From e5d6ac1c4122115c179fe620c8c8d6c04ed217fe Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 21 Jan 2023 20:26:51 -0500 Subject: [PATCH] d/jak2: second documentation PR and finish `forest-scenes` and `palace-scenes` (#2136) Also fixes #2135 Co-authored-by: water --- .vs/launch.vs.json | 2 +- decompiler/IR2/FormExpressionAnalysis.cpp | 2 +- decompiler/config/jak2/all-types.gc | 496 ++++++-- .../jak2/anonymous_function_types.jsonc | 10 + decompiler/config/jak2/label_types.jsonc | 4 + decompiler/config/jak2/stack_structures.jsonc | 3 +- decompiler/config/jak2/type_casts.jsonc | 3 +- decompiler/config/jak2/var_names.jsonc | 1080 ++++++++++++++++- goal_src/jak2/characters/ashelin/ash-shot.gc | 33 +- .../jak2/characters/ashelin/ash-states.gc | 46 +- goal_src/jak2/characters/ashelin/ash.gc | 31 +- goal_src/jak2/characters/sig/sig-shot.gc | 10 +- goal_src/jak2/characters/sig/sig-states.gc | 44 +- goal_src/jak2/characters/sig/sig.gc | 35 +- goal_src/jak2/engine/ai/enemy-h.gc | 62 +- goal_src/jak2/engine/ai/enemy.gc | 242 ++-- goal_src/jak2/engine/ambient/ambient-h.gc | 2 +- goal_src/jak2/engine/ambient/ambient.gc | 8 +- .../jak2/engine/collide/collide-shape-h.gc | 40 +- goal_src/jak2/engine/collide/collide-shape.gc | 12 +- .../jak2/engine/common_objs/dark-eco-pool.gc | 9 +- goal_src/jak2/engine/common_objs/elevator.gc | 2 +- .../jak2/engine/common_objs/projectile-h.gc | 11 +- .../jak2/engine/common_objs/projectile.gc | 10 +- .../jak2/engine/common_objs/water-anim.gc | 10 +- goal_src/jak2/engine/game/penetrate-h.gc | 35 +- goal_src/jak2/engine/level/level-h.gc | 29 +- goal_src/jak2/engine/level/level-info.gc | 310 ++--- goal_src/jak2/engine/nav/nav-enemy-h.gc | 4 +- goal_src/jak2/engine/nav/nav-enemy.gc | 151 ++- .../jak2/engine/target/gun/gun-blue-shot.gc | 4 +- .../jak2/engine/target/gun/gun-yellow-shot.gc | 4 +- .../engine/target/mech_suit/grunt-mech.gc | 42 +- .../jak2/engine/target/target-turret-shot.gc | 128 +- goal_src/jak2/engine/util/script.gc | 45 +- goal_src/jak2/levels/atoll/atoll-part.gc | 3 + goal_src/jak2/levels/atoll/juicer.gc | 109 +- goal_src/jak2/levels/atoll/sniper.gc | 81 +- goal_src/jak2/levels/city/common/vehicle.gc | 6 +- .../jak2/levels/city/farm/ctyfarma-part.gc | 2 + .../jak2/levels/city/farm/ctyfarmb-part.gc | 2 + goal_src/jak2/levels/city/farm/yakow.gc | 88 +- .../jak2/levels/city/oracle/oracle-scenes.gc | 6 +- .../jak2/levels/city/slums/kor/kid-states.gc | 18 +- goal_src/jak2/levels/city/slums/kor/kid.gc | 95 +- .../jak2/levels/city/slums/kor/kor-states.gc | 18 +- goal_src/jak2/levels/city/slums/kor/kor.gc | 91 +- goal_src/jak2/levels/common/ai/bot-states.gc | 4 +- goal_src/jak2/levels/common/ai/bot.gc | 40 +- .../common/enemy/amphibian/amphibian.gc | 45 +- .../enemy/baby_spider/tomb-baby-spider.gc | 16 +- .../jak2/levels/common/enemy/fodder/fodder.gc | 172 +-- .../enemy/guards/crimson-guard-level.gc | 113 +- goal_src/jak2/levels/common/enemy/hopper.gc | 26 +- .../enemy/metalhead_bearer/centurion.gc | 47 +- .../common/enemy/metalhead_brown/metalmonk.gc | 34 +- .../enemy/metalhead_slinger/grenadier.gc | 38 +- goal_src/jak2/levels/common/enemy/spyder.gc | 115 +- .../common/entities/fort-floor-spike.gc | 14 +- .../levels/common/entities/sew-gunturret.gc | 389 +++--- .../jak2/levels/common/entities/spydroid.gc | 32 +- goal_src/jak2/levels/common/flitter.gc | 21 +- goal_src/jak2/levels/common/grunt.gc | 34 +- .../jak2/levels/common/guard-projectile.gc | 14 +- .../levels/common/metalhead-projectile.gc | 10 +- goal_src/jak2/levels/dig/dig-digger.gc | 4 +- goal_src/jak2/levels/dig/dig-part.gc | 7 +- goal_src/jak2/levels/dig/dig3-obs.gc | 2 +- .../jak2/levels/drill_platform/drill-part2.gc | 1 + goal_src/jak2/levels/drill_platform/ginsu.gc | 28 +- goal_src/jak2/levels/forest/pegasus.gc | 995 ++++++++------- goal_src/jak2/levels/forest/predator.gc | 45 +- .../ammo_dump/fort-robotank-turret.gc | 6 +- .../levels/fortress/exit/forexitb-part.gc | 2 + goal_src/jak2/levels/fortress/fort-turret.gc | 59 +- goal_src/jak2/levels/fortress/fortress-obs.gc | 126 +- .../jak2/levels/mars_tomb/monster-frog.gc | 32 +- goal_src/jak2/levels/mars_tomb/tomb-beetle.gc | 16 +- goal_src/jak2/levels/mars_tomb/tomb-obs.gc | 6 +- goal_src/jak2/levels/nest/flying-spider.gc | 44 +- goal_src/jak2/levels/nest/mammoth.gc | 24 +- goal_src/jak2/levels/nest/mantis.gc | 40 +- .../jak2/levels/palace/explore/palent-part.gc | 4 +- .../jak2/levels/palace/roof/palroof-part.gc | 4 +- .../jak2/levels/palace/shaft/palshaft-part.gc | 2 +- goal_src/jak2/levels/ruins/rapid-gunner.gc | 39 +- goal_src/jak2/levels/sewer/gator.gc | 337 ++--- goal_src/jak2/levels/sewer/sewer-obs.gc | 674 +++++----- goal_src/jak2/levels/sewer/sewer-obs2.gc | 1036 ++++++++-------- goal_src/jak2/levels/sewer/sewer-part.gc | 30 +- goal_src/jak2/levels/strip/strip-obs.gc | 8 +- .../jak2/levels/temple/canyon/mincan-obs.gc | 6 +- goal_src/jak2/levels/temple/mountain-obs.gc | 6 +- goal_src/jak2/levels/temple/mountain-obs2.gc | 146 +-- goal_src/jak2/levels/temple/mountain-part.gc | 17 +- .../jak2/levels/temple/mountain-scenes.gc | 284 ++--- goal_src/jak2/levels/temple/rhino.gc | 39 +- goal_src/jak2/levels/undefined/hal.gc | 12 +- .../jak2/characters/ashelin/ash-shot_REF.gc | 562 +++++++++ .../jak2/characters/ashelin/ash-states_REF.gc | 44 +- .../jak2/characters/ashelin/ash_REF.gc | 94 +- .../jak2/characters/sig/sig-shot_REF.gc | 7 +- .../jak2/characters/sig/sig-states_REF.gc | 48 +- .../reference/jak2/characters/sig/sig_REF.gc | 102 +- .../reference/jak2/engine/ai/enemy-h_REF.gc | 58 +- .../reference/jak2/engine/ai/enemy_REF.gc | 242 ++-- .../jak2/engine/ambient/ambient-h_REF.gc | 2 +- .../jak2/engine/ambient/ambient_REF.gc | 8 +- .../engine/collide/collide-shape-h_REF.gc | 2 +- .../jak2/engine/collide/collide-shape_REF.gc | 12 +- .../engine/common_objs/dark-eco-pool_REF.gc | 6 +- .../engine/common_objs/projectile-h_REF.gc | 4 +- .../jak2/engine/common_objs/projectile_REF.gc | 11 +- .../jak2/engine/common_objs/water-anim_REF.gc | 10 +- .../jak2/engine/game/effect-control_REF.gc | 4 - .../reference/jak2/engine/game/main_REF.gc | 21 +- .../jak2/engine/level/level-h_REF.gc | 2 +- .../jak2/engine/level/level-info_REF.gc | 310 ++--- .../jak2/engine/nav/nav-enemy-h_REF.gc | 4 +- .../jak2/engine/nav/nav-enemy_REF.gc | 155 +-- .../engine/target/gun/gun-blue-shot_REF.gc | 4 +- .../engine/target/gun/gun-yellow-shot_REF.gc | 4 +- .../engine/target/mech_suit/grunt-mech_REF.gc | 46 +- .../engine/target/target-turret-shot_REF.gc | 129 +- .../jak2/levels/atoll/atoll-part_REF.gc | 3 + .../reference/jak2/levels/atoll/juicer_REF.gc | 109 +- .../reference/jak2/levels/atoll/sniper_REF.gc | 81 +- .../jak2/levels/city/common/vehicle_REF.gc | 2 +- .../levels/city/farm/ctyfarma-part_REF.gc | 6 +- .../levels/city/farm/ctyfarmb-part_REF.gc | 6 +- .../jak2/levels/city/farm/yakow_REF.gc | 88 +- .../levels/city/oracle/oracle-scenes_REF.gc | 6 +- .../levels/city/slums/kor/kid-states_REF.gc | 22 +- .../jak2/levels/city/slums/kor/kid_REF.gc | 95 +- .../levels/city/slums/kor/kor-states_REF.gc | 22 +- .../jak2/levels/city/slums/kor/kor_REF.gc | 91 +- .../jak2/levels/common/ai/bot-states_REF.gc | 8 +- .../jak2/levels/common/ai/bot_REF.gc | 38 +- .../common/enemy/amphibian/amphibian_REF.gc | 75 +- .../enemy/baby_spider/tomb-baby-spider_REF.gc | 46 +- .../levels/common/enemy/fodder/fodder_REF.gc | 202 +-- .../enemy/guards/crimson-guard-level_REF.gc | 448 ++++++- .../jak2/levels/common/enemy/hopper_REF.gc | 91 +- .../enemy/metalhead_bearer/centurion_REF.gc | 115 +- .../enemy/metalhead_brown/metalmonk_REF.gc | 101 +- .../enemy/metalhead_slinger/grenadier_REF.gc | 105 +- .../jak2/levels/common/enemy/spyder_REF.gc | 116 +- .../common/entities/fort-floor-spike_REF.gc | 14 +- .../common/entities/sew-gunturret_REF.gc | 389 +++--- .../levels/common/entities/spydroid_REF.gc | 32 +- .../jak2/levels/common/flitter_REF.gc | 51 +- .../reference/jak2/levels/common/grunt_REF.gc | 101 +- .../levels/common/guard-projectile_REF.gc | 16 +- .../levels/common/metalhead-projectile_REF.gc | 11 +- .../jak2/levels/dig/dig-digger_REF.gc | 4 +- .../reference/jak2/levels/dig/dig-part_REF.gc | 11 +- .../reference/jak2/levels/dig/dig3-obs_REF.gc | 2 +- .../levels/drill_platform/drill-part2_REF.gc | 5 +- .../jak2/levels/drill_platform/ginsu_REF.gc | 58 +- .../jak2/levels/forest/pegasus_REF.gc | 995 ++++++++------- .../jak2/levels/forest/predator_REF.gc | 112 +- .../ammo_dump/fort-robotank-turret_REF.gc | 7 +- .../fortress/ammo_dump/fortress-scenes_REF.gc | 293 +++++ .../levels/fortress/exit/forexitb-part_REF.gc | 6 +- .../jak2/levels/fortress/fort-turret_REF.gc | 50 +- .../jak2/levels/fortress/fortress-obs_REF.gc | 126 +- .../jak2/levels/mars_tomb/monster-frog_REF.gc | 62 +- .../jak2/levels/mars_tomb/tomb-obs_REF.gc | 6 +- .../jak2/levels/nest/flying-spider_REF.gc | 44 +- .../reference/jak2/levels/nest/mammoth_REF.gc | 24 +- .../reference/jak2/levels/nest/mantis_REF.gc | 40 +- .../levels/palace/explore/palent-part_REF.gc | 4 +- .../levels/palace/roof/palroof-part_REF.gc | 4 +- .../levels/palace/shaft/palshaft-part_REF.gc | 2 +- .../palace/throne_room/palace-scenes_REF.gc | 763 ++++++++++++ .../jak2/levels/ruins/rapid-gunner_REF.gc | 106 +- .../reference/jak2/levels/sewer/gator_REF.gc | 337 ++--- .../jak2/levels/sewer/sewer-obs2_REF.gc | 1036 ++++++++-------- .../jak2/levels/sewer/sewer-obs_REF.gc | 690 ++++++----- .../jak2/levels/sewer/sewer-part_REF.gc | 34 +- .../jak2/levels/strip/strip-obs_REF.gc | 9 +- .../levels/temple/canyon/mincan-obs_REF.gc | 6 +- .../jak2/levels/temple/mountain-obs2_REF.gc | 146 +-- .../jak2/levels/temple/mountain-obs_REF.gc | 6 +- .../jak2/levels/temple/mountain-part_REF.gc | 21 +- .../jak2/levels/temple/mountain-scenes_REF.gc | 284 ++--- .../reference/jak2/levels/temple/rhino_REF.gc | 103 +- test/offline/framework/orchestration.cpp | 2 +- 188 files changed, 11964 insertions(+), 6538 deletions(-) create mode 100644 test/decompiler/reference/jak2/characters/ashelin/ash-shot_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/fortress/ammo_dump/fortress-scenes_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/palace/throne_room/palace-scenes_REF.gc diff --git a/.vs/launch.vs.json b/.vs/launch.vs.json index a224c917b9..f246bd606d 100644 --- a/.vs/launch.vs.json +++ b/.vs/launch.vs.json @@ -96,7 +96,7 @@ "--game", "jak2", "--file", - "fort-turret" + "nav-enemy" ] }, { diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index fc4d059e49..db932c0722 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -200,7 +200,7 @@ Form* try_cast_simplify(Form* in, auto g = dynamic_cast(in->try_as_single_element()); if (g && g->op().kind() == GenericOperator::Kind::FUNCTION_EXPR) { auto f = dynamic_cast(g->op().func()->try_as_single_element()); - if (f->expr().is_identity() && f->expr().get_arg(0).is_sym_val()) { + if (f && f->expr().is_identity() && f->expr().get_arg(0).is_sym_val()) { auto& func_name = f->expr().get_arg(0).get_str(); if (func_name == "rand-vu-int-range" || func_name == "nav-enemy-rnd-int-range") { std::vector new_forms; diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 681d9898e9..10b8dac194 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -5778,6 +5778,32 @@ (ten 10) ) +;; +++level-h:bigmap-id +(defenum bigmap-id + :type uint32 + (bigmap-id-0 0) + (bigmap-id-1 1) + (bigmap-id-2 2) + (bigmap-id-3 3) + (bigmap-id-4 4) + (bigmap-id-5 5) + (bigmap-id-6 6) + (bigmap-id-7 7) + (bigmap-id-8 8) + (bigmap-id-9 9) + (bigmap-id-10 10) + (bigmap-id-11 11) + (bigmap-id-12 12) + (bigmap-id-13 13) + (sewer-default 14) + (sewer-with-board-area 15) + (bigmap-id-16 16) + (bigmap-id-17 17) + (bigmap-id-18 18) + (bigmap-id-19 19) + (bigmap-id-20 20)) +;; ---level-h:bigmap-id + (deftype level-load-info (basic) ((name-list symbol 6 :offset-assert 4 :score -1) (index int16 :offset-assert 28) @@ -5834,7 +5860,7 @@ (draw-priority float :offset-assert 224) (level-flags uint32 :offset-assert 228) (fog-height float :offset-assert 232) - (bigmap-id uint32 :offset-assert 236) + (bigmap-id bigmap-id :offset-assert 236) (ocean-near-translucent? symbol :offset-assert 240) (ocean-far? symbol :offset-assert 244) (mood-range mood-range :inline :offset-assert 256) @@ -7452,7 +7478,7 @@ (get-trail-for-connection "Get a trail for connection. If arg1 is set, allow allocating a new one." (_type_ connection-minimap symbol) minimap-trail 10) (get-icon-draw-pos "Follow the path from the start until it reaches the border of the map, then get this position." (_type_ connection-minimap minimap-trail vector float vector) symbol 11) - (add-icon! "Add an icon to the map!" (_type_ process uint int vector int) connection-minimap 12) ;; int can be #f / vector can be a symbol + (add-icon! "Add an icon to the map!" (_type_ process uint int vector int) connection-minimap 12) ;; int can be #f / vector can be a symbol or entity-actor (free-trail-by-connection "Free the trail associated with this connection." (_type_ connection-minimap) none 13) (update-trails "Main function to do trail search per-frame" (_type_) none 14) (draw-1 (_type_ dma-buffer vector4w symbol) none 15) ;; hud sprite 1 draw @@ -12925,7 +12951,7 @@ (sub-task-list (array game-task-node-info) :offset-assert 252) (mission-list (array game-task-node-info) :offset-assert 256) (task-counter uint32 :offset-assert 260) - (unknown-pad6 (array uint16) :offset-assert 264) + (unknown-pad6 (array uint16) :offset-assert 264) ;; TODO - speech related (level-opened uint8 32 :offset-assert 268) (total-deaths int32 :offset-assert 300) (continue-deaths int32 :offset-assert 304) @@ -13187,7 +13213,10 @@ :flag-assert #xe00000018 (:methods (talker-speech-class-method-9 (_type_) symbol 9) - (talker-speech-class-method-10 (_type_) none 10) + (play-communicator-speech! + "Plays the provided [[talker-speech-class]] + @TODO - understand the array from [[game-info]] better" + (_type_) none 10) (talker-speech-class-method-11 (_type_) none 11) (talker-speech-class-method-12 (_type_ int) none 12) (talker-speech-class-method-13 (_type_ int) none 13) @@ -14846,6 +14875,7 @@ ;; penetrate-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++penetrate-h:penetrate (defenum penetrate :bitfield #t :type uint64 @@ -14882,7 +14912,39 @@ (eco-blue 30) ;; hi 16384 (eco-green 31) ;; hi 32768 (knocked 32) ;; hihi 1 + (penetrate-33 33) + (penetrate-34 34) + (penetrate-35 35) + (penetrate-36 36) + (penetrate-37 37) + (penetrate-38 38) + (penetrate-39 39) + (penetrate-40 40) + (penetrate-41 41) + (penetrate-42 42) + (penetrate-43 43) + (penetrate-44 44) + (penetrate-45 45) + (penetrate-46 46) + (penetrate-47 47) + (penetrate-48 48) + (penetrate-49 49) + (penetrate-50 50) + (penetrate-51 51) + (penetrate-52 52) + (penetrate-53 53) + (penetrate-54 54) + (penetrate-55 55) + (penetrate-56 56) + (penetrate-57 57) + (penetrate-58 58) + (penetrate-59 59) + (penetrate-60 60) + (penetrate-61 61) + (penetrate-62 62) + (penetrate-63 63) ) +;; ---penetrate-h:penetrate (define-extern penetrate-using->damage (function penetrate int)) (define-extern penetrated-by-all&hit-points->penetrated-by (function penetrate int penetrate)) @@ -16336,7 +16398,9 @@ (set-collide-as! (_type_ collide-spec) none 48) (modify-collide-as! (_type_ int collide-spec collide-spec) none 49) (send-shoves (_type_ process touching-shapes-entry float float float) symbol 50) - (above-ground? (_type_ collide-query vector object float float float) symbol 51) + (above-ground? + "@returns if we are above ground or not" + (_type_ collide-query vector collide-spec float float float) symbol 51) (water-info-init! "Initialize a [[water-info]] with the currently loaded regions." (_type_ water-info collide-action) water-info 52) @@ -18022,11 +18086,11 @@ (_type_) none 25) (spawn-shell-particles "TODO - confirm" (_type_) none 26) (unknown-particles "TODO - confirm" (_type_) none 27) - (play-impact-sound (_type_ projectile-options) sound-id 28) + (play-impact-sound (_type_ projectile-options) none 28) (stop-sound! "Stops the current `sound-id` if set, re-init the `sound-id` after being stopped" (_type_) none 29) - (init-collision! + (init-proj-collision! "Init the [[projectile]]'s [[collide-shape]]" (_type_) none 30) (init-proj-settings! @@ -23211,7 +23275,7 @@ "Last arg can by a symbol with value [[#t]], in which case it will pull `trans` [[vector]] off the current [[process-drawable]] otherwise, an explicit [[vector]] can be provided" (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) -(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id :behavior process-drawable)) +(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id :behavior process-drawable)) ;; vector or symbol for final arg? (define-extern sound-pause (function sound-id int)) (define-extern sound-stop (function sound-id int)) (define-extern sound-continue (function sound-id int)) @@ -32264,7 +32328,7 @@ "Set a [[water-anim]]'s `trans` as specified by the [[vector]] and update `water-height`." (_type_ vector) int 22) (get-ripple-height (_type_ vector) float 23) - (art-init! "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." (_type_) none 24) + (init-water! "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" (_type_) none 24) (reset-root! "Reset a [[water-anim]]'s `root`." (_type_) trsqv 25) (water-anim-init! "Initialize a [[water-anim]]." (_type_) none 26) (water-anim-method-27 "Empty." (_type_) none 27) @@ -32425,7 +32489,7 @@ (enemy-aware-1 1) (enemy-aware-2 2) (enemy-aware-3 3) - (enemy-aware-4 4) + (unaware 4) ) ;; ---enemy-h:enemy-aware @@ -32476,8 +32540,8 @@ (default-hit-points int32 :offset-assert 156) (gnd-collide-with collide-spec :offset-assert 160) (overlaps-others-collide-with-filter collide-spec :offset-assert 164) - (penetrate-flinch uint64 :offset-assert 168) - (penetrate-knocked uint64 :offset-assert 176) + (penetrate-flinch penetrate :offset-assert 168) + (penetrate-knocked penetrate :offset-assert 176) (movement-gravity meters :offset-assert 184) (friction float :offset-assert 188) (slip-factor float :offset-assert 192) @@ -32577,7 +32641,7 @@ (knocked-type-1 1) (knocked-type-2 2) (knocked-type-3 3) - (knocked-type-4 4) + (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) @@ -32625,14 +32689,14 @@ (penetrated-by-all penetrate :offset-assert 256) (penetrated-flinch penetrate :offset-assert 264) (penetrated-knocked penetrate :offset-assert 272) - (reaction-time uint64 :offset-assert 280) - (notice-time uint64 :offset-assert 288) - (state-timeout uint64 :offset-assert 296) - (auto-reset-penetrate-time uint64 :offset-assert 304) - (hit-focus-time uint64 :offset-assert 312) - (last-draw-time uint64 :offset-assert 320) - (starting-time uint64 :offset-assert 328) - (fated-time uint64 :offset-assert 336) + (reaction-time time-frame :offset-assert 280) + (notice-time time-frame :offset-assert 288) + (state-timeout time-frame :offset-assert 296) + (auto-reset-penetrate-time time-frame :offset-assert 304) + (hit-focus-time time-frame :offset-assert 312) + (last-draw-time time-frame :offset-assert 320) + (starting-time time-frame :offset-assert 328) + (fated-time time-frame :offset-assert 336) (focus-pos vector :inline :offset-assert 352) (event-param-point vector :inline :offset-assert 368) (jump-dest vector :inline :offset 368) @@ -32682,17 +32746,31 @@ "TODO" (_type_ process-focusable) symbol 53) (enemy-method-54 (_type_) enemy-flag 54) - (enemy-method-55 (_type_) none 55) - (enemy-method-56 (_type_ process event-message-block) int 56) - (enemy-method-57 (_type_ process-focusable enemy-best-focus) enemy-aware 57) + (track-target! + "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" + (_type_) none 55) + (damage-amount-from-attack + "@returns the amount of damage taken from an attack. This can come straight off the [[attack-info]] or via [[penetrate-using->damage]]" + (_type_ process event-message-block) int 56) + (update-target-awareness! + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! + @TODO - flesh out docs + @returns the value that sets `aware`" + (_type_ process-focusable enemy-best-focus) enemy-aware 57) (enemy-method-58 (_type_ process event-message-block) symbol 58) - (enemy-method-59 (_type_) penetrate 59) + (get-penetrate-info + "@returns the allowed way(s) this enemy can take damage + @see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + (_type_) penetrate 59) (coin-flip? "@returns The result of a 50/50 RNG roll" (_type_) symbol 60) (enemy-method-61 (_type_ int) int :behavior enemy 61) (enemy-method-62 (_type_) none 62) - (enemy-method-63 (_type_ process-focusable symbol) symbol 63) + (enemy-method-63 (_type_ process-focusable enemy-aware) symbol 63) (enemy-method-64 (_type_) none 64) (enemy-method-65 (_type_) none 65) (go-ambush (_type_) none 66) @@ -32701,9 +32779,16 @@ (go-directed (_type_) none 69) (go-hostile (_type_) none 70) (go-flee (_type_) none 71) - (enemy-method-72 (_type_) none 72) - (enemy-method-73 (_type_) none 73) - (enemy-method-74 (_type_ process object symbol event-message-block) object 74) + (react-to-focus + "@TODO - flesh out docs" + (_type_) none 72) + (kill-prefer-falling + "If available in `enemy-info`, [[go]] to the [[die-falling]] state, if not, [[die]]" + (_type_) none 73) + (general-event-handler + "Handles various events for the enemy + @TODO - unsure if there is a pattern for the events and this should have a more specific name" + (_type_ process int symbol event-message-block) object 74) (enemy-method-75 (_type_ process touching-shapes-entry) none 75) (enemy-method-76 (_type_ process event-message-block) symbol 76) (enemy-method-77 (_type_ (pointer float)) symbol 77) @@ -32730,7 +32815,13 @@ (enemy-method-95 (_type_ vector float) symbol 95) (enemy-method-96 (_type_ float symbol) symbol 96) (enemy-method-97 (_type_) process 97) - (enemy-method-98 (_type_ process-focusable vector) symbol 98) + (in-aggro-range? + "Should the enemy activate. + - if `activate-distance` is `0.0`, always true + - otherwise, check if the provided process is close enough + @param proc The process used to distance check + @returns true/false" + (_type_ process-focusable vector) symbol 98) (enemy-method-99 (_type_ process-focusable) symbol 99) (enemy-method-100 (_type_) symbol 100) (enemy-method-101 (_type_) none 101) @@ -32739,15 +32830,31 @@ (enemy-method-104 (_type_ process uint 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) - (enemy-method-107 (_type_) process-focusable 107) + (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-109 (_type_ int) none 109) - (enemy-method-110 (_type_) none 110) + (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" + (_type_ enemy-flag) none 109) + (stop-looking-at-target! + "Will unset [[enemy-flag::death-start]] and [[enemy-flag::lock-focus]] and call [[joint-mod::shut-down]] if applicable" + (_type_) none 110) (enemy-method-111 (_type_) none :behavior enemy 111) - (enemy-method-112 (_type_ enemy-info) none 112) - (enemy-method-113 (_type_ enemy-info) none 113) - (enemy-method-114 "@abstract" (_type_) none 114) - (enemy-method-115 "@abstract" (_type_) none 115) + (set-enemy-info! + "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it + @param info Set `enemy-info` accordingly" + (_type_ enemy-info) none 112) + (init-enemy-behaviour-and-stats! + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" + (_type_ enemy-info) none 113) + (init-enemy-collision! + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (_type_) none 114) + (init-enemy! + "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 "@returns the result of calling [[rand-vu]]" @@ -32776,13 +32883,18 @@ (enemy-method-123 "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) - (enemy-method-126 (_type_ collide-query vector collide-spec float float float) symbol 126) + (enemy-above-ground? + "@returns if the enemy is above the ground or not + @see [[above-ground?]]" + (_type_ collide-query vector collide-spec float float float) symbol 126) (enemy-method-127 (_type_ float float symbol collide-spec) symbol 127) (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) - (enemy-method-132 (_type_) none 132) + (dispose! + "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) (enemy-method-135 (_type_ int) sound-id 135) @@ -32854,8 +32966,13 @@ :size-assert #x25c :flag-assert #xb201e0025c (:methods - (enemy-method-112 (_type_ nav-enemy-info) float :replace 112) - (enemy-method-113 (_type_ nav-enemy-info) none :replace 113) + (set-enemy-info! + "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it + @param info Set `enemy-info` accordingly" + (_type_ nav-enemy-info) none :replace 112) + (init-enemy-behaviour-and-stats! + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" + (_type_ nav-enemy-info) none :replace 113) (taunt () _type_ :state 137) (pacing () _type_ :state 138) (circling () _type_ :state 139) @@ -33589,7 +33706,7 @@ (elevator-flags-13) (elevator-flags-14) (elevator-flags-15) - (elevator-flags-16) + (airlock-opened) (elevator-flags-17) ) ;; ---elevator:elevator-flags @@ -34391,7 +34508,9 @@ (wait-for-focus () _type_ :state 182) (spin-attack () _type_ :state 183) (grunt-method-184 (_type_ float) process-focusable 184) - (grunt-method-185 (_type_) nav-enemy-info 185) + (get-enemy-info + "@returns the [[nav-enemy-info]] associated with this type of grunt" + (_type_) nav-enemy-info 185) ) ) @@ -35999,13 +36118,29 @@ (current-path int32 :offset 972) (num-paths int32 :offset 976) (display-path int32 :offset 980) - (targetted-timer uint64 :offset 984) + (targetted-timer time-frame :offset 984) ) :method-count-assert 138 :size-assert #x3e0 :flag-assert #x8a036003e0 (:methods - (pegasus-method-137 (_type_) none 137) + (run-logic? + "Calls [[process-tree::12]] if we are considered in-range of the [[pegasus]], otherwise returns [[#t]]" + (_type_) symbol :replace 12) + (damage-amount-from-attack + "Only attacks from the jetboard will deal max damage (6), but by default it will return `1`. + This is why the scouts are technically killable by other means + @returns the amount of damage taken from an attack. Also updates the `targetted-timer`. + @see [[*pegasus-enemy-info*]]" + (_type_ process event-message-block) int :replace 56) + (update-target-awareness! + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! + For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targetted for more than 5 [[seconds]] + @returns the value from [[enemy::57]], otherwise [[enemy-aware::4]]" + (_type_ process-focusable enemy-best-focus) enemy-aware :replace 57) + (track-how-long-aimed-at! + "Updates `targetted-timer` with the `frame-counter` while Jak is aiming at the [[pegasus]]" + (_type_) none 137) ) (:states pegasus-debug @@ -36013,15 +36148,68 @@ ) (define-extern *pegasus-enemy-info* enemy-info) -(define-extern pegasus-draw-section (function float float rgba none :behavior pegasus)) -(define-extern pegasus-show-runs (function symbol :behavior pegasus)) -(define-extern pegasus-rotate (function symbol float none :behavior pegasus)) -(define-extern pegasus-loop-on-same-path (function none :behavior pegasus)) -(define-extern pegasus-choose-path (function symbol :behavior pegasus)) -(define-extern pegasus-move (function float symbol symbol none :behavior pegasus)) -(define-extern pegasus-calc-speed (function float float float float symbol :behavior pegasus)) -(define-extern pegasus-calc-anim-speed (function float :behavior pegasus)) -(define-extern pegasus-fly-code (function int none :behavior pegasus)) +(define-extern pegasus-draw-section + "Draws the [[pegasus]] curve section between the two provided points. + @param path-percent-a Percentage along the path for the first point + @param path-percent-b Percentage along the path for the second point + param color The color to draw the curve with + @see [[curve-control]]" + (function float float rgba none :behavior pegasus)) +(define-extern pegasus-show-runs + "When [[*display-path-marks*]] is enabled, allow the user to cycle through the displayed path + - Pressing [[up]] on the D-Pad will increment the path index + - Pressing [[down]] on the D-Pad will decrement the path index + Additional debug text will be displayed as well. This is useful as many paths overlap other paths" + (function none :behavior pegasus)) +(define-extern pegasus-rotate + "Rotates the [[pegasus]] along the path, factoring in the current speed and the target's position + @param influenced-by-target? Whether or not to care about [[target]]'s position + @param angle The hopeful angle to use when constructing the rotation matrix, ultimately limited to `0.25` (radians?) though + @see [[target-pos]] and [[matrix-from-two-vectors-max-angle-partial!]] + @TODO - `float` should be `degrees` -- The usual amount passed in is `(degrees 100.0835)`" + (function symbol float none :behavior pegasus)) +(define-extern pegasus-loop-on-same-path + "Creates an endless loop on the same path as the name suggests + - If we are beyond the end of the path, start again near the beginning (1%) + - If we are far before the beginning, start at the beginning (0%) + - If we are atleast 1% into the path, step back 1% + - If we are less than 0% somehow, slowly add 1% + Ultimately this appears to be some sort of safe-guard to get things back into a somewhat working state + if there are unexpected path conditions -- but the results of this are not great! + Another potential explaination is to make it easy during development to identify and debug a bad path + In practice, this is never called" + (function none :behavior pegasus)) +(define-extern pegasus-choose-path + "Determines the next path the pegasus should take if we have completed the current path it's on + There are many fail-safes here if something goes wrong to try to keep the pegasus behaving + @see [[pegasus-look-on-same-path]] + @TODO - understand the path selection better" + (function symbol :behavior pegasus)) +(define-extern pegasus-move + "Moves the pegasus along the path by smoothly interpolating along it + @param explicit-y-vel Normally `0.0` but this value is used when the pegasus needs to switch direction + @param adjust-y-offset? Normally [[#f]] which forces the movement to reflect the result of the collison query - the [[pegasus]] will stay close to the ground. [[#t]] ignores this" + (function float symbol none :behavior pegasus)) +(define-extern pegasus-calc-speed + "Calculates the pegasus' speed based on a number of factors: + - Speed up as the target gets closer (up to a max) and slow down as the target is further away (up to a min) + This function also is what causes the pegasus to flip around + @param min-dist TODO + @param max-dist TODO + @param max-speed The maximum speed the pegasus can go + @param min-speed The minimum speed the pegasus can go + @returns If there should be a reaction to the target via [[enemy::72]]" + (function float float float float symbol :behavior pegasus)) +(define-extern pegasus-calc-anim-speed + "Based on `speed`, adjust how fast the pegasus should animate. + The faster it's moving the fast it flaps it's wings, etc + @TODO understand the magic values here better + @returns The anim speed, it can be no lower than `1.5`" + (function float :behavior pegasus)) +(define-extern pegasus-fly-code + "Handles the flying animations and sounds + @TODO - cleanup a bit more" + (function int none :behavior pegasus)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; wren ;; @@ -36889,7 +37077,9 @@ :flag-assert #x10003000b0 ) -(define-extern check-drop-level-dig-lava-bloops (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-drop-level-dig-lava-bloops + "Ensure the lava bloop splats where it originated" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-tube ;; @@ -36997,8 +37187,12 @@ :flag-assert #x10003000b0 ) -(define-extern check-drop-level-forexitb-drop-userdata (function sparticle-system sparticle-cpuinfo matrix none)) -(define-extern check-drop-level-forexitb-drop-water-userdata (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-drop-level-forexitb-drop-userdata + "Ensure water pipe spray at the end of fortress does not go below the provided value, render splash when it reaches" + (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-drop-level-forexitb-drop-water-userdata + "Ensure water pipe drip at the end of fortress does not go below the provided value, render splash when it reaches" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-turret-shot ;; @@ -37225,7 +37419,9 @@ ;; drill-part2 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define-extern check-drop-level-drill-drillbit-rubble-sparks (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-drop-level-drill-drillbit-rubble-sparks + "Ensure the rubble spark particle effects don't go below a predefined y value, draw splat effect when they do" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drill-mech-master ;; @@ -38282,7 +38478,7 @@ (time-flip float :offset-assert 368) (disable-track-under basic :offset-assert 372) (dest-angle float :offset-assert 376) - (on-shake basic :offset-assert 380) + (on-shake symbol :offset-assert 380) (hint-count float :offset-assert 384) ) :method-count-assert 37 @@ -38378,7 +38574,9 @@ :flag-assert #x10003000b0 ) -(define-extern check-drop-level-mountain-drop-userdata (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-drop-level-mountain-drop-userdata + "Ensure the waterfall drops don't go below the specified y-value" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; hopper ;; @@ -39773,8 +39971,12 @@ :flag-assert #x10003000b0 ) -(define-extern birth-func-ctyfarma-drip (function int sparticle-cpuinfo sparticle-launchinfo none)) -(define-extern check-drop-level-ctyfarma-drop-userdata (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern birth-func-ctyfarma-drip + "Create a new dirt drip, don't go below the ocean or the ground" + (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern check-drop-level-ctyfarma-drop-userdata + "Ensure water drop particle effects don't go below the provided y-value, render the splash" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ctyfarmb-part ;; @@ -39787,8 +39989,12 @@ :flag-assert #x10003000b0 ) -(define-extern birth-func-ctyfarmb-drip (function int sparticle-cpuinfo sparticle-launchinfo none)) -(define-extern check-drop-level-ctyfarmb-drop-userdata (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern birth-func-ctyfarmb-drip + "Create a new dirt drip, don't go below the ocean or the ground" + (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern check-drop-level-ctyfarmb-drop-userdata + "Ensure water drop particle effects don't go below the provided y-value, render the splash" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; yakow ;; @@ -40305,9 +40511,13 @@ :flag-assert #x10003000b0 ) -(define-extern birth-func-atoll-bird-wing (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) -(define-extern check-drop-level-atoll-drop (function sparticle-system sparticle-cpuinfo matrix none)) -(define-extern check-drop-level-atoll-drop-userdata (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern birth-func-atoll-bird-wing "@TODO - particle docs" (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) +(define-extern check-drop-level-atoll-drop + "Ensure water drop particle effects don't go below the ocean level, render the splash" + (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-drop-level-atoll-drop-userdata + "Ensure water drop particle effects don't go below the provided y-value, render the splash" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; atoll-obs ;; @@ -40479,7 +40689,7 @@ ((left-eye joint-mod :offset-assert 604) (right-eye joint-mod :offset-assert 608) (look-at-other handle :offset-assert 616) - (neck-away-from basic :offset-assert 624) + (neck-away-from symbol :offset-assert 624) (look-at-other-time time-frame :offset-assert 632) (pad-iuj1n23i1 uint32 3 :offset-assert 640) (slow-timer time-frame :offset-assert 656) @@ -40492,8 +40702,12 @@ :flag-assert #xb7024002c0 (:methods (fodder-method-178 (_type_) none 178) - (fodder-method-179 (_type_ vector) float 179) - (fodder-method-180 (_type_) symbol 180) + (look-at-position! + "Adjusts the eyes to look at particular position, or the focused target + @param position If this is provided, it will be used with [[joint-mod::target-set!]] to adjust the eyes, otherwise the `focus` position is used + @return TODO - unsure what the return value is, but it seems to make the eyes more lazy" + (_type_ vector) float 179) + (fodder-method-180 "@TODO no idea, never seems to do anything because the actor-group-count is always 0" (_type_) symbol 180) (fodder-method-181 (_type_ symbol) none 181) (fodder-method-182 (_type_) float 182) ) @@ -40799,10 +41013,18 @@ :flag-assert #x10003000b0 ) -(define-extern sewer-drop-birth-func (function int sparticle-cpuinfo sparticle-launchinfo none)) -(define-extern check-drop-level-sewer-drop (function sparticle-system sparticle-cpuinfo matrix none)) -(define-extern sewer-drop2-birth-func (function int sparticle-cpuinfo sparticle-launchinfo none)) -(define-extern check-drop2-level-sewer-drop (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern sewer-drop-birth-func + "Resets the timer to birth a new water drop" + (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern check-drop-level-sewer-drop + "Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds" + (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern sewer-drop2-birth-func + "Resets the timer to birth a new water drop" + (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern check-drop2-level-sewer-drop + "Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds" + (function sparticle-system sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sewer-ocean ;; @@ -40823,8 +41045,8 @@ (deftype sew-blade (process-drawable) ((y-min float :offset-assert 200) (y-max float :offset-assert 204) - (snd-water uint128 :offset-assert 208) - (snd-no-water uint128 :offset-assert 224) + (snd-water sound-name :offset-assert 208) + (snd-no-water sound-name :offset-assert 224) (last-sound int32 :offset-assert 240) (attack-id uint32 :offset-assert 244) ) @@ -40832,7 +41054,9 @@ :size-assert #xf8 :flag-assert #x15008000f8 (:methods - (sew-blade-method-20 (_type_) none 20) + (update-sound! + "Updates the sound of the [[sew-blade]] based on if it's under or above the water" + (_type_) none 20) ) ) @@ -40905,8 +41129,13 @@ (:methods (idle () _type_ :state 20) (pressed () _type_ :state 21) - (sew-light-switch-method-22 (_type_) none 22) - (sew-light-switch-method-23 (_type_ symbol) none 23) + (init-switch-collision! + "Initializes the collision on the switch" + (_type_) none 22) + (broadcast-to-actors + "Broadcast event to all associated [[entity]]s via the `actor-group`s + @param `event-type` the symbol to broadcast" + (_type_ symbol) none 23) ) ) @@ -40921,14 +41150,31 @@ :flag-assert #x1100100090 (:methods (idle () _type_ :state 14) - (sew-light-control-method-15 (_type_ symbol symbol) float 15) - (sew-light-control-method-16 (_type_ object vector float) symbol 16) + (press! + "Turns the lights on (or off) + @param switched-on? Should the sewer lights be turned on or off? + @param should-turret-flash? Should the turret have it's `flash` set as well" + (_type_ symbol symbol) float 15) + (sew-light-control-method-16 + "@unused + @TODO - not done yet, no callers?" + (_type_ object vector float) symbol 16) ) ) -(define-extern sew-tri-blade-joint-callback (function draw-control cspace-array joint-control none)) -(define-extern sew-light-control-init-by-other (function entity-actor entity-actor none :behavior sew-light-control)) -(define-extern sewer-startup (function none)) +(define-extern sew-tri-blade-joint-callback + "Handles the rotation and transformation of the [[sew-tri-blade]]" + (function draw-control cspace-array joint-control none)) +(define-extern sew-light-control-init-by-other + "Creates a [[sew-light-control]] given two entities for the turret and switch itself + @param switch The entity for the switch + @param turret The entity for the turret" + (function entity-actor entity-actor none :behavior sew-light-control)) +(define-extern sewer-startup + "Basic house-keeping for starting the sewer area: + - sets up the bigmap + - spawns the first switch and turret" + (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sewer-obs2 ;; @@ -40941,7 +41187,10 @@ :size-assert #x174 :flag-assert #x3201000174 (:methods - (sew-elevator-method-49 (_type_ symbol) none 49) + (configure-collision + "Appropriately sets the collision on the elevator + @param collide-with-jak? If set, the elevator will collide with Jak" + (_type_ symbol) none 49) ) ) @@ -41017,7 +41266,9 @@ (:methods (idle () _type_ :state 20) (die () _type_ :state 21) - (sew-mine-method-22 (_type_) none 22) + (init-mine! + "Initializes the mine's particles and sets `last-time` to `0`" + (_type_) none 22) ) ) @@ -41047,9 +41298,9 @@ ((deadly-radius float :offset-assert 204) (prev-deadly-radius float :offset-assert 208) (attack-id uint32 :offset-assert 212) - (first-wall? basic :offset-assert 216) + (first-wall? symbol :offset-assert 216) (anim spool-anim :offset-assert 220) - (art-name basic :offset-assert 224) + (art-name string :offset-assert 224) ) :method-count-assert 30 :size-assert #xe4 @@ -41057,7 +41308,9 @@ (:methods (idle () _type_ :state 27) (hit (symbol) _type_ :state 28) - (sew-wall-method-29 (_type_) none 29) + (attack-target! + "If the target is close enough to the wall, hit it!" + (_type_) none 29) ) ) @@ -41086,9 +41339,15 @@ ) ) -(define-extern sew-mar-statue-debris-init-by-other (function none :behavior sew-mar-statue-debris)) -(define-extern sew-mar-statue-debris-b-init-by-other (function none :behavior sew-mar-statue-debris-b)) -(define-extern sew-mar-statue-event-handler (function process int symbol event-message-block object :behavior sew-mar-statue)) +(define-extern sew-mar-statue-debris-init-by-other + "Initializes a [[sew-mar-statue--debris]]" + (function none :behavior sew-mar-statue-debris)) +(define-extern sew-mar-statue-debris-b-init-by-other + "Initializes a [[sew-mar-statue--debris-b]]" + (function none :behavior sew-mar-statue-debris-b)) +(define-extern sew-mar-statue-event-handler + "Event handler for the [[sew-mar-statue]], normally hidden, but once `trigger`ed it will spawn the debris" + (function process int symbol event-message-block object :behavior sew-mar-statue)) (define-extern *sew-scare-grunt-nav-enemy-info* nav-enemy-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -41227,8 +41486,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype gator (nav-enemy) + "Cannot take damage due to it overriding [[enemy::56]]" ((ocean-y float :offset-assert 604) - (lock-nav-target basic :offset-assert 608) + (lock-nav-target symbol :offset-assert 608) (new-facing vector :inline :offset-assert 624) (old-facing vector :inline :offset-assert 640) (turn-time time-frame :offset-assert 656) @@ -41238,9 +41498,17 @@ :flag-assert #xb602200298 (:methods (attack-forward () _type_ :state 178) - (gator-method-179 (_type_) float 179) - (gator-method-180 (_type_ vector) vector 180) - (gator-method-181 (_type_ float float symbol) time-frame 181) + (adjust-depth! + "Changes the height based on the ocean depth + @see [[get-height]]" + (_type_) float 179) + (update-facing! + "Updates the `new-facing` vector" + (_type_ vector) vector 180) + (encircle-target! + "Core movement for the [[gator]], circles the target, charges at the target, etc + @params TODO - not sure, they all dont seem to do very much and this method is a mess" + (_type_ float float symbol) time-frame 181) ) ) @@ -41384,10 +41652,10 @@ (gun-tilt float :offset-assert 564) (desired-twist float :offset-assert 568) (desired-tilt float :offset-assert 572) - (los-clear basic :offset-assert 576) + (los-clear symbol :offset-assert 576) (smoke-part sparticle-launch-control :offset-assert 580) (casing-part sparticle-launch-control :offset-assert 584) - (flash-state basic :offset-assert 588) + (flash-state symbol :offset-assert 588) (can-shoot symbol :offset-assert 592) (last-hit-time time-frame :offset-assert 600) (init-mat matrix :inline :offset-assert 608) @@ -41397,11 +41665,21 @@ :size-assert #x2a4 :flag-assert #x8e023002a4 (:methods - (sew-gunturret-method-137 (_type_ symbol) none 137) - (sew-gunturret-method-138 (_type_) none 138) - (sew-gunturret-method-139 (_type_) none 139) - (sew-gunturret-method-140 (_type_ symbol) none 140) - (sew-gunturret-method-141 (_type_) none 141) + (aim-turret! + "Calculates the angle and tilt for the turret to either aim at the target, or it's default direction + @param aim-at-target? Whether or not the turret should aim at the target, will ignore the target if #f" + (_type_ symbol) none 137) + (update-collision! + "Updates the collision for the turret based on it's aiming direction" + (_type_) none 138) + (set-aim-at-default! + "Aims the turret at it's default direction. Sets `aim-pos` accordingly" + (_type_) none 139) + (fire-turret! + "Actually fires the turret, sets `flash-state` to [[#t]] + @param fire-sound? Whether to play the fire sound effect or not" + (_type_ symbol) none 140) + (init-turret-params! (_type_) none 141) ) ) @@ -41411,7 +41689,9 @@ :size-assert #x2a4 :flag-assert #x8e023002a4 (:methods - (pal-gun-turret-method-140 (_type_ symbol) float :replace 140) + (fire-turret! + "@overrides Calls [[sew-gunturret::140]] but also customizes the turret flash via [[set-palcab-turret-flash!]]" + (_type_ symbol) float :replace 140) ) ) @@ -41816,7 +42096,9 @@ ) ) -(define-extern check-drop-level-palace-roof-rain (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-drop-level-palace-roof-rain + "Ensure the rain on the palace roof doesn't go through the roof and displays the splash effect when it makes impact" + (function sparticle-system sparticle-cpuinfo matrix none)) (define-extern *metalkor-head-lightning-shock-skel* lightning-spec) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -43143,7 +43425,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern death-precursor death-info) -;; (define-extern start-precursor-effect (function object none)) +(define-extern start-precursor-effect (function object none)) (define-extern birth-func-pecker-feather-color (function sparticle-system sparticle-cpuinfo sparticle-launchinfo none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -43290,7 +43572,7 @@ (gun-tilt float :offset-assert 580) (desired-twist float :offset-assert 584) (desired-tilt float :offset-assert 588) - (los-clear basic :offset-assert 592) + (los-clear symbol :offset-assert 592) (flash-state basic :offset-assert 596) (flash-index uint32 :offset-assert 600) (can-shoot symbol :offset-assert 604) diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index 7c6eeb542c..1dbf3daaa9 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -917,5 +917,15 @@ [15, "(function object hal-help-kid symbol)"], [16, "(function hal-help-kid none)"], [17, "(function object hal-help-kid symbol)"] + ], + "palace-scenes": [ + [0, "(function none :behavior scene-player)"], + [1, "(function none :behavior scene-player)"], + [2, "(function none :behavior scene-player)"] + ], + "fortress-scenes": [ + [0, "(function none :behavior scene-player)"], + [1, "(function none :behavior scene-player)"], + [2, "(function none :behavior scene-player)"] ] } diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 3a13d4d352..b0c2d3b369 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -1152,5 +1152,9 @@ ["L85", "vector"], ["L84", "vector"], ["L83", "vector"] + ], + "fortress-scenes": [ + ["L60", "vector"], + ["L69", "sprite-vec-data-2d"] ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 26468f7b03..116bd011f4 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -1733,5 +1733,6 @@ "(method 74 kid)": [[16, "vector"]], "(trans idle vehicle-turret)": [[16, "vector"]], "(anon-function 9 hal3-course)": [[96, "transport-params"]], - "(method 17 turret-control)": [[16, "attack-info"]] + "(method 17 turret-control)": [[16, "attack-info"]], + "(code active lightning-tracker)": [[16, "vector"]] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 67c93b60e9..1382d49b03 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -7945,5 +7945,6 @@ "(anon-function 12 hal3-course)": [[13, "v1", "halt-wait-spot"]], "(anon-function 16 hal3-course)": [[32, "v1", "halt-wait-spot"]], "(anon-function 14 hal3-course)": [[32, "v1", "halt-wait-spot"]], - "(anon-function 17 hal3-course)": [[55, "v1", "task-manager"]] + "(anon-function 17 hal3-course)": [[55, "v1", "task-manager"]], + "title-plug-lightning": [[99, "v1", "title-control"]] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index b3d6e6d19d..cb8f896736 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -2286,7 +2286,9 @@ } }, "(code target-running-attack)": { - "vars": { "t1-6": ["t1-6", "sound-name"] } + "vars": { + "t1-6": ["t1-6", "sound-name"] + } }, "(method 9 bot-speech-list)": { "vars": { @@ -2927,7 +2929,7 @@ "s4-0": "proc-draw", "s3-1": "spike-quat", "s4-1": "touched-from-dir", - "a1-8": "response", + "a1-8": "evt", "v1-11": "attack-info", "v0-0": "frame-count" } @@ -2961,5 +2963,1079 @@ "vars": { "v1-0": "index" } + }, + "(anon-function 1 palace-scenes)": { + "vars": { + "f30-0": "frame-num" + } + }, + "(method 11 throne-throne)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-group", + "v1-8": "prim-mesh", + "v1-11": "root-prim" + } + }, + "(method 137 sew-gunturret)": { + "args": ["obj", "aim-at-target?"], + "vars": { + "a0-2": "target-proc", + "s5-4": "matrix" + } + }, + "(method 138 sew-gunturret)": { + "vars": { + "a0-2": "target-proc", + "a1-5": "cquery", + "v1-17": "_cquery" + } + }, + "(method 140 sew-gunturret)": { + "args": ["obj", "fire-sound?"], + "vars": { + "s4-0": "proj-params", + "s3-0": "temp-vec" + } + }, + "(exit hostile sew-gunturret)": { + "vars": { + "t9-0": "func" + } + }, + "(code hostile sew-gunturret)": { + "vars": { + "gp-1": "frame-counter", + "gp-2": "fire-sound?", + "s5-1": "frames", + "gp-3": "_frame-counter" + } + }, + "(trans stare sew-gunturret)": { + "vars": { + "t9-0": "func" + } + }, + "(method 74 sew-gunturret)": { + "vars": { + "a1-10": "evt", + "v1-17": "attack-info", + "a0-4": "game-info", + "a2-2": "id" + }, + "args": ["obj", "proc", "arg2", "event-type", "event"] + }, + "(enter die sew-gunturret)": { + "vars": { + "v1-3": "root-prim" + } + }, + "(code die sew-gunturret)": { + "vars": { + "gp-0": "exploder-tuning", + "gp-2": "vec", + "s5-2": "frame-counter", + "gp-3": "_frame-counter" + } + }, + "(method 114 sew-gunturret)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-group", + "v1-14": "prim-sphere", + "v1-16": "_prim-sphere", + "v1-19": "root-prim" + } + }, + "(method 98 sew-gunturret)": { + "vars": { + "f0-2": "dist" + }, + "args": ["obj", "proc"] + }, + "(method 141 sew-gunturret)": { + "vars": { + "s5-0": "turret-params" + } + }, + "(method 141 pal-gun-turret)": { + "vars": { + "s5-0": "turret-params" + } + }, + "(method 74 gator)": { + "args": ["obj", "proc", "arg2", "event-type", "event"] + }, + "(method 180 gator)": { + "vars": { + "a0-3": "matrix" + } + }, + "(method 55 gator)": { + "vars": { + "t9-0": "func" + } + }, + "(method 107 gator)": { + "vars": { + "gp-0": "enemy-target" + } + }, + "(method 98 gator)": { + "vars": { + "s4-0": "target-pos" + } + }, + "(trans hostile gator)": { + "vars": { + "t9-0": "func", + "a0-1": "enemy-target", + "a0-4": "nav-state", + "gp-1": "dir-to-target" + } + }, + "(code hostile gator)": { + "vars": { + "f30-0": "circle-for" + } + }, + "(enter attack-forward gator)": { + "vars": { + "v1-2": "_self", + "v1-5": "__self", + "v1-8": "nav-state", + "v1-12": "game-info", + "v0-0": "id" + } + }, + "(trans attack-forward gator)": { + "vars": { + "gp-0": "focus", + "v1-16": "nav", + "v1-18": "_nav", + "a1-2": "nav-state", + "gp-1": "velocity", + "v1-24": "_nav-state", + "a0-19": "__nav-state", + "v1-27": "target-pos" + } + }, + "(code attack-forward gator)": { + "vars": { + "a2-2": "nav-state", + "a1-4": "target-pos" + } + }, + "(code pacing gator)": { + "vars": { + "f30-0": "circle-for?" + } + }, + "(trans stare gator)": { + "vars": { + "t9-0": "func" + } + }, + "(code stare gator)": { + "vars": { + "f30-0": "circle-for?" + } + }, + "(method 114 gator)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-group", + "v1-13": "prim-sphere-1", + "v1-15": "prim-sphere-2", + "v1-17": "prim-sphere-3", + "v1-19": "prim-sphere-4", + "v1-21": "root-prim" + } + }, + "(method 115 gator)": { + "vars": { + "v1-5": "nav" + } + }, + "(method 43 sew-elevator)": { + "args": ["obj", "arg1", "point-a", "point-b"], + "vars": { + "v1-3": "elevator-pos", + "s4-0": "path-point-a", + "a0-3": "path-point-b" + } + }, + "(method 45 sew-elevator)": { + "vars": { + "gp-0": "target", + "a0-2": "target-proc", + "v1-1": "target-pos", + "gp-2": "dist-from-center" + } + }, + "(method 49 sew-elevator)": { + "vars": { + "v1-3": "prim-group" + }, + "args": ["obj", "collide-with-jak?"] + }, + "(enter running sew-elevator)": { + "vars": { + "t9-0": "func" + } + }, + "(post running sew-elevator)": { + "vars": { + "t9-0": "func" + } + }, + "(enter arrived sew-elevator)": { + "vars": { + "t9-0": "func" + } + }, + "(method 41 sew-elevator)": { + "vars": { + "t9-0": "func" + } + }, + "(method 31 sew-elevator)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-group", + "v1-15": "prim-mesh-1", + "v1-17": "prim-mesh-2", + "v1-20": "root-prim" + } + }, + "(enter turn sew-valve)": { + "vars": { + "gp-1": "data", + "v1-5": "group-idx", + "a0-4": "actor-idx", + "a1-5": "actor" + } + }, + "(method 11 sew-valve)": { + "vars": { + "s4-0": "cshape", + "v1-6": "prim-sphere", + "v1-9": "root-prim", + "v1-22": "data", + "sv-16": "tag-1", + "sv-32": "tag-2" + }, + "args": ["obj", "entity"] + }, + "sew-mar-statue-debris-init-by-other": { + "vars": { + "gp-0": "cshape", + "s5-0": "prim-group", + "v1-9": "prim-mesh-1", + "v1-11": "prim-mesh-2", + "v1-13": "prim-mesh-3", + "v1-16": "root-prim", + "gp-1": "parent-proc" + } + }, + "sew-mar-statue-debris-b-init-by-other": { + "vars": { + "gp-0": "parent-proc" + } + }, + "(enter hidden sew-mar-statue)": { + "vars": { + "v1-1": "root-prim" + } + }, + "(method 11 sew-mar-statue)": { + "vars": { + "s4-0": "cshape", + "v1-2": "prim-mesh", + "v1-5": "root-prim" + }, + "args": ["obj", "entity"] + }, + "(method 11 sew-grill)": { + "args": ["obj", "entity"] + }, + "(method 11 sew-wall)": { + "args": ["obj", "entity"], + "vars": { + "s3-0": "data", + "s5-0": "art-group", + "s2-0": "cshape", + "s1-0": "prim-group", + "v1-19": "prim-mesh-1", + "v1-21": "prim-mesh-2", + "v1-23": "prim-mesh-3", + "v1-25": "prim-mesh-4", + "v1-27": "prim-mesh-5", + "v1-30": "root-prim", + "s5-1": "channel", + "s4-1": "_art-group", + "v1-51": "game-info", + "a0-43": "id" + } + }, + "(method 11 sew-mine-b)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-mesh", + "v1-11": "root-prim", + "a0-11": "_entity" + } + }, + "(method 11 sew-mine-a)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-mesh", + "v1-11": "root-prim" + } + }, + "(method 11 sew-catwalk)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-group", + "s0-0": "_prim-mesh", + "v1-28": "root-prim" + } + }, + "(code fall sew-catwalk)": { + "vars": { + "s5-0": "art-group", + "s4-0": "art", + "s5-1": "anim" + } + }, + "(event idle sew-mine)": { + "vars": { + "s4-0": "_proc", + "gp-0": "focus-proc", + "a1-7": "evt", + "v1-9": "attack-info", + "a2-3": "game-info", + "a3-2": "id" + } + }, + "(code die sew-mine)": { + "vars": { + "gp-2": "part", + "t9-6": "func", + "gp-3": "frame-counter" + } + }, + "(post idle sew-mine-b)": { + "vars": { + "t9-0": "func", + "f30-0": "ocean-base-height", + "f0-0": "period" + } + }, + "(method 29 sew-wall)": { + "vars": { + "s4-0": "target", + "f0-0": "dist-from-wall", + "f2-0": "deadly-radius", + "f1-0": "prev-deadly-radius", + "s5-1": "cquery", + "a1-4": "evt", + "v1-15": "attack-info" + } + }, + "(code hit sew-wall)": { + "vars": { + "s5-1": "anim", + "a0-14": "_root-prim", + "a1-11": "collide-with", + "v1-22": "collide-as", + "v1-4": "root-prim", + "s5-0": "art-group" + } + }, + "(trans waiting sew-scare-grunt)": { + "vars": { + "s5-0": "target", + "gp-0": "target-proc" + } + }, + "(enter scare sew-scare-grunt)": { + "vars": { + "v1-2": "actor", + "gp-0": "actor-proc" + } + }, + "(code scare sew-scare-grunt)": { + "vars": { + "a2-0": "anim", + "v1-8": "root-prim" + } + }, + "(post scare sew-scare-grunt)": { + "vars": { + "f30-0": "scale", + "gp-1": "set-sound-param", + "a1-5": "position", + "s5-1": "_self" + } + }, + "(exit scare sew-scare-grunt)": { + "vars": { + "a0-0": "actor", + "v1-0": "actor-proc" + } + }, + "(method 114 sew-scare-grunt)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-group", + "v1-15": "prim-sphere-1", + "v1-17": "prim-sphere-2", + "v1-19": "prim-sphere-3", + "v1-21": "prim-sphere-4", + "v1-23": "prim-sphere-5", + "v1-25": "prim-sphere-6", + "v1-28": "root-prim" + } + }, + "(method 115 sew-scare-grunt)": { + "vars": { + "t9-1": "func" + } + }, + "(method 20 sew-blade)": { + "vars": { + "f0-2": "ocean-base-height" + } + }, + "(event idle sew-single-blade)": { + "vars": { + "s4-0": "_proc", + "gp-0": "hit-proc", + "s4-2": "hit-direction", + "a1-6": "evt", + "a0-14": "attack-info" + } + }, + "(method 11 sew-single-blade)": { + "vars": { + "s4-0": "cshape", + "s3-0": "prim-mesh", + "v1-17": "root-prim", + "v1-35": "game-info", + "a0-19": "id" + } + }, + "sew-tri-blade-joint-callback": { + "vars": { + "gp-0": "blade", + "s5-0": "matrix" + } + }, + "(event idle sew-tri-blade)": { + "vars": { + "s5-0": "_proc", + "a0-2": "hit-proc", + "a1-6": "evt", + "v1-5": "attack-info" + } + }, + "(method 11 sew-tri-blade)": { + "vars": { + "s4-0": "cshape" + }, + "args": ["obj", "entity"] + }, + "(method 11 sew-light-switch)": { + "args": ["obj", "entity"], + "vars": { + "sv-16": "tag", + "v1-6": "data" + } + }, + "(method 11 sew-twist-blade)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-mesh", + "v1-17": "root-prim", + "v1-34": "game-info", + "a0-18": "id" + } + }, + "(method 11 sew-multi-blade)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-mesh", + "v1-17": "root-prim", + "v1-34": "game-info", + "a0-18": "id" + } + }, + "(method 11 sew-arm-blade)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-mesh", + "v1-17": "root-prim", + "v1-34": "game-info", + "a0-18": "id" + } + }, + "(event idle sew-multi-blade)": { + "vars": { + "s4-0": "_proc", + "gp-0": "hit-proc", + "s4-2": "hit-direction", + "a0-14": "attack-info", + "a1-6": "evt" + } + }, + "(event idle sew-twist-blade)": { + "vars": { + "s4-0": "_proc", + "gp-0": "hit-proc", + "s4-2": "hit-direction", + "a1-6": "evt", + "a0-14": "attack-info", + "v1-13": "root-prim" + } + }, + "(trans idle sew-twist-blade)": { + "vars": { + "v1-7": "root-prim", + "a1-0": "overlap-params" + } + }, + "(event idle sew-light-switch)": { + "vars": { + "s5-0": "_proc", + "v1-6": "target-proc" + } + }, + "(method 22 sew-light-switch)": { + "vars": { + "s5-0": "cshape", + "v1-6": "prim-mesh", + "v1-9": "root-prim" + } + }, + "(method 23 sew-light-switch)": { + "vars": { + "s4-0": "group-idx", + "s3-0": "group", + "s2-0": "actor-idx", + "v1-5": "actor", + "a1-1": "evt", + "t9-0": "func" + }, + "args": ["obj", "event-type"] + }, + "(event idle sew-light-control)": { + "vars": { + "v0-0": "actor" + } + }, + "(post idle sew-light-control)": { + "vars": { + "gp-0": "target", + "a0-1": "target-proc", + "a0-2": "switch", + "v1-2": "switch-proc", + "gp-1": "switch-pressed?", + "v1-4": "turret", + "a0-5": "turret-proc", + "a2-0": "should-flash?" + } + }, + "(method 15 sew-light-control)": { + "args": ["obj", "switched-on?", "should-turret-flash?"] + }, + "sew-light-control-init-by-other": { + "args": ["switch", "turret"] + }, + "sewer-drop2-birth-func": { + "vars": { + "s4-0": "cquery", + "v1-6": "_cquery" + } + }, + "(method 109 fodder)": { + "vars": { + "t9-0": "parent-method" + } + }, + "(method 110 fodder)": { + "vars": { + "t9-0": "parent-method" + } + }, + "(method 179 fodder)": { + "args": ["obj", "position"], + "vars": { + "a0-2": "focus-proc" + } + }, + "(method 180 fodder)": { + "vars": { + "s5-0": "group-idx", + "s4-0": "group", + "s3-0": "actor-idx", + "s1-0": "actor-proc", + "s2-0": "fodder-proc", + "s1-2": "dir-to-other-fodder", + "f0-0": "dir-length", + "v1-29": "channel" + } + }, + "(method 55 fodder)": { + "vars": { + "t9-0": "parent-method", + "v1-1": "proc", + "s5-0": "other-proc" + } + }, + "(post idle fodder)": { + "vars": { + "t9-0": "func" + } + }, + "(enter active fodder)": { + "vars": { + "t9-0": "func" + } + }, + "(code active fodder)": { + "vars": { + "v1-33": "_self", + "gp-0": "num-chews", + "v1-93": "__self" + } + }, + "(enter hostile fodder)": { + "vars": { + "t9-0": "func" + } + }, + "check-drop-level-mountain-drop-userdata": { + "vars": { + "s3-0": "vec", + "a0-3": "sys", + "t9-1": "func", + "a1-2": "launcher", + "a2-1": "matrix" + } + }, + "(method 11 mtn-plat-buried-rocks)": { + "vars": { + "s4-0": "cshape", + "v1-2": "prim-mesh" + }, + "args": ["obj", "entity"] + }, + "(method 31 mtn-plat-buried)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-mesh", + "v1-15": "root-prim" + } + }, + "(enter plat-idle mtn-plat-buried)": { + "vars": { + "t9-3": "func" + } + }, + "(anon-function 8 mountain-scenes)": { + "vars": { + "v1-0": "sound-set-param" + } + }, + "(method 11 mtn-lens)": { + "args": ["obj", "entity"] + }, + "(method 11 mtn-lens-base)": { + "args": ["obj", "entity"] + }, + "(method 11 mtn-lens-floor)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "v1-2": "prim-mesh", + "v1-5": "root-prim" + } + }, + "(method 11 mtn-shard)": { + "args": ["obj", "entity"] + }, + "(method 11 mtn-step-plat-rocks-a)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-group", + "s0-0": "prim-mesh", + "s0-1": "_prim-mesh", + "v1-24": "root-prim" + } + }, + "(method 11 mtn-step-plat-rocks-b)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-group", + "s0-0": "prim-mesh", + "s0-1": "_prim-mesh", + "v1-24": "root-prim" + } + }, + "(method 11 mtn-step-plat-rocks-c)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "s3-0": "prim-group", + "s0-0": "prim-mesh", + "s0-1": "_prim-mesh", + "v1-24": "root-prim" + } + }, + "(code close mtn-iris-door)": { + "vars": { + "v1-1": "root-prim" + } + }, + "(code open mtn-iris-door)": { + "vars": { + "v1-1": "root-prim" + } + }, + "(method 11 mtn-iris-door)": { + "vars": { + "s4-0": "cshape", + "v1-2": "prim-mesh", + "v1-5": "root-prim" + }, + "args": ["obj", "entity"] + }, + "(method 31 mtn-plat-shoot)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-mesh", + "v1-11": "root-prim" + } + }, + "(event plat-path-active mtn-plat-shoot)": { + "vars": { + "v1-3": "attack-info", + "gp-0": "attacking-proc", + "v1-5": "attacker", + "gp-1": "cshape", + "s5-0": "attacker-root" + } + }, + "(enter plat-path-active mtn-plat-shoot)": { + "vars": { + "t9-0": "func" + } + }, + "(trans plat-path-active mtn-plat-shoot)": { + "vars": { + "t9-12": "func" + } + }, + "(post plat-path-active mtn-plat-shoot)": { + "vars": { + "t9-0": "func" + } + }, + "(anon-function 0 mountain-obs2)": { + "vars": { + "gp-0": "arrow-params", + "f0-0": "dist-from-target" + } + }, + "(method 35 oracle-npc)": { + "vars": { + "v1-4": "root-prim" + } + }, + "(event impact turret-shot)": { + "vars": { + "s4-0": "toucher-proc", + "v1-1": "toucher", + "a1-2": "evt", + "v1-7": "attack-info" + } + }, + "(code impact turret-shot)": { + "vars": { + "v1-1": "root-prim", + "a1-0": "overlap-params" + } + }, + "(method 26 turret-shot)": { + "vars": { + "s5-0": "root" + } + }, + "(method 28 turret-shot)": { + "args": ["obj", "proj-options"], + "vars": { + "v1-0": "options" + } + }, + "(method 30 turret-shot)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-group", + "v1-13": "prim-sphere-1", + "v1-15": "prim-sphere-2", + "v1-18": "root-prim" + } + }, + "(enter die fort-trap-door)": { + "vars": { + "v1-1": "root-prim", + "a1-1": "evt", + "t9-2": "func", + "v1-6": "actor" + } + }, + "(anon-function 3 fortress-obs)": { + "vars": { + "gp-1": "exploder-tuning", + "s5-1": "target", + "a0-4": "target-proc" + } + }, + "(code die fort-trap-door)": { + "vars": { + "gp-0": "frame-counter" + } + }, + "(method 11 fort-trap-door)": { + "args": ["obj", "entity"], + "vars": { + "s4-0": "cshape", + "v1-2": "prim-mesh", + "v1-5": "root-prim", + "a0-14": "channel" + } + }, + "(method 24 water-anim-fortress)": { + "vars": { + "t9-0": "parent-method", + "v1-2": "ripple" + } + }, + "check-drop-level-dig-lava-bloops": { + "vars": { + "f30-0": "origin-y" + } + }, + "(method 12 pegasus)": { + "vars": { + "f0-0": "min-distance" + } + }, + "(method 137 pegasus)": { + "vars": { + "v1-0": "target", + "a1-0": "inaccuracy-dir", + "a0-4": "inaccuracy-vec", + "f1-0": "threshold", + "f0-1": "inaccuracy-mag" + } + }, + "(method 74 pegasus)": { + "args": ["obj", "proc", "arg2", "event-type", "event"] + }, + "(method 57 pegasus)": { + "args": ["obj", "proc", "focus"] + }, + "(method 56 pegasus)": { + "vars": { + "v0-0": "hitpoints", + "v1-0": ["attack-info", "attack-info"] + } + }, + "pegasus-draw-section": { + "args": ["path-percent-a", "path-percent-b", "color"], + "vars": { + "gp-0": "point-a", + "s5-0": "point-b" + } + }, + "pegasus-show-runs": { + "vars": { + "gp-0": "path-idx", + "a0-1": "path", + "a0-4": "_path" + } + }, + "pegasus-rotate": { + "vars": { + "gp-0": "flee-direction-vec", + "s5-0": "rotation-matrix" + }, + "args": ["influenced-by-target?", "angle"] + }, + "pegasus-choose-path": { + "vars": { + "gp-0": "control-data-idx", + "s5-0": "curr-pegasus-path", + "gp-1": "_curr-pegasus-path", + "t1-1": "control-data", + "v1-33": "rand-int", + "v1-34": ["rand-float", "float"], + "f0-9": "_rand" + } + }, + "pegasus-move": { + "args": ["explicit-y-vel", "adjust-y-offset?", "arg2"], + "vars": { + "gp-0": "draw-shadow?", + "s2-0": "cquery", + "f30-1": "y-pos", + "s3-0": "start-pos", + "v1-54": "shadow-ctrl", + "v1-57": "_shadow-ctrl", + "v1-59": "__shadow-ctrl" + } + }, + "pegasus-calc-speed": { + "vars": { + "s5-1": "dir-to-target", + "f1-3": "dist-from-target", + "gp-1": "react-to-target?", + "v1-22": "anim-group", + "v1-31": "_anim-group", + "f0-6": "movement-speed", + "f0-4": "interpolant", + "f0-5": "interpolated-speed" + }, + "args": ["min-dist", "max-dist", "max-speed", "min-speed"] + }, + "pegasus-calc-anim-speed": { + "vars": { + "f0-1": "speed-abs" + } + }, + "(code pegasus-debug)": { + "vars": { + "a1-1": "vec", + "gp-0": "cam-dbg-vec" + } + }, + "(code die pegasus)": { + "vars": { + "a1-1": "evt", + "gp-0": "event-result", + "f0-5": "frame-num", + "f1-0": "speed" + } + }, + "(trans stare pegasus)": { + "vars": { + "gp-0": "awareness" + } + }, + "(code stare pegasus)": { + "vars": { + "v1-2": "anim-group" + } + }, + "pegasus-fly-code": { + "vars": { + "f30-0": "anim-speed", + "f28-0": "min-dist", + "f0-4": "min-speed" + } + }, + "(enter pegasus-tired)": { + "vars": { + "t9-0": "func" + } + }, + "(exit pegasus-tired)": { + "vars": { + "t9-0": "func" + } + }, + "(trans pegasus-tired)": { + "vars": { + "t9-0": "func" + } + }, + "(enter flee pegasus)": { + "vars": { + "t9-0": "func" + } + }, + "(exit flee pegasus)": { + "vars": { + "t9-0": "func" + } + }, + "(trans flee pegasus)": { + "vars": { + "t9-0": "func" + } + }, + "(code active pegasus)": { + "vars": { + "v1-2": "anim-group" + } + }, + "(exit notice pegasus)": { + "vars": { + "t9-0": "func" + } + }, + "(code notice pegasus)": { + "vars": { + "f30-0": "anim-length" + } + }, + "(post idle pegasus)": { + "vars": { + "t9-2": "func" + } + }, + "(method 114 pegasus)": { + "vars": { + "s5-0": "cshape", + "s4-0": "prim-group", + "v1-14": "prim-sphere", + "v1-17": "root-prim" + } + }, + "(method 115 pegasus)": { + "vars": { + "sv-16": "tag", + "s5-1": "path-info-idx", + "v1-19": "curve", + "v1-22": "data", + "s5-2": "matrix", + "f0-9": "timeout" + } + }, + "(anon-function 2 pegasus)": { + "vars": { + "v1-6": "actor-group", + "gp-0": "actor-idx", + "t0-1": "actor" + } + }, + "(anon-function 1 pegasus)": { + "vars": { + "v1-12": "actor-group", + "a1-4": "actor", + "sv-16": "data", + "v1-15": "_data" + } } } diff --git a/goal_src/jak2/characters/ashelin/ash-shot.gc b/goal_src/jak2/characters/ashelin/ash-shot.gc index ddb4f5d853..998eec4dfc 100644 --- a/goal_src/jak2/characters/ashelin/ash-shot.gc +++ b/goal_src/jak2/characters/ashelin/ash-shot.gc @@ -257,7 +257,7 @@ (defmethod draw-laser-sight ashelin-shot ((obj ashelin-shot)) "TODO - confirm If applicable, draw the laser sight particles - :virtual" +:virtual" (draw-beam (-> *part-id-table* 675) (-> obj tail-pos) (-> obj starting-dir) #f #t) 0 (none) @@ -373,26 +373,21 @@ (none) ) -;; WARN: Return type mismatch none vs sound-id. -;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 18] -;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 36] (defmethod play-impact-sound ashelin-shot ((obj ashelin-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) - (the-as - sound-id - (cond - ((zero? v1-0) - (sound-play "ashelin-fire") - ) - ((= v1-0 (projectile-options lose-altitude)) - (sound-play "ashelin-shot-hi") - ) - ((= v1-0 (projectile-options lose-altitude proj-options-2)) - ((the-as (function projectile projectile-options none) (find-parent-method ashelin-shot 28)) obj arg0) - ) - ) + (cond + ((zero? v1-0) + (sound-play "ashelin-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "ashelin-shot-hi") + ) + ((= v1-0 (projectile-options lose-altitude proj-options-2)) + ((the-as (function projectile projectile-options none) (find-parent-method ashelin-shot 28)) obj arg0) + ) ) ) + (none) ) (defmethod made-impact? ashelin-shot ((obj ashelin-shot)) @@ -440,7 +435,7 @@ ) ;; WARN: Return type mismatch symbol vs none. -(defmethod init-collision! ashelin-shot ((obj ashelin-shot)) +(defmethod init-proj-collision! ashelin-shot ((obj ashelin-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -513,7 +508,7 @@ (defmethod init-proj-settings! ashelin-shot ((obj ashelin-shot)) "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc - :virtual" +:virtual" (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) (set! (-> obj attack-mode) 'eco-yellow) (set! (-> obj max-speed) 307200.0) diff --git a/goal_src/jak2/characters/ashelin/ash-states.gc b/goal_src/jak2/characters/ashelin/ash-states.gc index 48fac93b95..b0a9c436ed 100644 --- a/goal_src/jak2/characters/ashelin/ash-states.gc +++ b/goal_src/jak2/characters/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 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -120,7 +120,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) (none) @@ -145,7 +145,7 @@ (else (let ((a1-4 (ashelin-method-242 self))) (if (nonzero? a1-4) - (ashelin-method-240 self (the-as int a1-4)) + (ashelin-method-240 self a1-4) ) ) ) @@ -169,7 +169,7 @@ (ashelin-method-240 self a1-6) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (ashelin-method-247 self) ) (go-virtual chase) @@ -183,13 +183,13 @@ (logclear! (-> self bot-flags) (bot-flags bf21)) (let ((a1-7 (ashelin-method-241 self))) (if (nonzero? a1-7) - (ashelin-method-240 self (the-as int a1-7)) + (ashelin-method-240 self a1-7) ) ) ) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (ashelin-method-239 self) ) ) @@ -270,7 +270,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) (none) @@ -287,7 +287,7 @@ (logclear! (-> self bot-flags) (bot-flags bf21)) (let ((a1-2 (ashelin-method-241 self))) (if (nonzero? a1-2) - (ashelin-method-240 self (the-as int a1-2)) + (ashelin-method-240 self a1-2) ) ) ) @@ -362,7 +362,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-165 self) (set! (-> self player-blocking) 0.0) (none) @@ -383,7 +383,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -428,7 +428,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -493,7 +493,7 @@ (nav-enemy-method-167 self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (if (not (handle->process (-> self focus handle))) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self travel-anim-interp) 0.0) (none) @@ -505,7 +505,7 @@ :code (behavior () (bot-method-223 self #t) (if (or (not (bot-method-214 self)) (not (ashelin-method-235 self #f))) - (enemy-method-72 self) + (react-to-focus self) ) (let ((v1-12 (ja-group))) (if (and v1-12 (or (= v1-12 (-> self draw art-group data 29)) (= v1-12 (-> self draw art-group data 28)))) @@ -536,7 +536,7 @@ (ashelin-method-245 self) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior ashelin) nav-enemy-simple-post) @@ -554,7 +554,7 @@ (bot-method-223 self #t) (cond ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -562,7 +562,7 @@ (go-virtual traveling) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (or (ashelin-method-238 self #t #f) (ashelin-method-248 self)) (go-virtual standing-idle) ) @@ -616,7 +616,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-167 self) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> self travel-anim-interp) 0.0) @@ -727,7 +727,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -758,7 +758,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-167 self) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> self travel-anim-interp) 0.0) @@ -862,7 +862,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -893,7 +893,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-167 self) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> self travel-anim-interp) 0.0) @@ -997,7 +997,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -1053,7 +1053,7 @@ (set! (-> self enemy-flags) v1-15) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) diff --git a/goal_src/jak2/characters/ashelin/ash.gc b/goal_src/jak2/characters/ashelin/ash.gc index b2350ccfd1..3a04692e80 100644 --- a/goal_src/jak2/characters/ashelin/ash.gc +++ b/goal_src/jak2/characters/ashelin/ash.gc @@ -144,8 +144,10 @@ (set! (-> *ashelin-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-59 ashelin ((obj ashelin)) - (let* ((t9-0 (method-of-type bot enemy-method-59)) +(defmethod get-penetrate-info ashelin ((obj ashelin)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + (let* ((t9-0 (method-of-type bot get-penetrate-info)) (v0-0 (t9-0 obj)) ) (if (logtest? (bot-flags bf22) (-> obj bot-flags)) @@ -161,7 +163,7 @@ (set! (-> obj bot-flags) (logior (bot-flags bf22) (-> obj bot-flags))) (logclear! (-> obj bot-flags) (bot-flags bf22)) ) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (none) ) @@ -314,8 +316,8 @@ ) ) -(defmethod enemy-method-114 ashelin ((obj ashelin)) - "@abstract" +(defmethod init-enemy-collision! ashelin ((obj ashelin)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -369,8 +371,8 @@ (none) ) -(defmethod enemy-method-115 ashelin ((obj ashelin)) - "@abstract" +(defmethod init-enemy! ashelin ((obj ashelin)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (set! (-> obj channel) (the-as uint 22)) (set! (-> obj travel-anim-interp) 0.0) @@ -382,7 +384,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-ashelin" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *ashelin-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *ashelin-nav-enemy-info*) (let ((v1-10 (-> obj neck))) (set! (-> v1-10 up) (the-as uint 1)) (set! (-> v1-10 nose) (the-as uint 2)) @@ -390,7 +392,7 @@ (set-vector! (-> v1-10 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-10 ignore-angle) 30947.555) ) - (let ((t9-4 (method-of-type bot enemy-method-115))) + (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -627,7 +629,7 @@ (bot-method-223 obj #t) (cond ((not (bot-method-214 obj)) - (enemy-method-72 obj) + (react-to-focus obj) ) ((ashelin-method-238 obj #t #f) (go (method-of-object obj standing-idle)) @@ -642,7 +644,8 @@ (none) ) -(defmethod enemy-method-72 ashelin ((obj ashelin)) +(defmethod react-to-focus ashelin ((obj ashelin)) + "@TODO - flesh out docs" (if (bot-method-214 obj) (go-hostile obj) (ashelin-method-239 obj) @@ -1288,9 +1291,7 @@ ) ) (when (>= s5-0 0) - (set! (-> obj victory-speech-time) - (the-as time-frame (+ (get-rand-int-range obj 1200 2100) (-> pp clock frame-counter))) - ) + (set! (-> obj victory-speech-time) (+ (get-rand-int-range obj 1200 2100) (-> pp clock frame-counter))) (play-speech obj s5-0) ) ) @@ -1301,7 +1302,7 @@ (defmethod enemy-method-136 ashelin ((obj ashelin)) (with-pp - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj hit-focus-time))) (seconds 2)) + (when (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) (set! (-> obj enemy-flags) v0-0) v0-0 diff --git a/goal_src/jak2/characters/sig/sig-shot.gc b/goal_src/jak2/characters/sig/sig-shot.gc index 0e7d8cd82c..0beb7dde03 100644 --- a/goal_src/jak2/characters/sig/sig-shot.gc +++ b/goal_src/jak2/characters/sig/sig-shot.gc @@ -257,7 +257,7 @@ (defmethod draw-laser-sight sig-shot ((obj sig-shot)) "TODO - confirm If applicable, draw the laser sight particles - :virtual" +:virtual" (draw-beam (-> *part-id-table* 655) (-> obj tail-pos) (-> obj starting-dir) #f #t) 0 (none) @@ -373,7 +373,6 @@ (none) ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound sig-shot ((obj sig-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -385,7 +384,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) (defmethod made-impact? sig-shot ((obj sig-shot)) @@ -432,7 +432,7 @@ (none) ) -(defmethod init-collision! sig-shot ((obj sig-shot)) +(defmethod init-proj-collision! sig-shot ((obj sig-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -505,7 +505,7 @@ (defmethod init-proj-settings! sig-shot ((obj sig-shot)) "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc - :virtual" +:virtual" (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) (set! (-> obj attack-mode) 'eco-yellow) (set! (-> obj max-speed) 307200.0) diff --git a/goal_src/jak2/characters/sig/sig-states.gc b/goal_src/jak2/characters/sig/sig-states.gc index f1421df4ca..80a6b6e463 100644 --- a/goal_src/jak2/characters/sig/sig-states.gc +++ b/goal_src/jak2/characters/sig/sig-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 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-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)) @@ -82,7 +82,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -185,7 +185,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -316,7 +316,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -507,7 +507,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (set! (-> self plasma flags) (logand -29 (-> self plasma flags))) @@ -657,7 +657,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (-> self bot-flags) (bot-flags attacked)) @@ -840,7 +840,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (-> self bot-flags) (bot-flags attacked)) @@ -950,7 +950,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-166 self) (set! (-> self skel top-anim interp) 1.0) (set! (-> self player-blocking) 0.0) @@ -975,7 +975,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -1020,7 +1020,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -1255,7 +1255,7 @@ (if (logtest? (-> self bot-flags) (bot-flags attacked)) (reset-attacker! self) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -1283,7 +1283,7 @@ (nav-enemy-method-167 self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (if (not (handle->process (-> self focus handle))) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) @@ -1323,7 +1323,7 @@ (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) (or (not (bot-method-214 self)) (not (sig-method-245 self))) ) - (enemy-method-72 self) + (react-to-focus self) ) (suspend) (ja :num! (seek! f30-1)) @@ -1346,7 +1346,7 @@ (if (logtest? (-> self bot-flags) (bot-flags attacked)) (reset-attacker! self) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior sig) nav-enemy-simple-post) @@ -1364,7 +1364,7 @@ (bot-method-223 self #t) (cond ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -1542,7 +1542,7 @@ (set! (-> self enemy-flags) v1-39) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1651,7 +1651,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -1713,7 +1713,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (set! (-> self bot-flags) (logior (bot-flags bf24) (-> self bot-flags))) @@ -1785,7 +1785,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -1854,7 +1854,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (set! (-> self bot-flags) (logior (bot-flags bf24) (-> self bot-flags))) @@ -1932,7 +1932,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -2001,7 +2001,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (vector-reset! (-> self root-override2 transv)) diff --git a/goal_src/jak2/characters/sig/sig.gc b/goal_src/jak2/characters/sig/sig.gc index 117c0daceb..3b78501893 100644 --- a/goal_src/jak2/characters/sig/sig.gc +++ b/goal_src/jak2/characters/sig/sig.gc @@ -293,7 +293,9 @@ ;; WARN: Return type mismatch none vs object. ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 33] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 38] -(defmethod enemy-method-74 sig ((obj sig) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler sig ((obj sig) (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" (let ((v1-0 arg2)) (the-as object (cond ((= v1-0 'untrigger) @@ -311,14 +313,18 @@ ) ) (else - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) ) ) -(defmethod enemy-method-55 sig ((obj sig)) +(defmethod track-target! sig ((obj 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 +@TODO Not extremely well understood yet" (with-pp (let ((v1-2 (-> obj skel top-anim frame-group))) (cond @@ -364,15 +370,13 @@ ) ) ) - (let ((t9-2 (method-of-type bot enemy-method-55))) + (let ((t9-2 (method-of-type bot track-target!))) (t9-2 obj) ) (when (logtest? (-> obj bot-flags) (bot-flags too-far-fail)) (let ((f0-0 (vector-vector-distance (-> obj root-override2 trans) (target-pos 0)))) (when (or (>= f0-0 491520.0) - (and (>= f0-0 102400.0) - (>= (- (-> pp clock frame-counter) (the-as int (-> obj last-draw-time))) (seconds 10)) - ) + (and (>= f0-0 102400.0) (>= (- (-> pp clock frame-counter) (-> obj last-draw-time)) (seconds 10))) ) (process-entity-status! obj (entity-perm-status no-kill) #f) (cleanup-for-death obj) @@ -471,8 +475,8 @@ (none) ) -(defmethod enemy-method-114 sig ((obj sig)) - "@abstract" +(defmethod init-enemy-collision! sig ((obj sig)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -561,8 +565,8 @@ (none) ) -(defmethod enemy-method-115 sig ((obj sig)) - "@abstract" +(defmethod init-enemy! sig ((obj sig)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (set! (-> obj channel) (the-as uint 21)) (set! (-> obj notice-enemy-dist) 122880.0) @@ -577,7 +581,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-sig" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *sig-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *sig-nav-enemy-info*) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 147) obj)) (add-connection *part-engine* obj 23 obj 671 (new 'static 'sphere :y 327.68 :z 7536.64 :r 163840.0)) (set! (-> obj skel interp-select 0) (the-as int (the-as uint #x1ffc007ffff0))) @@ -594,7 +598,7 @@ (set-vector! (-> v1-26 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-26 ignore-angle) 30947.555) ) - (let ((t9-10 (method-of-type bot enemy-method-115))) + (let ((t9-10 (method-of-type bot init-enemy!))) (t9-10 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -645,7 +649,7 @@ (bot-method-223 obj #t) (cond ((not (bot-method-214 obj)) - (enemy-method-72 obj) + (react-to-focus obj) ) ((sig-method-246 obj) (go (method-of-object obj whip)) @@ -660,7 +664,8 @@ (none) ) -(defmethod enemy-method-72 sig ((obj sig)) +(defmethod react-to-focus sig ((obj sig)) + "@TODO - flesh out docs" (cond ((bot-method-214 obj) (go-hostile obj) diff --git a/goal_src/jak2/engine/ai/enemy-h.gc b/goal_src/jak2/engine/ai/enemy-h.gc index 470333a61d..c673b919f7 100644 --- a/goal_src/jak2/engine/ai/enemy-h.gc +++ b/goal_src/jak2/engine/ai/enemy-h.gc @@ -70,7 +70,7 @@ (enemy-aware-1 1) (enemy-aware-2 2) (enemy-aware-3 3) - (enemy-aware-4 4) + (unaware 4) ) ;; ---enemy-aware @@ -82,7 +82,7 @@ (knocked-type-1 1) (knocked-type-2 2) (knocked-type-3 3) - (knocked-type-4 4) + (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) @@ -138,8 +138,8 @@ (default-hit-points int32 :offset-assert 156) (gnd-collide-with collide-spec :offset-assert 160) (overlaps-others-collide-with-filter collide-spec :offset-assert 164) - (penetrate-flinch uint64 :offset-assert 168) - (penetrate-knocked uint64 :offset-assert 176) + (penetrate-flinch penetrate :offset-assert 168) + (penetrate-knocked penetrate :offset-assert 176) (movement-gravity meters :offset-assert 184) (friction float :offset-assert 188) (slip-factor float :offset-assert 192) @@ -279,14 +279,14 @@ (penetrated-by-all penetrate :offset-assert 256) (penetrated-flinch penetrate :offset-assert 264) (penetrated-knocked penetrate :offset-assert 272) - (reaction-time uint64 :offset-assert 280) - (notice-time uint64 :offset-assert 288) - (state-timeout uint64 :offset-assert 296) - (auto-reset-penetrate-time uint64 :offset-assert 304) - (hit-focus-time uint64 :offset-assert 312) - (last-draw-time uint64 :offset-assert 320) - (starting-time uint64 :offset-assert 328) - (fated-time uint64 :offset-assert 336) + (reaction-time time-frame :offset-assert 280) + (notice-time time-frame :offset-assert 288) + (state-timeout time-frame :offset-assert 296) + (auto-reset-penetrate-time time-frame :offset-assert 304) + (hit-focus-time time-frame :offset-assert 312) + (last-draw-time time-frame :offset-assert 320) + (starting-time time-frame :offset-assert 328) + (fated-time time-frame :offset-assert 336) (focus-pos vector :inline :offset-assert 352) (event-param-point vector :inline :offset-assert 368) (jump-dest vector :inline :offset 368) @@ -335,15 +335,15 @@ (enemy-method-52 (_type_ vector) none 52) (enemy-method-53 (_type_ process-focusable) symbol 53) (enemy-method-54 (_type_) enemy-flag 54) - (enemy-method-55 (_type_) none 55) - (enemy-method-56 (_type_ process event-message-block) int 56) - (enemy-method-57 (_type_ process-focusable enemy-best-focus) enemy-aware 57) + (track-target! (_type_) none 55) + (damage-amount-from-attack (_type_ process event-message-block) int 56) + (update-target-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware 57) (enemy-method-58 (_type_ process event-message-block) symbol 58) - (enemy-method-59 (_type_) penetrate 59) + (get-penetrate-info (_type_) penetrate 59) (coin-flip? (_type_) symbol 60) (enemy-method-61 (_type_ int) int :behavior enemy 61) (enemy-method-62 (_type_) none 62) - (enemy-method-63 (_type_ process-focusable symbol) symbol 63) + (enemy-method-63 (_type_ process-focusable enemy-aware) symbol 63) (enemy-method-64 (_type_) none 64) (enemy-method-65 (_type_) none 65) (go-ambush (_type_) none 66) @@ -352,9 +352,9 @@ (go-directed (_type_) none 69) (go-hostile (_type_) none 70) (go-flee (_type_) none 71) - (enemy-method-72 (_type_) none 72) - (enemy-method-73 (_type_) none 73) - (enemy-method-74 (_type_ process object symbol event-message-block) object 74) + (react-to-focus (_type_) none 72) + (kill-prefer-falling (_type_) none 73) + (general-event-handler (_type_ process int symbol event-message-block) object 74) (enemy-method-75 (_type_ process touching-shapes-entry) none 75) (enemy-method-76 (_type_ process event-message-block) symbol 76) (enemy-method-77 (_type_ (pointer float)) symbol 77) @@ -378,7 +378,7 @@ (enemy-method-95 (_type_ vector float) symbol 95) (enemy-method-96 (_type_ float symbol) symbol 96) (enemy-method-97 (_type_) process 97) - (enemy-method-98 (_type_ process-focusable vector) symbol 98) + (in-aggro-range? (_type_ process-focusable vector) symbol 98) (enemy-method-99 (_type_ process-focusable) symbol 99) (enemy-method-100 (_type_) symbol 100) (enemy-method-101 (_type_) none 101) @@ -387,15 +387,15 @@ (enemy-method-104 (_type_ process uint 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) - (enemy-method-107 (_type_) process-focusable 107) + (get-enemy-target (_type_) process-focusable 107) (enemy-method-108 (_type_ enemy event-message-block) int 108) - (enemy-method-109 (_type_ int) none 109) - (enemy-method-110 (_type_) none 110) + (look-at-target! (_type_ enemy-flag) none 109) + (stop-looking-at-target! (_type_) none 110) (enemy-method-111 (_type_) none :behavior enemy 111) - (enemy-method-112 (_type_ enemy-info) none 112) - (enemy-method-113 (_type_ enemy-info) none 113) - (enemy-method-114 (_type_) none 114) - (enemy-method-115 (_type_) none 115) + (set-enemy-info! (_type_ enemy-info) none 112) + (init-enemy-behaviour-and-stats! (_type_ enemy-info) none 113) + (init-enemy-collision! (_type_) none 114) + (init-enemy! (_type_) none 115) (go-idle (_type_) none 116) (get-rand-float (_type_) float 117) (get-rand-float-range (_type_ float float) float 118) @@ -406,13 +406,13 @@ (enemy-method-123 (_type_ float) symbol 123) (enemy-method-124 (_type_) collide-spec 124) (enemy-method-125 (_type_ collide-query collide-spec float float float) pat-surface 125) - (enemy-method-126 (_type_ collide-query vector collide-spec float float float) symbol 126) + (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol 126) (enemy-method-127 (_type_ float float symbol collide-spec) symbol 127) (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) - (enemy-method-132 (_type_) none 132) + (dispose! (_type_) none 132) (enemy-method-133 (_type_) symbol 133) (enemy-method-134 (_type_ process attack-info) process-focusable 134) (enemy-method-135 (_type_ int) sound-id 135) @@ -440,7 +440,7 @@ (set! (-> obj aware) (the-as enemy-aware - (enemy-method-61 arg1 (the-as int (enemy-method-57 arg1 arg0 (the-as enemy-best-focus #f)))) + (enemy-method-61 arg1 (the-as int (update-target-awareness! arg1 arg0 (the-as enemy-best-focus #f)))) ) ) ) diff --git a/goal_src/jak2/engine/ai/enemy.gc b/goal_src/jak2/engine/ai/enemy.gc index 20a7fdb06e..af4cda2db9 100644 --- a/goal_src/jak2/engine/ai/enemy.gc +++ b/goal_src/jak2/engine/ai/enemy.gc @@ -193,7 +193,9 @@ ) ) -(defmethod enemy-method-59 enemy ((obj enemy)) +(defmethod get-penetrate-info enemy ((obj enemy)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (penetrated-by-all&hit-points->penetrated-by (-> obj penetrated-by-all) (-> obj hit-points)) ) @@ -287,10 +289,14 @@ ) ) -(defmethod enemy-method-55 enemy ((obj enemy)) +(defmethod track-target! enemy ((obj 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" (with-pp (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) - (set! (-> obj last-draw-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj last-draw-time) (-> pp clock frame-counter)) ) (enemy-method-129 obj) (if (logtest? (enemy-flag use-trigger) (-> obj enemy-flags)) @@ -318,10 +324,10 @@ ) ) (when (and (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (the-as int (-> obj auto-reset-penetrate-time))) (seconds 0.1)) + (>= (- (-> pp clock frame-counter) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) ) (logclear! (-> obj enemy-flags) (enemy-flag attackable-backup)) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((v1-48 0)) (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) (set! v1-48 (logior (shl 1 32) v1-48)) @@ -346,7 +352,7 @@ (defmethod enemy-method-136 enemy ((obj enemy)) (with-pp - (when (or (>= (- (-> pp clock frame-counter) (the-as int (-> obj hit-focus-time))) (seconds 2)) + (when (or (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) (and (handle->process (-> obj focus handle)) (zero? (logand (-> (the-as process-focusable (handle->process (-> obj focus handle))) focus-status) (focus-status disable dead ignore grabbed) @@ -392,7 +398,8 @@ ) ;; WARN: Return type mismatch process vs process-focusable. -(defmethod enemy-method-107 enemy ((obj enemy)) +(defmethod get-enemy-target enemy ((obj enemy)) + "@returns the [[process-focusable]] that the enemy is currently focusing on, or [[#f]] otherwise" (let ((v0-0 (handle->process (-> obj focus handle)))) (if (and v0-0 (not (and v0-0 @@ -406,9 +413,9 @@ ) ) -(defmethod enemy-method-63 enemy ((obj enemy) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 enemy ((obj enemy) (arg0 process-focusable) (arg1 enemy-aware)) (if arg1 - (enemy-focus-method-13 (-> obj focus) arg0 (the-as enemy-aware arg1)) + (enemy-focus-method-13 (-> obj focus) arg0 arg1) (try-update-focus (-> obj focus) arg0 obj) ) ) @@ -422,7 +429,7 @@ ) ) (when (enemy-method-53 obj (the-as process-focusable s5-0)) - (enemy-method-63 obj (the-as process-focusable s5-0) #f) + (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) (logior! (-> obj focus flags) (enemy-flag lock-focus)) ) ) @@ -528,10 +535,11 @@ (none) ) -(defmethod enemy-method-72 enemy ((obj enemy)) +(defmethod react-to-focus enemy ((obj enemy)) + "@TODO - flesh out docs" (let ((s5-0 (-> obj focus aware))) (cond - ((and (= s5-0 (enemy-aware enemy-aware-3)) (enemy-method-107 obj)) + ((and (= s5-0 (enemy-aware enemy-aware-3)) (get-enemy-target obj)) (go-hostile obj) ) ((<= (the-as int s5-0) 0) @@ -540,7 +548,7 @@ ((>= 1 (the-as int s5-0)) (go (method-of-object obj active)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go-flee obj) ) (else @@ -554,13 +562,14 @@ (defmethod enemy-method-93 enemy ((obj enemy)) (if (logtest? (enemy-flag alert) (-> obj enemy-flags)) (go-directed obj) - (enemy-method-72 obj) + (react-to-focus obj) ) (none) ) ;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-73 enemy ((obj enemy)) +(defmethod kill-prefer-falling enemy ((obj enemy)) + "If available in `enemy-info`, [[go]] to the [[die-falling]] state, if not, [[die]]" (if (-> obj enemy-info use-die-falling) (go (method-of-object obj die-falling)) (go (method-of-object obj die)) @@ -670,8 +679,8 @@ (or (not v1-10) (zero? (logand (-> obj focus flags) (enemy-flag lock-focus)))) ) ) - (enemy-method-63 obj (the-as process-focusable s5-0) #f) - (set! (-> obj hit-focus-time) (the-as uint (-> pp clock frame-counter))) + (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) + (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) (let ((v0-3 (logior (-> obj enemy-flags) (enemy-flag look-at-focus)))) (set! (-> obj enemy-flags) v0-3) v0-3 @@ -686,7 +695,7 @@ (defmethod enemy-method-49 enemy ((obj enemy)) (logior! (-> obj enemy-flags) (enemy-flag attackable-backup)) (let ((v0-0 (-> self clock frame-counter))) - (set! (-> obj auto-reset-penetrate-time) (the-as uint v0-0)) + (set! (-> obj auto-reset-penetrate-time) v0-0) v0-0 ) ) @@ -777,13 +786,15 @@ (none) ) -(defmethod enemy-method-109 enemy ((obj enemy) (arg0 int)) +(defmethod look-at-target! enemy ((obj enemy) (arg0 enemy-flag)) + "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available +@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" (case arg0 - ((1) + (((enemy-flag lock-focus)) (logclear! (-> obj enemy-flags) (enemy-flag death-start)) (logior! (-> obj enemy-flags) (enemy-flag lock-focus)) ) - ((2) + (((enemy-flag death-start)) (logclear! (-> obj enemy-flags) (enemy-flag lock-focus)) (logior! (-> obj enemy-flags) (enemy-flag death-start)) ) @@ -795,7 +806,8 @@ (none) ) -(defmethod enemy-method-110 enemy ((obj enemy)) +(defmethod stop-looking-at-target! enemy ((obj enemy)) + "Will unset [[enemy-flag::death-start]] and [[enemy-flag::lock-focus]] and call [[joint-mod::shut-down]] if applicable" (when (nonzero? (-> obj neck)) (logclear! (-> obj enemy-flags) (enemy-flag lock-focus death-start)) (shut-down (-> obj neck)) @@ -813,7 +825,9 @@ ) ) -(defmethod enemy-method-126 enemy ((obj enemy) (arg0 collide-query) (arg1 vector) (arg2 collide-spec) (arg3 float) (arg4 float) (arg5 float)) +(defmethod enemy-above-ground? enemy ((obj enemy) (arg0 collide-query) (arg1 vector) (arg2 collide-spec) (arg3 float) (arg4 float) (arg5 float)) + "@returns if the enemy is above the ground or not +@see [[above-ground?]]" (above-ground? (-> obj root-override2) arg0 arg1 arg2 arg3 arg4 arg5) ) @@ -993,14 +1007,14 @@ (none) ) -(defmethod enemy-method-114 enemy ((obj enemy)) - "@abstract" +(defmethod init-enemy-collision! enemy ((obj enemy)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" 0 (none) ) -(defmethod enemy-method-115 enemy ((obj enemy)) - "@abstract" +(defmethod init-enemy! enemy ((obj enemy)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" 0 (none) ) @@ -1011,7 +1025,9 @@ (none) ) -(defmethod enemy-method-112 enemy ((obj enemy) (arg0 enemy-info)) +(defmethod set-enemy-info! enemy ((obj enemy) (arg0 enemy-info)) + "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it +@param info Set `enemy-info` accordingly" (set! (-> obj enemy-info) arg0) (when (and (!= (-> obj enemy-info neck-joint) -1) (zero? (-> obj neck))) (set! (-> obj neck) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj (-> obj enemy-info neck-joint))) @@ -1026,7 +1042,8 @@ (none) ) -(defmethod enemy-method-113 enemy ((obj enemy) (arg0 enemy-info)) +(defmethod init-enemy-behaviour-and-stats! enemy ((obj enemy) (arg0 enemy-info)) + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" (local-vars (sv-16 res-tag)) (when (coin-flip? obj) (let ((a0-2 (-> obj node-list data 2))) @@ -1039,7 +1056,7 @@ (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask))) (logior! (-> obj mask) (process-mask actor-pause)) (logior! (-> obj enemy-flags) (enemy-flag notice)) - (enemy-method-112 obj arg0) + (set-enemy-info! obj arg0) (let ((a1-2 (-> obj enemy-info idle-anim-script))) (if a1-2 (idle-control-method-9 (-> obj idle-anim-player) a1-2) @@ -1123,12 +1140,12 @@ ) (let ((s4-0 (-> obj root-override2))) (set! (-> obj penetrated-by-all) (-> s4-0 penetrated-by)) - (set! (-> s4-0 penetrated-by) (enemy-method-59 obj)) + (set! (-> s4-0 penetrated-by) (get-penetrate-info obj)) (set! (-> s4-0 event-self) 'touched) ) - (set! (-> obj penetrated-flinch) (the-as penetrate (-> arg0 penetrate-flinch))) - (set! (-> obj penetrated-knocked) (the-as penetrate (-> arg0 penetrate-knocked))) - (set! (-> obj reaction-time) (the-as uint (get-rand-int-range obj 30 180))) + (set! (-> obj penetrated-flinch) (-> arg0 penetrate-flinch)) + (set! (-> obj penetrated-knocked) (-> arg0 penetrate-knocked)) + (set! (-> obj reaction-time) (get-rand-int-range obj 30 180)) (let* ((v1-79 (-> obj enemy-flags)) (a0-28 (-> obj fact-info-override enemy-options)) (v1-80 (logior (enemy-flag @@ -1177,11 +1194,11 @@ (if (-> arg1 scale z) (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> self enemy-flags)))) ) - (enemy-method-114 self) + (init-enemy-collision! self) (set! (-> self root-override2 trans quad) (-> arg1 trans quad)) (quaternion-copy! (-> self root-override2 quat) (-> arg1 quat)) (vector-identity! (-> self root-override2 scale)) - (enemy-method-115 self) + (init-enemy! self) (when (> (-> self enemy-info gem-joint) 0) (cond ((and (or (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status save))) @@ -1240,9 +1257,9 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (enemy-method-114 obj) + (init-enemy-collision! obj) (process-drawable-from-entity! obj arg0) - (enemy-method-115 obj) + (init-enemy! obj) (when (>= (-> obj enemy-info gem-joint) 0) (cond ((and (or (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status save))) @@ -1292,7 +1309,12 @@ This commonly includes things such as: (none) ) -(defmethod enemy-method-98 enemy ((obj enemy) (arg0 process-focusable) (arg1 vector)) +(defmethod in-aggro-range? enemy ((obj enemy) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" #t ) @@ -1325,11 +1347,12 @@ This commonly includes things such as: (enemy-method-97 obj) (return #f) ) - (let ((v1-14 (enemy-method-61 - obj - (the-as int (enemy-method-57 obj (the-as process-focusable a1-0) (the-as enemy-best-focus #f))) - ) - ) + (let ((v1-14 + (enemy-method-61 + obj + (the-as int (update-target-awareness! obj (the-as process-focusable a1-0) (the-as enemy-best-focus #f))) + ) + ) ) (set! (-> gp-0 aware) (the-as enemy-aware v1-14)) (if (>= 1 v1-14) @@ -1376,7 +1399,7 @@ This commonly includes things such as: ) ) (if (and a1-1 (and a1-1 (zero? (logand (-> a1-1 focus-status) (focus-status disable dead)))) (!= obj a1-1)) - (enemy-method-57 obj a1-1 gp-0) + (update-target-awareness! obj a1-1 gp-0) ) ) ) @@ -1403,7 +1426,7 @@ This commonly includes things such as: ) ) (if (and a1-3 (and a1-3 (zero? (logand (-> a1-3 focus-status) (focus-status disable dead)))) (!= obj a1-3)) - (enemy-method-57 obj a1-3 gp-0) + (update-target-awareness! obj a1-3 gp-0) ) ) ) @@ -1429,7 +1452,7 @@ This commonly includes things such as: ) ) (if (and a1-5 (and a1-5 (zero? (logand (-> a1-5 focus-status) (focus-status disable dead)))) (!= obj a1-5)) - (enemy-method-57 obj a1-5 gp-0) + (update-target-awareness! obj a1-5 gp-0) ) ) ) @@ -1447,7 +1470,7 @@ This commonly includes things such as: (enemy-method-63 obj (the-as process-focusable s4-1) - (the-as symbol (enemy-method-61 obj (the-as int (-> gp-0 aware)))) + (the-as enemy-aware (enemy-method-61 obj (the-as int (-> gp-0 aware)))) ) s4-1 ) @@ -1456,7 +1479,10 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch int vs enemy-aware. -(defmethod enemy-method-57 enemy ((obj enemy) (arg0 process-focusable) (arg1 enemy-best-focus)) +(defmethod update-target-awareness! enemy ((obj enemy) (arg0 process-focusable) (arg1 enemy-best-focus)) + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! +@TODO - flesh out docs +@returns the value that sets `aware`" (let ((f30-0 (vector-vector-distance (get-trans arg0 0) (-> obj root-override2 trans))) (s3-1 #f) (s2-0 #f) @@ -1464,7 +1490,7 @@ This commonly includes things such as: (cond ((< f30-0 (-> obj enemy-info proximity-notice-distance)) (set! s3-1 #t) - (set! s2-0 (enemy-method-98 obj arg0 (the-as vector #f))) + (set! s2-0 (in-aggro-range? obj arg0 (the-as vector #f))) ) (else (let ((f0-1 (the-as float (-> obj enemy-info notice-distance)))) @@ -1472,7 +1498,7 @@ This commonly includes things such as: (set! f0-1 (+ (the-as meters f0-1) (-> obj enemy-info notice-distance-delta))) ) (when (or (< f30-0 f0-1) (zero? (logand (-> obj enemy-flags) (enemy-flag enable-on-notice)))) - (set! s2-0 (enemy-method-98 obj arg0 (the-as vector #f))) + (set! s2-0 (in-aggro-range? obj arg0 (the-as vector #f))) (if s2-0 (set! s3-1 #t) ) @@ -1568,12 +1594,10 @@ This commonly includes things such as: (v1-1 (when (not (logtest? (-> obj enemy-flags) (enemy-flag spawn-gem))) (logior! (-> obj enemy-flags) (enemy-flag spawn-gem)) - (set! (-> obj notice-time) (the-as uint (-> self clock frame-counter))) + (set! (-> obj notice-time) (-> self clock frame-counter)) ) (if (and (not (logtest? (-> obj enemy-flags) (enemy-flag chase-startup))) - (< (- (-> self clock frame-counter) (the-as int (-> obj notice-time))) - (the-as time-frame (-> obj reaction-time)) - ) + (< (- (-> self clock frame-counter) (-> obj notice-time)) (-> obj reaction-time)) ) (set! v1-1 #f) ) @@ -1586,7 +1610,7 @@ This commonly includes things such as: (v1-1 arg0 ) - ((or (zero? arg0) (>= (- (-> self clock frame-counter) (the-as int (-> obj last-draw-time))) (seconds 2))) + ((or (zero? arg0) (>= (- (-> self clock frame-counter) (-> obj last-draw-time)) (seconds 2))) 0 ) (else @@ -1615,7 +1639,9 @@ This commonly includes things such as: ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 814] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 850] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 933] -(defmethod enemy-method-74 enemy ((obj enemy) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler enemy ((obj enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (s5-5 rgbaf) (sv-432 process) (sv-448 event-message-block)) (with-pp (the-as @@ -1664,7 +1690,7 @@ This commonly includes things such as: (collide-action) ) ) - (set! (-> obj auto-reset-penetrate-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj auto-reset-penetrate-time) (-> pp clock frame-counter)) ) ) ) @@ -1680,7 +1706,7 @@ This commonly includes things such as: (set! (-> v1-31 prim-core collide-with) (collide-spec)) ) 0 - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ) ) @@ -1711,7 +1737,7 @@ This commonly includes things such as: (enemy-method-108 obj (the-as enemy arg0) arg3) (let ((a1-13 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-13 from) (process->ppointer arg0)) - (set! (-> a1-13 num-params) (the-as int arg1)) + (set! (-> a1-13 num-params) arg1) (set! (-> a1-13 message) (the-as symbol s2-1)) (set! (-> a1-13 param 0) (-> arg3 param 0)) (set! (-> a1-13 param 1) (-> arg3 param 1)) @@ -1747,7 +1773,7 @@ This commonly includes things such as: (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) #t ) @@ -1790,7 +1816,7 @@ This commonly includes things such as: (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> obj hit-points)) - (enemy-method-73 obj) + (kill-prefer-falling obj) (go (method-of-object obj hit)) ) ) @@ -1832,7 +1858,7 @@ This commonly includes things such as: (logclear! (-> obj enemy-flags) (enemy-flag alert victory called-dying)) (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) (go-ambush obj) - (enemy-method-72 obj) + (react-to-focus obj) ) #t ) @@ -1873,7 +1899,7 @@ This commonly includes things such as: ((= arg2 'instant-death) (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time))) (set! (-> obj hit-points) 0) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((s5-2 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) (vector-z-quaternion! s5-2 (-> obj root-override2 quat)) (vector-float*! s5-2 s5-2 -1.0) @@ -1890,12 +1916,12 @@ This commonly includes things such as: (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) (enemy-method-62 obj) (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ) ((= arg2 'die-fast) (logior! (-> obj draw status) (draw-control-status no-draw)) - (enemy-method-132 obj) + (dispose! obj) (send-event (ppointer->process (-> obj parent)) 'child-die) (let ((s5-3 (-> obj on-death))) (if s5-3 @@ -1971,7 +1997,8 @@ This commonly includes things such as: ) ) -(defmethod enemy-method-56 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack enemy ((obj enemy) (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]]" (let ((v1-0 (the-as attack-info (-> arg1 param 1)))) (if (logtest? (attack-info-mask damage) (-> v1-0 mask)) (the int (-> v1-0 damage)) @@ -1998,18 +2025,18 @@ This commonly includes things such as: (defmethod enemy-method-48 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) (with-pp - (let* ((v1-1 (enemy-method-56 obj arg0 arg1)) + (let* ((v1-1 (damage-amount-from-attack obj arg0 arg1)) (s5-0 (-> obj hit-points)) (s4-1 (max 0 (- s5-0 v1-1))) ) (when (and (zero? s4-1) (nonzero? s5-0) (= (-> obj incoming knocked-type) (knocked-type knocked-type-6))) (cond ((zero? (-> obj fated-time)) - (set! (-> obj fated-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj fated-time) (-> pp clock frame-counter)) (set! s4-1 1) ) (else - (if (< (- (-> pp clock frame-counter) (the-as int (-> obj fated-time))) (seconds 1)) + (if (< (- (-> pp clock frame-counter) (-> obj fated-time)) (seconds 1)) (set! s4-1 1) ) ) @@ -2017,7 +2044,7 @@ This commonly includes things such as: ) (set! (-> obj hit-points) s4-1) (if (not (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup))) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) ) (- s5-0 s4-1) ) @@ -2116,11 +2143,11 @@ This commonly includes things such as: ) (defbehavior enemy-event-handler enemy ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (enemy-method-74 self arg0 arg1 arg2 arg3) + (general-event-handler self arg0 arg1 arg2 arg3) ) (defbehavior enemy-simple-post enemy () - (enemy-method-55 self) + (track-target! self) (update-transforms (-> self root-override2)) 0 (none) @@ -2149,7 +2176,7 @@ This commonly includes things such as: ) ) (enemy-method-111 self) - (enemy-method-55 self) + (track-target! self) (none) ) @@ -2185,7 +2212,7 @@ This commonly includes things such as: (move-to-point! gp-0 s5-1) ) ) - (enemy-method-55 self) + (track-target! self) 0 (none) ) @@ -2195,10 +2222,10 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-110 self) + (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)) - (set! (-> self state-timeout) (the-as uint 150)) + (set! (-> self state-timeout) (seconds 0.5)) (if (-> self on-notice) (logior! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) ) @@ -2217,7 +2244,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -2232,7 +2259,7 @@ This commonly includes things such as: :post (behavior () (idle-control-method-10 (-> self idle-anim-player) self) (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-draw-time) (-> self clock frame-counter)) ) (enemy-method-129 self) (ja-post) @@ -2279,7 +2306,7 @@ This commonly includes things such as: :enter (-> (method-of-type enemy dormant) enter) :exit (-> (method-of-type enemy dormant) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (if (logtest? (enemy-option ambush) (-> self fact-info-override enemy-options)) @@ -2292,7 +2319,7 @@ This commonly includes things such as: :code (the-as (function none :behavior enemy) sleep-code) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-draw-time) (-> self clock frame-counter)) ) (enemy-method-129 self) (none) @@ -2373,7 +2400,7 @@ This commonly includes things such as: (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag called-dying))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (enemy-method-109 self 1) + (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)) (let ((gp-0 (-> self on-notice))) @@ -2388,10 +2415,10 @@ This commonly includes things such as: (let ((gp-1 (-> self focus aware))) (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) (cond - ((and (= gp-1 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-1 (enemy-aware enemy-aware-4)) + ((= gp-1 (enemy-aware unaware)) (go-flee self) ) (else @@ -2426,7 +2453,7 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post enemy-simple-post @@ -2437,7 +2464,7 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (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)) (logclear! (-> self mask) (process-mask actor-pause)) @@ -2459,12 +2486,12 @@ This commonly includes things such as: (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -2504,10 +2531,10 @@ This commonly includes things such as: ((>= 1 (the-as int gp-0)) (go-virtual active) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -2564,7 +2591,7 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post enemy-simple-post @@ -2575,14 +2602,14 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask actor-pause)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) - (if (!= (-> self focus aware) (enemy-aware enemy-aware-4)) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (!= (-> self focus aware) (enemy-aware unaware)) (go-stare self) ) ) @@ -2616,7 +2643,7 @@ This commonly includes things such as: (set! (-> arg0 dest-pos quad) (-> obj event-param-point quad)) (set! (-> arg0 start-pos quad) (-> obj root-override2 trans quad)) (let ((s4-0 (new 'stack-no-clear 'collide-query))) - (if (enemy-method-126 + (if (enemy-above-ground? obj s4-0 (-> arg0 dest-pos) @@ -2948,7 +2975,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (enemy-method-110 self) + (stop-looking-at-target! self) (logclear! (-> self mask) (process-mask actor-pause)) (enemy-method-135 self 0) (none) @@ -3055,7 +3082,7 @@ This commonly includes things such as: ) (logclear! (-> obj enemy-flags) (enemy-flag directed)) (if (and (enemy-method-102 obj) (zero? (logand (-> obj focus-status) (focus-status dead)))) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (let ((s5-1 (-> obj root-override2)) (a1-2 (new 'stack-no-clear 'collide-query)) @@ -3330,7 +3357,7 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (logclear! (-> self mask) (process-mask actor-pause)) (let* ((v1-8 *game-info*) @@ -3376,7 +3403,7 @@ This commonly includes things such as: (set! (-> self desired-angle) (enemy-method-51 self)) ) (if (zero? (-> self hit-points)) - (enemy-method-132 self) + (dispose! self) (enemy-method-135 self 0) ) (logclear! (-> self focus-status) (focus-status dangerous)) @@ -3443,7 +3470,7 @@ This commonly includes things such as: (set! (-> gp-0 move-count) 0) (until (enemy-method-80 self gp-0) (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) - (enemy-method-73 self) + (kill-prefer-falling self) ) (if (logtest? (-> self root-override2 status) (collide-status on-surface)) (+! (-> gp-0 on-surface-count) 1) @@ -3479,7 +3506,7 @@ This commonly includes things such as: (enemy-method-102 self) ) ) - (enemy-method-73 self) + (kill-prefer-falling self) ) (while (not (enemy-method-79 self 4 gp-0)) (suspend) @@ -3504,7 +3531,7 @@ This commonly includes things such as: (cleanup-for-death self) ) (else - (enemy-method-73 self) + (kill-prefer-falling self) ) ) ) @@ -3517,7 +3544,8 @@ This commonly includes things such as: :post enemy-falling-post ) -(defmethod enemy-method-132 enemy ((obj enemy)) +(defmethod dispose! enemy ((obj enemy)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (not (logtest? (enemy-flag recover-applied-velocity) (-> obj enemy-flags))) (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag recover-applied-velocity) (-> obj enemy-flags))) @@ -3555,7 +3583,7 @@ This commonly includes things such as: (if (-> obj skel effect) (logior! (-> obj skel effect flags) (effect-control-flag ecf1)) ) - (enemy-method-110 obj) + (stop-looking-at-target! obj) ) (none) ) @@ -3564,7 +3592,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (enemy-method-132 self) + (dispose! self) (let ((v1-3 (-> self root-override2 root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -3622,7 +3650,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (enemy-method-132 self) + (dispose! self) (let ((v1-3 (-> self root-override2 root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) diff --git a/goal_src/jak2/engine/ambient/ambient-h.gc b/goal_src/jak2/engine/ambient/ambient-h.gc index 9cbb8c413b..bc39ed1df2 100644 --- a/goal_src/jak2/engine/ambient/ambient-h.gc +++ b/goal_src/jak2/engine/ambient/ambient-h.gc @@ -38,7 +38,7 @@ :flag-assert #xe00000018 (:methods (talker-speech-class-method-9 (_type_) symbol 9) - (talker-speech-class-method-10 (_type_) none 10) + (play-communicator-speech! (_type_) none 10) (talker-speech-class-method-11 (_type_) none 11) (talker-speech-class-method-12 (_type_ int) none 12) (talker-speech-class-method-13 (_type_ int) none 13) diff --git a/goal_src/jak2/engine/ambient/ambient.gc b/goal_src/jak2/engine/ambient/ambient.gc index 6c6fa2dde3..86d9438ca8 100644 --- a/goal_src/jak2/engine/ambient/ambient.gc +++ b/goal_src/jak2/engine/ambient/ambient.gc @@ -119,7 +119,9 @@ ) ) -(defmethod talker-speech-class-method-10 talker-speech-class ((obj talker-speech-class)) +(defmethod play-communicator-speech! talker-speech-class ((obj talker-speech-class)) + "Plays the provided [[talker-speech-class]] +@TODO - understand the array from [[game-info]] better" (set! (-> *game-info* unknown-pad6 (+ (* (-> obj speech) 2) 1)) (the-as uint #xffff)) 0 (none) @@ -171,7 +173,7 @@ ) (logtest? (-> arg0 flags) 1) ) - (talker-speech-class-method-10 arg0) + (play-communicator-speech! arg0) ) (set! s2-0 (lookup-gui-connection-id *gui-control* (-> arg0 name) (-> arg0 channel) (gui-action none))) (set! s2-0 (cond @@ -379,7 +381,7 @@ :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) (if (logtest? (-> self message flags) 1) - (talker-speech-class-method-10 (-> self message)) + (play-communicator-speech! (-> self message)) ) (set-setting! 'hint (process->ppointer self) 0 0) (set-setting! 'speech-control #f 0 0) diff --git a/goal_src/jak2/engine/collide/collide-shape-h.gc b/goal_src/jak2/engine/collide/collide-shape-h.gc index e98cec4f25..e66bef02f2 100644 --- a/goal_src/jak2/engine/collide/collide-shape-h.gc +++ b/goal_src/jak2/engine/collide/collide-shape-h.gc @@ -17,44 +17,6 @@ (declare-type collide-cache basic) (declare-type rigid-body structure) -(defenum penetrate - :bitfield #t - :type uint64 - (touch 0) ;; 1 - (generic-attack 1) ;; 2 - (lunge 2) ;; 4 - (flop 3) ;; 8 - (punch 4) ;; 16 - (spin 5) ;; 32 - (roll 6) ;; 64 - (uppercut 7) ;; 128 - (bonk 8) ;; 256 - (tube 9) ;; 512 - (vehicle 10) ;; 1024 - (flut-attack 11) ;; 2048 - (board 12) ;; 4096 - (mech 13) ;; 8192 - (mech-punch 14) ;; 16384 - (mech-bonk 15) ;; 32768 - (dark-skin 16) ;; hi 1 - (dark-punch 17) ;; hi 2 - (dark-bomb 18) ;; hi 4 - (dark-giant 19) ;; hi 8 - (shield 20) ;; hi 16 - (explode 21) ;; hi 32 - (jak-yellow-shot 22) ;; hi 64 - (jak-red-shot 23) ;; hi 128 - (jak-blue-shot 24) ;; hi 256 - (jak-dark-shot 25) ;; hi 512 - (enemy-yellow-shot 26) ;; hi 1024 - (enemy-dark-shot 27) ;; hi 2048 - (eco-yellow 28) ;; hi 4096 - (eco-red 29) ;; hi 8192 - (eco-blue 30) ;; hi 16384 - (eco-green 31) ;; hi 32768 - (knocked 32) ;; hihi 1 - ) - (defenum collide-spec :bitfield #t :type uint32 @@ -511,7 +473,7 @@ (set-collide-as! (_type_ collide-spec) none 48) (modify-collide-as! (_type_ int collide-spec collide-spec) none 49) (send-shoves (_type_ process touching-shapes-entry float float float) symbol 50) - (above-ground? (_type_ collide-query vector object float float float) symbol 51) + (above-ground? (_type_ collide-query vector collide-spec float float float) symbol 51) (water-info-init! (_type_ water-info collide-action) water-info 52) (iterate-prims (_type_ (function collide-shape-prim none)) none 53) (pusher-init (_type_) none 54) diff --git a/goal_src/jak2/engine/collide/collide-shape.gc b/goal_src/jak2/engine/collide/collide-shape.gc index 482054334d..86da03c123 100644 --- a/goal_src/jak2/engine/collide/collide-shape.gc +++ b/goal_src/jak2/engine/collide/collide-shape.gc @@ -1799,15 +1799,21 @@ ) ) -(defmethod above-ground? collide-shape ((obj collide-shape) (arg0 collide-query) (arg1 vector) (arg2 object) (arg3 float) (arg4 float) (arg5 float)) - "Check to see if we are above the ground." +(defmethod above-ground? collide-shape ((obj collide-shape) + (arg0 collide-query) + (arg1 vector) + (arg2 collide-spec) + (arg3 float) + (arg4 float) + (arg5 float) + ) (set! (-> arg0 start-pos quad) (-> arg1 quad)) (+! (-> arg0 start-pos y) arg3) (vector-reset! (-> arg0 move-dist)) (set! (-> arg0 move-dist y) (- (+ arg3 arg4))) (let ((v1-2 arg0)) (set! (-> v1-2 radius) arg5) - (set! (-> v1-2 collide-with) (the-as collide-spec arg2)) + (set! (-> v1-2 collide-with) arg2) (set! (-> v1-2 ignore-process0) (-> obj process)) (set! (-> v1-2 ignore-process1) #f) (set! (-> v1-2 ignore-pat) (-> obj pat-ignore-mask)) diff --git a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc index 389c8a6ad0..31553f7d63 100644 --- a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc +++ b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc @@ -15,6 +15,7 @@ :flag-assert #x1d00800100 ) + (define *ripple-for-dark-eco-pool* (new 'static 'ripple-wave-set :count 3 :converted #f @@ -42,6 +43,7 @@ ) ) +;; WARN: Return type mismatch ambient-sound vs none. (defmethod offset! dark-eco-pool ((obj dark-eco-pool)) "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." (let ((t9-0 (method-of-type water-anim offset!))) @@ -69,9 +71,10 @@ (none) ) -(defmethod art-init! dark-eco-pool ((obj dark-eco-pool)) - "Initialize a [[water-anim]]'s [[skel-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) +;; WARN: Return type mismatch ripple-wave-set vs none. +(defmethod init-water! dark-eco-pool ((obj dark-eco-pool)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) (t9-0 obj) ) (let ((s5-0 (new 'process 'ripple-control))) diff --git a/goal_src/jak2/engine/common_objs/elevator.gc b/goal_src/jak2/engine/common_objs/elevator.gc index afa49171ac..3dafc1d90b 100644 --- a/goal_src/jak2/engine/common_objs/elevator.gc +++ b/goal_src/jak2/engine/common_objs/elevator.gc @@ -25,7 +25,7 @@ (elevator-flags-13) (elevator-flags-14) (elevator-flags-15) - (elevator-flags-16) + (airlock-opened) (elevator-flags-17) ) ;; ---elevator-flags diff --git a/goal_src/jak2/engine/common_objs/projectile-h.gc b/goal_src/jak2/engine/common_objs/projectile-h.gc index 0cc94b4177..c6198f5d82 100644 --- a/goal_src/jak2/engine/common_objs/projectile-h.gc +++ b/goal_src/jak2/engine/common_objs/projectile-h.gc @@ -71,9 +71,9 @@ (spawn-impact-particles (_type_) none 25) (spawn-shell-particles (_type_) none 26) (unknown-particles (_type_) none 27) - (play-impact-sound (_type_ projectile-options) sound-id 28) + (play-impact-sound (_type_ projectile-options) none 28) (stop-sound! (_type_) none 29) - (init-collision! (_type_) none 30) + (init-proj-collision! (_type_) none 30) (init-proj-settings! (_type_) none 31) (go-moving! (_type_) none 32) (go-sitting! (_type_) none 33) @@ -131,10 +131,3 @@ (noop (_type_) none 41) ) ) - - -0 - - - - diff --git a/goal_src/jak2/engine/common_objs/projectile.gc b/goal_src/jak2/engine/common_objs/projectile.gc index 2949ec1f3d..9e511ef05b 100644 --- a/goal_src/jak2/engine/common_objs/projectile.gc +++ b/goal_src/jak2/engine/common_objs/projectile.gc @@ -145,9 +145,9 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (none) ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound projectile ((obj projectile) (arg0 projectile-options)) - (the-as sound-id 0) + 0 + (none) ) (defmethod stop-sound! projectile ((obj projectile)) @@ -401,7 +401,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (none) ) -(defmethod init-collision! projectile ((obj projectile)) +(defmethod init-proj-collision! projectile ((obj projectile)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -482,7 +482,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (set! (-> self old-dist v1-18) 4095996000.0) ) (logior! (-> self options) (projectile-options proj-options-4)) - (init-collision! self) + (init-proj-collision! self) (let ((s5-0 (-> self root-override))) (when (type? s5-0 collide-shape-moving) (set! (-> self root-override dynam gravity y) 1228800.0) @@ -626,7 +626,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p ) ) -(defmethod init-collision! projectile-bounce ((obj projectile-bounce)) +(defmethod init-proj-collision! projectile-bounce ((obj projectile-bounce)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/engine/common_objs/water-anim.gc b/goal_src/jak2/engine/common_objs/water-anim.gc index 57f74a9bb8..b59fedc92e 100644 --- a/goal_src/jak2/engine/common_objs/water-anim.gc +++ b/goal_src/jak2/engine/common_objs/water-anim.gc @@ -32,7 +32,7 @@ (idle () _type_ :state 21) (move-to-point! (_type_ vector) int 22) (get-ripple-height (_type_ vector) float 23) - (art-init! (_type_) none 24) + (init-water! (_type_) none 24) (reset-root! (_type_) trsqv 25) (water-anim-init! (_type_) none 26) (water-anim-method-27 (_type_) none 27) @@ -499,8 +499,8 @@ (none) ) -(defmethod art-init! water-anim ((obj water-anim)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." +(defmethod init-water! water-anim ((obj water-anim)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" (let ((s5-0 (-> obj look))) (if (or (< s5-0 0) (>= s5-0 (-> *water-anim-look* length))) (go process-drawable-art-error "skel group") @@ -616,7 +616,7 @@ (reset-root! self) (water-anim-init! self) (offset! self) - (art-init! self) + (init-water! self) (go-virtual idle) (none) ) @@ -633,7 +633,7 @@ This commonly includes things such as: (reset-root! obj) (water-anim-init! obj) (offset! obj) - (art-init! obj) + (init-water! obj) (go (method-of-object obj idle)) (none) ) diff --git a/goal_src/jak2/engine/game/penetrate-h.gc b/goal_src/jak2/engine/game/penetrate-h.gc index 1e78c62228..275b7a7260 100644 --- a/goal_src/jak2/engine/game/penetrate-h.gc +++ b/goal_src/jak2/engine/game/penetrate-h.gc @@ -5,6 +5,7 @@ ;; name in dgo: penetrate-h ;; dgos: ENGINE, GAME +;; +++penetrate (defenum penetrate :bitfield #t :type uint64 @@ -41,7 +42,39 @@ (eco-blue 30) ;; hi 16384 (eco-green 31) ;; hi 32768 (knocked 32) ;; hihi 1 + (penetrate-33 33) + (penetrate-34 34) + (penetrate-35 35) + (penetrate-36 36) + (penetrate-37 37) + (penetrate-38 38) + (penetrate-39 39) + (penetrate-40 40) + (penetrate-41 41) + (penetrate-42 42) + (penetrate-43 43) + (penetrate-44 44) + (penetrate-45 45) + (penetrate-46 46) + (penetrate-47 47) + (penetrate-48 48) + (penetrate-49 49) + (penetrate-50 50) + (penetrate-51 51) + (penetrate-52 52) + (penetrate-53 53) + (penetrate-54 54) + (penetrate-55 55) + (penetrate-56 56) + (penetrate-57 57) + (penetrate-58 58) + (penetrate-59 59) + (penetrate-60 60) + (penetrate-61 61) + (penetrate-62 62) + (penetrate-63 63) ) +;; ---penetrate ;; DECOMP BEGINS @@ -86,6 +119,7 @@ ) ) +;; WARN: Return type mismatch uint vs penetrate. (defun penetrated-by-all&hit-points->penetrated-by ((arg0 penetrate) (arg1 int)) (let ((a0-1 arg1)) (the-as penetrate (logior (logclear arg0 (penetrate @@ -155,4 +189,3 @@ ) ) ) - diff --git a/goal_src/jak2/engine/level/level-h.gc b/goal_src/jak2/engine/level/level-h.gc index 90b6e7ff51..b2eaceae85 100644 --- a/goal_src/jak2/engine/level/level-h.gc +++ b/goal_src/jak2/engine/level/level-h.gc @@ -116,6 +116,33 @@ (declare-type level-load-info basic) (define-extern lookup-level-info (function symbol level-load-info)) +;; +++bigmap-id +(defenum bigmap-id + :type uint32 + (bigmap-id-0 0) + (bigmap-id-1 1) + (bigmap-id-2 2) + (bigmap-id-3 3) + (bigmap-id-4 4) + (bigmap-id-5 5) + (bigmap-id-6 6) + (bigmap-id-7 7) + (bigmap-id-8 8) + (bigmap-id-9 9) + (bigmap-id-10 10) + (bigmap-id-11 11) + (bigmap-id-12 12) + (bigmap-id-13 13) + (sewer-default 14) + (sewer-with-board-area 15) + (bigmap-id-16 16) + (bigmap-id-17 17) + (bigmap-id-18 18) + (bigmap-id-19 19) + (bigmap-id-20 20)) +;; ---bigmap-id + + ;; DECOMP BEGINS (deftype level-vis-info (basic) @@ -200,7 +227,7 @@ (draw-priority float :offset-assert 224) (level-flags uint32 :offset-assert 228) (fog-height float :offset-assert 232) - (bigmap-id uint32 :offset-assert 236) + (bigmap-id bigmap-id :offset-assert 236) (ocean-near-translucent? symbol :offset-assert 240) (ocean-far? symbol :offset-assert 244) (mood-range mood-range :inline :offset-assert 256) diff --git a/goal_src/jak2/engine/level/level-info.gc b/goal_src/jak2/engine/level/level-info.gc index a7a47f08ee..54c7687c0e 100644 --- a/goal_src/jak2/engine/level/level-info.gc +++ b/goal_src/jak2/engine/level/level-info.gc @@ -72,7 +72,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -128,7 +128,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -302,7 +302,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -452,7 +452,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -675,7 +675,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -923,7 +923,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -977,7 +977,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -1031,7 +1031,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -1085,7 +1085,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -1189,7 +1189,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xe + :bigmap-id (bigmap-id sewer-default) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1243,7 +1243,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xe + :bigmap-id (bigmap-id sewer-default) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1407,7 +1407,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x10 + :bigmap-id (bigmap-id bigmap-id-16) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1461,7 +1461,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x10 + :bigmap-id (bigmap-id bigmap-id-16) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1667,7 +1667,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1769,7 +1769,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1847,7 +1847,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1924,7 +1924,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2054,7 +2054,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2107,7 +2107,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2208,7 +2208,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2288,7 +2288,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x13 + :bigmap-id (bigmap-id bigmap-id-19) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2439,7 +2439,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x13 + :bigmap-id (bigmap-id bigmap-id-19) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2543,7 +2543,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2623,7 +2623,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2677,7 +2677,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xb + :bigmap-id (bigmap-id bigmap-id-11) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.75 1.0 0.75 1.0)) @@ -2805,7 +2805,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xb + :bigmap-id (bigmap-id bigmap-id-11) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.75 1.0 0.75 1.0)) @@ -2860,7 +2860,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xb + :bigmap-id (bigmap-id bigmap-id-11) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -2965,7 +2965,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xc + :bigmap-id (bigmap-id bigmap-id-12) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -3020,7 +3020,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3075,7 +3075,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3130,7 +3130,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -3233,7 +3233,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xc + :bigmap-id (bigmap-id bigmap-id-12) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -3361,7 +3361,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3415,7 +3415,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3469,7 +3469,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3571,7 +3571,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3674,7 +3674,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3752,7 +3752,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3831,7 +3831,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3933,7 +3933,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4013,7 +4013,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4140,7 +4140,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4194,7 +4194,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4346,7 +4346,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x11 + :bigmap-id (bigmap-id bigmap-id-17) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4528,7 +4528,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xd + :bigmap-id (bigmap-id bigmap-id-13) :ocean-near-translucent? #f :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4583,7 +4583,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xd + :bigmap-id (bigmap-id bigmap-id-13) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5211,7 +5211,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x8 + :bigmap-id (bigmap-id bigmap-id-8) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.0 1.0)) @@ -5267,7 +5267,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x8 + :bigmap-id (bigmap-id bigmap-id-8) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.0 1.0)) @@ -5371,7 +5371,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x6 + :bigmap-id (bigmap-id bigmap-id-6) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5427,7 +5427,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x6 + :bigmap-id (bigmap-id bigmap-id-6) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5531,7 +5531,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x8 + :bigmap-id (bigmap-id bigmap-id-8) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5589,7 +5589,7 @@ :draw-priority 9.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5645,7 +5645,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5701,7 +5701,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5757,7 +5757,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5812,7 +5812,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5867,7 +5867,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5996,7 +5996,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6125,7 +6125,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6254,7 +6254,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6550,7 +6550,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6701,7 +6701,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6853,7 +6853,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7316,7 +7316,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7370,7 +7370,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7524,7 +7524,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7630,7 +7630,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7805,7 +7805,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7909,7 +7909,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7988,7 +7988,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8115,7 +8115,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8221,7 +8221,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8375,7 +8375,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8528,7 +8528,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8704,7 +8704,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -8879,7 +8879,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9078,7 +9078,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9253,7 +9253,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9378,7 +9378,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9505,7 +9505,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9559,7 +9559,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9614,7 +9614,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9670,7 +9670,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9726,7 +9726,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9782,7 +9782,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9838,7 +9838,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9894,7 +9894,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9950,7 +9950,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10006,7 +10006,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10062,7 +10062,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10118,7 +10118,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10173,7 +10173,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10228,7 +10228,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10283,7 +10283,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10338,7 +10338,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10393,7 +10393,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10473,7 +10473,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10528,7 +10528,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10584,7 +10584,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10662,7 +10662,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10741,7 +10741,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10843,7 +10843,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.5 0.5)) @@ -10896,7 +10896,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10951,7 +10951,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11006,7 +11006,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11061,7 +11061,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11115,7 +11115,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11170,7 +11170,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11225,7 +11225,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11280,7 +11280,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11335,7 +11335,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11390,7 +11390,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11445,7 +11445,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11500,7 +11500,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11555,7 +11555,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11610,7 +11610,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11665,7 +11665,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11720,7 +11720,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11775,7 +11775,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11830,7 +11830,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12030,7 +12030,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12084,7 +12084,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12139,7 +12139,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12194,7 +12194,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12249,7 +12249,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12304,7 +12304,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12359,7 +12359,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12462,7 +12462,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12543,7 +12543,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x3 + :bigmap-id (bigmap-id bigmap-id-3) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12700,7 +12700,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x4 + :bigmap-id (bigmap-id bigmap-id-4) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12754,7 +12754,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x4 + :bigmap-id (bigmap-id bigmap-id-4) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12880,7 +12880,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x1 + :bigmap-id (bigmap-id bigmap-id-1) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12984,7 +12984,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x2 + :bigmap-id (bigmap-id bigmap-id-2) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13063,7 +13063,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13118,7 +13118,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x2 + :bigmap-id (bigmap-id bigmap-id-2) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13174,7 +13174,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x2 + :bigmap-id (bigmap-id bigmap-id-2) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13302,7 +13302,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13357,7 +13357,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13413,7 +13413,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13468,7 +13468,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13522,7 +13522,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13674,7 +13674,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x9 + :bigmap-id (bigmap-id bigmap-id-9) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13826,7 +13826,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x9 + :bigmap-id (bigmap-id bigmap-id-9) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13880,7 +13880,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13936,7 +13936,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13991,7 +13991,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14068,7 +14068,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14164,7 +14164,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14244,7 +14244,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14299,7 +14299,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14354,7 +14354,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14409,7 +14409,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14488,7 +14488,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14566,7 +14566,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14622,7 +14622,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) diff --git a/goal_src/jak2/engine/nav/nav-enemy-h.gc b/goal_src/jak2/engine/nav/nav-enemy-h.gc index 1b82e497ef..a372a4c9fb 100644 --- a/goal_src/jak2/engine/nav/nav-enemy-h.gc +++ b/goal_src/jak2/engine/nav/nav-enemy-h.gc @@ -69,8 +69,8 @@ :size-assert #x25c :flag-assert #xb201e0025c (:methods - (enemy-method-112 (_type_ nav-enemy-info) float :replace 112) - (enemy-method-113 (_type_ nav-enemy-info) none :replace 113) + (set-enemy-info! (_type_ nav-enemy-info) none :replace 112) + (init-enemy-behaviour-and-stats! (_type_ nav-enemy-info) none :replace 113) (taunt () _type_ :state 137) (pacing () _type_ :state 138) (circling () _type_ :state 139) diff --git a/goal_src/jak2/engine/nav/nav-enemy.gc b/goal_src/jak2/engine/nav/nav-enemy.gc index 35605b890f..ea82d97ea4 100644 --- a/goal_src/jak2/engine/nav/nav-enemy.gc +++ b/goal_src/jak2/engine/nav/nav-enemy.gc @@ -30,7 +30,9 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 15] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 23] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 33] -(defmethod enemy-method-74 nav-enemy ((obj nav-enemy) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler nav-enemy ((obj nav-enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (let ((v1-0 arg2)) (the-as object (cond ((= v1-0 'nav-mesh-kill) @@ -45,10 +47,10 @@ (go (method-of-object obj debug-control)) ) ((= v1-0 'debug-control-off) - (enemy-method-72 obj) + (react-to-focus obj) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -123,7 +125,15 @@ (cond ((-> obj enemy-info-override move-to-ground) (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (when (enemy-method-126 obj s3-1 s4-0 (-> obj enemy-info-override recover-gnd-collide-with) 8192.0 81920.0 1024.0) + (when (enemy-above-ground? + obj + s3-1 + s4-0 + (-> obj enemy-info-override recover-gnd-collide-with) + 8192.0 + 81920.0 + 1024.0 + ) (let ((f0-4 (- (-> gp-0 trans y) (-> s3-1 best-other-tri intersect y)))) (if (and (>= 12288.0 f0-4) (< -8192.0 f0-4)) (return #f) @@ -172,7 +182,7 @@ ) (logclear! (-> obj enemy-flags) (enemy-flag directed)) (if (and (enemy-method-102 obj) (zero? (logand (-> obj focus-status) (focus-status dead)))) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (the-as symbol @@ -207,10 +217,14 @@ ) ) -(defmethod enemy-method-55 nav-enemy ((obj nav-enemy)) +(defmethod track-target! nav-enemy ((obj nav-enemy)) + "Does a lot of various things relating to interacting with the target +- tracks when the enemy was last drawn +- looks at the target and handles attacking +@TODO Not extremely well understood yet" (with-pp (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) - (set! (-> obj last-draw-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj last-draw-time) (-> pp clock frame-counter)) ) (enemy-method-129 obj) (when (logtest? (enemy-flag use-trigger) (-> obj enemy-flags)) @@ -259,10 +273,10 @@ ) ) (when (and (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (the-as int (-> obj auto-reset-penetrate-time))) (seconds 0.1)) + (>= (- (-> pp clock frame-counter) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) ) (logclear! (-> obj enemy-flags) (enemy-flag attackable-backup)) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((v1-62 0)) (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) (set! v1-62 (logior (shl 1 32) v1-62)) @@ -350,7 +364,7 @@ 0 ) ) - (enemy-method-55 obj) + (track-target! obj) (update-transforms (-> obj root-override2)) 0 (none) @@ -919,7 +933,12 @@ ) ) -(defmethod enemy-method-98 nav-enemy ((obj nav-enemy) (arg0 process-focusable) (arg1 vector)) +(defmethod in-aggro-range? nav-enemy ((obj nav-enemy) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" (if (and arg0 (not arg1)) (set! arg1 (get-trans arg0 1)) ) @@ -970,7 +989,7 @@ ) (else (when (>= (- (-> pp clock frame-counter) (-> obj frustration-time)) - (the-as time-frame (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time))) + (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time)) ) (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag39) (-> obj enemy-flags)))) 0 @@ -1056,7 +1075,10 @@ (none) ) -(defmethod enemy-method-112 nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) +;; WARN: Return type mismatch float vs none. +(defmethod set-enemy-info! nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) + "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it +@param info Set `enemy-info` accordingly" (set! (-> obj enemy-info-override) arg0) (set! (-> arg0 callback-info) *nav-enemy-callback-info*) (when (and (!= (-> obj enemy-info-override neck-joint) -1) (zero? (-> obj neck))) @@ -1070,9 +1092,11 @@ (set! (-> obj neck max-dist) 102400.0) (set! (-> obj neck ignore-angle) 16384.0) ) + (none) ) -(defmethod enemy-method-113 nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) +(defmethod init-enemy-behaviour-and-stats! nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" (local-vars (sv-16 res-tag)) (when (coin-flip? obj) (let ((a0-2 (-> obj node-list data 2))) @@ -1086,7 +1110,7 @@ (logior! (-> obj mask) (process-mask actor-pause)) (logior! (-> obj enemy-flags) (enemy-flag notice)) (set! (-> obj nav-radius-backup) (-> obj root-override2 nav-radius)) - (enemy-method-112 obj arg0) + (set-enemy-info! obj arg0) (set! (-> obj enemy-info-override callback-info) *nav-enemy-callback-info*) (let ((a1-2 (-> obj enemy-info-override idle-anim-script))) (if a1-2 @@ -1205,12 +1229,12 @@ (set! (-> obj incoming attacker-handle) (the-as handle #f)) (let ((s4-0 (-> obj root-override2))) (set! (-> obj penetrated-by-all) (-> obj root-override2 penetrated-by)) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (set! (-> s4-0 event-self) 'touched) ) (set! (-> obj penetrated-flinch) (the-as penetrate (-> arg0 penetrate-flinch))) (set! (-> obj penetrated-knocked) (the-as penetrate (-> arg0 penetrate-knocked))) - (set! (-> obj reaction-time) (the-as uint (get-rand-int-range obj 30 240))) + (set! (-> obj reaction-time) (get-rand-int-range obj 30 240)) (let* ((v1-113 (-> obj enemy-flags)) (a0-47 (-> obj fact-info-override enemy-options)) (v1-114 (logior (enemy-flag @@ -1255,9 +1279,9 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (enemy-method-114 obj) + (init-enemy-collision! obj) (process-drawable-from-entity! obj arg0) - (enemy-method-115 obj) + (init-enemy! obj) (when (> (-> obj enemy-info-override gem-joint) 0) (cond ((or (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status save))) @@ -1323,7 +1347,7 @@ This commonly includes things such as: ) (defbehavior nav-enemy-simple-post nav-enemy () - (enemy-method-55 self) + (track-target! self) (update-transforms (-> self root-override2)) 0 (none) @@ -1521,7 +1545,7 @@ This commonly includes things such as: ((and (= s5-0 (enemy-aware enemy-aware-3)) (-> obj enemy-info-override use-circling)) (go (method-of-object obj circling)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go (method-of-object obj flee)) ) (else @@ -1595,7 +1619,7 @@ This commonly includes things such as: (t9-0) ) ) - (set! (-> self state-timeout) (the-as uint 300)) + (set! (-> self state-timeout) (seconds 1)) (let ((v1-5 self)) (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) @@ -1648,7 +1672,7 @@ This commonly includes things such as: (t9-0) ) ) - (set! (-> self state-timeout) (the-as uint 300)) + (set! (-> self state-timeout) (seconds 1)) (logior! (-> self nav state flags) (nav-state-flag at-target)) (let ((v1-8 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-8 enemy-flags))) @@ -1841,7 +1865,7 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post nav-enemy-simple-post @@ -1876,7 +1900,7 @@ This commonly includes things such as: (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -1888,10 +1912,10 @@ This commonly includes things such as: (go-virtual active) ) ) - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1920,7 +1944,7 @@ This commonly includes things such as: (let ((f0-0 (vector-vector-distance (-> self root-override2 trans) a1-0))) (set! (-> self state-timeout) (the-as - uint + 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))) ) ) @@ -1954,18 +1978,18 @@ This commonly includes things such as: (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (go-virtual active) ) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (go-stare self) ) ) @@ -2015,7 +2039,7 @@ This commonly includes things such as: 0 (nav-enemy-method-167 self) (vector-reset! (-> self root-override2 transv)) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (none) ) :exit (behavior () @@ -2076,9 +2100,9 @@ This commonly includes things such as: ) (let ((gp-0 (-> self focus aware))) (if (< (the-as int gp-0) 2) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self)) ) (cond @@ -2086,12 +2110,10 @@ This commonly includes things such as: (go-virtual active) ) ((= gp-0 (enemy-aware enemy-aware-3)) - (if (and (enemy-method-107 self) + (if (and (get-enemy-target self) (not (and (-> self enemy-info-override use-frustration) (logtest? (enemy-flag enemy-flag39) (-> self enemy-flags))) ) - (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (go-hostile self) ) @@ -2099,14 +2121,12 @@ This commonly includes things such as: (go-virtual circling) ) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ((and (= gp-0 (enemy-aware enemy-aware-2)) (-> self enemy-info-override use-pacing) - (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (go-virtual pacing) ) @@ -2155,7 +2175,7 @@ This commonly includes things such as: ) :exit (-> (method-of-type nav-enemy stare) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self)) ) (let ((v1-6 (-> self focus aware))) @@ -2163,7 +2183,7 @@ This commonly includes things such as: ((>= 1 (the-as int v1-6)) (go-virtual active) ) - ((and (= v1-6 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= v1-6 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-virtual hostile) ) ) @@ -2218,7 +2238,7 @@ This commonly includes things such as: :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) @@ -2235,8 +2255,8 @@ 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-override2 trans quad)) - (set! (-> self state-timeout) (the-as uint (get-rand-int-range self 2100 3300))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self state-timeout) (get-rand-int-range self 2100 3300)) + (set! (-> self starting-time) (-> self clock frame-counter)) (if (zero? (get-rand-int self 2)) (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag40) (-> self enemy-flags)))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag40)))) @@ -2256,17 +2276,16 @@ This commonly includes things such as: ) ) (let ((gp-1 (-> self focus aware))) - (if (or (!= gp-1 3) (not (enemy-method-107 self))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (if (or (!= gp-1 3) (not (get-enemy-target self))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 1 (the-as int gp-1)) (go-virtual active) ) (when (= gp-1 (enemy-aware enemy-aware-3)) - (when (and (enemy-method-107 self) (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (when (and (get-enemy-target self) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (nav-enemy-method-161 self) (go-virtual hostile) @@ -2278,14 +2297,14 @@ This commonly includes things such as: (if (nav-enemy-method-163 self) (go-stare2 self) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (nav-enemy-method-161 self) (go-stare2 self) ) ) ) (when (>= 1024.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (zero? (get-rand-int self 3)) ) (nav-enemy-method-161 self) @@ -2362,7 +2381,7 @@ This commonly includes things such as: :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) @@ -2396,7 +2415,7 @@ This commonly includes things such as: ) (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (none) ) :trans (behavior () @@ -2406,10 +2425,10 @@ This commonly includes things such as: ) ) (let ((gp-1 (-> self focus aware))) - (if (or (!= gp-1 3) (not (enemy-method-107 self))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (if (or (!= gp-1 3) (not (get-enemy-target self))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -2418,10 +2437,8 @@ This commonly includes things such as: ) ) (when (and (= gp-1 (enemy-aware enemy-aware-3)) - (enemy-method-107 self) - (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (get-enemy-target self) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (nav-enemy-method-161 self) (go-hostile self) @@ -2525,9 +2542,9 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (let ((v1-3 (-> self focus aware))) - (if (!= v1-3 (enemy-aware enemy-aware-4)) + (if (!= v1-3 (enemy-aware unaware)) (go-stare self) ) ) diff --git a/goal_src/jak2/engine/target/gun/gun-blue-shot.gc b/goal_src/jak2/engine/target/gun/gun-blue-shot.gc index 0b9e5448e0..e583eabae0 100644 --- a/goal_src/jak2/engine/target/gun/gun-blue-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-blue-shot.gc @@ -207,6 +207,7 @@ (none) ) +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound gun-blue-shot ((obj gun-blue-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -218,6 +219,7 @@ ) ) ) + (none) ) (defmethod made-impact? gun-blue-shot ((obj gun-blue-shot)) @@ -260,7 +262,7 @@ ) ) -(defmethod init-collision! gun-blue-shot ((obj gun-blue-shot)) +(defmethod init-proj-collision! gun-blue-shot ((obj gun-blue-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc index 5795e88dd5..cb69f5e3fc 100644 --- a/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc @@ -250,6 +250,7 @@ (none) ) +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound gun-yellow-shot ((obj gun-yellow-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -267,6 +268,7 @@ ) ) ) + (none) ) (defmethod made-impact? gun-yellow-shot ((obj gun-yellow-shot)) @@ -321,7 +323,7 @@ (none) ) -(defmethod init-collision! gun-yellow-shot ((obj gun-yellow-shot)) +(defmethod init-proj-collision! gun-yellow-shot ((obj gun-yellow-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc b/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc index f79a169beb..adedb8b3ee 100644 --- a/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc +++ b/goal_src/jak2/engine/target/mech_suit/grunt-mech.gc @@ -194,8 +194,12 @@ ) -(defmethod enemy-method-55 grunt-mech ((obj grunt-mech)) - ((method-of-type grunt enemy-method-55) obj) +(defmethod track-target! grunt-mech ((obj 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!) obj) 0 (none) ) @@ -292,7 +296,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (let ((gp-0 (enemy-method-107 obj))) + (let ((gp-0 (get-enemy-target obj))) (when gp-0 (cond ((logtest? (focus-status mech) (-> gp-0 focus-status)) @@ -458,7 +462,7 @@ (let ((s4-1 (new 'stack-no-clear 'vector))) (vector+! s4-1 (-> obj root-override2 trans) (the-as vector (-> s5-0 out-travel))) (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (when (enemy-method-126 obj s5-1 s4-1 (the-as collide-spec (-> obj gnd-collide)) 4096.0 122880.0 1024.0) + (when (enemy-above-ground? obj s5-1 s4-1 (the-as collide-spec (-> obj gnd-collide)) 4096.0 122880.0 1024.0) (set! (-> s4-1 y) (-> s5-1 best-other-tri intersect y)) (set! (-> obj dismount-dest quad) (-> s4-1 quad)) #t @@ -559,7 +563,7 @@ ;; WARN: Return type mismatch object vs none. (defmethod grunt-mech-method-191 grunt-mech ((obj grunt-mech)) (with-pp - (if (>= (-> pp clock frame-counter) (the-as time-frame (-> obj state-timeout))) + (if (>= (-> pp clock frame-counter) (-> obj state-timeout)) (go (method-of-object obj mech-dismount)) ) (none) @@ -573,10 +577,8 @@ (set! (-> self state-time) (-> self clock frame-counter)) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (set! (-> self root-override2 root-prim prim-core collide-as) (collide-spec)) - (enemy-method-110 self) - (set! (-> self state-timeout) - (the-as uint (+ (-> self clock frame-counter) (get-rand-int-range self 450 900))) - ) + (stop-looking-at-target! self) + (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 450 900))) (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) (none) ) @@ -808,9 +810,7 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt circling) enter)) - (set! (-> self state-timeout) - (the-as uint (+ (-> self clock frame-counter) (get-rand-int-range self 750 1200))) - ) + (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 750 1200))) (none) ) :trans (behavior () @@ -820,10 +820,10 @@ ) ) (let ((gp-1 (-> self focus aware))) - (if (or (!= gp-1 3) (not (enemy-method-107 self))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (if (or (!= gp-1 3) (not (get-enemy-target self))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -832,19 +832,17 @@ ) ) (when (= gp-1 (enemy-aware enemy-aware-3)) - (let ((v1-33 (enemy-method-107 self))) + (let ((v1-33 (get-enemy-target self))) (when v1-33 (cond ((logtest? (focus-status mech) (-> v1-33 focus-status)) - (when (>= (-> self clock frame-counter) (the-as time-frame (-> self state-timeout))) + (when (>= (-> self clock frame-counter) (-> self state-timeout)) (nav-enemy-method-161 self) (go-hostile self) ) ) (else - (when (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (when (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) (nav-enemy-method-161 self) (go-hostile self) ) @@ -872,9 +870,7 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt-mech mech-post-circling) enter)) - (set! (-> self state-timeout) - (the-as uint (+ (-> self clock frame-counter) (get-rand-int-range self 900 1800))) - ) + (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 900 1800))) (none) ) :trans (-> (method-of-type grunt-mech mech-post-circling) trans) diff --git a/goal_src/jak2/engine/target/target-turret-shot.gc b/goal_src/jak2/engine/target/target-turret-shot.gc index 51caafce22..d9edacb602 100644 --- a/goal_src/jak2/engine/target/target-turret-shot.gc +++ b/goal_src/jak2/engine/target/target-turret-shot.gc @@ -199,26 +199,26 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touched) - (let* ((s4-0 proc) - (v1-1 (if (type? s4-0 process-drawable) - (the-as process-drawable s4-0) - ) - ) + (let* ((toucher-proc proc) + (toucher (if (type? toucher-proc process-drawable) + (the-as process-drawable toucher-proc) + ) + ) ) - (when v1-1 - (-> v1-1 root) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) (process->ppointer self)) - (set! (-> a1-2 num-params) 2) - (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) (-> event param 0)) - (let ((v1-7 (new 'static 'attack-info :mask (attack-info-mask mode id damage)))) - (set! (-> v1-7 id) (-> self attack-id)) - (set! (-> v1-7 mode) 'explode) - (set! (-> v1-7 damage) (-> self damage)) - (set! (-> a1-2 param 1) (the-as uint v1-7)) + (when toucher + (-> toucher root) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask mode id damage)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info mode) 'explode) + (set! (-> attack-info damage) (-> self damage)) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function proc a1-2) + (send-event-function proc evt) ) ) ) @@ -229,14 +229,14 @@ ) ) :code (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core world-sphere w) 4915.2) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> (the-as collide-shape-prim-group root-prim) child 0 prim-core world-sphere w) 4915.2) ) - (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-0 options) (overlaps-others-options)) - (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) - (set! (-> a1-0 tlist) *touching-list*) - (find-overlapping-shapes (-> self root-override) a1-0) + (let ((overlap-params (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> overlap-params options) (overlaps-others-options)) + (set! (-> overlap-params collide-with-filter) (the-as collide-spec -1)) + (set! (-> overlap-params tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) overlap-params) ) (suspend) (go-virtual die) @@ -324,11 +324,11 @@ (defmethod spawn-shell-particles turret-shot ((obj turret-shot)) "TODO - confirm" - (let* ((s5-0 (-> obj root-override)) - (v1-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> s5-0 trans)) 2048.0)) + (let* ((root (-> obj root-override)) + (v1-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> root trans)) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) ) - (set! (-> gp-0 quad) (-> s5-0 trans quad)) + (set! (-> gp-0 quad) (-> root trans quad)) (vector+! gp-0 gp-0 v1-2) (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) (when s5-1 @@ -370,19 +370,19 @@ (none) ) -;; WARN: Return type mismatch int vs sound-id. -(defmethod play-impact-sound turret-shot ((obj turret-shot) (arg0 projectile-options)) - (let ((v1-0 arg0)) +(defmethod play-impact-sound turret-shot ((obj turret-shot) (proj-options projectile-options)) + (let ((options proj-options)) (cond - ((zero? v1-0) + ((zero? options) (sound-play "drl-turret-fire") ) - ((= v1-0 (projectile-options lose-altitude)) + ((= options (projectile-options lose-altitude)) (sound-play "drl-turret-hit") ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; WARN: Return type mismatch projectile-options vs none. @@ -399,21 +399,21 @@ (none) ) -(defmethod init-collision! turret-shot ((obj turret-shot)) +(defmethod init-proj-collision! turret-shot ((obj turret-shot)) "Init the [[projectile]]'s [[collide-shape]]" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) ) - (set! (-> s5-0 no-reaction) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) - (set! (-> s5-0 total-prims) (the-as uint 3)) - (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) - (set! (-> s4-0 prim-core collide-with) + (set! (-> cshape penetrate-using) (penetrate enemy-dark-shot)) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 2) 0))) + (set! (-> cshape total-prims) (the-as uint 3)) + (set! (-> prim-group prim-core collide-as) (collide-spec projectile)) + (set! (-> prim-group prim-core collide-with) (collide-spec backgnd jak @@ -428,13 +428,13 @@ obstacle-for-jak ) ) - (set! (-> s4-0 prim-core action) (collide-action solid)) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 4915.2) - (set! (-> s5-0 root-prim) s4-0) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 0.0 4915.2) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) - (set! (-> v1-13 prim-core collide-with) + (let ((prim-sphere-1 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-1 prim-core collide-as) (collide-spec projectile)) + (set! (-> prim-sphere-1 prim-core collide-with) (collide-spec backgnd jak @@ -449,25 +449,25 @@ obstacle-for-jak ) ) - (set! (-> v1-13 prim-core action) (collide-action solid deadly)) - (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 2048.0) + (set! (-> prim-sphere-1 prim-core action) (collide-action solid deadly)) + (set-vector! (-> prim-sphere-1 local-sphere) 0.0 0.0 0.0 2048.0) ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) - (set! (-> v1-15 prim-core collide-with) + (let ((prim-sphere-2 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-2 prim-core collide-as) (collide-spec projectile)) + (set! (-> prim-sphere-2 prim-core collide-with) (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list obstacle-for-jak) ) - (set! (-> v1-15 prim-core action) (collide-action deadly)) - (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4915.2) + (set! (-> prim-sphere-2 prim-core action) (collide-action deadly)) + (set-vector! (-> prim-sphere-2 local-sphere) 0.0 0.0 0.0 4915.2) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-18 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> s5-0 max-iteration-count) (the-as uint 1)) - (set! (-> s5-0 event-self) 'touched) - (set! (-> obj root-override) s5-0) + (set! (-> cshape max-iteration-count) (the-as uint 1)) + (set! (-> cshape event-self) 'touched) + (set! (-> obj root-override) cshape) ) (set! (-> obj root-override pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) diff --git a/goal_src/jak2/engine/util/script.gc b/goal_src/jak2/engine/util/script.gc index ba1c073fa1..d0570b836a 100644 --- a/goal_src/jak2/engine/util/script.gc +++ b/goal_src/jak2/engine/util/script.gc @@ -137,6 +137,7 @@ ) ;; WARN: Return type mismatch object vs process. +;; ERROR: Failed load: (set! v1-23 (l.wu 0)) at op 104 ;; WARN: Using new Jak 2 rtype-of (defun command-get-process ((arg0 object) (arg1 process)) (with-pp @@ -275,9 +276,9 @@ ;; WARN: Return type mismatch object vs entity. (defun command-get-entity ((search object) (fallback entity)) "- If `search` is a [[process]] - return it's `entity` - - If `search` is an [[entity]] - return it - - If `search` is a [[string]] - return the result of [[entity-by-name]] - - If `search` is [[null?]] or [[empty]] or if no other condition passes, return `fallback`" +- If `search` is an [[entity]] - return it +- If `search` is a [[string]] - return the result of [[entity-by-name]] +- If `search` is [[null?]] or [[empty]] or if no other condition passes, return `fallback`" (the-as entity (cond ((null? search) (empty) @@ -406,18 +407,6 @@ ) ) -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch -;; WARN: Stack slot offset 28 signed mismatch ;; WARN: Using new Jak 2 rtype-of ;; WARN: Using new Jak 2 rtype-of ;; WARN: Using new Jak 2 rtype-of @@ -2071,14 +2060,14 @@ (let ((a1-10 (-> sv-84 node-list data sv-104))) (let* ((v1-46 sv-96) (t0-0 (-> a1-10 bone transform)) - (a0-23 (-> t0-0 vector 0 quad)) - (a2-2 (-> t0-0 vector 1 quad)) - (a3-1 (-> t0-0 vector 2 quad)) + (a0-23 (-> t0-0 quad 0)) + (a2-2 (-> t0-0 quad 1)) + (a3-1 (-> t0-0 quad 2)) (t0-1 (-> t0-0 trans quad)) ) - (set! (-> v1-46 vector 0 quad) a0-23) - (set! (-> v1-46 vector 1 quad) a2-2) - (set! (-> v1-46 vector 2 quad) a3-1) + (set! (-> v1-46 quad 0) a0-23) + (set! (-> v1-46 quad 1) a2-2) + (set! (-> v1-46 quad 2) a3-1) (set! (-> v1-46 trans quad) t0-1) ) (vector<-cspace! (-> sv-96 trans) a1-10) @@ -2114,14 +2103,14 @@ (when (logtest? (-> sv-80 flags) (sp-group-flag screen-space)) (let* ((a2-4 sv-96) (a3-3 *identity-matrix*) - (v1-67 (-> a3-3 vector 0 quad)) - (a0-45 (-> a3-3 vector 1 quad)) - (a1-12 (-> a3-3 vector 2 quad)) + (v1-67 (-> a3-3 quad 0)) + (a0-45 (-> a3-3 quad 1)) + (a1-12 (-> a3-3 quad 2)) (a3-4 (-> a3-3 trans quad)) ) - (set! (-> a2-4 vector 0 quad) v1-67) - (set! (-> a2-4 vector 1 quad) a0-45) - (set! (-> a2-4 vector 2 quad) a1-12) + (set! (-> a2-4 quad 0) v1-67) + (set! (-> a2-4 quad 1) a0-45) + (set! (-> a2-4 quad 2) a1-12) (set! (-> a2-4 trans quad) a3-4) ) ) @@ -3012,7 +3001,7 @@ (when (-> arg0 side-effect?) (let ((a0-2 (string->talker-speech (the-as string (-> arg0 param 1))))) (if a0-2 - (talker-speech-class-method-10 a0-2) + (play-communicator-speech! a0-2) ) ) ) diff --git a/goal_src/jak2/levels/atoll/atoll-part.gc b/goal_src/jak2/levels/atoll/atoll-part.gc index 278c8eeedf..e3e1d25302 100644 --- a/goal_src/jak2/levels/atoll/atoll-part.gc +++ b/goal_src/jak2/levels/atoll/atoll-part.gc @@ -293,6 +293,7 @@ (arg3 sparticle-launcher) (arg4 sparticle-launch-state) ) + "@TODO - particle docs" (local-vars (v1-15 float) (v1-16 float)) (rlet ((vf0 :class vf) (vf1 :class vf) @@ -564,6 +565,7 @@ ) (defun check-drop-level-atoll-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the ocean level, render the splash" (let ((f30-0 (get-height *ocean* (the-as vector (-> arg2 vector)) #t))) (when (and (!= f30-0 4095996000.0) (< (-> arg2 vector 0 y) f30-0)) (let ((s3-0 (new 'stack-no-clear 'vector))) @@ -769,6 +771,7 @@ ) (defun check-drop-level-atoll-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the provided y-value, render the splash" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak2/levels/atoll/juicer.gc b/goal_src/jak2/levels/atoll/juicer.gc index 13296de38b..7900d73798 100644 --- a/goal_src/jak2/levels/atoll/juicer.gc +++ b/goal_src/jak2/levels/atoll/juicer.gc @@ -323,7 +323,7 @@ (none) ) -(defmethod init-collision! juicer-shot ((obj juicer-shot)) +(defmethod init-proj-collision! juicer-shot ((obj juicer-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -539,7 +539,72 @@ :default-hit-points 9 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.9 :attack-shove-back (meters 3) @@ -658,8 +723,12 @@ ) ) -(defmethod enemy-method-55 juicer ((obj juicer)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! juicer ((obj 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!))) (t9-0 obj) ) (los-control-method-9 (-> obj los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -681,13 +750,15 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) (go (method-of-object obj knocked)) ) (none) ) -(defmethod enemy-method-74 juicer ((obj juicer) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler juicer ((obj juicer) (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-flinch) (cond @@ -743,7 +814,7 @@ (('instant-death) (when (> (-> obj hit-points) 0) (set! (-> obj hit-points) 0) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((s4-0 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) (vector-z-quaternion! s4-0 (-> obj root-override2 quat)) (vector-float*! s4-0 s4-0 -1.0) @@ -770,10 +841,10 @@ (if (and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) (handle->process (-> obj focus handle)))) (set! (-> obj hit-focus) (the-as enemy-focus #t)) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -934,7 +1005,7 @@ ) (if (< v1-1 (-> a0-0 curve num-cverts)) (set! (-> self ambush-path-pt) v1-1) - (enemy-method-72 self) + (react-to-focus self) ) ) (until #f @@ -1003,7 +1074,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1024,7 +1095,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1121,7 +1192,7 @@ (when (and (or (logtest? (-> self nav state flags) (nav-state-flag blocked)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (if (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 1) (seconds 2))) (< 20480.0 f30-0) @@ -1675,7 +1746,7 @@ ) ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 juicer ((obj juicer) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 juicer ((obj juicer) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1684,8 +1755,8 @@ ) ) -(defmethod enemy-method-114 juicer ((obj juicer)) - "@abstract" +(defmethod init-enemy-collision! juicer ((obj juicer)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1790,14 +1861,14 @@ ) ) -(defmethod enemy-method-115 juicer ((obj juicer)) - "@abstract" +(defmethod init-enemy! juicer ((obj juicer)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-juicer" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *juicer-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *juicer-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (set! (-> v1-5 up) (the-as uint 1)) (set! (-> v1-5 nose) (the-as uint 2)) diff --git a/goal_src/jak2/levels/atoll/sniper.gc b/goal_src/jak2/levels/atoll/sniper.gc index 6144cc0c02..aee12ecf1e 100644 --- a/goal_src/jak2/levels/atoll/sniper.gc +++ b/goal_src/jak2/levels/atoll/sniper.gc @@ -53,7 +53,72 @@ :default-hit-points 12 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -230,12 +295,12 @@ ) ) -(defmethod enemy-method-115 sniper ((obj sniper)) - "@abstract" - (let ((t9-0 (method-of-type spyder enemy-method-115))) +(defmethod init-enemy! sniper ((obj sniper)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (let ((t9-0 (method-of-type spyder init-enemy!))) (t9-0 obj) ) - (enemy-method-112 obj *sniper-nav-enemy-info*) + (set-enemy-info! obj *sniper-nav-enemy-info*) (logior! (-> obj focus-status) (focus-status ignore)) (logclear! (-> obj focus-status) (focus-status dangerous)) (logclear! (-> obj enemy-flags) (enemy-flag check-water)) @@ -243,9 +308,9 @@ (none) ) -(defmethod enemy-method-114 sniper ((obj sniper)) - "@abstract" - (let ((t9-0 (method-of-type spyder enemy-method-114))) +(defmethod init-enemy-collision! sniper ((obj sniper)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((t9-0 (method-of-type spyder init-enemy-collision!))) (t9-0 obj) ) (let ((v1-2 (-> obj root-override2 root-prim))) diff --git a/goal_src/jak2/levels/city/common/vehicle.gc b/goal_src/jak2/levels/city/common/vehicle.gc index 82ab455903..f38a55fa99 100644 --- a/goal_src/jak2/levels/city/common/vehicle.gc +++ b/goal_src/jak2/levels/city/common/vehicle.gc @@ -53,8 +53,8 @@ (define *debug-vehicle-work* (new 'static 'debug-vehicle-work)) -(defskelgroup skel-vehicle-explosion vehicle-explosion 0 2 - ((1 (meters 999999))) +(defskelgroup skel-vehicle-explosion vehicle-explosion vehicle-explosion-lod0-jg vehicle-explosion-idle-ja + ((vehicle-explosion-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 50) ) @@ -749,7 +749,7 @@ (let ((s3-0 (new 'stack-no-clear 'collide-query))) (logclear! (-> s4-1 status) (collide-status on-ground)) (cond - ((above-ground? s4-1 s3-0 (-> s4-1 trans) 1 0.0 102400.0 1024.0) + ((above-ground? s4-1 s3-0 (-> s4-1 trans) (collide-spec backgnd) 0.0 102400.0 1024.0) (set! (-> s4-1 gspot-pos quad) (-> s4-1 trans quad)) (set! (-> s4-1 gspot-pos y) (-> s3-0 best-other-tri intersect y)) (set! (-> s4-1 gspot-normal quad) (-> s3-0 best-other-tri normal quad)) diff --git a/goal_src/jak2/levels/city/farm/ctyfarma-part.gc b/goal_src/jak2/levels/city/farm/ctyfarma-part.gc index 7f35ff3582..994f2970f4 100644 --- a/goal_src/jak2/levels/city/farm/ctyfarma-part.gc +++ b/goal_src/jak2/levels/city/farm/ctyfarma-part.gc @@ -69,6 +69,7 @@ ) (defun birth-func-ctyfarma-drip ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Create a new dirt drip, don't go below the ocean or the ground" (let ((s4-0 (new 'stack-no-clear 'collide-query))) (set! (-> s4-0 start-pos quad) (-> arg2 launchrot quad)) (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) @@ -112,6 +113,7 @@ ) (defun check-drop-level-ctyfarma-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the provided y-value, render the splash" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak2/levels/city/farm/ctyfarmb-part.gc b/goal_src/jak2/levels/city/farm/ctyfarmb-part.gc index 379ed57794..ef12208fa3 100644 --- a/goal_src/jak2/levels/city/farm/ctyfarmb-part.gc +++ b/goal_src/jak2/levels/city/farm/ctyfarmb-part.gc @@ -69,6 +69,7 @@ ) (defun birth-func-ctyfarmb-drip ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Create a new dirt drip, don't go below the ocean or the ground" (let ((s4-0 (new 'stack-no-clear 'collide-query))) (set! (-> s4-0 start-pos quad) (-> arg2 launchrot quad)) (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) @@ -112,6 +113,7 @@ ) (defun check-drop-level-ctyfarmb-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the provided y-value, render the splash" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak2/levels/city/farm/yakow.gc b/goal_src/jak2/levels/city/farm/yakow.gc index ccbcaf0a80..2bf696afe5 100644 --- a/goal_src/jak2/levels/city/farm/yakow.gc +++ b/goal_src/jak2/levels/city/farm/yakow.gc @@ -63,7 +63,72 @@ :default-hit-points 5 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -137,11 +202,14 @@ (set! (-> *yakow-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-56 yakow ((obj yakow) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack yakow ((obj yakow) (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]]" 0 ) -(defmethod enemy-method-74 yakow ((obj yakow) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler yakow ((obj yakow) (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 (('attack) (let ((v1-1 (the-as object (-> arg3 param 1)))) @@ -152,7 +220,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -228,7 +296,7 @@ ) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-draw-time) (-> self clock frame-counter)) ) (enemy-method-129 self) (ja-post) @@ -390,8 +458,8 @@ :post (the-as (function none :behavior yakow) ja-post) ) -(defmethod enemy-method-114 yakow ((obj yakow)) - "@abstract" +(defmethod init-enemy-collision! yakow ((obj yakow)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -436,14 +504,14 @@ (none) ) -(defmethod enemy-method-115 yakow ((obj yakow)) - "@abstract" +(defmethod init-enemy! yakow ((obj yakow)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-yakow" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *yakow-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *yakow-nav-enemy-info*) (let ((v1-5 (-> obj nav))) (set! (-> v1-5 speed-scale) 1.0) ) diff --git a/goal_src/jak2/levels/city/oracle/oracle-scenes.gc b/goal_src/jak2/levels/city/oracle/oracle-scenes.gc index 9a2df5f2a4..01b68b4a99 100644 --- a/goal_src/jak2/levels/city/oracle/oracle-scenes.gc +++ b/goal_src/jak2/levels/city/oracle/oracle-scenes.gc @@ -840,9 +840,9 @@ "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" (logior! (-> obj draw status) (draw-control-status no-draw-bounds)) - (let ((v1-4 (-> obj root-override root-prim))) - (set! (-> v1-4 prim-core collide-as) (collide-spec)) - (set! (-> v1-4 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> obj root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (-> obj draw art-group data 3) 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 fa25d2b4a6..896c92e00b 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-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -100,7 +100,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -263,7 +263,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -340,7 +340,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-166 self) (set! (-> self player-blocking) 0.0) (none) @@ -361,7 +361,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -408,7 +408,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -512,7 +512,7 @@ (set! (-> self enemy-flags) v1-39) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -546,7 +546,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-110 self) + (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)) @@ -570,7 +570,7 @@ gp-0 ) ) - (enemy-method-72 self) + (react-to-focus self) ) ) ) diff --git a/goal_src/jak2/levels/city/slums/kor/kid.gc b/goal_src/jak2/levels/city/slums/kor/kid.gc index 6f91544d61..2dc823bcc2 100644 --- a/goal_src/jak2/levels/city/slums/kor/kid.gc +++ b/goal_src/jak2/levels/city/slums/kor/kid.gc @@ -41,7 +41,72 @@ :default-hit-points 100 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak civilian enemy vehicle-sphere hit-by-others-list player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.7 :attack-shove-back (meters 3) @@ -115,7 +180,9 @@ (set! (-> *kid-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 kid ((obj kid) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler kid ((obj kid) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('arrest) @@ -156,11 +223,11 @@ (go (method-of-object obj arrested)) ) (('attack) - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) #f ) (else - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -298,8 +365,8 @@ ) ) -(defmethod enemy-method-114 kid ((obj kid)) - "@abstract" +(defmethod init-enemy-collision! kid ((obj kid)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -389,15 +456,15 @@ (none) ) -(defmethod enemy-method-115 kid ((obj kid)) - "@abstract" +(defmethod init-enemy! kid ((obj kid)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-kid" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *kid-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *kid-nav-enemy-info*) (let ((v1-7 (-> obj neck))) (set! (-> v1-7 up) (the-as uint 1)) (set! (-> v1-7 nose) (the-as uint 2)) @@ -405,7 +472,7 @@ (set-vector! (-> v1-7 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-7 ignore-angle) 30947.555) ) - (let ((t9-4 (method-of-type bot enemy-method-115))) + (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -422,7 +489,8 @@ (none) ) -(defmethod enemy-method-72 kid ((obj kid)) +(defmethod react-to-focus kid ((obj kid)) + "@TODO - flesh out docs" (kid-method-232 obj) (none) ) @@ -510,10 +578,11 @@ ) ) -(defmethod enemy-method-56 kid ((obj kid) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack kid ((obj kid) (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]]" (if (= (-> obj course course-id) 7) 0 - ((method-of-type bot enemy-method-56) obj arg0 arg1) + ((method-of-type bot damage-amount-from-attack) obj arg0 arg1) ) ) 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 73efe29940..7927334fff 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-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -99,7 +99,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -272,7 +272,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -349,7 +349,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-166 self) (set! (-> self player-blocking) 0.0) (none) @@ -370,7 +370,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -417,7 +417,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -521,7 +521,7 @@ (set! (-> self enemy-flags) v1-39) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -555,7 +555,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-110 self) + (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)) @@ -579,7 +579,7 @@ gp-0 ) ) - (enemy-method-72 self) + (react-to-focus self) ) ) ) diff --git a/goal_src/jak2/levels/city/slums/kor/kor.gc b/goal_src/jak2/levels/city/slums/kor/kor.gc index 3a0f2f4474..be29d3f62b 100644 --- a/goal_src/jak2/levels/city/slums/kor/kor.gc +++ b/goal_src/jak2/levels/city/slums/kor/kor.gc @@ -50,7 +50,72 @@ :default-hit-points 100 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak civilian enemy vehicle-sphere hit-by-others-list player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.7 :attack-shove-back (meters 3) @@ -124,7 +189,9 @@ (set! (-> *kor-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 kor ((obj kor) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler kor ((obj kor) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('arrest) @@ -164,7 +231,7 @@ (go (method-of-object obj arrested)) ) (else - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -302,8 +369,8 @@ ) ) -(defmethod enemy-method-114 kor ((obj kor)) - "@abstract" +(defmethod init-enemy-collision! kor ((obj kor)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -393,15 +460,15 @@ (none) ) -(defmethod enemy-method-115 kor ((obj kor)) - "@abstract" +(defmethod init-enemy! kor ((obj kor)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-kor" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *kor-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *kor-nav-enemy-info*) (let ((v1-7 (-> obj neck))) (set! (-> v1-7 up) (the-as uint 1)) (set! (-> v1-7 nose) (the-as uint 2)) @@ -409,7 +476,7 @@ (set-vector! (-> v1-7 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-7 ignore-angle) 30947.555) ) - (let ((t9-4 (method-of-type bot enemy-method-115))) + (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -426,7 +493,8 @@ (none) ) -(defmethod enemy-method-72 kor ((obj kor)) +(defmethod react-to-focus kor ((obj kor)) + "@TODO - flesh out docs" (kor-method-232 obj) (none) ) @@ -514,7 +582,8 @@ ) ) -(defmethod enemy-method-56 kor ((obj kor) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack kor ((obj kor) (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]]" 0 ) diff --git a/goal_src/jak2/levels/common/ai/bot-states.gc b/goal_src/jak2/levels/common/ai/bot-states.gc index 13626b0271..0bb1251cfb 100644 --- a/goal_src/jak2/levels/common/ai/bot-states.gc +++ b/goal_src/jak2/levels/common/ai/bot-states.gc @@ -76,7 +76,7 @@ (set! (-> self enemy-flags) v1-45) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -95,7 +95,7 @@ (bot-method-191 self) (when (zero? (-> self hit-points)) (set! (-> self hit-points) 1) - (set! (-> self fated-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self fated-time) (-> self clock frame-counter)) ) (logclear! (-> self bot-flags) (bot-flags bf11)) (let ((t9-2 (-> (method-of-type nav-enemy knocked) enter))) diff --git a/goal_src/jak2/levels/common/ai/bot.gc b/goal_src/jak2/levels/common/ai/bot.gc index eb8cff5f87..b457fd860c 100644 --- a/goal_src/jak2/levels/common/ai/bot.gc +++ b/goal_src/jak2/levels/common/ai/bot.gc @@ -347,8 +347,9 @@ (none) ) -(defmethod enemy-method-56 bot ((obj bot) (arg0 process) (arg1 event-message-block)) - (let* ((t9-0 (method-of-type nav-enemy enemy-method-56)) +(defmethod damage-amount-from-attack bot ((obj bot) (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]]" + (let* ((t9-0 (method-of-type nav-enemy damage-amount-from-attack)) (v0-0 (t9-0 obj arg0 arg1)) ) (let ((v1-1 (-> obj bot-flags))) @@ -419,7 +420,10 @@ ) ;; WARN: Return type mismatch int vs enemy-aware. -(defmethod enemy-method-57 bot ((obj bot) (arg0 process-focusable) (arg1 enemy-best-focus)) +(defmethod update-target-awareness! bot ((obj bot) (arg0 process-focusable) (arg1 enemy-best-focus)) + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! +@TODO - flesh out docs +@returns the value that sets `aware`" (the-as enemy-aware 3) ) @@ -734,7 +738,9 @@ ;; WARN: disable def twice: 280. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 5] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 9] -(defmethod enemy-method-74 bot ((obj bot) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler bot ((obj bot) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v0-0 none)) (with-pp (let ((v1-0 arg2)) @@ -753,7 +759,7 @@ (-> obj waypoint waypoint-id) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -846,7 +852,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -858,7 +864,7 @@ s5-2 ) (logior! (-> obj enemy-flags) (enemy-flag look-at-focus)) - (set! (-> obj hit-focus-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) ) ) #t @@ -873,7 +879,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -914,7 +920,7 @@ ) (else (if (and (-> obj next-state) (= (-> obj next-state name) 'hidden)) - (enemy-method-72 obj) + (react-to-focus obj) ) ) ) @@ -933,7 +939,7 @@ v0-0 ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1085,7 +1091,7 @@ ;; WARN: Using new Jak 2 rtype-of (defmethod bot-check-too-far bot ((obj bot)) "Call the current [[bot-waypoint]]'s `check-too-far` function if available, otherwise use the default `course` one. - If the player is too far, play a warning speech." +If the player is too far, play a warning speech." (with-pp (let ((result 0)) (let ((too-far-check (-> obj delay-too-far-check))) @@ -1156,7 +1162,11 @@ ) ) -(defmethod enemy-method-55 bot ((obj bot)) +(defmethod track-target! bot ((obj bot)) + "Does a lot of various things relating to interacting with the target +- tracks when the enemy was last drawn +- looks at the target and handles attacking +@TODO Not extremely well understood yet" (set! (-> obj travel-prev-ry) (-> obj travel-prev-ry1)) (set! (-> obj travel-prev-ry1) (quaternion-y-angle (-> obj root-override2 quat))) (let ((f0-4 (/ (the float (-> obj hit-points)) (the float (-> obj enemy-info-override default-hit-points))))) @@ -1185,7 +1195,7 @@ ) ) ) - (let ((t9-4 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-4 (method-of-type nav-enemy track-target!))) (t9-4 obj) ) (when (not (logtest? (-> obj bot-flags) (bot-flags bf09))) @@ -1475,8 +1485,8 @@ (none) ) -(defmethod enemy-method-115 bot ((obj bot)) - "@abstract" +(defmethod init-enemy! bot ((obj bot)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (process-entity-status! obj (entity-perm-status bit-4) #t) (set! (-> obj ai-ctrl) (new 'process 'ai-task-control *bot-task-pool*)) (logclear! (-> obj mask) (process-mask enemy)) diff --git a/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc b/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc index eec608e7ed..7814fb079f 100644 --- a/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc +++ b/goal_src/jak2/levels/common/enemy/amphibian/amphibian.gc @@ -234,7 +234,9 @@ obj ) -(defmethod enemy-method-74 amphibian ((obj amphibian) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler amphibian ((obj amphibian) (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) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -272,7 +274,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -338,8 +340,9 @@ (none) ) -(defmethod enemy-method-56 amphibian ((obj amphibian) (arg0 process) (arg1 event-message-block)) - (let* ((t9-0 (method-of-type nav-enemy enemy-method-56)) +(defmethod damage-amount-from-attack amphibian ((obj amphibian) (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]]" + (let* ((t9-0 (method-of-type nav-enemy damage-amount-from-attack)) (v0-0 (t9-0 obj arg0 arg1)) ) (let ((v1-1 (-> obj hit-points))) @@ -807,7 +810,7 @@ ((and (= s5-0 (enemy-aware enemy-aware-2)) (-> obj enemy-info-override use-pacing)) (go (method-of-object obj pacing)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go (method-of-object obj flee)) ) (else @@ -838,10 +841,14 @@ (none) ) -(defmethod enemy-method-55 amphibian ((obj amphibian)) +(defmethod track-target! amphibian ((obj 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! (-> obj prev-ry) (-> obj prev-ry1)) (set! (-> obj prev-ry1) (quaternion-y-angle (-> obj root-override2 quat))) - ((method-of-type nav-enemy enemy-method-55) obj) + ((method-of-type nav-enemy track-target!) obj) (none) ) @@ -1117,7 +1124,7 @@ (set! (-> self nav state heading quad) (-> gp-2 quad)) ) 0 - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1317,7 +1324,7 @@ (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) (go-virtual attack-spin) ) - (let ((a0-2 (enemy-method-107 self))) + (let ((a0-2 (get-enemy-target self))) (when a0-2 (let* ((s5-0 (get-trans a0-2 0)) (f30-0 (vector-vector-xz-distance s5-0 (-> self root-override2 trans))) @@ -1376,7 +1383,7 @@ ) (let ((gp-0 (handle->process (-> self focus handle)))) (if (not gp-0) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) @@ -1518,7 +1525,7 @@ (suspend) (ja-eval) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior amphibian) nav-enemy-simple-post) @@ -1552,7 +1559,7 @@ ) (let ((gp-0 (handle->process (-> self focus handle)))) (if (not gp-0) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) @@ -1629,7 +1636,7 @@ (suspend) (ja-eval) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior amphibian) nav-enemy-simple-post) @@ -1723,7 +1730,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior amphibian) nav-enemy-simple-post) @@ -1737,8 +1744,8 @@ (the-as amphibian ((method-of-type nav-enemy relocate) obj arg0)) ) -(defmethod enemy-method-114 amphibian ((obj amphibian)) - "@abstract" +(defmethod init-enemy-collision! amphibian ((obj amphibian)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1815,15 +1822,15 @@ (none) ) -(defmethod enemy-method-115 amphibian ((obj amphibian)) - "@abstract" +(defmethod init-enemy! amphibian ((obj amphibian)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (set! (-> obj attacker-handle) (the-as handle #f)) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-amphibian" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *amphibian-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *amphibian-nav-enemy-info*) (set! (-> obj tongue-mod) (new 'process 'amphibian-joint-mod obj 14)) (let ((v1-6 (-> obj neck))) (set! (-> v1-6 up) (the-as uint 1)) diff --git a/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc b/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc index 7f30a8df1b..eaf4078e5d 100644 --- a/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc +++ b/goal_src/jak2/levels/common/enemy/baby_spider/tomb-baby-spider.gc @@ -295,7 +295,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -454,7 +454,7 @@ ) ) (let ((gp-4 (-> self focus aware))) - (if (or (not (enemy-method-107 self)) (!= gp-4 3)) + (if (or (not (get-enemy-target self)) (!= gp-4 3)) (go-stare self) ) ) @@ -472,7 +472,7 @@ (t9-0) ) ) - (let ((a0-1 (enemy-method-107 self))) + (let ((a0-1 (get-enemy-target self))) (when a0-1 (let ((a0-2 (get-trans a0-1 0))) (if (and (< (vector-vector-distance a0-2 (-> self root-override2 trans)) 20480.0) @@ -668,8 +668,8 @@ ) ) -(defmethod enemy-method-114 tomb-baby-spider ((obj tomb-baby-spider)) - "@abstract" +(defmethod init-enemy-collision! tomb-baby-spider ((obj tomb-baby-spider)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -742,14 +742,14 @@ (none) ) -(defmethod enemy-method-115 tomb-baby-spider ((obj tomb-baby-spider)) - "@abstract" +(defmethod init-enemy! tomb-baby-spider ((obj tomb-baby-spider)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-tomb-baby-spider" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *tomb-baby-spider-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *tomb-baby-spider-nav-enemy-info*) (none) ) diff --git a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc index 5c34e99d9d..0771604c28 100644 --- a/goal_src/jak2/levels/common/enemy/fodder/fodder.gc +++ b/goal_src/jak2/levels/common/enemy/fodder/fodder.gc @@ -38,7 +38,7 @@ ((left-eye joint-mod :offset-assert 604) (right-eye joint-mod :offset-assert 608) (look-at-other handle :offset-assert 616) - (neck-away-from basic :offset-assert 624) + (neck-away-from symbol :offset-assert 624) (look-at-other-time time-frame :offset-assert 632) (pad-iuj1n23i1 uint32 3 :offset-assert 640) (slow-timer time-frame :offset-assert 656) @@ -52,7 +52,7 @@ :flag-assert #xb7024002c0 (:methods (fodder-method-178 (_type_) none 178) - (fodder-method-179 (_type_ vector) float 179) + (look-at-position! (_type_ vector) float 179) (fodder-method-180 (_type_) symbol 180) (fodder-method-181 (_type_ symbol) none 181) (fodder-method-182 (_type_) float 182) @@ -181,9 +181,11 @@ (set! (-> *fodder-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-109 fodder ((obj fodder) (arg0 int)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-109))) - (t9-0 obj arg0) +(defmethod look-at-target! fodder ((obj fodder) (arg0 enemy-flag)) + "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available +@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" + (let ((parent-method (method-of-type nav-enemy look-at-target!))) + (parent-method obj arg0) ) (if (nonzero? (-> obj left-eye)) (mode-set! (-> obj left-eye) (joint-mod-mode polar-look-at)) @@ -195,9 +197,10 @@ (none) ) -(defmethod enemy-method-110 fodder ((obj fodder)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-110))) - (t9-0 obj) +(defmethod stop-looking-at-target! fodder ((obj fodder)) + "Will unset [[enemy-flag::death-start]] and [[enemy-flag::lock-focus]] and call [[joint-mod::shut-down]] if applicable" + (let ((parent-method (method-of-type nav-enemy stop-looking-at-target!))) + (parent-method obj) ) (if (nonzero? (-> obj left-eye)) (shut-down (-> obj left-eye)) @@ -209,24 +212,27 @@ (none) ) -(defmethod fodder-method-179 fodder ((obj fodder) (arg0 vector)) - (when (not arg0) - (let ((a0-2 (handle->process (-> obj focus handle)))) - (if a0-2 - (set! arg0 (get-trans (the-as process-focusable a0-2) 2)) +(defmethod look-at-position! fodder ((obj fodder) (position vector)) + "Adjusts the eyes to look at particular position, or the focused target +@param position If this is provided, it will be used with [[joint-mod::target-set!]] to adjust the eyes, otherwise the `focus` position is used +@return TODO - unsure what the return value is, but it seems to make the eyes more lazy" + (when (not position) + (let ((focus-proc (handle->process (-> obj focus handle)))) + (if focus-proc + (set! position (get-trans (the-as process-focusable focus-proc) 2)) (return 0.0) ) ) ) (when (nonzero? (-> obj left-eye)) - (target-set! (-> obj left-eye) arg0) + (target-set! (-> obj left-eye) position) (when (nonzero? (-> obj left-eye)) (set! (-> obj left-eye polar-external-tilt-max) (-> obj right-eye polar-internal-tilt-max)) (set! (-> obj left-eye polar-external-radius) (-> obj right-eye polar-internal-radius)) ) ) (when (nonzero? (-> obj right-eye)) - (target-set! (-> obj right-eye) arg0) + (target-set! (-> obj right-eye) position) (when (nonzero? (-> obj right-eye)) (set! (-> obj right-eye polar-external-tilt-max) (-> obj left-eye polar-internal-tilt-max)) (set! (-> obj right-eye polar-external-radius) (-> obj left-eye polar-internal-radius)) @@ -235,46 +241,52 @@ ) (defmethod fodder-method-180 fodder ((obj fodder)) + "@TODO no idea, never seems to do anything because the actor-group-count is always 0" (with-pp (when (>= (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.25)) - (dotimes (s5-0 (-> obj actor-group-count)) - (let ((s4-0 (-> obj actor-group s5-0))) - (dotimes (s3-0 (-> s4-0 length)) - (let* ((s1-0 (-> s4-0 data s3-0 actor extra process)) - (s2-0 (if (type? s1-0 fodder) - (the-as fodder s1-0) - ) - ) + (dotimes (group-idx (-> obj actor-group-count)) + (let ((group (-> obj actor-group group-idx))) + (dotimes (actor-idx (-> group length)) + (let* ((actor-proc (-> group data actor-idx actor extra process)) + (fodder-proc (if (type? actor-proc fodder) + (the-as fodder actor-proc) + ) + ) ) - (when (and s2-0 (!= s2-0 obj) (>= (- (-> pp clock frame-counter) (-> s2-0 look-at-other-time)) (seconds 0.25))) - (let* ((s1-2 (vector-! (new 'stack-no-clear 'vector) (-> s2-0 root-override2 trans) (-> obj root-override2 trans))) - (f0-0 (vector-length s1-2)) + (when (and fodder-proc + (!= fodder-proc obj) + (>= (- (-> pp clock frame-counter) (-> fodder-proc look-at-other-time)) (seconds 0.25)) + ) + (let* ((dir-to-other-fodder + (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root-override2 trans) (-> obj root-override2 trans)) + ) + (dir-length (vector-length dir-to-other-fodder)) ) - (when (< f0-0 8192.0) - (vector-float*! s1-2 s1-2 (/ 1.0 f0-0)) + (when (< dir-length 8192.0) + (vector-float*! dir-to-other-fodder dir-to-other-fodder (/ 1.0 dir-length)) (let ((f30-0 (vector-dot - s1-2 + dir-to-other-fodder (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)) vector 2) ) ) ) (when (< (cos 14563.556) f30-0) - (let ((v1-29 (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) - (when v1-29 + (let ((channel (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) + (when channel (set! (-> obj skel interp-select 0) #xe00010) (set! (-> obj skel interp-select 1) 0) - (set! (-> v1-29 param 0) 1.0) - (set! (-> v1-29 param 1) 1.0) - (set! (-> v1-29 param 2) 1.0) - (set! (-> v1-29 num-func) num-func-interp1-play!) + (set! (-> channel param 0) 1.0) + (set! (-> channel param 1) 1.0) + (set! (-> channel param 2) 1.0) + (set! (-> channel num-func) num-func-interp1-play!) ) ) (set! (-> obj look-at-other-time) (-> pp clock frame-counter)) - (set! (-> obj look-at-other) (process->handle s2-0)) + (set! (-> obj look-at-other) (process->handle fodder-proc)) (set! (-> obj neck-away-from) #f) - (set! (-> s2-0 look-at-other-time) (-> pp clock frame-counter)) - (set! (-> s2-0 look-at-other) (process->handle obj)) - (set! (-> s2-0 neck-away-from) (the-as basic #t)) + (set! (-> fodder-proc look-at-other-time) (-> pp clock frame-counter)) + (set! (-> fodder-proc look-at-other) (process->handle obj)) + (set! (-> fodder-proc neck-away-from) #t) ) ) ) @@ -289,26 +301,30 @@ ) ) -(defmethod enemy-method-55 fodder ((obj fodder)) +(defmethod track-target! fodder ((obj 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" (with-pp - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) - (t9-0 obj) + (let ((parent-method (method-of-type nav-enemy track-target!))) + (parent-method obj) ) - (let ((v1-1 (the-as process-drawable #f))) + (let ((proc (the-as process-drawable #f))) (cond ((and (< (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.5)) (begin - (let ((s5-0 (handle->process (-> obj look-at-other)))) - (set! v1-1 (if (type? s5-0 process-drawable) - (the-as process-drawable s5-0) + (let ((other-proc (handle->process (-> obj look-at-other)))) + (set! proc (if (type? other-proc process-drawable) + (the-as process-drawable other-proc) ) ) ) - v1-1 + proc ) ) - (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> v1-1 node-list data 5)))) - (fodder-method-179 obj s5-1) + (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) + (look-at-position! obj s5-1) (cond ((zero? (-> obj neck)) ) @@ -328,7 +344,7 @@ ) ) ((logtest? (-> obj enemy-flags) (enemy-flag lock-focus)) - (fodder-method-179 obj (the-as vector #f)) + (look-at-position! obj (the-as vector #f)) ) ) ) @@ -339,9 +355,9 @@ (defstate idle (fodder) :virtual #t :post (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy idle) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type nav-enemy idle) post))) + (if func + ((the-as (function none) func)) ) ) (update-transforms (-> self root-override2)) @@ -352,9 +368,9 @@ (defstate active (fodder) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy active) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy active) enter))) + (if func + (func) ) ) (logclear! (-> self enemy-flags) (enemy-flag spawn-gem chase-startup use-notice-distance)) @@ -382,9 +398,9 @@ (ja :num! (seek! max f30-0)) ) (when (enemy-method-123 self 0.8) - (let ((v1-33 self)) - (set! (-> v1-33 enemy-flags) (the-as enemy-flag (logclear (-> v1-33 enemy-flags) (enemy-flag enemy-flag36)))) - (set! (-> v1-33 nav callback-info) *nav-enemy-null-callback-info*) + (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*) ) 0 (set! (-> self state-time) (-> self clock frame-counter)) @@ -402,7 +418,7 @@ ) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.25)) - (dotimes (gp-0 (rand-vu-int-range 4 7)) + (dotimes (num-chews (rand-vu-int-range 4 7)) (ja-no-eval :group! fodder-chew-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim fodder-chew-ja) frames num-frames) -1)) f30-0) :frame-num 0.0 @@ -414,12 +430,12 @@ ) ) ) - (let ((v1-93 self)) - (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-93 enemy-flags))) - (set! (-> v1-93 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-93 enemy-flags)))) + (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)))) ) - (set! (-> v1-93 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-93 enemy-flags)))) - (set! (-> v1-93 nav callback-info) (-> v1-93 enemy-info-override callback-info)) + (set! (-> __self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> __self enemy-flags)))) + (set! (-> __self nav callback-info) (-> __self enemy-info-override callback-info)) ) 0 (ja-no-eval :num! (loop!)) @@ -458,7 +474,7 @@ (let ((f30-0 (get-rand-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) - (enemy-method-110 self) + (stop-looking-at-target! self) (if (nonzero? (-> self neck)) (mode-set! (-> self neck) (joint-mod-mode look-at)) ) @@ -519,7 +535,7 @@ (if (nonzero? (-> self neck)) (target-set! (-> self neck) gp-0) ) - (fodder-method-179 self gp-0) + (look-at-position! self gp-0) (suspend) (ja :num! (seek! max (* 2.0 f30-0))) ) @@ -528,8 +544,8 @@ (label cfg-22) (get-rand-float-range self 0.8 1.2) (new 'stack-no-clear 'vector) - (enemy-method-109 self 1) - (enemy-method-110 self) + (look-at-target! self (enemy-flag lock-focus)) + (stop-looking-at-target! self) (if (nonzero? (-> self left-eye)) (shut-down (-> self left-eye)) ) @@ -538,7 +554,7 @@ ) (let ((gp-1 (-> self focus aware))) (cond - ((and (= gp-1 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) ((>= 1 (the-as int gp-1)) @@ -583,9 +599,9 @@ (defstate hostile (fodder) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy hostile) enter))) + (if func + (func) ) ) (fodder-method-181 self #t) @@ -996,8 +1012,8 @@ #f ) -(defmethod enemy-method-114 fodder ((obj fodder)) - "@abstract" +(defmethod init-enemy-collision! fodder ((obj fodder)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1084,8 +1100,8 @@ (set! (-> arg0 ignore-angle) 30947.555) ) -(defmethod enemy-method-115 fodder ((obj fodder)) - "@abstract" +(defmethod init-enemy! fodder ((obj fodder)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1093,7 +1109,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *fodder-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *fodder-nav-enemy-info*) (when (zero? (-> obj left-eye)) (set! (-> obj left-eye) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj 23)) (fodder-setup-eye-control (-> obj left-eye)) 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 77a1a22f08..b193098a2f 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 @@ -713,13 +713,14 @@ ) -(defmethod enemy-method-72 crimson-guard-level ((obj crimson-guard-level)) +(defmethod react-to-focus crimson-guard-level ((obj crimson-guard-level)) + "@TODO - flesh out docs" (let ((s5-0 (-> obj focus aware))) (cond - ((and (= s5-0 (enemy-aware enemy-aware-3)) (enemy-method-107 obj)) + ((and (= s5-0 (enemy-aware enemy-aware-3)) (get-enemy-target obj)) (go-hostile obj) ) - ((and (= s5-0 (enemy-aware enemy-aware-2)) (enemy-method-107 obj)) + ((and (= s5-0 (enemy-aware enemy-aware-2)) (get-enemy-target obj)) (go-hostile obj) ) ((<= (the-as int s5-0) 0) @@ -728,7 +729,7 @@ ((>= 1 (the-as int s5-0)) (go (method-of-object obj active)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go-flee obj) ) (else @@ -772,16 +773,16 @@ ((>= 1 (the-as int gp-0)) (go-virtual active) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((and (= gp-0 (enemy-aware enemy-aware-2)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-2)) (get-enemy-target self)) (if (logtest? (-> self flags) 1) (go-virtual arrest) (go-hostile self) ) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -792,7 +793,9 @@ ) ;; WARN: Return type mismatch none vs object. -(defmethod enemy-method-74 crimson-guard-level ((obj crimson-guard-level) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler crimson-guard-level ((obj crimson-guard-level) (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" (let ((v1-0 arg2)) (the-as object @@ -815,7 +818,7 @@ (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-3)) ) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ((= v1-0 'trigger) (let ((v0-0 (the-as object #t))) @@ -839,10 +842,10 @@ ) ) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1158,8 +1161,12 @@ ) ;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-55 crimson-guard-level ((obj crimson-guard-level)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! crimson-guard-level ((obj 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!))) (t9-0 obj) ) (if (-> obj joint-enable) @@ -1246,7 +1253,7 @@ (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag called-dying))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (enemy-method-109 self 1) + (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)) (let ((gp-1 (-> self on-notice))) @@ -1261,13 +1268,13 @@ (let ((gp-2 (-> self focus aware))) (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) (cond - ((and (= gp-2 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-2 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((and (= gp-2 (enemy-aware enemy-aware-2)) (enemy-method-107 self)) + ((and (= gp-2 (enemy-aware enemy-aware-2)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-2 (enemy-aware enemy-aware-4)) + ((= gp-2 (enemy-aware unaware)) (go-flee self) ) (else @@ -1314,7 +1321,7 @@ (go-virtual grenade-attack) ) (else - (enemy-method-72 self) + (react-to-focus self) ) ) (none) @@ -1337,7 +1344,7 @@ (if (logtest? (-> self flags) 4) (go-virtual gun-shoot) ) - (set! (-> self reaction-time) (the-as uint (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 (get-rand-float-range self 1.0 3.0))))) (none) ) :exit (behavior () @@ -1346,12 +1353,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (< (the-as int gp-0) 2) (not (enemy-method-107 self))) + ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1426,7 +1433,7 @@ :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self reaction-time) (the-as uint (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 (get-rand-float-range self 0.5 1.5))))) (none) ) :exit (behavior () @@ -1435,12 +1442,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1505,12 +1512,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (< (the-as int gp-0) 2) (not (enemy-method-107 self))) + ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1587,12 +1594,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (< (the-as int gp-0) 2) (not (enemy-method-107 self))) + ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1679,7 +1686,7 @@ (set! (-> self miss-amount) 0.0) (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) (set! (-> self joint-enable) #t) - (set! (-> self reaction-time) (the-as uint (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 (get-rand-float-range self 3.0 5.0))))) (none) ) :exit (behavior () @@ -1690,7 +1697,7 @@ :trans (behavior () (crimson-guard-level-method-200 self) (let ((v1-2 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond ((< (the-as int v1-2) 2) (go-stare self) @@ -1698,7 +1705,7 @@ ((= v1-2 (enemy-aware enemy-aware-3)) (go-hostile self) ) - ((= v1-2 (enemy-aware enemy-aware-4)) + ((= v1-2 (enemy-aware unaware)) (go-flee self) ) ) @@ -1724,7 +1731,7 @@ ) ) (until #f - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (< 10922.667 (fabs (-> self target-y-angle))) ) (goto cfg-13) @@ -2886,7 +2893,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (enemy-method-55 self) + (track-target! self) (none) ) ) @@ -2951,7 +2958,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (enemy-method-55 self) + (track-target! self) (none) ) ) @@ -3702,7 +3709,7 @@ (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) (.svf (&-> v1-10 quad) vf6) ) - (if (enemy-method-126 obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) ) (let ((v1-14 (-> obj nav)) @@ -3761,7 +3768,7 @@ ) 0 (set! (-> s1-0 y) (-> sv-784 y)) - (if (enemy-method-126 obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) ) (set! (-> arg0 quad) (-> s1-0 quad)) @@ -3938,7 +3945,7 @@ (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) (.svf (&-> a0-3 quad) vf6) ) - (if (enemy-method-126 self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) ) @@ -4001,8 +4008,8 @@ ) ) -(defmethod enemy-method-114 crimson-guard-level ((obj crimson-guard-level)) - "@abstract" +(defmethod init-enemy-collision! crimson-guard-level ((obj crimson-guard-level)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -4135,8 +4142,8 @@ (none) ) -(defmethod enemy-method-115 crimson-guard-level ((obj crimson-guard-level)) - "@abstract" +(defmethod init-enemy! crimson-guard-level ((obj crimson-guard-level)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (local-vars (sv-16 int)) (let ((f0-0 (res-lump-float (-> obj entity) 'rotoffset))) (if (!= f0-0 0.0) @@ -4173,22 +4180,22 @@ ) ) (set! (-> obj info) *crimson-guard-level-global-info*) - (enemy-method-113 obj *crimson-guard-level-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-info*) (cond ((logtest? (-> obj flags) 1) - (enemy-method-113 obj *crimson-guard-level-tazer-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-tazer-info*) ) ((logtest? (-> obj flags) 4) - (enemy-method-113 obj *crimson-guard-level-sniper-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-sniper-info*) ) ((logtest? (-> obj flags) 2) - (enemy-method-113 obj *crimson-guard-level-blast-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-blast-info*) ) ((logtest? (-> obj flags) 8) - (enemy-method-113 obj *crimson-guard-level-grenade-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-grenade-info*) ) (else - (enemy-method-113 obj *crimson-guard-level-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-info*) ) ) (let ((v1-34 (-> obj nav))) @@ -4306,7 +4313,7 @@ ;; WARN: Return type mismatch object vs none. (defbehavior crimson-guard-level-init-by-other crimson-guard-level ((arg0 crimson-guard-level-params)) - (enemy-method-114 self) + (init-enemy-collision! self) (set! (-> self root-override2 trans quad) (-> arg0 pos quad)) (quaternion-copy! (-> self root-override2 quat) (-> arg0 quat)) (vector-identity! (-> self root-override2 scale)) @@ -4314,7 +4321,7 @@ (add-process-drawable-to-navmesh (-> arg0 nav-mesh) self #t) (set! (-> arg0 proc) self) (set! (-> self transport) (the-as handle (-> arg0 handle))) - (enemy-method-115 self) + (init-enemy! self) (crimson-guard-level-method-203 self (-> arg0 weapon)) (logior! (-> self flags) 96) (go-virtual exit-transport) diff --git a/goal_src/jak2/levels/common/enemy/hopper.gc b/goal_src/jak2/levels/common/enemy/hopper.gc index 33a8b4d27f..a96c96e50e 100644 --- a/goal_src/jak2/levels/common/enemy/hopper.gc +++ b/goal_src/jak2/levels/common/enemy/hopper.gc @@ -278,14 +278,15 @@ (set! (-> *hopper-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-73 hopper ((obj hopper)) +(defmethod kill-prefer-falling hopper ((obj hopper)) + "If available in `enemy-info`, [[go]] to the [[die-falling]] state, if not, [[die]]" (cond ((-> obj can-go-knocked?) (set! (-> obj can-go-knocked?) #f) (go (method-of-object obj knocked)) ) (else - ((method-of-type nav-enemy enemy-method-73) obj) + ((method-of-type nav-enemy kill-prefer-falling) obj) ) ) (none) @@ -530,7 +531,7 @@ ) 0 (set! (-> s5-0 y) (-> s2-0 y)) - (if (enemy-method-126 obj s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? obj s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> s5-0 y) (-> s3-1 best-other-tri intersect y)) ) ) @@ -659,7 +660,7 @@ ) (cond ((< (vector-vector-xz-distance (-> self best-point) (get-trans (the-as process-focusable gp-0) 0)) 8192.0) - (when (enemy-method-107 self) + (when (get-enemy-target self) (cond ((zero? s5-0) (set! (-> self jump-start-anim) (the-as uint 34)) @@ -795,7 +796,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -862,7 +863,7 @@ (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack 'collide-query))) (get-point-in-path! (-> self path-intro) gp-0 1.0 'exact) - (if (enemy-method-126 self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) ) @@ -874,7 +875,8 @@ ) ) -(defmethod enemy-method-132 hopper ((obj hopper)) +(defmethod dispose! hopper ((obj hopper)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> obj minimap) (logior! (-> obj minimap flags) (minimap-flag fade-out)) (set! (-> obj minimap) #f) @@ -894,8 +896,8 @@ ) ) -(defmethod enemy-method-114 hopper ((obj hopper)) - "@abstract" +(defmethod init-enemy-collision! hopper ((obj hopper)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -958,8 +960,8 @@ (none) ) -(defmethod enemy-method-115 hopper ((obj hopper)) - "@abstract" +(defmethod init-enemy! hopper ((obj hopper)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -967,7 +969,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *hopper-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *hopper-nav-enemy-info*) (set! (-> obj can-go-knocked?) #t) (let ((v1-9 (-> obj neck))) (set! (-> v1-9 up) (the-as uint 1)) diff --git a/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc b/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc index f199206950..ce81801f09 100644 --- a/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc +++ b/goal_src/jak2/levels/common/enemy/metalhead_bearer/centurion.gc @@ -150,7 +150,6 @@ ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound centurion-shot ((obj centurion-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -165,7 +164,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) (defmethod init-proj-settings! centurion-shot ((obj centurion-shot)) @@ -353,7 +353,9 @@ (set! (-> *centurion-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 centurion ((obj centurion) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler centurion ((obj centurion) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('jump) @@ -390,7 +392,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -406,10 +408,10 @@ (cond ((and (-> obj next-state) (= (-> obj next-state name) 'fire)) (centurion-method-180 obj) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -451,7 +453,7 @@ ) (let ((a1-13 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-13 from) (process->ppointer arg0)) - (set! (-> a1-13 num-params) (the-as int arg1)) + (set! (-> a1-13 num-params) arg1) (set! (-> a1-13 message) 'victory) (set! (-> a1-13 param 0) (-> arg3 param 0)) (set! (-> a1-13 param 1) (-> arg3 param 1)) @@ -465,7 +467,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -584,7 +586,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (set! (-> self victory-sound) (new 'static 'sound-id)) 0 (none) @@ -876,13 +878,18 @@ :post (the-as (function none :behavior centurion) enemy-simple-post) ) -(defmethod enemy-method-132 centurion ((obj centurion)) - (talker-speech-class-method-10 (-> *talker-speech* 58)) +(defmethod dispose! centurion ((obj centurion)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" + (play-communicator-speech! (-> *talker-speech* 58)) ((the-as (function enemy none) (find-parent-method centurion 132)) obj) (none) ) -(defmethod enemy-method-55 centurion ((obj centurion)) +(defmethod track-target! centurion ((obj 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 +@TODO Not extremely well understood yet" (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -970,7 +977,7 @@ ) (logior! (-> obj skel status) (joint-control-status sync-math)) (los-control-method-9 (-> obj los) (the-as process-focusable #f) (the-as vector #f) 2048.0) - (let ((t9-12 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-12 (method-of-type nav-enemy track-target!))) (t9-12 obj) ) (when (not (logtest? (-> obj draw status) (draw-control-status no-draw))) @@ -1142,7 +1149,7 @@ ) (else (when (-> self can-shoot?) - (if (and (enemy-method-107 self) + (if (and (get-enemy-target self) (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (+ 60.0 (* 0.0036621094 f30-0)))) (check-los? (-> self los) 0) ) @@ -1394,7 +1401,7 @@ ) ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 centurion ((obj centurion) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 centurion ((obj centurion) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1403,8 +1410,8 @@ ) ) -(defmethod enemy-method-114 centurion ((obj centurion)) - "@abstract" +(defmethod init-enemy-collision! centurion ((obj centurion)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1490,8 +1497,8 @@ ) ) -(defmethod enemy-method-115 centurion ((obj centurion)) - "@abstract" +(defmethod init-enemy! centurion ((obj centurion)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1499,7 +1506,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *centurion-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *centurion-nav-enemy-info*) (set! (-> obj shield-shot) (the-as uint 0)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 474) obj)) (let ((v1-11 (-> obj neck))) diff --git a/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc b/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc index 2ec22dbf4f..6803a1a367 100644 --- a/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc +++ b/goal_src/jak2/levels/common/enemy/metalhead_brown/metalmonk.gc @@ -307,8 +307,12 @@ ) ) -(defmethod enemy-method-55 metalmonk ((obj metalmonk)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! metalmonk ((obj 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!))) (t9-0 obj) ) (set! (-> obj old-facing quad) (-> obj new-facing quad)) @@ -317,7 +321,9 @@ (none) ) -(defmethod enemy-method-74 metalmonk ((obj metalmonk) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler metalmonk ((obj metalmonk) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked 'hit-flinch) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -350,7 +356,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -369,7 +375,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -534,7 +540,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -548,7 +554,7 @@ ) ) (let ((gp-0 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (and gp-0 (or (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) 20480.0 @@ -775,7 +781,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) ) ) (none) @@ -794,7 +800,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1023,8 +1029,8 @@ (none) ) -(defmethod enemy-method-114 metalmonk ((obj metalmonk)) - "@abstract" +(defmethod init-enemy-collision! metalmonk ((obj metalmonk)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1148,8 +1154,8 @@ ) ) -(defmethod enemy-method-115 metalmonk ((obj metalmonk)) - "@abstract" +(defmethod init-enemy! metalmonk ((obj metalmonk)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1157,7 +1163,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *metalmonk-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *metalmonk-nav-enemy-info*) (let ((v1-8 (-> obj neck))) (set! (-> v1-8 up) (the-as uint 1)) (set! (-> v1-8 nose) (the-as uint 2)) diff --git a/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc b/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc index f2969d2482..900f39c7ff 100644 --- a/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc +++ b/goal_src/jak2/levels/common/enemy/metalhead_slinger/grenadier.gc @@ -215,7 +215,9 @@ (set! (-> *grenadier-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 grenadier ((obj grenadier) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler grenadier ((obj grenadier) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('hit-knocked) @@ -229,14 +231,14 @@ (logior! (-> obj status-flags) 1) (set! (-> obj suppress-knockaside-timer) (-> pp clock frame-counter)) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (('notify) (cond ((and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) (let ((v1-23 (new 'stack-no-clear 'event-message-block))) (set! (-> v1-23 from) (process->ppointer arg0)) - (set! (-> v1-23 num-params) (the-as int arg1)) + (set! (-> v1-23 num-params) arg1) (set! (-> v1-23 message) 'victory) (set! (-> v1-23 param 0) (-> arg3 param 0)) (set! (-> v1-23 param 1) (-> arg3 param 1)) @@ -248,12 +250,12 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -453,7 +455,7 @@ ) ) (grenadier-method-181 self) - (enemy-method-109 self 2) + (look-at-target! self (enemy-flag death-start)) (set! (-> self status-flags) (logand -2 (-> self status-flags))) (none) ) @@ -470,7 +472,7 @@ (f30-0 (vector-vector-distance gp-0 s5-0)) ) (cond - ((and (< f30-0 12288.0) (enemy-method-107 self)) + ((and (< f30-0 12288.0) (get-enemy-target self)) (go-virtual spin-kick) ) ((< f30-0 40960.0) @@ -814,7 +816,7 @@ (set! (-> v1-11 attack-id) a0-19) (set! (-> self attack-id) a0-19) ) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (none) ) :exit (behavior () @@ -1103,7 +1105,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1156,8 +1158,12 @@ (none) ) -(defmethod enemy-method-55 grenadier ((obj grenadier)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! grenadier ((obj 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!))) (t9-0 obj) ) (let ((a1-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 34)))) @@ -1166,8 +1172,8 @@ (none) ) -(defmethod enemy-method-114 grenadier ((obj grenadier)) - "@abstract" +(defmethod init-enemy-collision! grenadier ((obj grenadier)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1269,14 +1275,14 @@ ) ) -(defmethod enemy-method-115 grenadier ((obj grenadier)) - "@abstract" +(defmethod init-enemy! grenadier ((obj grenadier)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-grenadier" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *grenadier-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *grenadier-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (when v1-5 (set! (-> v1-5 up) (the-as uint 1)) diff --git a/goal_src/jak2/levels/common/enemy/spyder.gc b/goal_src/jak2/levels/common/enemy/spyder.gc index b2607231fb..656824a7a3 100644 --- a/goal_src/jak2/levels/common/enemy/spyder.gc +++ b/goal_src/jak2/levels/common/enemy/spyder.gc @@ -16,7 +16,6 @@ ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound spyder-shot ((obj spyder-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -28,7 +27,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) (defmethod init-proj-settings! spyder-shot ((obj spyder-shot)) @@ -119,7 +119,72 @@ :default-hit-points 8 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -195,7 +260,9 @@ (set! (-> *spyder-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 spyder ((obj spyder) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler spyder ((obj spyder) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('hit-knocked) @@ -226,7 +293,7 @@ (if (type? (-> arg0 parent 0) enemy) (logior! (-> obj status-flags) 2) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (('notify) (cond @@ -235,7 +302,7 @@ ((= (-> arg3 param 1) (handle->process (-> obj focus handle))) (let ((a1-6 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-6 from) (process->ppointer arg0)) - (set! (-> a1-6 num-params) (the-as int arg1)) + (set! (-> a1-6 num-params) arg1) (set! (-> a1-6 message) 'victory) (set! (-> a1-6 param 0) (-> arg3 param 0)) (set! (-> a1-6 param 1) (-> arg3 param 1)) @@ -247,12 +314,12 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -263,10 +330,10 @@ (sound-play "spyder-uncloak") ) (send-event obj 'cue-chase) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -595,13 +662,17 @@ ) ) -(defmethod enemy-method-55 spyder ((obj spyder)) +(defmethod track-target! spyder ((obj 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 +@TODO Not extremely well understood yet" (spyder-method-185 obj) (spyder-method-184 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) (update-trans! (-> obj sound) (-> obj root-override2 trans)) (update! (-> obj sound)) (spyder-method-182 obj) - (let ((t9-6 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-6 (method-of-type nav-enemy track-target!))) (t9-6 obj) ) (set! (-> obj status-flags) (logand -2 (-> obj status-flags))) @@ -793,7 +864,7 @@ ) ) (spyder-method-181 self) - (enemy-method-109 self 2) + (look-at-target! self (enemy-flag death-start)) (set! (-> self status-flags) (logand -3 (-> self status-flags))) (when (!= (-> self dest-fade) 128.0) (set! (-> self shock-effect-end) (+ (-> self clock frame-counter) (seconds 1))) @@ -809,7 +880,7 @@ ) ) (set! (-> self status-flags) (logand -33 (-> self status-flags))) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (none) ) :trans (behavior () @@ -961,7 +1032,7 @@ (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-4 enemy-flags)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (none) ) @@ -977,7 +1048,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (if (or (>= 2 (the-as int (-> self focus aware))) (not (enemy-method-107 self))) + (if (or (>= 2 (the-as int (-> self focus aware))) (not (get-enemy-target self))) (go-stare self) ) (none) @@ -1153,7 +1224,7 @@ ) ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 spyder ((obj spyder) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 spyder ((obj spyder) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1162,8 +1233,8 @@ ) ) -(defmethod enemy-method-114 spyder ((obj spyder)) - "@abstract" +(defmethod init-enemy-collision! spyder ((obj spyder)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1278,14 +1349,14 @@ ) ) -(defmethod enemy-method-115 spyder ((obj spyder)) - "@abstract" +(defmethod init-enemy! spyder ((obj spyder)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-spyder" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *spyder-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *spyder-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (set! (-> v1-5 up) (the-as uint 1)) (set! (-> v1-5 nose) (the-as uint 2)) diff --git a/goal_src/jak2/levels/common/entities/fort-floor-spike.gc b/goal_src/jak2/levels/common/entities/fort-floor-spike.gc index 24cfc9f349..dea6973ff1 100644 --- a/goal_src/jak2/levels/common/entities/fort-floor-spike.gc +++ b/goal_src/jak2/levels/common/entities/fort-floor-spike.gc @@ -108,20 +108,20 @@ (vector-flatten! touched-from-dir touched-from-dir spike-quat) (set! (-> touched-from-dir y) 0.0) (vector-normalize! touched-from-dir 1.0) - (let ((response (new 'stack-no-clear 'event-message-block))) - (set! (-> response from) (process->ppointer self)) - (set! (-> response num-params) 2) - (set! (-> response message) 'attack) - (set! (-> response param 0) (-> event param 0)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack) + (set! (-> evt param 0) (-> event param 0)) (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector mode shove-back shove-up id)))) (set! (-> attack-info id) (the-as uint (-> self attack-id))) (set! (-> attack-info mode) 'deadly) (set! (-> attack-info shove-up) 24576.0) (set! (-> attack-info shove-back) 16384.0) (set! (-> attack-info vector quad) (-> touched-from-dir quad)) - (set! (-> response param 1) (the-as uint attack-info)) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function proc response) + (send-event-function proc evt) ) ) (let ((frame-count (-> self clock frame-counter))) diff --git a/goal_src/jak2/levels/common/entities/sew-gunturret.gc b/goal_src/jak2/levels/common/entities/sew-gunturret.gc index 0687212995..6463f6aae9 100644 --- a/goal_src/jak2/levels/common/entities/sew-gunturret.gc +++ b/goal_src/jak2/levels/common/entities/sew-gunturret.gc @@ -452,10 +452,10 @@ (gun-tilt float :offset-assert 564) (desired-twist float :offset-assert 568) (desired-tilt float :offset-assert 572) - (los-clear basic :offset-assert 576) + (los-clear symbol :offset-assert 576) (smoke-part sparticle-launch-control :offset-assert 580) (casing-part sparticle-launch-control :offset-assert 584) - (flash-state basic :offset-assert 588) + (flash-state symbol :offset-assert 588) (can-shoot symbol :offset-assert 592) (last-hit-time time-frame :offset-assert 600) (init-mat matrix :inline :offset-assert 608) @@ -466,11 +466,11 @@ :size-assert #x2a4 :flag-assert #x8e023002a4 (:methods - (sew-gunturret-method-137 (_type_ symbol) none 137) - (sew-gunturret-method-138 (_type_) none 138) - (sew-gunturret-method-139 (_type_) none 139) - (sew-gunturret-method-140 (_type_ symbol) none 140) - (sew-gunturret-method-141 (_type_) none 141) + (aim-turret! (_type_ symbol) none 137) + (update-collision! (_type_) none 138) + (set-aim-at-default! (_type_) none 139) + (fire-turret! (_type_ symbol) none 140) + (init-turret-params! (_type_) none 141) ) ) @@ -557,17 +557,19 @@ (set! (-> *sew-gunturret-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod sew-gunturret-method-137 sew-gunturret ((obj sew-gunturret) (arg0 symbol)) +(defmethod aim-turret! sew-gunturret ((obj sew-gunturret) (aim-at-target? symbol)) + "Calculates the angle and tilt for the turret to either aim at the target, or it's default direction +@param aim-at-target? Whether or not the turret should aim at the target, will ignore the target if #f" (cond - ((and arg0 (-> obj los-clear)) - (let ((a0-2 (handle->process (-> obj focus handle)))) - (if a0-2 - (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable a0-2) 3) quad)) + ((and aim-at-target? (-> obj los-clear)) + (let ((target-proc (handle->process (-> obj focus handle)))) + (if target-proc + (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) ) ) ) (else - (sew-gunturret-method-139 obj) + (set-aim-at-default! obj) ) ) (let ((s4-0 (new 'stack-no-clear 'vector)) @@ -613,11 +615,11 @@ (-> obj aim-pos) (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj params gun-joint))) ) - (let ((s5-4 (new 'stack-no-clear 'matrix))) + (let ((matrix (new 'stack-no-clear 'matrix))) (+! (-> obj gun-twist) (fmax -364.0889 (fmin 364.0889 (* 0.3 (- (-> obj desired-twist) (-> obj gun-twist)))))) - (matrix-rotate-y! s5-4 (-> obj gun-twist)) - (matrix*! s5-4 s5-4 (-> obj init-mat)) - (matrix->quaternion (-> obj root-override2 quat) s5-4) + (matrix-rotate-y! matrix (-> obj gun-twist)) + (matrix*! matrix matrix (-> obj init-mat)) + (matrix->quaternion (-> obj root-override2 quat) matrix) ) (+! (-> obj gun-tilt) (fmax -364.0889 (fmin 364.0889 (* 0.3 (- (-> obj desired-tilt) (-> obj gun-tilt)))))) (quaternion-axis-angle! (-> obj gun-tilt-jm quat) 1.0 0.0 0.0 (-> obj gun-tilt)) @@ -625,10 +627,11 @@ (none) ) -(defmethod sew-gunturret-method-138 sew-gunturret ((obj sew-gunturret)) - (let ((a0-2 (handle->process (-> obj focus handle)))) - (if a0-2 - (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable a0-2) 3) quad)) +(defmethod update-collision! sew-gunturret ((obj sew-gunturret)) + "Updates the collision for the turret based on it's aiming direction" + (let ((target-proc (handle->process (-> obj focus handle)))) + (if target-proc + (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) ) ) (let* ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj params gun-joint)))) @@ -637,22 +640,24 @@ (when (< (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-3 1.0) (-> obj init-mat vector 2)) (cos 364.0889) ) - (let ((a1-5 (new 'stack-no-clear 'collide-query))) - (set! (-> a1-5 start-pos quad) (-> s4-0 quad)) - (set! (-> a1-5 move-dist quad) (-> s5-3 quad)) - (let ((v1-17 a1-5)) - (set! (-> v1-17 radius) 409.6) - (set! (-> v1-17 collide-with) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> s4-0 quad)) + (set! (-> cquery move-dist quad) (-> s5-3 quad)) + (let ((_cquery cquery)) + (set! (-> _cquery radius) 409.6) + (set! (-> _cquery collide-with) (collide-spec backgnd crate obstacle hit-by-player-list hit-by-others-list pusher) ) - (set! (-> v1-17 ignore-process0) obj) - (set! (-> v1-17 ignore-process1) #f) - (set! (-> v1-17 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-17 action-mask) (collide-action solid)) + (set! (-> _cquery ignore-process0) obj) + (set! (-> _cquery ignore-process1) #f) + (set! (-> _cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> _cquery action-mask) (collide-action solid)) ) - (if (>= (fill-and-probe-using-line-sphere *collide-cache* a1-5) 0.0) + (if (>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) (set! (-> obj los-clear) #f) - (set! (-> obj los-clear) (the-as basic #t)) + (set! (-> obj los-clear) #t) ) ) ) @@ -661,50 +666,53 @@ (none) ) -(defmethod sew-gunturret-method-139 sew-gunturret ((obj sew-gunturret)) +(defmethod set-aim-at-default! sew-gunturret ((obj sew-gunturret)) + "Aims the turret at it's default direction. Sets `aim-pos` accordingly" (vector+float*! (-> obj aim-pos) (-> obj root-override2 trans) (-> obj init-mat vector 2) 163840.0) 0 (none) ) -(defmethod sew-gunturret-method-140 sew-gunturret ((obj sew-gunturret) (arg0 symbol)) +(defmethod fire-turret! sew-gunturret ((obj sew-gunturret) (fire-sound? symbol)) + "Actually fires the turret, sets `flash-state` to [[#t]] +@param fire-sound? Whether to play the fire sound effect or not" (let ((v1-4 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj params gun-joint)))) - (s4-0 (new 'stack-no-clear 'projectile-init-by-other-params)) + (proj-params (new 'stack-no-clear 'projectile-init-by-other-params)) ) (let* ((s2-1 (vector-! (new 'stack-no-clear 'vector) (-> obj aim-pos) v1-4)) (f30-0 (/ 2013265900.0 (vector-length s2-1))) - (s3-0 (new 'stack-no-clear 'vector)) + (temp-vec (new 'stack-no-clear 'vector)) ) - (set! (-> s4-0 ent) (-> obj entity)) - (set! (-> s4-0 charge) 1.0) - (set! (-> s4-0 options) (projectile-options)) - (set! (-> s4-0 pos quad) (-> v1-4 quad)) - (set! (-> s4-0 notify-handle) (process->handle obj)) - (set! (-> s4-0 owner-handle) (the-as handle #f)) - (set! (-> s4-0 ignore-handle) (process->handle obj)) + (set! (-> proj-params ent) (-> obj entity)) + (set! (-> proj-params charge) 1.0) + (set! (-> proj-params options) (projectile-options)) + (set! (-> proj-params pos quad) (-> v1-4 quad)) + (set! (-> proj-params notify-handle) (process->handle obj)) + (set! (-> proj-params owner-handle) (the-as handle #f)) + (set! (-> proj-params ignore-handle) (process->handle obj)) (let* ((v1-12 *game-info*) (a0-18 (+ (-> v1-12 attack-id) 1)) ) (set! (-> v1-12 attack-id) a0-18) - (set! (-> s4-0 attack-id) a0-18) + (set! (-> proj-params attack-id) a0-18) ) - (set! (-> s4-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) - (vector-normalize-copy! (-> s4-0 vel) s2-1 491520.0) + (set! (-> proj-params timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (vector-normalize-copy! (-> proj-params vel) s2-1 491520.0) (let ((f30-1 (fmin 16384.0 f30-0))) - (set-vector! s3-0 (-> s2-1 z) (-> s2-1 y) (- (-> s2-1 x)) 1.0) - (vector-normalize! s3-0 (rand-vu-float-range (- f30-1) f30-1)) - (vector+! (-> s4-0 vel) (-> s4-0 vel) s3-0) - (vector-cross! s3-0 s3-0 (-> s4-0 vel)) - (vector-normalize! s3-0 (rand-vu-float-range (- f30-1) f30-1)) + (set-vector! temp-vec (-> s2-1 z) (-> s2-1 y) (- (-> s2-1 x)) 1.0) + (vector-normalize! temp-vec (rand-vu-float-range (- f30-1) f30-1)) + (vector+! (-> proj-params vel) (-> proj-params vel) temp-vec) + (vector-cross! temp-vec temp-vec (-> proj-params vel)) + (vector-normalize! temp-vec (rand-vu-float-range (- f30-1) f30-1)) ) - (vector+! (-> s4-0 vel) (-> s4-0 vel) s3-0) + (vector+! (-> proj-params vel) (-> proj-params vel) temp-vec) ) - (spawn-projectile guard-shot s4-0 obj *default-dead-pool*) + (spawn-projectile guard-shot proj-params obj *default-dead-pool*) ) - (if arg0 + (if fire-sound? (sound-play "gtur-shot-fire") ) - (set! (-> obj flash-state) (the-as basic #t)) + (set! (-> obj flash-state) #t) (spawn-with-cspace (-> obj casing-part) (-> obj node-list data (-> obj params hole-joints 0))) (spawn-with-cspace (-> obj casing-part) (-> obj node-list data (-> obj params hole-joints 1))) (spawn-with-cspace (-> obj casing-part) (-> obj node-list data (-> obj params hole-joints 2))) @@ -719,9 +727,9 @@ (defstate hostile (sew-gunturret) :virtual #t :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy hostile) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy hostile) exit))) + (if func + (func) ) ) (ja :group! (-> self draw art-group data (-> self params idle-anim))) @@ -732,32 +740,32 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (none) ) :code (behavior () - (sew-gunturret-method-139 self) + (set-aim-at-default! self) (until #f (-> self clock frame-counter) (until (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) (suspend) ) - (sew-gunturret-method-138 self) + (update-collision! self) (sound-play "sew-gun-lock") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.75)) - (sew-gunturret-method-137 self #t) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 0.75)) + (aim-turret! self #t) (suspend) ) ) (ja :group! (-> self draw art-group data (-> self params shoot-anim))) - (let ((s5-1 0) - (gp-2 #t) + (let ((frames 0) + (fire-sound? #t) ) (sound-play "gturret") (let ((s4-1 (-> self clock frame-counter))) @@ -765,10 +773,10 @@ (cond ((not (-> self can-shoot)) ) - ((>= (- (-> self clock frame-counter) (the-as time-frame s5-1)) (seconds 0.05)) - (sew-gunturret-method-140 self gp-2) - (set! s5-1 (the-as int (-> self clock frame-counter))) - (set! gp-2 (not gp-2)) + ((>= (- (-> self clock frame-counter) (the-as time-frame frames)) (seconds 0.05)) + (fire-turret! self fire-sound?) + (set! frames (the-as int (-> self clock frame-counter))) + (set! fire-sound? (not fire-sound?)) ) (else (set! (-> self flash-state) #f) @@ -782,8 +790,8 @@ (set! (-> self flash-state) #f) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self params idle-anim))) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.5)) + (let ((_frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 0.5)) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 0))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 1))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 2))) @@ -804,24 +812,26 @@ (defstate stare (sew-gunturret) :virtual #t :trans (behavior () - (let ((t9-0 (-> (method-of-type enemy stare) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy stare) trans))) + (if func + (func) ) ) (if (!= (-> self activate-distance) 0.0) - (sew-gunturret-method-137 self #f) + (aim-turret! self #f) ) (none) ) ) -(defmethod enemy-method-74 sew-gunturret ((obj sew-gunturret) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler sew-gunturret ((obj sew-gunturret) (proc process) (arg2 int) (event-type symbol) (event event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp - (if (and (= arg2 'notify) (< 1 (the-as int arg1)) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (if (and (= event-type 'notify) (< 1 arg2) (= (-> event param 0) 'attack) (= (-> event param 1) *target*)) (set! (-> obj last-hit-time) (-> pp clock frame-counter)) ) - (case arg2 + (case event-type (('start) (let ((v0-0 (the-as object #t))) (set! (-> obj can-shoot) (the-as symbol v0-0)) @@ -833,24 +843,24 @@ #f ) (('bonk) - (send-event arg0 'target-mech-get-off 90) - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) (process->ppointer pp)) - (set! (-> a1-10 num-params) 2) - (set! (-> a1-10 message) 'shove) - (set! (-> a1-10 param 0) (the-as uint #f)) - (let ((v1-17 (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) - (let* ((a0-4 *game-info*) - (a2-2 (+ (-> a0-4 attack-id) 1)) + (send-event proc 'target-mech-get-off 90) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer pp)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'shove) + (set! (-> evt param 0) (the-as uint #f)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> a0-4 attack-id) a2-2) - (set! (-> v1-17 id) a2-2) + (set! (-> game-info attack-id) id) + (set! (-> attack-info id) id) ) - (set! (-> v1-17 shove-back) 8192.0) - (set! (-> v1-17 shove-up) 2048.0) - (set! (-> a1-10 param 1) (the-as uint v1-17)) + (set! (-> attack-info shove-back) 8192.0) + (set! (-> attack-info shove-up) 2048.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function arg0 a1-10) + (send-event-function proc evt) ) #f ) @@ -858,7 +868,7 @@ (-> obj flash-state) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) ) ) ) @@ -867,37 +877,44 @@ (defstate die (sew-gunturret) :virtual #t :enter (behavior () - (enemy-method-132 self) - (let ((v1-3 (-> self root-override2 root-prim))) - (set! (-> v1-3 prim-core collide-as) (collide-spec)) - (set! (-> v1-3 prim-core collide-with) (collide-spec)) + (dispose! self) + (let ((root-prim (-> self root-override2 root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (set! (-> self hit-points) 0) - (talker-speech-class-method-10 (-> *talker-speech* 53)) + (play-communicator-speech! (-> *talker-speech* 53)) (none) ) :code (behavior () - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (process-spawn joint-exploder (-> self params explode-sg) 6 gp-0 *sew-gunturret-exploder-params* :to self) + (let ((exploder-tuning (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (process-spawn + joint-exploder + (-> self params explode-sg) + 6 + exploder-tuning + *sew-gunturret-exploder-params* + :to self + ) ) (activate! *camera-smush-control* 819.2 37 210 1.0 0.995 (-> self clock)) (sound-play "turret-explode") (suspend) (cleanup-for-death self) (ja-channel-set! 0) - (let ((gp-2 (new 'stack-no-clear 'vector))) - (set! (-> gp-2 quad) (-> self root-override2 trans quad)) - (set! (-> gp-2 y) (+ 10240.0 (-> gp-2 y))) - (let ((s5-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 2)) - (spawn (-> self part) gp-2) + (let ((vec (new 'stack-no-clear 'vector))) + (set! (-> vec quad) (-> self root-override2 trans quad)) + (set! (-> vec y) (+ 10240.0 (-> vec y))) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) + (spawn (-> self part) vec) (suspend) ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((_frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 1)) (suspend) ) ) @@ -908,84 +925,89 @@ (none) ) :post (behavior () - (enemy-method-55 self) + (track-target! self) (none) ) ) -(defmethod enemy-method-114 sew-gunturret ((obj sew-gunturret)) - "@abstract" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) +(defmethod init-enemy-collision! sew-gunturret ((obj sew-gunturret)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) - (set! (-> s5-0 total-prims) (the-as uint 3)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) - (set! (-> s4-0 transform-index) 3) - (set-vector! (-> s4-0 local-sphere) 0.0 9216.0 4096.0 18432.0) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 2) 0))) + (set! (-> cshape total-prims) (the-as uint 3)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid no-standon)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 9216.0 4096.0 18432.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-14 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-14 prim-core action) (collide-action solid no-standon)) - (set! (-> v1-14 transform-index) 3) - (set-vector! (-> v1-14 local-sphere) 0.0 6144.0 0.0 11264.0) + (let ((prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-sphere prim-core action) (collide-action solid no-standon)) + (set! (-> prim-sphere transform-index) 3) + (set-vector! (-> prim-sphere local-sphere) 0.0 6144.0 0.0 11264.0) ) - (let ((v1-16 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-16 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-16 prim-core action) (collide-action solid no-standon)) - (set! (-> v1-16 transform-index) 5) - (set-vector! (-> v1-16 local-sphere) 0.0 0.0 -5120.0 4096.0) + (let ((_prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> _prim-sphere prim-core collide-as) (collide-spec enemy)) + (set! (-> _prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> _prim-sphere prim-core action) (collide-action solid no-standon)) + (set! (-> _prim-sphere transform-index) 5) + (set-vector! (-> _prim-sphere local-sphere) 0.0 0.0 -5120.0 4096.0) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-19 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-19 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-19 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override2) s5-0) + (set! (-> obj root-override2) cshape) ) 0 (none) ) -(defmethod enemy-method-98 sew-gunturret ((obj sew-gunturret) (arg0 process-focusable) (arg1 vector)) +(defmethod in-aggro-range? sew-gunturret ((obj sew-gunturret) (proc process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" (cond ((= (-> obj activate-distance) 0.0) (return #t) ) (else - (let ((f0-2 (vector-dot - (vector-! (new 'stack-no-clear 'vector) (get-trans arg0 3) (-> obj root-override2 trans)) + (let ((dist (vector-dot + (vector-! (new 'stack-no-clear 'vector) (get-trans proc 3) (-> obj root-override2 trans)) (-> obj init-mat vector 2) ) ) ) - (return (and (< 0.0 f0-2) (< f0-2 (-> obj activate-distance)))) + (return (and (< 0.0 dist) (< dist (-> obj activate-distance)))) ) ) ) @@ -1022,8 +1044,8 @@ (the-as sew-gunturret ((method-of-type enemy relocate) obj arg0)) ) -(defmethod sew-gunturret-method-141 sew-gunturret ((obj sew-gunturret)) - (let ((s5-0 +(defmethod init-turret-params! sew-gunturret ((obj sew-gunturret)) + (let ((turret-params (new 'static 'gun-turret-params :idle-anim 2 :shoot-anim 3 @@ -1034,27 +1056,27 @@ ) ) ) - (set! (-> s5-0 normal-sg) + (set! (-> turret-params normal-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-gunturret" (the-as (pointer uint32) #f))) ) - (set! (-> s5-0 explode-sg) + (set! (-> turret-params explode-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-gunturret-explode" (the-as (pointer uint32) #f)) ) ) - (set! (-> s5-0 enemy-info) *sew-gunturret-enemy-info*) - (set! (-> obj params) s5-0) + (set! (-> turret-params enemy-info) *sew-gunturret-enemy-info*) + (set! (-> obj params) turret-params) ) 0 (none) ) -(defmethod enemy-method-115 sew-gunturret ((obj sew-gunturret)) - "@abstract" - (sew-gunturret-method-141 obj) +(defmethod init-enemy! sew-gunturret ((obj sew-gunturret)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (init-turret-params! obj) (initialize-skeleton obj (-> obj params normal-sg) (the-as pair 0)) - (enemy-method-113 obj (-> obj params enemy-info)) + (init-enemy-behaviour-and-stats! obj (-> obj params enemy-info)) (logclear! (-> obj mask) (process-mask actor-pause)) (logclear! (-> obj enemy-flags) (enemy-flag notice)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1126) obj)) @@ -1190,12 +1212,13 @@ :size-assert #x2a4 :flag-assert #x8e023002a4 (:methods - (pal-gun-turret-method-140 (_type_ symbol) float :replace 140) + (fire-turret! (_type_ symbol) float :replace 140) ) ) -(defmethod pal-gun-turret-method-140 pal-gun-turret ((obj pal-gun-turret) (arg0 symbol)) +(defmethod fire-turret! pal-gun-turret ((obj pal-gun-turret) (arg0 symbol)) + "@overrides Calls [[sew-gunturret::140]] but also customizes the turret flash via [[set-palcab-turret-flash!]]" ((the-as (function sew-gunturret symbol none) (find-parent-method pal-gun-turret 140)) obj arg0) (set-palcab-turret-flash! 1.0) ) @@ -1206,8 +1229,8 @@ (none) ) -(defmethod sew-gunturret-method-141 pal-gun-turret ((obj pal-gun-turret)) - (let ((s5-0 +(defmethod init-turret-params! pal-gun-turret ((obj pal-gun-turret)) + (let ((turret-params (new 'static 'gun-turret-params :idle-anim 2 :shoot-anim 3 @@ -1218,17 +1241,17 @@ ) ) ) - (set! (-> s5-0 normal-sg) + (set! (-> turret-params normal-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-pal-gun-turret" (the-as (pointer uint32) #f))) ) - (set! (-> s5-0 explode-sg) + (set! (-> turret-params explode-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-pal-gun-turret-explode" (the-as (pointer uint32) #f)) ) ) - (set! (-> s5-0 enemy-info) *pal-gun-turret-enemy-info*) - (set! (-> obj params) s5-0) + (set! (-> turret-params enemy-info) *pal-gun-turret-enemy-info*) + (set! (-> obj params) turret-params) ) 0 (none) diff --git a/goal_src/jak2/levels/common/entities/spydroid.gc b/goal_src/jak2/levels/common/entities/spydroid.gc index 9ea7decee4..8c0a30a23f 100644 --- a/goal_src/jak2/levels/common/entities/spydroid.gc +++ b/goal_src/jak2/levels/common/entities/spydroid.gc @@ -642,8 +642,12 @@ (set! (-> *spydroid-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-55 spydroid ((obj spydroid)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! spydroid ((obj 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!))) (t9-0 obj) ) (when (< (-> obj root-override2 scale x) 1.0) @@ -736,7 +740,9 @@ (none) ) -(defmethod enemy-method-74 spydroid ((obj spydroid) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler spydroid ((obj spydroid) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v1-6 vector) (sv-144 vector)) (with-pp (rlet ((vf0 :class vf) @@ -847,16 +853,16 @@ (logtest? (penetrate dark-bomb) (-> (the-as attack-info v1-30) penetrate-using)) ) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (('jump) (set! (-> obj floor) (-> (the-as vector (-> arg3 param 1)) y)) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1065,7 +1071,7 @@ (t9-0) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1079,7 +1085,7 @@ ) ) (let ((a0-1 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (and a0-1 (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root-override2 trans) @@ -1315,8 +1321,8 @@ ) ) -(defmethod enemy-method-114 spydroid ((obj spydroid)) - "@abstract" +(defmethod init-enemy-collision! spydroid ((obj spydroid)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1389,14 +1395,14 @@ (the-as spydroid ((method-of-type nav-enemy relocate) obj arg0)) ) -(defmethod enemy-method-115 spydroid ((obj spydroid)) - "@abstract" +(defmethod init-enemy! spydroid ((obj spydroid)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-spydroid" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *spydroid-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *spydroid-nav-enemy-info*) (dotimes (s5-1 4) (set! (-> obj lightning s5-1) (new diff --git a/goal_src/jak2/levels/common/flitter.gc b/goal_src/jak2/levels/common/flitter.gc index 407b848e17..7492cdfd16 100644 --- a/goal_src/jak2/levels/common/flitter.gc +++ b/goal_src/jak2/levels/common/flitter.gc @@ -730,7 +730,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self state-time) (-> self clock frame-counter)) (let ((gp-0 (-> self root-override2))) (vector-reset! (-> gp-0 transv)) @@ -927,7 +927,7 @@ (defbehavior flitter-fall-and-play-death-anim flitter ((arg0 art-joint-anim) (arg1 float) (arg2 time-frame)) (local-vars (v1-29 symbol)) - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel root-channel 0 frame-group) arg0) (let ((s4-1 (enemy-method-50 self (new 'stack-no-clear 'vector))) (s3-0 (-> self root-override2)) @@ -1064,7 +1064,7 @@ ) ) ) - (if (and (enemy-method-107 self) + (if (and (get-enemy-target self) (>= (- (-> self clock frame-counter) (the-as int (-> self off-screen-timer))) (seconds 0.3)) ) (go-hostile self) @@ -1294,7 +1294,7 @@ (ja :num! (seek!)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior flitter) nav-enemy-travel-post) @@ -1309,7 +1309,8 @@ ) ) -(defmethod enemy-method-132 flitter ((obj flitter)) +(defmethod dispose! flitter ((obj flitter)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> obj minimap) (logior! (-> obj minimap flags) (minimap-flag fade-out)) (set! (-> obj minimap) #f) @@ -1318,8 +1319,8 @@ (none) ) -(defmethod enemy-method-114 flitter ((obj flitter)) - "@abstract" +(defmethod init-enemy-collision! flitter ((obj flitter)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1371,14 +1372,14 @@ ) ;; WARN: Return type mismatch connection-minimap vs none. -(defmethod enemy-method-115 flitter ((obj flitter)) - "@abstract" +(defmethod init-enemy! flitter ((obj flitter)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-flitter" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *flitter-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *flitter-nav-enemy-info*) (set! (-> obj move-angle) 10922.667) (set! (-> obj heading) (the-as basic (if (= (rand-vu-int-range 0 1) 1) #t diff --git a/goal_src/jak2/levels/common/grunt.gc b/goal_src/jak2/levels/common/grunt.gc index ba6e23badc..ab727fe005 100644 --- a/goal_src/jak2/levels/common/grunt.gc +++ b/goal_src/jak2/levels/common/grunt.gc @@ -76,7 +76,7 @@ (wait-for-focus () _type_ :state 182) (spin-attack () _type_ :state 183) (grunt-method-184 (_type_ float) process-focusable 184) - (grunt-method-185 (_type_) nav-enemy-info 185) + (get-enemy-info (_type_) nav-enemy-info 185) ) ) @@ -272,7 +272,9 @@ (set! (-> *grunt-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 grunt ((obj grunt) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler grunt ((obj grunt) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -305,7 +307,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -324,7 +326,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -492,7 +494,7 @@ ) (if (< v1-1 (-> a0-0 curve num-cverts)) (set! (-> self unknown-byte-1ji2n3) v1-1) - (enemy-method-72 self) + (react-to-focus self) ) ) (until #f @@ -665,7 +667,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (let ((gp-0 (enemy-method-107 obj))) + (let ((gp-0 (get-enemy-target obj))) (when gp-0 (let ((v1-3 (get-trans gp-0 0)) (s4-0 (new 'stack-no-clear 'vector)) @@ -866,7 +868,7 @@ ) (ja :num-func num-func-identity :frame-num (ja-aframe 3.0 0)) (let ((gp-3 (-> self focus aware))) - (if (or (not (enemy-method-107 self)) (!= gp-3 3)) + (if (or (not (get-enemy-target self)) (!= gp-3 3)) (go-stare self) ) ) @@ -962,7 +964,7 @@ ) ) (let ((gp-3 (-> self focus aware))) - (if (or (not (enemy-method-107 self)) (!= gp-3 3)) + (if (or (not (get-enemy-target self)) (!= gp-3 3)) (go-stare self) ) ) @@ -1424,7 +1426,8 @@ :post (-> (method-of-type nav-enemy idle) post) ) -(defmethod enemy-method-132 grunt ((obj grunt)) +(defmethod dispose! grunt ((obj grunt)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> obj minimap) (logior! (-> obj minimap flags) (minimap-flag fade-out)) (set! (-> obj minimap) #f) @@ -1441,8 +1444,8 @@ (the-as grunt ((method-of-type nav-enemy relocate) obj arg0)) ) -(defmethod enemy-method-114 grunt ((obj grunt)) - "@abstract" +(defmethod init-enemy-collision! grunt ((obj grunt)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1537,18 +1540,19 @@ (none) ) -(defmethod grunt-method-185 grunt ((obj grunt)) +(defmethod get-enemy-info grunt ((obj grunt)) + "@returns the [[nav-enemy-info]] associated with this type of grunt" *grunt-nav-enemy-info* ) -(defmethod enemy-method-115 grunt ((obj grunt)) - "@abstract" +(defmethod init-enemy! grunt ((obj grunt)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-grunt" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj (grunt-method-185 obj)) + (init-enemy-behaviour-and-stats! obj (get-enemy-info obj)) (let ((v1-6 (-> obj neck))) (set! (-> v1-6 up) (the-as uint 1)) (set! (-> v1-6 nose) (the-as uint 2)) diff --git a/goal_src/jak2/levels/common/guard-projectile.gc b/goal_src/jak2/levels/common/guard-projectile.gc index b81e6f7372..1e83d19c7c 100644 --- a/goal_src/jak2/levels/common/guard-projectile.gc +++ b/goal_src/jak2/levels/common/guard-projectile.gc @@ -516,7 +516,6 @@ (none) ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound guard-shot ((obj guard-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -528,7 +527,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) (defstate impact (guard-shot) @@ -602,7 +602,7 @@ ) ) -(defmethod init-collision! guard-shot ((obj guard-shot)) +(defmethod init-proj-collision! guard-shot ((obj guard-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -686,7 +686,6 @@ :texture-level 6 ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound vehicle-grenade ((obj vehicle-grenade) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -698,10 +697,11 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) -(defmethod init-collision! vehicle-grenade ((obj vehicle-grenade)) +(defmethod init-proj-collision! vehicle-grenade ((obj vehicle-grenade)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -972,7 +972,7 @@ (none) ) -(defmethod init-collision! guard-lazer-shot ((obj guard-lazer-shot)) +(defmethod init-proj-collision! guard-lazer-shot ((obj guard-lazer-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/levels/common/metalhead-projectile.gc b/goal_src/jak2/levels/common/metalhead-projectile.gc index 6ecb80f490..d8ea705132 100644 --- a/goal_src/jak2/levels/common/metalhead-projectile.gc +++ b/goal_src/jak2/levels/common/metalhead-projectile.gc @@ -454,6 +454,7 @@ (none) ) +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound metalhead-shot ((obj metalhead-shot) (arg0 projectile-options)) (with-pp (case arg0 @@ -481,6 +482,7 @@ ) ) ) + (none) ) ) @@ -504,7 +506,7 @@ (none) ) -(defmethod init-collision! metalhead-shot ((obj metalhead-shot)) +(defmethod init-proj-collision! metalhead-shot ((obj metalhead-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -725,7 +727,6 @@ (none) ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound metalhead-grenade-shot ((obj metalhead-grenade-shot) (arg0 projectile-options)) (case arg0 (((projectile-options lose-altitude)) @@ -735,7 +736,8 @@ (sound-play "gren-missile" :id (-> obj sound-id) :position (-> obj root-override trans)) ) ) - (the-as sound-id 0) + 0 + (none) ) (defstate impact (metalhead-grenade-shot) @@ -874,7 +876,7 @@ (none) ) -(defmethod init-collision! metalhead-grenade-shot ((obj metalhead-grenade-shot)) +(defmethod init-proj-collision! metalhead-grenade-shot ((obj metalhead-grenade-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/levels/dig/dig-digger.gc b/goal_src/jak2/levels/dig/dig-digger.gc index ee56df9ad3..82dca72246 100644 --- a/goal_src/jak2/levels/dig/dig-digger.gc +++ b/goal_src/jak2/levels/dig/dig-digger.gc @@ -656,8 +656,8 @@ :enter (behavior () (process-entity-status! self (entity-perm-status subtask-complete) #t) (sound-play "dig-tether-snap") - (talker-speech-class-method-10 (-> *talker-speech* 191)) - (talker-speech-class-method-10 (-> *talker-speech* 192)) + (play-communicator-speech! (-> *talker-speech* 191)) + (play-communicator-speech! (-> *talker-speech* 192)) (cond ((-> self b) (ja :group! dig-digger-idle-ja :num! min) diff --git a/goal_src/jak2/levels/dig/dig-part.gc b/goal_src/jak2/levels/dig/dig-part.gc index 4399904b2d..a8cde64b96 100644 --- a/goal_src/jak2/levels/dig/dig-part.gc +++ b/goal_src/jak2/levels/dig/dig-part.gc @@ -961,11 +961,12 @@ ) (defun check-drop-level-dig-lava-bloops ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) - (let ((f30-0 (-> arg1 key origin trans y))) - (when (< (-> arg2 vector 0 y) f30-0) + "Ensure the lava bloop splats where it originated" + (let ((origin-y (-> arg1 key origin trans y))) + (when (< (-> arg2 vector 0 y) origin-y) (let ((gp-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) - (set-vector! gp-0 (-> arg2 vector 0 x) f30-0 (-> arg2 vector 0 z) 1.0) + (set-vector! gp-0 (-> arg2 vector 0 x) origin-y (-> arg2 vector 0 z) 1.0) (let ((t9-1 sp-launch-particles-var) (a0-2 *sp-particle-system-2d*) (a1-1 (-> *part-id-table* 5043)) diff --git a/goal_src/jak2/levels/dig/dig3-obs.gc b/goal_src/jak2/levels/dig/dig3-obs.gc index 21ee447f51..661afa014b 100644 --- a/goal_src/jak2/levels/dig/dig3-obs.gc +++ b/goal_src/jak2/levels/dig/dig3-obs.gc @@ -485,7 +485,7 @@ This commonly includes things such as: (-> arg0 status) ) -(defmethod init-collision! dig-spikey-sphere ((obj dig-spikey-sphere)) +(defmethod init-proj-collision! dig-spikey-sphere ((obj dig-spikey-sphere)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/levels/drill_platform/drill-part2.gc b/goal_src/jak2/levels/drill_platform/drill-part2.gc index 5dd822f428..6dc662d100 100644 --- a/goal_src/jak2/levels/drill_platform/drill-part2.gc +++ b/goal_src/jak2/levels/drill_platform/drill-part2.gc @@ -208,6 +208,7 @@ ) (defun check-drop-level-drill-drillbit-rubble-sparks ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure the rubble spark particle effects don't go below a predefined y value, draw splat effect when they do" (when (and (< (-> arg2 vector 0 y) -696320.0) (< (-> arg1 vel-sxvel y) 0.0)) (let ((gp-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak2/levels/drill_platform/ginsu.gc b/goal_src/jak2/levels/drill_platform/ginsu.gc index 4e26ef1fab..142eb99c11 100644 --- a/goal_src/jak2/levels/drill_platform/ginsu.gc +++ b/goal_src/jak2/levels/drill_platform/ginsu.gc @@ -326,10 +326,14 @@ ) ;; WARN: Return type mismatch symbol vs none. -(defmethod enemy-method-55 ginsu ((obj ginsu)) +(defmethod track-target! ginsu ((obj 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" (with-pp (ginsu-method-180 obj) - (let ((t9-1 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-1 (method-of-type nav-enemy track-target!))) (t9-1 obj) ) (cond @@ -490,7 +494,9 @@ ) ;; WARN: disable def twice: 11. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. -(defmethod enemy-method-74 ginsu ((obj ginsu) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler ginsu ((obj ginsu) (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-1 object)) (with-pp (case arg2 @@ -515,7 +521,7 @@ (('touch 'bonk 'attack) (cond ((or (!= arg0 *target*) (logtest? (focus-status dark) (-> *target* focus-status))) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else (let ((v1-15 (new 'stack-no-clear 'event-message-block))) @@ -544,7 +550,7 @@ v0-1 ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -587,7 +593,7 @@ (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) ) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (set! (-> self spiral-time) (-> self clock frame-counter)) (set! (-> self desired-distance) (vector-length (ginsu-method-181 self (new 'stack-no-clear 'vector)))) (none) @@ -979,8 +985,8 @@ (none) ) -(defmethod enemy-method-114 ginsu ((obj ginsu)) - "@abstract" +(defmethod init-enemy-collision! ginsu ((obj ginsu)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1045,8 +1051,8 @@ (none) ) -(defmethod enemy-method-115 ginsu ((obj ginsu)) - "@abstract" +(defmethod init-enemy! ginsu ((obj ginsu)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1054,7 +1060,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *ginsu-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *ginsu-nav-enemy-info*) (logclear! (-> obj nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> obj enemy-flags) (the-as enemy-flag (logclear (-> obj enemy-flags) (enemy-flag enemy-flag43)))) (logclear! (-> obj nav flags) (nav-control-flag limit-rotation-rate)) diff --git a/goal_src/jak2/levels/forest/pegasus.gc b/goal_src/jak2/levels/forest/pegasus.gc index ea5a143dc9..7cc3247f19 100644 --- a/goal_src/jak2/levels/forest/pegasus.gc +++ b/goal_src/jak2/levels/forest/pegasus.gc @@ -43,14 +43,17 @@ (current-path int32 :offset 972) (num-paths int32 :offset 976) (display-path int32 :offset 980) - (targetted-timer uint64 :offset 984) + (targetted-timer time-frame :offset 984) ) :heap-base #x360 :method-count-assert 138 :size-assert #x3e0 :flag-assert #x8a036003e0 (:methods - (pegasus-method-137 (_type_) none 137) + (run-logic? (_type_) symbol :replace 12) + (damage-amount-from-attack (_type_ process event-message-block) int :replace 56) + (update-target-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware :replace 57) + (track-how-long-aimed-at! (_type_) none 137) ) (:states pegasus-debug @@ -151,28 +154,35 @@ (set! (-> *pegasus-enemy-info* fact-defaults) *fact-info-enemy-defaults*) (defmethod run-logic? pegasus ((obj pegasus)) - (let ((f0-0 491520.0)) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> obj root-override2 trans) (camera-pos))) + "Calls [[process-tree::12]] if we are considered in-range of the [[pegasus]], otherwise returns [[#t]]" + (let ((min-distance 491520.0)) + (if (< (* min-distance min-distance) (vector-vector-distance-squared (-> obj root-override2 trans) (camera-pos))) ((method-of-type enemy run-logic?) obj) #t ) ) ) -(defmethod pegasus-method-137 pegasus ((obj pegasus)) +(defmethod track-how-long-aimed-at! pegasus ((obj pegasus)) + "Updates `targetted-timer` with the `frame-counter` while Jak is aiming at the [[pegasus]]" (with-pp - (let ((v1-0 *target*)) - (when (and v1-0 (-> v1-0 gun active?)) - (let ((a1-0 (new 'stack-no-clear 'vector)) - (a0-4 (new 'stack-no-clear 'vector)) + (let ((target *target*)) + (when (and target (-> target gun active?)) + (let ((inaccuracy-dir (new 'stack-no-clear 'vector)) + (inaccuracy-vec (new 'stack-no-clear 'vector)) ) - (vector-! a1-0 (-> obj root-override2 trans) (-> v1-0 gun fire-point)) - (vector+float*! a0-4 (-> v1-0 gun fire-point) (-> v1-0 gun fire-dir-out) (vector-length a1-0)) - (let ((f0-1 (vector-vector-distance-squared a0-4 (-> obj root-override2 trans))) - (f1-0 20480.0) + (vector-! inaccuracy-dir (-> obj root-override2 trans) (-> target gun fire-point)) + (vector+float*! + inaccuracy-vec + (-> target gun fire-point) + (-> target gun fire-dir-out) + (vector-length inaccuracy-dir) + ) + (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> obj root-override2 trans))) + (threshold 20480.0) ) - (if (< f0-1 (* f1-0 f1-0)) - (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + (if (< inaccuracy-mag (* threshold threshold)) + (set! (-> obj targetted-timer) (-> pp clock frame-counter)) ) ) ) @@ -184,22 +194,25 @@ ) ;; WARN: Return type mismatch int vs enemy-aware. -(defmethod enemy-method-57 pegasus ((obj pegasus) (arg0 process-focusable) (arg1 enemy-best-focus)) +(defmethod update-target-awareness! pegasus ((obj pegasus) (proc process-focusable) (focus enemy-best-focus)) + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! +For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targetted for more than 5 [[seconds]] +@returns the value from [[enemy::57]], otherwise [[enemy-aware::4]]" (with-pp - (the-as - enemy-aware - (if (>= (- (-> pp clock frame-counter) (the-as int (-> obj targetted-timer))) (seconds 5)) - (the-as int ((method-of-type enemy enemy-method-57) obj arg0 arg1)) - 4 - ) - ) + (the-as enemy-aware (if (>= (- (-> pp clock frame-counter) (-> obj targetted-timer)) (seconds 5)) + (the-as int ((method-of-type enemy update-target-awareness!) obj proc focus)) + 4 + ) + ) ) ) ;; WARN: Return type mismatch none vs object. -(defmethod enemy-method-74 pegasus ((obj pegasus) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler pegasus ((obj pegasus) (proc process) (arg2 int) (event-type symbol) (event event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp - (let ((v1-0 arg2)) + (let ((v1-0 event-type)) (the-as object (cond @@ -220,20 +233,20 @@ (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) (enemy-method-62 obj) (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (the-as object (enemy-method-73 obj)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (the-as object (kill-prefer-falling obj)) ) (else (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj targetted-timer) (the-as uint v0-0)) + (set! (-> obj targetted-timer) (the-as time-frame v0-0)) v0-0 ) ) ) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) ) ) ) @@ -241,91 +254,114 @@ ) ) -(defmethod enemy-method-56 pegasus ((obj pegasus) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack pegasus ((obj pegasus) (arg0 process) (arg1 event-message-block)) + "Only attacks from the jetboard will deal max damage (6), but by default it will return `1`. +This is why the scouts are technically killable by other means +@returns the amount of damage taken from an attack. Also updates the `targetted-timer`. +@see [[*pegasus-enemy-info*]]" (with-pp - (let ((v0-0 1)) - (let ((v1-0 (the-as object (-> arg1 param 1)))) + (let ((hitpoints 1)) + (let ((attack-info (the-as attack-info (-> arg1 param 1)))) (case (-> arg1 message) (('attack) - (if (and (logtest? (-> (the-as attack-info v1-0) mask) (attack-info-mask mode)) - (= (-> (the-as attack-info v1-0) mode) 'board) - ) - (set! v0-0 (-> obj hit-points)) + (if (and (logtest? (-> attack-info mask) (attack-info-mask mode)) (= (-> attack-info mode) 'board)) + (set! hitpoints (-> obj hit-points)) ) ) ) ) - (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) - v0-0 + (set! (-> obj targetted-timer) (-> pp clock frame-counter)) + hitpoints ) ) ) ;; WARN: Return type mismatch symbol vs none. -(defbehavior pegasus-draw-section pegasus ((arg0 float) (arg1 float) (arg2 rgba)) - (let ((gp-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) +(defbehavior pegasus-draw-section pegasus ((path-percent-a float) (path-percent-b float) (color rgba)) + "Draws the [[pegasus]] curve section between the two provided points. +@param path-percent-a Percentage along the path for the first point +@param path-percent-b Percentage along the path for the second point +param color The color to draw the curve with +@see [[curve-control]]" + (let ((point-a (new 'stack-no-clear 'vector)) + (point-b (new 'stack-no-clear 'vector)) ) - (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) gp-0 arg0 'interp) - (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) s5-0 arg1 'interp) - (add-debug-line #t (bucket-id debug-no-zbuf1) gp-0 s5-0 arg2 #f (the-as rgba -1)) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + point-a + path-percent-a + 'interp + ) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + point-b + path-percent-b + 'interp + ) + (add-debug-line #t (bucket-id debug-no-zbuf1) point-a point-b color #f (the-as rgba -1)) ) (none) ) -;; WARN: Return type mismatch none vs symbol. -;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 43] (defbehavior pegasus-show-runs pegasus () - (the-as symbol (when *display-path-marks* - (when (cpad-pressed? 0 up) - (+! (-> self display-path) 1) - (if (>= (-> self display-path) (-> self num-paths)) - (set! (-> self display-path) -1) - ) - ) - (when (cpad-pressed? 0 down) - (+! (-> self display-path) -1) - (if (< (-> self display-path) -1) - (set! (-> self display-path) (+ (-> self num-paths) -1)) - ) - ) - (cond - ((< (-> self display-path) 0) - (countdown (gp-0 20) - (let ((a0-1 (-> self path-info gp-0 path-data))) - (if a0-1 - (debug-draw a0-1) - ) - ) - ) - #f - ) - (else - (format - *stdcon* - "~A old-path ~D can run ~A at ~D ~F~%" - (-> self name) - (-> self previous-path) - (-> self can-run) - (-> self current-path) - (-> self curve-position) - ) - (format *stdcon* "~A showing path ~D~%" (-> self name) (-> self display-path)) - (let ((a0-4 (-> self path-info (-> self display-path) path-data))) - (if a0-4 - (debug-draw a0-4) - ) - ) - ) - ) - ) + "When [[*display-path-marks*]] is enabled, allow the user to cycle through the displayed path +- Pressing [[up]] on the D-Pad will increment the path index +- Pressing [[down]] on the D-Pad will decrement the path index +Additional debug text will be displayed as well. This is useful as many paths overlap other paths" + (when *display-path-marks* + (when (cpad-pressed? 0 up) + (+! (-> self display-path) 1) + (if (>= (-> self display-path) (-> self num-paths)) + (set! (-> self display-path) -1) ) + ) + (when (cpad-pressed? 0 down) + (+! (-> self display-path) -1) + (if (< (-> self display-path) -1) + (set! (-> self display-path) (+ (-> self num-paths) -1)) + ) + ) + (cond + ((< (-> self display-path) 0) + (countdown (path-idx 20) + (let ((path (-> self path-info path-idx path-data))) + (if path + (debug-draw path) + ) + ) + ) + ) + (else + (format + *stdcon* + "~A old-path ~D can run ~A at ~D ~F~%" + (-> self name) + (-> self previous-path) + (-> self can-run) + (-> self current-path) + (-> self curve-position) + ) + (format *stdcon* "~A showing path ~D~%" (-> self name) (-> self display-path)) + (let ((_path (-> self path-info (-> self display-path) path-data))) + (if _path + (debug-draw _path) + ) + ) + ) + ) + ) + (none) ) ;; WARN: Return type mismatch vector vs none. -(defbehavior pegasus-rotate pegasus ((arg0 symbol) (arg1 float)) - (let ((s5-0 (new 'stack-no-clear 'matrix)) - (gp-0 (new 'stack-no-clear 'vector)) +(defbehavior pegasus-rotate pegasus ((influenced-by-target? symbol) (angle float)) + "Rotates the [[pegasus]] along the path, factoring in the current speed and the target's position +@param influenced-by-target? Whether or not to care about [[target]]'s position +@param angle The hopeful angle to use when constructing the rotation matrix, ultimately limited to `0.25` (radians?) though +@see [[target-pos]] and [[matrix-from-two-vectors-max-angle-partial!]] +@TODO - `float` should be `degrees` -- The usual amount passed in is `(degrees 100.0835)`" + (let ((rotation-matrix (new 'stack-no-clear 'matrix)) + (flee-direction-vec (new 'stack-no-clear 'vector)) ) (displacement-between-points-at-percent-normalized! (-> self path-info (-> self current-path) path-data) @@ -333,37 +369,46 @@ (-> self curve-position) ) (cond - ((and arg0 *target*) - (vector-! gp-0 (-> self root-override2 trans) (target-pos 0)) - (vector-normalize! gp-0 1.0) + ((and influenced-by-target? *target*) + (vector-! flee-direction-vec (-> self root-override2 trans) (target-pos 0)) + (vector-normalize! flee-direction-vec 1.0) ) ((= (-> self speed) 0.0) - (set! (-> gp-0 quad) (-> self facing quad)) + (set! (-> flee-direction-vec quad) (-> self facing quad)) ) ((< (-> self speed) 0.0) - (vector-negate! gp-0 (-> self tangent)) + (vector-negate! flee-direction-vec (-> self tangent)) ) (else - (set! (-> gp-0 quad) (-> self tangent quad)) + (set! (-> flee-direction-vec quad) (-> self tangent quad)) ) ) - (matrix-from-two-vectors-max-angle-partial! s5-0 (-> self facing) gp-0 arg1 0.25) - (vector-matrix*! gp-0 (-> self facing) s5-0) - (vector-normalize! gp-0 1.0) - (forward-down->inv-matrix s5-0 gp-0 (new 'static 'vector :y -1.0)) - (matrix->quaternion (-> self root-override2 quat) s5-0) - (set! (-> self run-blend-interp) (acos (vector-dot gp-0 (-> self facing)))) + (matrix-from-two-vectors-max-angle-partial! rotation-matrix (-> self facing) flee-direction-vec angle 0.25) + (vector-matrix*! flee-direction-vec (-> self facing) rotation-matrix) + (vector-normalize! flee-direction-vec 1.0) + (forward-down->inv-matrix rotation-matrix flee-direction-vec (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> self root-override2 quat) rotation-matrix) + (set! (-> self run-blend-interp) (acos (vector-dot flee-direction-vec (-> self facing)))) (set! (-> self run-blend-interp) (* 0.0002746582 (-> self run-blend-interp))) - (if (< (vector-dot (-> self facing) (the-as vector (-> s5-0 vector))) 0.0) + (if (< (vector-dot (-> self facing) (the-as vector (-> rotation-matrix vector))) 0.0) (set! (-> self run-blend-interp) (- (-> self run-blend-interp))) ) - (set! (-> self facing quad) (-> gp-0 quad)) + (set! (-> self facing quad) (-> flee-direction-vec quad)) ) (none) ) ;; WARN: Return type mismatch float vs none. (defbehavior pegasus-loop-on-same-path pegasus () + "Creates an endless loop on the same path as the name suggests +- If we are beyond the end of the path, start again near the beginning (1%) +- If we are far before the beginning, start at the beginning (0%) +- If we are atleast 1% into the path, step back 1% +- If we are less than 0% somehow, slowly add 1% +Ultimately this appears to be some sort of safe-guard to get things back into a somewhat working state +if there are unexpected path conditions -- but the results of this are not great! +Another potential explaination is to make it easy during development to identify and debug a bad path +In practice, this is never called" (cond ((< 100.0 (-> self curve-position)) (set! (-> self curve-position) 1.0) @@ -382,84 +427,94 @@ ) (defbehavior pegasus-choose-path pegasus () + "Determines the next path the pegasus should take if we have completed the current path it's on +There are many fail-safes here if something goes wrong to try to keep the pegasus behaving +@see [[pegasus-look-on-same-path]] +@TODO - understand the path selection better" (local-vars (f0-15 float) (f30-0 float)) (while (begin (label cfg-61) (or (< 1.0 (-> self curve-position)) (< (-> self curve-position) 0.0))) - (let ((s5-0 (-> self path-info (-> self current-path))) - (gp-0 3) + (let ((curr-pegasus-path (-> self path-info (-> self current-path))) + (control-data-idx 3) ) 0.0 - (set! f30-0 - (cond - ((or (>= (-> self current-path) (-> self num-paths)) (< (-> self current-path) 0) (<= (-> s5-0 num-data) 0)) - (format - 0 - ": ~A has path out of range cur ~D num ~D num-data ~D~%" - (-> self name) - (-> self current-path) - (-> self num-paths) - (-> s5-0 num-data) - ) - (pegasus-loop-on-same-path) - (goto cfg-61) - f30-0 - ) - ((< (-> self curve-position) 0.0) - (while (and (< gp-0 (-> s5-0 num-data)) (>= (-> s5-0 control-data gp-0) 0.0)) - (+! gp-0 3) - ) - (+! gp-0 1) - (* (total-distance (-> s5-0 path-data)) (- (-> self curve-position))) - ) - (else - (* (total-distance (-> s5-0 path-data)) (+ -1.0 (-> self curve-position))) - ) - ) + (set! f30-0 (cond + ((or (>= (-> self current-path) (-> self num-paths)) + (< (-> self current-path) 0) + (<= (-> curr-pegasus-path num-data) 0) + ) + (format + 0 + ": ~A has path out of range cur ~D num ~D num-data ~D~%" + (-> self name) + (-> self current-path) + (-> self num-paths) + (-> curr-pegasus-path num-data) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + f30-0 + ) + ((< (-> self curve-position) 0.0) + (while (and (< control-data-idx (-> curr-pegasus-path num-data)) + (>= (-> curr-pegasus-path control-data control-data-idx) 0.0) + ) + (+! control-data-idx 3) + ) + (+! control-data-idx 1) + (* (total-distance (-> curr-pegasus-path path-data)) (- (-> self curve-position))) + ) + (else + (* (total-distance (-> curr-pegasus-path path-data)) (+ -1.0 (-> self curve-position))) + ) + ) ) - (when (or (< (- (-> s5-0 num-data) gp-0) 3) (< (-> s5-0 control-data gp-0) 0.0)) + (when (or (< (- (-> curr-pegasus-path num-data) control-data-idx) 3) + (< (-> curr-pegasus-path control-data control-data-idx) 0.0) + ) (format 0 ": ~A has bad path connect data format num-data ~D ctrl-data ~F~%" (-> self name) - (- (-> s5-0 num-data) gp-0) - (-> s5-0 control-data gp-0) + (- (-> curr-pegasus-path num-data) control-data-idx) + (-> curr-pegasus-path control-data control-data-idx) ) (pegasus-loop-on-same-path) (goto cfg-61) ) - (let* ((v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-34 (the-as number (logior #x3f800000 v1-33))) - (f0-9 (+ -1.0 (the-as float v1-34))) + (let* ((rand-int (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (rand-float (the-as float (logior #x3f800000 rand-int))) + (_rand (+ -1.0 rand-float)) ) - (while (and (>= (- (-> s5-0 num-data) gp-0) 6) - (>= (-> s5-0 control-data gp-0) 0.0) - (< (-> s5-0 control-data (+ gp-0 2)) f0-9) - (!= (-> s5-0 control-data (+ gp-0 3)) -1.0) - (!= (-> s5-0 control-data (+ gp-0 5)) 0.0) + (while (and (>= (- (-> curr-pegasus-path num-data) control-data-idx) 6) + (>= (-> curr-pegasus-path control-data control-data-idx) 0.0) + (< (-> curr-pegasus-path control-data (+ control-data-idx 2)) _rand) + (!= (-> curr-pegasus-path control-data (+ control-data-idx 3)) -1.0) + (!= (-> curr-pegasus-path control-data (+ control-data-idx 5)) 0.0) ) - (set! f0-9 (- f0-9 (-> s5-0 control-data (+ gp-0 2)))) - (+! gp-0 3) + (set! _rand (- _rand (-> curr-pegasus-path control-data (+ control-data-idx 2)))) + (+! control-data-idx 3) ) ) - (let ((t1-1 (the int (-> s5-0 control-data gp-0))) - (f28-0 (fmin 1.0 (fmax 0.0 (-> s5-0 control-data (+ gp-0 1))))) + (let ((control-data (the int (-> curr-pegasus-path control-data control-data-idx))) + (f28-0 (fmin 1.0 (fmax 0.0 (-> curr-pegasus-path control-data (+ control-data-idx 1))))) ) - (when (or (>= t1-1 (-> self num-paths)) (< t1-1 0)) + (when (or (>= control-data (-> self num-paths)) (< control-data 0)) (format 0 ": ~A has bad path connect data prev ~D current ~D desired ~D num ~D~%" (-> self name) (-> self previous-path) (-> self current-path) - t1-1 + control-data (-> self num-paths) ) (pegasus-loop-on-same-path) (goto cfg-61) ) (set! (-> self previous-path) (-> self current-path)) - (set! (-> self current-path) t1-1) - (let ((gp-1 (-> self path-info (-> self current-path)))) - (let ((f0-14 (/ f30-0 (total-distance (-> gp-1 path-data))))) + (set! (-> self current-path) control-data) + (let ((_curr-pegasus-path (-> self path-info (-> self current-path)))) + (let ((f0-14 (/ f30-0 (total-distance (-> _curr-pegasus-path path-data))))) (cond ((< 0.5 f28-0) (set! f0-15 (- f28-0 f0-14)) @@ -477,8 +532,8 @@ ) (set! (-> self curve-position) f0-15) (set! (-> self can-run) #f) - (if (> (-> gp-1 num-data) 0) - (set! (-> self can-run) (!= (-> gp-1 control-data 0) 0.0)) + (if (> (-> _curr-pegasus-path num-data) 0) + (set! (-> self can-run) (!= (-> _curr-pegasus-path control-data 0) 0.0)) ) ) ) @@ -487,7 +542,10 @@ #f ) -(defbehavior pegasus-move pegasus ((arg0 float) (arg1 symbol) (arg2 symbol)) +(defbehavior pegasus-move pegasus ((explicit-y-vel float) (adjust-y-offset? symbol)) + "Moves the pegasus along the path by smoothly interpolating along it +@param explicit-y-vel Normally `0.0` but this value is used when the pegasus needs to switch direction +@param adjust-y-offset? Normally [[#f]] which forces the movement to reflect the result of the collison query - the [[pegasus]] will stay close to the ground. [[#t]] ignores this" (+! (-> self curve-position) (/ (the float (* (- (-> self clock frame-counter) (-> self clock old-frame-counter)) (the int (-> self speed)))) (total-distance (-> self path-info (-> self current-path) path-data)) @@ -500,21 +558,21 @@ (-> self curve-position) 'interp ) - (let ((f30-1 (+ -81920.0 (-> self root-override2 trans y))) - (gp-0 #f) + (let ((y-pos (+ -81920.0 (-> self root-override2 trans y))) + (draw-shadow? #f) ) - (let ((s2-0 (new 'stack 'collide-query)) - (s3-0 (new 'stack-no-clear 'vector)) + (let ((cquery (new 'stack 'collide-query)) + (start-pos (new 'stack-no-clear 'vector)) ) - (set! (-> s3-0 quad) (-> self root-override2 trans quad)) + (set! (-> start-pos quad) (-> self root-override2 trans quad)) (set! (-> self over-ground) #f) - (when (enemy-method-126 self s2-0 s3-0 (collide-spec backgnd) 12288.0 81920.0 1024.0) - (set! f30-1 (-> s2-0 best-other-tri intersect y)) - (set! gp-0 #t) - (set! (-> self over-ground) (< 204.8 (fabs (- f30-1 (-> self water-height))))) - (set! arg1 (and (-> self over-ground) arg1)) - (if arg1 - (set! (-> self y-offset-desired) (- f30-1 (-> s3-0 y))) + (when (enemy-above-ground? self cquery start-pos (collide-spec backgnd) 12288.0 81920.0 1024.0) + (set! y-pos (-> cquery best-other-tri intersect y)) + (set! draw-shadow? #t) + (set! (-> self over-ground) (< 204.8 (fabs (- y-pos (-> self water-height))))) + (set! adjust-y-offset? (and (-> self over-ground) adjust-y-offset?)) + (if adjust-y-offset? + (set! (-> self y-offset-desired) (- y-pos (-> start-pos y))) ) ) ) @@ -522,8 +580,8 @@ ((< (-> self y-offset-desired) (-> self y-offset)) (set! (-> self y-vel) (* 0.25 (- (-> self y-offset-desired) (-> self y-offset)))) (set! (-> self y-vel) (fmax -68.26667 (-> self y-vel))) - (if (!= arg0 0.0) - (set! (-> self y-vel) (- arg0)) + (if (!= explicit-y-vel 0.0) + (set! (-> self y-vel) (- explicit-y-vel)) ) (+! (-> self y-offset) (-> self y-vel)) (when (>= (-> self y-offset-desired) (-> self y-offset)) @@ -534,8 +592,8 @@ ((< (-> self y-offset) (-> self y-offset-desired)) (set! (-> self y-vel) (* 0.5 (- (-> self y-offset-desired) (-> self y-offset)))) (set! (-> self y-vel) (fmin 13.653334 (-> self y-vel))) - (if (!= arg0 0.0) - (set! (-> self y-vel) arg0) + (if (!= explicit-y-vel 0.0) + (set! (-> self y-vel) explicit-y-vel) ) (+! (-> self y-offset) (-> self y-vel)) (when (>= (-> self y-offset) (-> self y-offset-desired)) @@ -545,26 +603,26 @@ ) ) (+! (-> self root-override2 trans y) (-> self y-offset)) - (when (< (-> self root-override2 trans y) f30-1) - (set! (-> self y-offset) (- f30-1 (- (-> self root-override2 trans y) (-> self y-offset)))) - (set! (-> self root-override2 trans y) f30-1) + (when (< (-> self root-override2 trans y) y-pos) + (set! (-> self y-offset) (- y-pos (- (-> self root-override2 trans y) (-> self y-offset)))) + (set! (-> self root-override2 trans y) y-pos) (set! (-> self y-vel) (fmax 0.0 (-> self y-vel))) ) - (set! (-> self on-ground) (< (fabs (- (-> self root-override2 trans y) f30-1)) 409.6)) + (set! (-> self on-ground) (< (fabs (- (-> self root-override2 trans y) y-pos)) 409.6)) (cond - (gp-0 - (let ((v1-54 (-> self draw shadow-ctrl))) - (logclear! (-> v1-54 settings flags) (shadow-flags disable-draw)) + (draw-shadow? + (let ((shadow-ctrl (-> self draw shadow-ctrl))) + (logclear! (-> shadow-ctrl settings flags) (shadow-flags disable-draw)) ) 0 - (let ((v1-57 (-> self draw shadow-ctrl))) - (set! (-> v1-57 settings bot-plane w) (- (+ (- -6144.0 (-> self root-override2 trans y)) f30-1))) + (let ((_shadow-ctrl (-> self draw shadow-ctrl))) + (set! (-> _shadow-ctrl settings bot-plane w) (- (+ (- -6144.0 (-> self root-override2 trans y)) y-pos))) ) 0 ) (else - (let ((v1-59 (-> self draw shadow-ctrl))) - (logior! (-> v1-59 settings flags) (shadow-flags disable-draw)) + (let ((__shadow-ctrl (-> self draw shadow-ctrl))) + (logior! (-> __shadow-ctrl settings flags) (shadow-flags disable-draw)) ) 0 ) @@ -573,50 +631,58 @@ (none) ) -(defbehavior pegasus-calc-speed pegasus ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self root-override2 trans) (target-pos 0))) - (gp-1 #f) +(defbehavior pegasus-calc-speed pegasus ((min-dist float) (max-dist float) (max-speed float) (min-speed float)) + "Calculates the pegasus' speed based on a number of factors: +- Speed up as the target gets closer (up to a max) and slow down as the target is further away (up to a min) +This function also is what causes the pegasus to flip around +@param min-dist TODO +@param max-dist TODO +@param max-speed The maximum speed the pegasus can go +@param min-speed The minimum speed the pegasus can go +@returns If there should be a reaction to the target via [[enemy::72]]" + (let ((dir-to-target (vector-! (new 'stack-no-clear 'vector) (-> self root-override2 trans) (target-pos 0))) + (react-to-target? #f) ) - (set! (-> s5-1 y) 0.0) - (let* ((f1-3 (/ (- (vector-length s5-1) arg0) (- arg1 arg0))) - (f0-4 (- 1.0 (fmax 0.0 (fmin 1.0 f1-3)))) - (f0-5 (lerp arg3 arg2 f0-4)) + (set! (-> dir-to-target y) 0.0) + (let* ((dist-from-target (/ (- (vector-length dir-to-target) min-dist) (- max-dist min-dist))) + (interpolant (- 1.0 (fmax 0.0 (fmin 1.0 dist-from-target)))) + (interpolated-speed (lerp min-speed max-speed interpolant)) ) - (if (< (- (-> self clock frame-counter) (the-as int (-> self targetted-timer))) (seconds 5)) - (set! f0-5 (fmax 163840.0 f0-5)) + (if (< (- (-> self clock frame-counter) (-> self targetted-timer)) (seconds 5)) + (set! interpolated-speed (fmax 163840.0 interpolated-speed)) ) - (let ((f0-6 (* 0.0033333334 f0-5))) + (let ((movement-speed (* 0.0033333334 interpolated-speed))) (cond - ((< (vector-dot s5-1 (-> self tangent)) 0.0) + ((< (vector-dot dir-to-target (-> self tangent)) 0.0) (if (< 0.0 (-> self speed)) - (set! gp-1 #t) + (set! react-to-target? #t) ) ) ((< (-> self speed) 0.0) - (set! gp-1 #t) + (set! react-to-target? #t) ) ) - (let ((v1-22 (ja-group))) + (let ((anim-group (ja-group))) (cond - ((and v1-22 (= v1-22 pegasus-flip-around-a-ja)) + ((and anim-group (= anim-group pegasus-flip-around-a-ja)) (if (< 1.0 (fabs (-> self speed))) (set! (-> self speed) (* 0.92 (-> self speed))) ) ) (else - (let ((v1-31 (ja-group))) + (let ((_anim-group (ja-group))) (cond - ((and v1-31 (= v1-31 pegasus-flip-around-b-ja)) + ((and _anim-group (= _anim-group pegasus-flip-around-b-ja)) (if (< (-> self speed) 0.0) - (seek! (-> self speed) (- f0-6) 13.653334) - (seek! (-> self speed) f0-6 13.653334) + (seek! (-> self speed) (- movement-speed) 13.653334) + (seek! (-> self speed) movement-speed 13.653334) ) ) ((< (-> self speed) 0.0) - (set! (-> self speed) (- f0-6)) + (set! (-> self speed) (- movement-speed)) ) (else - (set! (-> self speed) f0-6) + (set! (-> self speed) movement-speed) ) ) ) @@ -625,13 +691,17 @@ ) ) ) - gp-1 + react-to-target? ) ) (defbehavior pegasus-calc-anim-speed pegasus () - (let* ((f0-1 (fabs (-> self speed))) - (f0-2 (* 0.07324219 f0-1)) + "Based on `speed`, adjust how fast the pegasus should animate. +The faster it's moving the fast it flaps it's wings, etc +@TODO understand the magic values here better +@returns The anim speed, it can be no lower than `1.5`" + (let* ((speed-abs (fabs (-> self speed))) + (f0-2 (* 0.07324219 speed-abs)) (f0-3 (+ -15.0 f0-2)) (f0-4 (* 0.13333334 f0-3)) ) @@ -639,10 +709,14 @@ ) ) -(defmethod enemy-method-55 pegasus ((obj pegasus)) - (pegasus-method-137 obj) +(defmethod track-target! pegasus ((obj 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! obj) (pegasus-show-runs) - ((method-of-type enemy enemy-method-55) obj) + ((method-of-type enemy track-target!) obj) (none) ) @@ -658,13 +732,13 @@ :frame-num 0.0 ) (until (ja-done? 0) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((a1-1 (new 'stack-no-clear 'vector))) - (clmf-input gp-0 a1-1 1) + (let ((cam-dbg-vec (new 'stack-no-clear 'vector))) + (let ((vec (new 'stack-no-clear 'vector))) + (clmf-input cam-dbg-vec vec 1) ) - (vector-float*! gp-0 gp-0 4096.0) + (vector-float*! cam-dbg-vec cam-dbg-vec 4096.0) (+! (-> self curve-position) - (/ (-> gp-0 y) (total-distance (-> self path-info (-> self current-path) path-data))) + (/ (-> cam-dbg-vec y) (total-distance (-> self path-info (-> self current-path) path-data))) ) ) (cond @@ -696,66 +770,33 @@ :virtual #t :code (behavior () (process-entity-status! self (entity-perm-status subtask-complete) #t) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer self)) - (set! (-> a1-1 num-params) 1) - (set! (-> a1-1 message) 'change-mode) - (set! (-> a1-1 param 0) (the-as uint 'pegasus)) - (let ((gp-0 (send-event-function (handle->process (-> self incoming attacker-handle)) a1-1))) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 1) + (set! (-> evt message) 'change-mode) + (set! (-> evt param 0) (the-as uint 'pegasus)) + (let ((event-result (send-event-function (handle->process (-> self incoming attacker-handle)) evt))) (-> self speed) (ja-channel-push! 1 (seconds 0.1)) - (let ((a0-7 (-> self skel root-channel 0))) - (set! (-> a0-7 frame-group) (the-as art-joint-anim pegasus-board-attack-pegasus-ja)) - (set! (-> a0-7 param 0) - (the float (+ (-> (the-as art-joint-anim pegasus-board-attack-pegasus-ja) frames num-frames) -1)) - ) - (set! (-> a0-7 param 1) 1.5) - (set! (-> a0-7 frame-num) 0.0) - (let ((t9-3 joint-control-channel-group!) - (a1-3 pegasus-board-attack-pegasus-ja) - (a2-2 (the-as object num-func-seek!)) - ) - (t9-3 - a0-7 - (the-as art-joint-anim a1-3) - (the-as (function joint-control-channel float float float float :behavior process) a2-2) - ) - (until (ja-done? 0) - (let ((f0-5 (ja-aframe-num 0)) - (f1-0 (-> self speed)) + (ja-no-eval :group! pegasus-board-attack-pegasus-ja + :num! (seek! (the float (+ (-> (the-as art-joint-anim pegasus-board-attack-pegasus-ja) frames num-frames) -1)) 1.5) + :frame-num 0.0 ) - (when (>= f0-5 60.0) - (let ((t9-5 lerp-scale) - (a0-9 f1-0) - (a1-4 0.0) - ) - (set! a2-2 f0-5) - (set! (-> self speed) (t9-5 a0-9 a1-4 (the-as float a2-2) 60.0 100.0)) - ) - (set! (-> self y-offset-desired) 0.0) - ) - ) - (pegasus-move 0.0 #t (the-as symbol a2-2)) - (pegasus-rotate #f 1820.4445) - (suspend) - (let ((a0-12 (-> self skel root-channel 0))) - (set! (-> a0-12 param 0) (the float (+ (-> a0-12 frame-group frames num-frames) -1))) - (set! (-> a0-12 param 1) 1.5) - (let ((t9-8 joint-control-channel-group-eval!) - (a1-7 #f) - ) - (set! a2-2 num-func-seek!) - (t9-8 - a0-12 - (the-as art-joint-anim a1-7) - (the-as (function joint-control-channel float float float float :behavior process) a2-2) - ) - ) + (until (ja-done? 0) + (let ((frame-num (ja-aframe-num 0)) + (speed (-> self speed)) ) + (when (>= frame-num 60.0) + (set! (-> self speed) (lerp-scale speed 0.0 frame-num 60.0 100.0)) + (set! (-> self y-offset-desired) 0.0) ) ) + (pegasus-move 0.0 #t) + (pegasus-rotate #f 1820.4445) + (suspend) + (ja :num! (seek! max 1.5)) ) - (if gp-0 + (if event-result (send-event (handle->process (-> self incoming attacker-handle)) 'end-mode) ) ) @@ -773,18 +814,18 @@ :virtual #t :trans (behavior () (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) - (let ((gp-0 (-> self focus aware))) + (let ((awareness (-> self focus aware))) (cond - ((and (>= 1 (the-as int gp-0)) + ((and (>= 1 (the-as int awareness)) (-> self over-ground) (< (fabs (- (-> self y-offset) (-> self y-offset-desired))) 409.6) ) (go-virtual active) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= awareness (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= awareness (enemy-aware unaware)) (go-flee self) ) ) @@ -793,27 +834,19 @@ (none) ) :code (behavior () - (let ((v1-2 (ja-group))) - (when (not (and v1-2 (= v1-2 pegasus-fly-ja))) + (let ((anim-group (ja-group))) + (when (not (and anim-group (= anim-group pegasus-fly-ja))) (ja-channel-push! 1 (seconds 0.2)) (ja :group! pegasus-fly-ja) ) ) (until #f - (let ((gp-0 (-> self skel root-channel 0))) - (set! (-> gp-0 param 0) (pegasus-calc-anim-speed)) - (let ((t9-2 joint-control-channel-group-eval!) - (a1-1 #f) - (a2-0 num-func-loop!) - ) - (t9-2 gp-0 (the-as art-joint-anim a1-1) a2-0) - (if (< 27.306667 (fabs (-> self speed))) - (set! (-> self speed) (* 0.95 (-> self speed))) - ) - (set! (-> self y-offset-desired) 0.0) - (pegasus-move 409.6 #t (the-as symbol a2-0)) + (ja :num! (loop! (pegasus-calc-anim-speed))) + (if (< 27.306667 (fabs (-> self speed))) + (set! (-> self speed) (* 0.95 (-> self speed))) ) - ) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 409.6 #t) (pegasus-rotate #f 1820.4445) (suspend) ) @@ -824,82 +857,42 @@ ) (defbehavior pegasus-fly-code pegasus ((arg0 int)) - (local-vars (a2-3 object)) - (let ((f30-0 (pegasus-calc-anim-speed))) + "Handles the flying animations and sounds +@TODO - cleanup a bit more" + (let ((anim-speed (pegasus-calc-anim-speed))) (let ((gp-0 (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (-> self clock frame-counter))) ) ) - (let* ((f28-0 (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) - (f0-4 (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) - (s4-0 (pegasus-calc-speed f28-0 122880.0 f0-4 49152.0)) + (let* ((min-dist (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) + (min-speed (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) + (s4-0 (pegasus-calc-speed min-dist 122880.0 min-speed 49152.0)) ) (case (ja-group) (('pegasus-fly-doublespeed-ja) - (let ((a0-7 (-> self skel root-channel 0))) - (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) - (set! (-> a0-7 param 1) (fmax 1.0 (* 0.8 f30-0))) - (let ((t9-4 joint-control-channel-group-eval!) - (a1-3 #f) - ) - (set! a2-3 num-func-seek!) - (t9-4 - a0-7 - (the-as art-joint-anim a1-3) - (the-as (function joint-control-channel float float float float :behavior process) a2-3) - ) - ) - ) + (ja :num! (seek! max (fmax 1.0 (* 0.8 anim-speed)))) ) (('pegasus-fly-ja) - (let ((a0-9 (-> self skel root-channel 0))) - (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) - (set! (-> a0-9 param 1) (* 1.5 f30-0)) - (let ((t9-5 joint-control-channel-group-eval!) - (a1-4 #f) - ) - (set! a2-3 num-func-seek!) - (t9-5 - a0-9 - (the-as art-joint-anim a1-4) - (the-as (function joint-control-channel float float float float :behavior process) a2-3) - ) - ) - ) + (ja :num! (seek! max (* 1.5 anim-speed))) ) (else - (let ((a0-10 (-> self skel root-channel 0))) - (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group frames num-frames) -1))) - (set! (-> a0-10 param 1) 1.0) - (let ((t9-6 joint-control-channel-group-eval!) - (a1-5 #f) - ) - (set! a2-3 num-func-seek!) - (t9-6 - a0-10 - (the-as art-joint-anim a1-5) - (the-as (function joint-control-channel float float float float :behavior process) a2-3) - ) - ) - ) + (ja :num! (seek!)) ) ) (let ((v1-34 #f) (s5-1 12) ) (let ((a0-13 (ja-group))) - (when (not (and a0-13 (begin - (set! a2-3 (= a0-13 pegasus-fly-glide-ja)) - (or (the-as symbol a2-3) - (begin (set! a2-3 (= a0-13 pegasus-fly-doublespeed-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-fly-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-flip-around-a-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-flip-around-b-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-fly-to-run-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-run-ja)) (the-as symbol a2-3)) - (= a0-13 pegasus-run-to-fly-ja) - ) - ) + (when (not (and a0-13 + (or (= a0-13 pegasus-fly-glide-ja) + (= a0-13 pegasus-fly-doublespeed-ja) + (= a0-13 pegasus-fly-ja) + (= a0-13 pegasus-flip-around-a-ja) + (= a0-13 pegasus-flip-around-b-ja) + (= a0-13 pegasus-fly-to-run-ja) + (= a0-13 pegasus-run-ja) + (= a0-13 pegasus-run-to-fly-ja) + ) ) ) (set! s5-1 37) @@ -908,12 +901,7 @@ ) (cond ((and s4-0 (let ((a0-21 (ja-group))) - (not (and a0-21 (begin - (set! a2-3 (= a0-21 pegasus-flip-around-a-ja)) - (or (the-as symbol a2-3) (= a0-21 pegasus-flip-around-b-ja)) - ) - ) - ) + (not (and a0-21 (or (= a0-21 pegasus-flip-around-a-ja) (= a0-21 pegasus-flip-around-b-ja)))) ) ) (ja-channel-push! 1 (seconds 0.125)) @@ -942,9 +930,8 @@ (vector-cross! s5-3 s5-3 (-> self tangent)) (vector-normalize! s5-3 1.0) (matrix-axis-angle! s4-1 s5-3 32768.0) - (set! a2-3 s4-1) + (vector-matrix*! (-> self facing) (-> self facing) s4-1) ) - (vector-matrix*! (-> self facing) (-> self facing) (the-as matrix a2-3)) ) ((let ((v1-72 (ja-group))) (and v1-72 (= v1-72 pegasus-run-ja)) @@ -992,7 +979,7 @@ ) (ja :num-func num-func-identity :frame-num 0.0) ) - ((< 1.25 f30-0) + ((< 1.25 anim-speed) (let ((v1-135 (ja-group))) (when (not (and v1-135 (= v1-135 pegasus-fly-doublespeed-ja))) (ja-channel-push! 1 (the-as time-frame s5-1)) @@ -1018,17 +1005,11 @@ ) (pegasus-move 0.0 - (the-as - symbol - (or gp-0 - (let ((v1-161 (ja-group))) - (and v1-161 - (begin (set! a2-3 (= v1-161 pegasus-fly-to-run-ja)) (or (the-as symbol a2-3) (= v1-161 pegasus-run-ja))) - ) + (the-as symbol (or gp-0 (let ((v1-161 (ja-group))) + (and v1-161 (or (= v1-161 pegasus-fly-to-run-ja) (= v1-161 pegasus-run-ja))) + ) + ) ) - ) - ) - (the-as symbol a2-3) ) ) ) @@ -1039,9 +1020,9 @@ (defstate pegasus-tired (pegasus) :event (the-as (function process int symbol event-message-block object :behavior pegasus) enemy-event-handler) :enter (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) enter))) + (if func + (func) ) ) (set! (-> self state-time) (-> self clock frame-counter)) @@ -1050,18 +1031,18 @@ (none) ) :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) exit))) + (if func + (func) ) ) (remove-setting! 'sound-mode) (none) ) :trans (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) trans))) + (if func + (func) ) ) (cond @@ -1099,9 +1080,9 @@ (defstate flee (pegasus) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) enter))) + (if func + (func) ) ) (set! (-> self near-timer) 3000) @@ -1110,9 +1091,9 @@ (none) ) :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) exit))) + (if func + (func) ) ) (set! (-> self y-offset-desired) 0.0) @@ -1121,9 +1102,9 @@ ) :trans (behavior () (when (-> self can-run) - (let ((t9-0 (-> (method-of-type enemy flee) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) trans))) + (if func + (func) ) ) ) @@ -1161,8 +1142,8 @@ :virtual #t :code (behavior () (set! (-> self allow-idle) #f) - (let ((v1-2 (ja-group))) - (when (not (and v1-2 (= v1-2 pegasus-idle-ja))) + (let ((anim-group (ja-group))) + (when (not (and anim-group (= anim-group pegasus-idle-ja))) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! pegasus-fly-to-idle-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim pegasus-fly-to-idle-ja) frames num-frames) -1))) @@ -1200,9 +1181,9 @@ (none) ) :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy notice) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy notice) exit))) + (if func + (func) ) ) (remove-setting! 'sound-mode) @@ -1215,9 +1196,9 @@ (-> self curve-position) ) (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) - (enemy-method-72 self) + (react-to-focus self) ) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((anim-length (get-rand-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! @@ -1226,40 +1207,37 @@ -1 ) ) - f30-0 + anim-length ) :frame-num 0.0 ) (until (ja-done? 0) (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) - (enemy-method-72 self) + (react-to-focus self) ) (pegasus-rotate #f 1820.4445) (suspend) - (ja :num! (seek! max f30-0)) + (ja :num! (seek! max anim-length)) ) (ja-no-eval :group! pegasus-idle-takeoff-in-air-ja - :num! (seek! (the float (+ (-> (the-as art-joint-anim pegasus-idle-takeoff-in-air-ja) frames num-frames) -1)) f30-0) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim pegasus-idle-takeoff-in-air-ja) frames num-frames) -1)) + anim-length + ) :frame-num 0.0 ) (until (ja-done? 0) - (let ((t9-12 pegasus-calc-speed) - (a0-12 61440.0) - (a1-15 122880.0) - (a2-7 204800.0) - ) - (if (t9-12 a0-12 a1-15 a2-7 49152.0) - (enemy-method-72 self) - ) - (pegasus-rotate #f 1820.4445) - (set! (-> self y-offset-desired) 0.0) - (pegasus-move 0.0 #f (the-as symbol a2-7)) - ) + (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) + (react-to-focus self) + ) + (pegasus-rotate #f 1820.4445) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 0.0 #f) (suspend) - (ja :num! (seek! max f30-0)) + (ja :num! (seek! max anim-length)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1268,65 +1246,65 @@ :virtual #t :post (behavior () (pegasus-show-runs) - (pegasus-method-137 self) - (let ((t9-2 (-> (method-of-type enemy idle) post))) - (if t9-2 - ((the-as (function none) t9-2)) + (track-how-long-aimed-at! self) + (let ((func (-> (method-of-type enemy idle) post))) + (if func + ((the-as (function none) func)) ) ) (none) ) ) -(defmethod enemy-method-114 pegasus ((obj pegasus)) - "@abstract" +(defmethod init-enemy-collision! pegasus ((obj pegasus)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (stack-size-set! (-> obj main-thread) 512) - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0))) - (set! (-> s5-0 total-prims) (the-as uint 2)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) - (set! (-> s4-0 transform-index) 3) - (set-vector! (-> s4-0 local-sphere) 0.0 9216.0 4096.0 18432.0) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 1) 0))) + (set! (-> cshape total-prims) (the-as uint 2)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid no-standon)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 9216.0 4096.0 18432.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-14 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-14 prim-core action) (collide-action solid no-standon)) - (set! (-> v1-14 transform-index) 3) - (set-vector! (-> v1-14 local-sphere) 0.0 6144.0 0.0 11264.0) + (let ((prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-sphere prim-core action) (collide-action solid no-standon)) + (set! (-> prim-sphere transform-index) 3) + (set-vector! (-> prim-sphere local-sphere) 0.0 6144.0 0.0 11264.0) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-17 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override2) s5-0) + (set! (-> obj root-override2) cshape) ) 0 (none) @@ -1351,15 +1329,15 @@ (the-as pegasus ((method-of-type enemy relocate) obj arg0)) ) -(defmethod enemy-method-115 pegasus ((obj pegasus)) - "@abstract" - (local-vars (sv-16 res-tag)) +(defmethod init-enemy! pegasus ((obj pegasus)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (local-vars (tag res-tag)) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-pegasus" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *pegasus-enemy-info*) + (init-enemy-behaviour-and-stats! obj *pegasus-enemy-info*) (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf00)) (set! (-> obj link) (new 'process 'actor-link-info obj #f)) (dotimes (v1-8 20) @@ -1371,24 +1349,27 @@ (logior! (-> obj path-info 0 path-data flags) (path-control-flag display draw-line draw-point draw-text)) (set! (-> obj num-paths) 1) ) - (dotimes (s5-1 20) - (let ((v1-19 (new 'process 'curve-control obj 'path (the float s5-1)))) - (if (logtest? (-> v1-19 flags) (path-control-flag not-found)) + (dotimes (path-info-idx 20) + (let ((curve (new 'process 'curve-control obj 'path (the float path-info-idx)))) + (if (logtest? (-> curve flags) (path-control-flag not-found)) (goto cfg-15) ) - (set! (-> obj num-paths) (+ s5-1 1)) - (set! (-> obj path-info s5-1 path-data) v1-19) - (logior! (-> v1-19 flags) (path-control-flag display draw-line draw-point)) + (set! (-> obj num-paths) (+ path-info-idx 1)) + (set! (-> obj path-info path-info-idx path-data) curve) + (logior! (-> curve flags) (path-control-flag display draw-line draw-point)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data (-> obj entity) 'path-connection pointer :tag-ptr (& sv-16) :time (the float s5-1)))) + (set! tag (new 'static 'res-tag)) + (let ((data + (res-lump-data (-> obj entity) 'path-connection pointer :tag-ptr (& tag) :time (the float path-info-idx)) + ) + ) (cond - (v1-22 - (set! (-> obj path-info s5-1 num-data) (the-as int (-> sv-16 elt-count))) - (set! (-> obj path-info s5-1 control-data) (the-as (pointer float) v1-22)) + (data + (set! (-> obj path-info path-info-idx num-data) (the-as int (-> tag elt-count))) + (set! (-> obj path-info path-info-idx control-data) (the-as (pointer float) data)) ) (else - (set! (-> obj path-info s5-1 num-data) 0) + (set! (-> obj path-info path-info-idx num-data) 0) 0 ) ) @@ -1411,36 +1392,22 @@ (-> obj curve-position) ) (set! (-> obj facing quad) (-> obj tangent quad)) - (let ((s5-2 (new 'stack-no-clear 'matrix))) - (forward-down->inv-matrix s5-2 (-> obj facing) (new 'static 'vector :y -1.0)) - (matrix->quaternion (-> obj root-override2 quat) s5-2) + (let ((matrix (new 'stack-no-clear 'matrix))) + (forward-down->inv-matrix matrix (-> obj facing) (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> obj root-override2 quat) matrix) ) (set! (-> obj y-vel) 0.0) - (let ((t9-12 (method-of-type res-lump get-property-value-float)) - (a0-37 (-> obj entity)) - (a1-14 'water-height) - (a2-10 'interp) - ) - (set! (-> obj water-height) - (t9-12 a0-37 a1-14 a2-10 -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*) - ) - (set! (-> obj timeout) (the-as uint 3000)) - (when (-> obj entity) - (let ((t9-13 (method-of-type res-lump get-property-value-float)) - (a0-38 (-> obj entity)) - (a1-15 'timeout) - ) - (set! a2-10 'interp) - (let ((f0-9 (t9-13 a0-38 a1-15 a2-10 -1000000000.0 10.0 (the-as (pointer res-tag) #f) *res-static-buf*))) - (set! (-> obj timeout) (the-as uint (the int (* 300.0 f0-9)))) - ) - ) + (set! (-> obj water-height) (res-lump-float (-> obj entity) 'water-height)) + (set! (-> obj timeout) (the-as uint 3000)) + (when (-> obj entity) + (let ((timeout (res-lump-float (-> obj entity) 'timeout :default 10.0))) + (set! (-> obj timeout) (the-as uint (the int (* 300.0 timeout)))) ) - (set! (-> obj ambient-possible) (the-as uint 0)) - (set! (-> obj speed) 0.0) - (set! (-> obj y-offset-desired) 0.0) - (pegasus-move 409600.0 #t a2-10) ) + (set! (-> obj ambient-possible) (the-as uint 0)) + (set! (-> obj speed) 0.0) + (set! (-> obj y-offset-desired) 0.0) + (pegasus-move 409600.0 #t) (pegasus-calc-speed 61440.0 122880.0 2048.0 2048.0) (set! (-> obj can-run) #f) 0 @@ -1457,14 +1424,14 @@ (set! (-> self entity) (entity-by-type pegasus)) (set! (-> self actor-group 0) (res-lump-struct (-> self entity) 'actor-groups (pointer entity-actor))) (when (-> self actor-group 0) - (let ((v1-6 (-> self actor-group 0 0))) - (set! (-> self data-int32 0) (the-as int v1-6)) - (set! (-> self data-int32 1) (the-as int v1-6)) + (let ((actor-group (-> self actor-group 0 0))) + (set! (-> self data-int32 0) (the-as int actor-group)) + (set! (-> self data-int32 1) (the-as int actor-group)) ) - (dotimes (gp-0 (the-as int (-> self actor-group 0 0))) - (let ((t0-1 (-> (&+ (-> self actor-group 0) (* gp-0 8)) 3))) - (if t0-1 - (add-icon! *minimap* self (the-as uint 16) (the-as int #f) (the-as vector t0-1) 0) + (dotimes (actor-idx (the-as int (-> self actor-group 0 0))) + (let ((actor (-> (&+ (-> self actor-group 0) (* actor-idx 8)) 3))) + (if actor + (add-icon! *minimap* self (the-as uint 16) (the-as int #f) (the-as vector actor) 0) ) ) ) @@ -1481,23 +1448,23 @@ (function object) (lambda :behavior task-manager () - (local-vars (sv-16 int)) + (local-vars (data int)) (set! (-> self start-time) (-> self clock frame-counter)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-pegasus :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) - (set! sv-16 (-> self data-int32 1)) + (set! data (-> self data-int32 1)) (when (-> self actor-group 0) - (dotimes (v1-12 (the-as int (-> self actor-group 0 0))) - (let ((a1-4 (-> (&+ (-> self actor-group 0) (* v1-12 8)) 3))) - (if (and a1-4 (logtest? (-> a1-4 extra perm status) (entity-perm-status subtask-complete))) - (set! sv-16 (+ sv-16 -1)) + (dotimes (actor-group (the-as int (-> self actor-group 0 0))) + (let ((actor (-> (&+ (-> self actor-group 0) (* actor-group 8)) 3))) + (if (and actor (logtest? (-> actor extra perm status) (entity-perm-status subtask-complete))) + (set! data (+ data -1)) ) ) ) ) - (let ((v1-15 sv-16)) - (set! (-> self data-int32 0) v1-15) - (set! (-> *game-info* counter) (the float v1-15)) + (let ((_data data)) + (set! (-> self data-int32 0) _data) + (set! (-> *game-info* counter) (the float _data)) ) (suspend) ) diff --git a/goal_src/jak2/levels/forest/predator.gc b/goal_src/jak2/levels/forest/predator.gc index 7aca7688f2..df6163cf8b 100644 --- a/goal_src/jak2/levels/forest/predator.gc +++ b/goal_src/jak2/levels/forest/predator.gc @@ -108,6 +108,7 @@ ) +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound predator-shot ((obj predator-shot) (arg0 projectile-options)) (case arg0 (((projectile-options lose-altitude)) @@ -123,9 +124,10 @@ ) ) ) + (none) ) -(defmethod init-collision! predator-shot ((obj predator-shot)) +(defmethod init-proj-collision! predator-shot ((obj predator-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -343,12 +345,14 @@ (set! (-> *predator-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 predator ((obj predator) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler predator ((obj predator) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('attack) (set! (-> obj shock-effect-end) (the-as uint (+ (-> pp clock frame-counter) (seconds 1)))) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (('death-end) (when (nonzero? (-> obj ambient-sound-id)) @@ -356,10 +360,10 @@ (set! (-> obj ambient-sound-id) (new 'static 'sound-id)) 0 ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1173,10 +1177,8 @@ (if (not gp-0) (go-virtual active) ) - (when (enemy-method-107 self) - (when (and gp-0 - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) - ) + (when (get-enemy-target self) + (when (and gp-0 (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time))) (let ((f0-0 (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) ) @@ -1318,8 +1320,12 @@ #f ) -(defmethod enemy-method-55 predator ((obj predator)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! predator ((obj 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!))) (t9-0 obj) ) (predator-method-183 obj) @@ -1345,8 +1351,8 @@ #f ) -(defmethod enemy-method-114 predator ((obj predator)) - "@abstract" +(defmethod init-enemy-collision! predator ((obj predator)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1448,7 +1454,7 @@ ) ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 predator ((obj predator) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 predator ((obj predator) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1469,9 +1475,10 @@ This commonly includes things such as: (none) ) -(defmethod enemy-method-113 predator ((obj predator) (arg0 nav-enemy-info)) +(defmethod init-enemy-behaviour-and-stats! predator ((obj predator) (arg0 nav-enemy-info)) + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" (set! (-> arg0 nav-mesh) *default-nav-mesh*) - (let ((t9-0 (method-of-type nav-enemy enemy-method-113))) + (let ((t9-0 (method-of-type nav-enemy init-enemy-behaviour-and-stats!))) (t9-0 obj arg0) ) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -1480,14 +1487,14 @@ This commonly includes things such as: (none) ) -(defmethod enemy-method-115 predator ((obj predator)) - "@abstract" +(defmethod init-enemy! predator ((obj predator)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-predator" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *predator-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *predator-nav-enemy-info*) (let ((v1-5 (-> obj nav))) (set! (-> v1-5 speed-scale) 1.0) ) diff --git a/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc b/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc index 3369fbaab0..5b8c8916a7 100644 --- a/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc +++ b/goal_src/jak2/levels/fortress/ammo_dump/fort-robotank-turret.gc @@ -614,7 +614,6 @@ ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound fort-robotank-shot ((obj fort-robotank-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -626,10 +625,11 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) -(defmethod init-collision! fort-robotank-shot ((obj fort-robotank-shot)) +(defmethod init-proj-collision! fort-robotank-shot ((obj fort-robotank-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/levels/fortress/exit/forexitb-part.gc b/goal_src/jak2/levels/fortress/exit/forexitb-part.gc index d14b34e06a..57b4d477a1 100644 --- a/goal_src/jak2/levels/fortress/exit/forexitb-part.gc +++ b/goal_src/jak2/levels/fortress/exit/forexitb-part.gc @@ -1242,6 +1242,7 @@ ) (defun check-drop-level-forexitb-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water pipe spray at the end of fortress does not go below the provided value, render splash when it reaches" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) @@ -1269,6 +1270,7 @@ ) (defun check-drop-level-forexitb-drop-water-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water pipe drip at the end of fortress does not go below the provided value, render splash when it reaches" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/goal_src/jak2/levels/fortress/fort-turret.gc b/goal_src/jak2/levels/fortress/fort-turret.gc index c7bdc50411..dfdebe4eac 100644 --- a/goal_src/jak2/levels/fortress/fort-turret.gc +++ b/goal_src/jak2/levels/fortress/fort-turret.gc @@ -432,7 +432,7 @@ (gun-tilt float :offset-assert 580) (desired-twist float :offset-assert 584) (desired-tilt float :offset-assert 588) - (los-clear basic :offset-assert 592) + (los-clear symbol :offset-assert 592) (flash-state basic :offset-assert 596) (flash-index uint32 :offset-assert 600) (can-shoot symbol :offset-assert 604) @@ -540,8 +540,12 @@ (set! (-> *fort-turret-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-55 fort-turret ((obj fort-turret)) - (let ((t9-0 (method-of-type enemy enemy-method-55))) +(defmethod track-target! fort-turret ((obj 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!))) (t9-0 obj) ) (let ((s5-0 (-> obj root-override2))) @@ -747,12 +751,12 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) (if (or (>= (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) (< (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) @@ -838,12 +842,12 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (set! (-> self desired-twist) (* 8192.0 (cos (get-scaled-val! (-> self sync) 32768.0 0)))) (fort-turret-method-140 self 0.1 91.022224) (fort-turret-method-141 self) @@ -879,12 +883,12 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) (if (and (< (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) @@ -904,9 +908,11 @@ ) ) -(defmethod enemy-method-74 fort-turret ((obj fort-turret) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler fort-turret ((obj fort-turret) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp - (if (and (= arg2 'notify) (< 1 (the-as int arg1)) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (if (and (= arg2 'notify) (< 1 arg1) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) (set! (-> obj last-hit-time) (-> pp clock frame-counter)) ) (case arg2 @@ -929,12 +935,12 @@ #f ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -943,7 +949,7 @@ (defstate die (fort-turret) :virtual #t :enter (behavior () - (enemy-method-132 self) + (dispose! self) (let ((v1-3 (-> self root-override2 root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -989,19 +995,25 @@ (none) ) :post (behavior () - (enemy-method-55 self) + (track-target! self) (none) ) ) +(defmethod coin-flip? fort-turret ((obj fort-turret)) + "@returns The result of a 50/50 RNG roll" + #f + ) ;; WARN: Return type mismatch int vs penetrate. -(defmethod enemy-method-59 fort-turret ((obj fort-turret)) +(defmethod get-penetrate-info fort-turret ((obj fort-turret)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (the-as penetrate 0) ) -(defmethod enemy-method-114 fort-turret ((obj fort-turret)) - "@abstract" +(defmethod init-enemy-collision! fort-turret ((obj fort-turret)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (stack-size-set! (-> obj main-thread) 512) (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -1052,11 +1064,6 @@ (none) ) -(defmethod coin-flip? fort-turret ((obj fort-turret)) - "@returns The result of a 50/50 RNG roll" - #f - ) - ;; WARN: Return type mismatch enemy vs fort-turret. (defmethod relocate fort-turret ((obj fort-turret) (arg0 int)) (if (nonzero? (-> obj gun-tilt-jm)) @@ -1068,14 +1075,14 @@ (the-as fort-turret ((method-of-type enemy relocate) obj arg0)) ) -(defmethod enemy-method-115 fort-turret ((obj fort-turret)) - "@abstract" +(defmethod init-enemy! fort-turret ((obj fort-turret)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-fort-turret" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *fort-turret-enemy-info*) + (init-enemy-behaviour-and-stats! obj *fort-turret-enemy-info*) (set! (-> obj invincible) #f) (if (logtest? (the-as int (res-lump-value (-> obj entity) 'enemy-options uint128 :time -1000000000.0)) 1) (set! (-> obj invincible) #t) diff --git a/goal_src/jak2/levels/fortress/fortress-obs.gc b/goal_src/jak2/levels/fortress/fortress-obs.gc index 519518bd09..57955ec748 100644 --- a/goal_src/jak2/levels/fortress/fortress-obs.gc +++ b/goal_src/jak2/levels/fortress/fortress-obs.gc @@ -78,24 +78,24 @@ (defstate die (fort-trap-door) :virtual #t :enter (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (sound-play "trapdoor") - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer self)) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) 'trigger) - (let ((t9-2 send-event-function) - (v1-6 (-> self notify-actor)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 0) + (set! (-> evt message) 'trigger) + (let ((func send-event-function) + (actor (-> self notify-actor)) ) - (t9-2 - (if v1-6 - (-> v1-6 extra process) + (func + (if actor + (-> actor extra process) ) - a1-1 + evt ) ) ) @@ -105,27 +105,29 @@ ((lambda () (with-pp (sound-play "wcrate-break") - (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 1)))) - (let* ((s5-1 *target*) - (a0-4 (if (type? s5-1 process-focusable) - s5-1 - ) - ) + (let ((exploder-tuning (new 'stack 'joint-exploder-tuning (the-as uint 1)))) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when a0-4 - (set! (-> gp-1 fountain-rand-transv-lo quad) (-> (get-trans a0-4 0) quad)) - (set! (-> gp-1 fountain-rand-transv-lo y) (+ -16384.0 (-> gp-1 fountain-rand-transv-lo y))) + (when target-proc + (set! (-> exploder-tuning fountain-rand-transv-lo quad) (-> (get-trans target-proc 0) quad)) + (set! (-> exploder-tuning fountain-rand-transv-lo y) + (+ -16384.0 (-> exploder-tuning fountain-rand-transv-lo y)) + ) ) ) - (set! (-> gp-1 fountain-rand-transv-hi x) 24576.0) - (set! (-> gp-1 fountain-rand-transv-hi y) 81920.0) - (set! (-> gp-1 fountain-rand-transv-hi z) 12288.0) - (set! (-> gp-1 fountain-rand-transv-hi w) 32768.0) + (set! (-> exploder-tuning fountain-rand-transv-hi x) 24576.0) + (set! (-> exploder-tuning fountain-rand-transv-hi y) 81920.0) + (set! (-> exploder-tuning fountain-rand-transv-hi z) 12288.0) + (set! (-> exploder-tuning fountain-rand-transv-hi w) 32768.0) (process-spawn joint-exploder (art-group-get-by-name *level* "skel-fort-trap-door-explode" (the-as (pointer uint32) #f)) 5 - gp-1 + exploder-tuning *fort-trap-door-exploder-params* :to pp ) @@ -135,8 +137,8 @@ ) (suspend) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 1)) (suspend) ) ) @@ -151,42 +153,46 @@ ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! fort-trap-door ((obj fort-trap-door) (arg0 entity-actor)) +(defmethod init-from-entity! fort-trap-door ((obj fort-trap-door) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 0) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 20480.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 20480.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + (set! (-> obj root-override) (the-as collide-shape-moving cshape)) ) (set! (-> (the-as collide-shape-moving (-> obj root-override)) penetrated-by) (penetrate flop)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-fort-trap-door" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! (-> obj notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) - (let ((a0-14 (-> obj skel root-channel 0))) - (set! (-> a0-14 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) - (set! (-> a0-14 frame-num) 0.0) - (joint-control-channel-group! a0-14 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + (set! (-> obj notify-actor) (entity-actor-lookup entity 'alt-actor 0)) + (let ((channel (-> obj skel root-channel 0))) + (set! (-> channel frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> channel frame-num) 0.0) + (joint-control-channel-group! + channel + (the-as art-joint-anim (-> obj draw art-group data 2)) + num-func-identity + ) ) (transform-post) (go (method-of-object obj idle)) @@ -216,18 +222,18 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch ripple-wave-set vs none. -(defmethod art-init! water-anim-fortress ((obj water-anim-fortress)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) - (t9-0 obj) +(defmethod init-water! water-anim-fortress ((obj water-anim-fortress)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((parent-method (method-of-type water-anim init-water!))) + (parent-method obj) ) - (let ((v1-2 (new 'process 'ripple-control))) - (set! (-> obj draw ripple) v1-2) + (let ((ripple (new 'process 'ripple-control))) + (set! (-> obj draw ripple) ripple) (set-vector! (-> obj draw color-mult) 0.01 0.45 0.5 0.75) - (set! (-> v1-2 global-scale) 3072.0) - (set! (-> v1-2 close-fade-dist) 163840.0) - (set! (-> v1-2 far-fade-dist) 245760.0) - (set! (-> v1-2 waveform) ripple-for-water-anim-fortress) + (set! (-> ripple global-scale) 3072.0) + (set! (-> ripple close-fade-dist) 163840.0) + (set! (-> ripple far-fade-dist) 245760.0) + (set! (-> ripple waveform) ripple-for-water-anim-fortress) ) (none) ) diff --git a/goal_src/jak2/levels/mars_tomb/monster-frog.gc b/goal_src/jak2/levels/mars_tomb/monster-frog.gc index 9d2f71b5f4..daf776185a 100644 --- a/goal_src/jak2/levels/mars_tomb/monster-frog.gc +++ b/goal_src/jak2/levels/mars_tomb/monster-frog.gc @@ -306,7 +306,7 @@ (set! (-> v1-37 prim-core collide-as) (-> self root-override2 backup-collide-as)) (set! (-> v1-37 prim-core collide-with) (-> self root-override2 backup-collide-with)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior monster-frog) nav-enemy-simple-post) @@ -353,7 +353,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -514,7 +514,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -526,10 +526,10 @@ (go-virtual active) ) ) - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -676,7 +676,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -825,7 +825,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior monster-frog) nav-enemy-simple-post) @@ -951,14 +951,18 @@ ) ) -(defmethod enemy-method-55 monster-frog ((obj monster-frog)) +(defmethod track-target! monster-frog ((obj 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 (-> obj water)) - ((method-of-type nav-enemy enemy-method-55) obj) + ((method-of-type nav-enemy track-target!) obj) (none) ) -(defmethod enemy-method-114 monster-frog ((obj monster-frog)) - "@abstract" +(defmethod init-enemy-collision! monster-frog ((obj monster-frog)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1020,14 +1024,14 @@ (none) ) -(defmethod enemy-method-115 monster-frog ((obj monster-frog)) - "@abstract" +(defmethod init-enemy! monster-frog ((obj monster-frog)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-monster-frog" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *monster-frog-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *monster-frog-nav-enemy-info*) (set! (-> obj water) (new 'process 'water-control obj 5 0.0 8192.0 2048.0)) (set! (-> obj water flags) (water-flags active use-water-anim touch-water part-splash part-drip part-rings part-water find-water) diff --git a/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc b/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc index a8f847833d..6ff2a2f673 100644 --- a/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc +++ b/goal_src/jak2/levels/mars_tomb/tomb-beetle.gc @@ -162,13 +162,13 @@ (set! (-> *tomb-beetle-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 tomb-beetle ((obj tomb-beetle) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler tomb-beetle ((obj tomb-beetle) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (with-pp (let ((v1-0 (new 'static 'array int64 2 -1 0))) (case arg2 (('cue-chase) (set! (-> obj round) (-> arg3 param 0)) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (('attack) (when (and (-> obj next-state) (let ((a1-4 (-> obj next-state name))) @@ -199,7 +199,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -503,7 +503,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (set! (-> self state-timeout) (the-as uint (the int (* 300.0 (rand-vu-float-range 0.2 0.8))))) + (set! (-> self state-timeout) (the-as time-frame (the int (* 300.0 (rand-vu-float-range 0.2 0.8))))) (none) ) :trans (behavior () @@ -567,7 +567,7 @@ ) :code (behavior () (set! (-> self state-timeout) - (the-as uint (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.0 0.8))))) + (the-as time-frame (+ (-> self clock frame-counter) (the int (* 300.0 (rand-vu-float-range 0.0 0.8))))) ) (let ((v1-6 (ja-group))) (cond @@ -994,7 +994,7 @@ ) ) -(defmethod enemy-method-114 tomb-beetle ((obj tomb-beetle)) +(defmethod init-enemy-collision! tomb-beetle ((obj tomb-beetle)) "@abstract" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -1042,14 +1042,14 @@ (none) ) -(defmethod enemy-method-115 tomb-beetle ((obj tomb-beetle)) +(defmethod init-enemy! tomb-beetle ((obj tomb-beetle)) "@abstract" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-tomb-beetle" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *tomb-beetle-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *tomb-beetle-nav-enemy-info*) (let ((v1-5 (-> obj nav))) (set! (-> v1-5 sphere-mask) (the-as uint #x800fa)) ) diff --git a/goal_src/jak2/levels/mars_tomb/tomb-obs.gc b/goal_src/jak2/levels/mars_tomb/tomb-obs.gc index 2a11372e14..27c0618902 100644 --- a/goal_src/jak2/levels/mars_tomb/tomb-obs.gc +++ b/goal_src/jak2/levels/mars_tomb/tomb-obs.gc @@ -1228,9 +1228,9 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch ripple-wave-set vs none. -(defmethod art-init! water-anim-tomb ((obj water-anim-tomb)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) +(defmethod init-water! water-anim-tomb ((obj water-anim-tomb)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) (t9-0 obj) ) (let ((v1-2 (new 'process 'ripple-control))) diff --git a/goal_src/jak2/levels/nest/flying-spider.gc b/goal_src/jak2/levels/nest/flying-spider.gc index 2b3cd3254a..ca91fecfb2 100644 --- a/goal_src/jak2/levels/nest/flying-spider.gc +++ b/goal_src/jak2/levels/nest/flying-spider.gc @@ -18,6 +18,7 @@ ) +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound flying-spider-shot ((obj flying-spider-shot) (arg0 projectile-options)) (if (zero? arg0) (sound-play "fly-spider-shot") @@ -26,6 +27,7 @@ arg0 ) ) + (none) ) (defun spawn-flying-spider-projectile ((arg0 flying-spider) (arg1 vector) (arg2 vector) (arg3 float)) @@ -455,7 +457,7 @@ (none) ) :trans (behavior () - (let ((a0-1 (enemy-method-107 self))) + (let ((a0-1 (get-enemy-target self))) (cond ((or (not a0-1) (>= 2 (the-as int (-> self focus aware)))) (go-stare self) @@ -481,7 +483,7 @@ (suspend) (ja :num! (seek!)) ) - (if (enemy-method-107 self) + (if (get-enemy-target self) (go-virtual attack-fire) ) ) @@ -575,7 +577,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior flying-spider) enemy-event-handler) :enter (behavior () - (enemy-method-132 self) + (dispose! self) (set! (-> self state-time) (-> self clock frame-counter)) (set! (-> self hit-points) 0) (enemy-method-103 self) @@ -618,7 +620,9 @@ :post (the-as (function none :behavior flying-spider) enemy-simple-post) ) -(defmethod enemy-method-74 flying-spider ((obj flying-spider) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler flying-spider ((obj flying-spider) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -651,7 +655,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -675,16 +679,20 @@ (set! (-> v1-52 prim-core collide-with) (collide-spec)) ) 0 - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) -(defmethod enemy-method-55 flying-spider ((obj flying-spider)) - ((method-of-type nav-enemy enemy-method-55) obj) +(defmethod track-target! flying-spider ((obj 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!) obj) (none) ) @@ -780,13 +788,17 @@ (none) ) -(defmethod enemy-method-109 flying-spider ((obj flying-spider) (arg0 int)) +(defmethod look-at-target! flying-spider ((obj flying-spider) (arg0 enemy-flag)) + "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available +@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" 0 (none) ) ;; WARN: Return type mismatch int vs penetrate. -(defmethod enemy-method-59 flying-spider ((obj flying-spider)) +(defmethod get-penetrate-info flying-spider ((obj flying-spider)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (the-as penetrate 0) ) @@ -800,8 +812,8 @@ ) ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod enemy-method-114 flying-spider ((obj flying-spider)) - "@abstract" +(defmethod init-enemy-collision! flying-spider ((obj flying-spider)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -863,14 +875,14 @@ (none) ) -(defmethod enemy-method-115 flying-spider ((obj flying-spider)) - "@abstract" +(defmethod init-enemy! flying-spider ((obj flying-spider)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-flying-spider" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *flying-spider-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *flying-spider-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (set! (-> v1-5 up) (the-as uint 1)) (set! (-> v1-5 nose) (the-as uint 2)) diff --git a/goal_src/jak2/levels/nest/mammoth.gc b/goal_src/jak2/levels/nest/mammoth.gc index 285a583abd..d498ea9761 100644 --- a/goal_src/jak2/levels/nest/mammoth.gc +++ b/goal_src/jak2/levels/nest/mammoth.gc @@ -753,7 +753,9 @@ :post mammoth-walk-post ) -(defmethod enemy-method-74 mammoth ((obj mammoth) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler mammoth ((obj mammoth) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -771,7 +773,7 @@ (send-event arg0 'get-attack-count 1) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1419,10 +1421,14 @@ ) ) -(defmethod enemy-method-55 mammoth ((obj mammoth)) +(defmethod track-target! mammoth ((obj 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)) (with-pp - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-0 (method-of-type nav-enemy track-target!))) (t9-0 obj) ) (mammoth-update-ik) @@ -1593,8 +1599,8 @@ ) ) -(defmethod enemy-method-114 mammoth ((obj mammoth)) - "@abstract" +(defmethod init-enemy-collision! mammoth ((obj mammoth)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1688,15 +1694,15 @@ (none) ) -(defmethod enemy-method-115 mammoth ((obj mammoth)) - "@abstract" +(defmethod init-enemy! mammoth ((obj mammoth)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (with-pp (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-mammoth" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *mammoth-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *mammoth-nav-enemy-info*) (logclear! (-> obj mask) (process-mask actor-pause)) (set-vector! (-> obj root-override2 scale) 1.5 1.5 1.5 1.0) (set! (-> obj y-level) -40959590.0) diff --git a/goal_src/jak2/levels/nest/mantis.gc b/goal_src/jak2/levels/nest/mantis.gc index 822230eace..9940bc41e5 100644 --- a/goal_src/jak2/levels/nest/mantis.gc +++ b/goal_src/jak2/levels/nest/mantis.gc @@ -486,7 +486,7 @@ ) 0 (let ((gp-1 (new 'stack-no-clear 'collide-query))) - (if (enemy-method-126 self gp-1 (-> self root-override2 trans) (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? self gp-1 (-> self root-override2 trans) (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> self base-height) (-> gp-1 best-other-tri intersect y)) (set! (-> self base-height) (-> self root-override2 trans y)) ) @@ -572,7 +572,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :code (behavior () - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self root-override2 trans y) (-> self base-height)) (ja-channel-push! 1 0) (ja-no-eval :group! mantis-ground-crawl-out-ja @@ -609,7 +609,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self state-time) (-> self clock frame-counter)) (set! (-> self root-override2 trans y) (+ -18841.6 (-> self base-height))) (let ((gp-0 (-> self root-override2))) @@ -1193,7 +1193,7 @@ :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) @@ -1209,7 +1209,7 @@ ) 0 (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (none) ) :trans (behavior () @@ -1254,9 +1254,9 @@ (go-virtual crawl) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (>= (the-as int (-> self focus aware)) 3) - (enemy-method-107 self) + (get-enemy-target self) ) (go-hostile self) ) @@ -1280,7 +1280,9 @@ :post (the-as (function none :behavior mantis) nav-enemy-face-focus-post) ) -(defmethod enemy-method-74 mantis ((obj mantis) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler mantis ((obj mantis) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('track) @@ -1327,7 +1329,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -1346,7 +1348,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1533,9 +1535,13 @@ ) ;; WARN: Return type mismatch vector vs none. -(defmethod enemy-method-55 mantis ((obj mantis)) +(defmethod track-target! mantis ((obj 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 enemy-method-55))) + (let ((t9-0 (method-of-type nav-enemy track-target!))) (t9-0 obj) ) (logclear! (-> obj flags) (mantis-flag tracked)) @@ -1895,8 +1901,8 @@ ) ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod enemy-method-114 mantis ((obj mantis)) - "@abstract" +(defmethod init-enemy-collision! mantis ((obj mantis)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1998,15 +2004,15 @@ (none) ) -(defmethod enemy-method-115 mantis ((obj mantis)) - "@abstract" +(defmethod init-enemy! mantis ((obj mantis)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (with-pp (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-mantis" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *mantis-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *mantis-nav-enemy-info*) (set! (-> obj flags) (mantis-flag)) (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) diff --git a/goal_src/jak2/levels/palace/explore/palent-part.gc b/goal_src/jak2/levels/palace/explore/palent-part.gc index 7a3bfc08e2..b8856692bc 100644 --- a/goal_src/jak2/levels/palace/explore/palent-part.gc +++ b/goal_src/jak2/levels/palace/explore/palent-part.gc @@ -356,14 +356,14 @@ (defun palent-deactivate () "Sets [[palshaft.bigmap-id]] to `20`" - (set! (-> palshaft bigmap-id) (the-as uint 20)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-20)) 0 (none) ) (defun palent-activate () "Sets [[palshaft.bigmap-id]] to `12`" - (set! (-> palshaft bigmap-id) (the-as uint 12)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-12)) 0 (none) ) diff --git a/goal_src/jak2/levels/palace/roof/palroof-part.gc b/goal_src/jak2/levels/palace/roof/palroof-part.gc index 559ece0c96..e9361c8d88 100644 --- a/goal_src/jak2/levels/palace/roof/palroof-part.gc +++ b/goal_src/jak2/levels/palace/roof/palroof-part.gc @@ -443,7 +443,7 @@ (defun palroof-deactivate () "Sets [[palshaft.bigmap-id]] to `11` and [[*math-camera*.f]] to `20,000` meters" - (set! (-> palshaft bigmap-id) (the-as uint 20)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-20)) (set! (-> *math-camera* f) (meters 10000)) 0 (none) @@ -451,7 +451,7 @@ (defun palroof-activate () "Sets [[palshaft.bigmap-id]] to `20` and [[*math-camera*.f]] to `10,000` meters" - (set! (-> palshaft bigmap-id) (the-as uint 11)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-11)) (set! (-> *math-camera* f) (meters 20000)) 0 (none) diff --git a/goal_src/jak2/levels/palace/shaft/palshaft-part.gc b/goal_src/jak2/levels/palace/shaft/palshaft-part.gc index f000ffabee..0d3a28e743 100644 --- a/goal_src/jak2/levels/palace/shaft/palshaft-part.gc +++ b/goal_src/jak2/levels/palace/shaft/palshaft-part.gc @@ -749,7 +749,7 @@ (defun palshaft-deactivate () "Sets [[palshaft.bigmap-id]] to `20`" - (set! (-> palshaft bigmap-id) (the-as uint 20)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-20)) 0 (none) ) diff --git a/goal_src/jak2/levels/ruins/rapid-gunner.gc b/goal_src/jak2/levels/ruins/rapid-gunner.gc index 949c882b3c..24e9e67ca3 100644 --- a/goal_src/jak2/levels/ruins/rapid-gunner.gc +++ b/goal_src/jak2/levels/ruins/rapid-gunner.gc @@ -165,7 +165,9 @@ (set! (-> *rapid-gunner-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 rapid-gunner ((obj rapid-gunner) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler rapid-gunner ((obj rapid-gunner) (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 'hit-flinch) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -189,7 +191,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -390,8 +392,13 @@ ) ) -(defmethod enemy-method-98 rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 vector)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-98))) +(defmethod in-aggro-range? rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" + (let ((t9-0 (method-of-type nav-enemy in-aggro-range?))) (and (t9-0 obj arg0 arg1) (or (not (logtest? (-> obj fact-info-override enemy-options) (enemy-option user8))) (and (not (logtest? (-> arg0 focus-status) (focus-status in-air))) @@ -489,8 +496,12 @@ (none) ) -(defmethod enemy-method-55 rapid-gunner ((obj rapid-gunner)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! rapid-gunner ((obj 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!))) (t9-0 obj) ) (los-control-method-9 (-> obj los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -526,7 +537,7 @@ :virtual #t :enter (behavior () (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) - (enemy-method-109 self 1) + (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)) (let ((gp-0 (-> self on-notice))) @@ -593,7 +604,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -1321,7 +1332,7 @@ ) ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1330,8 +1341,8 @@ ) ) -(defmethod enemy-method-114 rapid-gunner ((obj rapid-gunner)) - "@abstract" +(defmethod init-enemy-collision! rapid-gunner ((obj rapid-gunner)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1420,8 +1431,8 @@ ) ) -(defmethod enemy-method-115 rapid-gunner ((obj rapid-gunner)) - "@abstract" +(defmethod init-enemy! rapid-gunner ((obj rapid-gunner)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (local-vars (sv-48 int)) (rlet ((acc :class vf) (vf0 :class vf) @@ -1436,7 +1447,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-rapid-gunner" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *rapid-gunner-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *rapid-gunner-nav-enemy-info*) (set! (-> obj neck up) (the-as uint 1)) (set! (-> obj neck nose) (the-as uint 2)) (set! (-> obj neck ear) (the-as uint 0)) diff --git a/goal_src/jak2/levels/sewer/gator.gc b/goal_src/jak2/levels/sewer/gator.gc index a03cc584c0..2cc116a3f5 100644 --- a/goal_src/jak2/levels/sewer/gator.gc +++ b/goal_src/jak2/levels/sewer/gator.gc @@ -13,8 +13,9 @@ ) (deftype gator (nav-enemy) + "Cannot take damage due to it overriding [[enemy::56]]" ((ocean-y float :offset-assert 604) - (lock-nav-target basic :offset-assert 608) + (lock-nav-target symbol :offset-assert 608) (new-facing vector :inline :offset-assert 624) (old-facing vector :inline :offset-assert 640) (turn-time time-frame :offset-assert 656) @@ -25,9 +26,9 @@ :flag-assert #xb602200298 (:methods (attack-forward () _type_ :state 178) - (gator-method-179 (_type_) float 179) - (gator-method-180 (_type_ vector) vector 180) - (gator-method-181 (_type_ float float symbol) time-frame 181) + (adjust-depth! (_type_) float 179) + (update-facing! (_type_ vector) vector 180) + (encircle-target! (_type_ float float symbol) time-frame 181) ) ) @@ -143,37 +144,44 @@ (set! (-> *gator-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) -(defmethod enemy-method-74 gator ((obj gator) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) - (case arg2 +(defmethod general-event-handler gator ((obj gator) (proc process) (arg2 int) (event-type symbol) (event event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" + (case event-type (('hit-knocked) (when (= (-> obj incoming knocked-type) (knocked-type knocked-type-4)) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) 0 ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj proc arg2 event-type event) ) (('track) #f ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj proc arg2 event-type event) ) ) ) -(defmethod gator-method-179 gator ((obj gator)) +(defmethod adjust-depth! gator ((obj gator)) + "Changes the height based on the ocean depth +@see [[get-height]]" (set! (-> obj ocean-y) (get-height *ocean* (-> obj root-override2 trans) #t)) (set! (-> obj root-override2 trans y) (+ -10240.0 (-> obj ocean-y))) ) -(defmethod gator-method-180 gator ((obj gator) (arg0 vector)) - (let ((a0-3 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)))) - (set! (-> arg0 quad) (-> a0-3 vector 2 quad)) +(defmethod update-facing! gator ((obj gator) (arg0 vector)) + "Updates the `new-facing` vector" + (let ((matrix (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)))) + (set! (-> arg0 quad) (-> matrix vector 2 quad)) ) arg0 ) -(defmethod gator-method-181 gator ((obj gator) (arg0 float) (arg1 float) (arg2 symbol)) +(defmethod encircle-target! gator ((obj gator) (arg0 float) (arg1 float) (arg2 symbol)) + "Core movement for the [[gator]], circles the target, charges at the target, etc +@params TODO - not sure, they all dont seem to do very much and this method is a mess" (local-vars (v1-17 object) (a0-5 object)) (with-pp (let ((f30-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) @@ -270,17 +278,22 @@ ) ;; WARN: Return type mismatch vector vs none. -(defmethod enemy-method-55 gator ((obj gator)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) - (t9-0 obj) +(defmethod track-target! gator ((obj 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!))) + (func obj) ) - (gator-method-179 obj) + (adjust-depth! obj) (set! (-> obj old-facing quad) (-> obj new-facing quad)) - (gator-method-180 obj (-> obj new-facing)) + (update-facing! obj (-> obj new-facing)) (none) ) -(defmethod enemy-method-56 gator ((obj gator) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack gator ((obj gator) (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]]" 0 ) @@ -290,44 +303,54 @@ (none) ) -(defmethod enemy-method-107 gator ((obj gator)) - (let ((gp-0 ((method-of-type nav-enemy enemy-method-107) obj))) - (if (and gp-0 (< (+ 1024.0 (get-height *ocean* (get-trans gp-0 0) #t)) (-> (get-trans gp-0 1) y))) - (set! gp-0 (the-as process-focusable #f)) +(defmethod get-enemy-target gator ((obj gator)) + "@returns the [[process-focusable]] that the enemy is currently focusing on, or [[#f]] otherwise" + (let ((enemy-target ((method-of-type nav-enemy get-enemy-target) obj))) + (if (and enemy-target + (< (+ 1024.0 (get-height *ocean* (get-trans enemy-target 0) #t)) (-> (get-trans enemy-target 1) y)) + ) + (set! enemy-target (the-as process-focusable #f)) ) - gp-0 + enemy-target ) ) -(defmethod enemy-method-98 gator ((obj gator) (arg0 process-focusable) (arg1 vector)) - (let ((s4-0 (new 'stack-no-clear 'vector))) +(defmethod in-aggro-range? gator ((obj gator) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" + (let ((target-pos (new 'stack-no-clear 'vector))) (when (and (= *target* arg0) (not arg1) (= (-> *target* control ground-pat material) (pat-material waterbottom))) - (set! (-> s4-0 quad) (-> (get-trans arg0 0) quad)) - (set! (-> s4-0 y) (get-height *ocean* s4-0 #t)) - (set! arg1 s4-0) + (set! (-> target-pos quad) (-> (get-trans arg0 0) quad)) + (set! (-> target-pos y) (get-height *ocean* target-pos #t)) + (set! arg1 target-pos) ) ) - ((method-of-type nav-enemy enemy-method-98) obj arg0 arg1) + ((method-of-type nav-enemy in-aggro-range?) obj arg0 arg1) ) (defstate hostile (gator) :virtual #t :trans (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy hostile) trans))) + (if func + (func) ) ) - (let ((a0-1 (enemy-method-107 self))) - (when a0-1 - (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (get-trans a0-1 0) (-> self root-override2 trans))) - (a0-4 (-> self nav state)) + (let ((enemy-target (get-enemy-target self))) + (when enemy-target + (let ((dir-to-target + (vector-! (new 'stack-no-clear 'vector) (get-trans enemy-target 0) (-> self root-override2 trans)) + ) + (nav-state (-> self nav state)) (s5-0 (new 'stack-no-clear 'vector)) ) - (set! (-> s5-0 quad) (-> a0-4 heading quad)) + (set! (-> s5-0 quad) (-> nav-state heading quad)) 0 - (let ((v1-10 (vector-normalize-ret-len! gp-1 1.0))) - (if (and (>= #x47000000 (the-as int v1-10)) (< (cos 5461.3335) (vector-dot gp-1 s5-0))) + (let ((v1-10 (vector-normalize-ret-len! dir-to-target 1.0))) + (if (and (>= #x47000000 (the-as int v1-10)) (< (cos 5461.3335) (vector-dot dir-to-target s5-0))) (go-virtual attack-forward) ) ) @@ -337,11 +360,11 @@ (none) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((circle-for (get-rand-float-range self 0.9 1.1))) (until #f - (gator-method-181 self 2.0 0.5 #t) + (encircle-target! self 2.0 0.5 #t) (suspend) - (ja :num! (loop! f30-0)) + (ja :num! (loop! circle-for)) ) ) #f @@ -354,29 +377,29 @@ :event (the-as (function process int symbol event-message-block object :behavior gator) enemy-event-handler) :enter (behavior () (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) - (let ((v1-2 self)) - (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) - (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + (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)))) ) - (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) - (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + (set! (-> _self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> _self enemy-flags)))) + (set! (-> _self nav callback-info) (-> _self enemy-info-override callback-info)) ) 0 - (let ((v1-5 self)) - (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + (let ((__self self)) + (set! (-> __self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> __self enemy-flags)))) ) 0 - (let ((v1-8 (-> self nav state))) - (set! (-> v1-8 speed) (* 1.25 (-> self enemy-info-override run-travel-speed))) + (let ((nav-state (-> self nav state))) + (set! (-> nav-state speed) (* 1.25 (-> self enemy-info-override run-travel-speed))) ) 0 (set! (-> self lock-nav-target) #f) (logior! (-> self focus-status) (focus-status dangerous)) - (let* ((v1-12 *game-info*) - (v0-0 (+ (-> v1-12 attack-id) 1)) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-12 attack-id) v0-0) - (set! (-> self attack-id) v0-0) + (set! (-> game-info attack-id) id) + (set! (-> self attack-id) id) ) (none) ) @@ -389,11 +412,11 @@ (none) ) :trans (behavior () - (let ((gp-0 (handle->process (-> self focus handle)))) - (if (not gp-0) - (enemy-method-72 self) + (let ((focus (handle->process (-> self focus handle)))) + (if (not focus) + (react-to-focus self) ) - (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) + (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable focus) 0) quad)) ) (cond ((-> self lock-nav-target) @@ -401,36 +424,36 @@ ((or (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) - (set! (-> self lock-nav-target) (the-as basic #t)) - (let ((v1-16 (-> self nav))) - (set! (-> v1-16 target-speed) (-> self enemy-info-override walk-travel-speed)) + (set! (-> self lock-nav-target) #t) + (let ((nav (-> self nav))) + (set! (-> nav target-speed) (-> self enemy-info-override walk-travel-speed)) ) 0 - (let ((v1-18 (-> self nav))) - (set! (-> v1-18 acceleration) 131072.0) + (let ((_nav (-> self nav))) + (set! (-> _nav acceleration) 131072.0) ) 0 - (let ((gp-1 (new 'stack-no-clear 'vector))) - (let ((a1-2 (-> self nav state))) - (set! (-> gp-1 quad) (-> a1-2 velocity quad)) + (let ((velocity (new 'stack-no-clear 'vector))) + (let ((nav-state (-> self nav state))) + (set! (-> velocity quad) (-> nav-state velocity quad)) ) - (vector-normalize! gp-1 32768.0) - (vector+! gp-1 gp-1 (-> self root-override2 trans)) - (let ((v1-24 (-> self nav state))) - (logclear! (-> v1-24 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-24 flags) (nav-state-flag target-poly-dirty)) - (set! (-> v1-24 target-post quad) (-> gp-1 quad)) + (vector-normalize! velocity 32768.0) + (vector+! velocity velocity (-> self root-override2 trans)) + (let ((_nav-state (-> self nav state))) + (logclear! (-> _nav-state flags) (nav-state-flag directional-mode)) + (logior! (-> _nav-state flags) (nav-state-flag target-poly-dirty)) + (set! (-> _nav-state target-post quad) (-> velocity quad)) ) ) 0 ) (else - (let ((a0-19 (-> self nav state)) - (v1-27 (-> self focus-pos)) + (let ((__nav-state (-> self nav state)) + (target-pos (-> self focus-pos)) ) - (logclear! (-> a0-19 flags) (nav-state-flag directional-mode)) - (logior! (-> a0-19 flags) (nav-state-flag target-poly-dirty)) - (set! (-> a0-19 target-post quad) (-> v1-27 quad)) + (logclear! (-> __nav-state flags) (nav-state-flag directional-mode)) + (logior! (-> __nav-state flags) (nav-state-flag target-poly-dirty)) + (set! (-> __nav-state target-post quad) (-> target-pos quad)) ) 0 ) @@ -448,18 +471,18 @@ :frame-num 0.0 ) (until (ja-done? 0) - (let ((a1-4 (new 'stack-no-clear 'vector))) - (let ((a2-2 (-> self nav state))) - (set! (-> a1-4 quad) (-> a2-2 target-post quad)) + (let ((target-pos (new 'stack-no-clear 'vector))) + (let ((nav-state (-> self nav state))) + (set! (-> target-pos quad) (-> nav-state target-post quad)) ) - (if (and (-> self lock-nav-target) (< (vector-vector-distance (-> self root-override2 trans) a1-4) 8192.0)) - (enemy-method-72 self) + (if (and (-> self lock-nav-target) (< (vector-vector-distance (-> self root-override2 trans) target-pos) 8192.0)) + (react-to-focus self) ) ) (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior gator) nav-enemy-travel-post) @@ -468,11 +491,11 @@ (defstate pacing (gator) :virtual #t :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (get-rand-float-range self 0.9 1.1))) (until #f - (gator-method-181 self 2.0 0.5 #f) + (encircle-target! self 2.0 0.5 #f) (suspend) - (ja :num! (loop! f30-0)) + (ja :num! (loop! circle-for?)) ) ) #f @@ -487,9 +510,9 @@ (none) ) :trans (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy stare) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy stare) trans))) + (if func + (func) ) ) (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) @@ -498,11 +521,11 @@ (none) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (get-rand-float-range self 0.9 1.1))) (until #f - (gator-method-181 self 2.0 0.5 #f) + (encircle-target! self 2.0 0.5 #f) (suspend) - (ja :num! (loop! f30-0)) + (ja :num! (loop! circle-for?)) ) ) #f @@ -515,94 +538,94 @@ #f ) -(defmethod enemy-method-114 gator ((obj gator)) - "@abstract" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) +(defmethod init-enemy-collision! gator ((obj gator)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 4) 0))) - (set! (-> s5-0 total-prims) (the-as uint 5)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 4) 0))) + (set! (-> cshape total-prims) (the-as uint 5)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec backgnd jak bot crate obstacle hit-by-others-list player-list) ) - (set! (-> s4-0 prim-core action) (collide-action deadly no-standon)) - (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 19660.8) - (set! (-> s5-0 root-prim) s4-0) + (set! (-> prim-group prim-core action) (collide-action deadly no-standon)) + (set-vector! (-> prim-group local-sphere) 0.0 8192.0 0.0 19660.8) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-13 prim-core collide-with) (collide-spec jak bot crate hit-by-others-list player-list)) - (set! (-> v1-13 prim-core action) (collide-action no-standon)) - (set-vector! (-> v1-13 local-sphere) 0.0 4915.2 0.0 4915.2) + (let ((prim-sphere-1 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-1 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-1 prim-core collide-with) (collide-spec jak bot crate hit-by-others-list player-list)) + (set! (-> prim-sphere-1 prim-core action) (collide-action no-standon)) + (set-vector! (-> prim-sphere-1 local-sphere) 0.0 4915.2 0.0 4915.2) ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-15 prim-core action) (collide-action deadly)) - (set! (-> v1-15 transform-index) 12) - (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.0) + (let ((prim-sphere-2 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-2 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-2 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-2 prim-core action) (collide-action deadly)) + (set! (-> prim-sphere-2 transform-index) 12) + (set-vector! (-> prim-sphere-2 local-sphere) 0.0 0.0 0.0 4096.0) ) - (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-17 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-17 transform-index) 20) - (set-vector! (-> v1-17 local-sphere) 0.0 0.0 0.0 4096.0) + (let ((prim-sphere-3 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-3 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-3 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-3 transform-index) 20) + (set-vector! (-> prim-sphere-3 local-sphere) 0.0 0.0 0.0 4096.0) ) - (let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-19 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-19 transform-index) 22) - (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 4505.6) + (let ((prim-sphere-4 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-4 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-4 transform-index) 22) + (set-vector! (-> prim-sphere-4 local-sphere) 0.0 0.0 0.0 4505.6) ) - (set! (-> s5-0 nav-radius) 8192.0) - (let ((v1-21 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-21 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-21 prim-core collide-with)) + (set! (-> cshape nav-radius) 8192.0) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> s5-0 max-iteration-count) (the-as uint 3)) - (set! (-> obj root-override2) s5-0) + (set! (-> cshape max-iteration-count) (the-as uint 3)) + (set! (-> obj root-override2) cshape) ) 0 (none) ) -(defmethod enemy-method-115 gator ((obj gator)) - "@abstract" +(defmethod init-enemy! gator ((obj gator)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-gator" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *gator-nav-enemy-info*) - (let ((v1-5 (-> obj nav))) - (set! (-> v1-5 speed-scale) 1.0) + (init-enemy-behaviour-and-stats! obj *gator-nav-enemy-info*) + (let ((nav (-> obj nav))) + (set! (-> nav speed-scale) 1.0) ) 0 (set-gravity-length (-> obj root-override2 dynam) 573440.0) (logior! (-> obj nav flags) (nav-control-flag momentum-ignore-heading)) - (gator-method-179 obj) + (adjust-depth! obj) (set! (-> obj turn-time) 0) 0 (none) diff --git a/goal_src/jak2/levels/sewer/sewer-obs.gc b/goal_src/jak2/levels/sewer/sewer-obs.gc index 17e6d54d5e..d274f4f17a 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs.gc @@ -8,43 +8,44 @@ ;; DECOMP BEGINS (deftype sew-blade (process-drawable) - ((y-min float :offset-assert 200) - (y-max float :offset-assert 204) - (snd-water uint128 :offset-assert 208) - (snd-no-water uint128 :offset-assert 224) - (last-sound int32 :offset-assert 240) - (attack-id uint32 :offset-assert 244) + ((y-min float :offset-assert 200) + (y-max float :offset-assert 204) + (snd-water sound-name :offset-assert 208) + (snd-no-water sound-name :offset-assert 224) + (last-sound int32 :offset-assert 240) + (attack-id uint32 :offset-assert 244) ) :heap-base #x80 :method-count-assert 21 :size-assert #xf8 :flag-assert #x15008000f8 (:methods - (sew-blade-method-20 (_type_) none 20) + (update-sound! (_type_) none 20) ) ) -(defmethod sew-blade-method-20 sew-blade ((obj sew-blade)) +(defmethod update-sound! sew-blade ((obj sew-blade)) + "Updates the sound of the [[sew-blade]] based on if it's under or above the water" (when (nonzero? (-> obj sound)) (let ((f30-0 (+ (-> obj root trans y) (-> obj y-max))) (f28-0 (+ (-> obj root trans y) (-> obj y-min))) - (f0-2 (get-base-height *ocean-map-sewer*)) + (ocean-base-height (get-base-height *ocean-map-sewer*)) ) (cond - ((< f30-0 f0-2) + ((< f30-0 ocean-base-height) (stop! (-> obj sound)) ) - ((< f0-2 f28-0) + ((< ocean-base-height f28-0) (when (!= (-> obj last-sound) 1) - (change-sound! (-> obj sound) (the-as sound-name (-> obj snd-no-water))) + (change-sound! (-> obj sound) (-> obj snd-no-water)) (set! (-> obj last-sound) 1) ) (update! (-> obj sound)) ) (else (when (!= (-> obj last-sound) 2) - (change-sound! (-> obj sound) (the-as sound-name (-> obj snd-water))) + (change-sound! (-> obj sound) (-> obj snd-water)) (set! (-> obj last-sound) 2) ) (update! (-> obj sound)) @@ -79,32 +80,34 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) ) - ) ) - (when gp-0 - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root trans))) + (when hit-proc + (let ((hit-direction + (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root-override trans) (-> self root trans)) + ) (v1-5 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) ) - (if (< (vector-dot v1-5 s4-2) 0.0) + (if (< (vector-dot v1-5 hit-direction) 0.0) (vector-float*! v1-5 v1-5 -1.0) ) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((a0-14 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) - (set! (-> a0-14 id) (-> self attack-id)) - (set! (-> a0-14 vector quad) (-> v1-5 quad)) - (set! (-> a0-14 shove-back) 20480.0) - (set! (-> a0-14 shove-up) 12288.0) - (set! (-> a1-6 param 1) (the-as uint a0-14)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info vector quad) (-> v1-5 quad)) + (set! (-> attack-info shove-back) 20480.0) + (set! (-> attack-info shove-up) 12288.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-6) + (send-event-function hit-proc evt) ) ) ) @@ -127,7 +130,7 @@ (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) @@ -142,28 +145,28 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 0.0 16384.0 22528.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 16384.0 22528.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) (process-drawable-from-entity! obj arg0) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -177,15 +180,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 286720.0) (set! (-> obj y-min) -16384.0) (set! (-> obj y-max) 16384.0) - (set! (-> obj snd-water) - (the-as uint128 (make-u128 (the-as uint #x772d6564616c) (the-as uint #x622d656c676e6973))) - ) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 #x6564616c (the-as uint #x622d656c676e6973)))) - (let* ((v1-35 *game-info*) - (a0-19 (+ (-> v1-35 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "single-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "single-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-35 attack-id) a0-19) - (set! (-> obj attack-id) a0-19) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (transform-post) (go (method-of-object obj idle)) @@ -213,24 +214,25 @@ This commonly includes things such as: ) (defun sew-tri-blade-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) + "Handles the rotation and transformation of the [[sew-tri-blade]]" (with-pp - (let ((gp-0 (the-as sew-tri-blade (-> arg0 process))) - (s5-0 (new-stack-matrix0)) + (let ((blade (the-as sew-tri-blade (-> arg0 process))) + (matrix (new-stack-matrix0)) (f30-0 (* 182.04445 (* 0.0033333334 (the float (-> pp clock frame-counter))))) ) (let ((s3-0 (-> arg1 data 4 bone transform))) - (matrix-rotate-y! s5-0 (* 240.0 f30-0)) - (matrix*! s3-0 s5-0 s3-0) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s3-0 matrix s3-0) ) (let ((s3-1 (-> arg1 data 5 bone transform))) - (matrix-rotate-y! s5-0 (* -240.0 f30-0)) - (matrix*! s3-1 s5-0 s3-1) - (set! (-> gp-0 y-max) (+ (- 25395.2 (-> gp-0 root trans y)) (-> s3-1 trans y))) + (matrix-rotate-y! matrix (* -240.0 f30-0)) + (matrix*! s3-1 matrix s3-1) + (set! (-> blade y-max) (+ (- 25395.2 (-> blade root trans y)) (-> s3-1 trans y))) ) (let ((s4-1 (-> arg1 data 6 bone transform))) - (matrix-rotate-y! s5-0 (* 240.0 f30-0)) - (matrix*! s4-1 s5-0 s4-1) - (set! (-> gp-0 y-max) (fmax (-> gp-0 y-max) (+ (- 19251.2 (-> gp-0 root trans y)) (-> s4-1 trans y)))) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s4-1 matrix s4-1) + (set! (-> blade y-max) (fmax (-> blade y-max) (+ (- 19251.2 (-> blade root trans y)) (-> s4-1 trans y)))) ) ) 0 @@ -243,25 +245,25 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s5-0 proc) - (a0-2 (if (type? s5-0 process-focusable) - s5-0 + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + _proc + ) ) - ) ) - (when a0-2 - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) - (set! (-> v1-5 id) (-> self attack-id)) - (set! (-> v1-5 shove-back) 20480.0) - (set! (-> v1-5 shove-up) 8192.0) - (set! (-> a1-6 param 1) (the-as uint v1-5)) + (when hit-proc + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info shove-back) 20480.0) + (set! (-> attack-info shove-up) 8192.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function a0-2 a1-6) + (send-event-function hit-proc evt) ) ) ) @@ -326,14 +328,14 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-tri-blade ((obj sew-tri-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-tri-blade ((obj sew-tri-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -342,50 +344,50 @@ This commonly includes things such as: - sounds" (with-pp (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) - (set! (-> s4-0 total-prims) (the-as uint 4)) + (let ((s3-0 (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) (set! (-> s3-0 prim-core action) (collide-action solid deadly)) (set-vector! (-> s3-0 local-sphere) 0.0 10240.0 0.0 36864.0) - (set! (-> s4-0 root-prim) s3-0) + (set! (-> cshape root-prim) s3-0) ) - (pusher-init s4-0) - (let ((v1-16 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 2) (the-as uint 0)))) + (pusher-init cshape) + (let ((v1-16 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) (set! (-> v1-16 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) (set! (-> v1-16 prim-core action) (collide-action solid deadly)) (set! (-> v1-16 transform-index) 4) (set-vector! (-> v1-16 local-sphere) 0.0 8192.0 0.0 18841.6) ) - (let ((v1-18 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (let ((v1-18 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) (set! (-> v1-18 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) (set! (-> v1-18 prim-core action) (collide-action solid deadly)) (set! (-> v1-18 transform-index) 5) (set-vector! (-> v1-18 local-sphere) 0.0 8192.0 0.0 12288.0) ) - (let ((v1-20 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (let ((v1-20 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) (set! (-> v1-20 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> v1-20 prim-core collide-with) (collide-spec jak player-list)) (set! (-> v1-20 prim-core action) (collide-action solid deadly)) (set! (-> v1-20 transform-index) 6) (set-vector! (-> v1-20 local-sphere) 0.0 4915.2 0.0 7372.8) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-23 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-23 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-23 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((v1-23 (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> v1-23 prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> v1-23 prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -402,15 +404,15 @@ This commonly includes things such as: (set! (-> v1-33 attack-id) a0-33) (set! (-> obj attack-id) a0-33) ) - (if (>= (res-lump-value arg0 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) + (if (>= (res-lump-value entity 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) (set! (-> obj anim-offset) 3.0) ) (set! (-> obj sound) (new 'process 'ambient-sound "none" (-> obj root trans))) (set-falloff-far! (-> obj sound) 286720.0) (set! (-> obj y-min) 0.0) (set! (-> obj y-max) 48332.8) - (set! (-> obj snd-water) (the-as uint128 (make-u128 #x772d65 (the-as uint #x64616c622d697274)))) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 101 (the-as uint #x64616c622d697274)))) + (set! (-> obj snd-water) (static-sound-name "tri-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "tri-blade")) (transform-post) (go (method-of-object obj idle)) (none) @@ -479,14 +481,14 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-arm-blade ((obj sew-arm-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-arm-blade ((obj sew-arm-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -494,30 +496,30 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 -24576.0 0.0 28672.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 -24576.0 0.0 28672.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -528,13 +530,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 286720.0) (set! (-> obj y-min) -43008.0) (set! (-> obj y-max) -4096.0) - (set! (-> obj snd-water) (the-as uint128 (make-u128 #x772d65 (the-as uint #x64616c622d6d7261)))) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 101 (the-as uint #x64616c622d6d7261)))) - (let* ((v1-34 *game-info*) - (a0-18 (+ (-> v1-34 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "arm-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "arm-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-34 attack-id) a0-18) - (set! (-> obj attack-id) a0-18) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (transform-post) (go (method-of-object obj idle)) @@ -563,32 +565,34 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) ) - ) ) - (when gp-0 - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root trans))) + (when hit-proc + (let ((hit-direction + (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root-override trans) (-> self root trans)) + ) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) ) - (if (< (vector-dot v1-5 s4-2) 0.0) + (if (< (vector-dot v1-5 hit-direction) 0.0) (vector-float*! v1-5 v1-5 -1.0) ) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((a0-14 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) - (set! (-> a0-14 id) (-> self attack-id)) - (set! (-> a0-14 vector quad) (-> v1-5 quad)) - (set! (-> a0-14 shove-back) 28672.0) - (set! (-> a0-14 shove-up) 16384.0) - (set! (-> a1-6 param 1) (the-as uint a0-14)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info vector quad) (-> v1-5 quad)) + (set! (-> attack-info shove-back) 28672.0) + (set! (-> attack-info shove-up) 16384.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-6) + (send-event-function hit-proc evt) ) ) ) @@ -611,14 +615,14 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-multi-blade ((obj sew-multi-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-multi-blade ((obj sew-multi-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -626,30 +630,30 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 73728.0 0.0 0.0 90112.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 73728.0 0.0 0.0 90112.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -660,15 +664,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 368640.0) (set! (-> obj y-min) -16384.0) (set! (-> obj y-max) 16384.0) - (set! (-> obj snd-water) - (the-as uint128 (make-u128 (the-as uint #x772d656461) (the-as uint #x6c622d69746c756d))) - ) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 #x656461 (the-as uint #x6c622d69746c756d)))) - (let* ((v1-34 *game-info*) - (a0-18 (+ (-> v1-34 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "multi-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "multi-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-34 attack-id) a0-18) - (set! (-> obj attack-id) a0-18) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (transform-post) (go (method-of-object obj idle)) @@ -701,38 +703,40 @@ This commonly includes things such as: object (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) ) - ) ) - (when gp-0 - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root-overide trans))) + (when hit-proc + (let ((hit-direction + (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root-override trans) (-> self root-overide trans)) + ) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root-overide quat))) ) - (if (< (vector-dot v1-5 s4-2) 0.0) + (if (< (vector-dot v1-5 hit-direction) 0.0) (vector-float*! v1-5 v1-5 -1.0) ) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((a0-14 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) - (set! (-> a0-14 id) (-> self attack-id)) - (set! (-> a0-14 vector quad) (-> v1-5 quad)) - (set! (-> a0-14 shove-back) 16384.0) - (set! (-> a0-14 shove-up) 8192.0) - (set! (-> a1-6 param 1) (the-as uint a0-14)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info vector quad) (-> v1-5 quad)) + (set! (-> attack-info shove-back) 16384.0) + (set! (-> attack-info shove-up) 8192.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-6) + (send-event-function hit-proc evt) ) ) (set! (-> self no-collision-timer) (the-as uint (-> self clock frame-counter))) - (let ((v1-13 (-> self root-overide root-prim))) - (set! (-> v1-13 prim-core collide-as) (collide-spec)) - (set! (-> v1-13 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-overide root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 ) @@ -747,18 +751,18 @@ This commonly includes things such as: (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) - (let ((v1-7 (-> self root-overide root-prim))) - (set! (-> v1-7 prim-core collide-as) (-> self root-overide backup-collide-as)) - (set! (-> v1-7 prim-core collide-with) (-> self root-overide backup-collide-with)) + (let ((root-prim (-> self root-overide root-prim))) + (set! (-> root-prim prim-core collide-as) (-> self root-overide backup-collide-as)) + (set! (-> root-prim prim-core collide-with) (-> self root-overide backup-collide-with)) ) (set! (-> self no-collision-timer) (the-as uint 0)) 0 ) - (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-0 options) (overlaps-others-options oo0)) - (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) - (set! (-> a1-0 tlist) *touching-list*) - (find-overlapping-shapes (-> self root-overide) a1-0) + (let ((overlap-params (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> overlap-params options) (overlaps-others-options oo0)) + (set! (-> overlap-params collide-with-filter) (the-as collide-spec -1)) + (set! (-> overlap-params tlist) *touching-list*) + (find-overlapping-shapes (-> self root-overide) overlap-params) ) (none) ) @@ -777,14 +781,14 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-twist-blade ((obj sew-twist-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-twist-blade ((obj sew-twist-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -792,30 +796,30 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 40960.0 0.0 0.0 49152.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 40960.0 0.0 0.0 49152.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-overide) s4-0) + (set! (-> obj root-overide) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -827,15 +831,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 245760.0) (set! (-> obj y-min) -4096.0) (set! (-> obj y-max) 4096.0) - (set! (-> obj snd-water) - (the-as uint128 (make-u128 (the-as uint #x772d656461) (the-as uint #x6c622d7473697774))) - ) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 #x656461 (the-as uint #x6c622d7473697774)))) - (let* ((v1-34 *game-info*) - (a0-18 (+ (-> v1-34 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "twist-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "twist-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-34 attack-id) a0-18) - (set! (-> obj attack-id) a0-18) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (go (method-of-object obj idle)) (none) @@ -853,8 +855,8 @@ This commonly includes things such as: (:methods (idle () _type_ :state 20) (pressed () _type_ :state 21) - (sew-light-switch-method-22 (_type_) none 22) - (sew-light-switch-method-23 (_type_ symbol) none 23) + (init-switch-collision! (_type_) none 22) + (broadcast-to-actors (_type_ symbol) none 23) ) ) @@ -871,7 +873,7 @@ This commonly includes things such as: :flag-assert #x1100100090 (:methods (idle () _type_ :state 14) - (sew-light-control-method-15 (_type_ symbol symbol) float 15) + (press! (_type_ symbol symbol) float 15) (sew-light-control-method-16 (_type_ object vector float) symbol 16) ) ) @@ -887,19 +889,19 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('trigger) - (sew-light-switch-method-23 self 'cue-chase) + (broadcast-to-actors self 'cue-chase) (go-virtual pressed) ) (('touch 'attack) (let* ((gp-0 (-> event param 0)) - (s5-0 proc) - (v1-6 (if (type? s5-0 target) - s5-0 - ) - ) + (_proc proc) + (target-proc (if (type? _proc target) + _proc + ) + ) ) - (when (and gp-0 v1-6) - (sew-light-switch-method-23 self 'cue-chase) + (when (and gp-0 target-proc) + (broadcast-to-actors self 'cue-chase) (go-virtual pressed) ) ) @@ -961,50 +963,53 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod sew-light-switch-method-22 sew-light-switch ((obj sew-light-switch)) - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) +(defmethod init-switch-collision! sew-light-switch ((obj sew-light-switch)) + "Initializes the collision on the switch" + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-6 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-6 prim-core action) (collide-action solid rideable)) - (set! (-> v1-6 transform-index) 3) - (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 4096.0) - (set! (-> s5-0 total-prims) (the-as uint 1)) - (set! (-> s5-0 root-prim) v1-6) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-9 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s5-0) + (set! (-> obj root) cshape) ) (none) ) ;; WARN: Return type mismatch object vs none. -(defmethod sew-light-switch-method-23 sew-light-switch ((obj sew-light-switch) (arg0 symbol)) +(defmethod broadcast-to-actors sew-light-switch ((obj sew-light-switch) (event-type symbol)) + "Broadcast event to all associated [[entity]]s via the `actor-group`s +@param `event-type` the symbol to broadcast" (with-pp - (dotimes (s4-0 (-> obj actor-group-count)) - (let ((s3-0 (-> obj actor-group s4-0))) - (dotimes (s2-0 (-> s3-0 length)) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer pp)) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) arg0) - (let ((t9-0 send-event-function) - (v1-5 (-> s3-0 data s2-0 actor)) + (dotimes (group-idx (-> obj actor-group-count)) + (let ((group (-> obj actor-group group-idx))) + (dotimes (actor-idx (-> group length)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer pp)) + (set! (-> evt num-params) 0) + (set! (-> evt message) event-type) + (let ((func send-event-function) + (actor (-> group data actor-idx actor)) ) - (t9-0 - (if v1-5 - (-> v1-5 extra process) + (func + (if actor + (-> actor extra process) ) - a1-1 + evt ) ) ) @@ -1012,35 +1017,35 @@ This commonly includes things such as: ) ) (if (-> *game-info* controller 0) - (send-event (-> *game-info* controller 0 process 0) arg0) + (send-event (-> *game-info* controller 0 process 0) event-type) ) (none) ) ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-light-switch ((obj sew-light-switch) (arg0 entity-actor)) +(defmethod init-from-entity! sew-light-switch ((obj sew-light-switch) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) - (sew-light-switch-method-22 obj) - (process-drawable-from-entity! obj arg0) + (local-vars (tag res-tag)) + (init-switch-collision! obj) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-light-switch" (the-as (pointer uint32) #f))) (the-as pair 0) ) (process-entity-status! obj (entity-perm-status no-kill) #t) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (set! tag (new 'static 'res-tag)) + (let ((data (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& tag)))) (cond - ((and v1-6 (nonzero? (-> sv-16 elt-count))) - (set! (-> obj actor-group) (the-as (pointer actor-group) v1-6)) - (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) + ((and data (nonzero? (-> tag elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) data)) + (set! (-> obj actor-group-count) (the-as int (-> tag elt-count))) ) (else (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) @@ -1085,43 +1090,43 @@ This commonly includes things such as: (none) ) :post (behavior () - (let* ((gp-0 *target*) - (a0-1 (if (type? gp-0 process-focusable) - gp-0 - ) - ) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when a0-1 - (get-trans a0-1 0) - (let ((gp-1 #f) - (a2-0 (the-as object #f)) + (when target-proc + (get-trans target-proc 0) + (let ((switch-pressed? #f) + (should-flash? (the-as object #f)) ) - (let* ((a0-2 (-> self switch-ent)) - (v1-2 (if a0-2 - (-> a0-2 extra process) - ) - ) + (let* ((switch (-> self switch-ent)) + (switch-proc (if switch + (-> switch extra process) + ) + ) ) - (if v1-2 - (set! gp-1 (-> (the-as sew-light-switch v1-2) light-state)) + (if switch-proc + (set! switch-pressed? (-> (the-as sew-light-switch switch-proc) light-state)) ) ) - (let* ((v1-4 (-> self turret-ent)) - (a0-5 (if v1-4 - (-> v1-4 extra process) - ) - ) + (let* ((turret (-> self turret-ent)) + (turret-proc (if turret + (-> turret extra process) + ) + ) ) - (when a0-5 + (when turret-proc (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer self)) (set! (-> a1-2 num-params) 0) (set! (-> a1-2 message) 'flash-state) - (set! a2-0 (send-event-function a0-5 a1-2)) + (set! should-flash? (send-event-function turret-proc a1-2)) ) ) ) - (sew-light-control-method-15 self gp-1 (the-as symbol a2-0)) + (press! self switch-pressed? (the-as symbol should-flash?)) ) ) ) @@ -1129,33 +1134,42 @@ This commonly includes things such as: ) ) -(defmethod sew-light-control-method-15 sew-light-control ((obj sew-light-control) (arg0 symbol) (arg1 symbol)) - (set-sewer-lights-flag! arg0) - (if arg1 +(defmethod press! sew-light-control ((obj sew-light-control) (switched-on? symbol) (should-turret-flash? symbol)) + "Turns the lights on (or off) +@param switched-on? Should the sewer lights be turned on or off? +@param should-turret-flash? Should the turret have it's `flash` set as well" + (set-sewer-lights-flag! switched-on?) + (if should-turret-flash? (set-sewer-turret-flash!) ) ) ;; WARN: Return type mismatch object vs none. -(defbehavior sew-light-control-init-by-other sew-light-control ((arg0 entity-actor) (arg1 entity-actor)) - (process-entity-set! self arg0) +(defbehavior sew-light-control-init-by-other sew-light-control ((switch entity-actor) (turret entity-actor)) + "Creates a [[sew-light-control]] given two entities for the turret and switch itself +@param switch The entity for the switch +@param turret The entity for the turret" + (process-entity-set! self switch) (set! (-> *game-info* controller 0) (process->handle self)) - (set! (-> self switch-ent) arg0) - (set! (-> self turret-ent) arg1) - (sew-light-control-method-15 self #f #f) + (set! (-> self switch-ent) switch) + (set! (-> self turret-ent) turret) + (press! self #f #f) (go-virtual idle) (none) ) (defun sewer-startup () + "Basic house-keeping for starting the sewer area: +- sets up the bigmap +- spawns the first switch and turret" (cond ((task-node-closed? (game-task-node sewer-board-introduction)) - (set! (-> sewer bigmap-id) (the-as uint 15)) - (set! (-> sewerb bigmap-id) (the-as uint 15)) + (set! (-> sewer bigmap-id) (bigmap-id sewer-with-board-area)) + (set! (-> sewerb bigmap-id) (bigmap-id sewer-with-board-area)) ) (else - (set! (-> sewer bigmap-id) (the-as uint 14)) - (set! (-> sewerb bigmap-id) (the-as uint 14)) + (set! (-> sewer bigmap-id) (bigmap-id sewer-default)) + (set! (-> sewerb bigmap-id) (bigmap-id sewer-default)) ) ) (process-spawn diff --git a/goal_src/jak2/levels/sewer/sewer-obs2.gc b/goal_src/jak2/levels/sewer/sewer-obs2.gc index b4f86a7955..edb5b1b0c9 100644 --- a/goal_src/jak2/levels/sewer/sewer-obs2.gc +++ b/goal_src/jak2/levels/sewer/sewer-obs2.gc @@ -15,7 +15,7 @@ :size-assert #x174 :flag-assert #x3201000174 (:methods - (sew-elevator-method-49 (_type_ symbol) none 49) + (configure-collision (_type_ symbol) none 49) ) ) @@ -30,18 +30,18 @@ (art-group-get-by-name *level* "skel-sew-elevator" (the-as (pointer uint32) #f)) ) -(defmethod move-between-points sew-elevator ((obj sew-elevator) (arg0 vector) (arg1 float) (arg2 float)) +(defmethod move-between-points sew-elevator ((obj sew-elevator) (arg1 vector) (point-a float) (point-b float)) "Move between two points on the elevator's path @param vec TODO not sure @param point-a The first point fetched from the elevator's path @param point-b The second point fetched from the path @see [[path-control]] and [[elevator]]" - (let ((s4-0 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg1 'interp)) - (a0-3 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg2 'interp)) - (v1-3 (-> obj root-override trans)) + (let ((path-point-a (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) point-a 'interp)) + (path-point-b (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) point-b 'interp)) + (elevator-pos (-> obj root-override trans)) ) - (when (and (< (-> a0-3 y) (-> s4-0 y)) (< (-> arg0 y) (+ -8192.0 (-> v1-3 y)))) - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) arg0 v1-3))) + (when (and (< (-> path-point-b y) (-> path-point-a y)) (< (-> arg1 y) (+ -8192.0 (-> elevator-pos y)))) + (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) arg1 elevator-pos))) (vector-inv-orient-by-quat! s4-2 s4-2 (-> obj root-override quat)) (and (< (fabs (-> s4-2 x)) 24576.0) (< 0.0 (-> s4-2 z)) (< (-> s4-2 z) 49152.0)) ) @@ -51,33 +51,38 @@ (defmethod commited-to-ride? sew-elevator ((obj sew-elevator)) "@returns if the target is considered within the elevator area enough to begin descending/ascending" - (let* ((gp-0 *target*) - (a0-2 (if (type? gp-0 process-focusable) - gp-0 - ) - ) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when a0-2 - (let* ((v1-1 (get-trans a0-2 0)) - (gp-2 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj root-override trans))) + (when target-proc + (let* ((target-pos (get-trans target-proc 0)) + (dist-from-center (vector-! (new 'stack-no-clear 'vector) target-pos (-> obj root-override trans))) + ) + (vector-inv-orient-by-quat! dist-from-center dist-from-center (-> obj root-override quat)) + (and (< (fabs (-> dist-from-center x)) 20480.0) + (< 0.0 (-> dist-from-center z)) + (< (-> dist-from-center z) 40960.0) ) - (vector-inv-orient-by-quat! gp-2 gp-2 (-> obj root-override quat)) - (and (< (fabs (-> gp-2 x)) 20480.0) (< 0.0 (-> gp-2 z)) (< (-> gp-2 z) 40960.0)) ) ) ) ) -(defmethod sew-elevator-method-49 sew-elevator ((obj sew-elevator) (arg0 symbol)) - (let ((v1-3 (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) child 1))) +(defmethod configure-collision sew-elevator ((obj sew-elevator) (collide-with-jak? symbol)) + "Appropriately sets the collision on the elevator +@param collide-with-jak? If set, the elevator will collide with Jak" + (let ((prim-group (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) child 1))) (cond - (arg0 - (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> v1-3 prim-core collide-with) (collide-spec jak player-list)) + (collide-with-jak? + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) ) (else - (set! (-> v1-3 prim-core collide-as) (collide-spec)) - (set! (-> v1-3 prim-core collide-with) (collide-spec)) + (set! (-> prim-group prim-core collide-as) (collide-spec)) + (set! (-> prim-group prim-core collide-with) (collide-spec)) 0 ) ) @@ -88,23 +93,23 @@ (defstate running (sew-elevator) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type elevator running) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type elevator running) enter))) + (if func + (func) ) ) (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) - (logtest? (elevator-flags elevator-flags-16) (-> self params flags)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) ) - (sew-elevator-method-49 self #t) + (configure-collision self #t) (set-setting! 'jump #f 0 0) ) (none) ) :post (behavior () - (let ((t9-0 (-> (method-of-type elevator running) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type elevator running) post))) + (if func + ((the-as (function none) func)) ) ) (sound-play "sew-elevator-lp" :id (-> self sound-id) :position (-> self root-override trans)) @@ -115,17 +120,17 @@ (defstate arrived (sew-elevator) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type elevator arrived) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type elevator arrived) enter))) + (if func + (func) ) ) (sound-stop (-> self sound-id)) (sound-play "sew-elev-stop") (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) - (logtest? (elevator-flags elevator-flags-16) (-> self params flags)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) ) - (sew-elevator-method-49 self #f) + (configure-collision self #f) (remove-setting! 'jump) ) (none) @@ -153,8 +158,8 @@ For example for an elevator pre-compute the distance between the first and last - `elevator-start-pos` - `elevator-move-rate` - `elevator-flags`" - (let ((t9-0 (method-of-type elevator init-defaults!))) - (t9-0 obj) + (let ((func (method-of-type elevator init-defaults!))) + (func obj) ) (if (name= (-> obj name) "sew-elevator-15") (set! (-> obj params xz-threshold) 348160.0) @@ -174,42 +179,42 @@ For example for an elevator pre-compute the distance between the first and last (defmethod init-plat-collision! sew-elevator ((obj sew-elevator)) "TODO - collision stuff for setting up the platform" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) - (set! (-> s5-0 total-prims) (the-as uint 3)) - (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid rideable)) - (set! (-> s4-0 transform-index) 3) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 22937.6 37683.2) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 2) 0))) + (set! (-> cshape total-prims) (the-as uint 3)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-group prim-core action) (collide-action solid rideable)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 22937.6 37683.2) + (set! (-> cshape root-prim) prim-group) ) - (pusher-init s5-0) - (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) - (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-15 prim-core action) (collide-action solid rideable)) - (set! (-> v1-15 transform-index) 3) - (set-vector! (-> v1-15 local-sphere) 0.0 0.0 22937.6 37683.2) + (pusher-init cshape) + (let ((prim-mesh-1 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh-1 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> prim-mesh-1 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh-1 prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh-1 transform-index) 3) + (set-vector! (-> prim-mesh-1 local-sphere) 0.0 0.0 22937.6 37683.2) ) - (let ((v1-17 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-17 prim-core action) (collide-action solid)) - (set! (-> v1-17 transform-index) 3) - (set-vector! (-> v1-17 local-sphere) 0.0 0.0 22937.6 39321.6) + (let ((prim-mesh-2 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> prim-mesh-2 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-2 transform-index) 3) + (set-vector! (-> prim-mesh-2 local-sphere) 0.0 0.0 22937.6 39321.6) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-20 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-20 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-20 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s5-0) + (set! (-> obj root-override) cshape) ) - (sew-elevator-method-49 obj #f) + (configure-collision obj #f) (none) ) @@ -262,20 +267,20 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self spin-rate) 196608.0) (logclear! (-> self mask) (process-mask actor-pause)) (sound-play "sew-valve") - (dotimes (v1-5 (-> self actor-group-count)) - (dotimes (a0-4 (-> self actor-group v1-5 length)) - (let ((a1-5 (-> self actor-group v1-5 data a0-4 actor))) - (if a1-5 - (logior! (-> a1-5 extra perm status) (entity-perm-status bit-10)) + (dotimes (group-idx (-> self actor-group-count)) + (dotimes (actor-idx (-> self actor-group group-idx length)) + (let ((actor (-> self actor-group group-idx data actor-idx actor))) + (if actor + (logior! (-> actor extra perm status) (entity-perm-status bit-10)) ) ) ) ) - (let ((gp-1 (res-lump-struct (-> self entity) 'on-activate structure))) - (if gp-1 + (let ((data (res-lump-struct (-> self entity) 'on-activate structure))) + (if data (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) - (the-as pair gp-1) + (the-as pair data) ) ) ) @@ -333,37 +338,37 @@ For example for an elevator pre-compute the distance between the first and last ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-valve ((obj sew-valve) (arg0 entity-actor)) +(defmethod init-from-entity! sew-valve ((obj sew-valve) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (local-vars (tag-1 res-tag) (tag-2 res-tag)) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-6 prim-core action) (collide-action solid)) - (set! (-> v1-6 transform-index) 3) - (set-vector! (-> v1-6 local-sphere) 0.0 0.0 1638.4 3276.8) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-6) + (let ((prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-sphere prim-core action) (collide-action solid)) + (set! (-> prim-sphere transform-index) 3) + (set-vector! (-> prim-sphere local-sphere) 0.0 0.0 1638.4 3276.8) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-sphere) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-9 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-9 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-valve" (the-as (pointer uint32) #f))) @@ -372,15 +377,15 @@ This commonly includes things such as: (set! (-> obj spin) 0.0) (set! (-> obj spin-rate) 0.0) (set! (-> obj joint) (new 'process 'joint-mod-rotate-local obj 4 #f)) - (set! sv-16 (new 'static 'res-tag)) + (set! tag-1 (new 'static 'res-tag)) (set! (-> obj actor-group) - (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)) + (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& tag-1)) ) - (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data (-> obj entity) 'extra-float-param pointer :tag-ptr (& sv-32)))) - (if (and v1-22 (nonzero? (-> sv-32 elt-count))) - (set! (-> obj water-height) (-> (the-as (pointer float) v1-22))) + (set! (-> obj actor-group-count) (the-as int (-> tag-1 elt-count))) + (set! tag-2 (new 'static 'res-tag)) + (let ((data (res-lump-data (-> obj entity) 'extra-float-param pointer :tag-ptr (& tag-2)))) + (if (and data (nonzero? (-> tag-2 elt-count))) + (set! (-> obj water-height) (-> (the-as (pointer float) data))) (set! (-> obj water-height) 0.0) ) ) @@ -453,48 +458,49 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior sew-mar-statue-debris-init-by-other sew-mar-statue-debris () - (let ((gp-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) - (let ((s5-0 (new 'process 'collide-shape-prim-group gp-0 (the-as uint 3) 0))) - (set! (-> gp-0 total-prims) (the-as uint 4)) - (set! (-> s5-0 prim-core collide-as) (collide-spec obstacle)) - (set! (-> s5-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s5-0 prim-core action) (collide-action solid)) - (set! (-> s5-0 transform-index) 3) - (set-vector! (-> s5-0 local-sphere) 10240.0 0.0 62464.0 151552.0) - (set! (-> gp-0 root-prim) s5-0) + "Initializes a [[sew-mar-statue--debris]]" + (let ((cshape (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 10240.0 0.0 62464.0 151552.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-9 (new 'process 'collide-shape-prim-mesh gp-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-9 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-9 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-9 prim-core action) (collide-action solid)) - (set! (-> v1-9 transform-index) 3) - (set-vector! (-> v1-9 local-sphere) 0.0 0.0 20480.0 81920.0) + (let ((prim-mesh-1 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh-1 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-1 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-1 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-1 transform-index) 3) + (set-vector! (-> prim-mesh-1 local-sphere) 0.0 0.0 20480.0 81920.0) ) - (let ((v1-11 (new 'process 'collide-shape-prim-mesh gp-0 (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-11 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-11 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-11 prim-core action) (collide-action solid)) - (set! (-> v1-11 transform-index) 3) - (set-vector! (-> v1-11 local-sphere) -49152.0 0.0 114688.0 61440.0) + (let ((prim-mesh-2 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> prim-mesh-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-2 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-2 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-2 transform-index) 3) + (set-vector! (-> prim-mesh-2 local-sphere) -49152.0 0.0 114688.0 61440.0) ) - (let ((v1-13 (new 'process 'collide-shape-prim-mesh gp-0 (the-as uint 2) (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-13 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-13 prim-core action) (collide-action solid)) - (set! (-> v1-13 transform-index) 3) - (set-vector! (-> v1-13 local-sphere) 69632.0 0.0 102400.0 73728.0) + (let ((prim-mesh-3 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) + (set! (-> prim-mesh-3 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-3 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-3 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-3 transform-index) 3) + (set-vector! (-> prim-mesh-3 local-sphere) 69632.0 0.0 102400.0 73728.0) ) - (set! (-> gp-0 nav-radius) (* 0.75 (-> gp-0 root-prim local-sphere w))) - (let ((v1-16 (-> gp-0 root-prim))) - (set! (-> gp-0 backup-collide-as) (-> v1-16 prim-core collide-as)) - (set! (-> gp-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> self root) gp-0) + (set! (-> self root) cshape) ) - (let ((gp-1 (ppointer->process (-> self parent)))) - (set! (-> self root trans quad) (-> (the-as process-drawable gp-1) root trans quad)) - (quaternion-copy! (-> self root quat) (-> (the-as process-drawable gp-1) root quat)) - (set! (-> self root scale quad) (-> (the-as process-drawable gp-1) root scale quad)) + (let ((parent-proc (ppointer->process (-> self parent)))) + (set! (-> self root trans quad) (-> (the-as process-drawable parent-proc) root trans quad)) + (quaternion-copy! (-> self root quat) (-> (the-as process-drawable parent-proc) root quat)) + (set! (-> self root scale quad) (-> (the-as process-drawable parent-proc) root scale quad)) ) (initialize-skeleton self @@ -517,11 +523,12 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. (defbehavior sew-mar-statue-debris-b-init-by-other sew-mar-statue-debris-b () + "Initializes a [[sew-mar-statue--debris-b]]" (set! (-> self root) (new 'process 'trsqv)) - (let ((gp-0 (ppointer->process (-> self parent)))) - (set! (-> self root trans quad) (-> (the-as process-drawable gp-0) root trans quad)) - (quaternion-copy! (-> self root quat) (-> (the-as process-drawable gp-0) root quat)) - (set! (-> self root scale quad) (-> (the-as process-drawable gp-0) root scale quad)) + (let ((parent-proc (ppointer->process (-> self parent)))) + (set! (-> self root trans quad) (-> (the-as process-drawable parent-proc) root trans quad)) + (quaternion-copy! (-> self root quat) (-> (the-as process-drawable parent-proc) root quat)) + (set! (-> self root scale quad) (-> (the-as process-drawable parent-proc) root scale quad)) ) (initialize-skeleton self @@ -538,6 +545,7 @@ This commonly includes things such as: ) (defbehavior sew-mar-statue-event-handler sew-mar-statue ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Event handler for the [[sew-mar-statue]], normally hidden, but once `trigger`ed it will spawn the debris" (case arg2 (('hide) (if (not (and (-> self next-state) (= (-> self next-state name) 'hidden))) @@ -575,9 +583,9 @@ This commonly includes things such as: :virtual #t :event sew-mar-statue-event-handler :enter (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (logior! (-> self draw status) (draw-control-status no-draw)) @@ -587,7 +595,7 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-mar-statue ((obj sew-mar-statue) (arg0 entity-actor)) +(defmethod init-from-entity! sew-mar-statue ((obj sew-mar-statue) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -595,24 +603,24 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj spawned-debris?) #f) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 0) - (set-vector! (-> v1-2 local-sphere) 0.0 30720.0 0.0 58982.4) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 30720.0 0.0 58982.4) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-mar-statue" (the-as (pointer uint32) #f))) @@ -668,21 +676,21 @@ and translate the platform via the `smush` (set! (-> self draw bounds w) 163840.0) (set! (-> self root-override root-prim local-sphere w) 163840.0) (set! (-> self draw force-lod) 0) - (let* ((s5-0 (-> self draw art-group)) - (s4-0 (method-of-object s5-0 get-art-by-name-method)) + (let* ((art-group (-> self draw art-group)) + (art (method-of-object art-group get-art-by-name-method)) ) (format (clear *temp-string*) "~S-end" (-> self art-name)) - (let ((s5-1 (the-as object (s4-0 s5-0 *temp-string* art-joint-anim)))) + (let ((anim (the-as object (art art-group *temp-string* art-joint-anim)))) (if (not arg0) (ja-play-spooled-anim (-> self anim) (ja-group) - (the-as art-joint-anim s5-1) + (the-as art-joint-anim anim) (the-as (function process-drawable symbol) false-func) ) ) (ja-channel-set! 1) - (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim anim)) ) ) (suspend) @@ -694,7 +702,7 @@ and translate the platform via the `smush` ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-catwalk ((obj sew-catwalk) (arg0 entity-actor)) +(defmethod init-from-entity! sew-catwalk ((obj sew-catwalk) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -703,21 +711,21 @@ This commonly includes things such as: - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape-moving)) (stack-size-set! (-> obj main-thread) 512) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 14) 0))) - (set! (-> s4-0 total-prims) (the-as uint 15)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) -28672.0 20480.0 -102400.0 73728.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 14) 0))) + (set! (-> cshape total-prims) (the-as uint 15)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) -28672.0 20480.0 -102400.0 73728.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 4 28672) (1 5 28672) @@ -738,20 +746,20 @@ This commonly includes things such as: (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((_prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (_prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> prim-group prim-core action)) (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) @@ -760,14 +768,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-28 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-28 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-28 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-catwalk-1" (the-as (pointer uint32) #f))) @@ -796,7 +804,7 @@ This commonly includes things such as: (:methods (idle () _type_ :state 20) (die () _type_ :state 21) - (sew-mine-method-22 (_type_) none 22) + (init-mine! (_type_) none 22) ) ) @@ -806,42 +814,43 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) + (let* ((_proc proc) + (focus-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) + ) ) - (when gp-0 - (let ((a0-4 (vector-normalize! - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root-override trans)) - 1.0 - ) - ) - (a1-7 (new 'stack-no-clear 'event-message-block)) - ) - (set! (-> a1-7 from) (process->ppointer self)) - (set! (-> a1-7 num-params) 2) - (set! (-> a1-7 message) 'attack-or-shove) - (set! (-> a1-7 param 0) (-> event param 0)) - (let ((v1-9 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up control id)))) - (let* ((a2-3 *game-info*) - (a3-2 (+ (-> a2-3 attack-id) 1)) - ) - (set! (-> a2-3 attack-id) a3-2) - (set! (-> v1-9 id) a3-2) - ) - (set! (-> v1-9 vector quad) (-> a0-4 quad)) - (set! (-> v1-9 shove-back) 20480.0) - (set! (-> v1-9 shove-up) 12288.0) - (set! (-> v1-9 control) (if (logtest? (focus-status board) (-> gp-0 focus-status)) - 1.0 - 0.0 - ) + (when focus-proc + (let ((a0-4 + (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> focus-proc root-override trans) (-> self root-override trans)) + 1.0 ) - (set! (-> a1-7 param 1) (the-as uint v1-9)) + ) + (evt (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up control id)))) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) + ) + (set! (-> game-info attack-id) id) + (set! (-> attack-info id) id) + ) + (set! (-> attack-info vector quad) (-> a0-4 quad)) + (set! (-> attack-info shove-back) 20480.0) + (set! (-> attack-info shove-up) 12288.0) + (set! (-> attack-info control) (if (logtest? (focus-status board) (-> focus-proc focus-status)) + 1.0 + 0.0 + ) + ) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-7) + (send-event-function focus-proc evt) ) ) ) @@ -873,13 +882,13 @@ This commonly includes things such as: (logior! (-> self draw status) (draw-control-status no-draw)) (sound-play "sew-mine-b") (process-spawn touch-tracker :init touch-tracker-init (-> self root-override trans) #x47200000 30 :to self) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-2 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 (the-as part-tracker gp-2) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + (let ((part (get-process *default-dead-pool* part-tracker #x4000))) + (when part + (let ((func (method-of-type part-tracker activate))) + (func (the-as part-tracker part) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) ) (let ((t9-7 run-function-in-process) - (a0-8 gp-2) + (a0-8 part) (a1-6 part-tracker-init) (a2-10 (-> *part-group-id-table* 124)) (a3-4 0) @@ -900,12 +909,12 @@ This commonly includes things such as: t3-0 ) ) - (-> gp-2 ppointer) + (-> part ppointer) ) ) (cleanup-for-death self) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 2)) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) (suspend) ) ) @@ -913,7 +922,8 @@ This commonly includes things such as: ) ) -(defmethod sew-mine-method-22 sew-mine ((obj sew-mine)) +(defmethod init-mine! sew-mine ((obj sew-mine)) + "Initializes the mine's particles and sets `last-time` to `0`" (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 345) obj)) (set! (-> obj last-time) 0) 0 @@ -932,38 +942,38 @@ This commonly includes things such as: (defskelgroup skel-sew-mine-a sew-mine-a 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3)) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-mine-a ((obj sew-mine-a) (arg0 entity-actor)) +(defmethod init-from-entity! sew-mine-a ((obj sew-mine-a) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 2048.0 0.0 8192.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 2048.0 0.0 8192.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-11 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-11 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + (set! (-> obj root-override) (the-as collide-shape-moving cshape)) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-mine-a" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (sew-mine-method-22 obj) + (init-mine! obj) (go (method-of-object obj idle)) (none) ) @@ -986,21 +996,21 @@ This commonly includes things such as: (defstate idle (sew-mine-b) :virtual #t :post (behavior () - (let ((t9-0 (-> (method-of-type sew-mine idle) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type sew-mine idle) post))) + (if func + ((the-as (function none) func)) ) ) - (let* ((f30-0 (get-base-height *ocean-map-sewer*)) - (f0-0 (-> self period)) + (let* ((ocean-base-height (get-base-height *ocean-map-sewer*)) + (period (-> self period)) (t9-2 sin-rad) (f1-0 -3.1415925) (f2-0 6.283185) (f3-1 (the float (+ (-> self clock frame-counter) (the-as time-frame (-> self time-skew))))) - (f28-0 (t9-2 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 f0-0))) f0-0)) f0-0))))) + (f28-0 (t9-2 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 period))) period)) period))))) ) - (when (< f30-0 (-> self center y)) - (set! (-> self center y) f30-0) + (when (< ocean-base-height (-> self center y)) + (set! (-> self center y) ocean-base-height) (if (>= (-> self base-height) (-> self center y)) (go-virtual die) ) @@ -1014,41 +1024,41 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-mine-b ((obj sew-mine-b) (arg0 entity-actor)) +(defmethod init-from-entity! sew-mine-b ((obj sew-mine-b) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 2048.0 0.0 8192.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 2048.0 0.0 8192.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-11 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-11 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + (set! (-> obj root-override) (the-as collide-shape-moving cshape)) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-mine-b" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (sew-mine-method-22 obj) - (let ((a0-11 (-> obj entity))) - (set! (-> obj base-height) ((method-of-object a0-11 get-property-value-float) - a0-11 + (init-mine! obj) + (let ((_entity (-> obj entity))) + (set! (-> obj base-height) ((method-of-object _entity get-property-value-float) + _entity 'base-height 'interp -1000000000.0 @@ -1071,9 +1081,9 @@ This commonly includes things such as: ((deadly-radius float :offset-assert 204) (prev-deadly-radius float :offset-assert 208) (attack-id uint32 :offset-assert 212) - (first-wall? basic :offset-assert 216) + (first-wall? symbol :offset-assert 216) (anim spool-anim :offset-assert 220) - (art-name basic :offset-assert 224) + (art-name string :offset-assert 224) ) :heap-base #x70 :method-count-assert 30 @@ -1082,7 +1092,7 @@ This commonly includes things such as: (:methods (idle () _type_ :state 27) (hit (symbol) _type_ :state 28) - (sew-wall-method-29 (_type_) none 29) + (attack-target! (_type_) none 29) ) ) @@ -1094,21 +1104,22 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch float vs none. -(defmethod sew-wall-method-29 sew-wall ((obj sew-wall)) +(defmethod attack-target! sew-wall ((obj sew-wall)) + "If the target is close enough to the wall, hit it!" (with-pp - (let ((s4-0 *target*)) - (when s4-0 - (let ((f0-0 (vector-vector-xz-distance (get-trans s4-0 0) (-> obj root-override trans))) - (f2-0 (-> obj deadly-radius)) - (f1-0 (-> obj prev-deadly-radius)) + (let ((target *target*)) + (when target + (let ((dist-from-wall (vector-vector-xz-distance (get-trans target 0) (-> obj root-override trans))) + (deadly-radius (-> obj deadly-radius)) + (prev-deadly-radius (-> obj prev-deadly-radius)) ) - (set! (-> obj prev-deadly-radius) f2-0) - (when (and (>= f2-0 f0-0) (>= f0-0 (+ -4096.0 f1-0))) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (set! (-> s5-1 start-pos quad) (-> obj root-override trans quad)) - (set! (-> s5-1 start-pos y) (+ 12288.0 (-> s5-1 start-pos y))) - (vector-! (-> s5-1 move-dist) (get-trans s4-0 3) (-> s5-1 start-pos)) - (let ((v1-9 s5-1)) + (set! (-> obj prev-deadly-radius) deadly-radius) + (when (and (>= deadly-radius dist-from-wall) (>= dist-from-wall (+ -4096.0 prev-deadly-radius))) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> obj root-override trans quad)) + (set! (-> cquery start-pos y) (+ 12288.0 (-> cquery start-pos y))) + (vector-! (-> cquery move-dist) (get-trans target 3) (-> cquery start-pos)) + (let ((v1-9 cquery)) (set! (-> v1-9 radius) 819.2) (set! (-> v1-9 collide-with) (collide-spec backgnd)) (set! (-> v1-9 ignore-process0) obj) @@ -1116,19 +1127,19 @@ This commonly includes things such as: (set! (-> v1-9 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) (set! (-> v1-9 action-mask) (collide-action solid)) ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s5-1) 0.0) - (let ((a1-4 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-4 from) (process->ppointer pp)) - (set! (-> a1-4 num-params) 2) - (set! (-> a1-4 message) 'attack) - (set! (-> a1-4 param 0) (the-as uint #f)) - (let ((v1-15 (new 'static 'attack-info :mask (attack-info-mask mode id attacker-velocity)))) - (set! (-> v1-15 id) (-> obj attack-id)) - (set! (-> v1-15 mode) 'explode) - (set! (-> v1-15 attacker-velocity quad) (-> s5-1 move-dist quad)) - (set! (-> a1-4 param 1) (the-as uint v1-15)) + (when (< (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer pp)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack) + (set! (-> evt param 0) (the-as uint #f)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask mode id attacker-velocity)))) + (set! (-> attack-info id) (-> obj attack-id)) + (set! (-> attack-info mode) 'explode) + (set! (-> attack-info attacker-velocity quad) (-> cquery move-dist quad)) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function *target* a1-4) + (send-event-function *target* evt) ) (set! (-> obj deadly-radius) -1.0) ) @@ -1185,7 +1196,7 @@ This commonly includes things such as: (let ((f0-0 (-> self deadly-radius))) (when (>= f0-0 0.0) (set! (-> self deadly-radius) (seek f0-0 409600.0 (* 368640.0 (-> self clock seconds-per-frame)))) - (sew-wall-method-29 self) + (attack-target! self) ) ) (none) @@ -1194,51 +1205,51 @@ This commonly includes things such as: (if (not (-> self first-wall?)) (set! arg0 #t) ) - (let ((v1-4 (-> self root-override root-prim))) - (set! (-> (the-as collide-shape-prim-group v1-4) child 0 prim-core collide-with) (collide-spec)) - (set! (-> (the-as collide-shape-prim-group v1-4) child 0 prim-core collide-as) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> (the-as collide-shape-prim-group root-prim) child 0 prim-core collide-with) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group root-prim) child 0 prim-core collide-as) (collide-spec)) (if (-> self first-wall?) - (set-vector! (-> v1-4 local-sphere) 43827.2 -16384.0 158924.8 204800.0) - (set-vector! (-> v1-4 local-sphere) 43827.2 -16384.0 110592.0 225280.0) + (set-vector! (-> root-prim local-sphere) 43827.2 -16384.0 158924.8 204800.0) + (set-vector! (-> root-prim local-sphere) 43827.2 -16384.0 110592.0 225280.0) ) - (set! (-> self draw bounds quad) (-> v1-4 local-sphere quad)) + (set! (-> self draw bounds quad) (-> root-prim local-sphere quad)) ) (update-transforms (-> self root-override)) - (let* ((s5-0 (-> self draw art-group)) - (s4-0 (method-of-object s5-0 get-art-by-name-method)) + (let* ((art-group (-> self draw art-group)) + (s4-0 (method-of-object art-group get-art-by-name-method)) ) (format (clear *temp-string*) "~S-end" (-> self art-name)) - (let ((s5-1 (the-as object (s4-0 s5-0 *temp-string* art-joint-anim)))) + (let ((anim (the-as object (s4-0 art-group *temp-string* art-joint-anim)))) (when (not arg0) (set! (-> self deadly-radius) 0.0) (ja-play-spooled-anim (-> self anim) (ja-group) - (the-as art-joint-anim s5-1) + (the-as art-joint-anim anim) (the-as (function process-drawable symbol) false-func) ) ) (ja-channel-set! 1) - (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim anim)) ) ) (set! (-> self deadly-radius) -1.0) - (let* ((a0-14 (-> self root-override root-prim)) - (a1-11 (-> a0-14 prim-core collide-with)) - (v1-22 (-> a0-14 prim-core collide-as)) + (let* ((_root-prim (-> self root-override root-prim)) + (collide-with (-> _root-prim prim-core collide-with)) + (collide-as (-> _root-prim prim-core collide-as)) ) (cond ((-> self first-wall?) - (set! (-> (the-as collide-shape-prim-group a0-14) child 1 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 1 prim-core collide-as) v1-22) - (set! (-> (the-as collide-shape-prim-group a0-14) child 2 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 2 prim-core collide-as) v1-22) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 1 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 1 prim-core collide-as) collide-as) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 2 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 2 prim-core collide-as) collide-as) ) (else - (set! (-> (the-as collide-shape-prim-group a0-14) child 3 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 3 prim-core collide-as) v1-22) - (set! (-> (the-as collide-shape-prim-group a0-14) child 4 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 4 prim-core collide-as) v1-22) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 3 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 3 prim-core collide-as) collide-as) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 4 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 4 prim-core collide-as) collide-as) ) ) ) @@ -1253,7 +1264,7 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-wall ((obj sew-wall) (arg0 entity-actor)) +(defmethod init-from-entity! sew-wall ((obj sew-wall) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -1263,7 +1274,7 @@ This commonly includes things such as: (with-pp (stack-size-set! (-> obj main-thread) 512) (set! (-> obj mask) (logior (process-mask collectable) (-> obj mask))) - (let ((s3-0 ((method-of-type res-lump get-property-struct) + (let ((data ((method-of-type res-lump get-property-struct) (-> obj entity) 'art-name 'interp @@ -1273,68 +1284,68 @@ This commonly includes things such as: *res-static-buf* ) ) - (s5-0 (art-group-get-by-name *level* "skel-sew-wall" (the-as (pointer uint32) #f))) + (art-group (art-group-get-by-name *level* "skel-sew-wall" (the-as (pointer uint32) #f))) ) - (set! (-> obj art-name) (the-as basic s3-0)) - (let ((s2-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s2-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s2-0 reaction) cshape-reaction-default) - (set! (-> s2-0 no-reaction) + (set! (-> obj art-name) (the-as string data)) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s1-0 (new 'process 'collide-shape-prim-group s2-0 (the-as uint 5) 0))) - (set! (-> s2-0 total-prims) (the-as uint 6)) - (set! (-> s1-0 prim-core collide-as) (collide-spec obstacle)) - (set! (-> s1-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s1-0 prim-core action) (collide-action solid)) - (set! (-> s1-0 transform-index) 4) - (set-vector! (-> s1-0 local-sphere) 0.0 0.0 0.0 40960.0) - (set! (-> s2-0 root-prim) s1-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 5) 0))) + (set! (-> cshape total-prims) (the-as uint 6)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 4) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 0.0 40960.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-19 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-19 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-19 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-19 prim-core action) (collide-action solid)) - (set! (-> v1-19 transform-index) 4) - (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 40960.0) + (let ((prim-mesh-1 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh-1 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-1 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-1 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-1 transform-index) 4) + (set-vector! (-> prim-mesh-1 local-sphere) 0.0 0.0 0.0 40960.0) ) - (let ((v1-21 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-21 prim-core action) (collide-action solid)) - (set! (-> v1-21 transform-index) 4) - (set-vector! (-> v1-21 local-sphere) 77824.0 -16384.0 282624.0 36864.0) + (let ((prim-mesh-2 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> prim-mesh-2 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-2 transform-index) 4) + (set-vector! (-> prim-mesh-2 local-sphere) 77824.0 -16384.0 282624.0 36864.0) ) - (let ((v1-23 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 2) (the-as uint 0)))) - (set! (-> v1-23 prim-core action) (collide-action solid)) - (set! (-> v1-23 transform-index) 4) - (set-vector! (-> v1-23 local-sphere) 61440.0 -16384.0 112640.0 151552.0) + (let ((prim-mesh-3 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) + (set! (-> prim-mesh-3 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-3 transform-index) 4) + (set-vector! (-> prim-mesh-3 local-sphere) 61440.0 -16384.0 112640.0 151552.0) ) - (let ((v1-25 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 3) (the-as uint 0)))) - (set! (-> v1-25 prim-core action) (collide-action solid)) - (set! (-> v1-25 transform-index) 4) - (set-vector! (-> v1-25 local-sphere) 0.0 -16384.0 40960.0 122880.0) + (let ((prim-mesh-4 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 3) (the-as uint 0)))) + (set! (-> prim-mesh-4 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-4 transform-index) 4) + (set-vector! (-> prim-mesh-4 local-sphere) 0.0 -16384.0 40960.0 122880.0) ) - (let ((v1-27 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 4) (the-as uint 0)))) - (set! (-> v1-27 prim-core action) (collide-action solid)) - (set! (-> v1-27 transform-index) 4) - (set-vector! (-> v1-27 local-sphere) 81920.0 0.0 204800.0 143360.0) + (let ((prim-mesh-5 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 4) (the-as uint 0)))) + (set! (-> prim-mesh-5 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-5 transform-index) 4) + (set-vector! (-> prim-mesh-5 local-sphere) 81920.0 0.0 204800.0 143360.0) ) - (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) - (let ((v1-30 (-> s2-0 root-prim))) - (set! (-> s2-0 backup-collide-as) (-> v1-30 prim-core collide-as)) - (set! (-> s2-0 backup-collide-with) (-> v1-30 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s2-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (cond - ((string= (the-as string (-> obj art-name)) "sew-wall-1") + ((string= (-> obj art-name) "sew-wall-1") (set! (-> obj anim) (new 'static 'spool-anim :name "sew-wall-1" :anim-name "1-break" :parts 1 :command-list '()) ) - (set! (-> obj first-wall?) (the-as basic #t)) + (set! (-> obj first-wall?) #t) ) - ((string= (the-as string (-> obj art-name)) "sew-wall-2") + ((string= (-> obj art-name) "sew-wall-2") (set! (-> obj anim) (new 'static 'spool-anim :name "sew-wall-2" :anim-name "2-break" :parts 1 :command-list '()) ) @@ -1342,25 +1353,25 @@ This commonly includes things such as: (set! (-> obj first-wall?) #f) ) (else - (go process-drawable-art-error (the-as string s3-0)) + (go process-drawable-art-error (the-as string data)) ) ) - (initialize-skeleton obj (the-as skeleton-group s5-0) (the-as pair 0)) + (initialize-skeleton obj (the-as skeleton-group art-group) (the-as pair 0)) ) (set! (-> obj draw force-lod) 0) (ja-channel-set! 1) - (let* ((s5-1 (-> obj skel root-channel 0)) - (s4-1 (-> obj draw art-group)) - (s3-1 (method-of-object s4-1 get-art-by-name-method)) + (let* ((channel (-> obj skel root-channel 0)) + (_art-group (-> obj draw art-group)) + (s3-1 (method-of-object _art-group get-art-by-name-method)) ) (format (clear *temp-string*) "~S-idle" (-> obj art-name)) - (set! (-> s5-1 frame-group) (the-as art-joint-anim (s3-1 s4-1 *temp-string* (the-as type #f)))) + (set! (-> channel frame-group) (the-as art-joint-anim (s3-1 _art-group *temp-string* (the-as type #f)))) ) - (let* ((v1-51 *game-info*) - (a0-43 (+ (-> v1-51 attack-id) 1)) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-51 attack-id) a0-43) - (set! (-> obj attack-id) a0-43) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (if (eval! (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) @@ -1407,7 +1418,7 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-grill ((obj sew-grill) (arg0 entity-actor)) +(defmethod init-from-entity! sew-grill ((obj sew-grill) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -1415,7 +1426,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-grill" (the-as (pointer uint32) #f))) @@ -1571,18 +1582,18 @@ This commonly includes things such as: (none) ) :trans (behavior () - (let* ((s5-0 *target*) - (gp-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when gp-0 + (when target-proc (cond - ((< (vector-vector-distance (-> self root-override2 trans) (get-trans gp-0 0)) 20480.0) + ((< (vector-vector-distance (-> self root-override2 trans) (get-trans target-proc 0)) 20480.0) (go-virtual scare) ) - ((< (vector-vector-distance (-> self root-override2 trans) (get-trans gp-0 0)) 102400.0) + ((< (vector-vector-distance (-> self root-override2 trans) (get-trans target-proc 0)) 102400.0) (gui-control-method-12 *gui-control* self @@ -1624,19 +1635,19 @@ This commonly includes things such as: ) :enter (behavior () (logclear! (-> self draw status) (draw-control-status no-draw)) - (let* ((v1-2 (-> self grill-actor)) - (gp-0 (if v1-2 - (-> v1-2 extra process) - ) - ) + (let* ((actor (-> self grill-actor)) + (actor-proc (if actor + (-> actor extra process) + ) + ) ) - (when gp-0 + (when actor-proc (set! (-> self manipy) (process-spawn manipy :init manipy-init (-> self root-override2 trans) - (-> gp-0 entity) + (-> actor-proc entity) (art-group-get-by-name *level* "skel-sew-grill" (the-as (pointer uint32) #f)) #f 0 @@ -1644,8 +1655,8 @@ This commonly includes things such as: ) ) (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) - (set! (-> self manipy 0 draw light-index) (-> (the-as sew-grill gp-0) draw light-index)) - (logior! (-> (the-as sew-grill gp-0) draw status) (draw-control-status no-draw)) + (set! (-> self manipy 0 draw light-index) (-> (the-as sew-grill actor-proc) draw light-index)) + (logior! (-> (the-as sew-grill actor-proc) draw status) (draw-control-status no-draw)) ) ) (set! (-> self spooled-sound-id) @@ -1657,31 +1668,31 @@ This commonly includes things such as: (none) ) :exit (behavior () - (let* ((a0-0 (-> self grill-actor)) - (v1-0 (if a0-0 - (-> a0-0 extra process) - ) - ) + (let* ((actor (-> self grill-actor)) + (actor-proc (if actor + (-> actor extra process) + ) + ) ) - (if v1-0 - (logclear! (-> (the-as sew-grill v1-0) draw status) (draw-control-status no-draw)) + (if actor-proc + (logclear! (-> (the-as sew-grill actor-proc) draw status) (draw-control-status no-draw)) ) ) (none) ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((a2-0 (-> self draw art-group data 57))) + (let ((anim (-> self draw art-group data 57))) (ja-play-spooled-anim (-> self anim) (ja-group) - (the-as art-joint-anim a2-0) + (the-as art-joint-anim anim) (the-as (function process-drawable symbol) false-func) ) ) - (let ((v1-8 (-> self root-override2 root-prim))) - (set! (-> v1-8 prim-core collide-as) (collide-spec)) - (set! (-> v1-8 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override2 root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (suspend) @@ -1701,28 +1712,28 @@ This commonly includes things such as: (fmax 0.0 (fmin 1.0 (* 0.00001994613 f1-0))) ) ) - (let ((f30-0 + (let ((scale (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override2 trans) (camera-pos)) 65536.0 204800.0) ) ) (when *sound-player-enable* - (let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> gp-1 command) (sound-command set-param)) - (set! (-> gp-1 id) (the-as sound-id (-> self spooled-sound-id))) - (set! (-> gp-1 params volume) (the int (* 1024.0 f30-0))) - (let ((a1-5 (-> self root-override2 trans))) - (let ((s5-1 self)) - (when (= a1-5 #t) - (if (and s5-1 (type? s5-1 process-drawable) (nonzero? (-> s5-1 root-override2))) - (set! a1-5 (-> s5-1 root-override2 trans)) - (set! a1-5 (the-as vector #f)) + (let ((set-sound-param (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> set-sound-param command) (sound-command set-param)) + (set! (-> set-sound-param id) (the-as sound-id (-> self spooled-sound-id))) + (set! (-> set-sound-param params volume) (the int (* 1024.0 scale))) + (let ((position (-> self root-override2 trans))) + (let ((_self self)) + (when (= position #t) + (if (and _self (type? _self process-drawable) (nonzero? (-> _self root-override2))) + (set! position (-> _self root-override2 trans)) + (set! position (the-as vector #f)) ) ) ) - (sound-trans-convert (the-as vector3w (-> gp-1 params trans)) a1-5) + (sound-trans-convert (the-as vector3w (-> set-sound-param params trans)) position) ) - (set! (-> gp-1 params mask) (the-as uint 33)) - (-> gp-1 id) + (set! (-> set-sound-param params mask) (the-as uint 33)) + (-> set-sound-param id) ) ) ) @@ -1737,107 +1748,108 @@ This commonly includes things such as: (none) ) -(defmethod enemy-method-114 sew-scare-grunt ((obj sew-scare-grunt)) - "@abstract" +(defmethod init-enemy-collision! sew-scare-grunt ((obj sew-scare-grunt)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (stack-size-set! (-> obj main-thread) 512) - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 6) 0))) - (set! (-> s5-0 total-prims) (the-as uint 7)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) (collide-spec backgnd)) - (set! (-> s4-0 prim-core action) (collide-action solid)) - (set-vector! (-> s4-0 local-sphere) 0.0 6144.0 0.0 17408.0) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 6) 0))) + (set! (-> cshape total-prims) (the-as uint 7)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec backgnd)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set-vector! (-> prim-group local-sphere) 0.0 6144.0 0.0 17408.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-15 prim-core collide-with) (collide-spec backgnd)) - (set! (-> v1-15 prim-core action) (collide-action solid)) - (set-vector! (-> v1-15 local-sphere) 0.0 4915.2 0.0 4915.2) + (let ((prim-sphere-1 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-1 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-1 prim-core collide-with) (collide-spec backgnd)) + (set! (-> prim-sphere-1 prim-core action) (collide-action solid)) + (set-vector! (-> prim-sphere-1 local-sphere) 0.0 4915.2 0.0 4915.2) ) - (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-17 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-17 prim-core action) (collide-action semi-solid)) - (set! (-> v1-17 transform-index) 4) - (set-vector! (-> v1-17 local-sphere) 0.0 0.0 0.0 4915.2) + (let ((prim-sphere-2 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-2 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-2 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-2 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-2 transform-index) 4) + (set-vector! (-> prim-sphere-2 local-sphere) 0.0 0.0 0.0 4915.2) ) - (let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-19 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-19 prim-core action) (collide-action semi-solid)) - (set! (-> v1-19 transform-index) 18) - (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 2252.8) + (let ((prim-sphere-3 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-3 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-3 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-3 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-3 transform-index) 18) + (set-vector! (-> prim-sphere-3 local-sphere) 0.0 0.0 0.0 2252.8) ) - (let ((v1-21 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-21 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-21 prim-core action) (collide-action semi-solid)) - (set! (-> v1-21 transform-index) 16) - (set-vector! (-> v1-21 local-sphere) 0.0 0.0 0.0 2048.0) + (let ((prim-sphere-4 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-4 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-4 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-4 transform-index) 16) + (set-vector! (-> prim-sphere-4 local-sphere) 0.0 0.0 0.0 2048.0) ) - (let ((v1-23 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-23 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-23 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-23 prim-core action) (collide-action semi-solid)) - (set! (-> v1-23 transform-index) 12) - (set-vector! (-> v1-23 local-sphere) 0.0 0.0 0.0 2048.0) + (let ((prim-sphere-5 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-5 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-5 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-5 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-5 transform-index) 12) + (set-vector! (-> prim-sphere-5 local-sphere) 0.0 0.0 0.0 2048.0) ) - (let ((v1-25 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-25 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-25 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-25 prim-core action) (collide-action semi-solid)) - (set! (-> v1-25 transform-index) 6) - (set-vector! (-> v1-25 local-sphere) 0.0 0.0 0.0 8192.0) + (let ((prim-sphere-6 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-6 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-6 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-6 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-6 transform-index) 6) + (set-vector! (-> prim-sphere-6 local-sphere) 0.0 0.0 0.0 8192.0) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-28 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-28 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-28 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> s5-0 max-iteration-count) (the-as uint 3)) - (set! (-> obj root-override2) s5-0) + (set! (-> cshape max-iteration-count) (the-as uint 3)) + (set! (-> obj root-override2) cshape) ) 0 (none) ) -(defmethod grunt-method-185 sew-scare-grunt ((obj sew-scare-grunt)) +(defmethod get-enemy-info sew-scare-grunt ((obj sew-scare-grunt)) + "@returns the [[nav-enemy-info]] associated with this type of grunt" *sew-scare-grunt-nav-enemy-info* ) ;; WARN: Return type mismatch float vs none. -(defmethod enemy-method-115 sew-scare-grunt ((obj sew-scare-grunt)) - "@abstract" +(defmethod init-enemy! sew-scare-grunt ((obj sew-scare-grunt)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (set! (-> obj anim) (new 'static 'spool-anim :name "sew-scare-grunt" :anim-name "sew-scare-grunt" :parts 2 :command-list '()) ) (set! (-> obj grill-actor) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) - (let ((t9-1 (method-of-type grunt enemy-method-115))) - (t9-1 obj) + (let ((func (method-of-type grunt init-enemy!))) + (func obj) ) (set! (-> obj root-override2 trans y) (+ -3276.8 (-> obj root-override2 trans y))) (none) diff --git a/goal_src/jak2/levels/sewer/sewer-part.gc b/goal_src/jak2/levels/sewer/sewer-part.gc index 2bc982fc50..f2b769ce49 100644 --- a/goal_src/jak2/levels/sewer/sewer-part.gc +++ b/goal_src/jak2/levels/sewer/sewer-part.gc @@ -181,6 +181,7 @@ ) (defun sewer-drop-birth-func ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Resets the timer to birth a new water drop" (when (>= (get-height *ocean* (-> arg2 launchrot) #t) (-> arg2 launchrot y)) (set! (-> arg1 timer) 0) 0 @@ -190,6 +191,7 @@ ) (defun check-drop-level-sewer-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds" (let ((f30-0 (-> arg1 key origin trans y)) (f28-0 (-> arg2 vector 0 y)) (s5-0 #f) @@ -330,23 +332,26 @@ ) (defun sewer-drop2-birth-func ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Resets the timer to birth a new water drop" (when (>= (get-height *ocean* (-> arg2 launchrot) #t) (-> arg2 launchrot y)) (set! (-> arg1 timer) 0) 0 ) - (let ((s4-0 (new 'stack-no-clear 'collide-query))) - (set! (-> s4-0 start-pos quad) (-> arg2 launchrot quad)) - (set-vector! (-> s4-0 move-dist) 0.0 -204800.0 0.0 1.0) - (let ((v1-6 s4-0)) - (set! (-> v1-6 radius) 40.96) - (set! (-> v1-6 collide-with) (collide-spec backgnd)) - (set! (-> v1-6 ignore-process0) #f) - (set! (-> v1-6 ignore-process1) #f) - (set! (-> v1-6 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-6 action-mask) (collide-action solid)) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> arg2 launchrot quad)) + (set-vector! (-> cquery move-dist) 0.0 -204800.0 0.0 1.0) + (let ((_cquery cquery)) + (set! (-> _cquery radius) 40.96) + (set! (-> _cquery collide-with) (collide-spec backgnd)) + (set! (-> _cquery ignore-process0) #f) + (set! (-> _cquery ignore-process1) #f) + (set! (-> _cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> _cquery action-mask) (collide-action solid)) ) - (if (>= (fill-and-probe-using-line-sphere *collide-cache* s4-0) 0.0) - (set! (-> arg1 user-float) (-> s4-0 best-other-tri intersect y)) + (if (>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) + (set! (-> arg1 user-float) (-> cquery best-other-tri intersect y)) (set! (-> arg1 user-float) (+ -204800.0 (-> arg2 launchrot y))) ) ) @@ -355,6 +360,7 @@ ) (defun check-drop2-level-sewer-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds" (-> arg1 key) (let ((f30-0 (-> arg1 user-float)) (f28-0 (-> arg2 vector 0 y)) diff --git a/goal_src/jak2/levels/strip/strip-obs.gc b/goal_src/jak2/levels/strip/strip-obs.gc index a61e797691..9779f4e1b7 100644 --- a/goal_src/jak2/levels/strip/strip-obs.gc +++ b/goal_src/jak2/levels/strip/strip-obs.gc @@ -867,7 +867,7 @@ This commonly includes things such as: ) ) :code (behavior () - (talker-speech-class-method-10 (-> *talker-speech* 194)) + (play-communicator-speech! (-> *talker-speech* 194)) (process-entity-status! self (entity-perm-status subtask-complete) #t) (kill-and-free-particles (-> self part)) (stop! (-> self sound)) @@ -1238,7 +1238,6 @@ This commonly includes things such as: (none) ) -;; WARN: Return type mismatch int vs sound-id. (defmethod play-impact-sound grenade ((obj grenade) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -1250,7 +1249,8 @@ This commonly includes things such as: ) ) ) - (the-as sound-id 0) + 0 + (none) ) (defstate impact (grenade) @@ -1384,7 +1384,7 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod init-collision! grenade ((obj grenade)) +(defmethod init-proj-collision! grenade ((obj grenade)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/goal_src/jak2/levels/temple/canyon/mincan-obs.gc b/goal_src/jak2/levels/temple/canyon/mincan-obs.gc index 1aebcccedb..98278cd46f 100644 --- a/goal_src/jak2/levels/temple/canyon/mincan-obs.gc +++ b/goal_src/jak2/levels/temple/canyon/mincan-obs.gc @@ -31,9 +31,9 @@ ) ) -(defmethod art-init! water-anim-mincan ((obj water-anim-mincan)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((func (method-of-type water-anim art-init!))) +(defmethod init-water! water-anim-mincan ((obj water-anim-mincan)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((func (method-of-type water-anim init-water!))) (func obj) ) (let ((ripple-control (new 'process 'ripple-control))) diff --git a/goal_src/jak2/levels/temple/mountain-obs.gc b/goal_src/jak2/levels/temple/mountain-obs.gc index b50e40b066..dab1336fb6 100644 --- a/goal_src/jak2/levels/temple/mountain-obs.gc +++ b/goal_src/jak2/levels/temple/mountain-obs.gc @@ -3197,9 +3197,9 @@ This commonly includes things such as: ) ) -(defmethod art-init! water-anim-mountain ((obj water-anim-mountain)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) +(defmethod init-water! water-anim-mountain ((obj water-anim-mountain)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) (t9-0 obj) ) (let ((v1-2 (new 'process 'ripple-control))) diff --git a/goal_src/jak2/levels/temple/mountain-obs2.gc b/goal_src/jak2/levels/temple/mountain-obs2.gc index c203a0b4ad..9c13273552 100644 --- a/goal_src/jak2/levels/temple/mountain-obs2.gc +++ b/goal_src/jak2/levels/temple/mountain-obs2.gc @@ -36,9 +36,9 @@ (none) ) :code (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (-> self root-override backup-collide-as)) - (set! (-> v1-1 prim-core collide-with) (-> self root-override backup-collide-with)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (-> self root-override backup-collide-as)) + (set! (-> root-prim prim-core collide-with) (-> self root-override backup-collide-with)) ) (ja :num-func num-func-identity :frame-num 0.0) (ja-post) @@ -56,9 +56,9 @@ (none) ) :code (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (ja :num-func num-func-identity :frame-num max) @@ -69,31 +69,31 @@ ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-iris-door ((obj mtn-iris-door) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-iris-door ((obj mtn-iris-door) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 3) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 40960.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 40960.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-mtn-iris-door" (the-as (pointer uint32) #f))) @@ -113,7 +113,7 @@ This commonly includes things such as: (time-flip float :offset-assert 368) (disable-track-under basic :offset-assert 372) (dest-angle float :offset-assert 376) - (on-shake basic :offset-assert 380) + (on-shake symbol :offset-assert 380) (hint-count float :offset-assert 384) ) :heap-base #x110 @@ -135,23 +135,23 @@ This commonly includes things such as: (defmethod init-plat-collision! mtn-plat-shoot ((obj mtn-plat-shoot)) "TODO - collision stuff for setting up the platform" - (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid rideable)) - (set! (-> s4-0 transform-index) 0) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 20889.6) - (set! (-> s5-0 total-prims) (the-as uint 1)) - (set! (-> s5-0 root-prim) s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 20889.6) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s5-0) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-11 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s5-0) + (set! (-> obj root-override) cshape) ) 0 (none) @@ -196,30 +196,30 @@ For example for an elevator pre-compute the distance between the first and last ) (('attack) (when (zero? (-> self state-flip)) - (let ((v1-3 (the-as object (-> event param 1)))) - (when (!= (-> (the-as attack-info v1-3) id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> (the-as attack-info v1-3) id)) - (let* ((gp-0 proc) - (v1-5 (if (type? gp-0 process-drawable) - (the-as process-drawable gp-0) - ) - ) - ) - (when v1-5 - (let* ((s5-0 (-> v1-5 root)) - (gp-1 (if (type? s5-0 collide-shape) - (the-as collide-shape s5-0) + (let ((attack-info (the-as object (-> event param 1)))) + (when (!= (-> (the-as attack-info attack-info) id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> (the-as attack-info attack-info) id)) + (let* ((attacking-proc proc) + (attacker (if (type? attacking-proc process-drawable) + (the-as process-drawable attacking-proc) ) ) + ) + (when attacker + (let* ((attacker-root (-> attacker root)) + (cshape (if (type? attacker-root collide-shape) + (the-as collide-shape attacker-root) + ) + ) ) - (when gp-1 - (when (logtest? (-> gp-1 root-prim prim-core collide-as) (collide-spec projectile)) + (when cshape + (when (logtest? (-> cshape root-prim prim-core collide-as) (collide-spec projectile)) (when (zero? (-> self state-flip)) (sound-play "mtn-plat-flip1") (set! (-> self state-flip) (the-as uint 1)) ) (set! (-> self hint-count) -1.0) - (vector-! (-> self axe-flip) (-> gp-1 trans) (-> self root-override trans)) + (vector-! (-> self axe-flip) (-> cshape trans) (-> self root-override trans)) (set! (-> self axe-flip y) 0.0) (vector-normalize! (-> self axe-flip) 1.0) (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) @@ -267,9 +267,9 @@ For example for an elevator pre-compute the distance between the first and last ) ) :enter (behavior () - (let ((t9-0 (-> (method-of-type plat plat-path-active) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type plat plat-path-active) enter))) + (if func + (func) ) ) (set! (-> self dest-angle) 180.0) @@ -307,7 +307,7 @@ For example for an elevator pre-compute the distance between the first and last ) (when (not (-> self on-shake)) (sound-play "mtn-plat-shake") - (set! (-> self on-shake) (the-as basic #t)) + (set! (-> self on-shake) #t) ) (let ((s5-2 (new 'stack-no-clear 'vector)) (gp-2 (new 'stack-no-clear 'quaternion)) @@ -330,17 +330,17 @@ For example for an elevator pre-compute the distance between the first and last ) ) (quaternion-normalize! (-> self root-override quat)) - (let ((t9-12 (-> (method-of-type plat plat-path-active) trans))) - (if t9-12 - (t9-12) + (let ((func (-> (method-of-type plat plat-path-active) trans))) + (if func + (func) ) ) (none) ) :post (behavior () - (let ((t9-0 (-> (method-of-type plat plat-path-active) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type plat plat-path-active) post))) + (if func + ((the-as (function none) func)) ) ) (none) @@ -353,21 +353,21 @@ For example for an elevator pre-compute the distance between the first and last 3 (lambda :behavior task-manager () - (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) - (set! (-> gp-0 pos quad) (-> self info end-sphere quad)) - (quaternion-identity! (-> gp-0 quat)) - (set! (-> gp-0 flags) (task-arrow-flags)) - (set! (-> gp-0 map-icon) (the-as uint 15)) - (set! (-> self arrow) (process->handle (task-arrow-spawn gp-0 (the-as task-arrow self)))) + (let ((arrow-params (new 'stack-no-clear 'task-arrow-params))) + (set! (-> arrow-params pos quad) (-> self info end-sphere quad)) + (quaternion-identity! (-> arrow-params quat)) + (set! (-> arrow-params flags) (task-arrow-flags)) + (set! (-> arrow-params map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn arrow-params (the-as task-arrow self)))) ) (until #f - (let ((f0-0 (vector-vector-distance (target-pos 0) (-> self info end-sphere)))) + (let ((dist-from-target (vector-vector-distance (target-pos 0) (-> self info end-sphere)))) (cond - ((< f0-0 (-> self info end-sphere r)) + ((< dist-from-target (-> self info end-sphere r)) (send-event (handle->process (-> self arrow)) 'leave) (go-virtual complete) ) - ((< f0-0 (* 6.0 (-> self info end-sphere r))) + ((< dist-from-target (* 6.0 (-> self info end-sphere r))) (gui-control-method-12 *gui-control* self diff --git a/goal_src/jak2/levels/temple/mountain-part.gc b/goal_src/jak2/levels/temple/mountain-part.gc index 16ebe4524f..dd8455599a 100644 --- a/goal_src/jak2/levels/temple/mountain-part.gc +++ b/goal_src/jak2/levels/temple/mountain-part.gc @@ -1959,17 +1959,18 @@ ) (defun check-drop-level-mountain-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure the waterfall drops don't go below the specified y-value" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) - (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((vec (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) - (set-vector! s3-0 (-> arg2 vector 0 x) (-> arg1 user-float) (-> arg2 vector 0 z) 1.0) - (let ((t9-1 sp-launch-particles-var) - (a0-3 *sp-particle-system-3d*) - (a1-2 (-> *part-id-table* 1591)) - (a2-1 *launch-matrix*) + (set-vector! vec (-> arg2 vector 0 x) (-> arg1 user-float) (-> arg2 vector 0 z) 1.0) + (let ((func sp-launch-particles-var) + (sys *sp-particle-system-3d*) + (launcher (-> *part-id-table* 1591)) + (matrix *launch-matrix*) ) - (set! (-> a2-1 trans quad) (-> s3-0 quad)) - (t9-1 a0-3 a1-2 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> matrix trans quad) (-> vec quad)) + (func sys launcher matrix (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) diff --git a/goal_src/jak2/levels/temple/mountain-scenes.gc b/goal_src/jak2/levels/temple/mountain-scenes.gc index af9a44baa7..424f55f52f 100644 --- a/goal_src/jak2/levels/temple/mountain-scenes.gc +++ b/goal_src/jak2/levels/temple/mountain-scenes.gc @@ -1734,31 +1734,31 @@ ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-plat-buried-rocks ((obj mtn-plat-buried-rocks) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-plat-buried-rocks ((obj mtn-plat-buried-rocks) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 3) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 122880.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 122880.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((v1-5 (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> v1-5 prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as @@ -1804,28 +1804,28 @@ This commonly includes things such as: (defmethod init-plat-collision! mtn-plat-buried ((obj mtn-plat-buried)) "TODO - collision stuff for setting up the platform" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid rideable)) - (set! (-> s4-0 transform-index) 0) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 19660.8) - (set! (-> s5-0 total-prims) (the-as uint 1)) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 19660.8) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s5-0) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-15 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-15 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s5-0) + (set! (-> obj root-override) cshape) ) (set! (-> obj sound) (new 'process 'ambient-sound (static-sound-spec "mtn-plat-lp" :fo-max 100) (-> obj root-override trans)) @@ -1885,9 +1885,9 @@ otherwise, [[plat::34]] ) (set! (-> self path-pos) (get-norm! (-> self sync) 0)) (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) - (let ((t9-3 (-> (method-of-type plat plat-idle) enter))) - (if t9-3 - (t9-3) + (let ((func (-> (method-of-type plat plat-idle) enter))) + (if func + (func) ) ) (none) @@ -2400,14 +2400,14 @@ otherwise, [[plat::34]] ) (355 (apply ,(lambda :behavior scene-player () - (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> v1-0 command) (sound-command set-param)) - (set! (-> v1-0 id) (-> self user-sound 0)) - (set! (-> v1-0 params volume) -4) - (set! (-> v1-0 auto-time) 48) - (set! (-> v1-0 auto-from) 2) - (set! (-> v1-0 params mask) (the-as uint 17)) - (-> v1-0 id) + (let ((sound-set-param (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> sound-set-param command) (sound-command set-param)) + (set! (-> sound-set-param id) (-> self user-sound 0)) + (set! (-> sound-set-param params volume) -4) + (set! (-> sound-set-param auto-time) 48) + (set! (-> sound-set-param auto-from) 2) + (set! (-> sound-set-param params mask) (the-as uint 17)) + (-> sound-set-param id) ) (none) ) @@ -2962,7 +2962,7 @@ otherwise, [[plat::34]] ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-lens ((obj mtn-lens) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-lens ((obj mtn-lens) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -2970,7 +2970,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3000,7 +3000,7 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-lens-base ((obj mtn-lens-base) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-lens-base ((obj mtn-lens-base) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3008,7 +3008,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3049,31 +3049,31 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-lens-floor ((obj mtn-lens-floor) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-lens-floor ((obj mtn-lens-floor) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 3) - (set-vector! (-> v1-2 local-sphere) 0.0 -4096.0 0.0 26624.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 -4096.0 0.0 26624.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3107,7 +3107,7 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-shard ((obj mtn-shard) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-shard ((obj mtn-shard) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3115,7 +3115,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3136,7 +3136,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-step-plat-rocks-a ((obj mtn-step-plat-rocks-a) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-step-plat-rocks-a ((obj mtn-step-plat-rocks-a) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3144,35 +3144,35 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) - (set! (-> s4-0 total-prims) (the-as uint 4)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) 0.0 12288.0 0.0 20480.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 12288.0 0.0 20480.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 4 16384) (1 7 16384) (2 12 16384))) (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) @@ -3180,14 +3180,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-24 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as @@ -3220,7 +3220,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-step-plat-rocks-b ((obj mtn-step-plat-rocks-b) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-step-plat-rocks-b ((obj mtn-step-plat-rocks-b) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3228,16 +3228,16 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 17) 0))) - (set! (-> s4-0 total-prims) (the-as uint 18)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) 0.0 -12288.0 0.0 40960.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 17) 0))) + (set! (-> cshape total-prims) (the-as uint 18)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 -12288.0 0.0 40960.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 6 16384) (1 7 16384) (2 8 16384) @@ -3260,21 +3260,21 @@ This commonly includes things such as: (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) @@ -3282,14 +3282,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-24 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as @@ -3322,7 +3322,7 @@ This commonly includes things such as: ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-step-plat-rocks-c ((obj mtn-step-plat-rocks-c) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-step-plat-rocks-c ((obj mtn-step-plat-rocks-c) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3330,16 +3330,16 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 24) 0))) - (set! (-> s4-0 total-prims) (the-as uint 25)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) 0.0 0.0 32768.0 57344.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 24) 0))) + (set! (-> cshape total-prims) (the-as uint 25)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 32768.0 57344.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 4 16384) (1 6 16384) (2 9 16384) @@ -3369,21 +3369,21 @@ This commonly includes things such as: (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) @@ -3391,14 +3391,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-24 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as diff --git a/goal_src/jak2/levels/temple/rhino.gc b/goal_src/jak2/levels/temple/rhino.gc index 1d451a1564..011b5b77fc 100644 --- a/goal_src/jak2/levels/temple/rhino.gc +++ b/goal_src/jak2/levels/temple/rhino.gc @@ -313,7 +313,9 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 272] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 318] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 323] -(defmethod enemy-method-74 rhino ((obj rhino) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler rhino ((obj rhino) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (sv-96 int) (sv-112 symbol) @@ -342,10 +344,10 @@ ((zero? (-> obj hit-points)) (set! (-> *rhino-nav-enemy-info* die-anim) 15) (set! (-> obj frame-die-smush) 11.0) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -354,7 +356,7 @@ ((zero? (-> obj hit-points)) (set! (-> *rhino-nav-enemy-info* die-anim) 14) (set! (-> obj frame-die-smush) 16.0) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (else (let* ((s5-0 arg0) @@ -503,10 +505,10 @@ (set! (-> v1-74 prim-core collide-with) (collide-spec)) ) 0 - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -558,7 +560,7 @@ ) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -573,7 +575,7 @@ :virtual #t :enter (behavior () (remove-setting! 'sound-mode) - (enemy-method-132 self) + (dispose! self) (set! (-> self hit-points) 0) 0 (none) @@ -687,7 +689,8 @@ ) ) -(defmethod enemy-method-56 rhino ((obj rhino) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack rhino ((obj 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 (-> obj incoming penetrate-using)))))) (cond @@ -964,7 +967,7 @@ (vector-vector-xz-distance (get-trans (the-as process-focusable a0-37) 0) (-> self root-override2 trans)) ) (ja-channel-push! 1 (seconds 0.075)) - (enemy-method-72 self) + (react-to-focus self) ) (else (go-virtual run-away) @@ -973,7 +976,7 @@ ) (else (ja-channel-push! 1 (seconds 0.075)) - (enemy-method-72 self) + (react-to-focus self) ) ) ) @@ -1097,7 +1100,7 @@ (vector-! gp-0 s2-0 (-> self root-override2 trans)) (vector-normalize! gp-0 (+ 16384.0 (vector-length gp-0))) (vector+! s4-0 (-> self root-override2 trans) gp-0) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 40960.0 ) @@ -1109,7 +1112,7 @@ (cond ((-> self charge-straight) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + ((>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 20480.0 ) @@ -1623,8 +1626,8 @@ ) ) -(defmethod enemy-method-114 rhino ((obj rhino)) - "@abstract" +(defmethod init-enemy-collision! rhino ((obj rhino)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1706,8 +1709,8 @@ ) ) -(defmethod enemy-method-115 rhino ((obj rhino)) - "@abstract" +(defmethod init-enemy! rhino ((obj rhino)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1715,7 +1718,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *rhino-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *rhino-nav-enemy-info*) (let ((v1-8 (-> obj neck))) (set! (-> v1-8 up) (the-as uint 1)) (set! (-> v1-8 nose) (the-as uint 2)) diff --git a/goal_src/jak2/levels/undefined/hal.gc b/goal_src/jak2/levels/undefined/hal.gc index 97afb74124..daa817fa5c 100644 --- a/goal_src/jak2/levels/undefined/hal.gc +++ b/goal_src/jak2/levels/undefined/hal.gc @@ -272,7 +272,7 @@ (none) ) -(defmethod enemy-method-114 hal ((obj hal)) +(defmethod init-enemy-collision! hal ((obj hal)) "@abstract" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -311,7 +311,7 @@ (none) ) -(defmethod enemy-method-115 hal ((obj hal)) +(defmethod init-enemy! hal ((obj hal)) "@abstract" (init! obj) (initialize-skeleton @@ -319,8 +319,8 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-scenecamera" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *hal-nav-enemy-info*) - (let ((t9-4 (method-of-type bot enemy-method-115))) + (init-enemy-behaviour-and-stats! obj *hal-nav-enemy-info*) + (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj channel) (the-as uint 28)) @@ -385,7 +385,7 @@ ) ;; WARN: Return type mismatch none vs object. -(defmethod enemy-method-74 hal ((obj hal) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler hal ((obj hal) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (the-as object (case arg2 @@ -528,7 +528,7 @@ ) (defbehavior hal-event-handler hal ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (enemy-method-74 self arg0 arg1 arg2 arg3) + (general-event-handler self arg0 arg1 arg2 arg3) ) (defstate idle (hal) diff --git a/test/decompiler/reference/jak2/characters/ashelin/ash-shot_REF.gc b/test/decompiler/reference/jak2/characters/ashelin/ash-shot_REF.gc new file mode 100644 index 0000000000..df43d342d2 --- /dev/null +++ b/test/decompiler/reference/jak2/characters/ashelin/ash-shot_REF.gc @@ -0,0 +1,562 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpart 672 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x45 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 0.75)) + (sp-flt spt-scale-y (meters 10)) + (sp-flt spt-r 128.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +;; failed to figure out what this is: +(defpart 673 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 3) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 674 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x34 :page #xc)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.013333334) (meters 0.006666667) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -1.28) + (sp-flt spt-fade-b -1.28) + (sp-flt spt-fade-a -0.48) + (sp-int spt-timer 100) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 675 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x46 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-scale-y (meters 4.5)) + (sp-flt spt-r 128.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -3.6571429) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-ashelin-shot-hit + :id 149 + :duration (seconds 1) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 676 :period 600 :length 5) + (sp-item 677 :fade-after (meters 100) :period 600 :length 5) + (sp-item 678 :period 600 :length 5) + (sp-item 679 :fade-after (meters 50) :falloff-to (meters 50) :period 600 :length 200) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 200) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 150) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 125) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 100) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 75) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 65) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 50) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 40) + (sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period 600 :length 25) + ) + ) + +;; failed to figure out what this is: +(defpart 679 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-rnd-flt spt-num 0.0 0.2 1.0) + (sp-flt spt-y (meters 0.25)) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.2) 1.0) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 32.0 8.0 1.0) + (sp-rnd-flt spt-b 32.0 8.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.013333334) 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.001) (meters -0.00033333333) 1.0) + (sp-rnd-int-flt spt-rotvel-z (degrees -2.4) 1 873.81335) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.10666667) + (sp-flt spt-fade-b -0.10666667) + (sp-rnd-flt spt-accel-y -1.3653333 -5.4613333 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 200) + (sp-launcher-by-id spt-next-launcher 681) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 680 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.3) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 32.0 8.0 1.0) + (sp-rnd-flt spt-b 32.0 8.0 1.0) + (sp-flt spt-a 96.0) + (sp-rnd-flt spt-vel-y (meters 0.006666667) (meters 0.013333334) 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.0005) (meters -0.0005) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.10666667) + (sp-flt spt-fade-b -0.10666667) + (sp-rnd-flt spt-accel-y -1.3653333 -5.4613333 1.0) + (sp-flt spt-friction 0.8) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 200) + (sp-launcher-by-id spt-next-launcher 681) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 681 + :init-specs ((sp-flt spt-fade-a -0.96)) + ) + +;; failed to figure out what this is: +(defpart 677 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x47 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 5) (meters 0.1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 32.0 8.0 1.0) + (sp-rnd-flt spt-b 32.0 8.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-rotvel-z (degrees -0.1)) + (sp-flt spt-fade-a -0.32) + (sp-int spt-timer 400) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 682) + ) + ) + +;; failed to figure out what this is: +(defpart 682 + :init-specs ((sp-rnd-flt spt-scale-x (meters 2) (meters 0.5) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 32.0 8.0 1.0) + (sp-rnd-flt spt-b 32.0 8.0 1.0) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 682) + ) + ) + +;; failed to figure out what this is: +(defpart 678 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x47 :page #xc)) + (sp-flt spt-num 2.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 32.0 8.0 1.0) + (sp-rnd-flt spt-b 32.0 8.0 1.0) + (sp-flt spt-a 48.0) + (sp-flt spt-scalevel-x (meters 0.12857144)) + (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.9142857) + (sp-flt spt-fade-b -0.9142857) + (sp-int spt-timer 400) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2) + (sp-int spt-next-time 35) + (sp-launcher-by-id spt-next-launcher 683) + ) + ) + +;; failed to figure out what this is: +(defpart 683 + :init-specs ((sp-flt spt-scale-x (meters 4.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.010958904)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.38356164) + (sp-flt spt-fade-b 0.0) + (sp-flt spt-fade-a -0.13150685) + ) + ) + +;; failed to figure out what this is: +(defpart 676 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x47 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 96.0) + (sp-flt spt-scalevel-x (meters 0.16666667)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 55) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 684) + ) + ) + +;; failed to figure out what this is: +(defpart 684 + :init-specs ((sp-flt spt-scale-x (meters 3.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.0875)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-b -6.4) + ) + ) + +;; definition of type ashelin-shot +(deftype ashelin-shot (projectile) + ((tail-pos vector :inline :offset-assert 480) + (hit-pos vector :inline :offset-assert 496) + ) + :heap-base #x180 + :method-count-assert 40 + :size-assert #x200 + :flag-assert #x2801800200 + ) + +;; definition for method 3 of type ashelin-shot +(defmethod inspect ashelin-shot ((obj ashelin-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 obj) + ) + (format #t "~2Ttail-pos: #~%" (-> obj tail-pos)) + (format #t "~2Thit-pos: #~%" (-> obj hit-pos)) + (label cfg-4) + obj + ) + +;; definition for method 24 of type ashelin-shot +;; WARN: Return type mismatch int vs none. +(defmethod draw-laser-sight ashelin-shot ((obj ashelin-shot)) + "TODO - confirm If applicable, draw the laser sight particles +:virtual" + (draw-beam (-> *part-id-table* 675) (-> obj tail-pos) (-> obj starting-dir) #f #t) + 0 + (none) + ) + +;; definition for method 25 of type ashelin-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles ashelin-shot ((obj ashelin-shot)) + "Spawns associated particles with the projectile if applicable" + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((v1-1 (-> obj root-override trans)) + (a1-0 (-> obj tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-2 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-2 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> gp-0 quad) vf6) + (let ((f30-0 (-> *part-id-table* 672 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 672 init-specs 4 initial-valuef) (fmin f30-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 672) a1-0 s5-1 #f #t) + (set! (-> *part-id-table* 672 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* 673)) + (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) + ) + (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) + (when (< 0.0 f0-4) + (let ((f0-5 (* f0-4 f0-4)) + (f30-1 (-> *part-id-table* 674 init-specs 8 initial-valuef)) + (f28-0 (-> *part-id-table* 674 init-specs 8 random-rangef)) + ) + (set! (-> *part-id-table* 674 init-specs 8 initial-valuef) (* f30-1 f0-5)) + (set! (-> *part-id-table* 674 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* 674)) + (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) + ) + (set! (-> *part-id-table* 674 init-specs 8 initial-valuef) f30-1) + (set! (-> *part-id-table* 674 init-specs 8 random-rangef) f28-0) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 26 of type ashelin-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-shell-particles ashelin-shot ((obj ashelin-shot)) + "TODO - confirm" + (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker gp-0) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-2 run-function-in-process) + (a0-3 gp-0) + (a1-2 part-tracker-init) + (a2-4 (-> *part-group-id-table* 149)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> obj root-override trans quad)) + ((the-as (function object object object object object object object object none) t9-2) + a0-3 + a1-2 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> gp-0 ppointer) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type ashelin-shot +(defmethod play-impact-sound ashelin-shot ((obj ashelin-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "ashelin-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "ashelin-shot-hi") + ) + ((= v1-0 (projectile-options lose-altitude proj-options-2)) + ((the-as (function projectile projectile-options none) (find-parent-method ashelin-shot 28)) obj arg0) + ) + ) + ) + (none) + ) + +;; definition for method 38 of type ashelin-shot +(defmethod made-impact? ashelin-shot ((obj ashelin-shot)) + "TODO - queries the collision cache, return true/false" + (let ((v1-0 (-> obj root-override)) + (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-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> a1-0 action-mask) (collide-action solid)) + ) + (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -10240.0 12697.6 -4096.0 t1-0) + ) + ) + +;; definition for function ashelin-shot-move +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun ashelin-shot-move ((arg0 ashelin-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root-override))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 40960.0 f0-0) + (vector-normalize! s4-0 40960.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (when (logtest? (-> s5-0 status) (collide-status touch-surface)) + (let ((v1-9 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> arg0 tail-pos) (-> s5-0 trans)) 2048.0)) + (a1-5 (-> arg0 hit-pos)) + ) + (set! (-> a1-5 quad) (-> s5-0 trans quad)) + (vector+! a1-5 a1-5 v1-9) + (move-to-point! (-> arg0 root-override) a1-5) + ) + (go (the-as (state ashelin) (method-of-object arg0 impact))) + ) + ) + 0 + (none) + ) + +;; definition for method 30 of type ashelin-shot +;; WARN: Return type mismatch symbol vs none. +(defmethod init-proj-collision! ashelin-shot ((obj ashelin-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (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) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (let ((v1-23 (-> obj parent))) + (when (not (logtest? (-> (the-as ashelin (if v1-23 + (the-as ashelin (-> v1-23 0 self)) + ) + ) + bot-flags + ) + (bot-flags attacked) + ) + ) + (let* ((a0-17 (-> obj root-override)) + (v1-27 (-> a0-17 root-prim)) + ) + (countdown (a0-18 (-> a0-17 total-prims)) + (logclear! (-> v1-27 prim-core collide-with) (collide-spec jak)) + (&+! v1-27 80) + ) + ) + ) + ) + (none) + ) + +;; definition for method 31 of type ashelin-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-proj-settings! ashelin-shot ((obj ashelin-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc +:virtual" + (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) + (set! (-> obj attack-mode) 'eco-yellow) + (set! (-> obj max-speed) 307200.0) + (set! (-> obj move) ashelin-shot-move) + (set! (-> obj timeout) (seconds 1.335)) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/characters/ashelin/ash-states_REF.gc b/test/decompiler/reference/jak2/characters/ashelin/ash-states_REF.gc index 73a88f7cfa..f692d26fee 100644 --- a/test/decompiler/reference/jak2/characters/ashelin/ash-states_REF.gc +++ b/test/decompiler/reference/jak2/characters/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 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -116,7 +116,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) (none) @@ -165,7 +165,7 @@ (ashelin-method-240 self a1-6) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (ashelin-method-247 self) ) (go-virtual chase) @@ -185,7 +185,7 @@ ) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (ashelin-method-239 self) ) ) @@ -267,7 +267,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (logclear! (-> self bot-flags) (bot-flags bf21)) (none) @@ -360,7 +360,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-165 self) (set! (-> self player-blocking) 0.0) (none) @@ -381,7 +381,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -427,7 +427,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -494,7 +494,7 @@ (nav-enemy-method-167 self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (if (not (handle->process (-> self focus handle))) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self travel-anim-interp) 0.0) (none) @@ -506,7 +506,7 @@ :code (behavior () (bot-method-223 self #t) (if (or (not (bot-method-214 self)) (not (ashelin-method-235 self #f))) - (enemy-method-72 self) + (react-to-focus self) ) (let ((v1-12 (ja-group))) (if (and v1-12 (or (= v1-12 (-> self draw art-group data 29)) (= v1-12 (-> self draw art-group data 28)))) @@ -537,7 +537,7 @@ (ashelin-method-245 self) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior ashelin) nav-enemy-simple-post) @@ -556,7 +556,7 @@ (bot-method-223 self #t) (cond ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -564,7 +564,7 @@ (go-virtual traveling) ) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (or (ashelin-method-238 self #t #f) (ashelin-method-248 self)) (go-virtual standing-idle) ) @@ -619,7 +619,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-167 self) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> self travel-anim-interp) 0.0) @@ -730,7 +730,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -762,7 +762,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-167 self) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> self travel-anim-interp) 0.0) @@ -866,7 +866,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -898,7 +898,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-167 self) (logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> self travel-anim-interp) 0.0) @@ -1002,7 +1002,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -1059,7 +1059,7 @@ (set! (-> self enemy-flags) v1-15) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1174,7 +1174,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc b/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc index 897fb4c8e6..aea4742e17 100644 --- a/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc +++ b/test/decompiler/reference/jak2/characters/ashelin/ash_REF.gc @@ -92,7 +92,72 @@ :default-hit-points 10 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak civilian enemy vehicle-sphere hit-by-others-list player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.7 :attack-shove-back (meters 3) @@ -168,8 +233,10 @@ (set! (-> *ashelin-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 59 of type ashelin -(defmethod enemy-method-59 ashelin ((obj ashelin)) - (let* ((t9-0 (method-of-type bot enemy-method-59)) +(defmethod get-penetrate-info ashelin ((obj ashelin)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + (let* ((t9-0 (method-of-type bot get-penetrate-info)) (v0-0 (t9-0 obj)) ) (if (logtest? (bot-flags bf22) (-> obj bot-flags)) @@ -186,7 +253,7 @@ (set! (-> obj bot-flags) (logior (bot-flags bf22) (-> obj bot-flags))) (logclear! (-> obj bot-flags) (bot-flags bf22)) ) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (none) ) @@ -347,8 +414,8 @@ ;; definition for method 114 of type ashelin ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 ashelin ((obj ashelin)) - "@abstract" +(defmethod init-enemy-collision! ashelin ((obj ashelin)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -404,8 +471,8 @@ ;; definition for method 115 of type ashelin ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 ashelin ((obj ashelin)) - "@abstract" +(defmethod init-enemy! ashelin ((obj ashelin)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (set! (-> obj channel) (the-as uint 22)) (set! (-> obj travel-anim-interp) 0.0) @@ -417,7 +484,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-ashelin" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *ashelin-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *ashelin-nav-enemy-info*) (let ((v1-10 (-> obj neck))) (set! (-> v1-10 up) (the-as uint 1)) (set! (-> v1-10 nose) (the-as uint 2)) @@ -425,7 +492,7 @@ (set-vector! (-> v1-10 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-10 ignore-angle) 30947.555) ) - (let ((t9-4 (method-of-type bot enemy-method-115))) + (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -673,7 +740,7 @@ (bot-method-223 obj #t) (cond ((not (bot-method-214 obj)) - (enemy-method-72 obj) + (react-to-focus obj) ) ((ashelin-method-238 obj #t #f) (go (method-of-object obj standing-idle)) @@ -689,7 +756,8 @@ ) ;; definition for method 72 of type ashelin -(defmethod enemy-method-72 ashelin ((obj ashelin)) +(defmethod react-to-focus ashelin ((obj ashelin)) + "@TODO - flesh out docs" (if (bot-method-214 obj) (go-hostile obj) (ashelin-method-239 obj) @@ -1368,7 +1436,7 @@ ;; definition for method 136 of type ashelin (defmethod enemy-method-136 ashelin ((obj ashelin)) (with-pp - (when (>= (- (-> pp clock frame-counter) (the-as int (-> obj hit-focus-time))) (seconds 2)) + (when (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) (let ((v0-0 (logclear (-> obj enemy-flags) (enemy-flag look-at-focus)))) (set! (-> obj enemy-flags) v0-0) v0-0 diff --git a/test/decompiler/reference/jak2/characters/sig/sig-shot_REF.gc b/test/decompiler/reference/jak2/characters/sig/sig-shot_REF.gc index f6a80868c8..8a15cc92fd 100644 --- a/test/decompiler/reference/jak2/characters/sig/sig-shot_REF.gc +++ b/test/decompiler/reference/jak2/characters/sig/sig-shot_REF.gc @@ -405,7 +405,7 @@ ) ;; definition for method 28 of type sig-shot -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound sig-shot ((obj sig-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -417,7 +417,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; definition for method 38 of type sig-shot @@ -470,7 +471,7 @@ ;; definition for method 30 of type sig-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! sig-shot ((obj sig-shot)) +(defmethod init-proj-collision! sig-shot ((obj sig-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/characters/sig/sig-states_REF.gc b/test/decompiler/reference/jak2/characters/sig/sig-states_REF.gc index 3004feab14..1c2ed689d9 100644 --- a/test/decompiler/reference/jak2/characters/sig/sig-states_REF.gc +++ b/test/decompiler/reference/jak2/characters/sig/sig-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 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-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)) @@ -78,7 +78,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -182,7 +182,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -314,7 +314,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -506,7 +506,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (set! (-> self plasma flags) (logand -29 (-> self plasma flags))) @@ -658,7 +658,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (-> self bot-flags) (bot-flags attacked)) @@ -842,7 +842,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (if (logtest? (-> self bot-flags) (bot-flags attacked)) @@ -953,7 +953,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-166 self) (set! (-> self skel top-anim interp) 1.0) (set! (-> self player-blocking) 0.0) @@ -978,7 +978,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -1024,7 +1024,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -1261,7 +1261,7 @@ (if (logtest? (-> self bot-flags) (bot-flags attacked)) (reset-attacker! self) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -1290,7 +1290,7 @@ (nav-enemy-method-167 self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (if (not (handle->process (-> self focus handle))) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) @@ -1330,7 +1330,7 @@ (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) (or (not (bot-method-214 self)) (not (sig-method-245 self))) ) - (enemy-method-72 self) + (react-to-focus self) ) (suspend) (ja :num! (seek! f30-1)) @@ -1353,7 +1353,7 @@ (if (logtest? (-> self bot-flags) (bot-flags attacked)) (reset-attacker! self) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior sig) nav-enemy-simple-post) @@ -1372,7 +1372,7 @@ (bot-method-223 self #t) (cond ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -1552,7 +1552,7 @@ (set! (-> self enemy-flags) v1-39) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1665,7 +1665,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -1728,7 +1728,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (set! (-> self bot-flags) (logior (bot-flags bf24) (-> self bot-flags))) @@ -1801,7 +1801,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -1871,7 +1871,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (set! (-> self bot-flags) (logior (bot-flags bf24) (-> self bot-flags))) @@ -1950,7 +1950,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (none) @@ -2020,7 +2020,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self skel top-anim interp) 0.0) (set! (-> self travel-anim-interp) 0.0) (vector-reset! (-> self root-override2 transv)) @@ -2051,7 +2051,3 @@ ) :post (the-as (function none :behavior sig) nav-enemy-simple-post) ) - - - - diff --git a/test/decompiler/reference/jak2/characters/sig/sig_REF.gc b/test/decompiler/reference/jak2/characters/sig/sig_REF.gc index 59c99dbf4c..b1750f0c1e 100644 --- a/test/decompiler/reference/jak2/characters/sig/sig_REF.gc +++ b/test/decompiler/reference/jak2/characters/sig/sig_REF.gc @@ -94,7 +94,72 @@ :default-hit-points 20 :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list) :overlaps-others-collide-with-filter (collide-spec jak civilian enemy vehicle-sphere hit-by-others-list player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.7 :attack-shove-back (meters 3) @@ -319,7 +384,9 @@ ;; WARN: Return type mismatch none vs object. ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 33] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 38] -(defmethod enemy-method-74 sig ((obj sig) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler sig ((obj sig) (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" (let ((v1-0 arg2)) (the-as object (cond ((= v1-0 'untrigger) @@ -337,7 +404,7 @@ ) ) (else - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -345,7 +412,11 @@ ) ;; definition for method 55 of type sig -(defmethod enemy-method-55 sig ((obj sig)) +(defmethod track-target! sig ((obj 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 +@TODO Not extremely well understood yet" (with-pp (let ((v1-2 (-> obj skel top-anim frame-group))) (cond @@ -391,15 +462,13 @@ ) ) ) - (let ((t9-2 (method-of-type bot enemy-method-55))) + (let ((t9-2 (method-of-type bot track-target!))) (t9-2 obj) ) (when (logtest? (-> obj bot-flags) (bot-flags too-far-fail)) (let ((f0-0 (vector-vector-distance (-> obj root-override2 trans) (target-pos 0)))) (when (or (>= f0-0 491520.0) - (and (>= f0-0 102400.0) - (>= (- (-> pp clock frame-counter) (the-as int (-> obj last-draw-time))) (seconds 10)) - ) + (and (>= f0-0 102400.0) (>= (- (-> pp clock frame-counter) (-> obj last-draw-time)) (seconds 10))) ) (process-entity-status! obj (entity-perm-status no-kill) #f) (cleanup-for-death obj) @@ -503,8 +572,8 @@ ;; definition for method 114 of type sig ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 sig ((obj sig)) - "@abstract" +(defmethod init-enemy-collision! sig ((obj sig)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -595,8 +664,8 @@ ;; definition for method 115 of type sig ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 sig ((obj sig)) - "@abstract" +(defmethod init-enemy! sig ((obj sig)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (set! (-> obj channel) (the-as uint 21)) (set! (-> obj notice-enemy-dist) 122880.0) @@ -611,7 +680,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-sig" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *sig-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *sig-nav-enemy-info*) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 147) obj)) (add-connection *part-engine* obj 23 obj 671 (new 'static 'sphere :y 327.68 :z 7536.64 :r 163840.0)) (set! (-> obj skel interp-select 0) (the-as int (the-as uint #x1ffc007ffff0))) @@ -628,7 +697,7 @@ (set-vector! (-> v1-26 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-26 ignore-angle) 30947.555) ) - (let ((t9-10 (method-of-type bot enemy-method-115))) + (let ((t9-10 (method-of-type bot init-enemy!))) (t9-10 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -687,7 +756,7 @@ (bot-method-223 obj #t) (cond ((not (bot-method-214 obj)) - (enemy-method-72 obj) + (react-to-focus obj) ) ((sig-method-246 obj) (go (method-of-object obj whip)) @@ -703,7 +772,8 @@ ) ;; definition for method 72 of type sig -(defmethod enemy-method-72 sig ((obj sig)) +(defmethod react-to-focus sig ((obj sig)) + "@TODO - flesh out docs" (cond ((bot-method-214 obj) (go-hostile obj) 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 5899179b4f..94793f36bc 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy-h_REF.gc @@ -64,8 +64,8 @@ (default-hit-points int32 :offset-assert 156) (gnd-collide-with collide-spec :offset-assert 160) (overlaps-others-collide-with-filter collide-spec :offset-assert 164) - (penetrate-flinch uint64 :offset-assert 168) - (penetrate-knocked uint64 :offset-assert 176) + (penetrate-flinch penetrate :offset-assert 168) + (penetrate-knocked penetrate :offset-assert 176) (movement-gravity meters :offset-assert 184) (friction float :offset-assert 188) (slip-factor float :offset-assert 192) @@ -379,14 +379,14 @@ (penetrated-by-all penetrate :offset-assert 256) (penetrated-flinch penetrate :offset-assert 264) (penetrated-knocked penetrate :offset-assert 272) - (reaction-time uint64 :offset-assert 280) - (notice-time uint64 :offset-assert 288) - (state-timeout uint64 :offset-assert 296) - (auto-reset-penetrate-time uint64 :offset-assert 304) - (hit-focus-time uint64 :offset-assert 312) - (last-draw-time uint64 :offset-assert 320) - (starting-time uint64 :offset-assert 328) - (fated-time uint64 :offset-assert 336) + (reaction-time time-frame :offset-assert 280) + (notice-time time-frame :offset-assert 288) + (state-timeout time-frame :offset-assert 296) + (auto-reset-penetrate-time time-frame :offset-assert 304) + (hit-focus-time time-frame :offset-assert 312) + (last-draw-time time-frame :offset-assert 320) + (starting-time time-frame :offset-assert 328) + (fated-time time-frame :offset-assert 336) (focus-pos vector :inline :offset-assert 352) (event-param-point vector :inline :offset-assert 368) (jump-dest vector :inline :offset 368) @@ -435,15 +435,15 @@ (enemy-method-52 (_type_ vector) none 52) (enemy-method-53 (_type_ process-focusable) symbol 53) (enemy-method-54 (_type_) enemy-flag 54) - (enemy-method-55 (_type_) none 55) - (enemy-method-56 (_type_ process event-message-block) int 56) - (enemy-method-57 (_type_ process-focusable enemy-best-focus) enemy-aware 57) + (track-target! (_type_) none 55) + (damage-amount-from-attack (_type_ process event-message-block) int 56) + (update-target-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware 57) (enemy-method-58 (_type_ process event-message-block) symbol 58) - (enemy-method-59 (_type_) penetrate 59) + (get-penetrate-info (_type_) penetrate 59) (coin-flip? (_type_) symbol 60) (enemy-method-61 (_type_ int) int :behavior enemy 61) (enemy-method-62 (_type_) none 62) - (enemy-method-63 (_type_ process-focusable symbol) symbol 63) + (enemy-method-63 (_type_ process-focusable enemy-aware) symbol 63) (enemy-method-64 (_type_) none 64) (enemy-method-65 (_type_) none 65) (go-ambush (_type_) none 66) @@ -452,9 +452,9 @@ (go-directed (_type_) none 69) (go-hostile (_type_) none 70) (go-flee (_type_) none 71) - (enemy-method-72 (_type_) none 72) - (enemy-method-73 (_type_) none 73) - (enemy-method-74 (_type_ process object symbol event-message-block) object 74) + (react-to-focus (_type_) none 72) + (kill-prefer-falling (_type_) none 73) + (general-event-handler (_type_ process int symbol event-message-block) object 74) (enemy-method-75 (_type_ process touching-shapes-entry) none 75) (enemy-method-76 (_type_ process event-message-block) symbol 76) (enemy-method-77 (_type_ (pointer float)) symbol 77) @@ -478,7 +478,7 @@ (enemy-method-95 (_type_ vector float) symbol 95) (enemy-method-96 (_type_ float symbol) symbol 96) (enemy-method-97 (_type_) process 97) - (enemy-method-98 (_type_ process-focusable vector) symbol 98) + (in-aggro-range? (_type_ process-focusable vector) symbol 98) (enemy-method-99 (_type_ process-focusable) symbol 99) (enemy-method-100 (_type_) symbol 100) (enemy-method-101 (_type_) none 101) @@ -487,15 +487,15 @@ (enemy-method-104 (_type_ process uint 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) - (enemy-method-107 (_type_) process-focusable 107) + (get-enemy-target (_type_) process-focusable 107) (enemy-method-108 (_type_ enemy event-message-block) int 108) - (enemy-method-109 (_type_ int) none 109) - (enemy-method-110 (_type_) none 110) + (look-at-target! (_type_ enemy-flag) none 109) + (stop-looking-at-target! (_type_) none 110) (enemy-method-111 (_type_) none :behavior enemy 111) - (enemy-method-112 (_type_ enemy-info) none 112) - (enemy-method-113 (_type_ enemy-info) none 113) - (enemy-method-114 (_type_) none 114) - (enemy-method-115 (_type_) none 115) + (set-enemy-info! (_type_ enemy-info) none 112) + (init-enemy-behaviour-and-stats! (_type_ enemy-info) none 113) + (init-enemy-collision! (_type_) none 114) + (init-enemy! (_type_) none 115) (go-idle (_type_) none 116) (get-rand-float (_type_) float 117) (get-rand-float-range (_type_ float float) float 118) @@ -506,13 +506,13 @@ (enemy-method-123 (_type_ float) symbol 123) (enemy-method-124 (_type_) collide-spec 124) (enemy-method-125 (_type_ collide-query collide-spec float float float) pat-surface 125) - (enemy-method-126 (_type_ collide-query vector collide-spec float float float) symbol 126) + (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol 126) (enemy-method-127 (_type_ float float symbol collide-spec) symbol 127) (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) - (enemy-method-132 (_type_) none 132) + (dispose! (_type_) none 132) (enemy-method-133 (_type_) symbol 133) (enemy-method-134 (_type_ process attack-info) process-focusable 134) (enemy-method-135 (_type_ int) sound-id 135) @@ -715,7 +715,7 @@ (set! (-> obj aware) (the-as enemy-aware - (enemy-method-61 arg1 (the-as int (enemy-method-57 arg1 arg0 (the-as enemy-best-focus #f)))) + (enemy-method-61 arg1 (the-as int (update-target-awareness! arg1 arg0 (the-as enemy-best-focus #f)))) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc index 724ec9a8b8..34e244fae9 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc @@ -204,7 +204,9 @@ ) ;; definition for method 59 of type enemy -(defmethod enemy-method-59 enemy ((obj enemy)) +(defmethod get-penetrate-info enemy ((obj enemy)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (penetrated-by-all&hit-points->penetrated-by (-> obj penetrated-by-all) (-> obj hit-points)) ) @@ -303,10 +305,14 @@ ;; definition for method 55 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 enemy ((obj enemy)) +(defmethod track-target! enemy ((obj 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" (with-pp (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) - (set! (-> obj last-draw-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj last-draw-time) (-> pp clock frame-counter)) ) (enemy-method-129 obj) (if (logtest? (enemy-flag use-trigger) (-> obj enemy-flags)) @@ -334,10 +340,10 @@ ) ) (when (and (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (the-as int (-> obj auto-reset-penetrate-time))) (seconds 0.1)) + (>= (- (-> pp clock frame-counter) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) ) (logclear! (-> obj enemy-flags) (enemy-flag attackable-backup)) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((v1-48 0)) (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) (set! v1-48 (logior (shl 1 32) v1-48)) @@ -363,7 +369,7 @@ ;; definition for method 136 of type enemy (defmethod enemy-method-136 enemy ((obj enemy)) (with-pp - (when (or (>= (- (-> pp clock frame-counter) (the-as int (-> obj hit-focus-time))) (seconds 2)) + (when (or (>= (- (-> pp clock frame-counter) (-> obj hit-focus-time)) (seconds 2)) (and (handle->process (-> obj focus handle)) (zero? (logand (-> (the-as process-focusable (handle->process (-> obj focus handle))) focus-status) (focus-status disable dead ignore grabbed) @@ -411,7 +417,8 @@ ;; definition for method 107 of type enemy ;; WARN: Return type mismatch process vs process-focusable. -(defmethod enemy-method-107 enemy ((obj enemy)) +(defmethod get-enemy-target enemy ((obj enemy)) + "@returns the [[process-focusable]] that the enemy is currently focusing on, or [[#f]] otherwise" (let ((v0-0 (handle->process (-> obj focus handle)))) (if (and v0-0 (not (and v0-0 @@ -426,9 +433,9 @@ ) ;; definition for method 63 of type enemy -(defmethod enemy-method-63 enemy ((obj enemy) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 enemy ((obj enemy) (arg0 process-focusable) (arg1 enemy-aware)) (if arg1 - (enemy-focus-method-13 (-> obj focus) arg0 (the-as enemy-aware arg1)) + (enemy-focus-method-13 (-> obj focus) arg0 arg1) (try-update-focus (-> obj focus) arg0 obj) ) ) @@ -444,7 +451,7 @@ ) ) (when (enemy-method-53 obj (the-as process-focusable s5-0)) - (enemy-method-63 obj (the-as process-focusable s5-0) #f) + (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) (logior! (-> obj focus flags) (enemy-flag lock-focus)) ) ) @@ -560,10 +567,11 @@ ) ;; definition for method 72 of type enemy -(defmethod enemy-method-72 enemy ((obj enemy)) +(defmethod react-to-focus enemy ((obj enemy)) + "@TODO - flesh out docs" (let ((s5-0 (-> obj focus aware))) (cond - ((and (= s5-0 (enemy-aware enemy-aware-3)) (enemy-method-107 obj)) + ((and (= s5-0 (enemy-aware enemy-aware-3)) (get-enemy-target obj)) (go-hostile obj) ) ((<= (the-as int s5-0) 0) @@ -572,7 +580,7 @@ ((>= 1 (the-as int s5-0)) (go (method-of-object obj active)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go-flee obj) ) (else @@ -587,14 +595,15 @@ (defmethod enemy-method-93 enemy ((obj enemy)) (if (logtest? (enemy-flag alert) (-> obj enemy-flags)) (go-directed obj) - (enemy-method-72 obj) + (react-to-focus obj) ) (none) ) ;; definition for method 73 of type enemy ;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-73 enemy ((obj enemy)) +(defmethod kill-prefer-falling enemy ((obj enemy)) + "If available in `enemy-info`, [[go]] to the [[die-falling]] state, if not, [[die]]" (if (-> obj enemy-info use-die-falling) (go (method-of-object obj die-falling)) (go (method-of-object obj die)) @@ -712,8 +721,8 @@ (or (not v1-10) (zero? (logand (-> obj focus flags) (enemy-flag lock-focus)))) ) ) - (enemy-method-63 obj (the-as process-focusable s5-0) #f) - (set! (-> obj hit-focus-time) (the-as uint (-> pp clock frame-counter))) + (enemy-method-63 obj (the-as process-focusable s5-0) (the-as enemy-aware #f)) + (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) (let ((v0-3 (logior (-> obj enemy-flags) (enemy-flag look-at-focus)))) (set! (-> obj enemy-flags) v0-3) v0-3 @@ -729,7 +738,7 @@ (defmethod enemy-method-49 enemy ((obj enemy)) (logior! (-> obj enemy-flags) (enemy-flag attackable-backup)) (let ((v0-0 (-> self clock frame-counter))) - (set! (-> obj auto-reset-penetrate-time) (the-as uint v0-0)) + (set! (-> obj auto-reset-penetrate-time) v0-0) v0-0 ) ) @@ -828,13 +837,15 @@ ;; definition for method 109 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-109 enemy ((obj enemy) (arg0 int)) +(defmethod look-at-target! enemy ((obj enemy) (arg0 enemy-flag)) + "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available +@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" (case arg0 - ((1) + (((enemy-flag lock-focus)) (logclear! (-> obj enemy-flags) (enemy-flag death-start)) (logior! (-> obj enemy-flags) (enemy-flag lock-focus)) ) - ((2) + (((enemy-flag death-start)) (logclear! (-> obj enemy-flags) (enemy-flag lock-focus)) (logior! (-> obj enemy-flags) (enemy-flag death-start)) ) @@ -848,7 +859,8 @@ ;; definition for method 110 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-110 enemy ((obj enemy)) +(defmethod stop-looking-at-target! enemy ((obj enemy)) + "Will unset [[enemy-flag::death-start]] and [[enemy-flag::lock-focus]] and call [[joint-mod::shut-down]] if applicable" (when (nonzero? (-> obj neck)) (logclear! (-> obj enemy-flags) (enemy-flag lock-focus death-start)) (shut-down (-> obj neck)) @@ -868,7 +880,9 @@ ) ;; definition for method 126 of type enemy -(defmethod enemy-method-126 enemy ((obj enemy) (arg0 collide-query) (arg1 vector) (arg2 collide-spec) (arg3 float) (arg4 float) (arg5 float)) +(defmethod enemy-above-ground? enemy ((obj enemy) (arg0 collide-query) (arg1 vector) (arg2 collide-spec) (arg3 float) (arg4 float) (arg5 float)) + "@returns if the enemy is above the ground or not +@see [[above-ground?]]" (above-ground? (-> obj root-override2) arg0 arg1 arg2 arg3 arg4 arg5) ) @@ -1057,16 +1071,16 @@ ;; definition for method 114 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 enemy ((obj enemy)) - "@abstract" +(defmethod init-enemy-collision! enemy ((obj enemy)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" 0 (none) ) ;; definition for method 115 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 enemy ((obj enemy)) - "@abstract" +(defmethod init-enemy! enemy ((obj enemy)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" 0 (none) ) @@ -1080,7 +1094,9 @@ ;; definition for method 112 of type enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-112 enemy ((obj enemy) (arg0 enemy-info)) +(defmethod set-enemy-info! enemy ((obj enemy) (arg0 enemy-info)) + "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it +@param info Set `enemy-info` accordingly" (set! (-> obj enemy-info) arg0) (when (and (!= (-> obj enemy-info neck-joint) -1) (zero? (-> obj neck))) (set! (-> obj neck) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj (-> obj enemy-info neck-joint))) @@ -1098,7 +1114,8 @@ ;; definition for method 113 of type enemy ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-113 enemy ((obj enemy) (arg0 enemy-info)) +(defmethod init-enemy-behaviour-and-stats! enemy ((obj enemy) (arg0 enemy-info)) + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" (local-vars (sv-16 res-tag)) (when (coin-flip? obj) (let ((a0-2 (-> obj node-list data 2))) @@ -1111,7 +1128,7 @@ (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask))) (logior! (-> obj mask) (process-mask actor-pause)) (logior! (-> obj enemy-flags) (enemy-flag notice)) - (enemy-method-112 obj arg0) + (set-enemy-info! obj arg0) (let ((a1-2 (-> obj enemy-info idle-anim-script))) (if a1-2 (idle-control-method-9 (-> obj idle-anim-player) a1-2) @@ -1195,12 +1212,12 @@ ) (let ((s4-0 (-> obj root-override2))) (set! (-> obj penetrated-by-all) (-> s4-0 penetrated-by)) - (set! (-> s4-0 penetrated-by) (enemy-method-59 obj)) + (set! (-> s4-0 penetrated-by) (get-penetrate-info obj)) (set! (-> s4-0 event-self) 'touched) ) - (set! (-> obj penetrated-flinch) (the-as penetrate (-> arg0 penetrate-flinch))) - (set! (-> obj penetrated-knocked) (the-as penetrate (-> arg0 penetrate-knocked))) - (set! (-> obj reaction-time) (the-as uint (get-rand-int-range obj 30 180))) + (set! (-> obj penetrated-flinch) (-> arg0 penetrate-flinch)) + (set! (-> obj penetrated-knocked) (-> arg0 penetrate-knocked)) + (set! (-> obj reaction-time) (the-as time-frame (get-rand-int-range obj 30 180))) (let* ((v1-79 (-> obj enemy-flags)) (a0-28 (-> obj fact-info-override enemy-options)) (v1-80 (logior (enemy-flag @@ -1251,11 +1268,11 @@ (if (-> arg1 scale z) (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> self enemy-flags)))) ) - (enemy-method-114 self) + (init-enemy-collision! self) (set! (-> self root-override2 trans quad) (-> arg1 trans quad)) (quaternion-copy! (-> self root-override2 quat) (-> arg1 quat)) (vector-identity! (-> self root-override2 scale)) - (enemy-method-115 self) + (init-enemy! self) (when (> (-> self enemy-info gem-joint) 0) (cond ((and (or (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status save))) @@ -1315,9 +1332,9 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (enemy-method-114 obj) + (init-enemy-collision! obj) (process-drawable-from-entity! obj arg0) - (enemy-method-115 obj) + (init-enemy! obj) (when (>= (-> obj enemy-info gem-joint) 0) (cond ((and (or (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status save))) @@ -1368,7 +1385,12 @@ This commonly includes things such as: ) ;; definition for method 98 of type enemy -(defmethod enemy-method-98 enemy ((obj enemy) (arg0 process-focusable) (arg1 vector)) +(defmethod in-aggro-range? enemy ((obj enemy) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" #t ) @@ -1405,11 +1427,12 @@ This commonly includes things such as: (enemy-method-97 obj) (return #f) ) - (let ((v1-14 (enemy-method-61 - obj - (the-as int (enemy-method-57 obj (the-as process-focusable a1-0) (the-as enemy-best-focus #f))) - ) - ) + (let ((v1-14 + (enemy-method-61 + obj + (the-as int (update-target-awareness! obj (the-as process-focusable a1-0) (the-as enemy-best-focus #f))) + ) + ) ) (set! (-> gp-0 aware) (the-as enemy-aware v1-14)) (if (>= 1 v1-14) @@ -1457,7 +1480,7 @@ This commonly includes things such as: ) ) (if (and a1-1 (and a1-1 (zero? (logand (-> a1-1 focus-status) (focus-status disable dead)))) (!= obj a1-1)) - (enemy-method-57 obj a1-1 gp-0) + (update-target-awareness! obj a1-1 gp-0) ) ) ) @@ -1484,7 +1507,7 @@ This commonly includes things such as: ) ) (if (and a1-3 (and a1-3 (zero? (logand (-> a1-3 focus-status) (focus-status disable dead)))) (!= obj a1-3)) - (enemy-method-57 obj a1-3 gp-0) + (update-target-awareness! obj a1-3 gp-0) ) ) ) @@ -1510,7 +1533,7 @@ This commonly includes things such as: ) ) (if (and a1-5 (and a1-5 (zero? (logand (-> a1-5 focus-status) (focus-status disable dead)))) (!= obj a1-5)) - (enemy-method-57 obj a1-5 gp-0) + (update-target-awareness! obj a1-5 gp-0) ) ) ) @@ -1528,7 +1551,7 @@ This commonly includes things such as: (enemy-method-63 obj (the-as process-focusable s4-1) - (the-as symbol (enemy-method-61 obj (the-as int (-> gp-0 aware)))) + (the-as enemy-aware (enemy-method-61 obj (the-as int (-> gp-0 aware)))) ) s4-1 ) @@ -1538,7 +1561,10 @@ This commonly includes things such as: ;; definition for method 57 of type enemy ;; WARN: Return type mismatch int vs enemy-aware. -(defmethod enemy-method-57 enemy ((obj enemy) (arg0 process-focusable) (arg1 enemy-best-focus)) +(defmethod update-target-awareness! enemy ((obj enemy) (arg0 process-focusable) (arg1 enemy-best-focus)) + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! +@TODO - flesh out docs +@returns the value that sets `aware`" (let ((f30-0 (vector-vector-distance (get-trans arg0 0) (-> obj root-override2 trans))) (s3-1 #f) (s2-0 #f) @@ -1546,7 +1572,7 @@ This commonly includes things such as: (cond ((< f30-0 (-> obj enemy-info proximity-notice-distance)) (set! s3-1 #t) - (set! s2-0 (enemy-method-98 obj arg0 (the-as vector #f))) + (set! s2-0 (in-aggro-range? obj arg0 (the-as vector #f))) ) (else (let ((f0-1 (the-as float (-> obj enemy-info notice-distance)))) @@ -1554,7 +1580,7 @@ This commonly includes things such as: (set! f0-1 (+ (the-as meters f0-1) (-> obj enemy-info notice-distance-delta))) ) (when (or (< f30-0 f0-1) (zero? (logand (-> obj enemy-flags) (enemy-flag enable-on-notice)))) - (set! s2-0 (enemy-method-98 obj arg0 (the-as vector #f))) + (set! s2-0 (in-aggro-range? obj arg0 (the-as vector #f))) (if s2-0 (set! s3-1 #t) ) @@ -1652,12 +1678,10 @@ This commonly includes things such as: (v1-1 (when (not (logtest? (-> obj enemy-flags) (enemy-flag spawn-gem))) (logior! (-> obj enemy-flags) (enemy-flag spawn-gem)) - (set! (-> obj notice-time) (the-as uint (-> self clock frame-counter))) + (set! (-> obj notice-time) (-> self clock frame-counter)) ) (if (and (not (logtest? (-> obj enemy-flags) (enemy-flag chase-startup))) - (< (- (-> self clock frame-counter) (the-as int (-> obj notice-time))) - (the-as time-frame (-> obj reaction-time)) - ) + (< (- (-> self clock frame-counter) (-> obj notice-time)) (-> obj reaction-time)) ) (set! v1-1 #f) ) @@ -1670,7 +1694,7 @@ This commonly includes things such as: (v1-1 arg0 ) - ((or (zero? arg0) (>= (- (-> self clock frame-counter) (the-as int (-> obj last-draw-time))) (seconds 2))) + ((or (zero? arg0) (>= (- (-> self clock frame-counter) (-> obj last-draw-time)) (seconds 2))) 0 ) (else @@ -1701,7 +1725,9 @@ This commonly includes things such as: ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 814] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 850] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 933] -(defmethod enemy-method-74 enemy ((obj enemy) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler enemy ((obj enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (s5-5 rgbaf) (sv-432 process) (sv-448 event-message-block)) (with-pp (the-as @@ -1750,7 +1776,7 @@ This commonly includes things such as: (collide-action) ) ) - (set! (-> obj auto-reset-penetrate-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj auto-reset-penetrate-time) (-> pp clock frame-counter)) ) ) ) @@ -1766,7 +1792,7 @@ This commonly includes things such as: (set! (-> v1-31 prim-core collide-with) (collide-spec)) ) 0 - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ) ) @@ -1797,7 +1823,7 @@ This commonly includes things such as: (enemy-method-108 obj (the-as enemy arg0) arg3) (let ((a1-13 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-13 from) (process->ppointer arg0)) - (set! (-> a1-13 num-params) (the-as int arg1)) + (set! (-> a1-13 num-params) arg1) (set! (-> a1-13 message) (the-as symbol s2-1)) (set! (-> a1-13 param 0) (-> arg3 param 0)) (set! (-> a1-13 param 1) (-> arg3 param 1)) @@ -1833,7 +1859,7 @@ This commonly includes things such as: (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) (process-contact-action arg0) (send-event arg0 'get-attack-count 1) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) #t ) @@ -1876,7 +1902,7 @@ This commonly includes things such as: (process-contact-action arg0) (send-event arg0 'get-attack-count 1) (if (zero? (-> obj hit-points)) - (enemy-method-73 obj) + (kill-prefer-falling obj) (go (method-of-object obj hit)) ) ) @@ -1918,7 +1944,7 @@ This commonly includes things such as: (logclear! (-> obj enemy-flags) (enemy-flag alert victory called-dying)) (if (logtest? (enemy-option ambush) (-> obj fact-info-override enemy-options)) (go-ambush obj) - (enemy-method-72 obj) + (react-to-focus obj) ) #t ) @@ -1959,7 +1985,7 @@ This commonly includes things such as: ((= arg2 'instant-death) (when (and (> (-> obj hit-points) 0) (zero? (-> obj fated-time))) (set! (-> obj hit-points) 0) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((s5-2 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) (vector-z-quaternion! s5-2 (-> obj root-override2 quat)) (vector-float*! s5-2 s5-2 -1.0) @@ -1976,12 +2002,12 @@ This commonly includes things such as: (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) (enemy-method-62 obj) (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ) ((= arg2 'die-fast) (logior! (-> obj draw status) (draw-control-status no-draw)) - (enemy-method-132 obj) + (dispose! obj) (send-event (ppointer->process (-> obj parent)) 'child-die) (let ((s5-3 (-> obj on-death))) (if s5-3 @@ -2058,7 +2084,8 @@ This commonly includes things such as: ) ;; definition for method 56 of type enemy -(defmethod enemy-method-56 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack enemy ((obj enemy) (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]]" (let ((v1-0 (the-as attack-info (-> arg1 param 1)))) (if (logtest? (attack-info-mask damage) (-> v1-0 mask)) (the int (-> v1-0 damage)) @@ -2087,18 +2114,18 @@ This commonly includes things such as: ;; definition for method 48 of type enemy (defmethod enemy-method-48 enemy ((obj enemy) (arg0 process) (arg1 event-message-block)) (with-pp - (let* ((v1-1 (enemy-method-56 obj arg0 arg1)) + (let* ((v1-1 (damage-amount-from-attack obj arg0 arg1)) (s5-0 (-> obj hit-points)) (s4-1 (max 0 (- s5-0 v1-1))) ) (when (and (zero? s4-1) (nonzero? s5-0) (= (-> obj incoming knocked-type) (knocked-type knocked-type-6))) (cond ((zero? (-> obj fated-time)) - (set! (-> obj fated-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj fated-time) (-> pp clock frame-counter)) (set! s4-1 1) ) (else - (if (< (- (-> pp clock frame-counter) (the-as int (-> obj fated-time))) (seconds 1)) + (if (< (- (-> pp clock frame-counter) (-> obj fated-time)) (seconds 1)) (set! s4-1 1) ) ) @@ -2106,7 +2133,7 @@ This commonly includes things such as: ) (set! (-> obj hit-points) s4-1) (if (not (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup))) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) ) (- s5-0 s4-1) ) @@ -2209,13 +2236,13 @@ This commonly includes things such as: ;; definition for function enemy-event-handler (defbehavior enemy-event-handler enemy ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (enemy-method-74 self arg0 arg1 arg2 arg3) + (general-event-handler self arg0 arg1 arg2 arg3) ) ;; definition for function enemy-simple-post ;; WARN: Return type mismatch int vs none. (defbehavior enemy-simple-post enemy () - (enemy-method-55 self) + (track-target! self) (update-transforms (-> self root-override2)) 0 (none) @@ -2246,7 +2273,7 @@ This commonly includes things such as: ) ) (enemy-method-111 self) - (enemy-method-55 self) + (track-target! self) (none) ) @@ -2286,7 +2313,7 @@ This commonly includes things such as: (move-to-point! gp-0 s5-1) ) ) - (enemy-method-55 self) + (track-target! self) 0 (none) ) @@ -2297,10 +2324,10 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-110 self) + (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)) - (set! (-> self state-timeout) (the-as uint 150)) + (set! (-> self state-timeout) (seconds 0.5)) (if (-> self on-notice) (logior! (-> self enemy-flags) (enemy-flag auto-reset-penetrate)) ) @@ -2319,7 +2346,7 @@ This commonly includes things such as: (none) ) :trans (behavior () - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -2334,7 +2361,7 @@ This commonly includes things such as: :post (behavior () (idle-control-method-10 (-> self idle-anim-player) self) (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-draw-time) (-> self clock frame-counter)) ) (enemy-method-129 self) (ja-post) @@ -2383,7 +2410,7 @@ This commonly includes things such as: :enter (-> (method-of-type enemy dormant) enter) :exit (-> (method-of-type enemy dormant) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (if (logtest? (enemy-option ambush) (-> self fact-info-override enemy-options)) @@ -2396,7 +2423,7 @@ This commonly includes things such as: :code (the-as (function none :behavior enemy) sleep-code) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-draw-time) (-> self clock frame-counter)) ) (enemy-method-129 self) (none) @@ -2480,7 +2507,7 @@ This commonly includes things such as: (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag called-dying))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (enemy-method-109 self 1) + (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)) (let ((gp-0 (-> self on-notice))) @@ -2495,10 +2522,10 @@ This commonly includes things such as: (let ((gp-1 (-> self focus aware))) (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) (cond - ((and (= gp-1 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-1 (enemy-aware enemy-aware-4)) + ((= gp-1 (enemy-aware unaware)) (go-flee self) ) (else @@ -2533,7 +2560,7 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post enemy-simple-post @@ -2545,7 +2572,7 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (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)) (logclear! (-> self mask) (process-mask actor-pause)) @@ -2567,12 +2594,12 @@ This commonly includes things such as: (go-virtual victory) ) (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -2613,10 +2640,10 @@ This commonly includes things such as: ((>= 1 (the-as int gp-0)) (go-virtual active) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -2674,7 +2701,7 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post enemy-simple-post @@ -2686,14 +2713,14 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logclear! (-> self enemy-flags) (enemy-flag dangerous-backup)) (logclear! (-> self mask) (process-mask actor-pause)) (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) - (if (!= (-> self focus aware) (enemy-aware enemy-aware-4)) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + (if (!= (-> self focus aware) (enemy-aware unaware)) (go-stare self) ) ) @@ -2730,7 +2757,7 @@ This commonly includes things such as: (set! (-> arg0 dest-pos quad) (-> obj event-param-point quad)) (set! (-> arg0 start-pos quad) (-> obj root-override2 trans quad)) (let ((s4-0 (new 'stack-no-clear 'collide-query))) - (if (enemy-method-126 + (if (enemy-above-ground? obj s4-0 (-> arg0 dest-pos) @@ -3076,7 +3103,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (enemy-method-110 self) + (stop-looking-at-target! self) (logclear! (-> self mask) (process-mask actor-pause)) (enemy-method-135 self 0) (none) @@ -3188,7 +3215,7 @@ This commonly includes things such as: ) (logclear! (-> obj enemy-flags) (enemy-flag directed)) (if (and (enemy-method-102 obj) (zero? (logand (-> obj focus-status) (focus-status dead)))) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (let ((s5-1 (-> obj root-override2)) (a1-2 (new 'stack-no-clear 'collide-query)) @@ -3474,7 +3501,7 @@ This commonly includes things such as: :event enemy-event-handler :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (logclear! (-> self mask) (process-mask actor-pause)) (let* ((v1-8 *game-info*) @@ -3520,7 +3547,7 @@ This commonly includes things such as: (set! (-> self desired-angle) (enemy-method-51 self)) ) (if (zero? (-> self hit-points)) - (enemy-method-132 self) + (dispose! self) (enemy-method-135 self 0) ) (logclear! (-> self focus-status) (focus-status dangerous)) @@ -3587,7 +3614,7 @@ This commonly includes things such as: (set! (-> gp-0 move-count) 0) (until (enemy-method-80 self gp-0) (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) - (enemy-method-73 self) + (kill-prefer-falling self) ) (if (logtest? (-> self root-override2 status) (collide-status on-surface)) (+! (-> gp-0 on-surface-count) 1) @@ -3623,7 +3650,7 @@ This commonly includes things such as: (enemy-method-102 self) ) ) - (enemy-method-73 self) + (kill-prefer-falling self) ) (while (not (enemy-method-79 self 4 gp-0)) (suspend) @@ -3648,7 +3675,7 @@ This commonly includes things such as: (cleanup-for-death self) ) (else - (enemy-method-73 self) + (kill-prefer-falling self) ) ) ) @@ -3662,7 +3689,8 @@ This commonly includes things such as: ) ;; definition for method 132 of type enemy -(defmethod enemy-method-132 enemy ((obj enemy)) +(defmethod dispose! enemy ((obj enemy)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (not (logtest? (enemy-flag recover-applied-velocity) (-> obj enemy-flags))) (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag recover-applied-velocity) (-> obj enemy-flags))) @@ -3700,7 +3728,7 @@ This commonly includes things such as: (if (-> obj skel effect) (logior! (-> obj skel effect flags) (effect-control-flag ecf1)) ) - (enemy-method-110 obj) + (stop-looking-at-target! obj) ) (none) ) @@ -3710,7 +3738,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (enemy-method-132 self) + (dispose! self) (let ((v1-3 (-> self root-override2 root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -3770,7 +3798,7 @@ This commonly includes things such as: :virtual #t :event enemy-event-handler :enter (behavior () - (enemy-method-132 self) + (dispose! self) (let ((v1-3 (-> self root-override2 root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) diff --git a/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc b/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc index 051b68f7c1..7dccafb7bc 100644 --- a/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc @@ -20,7 +20,7 @@ :flag-assert #xe00000018 (:methods (talker-speech-class-method-9 (_type_) symbol 9) - (talker-speech-class-method-10 (_type_) none 10) + (play-communicator-speech! (_type_) none 10) (talker-speech-class-method-11 (_type_) none 11) (talker-speech-class-method-12 (_type_ int) none 12) (talker-speech-class-method-13 (_type_ int) none 13) diff --git a/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc b/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc index 592a680f3c..8a442f253b 100644 --- a/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc +++ b/test/decompiler/reference/jak2/engine/ambient/ambient_REF.gc @@ -121,7 +121,9 @@ ;; definition for method 10 of type talker-speech-class ;; WARN: Return type mismatch int vs none. -(defmethod talker-speech-class-method-10 talker-speech-class ((obj talker-speech-class)) +(defmethod play-communicator-speech! talker-speech-class ((obj talker-speech-class)) + "Plays the provided [[talker-speech-class]] +@TODO - understand the array from [[game-info]] better" (set! (-> *game-info* unknown-pad6 (+ (* (-> obj speech) 2) 1)) (the-as uint #xffff)) 0 (none) @@ -180,7 +182,7 @@ ) (logtest? (-> arg0 flags) 1) ) - (talker-speech-class-method-10 arg0) + (play-communicator-speech! arg0) ) (set! s2-0 (lookup-gui-connection-id *gui-control* (-> arg0 name) (-> arg0 channel) (gui-action none))) (set! s2-0 (cond @@ -396,7 +398,7 @@ :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) (if (logtest? (-> self message flags) 1) - (talker-speech-class-method-10 (-> self message)) + (play-communicator-speech! (-> self message)) ) (set-setting! 'hint (process->ppointer self) 0 0) (set-setting! 'speech-control #f 0 0) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc index 3aa59623ae..6b1260659f 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc @@ -1329,7 +1329,7 @@ (set-collide-as! (_type_ collide-spec) none 48) (modify-collide-as! (_type_ int collide-spec collide-spec) none 49) (send-shoves (_type_ process touching-shapes-entry float float float) symbol 50) - (above-ground? (_type_ collide-query vector object float float float) symbol 51) + (above-ground? (_type_ collide-query vector collide-spec float float float) symbol 51) (water-info-init! (_type_ water-info collide-action) water-info 52) (iterate-prims (_type_ (function collide-shape-prim none)) none 53) (pusher-init (_type_) none 54) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc index 53a2f70b77..6741ee7966 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc @@ -1626,14 +1626,22 @@ ;; definition for method 51 of type collide-shape ;; INFO: Used lq/sq -(defmethod above-ground? collide-shape ((obj collide-shape) (arg0 collide-query) (arg1 vector) (arg2 object) (arg3 float) (arg4 float) (arg5 float)) +(defmethod above-ground? collide-shape ((obj collide-shape) + (arg0 collide-query) + (arg1 vector) + (arg2 collide-spec) + (arg3 float) + (arg4 float) + (arg5 float) + ) + "@returns if we are above ground or not" (set! (-> arg0 start-pos quad) (-> arg1 quad)) (+! (-> arg0 start-pos y) arg3) (vector-reset! (-> arg0 move-dist)) (set! (-> arg0 move-dist y) (- (+ arg3 arg4))) (let ((v1-2 arg0)) (set! (-> v1-2 radius) arg5) - (set! (-> v1-2 collide-with) (the-as collide-spec arg2)) + (set! (-> v1-2 collide-with) arg2) (set! (-> v1-2 ignore-process0) (-> obj process)) (set! (-> v1-2 ignore-process1) #f) (set! (-> v1-2 ignore-pat) (-> obj pat-ignore-mask)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc index 5f6b288d34..147d9eadb2 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc @@ -83,9 +83,9 @@ ;; definition for method 24 of type dark-eco-pool ;; WARN: Return type mismatch ripple-wave-set vs none. -(defmethod art-init! dark-eco-pool ((obj dark-eco-pool)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) +(defmethod init-water! dark-eco-pool ((obj dark-eco-pool)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) (t9-0 obj) ) (let ((s5-0 (new 'process 'ripple-control))) diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc index 26f63dd59e..cf163eea93 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc @@ -46,9 +46,9 @@ (spawn-impact-particles (_type_) none 25) (spawn-shell-particles (_type_) none 26) (unknown-particles (_type_) none 27) - (play-impact-sound (_type_ projectile-options) sound-id 28) + (play-impact-sound (_type_ projectile-options) none 28) (stop-sound! (_type_) none 29) - (init-collision! (_type_) none 30) + (init-proj-collision! (_type_) none 30) (init-proj-settings! (_type_) none 31) (go-moving! (_type_) none 32) (go-sitting! (_type_) none 33) diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc index 608d154c39..feb6f5ff72 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc @@ -156,9 +156,10 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p ) ;; definition for method 28 of type projectile -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound projectile ((obj projectile) (arg0 projectile-options)) - (the-as sound-id 0) + 0 + (none) ) ;; definition for method 29 of type projectile @@ -434,7 +435,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p ;; definition for method 30 of type projectile ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! projectile ((obj projectile)) +(defmethod init-proj-collision! projectile ((obj projectile)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -521,7 +522,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p (set! (-> self old-dist v1-18) 4095996000.0) ) (logior! (-> self options) (projectile-options proj-options-4)) - (init-collision! self) + (init-proj-collision! self) (let ((s5-0 (-> self root-override))) (when (type? s5-0 collide-shape-moving) (set! (-> self root-override dynam gravity y) 1228800.0) @@ -682,7 +683,7 @@ If we've met or exceeded the projectiles maximum allowed hits, switch to the [[p ;; definition for method 30 of type projectile-bounce ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! projectile-bounce ((obj projectile-bounce)) +(defmethod init-proj-collision! projectile-bounce ((obj projectile-bounce)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc index 433e1e1ea0..7ea9a5fad9 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc @@ -25,7 +25,7 @@ (idle () _type_ :state 21) (move-to-point! (_type_ vector) int 22) (get-ripple-height (_type_ vector) float 23) - (art-init! (_type_) none 24) + (init-water! (_type_) none 24) (reset-root! (_type_) trsqv 25) (water-anim-init! (_type_) none 26) (water-anim-method-27 (_type_) none 27) @@ -576,8 +576,8 @@ ) ;; definition for method 24 of type water-anim -(defmethod art-init! water-anim ((obj water-anim)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." +(defmethod init-water! water-anim ((obj water-anim)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" (let ((s5-0 (-> obj look))) (if (or (< s5-0 0) (>= s5-0 (-> *water-anim-look* length))) (go process-drawable-art-error "skel group") @@ -697,7 +697,7 @@ (reset-root! self) (water-anim-init! self) (offset! self) - (art-init! self) + (init-water! self) (go-virtual idle) (none) ) @@ -715,7 +715,7 @@ This commonly includes things such as: (reset-root! obj) (water-anim-init! obj) (offset! obj) - (art-init! obj) + (init-water! obj) (go (method-of-object obj idle)) (none) ) diff --git a/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc index 6c22d12d8c..d90001fd09 100644 --- a/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc @@ -1188,7 +1188,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/game/main_REF.gc b/test/decompiler/reference/jak2/engine/game/main_REF.gc index 7cc0e2d50e..a63808f8d7 100644 --- a/test/decompiler/reference/jak2/engine/game/main_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/main_REF.gc @@ -16,8 +16,7 @@ ;; definition for function letterbox ;; WARN: Return type mismatch pointer vs none. -;; WARN: Failed store: (s.w! (+ v1-7 8) 0) at op 30 -;; WARN: Failed store: (s.w! (+ v1-7 12) 0) at op 31 +;; ERROR: Failed store: (s.w! (+ v1-7 8) 0) at op 30 (defun letterbox () (with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id screen-filter) @@ -53,8 +52,7 @@ ;; definition for function blackout ;; WARN: Return type mismatch pointer vs none. -;; WARN: Failed store: (s.w! (+ v1-6 8) 0) at op 21 -;; WARN: Failed store: (s.w! (+ v1-6 12) 0) at op 22 +;; ERROR: Failed store: (s.w! (+ v1-6 8) 0) at op 21 (defun blackout () (with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id debug-no-zbuf2) @@ -263,8 +261,7 @@ ;; definition for method 9 of type screen-filter ;; WARN: Return type mismatch int vs none. -;; WARN: Failed store: (s.w! (+ v1-16 8) 0) at op 85 -;; WARN: Failed store: (s.w! (+ v1-16 12) 0) at op 86 +;; ERROR: Failed store: (s.w! (+ v1-16 8) 0) at op 85 (defmethod draw screen-filter ((obj screen-filter)) (local-vars (v1-1 float)) (rlet ((vf0 :class vf) @@ -367,8 +364,7 @@ (define *first-boot* #t) ;; definition for function main-cheats -;; WARN: Failed store: (s.w! (+ v1-77 8) 0) at op 163 -;; WARN: Failed store: (s.w! (+ v1-77 12) 0) at op 164 +;; ERROR: Failed store: (s.w! (+ v1-77 8) 0) at op 163 (defun main-cheats () (when (and (cpad-hold? 0 l3) (or *cheat-mode* (not (demo?)))) ((lambda () @@ -1234,10 +1230,7 @@ ;; definition for function end-display ;; WARN: Return type mismatch int vs none. -;; WARN: Failed store: (s.w! (+ v1-37 8) 0) at op 87 -;; WARN: Failed store: (s.w! (+ v1-37 12) 0) at op 88 -;; WARN: Failed store: (s.w! (+ v1-94 8) 0) at op 237 -;; WARN: Failed store: (s.w! (+ v1-94 12) 0) at op 238 +;; ERROR: Failed store: (s.w! (+ v1-37 8) 0) at op 87 (defun end-display ((arg0 display)) (let ((s5-0 (-> (if *debug-segment* (-> arg0 frames (-> arg0 on-screen) debug-buf) @@ -1911,7 +1904,3 @@ (set! *run* #f) 0 ) - - - - diff --git a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc index daddc51f86..f30025957a 100644 --- a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc @@ -208,7 +208,7 @@ (draw-priority float :offset-assert 224) (level-flags uint32 :offset-assert 228) (fog-height float :offset-assert 232) - (bigmap-id uint32 :offset-assert 236) + (bigmap-id bigmap-id :offset-assert 236) (ocean-near-translucent? symbol :offset-assert 240) (ocean-far? symbol :offset-assert 244) (mood-range mood-range :inline :offset-assert 256) diff --git a/test/decompiler/reference/jak2/engine/level/level-info_REF.gc b/test/decompiler/reference/jak2/engine/level/level-info_REF.gc index c27c4bd6a8..43968b0894 100644 --- a/test/decompiler/reference/jak2/engine/level/level-info_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/level-info_REF.gc @@ -68,7 +68,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -126,7 +126,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -301,7 +301,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -452,7 +452,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -676,7 +676,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -925,7 +925,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -980,7 +980,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -1035,7 +1035,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -1090,7 +1090,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x5 + :bigmap-id (bigmap-id bigmap-id-5) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 1.0 1.0 0.0 1.0)) @@ -1195,7 +1195,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xe + :bigmap-id (bigmap-id sewer-default) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1250,7 +1250,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xe + :bigmap-id (bigmap-id sewer-default) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1415,7 +1415,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x10 + :bigmap-id (bigmap-id bigmap-id-16) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1470,7 +1470,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x10 + :bigmap-id (bigmap-id bigmap-id-16) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1677,7 +1677,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1780,7 +1780,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1859,7 +1859,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -1937,7 +1937,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2068,7 +2068,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2122,7 +2122,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2224,7 +2224,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x12 + :bigmap-id (bigmap-id bigmap-id-18) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2305,7 +2305,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x13 + :bigmap-id (bigmap-id bigmap-id-19) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2457,7 +2457,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x13 + :bigmap-id (bigmap-id bigmap-id-19) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2562,7 +2562,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2643,7 +2643,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -2698,7 +2698,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xb + :bigmap-id (bigmap-id bigmap-id-11) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.75 1.0 0.75 1.0)) @@ -2827,7 +2827,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xb + :bigmap-id (bigmap-id bigmap-id-11) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.75 1.0 0.75 1.0)) @@ -2883,7 +2883,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xb + :bigmap-id (bigmap-id bigmap-id-11) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -2989,7 +2989,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xc + :bigmap-id (bigmap-id bigmap-id-12) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -3045,7 +3045,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3101,7 +3101,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3157,7 +3157,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -3261,7 +3261,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xc + :bigmap-id (bigmap-id bigmap-id-12) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.5 1.0 0.5 0.5)) @@ -3390,7 +3390,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3445,7 +3445,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3500,7 +3500,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3603,7 +3603,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3707,7 +3707,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3786,7 +3786,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3866,7 +3866,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -3969,7 +3969,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4050,7 +4050,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4178,7 +4178,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4233,7 +4233,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x7 + :bigmap-id (bigmap-id bigmap-id-7) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4386,7 +4386,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x11 + :bigmap-id (bigmap-id bigmap-id-17) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4569,7 +4569,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xd + :bigmap-id (bigmap-id bigmap-id-13) :ocean-near-translucent? #f :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -4625,7 +4625,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #xd + :bigmap-id (bigmap-id bigmap-id-13) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5256,7 +5256,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x8 + :bigmap-id (bigmap-id bigmap-id-8) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.0 1.0)) @@ -5313,7 +5313,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x8 + :bigmap-id (bigmap-id bigmap-id-8) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.0 1.0)) @@ -5418,7 +5418,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x6 + :bigmap-id (bigmap-id bigmap-id-6) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5475,7 +5475,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x6 + :bigmap-id (bigmap-id bigmap-id-6) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5580,7 +5580,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x8 + :bigmap-id (bigmap-id bigmap-id-8) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5639,7 +5639,7 @@ :draw-priority 9.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5696,7 +5696,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5753,7 +5753,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5810,7 +5810,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5866,7 +5866,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -5922,7 +5922,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6052,7 +6052,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6182,7 +6182,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6312,7 +6312,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6609,7 +6609,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6761,7 +6761,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -6914,7 +6914,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7378,7 +7378,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7433,7 +7433,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7588,7 +7588,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7695,7 +7695,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7871,7 +7871,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -7976,7 +7976,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8056,7 +8056,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8184,7 +8184,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8291,7 +8291,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8446,7 +8446,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8600,7 +8600,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -8777,7 +8777,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -8953,7 +8953,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9153,7 +9153,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9329,7 +9329,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9455,7 +9455,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9583,7 +9583,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9638,7 +9638,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 0.5 0.25 0.75)) @@ -9694,7 +9694,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9751,7 +9751,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9808,7 +9808,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9865,7 +9865,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9922,7 +9922,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -9979,7 +9979,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10036,7 +10036,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10093,7 +10093,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10150,7 +10150,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10207,7 +10207,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10263,7 +10263,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10319,7 +10319,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10375,7 +10375,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10431,7 +10431,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10487,7 +10487,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10568,7 +10568,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10624,7 +10624,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10681,7 +10681,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10760,7 +10760,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10840,7 +10840,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -10943,7 +10943,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.5 0.5)) @@ -10997,7 +10997,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11053,7 +11053,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11109,7 +11109,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11165,7 +11165,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11220,7 +11220,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11276,7 +11276,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11332,7 +11332,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11388,7 +11388,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11444,7 +11444,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11500,7 +11500,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11556,7 +11556,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11612,7 +11612,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11668,7 +11668,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11724,7 +11724,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11780,7 +11780,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11836,7 +11836,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11892,7 +11892,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -11948,7 +11948,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12149,7 +12149,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12204,7 +12204,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12260,7 +12260,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12316,7 +12316,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12372,7 +12372,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12428,7 +12428,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12484,7 +12484,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12588,7 +12588,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12670,7 +12670,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x3 + :bigmap-id (bigmap-id bigmap-id-3) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12828,7 +12828,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x4 + :bigmap-id (bigmap-id bigmap-id-4) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -12883,7 +12883,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x4 + :bigmap-id (bigmap-id bigmap-id-4) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13010,7 +13010,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x1 + :bigmap-id (bigmap-id bigmap-id-1) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13115,7 +13115,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x2 + :bigmap-id (bigmap-id bigmap-id-2) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13195,7 +13195,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13251,7 +13251,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x2 + :bigmap-id (bigmap-id bigmap-id-2) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13308,7 +13308,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x2 + :bigmap-id (bigmap-id bigmap-id-2) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13437,7 +13437,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13493,7 +13493,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13550,7 +13550,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13606,7 +13606,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13661,7 +13661,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13814,7 +13814,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x9 + :bigmap-id (bigmap-id bigmap-id-9) :ocean-near-translucent? #t :ocean-far? #t :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -13967,7 +13967,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x9 + :bigmap-id (bigmap-id bigmap-id-9) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14022,7 +14022,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14079,7 +14079,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14135,7 +14135,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14213,7 +14213,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14311,7 +14311,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14392,7 +14392,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14448,7 +14448,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14504,7 +14504,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14560,7 +14560,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14640,7 +14640,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14719,7 +14719,7 @@ :texture-anim-sky #f :draw-priority 10.0 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) @@ -14776,7 +14776,7 @@ :draw-priority 10.0 :level-flags #x1 :fog-height 327680.0 - :bigmap-id #x14 + :bigmap-id (bigmap-id bigmap-id-20) :ocean-near-translucent? #t :ocean-far? #f :mood-range (new 'static 'mood-range :data (new 'static 'array float 4 0.0 1.0 0.0 1.0)) diff --git a/test/decompiler/reference/jak2/engine/nav/nav-enemy-h_REF.gc b/test/decompiler/reference/jak2/engine/nav/nav-enemy-h_REF.gc index 941a7a5057..1d99d7fc40 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-enemy-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-enemy-h_REF.gc @@ -169,8 +169,8 @@ :size-assert #x25c :flag-assert #xb201e0025c (:methods - (enemy-method-112 (_type_ nav-enemy-info) float :replace 112) - (enemy-method-113 (_type_ nav-enemy-info) none :replace 113) + (set-enemy-info! (_type_ nav-enemy-info) none :replace 112) + (init-enemy-behaviour-and-stats! (_type_ nav-enemy-info) none :replace 113) (taunt () _type_ :state 137) (pacing () _type_ :state 138) (circling () _type_ :state 139) 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 15ffa972a7..01411012cf 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc @@ -28,7 +28,9 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 15] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 23] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 33] -(defmethod enemy-method-74 nav-enemy ((obj nav-enemy) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler nav-enemy ((obj nav-enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (let ((v1-0 arg2)) (the-as object (cond ((= v1-0 'nav-mesh-kill) @@ -43,10 +45,10 @@ (go (method-of-object obj debug-control)) ) ((= v1-0 'debug-control-off) - (enemy-method-72 obj) + (react-to-focus obj) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -127,7 +129,15 @@ (cond ((-> obj enemy-info-override move-to-ground) (let ((s3-1 (new 'stack-no-clear 'collide-query))) - (when (enemy-method-126 obj s3-1 s4-0 (-> obj enemy-info-override recover-gnd-collide-with) 8192.0 81920.0 1024.0) + (when (enemy-above-ground? + obj + s3-1 + s4-0 + (-> obj enemy-info-override recover-gnd-collide-with) + 8192.0 + 81920.0 + 1024.0 + ) (let ((f0-4 (- (-> gp-0 trans y) (-> s3-1 best-other-tri intersect y)))) (if (and (>= 12288.0 f0-4) (< -8192.0 f0-4)) (return #f) @@ -178,7 +188,7 @@ ) (logclear! (-> obj enemy-flags) (enemy-flag directed)) (if (and (enemy-method-102 obj) (zero? (logand (-> obj focus-status) (focus-status dead)))) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (the-as symbol @@ -215,10 +225,14 @@ ;; definition for method 55 of type nav-enemy ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 nav-enemy ((obj nav-enemy)) +(defmethod track-target! nav-enemy ((obj nav-enemy)) + "Does a lot of various things relating to interacting with the target +- tracks when the enemy was last drawn +- looks at the target and handles attacking +@TODO Not extremely well understood yet" (with-pp (if (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-control-status on-screen))) - (set! (-> obj last-draw-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj last-draw-time) (-> pp clock frame-counter)) ) (enemy-method-129 obj) (when (logtest? (enemy-flag use-trigger) (-> obj enemy-flags)) @@ -267,10 +281,10 @@ ) ) (when (and (logtest? (-> obj enemy-flags) (enemy-flag attackable-backup)) - (>= (- (-> pp clock frame-counter) (the-as int (-> obj auto-reset-penetrate-time))) (seconds 0.1)) + (>= (- (-> pp clock frame-counter) (-> obj auto-reset-penetrate-time)) (seconds 0.1)) ) (logclear! (-> obj enemy-flags) (enemy-flag attackable-backup)) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((v1-62 0)) (if (logtest? (penetrate knocked) (-> obj root-override2 penetrate-using)) (set! v1-62 (logior (shl 1 32) v1-62)) @@ -362,7 +376,7 @@ 0 ) ) - (enemy-method-55 obj) + (track-target! obj) (update-transforms (-> obj root-override2)) 0 (none) @@ -978,7 +992,12 @@ ) ;; definition for method 98 of type nav-enemy -(defmethod enemy-method-98 nav-enemy ((obj nav-enemy) (arg0 process-focusable) (arg1 vector)) +(defmethod in-aggro-range? nav-enemy ((obj nav-enemy) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" (if (and arg0 (not arg1)) (set! arg1 (get-trans arg0 1)) ) @@ -1033,7 +1052,7 @@ ) (else (when (>= (- (-> pp clock frame-counter) (-> obj frustration-time)) - (the-as time-frame (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time))) + (+ (-> obj reaction-time) (-> obj enemy-info-override frustration-time)) ) (set! (-> obj enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag39) (-> obj enemy-flags)))) 0 @@ -1131,7 +1150,10 @@ ) ;; definition for method 112 of type nav-enemy -(defmethod enemy-method-112 nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) +;; WARN: Return type mismatch float vs none. +(defmethod set-enemy-info! nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) + "In addition to setting the `enemy-info`, also init the `neck-joint` if applicable from it +@param info Set `enemy-info` accordingly" (set! (-> obj enemy-info-override) arg0) (set! (-> arg0 callback-info) *nav-enemy-callback-info*) (when (and (!= (-> obj enemy-info-override neck-joint) -1) (zero? (-> obj neck))) @@ -1145,12 +1167,14 @@ (set! (-> obj neck max-dist) 102400.0) (set! (-> obj neck ignore-angle) 16384.0) ) + (none) ) ;; definition for method 113 of type nav-enemy ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-113 nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) +(defmethod init-enemy-behaviour-and-stats! nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info)) + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" (local-vars (sv-16 res-tag)) (when (coin-flip? obj) (let ((a0-2 (-> obj node-list data 2))) @@ -1164,7 +1188,7 @@ (logior! (-> obj mask) (process-mask actor-pause)) (logior! (-> obj enemy-flags) (enemy-flag notice)) (set! (-> obj nav-radius-backup) (-> obj root-override2 nav-radius)) - (enemy-method-112 obj arg0) + (set-enemy-info! obj arg0) (set! (-> obj enemy-info-override callback-info) *nav-enemy-callback-info*) (let ((a1-2 (-> obj enemy-info-override idle-anim-script))) (if a1-2 @@ -1283,12 +1307,12 @@ (set! (-> obj incoming attacker-handle) (the-as handle #f)) (let ((s4-0 (-> obj root-override2))) (set! (-> obj penetrated-by-all) (-> obj root-override2 penetrated-by)) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (set! (-> s4-0 event-self) 'touched) ) - (set! (-> obj penetrated-flinch) (the-as penetrate (-> arg0 penetrate-flinch))) - (set! (-> obj penetrated-knocked) (the-as penetrate (-> arg0 penetrate-knocked))) - (set! (-> obj reaction-time) (the-as uint (get-rand-int-range obj 30 240))) + (set! (-> obj penetrated-flinch) (-> arg0 penetrate-flinch)) + (set! (-> obj penetrated-knocked) (-> arg0 penetrate-knocked)) + (set! (-> obj reaction-time) (the-as time-frame (get-rand-int-range obj 30 240))) (let* ((v1-113 (-> obj enemy-flags)) (a0-47 (-> obj fact-info-override enemy-options)) (v1-114 (logior (enemy-flag @@ -1335,9 +1359,9 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" - (enemy-method-114 obj) + (init-enemy-collision! obj) (process-drawable-from-entity! obj arg0) - (enemy-method-115 obj) + (init-enemy! obj) (when (> (-> obj enemy-info-override gem-joint) 0) (cond ((or (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status save))) @@ -1405,7 +1429,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 () - (enemy-method-55 self) + (track-target! self) (update-transforms (-> self root-override2)) 0 (none) @@ -1627,7 +1651,7 @@ This commonly includes things such as: ((and (= s5-0 (enemy-aware enemy-aware-3)) (-> obj enemy-info-override use-circling)) (go (method-of-object obj circling)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go (method-of-object obj flee)) ) (else @@ -1707,7 +1731,7 @@ This commonly includes things such as: (t9-0) ) ) - (set! (-> self state-timeout) (the-as uint 300)) + (set! (-> self state-timeout) (seconds 1)) (let ((v1-5 self)) (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) @@ -1763,7 +1787,7 @@ This commonly includes things such as: (t9-0) ) ) - (set! (-> self state-timeout) (the-as uint 300)) + (set! (-> self state-timeout) (seconds 1)) (logior! (-> self nav state flags) (nav-state-flag at-target)) (let ((v1-8 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-8 enemy-flags))) @@ -1957,7 +1981,7 @@ This commonly includes things such as: (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post nav-enemy-simple-post @@ -1993,7 +2017,7 @@ This commonly includes things such as: (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -2005,10 +2029,10 @@ This commonly includes things such as: (go-virtual active) ) ) - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -2038,7 +2062,7 @@ This commonly includes things such as: (let ((f0-0 (vector-vector-distance (-> self root-override2 trans) a1-0))) (set! (-> self state-timeout) (the-as - uint + 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))) ) ) @@ -2072,18 +2096,18 @@ This commonly includes things such as: (let ((gp-0 (-> self focus aware))) (cond ((>= 1 (the-as int gp-0)) - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (go-virtual active) ) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) (else - (if (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (go-stare self) ) ) @@ -2134,7 +2158,7 @@ This commonly includes things such as: 0 (nav-enemy-method-167 self) (vector-reset! (-> self root-override2 transv)) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (none) ) :exit (behavior () @@ -2195,9 +2219,9 @@ This commonly includes things such as: ) (let ((gp-0 (-> self focus aware))) (if (< (the-as int gp-0) 2) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self)) ) (cond @@ -2205,12 +2229,10 @@ This commonly includes things such as: (go-virtual active) ) ((= gp-0 (enemy-aware enemy-aware-3)) - (if (and (enemy-method-107 self) + (if (and (get-enemy-target self) (not (and (-> self enemy-info-override use-frustration) (logtest? (enemy-flag enemy-flag39) (-> self enemy-flags))) ) - (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (go-hostile self) ) @@ -2218,14 +2240,12 @@ This commonly includes things such as: (go-virtual circling) ) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ((and (= gp-0 (enemy-aware enemy-aware-2)) (-> self enemy-info-override use-pacing) - (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (go-virtual pacing) ) @@ -2275,7 +2295,7 @@ This commonly includes things such as: ) :exit (-> (method-of-type nav-enemy stare) exit) :trans (behavior () - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (not (nav-enemy-method-163 self)) ) (let ((v1-6 (-> self focus aware))) @@ -2283,7 +2303,7 @@ This commonly includes things such as: ((>= 1 (the-as int v1-6)) (go-virtual active) ) - ((and (= v1-6 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= v1-6 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-virtual hostile) ) ) @@ -2339,7 +2359,7 @@ This commonly includes things such as: :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) @@ -2356,8 +2376,8 @@ 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-override2 trans quad)) - (set! (-> self state-timeout) (the-as uint (get-rand-int-range self 2100 3300))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self state-timeout) (the-as time-frame (get-rand-int-range self 2100 3300))) + (set! (-> self starting-time) (-> self clock frame-counter)) (if (zero? (get-rand-int self 2)) (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag40) (-> self enemy-flags)))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag40)))) @@ -2377,17 +2397,16 @@ This commonly includes things such as: ) ) (let ((gp-1 (-> self focus aware))) - (if (or (!= gp-1 3) (not (enemy-method-107 self))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (if (or (!= gp-1 3) (not (get-enemy-target self))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 1 (the-as int gp-1)) (go-virtual active) ) (when (= gp-1 (enemy-aware enemy-aware-3)) - (when (and (enemy-method-107 self) (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (when (and (get-enemy-target self) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (nav-enemy-method-161 self) (go-virtual hostile) @@ -2399,14 +2418,14 @@ This commonly includes things such as: (if (nav-enemy-method-163 self) (go-stare2 self) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (nav-enemy-method-161 self) (go-stare2 self) ) ) ) (when (>= 1024.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> self move-dest))) - (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (zero? (get-rand-int self 3)) ) (nav-enemy-method-161 self) @@ -2484,7 +2503,7 @@ This commonly includes things such as: :event (the-as (function process int symbol event-message-block object :behavior nav-enemy) enemy-event-handler) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) @@ -2518,7 +2537,7 @@ This commonly includes things such as: ) (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (none) ) :trans (behavior () @@ -2528,10 +2547,10 @@ This commonly includes things such as: ) ) (let ((gp-1 (-> self focus aware))) - (if (or (!= gp-1 3) (not (enemy-method-107 self))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (if (or (!= gp-1 3) (not (get-enemy-target self))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -2540,10 +2559,8 @@ This commonly includes things such as: ) ) (when (and (= gp-1 (enemy-aware enemy-aware-3)) - (enemy-method-107 self) - (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (get-enemy-target self) + (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) ) (nav-enemy-method-161 self) (go-hostile self) @@ -2648,9 +2665,9 @@ This commonly includes things such as: (none) ) :trans (behavior () - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (let ((v1-3 (-> self focus aware))) - (if (!= v1-3 (enemy-aware enemy-aware-4)) + (if (!= v1-3 (enemy-aware unaware)) (go-stare self) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc index d64824f3ff..7a4edb692e 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc @@ -228,6 +228,7 @@ ) ;; definition for method 28 of type gun-blue-shot +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound gun-blue-shot ((obj gun-blue-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -239,6 +240,7 @@ ) ) ) + (none) ) ;; definition for method 38 of type gun-blue-shot @@ -288,7 +290,7 @@ ;; definition for method 30 of type gun-blue-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! gun-blue-shot ((obj gun-blue-shot)) +(defmethod init-proj-collision! gun-blue-shot ((obj gun-blue-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc index ec90326a14..b5985145cd 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc @@ -274,6 +274,7 @@ ) ;; definition for method 28 of type gun-yellow-shot +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound gun-yellow-shot ((obj gun-yellow-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -291,6 +292,7 @@ ) ) ) + (none) ) ;; definition for method 38 of type gun-yellow-shot @@ -351,7 +353,7 @@ ;; definition for method 30 of type gun-yellow-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! gun-yellow-shot ((obj gun-yellow-shot)) +(defmethod init-proj-collision! gun-yellow-shot ((obj gun-yellow-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc index 8db4a2ee1a..89bc861aa0 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/grunt-mech_REF.gc @@ -243,8 +243,12 @@ ;; definition for method 55 of type grunt-mech ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 grunt-mech ((obj grunt-mech)) - ((method-of-type grunt enemy-method-55) obj) +(defmethod track-target! grunt-mech ((obj 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!) obj) 0 (none) ) @@ -344,7 +348,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (let ((gp-0 (enemy-method-107 obj))) + (let ((gp-0 (get-enemy-target obj))) (when gp-0 (cond ((logtest? (focus-status mech) (-> gp-0 focus-status)) @@ -515,7 +519,7 @@ (let ((s4-1 (new 'stack-no-clear 'vector))) (vector+! s4-1 (-> obj root-override2 trans) (the-as vector (-> s5-0 out-travel))) (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (when (enemy-method-126 obj s5-1 s4-1 (the-as collide-spec (-> obj gnd-collide)) 4096.0 122880.0 1024.0) + (when (enemy-above-ground? obj s5-1 s4-1 (the-as collide-spec (-> obj gnd-collide)) 4096.0 122880.0 1024.0) (set! (-> s4-1 y) (-> s5-1 best-other-tri intersect y)) (set! (-> obj dismount-dest quad) (-> s4-1 quad)) #t @@ -619,7 +623,7 @@ ;; WARN: Return type mismatch object vs none. (defmethod grunt-mech-method-191 grunt-mech ((obj grunt-mech)) (with-pp - (if (>= (-> pp clock frame-counter) (the-as time-frame (-> obj state-timeout))) + (if (>= (-> pp clock frame-counter) (-> obj state-timeout)) (go (method-of-object obj mech-dismount)) ) (none) @@ -634,10 +638,8 @@ (set! (-> self state-time) (-> self clock frame-counter)) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (set! (-> self root-override2 root-prim prim-core collide-as) (collide-spec)) - (enemy-method-110 self) - (set! (-> self state-timeout) - (the-as uint (+ (-> self clock frame-counter) (get-rand-int-range self 450 900))) - ) + (stop-looking-at-target! self) + (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 450 900))) (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) (none) ) @@ -871,9 +873,7 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt circling) enter)) - (set! (-> self state-timeout) - (the-as uint (+ (-> self clock frame-counter) (get-rand-int-range self 750 1200))) - ) + (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 750 1200))) (none) ) :trans (behavior () @@ -883,10 +883,10 @@ ) ) (let ((gp-1 (-> self focus aware))) - (if (or (!= gp-1 3) (not (enemy-method-107 self))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (if (or (!= gp-1 3) (not (get-enemy-target self))) + (set! (-> self starting-time) (-> self clock frame-counter)) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (when (>= 1 (the-as int gp-1)) (nav-enemy-method-161 self) (if (-> self enemy-info-override use-stop-chase) @@ -895,19 +895,17 @@ ) ) (when (= gp-1 (enemy-aware enemy-aware-3)) - (let ((v1-33 (enemy-method-107 self))) + (let ((v1-33 (get-enemy-target self))) (when v1-33 (cond ((logtest? (focus-status mech) (-> v1-33 focus-status)) - (when (>= (-> self clock frame-counter) (the-as time-frame (-> self state-timeout))) + (when (>= (-> self clock frame-counter) (-> self state-timeout)) (nav-enemy-method-161 self) (go-hostile self) ) ) (else - (when (>= (- (-> self clock frame-counter) (the-as int (-> self starting-time))) - (the-as time-frame (-> self reaction-time)) - ) + (when (>= (- (-> self clock frame-counter) (-> self starting-time)) (-> self reaction-time)) (nav-enemy-method-161 self) (go-hostile self) ) @@ -936,16 +934,10 @@ :event (the-as (function process int symbol event-message-block object :behavior grunt-mech) enemy-event-handler) :enter (behavior () ((-> (method-of-type grunt-mech mech-post-circling) enter)) - (set! (-> self state-timeout) - (the-as uint (+ (-> self clock frame-counter) (get-rand-int-range self 900 1800))) - ) + (set! (-> self state-timeout) (+ (-> self clock frame-counter) (get-rand-int-range self 900 1800))) (none) ) :trans (-> (method-of-type grunt-mech mech-post-circling) trans) :code (-> (method-of-type grunt-mech mech-post-circling) code) :post (-> (method-of-type grunt-mech mech-post-circling) post) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/target/target-turret-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/target-turret-shot_REF.gc index d4a4d590ec..130d3cf55b 100644 --- a/test/decompiler/reference/jak2/engine/target/target-turret-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-turret-shot_REF.gc @@ -218,26 +218,26 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touched) - (let* ((s4-0 proc) - (v1-1 (if (type? s4-0 process-drawable) - (the-as process-drawable s4-0) - ) - ) + (let* ((toucher-proc proc) + (toucher (if (type? toucher-proc process-drawable) + (the-as process-drawable toucher-proc) + ) + ) ) - (when v1-1 - (-> v1-1 root) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) (process->ppointer self)) - (set! (-> a1-2 num-params) 2) - (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) (-> event param 0)) - (let ((v1-7 (new 'static 'attack-info :mask (attack-info-mask mode id damage)))) - (set! (-> v1-7 id) (-> self attack-id)) - (set! (-> v1-7 mode) 'explode) - (set! (-> v1-7 damage) (-> self damage)) - (set! (-> a1-2 param 1) (the-as uint v1-7)) + (when toucher + (-> toucher root) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask mode id damage)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info mode) 'explode) + (set! (-> attack-info damage) (-> self damage)) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function proc a1-2) + (send-event-function proc evt) ) ) ) @@ -248,14 +248,14 @@ ) ) :code (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core world-sphere w) 4915.2) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> (the-as collide-shape-prim-group root-prim) child 0 prim-core world-sphere w) 4915.2) ) - (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-0 options) (overlaps-others-options)) - (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) - (set! (-> a1-0 tlist) *touching-list*) - (find-overlapping-shapes (-> self root-override) a1-0) + (let ((overlap-params (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> overlap-params options) (overlaps-others-options)) + (set! (-> overlap-params collide-with-filter) (the-as collide-spec -1)) + (set! (-> overlap-params tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) overlap-params) ) (suspend) (go-virtual die) @@ -349,11 +349,11 @@ ;; WARN: Return type mismatch int vs none. (defmethod spawn-shell-particles turret-shot ((obj turret-shot)) "TODO - confirm" - (let* ((s5-0 (-> obj root-override)) - (v1-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> s5-0 trans)) 2048.0)) + (let* ((root (-> obj root-override)) + (v1-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> root trans)) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) ) - (set! (-> gp-0 quad) (-> s5-0 trans quad)) + (set! (-> gp-0 quad) (-> root trans quad)) (vector+! gp-0 gp-0 v1-2) (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) (when s5-1 @@ -396,19 +396,20 @@ ) ;; definition for method 28 of type turret-shot -;; WARN: Return type mismatch int vs sound-id. -(defmethod play-impact-sound turret-shot ((obj turret-shot) (arg0 projectile-options)) - (let ((v1-0 arg0)) +;; WARN: Return type mismatch int vs none. +(defmethod play-impact-sound turret-shot ((obj turret-shot) (proj-options projectile-options)) + (let ((options proj-options)) (cond - ((zero? v1-0) + ((zero? options) (sound-play "drl-turret-fire") ) - ((= v1-0 (projectile-options lose-altitude)) + ((= options (projectile-options lose-altitude)) (sound-play "drl-turret-hit") ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; definition for method 31 of type turret-shot @@ -429,21 +430,21 @@ ;; definition for method 30 of type turret-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! turret-shot ((obj turret-shot)) +(defmethod init-proj-collision! turret-shot ((obj turret-shot)) "Init the [[projectile]]'s [[collide-shape]]" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) ) - (set! (-> s5-0 no-reaction) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) - (set! (-> s5-0 total-prims) (the-as uint 3)) - (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) - (set! (-> s4-0 prim-core collide-with) + (set! (-> cshape penetrate-using) (penetrate enemy-dark-shot)) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 2) 0))) + (set! (-> cshape total-prims) (the-as uint 3)) + (set! (-> prim-group prim-core collide-as) (collide-spec projectile)) + (set! (-> prim-group prim-core collide-with) (collide-spec backgnd jak @@ -458,13 +459,13 @@ obstacle-for-jak ) ) - (set! (-> s4-0 prim-core action) (collide-action solid)) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 4915.2) - (set! (-> s5-0 root-prim) s4-0) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 0.0 4915.2) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) - (set! (-> v1-13 prim-core collide-with) + (let ((prim-sphere-1 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-1 prim-core collide-as) (collide-spec projectile)) + (set! (-> prim-sphere-1 prim-core collide-with) (collide-spec backgnd jak @@ -479,25 +480,25 @@ obstacle-for-jak ) ) - (set! (-> v1-13 prim-core action) (collide-action solid deadly)) - (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 2048.0) + (set! (-> prim-sphere-1 prim-core action) (collide-action solid deadly)) + (set-vector! (-> prim-sphere-1 local-sphere) 0.0 0.0 0.0 2048.0) ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) - (set! (-> v1-15 prim-core collide-with) + (let ((prim-sphere-2 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-2 prim-core collide-as) (collide-spec projectile)) + (set! (-> prim-sphere-2 prim-core collide-with) (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list obstacle-for-jak) ) - (set! (-> v1-15 prim-core action) (collide-action deadly)) - (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4915.2) + (set! (-> prim-sphere-2 prim-core action) (collide-action deadly)) + (set-vector! (-> prim-sphere-2 local-sphere) 0.0 0.0 0.0 4915.2) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-18 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> s5-0 max-iteration-count) (the-as uint 1)) - (set! (-> s5-0 event-self) 'touched) - (set! (-> obj root-override) s5-0) + (set! (-> cshape max-iteration-count) (the-as uint 1)) + (set! (-> cshape event-self) 'touched) + (set! (-> obj root-override) cshape) ) (set! (-> obj root-override pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) diff --git a/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc b/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc index d943651ee7..047db9f106 100644 --- a/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc @@ -318,6 +318,7 @@ (arg3 sparticle-launcher) (arg4 sparticle-launch-state) ) + "@TODO - particle docs" (local-vars (v1-15 float) (v1-16 float)) (rlet ((vf0 :class vf) (vf1 :class vf) @@ -605,6 +606,7 @@ ;; definition for function check-drop-level-atoll-drop ;; INFO: Used lq/sq (defun check-drop-level-atoll-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the ocean level, render the splash" (let ((f30-0 (get-height *ocean* (the-as vector (-> arg2 vector)) #t))) (when (and (!= f30-0 4095996000.0) (< (-> arg2 vector 0 y) f30-0)) (let ((s3-0 (new 'stack-no-clear 'vector))) @@ -823,6 +825,7 @@ ;; definition for function check-drop-level-atoll-drop-userdata ;; INFO: Used lq/sq (defun check-drop-level-atoll-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the provided y-value, render the splash" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) diff --git a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc index 8ce89aca93..9bfeba0fb7 100644 --- a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc @@ -352,7 +352,7 @@ ;; definition for method 30 of type juicer-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! juicer-shot ((obj juicer-shot)) +(defmethod init-proj-collision! juicer-shot ((obj juicer-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -638,7 +638,72 @@ :default-hit-points 9 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.9 :attack-shove-back (meters 3) @@ -764,8 +829,12 @@ ) ;; definition for method 55 of type juicer -(defmethod enemy-method-55 juicer ((obj juicer)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! juicer ((obj 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!))) (t9-0 obj) ) (los-control-method-9 (-> obj los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -788,14 +857,16 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) (go (method-of-object obj knocked)) ) (none) ) ;; definition for method 74 of type juicer -(defmethod enemy-method-74 juicer ((obj juicer) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler juicer ((obj juicer) (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-flinch) (cond @@ -851,7 +922,7 @@ (('instant-death) (when (> (-> obj hit-points) 0) (set! (-> obj hit-points) 0) - (set! (-> obj root-override2 penetrated-by) (enemy-method-59 obj)) + (set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj)) (let ((s4-0 (enemy-method-50 obj (new 'stack-no-clear 'vector)))) (vector-z-quaternion! s4-0 (-> obj root-override2 quat)) (vector-float*! s4-0 s4-0 -1.0) @@ -878,10 +949,10 @@ (if (and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) (handle->process (-> obj focus handle)))) (set! (-> obj hit-focus) (the-as enemy-focus #t)) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1047,7 +1118,7 @@ ) (if (< v1-1 (-> a0-0 curve num-cverts)) (set! (-> self ambush-path-pt) v1-1) - (enemy-method-72 self) + (react-to-focus self) ) ) (until #f @@ -1117,7 +1188,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1139,7 +1210,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1237,7 +1308,7 @@ (when (and (or (logtest? (-> self nav state flags) (nav-state-flag blocked)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (if (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 1) (seconds 2))) (< 20480.0 f30-0) @@ -1803,7 +1874,7 @@ ;; definition for method 63 of type juicer ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 juicer ((obj juicer) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 juicer ((obj juicer) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1814,8 +1885,8 @@ ;; definition for method 114 of type juicer ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 juicer ((obj juicer)) - "@abstract" +(defmethod init-enemy-collision! juicer ((obj juicer)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1923,14 +1994,14 @@ ;; definition for method 115 of type juicer ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 juicer ((obj juicer)) - "@abstract" +(defmethod init-enemy! juicer ((obj juicer)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-juicer" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *juicer-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *juicer-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (set! (-> v1-5 up) (the-as uint 1)) (set! (-> v1-5 nose) (the-as uint 2)) diff --git a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc index a339f7cbe3..c3c90d4312 100644 --- a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc @@ -62,7 +62,72 @@ :default-hit-points 12 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -249,12 +314,12 @@ ;; definition for method 115 of type sniper ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 sniper ((obj sniper)) - "@abstract" - (let ((t9-0 (method-of-type spyder enemy-method-115))) +(defmethod init-enemy! sniper ((obj sniper)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (let ((t9-0 (method-of-type spyder init-enemy!))) (t9-0 obj) ) - (enemy-method-112 obj *sniper-nav-enemy-info*) + (set-enemy-info! obj *sniper-nav-enemy-info*) (logior! (-> obj focus-status) (focus-status ignore)) (logclear! (-> obj focus-status) (focus-status dangerous)) (logclear! (-> obj enemy-flags) (enemy-flag check-water)) @@ -264,9 +329,9 @@ ;; definition for method 114 of type sniper ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 sniper ((obj sniper)) - "@abstract" - (let ((t9-0 (method-of-type spyder enemy-method-114))) +(defmethod init-enemy-collision! sniper ((obj sniper)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((t9-0 (method-of-type spyder init-enemy-collision!))) (t9-0 obj) ) (let ((v1-2 (-> obj root-override2 root-prim))) diff --git a/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc b/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc index e35d11a9a3..84ddf26fec 100644 --- a/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/vehicle_REF.gc @@ -780,7 +780,7 @@ (let ((s3-0 (new 'stack-no-clear 'collide-query))) (logclear! (-> s4-1 status) (collide-status on-ground)) (cond - ((above-ground? s4-1 s3-0 (-> s4-1 trans) 1 0.0 102400.0 1024.0) + ((above-ground? s4-1 s3-0 (-> s4-1 trans) (collide-spec backgnd) 0.0 102400.0 1024.0) (set! (-> s4-1 gspot-pos quad) (-> s4-1 trans quad)) (set! (-> s4-1 gspot-pos y) (-> s3-0 best-other-tri intersect y)) (set! (-> s4-1 gspot-normal quad) (-> s3-0 best-other-tri normal quad)) diff --git a/test/decompiler/reference/jak2/levels/city/farm/ctyfarma-part_REF.gc b/test/decompiler/reference/jak2/levels/city/farm/ctyfarma-part_REF.gc index 3a28a5fc6b..6b3e7a11d0 100644 --- a/test/decompiler/reference/jak2/levels/city/farm/ctyfarma-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/farm/ctyfarma-part_REF.gc @@ -83,6 +83,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun birth-func-ctyfarma-drip ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Create a new dirt drip, don't go below the ocean or the ground" (let ((s4-0 (new 'stack-no-clear 'collide-query))) (set! (-> s4-0 start-pos quad) (-> arg2 launchrot quad)) (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) @@ -128,6 +129,7 @@ ;; definition for function check-drop-level-ctyfarma-drop-userdata ;; INFO: Used lq/sq (defun check-drop-level-ctyfarma-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the provided y-value, render the splash" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) @@ -296,7 +298,3 @@ (sp-rnd-flt spt-rotate-z (degrees 0.0) (degrees 3600.0) 1.0) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/city/farm/ctyfarmb-part_REF.gc b/test/decompiler/reference/jak2/levels/city/farm/ctyfarmb-part_REF.gc index abe4a5b08b..d8ea8ffd38 100644 --- a/test/decompiler/reference/jak2/levels/city/farm/ctyfarmb-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/farm/ctyfarmb-part_REF.gc @@ -83,6 +83,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun birth-func-ctyfarmb-drip ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Create a new dirt drip, don't go below the ocean or the ground" (let ((s4-0 (new 'stack-no-clear 'collide-query))) (set! (-> s4-0 start-pos quad) (-> arg2 launchrot quad)) (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) @@ -128,6 +129,7 @@ ;; definition for function check-drop-level-ctyfarmb-drop-userdata ;; INFO: Used lq/sq (defun check-drop-level-ctyfarmb-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water drop particle effects don't go below the provided y-value, render the splash" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) @@ -296,7 +298,3 @@ (sp-rnd-flt spt-rotate-z (degrees 0.0) (degrees 3600.0) 1.0) ) ) - - - - 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 94003d4c6a..e4ee75e68f 100644 --- a/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/farm/yakow_REF.gc @@ -74,7 +74,72 @@ :default-hit-points 5 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -150,12 +215,15 @@ (set! (-> *yakow-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 56 of type yakow -(defmethod enemy-method-56 yakow ((obj yakow) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack yakow ((obj yakow) (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]]" 0 ) ;; definition for method 74 of type yakow -(defmethod enemy-method-74 yakow ((obj yakow) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler yakow ((obj yakow) (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 (('attack) (let ((v1-1 (the-as object (-> arg3 param 1)))) @@ -166,7 +234,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -247,7 +315,7 @@ ) :post (behavior () (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) - (set! (-> self last-draw-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self last-draw-time) (-> self clock frame-counter)) ) (enemy-method-129 self) (ja-post) @@ -413,8 +481,8 @@ ;; definition for method 114 of type yakow ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 yakow ((obj yakow)) - "@abstract" +(defmethod init-enemy-collision! yakow ((obj yakow)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -461,14 +529,14 @@ ;; definition for method 115 of type yakow ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 yakow ((obj yakow)) - "@abstract" +(defmethod init-enemy! yakow ((obj yakow)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-yakow" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *yakow-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *yakow-nav-enemy-info*) (let ((v1-5 (-> obj nav))) (set! (-> v1-5 speed-scale) 1.0) ) diff --git a/test/decompiler/reference/jak2/levels/city/oracle/oracle-scenes_REF.gc b/test/decompiler/reference/jak2/levels/city/oracle/oracle-scenes_REF.gc index 476dfb3339..a2091047ea 100644 --- a/test/decompiler/reference/jak2/levels/city/oracle/oracle-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/oracle/oracle-scenes_REF.gc @@ -861,9 +861,9 @@ "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" (logior! (-> obj draw status) (draw-control-status no-draw-bounds)) - (let ((v1-4 (-> obj root-override root-prim))) - (set! (-> v1-4 prim-core collide-as) (collide-spec)) - (set! (-> v1-4 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> obj root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (-> obj draw art-group data 3) 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 cf999b9c74..338e8dbdcf 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-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -94,7 +94,7 @@ (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -259,7 +259,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -337,7 +337,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-166 self) (set! (-> self player-blocking) 0.0) (none) @@ -358,7 +358,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -406,7 +406,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -512,7 +512,7 @@ (set! (-> self enemy-flags) v1-39) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -548,7 +548,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-110 self) + (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)) @@ -572,7 +572,7 @@ gp-0 ) ) - (enemy-method-72 self) + (react-to-focus self) ) ) ) @@ -652,7 +652,3 @@ :trans (-> (method-of-type kid failed) trans) :code (-> (method-of-type kid failed) code) ) - - - - 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 e1dfefdc26..1050df3069 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 @@ -36,7 +36,72 @@ :default-hit-points 100 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak civilian enemy vehicle-sphere hit-by-others-list player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.7 :attack-shove-back (meters 3) @@ -112,7 +177,9 @@ (set! (-> *kid-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type kid -(defmethod enemy-method-74 kid ((obj kid) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler kid ((obj kid) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('arrest) @@ -153,11 +220,11 @@ (go (method-of-object obj arrested)) ) (('attack) - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) #f ) (else - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -299,8 +366,8 @@ ;; definition for method 114 of type kid ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 kid ((obj kid)) - "@abstract" +(defmethod init-enemy-collision! kid ((obj kid)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -394,15 +461,15 @@ ;; definition for method 115 of type kid ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 kid ((obj kid)) - "@abstract" +(defmethod init-enemy! kid ((obj kid)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-kid" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *kid-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *kid-nav-enemy-info*) (let ((v1-7 (-> obj neck))) (set! (-> v1-7 up) (the-as uint 1)) (set! (-> v1-7 nose) (the-as uint 2)) @@ -410,7 +477,7 @@ (set-vector! (-> v1-7 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-7 ignore-angle) 30947.555) ) - (let ((t9-4 (method-of-type bot enemy-method-115))) + (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -430,7 +497,8 @@ ) ;; definition for method 72 of type kid -(defmethod enemy-method-72 kid ((obj kid)) +(defmethod react-to-focus kid ((obj kid)) + "@TODO - flesh out docs" (kid-method-232 obj) (none) ) @@ -523,10 +591,11 @@ ) ;; definition for method 56 of type kid -(defmethod enemy-method-56 kid ((obj kid) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack kid ((obj kid) (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]]" (if (= (-> obj course course-id) 7) 0 - ((method-of-type bot enemy-method-56) obj arg0 arg1) + ((method-of-type bot damage-amount-from-attack) obj arg0 arg1) ) ) 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 ea607e44b4..648fc27588 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-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -95,7 +95,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -270,7 +270,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -348,7 +348,7 @@ (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) ) 0 - (enemy-method-110 self) + (stop-looking-at-target! self) (nav-enemy-method-166 self) (set! (-> self player-blocking) 0.0) (none) @@ -369,7 +369,7 @@ (go-virtual traveling-blocked) ) ((and (nav-enemy-method-163 self) - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) ) (go-stare2 self) ) @@ -417,7 +417,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self travel-anim-interp) 0.0) (none) ) @@ -523,7 +523,7 @@ (set! (-> self enemy-flags) v1-39) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -559,7 +559,7 @@ ) 0 (vector-reset! (-> self root-override2 transv)) - (enemy-method-110 self) + (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)) @@ -583,7 +583,7 @@ gp-0 ) ) - (enemy-method-72 self) + (react-to-focus self) ) ) ) @@ -678,7 +678,3 @@ :trans (-> (method-of-type kor failed) trans) :code (-> (method-of-type kor failed) code) ) - - - - 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 1d34f4b713..e37a8799f9 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 @@ -57,7 +57,72 @@ :default-hit-points 100 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak civilian enemy vehicle-sphere hit-by-others-list player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.7 :attack-shove-back (meters 3) @@ -133,7 +198,9 @@ (set! (-> *kor-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type kor -(defmethod enemy-method-74 kor ((obj kor) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler kor ((obj kor) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('arrest) @@ -173,7 +240,7 @@ (go (method-of-object obj arrested)) ) (else - ((method-of-type bot enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -315,8 +382,8 @@ ;; definition for method 114 of type kor ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 kor ((obj kor)) - "@abstract" +(defmethod init-enemy-collision! kor ((obj kor)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -410,15 +477,15 @@ ;; definition for method 115 of type kor ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 kor ((obj kor)) - "@abstract" +(defmethod init-enemy! kor ((obj kor)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-kor" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *kor-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *kor-nav-enemy-info*) (let ((v1-7 (-> obj neck))) (set! (-> v1-7 up) (the-as uint 1)) (set! (-> v1-7 nose) (the-as uint 2)) @@ -426,7 +493,7 @@ (set-vector! (-> v1-7 twist-max) 11832.889 11832.889 0.0 1.0) (set! (-> v1-7 ignore-angle) 30947.555) ) - (let ((t9-4 (method-of-type bot enemy-method-115))) + (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) @@ -446,7 +513,8 @@ ) ;; definition for method 72 of type kor -(defmethod enemy-method-72 kor ((obj kor)) +(defmethod react-to-focus kor ((obj kor)) + "@TODO - flesh out docs" (kor-method-232 obj) (none) ) @@ -539,7 +607,8 @@ ) ;; definition for method 56 of type kor -(defmethod enemy-method-56 kor ((obj kor) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack kor ((obj kor) (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]]" 0 ) 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 1c5cef6c22..5fb7498522 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 @@ -71,7 +71,7 @@ (set! (-> self enemy-flags) v1-45) (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) (logclear! (-> self focus-status) (focus-status hit)) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -91,7 +91,7 @@ (bot-method-191 self) (when (zero? (-> self hit-points)) (set! (-> self hit-points) 1) - (set! (-> self fated-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self fated-time) (-> self clock frame-counter)) ) (logclear! (-> self bot-flags) (bot-flags bf11)) (let ((t9-2 (-> (method-of-type nav-enemy knocked) enter))) @@ -289,7 +289,3 @@ :code (the-as (function none :behavior bot) sleep-code) :post (the-as (function none :behavior bot) nav-enemy-simple-post) ) - - - - 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 d774a78d60..b9403b34cd 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc @@ -356,8 +356,9 @@ ) ;; definition for method 56 of type bot -(defmethod enemy-method-56 bot ((obj bot) (arg0 process) (arg1 event-message-block)) - (let* ((t9-0 (method-of-type nav-enemy enemy-method-56)) +(defmethod damage-amount-from-attack bot ((obj bot) (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]]" + (let* ((t9-0 (method-of-type nav-enemy damage-amount-from-attack)) (v0-0 (t9-0 obj arg0 arg1)) ) (let ((v1-1 (-> obj bot-flags))) @@ -432,7 +433,10 @@ ;; definition for method 57 of type bot ;; WARN: Return type mismatch int vs enemy-aware. -(defmethod enemy-method-57 bot ((obj bot) (arg0 process-focusable) (arg1 enemy-best-focus)) +(defmethod update-target-awareness! bot ((obj bot) (arg0 process-focusable) (arg1 enemy-best-focus)) + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! +@TODO - flesh out docs +@returns the value that sets `aware`" (the-as enemy-aware 3) ) @@ -756,7 +760,9 @@ ;; WARN: disable def twice: 280. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 5] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 9] -(defmethod enemy-method-74 bot ((obj bot) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler bot ((obj bot) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v0-0 none)) (with-pp (let ((v1-0 arg2)) @@ -775,7 +781,7 @@ (-> obj waypoint waypoint-id) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -868,7 +874,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -880,7 +886,7 @@ s5-2 ) (logior! (-> obj enemy-flags) (enemy-flag look-at-focus)) - (set! (-> obj hit-focus-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> obj hit-focus-time) (-> pp clock frame-counter)) ) ) #t @@ -895,7 +901,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -936,7 +942,7 @@ ) (else (if (and (-> obj next-state) (= (-> obj next-state name) 'hidden)) - (enemy-method-72 obj) + (react-to-focus obj) ) ) ) @@ -955,7 +961,7 @@ v0-0 ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1187,7 +1193,11 @@ If the player is too far, play a warning speech." ) ;; definition for method 55 of type bot -(defmethod enemy-method-55 bot ((obj bot)) +(defmethod track-target! bot ((obj bot)) + "Does a lot of various things relating to interacting with the target +- tracks when the enemy was last drawn +- looks at the target and handles attacking +@TODO Not extremely well understood yet" (set! (-> obj travel-prev-ry) (-> obj travel-prev-ry1)) (set! (-> obj travel-prev-ry1) (quaternion-y-angle (-> obj root-override2 quat))) (let ((f0-4 (/ (the float (-> obj hit-points)) (the float (-> obj enemy-info-override default-hit-points))))) @@ -1216,7 +1226,7 @@ If the player is too far, play a warning speech." ) ) ) - (let ((t9-4 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-4 (method-of-type nav-enemy track-target!))) (t9-4 obj) ) (when (not (logtest? (-> obj bot-flags) (bot-flags bf09))) @@ -1524,8 +1534,8 @@ If the player is too far, play a warning speech." ;; definition for method 115 of type bot ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 bot ((obj bot)) - "@abstract" +(defmethod init-enemy! bot ((obj bot)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (process-entity-status! obj (entity-perm-status bit-4) #t) (set! (-> obj ai-ctrl) (new 'process 'ai-task-control *bot-task-pool*)) (logclear! (-> obj mask) (process-mask enemy)) 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 cf7394738c..7eb47ce197 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 @@ -244,7 +244,35 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #x11fffdffa + :penetrate-knocked (penetrate + generic-attack + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + knocked + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3.5) @@ -326,7 +354,9 @@ ) ;; definition for method 74 of type amphibian -(defmethod enemy-method-74 amphibian ((obj amphibian) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler amphibian ((obj amphibian) (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) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -364,7 +394,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -437,8 +467,9 @@ ) ;; definition for method 56 of type amphibian -(defmethod enemy-method-56 amphibian ((obj amphibian) (arg0 process) (arg1 event-message-block)) - (let* ((t9-0 (method-of-type nav-enemy enemy-method-56)) +(defmethod damage-amount-from-attack amphibian ((obj amphibian) (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]]" + (let* ((t9-0 (method-of-type nav-enemy damage-amount-from-attack)) (v0-0 (t9-0 obj arg0 arg1)) ) (let ((v1-1 (-> obj hit-points))) @@ -922,7 +953,7 @@ ((and (= s5-0 (enemy-aware enemy-aware-2)) (-> obj enemy-info-override use-pacing)) (go (method-of-object obj pacing)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go (method-of-object obj flee)) ) (else @@ -955,10 +986,14 @@ ) ;; definition for method 55 of type amphibian -(defmethod enemy-method-55 amphibian ((obj amphibian)) +(defmethod track-target! amphibian ((obj 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! (-> obj prev-ry) (-> obj prev-ry1)) (set! (-> obj prev-ry1) (quaternion-y-angle (-> obj root-override2 quat))) - ((method-of-type nav-enemy enemy-method-55) obj) + ((method-of-type nav-enemy track-target!) obj) (none) ) @@ -1238,7 +1273,7 @@ (set! (-> self nav state heading quad) (-> gp-2 quad)) ) 0 - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1444,7 +1479,7 @@ (logclear! (-> self enemy-flags) (enemy-flag look-at-focus)) (go-virtual attack-spin) ) - (let ((a0-2 (enemy-method-107 self))) + (let ((a0-2 (get-enemy-target self))) (when a0-2 (let* ((s5-0 (get-trans a0-2 0)) (f30-0 (vector-vector-xz-distance s5-0 (-> self root-override2 trans))) @@ -1504,7 +1539,7 @@ ) (let ((gp-0 (handle->process (-> self focus handle)))) (if (not gp-0) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) @@ -1648,7 +1683,7 @@ (suspend) (ja-eval) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior amphibian) nav-enemy-simple-post) @@ -1683,7 +1718,7 @@ ) (let ((gp-0 (handle->process (-> self focus handle)))) (if (not gp-0) - (enemy-method-72 self) + (react-to-focus self) ) (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) ) @@ -1760,7 +1795,7 @@ (suspend) (ja-eval) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior amphibian) nav-enemy-simple-post) @@ -1855,7 +1890,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior amphibian) nav-enemy-simple-post) @@ -1872,8 +1907,8 @@ ;; definition for method 114 of type amphibian ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 amphibian ((obj amphibian)) - "@abstract" +(defmethod init-enemy-collision! amphibian ((obj amphibian)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1952,15 +1987,15 @@ ;; definition for method 115 of type amphibian ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 amphibian ((obj amphibian)) - "@abstract" +(defmethod init-enemy! amphibian ((obj amphibian)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (set! (-> obj attacker-handle) (the-as handle #f)) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-amphibian" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *amphibian-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *amphibian-nav-enemy-info*) (set! (-> obj tongue-mod) (new 'process 'amphibian-joint-mod obj 14)) (let ((v1-6 (-> obj neck))) (set! (-> v1-6 up) (the-as uint 1)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc index 4c68493b24..09aed50020 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/baby_spider/tomb-baby-spider_REF.gc @@ -72,7 +72,35 @@ :default-hit-points 1 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #x11fffdffa + :penetrate-knocked (penetrate + generic-attack + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + knocked + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 6) @@ -307,7 +335,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -468,7 +496,7 @@ ) ) (let ((gp-4 (-> self focus aware))) - (if (or (not (enemy-method-107 self)) (!= gp-4 3)) + (if (or (not (get-enemy-target self)) (!= gp-4 3)) (go-stare self) ) ) @@ -487,7 +515,7 @@ (t9-0) ) ) - (let ((a0-1 (enemy-method-107 self))) + (let ((a0-1 (get-enemy-target self))) (when a0-1 (let ((a0-2 (get-trans a0-1 0))) (if (and (< (vector-vector-distance a0-2 (-> self root-override2 trans)) 20480.0) @@ -689,8 +717,8 @@ ;; definition for method 114 of type tomb-baby-spider ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 tomb-baby-spider ((obj tomb-baby-spider)) - "@abstract" +(defmethod init-enemy-collision! tomb-baby-spider ((obj tomb-baby-spider)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -764,14 +792,14 @@ ) ;; definition for method 115 of type tomb-baby-spider -(defmethod enemy-method-115 tomb-baby-spider ((obj tomb-baby-spider)) - "@abstract" +(defmethod init-enemy! tomb-baby-spider ((obj tomb-baby-spider)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-tomb-baby-spider" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *tomb-baby-spider-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *tomb-baby-spider-nav-enemy-info*) (none) ) 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 6f8b01c225..d0906a915c 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 @@ -59,7 +59,7 @@ ((left-eye joint-mod :offset-assert 604) (right-eye joint-mod :offset-assert 608) (look-at-other handle :offset-assert 616) - (neck-away-from basic :offset-assert 624) + (neck-away-from symbol :offset-assert 624) (look-at-other-time time-frame :offset-assert 632) (pad-iuj1n23i1 uint32 3 :offset-assert 640) (slow-timer time-frame :offset-assert 656) @@ -73,7 +73,7 @@ :flag-assert #xb7024002c0 (:methods (fodder-method-178 (_type_) none 178) - (fodder-method-179 (_type_ vector) float 179) + (look-at-position! (_type_ vector) float 179) (fodder-method-180 (_type_) symbol 180) (fodder-method-181 (_type_ symbol) none 181) (fodder-method-182 (_type_) float 182) @@ -152,7 +152,35 @@ :default-hit-points 1 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #x11fffdffa + :penetrate-knocked (penetrate + generic-attack + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + knocked + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -229,9 +257,11 @@ ;; definition for method 109 of type fodder ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-109 fodder ((obj fodder) (arg0 int)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-109))) - (t9-0 obj arg0) +(defmethod look-at-target! fodder ((obj fodder) (arg0 enemy-flag)) + "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available +@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" + (let ((parent-method (method-of-type nav-enemy look-at-target!))) + (parent-method obj arg0) ) (if (nonzero? (-> obj left-eye)) (mode-set! (-> obj left-eye) (joint-mod-mode polar-look-at)) @@ -245,9 +275,10 @@ ;; definition for method 110 of type fodder ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-110 fodder ((obj fodder)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-110))) - (t9-0 obj) +(defmethod stop-looking-at-target! fodder ((obj fodder)) + "Will unset [[enemy-flag::death-start]] and [[enemy-flag::lock-focus]] and call [[joint-mod::shut-down]] if applicable" + (let ((parent-method (method-of-type nav-enemy stop-looking-at-target!))) + (parent-method obj) ) (if (nonzero? (-> obj left-eye)) (shut-down (-> obj left-eye)) @@ -260,24 +291,27 @@ ) ;; definition for method 179 of type fodder -(defmethod fodder-method-179 fodder ((obj fodder) (arg0 vector)) - (when (not arg0) - (let ((a0-2 (handle->process (-> obj focus handle)))) - (if a0-2 - (set! arg0 (get-trans (the-as process-focusable a0-2) 2)) +(defmethod look-at-position! fodder ((obj fodder) (position vector)) + "Adjusts the eyes to look at particular position, or the focused target +@param position If this is provided, it will be used with [[joint-mod::target-set!]] to adjust the eyes, otherwise the `focus` position is used +@return TODO - unsure what the return value is, but it seems to make the eyes more lazy" + (when (not position) + (let ((focus-proc (handle->process (-> obj focus handle)))) + (if focus-proc + (set! position (get-trans (the-as process-focusable focus-proc) 2)) (return 0.0) ) ) ) (when (nonzero? (-> obj left-eye)) - (target-set! (-> obj left-eye) arg0) + (target-set! (-> obj left-eye) position) (when (nonzero? (-> obj left-eye)) (set! (-> obj left-eye polar-external-tilt-max) (-> obj right-eye polar-internal-tilt-max)) (set! (-> obj left-eye polar-external-radius) (-> obj right-eye polar-internal-radius)) ) ) (when (nonzero? (-> obj right-eye)) - (target-set! (-> obj right-eye) arg0) + (target-set! (-> obj right-eye) position) (when (nonzero? (-> obj right-eye)) (set! (-> obj right-eye polar-external-tilt-max) (-> obj left-eye polar-internal-tilt-max)) (set! (-> obj right-eye polar-external-radius) (-> obj left-eye polar-internal-radius)) @@ -287,46 +321,52 @@ ;; definition for method 180 of type fodder (defmethod fodder-method-180 fodder ((obj fodder)) + "@TODO no idea, never seems to do anything because the actor-group-count is always 0" (with-pp (when (>= (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.25)) - (dotimes (s5-0 (-> obj actor-group-count)) - (let ((s4-0 (-> obj actor-group s5-0))) - (dotimes (s3-0 (-> s4-0 length)) - (let* ((s1-0 (-> s4-0 data s3-0 actor extra process)) - (s2-0 (if (type? s1-0 fodder) - (the-as fodder s1-0) - ) - ) + (dotimes (group-idx (-> obj actor-group-count)) + (let ((group (-> obj actor-group group-idx))) + (dotimes (actor-idx (-> group length)) + (let* ((actor-proc (-> group data actor-idx actor extra process)) + (fodder-proc (if (type? actor-proc fodder) + (the-as fodder actor-proc) + ) + ) ) - (when (and s2-0 (!= s2-0 obj) (>= (- (-> pp clock frame-counter) (-> s2-0 look-at-other-time)) (seconds 0.25))) - (let* ((s1-2 (vector-! (new 'stack-no-clear 'vector) (-> s2-0 root-override2 trans) (-> obj root-override2 trans))) - (f0-0 (vector-length s1-2)) + (when (and fodder-proc + (!= fodder-proc obj) + (>= (- (-> pp clock frame-counter) (-> fodder-proc look-at-other-time)) (seconds 0.25)) + ) + (let* ((dir-to-other-fodder + (vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root-override2 trans) (-> obj root-override2 trans)) + ) + (dir-length (vector-length dir-to-other-fodder)) ) - (when (< f0-0 8192.0) - (vector-float*! s1-2 s1-2 (/ 1.0 f0-0)) + (when (< dir-length 8192.0) + (vector-float*! dir-to-other-fodder dir-to-other-fodder (/ 1.0 dir-length)) (let ((f30-0 (vector-dot - s1-2 + dir-to-other-fodder (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)) vector 2) ) ) ) (when (< (cos 14563.556) f30-0) - (let ((v1-29 (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) - (when v1-29 + (let ((channel (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 15)) 0.0 0.0 0.0))) + (when channel (set! (-> obj skel interp-select 0) #xe00010) (set! (-> obj skel interp-select 1) 0) - (set! (-> v1-29 param 0) 1.0) - (set! (-> v1-29 param 1) 1.0) - (set! (-> v1-29 param 2) 1.0) - (set! (-> v1-29 num-func) num-func-interp1-play!) + (set! (-> channel param 0) 1.0) + (set! (-> channel param 1) 1.0) + (set! (-> channel param 2) 1.0) + (set! (-> channel num-func) num-func-interp1-play!) ) ) (set! (-> obj look-at-other-time) (-> pp clock frame-counter)) - (set! (-> obj look-at-other) (process->handle s2-0)) + (set! (-> obj look-at-other) (process->handle fodder-proc)) (set! (-> obj neck-away-from) #f) - (set! (-> s2-0 look-at-other-time) (-> pp clock frame-counter)) - (set! (-> s2-0 look-at-other) (process->handle obj)) - (set! (-> s2-0 neck-away-from) (the-as basic #t)) + (set! (-> fodder-proc look-at-other-time) (-> pp clock frame-counter)) + (set! (-> fodder-proc look-at-other) (process->handle obj)) + (set! (-> fodder-proc neck-away-from) #t) ) ) ) @@ -342,26 +382,30 @@ ) ;; definition for method 55 of type fodder -(defmethod enemy-method-55 fodder ((obj fodder)) +(defmethod track-target! fodder ((obj 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" (with-pp - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) - (t9-0 obj) + (let ((parent-method (method-of-type nav-enemy track-target!))) + (parent-method obj) ) - (let ((v1-1 (the-as process-drawable #f))) + (let ((proc (the-as process-drawable #f))) (cond ((and (< (- (-> pp clock frame-counter) (-> obj look-at-other-time)) (seconds 0.5)) (begin - (let ((s5-0 (handle->process (-> obj look-at-other)))) - (set! v1-1 (if (type? s5-0 process-drawable) - (the-as process-drawable s5-0) + (let ((other-proc (handle->process (-> obj look-at-other)))) + (set! proc (if (type? other-proc process-drawable) + (the-as process-drawable other-proc) ) ) ) - v1-1 + proc ) ) - (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> v1-1 node-list data 5)))) - (fodder-method-179 obj s5-1) + (let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5)))) + (look-at-position! obj s5-1) (cond ((zero? (-> obj neck)) ) @@ -381,7 +425,7 @@ ) ) ((logtest? (-> obj enemy-flags) (enemy-flag lock-focus)) - (fodder-method-179 obj (the-as vector #f)) + (look-at-position! obj (the-as vector #f)) ) ) ) @@ -393,9 +437,9 @@ (defstate idle (fodder) :virtual #t :post (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy idle) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type nav-enemy idle) post))) + (if func + ((the-as (function none) func)) ) ) (update-transforms (-> self root-override2)) @@ -407,9 +451,9 @@ (defstate active (fodder) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy active) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy active) enter))) + (if func + (func) ) ) (logclear! (-> self enemy-flags) (enemy-flag spawn-gem chase-startup use-notice-distance)) @@ -437,9 +481,9 @@ (ja :num! (seek! max f30-0)) ) (when (enemy-method-123 self 0.8) - (let ((v1-33 self)) - (set! (-> v1-33 enemy-flags) (the-as enemy-flag (logclear (-> v1-33 enemy-flags) (enemy-flag enemy-flag36)))) - (set! (-> v1-33 nav callback-info) *nav-enemy-null-callback-info*) + (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*) ) 0 (set! (-> self state-time) (-> self clock frame-counter)) @@ -457,7 +501,7 @@ ) (ja-no-eval :num! (loop!)) (ja-channel-push! 1 (seconds 0.25)) - (dotimes (gp-0 (rand-vu-int-range 4 7)) + (dotimes (num-chews (rand-vu-int-range 4 7)) (ja-no-eval :group! fodder-chew-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim fodder-chew-ja) frames num-frames) -1)) f30-0) :frame-num 0.0 @@ -469,12 +513,12 @@ ) ) ) - (let ((v1-93 self)) - (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-93 enemy-flags))) - (set! (-> v1-93 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-93 enemy-flags)))) + (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)))) ) - (set! (-> v1-93 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-93 enemy-flags)))) - (set! (-> v1-93 nav callback-info) (-> v1-93 enemy-info-override callback-info)) + (set! (-> __self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> __self enemy-flags)))) + (set! (-> __self nav callback-info) (-> __self enemy-info-override callback-info)) ) 0 (ja-no-eval :num! (loop!)) @@ -514,7 +558,7 @@ (let ((f30-0 (get-rand-float-range self 0.8 1.2)) (gp-0 (new 'stack-no-clear 'vector)) ) - (enemy-method-110 self) + (stop-looking-at-target! self) (if (nonzero? (-> self neck)) (mode-set! (-> self neck) (joint-mod-mode look-at)) ) @@ -575,7 +619,7 @@ (if (nonzero? (-> self neck)) (target-set! (-> self neck) gp-0) ) - (fodder-method-179 self gp-0) + (look-at-position! self gp-0) (suspend) (ja :num! (seek! max (* 2.0 f30-0))) ) @@ -584,8 +628,8 @@ (label cfg-22) (get-rand-float-range self 0.8 1.2) (new 'stack-no-clear 'vector) - (enemy-method-109 self 1) - (enemy-method-110 self) + (look-at-target! self (enemy-flag lock-focus)) + (stop-looking-at-target! self) (if (nonzero? (-> self left-eye)) (shut-down (-> self left-eye)) ) @@ -594,7 +638,7 @@ ) (let ((gp-1 (-> self focus aware))) (cond - ((and (= gp-1 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-1 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) ((>= 1 (the-as int gp-1)) @@ -641,9 +685,9 @@ (defstate hostile (fodder) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy hostile) enter))) + (if func + (func) ) ) (fodder-method-181 self #t) @@ -1063,8 +1107,8 @@ ;; definition for method 114 of type fodder ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 fodder ((obj fodder)) - "@abstract" +(defmethod init-enemy-collision! fodder ((obj fodder)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1155,8 +1199,8 @@ ;; definition for method 115 of type fodder ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 fodder ((obj fodder)) - "@abstract" +(defmethod init-enemy! fodder ((obj fodder)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1164,7 +1208,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *fodder-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *fodder-nav-enemy-info*) (when (zero? (-> obj left-eye)) (set! (-> obj left-eye) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj 23)) (fodder-setup-eye-control (-> obj left-eye)) 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 4924923b67..1f4ecb6f38 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 @@ -165,7 +165,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list pusher) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.5 :attack-shove-back (meters 3) @@ -279,7 +344,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list pusher) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.5 :attack-shove-back (meters 3) @@ -393,7 +523,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list pusher) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.5 :attack-shove-back (meters 3) @@ -507,7 +702,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list pusher) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.5 :attack-shove-back (meters 3) @@ -621,7 +881,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd obstacle hit-by-others-list pusher) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.5 :attack-shove-back (meters 3) @@ -818,13 +1143,14 @@ ) ;; definition for method 72 of type crimson-guard-level -(defmethod enemy-method-72 crimson-guard-level ((obj crimson-guard-level)) +(defmethod react-to-focus crimson-guard-level ((obj crimson-guard-level)) + "@TODO - flesh out docs" (let ((s5-0 (-> obj focus aware))) (cond - ((and (= s5-0 (enemy-aware enemy-aware-3)) (enemy-method-107 obj)) + ((and (= s5-0 (enemy-aware enemy-aware-3)) (get-enemy-target obj)) (go-hostile obj) ) - ((and (= s5-0 (enemy-aware enemy-aware-2)) (enemy-method-107 obj)) + ((and (= s5-0 (enemy-aware enemy-aware-2)) (get-enemy-target obj)) (go-hostile obj) ) ((<= (the-as int s5-0) 0) @@ -833,7 +1159,7 @@ ((>= 1 (the-as int s5-0)) (go (method-of-object obj active)) ) - ((= s5-0 (enemy-aware enemy-aware-4)) + ((= s5-0 (enemy-aware unaware)) (go-flee obj) ) (else @@ -879,16 +1205,16 @@ ((>= 1 (the-as int gp-0)) (go-virtual active) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((and (= gp-0 (enemy-aware enemy-aware-2)) (enemy-method-107 self)) + ((and (= gp-0 (enemy-aware enemy-aware-2)) (get-enemy-target self)) (if (logtest? (-> self flags) 1) (go-virtual arrest) (go-hostile self) ) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -900,7 +1226,9 @@ ;; definition for method 74 of type crimson-guard-level ;; WARN: Return type mismatch none vs object. -(defmethod enemy-method-74 crimson-guard-level ((obj crimson-guard-level) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler crimson-guard-level ((obj crimson-guard-level) (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" (let ((v1-0 arg2)) (the-as object @@ -923,7 +1251,7 @@ (speech-control-method-12 *speech-control* obj (speech-type speech-type-0 speech-type-1 speech-type-3)) ) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ((= v1-0 'trigger) (let ((v0-0 (the-as object #t))) @@ -947,10 +1275,10 @@ ) ) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1279,8 +1607,12 @@ ;; definition for method 55 of type crimson-guard-level ;; WARN: Return type mismatch object vs none. -(defmethod enemy-method-55 crimson-guard-level ((obj crimson-guard-level)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! crimson-guard-level ((obj 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!))) (t9-0 obj) ) (if (-> obj joint-enable) @@ -1370,7 +1702,7 @@ (set! (-> self enemy-flags) (logclear v1-4 (enemy-flag called-dying))) ) (logclear! (-> self mask) (process-mask actor-pause)) - (enemy-method-109 self 1) + (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)) (let ((gp-1 (-> self on-notice))) @@ -1385,13 +1717,13 @@ (let ((gp-2 (-> self focus aware))) (when (logtest? (-> self enemy-flags) (enemy-flag chase-startup)) (cond - ((and (= gp-2 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= gp-2 (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((and (= gp-2 (enemy-aware enemy-aware-2)) (enemy-method-107 self)) + ((and (= gp-2 (enemy-aware enemy-aware-2)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-2 (enemy-aware enemy-aware-4)) + ((= gp-2 (enemy-aware unaware)) (go-flee self) ) (else @@ -1438,7 +1770,7 @@ (go-virtual grenade-attack) ) (else - (enemy-method-72 self) + (react-to-focus self) ) ) (none) @@ -1462,7 +1794,7 @@ (if (logtest? (-> self flags) 4) (go-virtual gun-shoot) ) - (set! (-> self reaction-time) (the-as uint (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 (get-rand-float-range self 1.0 3.0))))) (none) ) :exit (behavior () @@ -1471,12 +1803,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (< (the-as int gp-0) 2) (not (enemy-method-107 self))) + ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1552,7 +1884,7 @@ :enter (behavior () ((-> (method-of-type nav-enemy hostile) enter)) (set! (-> self state-time) (-> self clock frame-counter)) - (set! (-> self reaction-time) (the-as uint (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 (get-rand-float-range self 0.5 1.5))))) (none) ) :exit (behavior () @@ -1561,12 +1893,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1632,12 +1964,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (< (the-as int gp-0) 2) (not (enemy-method-107 self))) + ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1715,12 +2047,12 @@ ) :trans (behavior () (let ((gp-0 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond - ((or (< (the-as int gp-0) 2) (not (enemy-method-107 self))) + ((or (< (the-as int gp-0) 2) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -1808,7 +2140,7 @@ (set! (-> self miss-amount) 0.0) (set! (-> self next-shot) (the-as int (-> self clock frame-counter))) (set! (-> self joint-enable) #t) - (set! (-> self reaction-time) (the-as uint (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 (get-rand-float-range self 3.0 5.0))))) (none) ) :exit (behavior () @@ -1819,7 +2151,7 @@ :trans (behavior () (crimson-guard-level-method-200 self) (let ((v1-2 (-> self focus aware))) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (cond ((< (the-as int v1-2) 2) (go-stare self) @@ -1827,7 +2159,7 @@ ((= v1-2 (enemy-aware enemy-aware-3)) (go-hostile self) ) - ((= v1-2 (enemy-aware enemy-aware-4)) + ((= v1-2 (enemy-aware unaware)) (go-flee self) ) ) @@ -1853,7 +2185,7 @@ ) ) (until #f - (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (or (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (< 10922.667 (fabs (-> self target-y-angle))) ) (goto cfg-13) @@ -3027,7 +3359,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (enemy-method-55 self) + (track-target! self) (none) ) ) @@ -3093,7 +3425,7 @@ (set! (-> a0-0 travel quad) (-> v1-1 quad)) ) 0 - (enemy-method-55 self) + (track-target! self) (none) ) ) @@ -3856,7 +4188,7 @@ (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) (.svf (&-> v1-10 quad) vf6) ) - (if (enemy-method-126 obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) ) (let ((v1-14 (-> obj nav)) @@ -3914,7 +4246,7 @@ ) 0 (set! (-> s1-0 y) (-> sv-784 y)) - (if (enemy-method-126 obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? obj s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) ) (set! (-> arg0 quad) (-> s1-0 quad)) @@ -4098,7 +4430,7 @@ (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) (.svf (&-> a0-3 quad) vf6) ) - (if (enemy-method-126 self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) ) @@ -4163,8 +4495,8 @@ ;; definition for method 114 of type crimson-guard-level ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 crimson-guard-level ((obj crimson-guard-level)) - "@abstract" +(defmethod init-enemy-collision! crimson-guard-level ((obj crimson-guard-level)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -4304,8 +4636,8 @@ ;; definition for method 115 of type crimson-guard-level ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 crimson-guard-level ((obj crimson-guard-level)) - "@abstract" +(defmethod init-enemy! crimson-guard-level ((obj crimson-guard-level)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (local-vars (sv-16 int)) (let ((f0-0 (res-lump-float (-> obj entity) 'rotoffset))) (if (!= f0-0 0.0) @@ -4342,22 +4674,22 @@ ) ) (set! (-> obj info) *crimson-guard-level-global-info*) - (enemy-method-113 obj *crimson-guard-level-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-info*) (cond ((logtest? (-> obj flags) 1) - (enemy-method-113 obj *crimson-guard-level-tazer-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-tazer-info*) ) ((logtest? (-> obj flags) 4) - (enemy-method-113 obj *crimson-guard-level-sniper-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-sniper-info*) ) ((logtest? (-> obj flags) 2) - (enemy-method-113 obj *crimson-guard-level-blast-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-blast-info*) ) ((logtest? (-> obj flags) 8) - (enemy-method-113 obj *crimson-guard-level-grenade-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-grenade-info*) ) (else - (enemy-method-113 obj *crimson-guard-level-info*) + (init-enemy-behaviour-and-stats! obj *crimson-guard-level-info*) ) ) (let ((v1-34 (-> obj nav))) @@ -4495,7 +4827,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior crimson-guard-level-init-by-other crimson-guard-level ((arg0 crimson-guard-level-params)) - (enemy-method-114 self) + (init-enemy-collision! self) (set! (-> self root-override2 trans quad) (-> arg0 pos quad)) (quaternion-copy! (-> self root-override2 quat) (-> arg0 quat)) (vector-identity! (-> self root-override2 scale)) @@ -4503,7 +4835,7 @@ (add-process-drawable-to-navmesh (-> arg0 nav-mesh) self #t) (set! (-> arg0 proc) self) (set! (-> self transport) (the-as handle (-> arg0 handle))) - (enemy-method-115 self) + (init-enemy! self) (crimson-guard-level-method-203 self (-> arg0 weapon)) (logior! (-> self flags) 96) (go-virtual exit-transport) 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 cd8a51ea76..c0adcc34f0 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc @@ -261,7 +261,72 @@ :default-hit-points 1 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -339,14 +404,15 @@ (set! (-> *hopper-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 73 of type hopper -(defmethod enemy-method-73 hopper ((obj hopper)) +(defmethod kill-prefer-falling hopper ((obj hopper)) + "If available in `enemy-info`, [[go]] to the [[die-falling]] state, if not, [[die]]" (cond ((-> obj can-go-knocked?) (set! (-> obj can-go-knocked?) #f) (go (method-of-object obj knocked)) ) (else - ((method-of-type nav-enemy enemy-method-73) obj) + ((method-of-type nav-enemy kill-prefer-falling) obj) ) ) (none) @@ -599,7 +665,7 @@ ) 0 (set! (-> s5-0 y) (-> s2-0 y)) - (if (enemy-method-126 obj s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? obj s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> s5-0 y) (-> s3-1 best-other-tri intersect y)) ) ) @@ -734,7 +800,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -802,7 +868,7 @@ (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack 'collide-query))) (get-point-in-path! (-> self path-intro) gp-0 1.0 'exact) - (if (enemy-method-126 self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? self s5-0 gp-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> gp-0 y) (-> s5-0 best-other-tri intersect y)) ) ) @@ -815,7 +881,8 @@ ) ;; definition for method 132 of type hopper -(defmethod enemy-method-132 hopper ((obj hopper)) +(defmethod dispose! hopper ((obj hopper)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> obj minimap) (logior! (-> obj minimap flags) (minimap-flag fade-out)) (set! (-> obj minimap) #f) @@ -838,8 +905,8 @@ ;; definition for method 114 of type hopper ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 hopper ((obj hopper)) - "@abstract" +(defmethod init-enemy-collision! hopper ((obj hopper)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -904,8 +971,8 @@ ;; definition for method 115 of type hopper ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 hopper ((obj hopper)) - "@abstract" +(defmethod init-enemy! hopper ((obj hopper)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -913,7 +980,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *hopper-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *hopper-nav-enemy-info*) (set! (-> obj can-go-knocked?) #t) (let ((v1-9 (-> obj neck))) (set! (-> v1-9 up) (the-as uint 1)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc index bf99519036..7b287a39d9 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_bearer/centurion_REF.gc @@ -175,7 +175,7 @@ ) ;; definition for method 28 of type centurion-shot -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound centurion-shot ((obj centurion-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -190,7 +190,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; definition for method 31 of type centurion-shot @@ -359,7 +360,72 @@ :default-hit-points 3 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.1 :attack-shove-back (meters 3) @@ -437,7 +503,9 @@ (set! (-> *centurion-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type centurion -(defmethod enemy-method-74 centurion ((obj centurion) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler centurion ((obj centurion) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('jump) @@ -474,7 +542,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -490,10 +558,10 @@ (cond ((and (-> obj next-state) (= (-> obj next-state name) 'fire)) (centurion-method-180 obj) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -535,7 +603,7 @@ ) (let ((a1-13 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-13 from) (process->ppointer arg0)) - (set! (-> a1-13 num-params) (the-as int arg1)) + (set! (-> a1-13 num-params) arg1) (set! (-> a1-13 message) 'victory) (set! (-> a1-13 param 0) (-> arg3 param 0)) (set! (-> a1-13 param 1) (-> arg3 param 1)) @@ -549,7 +617,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -671,7 +739,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (set! (-> self victory-sound) (new 'static 'sound-id)) 0 (none) @@ -971,15 +1039,20 @@ ) ;; definition for method 132 of type centurion -(defmethod enemy-method-132 centurion ((obj centurion)) - (talker-speech-class-method-10 (-> *talker-speech* 58)) +(defmethod dispose! centurion ((obj centurion)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" + (play-communicator-speech! (-> *talker-speech* 58)) ((the-as (function enemy none) (find-parent-method centurion 132)) obj) (none) ) ;; definition for method 55 of type centurion ;; INFO: Used lq/sq -(defmethod enemy-method-55 centurion ((obj centurion)) +(defmethod track-target! centurion ((obj 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 +@TODO Not extremely well understood yet" (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -1067,7 +1140,7 @@ ) (logior! (-> obj skel status) (joint-control-status sync-math)) (los-control-method-9 (-> obj los) (the-as process-focusable #f) (the-as vector #f) 2048.0) - (let ((t9-12 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-12 (method-of-type nav-enemy track-target!))) (t9-12 obj) ) (when (not (logtest? (-> obj draw status) (draw-control-status no-draw))) @@ -1244,7 +1317,7 @@ ) (else (when (-> self can-shoot?) - (if (and (enemy-method-107 self) + (if (and (get-enemy-target self) (>= (- (-> self clock frame-counter) (-> self state-time)) (the int (+ 60.0 (* 0.0036621094 f30-0)))) (check-los? (-> self los) 0) ) @@ -1500,7 +1573,7 @@ ;; definition for method 63 of type centurion ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 centurion ((obj centurion) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 centurion ((obj centurion) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1511,8 +1584,8 @@ ;; definition for method 114 of type centurion ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 centurion ((obj centurion)) - "@abstract" +(defmethod init-enemy-collision! centurion ((obj centurion)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1602,8 +1675,8 @@ ;; definition for method 115 of type centurion ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 centurion ((obj centurion)) - "@abstract" +(defmethod init-enemy! centurion ((obj centurion)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1611,7 +1684,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *centurion-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *centurion-nav-enemy-info*) (set! (-> obj shield-shot) (the-as uint 0)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 474) obj)) (let ((v1-11 (-> obj neck))) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc index befb47483a..6800f17372 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_brown/metalmonk_REF.gc @@ -163,7 +163,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -366,8 +431,12 @@ ;; definition for method 55 of type metalmonk ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 metalmonk ((obj metalmonk)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! metalmonk ((obj 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!))) (t9-0 obj) ) (set! (-> obj old-facing quad) (-> obj new-facing quad)) @@ -377,7 +446,9 @@ ) ;; definition for method 74 of type metalmonk -(defmethod enemy-method-74 metalmonk ((obj metalmonk) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler metalmonk ((obj metalmonk) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked 'hit-flinch) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -410,7 +481,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -429,7 +500,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -602,7 +673,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -617,7 +688,7 @@ ) ) (let ((gp-0 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (and gp-0 (or (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) 20480.0 @@ -847,7 +918,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) ) ) (none) @@ -866,7 +937,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1104,8 +1175,8 @@ ;; definition for method 114 of type metalmonk ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 metalmonk ((obj metalmonk)) - "@abstract" +(defmethod init-enemy-collision! metalmonk ((obj metalmonk)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1233,8 +1304,8 @@ ;; definition for method 115 of type metalmonk ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 metalmonk ((obj metalmonk)) - "@abstract" +(defmethod init-enemy! metalmonk ((obj metalmonk)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1242,7 +1313,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *metalmonk-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *metalmonk-nav-enemy-info*) (let ((v1-8 (-> obj neck))) (set! (-> v1-8 up) (the-as uint 1)) (set! (-> v1-8 nose) (the-as uint 2)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc index cfbccb7df6..e6cf4bc8f4 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalhead_slinger/grenadier_REF.gc @@ -174,7 +174,72 @@ :default-hit-points 14 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -252,7 +317,9 @@ (set! (-> *grenadier-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type grenadier -(defmethod enemy-method-74 grenadier ((obj grenadier) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler grenadier ((obj grenadier) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('hit-knocked) @@ -266,14 +333,14 @@ (logior! (-> obj status-flags) 1) (set! (-> obj suppress-knockaside-timer) (-> pp clock frame-counter)) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (('notify) (cond ((and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) (let ((v1-23 (new 'stack-no-clear 'event-message-block))) (set! (-> v1-23 from) (process->ppointer arg0)) - (set! (-> v1-23 num-params) (the-as int arg1)) + (set! (-> v1-23 num-params) arg1) (set! (-> v1-23 message) 'victory) (set! (-> v1-23 param 0) (-> arg3 param 0)) (set! (-> v1-23 param 1) (-> arg3 param 1)) @@ -285,12 +352,12 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -498,7 +565,7 @@ ) ) (grenadier-method-181 self) - (enemy-method-109 self 2) + (look-at-target! self (enemy-flag death-start)) (set! (-> self status-flags) (logand -2 (-> self status-flags))) (none) ) @@ -515,7 +582,7 @@ (f30-0 (vector-vector-distance gp-0 s5-0)) ) (cond - ((and (< f30-0 12288.0) (enemy-method-107 self)) + ((and (< f30-0 12288.0) (get-enemy-target self)) (go-virtual spin-kick) ) ((< f30-0 40960.0) @@ -864,7 +931,7 @@ (set! (-> v1-11 attack-id) a0-19) (set! (-> self attack-id) a0-19) ) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (none) ) :exit (behavior () @@ -1156,7 +1223,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1213,8 +1280,12 @@ ) ;; definition for method 55 of type grenadier -(defmethod enemy-method-55 grenadier ((obj grenadier)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! grenadier ((obj 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!))) (t9-0 obj) ) (let ((a1-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 34)))) @@ -1225,8 +1296,8 @@ ;; definition for method 114 of type grenadier ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 grenadier ((obj grenadier)) - "@abstract" +(defmethod init-enemy-collision! grenadier ((obj grenadier)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1331,14 +1402,14 @@ ;; definition for method 115 of type grenadier ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 grenadier ((obj grenadier)) - "@abstract" +(defmethod init-enemy! grenadier ((obj grenadier)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-grenadier" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *grenadier-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *grenadier-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (when v1-5 (set! (-> v1-5 up) (the-as uint 1)) 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 4bed0682bf..54cc34eddf 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc @@ -24,7 +24,7 @@ ) ;; definition for method 28 of type spyder-shot -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound spyder-shot ((obj spyder-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -36,7 +36,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; definition for method 31 of type spyder-shot @@ -160,7 +161,72 @@ :default-hit-points 8 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -238,7 +304,9 @@ (set! (-> *spyder-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type spyder -(defmethod enemy-method-74 spyder ((obj spyder) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler spyder ((obj spyder) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('hit-knocked) @@ -269,7 +337,7 @@ (if (type? (-> arg0 parent 0) enemy) (logior! (-> obj status-flags) 2) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (('notify) (cond @@ -278,7 +346,7 @@ ((= (-> arg3 param 1) (handle->process (-> obj focus handle))) (let ((a1-6 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-6 from) (process->ppointer arg0)) - (set! (-> a1-6 num-params) (the-as int arg1)) + (set! (-> a1-6 num-params) arg1) (set! (-> a1-6 message) 'victory) (set! (-> a1-6 param 0) (-> arg3 param 0)) (set! (-> a1-6 param 1) (-> arg3 param 1)) @@ -290,12 +358,12 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -306,10 +374,10 @@ (sound-play "spyder-uncloak") ) (send-event obj 'cue-chase) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -659,13 +727,17 @@ ) ;; definition for method 55 of type spyder -(defmethod enemy-method-55 spyder ((obj spyder)) +(defmethod track-target! spyder ((obj 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 +@TODO Not extremely well understood yet" (spyder-method-185 obj) (spyder-method-184 obj (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> obj root-override2 quat))) (update-trans! (-> obj sound) (-> obj root-override2 trans)) (update! (-> obj sound)) (spyder-method-182 obj) - (let ((t9-6 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-6 (method-of-type nav-enemy track-target!))) (t9-6 obj) ) (set! (-> obj status-flags) (logand -2 (-> obj status-flags))) @@ -877,7 +949,7 @@ ) ) (spyder-method-181 self) - (enemy-method-109 self 2) + (look-at-target! self (enemy-flag death-start)) (set! (-> self status-flags) (logand -3 (-> self status-flags))) (when (!= (-> self dest-fade) 128.0) (set! (-> self shock-effect-end) (+ (-> self clock frame-counter) (seconds 1))) @@ -893,7 +965,7 @@ ) ) (set! (-> self status-flags) (logand -33 (-> self status-flags))) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (none) ) :trans (behavior () @@ -1049,7 +1121,7 @@ (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-4 enemy-flags)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) (none) ) @@ -1065,7 +1137,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (if (or (>= 2 (the-as int (-> self focus aware))) (not (enemy-method-107 self))) + (if (or (>= 2 (the-as int (-> self focus aware))) (not (get-enemy-target self))) (go-stare self) ) (none) @@ -1249,7 +1321,7 @@ ;; definition for method 63 of type spyder ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 spyder ((obj spyder) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 spyder ((obj spyder) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1260,8 +1332,8 @@ ;; definition for method 114 of type spyder ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 spyder ((obj spyder)) - "@abstract" +(defmethod init-enemy-collision! spyder ((obj spyder)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1380,14 +1452,14 @@ ;; definition for method 115 of type spyder ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 spyder ((obj spyder)) - "@abstract" +(defmethod init-enemy! spyder ((obj spyder)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-spyder" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *spyder-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *spyder-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (set! (-> v1-5 up) (the-as uint 1)) (set! (-> v1-5 nose) (the-as uint 2)) diff --git a/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc index ad9940bb9f..3870f6ac0c 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc @@ -157,20 +157,20 @@ (vector-flatten! touched-from-dir touched-from-dir spike-quat) (set! (-> touched-from-dir y) 0.0) (vector-normalize! touched-from-dir 1.0) - (let ((response (new 'stack-no-clear 'event-message-block))) - (set! (-> response from) (process->ppointer self)) - (set! (-> response num-params) 2) - (set! (-> response message) 'attack) - (set! (-> response param 0) (-> event param 0)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack) + (set! (-> evt param 0) (-> event param 0)) (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector mode shove-back shove-up id)))) (set! (-> attack-info id) (the-as uint (-> self attack-id))) (set! (-> attack-info mode) 'deadly) (set! (-> attack-info shove-up) 24576.0) (set! (-> attack-info shove-back) 16384.0) (set! (-> attack-info vector quad) (-> touched-from-dir quad)) - (set! (-> response param 1) (the-as uint attack-info)) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function proc response) + (send-event-function proc evt) ) ) (let ((frame-count (-> self clock frame-counter))) diff --git a/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc index d3a931bc29..84dbe2eb3a 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/sew-gunturret_REF.gc @@ -493,10 +493,10 @@ (gun-tilt float :offset-assert 564) (desired-twist float :offset-assert 568) (desired-tilt float :offset-assert 572) - (los-clear basic :offset-assert 576) + (los-clear symbol :offset-assert 576) (smoke-part sparticle-launch-control :offset-assert 580) (casing-part sparticle-launch-control :offset-assert 584) - (flash-state basic :offset-assert 588) + (flash-state symbol :offset-assert 588) (can-shoot symbol :offset-assert 592) (last-hit-time time-frame :offset-assert 600) (init-mat matrix :inline :offset-assert 608) @@ -507,11 +507,11 @@ :size-assert #x2a4 :flag-assert #x8e023002a4 (:methods - (sew-gunturret-method-137 (_type_ symbol) none 137) - (sew-gunturret-method-138 (_type_) none 138) - (sew-gunturret-method-139 (_type_) none 139) - (sew-gunturret-method-140 (_type_ symbol) none 140) - (sew-gunturret-method-141 (_type_) none 141) + (aim-turret! (_type_ symbol) none 137) + (update-collision! (_type_) none 138) + (set-aim-at-default! (_type_) none 139) + (fire-turret! (_type_ symbol) none 140) + (init-turret-params! (_type_) none 141) ) ) @@ -630,17 +630,19 @@ ;; definition for method 137 of type sew-gunturret ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod sew-gunturret-method-137 sew-gunturret ((obj sew-gunturret) (arg0 symbol)) +(defmethod aim-turret! sew-gunturret ((obj sew-gunturret) (aim-at-target? symbol)) + "Calculates the angle and tilt for the turret to either aim at the target, or it's default direction +@param aim-at-target? Whether or not the turret should aim at the target, will ignore the target if #f" (cond - ((and arg0 (-> obj los-clear)) - (let ((a0-2 (handle->process (-> obj focus handle)))) - (if a0-2 - (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable a0-2) 3) quad)) + ((and aim-at-target? (-> obj los-clear)) + (let ((target-proc (handle->process (-> obj focus handle)))) + (if target-proc + (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) ) ) ) (else - (sew-gunturret-method-139 obj) + (set-aim-at-default! obj) ) ) (let ((s4-0 (new 'stack-no-clear 'vector)) @@ -686,11 +688,11 @@ (-> obj aim-pos) (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj params gun-joint))) ) - (let ((s5-4 (new 'stack-no-clear 'matrix))) + (let ((matrix (new 'stack-no-clear 'matrix))) (+! (-> obj gun-twist) (fmax -364.0889 (fmin 364.0889 (* 0.3 (- (-> obj desired-twist) (-> obj gun-twist)))))) - (matrix-rotate-y! s5-4 (-> obj gun-twist)) - (matrix*! s5-4 s5-4 (-> obj init-mat)) - (matrix->quaternion (-> obj root-override2 quat) s5-4) + (matrix-rotate-y! matrix (-> obj gun-twist)) + (matrix*! matrix matrix (-> obj init-mat)) + (matrix->quaternion (-> obj root-override2 quat) matrix) ) (+! (-> obj gun-tilt) (fmax -364.0889 (fmin 364.0889 (* 0.3 (- (-> obj desired-tilt) (-> obj gun-tilt)))))) (quaternion-axis-angle! (-> obj gun-tilt-jm quat) 1.0 0.0 0.0 (-> obj gun-tilt)) @@ -701,10 +703,11 @@ ;; definition for method 138 of type sew-gunturret ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod sew-gunturret-method-138 sew-gunturret ((obj sew-gunturret)) - (let ((a0-2 (handle->process (-> obj focus handle)))) - (if a0-2 - (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable a0-2) 3) quad)) +(defmethod update-collision! sew-gunturret ((obj sew-gunturret)) + "Updates the collision for the turret based on it's aiming direction" + (let ((target-proc (handle->process (-> obj focus handle)))) + (if target-proc + (set! (-> obj aim-pos quad) (-> (get-trans (the-as process-focusable target-proc) 3) quad)) ) ) (let* ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj params gun-joint)))) @@ -713,22 +716,24 @@ (when (< (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-3 1.0) (-> obj init-mat vector 2)) (cos 364.0889) ) - (let ((a1-5 (new 'stack-no-clear 'collide-query))) - (set! (-> a1-5 start-pos quad) (-> s4-0 quad)) - (set! (-> a1-5 move-dist quad) (-> s5-3 quad)) - (let ((v1-17 a1-5)) - (set! (-> v1-17 radius) 409.6) - (set! (-> v1-17 collide-with) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> s4-0 quad)) + (set! (-> cquery move-dist quad) (-> s5-3 quad)) + (let ((_cquery cquery)) + (set! (-> _cquery radius) 409.6) + (set! (-> _cquery collide-with) (collide-spec backgnd crate obstacle hit-by-player-list hit-by-others-list pusher) ) - (set! (-> v1-17 ignore-process0) obj) - (set! (-> v1-17 ignore-process1) #f) - (set! (-> v1-17 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-17 action-mask) (collide-action solid)) + (set! (-> _cquery ignore-process0) obj) + (set! (-> _cquery ignore-process1) #f) + (set! (-> _cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> _cquery action-mask) (collide-action solid)) ) - (if (>= (fill-and-probe-using-line-sphere *collide-cache* a1-5) 0.0) + (if (>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) (set! (-> obj los-clear) #f) - (set! (-> obj los-clear) (the-as basic #t)) + (set! (-> obj los-clear) #t) ) ) ) @@ -739,7 +744,8 @@ ;; definition for method 139 of type sew-gunturret ;; WARN: Return type mismatch int vs none. -(defmethod sew-gunturret-method-139 sew-gunturret ((obj sew-gunturret)) +(defmethod set-aim-at-default! sew-gunturret ((obj sew-gunturret)) + "Aims the turret at it's default direction. Sets `aim-pos` accordingly" (vector+float*! (-> obj aim-pos) (-> obj root-override2 trans) (-> obj init-mat vector 2) 163840.0) 0 (none) @@ -747,44 +753,46 @@ ;; definition for method 140 of type sew-gunturret ;; INFO: Used lq/sq -(defmethod sew-gunturret-method-140 sew-gunturret ((obj sew-gunturret) (arg0 symbol)) +(defmethod fire-turret! sew-gunturret ((obj sew-gunturret) (fire-sound? symbol)) + "Actually fires the turret, sets `flash-state` to [[#t]] +@param fire-sound? Whether to play the fire sound effect or not" (let ((v1-4 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data (-> obj params gun-joint)))) - (s4-0 (new 'stack-no-clear 'projectile-init-by-other-params)) + (proj-params (new 'stack-no-clear 'projectile-init-by-other-params)) ) (let* ((s2-1 (vector-! (new 'stack-no-clear 'vector) (-> obj aim-pos) v1-4)) (f30-0 (/ 2013265900.0 (vector-length s2-1))) - (s3-0 (new 'stack-no-clear 'vector)) + (temp-vec (new 'stack-no-clear 'vector)) ) - (set! (-> s4-0 ent) (-> obj entity)) - (set! (-> s4-0 charge) 1.0) - (set! (-> s4-0 options) (projectile-options)) - (set! (-> s4-0 pos quad) (-> v1-4 quad)) - (set! (-> s4-0 notify-handle) (process->handle obj)) - (set! (-> s4-0 owner-handle) (the-as handle #f)) - (set! (-> s4-0 ignore-handle) (process->handle obj)) + (set! (-> proj-params ent) (-> obj entity)) + (set! (-> proj-params charge) 1.0) + (set! (-> proj-params options) (projectile-options)) + (set! (-> proj-params pos quad) (-> v1-4 quad)) + (set! (-> proj-params notify-handle) (process->handle obj)) + (set! (-> proj-params owner-handle) (the-as handle #f)) + (set! (-> proj-params ignore-handle) (process->handle obj)) (let* ((v1-12 *game-info*) (a0-18 (+ (-> v1-12 attack-id) 1)) ) (set! (-> v1-12 attack-id) a0-18) - (set! (-> s4-0 attack-id) a0-18) + (set! (-> proj-params attack-id) a0-18) ) - (set! (-> s4-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) - (vector-normalize-copy! (-> s4-0 vel) s2-1 491520.0) + (set! (-> proj-params timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (vector-normalize-copy! (-> proj-params vel) s2-1 491520.0) (let ((f30-1 (fmin 16384.0 f30-0))) - (set-vector! s3-0 (-> s2-1 z) (-> s2-1 y) (- (-> s2-1 x)) 1.0) - (vector-normalize! s3-0 (rand-vu-float-range (- f30-1) f30-1)) - (vector+! (-> s4-0 vel) (-> s4-0 vel) s3-0) - (vector-cross! s3-0 s3-0 (-> s4-0 vel)) - (vector-normalize! s3-0 (rand-vu-float-range (- f30-1) f30-1)) + (set-vector! temp-vec (-> s2-1 z) (-> s2-1 y) (- (-> s2-1 x)) 1.0) + (vector-normalize! temp-vec (rand-vu-float-range (- f30-1) f30-1)) + (vector+! (-> proj-params vel) (-> proj-params vel) temp-vec) + (vector-cross! temp-vec temp-vec (-> proj-params vel)) + (vector-normalize! temp-vec (rand-vu-float-range (- f30-1) f30-1)) ) - (vector+! (-> s4-0 vel) (-> s4-0 vel) s3-0) + (vector+! (-> proj-params vel) (-> proj-params vel) temp-vec) ) - (spawn-projectile guard-shot s4-0 obj *default-dead-pool*) + (spawn-projectile guard-shot proj-params obj *default-dead-pool*) ) - (if arg0 + (if fire-sound? (sound-play "gtur-shot-fire") ) - (set! (-> obj flash-state) (the-as basic #t)) + (set! (-> obj flash-state) #t) (spawn-with-cspace (-> obj casing-part) (-> obj node-list data (-> obj params hole-joints 0))) (spawn-with-cspace (-> obj casing-part) (-> obj node-list data (-> obj params hole-joints 1))) (spawn-with-cspace (-> obj casing-part) (-> obj node-list data (-> obj params hole-joints 2))) @@ -800,9 +808,9 @@ (defstate hostile (sew-gunturret) :virtual #t :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy hostile) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy hostile) exit))) + (if func + (func) ) ) (ja :group! (-> self draw art-group data (-> self params idle-anim))) @@ -813,32 +821,32 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (none) ) :code (behavior () - (sew-gunturret-method-139 self) + (set-aim-at-default! self) (until #f (-> self clock frame-counter) (until (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) (suspend) ) - (sew-gunturret-method-138 self) + (update-collision! self) (sound-play "sew-gun-lock") - (let ((gp-1 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.75)) - (sew-gunturret-method-137 self #t) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 0.75)) + (aim-turret! self #t) (suspend) ) ) (ja :group! (-> self draw art-group data (-> self params shoot-anim))) - (let ((s5-1 0) - (gp-2 #t) + (let ((frames 0) + (fire-sound? #t) ) (sound-play "gturret") (let ((s4-1 (-> self clock frame-counter))) @@ -846,10 +854,10 @@ (cond ((not (-> self can-shoot)) ) - ((>= (- (-> self clock frame-counter) (the-as time-frame s5-1)) (seconds 0.05)) - (sew-gunturret-method-140 self gp-2) - (set! s5-1 (the-as int (-> self clock frame-counter))) - (set! gp-2 (not gp-2)) + ((>= (- (-> self clock frame-counter) (the-as time-frame frames)) (seconds 0.05)) + (fire-turret! self fire-sound?) + (set! frames (the-as int (-> self clock frame-counter))) + (set! fire-sound? (not fire-sound?)) ) (else (set! (-> self flash-state) #f) @@ -863,8 +871,8 @@ (set! (-> self flash-state) #f) (ja-channel-push! 1 (seconds 0.2)) (ja :group! (-> self draw art-group data (-> self params idle-anim))) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 0.5)) + (let ((_frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 0.5)) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 0))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 1))) (spawn-with-cspace (-> self smoke-part) (-> self node-list data (-> self params hole-joints 2))) @@ -886,25 +894,27 @@ (defstate stare (sew-gunturret) :virtual #t :trans (behavior () - (let ((t9-0 (-> (method-of-type enemy stare) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy stare) trans))) + (if func + (func) ) ) (if (!= (-> self activate-distance) 0.0) - (sew-gunturret-method-137 self #f) + (aim-turret! self #f) ) (none) ) ) ;; definition for method 74 of type sew-gunturret -(defmethod enemy-method-74 sew-gunturret ((obj sew-gunturret) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler sew-gunturret ((obj sew-gunturret) (proc process) (arg2 int) (event-type symbol) (event event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp - (if (and (= arg2 'notify) (< 1 (the-as int arg1)) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (if (and (= event-type 'notify) (< 1 arg2) (= (-> event param 0) 'attack) (= (-> event param 1) *target*)) (set! (-> obj last-hit-time) (-> pp clock frame-counter)) ) - (case arg2 + (case event-type (('start) (let ((v0-0 (the-as object #t))) (set! (-> obj can-shoot) (the-as symbol v0-0)) @@ -916,24 +926,24 @@ #f ) (('bonk) - (send-event arg0 'target-mech-get-off 90) - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) (process->ppointer pp)) - (set! (-> a1-10 num-params) 2) - (set! (-> a1-10 message) 'shove) - (set! (-> a1-10 param 0) (the-as uint #f)) - (let ((v1-17 (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) - (let* ((a0-4 *game-info*) - (a2-2 (+ (-> a0-4 attack-id) 1)) + (send-event proc 'target-mech-get-off 90) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer pp)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'shove) + (set! (-> evt param 0) (the-as uint #f)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> a0-4 attack-id) a2-2) - (set! (-> v1-17 id) a2-2) + (set! (-> game-info attack-id) id) + (set! (-> attack-info id) id) ) - (set! (-> v1-17 shove-back) 8192.0) - (set! (-> v1-17 shove-up) 2048.0) - (set! (-> a1-10 param 1) (the-as uint v1-17)) + (set! (-> attack-info shove-back) 8192.0) + (set! (-> attack-info shove-up) 2048.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function arg0 a1-10) + (send-event-function proc evt) ) #f ) @@ -941,7 +951,7 @@ (-> obj flash-state) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) ) ) ) @@ -951,37 +961,44 @@ (defstate die (sew-gunturret) :virtual #t :enter (behavior () - (enemy-method-132 self) - (let ((v1-3 (-> self root-override2 root-prim))) - (set! (-> v1-3 prim-core collide-as) (collide-spec)) - (set! (-> v1-3 prim-core collide-with) (collide-spec)) + (dispose! self) + (let ((root-prim (-> self root-override2 root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (set! (-> self hit-points) 0) - (talker-speech-class-method-10 (-> *talker-speech* 53)) + (play-communicator-speech! (-> *talker-speech* 53)) (none) ) :code (behavior () - (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) - (process-spawn joint-exploder (-> self params explode-sg) 6 gp-0 *sew-gunturret-exploder-params* :to self) + (let ((exploder-tuning (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (process-spawn + joint-exploder + (-> self params explode-sg) + 6 + exploder-tuning + *sew-gunturret-exploder-params* + :to self + ) ) (activate! *camera-smush-control* 819.2 37 210 1.0 0.995 (-> self clock)) (sound-play "turret-explode") (suspend) (cleanup-for-death self) (ja-channel-set! 0) - (let ((gp-2 (new 'stack-no-clear 'vector))) - (set! (-> gp-2 quad) (-> self root-override2 trans quad)) - (set! (-> gp-2 y) (+ 10240.0 (-> gp-2 y))) - (let ((s5-2 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) s5-2) (seconds 2)) - (spawn (-> self part) gp-2) + (let ((vec (new 'stack-no-clear 'vector))) + (set! (-> vec quad) (-> self root-override2 trans quad)) + (set! (-> vec y) (+ 10240.0 (-> vec y))) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) + (spawn (-> self part) vec) (suspend) ) ) ) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 1)) + (let ((_frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) _frame-counter) (seconds 1)) (suspend) ) ) @@ -992,87 +1009,92 @@ (none) ) :post (behavior () - (enemy-method-55 self) + (track-target! self) (none) ) ) ;; definition for method 114 of type sew-gunturret ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 sew-gunturret ((obj sew-gunturret)) - "@abstract" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) +(defmethod init-enemy-collision! sew-gunturret ((obj sew-gunturret)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) - (set! (-> s5-0 total-prims) (the-as uint 3)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) - (set! (-> s4-0 transform-index) 3) - (set-vector! (-> s4-0 local-sphere) 0.0 9216.0 4096.0 18432.0) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 2) 0))) + (set! (-> cshape total-prims) (the-as uint 3)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid no-standon)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 9216.0 4096.0 18432.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-14 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-14 prim-core action) (collide-action solid no-standon)) - (set! (-> v1-14 transform-index) 3) - (set-vector! (-> v1-14 local-sphere) 0.0 6144.0 0.0 11264.0) + (let ((prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-sphere prim-core action) (collide-action solid no-standon)) + (set! (-> prim-sphere transform-index) 3) + (set-vector! (-> prim-sphere local-sphere) 0.0 6144.0 0.0 11264.0) ) - (let ((v1-16 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-16 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-16 prim-core action) (collide-action solid no-standon)) - (set! (-> v1-16 transform-index) 5) - (set-vector! (-> v1-16 local-sphere) 0.0 0.0 -5120.0 4096.0) + (let ((_prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> _prim-sphere prim-core collide-as) (collide-spec enemy)) + (set! (-> _prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> _prim-sphere prim-core action) (collide-action solid no-standon)) + (set! (-> _prim-sphere transform-index) 5) + (set-vector! (-> _prim-sphere local-sphere) 0.0 0.0 -5120.0 4096.0) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-19 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-19 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-19 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override2) s5-0) + (set! (-> obj root-override2) cshape) ) 0 (none) ) ;; definition for method 98 of type sew-gunturret -(defmethod enemy-method-98 sew-gunturret ((obj sew-gunturret) (arg0 process-focusable) (arg1 vector)) +(defmethod in-aggro-range? sew-gunturret ((obj sew-gunturret) (proc process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" (cond ((= (-> obj activate-distance) 0.0) (return #t) ) (else - (let ((f0-2 (vector-dot - (vector-! (new 'stack-no-clear 'vector) (get-trans arg0 3) (-> obj root-override2 trans)) + (let ((dist (vector-dot + (vector-! (new 'stack-no-clear 'vector) (get-trans proc 3) (-> obj root-override2 trans)) (-> obj init-mat vector 2) ) ) ) - (return (and (< 0.0 f0-2) (< f0-2 (-> obj activate-distance)))) + (return (and (< 0.0 dist) (< dist (-> obj activate-distance)))) ) ) ) @@ -1114,8 +1136,8 @@ ;; definition for method 141 of type sew-gunturret ;; WARN: Return type mismatch int vs none. -(defmethod sew-gunturret-method-141 sew-gunturret ((obj sew-gunturret)) - (let ((s5-0 +(defmethod init-turret-params! sew-gunturret ((obj sew-gunturret)) + (let ((turret-params (new 'static 'gun-turret-params :idle-anim 2 :shoot-anim 3 @@ -1126,17 +1148,17 @@ ) ) ) - (set! (-> s5-0 normal-sg) + (set! (-> turret-params normal-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-gunturret" (the-as (pointer uint32) #f))) ) - (set! (-> s5-0 explode-sg) + (set! (-> turret-params explode-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-gunturret-explode" (the-as (pointer uint32) #f)) ) ) - (set! (-> s5-0 enemy-info) *sew-gunturret-enemy-info*) - (set! (-> obj params) s5-0) + (set! (-> turret-params enemy-info) *sew-gunturret-enemy-info*) + (set! (-> obj params) turret-params) ) 0 (none) @@ -1144,11 +1166,11 @@ ;; definition for method 115 of type sew-gunturret ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 sew-gunturret ((obj sew-gunturret)) - "@abstract" - (sew-gunturret-method-141 obj) +(defmethod init-enemy! sew-gunturret ((obj sew-gunturret)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (init-turret-params! obj) (initialize-skeleton obj (-> obj params normal-sg) (the-as pair 0)) - (enemy-method-113 obj (-> obj params enemy-info)) + (init-enemy-behaviour-and-stats! obj (-> obj params enemy-info)) (logclear! (-> obj mask) (process-mask actor-pause)) (logclear! (-> obj enemy-flags) (enemy-flag notice)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 1126) obj)) @@ -1290,7 +1312,7 @@ :size-assert #x2a4 :flag-assert #x8e023002a4 (:methods - (pal-gun-turret-method-140 (_type_ symbol) float :replace 140) + (fire-turret! (_type_ symbol) float :replace 140) ) ) @@ -1308,7 +1330,8 @@ ) ;; definition for method 140 of type pal-gun-turret -(defmethod pal-gun-turret-method-140 pal-gun-turret ((obj pal-gun-turret) (arg0 symbol)) +(defmethod fire-turret! pal-gun-turret ((obj pal-gun-turret) (arg0 symbol)) + "@overrides Calls [[sew-gunturret::140]] but also customizes the turret flash via [[set-palcab-turret-flash!]]" ((the-as (function sew-gunturret symbol none) (find-parent-method pal-gun-turret 140)) obj arg0) (set-palcab-turret-flash! 1.0) ) @@ -1322,8 +1345,8 @@ ;; definition for method 141 of type pal-gun-turret ;; WARN: Return type mismatch int vs none. -(defmethod sew-gunturret-method-141 pal-gun-turret ((obj pal-gun-turret)) - (let ((s5-0 +(defmethod init-turret-params! pal-gun-turret ((obj pal-gun-turret)) + (let ((turret-params (new 'static 'gun-turret-params :idle-anim 2 :shoot-anim 3 @@ -1334,17 +1357,17 @@ ) ) ) - (set! (-> s5-0 normal-sg) + (set! (-> turret-params normal-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-pal-gun-turret" (the-as (pointer uint32) #f))) ) - (set! (-> s5-0 explode-sg) + (set! (-> turret-params explode-sg) (the-as skeleton-group (art-group-get-by-name *level* "skel-pal-gun-turret-explode" (the-as (pointer uint32) #f)) ) ) - (set! (-> s5-0 enemy-info) *pal-gun-turret-enemy-info*) - (set! (-> obj params) s5-0) + (set! (-> turret-params enemy-info) *pal-gun-turret-enemy-info*) + (set! (-> obj params) turret-params) ) 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 fbcf8f6f89..1821a2cdaf 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc @@ -691,8 +691,12 @@ ;; definition for method 55 of type spydroid ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 spydroid ((obj spydroid)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! spydroid ((obj 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!))) (t9-0 obj) ) (when (< (-> obj root-override2 scale x) 1.0) @@ -787,7 +791,9 @@ ;; definition for method 74 of type spydroid ;; INFO: Used lq/sq -(defmethod enemy-method-74 spydroid ((obj spydroid) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler spydroid ((obj spydroid) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (v1-6 vector) (sv-144 vector)) (with-pp (rlet ((vf0 :class vf) @@ -898,16 +904,16 @@ (logtest? (penetrate dark-bomb) (-> (the-as attack-info v1-30) penetrate-using)) ) ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (('jump) (set! (-> obj floor) (-> (the-as vector (-> arg3 param 1)) y)) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1119,7 +1125,7 @@ (t9-0) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1134,7 +1140,7 @@ ) ) (let ((a0-1 (handle->process (-> self focus handle)))) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (and a0-1 (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root-override2 trans) @@ -1375,8 +1381,8 @@ ;; definition for method 114 of type spydroid ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 spydroid ((obj spydroid)) - "@abstract" +(defmethod init-enemy-collision! spydroid ((obj spydroid)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1454,14 +1460,14 @@ ;; definition for method 115 of type spydroid ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 spydroid ((obj spydroid)) - "@abstract" +(defmethod init-enemy! spydroid ((obj spydroid)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-spydroid" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *spydroid-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *spydroid-nav-enemy-info*) (dotimes (s5-1 4) (set! (-> obj lightning s5-1) (new diff --git a/test/decompiler/reference/jak2/levels/common/flitter_REF.gc b/test/decompiler/reference/jak2/levels/common/flitter_REF.gc index 7eb30e144e..b33660d6b0 100644 --- a/test/decompiler/reference/jak2/levels/common/flitter_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/flitter_REF.gc @@ -490,7 +490,35 @@ :default-hit-points 1 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #x11fffdffa + :penetrate-knocked (penetrate + generic-attack + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + knocked + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 6) @@ -771,7 +799,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self state-time) (-> self clock frame-counter)) (let ((gp-0 (-> self root-override2))) (vector-reset! (-> gp-0 transv)) @@ -975,7 +1003,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior flitter-fall-and-play-death-anim flitter ((arg0 art-joint-anim) (arg1 float) (arg2 time-frame)) (local-vars (v1-29 symbol)) - (enemy-method-110 self) + (stop-looking-at-target! self) (set! (-> self skel root-channel 0 frame-group) arg0) (let ((s4-1 (enemy-method-50 self (new 'stack-no-clear 'vector))) (s3-0 (-> self root-override2)) @@ -1115,7 +1143,7 @@ ) ) ) - (if (and (enemy-method-107 self) + (if (and (get-enemy-target self) (>= (- (-> self clock frame-counter) (the-as int (-> self off-screen-timer))) (seconds 0.3)) ) (go-hostile self) @@ -1349,7 +1377,7 @@ (ja :num! (seek!)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior flitter) nav-enemy-travel-post) @@ -1366,7 +1394,8 @@ ) ;; definition for method 132 of type flitter -(defmethod enemy-method-132 flitter ((obj flitter)) +(defmethod dispose! flitter ((obj flitter)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> obj minimap) (logior! (-> obj minimap flags) (minimap-flag fade-out)) (set! (-> obj minimap) #f) @@ -1377,8 +1406,8 @@ ;; definition for method 114 of type flitter ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 flitter ((obj flitter)) - "@abstract" +(defmethod init-enemy-collision! flitter ((obj flitter)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1431,14 +1460,14 @@ ;; definition for method 115 of type flitter ;; WARN: Return type mismatch connection-minimap vs none. -(defmethod enemy-method-115 flitter ((obj flitter)) - "@abstract" +(defmethod init-enemy! flitter ((obj flitter)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-flitter" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *flitter-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *flitter-nav-enemy-info*) (set! (-> obj move-angle) 10922.667) (set! (-> obj heading) (the-as basic (if (= (rand-vu-int-range 0 1) 1) #t diff --git a/test/decompiler/reference/jak2/levels/common/grunt_REF.gc b/test/decompiler/reference/jak2/levels/common/grunt_REF.gc index 1fd2407854..ca200ccbf6 100644 --- a/test/decompiler/reference/jak2/levels/common/grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/grunt_REF.gc @@ -106,7 +106,7 @@ (wait-for-focus () _type_ :state 182) (spin-attack () _type_ :state 183) (grunt-method-184 (_type_ float) process-focusable 184) - (grunt-method-185 (_type_) nav-enemy-info 185) + (get-enemy-info (_type_) nav-enemy-info 185) ) ) @@ -257,7 +257,72 @@ :default-hit-points 5 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 5) @@ -335,7 +400,9 @@ (set! (-> *grunt-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type grunt -(defmethod enemy-method-74 grunt ((obj grunt) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler grunt ((obj grunt) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -368,7 +435,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -387,7 +454,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -560,7 +627,7 @@ ) (if (< v1-1 (-> a0-0 curve num-cverts)) (set! (-> self unknown-byte-1ji2n3) v1-1) - (enemy-method-72 self) + (react-to-focus self) ) ) (until #f @@ -735,7 +802,7 @@ (vf2 :class vf) ) (init-vf0-vector) - (let ((gp-0 (enemy-method-107 obj))) + (let ((gp-0 (get-enemy-target obj))) (when gp-0 (let ((v1-3 (get-trans gp-0 0)) (s4-0 (new 'stack-no-clear 'vector)) @@ -938,7 +1005,7 @@ ) (ja :num-func num-func-identity :frame-num (ja-aframe 3.0 0)) (let ((gp-3 (-> self focus aware))) - (if (or (not (enemy-method-107 self)) (!= gp-3 3)) + (if (or (not (get-enemy-target self)) (!= gp-3 3)) (go-stare self) ) ) @@ -1035,7 +1102,7 @@ ) ) (let ((gp-3 (-> self focus aware))) - (if (or (not (enemy-method-107 self)) (!= gp-3 3)) + (if (or (not (get-enemy-target self)) (!= gp-3 3)) (go-stare self) ) ) @@ -1504,7 +1571,8 @@ ) ;; definition for method 132 of type grunt -(defmethod enemy-method-132 grunt ((obj grunt)) +(defmethod dispose! grunt ((obj grunt)) + "Cleans-up the enemy and any associated resources. Potentially spawns skull gems" (when (-> obj minimap) (logior! (-> obj minimap flags) (minimap-flag fade-out)) (set! (-> obj minimap) #f) @@ -1524,8 +1592,8 @@ ;; definition for method 114 of type grunt ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 grunt ((obj grunt)) - "@abstract" +(defmethod init-enemy-collision! grunt ((obj grunt)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1621,20 +1689,21 @@ ) ;; definition for method 185 of type grunt -(defmethod grunt-method-185 grunt ((obj grunt)) +(defmethod get-enemy-info grunt ((obj grunt)) + "@returns the [[nav-enemy-info]] associated with this type of grunt" *grunt-nav-enemy-info* ) ;; definition for method 115 of type grunt ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 grunt ((obj grunt)) - "@abstract" +(defmethod init-enemy! grunt ((obj grunt)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-grunt" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj (grunt-method-185 obj)) + (init-enemy-behaviour-and-stats! obj (get-enemy-info obj)) (let ((v1-6 (-> obj neck))) (set! (-> v1-6 up) (the-as uint 1)) (set! (-> v1-6 nose) (the-as uint 2)) diff --git a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc index 8a2ac440b7..3fef0823f3 100644 --- a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc @@ -554,7 +554,7 @@ ) ;; definition for method 28 of type guard-shot -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound guard-shot ((obj guard-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -566,7 +566,8 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; failed to figure out what this is: @@ -646,7 +647,7 @@ ;; definition for method 30 of type guard-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! guard-shot ((obj guard-shot)) +(defmethod init-proj-collision! guard-shot ((obj guard-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -748,7 +749,7 @@ ) ;; definition for method 28 of type vehicle-grenade -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound vehicle-grenade ((obj vehicle-grenade) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -760,12 +761,13 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; definition for method 30 of type vehicle-grenade ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! vehicle-grenade ((obj vehicle-grenade)) +(defmethod init-proj-collision! vehicle-grenade ((obj vehicle-grenade)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -1068,7 +1070,7 @@ ;; definition for method 30 of type guard-lazer-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! guard-lazer-shot ((obj guard-lazer-shot)) +(defmethod init-proj-collision! guard-lazer-shot ((obj guard-lazer-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc index 0174bfb5a2..c3d5a1f4f8 100644 --- a/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc @@ -490,6 +490,7 @@ ) ;; definition for method 28 of type metalhead-shot +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound metalhead-shot ((obj metalhead-shot) (arg0 projectile-options)) (with-pp (case arg0 @@ -517,6 +518,7 @@ ) ) ) + (none) ) ) @@ -544,7 +546,7 @@ ;; definition for method 30 of type metalhead-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! metalhead-shot ((obj metalhead-shot)) +(defmethod init-proj-collision! metalhead-shot ((obj metalhead-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -793,7 +795,7 @@ ) ;; definition for method 28 of type metalhead-grenade-shot -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound metalhead-grenade-shot ((obj metalhead-grenade-shot) (arg0 projectile-options)) (case arg0 (((projectile-options lose-altitude)) @@ -803,7 +805,8 @@ (sound-play "gren-missile" :id (-> obj sound-id) :position (-> obj root-override trans)) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; failed to figure out what this is: @@ -952,7 +955,7 @@ ;; definition for method 30 of type metalhead-grenade-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! metalhead-grenade-shot ((obj metalhead-grenade-shot)) +(defmethod init-proj-collision! metalhead-grenade-shot ((obj metalhead-grenade-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc index 68393f4c00..b8430b1f24 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc @@ -704,8 +704,8 @@ :enter (behavior () (process-entity-status! self (entity-perm-status subtask-complete) #t) (sound-play "dig-tether-snap") - (talker-speech-class-method-10 (-> *talker-speech* 191)) - (talker-speech-class-method-10 (-> *talker-speech* 192)) + (play-communicator-speech! (-> *talker-speech* 191)) + (play-communicator-speech! (-> *talker-speech* 192)) (cond ((-> self b) (ja :group! dig-digger-idle-ja :num! min) diff --git a/test/decompiler/reference/jak2/levels/dig/dig-part_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig-part_REF.gc index 07d1037fab..30c4127dec 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig-part_REF.gc @@ -1021,11 +1021,12 @@ ;; definition for function check-drop-level-dig-lava-bloops ;; INFO: Used lq/sq (defun check-drop-level-dig-lava-bloops ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) - (let ((f30-0 (-> arg1 key origin trans y))) - (when (< (-> arg2 vector 0 y) f30-0) + "Ensure the lava bloop splats where it originated" + (let ((origin-y (-> arg1 key origin trans y))) + (when (< (-> arg2 vector 0 y) origin-y) (let ((gp-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) - (set-vector! gp-0 (-> arg2 vector 0 x) f30-0 (-> arg2 vector 0 z) 1.0) + (set-vector! gp-0 (-> arg2 vector 0 x) origin-y (-> arg2 vector 0 z) 1.0) (let ((t9-1 sp-launch-particles-var) (a0-2 *sp-particle-system-2d*) (a1-1 (-> *part-id-table* 5043)) @@ -1469,7 +1470,3 @@ (sp-flt spt-userdata 20480.0) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc index 23f67cd6f0..376c5485f3 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc @@ -535,7 +535,7 @@ This commonly includes things such as: ;; definition for method 30 of type dig-spikey-sphere ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! dig-spikey-sphere ((obj dig-spikey-sphere)) +(defmethod init-proj-collision! dig-spikey-sphere ((obj dig-spikey-sphere)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/levels/drill_platform/drill-part2_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/drill-part2_REF.gc index 31384191a9..3f7ddb9951 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/drill-part2_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/drill-part2_REF.gc @@ -218,6 +218,7 @@ ;; definition for function check-drop-level-drill-drillbit-rubble-sparks ;; INFO: Used lq/sq (defun check-drop-level-drill-drillbit-rubble-sparks ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure the rubble spark particle effects don't go below a predefined y value, draw splat effect when they do" (when (and (< (-> arg2 vector 0 y) -696320.0) (< (-> arg1 vel-sxvel y) 0.0)) (let ((gp-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) @@ -2279,7 +2280,3 @@ (sp-flt spt-rotate-y (degrees 90.0)) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc b/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc index b868771ba3..d1bf82b6d5 100644 --- a/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill_platform/ginsu_REF.gc @@ -260,7 +260,35 @@ :default-hit-points 1 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot enemy hit-by-others-list player-list) - :penetrate-knocked #x11fffdffa + :penetrate-knocked (penetrate + generic-attack + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + knocked + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -387,10 +415,14 @@ ;; definition for method 55 of type ginsu ;; WARN: Return type mismatch symbol vs none. -(defmethod enemy-method-55 ginsu ((obj ginsu)) +(defmethod track-target! ginsu ((obj 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" (with-pp (ginsu-method-180 obj) - (let ((t9-1 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-1 (method-of-type nav-enemy track-target!))) (t9-1 obj) ) (cond @@ -558,7 +590,9 @@ ;; definition for method 74 of type ginsu ;; WARN: disable def twice: 11. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. -(defmethod enemy-method-74 ginsu ((obj ginsu) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler ginsu ((obj ginsu) (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-1 object)) (with-pp (case arg2 @@ -583,7 +617,7 @@ (('touch 'bonk 'attack) (cond ((or (!= arg0 *target*) (logtest? (focus-status dark) (-> *target* focus-status))) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else (let ((v1-15 (new 'stack-no-clear 'event-message-block))) @@ -612,7 +646,7 @@ v0-1 ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -657,7 +691,7 @@ (set! (-> self enemy-flags) (the-as enemy-flag (logxor (shl 256 32) (the-as int (-> self enemy-flags))))) ) (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag enemy-flag41)))) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (set! (-> self spiral-time) (-> self clock frame-counter)) (set! (-> self desired-distance) (vector-length (ginsu-method-181 self (new 'stack-no-clear 'vector)))) (none) @@ -1068,8 +1102,8 @@ ;; definition for method 114 of type ginsu ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 ginsu ((obj ginsu)) - "@abstract" +(defmethod init-enemy-collision! ginsu ((obj ginsu)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1136,8 +1170,8 @@ ;; definition for method 115 of type ginsu ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 ginsu ((obj ginsu)) - "@abstract" +(defmethod init-enemy! ginsu ((obj ginsu)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -1145,7 +1179,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *ginsu-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *ginsu-nav-enemy-info*) (logclear! (-> obj nav flags) (nav-control-flag update-heading-from-facing)) (set! (-> obj enemy-flags) (the-as enemy-flag (logclear (-> obj enemy-flags) (enemy-flag enemy-flag43)))) (logclear! (-> obj nav flags) (nav-control-flag limit-rotation-rate)) diff --git a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc index 4b027a3e2e..4860e0c860 100644 --- a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc @@ -52,14 +52,17 @@ (current-path int32 :offset 972) (num-paths int32 :offset 976) (display-path int32 :offset 980) - (targetted-timer uint64 :offset 984) + (targetted-timer time-frame :offset 984) ) :heap-base #x360 :method-count-assert 138 :size-assert #x3e0 :flag-assert #x8a036003e0 (:methods - (pegasus-method-137 (_type_) none 137) + (run-logic? (_type_) symbol :replace 12) + (damage-amount-from-attack (_type_ process event-message-block) int :replace 56) + (update-target-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware :replace 57) + (track-how-long-aimed-at! (_type_) none 137) ) (:states pegasus-debug @@ -200,8 +203,9 @@ ;; definition for method 12 of type pegasus (defmethod run-logic? pegasus ((obj pegasus)) - (let ((f0-0 491520.0)) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> obj root-override2 trans) (camera-pos))) + "Calls [[process-tree::12]] if we are considered in-range of the [[pegasus]], otherwise returns [[#t]]" + (let ((min-distance 491520.0)) + (if (< (* min-distance min-distance) (vector-vector-distance-squared (-> obj root-override2 trans) (camera-pos))) ((method-of-type enemy run-logic?) obj) #t ) @@ -210,20 +214,26 @@ ;; definition for method 137 of type pegasus ;; WARN: Return type mismatch int vs none. -(defmethod pegasus-method-137 pegasus ((obj pegasus)) +(defmethod track-how-long-aimed-at! pegasus ((obj pegasus)) + "Updates `targetted-timer` with the `frame-counter` while Jak is aiming at the [[pegasus]]" (with-pp - (let ((v1-0 *target*)) - (when (and v1-0 (-> v1-0 gun active?)) - (let ((a1-0 (new 'stack-no-clear 'vector)) - (a0-4 (new 'stack-no-clear 'vector)) + (let ((target *target*)) + (when (and target (-> target gun active?)) + (let ((inaccuracy-dir (new 'stack-no-clear 'vector)) + (inaccuracy-vec (new 'stack-no-clear 'vector)) ) - (vector-! a1-0 (-> obj root-override2 trans) (-> v1-0 gun fire-point)) - (vector+float*! a0-4 (-> v1-0 gun fire-point) (-> v1-0 gun fire-dir-out) (vector-length a1-0)) - (let ((f0-1 (vector-vector-distance-squared a0-4 (-> obj root-override2 trans))) - (f1-0 20480.0) + (vector-! inaccuracy-dir (-> obj root-override2 trans) (-> target gun fire-point)) + (vector+float*! + inaccuracy-vec + (-> target gun fire-point) + (-> target gun fire-dir-out) + (vector-length inaccuracy-dir) + ) + (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> obj root-override2 trans))) + (threshold 20480.0) ) - (if (< f0-1 (* f1-0 f1-0)) - (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + (if (< inaccuracy-mag (* threshold threshold)) + (set! (-> obj targetted-timer) (-> pp clock frame-counter)) ) ) ) @@ -236,23 +246,26 @@ ;; definition for method 57 of type pegasus ;; WARN: Return type mismatch int vs enemy-aware. -(defmethod enemy-method-57 pegasus ((obj pegasus) (arg0 process-focusable) (arg1 enemy-best-focus)) +(defmethod update-target-awareness! pegasus ((obj pegasus) (proc process-focusable) (focus enemy-best-focus)) + "Checks a variety of criteria to determine the level of awareness the enemy is of the target. Sets `aware` and related fields as well! +For pegasus, it will call [[enemy::57]] only if the [[pegasus]] has been targetted for more than 5 [[seconds]] +@returns the value from [[enemy::57]], otherwise [[enemy-aware::4]]" (with-pp - (the-as - enemy-aware - (if (>= (- (-> pp clock frame-counter) (the-as int (-> obj targetted-timer))) (seconds 5)) - (the-as int ((method-of-type enemy enemy-method-57) obj arg0 arg1)) - 4 - ) - ) + (the-as enemy-aware (if (>= (- (-> pp clock frame-counter) (-> obj targetted-timer)) (seconds 5)) + (the-as int ((method-of-type enemy update-target-awareness!) obj proc focus)) + 4 + ) + ) ) ) ;; definition for method 74 of type pegasus ;; WARN: Return type mismatch none vs object. -(defmethod enemy-method-74 pegasus ((obj pegasus) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler pegasus ((obj pegasus) (proc process) (arg2 int) (event-type symbol) (event event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp - (let ((v1-0 arg2)) + (let ((v1-0 event-type)) (the-as object (cond @@ -273,20 +286,20 @@ (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) (enemy-method-62 obj) (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) - (process-contact-action arg0) - (send-event arg0 'get-attack-count 1) - (the-as object (enemy-method-73 obj)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (the-as object (kill-prefer-falling obj)) ) (else (let ((v0-0 (the-as object (-> pp clock frame-counter)))) - (set! (-> obj targetted-timer) (the-as uint v0-0)) + (set! (-> obj targetted-timer) (the-as time-frame v0-0)) v0-0 ) ) ) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj proc arg2 event-type event) ) ) ) @@ -295,95 +308,118 @@ ) ;; definition for method 56 of type pegasus -(defmethod enemy-method-56 pegasus ((obj pegasus) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack pegasus ((obj pegasus) (arg0 process) (arg1 event-message-block)) + "Only attacks from the jetboard will deal max damage (6), but by default it will return `1`. +This is why the scouts are technically killable by other means +@returns the amount of damage taken from an attack. Also updates the `targetted-timer`. +@see [[*pegasus-enemy-info*]]" (with-pp - (let ((v0-0 1)) - (let ((v1-0 (the-as object (-> arg1 param 1)))) + (let ((hitpoints 1)) + (let ((attack-info (the-as attack-info (-> arg1 param 1)))) (case (-> arg1 message) (('attack) - (if (and (logtest? (-> (the-as attack-info v1-0) mask) (attack-info-mask mode)) - (= (-> (the-as attack-info v1-0) mode) 'board) - ) - (set! v0-0 (-> obj hit-points)) + (if (and (logtest? (-> attack-info mask) (attack-info-mask mode)) (= (-> attack-info mode) 'board)) + (set! hitpoints (-> obj hit-points)) ) ) ) ) - (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) - v0-0 + (set! (-> obj targetted-timer) (-> pp clock frame-counter)) + hitpoints ) ) ) ;; definition for function pegasus-draw-section ;; WARN: Return type mismatch symbol vs none. -(defbehavior pegasus-draw-section pegasus ((arg0 float) (arg1 float) (arg2 rgba)) - (let ((gp-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) +(defbehavior pegasus-draw-section pegasus ((path-percent-a float) (path-percent-b float) (color rgba)) + "Draws the [[pegasus]] curve section between the two provided points. +@param path-percent-a Percentage along the path for the first point +@param path-percent-b Percentage along the path for the second point +param color The color to draw the curve with +@see [[curve-control]]" + (let ((point-a (new 'stack-no-clear 'vector)) + (point-b (new 'stack-no-clear 'vector)) ) - (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) gp-0 arg0 'interp) - (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) s5-0 arg1 'interp) - (add-debug-line #t (bucket-id debug-no-zbuf1) gp-0 s5-0 arg2 #f (the-as rgba -1)) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + point-a + path-percent-a + 'interp + ) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + point-b + path-percent-b + 'interp + ) + (add-debug-line #t (bucket-id debug-no-zbuf1) point-a point-b color #f (the-as rgba -1)) ) (none) ) ;; definition for function pegasus-show-runs -;; WARN: Return type mismatch none vs symbol. -;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 43] (defbehavior pegasus-show-runs pegasus () - (the-as symbol (when *display-path-marks* - (when (cpad-pressed? 0 up) - (+! (-> self display-path) 1) - (if (>= (-> self display-path) (-> self num-paths)) - (set! (-> self display-path) -1) - ) - ) - (when (cpad-pressed? 0 down) - (+! (-> self display-path) -1) - (if (< (-> self display-path) -1) - (set! (-> self display-path) (+ (-> self num-paths) -1)) - ) - ) - (cond - ((< (-> self display-path) 0) - (countdown (gp-0 20) - (let ((a0-1 (-> self path-info gp-0 path-data))) - (if a0-1 - (debug-draw a0-1) - ) - ) - ) - #f - ) - (else - (format - *stdcon* - "~A old-path ~D can run ~A at ~D ~F~%" - (-> self name) - (-> self previous-path) - (-> self can-run) - (-> self current-path) - (-> self curve-position) - ) - (format *stdcon* "~A showing path ~D~%" (-> self name) (-> self display-path)) - (let ((a0-4 (-> self path-info (-> self display-path) path-data))) - (if a0-4 - (debug-draw a0-4) - ) - ) - ) - ) - ) + "When [[*display-path-marks*]] is enabled, allow the user to cycle through the displayed path +- Pressing [[up]] on the D-Pad will increment the path index +- Pressing [[down]] on the D-Pad will decrement the path index +Additional debug text will be displayed as well. This is useful as many paths overlap other paths" + (when *display-path-marks* + (when (cpad-pressed? 0 up) + (+! (-> self display-path) 1) + (if (>= (-> self display-path) (-> self num-paths)) + (set! (-> self display-path) -1) ) + ) + (when (cpad-pressed? 0 down) + (+! (-> self display-path) -1) + (if (< (-> self display-path) -1) + (set! (-> self display-path) (+ (-> self num-paths) -1)) + ) + ) + (cond + ((< (-> self display-path) 0) + (countdown (path-idx 20) + (let ((path (-> self path-info path-idx path-data))) + (if path + (debug-draw path) + ) + ) + ) + ) + (else + (format + *stdcon* + "~A old-path ~D can run ~A at ~D ~F~%" + (-> self name) + (-> self previous-path) + (-> self can-run) + (-> self current-path) + (-> self curve-position) + ) + (format *stdcon* "~A showing path ~D~%" (-> self name) (-> self display-path)) + (let ((_path (-> self path-info (-> self display-path) path-data))) + (if _path + (debug-draw _path) + ) + ) + ) + ) + ) + (none) ) ;; definition for function pegasus-rotate ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. -(defbehavior pegasus-rotate pegasus ((arg0 symbol) (arg1 float)) - (let ((s5-0 (new 'stack-no-clear 'matrix)) - (gp-0 (new 'stack-no-clear 'vector)) +(defbehavior pegasus-rotate pegasus ((influenced-by-target? symbol) (angle float)) + "Rotates the [[pegasus]] along the path, factoring in the current speed and the target's position +@param influenced-by-target? Whether or not to care about [[target]]'s position +@param angle The hopeful angle to use when constructing the rotation matrix, ultimately limited to `0.25` (radians?) though +@see [[target-pos]] and [[matrix-from-two-vectors-max-angle-partial!]] +@TODO - `float` should be `degrees` -- The usual amount passed in is `(degrees 100.0835)`" + (let ((rotation-matrix (new 'stack-no-clear 'matrix)) + (flee-direction-vec (new 'stack-no-clear 'vector)) ) (displacement-between-points-at-percent-normalized! (-> self path-info (-> self current-path) path-data) @@ -391,31 +427,31 @@ (-> self curve-position) ) (cond - ((and arg0 *target*) - (vector-! gp-0 (-> self root-override2 trans) (target-pos 0)) - (vector-normalize! gp-0 1.0) + ((and influenced-by-target? *target*) + (vector-! flee-direction-vec (-> self root-override2 trans) (target-pos 0)) + (vector-normalize! flee-direction-vec 1.0) ) ((= (-> self speed) 0.0) - (set! (-> gp-0 quad) (-> self facing quad)) + (set! (-> flee-direction-vec quad) (-> self facing quad)) ) ((< (-> self speed) 0.0) - (vector-negate! gp-0 (-> self tangent)) + (vector-negate! flee-direction-vec (-> self tangent)) ) (else - (set! (-> gp-0 quad) (-> self tangent quad)) + (set! (-> flee-direction-vec quad) (-> self tangent quad)) ) ) - (matrix-from-two-vectors-max-angle-partial! s5-0 (-> self facing) gp-0 arg1 0.25) - (vector-matrix*! gp-0 (-> self facing) s5-0) - (vector-normalize! gp-0 1.0) - (forward-down->inv-matrix s5-0 gp-0 (new 'static 'vector :y -1.0)) - (matrix->quaternion (-> self root-override2 quat) s5-0) - (set! (-> self run-blend-interp) (acos (vector-dot gp-0 (-> self facing)))) + (matrix-from-two-vectors-max-angle-partial! rotation-matrix (-> self facing) flee-direction-vec angle 0.25) + (vector-matrix*! flee-direction-vec (-> self facing) rotation-matrix) + (vector-normalize! flee-direction-vec 1.0) + (forward-down->inv-matrix rotation-matrix flee-direction-vec (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> self root-override2 quat) rotation-matrix) + (set! (-> self run-blend-interp) (acos (vector-dot flee-direction-vec (-> self facing)))) (set! (-> self run-blend-interp) (* 0.0002746582 (-> self run-blend-interp))) - (if (< (vector-dot (-> self facing) (the-as vector (-> s5-0 vector))) 0.0) + (if (< (vector-dot (-> self facing) (the-as vector (-> rotation-matrix vector))) 0.0) (set! (-> self run-blend-interp) (- (-> self run-blend-interp))) ) - (set! (-> self facing quad) (-> gp-0 quad)) + (set! (-> self facing quad) (-> flee-direction-vec quad)) ) (none) ) @@ -423,6 +459,15 @@ ;; definition for function pegasus-loop-on-same-path ;; WARN: Return type mismatch float vs none. (defbehavior pegasus-loop-on-same-path pegasus () + "Creates an endless loop on the same path as the name suggests +- If we are beyond the end of the path, start again near the beginning (1%) +- If we are far before the beginning, start at the beginning (0%) +- If we are atleast 1% into the path, step back 1% +- If we are less than 0% somehow, slowly add 1% +Ultimately this appears to be some sort of safe-guard to get things back into a somewhat working state +if there are unexpected path conditions -- but the results of this are not great! +Another potential explaination is to make it easy during development to identify and debug a bad path +In practice, this is never called" (cond ((< 100.0 (-> self curve-position)) (set! (-> self curve-position) 1.0) @@ -442,84 +487,94 @@ ;; definition for function pegasus-choose-path (defbehavior pegasus-choose-path pegasus () + "Determines the next path the pegasus should take if we have completed the current path it's on +There are many fail-safes here if something goes wrong to try to keep the pegasus behaving +@see [[pegasus-look-on-same-path]] +@TODO - understand the path selection better" (local-vars (f0-15 float) (f30-0 float)) (while (begin (label cfg-61) (or (< 1.0 (-> self curve-position)) (< (-> self curve-position) 0.0))) - (let ((s5-0 (-> self path-info (-> self current-path))) - (gp-0 3) + (let ((curr-pegasus-path (-> self path-info (-> self current-path))) + (control-data-idx 3) ) 0.0 - (set! f30-0 - (cond - ((or (>= (-> self current-path) (-> self num-paths)) (< (-> self current-path) 0) (<= (-> s5-0 num-data) 0)) - (format - 0 - ": ~A has path out of range cur ~D num ~D num-data ~D~%" - (-> self name) - (-> self current-path) - (-> self num-paths) - (-> s5-0 num-data) - ) - (pegasus-loop-on-same-path) - (goto cfg-61) - f30-0 - ) - ((< (-> self curve-position) 0.0) - (while (and (< gp-0 (-> s5-0 num-data)) (>= (-> s5-0 control-data gp-0) 0.0)) - (+! gp-0 3) - ) - (+! gp-0 1) - (* (total-distance (-> s5-0 path-data)) (- (-> self curve-position))) - ) - (else - (* (total-distance (-> s5-0 path-data)) (+ -1.0 (-> self curve-position))) - ) - ) + (set! f30-0 (cond + ((or (>= (-> self current-path) (-> self num-paths)) + (< (-> self current-path) 0) + (<= (-> curr-pegasus-path num-data) 0) + ) + (format + 0 + ": ~A has path out of range cur ~D num ~D num-data ~D~%" + (-> self name) + (-> self current-path) + (-> self num-paths) + (-> curr-pegasus-path num-data) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + f30-0 + ) + ((< (-> self curve-position) 0.0) + (while (and (< control-data-idx (-> curr-pegasus-path num-data)) + (>= (-> curr-pegasus-path control-data control-data-idx) 0.0) + ) + (+! control-data-idx 3) + ) + (+! control-data-idx 1) + (* (total-distance (-> curr-pegasus-path path-data)) (- (-> self curve-position))) + ) + (else + (* (total-distance (-> curr-pegasus-path path-data)) (+ -1.0 (-> self curve-position))) + ) + ) ) - (when (or (< (- (-> s5-0 num-data) gp-0) 3) (< (-> s5-0 control-data gp-0) 0.0)) + (when (or (< (- (-> curr-pegasus-path num-data) control-data-idx) 3) + (< (-> curr-pegasus-path control-data control-data-idx) 0.0) + ) (format 0 ": ~A has bad path connect data format num-data ~D ctrl-data ~F~%" (-> self name) - (- (-> s5-0 num-data) gp-0) - (-> s5-0 control-data gp-0) + (- (-> curr-pegasus-path num-data) control-data-idx) + (-> curr-pegasus-path control-data control-data-idx) ) (pegasus-loop-on-same-path) (goto cfg-61) ) - (let* ((v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-34 (the-as number (logior #x3f800000 v1-33))) - (f0-9 (+ -1.0 (the-as float v1-34))) + (let* ((rand-int (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (rand-float (the-as float (logior #x3f800000 rand-int))) + (_rand (+ -1.0 rand-float)) ) - (while (and (>= (- (-> s5-0 num-data) gp-0) 6) - (>= (-> s5-0 control-data gp-0) 0.0) - (< (-> s5-0 control-data (+ gp-0 2)) f0-9) - (!= (-> s5-0 control-data (+ gp-0 3)) -1.0) - (!= (-> s5-0 control-data (+ gp-0 5)) 0.0) + (while (and (>= (- (-> curr-pegasus-path num-data) control-data-idx) 6) + (>= (-> curr-pegasus-path control-data control-data-idx) 0.0) + (< (-> curr-pegasus-path control-data (+ control-data-idx 2)) _rand) + (!= (-> curr-pegasus-path control-data (+ control-data-idx 3)) -1.0) + (!= (-> curr-pegasus-path control-data (+ control-data-idx 5)) 0.0) ) - (set! f0-9 (- f0-9 (-> s5-0 control-data (+ gp-0 2)))) - (+! gp-0 3) + (set! _rand (- _rand (-> curr-pegasus-path control-data (+ control-data-idx 2)))) + (+! control-data-idx 3) ) ) - (let ((t1-1 (the int (-> s5-0 control-data gp-0))) - (f28-0 (fmin 1.0 (fmax 0.0 (-> s5-0 control-data (+ gp-0 1))))) + (let ((control-data (the int (-> curr-pegasus-path control-data control-data-idx))) + (f28-0 (fmin 1.0 (fmax 0.0 (-> curr-pegasus-path control-data (+ control-data-idx 1))))) ) - (when (or (>= t1-1 (-> self num-paths)) (< t1-1 0)) + (when (or (>= control-data (-> self num-paths)) (< control-data 0)) (format 0 ": ~A has bad path connect data prev ~D current ~D desired ~D num ~D~%" (-> self name) (-> self previous-path) (-> self current-path) - t1-1 + control-data (-> self num-paths) ) (pegasus-loop-on-same-path) (goto cfg-61) ) (set! (-> self previous-path) (-> self current-path)) - (set! (-> self current-path) t1-1) - (let ((gp-1 (-> self path-info (-> self current-path)))) - (let ((f0-14 (/ f30-0 (total-distance (-> gp-1 path-data))))) + (set! (-> self current-path) control-data) + (let ((_curr-pegasus-path (-> self path-info (-> self current-path)))) + (let ((f0-14 (/ f30-0 (total-distance (-> _curr-pegasus-path path-data))))) (cond ((< 0.5 f28-0) (set! f0-15 (- f28-0 f0-14)) @@ -537,8 +592,8 @@ ) (set! (-> self curve-position) f0-15) (set! (-> self can-run) #f) - (if (> (-> gp-1 num-data) 0) - (set! (-> self can-run) (!= (-> gp-1 control-data 0) 0.0)) + (if (> (-> _curr-pegasus-path num-data) 0) + (set! (-> self can-run) (!= (-> _curr-pegasus-path control-data 0) 0.0)) ) ) ) @@ -550,7 +605,10 @@ ;; definition for function pegasus-move ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defbehavior pegasus-move pegasus ((arg0 float) (arg1 symbol) (arg2 symbol)) +(defbehavior pegasus-move pegasus ((explicit-y-vel float) (adjust-y-offset? symbol)) + "Moves the pegasus along the path by smoothly interpolating along it +@param explicit-y-vel Normally `0.0` but this value is used when the pegasus needs to switch direction +@param adjust-y-offset? Normally [[#f]] which forces the movement to reflect the result of the collison query - the [[pegasus]] will stay close to the ground. [[#t]] ignores this" (+! (-> self curve-position) (/ (the float (* (- (-> self clock frame-counter) (-> self clock old-frame-counter)) (the int (-> self speed)))) (total-distance (-> self path-info (-> self current-path) path-data)) @@ -563,21 +621,21 @@ (-> self curve-position) 'interp ) - (let ((f30-1 (+ -81920.0 (-> self root-override2 trans y))) - (gp-0 #f) + (let ((y-pos (+ -81920.0 (-> self root-override2 trans y))) + (draw-shadow? #f) ) - (let ((s2-0 (new 'stack 'collide-query)) - (s3-0 (new 'stack-no-clear 'vector)) + (let ((cquery (new 'stack 'collide-query)) + (start-pos (new 'stack-no-clear 'vector)) ) - (set! (-> s3-0 quad) (-> self root-override2 trans quad)) + (set! (-> start-pos quad) (-> self root-override2 trans quad)) (set! (-> self over-ground) #f) - (when (enemy-method-126 self s2-0 s3-0 (collide-spec backgnd) 12288.0 81920.0 1024.0) - (set! f30-1 (-> s2-0 best-other-tri intersect y)) - (set! gp-0 #t) - (set! (-> self over-ground) (< 204.8 (fabs (- f30-1 (-> self water-height))))) - (set! arg1 (and (-> self over-ground) arg1)) - (if arg1 - (set! (-> self y-offset-desired) (- f30-1 (-> s3-0 y))) + (when (enemy-above-ground? self cquery start-pos (collide-spec backgnd) 12288.0 81920.0 1024.0) + (set! y-pos (-> cquery best-other-tri intersect y)) + (set! draw-shadow? #t) + (set! (-> self over-ground) (< 204.8 (fabs (- y-pos (-> self water-height))))) + (set! adjust-y-offset? (and (-> self over-ground) adjust-y-offset?)) + (if adjust-y-offset? + (set! (-> self y-offset-desired) (- y-pos (-> start-pos y))) ) ) ) @@ -585,8 +643,8 @@ ((< (-> self y-offset-desired) (-> self y-offset)) (set! (-> self y-vel) (* 0.25 (- (-> self y-offset-desired) (-> self y-offset)))) (set! (-> self y-vel) (fmax -68.26667 (-> self y-vel))) - (if (!= arg0 0.0) - (set! (-> self y-vel) (- arg0)) + (if (!= explicit-y-vel 0.0) + (set! (-> self y-vel) (- explicit-y-vel)) ) (+! (-> self y-offset) (-> self y-vel)) (when (>= (-> self y-offset-desired) (-> self y-offset)) @@ -597,8 +655,8 @@ ((< (-> self y-offset) (-> self y-offset-desired)) (set! (-> self y-vel) (* 0.5 (- (-> self y-offset-desired) (-> self y-offset)))) (set! (-> self y-vel) (fmin 13.653334 (-> self y-vel))) - (if (!= arg0 0.0) - (set! (-> self y-vel) arg0) + (if (!= explicit-y-vel 0.0) + (set! (-> self y-vel) explicit-y-vel) ) (+! (-> self y-offset) (-> self y-vel)) (when (>= (-> self y-offset) (-> self y-offset-desired)) @@ -608,26 +666,26 @@ ) ) (+! (-> self root-override2 trans y) (-> self y-offset)) - (when (< (-> self root-override2 trans y) f30-1) - (set! (-> self y-offset) (- f30-1 (- (-> self root-override2 trans y) (-> self y-offset)))) - (set! (-> self root-override2 trans y) f30-1) + (when (< (-> self root-override2 trans y) y-pos) + (set! (-> self y-offset) (- y-pos (- (-> self root-override2 trans y) (-> self y-offset)))) + (set! (-> self root-override2 trans y) y-pos) (set! (-> self y-vel) (fmax 0.0 (-> self y-vel))) ) - (set! (-> self on-ground) (< (fabs (- (-> self root-override2 trans y) f30-1)) 409.6)) + (set! (-> self on-ground) (< (fabs (- (-> self root-override2 trans y) y-pos)) 409.6)) (cond - (gp-0 - (let ((v1-54 (-> self draw shadow-ctrl))) - (logclear! (-> v1-54 settings flags) (shadow-flags disable-draw)) + (draw-shadow? + (let ((shadow-ctrl (-> self draw shadow-ctrl))) + (logclear! (-> shadow-ctrl settings flags) (shadow-flags disable-draw)) ) 0 - (let ((v1-57 (-> self draw shadow-ctrl))) - (set! (-> v1-57 settings bot-plane w) (- (+ (- -6144.0 (-> self root-override2 trans y)) f30-1))) + (let ((_shadow-ctrl (-> self draw shadow-ctrl))) + (set! (-> _shadow-ctrl settings bot-plane w) (- (+ (- -6144.0 (-> self root-override2 trans y)) y-pos))) ) 0 ) (else - (let ((v1-59 (-> self draw shadow-ctrl))) - (logior! (-> v1-59 settings flags) (shadow-flags disable-draw)) + (let ((__shadow-ctrl (-> self draw shadow-ctrl))) + (logior! (-> __shadow-ctrl settings flags) (shadow-flags disable-draw)) ) 0 ) @@ -637,50 +695,58 @@ ) ;; definition for function pegasus-calc-speed -(defbehavior pegasus-calc-speed pegasus ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) - (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self root-override2 trans) (target-pos 0))) - (gp-1 #f) +(defbehavior pegasus-calc-speed pegasus ((min-dist float) (max-dist float) (max-speed float) (min-speed float)) + "Calculates the pegasus' speed based on a number of factors: +- Speed up as the target gets closer (up to a max) and slow down as the target is further away (up to a min) +This function also is what causes the pegasus to flip around +@param min-dist TODO +@param max-dist TODO +@param max-speed The maximum speed the pegasus can go +@param min-speed The minimum speed the pegasus can go +@returns If there should be a reaction to the target via [[enemy::72]]" + (let ((dir-to-target (vector-! (new 'stack-no-clear 'vector) (-> self root-override2 trans) (target-pos 0))) + (react-to-target? #f) ) - (set! (-> s5-1 y) 0.0) - (let* ((f1-3 (/ (- (vector-length s5-1) arg0) (- arg1 arg0))) - (f0-4 (- 1.0 (fmax 0.0 (fmin 1.0 f1-3)))) - (f0-5 (lerp arg3 arg2 f0-4)) + (set! (-> dir-to-target y) 0.0) + (let* ((dist-from-target (/ (- (vector-length dir-to-target) min-dist) (- max-dist min-dist))) + (interpolant (- 1.0 (fmax 0.0 (fmin 1.0 dist-from-target)))) + (interpolated-speed (lerp min-speed max-speed interpolant)) ) - (if (< (- (-> self clock frame-counter) (the-as int (-> self targetted-timer))) (seconds 5)) - (set! f0-5 (fmax 163840.0 f0-5)) + (if (< (- (-> self clock frame-counter) (-> self targetted-timer)) (seconds 5)) + (set! interpolated-speed (fmax 163840.0 interpolated-speed)) ) - (let ((f0-6 (* 0.0033333334 f0-5))) + (let ((movement-speed (* 0.0033333334 interpolated-speed))) (cond - ((< (vector-dot s5-1 (-> self tangent)) 0.0) + ((< (vector-dot dir-to-target (-> self tangent)) 0.0) (if (< 0.0 (-> self speed)) - (set! gp-1 #t) + (set! react-to-target? #t) ) ) ((< (-> self speed) 0.0) - (set! gp-1 #t) + (set! react-to-target? #t) ) ) - (let ((v1-22 (ja-group))) + (let ((anim-group (ja-group))) (cond - ((and v1-22 (= v1-22 pegasus-flip-around-a-ja)) + ((and anim-group (= anim-group pegasus-flip-around-a-ja)) (if (< 1.0 (fabs (-> self speed))) (set! (-> self speed) (* 0.92 (-> self speed))) ) ) (else - (let ((v1-31 (ja-group))) + (let ((_anim-group (ja-group))) (cond - ((and v1-31 (= v1-31 pegasus-flip-around-b-ja)) + ((and _anim-group (= _anim-group pegasus-flip-around-b-ja)) (if (< (-> self speed) 0.0) - (seek! (-> self speed) (- f0-6) 13.653334) - (seek! (-> self speed) f0-6 13.653334) + (seek! (-> self speed) (- movement-speed) 13.653334) + (seek! (-> self speed) movement-speed 13.653334) ) ) ((< (-> self speed) 0.0) - (set! (-> self speed) (- f0-6)) + (set! (-> self speed) (- movement-speed)) ) (else - (set! (-> self speed) f0-6) + (set! (-> self speed) movement-speed) ) ) ) @@ -689,14 +755,18 @@ ) ) ) - gp-1 + react-to-target? ) ) ;; definition for function pegasus-calc-anim-speed (defbehavior pegasus-calc-anim-speed pegasus () - (let* ((f0-1 (fabs (-> self speed))) - (f0-2 (* 0.07324219 f0-1)) + "Based on `speed`, adjust how fast the pegasus should animate. +The faster it's moving the fast it flaps it's wings, etc +@TODO understand the magic values here better +@returns The anim speed, it can be no lower than `1.5`" + (let* ((speed-abs (fabs (-> self speed))) + (f0-2 (* 0.07324219 speed-abs)) (f0-3 (+ -15.0 f0-2)) (f0-4 (* 0.13333334 f0-3)) ) @@ -705,10 +775,14 @@ ) ;; definition for method 55 of type pegasus -(defmethod enemy-method-55 pegasus ((obj pegasus)) - (pegasus-method-137 obj) +(defmethod track-target! pegasus ((obj 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! obj) (pegasus-show-runs) - ((method-of-type enemy enemy-method-55) obj) + ((method-of-type enemy track-target!) obj) (none) ) @@ -726,13 +800,13 @@ :frame-num 0.0 ) (until (ja-done? 0) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((a1-1 (new 'stack-no-clear 'vector))) - (clmf-input gp-0 a1-1 1) + (let ((cam-dbg-vec (new 'stack-no-clear 'vector))) + (let ((vec (new 'stack-no-clear 'vector))) + (clmf-input cam-dbg-vec vec 1) ) - (vector-float*! gp-0 gp-0 4096.0) + (vector-float*! cam-dbg-vec cam-dbg-vec 4096.0) (+! (-> self curve-position) - (/ (-> gp-0 y) (total-distance (-> self path-info (-> self current-path) path-data))) + (/ (-> cam-dbg-vec y) (total-distance (-> self path-info (-> self current-path) path-data))) ) ) (cond @@ -765,66 +839,33 @@ :virtual #t :code (behavior () (process-entity-status! self (entity-perm-status subtask-complete) #t) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer self)) - (set! (-> a1-1 num-params) 1) - (set! (-> a1-1 message) 'change-mode) - (set! (-> a1-1 param 0) (the-as uint 'pegasus)) - (let ((gp-0 (send-event-function (handle->process (-> self incoming attacker-handle)) a1-1))) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 1) + (set! (-> evt message) 'change-mode) + (set! (-> evt param 0) (the-as uint 'pegasus)) + (let ((event-result (send-event-function (handle->process (-> self incoming attacker-handle)) evt))) (-> self speed) (ja-channel-push! 1 (seconds 0.1)) - (let ((a0-7 (-> self skel root-channel 0))) - (set! (-> a0-7 frame-group) (the-as art-joint-anim pegasus-board-attack-pegasus-ja)) - (set! (-> a0-7 param 0) - (the float (+ (-> (the-as art-joint-anim pegasus-board-attack-pegasus-ja) frames num-frames) -1)) - ) - (set! (-> a0-7 param 1) 1.5) - (set! (-> a0-7 frame-num) 0.0) - (let ((t9-3 joint-control-channel-group!) - (a1-3 pegasus-board-attack-pegasus-ja) - (a2-2 (the-as object num-func-seek!)) - ) - (t9-3 - a0-7 - (the-as art-joint-anim a1-3) - (the-as (function joint-control-channel float float float float :behavior process) a2-2) - ) - (until (ja-done? 0) - (let ((f0-5 (ja-aframe-num 0)) - (f1-0 (-> self speed)) + (ja-no-eval :group! pegasus-board-attack-pegasus-ja + :num! (seek! (the float (+ (-> (the-as art-joint-anim pegasus-board-attack-pegasus-ja) frames num-frames) -1)) 1.5) + :frame-num 0.0 ) - (when (>= f0-5 60.0) - (let ((t9-5 lerp-scale) - (a0-9 f1-0) - (a1-4 0.0) - ) - (set! a2-2 f0-5) - (set! (-> self speed) (t9-5 a0-9 a1-4 (the-as float a2-2) 60.0 100.0)) - ) - (set! (-> self y-offset-desired) 0.0) - ) - ) - (pegasus-move 0.0 #t (the-as symbol a2-2)) - (pegasus-rotate #f 1820.4445) - (suspend) - (let ((a0-12 (-> self skel root-channel 0))) - (set! (-> a0-12 param 0) (the float (+ (-> a0-12 frame-group frames num-frames) -1))) - (set! (-> a0-12 param 1) 1.5) - (let ((t9-8 joint-control-channel-group-eval!) - (a1-7 #f) - ) - (set! a2-2 num-func-seek!) - (t9-8 - a0-12 - (the-as art-joint-anim a1-7) - (the-as (function joint-control-channel float float float float :behavior process) a2-2) - ) - ) + (until (ja-done? 0) + (let ((frame-num (ja-aframe-num 0)) + (speed (-> self speed)) ) + (when (>= frame-num 60.0) + (set! (-> self speed) (lerp-scale speed 0.0 frame-num 60.0 100.0)) + (set! (-> self y-offset-desired) 0.0) ) ) + (pegasus-move 0.0 #t) + (pegasus-rotate #f 1820.4445) + (suspend) + (ja :num! (seek! max 1.5)) ) - (if gp-0 + (if event-result (send-event (handle->process (-> self incoming attacker-handle)) 'end-mode) ) ) @@ -843,18 +884,18 @@ :virtual #t :trans (behavior () (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) - (let ((gp-0 (-> self focus aware))) + (let ((awareness (-> self focus aware))) (cond - ((and (>= 1 (the-as int gp-0)) + ((and (>= 1 (the-as int awareness)) (-> self over-ground) (< (fabs (- (-> self y-offset) (-> self y-offset-desired))) 409.6) ) (go-virtual active) ) - ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + ((and (= awareness (enemy-aware enemy-aware-3)) (get-enemy-target self)) (go-hostile self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= awareness (enemy-aware unaware)) (go-flee self) ) ) @@ -863,27 +904,19 @@ (none) ) :code (behavior () - (let ((v1-2 (ja-group))) - (when (not (and v1-2 (= v1-2 pegasus-fly-ja))) + (let ((anim-group (ja-group))) + (when (not (and anim-group (= anim-group pegasus-fly-ja))) (ja-channel-push! 1 (seconds 0.2)) (ja :group! pegasus-fly-ja) ) ) (until #f - (let ((gp-0 (-> self skel root-channel 0))) - (set! (-> gp-0 param 0) (pegasus-calc-anim-speed)) - (let ((t9-2 joint-control-channel-group-eval!) - (a1-1 #f) - (a2-0 num-func-loop!) - ) - (t9-2 gp-0 (the-as art-joint-anim a1-1) a2-0) - (if (< 27.306667 (fabs (-> self speed))) - (set! (-> self speed) (* 0.95 (-> self speed))) - ) - (set! (-> self y-offset-desired) 0.0) - (pegasus-move 409.6 #t (the-as symbol a2-0)) + (ja :num! (loop! (pegasus-calc-anim-speed))) + (if (< 27.306667 (fabs (-> self speed))) + (set! (-> self speed) (* 0.95 (-> self speed))) ) - ) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 409.6 #t) (pegasus-rotate #f 1820.4445) (suspend) ) @@ -895,82 +928,42 @@ ;; definition for function pegasus-fly-code (defbehavior pegasus-fly-code pegasus ((arg0 int)) - (local-vars (a2-3 object)) - (let ((f30-0 (pegasus-calc-anim-speed))) + "Handles the flying animations and sounds +@TODO - cleanup a bit more" + (let ((anim-speed (pegasus-calc-anim-speed))) (let ((gp-0 (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (-> self clock frame-counter))) ) ) - (let* ((f28-0 (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) - (f0-4 (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) - (s4-0 (pegasus-calc-speed f28-0 122880.0 f0-4 49152.0)) + (let* ((min-dist (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) + (min-speed (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) + (s4-0 (pegasus-calc-speed min-dist 122880.0 min-speed 49152.0)) ) (case (ja-group) (('pegasus-fly-doublespeed-ja) - (let ((a0-7 (-> self skel root-channel 0))) - (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) - (set! (-> a0-7 param 1) (fmax 1.0 (* 0.8 f30-0))) - (let ((t9-4 joint-control-channel-group-eval!) - (a1-3 #f) - ) - (set! a2-3 num-func-seek!) - (t9-4 - a0-7 - (the-as art-joint-anim a1-3) - (the-as (function joint-control-channel float float float float :behavior process) a2-3) - ) - ) - ) + (ja :num! (seek! max (fmax 1.0 (* 0.8 anim-speed)))) ) (('pegasus-fly-ja) - (let ((a0-9 (-> self skel root-channel 0))) - (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) - (set! (-> a0-9 param 1) (* 1.5 f30-0)) - (let ((t9-5 joint-control-channel-group-eval!) - (a1-4 #f) - ) - (set! a2-3 num-func-seek!) - (t9-5 - a0-9 - (the-as art-joint-anim a1-4) - (the-as (function joint-control-channel float float float float :behavior process) a2-3) - ) - ) - ) + (ja :num! (seek! max (* 1.5 anim-speed))) ) (else - (let ((a0-10 (-> self skel root-channel 0))) - (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group frames num-frames) -1))) - (set! (-> a0-10 param 1) 1.0) - (let ((t9-6 joint-control-channel-group-eval!) - (a1-5 #f) - ) - (set! a2-3 num-func-seek!) - (t9-6 - a0-10 - (the-as art-joint-anim a1-5) - (the-as (function joint-control-channel float float float float :behavior process) a2-3) - ) - ) - ) + (ja :num! (seek!)) ) ) (let ((v1-34 #f) (s5-1 12) ) (let ((a0-13 (ja-group))) - (when (not (and a0-13 (begin - (set! a2-3 (= a0-13 pegasus-fly-glide-ja)) - (or (the-as symbol a2-3) - (begin (set! a2-3 (= a0-13 pegasus-fly-doublespeed-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-fly-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-flip-around-a-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-flip-around-b-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-fly-to-run-ja)) (the-as symbol a2-3)) - (begin (set! a2-3 (= a0-13 pegasus-run-ja)) (the-as symbol a2-3)) - (= a0-13 pegasus-run-to-fly-ja) - ) - ) + (when (not (and a0-13 + (or (= a0-13 pegasus-fly-glide-ja) + (= a0-13 pegasus-fly-doublespeed-ja) + (= a0-13 pegasus-fly-ja) + (= a0-13 pegasus-flip-around-a-ja) + (= a0-13 pegasus-flip-around-b-ja) + (= a0-13 pegasus-fly-to-run-ja) + (= a0-13 pegasus-run-ja) + (= a0-13 pegasus-run-to-fly-ja) + ) ) ) (set! s5-1 37) @@ -979,12 +972,7 @@ ) (cond ((and s4-0 (let ((a0-21 (ja-group))) - (not (and a0-21 (begin - (set! a2-3 (= a0-21 pegasus-flip-around-a-ja)) - (or (the-as symbol a2-3) (= a0-21 pegasus-flip-around-b-ja)) - ) - ) - ) + (not (and a0-21 (or (= a0-21 pegasus-flip-around-a-ja) (= a0-21 pegasus-flip-around-b-ja)))) ) ) (ja-channel-push! 1 (seconds 0.125)) @@ -1013,9 +1001,8 @@ (vector-cross! s5-3 s5-3 (-> self tangent)) (vector-normalize! s5-3 1.0) (matrix-axis-angle! s4-1 s5-3 32768.0) - (set! a2-3 s4-1) + (vector-matrix*! (-> self facing) (-> self facing) s4-1) ) - (vector-matrix*! (-> self facing) (-> self facing) (the-as matrix a2-3)) ) ((let ((v1-72 (ja-group))) (and v1-72 (= v1-72 pegasus-run-ja)) @@ -1063,7 +1050,7 @@ ) (ja :num-func num-func-identity :frame-num 0.0) ) - ((< 1.25 f30-0) + ((< 1.25 anim-speed) (let ((v1-135 (ja-group))) (when (not (and v1-135 (= v1-135 pegasus-fly-doublespeed-ja))) (ja-channel-push! 1 (the-as time-frame s5-1)) @@ -1089,17 +1076,11 @@ ) (pegasus-move 0.0 - (the-as - symbol - (or gp-0 - (let ((v1-161 (ja-group))) - (and v1-161 - (begin (set! a2-3 (= v1-161 pegasus-fly-to-run-ja)) (or (the-as symbol a2-3) (= v1-161 pegasus-run-ja))) - ) + (the-as symbol (or gp-0 (let ((v1-161 (ja-group))) + (and v1-161 (or (= v1-161 pegasus-fly-to-run-ja) (= v1-161 pegasus-run-ja))) + ) + ) ) - ) - ) - (the-as symbol a2-3) ) ) ) @@ -1111,9 +1092,9 @@ (defstate pegasus-tired (pegasus) :event (the-as (function process int symbol event-message-block object :behavior pegasus) enemy-event-handler) :enter (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) enter))) + (if func + (func) ) ) (set! (-> self state-time) (-> self clock frame-counter)) @@ -1122,18 +1103,18 @@ (none) ) :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) exit))) + (if func + (func) ) ) (remove-setting! 'sound-mode) (none) ) :trans (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) trans))) + (if func + (func) ) ) (cond @@ -1172,9 +1153,9 @@ (defstate flee (pegasus) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) enter))) + (if func + (func) ) ) (set! (-> self near-timer) 3000) @@ -1183,9 +1164,9 @@ (none) ) :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy flee) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) exit))) + (if func + (func) ) ) (set! (-> self y-offset-desired) 0.0) @@ -1194,9 +1175,9 @@ ) :trans (behavior () (when (-> self can-run) - (let ((t9-0 (-> (method-of-type enemy flee) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy flee) trans))) + (if func + (func) ) ) ) @@ -1235,8 +1216,8 @@ :virtual #t :code (behavior () (set! (-> self allow-idle) #f) - (let ((v1-2 (ja-group))) - (when (not (and v1-2 (= v1-2 pegasus-idle-ja))) + (let ((anim-group (ja-group))) + (when (not (and anim-group (= anim-group pegasus-idle-ja))) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! pegasus-fly-to-idle-ja :num! (seek! (the float (+ (-> (the-as art-joint-anim pegasus-fly-to-idle-ja) frames num-frames) -1))) @@ -1275,9 +1256,9 @@ (none) ) :exit (behavior () - (let ((t9-0 (-> (method-of-type enemy notice) exit))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type enemy notice) exit))) + (if func + (func) ) ) (remove-setting! 'sound-mode) @@ -1290,9 +1271,9 @@ (-> self curve-position) ) (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) - (enemy-method-72 self) + (react-to-focus self) ) - (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (let ((anim-length (get-rand-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! @@ -1301,40 +1282,37 @@ -1 ) ) - f30-0 + anim-length ) :frame-num 0.0 ) (until (ja-done? 0) (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) - (enemy-method-72 self) + (react-to-focus self) ) (pegasus-rotate #f 1820.4445) (suspend) - (ja :num! (seek! max f30-0)) + (ja :num! (seek! max anim-length)) ) (ja-no-eval :group! pegasus-idle-takeoff-in-air-ja - :num! (seek! (the float (+ (-> (the-as art-joint-anim pegasus-idle-takeoff-in-air-ja) frames num-frames) -1)) f30-0) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim pegasus-idle-takeoff-in-air-ja) frames num-frames) -1)) + anim-length + ) :frame-num 0.0 ) (until (ja-done? 0) - (let ((t9-12 pegasus-calc-speed) - (a0-12 61440.0) - (a1-15 122880.0) - (a2-7 204800.0) - ) - (if (t9-12 a0-12 a1-15 a2-7 49152.0) - (enemy-method-72 self) - ) - (pegasus-rotate #f 1820.4445) - (set! (-> self y-offset-desired) 0.0) - (pegasus-move 0.0 #f (the-as symbol a2-7)) - ) + (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) + (react-to-focus self) + ) + (pegasus-rotate #f 1820.4445) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 0.0 #f) (suspend) - (ja :num! (seek! max f30-0)) + (ja :num! (seek! max anim-length)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -1344,10 +1322,10 @@ :virtual #t :post (behavior () (pegasus-show-runs) - (pegasus-method-137 self) - (let ((t9-2 (-> (method-of-type enemy idle) post))) - (if t9-2 - ((the-as (function none) t9-2)) + (track-how-long-aimed-at! self) + (let ((func (-> (method-of-type enemy idle) post))) + (if func + ((the-as (function none) func)) ) ) (none) @@ -1356,54 +1334,54 @@ ;; definition for method 114 of type pegasus ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 pegasus ((obj pegasus)) - "@abstract" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) +(defmethod init-enemy-collision! pegasus ((obj pegasus)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0))) - (set! (-> s5-0 total-prims) (the-as uint 2)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) - (set! (-> s4-0 transform-index) 3) - (set-vector! (-> s4-0 local-sphere) 0.0 9216.0 4096.0 18432.0) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 1) 0))) + (set! (-> cshape total-prims) (the-as uint 2)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid no-standon)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 9216.0 4096.0 18432.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-14 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-14 prim-core action) (collide-action solid no-standon)) - (set! (-> v1-14 transform-index) 3) - (set-vector! (-> v1-14 local-sphere) 0.0 6144.0 0.0 11264.0) + (let ((prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-sphere prim-core action) (collide-action solid no-standon)) + (set! (-> prim-sphere transform-index) 3) + (set-vector! (-> prim-sphere local-sphere) 0.0 6144.0 0.0 11264.0) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-17 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override2) s5-0) + (set! (-> obj root-override2) cshape) ) 0 (none) @@ -1434,15 +1412,15 @@ ;; definition for method 115 of type pegasus ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 pegasus ((obj pegasus)) - "@abstract" - (local-vars (sv-16 res-tag)) +(defmethod init-enemy! pegasus ((obj pegasus)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (local-vars (tag res-tag)) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-pegasus" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *pegasus-enemy-info*) + (init-enemy-behaviour-and-stats! obj *pegasus-enemy-info*) (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf00)) (set! (-> obj link) (new 'process 'actor-link-info obj #f)) (dotimes (v1-8 20) @@ -1454,24 +1432,27 @@ (logior! (-> obj path-info 0 path-data flags) (path-control-flag display draw-line draw-point draw-text)) (set! (-> obj num-paths) 1) ) - (dotimes (s5-1 20) - (let ((v1-19 (new 'process 'curve-control obj 'path (the float s5-1)))) - (if (logtest? (-> v1-19 flags) (path-control-flag not-found)) + (dotimes (path-info-idx 20) + (let ((curve (new 'process 'curve-control obj 'path (the float path-info-idx)))) + (if (logtest? (-> curve flags) (path-control-flag not-found)) (goto cfg-15) ) - (set! (-> obj num-paths) (+ s5-1 1)) - (set! (-> obj path-info s5-1 path-data) v1-19) - (logior! (-> v1-19 flags) (path-control-flag display draw-line draw-point)) + (set! (-> obj num-paths) (+ path-info-idx 1)) + (set! (-> obj path-info path-info-idx path-data) curve) + (logior! (-> curve flags) (path-control-flag display draw-line draw-point)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data (-> obj entity) 'path-connection pointer :tag-ptr (& sv-16) :time (the float s5-1)))) + (set! tag (new 'static 'res-tag)) + (let ((data + (res-lump-data (-> obj entity) 'path-connection pointer :tag-ptr (& tag) :time (the float path-info-idx)) + ) + ) (cond - (v1-22 - (set! (-> obj path-info s5-1 num-data) (the-as int (-> sv-16 elt-count))) - (set! (-> obj path-info s5-1 control-data) (the-as (pointer float) v1-22)) + (data + (set! (-> obj path-info path-info-idx num-data) (the-as int (-> tag elt-count))) + (set! (-> obj path-info path-info-idx control-data) (the-as (pointer float) data)) ) (else - (set! (-> obj path-info s5-1 num-data) 0) + (set! (-> obj path-info path-info-idx num-data) 0) 0 ) ) @@ -1494,36 +1475,22 @@ (-> obj curve-position) ) (set! (-> obj facing quad) (-> obj tangent quad)) - (let ((s5-2 (new 'stack-no-clear 'matrix))) - (forward-down->inv-matrix s5-2 (-> obj facing) (new 'static 'vector :y -1.0)) - (matrix->quaternion (-> obj root-override2 quat) s5-2) + (let ((matrix (new 'stack-no-clear 'matrix))) + (forward-down->inv-matrix matrix (-> obj facing) (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> obj root-override2 quat) matrix) ) (set! (-> obj y-vel) 0.0) - (let ((t9-12 (method-of-type res-lump get-property-value-float)) - (a0-37 (-> obj entity)) - (a1-14 'water-height) - (a2-10 'interp) - ) - (set! (-> obj water-height) - (t9-12 a0-37 a1-14 a2-10 -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*) - ) - (set! (-> obj timeout) (the-as uint 3000)) - (when (-> obj entity) - (let ((t9-13 (method-of-type res-lump get-property-value-float)) - (a0-38 (-> obj entity)) - (a1-15 'timeout) - ) - (set! a2-10 'interp) - (let ((f0-9 (t9-13 a0-38 a1-15 a2-10 -1000000000.0 10.0 (the-as (pointer res-tag) #f) *res-static-buf*))) - (set! (-> obj timeout) (the-as uint (the int (* 300.0 f0-9)))) - ) - ) + (set! (-> obj water-height) (res-lump-float (-> obj entity) 'water-height)) + (set! (-> obj timeout) (the-as uint 3000)) + (when (-> obj entity) + (let ((timeout (res-lump-float (-> obj entity) 'timeout :default 10.0))) + (set! (-> obj timeout) (the-as uint (the int (* 300.0 timeout)))) ) - (set! (-> obj ambient-possible) (the-as uint 0)) - (set! (-> obj speed) 0.0) - (set! (-> obj y-offset-desired) 0.0) - (pegasus-move 409600.0 #t a2-10) ) + (set! (-> obj ambient-possible) (the-as uint 0)) + (set! (-> obj speed) 0.0) + (set! (-> obj y-offset-desired) 0.0) + (pegasus-move 409600.0 #t) (pegasus-calc-speed 61440.0 122880.0 2048.0 2048.0) (set! (-> obj can-run) #f) 0 @@ -1541,14 +1508,14 @@ (set! (-> self entity) (entity-by-type pegasus)) (set! (-> self actor-group 0) (res-lump-struct (-> self entity) 'actor-groups (pointer entity-actor))) (when (-> self actor-group 0) - (let ((v1-6 (-> self actor-group 0 0))) - (set! (-> self data-int32 0) (the-as int v1-6)) - (set! (-> self data-int32 1) (the-as int v1-6)) + (let ((actor-group (-> self actor-group 0 0))) + (set! (-> self data-int32 0) (the-as int actor-group)) + (set! (-> self data-int32 1) (the-as int actor-group)) ) - (dotimes (gp-0 (the-as int (-> self actor-group 0 0))) - (let ((t0-1 (-> (&+ (-> self actor-group 0) (* gp-0 8)) 3))) - (if t0-1 - (add-icon! *minimap* self (the-as uint 16) (the-as int #f) (the-as vector t0-1) 0) + (dotimes (actor-idx (the-as int (-> self actor-group 0 0))) + (let ((actor (-> (&+ (-> self actor-group 0) (* actor-idx 8)) 3))) + (if actor + (add-icon! *minimap* self (the-as uint 16) (the-as int #f) (the-as vector actor) 0) ) ) ) @@ -1566,23 +1533,23 @@ (function object) (lambda :behavior task-manager () - (local-vars (sv-16 int)) + (local-vars (data int)) (set! (-> self start-time) (-> self clock frame-counter)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-pegasus :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) - (set! sv-16 (-> self data-int32 1)) + (set! data (-> self data-int32 1)) (when (-> self actor-group 0) - (dotimes (v1-12 (the-as int (-> self actor-group 0 0))) - (let ((a1-4 (-> (&+ (-> self actor-group 0) (* v1-12 8)) 3))) - (if (and a1-4 (logtest? (-> a1-4 extra perm status) (entity-perm-status subtask-complete))) - (set! sv-16 (+ sv-16 -1)) + (dotimes (actor-group (the-as int (-> self actor-group 0 0))) + (let ((actor (-> (&+ (-> self actor-group 0) (* actor-group 8)) 3))) + (if (and actor (logtest? (-> actor extra perm status) (entity-perm-status subtask-complete))) + (set! data (+ data -1)) ) ) ) ) - (let ((v1-15 sv-16)) - (set! (-> self data-int32 0) v1-15) - (set! (-> *game-info* counter) (the float v1-15)) + (let ((_data data)) + (set! (-> self data-int32 0) _data) + (set! (-> *game-info* counter) (the float _data)) ) (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc index 093f0a1e69..a9a09e7fe5 100644 --- a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc @@ -130,6 +130,7 @@ ) ;; definition for method 28 of type predator-shot +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound predator-shot ((obj predator-shot) (arg0 projectile-options)) (case arg0 (((projectile-options lose-altitude)) @@ -145,11 +146,12 @@ ) ) ) + (none) ) ;; definition for method 30 of type predator-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! predator-shot ((obj predator-shot)) +(defmethod init-proj-collision! predator-shot ((obj predator-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -323,7 +325,72 @@ :default-hit-points 5 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -399,12 +466,14 @@ (set! (-> *predator-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type predator -(defmethod enemy-method-74 predator ((obj predator) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler predator ((obj predator) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('attack) (set! (-> obj shock-effect-end) (the-as uint (+ (-> pp clock frame-counter) (seconds 1)))) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (('death-end) (when (nonzero? (-> obj ambient-sound-id)) @@ -412,10 +481,10 @@ (set! (-> obj ambient-sound-id) (new 'static 'sound-id)) 0 ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1247,10 +1316,8 @@ (if (not gp-0) (go-virtual active) ) - (when (enemy-method-107 self) - (when (and gp-0 - (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) - ) + (when (get-enemy-target self) + (when (and gp-0 (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time))) (let ((f0-0 (vector-vector-xz-distance (get-trans (the-as process-focusable gp-0) 0) (-> self root-override2 trans)) ) @@ -1398,8 +1465,12 @@ ;; definition for method 55 of type predator ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 predator ((obj predator)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! predator ((obj 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!))) (t9-0 obj) ) (predator-method-183 obj) @@ -1428,8 +1499,8 @@ ;; definition for method 114 of type predator ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 predator ((obj predator)) - "@abstract" +(defmethod init-enemy-collision! predator ((obj predator)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1536,7 +1607,7 @@ ;; definition for method 63 of type predator ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 predator ((obj predator) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 predator ((obj predator) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1560,9 +1631,10 @@ This commonly includes things such as: ;; definition for method 113 of type predator ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-113 predator ((obj predator) (arg0 nav-enemy-info)) +(defmethod init-enemy-behaviour-and-stats! predator ((obj predator) (arg0 nav-enemy-info)) + "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" (set! (-> arg0 nav-mesh) *default-nav-mesh*) - (let ((t9-0 (method-of-type nav-enemy enemy-method-113))) + (let ((t9-0 (method-of-type nav-enemy init-enemy-behaviour-and-stats!))) (t9-0 obj arg0) ) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -1573,14 +1645,14 @@ This commonly includes things such as: ;; definition for method 115 of type predator ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 predator ((obj predator)) - "@abstract" +(defmethod init-enemy! predator ((obj predator)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-predator" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *predator-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *predator-nav-enemy-info*) (let ((v1-5 (-> obj nav))) (set! (-> v1-5 speed-scale) 1.0) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc index 1b5836c71c..78fd8af856 100644 --- a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fort-robotank-turret_REF.gc @@ -717,7 +717,7 @@ ) ;; definition for method 28 of type fort-robotank-shot -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound fort-robotank-shot ((obj fort-robotank-shot) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -729,12 +729,13 @@ ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; definition for method 30 of type fort-robotank-shot ;; WARN: Return type mismatch int vs none. -(defmethod init-collision! fort-robotank-shot ((obj fort-robotank-shot)) +(defmethod init-proj-collision! fort-robotank-shot ((obj fort-robotank-shot)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fortress-scenes_REF.gc b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fortress-scenes_REF.gc new file mode 100644 index 0000000000..7428b0e8ea --- /dev/null +++ b/test/decompiler/reference/jak2/levels/fortress/ammo_dump/fortress-scenes_REF.gc @@ -0,0 +1,293 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(scene-method-16 (new 'static 'scene + :name "fortress-blow-up-ammo-res-a" + :extra #f + :info #f + :mask-to-clear #x1282000 + :entity "scene-stage-44" + :art-group "scenecamera" + :anim "fortress-blow-up-ammo-res-a" + :parts 9 + :command-list '((0 + (kill "fort-robotank-6") + (kill "fort-entry-gate-16") + (setting-reset gem mode #t) + (fadein (frame-time-30 5)) + ) + (10000 + (unless (task-closed? "fortress-dump-deal") (talker-spawn "miss006")) + (task-close! "fortress-dump-deal") + ) + ) + :cut-list '(68 105 151 240 311 521 652 695 744 891) + :wait-ground-time (seconds 1) + :draw-target #f + :abort #t + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'fordumpc + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '((311 521)) + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jak-highres" + :level 'fordumpc + :art-group "skel-jak-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "crimson-guard-lowres" + :level 'fordumpd + :art-group "skel-crimson-guard-lowres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x4 + ) + (new 'static 'scene-actor + :name "crimson-guard-highres" + :level 'fordumpd + :art-group "skel-crimson-guard-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "grunt-fma" + :level 'fordumpd + :art-group "skel-grunt-fma" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "grunt-fma" + :level 'fordumpd + :art-group "skel-grunt-fma" + :prefix "b-" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "palmpilot" + :level 'fordumpd + :art-group "skel-palmpilot" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "fort-robotank" + :level 'fordumpc + :art-group "skel-fort-robotank" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "fort-robotank-turret" + :level 'fordumpc + :art-group "skel-fort-robotank-turret" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point-obj "fordumpc-start" + :end-point-obj "fordumpc-movie-end" + :borrow '() + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :blackout-end #t + :peaceful #t + :save #t + ) + ) + +;; failed to figure out what this is: +(scene-method-16 + (new 'static 'scene + :name "fortress-blow-up-ammo-res-b" + :extra #f + :info #f + :mask-to-clear #x1282000 + :entity "scene-stage-45" + :art-group "scenecamera" + :anim "fortress-blow-up-ammo-res-b" + :parts 8 + :command-list '((0 + (send-event "fort-missile-2" 'halt) + (send-event "fort-entry-gate-14" 'open (seconds 20) #t) + (send-event "fort-entry-gate-18" 'open (seconds 20) #t) + (kill "fort-entry-gate-14") + (kill "fort-entry-gate-18") + (kill "fort-robotank-6") + (apply ,(lambda :behavior scene-player () (set! (-> self clock) (-> *display* base-clock)) (none))) + (send-event *traffic-manager* 'set-guard-target-level (unbox 0)) + (send-event *traffic-manager* 'set-max-alert-level (unbox 0)) + (send-event *traffic-manager* 'set-alert-level (unbox 0)) + (send-event *traffic-manager* 'set-alert-duration (unbox 10800000)) + (send-event *traffic-manager* 'deactivate-by-type (unbox 6)) + (send-event *traffic-manager* 'deactivate-by-type (unbox 18)) + (send-event *traffic-manager* 'deactivate-by-type (unbox 19)) + ) + (1 (apply ,(lambda :behavior scene-player () (update-rates! (-> *display* entity-clock) 0.1) (none)))) + (267 + (part-tracker + "group-fortress-big-explosion" + entity + "particleman" + joint + "particleA" + track + #t + duration + (frame-range 270 365) + ) + ) + (305 (send-event "fort-missile-2" 'die)) + (365 + (part-tracker + "group-fortress-side-explosion" + entity + "particleman" + joint + "particleA" + track + #t + duration + (frame-range 365 454) + ) + ) + (479 (blackout (frame-range 479 510))) + (500 + (fma-sphere + (danger) + duration + (frame-range (new 'static 'bfloat :data 500.0) (new 'static 'bfloat :data 900.0)) + danger + (new 'static 'sprite-vec-data-2d + :x-y-z-sx (new 'static 'vector :x 3149824.0 :y 32768.0 :z 1433600.0 :w 81920.0) + :r-g-b-a (new 'static 'vector :z 163840.0 :w 1.0) + ) + ) + (fma-sphere (nav kill-once) sphere (new 'static 'vector :x 3149824.0 :y 32768.0 :z 1433600.0 :w 40960.0)) + ) + (10000 + (task-close! "fortress-dump-resolution") + (apply ,(lambda :behavior scene-player () (update-rates! (-> *display* entity-clock) 1.0) (none))) + (send-event *traffic-manager* 'restore-default-settings) + ) + ) + :cut-list '(356 381 431 457 511) + :wait-ground-time (seconds 1) + :draw-target #f + :abort #t + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'fordumpc + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jak-highres" + :level 'fordumpc + :art-group "skel-jak-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "particleman" + :level 'fordumpc + :art-group "skel-particleman" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point-obj "fordumpc-explode-movie" + :end-point-obj "ctysluma-fort-end" + :borrow '() + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :blackout-end #t + :peaceful #t + :music-delay 1500.0 + :save #t + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/fortress/exit/forexitb-part_REF.gc b/test/decompiler/reference/jak2/levels/fortress/exit/forexitb-part_REF.gc index f6b86ea4e7..75c3e2ec4b 100644 --- a/test/decompiler/reference/jak2/levels/fortress/exit/forexitb-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/exit/forexitb-part_REF.gc @@ -1318,6 +1318,7 @@ ;; definition for function check-drop-level-forexitb-drop-userdata ;; INFO: Used lq/sq (defun check-drop-level-forexitb-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water pipe spray at the end of fortress does not go below the provided value, render splash when it reaches" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) @@ -1347,6 +1348,7 @@ ;; definition for function check-drop-level-forexitb-drop-water-userdata ;; INFO: Used lq/sq (defun check-drop-level-forexitb-drop-water-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure water pipe drip at the end of fortress does not go below the provided value, render splash when it reaches" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) (let ((s3-0 (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) @@ -1810,7 +1812,3 @@ (sp-flt spt-rotate-y (degrees 0.0)) ) ) - - - - 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 7e5ff1918d..cbfcd8a3ca 100644 --- a/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/fort-turret_REF.gc @@ -454,7 +454,7 @@ (gun-tilt float :offset-assert 580) (desired-twist float :offset-assert 584) (desired-tilt float :offset-assert 588) - (los-clear basic :offset-assert 592) + (los-clear symbol :offset-assert 592) (flash-state basic :offset-assert 596) (flash-index uint32 :offset-assert 600) (can-shoot symbol :offset-assert 604) @@ -595,8 +595,12 @@ (set! (-> *fort-turret-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 55 of type fort-turret -(defmethod enemy-method-55 fort-turret ((obj fort-turret)) - (let ((t9-0 (method-of-type enemy enemy-method-55))) +(defmethod track-target! fort-turret ((obj 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!))) (t9-0 obj) ) (let ((s5-0 (-> obj root-override2))) @@ -810,12 +814,12 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) (if (or (>= (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) (< (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) @@ -902,12 +906,12 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (set! (-> self desired-twist) (* 8192.0 (cos (get-scaled-val! (-> self sync) 32768.0 0)))) (fort-turret-method-140 self 0.1 91.022224) (fort-turret-method-141 self) @@ -944,12 +948,12 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (>= 2 (the-as int (-> self focus aware))) (go-stare self) ) ) - (set! (-> self root-override2 penetrated-by) (enemy-method-59 self)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) (fort-turret-method-141 self) (if (and (< (- (-> self clock frame-counter) (the-as int (-> self target-timeout))) (seconds 0.5)) (>= (- (-> self clock frame-counter) (-> self last-hit-time)) (seconds 2)) @@ -970,9 +974,11 @@ ) ;; definition for method 74 of type fort-turret -(defmethod enemy-method-74 fort-turret ((obj fort-turret) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler fort-turret ((obj fort-turret) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp - (if (and (= arg2 'notify) (< 1 (the-as int arg1)) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) + (if (and (= arg2 'notify) (< 1 arg1) (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*)) (set! (-> obj last-hit-time) (-> pp clock frame-counter)) ) (case arg2 @@ -995,12 +1001,12 @@ #f ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) (else - ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1010,7 +1016,7 @@ (defstate die (fort-turret) :virtual #t :enter (behavior () - (enemy-method-132 self) + (dispose! self) (let ((v1-3 (-> self root-override2 root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) @@ -1056,7 +1062,7 @@ (none) ) :post (behavior () - (enemy-method-55 self) + (track-target! self) (none) ) ) @@ -1070,14 +1076,16 @@ ;; definition for method 59 of type fort-turret ;; WARN: Return type mismatch int vs penetrate. -(defmethod enemy-method-59 fort-turret ((obj fort-turret)) +(defmethod get-penetrate-info fort-turret ((obj fort-turret)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (the-as penetrate 0) ) ;; definition for method 114 of type fort-turret ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 fort-turret ((obj fort-turret)) - "@abstract" +(defmethod init-enemy-collision! fort-turret ((obj fort-turret)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (stack-size-set! (-> obj main-thread) 512) (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) @@ -1149,14 +1157,14 @@ ;; definition for method 115 of type fort-turret ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 fort-turret ((obj fort-turret)) - "@abstract" +(defmethod init-enemy! fort-turret ((obj fort-turret)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-fort-turret" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *fort-turret-enemy-info*) + (init-enemy-behaviour-and-stats! obj *fort-turret-enemy-info*) (set! (-> obj invincible) #f) (if (logtest? (the-as int (res-lump-value (-> obj entity) 'enemy-options uint128 :time -1000000000.0)) 1) (set! (-> obj invincible) #t) diff --git a/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc index edd33e8e6d..3896ed2b08 100644 --- a/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/fortress-obs_REF.gc @@ -91,24 +91,24 @@ (defstate die (fort-trap-door) :virtual #t :enter (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (sound-play "trapdoor") - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer self)) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) 'trigger) - (let ((t9-2 send-event-function) - (v1-6 (-> self notify-actor)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 0) + (set! (-> evt message) 'trigger) + (let ((func send-event-function) + (actor (-> self notify-actor)) ) - (t9-2 - (if v1-6 - (-> v1-6 extra process) + (func + (if actor + (-> actor extra process) ) - a1-1 + evt ) ) ) @@ -118,27 +118,29 @@ ((lambda () (with-pp (sound-play "wcrate-break") - (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 1)))) - (let* ((s5-1 *target*) - (a0-4 (if (type? s5-1 process-focusable) - s5-1 - ) - ) + (let ((exploder-tuning (new 'stack 'joint-exploder-tuning (the-as uint 1)))) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when a0-4 - (set! (-> gp-1 fountain-rand-transv-lo quad) (-> (get-trans a0-4 0) quad)) - (set! (-> gp-1 fountain-rand-transv-lo y) (+ -16384.0 (-> gp-1 fountain-rand-transv-lo y))) + (when target-proc + (set! (-> exploder-tuning fountain-rand-transv-lo quad) (-> (get-trans target-proc 0) quad)) + (set! (-> exploder-tuning fountain-rand-transv-lo y) + (+ -16384.0 (-> exploder-tuning fountain-rand-transv-lo y)) + ) ) ) - (set! (-> gp-1 fountain-rand-transv-hi x) 24576.0) - (set! (-> gp-1 fountain-rand-transv-hi y) 81920.0) - (set! (-> gp-1 fountain-rand-transv-hi z) 12288.0) - (set! (-> gp-1 fountain-rand-transv-hi w) 32768.0) + (set! (-> exploder-tuning fountain-rand-transv-hi x) 24576.0) + (set! (-> exploder-tuning fountain-rand-transv-hi y) 81920.0) + (set! (-> exploder-tuning fountain-rand-transv-hi z) 12288.0) + (set! (-> exploder-tuning fountain-rand-transv-hi w) 32768.0) (process-spawn joint-exploder (art-group-get-by-name *level* "skel-fort-trap-door-explode" (the-as (pointer uint32) #f)) 5 - gp-1 + exploder-tuning *fort-trap-door-exploder-params* :to pp ) @@ -148,8 +150,8 @@ ) (suspend) (ja-channel-set! 0) - (let ((gp-0 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 1)) (suspend) ) ) @@ -165,42 +167,46 @@ ;; definition for method 11 of type fort-trap-door ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! fort-trap-door ((obj fort-trap-door) (arg0 entity-actor)) +(defmethod init-from-entity! fort-trap-door ((obj fort-trap-door) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 0) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 20480.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 20480.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + (set! (-> obj root-override) (the-as collide-shape-moving cshape)) ) (set! (-> (the-as collide-shape-moving (-> obj root-override)) penetrated-by) (penetrate flop)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-fort-trap-door" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! (-> obj notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) - (let ((a0-14 (-> obj skel root-channel 0))) - (set! (-> a0-14 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) - (set! (-> a0-14 frame-num) 0.0) - (joint-control-channel-group! a0-14 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + (set! (-> obj notify-actor) (entity-actor-lookup entity 'alt-actor 0)) + (let ((channel (-> obj skel root-channel 0))) + (set! (-> channel frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> channel frame-num) 0.0) + (joint-control-channel-group! + channel + (the-as art-joint-anim (-> obj draw art-group data 2)) + num-func-identity + ) ) (transform-post) (go (method-of-object obj idle)) @@ -245,18 +251,18 @@ This commonly includes things such as: ;; definition for method 24 of type water-anim-fortress ;; WARN: Return type mismatch ripple-wave-set vs none. -(defmethod art-init! water-anim-fortress ((obj water-anim-fortress)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) - (t9-0 obj) +(defmethod init-water! water-anim-fortress ((obj water-anim-fortress)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((parent-method (method-of-type water-anim init-water!))) + (parent-method obj) ) - (let ((v1-2 (new 'process 'ripple-control))) - (set! (-> obj draw ripple) v1-2) + (let ((ripple (new 'process 'ripple-control))) + (set! (-> obj draw ripple) ripple) (set-vector! (-> obj draw color-mult) 0.01 0.45 0.5 0.75) - (set! (-> v1-2 global-scale) 3072.0) - (set! (-> v1-2 close-fade-dist) 163840.0) - (set! (-> v1-2 far-fade-dist) 245760.0) - (set! (-> v1-2 waveform) ripple-for-water-anim-fortress) + (set! (-> ripple global-scale) 3072.0) + (set! (-> ripple close-fade-dist) 163840.0) + (set! (-> ripple far-fade-dist) 245760.0) + (set! (-> ripple waveform) ripple-for-water-anim-fortress) ) (none) ) diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc index 3571be1fa4..89d26a90f0 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/monster-frog_REF.gc @@ -79,7 +79,35 @@ :default-hit-points 1 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #x11fffdffa + :penetrate-knocked (penetrate + generic-attack + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + knocked + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 3) @@ -319,7 +347,7 @@ (set! (-> v1-37 prim-core collide-as) (-> self root-override2 backup-collide-as)) (set! (-> v1-37 prim-core collide-with) (-> self root-override2 backup-collide-with)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior monster-frog) nav-enemy-simple-post) @@ -367,7 +395,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) ) @@ -533,7 +561,7 @@ (if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory)) (go-virtual victory) ) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (nav-enemy-method-163 self) (go-stare2 self) ) @@ -545,10 +573,10 @@ (go-virtual active) ) ) - ((or (>= 2 (the-as int gp-0)) (not (enemy-method-107 self))) + ((or (>= 2 (the-as int gp-0)) (not (get-enemy-target self))) (go-stare self) ) - ((= gp-0 (enemy-aware enemy-aware-4)) + ((= gp-0 (enemy-aware unaware)) (go-flee self) ) ) @@ -696,7 +724,7 @@ (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -847,7 +875,7 @@ ) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior monster-frog) nav-enemy-simple-post) @@ -976,16 +1004,20 @@ ) ;; definition for method 55 of type monster-frog -(defmethod enemy-method-55 monster-frog ((obj monster-frog)) +(defmethod track-target! monster-frog ((obj 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 (-> obj water)) - ((method-of-type nav-enemy enemy-method-55) obj) + ((method-of-type nav-enemy track-target!) obj) (none) ) ;; definition for method 114 of type monster-frog ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 monster-frog ((obj monster-frog)) - "@abstract" +(defmethod init-enemy-collision! monster-frog ((obj monster-frog)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1049,14 +1081,14 @@ ;; definition for method 115 of type monster-frog ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 monster-frog ((obj monster-frog)) - "@abstract" +(defmethod init-enemy! monster-frog ((obj monster-frog)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-monster-frog" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *monster-frog-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *monster-frog-nav-enemy-info*) (set! (-> obj water) (new 'process 'water-control obj 5 0.0 8192.0 2048.0)) (set! (-> obj water flags) (water-flags active use-water-anim touch-water part-splash part-drip part-rings part-water find-water) diff --git a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc index 141b93f404..f31d5ef077 100644 --- a/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/mars_tomb/tomb-obs_REF.gc @@ -1396,9 +1396,9 @@ This commonly includes things such as: ;; definition for method 24 of type water-anim-tomb ;; WARN: Return type mismatch ripple-wave-set vs none. -(defmethod art-init! water-anim-tomb ((obj water-anim-tomb)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) +(defmethod init-water! water-anim-tomb ((obj water-anim-tomb)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) (t9-0 obj) ) (let ((v1-2 (new 'process 'ripple-control))) 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 85fac70868..facf4c2f8f 100644 --- a/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc @@ -24,6 +24,7 @@ ) ;; definition for method 28 of type flying-spider-shot +;; WARN: Return type mismatch sound-id vs none. (defmethod play-impact-sound flying-spider-shot ((obj flying-spider-shot) (arg0 projectile-options)) (if (zero? arg0) (sound-play "fly-spider-shot") @@ -32,6 +33,7 @@ arg0 ) ) + (none) ) ;; definition for function spawn-flying-spider-projectile @@ -492,7 +494,7 @@ (none) ) :trans (behavior () - (let ((a0-1 (enemy-method-107 self))) + (let ((a0-1 (get-enemy-target self))) (cond ((or (not a0-1) (>= 2 (the-as int (-> self focus aware)))) (go-stare self) @@ -518,7 +520,7 @@ (suspend) (ja :num! (seek!)) ) - (if (enemy-method-107 self) + (if (get-enemy-target self) (go-virtual attack-fire) ) ) @@ -614,7 +616,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior flying-spider) enemy-event-handler) :enter (behavior () - (enemy-method-132 self) + (dispose! self) (set! (-> self state-time) (-> self clock frame-counter)) (set! (-> self hit-points) 0) (enemy-method-103 self) @@ -658,7 +660,9 @@ ) ;; definition for method 74 of type flying-spider -(defmethod enemy-method-74 flying-spider ((obj flying-spider) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler flying-spider ((obj flying-spider) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit 'hit-knocked) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -691,7 +695,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -715,17 +719,21 @@ (set! (-> v1-52 prim-core collide-with) (collide-spec)) ) 0 - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) ;; definition for method 55 of type flying-spider -(defmethod enemy-method-55 flying-spider ((obj flying-spider)) - ((method-of-type nav-enemy enemy-method-55) obj) +(defmethod track-target! flying-spider ((obj 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!) obj) (none) ) @@ -831,14 +839,18 @@ ;; definition for method 109 of type flying-spider ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-109 flying-spider ((obj flying-spider) (arg0 int)) +(defmethod look-at-target! flying-spider ((obj flying-spider) (arg0 enemy-flag)) + "Logic for looking at the target that is locked on, sets some flags and adjusts the neck to look at the target if available +@param flag Reacts to [[enemy-flag::death-start]] and [[enemy-flag::enable-on-active]], see implementation for details" 0 (none) ) ;; definition for method 59 of type flying-spider ;; WARN: Return type mismatch int vs penetrate. -(defmethod enemy-method-59 flying-spider ((obj flying-spider)) +(defmethod get-penetrate-info flying-spider ((obj flying-spider)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" (the-as penetrate 0) ) @@ -855,8 +867,8 @@ ;; definition for method 114 of type flying-spider ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod enemy-method-114 flying-spider ((obj flying-spider)) - "@abstract" +(defmethod init-enemy-collision! flying-spider ((obj flying-spider)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -921,14 +933,14 @@ ;; definition for method 115 of type flying-spider ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 flying-spider ((obj flying-spider)) - "@abstract" +(defmethod init-enemy! flying-spider ((obj flying-spider)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-flying-spider" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *flying-spider-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *flying-spider-nav-enemy-info*) (let ((v1-5 (-> obj neck))) (set! (-> v1-5 up) (the-as uint 1)) (set! (-> v1-5 nose) (the-as uint 2)) diff --git a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc index c4b988f525..b20c959048 100644 --- a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc @@ -825,7 +825,9 @@ ) ;; definition for method 74 of type mammoth -(defmethod enemy-method-74 mammoth ((obj mammoth) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler mammoth ((obj mammoth) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (case arg2 (('hit) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -843,7 +845,7 @@ (send-event arg0 'get-attack-count 1) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1515,10 +1517,14 @@ ;; definition for method 55 of type mammoth ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 mammoth ((obj mammoth)) +(defmethod track-target! mammoth ((obj 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)) (with-pp - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) + (let ((t9-0 (method-of-type nav-enemy track-target!))) (t9-0 obj) ) (mammoth-update-ik) @@ -1693,8 +1699,8 @@ ;; definition for method 114 of type mammoth ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 mammoth ((obj mammoth)) - "@abstract" +(defmethod init-enemy-collision! mammoth ((obj mammoth)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1791,15 +1797,15 @@ ;; definition for method 115 of type mammoth ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 mammoth ((obj mammoth)) - "@abstract" +(defmethod init-enemy! mammoth ((obj mammoth)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (with-pp (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-mammoth" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *mammoth-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *mammoth-nav-enemy-info*) (logclear! (-> obj mask) (process-mask actor-pause)) (set-vector! (-> obj root-override2 scale) 1.5 1.5 1.5 1.0) (set! (-> obj y-level) -40959590.0) diff --git a/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc b/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc index 77ab431039..c2afa3e3a4 100644 --- a/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc @@ -531,7 +531,7 @@ ) 0 (let ((gp-1 (new 'stack-no-clear 'collide-query))) - (if (enemy-method-126 self gp-1 (-> self root-override2 trans) (collide-spec backgnd) 8192.0 81920.0 1024.0) + (if (enemy-above-ground? self gp-1 (-> self root-override2 trans) (collide-spec backgnd) 8192.0 81920.0 1024.0) (set! (-> self base-height) (-> gp-1 best-other-tri intersect y)) (set! (-> self base-height) (-> self root-override2 trans y)) ) @@ -618,7 +618,7 @@ :virtual #t :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :code (behavior () - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self root-override2 trans y) (-> self base-height)) (ja-channel-push! 1 0) (ja-no-eval :group! mantis-ground-crawl-out-ja @@ -656,7 +656,7 @@ (set! (-> v1-3 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-3 enemy-flags)))) ) 0 - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (set! (-> self state-time) (-> self clock frame-counter)) (set! (-> self root-override2 trans y) (+ -18841.6 (-> self base-height))) (let ((gp-0 (-> self root-override2))) @@ -1247,7 +1247,7 @@ :event (the-as (function process int symbol event-message-block object :behavior mantis) enemy-event-handler) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) - (enemy-method-109 self 1) + (look-at-target! self (enemy-flag lock-focus)) (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) (let ((v1-6 self)) (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-6 enemy-flags))) @@ -1263,7 +1263,7 @@ ) 0 (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self starting-time) (the-as uint (-> self clock frame-counter))) + (set! (-> self starting-time) (-> self clock frame-counter)) (none) ) :trans (behavior () @@ -1308,9 +1308,9 @@ (go-virtual crawl) ) ) - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (>= (the-as int (-> self focus aware)) 3) - (enemy-method-107 self) + (get-enemy-target self) ) (go-hostile self) ) @@ -1335,7 +1335,9 @@ ) ;; definition for method 74 of type mantis -(defmethod enemy-method-74 mantis ((obj mantis) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler mantis ((obj mantis) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (with-pp (case arg2 (('track) @@ -1382,7 +1384,7 @@ (>= f0-0 (* f1-0 f1-0)) ) ) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) ((or (= s5-1 (knocked-type knocked-type-4)) (= s5-1 (knocked-type knocked-type-6))) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) @@ -1401,7 +1403,7 @@ #t ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -1601,9 +1603,13 @@ ;; definition for method 55 of type mantis ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. -(defmethod enemy-method-55 mantis ((obj mantis)) +(defmethod track-target! mantis ((obj 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 enemy-method-55))) + (let ((t9-0 (method-of-type nav-enemy track-target!))) (t9-0 obj) ) (logclear! (-> obj flags) (mantis-flag tracked)) @@ -1979,8 +1985,8 @@ ;; definition for method 114 of type mantis ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod enemy-method-114 mantis ((obj mantis)) - "@abstract" +(defmethod init-enemy-collision! mantis ((obj mantis)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -2085,15 +2091,15 @@ ;; definition for method 115 of type mantis ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 mantis ((obj mantis)) - "@abstract" +(defmethod init-enemy! mantis ((obj mantis)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (with-pp (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-mantis" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *mantis-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *mantis-nav-enemy-info*) (set! (-> obj flags) (mantis-flag)) (set! (-> obj my-up-vector quad) (-> *y-vector* quad)) (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) diff --git a/test/decompiler/reference/jak2/levels/palace/explore/palent-part_REF.gc b/test/decompiler/reference/jak2/levels/palace/explore/palent-part_REF.gc index f3447f255f..c799a84f68 100644 --- a/test/decompiler/reference/jak2/levels/palace/explore/palent-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/explore/palent-part_REF.gc @@ -387,7 +387,7 @@ ;; WARN: Return type mismatch int vs none. (defun palent-deactivate () "Sets [[palshaft.bigmap-id]] to `20`" - (set! (-> palshaft bigmap-id) (the-as uint 20)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-20)) 0 (none) ) @@ -396,7 +396,7 @@ ;; WARN: Return type mismatch int vs none. (defun palent-activate () "Sets [[palshaft.bigmap-id]] to `12`" - (set! (-> palshaft bigmap-id) (the-as uint 12)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-12)) 0 (none) ) diff --git a/test/decompiler/reference/jak2/levels/palace/roof/palroof-part_REF.gc b/test/decompiler/reference/jak2/levels/palace/roof/palroof-part_REF.gc index 8029cdf4ce..c8ae3d4427 100644 --- a/test/decompiler/reference/jak2/levels/palace/roof/palroof-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/roof/palroof-part_REF.gc @@ -477,7 +477,7 @@ ;; WARN: Return type mismatch int vs none. (defun palroof-deactivate () "Sets [[palshaft.bigmap-id]] to `11` and [[*math-camera*.f]] to `20,000` meters" - (set! (-> palshaft bigmap-id) (the-as uint 20)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-20)) (set! (-> *math-camera* f) (meters 10000)) 0 (none) @@ -487,7 +487,7 @@ ;; WARN: Return type mismatch int vs none. (defun palroof-activate () "Sets [[palshaft.bigmap-id]] to `20` and [[*math-camera*.f]] to `10,000` meters" - (set! (-> palshaft bigmap-id) (the-as uint 11)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-11)) (set! (-> *math-camera* f) (meters 20000)) 0 (none) diff --git a/test/decompiler/reference/jak2/levels/palace/shaft/palshaft-part_REF.gc b/test/decompiler/reference/jak2/levels/palace/shaft/palshaft-part_REF.gc index d2c9105e5f..3aa17fcbea 100644 --- a/test/decompiler/reference/jak2/levels/palace/shaft/palshaft-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/shaft/palshaft-part_REF.gc @@ -796,7 +796,7 @@ ;; WARN: Return type mismatch int vs none. (defun palshaft-deactivate () "Sets [[palshaft.bigmap-id]] to `20`" - (set! (-> palshaft bigmap-id) (the-as uint 20)) + (set! (-> palshaft bigmap-id) (bigmap-id bigmap-id-20)) 0 (none) ) diff --git a/test/decompiler/reference/jak2/levels/palace/throne_room/palace-scenes_REF.gc b/test/decompiler/reference/jak2/levels/palace/throne_room/palace-scenes_REF.gc new file mode 100644 index 0000000000..9338ad1388 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/palace/throne_room/palace-scenes_REF.gc @@ -0,0 +1,763 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type throne-throne +(deftype throne-throne (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type throne-throne +(defmethod inspect throne-throne ((obj throne-throne)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-throne-throne throne-throne throne-throne-lod0-jg throne-throne-idle-ja + ((throne-throne-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 20) + ) + +;; failed to figure out what this is: +(defstate idle (throne-throne) + :virtual #t + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior throne-throne) ja-post) + ) + +;; definition for method 11 of type throne-throne +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! throne-throne ((obj throne-throne) (entity entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 1) 0))) + (set! (-> cshape total-prims) (the-as uint 2)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 0.0 81920.0) + (set! (-> cshape root-prim) prim-group) + ) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 81920.0) + ) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) + ) + (set! (-> obj root) cshape) + ) + (process-drawable-from-entity! obj entity) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-throne-throne" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +;; failed to figure out what this is: +(defpartgroup group-palroof-snot + :id 1139 + :duration (seconds 0.035) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 4926 :flags (bit7)) (sp-item 4927 :flags (bit7)) (sp-item 4928 :flags (bit7))) + ) + +;; failed to figure out what this is: +(defpart 4927 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 10.0) + (sp-flt spt-z (meters -0.06)) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.05) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.1) (meters 0.05) 1.0) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-rnd-flt spt-g 128.0 64.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 8.0 8.0 1.0) + (sp-flt spt-omega 0.4096) + (sp-flt spt-vel-z (meters -0.05)) + (sp-int spt-timer 1200) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12 use-global-acc) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 4929) + (sp-rnd-flt spt-launchrot-x (degrees -60.0) (degrees 120.0) 1.0) + (sp-rnd-flt spt-launchrot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 4928 + :init-specs ((sp-flt spt-num 20.0) + (sp-flt spt-z (meters -0.06)) + (sp-int spt-rot-x 6) + (sp-flt spt-r 614.4) + (sp-flt spt-g 471.04) + (sp-flt spt-b 491.52) + (sp-flt spt-vel-z (meters -0.05)) + (sp-int spt-timer 1200) + (sp-cpuinfo-flags distort) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 4930) + (sp-rnd-flt spt-launchrot-x (degrees -30.0) (degrees 60.0) 1.0) + (sp-rnd-flt spt-launchrot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 4930 + :init-specs ((sp-flt spt-vel-x (meters 0)) (sp-flt spt-vel-y (meters 0)) (sp-flt spt-vel-z (meters 0))) + ) + +;; failed to figure out what this is: +(defpart 4926 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 64.0) + (sp-flt spt-z (meters -0.06)) + (sp-rnd-flt spt-scale-x (meters 0.01) (meters 0.03) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.01) (meters 0.03) 1.0) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-rnd-flt spt-g 128.0 64.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 8.0 8.0 1.0) + (sp-flt spt-omega 0.4096) + (sp-flt spt-vel-z (meters -0.05)) + (sp-int spt-timer 1200) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12 use-global-acc) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 4929) + (sp-rnd-flt spt-launchrot-x (degrees -60.0) (degrees 120.0) 1.0) + (sp-rnd-flt spt-launchrot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 4929 + :init-specs ((sp-flt spt-vel-x (meters 0)) + (sp-flt spt-vel-y (meters 0)) + (sp-flt spt-vel-z (meters 0)) + (sp-rnd-flt spt-scalevel-x (meters 0.0033333334) (meters 0.006666667) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 4931) + ) + ) + +;; failed to figure out what this is: +(defpart 4931 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-copy-from-other spt-scalevel-y -4)) + ) + +;; failed to figure out what this is: +(defpartgroup group-palroof-rain0 + :id 1140 + :duration (seconds 0.017) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 128) + :parts ((sp-item 4932) (sp-item 4933)) + ) + +;; failed to figure out what this is: +(defpart 4932 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-func spt-birth-func 'birth-func-rain) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters -30) (meters 45) 1.0) + (sp-flt spt-y (meters 16)) + (sp-rnd-flt spt-scale-x (meters 0.03) (meters 0.03) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.5) 1.0) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters -0.06666667) (meters -0.13333334) 1.0) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-drop-level-palace-roof-rain) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 4934 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.08) (meters 0.03) 1.0) + (sp-int spt-rot-x 4) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-rnd-flt spt-omega 1.6384 0.8192 1.0) + (sp-rnd-flt spt-vel-y (meters 0.033333335) (meters 0.06666667) 1.0) + (sp-rnd-flt spt-fade-a -1.2 -1.2 1.0) + (sp-rnd-flt spt-accel-y -20.48 -2.7306666 1.0) + (sp-flt spt-friction 0.98) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 use-global-acc) + (sp-func spt-func 'sparticle-motion-blur) + (sp-int-plain-rnd spt-next-time 0 99 1) + (sp-launcher-by-id spt-next-launcher 63) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-x (degrees 0.0)) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; definition for function check-drop-level-palace-roof-rain +;; INFO: Used lq/sq +(defun check-drop-level-palace-roof-rain ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure the rain on the palace roof doesn't go through the roof and displays the splash effect when it makes impact" + (when (< (-> arg2 vector 0 y) (+ 4096.0 (-> arg1 user-float))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'matrix)) + ) + (sp-kill-particle arg0 arg1) + (set-vector! s4-0 (-> arg2 vector 0 x) (-> arg1 user-float) (-> arg2 vector 0 z) 1.0) + (-> arg1 omega) + (set-vector! + (-> s5-0 vector 1) + (* 0.007874016 (the float (-> arg1 datab 0))) + (* 0.007874016 (the float (-> arg1 datab 1))) + (* 0.007874016 (the float (-> arg1 datab 2))) + 0.0 + ) + (set-vector! (-> s5-0 vector 2) 0.0 0.0 1.0 0.0) + (vector-cross! (the-as vector (-> s5-0 vector)) (-> s5-0 vector 1) (-> s5-0 vector 2)) + (set! (-> s5-0 trans quad) (-> s4-0 quad)) + (set! (-> *part-id-table* 4934 init-specs 22 initial-valuef) (vector-y-angle (-> s5-0 vector 1))) + (set! (-> *part-id-table* 4934 init-specs 21 initial-valuef) (- 16384.0 (vector-x-angle (-> s5-0 vector 1)))) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 4934) + s5-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! (-> *part-id-table* 64 init-specs 10 initial-valuef) (-> arg1 omega)) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 64) + s5-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defpartgroup group-palroof-rain1 + :id 1141 + :duration (seconds 0.017) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 128) + :parts ((sp-item 4935) (sp-item 4936)) + ) + +;; failed to figure out what this is: +(defpart 4935 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 0) (meters 30) 1.0) + (sp-flt spt-y (meters 32)) + (sp-rnd-flt spt-z (meters -8) (meters 12) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.03) (meters 0.03) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.5) 1.0) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters -0.06666667) (meters -0.033333335) 1.0) + (sp-int spt-timer 390) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 4936 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 4.0) + (sp-rnd-flt spt-x (meters -60) (meters 60) 1.0) + (sp-flt spt-y (meters 32)) + (sp-rnd-flt spt-z (meters -10) (meters 12) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.03) (meters 0.03) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.5) 1.0) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters -0.06666667) (meters -0.033333335) 1.0) + (sp-int spt-timer 390) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-flt spt-rotate-y (degrees 45.0)) + ) + ) + +;; failed to figure out what this is: +(defskelgroup skel-metalkor-head metalkor-head metalkor-head-lod0-jg metalkor-head-idle-ja + ((metalkor-head-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :origin-joint-index 3 + ) + +;; definition for symbol *metalkor-head-lightning-shock-skel*, type lightning-spec +(define *metalkor-head-lightning-shock-skel* (new 'static 'lightning-spec + :name #f + :flags (lightning-spec-flags lsf0) + :rand-func #x2 + :start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture (new 'static 'texture-id :index #x83 :page #xc) + :reduction 0.5 + :num-points 32 + :box-size 2048.0 + :merge-factor 0.5 + :merge-count 2 + :radius 4096.0 + :duration 30.0 + :sound #f + ) + ) + +;; failed to figure out what this is: +(scene-method-16 + (new 'static 'scene + :name "palace-outside-window-res" + :extra #f + :info #f + :mask-to-clear #x1282000 + :entity "scene-stage-54" + :art-group "scenecamera" + :anim "palace-outside-window-res" + :parts 23 + :command-list '((0 + (fadein (seconds (new 'static 'bfloat :data 0.5))) + (kill "pal-lowrez-throne-1") + (fadein (frame-time-30 10)) + (apply ,(lambda :behavior scene-player () (set-setting! 'rain 'abs 0 0) (none))) + (send-event + "metalkor-head" + 'trans-hook + ,(lambda :behavior scene-player + () + (let ((frame-num (ja-aframe-num 0))) + (if (or (and (< 416.0 frame-num) (< frame-num 440.0)) + (and (< 462.0 frame-num) (< frame-num 473.0)) + (and (< 620.0 frame-num) (< frame-num 640.0)) + (and (< 665.0 frame-num) (< frame-num 670.0)) + (and (< 860.0 frame-num) (< frame-num 880.0)) + ) + (process-drawable-shock-skel-effect + self + *metalkor-head-lightning-shock-skel* + lightning-probe-callback + (-> *part-id-table* 166) + 8192.0 + -1 + -1 + ) + ) + (cond + ((>= frame-num 950.0) + (set! (-> self draw force-fade) (the-as uint (the int (lerp-scale 0.0 128.0 frame-num 950.0 980.0)))) + (logior! (-> self draw status) (draw-control-status force-fade warp-cross-fade)) + ) + (else + (logclear! (-> self draw status) (draw-control-status force-fade warp-cross-fade)) + ) + ) + ) + (none) + ) + ) + (part-tracker + "group-palroof-rain0" + entity + "particleman" + joint + "particleB" + track + #t + duration + (frame-range (new 'static 'bfloat) (new 'static 'bfloat :data 150.0)) + ) + ) + (145 + (part-tracker + "group-palroof-rain0" + entity + "particleman" + joint + "particleB" + track + #t + duration + (frame-range (new 'static 'bfloat :data 145.0) (new 'static 'bfloat :data 280.0)) + ) + ) + (401 (want-display 'palcab #f)) + (490 + (want-display 'palcab 'display) + (part-tracker + "group-palroof-rain1" + entity + "particleman" + joint + "particleC" + track + #t + duration + (frame-range (new 'static 'bfloat :data 490.0) (new 'static 'bfloat :data 595.0)) + ) + ) + (650 (part-tracker + "group-palroof-rain0" + entity + "particleman" + joint + "particleB" + track + #t + duration + (frame-range (new 'static 'bfloat :data 650.0) (new 'static 'bfloat :data 840.0)) + ) + ) + (1100 (part-tracker + "group-palroof-rain1" + entity + "particleman" + joint + "particleC" + track + #t + duration + (frame-range (new 'static 'bfloat :data 1100.0) (new 'static 'bfloat :data 1285.0)) + ) + ) + (1450 (part-tracker + "group-palroof-rain1" + entity + "particleman" + joint + "particleC" + track + #t + duration + (frame-range (new 'static 'bfloat :data 1450.0) (new 'static 'bfloat :data 1890.0)) + ) + ) + (2055 (part-tracker + "group-palroof-rain0" + entity + "particleman" + joint + "particleB" + track + #t + duration + (frame-range (new 'static 'bfloat :data 2055.0) (new 'static 'bfloat :data 2240.0)) + ) + ) + (2235 (part-tracker + "group-palroof-rain0" + entity + "particleman" + joint + "particleB" + track + #t + duration + (frame-range (new 'static 'bfloat :data 2235.0) (new 'static 'bfloat :data 2365.0)) + ) + ) + (2360 (part-tracker + "group-palroof-rain0" + entity + "particleman" + joint + "particleB" + track + #t + duration + (frame-range (new 'static 'bfloat :data 2360.0) (new 'static 'bfloat :data 2615.0)) + ) + ) + (2604 (part-tracker "group-palroof-snot" entity "particleman" joint "particleA" track #t)) + (2660 (part-tracker + "group-palroof-rain0" + entity + "particleman" + joint + "particleB" + track + #t + duration + (frame-range (new 'static 'bfloat :data 2660.0) (new 'static 'bfloat :data 2750.0)) + ) + ) + (10000 (task-close! "palace-cable-resolution")) + ) + :cut-list '(151 281 401 501 596 716 841 1136 1286 1490 1671 1781 1891 2061 2241 2366 2616 2666) + :wait-ground-time (seconds 1) + :draw-target #f + :abort #t + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "particleman" + :level 'throne + :art-group "skel-particleman" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'throne + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jak-highres" + :level 'throne + :art-group "skel-jak-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "baron-highres" + :level 'lbrnermk + :art-group "skel-baron-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '((1286 1489)) + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "errol-highres" + :level 'lbrnermk + :art-group "skel-errol-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "metalkor-head" + :level 'lbrnermk + :art-group "skel-metalkor-head" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point-obj "palroof-throne" + :end-point-obj "palroof-throne" + :borrow '((throne 0 lbrnermk special)) + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :blackout-end #t + :peaceful #t + :music-delay 1500.0 + :save #t + ) + ) + +;; failed to figure out what this is: +(scene-method-16 + (new 'static 'scene + :name "palace-sneak-in-res" + :extra #f + :info #f + :mask-to-clear #x1282000 + :entity "scene-stage-54" + :art-group "scenecamera" + :anim "palace-sneak-in-res" + :parts 21 + :command-list '((0 (fadein (seconds 1)) (apply ,(lambda :behavior scene-player () (set-setting! 'rain 'abs 0 0) (none)))) + (10000 + (unless (task-closed? "palace-sneak-in-meeting") (talker-spawn "miss010")) + (task-close! "palace-sneak-in-meeting") + ) + ) + :cut-list '(65 105 251 296 419 483 589 645 735 891 1029 1499 1660 1708 1851 2047 2151 2261 2421) + :wait-ground-time (seconds 1) + :draw-target #f + :abort #t + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'throne + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jak-highres" + :level 'throne + :art-group "skel-jak-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "ashelin-highres" + :level 'lashthrn + :art-group "skel-ashelin-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "palmpilot" + :level 'lashthrn + :art-group "skel-palmpilot" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point-obj "throne-ashelin" + :end-point-obj (new 'static 'continue-point + :name "throne-ashelin" + :level #f + :trans (new 'static 'vector :x 657938.44 :y 1414076.9 :z 2301379.5 :w 1.0) + :quat (new 'static 'vector :y 0.9228 :w 0.3851) + :camera-trans (new 'static 'vector :x 632095.94 :y 1433352.2 :z 2337665.8 :w 1.0) + :camera-rot (new 'static 'inline-array vector3s 3 + (new 'static 'vector3s :data (new 'static 'array float 3 -0.81 0.0 -0.5863)) + (new 'static 'vector3s :data (new 'static 'array float 3 0.0757 0.9916 -0.1046)) + (new 'static 'vector3s :data (new 'static 'array float 3 0.5814 -0.1291 -0.8032)) + ) + :on-goto #f + :vis-nick 'throne + :want (new 'static 'inline-array level-buffer-state 6 + (new 'static 'level-buffer-state :name 'palent :display? 'display :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name 'throne :display? 'display :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name 'palout :display? 'display :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name #f :display? #f :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name #f :display? #f :force-vis? #f :force-inside? #f) + (new 'static 'level-buffer-state :name #f :display? #f :force-vis? #f :force-inside? #f) + ) + :want-sound (new 'static 'array symbol 3 'palent1 'palent2 'palent3) + ) + :borrow '((throne 0 lashthrn special)) + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :blackout-end #t + :peaceful #t + :music-delay 1500.0 + :save #t + ) + ) + + + + 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 8f2dcc7edf..7c57fb9065 100644 --- a/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc @@ -118,7 +118,72 @@ :default-hit-points 4 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-knocked #xffffffffffffffff + :penetrate-knocked (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + explode + jak-yellow-shot + jak-red-shot + jak-blue-shot + jak-dark-shot + enemy-yellow-shot + enemy-dark-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.6 :attack-shove-back (meters 6) @@ -195,7 +260,9 @@ (set! (-> *rapid-gunner-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type rapid-gunner -(defmethod enemy-method-74 rapid-gunner ((obj rapid-gunner) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler rapid-gunner ((obj rapid-gunner) (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 'hit-flinch) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -219,7 +286,7 @@ ) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -424,8 +491,13 @@ ) ;; definition for method 98 of type rapid-gunner -(defmethod enemy-method-98 rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 vector)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-98))) +(defmethod in-aggro-range? rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" + (let ((t9-0 (method-of-type nav-enemy in-aggro-range?))) (and (t9-0 obj arg0 arg1) (or (not (logtest? (-> obj fact-info-override enemy-options) (enemy-option user8))) (and (not (logtest? (-> arg0 focus-status) (focus-status in-air))) @@ -533,8 +605,12 @@ ;; definition for method 55 of type rapid-gunner ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-55 rapid-gunner ((obj rapid-gunner)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) +(defmethod track-target! rapid-gunner ((obj 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!))) (t9-0 obj) ) (los-control-method-9 (-> obj los) (the-as process-focusable #f) (the-as vector #f) 2048.0) @@ -574,7 +650,7 @@ :virtual #t :enter (behavior () (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) - (enemy-method-109 self 1) + (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)) (let ((gp-0 (-> self on-notice))) @@ -641,7 +717,7 @@ (ja :num! (seek! max f30-0)) ) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (behavior () @@ -1381,7 +1457,7 @@ ;; definition for method 63 of type rapid-gunner ;; WARN: Return type mismatch none vs symbol. -(defmethod enemy-method-63 rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 symbol)) +(defmethod enemy-method-63 rapid-gunner ((obj rapid-gunner) (arg0 process-focusable) (arg1 enemy-aware)) (let ((t9-0 (method-of-type nav-enemy enemy-method-63))) (the-as symbol (if (t9-0 obj arg0 arg1) (set-dst-proc! (-> obj los) (-> obj focus handle)) @@ -1392,8 +1468,8 @@ ;; definition for method 114 of type rapid-gunner ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 rapid-gunner ((obj rapid-gunner)) - "@abstract" +(defmethod init-enemy-collision! rapid-gunner ((obj rapid-gunner)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1486,8 +1562,8 @@ ;; definition for method 115 of type rapid-gunner ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 rapid-gunner ((obj rapid-gunner)) - "@abstract" +(defmethod init-enemy! rapid-gunner ((obj rapid-gunner)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (local-vars (sv-48 int)) (rlet ((acc :class vf) (vf0 :class vf) @@ -1502,7 +1578,7 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-rapid-gunner" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *rapid-gunner-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *rapid-gunner-nav-enemy-info*) (set! (-> obj neck up) (the-as uint 1)) (set! (-> obj neck nose) (the-as uint 2)) (set! (-> obj neck ear) (the-as uint 0)) diff --git a/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc b/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc index 4ad49d2e6a..a1b4c0bade 100644 --- a/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/gator_REF.gc @@ -9,8 +9,9 @@ ;; definition of type gator (deftype gator (nav-enemy) + "Cannot take damage due to it overriding [[enemy::56]]" ((ocean-y float :offset-assert 604) - (lock-nav-target basic :offset-assert 608) + (lock-nav-target symbol :offset-assert 608) (new-facing vector :inline :offset-assert 624) (old-facing vector :inline :offset-assert 640) (turn-time time-frame :offset-assert 656) @@ -21,9 +22,9 @@ :flag-assert #xb602200298 (:methods (attack-forward () _type_ :state 178) - (gator-method-179 (_type_) float 179) - (gator-method-180 (_type_ vector) vector 180) - (gator-method-181 (_type_ float float symbol) time-frame 181) + (adjust-depth! (_type_) float 179) + (update-facing! (_type_ vector) vector 180) + (encircle-target! (_type_ float float symbol) time-frame 181) ) ) @@ -159,41 +160,48 @@ (set! (-> *gator-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for method 74 of type gator -(defmethod enemy-method-74 gator ((obj gator) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) - (case arg2 +(defmethod general-event-handler gator ((obj gator) (proc process) (arg2 int) (event-type symbol) (event event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" + (case event-type (('hit-knocked) (when (= (-> obj incoming knocked-type) (knocked-type knocked-type-4)) (set! (-> obj incoming knocked-type) (knocked-type knocked-type-0)) 0 ) - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj proc arg2 event-type event) ) (('track) #f ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj proc arg2 event-type event) ) ) ) ;; definition for method 179 of type gator -(defmethod gator-method-179 gator ((obj gator)) +(defmethod adjust-depth! gator ((obj gator)) + "Changes the height based on the ocean depth +@see [[get-height]]" (set! (-> obj ocean-y) (get-height *ocean* (-> obj root-override2 trans) #t)) (set! (-> obj root-override2 trans y) (+ -10240.0 (-> obj ocean-y))) ) ;; definition for method 180 of type gator ;; INFO: Used lq/sq -(defmethod gator-method-180 gator ((obj gator) (arg0 vector)) - (let ((a0-3 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)))) - (set! (-> arg0 quad) (-> a0-3 vector 2 quad)) +(defmethod update-facing! gator ((obj gator) (arg0 vector)) + "Updates the `new-facing` vector" + (let ((matrix (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root-override2 quat)))) + (set! (-> arg0 quad) (-> matrix vector 2 quad)) ) arg0 ) ;; definition for method 181 of type gator -(defmethod gator-method-181 gator ((obj gator) (arg0 float) (arg1 float) (arg2 symbol)) +(defmethod encircle-target! gator ((obj gator) (arg0 float) (arg1 float) (arg2 symbol)) + "Core movement for the [[gator]], circles the target, charges at the target, etc +@params TODO - not sure, they all dont seem to do very much and this method is a mess" (local-vars (v1-17 object) (a0-5 object)) (with-pp (let ((f30-0 (vector-dot (-> obj new-facing) (-> obj old-facing))) @@ -292,18 +300,23 @@ ;; definition for method 55 of type gator ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. -(defmethod enemy-method-55 gator ((obj gator)) - (let ((t9-0 (method-of-type nav-enemy enemy-method-55))) - (t9-0 obj) +(defmethod track-target! gator ((obj 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!))) + (func obj) ) - (gator-method-179 obj) + (adjust-depth! obj) (set! (-> obj old-facing quad) (-> obj new-facing quad)) - (gator-method-180 obj (-> obj new-facing)) + (update-facing! obj (-> obj new-facing)) (none) ) ;; definition for method 56 of type gator -(defmethod enemy-method-56 gator ((obj gator) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack gator ((obj gator) (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]]" 0 ) @@ -315,47 +328,57 @@ ) ;; definition for method 107 of type gator -(defmethod enemy-method-107 gator ((obj gator)) - (let ((gp-0 ((method-of-type nav-enemy enemy-method-107) obj))) - (if (and gp-0 (< (+ 1024.0 (get-height *ocean* (get-trans gp-0 0) #t)) (-> (get-trans gp-0 1) y))) - (set! gp-0 (the-as process-focusable #f)) +(defmethod get-enemy-target gator ((obj gator)) + "@returns the [[process-focusable]] that the enemy is currently focusing on, or [[#f]] otherwise" + (let ((enemy-target ((method-of-type nav-enemy get-enemy-target) obj))) + (if (and enemy-target + (< (+ 1024.0 (get-height *ocean* (get-trans enemy-target 0) #t)) (-> (get-trans enemy-target 1) y)) + ) + (set! enemy-target (the-as process-focusable #f)) ) - gp-0 + enemy-target ) ) ;; definition for method 98 of type gator ;; INFO: Used lq/sq -(defmethod enemy-method-98 gator ((obj gator) (arg0 process-focusable) (arg1 vector)) - (let ((s4-0 (new 'stack-no-clear 'vector))) +(defmethod in-aggro-range? gator ((obj gator) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" + (let ((target-pos (new 'stack-no-clear 'vector))) (when (and (= *target* arg0) (not arg1) (= (-> *target* control ground-pat material) (pat-material waterbottom))) - (set! (-> s4-0 quad) (-> (get-trans arg0 0) quad)) - (set! (-> s4-0 y) (get-height *ocean* s4-0 #t)) - (set! arg1 s4-0) + (set! (-> target-pos quad) (-> (get-trans arg0 0) quad)) + (set! (-> target-pos y) (get-height *ocean* target-pos #t)) + (set! arg1 target-pos) ) ) - ((method-of-type nav-enemy enemy-method-98) obj arg0 arg1) + ((method-of-type nav-enemy in-aggro-range?) obj arg0 arg1) ) ;; failed to figure out what this is: (defstate hostile (gator) :virtual #t :trans (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy hostile) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy hostile) trans))) + (if func + (func) ) ) - (let ((a0-1 (enemy-method-107 self))) - (when a0-1 - (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (get-trans a0-1 0) (-> self root-override2 trans))) - (a0-4 (-> self nav state)) + (let ((enemy-target (get-enemy-target self))) + (when enemy-target + (let ((dir-to-target + (vector-! (new 'stack-no-clear 'vector) (get-trans enemy-target 0) (-> self root-override2 trans)) + ) + (nav-state (-> self nav state)) (s5-0 (new 'stack-no-clear 'vector)) ) - (set! (-> s5-0 quad) (-> a0-4 heading quad)) + (set! (-> s5-0 quad) (-> nav-state heading quad)) 0 - (let ((v1-10 (vector-normalize-ret-len! gp-1 1.0))) - (if (and (>= #x47000000 (the-as int v1-10)) (< (cos 5461.3335) (vector-dot gp-1 s5-0))) + (let ((v1-10 (vector-normalize-ret-len! dir-to-target 1.0))) + (if (and (>= #x47000000 (the-as int v1-10)) (< (cos 5461.3335) (vector-dot dir-to-target s5-0))) (go-virtual attack-forward) ) ) @@ -365,11 +388,11 @@ (none) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((circle-for (get-rand-float-range self 0.9 1.1))) (until #f - (gator-method-181 self 2.0 0.5 #t) + (encircle-target! self 2.0 0.5 #t) (suspend) - (ja :num! (loop! f30-0)) + (ja :num! (loop! circle-for)) ) ) #f @@ -383,29 +406,29 @@ :event (the-as (function process int symbol event-message-block object :behavior gator) enemy-event-handler) :enter (behavior () (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) - (let ((v1-2 self)) - (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) - (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + (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)))) ) - (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) - (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + (set! (-> _self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> _self enemy-flags)))) + (set! (-> _self nav callback-info) (-> _self enemy-info-override callback-info)) ) 0 - (let ((v1-5 self)) - (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + (let ((__self self)) + (set! (-> __self enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> __self enemy-flags)))) ) 0 - (let ((v1-8 (-> self nav state))) - (set! (-> v1-8 speed) (* 1.25 (-> self enemy-info-override run-travel-speed))) + (let ((nav-state (-> self nav state))) + (set! (-> nav-state speed) (* 1.25 (-> self enemy-info-override run-travel-speed))) ) 0 (set! (-> self lock-nav-target) #f) (logior! (-> self focus-status) (focus-status dangerous)) - (let* ((v1-12 *game-info*) - (v0-0 (+ (-> v1-12 attack-id) 1)) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-12 attack-id) v0-0) - (set! (-> self attack-id) v0-0) + (set! (-> game-info attack-id) id) + (set! (-> self attack-id) id) ) (none) ) @@ -418,11 +441,11 @@ (none) ) :trans (behavior () - (let ((gp-0 (handle->process (-> self focus handle)))) - (if (not gp-0) - (enemy-method-72 self) + (let ((focus (handle->process (-> self focus handle)))) + (if (not focus) + (react-to-focus self) ) - (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) + (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable focus) 0) quad)) ) (cond ((-> self lock-nav-target) @@ -430,36 +453,36 @@ ((or (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (logtest? (-> self nav state flags) (nav-state-flag at-target)) ) - (set! (-> self lock-nav-target) (the-as basic #t)) - (let ((v1-16 (-> self nav))) - (set! (-> v1-16 target-speed) (-> self enemy-info-override walk-travel-speed)) + (set! (-> self lock-nav-target) #t) + (let ((nav (-> self nav))) + (set! (-> nav target-speed) (-> self enemy-info-override walk-travel-speed)) ) 0 - (let ((v1-18 (-> self nav))) - (set! (-> v1-18 acceleration) 131072.0) + (let ((_nav (-> self nav))) + (set! (-> _nav acceleration) 131072.0) ) 0 - (let ((gp-1 (new 'stack-no-clear 'vector))) - (let ((a1-2 (-> self nav state))) - (set! (-> gp-1 quad) (-> a1-2 velocity quad)) + (let ((velocity (new 'stack-no-clear 'vector))) + (let ((nav-state (-> self nav state))) + (set! (-> velocity quad) (-> nav-state velocity quad)) ) - (vector-normalize! gp-1 32768.0) - (vector+! gp-1 gp-1 (-> self root-override2 trans)) - (let ((v1-24 (-> self nav state))) - (logclear! (-> v1-24 flags) (nav-state-flag directional-mode)) - (logior! (-> v1-24 flags) (nav-state-flag target-poly-dirty)) - (set! (-> v1-24 target-post quad) (-> gp-1 quad)) + (vector-normalize! velocity 32768.0) + (vector+! velocity velocity (-> self root-override2 trans)) + (let ((_nav-state (-> self nav state))) + (logclear! (-> _nav-state flags) (nav-state-flag directional-mode)) + (logior! (-> _nav-state flags) (nav-state-flag target-poly-dirty)) + (set! (-> _nav-state target-post quad) (-> velocity quad)) ) ) 0 ) (else - (let ((a0-19 (-> self nav state)) - (v1-27 (-> self focus-pos)) + (let ((__nav-state (-> self nav state)) + (target-pos (-> self focus-pos)) ) - (logclear! (-> a0-19 flags) (nav-state-flag directional-mode)) - (logior! (-> a0-19 flags) (nav-state-flag target-poly-dirty)) - (set! (-> a0-19 target-post quad) (-> v1-27 quad)) + (logclear! (-> __nav-state flags) (nav-state-flag directional-mode)) + (logior! (-> __nav-state flags) (nav-state-flag target-poly-dirty)) + (set! (-> __nav-state target-post quad) (-> target-pos quad)) ) 0 ) @@ -477,18 +500,18 @@ :frame-num 0.0 ) (until (ja-done? 0) - (let ((a1-4 (new 'stack-no-clear 'vector))) - (let ((a2-2 (-> self nav state))) - (set! (-> a1-4 quad) (-> a2-2 target-post quad)) + (let ((target-pos (new 'stack-no-clear 'vector))) + (let ((nav-state (-> self nav state))) + (set! (-> target-pos quad) (-> nav-state target-post quad)) ) - (if (and (-> self lock-nav-target) (< (vector-vector-distance (-> self root-override2 trans) a1-4) 8192.0)) - (enemy-method-72 self) + (if (and (-> self lock-nav-target) (< (vector-vector-distance (-> self root-override2 trans) target-pos) 8192.0)) + (react-to-focus self) ) ) (suspend) (ja :num! (seek!)) ) - (enemy-method-72 self) + (react-to-focus self) (none) ) :post (the-as (function none :behavior gator) nav-enemy-travel-post) @@ -498,11 +521,11 @@ (defstate pacing (gator) :virtual #t :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (get-rand-float-range self 0.9 1.1))) (until #f - (gator-method-181 self 2.0 0.5 #f) + (encircle-target! self 2.0 0.5 #f) (suspend) - (ja :num! (loop! f30-0)) + (ja :num! (loop! circle-for?)) ) ) #f @@ -518,9 +541,9 @@ (none) ) :trans (behavior () - (let ((t9-0 (-> (method-of-type nav-enemy stare) trans))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type nav-enemy stare) trans))) + (if func + (func) ) ) (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.017)) @@ -529,11 +552,11 @@ (none) ) :code (behavior () - (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (let ((circle-for? (get-rand-float-range self 0.9 1.1))) (until #f - (gator-method-181 self 2.0 0.5 #f) + (encircle-target! self 2.0 0.5 #f) (suspend) - (ja :num! (loop! f30-0)) + (ja :num! (loop! circle-for?)) ) ) #f @@ -549,74 +572,74 @@ ;; definition for method 114 of type gator ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 gator ((obj gator)) - "@abstract" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) +(defmethod init-enemy-collision! gator ((obj gator)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 4) 0))) - (set! (-> s5-0 total-prims) (the-as uint 5)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 4) 0))) + (set! (-> cshape total-prims) (the-as uint 5)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec backgnd jak bot crate obstacle hit-by-others-list player-list) ) - (set! (-> s4-0 prim-core action) (collide-action deadly no-standon)) - (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 19660.8) - (set! (-> s5-0 root-prim) s4-0) + (set! (-> prim-group prim-core action) (collide-action deadly no-standon)) + (set-vector! (-> prim-group local-sphere) 0.0 8192.0 0.0 19660.8) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-13 prim-core collide-with) (collide-spec jak bot crate hit-by-others-list player-list)) - (set! (-> v1-13 prim-core action) (collide-action no-standon)) - (set-vector! (-> v1-13 local-sphere) 0.0 4915.2 0.0 4915.2) + (let ((prim-sphere-1 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-1 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-1 prim-core collide-with) (collide-spec jak bot crate hit-by-others-list player-list)) + (set! (-> prim-sphere-1 prim-core action) (collide-action no-standon)) + (set-vector! (-> prim-sphere-1 local-sphere) 0.0 4915.2 0.0 4915.2) ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-15 prim-core action) (collide-action deadly)) - (set! (-> v1-15 transform-index) 12) - (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.0) + (let ((prim-sphere-2 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-2 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-2 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-2 prim-core action) (collide-action deadly)) + (set! (-> prim-sphere-2 transform-index) 12) + (set-vector! (-> prim-sphere-2 local-sphere) 0.0 0.0 0.0 4096.0) ) - (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-17 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-17 transform-index) 20) - (set-vector! (-> v1-17 local-sphere) 0.0 0.0 0.0 4096.0) + (let ((prim-sphere-3 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-3 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-3 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-3 transform-index) 20) + (set-vector! (-> prim-sphere-3 local-sphere) 0.0 0.0 0.0 4096.0) ) - (let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-19 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-19 transform-index) 22) - (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 4505.6) + (let ((prim-sphere-4 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-4 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-4 transform-index) 22) + (set-vector! (-> prim-sphere-4 local-sphere) 0.0 0.0 0.0 4505.6) ) - (set! (-> s5-0 nav-radius) 8192.0) - (let ((v1-21 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-21 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-21 prim-core collide-with)) + (set! (-> cshape nav-radius) 8192.0) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> s5-0 max-iteration-count) (the-as uint 3)) - (set! (-> obj root-override2) s5-0) + (set! (-> cshape max-iteration-count) (the-as uint 3)) + (set! (-> obj root-override2) cshape) ) 0 (none) @@ -624,21 +647,21 @@ ;; definition for method 115 of type gator ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 gator ((obj gator)) - "@abstract" +(defmethod init-enemy! gator ((obj gator)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-gator" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (enemy-method-113 obj *gator-nav-enemy-info*) - (let ((v1-5 (-> obj nav))) - (set! (-> v1-5 speed-scale) 1.0) + (init-enemy-behaviour-and-stats! obj *gator-nav-enemy-info*) + (let ((nav (-> obj nav))) + (set! (-> nav speed-scale) 1.0) ) 0 (set-gravity-length (-> obj root-override2 dynam) 573440.0) (logior! (-> obj nav flags) (nav-control-flag momentum-ignore-heading)) - (gator-method-179 obj) + (adjust-depth! obj) (set! (-> obj turn-time) 0) 0 (none) diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc index 1e594d9b39..8ec11408dc 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc @@ -10,7 +10,7 @@ :size-assert #x174 :flag-assert #x3201000174 (:methods - (sew-elevator-method-49 (_type_ symbol) none 49) + (configure-collision (_type_ symbol) none 49) ) ) @@ -41,18 +41,18 @@ ) ;; definition for method 43 of type sew-elevator -(defmethod move-between-points sew-elevator ((obj sew-elevator) (arg0 vector) (arg1 float) (arg2 float)) +(defmethod move-between-points sew-elevator ((obj sew-elevator) (arg1 vector) (point-a float) (point-b float)) "Move between two points on the elevator's path @param vec TODO not sure @param point-a The first point fetched from the elevator's path @param point-b The second point fetched from the path @see [[path-control]] and [[elevator]]" - (let ((s4-0 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg1 'interp)) - (a0-3 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg2 'interp)) - (v1-3 (-> obj root-override trans)) + (let ((path-point-a (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) point-a 'interp)) + (path-point-b (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) point-b 'interp)) + (elevator-pos (-> obj root-override trans)) ) - (when (and (< (-> a0-3 y) (-> s4-0 y)) (< (-> arg0 y) (+ -8192.0 (-> v1-3 y)))) - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) arg0 v1-3))) + (when (and (< (-> path-point-b y) (-> path-point-a y)) (< (-> arg1 y) (+ -8192.0 (-> elevator-pos y)))) + (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) arg1 elevator-pos))) (vector-inv-orient-by-quat! s4-2 s4-2 (-> obj root-override quat)) (and (< (fabs (-> s4-2 x)) 24576.0) (< 0.0 (-> s4-2 z)) (< (-> s4-2 z) 49152.0)) ) @@ -63,18 +63,21 @@ ;; definition for method 45 of type sew-elevator (defmethod commited-to-ride? sew-elevator ((obj sew-elevator)) "@returns if the target is considered within the elevator area enough to begin descending/ascending" - (let* ((gp-0 *target*) - (a0-2 (if (type? gp-0 process-focusable) - gp-0 - ) - ) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when a0-2 - (let* ((v1-1 (get-trans a0-2 0)) - (gp-2 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj root-override trans))) + (when target-proc + (let* ((target-pos (get-trans target-proc 0)) + (dist-from-center (vector-! (new 'stack-no-clear 'vector) target-pos (-> obj root-override trans))) + ) + (vector-inv-orient-by-quat! dist-from-center dist-from-center (-> obj root-override quat)) + (and (< (fabs (-> dist-from-center x)) 20480.0) + (< 0.0 (-> dist-from-center z)) + (< (-> dist-from-center z) 40960.0) ) - (vector-inv-orient-by-quat! gp-2 gp-2 (-> obj root-override quat)) - (and (< (fabs (-> gp-2 x)) 20480.0) (< 0.0 (-> gp-2 z)) (< (-> gp-2 z) 40960.0)) ) ) ) @@ -82,16 +85,18 @@ ;; definition for method 49 of type sew-elevator ;; WARN: Return type mismatch int vs none. -(defmethod sew-elevator-method-49 sew-elevator ((obj sew-elevator) (arg0 symbol)) - (let ((v1-3 (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) child 1))) +(defmethod configure-collision sew-elevator ((obj sew-elevator) (collide-with-jak? symbol)) + "Appropriately sets the collision on the elevator +@param collide-with-jak? If set, the elevator will collide with Jak" + (let ((prim-group (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) child 1))) (cond - (arg0 - (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> v1-3 prim-core collide-with) (collide-spec jak player-list)) + (collide-with-jak? + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) ) (else - (set! (-> v1-3 prim-core collide-as) (collide-spec)) - (set! (-> v1-3 prim-core collide-with) (collide-spec)) + (set! (-> prim-group prim-core collide-as) (collide-spec)) + (set! (-> prim-group prim-core collide-with) (collide-spec)) 0 ) ) @@ -103,23 +108,23 @@ (defstate running (sew-elevator) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type elevator running) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type elevator running) enter))) + (if func + (func) ) ) (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) - (logtest? (elevator-flags elevator-flags-16) (-> self params flags)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) ) - (sew-elevator-method-49 self #t) + (configure-collision self #t) (set-setting! 'jump #f 0 0) ) (none) ) :post (behavior () - (let ((t9-0 (-> (method-of-type elevator running) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type elevator running) post))) + (if func + ((the-as (function none) func)) ) ) (sound-play "sew-elevator-lp" :id (-> self sound-id) :position (-> self root-override trans)) @@ -131,17 +136,17 @@ (defstate arrived (sew-elevator) :virtual #t :enter (behavior () - (let ((t9-0 (-> (method-of-type elevator arrived) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type elevator arrived) enter))) + (if func + (func) ) ) (sound-stop (-> self sound-id)) (sound-play "sew-elev-stop") (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) - (logtest? (elevator-flags elevator-flags-16) (-> self params flags)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) ) - (sew-elevator-method-49 self #f) + (configure-collision self #f) (remove-setting! 'jump) ) (none) @@ -174,8 +179,8 @@ For example for an elevator pre-compute the distance between the first and last - `elevator-start-pos` - `elevator-move-rate` - `elevator-flags`" - (let ((t9-0 (method-of-type elevator init-defaults!))) - (t9-0 obj) + (let ((func (method-of-type elevator init-defaults!))) + (func obj) ) (if (name= (-> obj name) "sew-elevator-15") (set! (-> obj params xz-threshold) 348160.0) @@ -196,42 +201,42 @@ For example for an elevator pre-compute the distance between the first and last ;; definition for method 31 of type sew-elevator (defmethod init-plat-collision! sew-elevator ((obj sew-elevator)) "TODO - collision stuff for setting up the platform" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) - (set! (-> s5-0 total-prims) (the-as uint 3)) - (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid rideable)) - (set! (-> s4-0 transform-index) 3) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 22937.6 37683.2) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 2) 0))) + (set! (-> cshape total-prims) (the-as uint 3)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-group prim-core action) (collide-action solid rideable)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 22937.6 37683.2) + (set! (-> cshape root-prim) prim-group) ) - (pusher-init s5-0) - (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) - (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-15 prim-core action) (collide-action solid rideable)) - (set! (-> v1-15 transform-index) 3) - (set-vector! (-> v1-15 local-sphere) 0.0 0.0 22937.6 37683.2) + (pusher-init cshape) + (let ((prim-mesh-1 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh-1 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> prim-mesh-1 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh-1 prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh-1 transform-index) 3) + (set-vector! (-> prim-mesh-1 local-sphere) 0.0 0.0 22937.6 37683.2) ) - (let ((v1-17 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-17 prim-core action) (collide-action solid)) - (set! (-> v1-17 transform-index) 3) - (set-vector! (-> v1-17 local-sphere) 0.0 0.0 22937.6 39321.6) + (let ((prim-mesh-2 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> prim-mesh-2 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-2 transform-index) 3) + (set-vector! (-> prim-mesh-2 local-sphere) 0.0 0.0 22937.6 39321.6) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-20 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-20 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-20 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s5-0) + (set! (-> obj root-override) cshape) ) - (sew-elevator-method-49 obj #f) + (configure-collision obj #f) (none) ) @@ -309,20 +314,20 @@ For example for an elevator pre-compute the distance between the first and last (set! (-> self spin-rate) 196608.0) (logclear! (-> self mask) (process-mask actor-pause)) (sound-play "sew-valve") - (dotimes (v1-5 (-> self actor-group-count)) - (dotimes (a0-4 (-> self actor-group v1-5 length)) - (let ((a1-5 (-> self actor-group v1-5 data a0-4 actor))) - (if a1-5 - (logior! (-> a1-5 extra perm status) (entity-perm-status bit-10)) + (dotimes (group-idx (-> self actor-group-count)) + (dotimes (actor-idx (-> self actor-group group-idx length)) + (let ((actor (-> self actor-group group-idx data actor-idx actor))) + (if actor + (logior! (-> actor extra perm status) (entity-perm-status bit-10)) ) ) ) ) - (let ((gp-1 (res-lump-struct (-> self entity) 'on-activate structure))) - (if gp-1 + (let ((data (res-lump-struct (-> self entity) 'on-activate structure))) + (if data (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) - (the-as pair gp-1) + (the-as pair data) ) ) ) @@ -383,37 +388,37 @@ For example for an elevator pre-compute the distance between the first and last ;; definition for method 11 of type sew-valve ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-valve ((obj sew-valve) (arg0 entity-actor)) +(defmethod init-from-entity! sew-valve ((obj sew-valve) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (local-vars (tag-1 res-tag) (tag-2 res-tag)) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) - (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-6 prim-core action) (collide-action solid)) - (set! (-> v1-6 transform-index) 3) - (set-vector! (-> v1-6 local-sphere) 0.0 0.0 1638.4 3276.8) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-6) + (let ((prim-sphere (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-sphere prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-sphere prim-core action) (collide-action solid)) + (set! (-> prim-sphere transform-index) 3) + (set-vector! (-> prim-sphere local-sphere) 0.0 0.0 1638.4 3276.8) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-sphere) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-9 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-9 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-valve" (the-as (pointer uint32) #f))) @@ -422,15 +427,15 @@ This commonly includes things such as: (set! (-> obj spin) 0.0) (set! (-> obj spin-rate) 0.0) (set! (-> obj joint) (new 'process 'joint-mod-rotate-local obj 4 #f)) - (set! sv-16 (new 'static 'res-tag)) + (set! tag-1 (new 'static 'res-tag)) (set! (-> obj actor-group) - (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)) + (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& tag-1)) ) - (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data (-> obj entity) 'extra-float-param pointer :tag-ptr (& sv-32)))) - (if (and v1-22 (nonzero? (-> sv-32 elt-count))) - (set! (-> obj water-height) (-> (the-as (pointer float) v1-22))) + (set! (-> obj actor-group-count) (the-as int (-> tag-1 elt-count))) + (set! tag-2 (new 'static 'res-tag)) + (let ((data (res-lump-data (-> obj entity) 'extra-float-param pointer :tag-ptr (& tag-2)))) + (if (and data (nonzero? (-> tag-2 elt-count))) + (set! (-> obj water-height) (-> (the-as (pointer float) data))) (set! (-> obj water-height) 0.0) ) ) @@ -549,48 +554,49 @@ This commonly includes things such as: ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior sew-mar-statue-debris-init-by-other sew-mar-statue-debris () - (let ((gp-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) - (let ((s5-0 (new 'process 'collide-shape-prim-group gp-0 (the-as uint 3) 0))) - (set! (-> gp-0 total-prims) (the-as uint 4)) - (set! (-> s5-0 prim-core collide-as) (collide-spec obstacle)) - (set! (-> s5-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s5-0 prim-core action) (collide-action solid)) - (set! (-> s5-0 transform-index) 3) - (set-vector! (-> s5-0 local-sphere) 10240.0 0.0 62464.0 151552.0) - (set! (-> gp-0 root-prim) s5-0) + "Initializes a [[sew-mar-statue--debris]]" + (let ((cshape (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 10240.0 0.0 62464.0 151552.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-9 (new 'process 'collide-shape-prim-mesh gp-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-9 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-9 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-9 prim-core action) (collide-action solid)) - (set! (-> v1-9 transform-index) 3) - (set-vector! (-> v1-9 local-sphere) 0.0 0.0 20480.0 81920.0) + (let ((prim-mesh-1 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh-1 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-1 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-1 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-1 transform-index) 3) + (set-vector! (-> prim-mesh-1 local-sphere) 0.0 0.0 20480.0 81920.0) ) - (let ((v1-11 (new 'process 'collide-shape-prim-mesh gp-0 (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-11 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-11 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-11 prim-core action) (collide-action solid)) - (set! (-> v1-11 transform-index) 3) - (set-vector! (-> v1-11 local-sphere) -49152.0 0.0 114688.0 61440.0) + (let ((prim-mesh-2 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> prim-mesh-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-2 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-2 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-2 transform-index) 3) + (set-vector! (-> prim-mesh-2 local-sphere) -49152.0 0.0 114688.0 61440.0) ) - (let ((v1-13 (new 'process 'collide-shape-prim-mesh gp-0 (the-as uint 2) (the-as uint 0)))) - (set! (-> v1-13 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-13 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-13 prim-core action) (collide-action solid)) - (set! (-> v1-13 transform-index) 3) - (set-vector! (-> v1-13 local-sphere) 69632.0 0.0 102400.0 73728.0) + (let ((prim-mesh-3 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) + (set! (-> prim-mesh-3 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-3 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-3 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-3 transform-index) 3) + (set-vector! (-> prim-mesh-3 local-sphere) 69632.0 0.0 102400.0 73728.0) ) - (set! (-> gp-0 nav-radius) (* 0.75 (-> gp-0 root-prim local-sphere w))) - (let ((v1-16 (-> gp-0 root-prim))) - (set! (-> gp-0 backup-collide-as) (-> v1-16 prim-core collide-as)) - (set! (-> gp-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> self root) gp-0) + (set! (-> self root) cshape) ) - (let ((gp-1 (ppointer->process (-> self parent)))) - (set! (-> self root trans quad) (-> (the-as process-drawable gp-1) root trans quad)) - (quaternion-copy! (-> self root quat) (-> (the-as process-drawable gp-1) root quat)) - (set! (-> self root scale quad) (-> (the-as process-drawable gp-1) root scale quad)) + (let ((parent-proc (ppointer->process (-> self parent)))) + (set! (-> self root trans quad) (-> (the-as process-drawable parent-proc) root trans quad)) + (quaternion-copy! (-> self root quat) (-> (the-as process-drawable parent-proc) root quat)) + (set! (-> self root scale quad) (-> (the-as process-drawable parent-proc) root scale quad)) ) (initialize-skeleton self @@ -616,11 +622,12 @@ This commonly includes things such as: ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior sew-mar-statue-debris-b-init-by-other sew-mar-statue-debris-b () + "Initializes a [[sew-mar-statue--debris-b]]" (set! (-> self root) (new 'process 'trsqv)) - (let ((gp-0 (ppointer->process (-> self parent)))) - (set! (-> self root trans quad) (-> (the-as process-drawable gp-0) root trans quad)) - (quaternion-copy! (-> self root quat) (-> (the-as process-drawable gp-0) root quat)) - (set! (-> self root scale quad) (-> (the-as process-drawable gp-0) root scale quad)) + (let ((parent-proc (ppointer->process (-> self parent)))) + (set! (-> self root trans quad) (-> (the-as process-drawable parent-proc) root trans quad)) + (quaternion-copy! (-> self root quat) (-> (the-as process-drawable parent-proc) root quat)) + (set! (-> self root scale quad) (-> (the-as process-drawable parent-proc) root scale quad)) ) (initialize-skeleton self @@ -638,6 +645,7 @@ This commonly includes things such as: ;; definition for function sew-mar-statue-event-handler (defbehavior sew-mar-statue-event-handler sew-mar-statue ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Event handler for the [[sew-mar-statue]], normally hidden, but once `trigger`ed it will spawn the debris" (case arg2 (('hide) (if (not (and (-> self next-state) (= (-> self next-state name) 'hidden))) @@ -678,9 +686,9 @@ This commonly includes things such as: :virtual #t :event sew-mar-statue-event-handler :enter (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (logior! (-> self draw status) (draw-control-status no-draw)) @@ -691,7 +699,7 @@ This commonly includes things such as: ;; definition for method 11 of type sew-mar-statue ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-mar-statue ((obj sew-mar-statue) (arg0 entity-actor)) +(defmethod init-from-entity! sew-mar-statue ((obj sew-mar-statue) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -699,24 +707,24 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj spawned-debris?) #f) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 0) - (set-vector! (-> v1-2 local-sphere) 0.0 30720.0 0.0 58982.4) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 30720.0 0.0 58982.4) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-mar-statue" (the-as (pointer uint32) #f))) @@ -789,21 +797,21 @@ and translate the platform via the `smush` (set! (-> self draw bounds w) 163840.0) (set! (-> self root-override root-prim local-sphere w) 163840.0) (set! (-> self draw force-lod) 0) - (let* ((s5-0 (-> self draw art-group)) - (s4-0 (method-of-object s5-0 get-art-by-name-method)) + (let* ((art-group (-> self draw art-group)) + (art (method-of-object art-group get-art-by-name-method)) ) (format (clear *temp-string*) "~S-end" (-> self art-name)) - (let ((s5-1 (the-as object (s4-0 s5-0 *temp-string* art-joint-anim)))) + (let ((anim (the-as object (art art-group *temp-string* art-joint-anim)))) (if (not arg0) (ja-play-spooled-anim (-> self anim) (ja-group) - (the-as art-joint-anim s5-1) + (the-as art-joint-anim anim) (the-as (function process-drawable symbol) false-func) ) ) (ja-channel-set! 1) - (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim anim)) ) ) (suspend) @@ -817,7 +825,7 @@ and translate the platform via the `smush` ;; definition for method 11 of type sew-catwalk ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-catwalk ((obj sew-catwalk) (arg0 entity-actor)) +(defmethod init-from-entity! sew-catwalk ((obj sew-catwalk) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -826,21 +834,21 @@ This commonly includes things such as: - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape-moving)) (stack-size-set! (-> obj main-thread) 512) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 14) 0))) - (set! (-> s4-0 total-prims) (the-as uint 15)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) -28672.0 20480.0 -102400.0 73728.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 14) 0))) + (set! (-> cshape total-prims) (the-as uint 15)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) -28672.0 20480.0 -102400.0 73728.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 4 28672) (1 5 28672) @@ -861,20 +869,20 @@ This commonly includes things such as: (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((_prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (_prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> prim-group prim-core action)) (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) @@ -883,14 +891,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-28 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-28 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-28 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-catwalk-1" (the-as (pointer uint32) #f))) @@ -920,7 +928,7 @@ This commonly includes things such as: (:methods (idle () _type_ :state 20) (die () _type_ :state 21) - (sew-mine-method-22 (_type_) none 22) + (init-mine! (_type_) none 22) ) ) @@ -944,42 +952,43 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) - ) - ) + (let* ((_proc proc) + (focus-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) + ) ) - (when gp-0 - (let ((a0-4 (vector-normalize! - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root-override trans)) - 1.0 - ) - ) - (a1-7 (new 'stack-no-clear 'event-message-block)) - ) - (set! (-> a1-7 from) (process->ppointer self)) - (set! (-> a1-7 num-params) 2) - (set! (-> a1-7 message) 'attack-or-shove) - (set! (-> a1-7 param 0) (-> event param 0)) - (let ((v1-9 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up control id)))) - (let* ((a2-3 *game-info*) - (a3-2 (+ (-> a2-3 attack-id) 1)) - ) - (set! (-> a2-3 attack-id) a3-2) - (set! (-> v1-9 id) a3-2) - ) - (set! (-> v1-9 vector quad) (-> a0-4 quad)) - (set! (-> v1-9 shove-back) 20480.0) - (set! (-> v1-9 shove-up) 12288.0) - (set! (-> v1-9 control) (if (logtest? (focus-status board) (-> gp-0 focus-status)) - 1.0 - 0.0 - ) + (when focus-proc + (let ((a0-4 + (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> focus-proc root-override trans) (-> self root-override trans)) + 1.0 ) - (set! (-> a1-7 param 1) (the-as uint v1-9)) + ) + (evt (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up control id)))) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) + ) + (set! (-> game-info attack-id) id) + (set! (-> attack-info id) id) + ) + (set! (-> attack-info vector quad) (-> a0-4 quad)) + (set! (-> attack-info shove-back) 20480.0) + (set! (-> attack-info shove-up) 12288.0) + (set! (-> attack-info control) (if (logtest? (focus-status board) (-> focus-proc focus-status)) + 1.0 + 0.0 + ) + ) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-7) + (send-event-function focus-proc evt) ) ) ) @@ -1012,13 +1021,13 @@ This commonly includes things such as: (logior! (-> self draw status) (draw-control-status no-draw)) (sound-play "sew-mine-b") (process-spawn touch-tracker :init touch-tracker-init (-> self root-override trans) #x47200000 30 :to self) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-2 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 (the-as part-tracker gp-2) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + (let ((part (get-process *default-dead-pool* part-tracker #x4000))) + (when part + (let ((func (method-of-type part-tracker activate))) + (func (the-as part-tracker part) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) ) (let ((t9-7 run-function-in-process) - (a0-8 gp-2) + (a0-8 part) (a1-6 part-tracker-init) (a2-10 (-> *part-group-id-table* 124)) (a3-4 0) @@ -1039,12 +1048,12 @@ This commonly includes things such as: t3-0 ) ) - (-> gp-2 ppointer) + (-> part ppointer) ) ) (cleanup-for-death self) - (let ((gp-3 (-> self clock frame-counter))) - (until (>= (- (-> self clock frame-counter) gp-3) (seconds 2)) + (let ((frame-counter (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) frame-counter) (seconds 2)) (suspend) ) ) @@ -1054,7 +1063,8 @@ This commonly includes things such as: ;; definition for method 22 of type sew-mine ;; WARN: Return type mismatch int vs none. -(defmethod sew-mine-method-22 sew-mine ((obj sew-mine)) +(defmethod init-mine! sew-mine ((obj sew-mine)) + "Initializes the mine's particles and sets `last-time` to `0`" (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 345) obj)) (set! (-> obj last-time) 0) 0 @@ -1088,38 +1098,38 @@ This commonly includes things such as: ;; definition for method 11 of type sew-mine-a ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-mine-a ((obj sew-mine-a) (arg0 entity-actor)) +(defmethod init-from-entity! sew-mine-a ((obj sew-mine-a) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 2048.0 0.0 8192.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 2048.0 0.0 8192.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-11 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-11 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + (set! (-> obj root-override) (the-as collide-shape-moving cshape)) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-mine-a" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (sew-mine-method-22 obj) + (init-mine! obj) (go (method-of-object obj idle)) (none) ) @@ -1161,21 +1171,21 @@ This commonly includes things such as: (defstate idle (sew-mine-b) :virtual #t :post (behavior () - (let ((t9-0 (-> (method-of-type sew-mine idle) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type sew-mine idle) post))) + (if func + ((the-as (function none) func)) ) ) - (let* ((f30-0 (get-base-height *ocean-map-sewer*)) - (f0-0 (-> self period)) + (let* ((ocean-base-height (get-base-height *ocean-map-sewer*)) + (period (-> self period)) (t9-2 sin-rad) (f1-0 -3.1415925) (f2-0 6.283185) (f3-1 (the float (+ (-> self clock frame-counter) (the-as time-frame (-> self time-skew))))) - (f28-0 (t9-2 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 f0-0))) f0-0)) f0-0))))) + (f28-0 (t9-2 (+ f1-0 (* f2-0 (/ (- f3-1 (* (the float (the int (/ f3-1 period))) period)) period))))) ) - (when (< f30-0 (-> self center y)) - (set! (-> self center y) f30-0) + (when (< ocean-base-height (-> self center y)) + (set! (-> self center y) ocean-base-height) (if (>= (-> self base-height) (-> self center y)) (go-virtual die) ) @@ -1191,41 +1201,41 @@ This commonly includes things such as: ;; definition for method 11 of type sew-mine-b ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-mine-b ((obj sew-mine-b) (arg0 entity-actor)) +(defmethod init-from-entity! sew-mine-b ((obj sew-mine-b) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 2048.0 0.0 8192.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 2048.0 0.0 8192.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-11 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-11 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + (set! (-> obj root-override) (the-as collide-shape-moving cshape)) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-mine-b" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (sew-mine-method-22 obj) - (let ((a0-11 (-> obj entity))) - (set! (-> obj base-height) ((method-of-object a0-11 get-property-value-float) - a0-11 + (init-mine! obj) + (let ((_entity (-> obj entity))) + (set! (-> obj base-height) ((method-of-object _entity get-property-value-float) + _entity 'base-height 'interp -1000000000.0 @@ -1249,9 +1259,9 @@ This commonly includes things such as: ((deadly-radius float :offset-assert 204) (prev-deadly-radius float :offset-assert 208) (attack-id uint32 :offset-assert 212) - (first-wall? basic :offset-assert 216) + (first-wall? symbol :offset-assert 216) (anim spool-anim :offset-assert 220) - (art-name basic :offset-assert 224) + (art-name string :offset-assert 224) ) :heap-base #x70 :method-count-assert 30 @@ -1260,7 +1270,7 @@ This commonly includes things such as: (:methods (idle () _type_ :state 27) (hit (symbol) _type_ :state 28) - (sew-wall-method-29 (_type_) none 29) + (attack-target! (_type_) none 29) ) ) @@ -1293,21 +1303,22 @@ This commonly includes things such as: ;; definition for method 29 of type sew-wall ;; INFO: Used lq/sq ;; WARN: Return type mismatch float vs none. -(defmethod sew-wall-method-29 sew-wall ((obj sew-wall)) +(defmethod attack-target! sew-wall ((obj sew-wall)) + "If the target is close enough to the wall, hit it!" (with-pp - (let ((s4-0 *target*)) - (when s4-0 - (let ((f0-0 (vector-vector-xz-distance (get-trans s4-0 0) (-> obj root-override trans))) - (f2-0 (-> obj deadly-radius)) - (f1-0 (-> obj prev-deadly-radius)) + (let ((target *target*)) + (when target + (let ((dist-from-wall (vector-vector-xz-distance (get-trans target 0) (-> obj root-override trans))) + (deadly-radius (-> obj deadly-radius)) + (prev-deadly-radius (-> obj prev-deadly-radius)) ) - (set! (-> obj prev-deadly-radius) f2-0) - (when (and (>= f2-0 f0-0) (>= f0-0 (+ -4096.0 f1-0))) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (set! (-> s5-1 start-pos quad) (-> obj root-override trans quad)) - (set! (-> s5-1 start-pos y) (+ 12288.0 (-> s5-1 start-pos y))) - (vector-! (-> s5-1 move-dist) (get-trans s4-0 3) (-> s5-1 start-pos)) - (let ((v1-9 s5-1)) + (set! (-> obj prev-deadly-radius) deadly-radius) + (when (and (>= deadly-radius dist-from-wall) (>= dist-from-wall (+ -4096.0 prev-deadly-radius))) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> obj root-override trans quad)) + (set! (-> cquery start-pos y) (+ 12288.0 (-> cquery start-pos y))) + (vector-! (-> cquery move-dist) (get-trans target 3) (-> cquery start-pos)) + (let ((v1-9 cquery)) (set! (-> v1-9 radius) 819.2) (set! (-> v1-9 collide-with) (collide-spec backgnd)) (set! (-> v1-9 ignore-process0) obj) @@ -1315,19 +1326,19 @@ This commonly includes things such as: (set! (-> v1-9 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) (set! (-> v1-9 action-mask) (collide-action solid)) ) - (when (< (fill-and-probe-using-line-sphere *collide-cache* s5-1) 0.0) - (let ((a1-4 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-4 from) (process->ppointer pp)) - (set! (-> a1-4 num-params) 2) - (set! (-> a1-4 message) 'attack) - (set! (-> a1-4 param 0) (the-as uint #f)) - (let ((v1-15 (new 'static 'attack-info :mask (attack-info-mask mode id attacker-velocity)))) - (set! (-> v1-15 id) (-> obj attack-id)) - (set! (-> v1-15 mode) 'explode) - (set! (-> v1-15 attacker-velocity quad) (-> s5-1 move-dist quad)) - (set! (-> a1-4 param 1) (the-as uint v1-15)) + (when (< (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer pp)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack) + (set! (-> evt param 0) (the-as uint #f)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask mode id attacker-velocity)))) + (set! (-> attack-info id) (-> obj attack-id)) + (set! (-> attack-info mode) 'explode) + (set! (-> attack-info attacker-velocity quad) (-> cquery move-dist quad)) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function *target* a1-4) + (send-event-function *target* evt) ) (set! (-> obj deadly-radius) -1.0) ) @@ -1386,7 +1397,7 @@ This commonly includes things such as: (let ((f0-0 (-> self deadly-radius))) (when (>= f0-0 0.0) (set! (-> self deadly-radius) (seek f0-0 409600.0 (* 368640.0 (-> self clock seconds-per-frame)))) - (sew-wall-method-29 self) + (attack-target! self) ) ) (none) @@ -1395,51 +1406,51 @@ This commonly includes things such as: (if (not (-> self first-wall?)) (set! arg0 #t) ) - (let ((v1-4 (-> self root-override root-prim))) - (set! (-> (the-as collide-shape-prim-group v1-4) child 0 prim-core collide-with) (collide-spec)) - (set! (-> (the-as collide-shape-prim-group v1-4) child 0 prim-core collide-as) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> (the-as collide-shape-prim-group root-prim) child 0 prim-core collide-with) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group root-prim) child 0 prim-core collide-as) (collide-spec)) (if (-> self first-wall?) - (set-vector! (-> v1-4 local-sphere) 43827.2 -16384.0 158924.8 204800.0) - (set-vector! (-> v1-4 local-sphere) 43827.2 -16384.0 110592.0 225280.0) + (set-vector! (-> root-prim local-sphere) 43827.2 -16384.0 158924.8 204800.0) + (set-vector! (-> root-prim local-sphere) 43827.2 -16384.0 110592.0 225280.0) ) - (set! (-> self draw bounds quad) (-> v1-4 local-sphere quad)) + (set! (-> self draw bounds quad) (-> root-prim local-sphere quad)) ) (update-transforms (-> self root-override)) - (let* ((s5-0 (-> self draw art-group)) - (s4-0 (method-of-object s5-0 get-art-by-name-method)) + (let* ((art-group (-> self draw art-group)) + (s4-0 (method-of-object art-group get-art-by-name-method)) ) (format (clear *temp-string*) "~S-end" (-> self art-name)) - (let ((s5-1 (the-as object (s4-0 s5-0 *temp-string* art-joint-anim)))) + (let ((anim (the-as object (s4-0 art-group *temp-string* art-joint-anim)))) (when (not arg0) (set! (-> self deadly-radius) 0.0) (ja-play-spooled-anim (-> self anim) (ja-group) - (the-as art-joint-anim s5-1) + (the-as art-joint-anim anim) (the-as (function process-drawable symbol) false-func) ) ) (ja-channel-set! 1) - (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim anim)) ) ) (set! (-> self deadly-radius) -1.0) - (let* ((a0-14 (-> self root-override root-prim)) - (a1-11 (-> a0-14 prim-core collide-with)) - (v1-22 (-> a0-14 prim-core collide-as)) + (let* ((_root-prim (-> self root-override root-prim)) + (collide-with (-> _root-prim prim-core collide-with)) + (collide-as (-> _root-prim prim-core collide-as)) ) (cond ((-> self first-wall?) - (set! (-> (the-as collide-shape-prim-group a0-14) child 1 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 1 prim-core collide-as) v1-22) - (set! (-> (the-as collide-shape-prim-group a0-14) child 2 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 2 prim-core collide-as) v1-22) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 1 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 1 prim-core collide-as) collide-as) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 2 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 2 prim-core collide-as) collide-as) ) (else - (set! (-> (the-as collide-shape-prim-group a0-14) child 3 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 3 prim-core collide-as) v1-22) - (set! (-> (the-as collide-shape-prim-group a0-14) child 4 prim-core collide-with) a1-11) - (set! (-> (the-as collide-shape-prim-group a0-14) child 4 prim-core collide-as) v1-22) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 3 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 3 prim-core collide-as) collide-as) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 4 prim-core collide-with) collide-with) + (set! (-> (the-as collide-shape-prim-group _root-prim) child 4 prim-core collide-as) collide-as) ) ) ) @@ -1455,7 +1466,7 @@ This commonly includes things such as: ;; definition for method 11 of type sew-wall ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-wall ((obj sew-wall) (arg0 entity-actor)) +(defmethod init-from-entity! sew-wall ((obj sew-wall) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -1465,7 +1476,7 @@ This commonly includes things such as: (with-pp (stack-size-set! (-> obj main-thread) 512) (set! (-> obj mask) (logior (process-mask collectable) (-> obj mask))) - (let ((s3-0 ((method-of-type res-lump get-property-struct) + (let ((data ((method-of-type res-lump get-property-struct) (-> obj entity) 'art-name 'interp @@ -1475,68 +1486,68 @@ This commonly includes things such as: *res-static-buf* ) ) - (s5-0 (art-group-get-by-name *level* "skel-sew-wall" (the-as (pointer uint32) #f))) + (art-group (art-group-get-by-name *level* "skel-sew-wall" (the-as (pointer uint32) #f))) ) - (set! (-> obj art-name) (the-as basic s3-0)) - (let ((s2-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s2-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s2-0 reaction) cshape-reaction-default) - (set! (-> s2-0 no-reaction) + (set! (-> obj art-name) (the-as string data)) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s1-0 (new 'process 'collide-shape-prim-group s2-0 (the-as uint 5) 0))) - (set! (-> s2-0 total-prims) (the-as uint 6)) - (set! (-> s1-0 prim-core collide-as) (collide-spec obstacle)) - (set! (-> s1-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s1-0 prim-core action) (collide-action solid)) - (set! (-> s1-0 transform-index) 4) - (set-vector! (-> s1-0 local-sphere) 0.0 0.0 0.0 40960.0) - (set! (-> s2-0 root-prim) s1-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 5) 0))) + (set! (-> cshape total-prims) (the-as uint 6)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 4) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 0.0 40960.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-19 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-19 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-19 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-19 prim-core action) (collide-action solid)) - (set! (-> v1-19 transform-index) 4) - (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 40960.0) + (let ((prim-mesh-1 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh-1 prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh-1 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh-1 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-1 transform-index) 4) + (set-vector! (-> prim-mesh-1 local-sphere) 0.0 0.0 0.0 40960.0) ) - (let ((v1-21 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 1) (the-as uint 0)))) - (set! (-> v1-21 prim-core action) (collide-action solid)) - (set! (-> v1-21 transform-index) 4) - (set-vector! (-> v1-21 local-sphere) 77824.0 -16384.0 282624.0 36864.0) + (let ((prim-mesh-2 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) + (set! (-> prim-mesh-2 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-2 transform-index) 4) + (set-vector! (-> prim-mesh-2 local-sphere) 77824.0 -16384.0 282624.0 36864.0) ) - (let ((v1-23 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 2) (the-as uint 0)))) - (set! (-> v1-23 prim-core action) (collide-action solid)) - (set! (-> v1-23 transform-index) 4) - (set-vector! (-> v1-23 local-sphere) 61440.0 -16384.0 112640.0 151552.0) + (let ((prim-mesh-3 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) + (set! (-> prim-mesh-3 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-3 transform-index) 4) + (set-vector! (-> prim-mesh-3 local-sphere) 61440.0 -16384.0 112640.0 151552.0) ) - (let ((v1-25 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 3) (the-as uint 0)))) - (set! (-> v1-25 prim-core action) (collide-action solid)) - (set! (-> v1-25 transform-index) 4) - (set-vector! (-> v1-25 local-sphere) 0.0 -16384.0 40960.0 122880.0) + (let ((prim-mesh-4 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 3) (the-as uint 0)))) + (set! (-> prim-mesh-4 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-4 transform-index) 4) + (set-vector! (-> prim-mesh-4 local-sphere) 0.0 -16384.0 40960.0 122880.0) ) - (let ((v1-27 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 4) (the-as uint 0)))) - (set! (-> v1-27 prim-core action) (collide-action solid)) - (set! (-> v1-27 transform-index) 4) - (set-vector! (-> v1-27 local-sphere) 81920.0 0.0 204800.0 143360.0) + (let ((prim-mesh-5 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 4) (the-as uint 0)))) + (set! (-> prim-mesh-5 prim-core action) (collide-action solid)) + (set! (-> prim-mesh-5 transform-index) 4) + (set-vector! (-> prim-mesh-5 local-sphere) 81920.0 0.0 204800.0 143360.0) ) - (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) - (let ((v1-30 (-> s2-0 root-prim))) - (set! (-> s2-0 backup-collide-as) (-> v1-30 prim-core collide-as)) - (set! (-> s2-0 backup-collide-with) (-> v1-30 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s2-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (cond - ((string= (the-as string (-> obj art-name)) "sew-wall-1") + ((string= (-> obj art-name) "sew-wall-1") (set! (-> obj anim) (new 'static 'spool-anim :name "sew-wall-1" :anim-name "1-break" :parts 1 :command-list '()) ) - (set! (-> obj first-wall?) (the-as basic #t)) + (set! (-> obj first-wall?) #t) ) - ((string= (the-as string (-> obj art-name)) "sew-wall-2") + ((string= (-> obj art-name) "sew-wall-2") (set! (-> obj anim) (new 'static 'spool-anim :name "sew-wall-2" :anim-name "2-break" :parts 1 :command-list '()) ) @@ -1544,25 +1555,25 @@ This commonly includes things such as: (set! (-> obj first-wall?) #f) ) (else - (go process-drawable-art-error (the-as string s3-0)) + (go process-drawable-art-error (the-as string data)) ) ) - (initialize-skeleton obj (the-as skeleton-group s5-0) (the-as pair 0)) + (initialize-skeleton obj (the-as skeleton-group art-group) (the-as pair 0)) ) (set! (-> obj draw force-lod) 0) (ja-channel-set! 1) - (let* ((s5-1 (-> obj skel root-channel 0)) - (s4-1 (-> obj draw art-group)) - (s3-1 (method-of-object s4-1 get-art-by-name-method)) + (let* ((channel (-> obj skel root-channel 0)) + (_art-group (-> obj draw art-group)) + (s3-1 (method-of-object _art-group get-art-by-name-method)) ) (format (clear *temp-string*) "~S-idle" (-> obj art-name)) - (set! (-> s5-1 frame-group) (the-as art-joint-anim (s3-1 s4-1 *temp-string* (the-as type #f)))) + (set! (-> channel frame-group) (the-as art-joint-anim (s3-1 _art-group *temp-string* (the-as type #f)))) ) - (let* ((v1-51 *game-info*) - (a0-43 (+ (-> v1-51 attack-id) 1)) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-51 attack-id) a0-43) - (set! (-> obj attack-id) a0-43) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (if (eval! (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) @@ -1625,7 +1636,7 @@ This commonly includes things such as: ;; definition for method 11 of type sew-grill ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-grill ((obj sew-grill) (arg0 entity-actor)) +(defmethod init-from-entity! sew-grill ((obj sew-grill) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -1633,7 +1644,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-grill" (the-as (pointer uint32) #f))) @@ -1810,18 +1821,18 @@ This commonly includes things such as: (none) ) :trans (behavior () - (let* ((s5-0 *target*) - (gp-0 (if (type? s5-0 process-focusable) - s5-0 - ) - ) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when gp-0 + (when target-proc (cond - ((< (vector-vector-distance (-> self root-override2 trans) (get-trans gp-0 0)) 20480.0) + ((< (vector-vector-distance (-> self root-override2 trans) (get-trans target-proc 0)) 20480.0) (go-virtual scare) ) - ((< (vector-vector-distance (-> self root-override2 trans) (get-trans gp-0 0)) 102400.0) + ((< (vector-vector-distance (-> self root-override2 trans) (get-trans target-proc 0)) 102400.0) (gui-control-method-12 *gui-control* self @@ -1864,19 +1875,19 @@ This commonly includes things such as: ) :enter (behavior () (logclear! (-> self draw status) (draw-control-status no-draw)) - (let* ((v1-2 (-> self grill-actor)) - (gp-0 (if v1-2 - (-> v1-2 extra process) - ) - ) + (let* ((actor (-> self grill-actor)) + (actor-proc (if actor + (-> actor extra process) + ) + ) ) - (when gp-0 + (when actor-proc (set! (-> self manipy) (process-spawn manipy :init manipy-init (-> self root-override2 trans) - (-> gp-0 entity) + (-> actor-proc entity) (art-group-get-by-name *level* "skel-sew-grill" (the-as (pointer uint32) #f)) #f 0 @@ -1884,8 +1895,8 @@ This commonly includes things such as: ) ) (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) - (set! (-> self manipy 0 draw light-index) (-> (the-as sew-grill gp-0) draw light-index)) - (logior! (-> (the-as sew-grill gp-0) draw status) (draw-control-status no-draw)) + (set! (-> self manipy 0 draw light-index) (-> (the-as sew-grill actor-proc) draw light-index)) + (logior! (-> (the-as sew-grill actor-proc) draw status) (draw-control-status no-draw)) ) ) (set! (-> self spooled-sound-id) @@ -1897,31 +1908,31 @@ This commonly includes things such as: (none) ) :exit (behavior () - (let* ((a0-0 (-> self grill-actor)) - (v1-0 (if a0-0 - (-> a0-0 extra process) - ) - ) + (let* ((actor (-> self grill-actor)) + (actor-proc (if actor + (-> actor extra process) + ) + ) ) - (if v1-0 - (logclear! (-> (the-as sew-grill v1-0) draw status) (draw-control-status no-draw)) + (if actor-proc + (logclear! (-> (the-as sew-grill actor-proc) draw status) (draw-control-status no-draw)) ) ) (none) ) :code (behavior () (ja-channel-push! 1 (seconds 0.2)) - (let ((a2-0 (-> self draw art-group data 57))) + (let ((anim (-> self draw art-group data 57))) (ja-play-spooled-anim (-> self anim) (ja-group) - (the-as art-joint-anim a2-0) + (the-as art-joint-anim anim) (the-as (function process-drawable symbol) false-func) ) ) - (let ((v1-8 (-> self root-override2 root-prim))) - (set! (-> v1-8 prim-core collide-as) (collide-spec)) - (set! (-> v1-8 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override2 root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (suspend) @@ -1941,28 +1952,28 @@ This commonly includes things such as: (fmax 0.0 (fmin 1.0 (* 0.00001994613 f1-0))) ) ) - (let ((f30-0 + (let ((scale (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override2 trans) (camera-pos)) 65536.0 204800.0) ) ) (when *sound-player-enable* - (let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> gp-1 command) (sound-command set-param)) - (set! (-> gp-1 id) (the-as sound-id (-> self spooled-sound-id))) - (set! (-> gp-1 params volume) (the int (* 1024.0 f30-0))) - (let ((a1-5 (-> self root-override2 trans))) - (let ((s5-1 self)) - (when (= a1-5 #t) - (if (and s5-1 (type? s5-1 process-drawable) (nonzero? (-> s5-1 root-override2))) - (set! a1-5 (-> s5-1 root-override2 trans)) - (set! a1-5 (the-as vector #f)) + (let ((set-sound-param (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> set-sound-param command) (sound-command set-param)) + (set! (-> set-sound-param id) (the-as sound-id (-> self spooled-sound-id))) + (set! (-> set-sound-param params volume) (the int (* 1024.0 scale))) + (let ((position (-> self root-override2 trans))) + (let ((_self self)) + (when (= position #t) + (if (and _self (type? _self process-drawable) (nonzero? (-> _self root-override2))) + (set! position (-> _self root-override2 trans)) + (set! position (the-as vector #f)) ) ) ) - (sound-trans-convert (the-as vector3w (-> gp-1 params trans)) a1-5) + (sound-trans-convert (the-as vector3w (-> set-sound-param params trans)) position) ) - (set! (-> gp-1 params mask) (the-as uint 33)) - (-> gp-1 id) + (set! (-> set-sound-param params mask) (the-as uint 33)) + (-> set-sound-param id) ) ) ) @@ -1980,109 +1991,110 @@ This commonly includes things such as: ;; definition for method 114 of type sew-scare-grunt ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 sew-scare-grunt ((obj sew-scare-grunt)) - "@abstract" +(defmethod init-enemy-collision! sew-scare-grunt ((obj sew-scare-grunt)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (stack-size-set! (-> obj main-thread) 512) - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 penetrated-by) (penetrate - generic-attack - lunge - flop - punch - spin - roll - uppercut - bonk - tube - vehicle - flut-attack - board - mech-punch - dark-punch - dark-giant - ) + (set! (-> cshape penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) ) - (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 6) 0))) - (set! (-> s5-0 total-prims) (the-as uint 7)) - (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) - (set! (-> s4-0 prim-core collide-with) (collide-spec backgnd)) - (set! (-> s4-0 prim-core action) (collide-action solid)) - (set-vector! (-> s4-0 local-sphere) 0.0 6144.0 0.0 17408.0) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 6) 0))) + (set! (-> cshape total-prims) (the-as uint 7)) + (set! (-> prim-group prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-group prim-core collide-with) (collide-spec backgnd)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set-vector! (-> prim-group local-sphere) 0.0 6144.0 0.0 17408.0) + (set! (-> cshape root-prim) prim-group) ) - (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-15 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-15 prim-core collide-with) (collide-spec backgnd)) - (set! (-> v1-15 prim-core action) (collide-action solid)) - (set-vector! (-> v1-15 local-sphere) 0.0 4915.2 0.0 4915.2) + (let ((prim-sphere-1 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-1 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-1 prim-core collide-with) (collide-spec backgnd)) + (set! (-> prim-sphere-1 prim-core action) (collide-action solid)) + (set-vector! (-> prim-sphere-1 local-sphere) 0.0 4915.2 0.0 4915.2) ) - (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-17 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-17 prim-core action) (collide-action semi-solid)) - (set! (-> v1-17 transform-index) 4) - (set-vector! (-> v1-17 local-sphere) 0.0 0.0 0.0 4915.2) + (let ((prim-sphere-2 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-2 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-2 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-2 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-2 transform-index) 4) + (set-vector! (-> prim-sphere-2 local-sphere) 0.0 0.0 0.0 4915.2) ) - (let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-19 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-19 prim-core action) (collide-action semi-solid)) - (set! (-> v1-19 transform-index) 18) - (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 2252.8) + (let ((prim-sphere-3 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-3 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-3 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-3 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-3 transform-index) 18) + (set-vector! (-> prim-sphere-3 local-sphere) 0.0 0.0 0.0 2252.8) ) - (let ((v1-21 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-21 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-21 prim-core action) (collide-action semi-solid)) - (set! (-> v1-21 transform-index) 16) - (set-vector! (-> v1-21 local-sphere) 0.0 0.0 0.0 2048.0) + (let ((prim-sphere-4 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-4 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-4 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-4 transform-index) 16) + (set-vector! (-> prim-sphere-4 local-sphere) 0.0 0.0 0.0 2048.0) ) - (let ((v1-23 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-23 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-23 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-23 prim-core action) (collide-action semi-solid)) - (set! (-> v1-23 transform-index) 12) - (set-vector! (-> v1-23 local-sphere) 0.0 0.0 0.0 2048.0) + (let ((prim-sphere-5 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-5 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-5 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-5 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-5 transform-index) 12) + (set-vector! (-> prim-sphere-5 local-sphere) 0.0 0.0 0.0 2048.0) ) - (let ((v1-25 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) - (set! (-> v1-25 prim-core collide-as) (collide-spec enemy)) - (set! (-> v1-25 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-25 prim-core action) (collide-action semi-solid)) - (set! (-> v1-25 transform-index) 6) - (set-vector! (-> v1-25 local-sphere) 0.0 0.0 0.0 8192.0) + (let ((prim-sphere-6 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0)))) + (set! (-> prim-sphere-6 prim-core collide-as) (collide-spec enemy)) + (set! (-> prim-sphere-6 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-sphere-6 prim-core action) (collide-action semi-solid)) + (set! (-> prim-sphere-6 transform-index) 6) + (set-vector! (-> prim-sphere-6 local-sphere) 0.0 0.0 0.0 8192.0) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-28 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-28 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-28 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> s5-0 max-iteration-count) (the-as uint 3)) - (set! (-> obj root-override2) s5-0) + (set! (-> cshape max-iteration-count) (the-as uint 3)) + (set! (-> obj root-override2) cshape) ) 0 (none) ) ;; definition for method 185 of type sew-scare-grunt -(defmethod grunt-method-185 sew-scare-grunt ((obj sew-scare-grunt)) +(defmethod get-enemy-info sew-scare-grunt ((obj sew-scare-grunt)) + "@returns the [[nav-enemy-info]] associated with this type of grunt" *sew-scare-grunt-nav-enemy-info* ) ;; definition for method 115 of type sew-scare-grunt ;; WARN: Return type mismatch float vs none. -(defmethod enemy-method-115 sew-scare-grunt ((obj sew-scare-grunt)) - "@abstract" +(defmethod init-enemy! sew-scare-grunt ((obj sew-scare-grunt)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (set! (-> obj anim) (new 'static 'spool-anim :name "sew-scare-grunt" :anim-name "sew-scare-grunt" :parts 2 :command-list '()) ) (set! (-> obj grill-actor) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) - (let ((t9-1 (method-of-type grunt enemy-method-115))) - (t9-1 obj) + (let ((func (method-of-type grunt init-enemy!))) + (func obj) ) (set! (-> obj root-override2 trans y) (+ -3276.8 (-> obj root-override2 trans y))) (none) diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc index 40fc6cedd9..8f990b93bf 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc @@ -3,19 +3,19 @@ ;; definition of type sew-blade (deftype sew-blade (process-drawable) - ((y-min float :offset-assert 200) - (y-max float :offset-assert 204) - (snd-water uint128 :offset-assert 208) - (snd-no-water uint128 :offset-assert 224) - (last-sound int32 :offset-assert 240) - (attack-id uint32 :offset-assert 244) + ((y-min float :offset-assert 200) + (y-max float :offset-assert 204) + (snd-water sound-name :offset-assert 208) + (snd-no-water sound-name :offset-assert 224) + (last-sound int32 :offset-assert 240) + (attack-id uint32 :offset-assert 244) ) :heap-base #x80 :method-count-assert 21 :size-assert #xf8 :flag-assert #x15008000f8 (:methods - (sew-blade-method-20 (_type_) none 20) + (update-sound! (_type_) none 20) ) ) @@ -42,26 +42,27 @@ ;; definition for method 20 of type sew-blade ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod sew-blade-method-20 sew-blade ((obj sew-blade)) +(defmethod update-sound! sew-blade ((obj sew-blade)) + "Updates the sound of the [[sew-blade]] based on if it's under or above the water" (when (nonzero? (-> obj sound)) (let ((f30-0 (+ (-> obj root trans y) (-> obj y-max))) (f28-0 (+ (-> obj root trans y) (-> obj y-min))) - (f0-2 (get-base-height *ocean-map-sewer*)) + (ocean-base-height (get-base-height *ocean-map-sewer*)) ) (cond - ((< f30-0 f0-2) + ((< f30-0 ocean-base-height) (stop! (-> obj sound)) ) - ((< f0-2 f28-0) + ((< ocean-base-height f28-0) (when (!= (-> obj last-sound) 1) - (change-sound! (-> obj sound) (the-as sound-name (-> obj snd-no-water))) + (change-sound! (-> obj sound) (-> obj snd-no-water)) (set! (-> obj last-sound) 1) ) (update! (-> obj sound)) ) (else (when (!= (-> obj last-sound) 2) - (change-sound! (-> obj sound) (the-as sound-name (-> obj snd-water))) + (change-sound! (-> obj sound) (-> obj snd-water)) (set! (-> obj last-sound) 2) ) (update! (-> obj sound)) @@ -112,32 +113,34 @@ :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) ) - ) ) - (when gp-0 - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root trans))) + (when hit-proc + (let ((hit-direction + (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root-override trans) (-> self root trans)) + ) (v1-5 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) ) - (if (< (vector-dot v1-5 s4-2) 0.0) + (if (< (vector-dot v1-5 hit-direction) 0.0) (vector-float*! v1-5 v1-5 -1.0) ) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((a0-14 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) - (set! (-> a0-14 id) (-> self attack-id)) - (set! (-> a0-14 vector quad) (-> v1-5 quad)) - (set! (-> a0-14 shove-back) 20480.0) - (set! (-> a0-14 shove-up) 12288.0) - (set! (-> a1-6 param 1) (the-as uint a0-14)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info vector quad) (-> v1-5 quad)) + (set! (-> attack-info shove-back) 20480.0) + (set! (-> attack-info shove-up) 12288.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-6) + (send-event-function hit-proc evt) ) ) ) @@ -160,7 +163,7 @@ (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) @@ -177,28 +180,28 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 0.0 16384.0 22528.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 16384.0 22528.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) (process-drawable-from-entity! obj arg0) (logclear! (-> obj mask) (process-mask actor-pause)) @@ -212,15 +215,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 286720.0) (set! (-> obj y-min) -16384.0) (set! (-> obj y-max) 16384.0) - (set! (-> obj snd-water) - (the-as uint128 (make-u128 (the-as uint #x772d6564616c) (the-as uint #x622d656c676e6973))) - ) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 #x6564616c (the-as uint #x622d656c676e6973)))) - (let* ((v1-35 *game-info*) - (a0-19 (+ (-> v1-35 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "single-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "single-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-35 attack-id) a0-19) - (set! (-> obj attack-id) a0-19) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (transform-post) (go (method-of-object obj idle)) @@ -268,24 +269,25 @@ This commonly includes things such as: ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun sew-tri-blade-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) + "Handles the rotation and transformation of the [[sew-tri-blade]]" (with-pp - (let ((gp-0 (the-as sew-tri-blade (-> arg0 process))) - (s5-0 (new-stack-matrix0)) + (let ((blade (the-as sew-tri-blade (-> arg0 process))) + (matrix (new-stack-matrix0)) (f30-0 (* 182.04445 (* 0.0033333334 (the float (-> pp clock frame-counter))))) ) (let ((s3-0 (-> arg1 data 4 bone transform))) - (matrix-rotate-y! s5-0 (* 240.0 f30-0)) - (matrix*! s3-0 s5-0 s3-0) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s3-0 matrix s3-0) ) (let ((s3-1 (-> arg1 data 5 bone transform))) - (matrix-rotate-y! s5-0 (* -240.0 f30-0)) - (matrix*! s3-1 s5-0 s3-1) - (set! (-> gp-0 y-max) (+ (- 25395.2 (-> gp-0 root trans y)) (-> s3-1 trans y))) + (matrix-rotate-y! matrix (* -240.0 f30-0)) + (matrix*! s3-1 matrix s3-1) + (set! (-> blade y-max) (+ (- 25395.2 (-> blade root trans y)) (-> s3-1 trans y))) ) (let ((s4-1 (-> arg1 data 6 bone transform))) - (matrix-rotate-y! s5-0 (* 240.0 f30-0)) - (matrix*! s4-1 s5-0 s4-1) - (set! (-> gp-0 y-max) (fmax (-> gp-0 y-max) (+ (- 19251.2 (-> gp-0 root trans y)) (-> s4-1 trans y)))) + (matrix-rotate-y! matrix (* 240.0 f30-0)) + (matrix*! s4-1 matrix s4-1) + (set! (-> blade y-max) (fmax (-> blade y-max) (+ (- 19251.2 (-> blade root trans y)) (-> s4-1 trans y)))) ) ) 0 @@ -299,25 +301,25 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s5-0 proc) - (a0-2 (if (type? s5-0 process-focusable) - s5-0 + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + _proc + ) ) - ) ) - (when a0-2 - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) - (set! (-> v1-5 id) (-> self attack-id)) - (set! (-> v1-5 shove-back) 20480.0) - (set! (-> v1-5 shove-up) 8192.0) - (set! (-> a1-6 param 1) (the-as uint v1-5)) + (when hit-proc + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info shove-back) 20480.0) + (set! (-> attack-info shove-up) 8192.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function a0-2 a1-6) + (send-event-function hit-proc evt) ) ) ) @@ -382,7 +384,7 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) @@ -391,7 +393,7 @@ This commonly includes things such as: ;; definition for method 11 of type sew-tri-blade ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-tri-blade ((obj sew-tri-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-tri-blade ((obj sew-tri-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -400,50 +402,50 @@ This commonly includes things such as: - sounds" (with-pp (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) - (set! (-> s4-0 total-prims) (the-as uint 4)) + (let ((s3-0 (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) (set! (-> s3-0 prim-core action) (collide-action solid deadly)) (set-vector! (-> s3-0 local-sphere) 0.0 10240.0 0.0 36864.0) - (set! (-> s4-0 root-prim) s3-0) + (set! (-> cshape root-prim) s3-0) ) - (pusher-init s4-0) - (let ((v1-16 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 2) (the-as uint 0)))) + (pusher-init cshape) + (let ((v1-16 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 2) (the-as uint 0)))) (set! (-> v1-16 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> v1-16 prim-core collide-with) (collide-spec jak player-list)) (set! (-> v1-16 prim-core action) (collide-action solid deadly)) (set! (-> v1-16 transform-index) 4) (set-vector! (-> v1-16 local-sphere) 0.0 8192.0 0.0 18841.6) ) - (let ((v1-18 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (let ((v1-18 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 1) (the-as uint 0)))) (set! (-> v1-18 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) (set! (-> v1-18 prim-core action) (collide-action solid deadly)) (set! (-> v1-18 transform-index) 5) (set-vector! (-> v1-18 local-sphere) 0.0 8192.0 0.0 12288.0) ) - (let ((v1-20 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (let ((v1-20 (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) (set! (-> v1-20 prim-core collide-as) (collide-spec camera-blocker pusher)) (set! (-> v1-20 prim-core collide-with) (collide-spec jak player-list)) (set! (-> v1-20 prim-core action) (collide-action solid deadly)) (set! (-> v1-20 transform-index) 6) (set-vector! (-> v1-20 local-sphere) 0.0 4915.2 0.0 7372.8) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-23 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-23 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-23 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((v1-23 (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> v1-23 prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> v1-23 prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -460,15 +462,15 @@ This commonly includes things such as: (set! (-> v1-33 attack-id) a0-33) (set! (-> obj attack-id) a0-33) ) - (if (>= (res-lump-value arg0 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) + (if (>= (res-lump-value entity 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) (set! (-> obj anim-offset) 3.0) ) (set! (-> obj sound) (new 'process 'ambient-sound "none" (-> obj root trans))) (set-falloff-far! (-> obj sound) 286720.0) (set! (-> obj y-min) 0.0) (set! (-> obj y-max) 48332.8) - (set! (-> obj snd-water) (the-as uint128 (make-u128 #x772d65 (the-as uint #x64616c622d697274)))) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 101 (the-as uint #x64616c622d697274)))) + (set! (-> obj snd-water) (static-sound-name "tri-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "tri-blade")) (transform-post) (go (method-of-object obj idle)) (none) @@ -552,7 +554,7 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) @@ -561,7 +563,7 @@ This commonly includes things such as: ;; definition for method 11 of type sew-arm-blade ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-arm-blade ((obj sew-arm-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-arm-blade ((obj sew-arm-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -569,30 +571,30 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 -24576.0 0.0 28672.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 -24576.0 0.0 28672.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -603,13 +605,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 286720.0) (set! (-> obj y-min) -43008.0) (set! (-> obj y-max) -4096.0) - (set! (-> obj snd-water) (the-as uint128 (make-u128 #x772d65 (the-as uint #x64616c622d6d7261)))) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 101 (the-as uint #x64616c622d6d7261)))) - (let* ((v1-34 *game-info*) - (a0-18 (+ (-> v1-34 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "arm-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "arm-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-34 attack-id) a0-18) - (set! (-> obj attack-id) a0-18) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (transform-post) (go (method-of-object obj idle)) @@ -653,32 +655,34 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) ) - ) ) - (when gp-0 - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root trans))) + (when hit-proc + (let ((hit-direction + (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root-override trans) (-> self root trans)) + ) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat))) ) - (if (< (vector-dot v1-5 s4-2) 0.0) + (if (< (vector-dot v1-5 hit-direction) 0.0) (vector-float*! v1-5 v1-5 -1.0) ) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((a0-14 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) - (set! (-> a0-14 id) (-> self attack-id)) - (set! (-> a0-14 vector quad) (-> v1-5 quad)) - (set! (-> a0-14 shove-back) 28672.0) - (set! (-> a0-14 shove-up) 16384.0) - (set! (-> a1-6 param 1) (the-as uint a0-14)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info vector quad) (-> v1-5 quad)) + (set! (-> attack-info shove-back) 28672.0) + (set! (-> attack-info shove-up) 16384.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-6) + (send-event-function hit-proc evt) ) ) ) @@ -701,7 +705,7 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) @@ -710,7 +714,7 @@ This commonly includes things such as: ;; definition for method 11 of type sew-multi-blade ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-multi-blade ((obj sew-multi-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-multi-blade ((obj sew-multi-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -718,30 +722,30 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 73728.0 0.0 0.0 90112.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 73728.0 0.0 0.0 90112.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -752,15 +756,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 368640.0) (set! (-> obj y-min) -16384.0) (set! (-> obj y-max) 16384.0) - (set! (-> obj snd-water) - (the-as uint128 (make-u128 (the-as uint #x772d656461) (the-as uint #x6c622d69746c756d))) - ) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 #x656461 (the-as uint #x6c622d69746c756d)))) - (let* ((v1-34 *game-info*) - (a0-18 (+ (-> v1-34 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "multi-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "multi-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-34 attack-id) a0-18) - (set! (-> obj attack-id) a0-18) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (transform-post) (go (method-of-object obj idle)) @@ -809,38 +811,40 @@ This commonly includes things such as: object (case event-type (('touch 'attack) - (let* ((s4-0 proc) - (gp-0 (if (type? s4-0 process-focusable) - (the-as process-focusable s4-0) + (let* ((_proc proc) + (hit-proc (if (type? _proc process-focusable) + (the-as process-focusable _proc) + ) ) - ) ) - (when gp-0 - (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 root-override trans) (-> self root-overide trans))) + (when hit-proc + (let ((hit-direction + (vector-! (new 'stack-no-clear 'vector) (-> hit-proc root-override trans) (-> self root-overide trans)) + ) (v1-5 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root-overide quat))) ) - (if (< (vector-dot v1-5 s4-2) 0.0) + (if (< (vector-dot v1-5 hit-direction) 0.0) (vector-float*! v1-5 v1-5 -1.0) ) - (let ((a1-6 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-6 from) (process->ppointer self)) - (set! (-> a1-6 num-params) 2) - (set! (-> a1-6 message) 'attack-or-shove) - (set! (-> a1-6 param 0) (-> event param 0)) - (let ((a0-14 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) - (set! (-> a0-14 id) (-> self attack-id)) - (set! (-> a0-14 vector quad) (-> v1-5 quad)) - (set! (-> a0-14 shove-back) 16384.0) - (set! (-> a0-14 shove-up) 8192.0) - (set! (-> a1-6 param 1) (the-as uint a0-14)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer self)) + (set! (-> evt num-params) 2) + (set! (-> evt message) 'attack-or-shove) + (set! (-> evt param 0) (-> event param 0)) + (let ((attack-info (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id)))) + (set! (-> attack-info id) (-> self attack-id)) + (set! (-> attack-info vector quad) (-> v1-5 quad)) + (set! (-> attack-info shove-back) 16384.0) + (set! (-> attack-info shove-up) 8192.0) + (set! (-> evt param 1) (the-as uint attack-info)) ) - (send-event-function gp-0 a1-6) + (send-event-function hit-proc evt) ) ) (set! (-> self no-collision-timer) (the-as uint (-> self clock frame-counter))) - (let ((v1-13 (-> self root-overide root-prim))) - (set! (-> v1-13 prim-core collide-as) (collide-spec)) - (set! (-> v1-13 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-overide root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 ) @@ -855,18 +859,18 @@ This commonly includes things such as: (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout)) ) ) - (let ((v1-7 (-> self root-overide root-prim))) - (set! (-> v1-7 prim-core collide-as) (-> self root-overide backup-collide-as)) - (set! (-> v1-7 prim-core collide-with) (-> self root-overide backup-collide-with)) + (let ((root-prim (-> self root-overide root-prim))) + (set! (-> root-prim prim-core collide-as) (-> self root-overide backup-collide-as)) + (set! (-> root-prim prim-core collide-with) (-> self root-overide backup-collide-with)) ) (set! (-> self no-collision-timer) (the-as uint 0)) 0 ) - (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-0 options) (overlaps-others-options oo0)) - (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) - (set! (-> a1-0 tlist) *touching-list*) - (find-overlapping-shapes (-> self root-overide) a1-0) + (let ((overlap-params (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> overlap-params options) (overlaps-others-options oo0)) + (set! (-> overlap-params collide-with-filter) (the-as collide-spec -1)) + (set! (-> overlap-params tlist) *touching-list*) + (find-overlapping-shapes (-> self root-overide) overlap-params) ) (none) ) @@ -885,7 +889,7 @@ This commonly includes things such as: (none) ) :post (behavior () - (sew-blade-method-20 self) + (update-sound! self) (transform-post) (none) ) @@ -894,7 +898,7 @@ This commonly includes things such as: ;; definition for method 11 of type sew-twist-blade ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-twist-blade ((obj sew-twist-blade) (arg0 entity-actor)) +(defmethod init-from-entity! sew-twist-blade ((obj sew-twist-blade) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -902,30 +906,30 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) - (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid deadly)) - (set! (-> s3-0 transform-index) 0) - (set-vector! (-> s3-0 local-sphere) 40960.0 0.0 0.0 49152.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) s3-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec camera-blocker pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid deadly)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 40960.0 0.0 0.0 49152.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s4-0) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-17 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-17 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-overide) s4-0) + (set! (-> obj root-overide) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -937,15 +941,13 @@ This commonly includes things such as: (set-falloff-far! (-> obj sound) 245760.0) (set! (-> obj y-min) -4096.0) (set! (-> obj y-max) 4096.0) - (set! (-> obj snd-water) - (the-as uint128 (make-u128 (the-as uint #x772d656461) (the-as uint #x6c622d7473697774))) - ) - (set! (-> obj snd-no-water) (the-as uint128 (make-u128 #x656461 (the-as uint #x6c622d7473697774)))) - (let* ((v1-34 *game-info*) - (a0-18 (+ (-> v1-34 attack-id) 1)) + (set! (-> obj snd-water) (static-sound-name "twist-blade-w")) + (set! (-> obj snd-no-water) (static-sound-name "twist-blade")) + (let* ((game-info *game-info*) + (id (+ (-> game-info attack-id) 1)) ) - (set! (-> v1-34 attack-id) a0-18) - (set! (-> obj attack-id) a0-18) + (set! (-> game-info attack-id) id) + (set! (-> obj attack-id) id) ) (go (method-of-object obj idle)) (none) @@ -964,8 +966,8 @@ This commonly includes things such as: (:methods (idle () _type_ :state 20) (pressed () _type_ :state 21) - (sew-light-switch-method-22 (_type_) none 22) - (sew-light-switch-method-23 (_type_ symbol) none 23) + (init-switch-collision! (_type_) none 22) + (broadcast-to-actors (_type_ symbol) none 23) ) ) @@ -1001,7 +1003,7 @@ This commonly includes things such as: :flag-assert #x1100100090 (:methods (idle () _type_ :state 14) - (sew-light-control-method-15 (_type_ symbol symbol) float 15) + (press! (_type_ symbol symbol) float 15) (sew-light-control-method-16 (_type_ object vector float) symbol 16) ) ) @@ -1035,19 +1037,19 @@ This commonly includes things such as: :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type (('trigger) - (sew-light-switch-method-23 self 'cue-chase) + (broadcast-to-actors self 'cue-chase) (go-virtual pressed) ) (('touch 'attack) (let* ((gp-0 (-> event param 0)) - (s5-0 proc) - (v1-6 (if (type? s5-0 target) - s5-0 - ) - ) + (_proc proc) + (target-proc (if (type? _proc target) + _proc + ) + ) ) - (when (and gp-0 v1-6) - (sew-light-switch-method-23 self 'cue-chase) + (when (and gp-0 target-proc) + (broadcast-to-actors self 'cue-chase) (go-virtual pressed) ) ) @@ -1111,51 +1113,54 @@ This commonly includes things such as: ;; definition for method 22 of type sew-light-switch ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod sew-light-switch-method-22 sew-light-switch ((obj sew-light-switch)) - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) +(defmethod init-switch-collision! sew-light-switch ((obj sew-light-switch)) + "Initializes the collision on the switch" + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-6 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-6 prim-core action) (collide-action solid rideable)) - (set! (-> v1-6 transform-index) 3) - (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 4096.0) - (set! (-> s5-0 total-prims) (the-as uint 1)) - (set! (-> s5-0 root-prim) v1-6) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-9 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s5-0) + (set! (-> obj root) cshape) ) (none) ) ;; definition for method 23 of type sew-light-switch ;; WARN: Return type mismatch object vs none. -(defmethod sew-light-switch-method-23 sew-light-switch ((obj sew-light-switch) (arg0 symbol)) +(defmethod broadcast-to-actors sew-light-switch ((obj sew-light-switch) (event-type symbol)) + "Broadcast event to all associated [[entity]]s via the `actor-group`s +@param `event-type` the symbol to broadcast" (with-pp - (dotimes (s4-0 (-> obj actor-group-count)) - (let ((s3-0 (-> obj actor-group s4-0))) - (dotimes (s2-0 (-> s3-0 length)) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer pp)) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) arg0) - (let ((t9-0 send-event-function) - (v1-5 (-> s3-0 data s2-0 actor)) + (dotimes (group-idx (-> obj actor-group-count)) + (let ((group (-> obj actor-group group-idx))) + (dotimes (actor-idx (-> group length)) + (let ((evt (new 'stack-no-clear 'event-message-block))) + (set! (-> evt from) (process->ppointer pp)) + (set! (-> evt num-params) 0) + (set! (-> evt message) event-type) + (let ((func send-event-function) + (actor (-> group data actor-idx actor)) ) - (t9-0 - (if v1-5 - (-> v1-5 extra process) + (func + (if actor + (-> actor extra process) ) - a1-1 + evt ) ) ) @@ -1163,7 +1168,7 @@ This commonly includes things such as: ) ) (if (-> *game-info* controller 0) - (send-event (-> *game-info* controller 0 process 0) arg0) + (send-event (-> *game-info* controller 0 process 0) event-type) ) (none) ) @@ -1172,28 +1177,28 @@ This commonly includes things such as: ;; definition for method 11 of type sew-light-switch ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! sew-light-switch ((obj sew-light-switch) (arg0 entity-actor)) +(defmethod init-from-entity! sew-light-switch ((obj sew-light-switch) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) - (sew-light-switch-method-22 obj) - (process-drawable-from-entity! obj arg0) + (local-vars (tag res-tag)) + (init-switch-collision! obj) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-sew-light-switch" (the-as (pointer uint32) #f))) (the-as pair 0) ) (process-entity-status! obj (entity-perm-status no-kill) #t) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (set! tag (new 'static 'res-tag)) + (let ((data (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& tag)))) (cond - ((and v1-6 (nonzero? (-> sv-16 elt-count))) - (set! (-> obj actor-group) (the-as (pointer actor-group) v1-6)) - (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) + ((and data (nonzero? (-> tag elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) data)) + (set! (-> obj actor-group-count) (the-as int (-> tag elt-count))) ) (else (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) @@ -1210,6 +1215,8 @@ This commonly includes things such as: ;; definition for method 16 of type sew-light-control ;; ERROR: failed type prop at 53: Could not figure out load: (set! v1 (l.w s4)) (defmethod sew-light-control-method-16 sew-light-control ((a0-0 sew-light-control) (a1-0 object) (a2-0 vector) (a3-0 float)) + "@unused +@TODO - not done yet, no callers?" (local-vars (v0-0 symbol) (v0-1 none) @@ -1323,17 +1330,17 @@ This commonly includes things such as: (defstate idle (sew-light-control) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 entity)) + (local-vars (actor entity)) (the-as object (case event-type (('use-switch) - (set! v0-0 (entity-by-name (the-as string (-> event param 0)))) - (set! (-> self switch-ent) (the-as entity-actor v0-0)) - v0-0 + (set! actor (entity-by-name (the-as string (-> event param 0)))) + (set! (-> self switch-ent) (the-as entity-actor actor)) + actor ) (('use-turret) - (set! v0-0 (entity-by-name (the-as string (-> event param 0)))) - (set! (-> self turret-ent) (the-as entity-actor v0-0)) - v0-0 + (set! actor (entity-by-name (the-as string (-> event param 0)))) + (set! (-> self turret-ent) (the-as entity-actor actor)) + actor ) ) ) @@ -1346,43 +1353,43 @@ This commonly includes things such as: (none) ) :post (behavior () - (let* ((gp-0 *target*) - (a0-1 (if (type? gp-0 process-focusable) - gp-0 - ) - ) + (let* ((target *target*) + (target-proc (if (type? target process-focusable) + target + ) + ) ) - (when a0-1 - (get-trans a0-1 0) - (let ((gp-1 #f) - (a2-0 (the-as object #f)) + (when target-proc + (get-trans target-proc 0) + (let ((switch-pressed? #f) + (should-flash? (the-as object #f)) ) - (let* ((a0-2 (-> self switch-ent)) - (v1-2 (if a0-2 - (-> a0-2 extra process) - ) - ) + (let* ((switch (-> self switch-ent)) + (switch-proc (if switch + (-> switch extra process) + ) + ) ) - (if v1-2 - (set! gp-1 (-> (the-as sew-light-switch v1-2) light-state)) + (if switch-proc + (set! switch-pressed? (-> (the-as sew-light-switch switch-proc) light-state)) ) ) - (let* ((v1-4 (-> self turret-ent)) - (a0-5 (if v1-4 - (-> v1-4 extra process) - ) - ) + (let* ((turret (-> self turret-ent)) + (turret-proc (if turret + (-> turret extra process) + ) + ) ) - (when a0-5 + (when turret-proc (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer self)) (set! (-> a1-2 num-params) 0) (set! (-> a1-2 message) 'flash-state) - (set! a2-0 (send-event-function a0-5 a1-2)) + (set! should-flash? (send-event-function turret-proc a1-2)) ) ) ) - (sew-light-control-method-15 self gp-1 (the-as symbol a2-0)) + (press! self switch-pressed? (the-as symbol should-flash?)) ) ) ) @@ -1391,21 +1398,27 @@ This commonly includes things such as: ) ;; definition for method 15 of type sew-light-control -(defmethod sew-light-control-method-15 sew-light-control ((obj sew-light-control) (arg0 symbol) (arg1 symbol)) - (set-sewer-lights-flag! arg0) - (if arg1 +(defmethod press! sew-light-control ((obj sew-light-control) (switched-on? symbol) (should-turret-flash? symbol)) + "Turns the lights on (or off) +@param switched-on? Should the sewer lights be turned on or off? +@param should-turret-flash? Should the turret have it's `flash` set as well" + (set-sewer-lights-flag! switched-on?) + (if should-turret-flash? (set-sewer-turret-flash!) ) ) ;; definition for function sew-light-control-init-by-other ;; WARN: Return type mismatch object vs none. -(defbehavior sew-light-control-init-by-other sew-light-control ((arg0 entity-actor) (arg1 entity-actor)) - (process-entity-set! self arg0) +(defbehavior sew-light-control-init-by-other sew-light-control ((switch entity-actor) (turret entity-actor)) + "Creates a [[sew-light-control]] given two entities for the turret and switch itself +@param switch The entity for the switch +@param turret The entity for the turret" + (process-entity-set! self switch) (set! (-> *game-info* controller 0) (process->handle self)) - (set! (-> self switch-ent) arg0) - (set! (-> self turret-ent) arg1) - (sew-light-control-method-15 self #f #f) + (set! (-> self switch-ent) switch) + (set! (-> self turret-ent) turret) + (press! self #f #f) (go-virtual idle) (none) ) @@ -1413,14 +1426,17 @@ This commonly includes things such as: ;; definition for function sewer-startup ;; WARN: Return type mismatch int vs none. (defun sewer-startup () + "Basic house-keeping for starting the sewer area: +- sets up the bigmap +- spawns the first switch and turret" (cond ((task-node-closed? (game-task-node sewer-board-introduction)) - (set! (-> sewer bigmap-id) (the-as uint 15)) - (set! (-> sewerb bigmap-id) (the-as uint 15)) + (set! (-> sewer bigmap-id) (bigmap-id sewer-with-board-area)) + (set! (-> sewerb bigmap-id) (bigmap-id sewer-with-board-area)) ) (else - (set! (-> sewer bigmap-id) (the-as uint 14)) - (set! (-> sewerb bigmap-id) (the-as uint 14)) + (set! (-> sewer bigmap-id) (bigmap-id sewer-default)) + (set! (-> sewerb bigmap-id) (bigmap-id sewer-default)) ) ) (process-spawn diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-part_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-part_REF.gc index 018d664ffd..e9e5e77c80 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-part_REF.gc @@ -202,6 +202,7 @@ ;; definition for function sewer-drop-birth-func ;; WARN: Return type mismatch int vs none. (defun sewer-drop-birth-func ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Resets the timer to birth a new water drop" (when (>= (get-height *ocean* (-> arg2 launchrot) #t) (-> arg2 launchrot y)) (set! (-> arg1 timer) 0) 0 @@ -213,6 +214,7 @@ ;; definition for function check-drop-level-sewer-drop ;; INFO: Used lq/sq (defun check-drop-level-sewer-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds" (let ((f30-0 (-> arg1 key origin trans y)) (f28-0 (-> arg2 vector 0 y)) (s5-0 #f) @@ -362,23 +364,26 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun sewer-drop2-birth-func ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + "Resets the timer to birth a new water drop" (when (>= (get-height *ocean* (-> arg2 launchrot) #t) (-> arg2 launchrot y)) (set! (-> arg1 timer) 0) 0 ) - (let ((s4-0 (new 'stack-no-clear 'collide-query))) - (set! (-> s4-0 start-pos quad) (-> arg2 launchrot quad)) - (set-vector! (-> s4-0 move-dist) 0.0 -204800.0 0.0 1.0) - (let ((v1-6 s4-0)) - (set! (-> v1-6 radius) 40.96) - (set! (-> v1-6 collide-with) (collide-spec backgnd)) - (set! (-> v1-6 ignore-process0) #f) - (set! (-> v1-6 ignore-process1) #f) - (set! (-> v1-6 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-6 action-mask) (collide-action solid)) + (let ((cquery (new 'stack-no-clear 'collide-query))) + (set! (-> cquery start-pos quad) (-> arg2 launchrot quad)) + (set-vector! (-> cquery move-dist) 0.0 -204800.0 0.0 1.0) + (let ((_cquery cquery)) + (set! (-> _cquery radius) 40.96) + (set! (-> _cquery collide-with) (collide-spec backgnd)) + (set! (-> _cquery ignore-process0) #f) + (set! (-> _cquery ignore-process1) #f) + (set! (-> _cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> _cquery action-mask) (collide-action solid)) ) - (if (>= (fill-and-probe-using-line-sphere *collide-cache* s4-0) 0.0) - (set! (-> arg1 user-float) (-> s4-0 best-other-tri intersect y)) + (if (>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0) + (set! (-> arg1 user-float) (-> cquery best-other-tri intersect y)) (set! (-> arg1 user-float) (+ -204800.0 (-> arg2 launchrot y))) ) ) @@ -389,6 +394,7 @@ ;; definition for function check-drop2-level-sewer-drop ;; INFO: Used lq/sq (defun check-drop2-level-sewer-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds" (-> arg1 key) (let ((f30-0 (-> arg1 user-float)) (f28-0 (-> arg2 vector 0 y)) @@ -548,7 +554,3 @@ (sp-flt spt-rotate-y (degrees 0.0)) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc b/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc index 4b4b2ec34d..ad0748520f 100644 --- a/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc @@ -976,7 +976,7 @@ This commonly includes things such as: ) ) :code (behavior () - (talker-speech-class-method-10 (-> *talker-speech* 194)) + (play-communicator-speech! (-> *talker-speech* 194)) (process-entity-status! self (entity-perm-status subtask-complete) #t) (kill-and-free-particles (-> self part)) (stop! (-> self sound)) @@ -1385,7 +1385,7 @@ This commonly includes things such as: ) ;; definition for method 28 of type grenade -;; WARN: Return type mismatch int vs sound-id. +;; WARN: Return type mismatch int vs none. (defmethod play-impact-sound grenade ((obj grenade) (arg0 projectile-options)) (let ((v1-0 arg0)) (cond @@ -1397,7 +1397,8 @@ This commonly includes things such as: ) ) ) - (the-as sound-id 0) + 0 + (none) ) ;; failed to figure out what this is: @@ -1539,7 +1540,7 @@ This commonly includes things such as: ;; definition for method 30 of type grenade ;; WARN: Return type mismatch collide-shape-moving vs none. -(defmethod init-collision! grenade ((obj grenade)) +(defmethod init-proj-collision! grenade ((obj grenade)) "Init the [[projectile]]'s [[collide-shape]]" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) diff --git a/test/decompiler/reference/jak2/levels/temple/canyon/mincan-obs_REF.gc b/test/decompiler/reference/jak2/levels/temple/canyon/mincan-obs_REF.gc index 8e46d64196..0d49f6ad27 100644 --- a/test/decompiler/reference/jak2/levels/temple/canyon/mincan-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/canyon/mincan-obs_REF.gc @@ -39,9 +39,9 @@ ;; definition for method 24 of type water-anim-mincan ;; WARN: Return type mismatch int vs none. -(defmethod art-init! water-anim-mincan ((obj water-anim-mincan)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((func (method-of-type water-anim art-init!))) +(defmethod init-water! water-anim-mincan ((obj water-anim-mincan)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((func (method-of-type water-anim init-water!))) (func obj) ) (let ((ripple-control (new 'process 'ripple-control))) diff --git a/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc b/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc index 623ca12bdc..82b44eacc6 100644 --- a/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/mountain-obs2_REF.gc @@ -45,9 +45,9 @@ (none) ) :code (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (-> self root-override backup-collide-as)) - (set! (-> v1-1 prim-core collide-with) (-> self root-override backup-collide-with)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (-> self root-override backup-collide-as)) + (set! (-> root-prim prim-core collide-with) (-> self root-override backup-collide-with)) ) (ja :num-func num-func-identity :frame-num 0.0) (ja-post) @@ -66,9 +66,9 @@ (none) ) :code (behavior () - (let ((v1-1 (-> self root-override root-prim))) - (set! (-> v1-1 prim-core collide-as) (collide-spec)) - (set! (-> v1-1 prim-core collide-with) (collide-spec)) + (let ((root-prim (-> self root-override root-prim))) + (set! (-> root-prim prim-core collide-as) (collide-spec)) + (set! (-> root-prim prim-core collide-with) (collide-spec)) ) 0 (ja :num-func num-func-identity :frame-num max) @@ -80,31 +80,31 @@ ;; definition for method 11 of type mtn-iris-door ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-iris-door ((obj mtn-iris-door) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-iris-door ((obj mtn-iris-door) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 3) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 40960.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 40960.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-mtn-iris-door" (the-as (pointer uint32) #f))) @@ -125,7 +125,7 @@ This commonly includes things such as: (time-flip float :offset-assert 368) (disable-track-under basic :offset-assert 372) (dest-angle float :offset-assert 376) - (on-shake basic :offset-assert 380) + (on-shake symbol :offset-assert 380) (hint-count float :offset-assert 384) ) :heap-base #x110 @@ -174,23 +174,23 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defmethod init-plat-collision! mtn-plat-shoot ((obj mtn-plat-shoot)) "TODO - collision stuff for setting up the platform" - (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid rideable)) - (set! (-> s4-0 transform-index) 0) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 20889.6) - (set! (-> s5-0 total-prims) (the-as uint 1)) - (set! (-> s5-0 root-prim) s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 20889.6) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s5-0) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-11 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s5-0) + (set! (-> obj root-override) cshape) ) 0 (none) @@ -240,30 +240,30 @@ For example for an elevator pre-compute the distance between the first and last ) (('attack) (when (zero? (-> self state-flip)) - (let ((v1-3 (the-as object (-> event param 1)))) - (when (!= (-> (the-as attack-info v1-3) id) (-> self incoming-attack-id)) - (set! (-> self incoming-attack-id) (-> (the-as attack-info v1-3) id)) - (let* ((gp-0 proc) - (v1-5 (if (type? gp-0 process-drawable) - (the-as process-drawable gp-0) - ) - ) - ) - (when v1-5 - (let* ((s5-0 (-> v1-5 root)) - (gp-1 (if (type? s5-0 collide-shape) - (the-as collide-shape s5-0) + (let ((attack-info (the-as object (-> event param 1)))) + (when (!= (-> (the-as attack-info attack-info) id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> (the-as attack-info attack-info) id)) + (let* ((attacking-proc proc) + (attacker (if (type? attacking-proc process-drawable) + (the-as process-drawable attacking-proc) ) ) + ) + (when attacker + (let* ((attacker-root (-> attacker root)) + (cshape (if (type? attacker-root collide-shape) + (the-as collide-shape attacker-root) + ) + ) ) - (when gp-1 - (when (logtest? (-> gp-1 root-prim prim-core collide-as) (collide-spec projectile)) + (when cshape + (when (logtest? (-> cshape root-prim prim-core collide-as) (collide-spec projectile)) (when (zero? (-> self state-flip)) (sound-play "mtn-plat-flip1") (set! (-> self state-flip) (the-as uint 1)) ) (set! (-> self hint-count) -1.0) - (vector-! (-> self axe-flip) (-> gp-1 trans) (-> self root-override trans)) + (vector-! (-> self axe-flip) (-> cshape trans) (-> self root-override trans)) (set! (-> self axe-flip y) 0.0) (vector-normalize! (-> self axe-flip) 1.0) (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) @@ -311,9 +311,9 @@ For example for an elevator pre-compute the distance between the first and last ) ) :enter (behavior () - (let ((t9-0 (-> (method-of-type plat plat-path-active) enter))) - (if t9-0 - (t9-0) + (let ((func (-> (method-of-type plat plat-path-active) enter))) + (if func + (func) ) ) (set! (-> self dest-angle) 180.0) @@ -351,7 +351,7 @@ For example for an elevator pre-compute the distance between the first and last ) (when (not (-> self on-shake)) (sound-play "mtn-plat-shake") - (set! (-> self on-shake) (the-as basic #t)) + (set! (-> self on-shake) #t) ) (let ((s5-2 (new 'stack-no-clear 'vector)) (gp-2 (new 'stack-no-clear 'quaternion)) @@ -374,17 +374,17 @@ For example for an elevator pre-compute the distance between the first and last ) ) (quaternion-normalize! (-> self root-override quat)) - (let ((t9-12 (-> (method-of-type plat plat-path-active) trans))) - (if t9-12 - (t9-12) + (let ((func (-> (method-of-type plat plat-path-active) trans))) + (if func + (func) ) ) (none) ) :post (behavior () - (let ((t9-0 (-> (method-of-type plat plat-path-active) post))) - (if t9-0 - ((the-as (function none) t9-0)) + (let ((func (-> (method-of-type plat plat-path-active) post))) + (if func + ((the-as (function none) func)) ) ) (none) @@ -398,21 +398,21 @@ For example for an elevator pre-compute the distance between the first and last 3 (lambda :behavior task-manager () - (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) - (set! (-> gp-0 pos quad) (-> self info end-sphere quad)) - (quaternion-identity! (-> gp-0 quat)) - (set! (-> gp-0 flags) (task-arrow-flags)) - (set! (-> gp-0 map-icon) (the-as uint 15)) - (set! (-> self arrow) (process->handle (task-arrow-spawn gp-0 (the-as task-arrow self)))) + (let ((arrow-params (new 'stack-no-clear 'task-arrow-params))) + (set! (-> arrow-params pos quad) (-> self info end-sphere quad)) + (quaternion-identity! (-> arrow-params quat)) + (set! (-> arrow-params flags) (task-arrow-flags)) + (set! (-> arrow-params map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn arrow-params (the-as task-arrow self)))) ) (until #f - (let ((f0-0 (vector-vector-distance (target-pos 0) (-> self info end-sphere)))) + (let ((dist-from-target (vector-vector-distance (target-pos 0) (-> self info end-sphere)))) (cond - ((< f0-0 (-> self info end-sphere r)) + ((< dist-from-target (-> self info end-sphere r)) (send-event (handle->process (-> self arrow)) 'leave) (go-virtual complete) ) - ((< f0-0 (* 6.0 (-> self info end-sphere r))) + ((< dist-from-target (* 6.0 (-> self info end-sphere r))) (gui-control-method-12 *gui-control* self diff --git a/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc b/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc index 7adb1cd6d7..9515adecff 100644 --- a/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/mountain-obs_REF.gc @@ -3524,9 +3524,9 @@ This commonly includes things such as: ;; definition for method 24 of type water-anim-mountain ;; WARN: Return type mismatch int vs none. -(defmethod art-init! water-anim-mountain ((obj water-anim-mountain)) - "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." - (let ((t9-0 (method-of-type water-anim art-init!))) +(defmethod init-water! water-anim-mountain ((obj water-anim-mountain)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) (t9-0 obj) ) (let ((v1-2 (new 'process 'ripple-control))) diff --git a/test/decompiler/reference/jak2/levels/temple/mountain-part_REF.gc b/test/decompiler/reference/jak2/levels/temple/mountain-part_REF.gc index 68ee9a0537..7ec1b16ccc 100644 --- a/test/decompiler/reference/jak2/levels/temple/mountain-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/mountain-part_REF.gc @@ -2041,17 +2041,18 @@ ;; definition for function check-drop-level-mountain-drop-userdata ;; INFO: Used lq/sq (defun check-drop-level-mountain-drop-userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + "Ensure the waterfall drops don't go below the specified y-value" (when (< (-> arg2 vector 0 y) (-> arg1 user-float)) - (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((vec (new 'stack-no-clear 'vector))) (sp-kill-particle arg0 arg1) - (set-vector! s3-0 (-> arg2 vector 0 x) (-> arg1 user-float) (-> arg2 vector 0 z) 1.0) - (let ((t9-1 sp-launch-particles-var) - (a0-3 *sp-particle-system-3d*) - (a1-2 (-> *part-id-table* 1591)) - (a2-1 *launch-matrix*) + (set-vector! vec (-> arg2 vector 0 x) (-> arg1 user-float) (-> arg2 vector 0 z) 1.0) + (let ((func sp-launch-particles-var) + (sys *sp-particle-system-3d*) + (launcher (-> *part-id-table* 1591)) + (matrix *launch-matrix*) ) - (set! (-> a2-1 trans quad) (-> s3-0 quad)) - (t9-1 a0-3 a1-2 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> matrix trans quad) (-> vec quad)) + (func sys launcher matrix (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -2713,7 +2714,3 @@ (sp-rnd-flt spt-fade-a -0.18 -0.12 1.0) ) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/temple/mountain-scenes_REF.gc b/test/decompiler/reference/jak2/levels/temple/mountain-scenes_REF.gc index fa36167b45..8920e5a015 100644 --- a/test/decompiler/reference/jak2/levels/temple/mountain-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/mountain-scenes_REF.gc @@ -1798,31 +1798,31 @@ ;; definition for method 11 of type mtn-plat-buried-rocks ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-plat-buried-rocks ((obj mtn-plat-buried-rocks) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-plat-buried-rocks ((obj mtn-plat-buried-rocks) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 3) - (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 122880.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 122880.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((v1-5 (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> v1-5 prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as @@ -1975,28 +1975,28 @@ This commonly includes things such as: ;; WARN: Return type mismatch int vs none. (defmethod init-plat-collision! mtn-plat-buried ((obj mtn-plat-buried)) "TODO - collision stuff for setting up the platform" - (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) - (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) - (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) + (let ((cshape (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) + (set! (-> cshape reaction) cshape-reaction-default) + (set! (-> cshape no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) - (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s4-0 prim-core action) (collide-action solid rideable)) - (set! (-> s4-0 transform-index) 0) - (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 19660.8) - (set! (-> s5-0 total-prims) (the-as uint 1)) - (set! (-> s5-0 root-prim) s4-0) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec pusher)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid rideable)) + (set! (-> prim-mesh transform-index) 0) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 19660.8) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (pusher-init s5-0) - (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) - (let ((v1-15 (-> s5-0 root-prim))) - (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) - (set! (-> s5-0 backup-collide-with) (-> v1-15 prim-core collide-with)) + (pusher-init cshape) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s5-0) + (set! (-> obj root-override) cshape) ) (set! (-> obj sound) (new 'process 'ambient-sound (static-sound-spec "mtn-plat-lp" :fo-max 100) (-> obj root-override trans)) @@ -2058,9 +2058,9 @@ otherwise, [[plat::34]] ) (set! (-> self path-pos) (get-norm! (-> self sync) 0)) (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) - (let ((t9-3 (-> (method-of-type plat plat-idle) enter))) - (if t9-3 - (t9-3) + (let ((func (-> (method-of-type plat plat-idle) enter))) + (if func + (func) ) ) (none) @@ -2578,14 +2578,14 @@ otherwise, [[plat::34]] ) (355 (apply ,(lambda :behavior scene-player () - (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> v1-0 command) (sound-command set-param)) - (set! (-> v1-0 id) (-> self user-sound 0)) - (set! (-> v1-0 params volume) -4) - (set! (-> v1-0 auto-time) 48) - (set! (-> v1-0 auto-from) 2) - (set! (-> v1-0 params mask) (the-as uint 17)) - (-> v1-0 id) + (let ((sound-set-param (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> sound-set-param command) (sound-command set-param)) + (set! (-> sound-set-param id) (-> self user-sound 0)) + (set! (-> sound-set-param params volume) -4) + (set! (-> sound-set-param auto-time) 48) + (set! (-> sound-set-param auto-from) 2) + (set! (-> sound-set-param params mask) (the-as uint 17)) + (-> sound-set-param id) ) (none) ) @@ -3156,7 +3156,7 @@ otherwise, [[plat::34]] ;; definition for method 11 of type mtn-lens ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-lens ((obj mtn-lens) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-lens ((obj mtn-lens) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3164,7 +3164,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3209,7 +3209,7 @@ This commonly includes things such as: ;; definition for method 11 of type mtn-lens-base ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-lens-base ((obj mtn-lens-base) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-lens-base ((obj mtn-lens-base) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3217,7 +3217,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3274,31 +3274,31 @@ This commonly includes things such as: ;; definition for method 11 of type mtn-lens-floor ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-lens-floor ((obj mtn-lens-floor) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-lens-floor ((obj mtn-lens-floor) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size - collision information - loading the skeleton group / bones - sounds" - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) - (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) - (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) - (set! (-> v1-2 prim-core collide-with) (collide-spec jak bot player-list)) - (set! (-> v1-2 prim-core action) (collide-action solid)) - (set! (-> v1-2 transform-index) 3) - (set-vector! (-> v1-2 local-sphere) 0.0 -4096.0 0.0 26624.0) - (set! (-> s4-0 total-prims) (the-as uint 1)) - (set! (-> s4-0 root-prim) v1-2) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((prim-mesh (new 'process 'collide-shape-prim-mesh cshape (the-as uint 0) (the-as uint 0)))) + (set! (-> prim-mesh prim-core collide-as) (collide-spec obstacle)) + (set! (-> prim-mesh prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> prim-mesh prim-core action) (collide-action solid)) + (set! (-> prim-mesh transform-index) 3) + (set-vector! (-> prim-mesh local-sphere) 0.0 -4096.0 0.0 26624.0) + (set! (-> cshape total-prims) (the-as uint 1)) + (set! (-> cshape root-prim) prim-mesh) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-5 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root) s4-0) + (set! (-> obj root) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3347,7 +3347,7 @@ This commonly includes things such as: ;; definition for method 11 of type mtn-shard ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-shard ((obj mtn-shard) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-shard ((obj mtn-shard) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3355,7 +3355,7 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (set! (-> obj root) (new 'process 'trsqv)) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (logclear! (-> obj mask) (process-mask actor-pause)) (initialize-skeleton obj @@ -3391,7 +3391,7 @@ This commonly includes things such as: ;; definition for method 11 of type mtn-step-plat-rocks-a ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-step-plat-rocks-a ((obj mtn-step-plat-rocks-a) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-step-plat-rocks-a ((obj mtn-step-plat-rocks-a) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3399,35 +3399,35 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) - (set! (-> s4-0 total-prims) (the-as uint 4)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) 0.0 12288.0 0.0 20480.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) + (set! (-> cshape total-prims) (the-as uint 4)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 12288.0 0.0 20480.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 4 16384) (1 7 16384) (2 12 16384))) (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) @@ -3435,14 +3435,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-24 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as @@ -3490,7 +3490,7 @@ This commonly includes things such as: ;; definition for method 11 of type mtn-step-plat-rocks-b ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-step-plat-rocks-b ((obj mtn-step-plat-rocks-b) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-step-plat-rocks-b ((obj mtn-step-plat-rocks-b) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3498,16 +3498,16 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 17) 0))) - (set! (-> s4-0 total-prims) (the-as uint 18)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) 0.0 -12288.0 0.0 40960.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 17) 0))) + (set! (-> cshape total-prims) (the-as uint 18)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 -12288.0 0.0 40960.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 6 16384) (1 7 16384) (2 8 16384) @@ -3530,21 +3530,21 @@ This commonly includes things such as: (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) @@ -3552,14 +3552,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-24 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as @@ -3607,7 +3607,7 @@ This commonly includes things such as: ;; definition for method 11 of type mtn-step-plat-rocks-c ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. -(defmethod init-from-entity! mtn-step-plat-rocks-c ((obj mtn-step-plat-rocks-c) (arg0 entity-actor)) +(defmethod init-from-entity! mtn-step-plat-rocks-c ((obj mtn-step-plat-rocks-c) (entity entity-actor)) "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. This commonly includes things such as: - stack size @@ -3615,16 +3615,16 @@ This commonly includes things such as: - loading the skeleton group / bones - sounds" (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) - (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 24) 0))) - (set! (-> s4-0 total-prims) (the-as uint 25)) - (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) - (set! (-> s3-0 prim-core collide-with) (collide-spec jak player-list)) - (set! (-> s3-0 prim-core action) (collide-action solid)) - (set! (-> s3-0 transform-index) 3) - (set-vector! (-> s3-0 local-sphere) 0.0 0.0 32768.0 57344.0) - (set! (-> s4-0 root-prim) s3-0) - (pusher-init s4-0) + (let ((cshape (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 24) 0))) + (set! (-> cshape total-prims) (the-as uint 25)) + (set! (-> prim-group prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> prim-group prim-core collide-with) (collide-spec jak player-list)) + (set! (-> prim-group prim-core action) (collide-action solid)) + (set! (-> prim-group transform-index) 3) + (set-vector! (-> prim-group local-sphere) 0.0 0.0 32768.0 57344.0) + (set! (-> cshape root-prim) prim-group) + (pusher-init cshape) (let* ((s2-0 '((0 4 16384) (1 6 16384) (2 9 16384) @@ -3654,21 +3654,21 @@ This commonly includes things such as: (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) + (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) (set! sv-32 'process) (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) + (set! sv-64 cshape) (let ((a3-2 (command-get-int (car s1-0) 0)) (t0-1 0) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) ) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) @@ -3676,14 +3676,14 @@ This commonly includes things such as: ) ) ) - (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) - (let ((v1-24 (-> s4-0 root-prim))) - (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) - (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + (set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w))) + (let ((root-prim (-> cshape root-prim))) + (set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as)) + (set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with)) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override) cshape) ) - (process-drawable-from-entity! obj arg0) + (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as diff --git a/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc b/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc index 9965780b6f..fac4c51cb6 100644 --- a/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc +++ b/test/decompiler/reference/jak2/levels/temple/rhino_REF.gc @@ -440,7 +440,69 @@ :default-hit-points 35 :gnd-collide-with (collide-spec backgnd) :overlaps-others-collide-with-filter (collide-spec jak bot player-list) - :penetrate-flinch #xfffffffff5dfffff + :penetrate-flinch (penetrate + touch + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + mech-bonk + dark-skin + dark-punch + dark-bomb + dark-giant + shield + jak-yellow-shot + jak-red-shot + jak-blue-shot + enemy-yellow-shot + eco-yellow + eco-red + eco-blue + eco-green + knocked + penetrate-33 + penetrate-34 + penetrate-35 + penetrate-36 + penetrate-37 + penetrate-38 + penetrate-39 + penetrate-40 + penetrate-41 + penetrate-42 + penetrate-43 + penetrate-44 + penetrate-45 + penetrate-46 + penetrate-47 + penetrate-48 + penetrate-49 + penetrate-50 + penetrate-51 + penetrate-52 + penetrate-53 + penetrate-54 + penetrate-55 + penetrate-56 + penetrate-57 + penetrate-58 + penetrate-59 + penetrate-60 + penetrate-61 + penetrate-62 + penetrate-63 + ) :movement-gravity (meters -100) :friction 0.8 :attack-shove-back (meters 4) @@ -574,7 +636,9 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 272] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 318] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 323] -(defmethod enemy-method-74 rhino ((obj rhino) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) +(defmethod general-event-handler rhino ((obj rhino) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" (local-vars (sv-96 int) (sv-112 symbol) @@ -603,10 +667,10 @@ ((zero? (-> obj hit-points)) (set! (-> *rhino-nav-enemy-info* die-anim) 15) (set! (-> obj frame-die-smush) 11.0) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -615,7 +679,7 @@ ((zero? (-> obj hit-points)) (set! (-> *rhino-nav-enemy-info* die-anim) 14) (set! (-> obj frame-die-smush) 16.0) - (enemy-method-73 obj) + (kill-prefer-falling obj) ) (else (let* ((s5-0 arg0) @@ -764,10 +828,10 @@ (set! (-> v1-74 prim-core collide-with) (collide-spec)) ) 0 - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) (else - ((method-of-type nav-enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) ) ) ) @@ -820,7 +884,7 @@ ) ) (else - (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self state-timeout))) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0) ) (go-virtual active) @@ -836,7 +900,7 @@ :virtual #t :enter (behavior () (remove-setting! 'sound-mode) - (enemy-method-132 self) + (dispose! self) (set! (-> self hit-points) 0) 0 (none) @@ -952,7 +1016,8 @@ ) ;; definition for method 56 of type rhino -(defmethod enemy-method-56 rhino ((obj rhino) (arg0 process) (arg1 event-message-block)) +(defmethod damage-amount-from-attack rhino ((obj 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 (-> obj incoming penetrate-using)))))) (cond @@ -1235,7 +1300,7 @@ (vector-vector-xz-distance (get-trans (the-as process-focusable a0-37) 0) (-> self root-override2 trans)) ) (ja-channel-push! 1 (seconds 0.075)) - (enemy-method-72 self) + (react-to-focus self) ) (else (go-virtual run-away) @@ -1244,7 +1309,7 @@ ) (else (ja-channel-push! 1 (seconds 0.075)) - (enemy-method-72 self) + (react-to-focus self) ) ) ) @@ -1370,7 +1435,7 @@ (vector-! gp-0 s2-0 (-> self root-override2 trans)) (vector-normalize! gp-0 (+ 16384.0 (vector-length gp-0))) (vector+! s4-0 (-> self root-override2 trans) gp-0) - (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (and (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 40960.0 ) @@ -1382,7 +1447,7 @@ (cond ((-> self charge-straight) (cond - ((>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self reaction-time))) + ((>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) (if (< (vector-vector-xz-distance (get-trans (the-as process-focusable s3-0) 0) (-> self root-override2 trans)) 20480.0 ) @@ -1905,8 +1970,8 @@ ;; definition for method 114 of type rhino ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-114 rhino ((obj rhino)) - "@abstract" +(defmethod init-enemy-collision! rhino ((obj rhino)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -1991,8 +2056,8 @@ ;; definition for method 115 of type rhino ;; WARN: Return type mismatch int vs none. -(defmethod enemy-method-115 rhino ((obj rhino)) - "@abstract" +(defmethod init-enemy! rhino ((obj rhino)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (stack-size-set! (-> obj main-thread) 256) (initialize-skeleton obj @@ -2000,7 +2065,7 @@ (the-as pair 0) ) (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) - (enemy-method-113 obj *rhino-nav-enemy-info*) + (init-enemy-behaviour-and-stats! obj *rhino-nav-enemy-info*) (let ((v1-8 (-> obj neck))) (set! (-> v1-8 up) (the-as uint 1)) (set! (-> v1-8 nose) (the-as uint 2)) diff --git a/test/offline/framework/orchestration.cpp b/test/offline/framework/orchestration.cpp index 02ee1b8c22..bb506240da 100644 --- a/test/offline/framework/orchestration.cpp +++ b/test/offline/framework/orchestration.cpp @@ -330,7 +330,7 @@ void OfflineTestThreadManager::print_current_test_status(const OfflineTestConfig fmt::format("[{}/{}]", status->curr_step, status->total_steps), status->curr_file); threads_shown++; } - if (threads_hidden != 0) { + if (threads_hidden > 0) { fmt::print( fmt::fg(fmt::color::gray), "\33[2K\r+{} other threads. [{} | {} | {}]\n", threads_hidden, fmt::styled(g_offline_test_thread_manager.num_threads_pending(),