From 4d634cf50d6c5204daeb493382b441c0895dc4de Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Mon, 2 May 2022 23:35:17 +0100 Subject: [PATCH] [decomp] add a bunch of flag enums (#1350) * update refs * first pass * update refs 2 * update * update * update * stuff and things * accidentally wiped this * fancy decomp for static sound specs * clang * 5 more refs --- common/goos/PrettyPrinter2.cpp | 5 +- decompiler/IR2/Form.cpp | 1 - decompiler/analysis/find_defstates.cpp | 12 +- decompiler/config/all-types.gc | 445 +++- .../jak1_ntsc_black_label/type_casts.jsonc | 10 +- decompiler/util/data_decompile.cpp | 169 +- decompiler/util/sparticle_decompile.cpp | 2 +- goal_src/engine/ambient/ambient.gc | 8 +- goal_src/engine/ambient/mood.gc | 6 +- goal_src/engine/anim/aligner-h.gc | 41 +- goal_src/engine/anim/aligner.gc | 195 +- goal_src/engine/camera/cam-master.gc | 57 +- goal_src/engine/camera/cam-states.gc | 5 +- .../engine/collide/collide-reaction-target.gc | 37 +- goal_src/engine/collide/collide-shape-h.gc | 88 +- goal_src/engine/collide/collide-shape.gc | 44 +- goal_src/engine/collide/collide-target-h.gc | 4 +- goal_src/engine/debug/default-menu.gc | 23 +- goal_src/engine/draw/process-drawable.gc | 13 +- goal_src/engine/game/collectables-part.gc | 4 +- goal_src/engine/game/collectables.gc | 102 +- goal_src/engine/game/crates.gc | 15 +- goal_src/engine/game/effect-control.gc | 34 +- goal_src/engine/game/game-h.gc | 39 +- goal_src/engine/game/generic-obs.gc | 2 +- goal_src/engine/game/powerups.gc | 10 +- goal_src/engine/game/projectiles.gc | 18 +- goal_src/engine/game/task/process-taskable.gc | 15 +- goal_src/engine/gfx/shadow/shadow-cpu-h.gc | 39 +- goal_src/engine/gfx/shadow/shadow-cpu.gc | 13 +- goal_src/engine/gfx/shadow/shadow.gc | 2 +- goal_src/engine/gfx/water/water-h.gc | 106 +- goal_src/engine/gfx/water/water.gc | 153 +- goal_src/engine/nav/navigate.gc | 4 +- goal_src/engine/sound/gsound-h.gc | 57 +- goal_src/engine/sound/gsound.gc | 18 +- goal_src/engine/target/logic-target.gc | 152 +- goal_src/engine/target/surface-h.gc | 2162 ++++++++--------- goal_src/engine/target/target-death.gc | 51 +- goal_src/engine/target/target-h.gc | 2 +- goal_src/engine/target/target-handler.gc | 84 +- goal_src/engine/target/target-util.gc | 89 +- goal_src/engine/target/target.gc | 160 +- goal_src/engine/target/target2.gc | 106 +- goal_src/engine/ui/hud.gc | 2 +- goal_src/goos-lib.gs | 9 + goal_src/levels/beach/beach-obs.gc | 6 +- goal_src/levels/beach/beach-part.gc | 4 +- goal_src/levels/beach/bird-lady.gc | 11 +- goal_src/levels/beach/lurkercrab.gc | 2 +- goal_src/levels/beach/mayor.gc | 9 +- goal_src/levels/beach/sculptor.gc | 9 +- goal_src/levels/beach/seagull.gc | 8 +- goal_src/levels/citadel/citadel-obs.gc | 47 +- goal_src/levels/citadel/citadel-sages.gc | 33 +- goal_src/levels/citadel/citb-bunny.gc | 2 +- goal_src/levels/citadel/citb-plat.gc | 30 +- goal_src/levels/common/basebutton.gc | 8 +- goal_src/levels/common/baseplat.gc | 71 +- goal_src/levels/common/dark-eco-pool.gc | 35 +- goal_src/levels/common/nav-enemy.gc | 45 +- goal_src/levels/common/orb-cache.gc | 65 +- goal_src/levels/common/plat-button.gc | 30 +- goal_src/levels/common/sharkey.gc | 6 +- goal_src/levels/common/water-anim.gc | 238 +- goal_src/levels/darkcave/darkcave-obs.gc | 15 +- goal_src/levels/finalboss/final-door.gc | 6 +- goal_src/levels/finalboss/green-eco-lurker.gc | 14 +- goal_src/levels/finalboss/light-eco.gc | 18 +- goal_src/levels/finalboss/robotboss-misc.gc | 15 +- goal_src/levels/finalboss/robotboss-weapon.gc | 30 +- goal_src/levels/finalboss/robotboss.gc | 100 +- goal_src/levels/flut_common/flutflut.gc | 15 +- goal_src/levels/flut_common/target-flut.gc | 110 +- goal_src/levels/jungle/fisher.gc | 10 +- goal_src/levels/jungle/jungle-mirrors.gc | 36 +- goal_src/levels/jungle/junglefish.gc | 2 +- goal_src/levels/jungle/junglesnake.gc | 6 +- goal_src/levels/jungleb/plant-boss.gc | 2 +- goal_src/levels/lavatube/lavatube-obs.gc | 33 +- goal_src/levels/lavatube/lavatube-part.gc | 18 +- goal_src/levels/maincave/baby-spider.gc | 4 +- goal_src/levels/maincave/driller-lurker.gc | 35 +- goal_src/levels/maincave/gnawer.gc | 36 +- goal_src/levels/maincave/maincave-obs.gc | 54 +- goal_src/levels/maincave/mother-spider-egg.gc | 14 +- .../levels/maincave/mother-spider-proj.gc | 6 +- goal_src/levels/maincave/mother-spider.gc | 24 +- goal_src/levels/maincave/spiderwebs.gc | 2 +- goal_src/levels/misty/misty-conveyor.gc | 8 +- goal_src/levels/misty/misty-part.gc | 36 +- goal_src/levels/misty/mistycannon.gc | 28 +- goal_src/levels/misty/mud.gc | 4 +- goal_src/levels/misty/quicksandlurker.gc | 2 +- goal_src/levels/ogre/flying-lurker.gc | 12 +- goal_src/levels/ogre/ogre-obs.gc | 4 +- .../racer_common/collide-reaction-racer.gc | 31 +- goal_src/levels/racer_common/racer-states.gc | 43 +- goal_src/levels/racer_common/racer.gc | 15 +- goal_src/levels/racer_common/target-racer.gc | 50 +- goal_src/levels/rolling/rolling-obs.gc | 2 +- goal_src/levels/rolling/rolling-race-ring.gc | 15 +- goal_src/levels/snow/ice-cube.gc | 26 +- goal_src/levels/snow/snow-bumper.gc | 15 +- goal_src/levels/snow/snow-bunny.gc | 22 +- goal_src/levels/snow/snow-flutflut-obs.gc | 4 +- goal_src/levels/snow/snow-obs.gc | 47 +- goal_src/levels/snow/snow-ram-boss.gc | 10 +- goal_src/levels/sunken/bully.gc | 13 +- goal_src/levels/sunken/double-lurker.gc | 4 +- goal_src/levels/sunken/floating-launcher.gc | 4 +- goal_src/levels/sunken/helix-water.gc | 6 +- goal_src/levels/sunken/orbit-plat.gc | 9 +- goal_src/levels/sunken/puffer.gc | 17 +- goal_src/levels/sunken/qbert-plat.gc | 4 +- goal_src/levels/sunken/sun-exit-chamber.gc | 25 +- goal_src/levels/sunken/sunken-pipegame.gc | 4 +- goal_src/levels/sunken/sunken-water.gc | 38 +- goal_src/levels/sunken/target-tube.gc | 24 +- goal_src/levels/sunken/whirlpool.gc | 19 +- goal_src/levels/swamp/billy.gc | 2 +- goal_src/levels/swamp/kermit.gc | 27 +- goal_src/levels/swamp/swamp-rat.gc | 6 +- goal_src/levels/training/training-obs.gc | 30 +- goal_src/levels/training/training-part.gc | 11 +- goal_src/levels/village1/assistant.gc | 11 +- goal_src/levels/village1/explorer.gc | 11 +- goal_src/levels/village1/fishermans-boat.gc | 4 +- goal_src/levels/village1/village1-part.gc | 9 +- goal_src/levels/village1/village1-part2.gc | 9 +- goal_src/levels/village1/yakow.gc | 2 +- .../levels/village2/assistant-village2.gc | 26 +- goal_src/levels/village2/village2-obs.gc | 15 +- goal_src/levels/village2/village2-part.gc | 16 +- goal_src/levels/village2/warrior.gc | 9 +- .../levels/village3/assistant-village3.gc | 9 +- goal_src/levels/village3/minecart.gc | 15 +- goal_src/levels/village3/miners.gc | 22 +- goal_src/levels/village3/sage-village3.gc | 13 +- goal_src/levels/village3/village3-obs.gc | 12 +- goal_src/levels/village3/village3-part.gc | 41 +- goal_src/levels/village_common/oracle.gc | 15 +- .../levels/village_common/villagep-obs.gc | 15 +- .../decompiler/reference/decompiler-macros.gc | 34 + .../reference/engine/ambient/ambient_REF.gc | 8 +- .../reference/engine/ambient/mood_REF.gc | 6 +- .../reference/engine/anim/aligner-h_REF.gc | 2 +- .../reference/engine/anim/aligner_REF.gc | 8 +- .../reference/engine/camera/cam-master_REF.gc | 57 +- .../reference/engine/camera/cam-states_REF.gc | 5 +- .../engine/collide/collide-edge-grab_REF.gc | 810 ++++++ .../collide/collide-reaction-target_REF.gc | 436 ++++ .../engine/collide/collide-shape-h_REF.gc | 50 +- .../engine/collide/collide-shape-rider_REF.gc | 488 ++++ .../engine/collide/collide-target-h_REF.gc | 20 +- .../engine/debug/default-menu_REF.gc | 19 +- .../engine/draw/process-drawable_REF.gc | 13 +- .../engine/game/collectables-part_REF.gc | 4 +- .../reference/engine/game/collectables_REF.gc | 96 +- .../reference/engine/game/crates_REF.gc | 15 +- .../engine/game/effect-control_REF.gc | 24 +- .../reference/engine/game/game-h_REF.gc | 2 +- .../reference/engine/game/generic-obs_REF.gc | 2 +- .../reference/engine/game/powerups_REF.gc | 10 +- .../reference/engine/game/projectiles_REF.gc | 20 +- .../engine/game/task/process-taskable_REF.gc | 15 +- .../reference/engine/gfx/shadow/shadow_REF.gc | 2 +- .../reference/engine/gfx/water/water-h_REF.gc | 22 +- .../reference/engine/gfx/water/water_REF.gc | 156 +- .../reference/engine/nav/navigate_REF.gc | 4 +- .../reference/engine/sound/gsound-h_REF.gc | 22 +- .../reference/engine/sound/gsound_REF.gc | 12 +- .../engine/target/logic-target_REF.gc | 151 +- .../reference/engine/target/surface-h_REF.gc | 56 +- .../engine/target/target-death_REF.gc | 49 +- .../engine/target/target-handler_REF.gc | 82 +- .../engine/target/target-util_REF.gc | 89 +- .../reference/engine/target/target2_REF.gc | 106 +- .../reference/engine/target/target_REF.gc | 160 +- .../decompiler/reference/engine/ui/hud_REF.gc | 2 +- .../reference/engine/util/glist_REF.gc | 243 ++ .../reference/levels/beach/beach-obs_REF.gc | 6 +- .../reference/levels/beach/beach-part_REF.gc | 4 +- .../reference/levels/beach/bird-lady_REF.gc | 8 +- .../reference/levels/beach/lurkercrab_REF.gc | 2 +- .../reference/levels/beach/mayor_REF.gc | 4 +- .../reference/levels/beach/sculptor_REF.gc | 4 +- .../reference/levels/beach/seagull_REF.gc | 10 +- .../levels/citadel/citadel-obs_REF.gc | 47 +- .../levels/citadel/citadel-sages_REF.gc | 39 +- .../levels/citadel/citb-bunny_REF.gc | 2 +- .../reference/levels/citadel/citb-plat_REF.gc | 30 +- .../reference/levels/common/basebutton_REF.gc | 8 +- .../reference/levels/common/baseplat_REF.gc | 34 +- .../levels/common/dark-eco-pool_REF.gc | 36 +- .../reference/levels/common/nav-enemy_REF.gc | 45 +- .../reference/levels/common/orb-cache_REF.gc | 65 +- .../levels/common/plat-button_REF.gc | 30 +- .../reference/levels/common/sharkey_REF.gc | 6 +- .../reference/levels/common/water-anim_REF.gc | 240 +- .../levels/darkcave/darkcave-obs_REF.gc | 15 +- .../levels/finalboss/final-door_REF.gc | 6 +- .../levels/finalboss/green-eco-lurker_REF.gc | 14 +- .../levels/finalboss/light-eco_REF.gc | 18 +- .../levels/finalboss/robotboss-misc_REF.gc | 15 +- .../levels/finalboss/robotboss-weapon_REF.gc | 30 +- .../levels/finalboss/robotboss_REF.gc | 100 +- .../levels/flut_common/flutflut_REF.gc | 15 +- .../levels/flut_common/target-flut_REF.gc | 110 +- .../reference/levels/jungle/fisher_REF.gc | 12 +- .../levels/jungle/jungle-mirrors_REF.gc | 36 +- .../reference/levels/jungle/junglefish_REF.gc | 2 +- .../levels/jungle/junglesnake_REF.gc | 6 +- .../levels/jungleb/plant-boss_REF.gc | 2 +- .../levels/lavatube/lavatube-obs_REF.gc | 33 +- .../levels/lavatube/lavatube-part_REF.gc | 18 +- .../levels/maincave/baby-spider_REF.gc | 4 +- .../levels/maincave/driller-lurker_REF.gc | 35 +- .../reference/levels/maincave/gnawer_REF.gc | 36 +- .../levels/maincave/maincave-obs_REF.gc | 54 +- .../levels/maincave/mother-spider-egg_REF.gc | 14 +- .../levels/maincave/mother-spider-proj_REF.gc | 6 +- .../levels/maincave/mother-spider_REF.gc | 24 +- .../levels/maincave/spiderwebs_REF.gc | 2 +- .../levels/misty/misty-conveyor_REF.gc | 8 +- .../reference/levels/misty/misty-part_REF.gc | 36 +- .../reference/levels/misty/mistycannon_REF.gc | 30 +- .../reference/levels/misty/mud_REF.gc | 4 +- .../levels/misty/quicksandlurker_REF.gc | 2 +- .../levels/ogre/flying-lurker_REF.gc | 12 +- .../reference/levels/ogre/ogre-obs_REF.gc | 4 +- .../collide-reaction-racer_REF.gc | 33 +- .../levels/racer_common/racer-states_REF.gc | 43 +- .../levels/racer_common/racer_REF.gc | 15 +- .../levels/racer_common/target-racer_REF.gc | 50 +- .../levels/rolling/rolling-obs_REF.gc | 4 +- .../levels/rolling/rolling-race-ring_REF.gc | 15 +- .../reference/levels/snow/ice-cube_REF.gc | 26 +- .../reference/levels/snow/snow-bumper_REF.gc | 15 +- .../reference/levels/snow/snow-bunny_REF.gc | 22 +- .../levels/snow/snow-flutflut-obs_REF.gc | 4 +- .../reference/levels/snow/snow-obs_REF.gc | 47 +- .../levels/snow/snow-ram-boss_REF.gc | 10 +- .../reference/levels/sunken/bully_REF.gc | 13 +- .../levels/sunken/double-lurker_REF.gc | 4 +- .../levels/sunken/floating-launcher_REF.gc | 4 +- .../levels/sunken/helix-water_REF.gc | 6 +- .../reference/levels/sunken/orbit-plat_REF.gc | 9 +- .../reference/levels/sunken/puffer_REF.gc | 17 +- .../reference/levels/sunken/qbert-plat_REF.gc | 4 +- .../levels/sunken/sun-exit-chamber_REF.gc | 25 +- .../levels/sunken/sunken-pipegame_REF.gc | 4 +- .../levels/sunken/sunken-water_REF.gc | 40 +- .../levels/sunken/target-tube_REF.gc | 24 +- .../reference/levels/sunken/whirlpool_REF.gc | 19 +- .../reference/levels/swamp/billy_REF.gc | 2 +- .../reference/levels/swamp/kermit_REF.gc | 27 +- .../reference/levels/swamp/swamp-rat_REF.gc | 6 +- .../levels/training/training-obs_REF.gc | 30 +- .../levels/training/training-part_REF.gc | 11 +- .../levels/village1/assistant_REF.gc | 8 +- .../reference/levels/village1/explorer_REF.gc | 8 +- .../levels/village1/fishermans-boat_REF.gc | 4 +- .../levels/village1/village1-part2_REF.gc | 9 +- .../levels/village1/village1-part_REF.gc | 9 +- .../reference/levels/village1/yakow_REF.gc | 2 +- .../levels/village2/assistant-village2_REF.gc | 23 +- .../levels/village2/village2-obs_REF.gc | 15 +- .../levels/village2/village2-part_REF.gc | 16 +- .../reference/levels/village2/warrior_REF.gc | 4 +- .../levels/village3/assistant-village3_REF.gc | 4 +- .../reference/levels/village3/minecart_REF.gc | 15 +- .../reference/levels/village3/miners_REF.gc | 16 +- .../levels/village3/sage-village3_REF.gc | 8 +- .../levels/village3/village3-obs_REF.gc | 640 +++++ .../levels/village3/village3-part_REF.gc | 41 +- .../levels/village_common/oracle_REF.gc | 15 +- .../levels/village_common/villagep-obs_REF.gc | 15 +- test/offline/config.jsonc | 25 +- 279 files changed, 7312 insertions(+), 5465 deletions(-) create mode 100644 test/decompiler/reference/engine/collide/collide-edge-grab_REF.gc create mode 100644 test/decompiler/reference/engine/collide/collide-reaction-target_REF.gc create mode 100644 test/decompiler/reference/engine/collide/collide-shape-rider_REF.gc create mode 100644 test/decompiler/reference/engine/util/glist_REF.gc create mode 100644 test/decompiler/reference/levels/village3/village3-obs_REF.gc diff --git a/common/goos/PrettyPrinter2.cpp b/common/goos/PrettyPrinter2.cpp index 8a0d12cadc..17d1e5fa47 100644 --- a/common/goos/PrettyPrinter2.cpp +++ b/common/goos/PrettyPrinter2.cpp @@ -198,8 +198,9 @@ void break_list(Node* node) { node->top_line_count = 1; const std::unordered_set sameline_splitters = { - "if", "<", ">", "<=", ">=", "set!", "=", "!=", "+", "-", "*", - "/", "the", "->", "and", "or", "logand", "logior", "logxor", "+!", "*!", "logtest?"}; + "if", "<", ">", "<=", ">=", "set!", "=", "!=", "+", + "-", "*", "/", "the", "->", "and", "or", "logand", "logior", + "logxor", "+!", "*!", "logtest?", "not", "zero?", "nonzero?"}; if (node->child_nodes.at(0).kind == Node::Kind::LIST) { // ((foo diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index 9412b4c905..8909ca3939 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -2460,7 +2460,6 @@ void DecompiledDataElement::do_decomp(const Env& env, const LinkedObjectFile* fi if (m_label_info) { m_description = decompile_at_label_with_hint(*m_label_info, m_label, env.file->labels, env.file->words_by_seg, *env.dts, file); - } else { m_description = decompile_at_label_guess_type(m_label, env.file->labels, env.file->words_by_seg, env.dts->ts, file); diff --git a/decompiler/analysis/find_defstates.cpp b/decompiler/analysis/find_defstates.cpp index 0021e1b71e..063fa8104c 100644 --- a/decompiler/analysis/find_defstates.cpp +++ b/decompiler/analysis/find_defstates.cpp @@ -153,10 +153,16 @@ std::vector get_defstate_entries( } } // name = code/event/etc - if (skip_states.count(state_name) > 0) { - if (skip_states.at(state_name).find(name) != skip_states.at(state_name).end()) { + std::string name_to_check_for_skip = state_name; + if (skip_states.count(name_to_check_for_skip) == 0) { + name_to_check_for_skip = + fmt::format("({} {})", state_name, state_type.last_arg().base_type()); + } + if (skip_states.count(name_to_check_for_skip) > 0) { + if (skip_states.at(name_to_check_for_skip).find(name) != + skip_states.at(name_to_check_for_skip).end()) { env.func->warnings.general_warning("SKIP: skipping '{}' handler for state '{}'", name, - state_name); + name_to_check_for_skip); continue; } } diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index f366a19e63..4954051476 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -2914,6 +2914,20 @@ :flag-assert #x900000010 ) +(defenum sound-mask + :bitfield #t + :type uint16 + (volume) + (pitch) + (bend) + (unused) + (time) + (trans) + (fo-min) + (fo-max) + (fo-curve) + ) + (deftype sound-rpc-cmd (structure) ((rsvd1 uint16 :offset-assert 0) (command sound-command :offset-assert 2) @@ -2924,7 +2938,7 @@ ) (deftype sound-play-parms (structure) - ((mask uint16 :offset-assert 0) + ((mask sound-mask :offset-assert 0) (pitch-mod int16 :offset-assert 2) (bend int16 :offset-assert 4) (fo-min int16 :offset-assert 6) @@ -3191,12 +3205,12 @@ ) (deftype sound-spec (basic) - ((mask uint16 :offset-assert 4) + ((mask sound-mask :offset-assert 4) (num float :offset-assert 8) (group uint8 :offset-assert 12) - (sound-name sound-name :score 20 :offset 16) - (sound-name-char uint8 16 :offset 16) ;; moved to after sound-name - (trans float 4 :offset-assert 32) ;; guess + (sound-name sound-name :score 20 :offset 16) + (sound-name-char uint8 16 :offset 16) ;; moved to after sound-name + (trans float 4 :offset-assert 32) ;; guess (volume int32 :offset-assert 48) (pitch-mod int32 :offset-assert 52) (bend int32 :offset-assert 56) @@ -3219,15 +3233,15 @@ (playing-id sound-id :offset-assert 8) (trans vector :inline :offset-assert 16) (name sound-name :offset-assert 32) - (play-time time-frame :offset-assert 48) - (time-base time-frame :offset-assert 56) - (time-random time-frame :offset-assert 64) + (play-time time-frame :offset-assert 48) + (time-base time-frame :offset-assert 56) + (time-random time-frame :offset-assert 64) (volume int32 :offset-assert 72) (pitch int32 :offset-assert 76) (falloff-near int32 :offset-assert 80) (falloff-far int32 :offset-assert 84) (falloff-mode int32 :offset-assert 88) - (params (pointer float) :offset-assert 92) + (params (pointer float) :offset-assert 92) (param-count int32 :offset-assert 96) (entity entity :offset-assert 100) (sound-count int32 :offset-assert 104) @@ -9080,9 +9094,46 @@ ;; - Types +(defenum shadow-flags + :bitfield #t + :type int32 + (shdf00) + (shdf01) + (shdf02) + (shdf03) + (shdf04) + (shdf05) + (shdf06) + (shdf07) + (shdf08) + (shdf09) + (shdf10) + (shdf11) + (shdf12) + (shdf13) + (shdf14) + (shdf15) + (shdf16) + (shdf17) + (shdf18) + (shdf19) + (shdf20) + (shdf21) + (shdf22) + (shdf23) + (shdf24) + (shdf25) + (shdf26) + (shdf27) + (shdf28) + (shdf29) + (shdf30) + (shdf31) + ) + (deftype shadow-settings (structure) ((center vector :inline :offset-assert 0) - (flags int32 :score 100 :offset 12) + (flags shadow-flags :score 100 :offset 12) (shadow-dir vector :inline :offset-assert 16) (dist-to-locus float :offset 28) (bot-plane plane :inline :offset-assert 32) @@ -10087,6 +10138,43 @@ ;; - Types +(defenum surface-flags + :bitfield #t + :type uint32 + (surf00) + (surf01) + (surf02) + (surf03) + (surf04) + (surf05) + (surf06) + (surf07) + (surf08) + (surf09) + (surf10) + (surf11) + (surf12) + (surf13) + (surf14) + (surf15) + (surf16) + (surf17) + (surf18) + (surf19) + (surf20) + (surf21) + (surf22) + (surf23) + (surf24) + (surf25) + (surf26) + (surf27) + (surf28) + (surf29) + (surf30) + (surf31) + ) + (deftype surface (basic) ((name symbol :offset-assert 4) ;; data went here @@ -10119,7 +10207,7 @@ (mult-hook (function surface surface surface int none) :offset-assert 140) ;; dataw went here (mode symbol :offset-assert 144) - (flags uint32 :offset-assert 148) + (flags surface-flags :offset-assert 148) (data float 30 :offset 8) (hook function 4 :offset 128) (dataw uint32 2 :offset 144) @@ -10370,13 +10458,50 @@ ;; - Types +(defenum align-flags + :bitfield #t + :type uint32 + (algf00) + (algf01) + (algf02) + (algf03) + (algf04) + (algf05) + (algf06) + (algf07) + (algf08) + (algf09) + (algf10) + (algf11) + (algf12) + (algf13) + (algf14) + (algf15) + (algf16) + (algf17) + (algf18) + (algf19) + (algf20) + (algf21) + (algf22) + (algf23) + (algf24) + (algf25) + (algf26) + (algf27) + (algf28) + (algf29) + (algf30) + (algf31) + ) + (deftype align-control (basic) - ((flags uint32 :offset-assert 4) - (process process-drawable :offset-assert 8) - (frame-group art-joint-anim :offset-assert 12) + ((flags align-flags :offset-assert 4) + (process process-drawable :offset-assert 8) + (frame-group art-joint-anim :offset-assert 12) (frame-num float :offset-assert 16) - (matrix matrix 2 :inline :offset-assert 32) - (transform transform 2 :inline :offset-assert 160) + (matrix matrix 2 :inline :offset-assert 32) + (transform transform 2 :inline :offset-assert 160) (delta transformq :inline :offset-assert 256) (last-speed meters :offset-assert 304) (align transformq :inline :offset 160) @@ -10403,6 +10528,43 @@ ;; - Types +(defenum state-flags + :bitfield #t + :type uint32 + (sf00) + (sf01) + (sf02) + (sf03) + (sf04) + (sf05) + (sf06) + (sf07) + (sf08) + (sf09) + (sf10) + (sf11) + (sf12) + (sf13) + (sf14) + (sf15) + (sf16) + (sf17) + (sf18) + (sf19) + (sf20) + (sf21) + (sf22) + (sf23) + (sf24) + (sf25) + (sf26) + (sf27) + (sf28) + (sf29) + (sf30) + (sf31) + ) + (declare-type nav-control basic) (declare-type path-control basic) (declare-type vol-control basic) @@ -10425,7 +10587,7 @@ (part sparticle-launch-control :offset-assert 152) (water water-control :offset-assert 156) (sound ambient-sound :offset-assert 160) - (state-flags uint32 :offset-assert 164) + (state-flags state-flags :offset-assert 164) (state-time time-frame :offset-assert 168) ) :heap-base #x40 @@ -11624,6 +11786,78 @@ ) ) +(defenum cshape-moving-flags + :bitfield #t + :type uint64 + (onsurf) + (onground) + (tsurf) + (twall) + (t-ciel) + (t-act) + (csmf06) + (csmf07) + (csmf08) + (csmf09) + (on-water) + (csmf11) + (csmf12) + (csmf13) + (csmf14) + (csmf15) + (csmf16) + (csmf17) + (csmf18) + (csmf19) + (csmf20) + (csmf21) + (csmf22) + (csmf23) + (csmf24) + (csmf25) + (csmf26) + (csmf27) + (csmf28) + (csmf29) + ) + +(defenum cshape-reaction-flags + :bitfield #t + :type uint32 + (csrf00) + (csrf01) + (csrf02) + (csrf03) + (csrf04) + (csrf05) + (csrf06) + (csrf07) + (csrf08) + (csrf09) + (csrf10) + (csrf11) + (csrf12) + (csrf13) + (csrf14) + (csrf15) + (csrf16) + (csrf17) + (csrf18) + (csrf19) + (csrf20) + (csrf21) + (csrf22) + (csrf23) + (csrf24) + (csrf25) + (csrf26) + (csrf27) + (csrf28) + (csrf29) + (csrf30) + (csrf31) + ) + (deftype collide-shape-moving (collide-shape) ((rider-time time-frame :offset-assert 184) (rider-last-move vector :inline :offset-assert 192) @@ -11631,12 +11865,12 @@ (poly-pat pat-surface :offset-assert 256) (cur-pat pat-surface :offset-assert 260) (ground-pat pat-surface :offset-assert 264) - (status uint64 :offset-assert 272) ;; 1: onsurf 2: onground 4: tsurf 8: twall 16: t-ciel 32: t-act ?? 1024: on-water - (old-status uint64 :offset-assert 280) - (prev-status uint64 :offset-assert 288) - (reaction-flag uint32 :offset-assert 296) - (reaction (function collide-shape-moving collide-shape-intersect vector vector uint) :offset-assert 300) - (no-reaction (function collide-shape-moving collide-shape-intersect vector vector none) :offset-assert 304) + (status cshape-moving-flags :offset-assert 272) + (old-status cshape-moving-flags :offset-assert 280) + (prev-status cshape-moving-flags :offset-assert 288) + (reaction-flag cshape-reaction-flags :offset-assert 296) + (reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags) :offset-assert 300) + (no-reaction (function collide-shape-moving collide-shape-intersect vector vector none) :offset-assert 304) (local-normal vector :inline :offset-assert 320) (surface-normal vector :inline :offset-assert 336) (poly-normal vector :inline :offset-assert 352) @@ -11693,9 +11927,9 @@ (local-normal vector :inline :offset-assert 64) (surface-normal vector :inline :offset-assert 80) (time time-frame :offset-assert 96) - (status uint64 :offset-assert 104) + (status cshape-moving-flags :offset-assert 104) (pat pat-surface :offset-assert 112) - (reaction-flag uint32 :offset-assert 116) + (reaction-flag cshape-reaction-flags :offset-assert 116) ) :method-count-assert 10 :size-assert #x78 @@ -18939,8 +19173,8 @@ (define-extern target-attack-up (function target symbol symbol none)) (define-extern find-ground-point (function control-info vector float float vector)) -(define-extern default-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector uint)) ;; TODO - not completely confirmed -(define-extern simple-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector uint)) +(define-extern default-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags)) +(define-extern simple-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags)) (define-extern collide-shape-draw-debug-marks (function none)) (define-extern debug-report-col-stats (function int)) @@ -19022,24 +19256,61 @@ ;; - Types +(defenum water-flags + :bitfield #t + :type uint32 + (wt00) + (wt01) + (wt02) + (wt03) + (wt04) + (wt05) + (wt06) + (wt07) + (wt08) + (wt09) + (wt10) + (wt11) + (wt12) + (wt13) + (wt14) + (wt15) + (wt16) + (wt17) + (wt18) + (wt19) + (wt20) + (wt21) + (wt22) + (wt23) + (wt24) + (wt25) + (wt26) + (wt27) + (wt28) + (wt29) + (wt30) + (wt31) + ) + (deftype water-control (basic) - ((flags uint32 :offset-assert 4) - (process process-drawable :offset-assert 8) + ((flags water-flags :offset-assert 4) + (process process-drawable :offset-assert 8) (joint-index int32 :offset-assert 12) (top-y-offset float :offset-assert 16) (ripple-size meters :offset-assert 20) - (enter-water-time time-frame :offset-assert 24) - (wade-time time-frame :offset-assert 32) - (on-water-time time-frame :offset-assert 40) - (enter-swim-time time-frame :offset-assert 48) - (swim-time time-frame :offset-assert 56) + (enter-water-time time-frame :offset-assert 24) + (wade-time time-frame :offset-assert 32) + (on-water-time time-frame :offset-assert 40) + (enter-swim-time time-frame :offset-assert 48) + (swim-time time-frame :offset-assert 56) (base-height meters :offset-assert 64) (wade-height meters :offset-assert 68) (swim-height meters :offset-assert 72) (surface-height meters :offset-assert 76) (bottom-height meters :offset-assert 80) (height meters :offset-assert 84) - (height-offset float 4 :offset-assert 88) + (height-offset float 4 :offset-assert 88) (real-ocean-offset meters :offset 88) (ocean-offset meters :offset 92) (bob-offset meters :offset 96) @@ -19047,13 +19318,13 @@ (swim-depth meters :offset-assert 104) (bob smush-control :inline :offset-assert 112) (volume handle :offset-assert 144) ;; handle? - (bottom vector 2 :inline :offset-assert 160) - (top vector 2 :inline :offset-assert 192) + (bottom vector 2 :inline :offset-assert 160) + (top vector 2 :inline :offset-assert 192) (enter-water-pos vector :inline :offset-assert 224) (drip-old-pos vector :inline :offset-assert 240) (drip-joint-index int32 :offset-assert 256) (drip-wetness float :offset-assert 260) - (drip-time time-frame :offset-assert 264) + (drip-time time-frame :offset-assert 264) (drip-speed float :offset-assert 272) (drip-height meters :offset-assert 276) (drip-mult float :offset-assert 280) @@ -19079,9 +19350,9 @@ (wade-height meters :offset-assert 180) (swim-height meters :offset-assert 184) (bottom-height meters :offset-assert 188) - (attack-event symbol :offset-assert 192) + (attack-event symbol :offset-assert 192) (target handle :offset-assert 200) - (flags uint32 :offset-assert 208) + (flags water-flags :offset-assert 208) ) :heap-base #x70 :method-count-assert 30 @@ -19094,11 +19365,11 @@ (TODO-RENAME-22 (_type_) none 22) ;; can also return an obs? (reset-root! (_type_) none 23) (set-stack-size! (_type_) none 24) - (TODO-RENAME-25 (_type_) object 25) + (TODO-RENAME-25 (_type_) none 25) (TODO-RENAME-26 (_type_) none 26) (dummy-27 (_type_) none 27) (get-ripple-height (_type_ vector) float 28) - (TODO-RENAME-29 (_type_) uint 29) + (TODO-RENAME-29 (_type_) none 29) ) ) @@ -19501,6 +19772,43 @@ ) ) +(defenum vol-flags + :bitfield #t + :type uint32 + (volf00) + (volf01) + (volf02) + (volf03) + (volf04) + (volf05) + (volf06) + (volf07) + (volf08) + (volf09) + (volf10) + (volf11) + (volf12) + (volf13) + (volf14) + (volf15) + (volf16) + (volf17) + (volf18) + (volf19) + (volf20) + (volf21) + (volf22) + (volf23) + (volf24) + (volf25) + (volf26) + (volf27) + (volf28) + (volf29) + (volf30) + (volf31) + ) + (deftype vol-control (basic) ((flags uint32 :offset-assert 4) (process process-drawable :offset-assert 8) @@ -20284,7 +20592,7 @@ (define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) (define-extern target-collision-low-coverage (function control-info collide-shape-intersect vector (pointer uint32) (pointer uint64) (pointer symbol) uint)) ;; i think the pointers are lies - TODO (define-extern poly-find-nearest-edge (function vector (inline-array vector) vector vector vector)) -(define-extern target-collision-reaction (function control-info collide-shape-intersect vector vector uint)) +(define-extern target-collision-reaction (function control-info collide-shape-intersect vector vector cshape-moving-flags)) (define-extern target-collision-no-reaction (function control-info collide-shape-intersect vector vector none)) @@ -20315,7 +20623,7 @@ (define-extern add-thrust (function symbol :behavior target)) (define-extern add-gravity (function vector :behavior target)) (define-extern do-rotations2 (function int :behavior target)) -(define-extern reverse-conversions (function vector uint :behavior target)) +(define-extern reverse-conversions (function vector none :behavior target)) (define-extern bend-gravity (function symbol :behavior target)) (define-extern post-flag-setup (function none :behavior target)) (define-extern joint-points (function none :behavior target)) @@ -21851,7 +22159,7 @@ ;; - Functions -(define-extern projectile-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector uint)) +(define-extern projectile-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags)) (define-extern projectile-update-velocity-space-wars (function projectile none)) (define-extern find-nearest-attackable (function vector float uint uint vector float projectile)) ;; Whatever te search returns (match from search-info) (define-extern find-ground-and-draw-shadow (function vector vector float collide-kind process-drawable float float none)) @@ -23051,6 +23359,43 @@ ) ) +(defenum eco-door-flags + :bitfield #t + :type int32 + (ecdf00) + (ecdf01) + (auto-close) + (one-way) + (ecdf04) + (ecdf05) + (ecdf06) + (ecdf07) + (ecdf08) + (ecdf09) + (ecdf10) + (ecdf11) + (ecdf12) + (ecdf13) + (ecdf14) + (ecdf15) + (ecdf16) + (ecdf17) + (ecdf18) + (ecdf19) + (ecdf20) + (ecdf21) + (ecdf22) + (ecdf23) + (ecdf24) + (ecdf25) + (ecdf26) + (ecdf27) + (ecdf28) + (ecdf29) + (ecdf30) + (ecdf31) + ) + (deftype eco-door (process-drawable) ((root-override collide-shape :score 100 :offset 112) (speed float :offset-assert 176) @@ -23060,7 +23405,7 @@ (open-sound sound-name :offset-assert 208) (close-sound sound-name :offset-assert 224) (state-actor entity-actor :offset-assert 240) - (flags int32 :offset-assert 244) + (flags eco-door-flags :offset-assert 244) (locked symbol :offset-assert 248) (auto-close symbol :offset-assert 252) (one-way symbol :offset-assert 256) @@ -23795,7 +24140,7 @@ (define-extern spawn-mistycannon-missile (function process-tree vector vector float float float float entity none)) (define-extern angle-tracker-apply-move! (function angle-tracker float float)) (define-extern mistycannon-missile-init-by-other (function mistycannon-init-data entity none :behavior mistycannon-missile)) -(define-extern mistycannon-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector uint)) +(define-extern mistycannon-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags)) (define-extern angle-tracker-get-value (function angle-tracker float)) (define-extern angle-tracker-set-value (function angle-tracker float float)) (define-extern solve-missile-tilt (function quadratic-solution float float float float symbol)) @@ -24501,7 +24846,7 @@ ;; - Functions (define-extern seagull-init-by-other (function vector int seagullflock none :behavior seagull)) -(define-extern seagull-reaction (function collide-shape-moving collide-shape-intersect vector vector uint)) +(define-extern seagull-reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags)) (define-extern seagull-post (function none :behavior seagull)) (define-extern beach-rock-trigger (function int)) @@ -27318,7 +27663,7 @@ ;; - Functions -(define-extern racer-collision-reaction (function control-info collide-shape-intersect vector vector uint)) +(define-extern racer-collision-reaction (function control-info collide-shape-intersect vector vector cshape-moving-flags)) (define-extern racer-service-slide (function none :behavior target)) (define-extern racer-xz (function float float none :behavior target)) (define-extern racer-thrust (function basic float none :behavior target)) @@ -31542,7 +31887,7 @@ :heap-base #x60 :flag-assert #x15006000cc (:methods - (dummy-20 (_type_ float) uint 20) + (dummy-20 (_type_ float) cshape-moving-flags 20) ) (:states (whirlpool-idle)) diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 05137727f4..54868cd457 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -5143,7 +5143,10 @@ [50, "s5", "eco-collectable"] ], - "fuel-cell-init-by-other": [[118, "gp", "vector"]], + "fuel-cell-init-by-other": [ + [108, "v0", "fact-options"], + [118, "gp", "vector"] + ], "ecovalve-init-by-other": [ [95, "a0", "process-drawable"], @@ -5194,7 +5197,10 @@ "(code die eco)": [[53, "v1", "float"]], - "(trans pickup fuel-cell)": [[92, "v1", "float"]], + "(trans pickup fuel-cell)": [ + [92, "v1", "float"], + [130, "v0", "fact-options"] + ], "(enter notice-blue eco-collectable)": [[13, "v1", "float"]], diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 7991db76c9..8205e2eb3c 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -288,6 +288,18 @@ goos::Object decompile_value_array(const TypeSpec& elt_type, } namespace { +float word_as_float(const LinkedWord& w) { + ASSERT(w.kind() == LinkedWord::PLAIN_DATA); + float v; + memcpy(&v, &w.data, 4); + return v; +} + +s32 word_as_s32(const LinkedWord& w) { + ASSERT(w.kind() == LinkedWord::PLAIN_DATA); + return w.data; +} + std::string print_def(const goos::Object& obj) { if (obj.is_pair() && obj.as_pair()->car.is_symbol() && obj.as_pair()->car.as_symbol()->name == "quote") { @@ -578,6 +590,147 @@ goos::Object sp_launch_grp_launcher_decompile(const std::vector& wor file, TypeSpec("sparticle-group-item"), 32); } +goos::Object decompile_sound_spec(const TypeSpec& type, + const DecompilerLabel& label, + const std::vector& labels, + const std::vector>& words, + const TypeSystem& ts, + const LinkedObjectFile* file) { + // auto normal = decompile_structure(type, label, labels, words, ts, file, false); + // fmt::print("Doing: {}\n", normal.print()); + auto uncast_type_info = ts.lookup_type(type); + auto type_info = dynamic_cast(uncast_type_info); + if (!type_info) { + throw std::runtime_error(fmt::format("Type {} wasn't a structure type.", type.print())); + } + ASSERT(type_info->get_size_in_memory() == 0x4c); + + // get words for real + auto offset_location = label.offset - type_info->get_offset(); + int word_count = (type_info->get_size_in_memory() + 3) / 4; + std::vector obj_words; + obj_words.insert(obj_words.begin(), + words.at(label.target_segment).begin() + (offset_location / 4) + 1, + words.at(label.target_segment).begin() + (offset_location / 4) + word_count); + + for (int i = 0; i < word_count - 1; ++i) { + if (i == word_count - 2 && !obj_words.at(i).data) { + // just some default initialized sound spec, don't attempt anything fancy. + return decompile_structure(type, label, labels, words, ts, file, false); + } + if (obj_words.at(i).data) + break; + } + + u16 implicit_mask = 0; + u16 mask = obj_words.at(0).data; + float num = word_as_float(obj_words.at(1)); + u8 group = obj_words.at(2).data; + char sound_name[17]; + sound_name[16] = 0; + memcpy(&sound_name[0], &obj_words.at(3).data, sizeof(u32)); + memcpy(&sound_name[4], &obj_words.at(4).data, sizeof(u32)); + memcpy(&sound_name[8], &obj_words.at(5).data, sizeof(u32)); + memcpy(&sound_name[12], &obj_words.at(6).data, sizeof(u32)); + std::string name(sound_name); + + for (int i = 0; i < 4; ++i) { + if (obj_words.at(7 + i).data) { + throw std::runtime_error("static sound-spec trans was not zero."); + } + } + + s32 volume = word_as_s32(obj_words.at(11)); + s32 pitch = word_as_s32(obj_words.at(12)); + s32 bend = word_as_s32(obj_words.at(13)); + s16 fo_min = word_as_s32(obj_words.at(14)); + s16 fo_max = word_as_s32(obj_words.at(14)) >> 16; + s8 fo_curve = word_as_s32(obj_words.at(15)); + s8 priority = word_as_s32(obj_words.at(15)) >> 8; + s32 auto_time = word_as_s32(obj_words.at(16)); + s32 auto_from = word_as_s32(obj_words.at(17)); + + if (bend) { + throw std::runtime_error("static sound-spec bend was not zero."); + } + if (fo_curve) { + throw std::runtime_error("static sound-spec fo_curve was not zero."); + } + if (priority) { + throw std::runtime_error("static sound-spec priority was not zero."); + } + if (auto_time) { + throw std::runtime_error("static sound-spec auto_time was not zero."); + } + if (auto_from) { + throw std::runtime_error("static sound-spec auto_from was not zero."); + } + + std::vector the_macro; + + the_macro.push_back(pretty_print::to_symbol("static-sound-spec")); + the_macro.push_back(goos::StringObject::make_new(name)); + if (num != 1) { + the_macro.push_back(pretty_print::to_symbol(fmt::format(":num {}", num))); + } + if (group != 1) { + the_macro.push_back(pretty_print::to_symbol(fmt::format(":group {}", num))); + } + if ((mask & 1) || volume != 1024) { + implicit_mask |= 1 << 0; + float volf = volume / 10.24f; + // volume is fixed point, and floats should round towards zero, so we convert specific ints + // to better-looking floats that end up being the same value. + // there should be a more automated way to do this, but i am a bit lazy. + switch (volume) { + case 0x2cc: + volf = 70; + break; + case 0x333: + volf = 80; + break; + } + the_macro.push_back(pretty_print::to_symbol(fmt::format(":volume {}", float_to_string(volf)))); + } + if (pitch != 0) { + implicit_mask |= 1 << 1; + the_macro.push_back(pretty_print::to_symbol(fmt::format(":pitch-mod {}", pitch))); + } + if (fo_min != 0) { + implicit_mask |= 1 << 6; + the_macro.push_back(pretty_print::to_symbol(fmt::format(":fo-min {}", fo_min))); + } + if (fo_max != 0) { + implicit_mask |= 1 << 7; + the_macro.push_back(pretty_print::to_symbol(fmt::format(":fo-max {}", fo_max))); + } + + if (mask < implicit_mask) { + throw std::runtime_error( + fmt::format("static sound-spec too many implicit masks: #x{:x}", implicit_mask ^ mask)); + } + u16 final_mask = mask ^ implicit_mask; + if (final_mask) { + lg::error( + "final_mask in static sound-spec decomp: #x{:x}. This is fine, but should be reported.", + final_mask); + std::string mask_list = ":mask ("; + bool first = true; + for (const auto& m : decompile_bitfield_enum_from_int(TypeSpec("sound-mask"), ts, final_mask)) { + if (!first) { + mask_list += " "; + } + mask_list += m; + first = false; + } + mask_list += ")"; + + the_macro.push_back(pretty_print::to_symbol(mask_list)); + } + + return pretty_print::build_list(the_macro); +} + } // namespace goos::Object decompile_structure(const TypeSpec& type, @@ -587,13 +740,19 @@ goos::Object decompile_structure(const TypeSpec& type, const TypeSystem& ts, const LinkedObjectFile* file, bool use_fancy_macros) { - if (use_fancy_macros && type == TypeSpec("sp-field-init-spec")) { - return decompile_sparticle_field_init(type, label, labels, words, ts, file); + // some structures we want to decompile to fancy macros instead of a raw static definiton + if (use_fancy_macros) { + if (type == TypeSpec("sp-field-init-spec")) { + return decompile_sparticle_field_init(type, label, labels, words, ts, file); + } + if (type == TypeSpec("sparticle-group-item")) { + return decompile_sparticle_group_item(type, label, labels, words, ts, file); + } + if (type == TypeSpec("sound-spec")) { + return decompile_sound_spec(type, label, labels, words, ts, file); + } } - if (use_fancy_macros && type == TypeSpec("sparticle-group-item")) { - return decompile_sparticle_group_item(type, label, labels, words, ts, file); - } // first step, get type info and words TypeSpec actual_type = type; auto uncast_type_info = ts.lookup_type(actual_type); diff --git a/decompiler/util/sparticle_decompile.cpp b/decompiler/util/sparticle_decompile.cpp index 551eed7854..3cb2d1cc0d 100644 --- a/decompiler/util/sparticle_decompile.cpp +++ b/decompiler/util/sparticle_decompile.cpp @@ -448,7 +448,7 @@ goos::Object decompile_sparticle_group_item(const TypeSpec& type, const std::vector>& words, const TypeSystem& ts, const LinkedObjectFile* file) { - auto normal = decompile_structure(type, label, labels, words, ts, file, false); + // auto normal = decompile_structure(type, label, labels, words, ts, file, false); // fmt::print("Doing: {}\n", normal.print()); auto uncast_type_info = ts.lookup_type(type); auto type_info = dynamic_cast(uncast_type_info); diff --git a/goal_src/engine/ambient/ambient.gc b/goal_src/engine/ambient/ambient.gc index 1ddb7b512e..0dd1c982b2 100644 --- a/goal_src/engine/ambient/ambient.gc +++ b/goal_src/engine/ambient/ambient.gc @@ -229,7 +229,7 @@ ) (and *target* (!= (-> *target* next-state name) 'target-look-around) - (zero? (logand (-> *target* state-flags) #x8008)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf15))) (= *master-mode* 'game) ) ) @@ -750,9 +750,9 @@ (set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) (let ((s4-2 (new 'stack 'sound-spec))) (set! (-> s4-2 sound-name) (string->sound-name sv-16)) - (logior! (-> s4-2 mask) 1) + (logior! (-> s4-2 mask) (sound-mask volume)) (set! (-> s4-2 volume) 1024) - (logior! (-> s4-2 mask) 4) + (logior! (-> s4-2 mask) (sound-mask bend)) (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) (set! sv-112 (new 'static 'res-tag)) (let ((a1-7 ((method-of-type res-lump get-property-data) @@ -802,7 +802,7 @@ (s4-0 (new 'stack 'sound-spec)) ) (set! (-> s4-0 sound-name) (string->sound-name s2-0)) - (logior! (-> s4-0 mask) 1) + (logior! (-> s4-0 mask) (sound-mask volume)) (set! (-> s4-0 volume) 1024) (when (the-as (pointer res-tag) s3-0) (let ((t9-2 effect-param->sound-spec) diff --git a/goal_src/engine/ambient/mood.gc b/goal_src/engine/ambient/mood.gc index 181d70ebb1..19e38cc0bd 100644 --- a/goal_src/engine/ambient/mood.gc +++ b/goal_src/engine/ambient/mood.gc @@ -823,7 +823,7 @@ ) (sound-trans-convert (-> gp-3 parms trans) a1-23) ) - (set! (-> gp-3 parms mask) (the-as uint 32)) + (set! (-> gp-3 parms mask) (sound-mask trans)) (-> gp-3 id) ) (let ((gp-4 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -840,7 +840,7 @@ ) (sound-trans-convert (-> gp-4 parms trans) a1-25) ) - (set! (-> gp-4 parms mask) (the-as uint 32)) + (set! (-> gp-4 parms mask) (sound-mask trans)) (-> gp-4 id) ) (let ((gp-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -857,7 +857,7 @@ ) (sound-trans-convert (-> gp-5 parms trans) a1-27) ) - (set! (-> gp-5 parms mask) (the-as uint 32)) + (set! (-> gp-5 parms mask) (sound-mask trans)) (-> gp-5 id) ) ) diff --git a/goal_src/engine/anim/aligner-h.gc b/goal_src/engine/anim/aligner-h.gc index b2df7e45b1..dea5534886 100644 --- a/goal_src/engine/anim/aligner-h.gc +++ b/goal_src/engine/anim/aligner-h.gc @@ -5,9 +5,46 @@ ;; name in dgo: aligner-h ;; dgos: GAME, ENGINE +(defenum align-flags + :bitfield #t + :type uint32 + (algf00) + (algf01) + (algf02) + (algf03) + (algf04) + (algf05) + (algf06) + (algf07) + (algf08) + (algf09) + (algf10) + (algf11) + (algf12) + (algf13) + (algf14) + (algf15) + (algf16) + (algf17) + (algf18) + (algf19) + (algf20) + (algf21) + (algf22) + (algf23) + (algf24) + (algf25) + (algf26) + (algf27) + (algf28) + (algf29) + (algf30) + (algf31) + ) + ;; The align control is responsible for aligning an animation to a moving character. (deftype align-control (basic) - ((flags uint32 :offset-assert 4) + ((flags align-flags :offset-assert 4) (process process-drawable :offset-assert 8) (frame-group art-joint-anim :offset-assert 12) (frame-num float :offset-assert 16) @@ -45,3 +82,5 @@ ) + + diff --git a/goal_src/engine/anim/aligner.gc b/goal_src/engine/anim/aligner.gc index 1f06cc5244..e642709674 100644 --- a/goal_src/engine/anim/aligner.gc +++ b/goal_src/engine/anim/aligner.gc @@ -5,10 +5,10 @@ ;; name in dgo: aligner ;; dgos: GAME, ENGINE -;; definition for method 9 of type align-control +;; DECOMP BEGINS + ;; WARN: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] ;; WARN: Unsupported inline assembly instruction kind - [jr ra] -;; Used lq/sq (defmethod TODO-RENAME-9 align-control ((obj align-control)) (local-vars (a0-9 symbol) (s7-0 none) (ra-0 int)) (with-pp @@ -21,11 +21,7 @@ (a2-0 (= a0-4 a1-0)) ) (cond - ((or a2-0 (begin - (set! a1-0 'stack1) - (= a0-4 a1-0) - ) - ) + ((or a2-0 (begin (set! a1-0 'stack1) (= a0-4 a1-0))) ) (else ; TODO - support decompiling the return-from-thread @@ -62,37 +58,30 @@ (set! a0-9 (< (* (-> a0-8 param 0) (- f0-0 (-> obj frame-num))) 0.0)) ) (else - (set! a0-9 (= f0-0 0.0)) - ) + (set! a0-9 (= f0-0 0.0)) + ) ) (if a0-9 - (logior! (-> obj flags) 1) - (set! (-> obj flags) (logand -2 (the-as int (-> obj flags)))) + (logior! (-> obj flags) (align-flags algf00)) + (logclear! (-> obj flags) (align-flags algf00)) ) (set! (-> obj frame-group) v1-16) (set! (-> obj frame-num) f0-0) ) - (mem-copy! - (the-as pointer (-> obj transform 1)) - (the-as pointer (-> obj transform)) - 48 - ) - (quaternion-copy! - (the-as quaternion (-> obj transform 1 rot)) - (-> obj align quat) - ) + (mem-copy! (the-as pointer (-> obj transform 1)) (the-as pointer (-> obj transform)) 48) + (quaternion-copy! (the-as quaternion (-> obj transform 1 rot)) (-> obj align quat)) (set! (-> obj transform 1 scale quad) (-> obj align scale quad)) - (let* ((a2-5 (-> obj matrix 1)) + (let* ((a2-5 (-> obj matrix 1 vector)) (a3-0 (-> obj matrix)) (v1-19 (-> a3-0 0 vector 0 quad)) (a0-18 (-> a3-0 0 vector 1 quad)) (a1-12 (-> a3-0 0 vector 2 quad)) (a3-1 (-> a3-0 0 vector 3 quad)) ) - (set! (-> a2-5 vector 0 quad) v1-19) - (set! (-> a2-5 vector 1 quad) a0-18) - (set! (-> a2-5 vector 2 quad) a1-12) - (set! (-> a2-5 vector 3 quad) a3-1) + (set! (-> a2-5 0 quad) v1-19) + (set! (-> a2-5 1 quad) a0-18) + (set! (-> a2-5 2 quad) a1-12) + (set! (-> a2-5 3 quad) a3-1) ) (let ((s5-1 (-> obj process node-list data 1))) (cspace<-matrix-no-push-joint! s5-1 (-> obj process skel)) @@ -108,71 +97,43 @@ (set! (-> v1-23 0 vector 2 quad) a2-6) (set! (-> v1-23 0 vector 3 quad) a3-3) ) - (vector*! - (the-as vector (-> obj transform)) - (-> s5-1 bone position) - (-> obj process root scale) - ) + (vector*! (the-as vector (-> obj transform)) (-> s5-1 bone transform vector 3) (-> obj process root scale)) ) (vector-! - (the-as vector (-> obj delta)) - (the-as vector (-> obj transform)) - (the-as vector (-> obj transform 1)) - ) + (the-as vector (-> obj delta)) + (the-as vector (-> obj transform)) + (the-as vector (-> obj transform 1)) + ) (set-vector! - (-> obj align scale) - (vector-length (the-as vector (-> obj matrix))) - (vector-length (-> obj matrix 0 vector 1)) - (vector-length (-> obj matrix 0 vector 2)) - 1.0 - ) - (vector-! - (-> obj delta scale) - (-> obj align scale) - (-> obj transform 1 scale) - ) - (let - ((a2-8 - (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> obj align scale)) - ) - ) - (quaternion-normalize! - (matrix->quaternion - (-> obj align quat) - (matrix*! a2-8 (the-as matrix (-> obj matrix)) a2-8) - ) - ) + (-> obj align scale) + (vector-length (the-as vector (-> obj matrix))) + (vector-length (-> obj matrix 0 vector 1)) + (vector-length (-> obj matrix 0 vector 2)) + 1.0 ) - (let - ((a1-24 - (quaternion-inverse! - (new 'stack-no-clear 'quaternion) - (the-as quaternion (-> obj transform 1 rot)) - ) - ) - ) + (vector-! (-> obj delta scale) (-> obj align scale) (-> obj transform 1 scale)) + (let ((a2-8 (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> obj align scale)))) (quaternion-normalize! - (quaternion*! (-> obj delta quat) a1-24 (-> obj align quat)) - ) + (matrix->quaternion (-> obj align quat) (matrix*! a2-8 (the-as matrix (-> obj matrix)) a2-8)) + ) + ) + (let ((a1-24 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> obj transform 1 rot))))) + (quaternion-normalize! (quaternion*! (-> obj delta quat) a1-24 (-> obj align quat))) ) (-> obj delta) ) ) -;; definition for method 12 of type align-control -;; INFO: Return type mismatch (inline-array transform) vs transform. (defmethod first-transform align-control ((obj align-control)) (the-as transform (-> obj transform)) ) -;; definition for method 13 of type align-control (defmethod snd-transform align-control ((obj align-control)) (-> obj transform 1) ) -;; definition for method 10 of type align-control (defmethod TODO-RENAME-10 align-control ((obj align-control) (arg0 int) (arg1 float) (arg2 float) (arg3 float)) - (when (zero? (logand (-> obj flags) 1)) + (when (zero? (logand (-> obj flags) (align-flags algf00))) (let* ((a0-1 (-> obj process)) (t9-0 (method-of-object a0-1 apply-alignment)) (v1-4 (-> obj delta)) @@ -188,79 +149,45 @@ (-> obj process root) ) -;; definition for method 26 of type trsqv -(defmethod - TODO-RENAME-26 - trsqv - ((obj trsqv) (arg0 int) (arg1 vector) (arg2 float)) +(defmethod TODO-RENAME-26 trsqv ((obj trsqv) (arg0 int) (arg1 vector) (arg2 float)) (let ((gp-0 (-> obj transv))) - (when (nonzero? (logand arg0 4)) - (set! (-> gp-0 x) (-> arg1 x)) - (set! (-> gp-0 z) (-> arg1 z)) - (let - ((f0-4 - (fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2) - ) + (when (logtest? arg0 4) + (set! (-> gp-0 x) (-> arg1 x)) + (set! (-> gp-0 z) (-> arg1 z)) + (let ((f0-4 (fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2))) + (vector-xz-normalize! gp-0 f0-4) + ) ) - (vector-xz-normalize! gp-0 f0-4) - ) ) - ) obj ) -;; definition for method 11 of type align-control -;; INFO: Return type mismatch trsqv vs none. -(defmethod - TODO-RENAME-11 - align-control - ((obj align-control) - (arg0 int) - (arg1 vector) - (arg2 int) - (arg3 float) - (arg4 float) - ) - (when (zero? (logand (-> obj flags) 1)) - (let ((s5-0 (-> obj delta))) - (let ((s3-0 (-> obj process root transv))) - (if (nonzero? (logand arg0 2)) - (set! - (-> s3-0 y) - (* (* (-> s5-0 trans y) arg3) (-> *display* frames-per-second)) - ) - ) - (when (nonzero? (logand arg0 4)) - (set! (-> s3-0 x) (-> arg1 x)) - (set! (-> s3-0 z) (-> arg1 z)) - (let - ((f0-8 - (* - (fmin - (vector-xz-length arg1) - (* (vector-xz-length (-> s5-0 trans)) arg4) - ) - (-> *display* frames-per-second) +(defmethod TODO-RENAME-11 align-control ((obj align-control) (arg0 int) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) + (when (zero? (logand (-> obj flags) (align-flags algf00))) + (let ((s5-0 (-> obj delta))) + (let ((s3-0 (-> obj process root transv))) + (if (logtest? arg0 2) + (set! (-> s3-0 y) (* (-> s5-0 trans y) arg3 (-> *display* frames-per-second))) + ) + (when (logtest? arg0 4) + (set! (-> s3-0 x) (-> arg1 x)) + (set! (-> s3-0 z) (-> arg1 z)) + (let ((f0-8 (* (fmin (vector-xz-length arg1) (* (vector-xz-length (-> s5-0 trans)) arg4)) + (-> *display* frames-per-second) + ) + ) + (t9-2 vector-xz-normalize!) + ) + (set! (-> obj last-speed) f0-8) + (t9-2 s3-0 f0-8) + ) ) - ) - (t9-2 vector-xz-normalize!) ) - (set! (-> obj last-speed) f0-8) - (t9-2 s3-0 f0-8) - ) + (if (logtest? arg0 16) + (quaternion-normalize! (quaternion*! (-> obj process root quat) (-> obj process root quat) (-> s5-0 quat))) + ) ) - ) - (if (nonzero? (logand arg0 16)) - (quaternion-normalize! - (quaternion*! - (-> obj process root quat) - (-> obj process root quat) - (-> s5-0 quat) - ) - ) - ) ) - ) (-> obj process root) (none) ) diff --git a/goal_src/engine/camera/cam-master.gc b/goal_src/engine/camera/cam-master.gc index 62f671a792..55a3870087 100644 --- a/goal_src/engine/camera/cam-master.gc +++ b/goal_src/engine/camera/cam-master.gc @@ -65,10 +65,11 @@ (set! (-> self foot-offset) (-> *CAMERA_MASTER-bank* onscreen-foot-height)) (set! (-> self head-offset) (-> *CAMERA_MASTER-bank* onscreen-head-height)) (set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height)) - (set! (-> self on-ground) (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) + (set! (-> self on-ground) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) ) (set! (-> self on-pole) #f) (set! (-> self ease-t) 1.0) @@ -99,7 +100,9 @@ ) ) (cond - ((and (logtest? (-> *target* water flags) 4096) (zero? (logand (-> *target* water flags) 16))) + ((and (logtest? (-> *target* water flags) (water-flags wt12)) + (zero? (logand (-> *target* water flags) (water-flags wt04))) + ) (set! (-> self under-water) 2) ) (else @@ -322,7 +325,9 @@ ) ) (cond - ((and (logtest? (-> *target* water flags) 4096) (zero? (logand (-> *target* water flags) 16))) + ((and (logtest? (-> *target* water flags) (water-flags wt12)) + (zero? (logand (-> *target* water flags) (water-flags wt04))) + ) (set! (-> self under-water) 2) ) ((> (-> self under-water) 0) @@ -372,17 +377,18 @@ (vector--float*! s5-2 (-> self tpos-curr) (-> self local-down) (-> self target-height)) (vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2) (vector-! s5-2 s5-2 gp-5) - (let ((f0-20 (fill-and-probe-using-line-sphere - *collide-cache* - s5-2 - gp-5 - 4300.8 - (collide-kind background) - (the-as process #f) - s4-2 - 4098 - ) - ) + (let ((f0-20 + (fill-and-probe-using-line-sphere + *collide-cache* + s5-2 + gp-5 + 4300.8 + (collide-kind background) + (the-as process #f) + s4-2 + 4098 + ) + ) ) (if (and (< 0.0 f0-20) (< f0-20 1.0)) (vector+float*! (-> self tpos-curr) (-> self tpos-curr) gp-5 (+ -1.0 f0-20)) @@ -390,16 +396,17 @@ ) ) ) - (set! (-> self on-ground) (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) + (set! (-> self on-ground) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) ) (let ((gp-6 (new-stack-vector0))) 0.0 (cond - ((and (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + ((and (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (!= (-> *target* control unknown-surface00 name) 'launch-jump) ) @@ -445,7 +452,7 @@ (vector-! gp-6 (-> self tpos-curr) (-> self tpos-old)) (let ((f0-38 (vector-dot gp-6 (-> self local-down)))) (cond - ((logtest? (-> *target* water flags) 512) + ((logtest? (-> *target* water flags) (water-flags wt09)) (set! (-> self upspeed) 0.0) ) ((< 0.0 f0-38) @@ -474,7 +481,7 @@ (reset-follow) ) (let ((v1-196 (-> *target* water flags))) - (when (and (logtest? v1-196 512) (logtest? v1-196 6144)) + (when (and (logtest? v1-196 (water-flags wt09)) (logtest? v1-196 (water-flags wt11 wt12))) (let ((f0-45 (- (-> *target* water base-height) (-> self target-height)))) (if (< (-> self tpos-curr-adj y) f0-45) (set! (-> self tpos-curr-adj y) f0-45) diff --git a/goal_src/engine/camera/cam-states.gc b/goal_src/engine/camera/cam-states.gc index b89c344686..b77a22b3a4 100644 --- a/goal_src/engine/camera/cam-states.gc +++ b/goal_src/engine/camera/cam-states.gc @@ -460,7 +460,10 @@ ) :exit (behavior () - (if (and *target* (logtest? (-> *camera* master-options) 2) (logtest? (-> *target* state-flags) 512)) + (if (and *target* + (logtest? (-> *camera* master-options) 2) + (logtest? (-> *target* state-flags) (state-flags sf09)) + ) (send-event *target* 'end-mode) ) (none) diff --git a/goal_src/engine/collide/collide-reaction-target.gc b/goal_src/engine/collide/collide-reaction-target.gc index 38fabf6480..fb57073b6b 100644 --- a/goal_src/engine/collide/collide-reaction-target.gc +++ b/goal_src/engine/collide/collide-reaction-target.gc @@ -203,7 +203,7 @@ (if (= (-> arg0 poly-pat mode) (pat-mode wall)) (set! sv-104 (logior sv-104 1)) ) - (if (logtest? (-> arg0 unknown-surface00 flags) 2048) + (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags surf11)) (set! sv-104 (logior sv-104 32)) ) (let ((v1-23 (new 'stack-no-clear 'vector))) @@ -251,7 +251,7 @@ (& sv-160) ) ) - (when (zero? (logand (-> arg0 prev-status) 1)) + (when (zero? (logand (-> arg0 prev-status) (cshape-moving-flags onsurf))) (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) (set! sv-96 (logior sv-96 2048)) (when (not sv-160) @@ -314,19 +314,18 @@ ) ) (cond - ((not - (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) - ) - ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) (seconds 0.3)) - (zero? (logand sv-104 32)) - ) - ) - ) + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) (seconds 0.3)) + (zero? (logand sv-104 32)) + ) + ) + ) ) (else (set! sv-104 (logior sv-104 256)) @@ -365,7 +364,7 @@ ) ) (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as uint sv-104)) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) (update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 @@ -374,16 +373,16 @@ arg2 ) (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as uint sv-96) + (the-as cshape-moving-flags sv-96) ) (defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) (if (= (-> arg0 unknown-surface00 mode) 'air) - (logior! (-> arg0 reaction-flag) 32) + (logior! (-> arg0 reaction-flag) (cshape-reaction-flags csrf05)) ) (let ((s5-0 (-> arg0 history-data (-> arg0 unknown-halfword00)))) (update! s5-0 arg0 (-> arg0 trans) arg3 arg2) - (logior! (-> s5-0 status) 256) + (logior! (-> s5-0 status) (cshape-moving-flags csmf08)) ) (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) 0 diff --git a/goal_src/engine/collide/collide-shape-h.gc b/goal_src/engine/collide/collide-shape-h.gc index 77f736256d..7bb3496c7d 100644 --- a/goal_src/engine/collide/collide-shape-h.gc +++ b/goal_src/engine/collide/collide-shape-h.gc @@ -539,7 +539,79 @@ ) ) -;; More complicated collide-shape? +(defenum cshape-moving-flags + :bitfield #t + :type uint64 + (onsurf) + (onground) + (tsurf) + (twall) + (t-ciel) + (t-act) + (csmf06) + (csmf07) + (csmf08) + (csmf09) + (on-water) + (csmf11) + (csmf12) + (csmf13) + (csmf14) + (csmf15) + (csmf16) + (csmf17) + (csmf18) + (csmf19) + (csmf20) + (csmf21) + (csmf22) + (csmf23) + (csmf24) + (csmf25) + (csmf26) + (csmf27) + (csmf28) + (csmf29) + ) + +(defenum cshape-reaction-flags + :bitfield #t + :type uint32 + (csrf00) + (csrf01) + (csrf02) + (csrf03) + (csrf04) + (csrf05) + (csrf06) + (csrf07) + (csrf08) + (csrf09) + (csrf10) + (csrf11) + (csrf12) + (csrf13) + (csrf14) + (csrf15) + (csrf16) + (csrf17) + (csrf18) + (csrf19) + (csrf20) + (csrf21) + (csrf22) + (csrf23) + (csrf24) + (csrf25) + (csrf26) + (csrf27) + (csrf28) + (csrf29) + (csrf30) + (csrf31) + ) + +;; A collide-shape for independently moving objects (deftype collide-shape-moving (collide-shape) ((rider-time time-frame :offset-assert 184) (rider-last-move vector :inline :offset-assert 192) @@ -547,11 +619,11 @@ (poly-pat pat-surface :offset-assert 256) (cur-pat pat-surface :offset-assert 260) (ground-pat pat-surface :offset-assert 264) - (status uint64 :offset-assert 272) - (old-status uint64 :offset-assert 280) - (prev-status uint64 :offset-assert 288) - (reaction-flag uint32 :offset-assert 296) - (reaction (function collide-shape-moving collide-shape-intersect vector vector uint) :offset-assert 300) + (status cshape-moving-flags :offset-assert 272) + (old-status cshape-moving-flags :offset-assert 280) + (prev-status cshape-moving-flags :offset-assert 288) + (reaction-flag cshape-reaction-flags :offset-assert 296) + (reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags) :offset-assert 300) (no-reaction (function collide-shape-moving collide-shape-intersect vector vector none) :offset-assert 304) (local-normal vector :inline :offset-assert 320) (surface-normal vector :inline :offset-assert 336) @@ -564,8 +636,8 @@ (poly-angle float :offset-assert 424) (touch-angle float :offset-assert 428) (coverage float :offset-assert 432) - (dynam dynamics :offset-assert 436) - (surf surface :offset-assert 440) + (dynam dynamics :offset-assert 436) + (surf surface :offset-assert 440) ) :method-count-assert 65 :size-assert #x1bc diff --git a/goal_src/engine/collide/collide-shape.gc b/goal_src/engine/collide/collide-shape.gc index 0ba114210e..eeb800b194 100644 --- a/goal_src/engine/collide/collide-shape.gc +++ b/goal_src/engine/collide/collide-shape.gc @@ -1103,7 +1103,7 @@ ) ) (logior! (-> arg0 status) sv-80) - (the-as uint sv-80) + (the-as cshape-moving-flags sv-80) ) (defun simple-collision-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) @@ -1123,7 +1123,7 @@ ) (let ((v0-1 (logior s5-0 7))) (logior! (-> arg0 status) v0-1) - (the-as uint v0-1) + (the-as cshape-moving-flags v0-1) ) ) ) @@ -1176,7 +1176,7 @@ ) ;; do the collision reaction! this function should move the collide shape. - (set! (-> obj prev-status) (the-as uint ((-> obj reaction) obj s5-0 arg0 arg1))) + (set! (-> obj prev-status) (the-as cshape-moving-flags ((-> obj reaction) obj s5-0 arg0 arg1))) ;; debug draw collision marks. (when *display-collision-marks* @@ -1224,9 +1224,9 @@ ) (else ;; didn't hit anything! call the no-reaction function. - (set! (-> obj reaction-flag) (the-as uint 0)) + (set! (-> obj reaction-flag) (cshape-reaction-flags)) ((-> obj no-reaction) obj s5-0 arg0 arg1) - (set! (-> obj prev-status) (the-as uint 0)) + (set! (-> obj prev-status) (cshape-moving-flags)) ;; and do the move ourself (move-by-vector! obj s2-0) ;; velocity is unchanged @@ -1282,7 +1282,22 @@ (set! (-> obj prev-status) (-> obj status)) ;; setup - (set! (-> obj status) (logand -16128 (-> obj status))) + (logclear! (-> obj status) (cshape-moving-flags + onsurf + onground + tsurf + twall + t-ciel + t-act + csmf06 + csmf07 + csmf09 + on-water + csmf11 + csmf12 + csmf13 + ) + ) (set! (-> obj local-normal quad) (-> obj dynam gravity-normal quad)) (set! (-> obj surface-normal quad) (-> obj dynam gravity-normal quad)) (set! (-> obj poly-normal quad) (-> obj dynam gravity-normal quad)) @@ -1461,7 +1476,22 @@ (set! (-> obj trans-old 1 quad) (-> obj trans-old 0 quad)) (set! (-> obj trans-old 0 quad) (-> obj trans quad)) (set! (-> obj prev-status) (-> obj status)) - (set! (-> obj status) (logand -16128 (-> obj status))) + (logclear! (-> obj status) (cshape-moving-flags + onsurf + onground + tsurf + twall + t-ciel + t-act + csmf06 + csmf07 + csmf09 + on-water + csmf11 + csmf12 + csmf13 + ) + ) (set! (-> obj local-normal quad) (-> obj dynam gravity-normal quad)) (set! (-> obj surface-normal quad) (-> obj dynam gravity-normal quad)) (set! (-> obj poly-normal quad) (-> obj dynam gravity-normal quad)) diff --git a/goal_src/engine/collide/collide-target-h.gc b/goal_src/engine/collide/collide-target-h.gc index 3e5cd0581a..2421fa435f 100644 --- a/goal_src/engine/collide/collide-target-h.gc +++ b/goal_src/engine/collide/collide-target-h.gc @@ -15,9 +15,9 @@ (local-normal vector :inline :offset-assert 64) (surface-normal vector :inline :offset-assert 80) (time time-frame :offset-assert 96) - (status uint64 :offset-assert 104) + (status cshape-moving-flags :offset-assert 104) (pat pat-surface :offset-assert 112) - (reaction-flag uint32 :offset-assert 116) + (reaction-flag cshape-reaction-flags :offset-assert 116) ) :method-count-assert 10 :size-assert #x78 diff --git a/goal_src/engine/debug/default-menu.gc b/goal_src/engine/debug/default-menu.gc index 762d43d129..3d0926e7a8 100644 --- a/goal_src/engine/debug/default-menu.gc +++ b/goal_src/engine/debug/default-menu.gc @@ -624,7 +624,7 @@ (new 'debug 'debug-menu-item-flag - (the-as string (-> s3-1 array-data s2-1 name)) + (-> s3-1 array-data s2-1 name) (-> s3-1 array-data s2-1 name) dm-instance-pick-func ) @@ -636,7 +636,7 @@ (new 'debug 'debug-menu-item-flag - (the-as string (-> s3-1 array-data s2-1 name)) + (-> s3-1 array-data s2-1 name) (-> s3-1 array-data s2-1 name) dm-enable-instance-func ) @@ -3757,15 +3757,18 @@ (function "Play" #f (lambda () (play #t #t))) (function "Start" #f (lambda () (the-as int (start 'debug (get-or-create-continue! *game-info*))))) (function "Stop" #f (lambda () (stop 'debug))) - (flag "Invulnerable" #f (lambda ((arg0 int) (arg1 debug-menu-msg)) - (when (= arg1 (debug-menu-msg press)) - (if *target* - (set! (-> *target* state-flags) (logxor (-> *target* state-flags) 16)) - ) - ) - (the-as symbol (and *target* (logtest? (-> *target* state-flags) 16))) - ) + (flag + "Invulnerable" + #f + (lambda ((arg0 int) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (if *target* + (set! (-> *target* state-flags) (logxor (-> *target* state-flags) (state-flags sf04))) + ) ) + (the-as symbol (and *target* (logtest? (-> *target* state-flags) (state-flags sf04)))) + ) + ) (function "Reset Trans" #f diff --git a/goal_src/engine/draw/process-drawable.gc b/goal_src/engine/draw/process-drawable.gc index e71eac76ad..07d4dd7e3e 100644 --- a/goal_src/engine/draw/process-drawable.gc +++ b/goal_src/engine/draw/process-drawable.gc @@ -1086,8 +1086,8 @@ (defbehavior process-drawable-delay-player process-drawable ((arg0 time-frame)) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -1198,11 +1198,10 @@ (else (set! s5-0 (cond ((valid? (-> s2-0 frame-group) art-joint-anim "joint-control frame-group" #t *valid-con*) - (when (not - (and (>= (the int (-> s2-0 frame-num)) 0) - (< (the int (-> s2-0 frame-num)) (-> s2-0 frame-group data 0 length)) - ) - ) + (when (not (and (>= (the int (-> s2-0 frame-num)) 0) + (< (the int (-> s2-0 frame-num)) (-> s2-0 frame-group data 0 length)) + ) + ) (format *valid-con* "ERROR: ~`joint-control-channel`P #~D has an invalid frame-num ~F/~D [0-~D]~%" diff --git a/goal_src/engine/game/collectables-part.gc b/goal_src/engine/game/collectables-part.gc index d58a812a54..25b24fd0fb 100644 --- a/goal_src/engine/game/collectables-part.gc +++ b/goal_src/engine/game/collectables-part.gc @@ -13,7 +13,7 @@ ;; DECOMP BEGINS (defun eco-fadeout ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) - (if (zero? (logand (-> (the-as process-drawable (-> arg1 key proc)) state-flags) 1)) + (if (zero? (logand (-> (the-as process-drawable (-> arg1 key proc)) state-flags) (state-flags sf00))) (set! (-> arg1 next-time) (the-as uint (* (-> *sp-frame-time* x) 2))) ) 0 @@ -27,7 +27,7 @@ (set! (-> arg2 y) (-> a0-3 world-sphere y)) (set! (-> arg2 z) (-> a0-3 world-sphere z)) ) - (if (zero? (logand (-> v1-1 state-flags) 1)) + (if (zero? (logand (-> v1-1 state-flags) (state-flags sf00))) (set! (-> arg1 next-time) (the-as uint (* (-> *sp-frame-time* x) 2))) ) ) diff --git a/goal_src/engine/game/collectables.gc b/goal_src/engine/game/collectables.gc index b9a37a4070..7677529ab2 100644 --- a/goal_src/engine/game/collectables.gc +++ b/goal_src/engine/game/collectables.gc @@ -172,60 +172,28 @@ (set! (-> obj collect-effect) (-> *part-group-id-table* 68)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 57)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "yel-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "yel-eco-idle" :fo-max 15)) ) (((pickup-type eco-red)) (set! (-> obj eco-effect) (-> *part-group-id-table* 48)) (set! (-> obj collect-effect) (-> *part-group-id-table* 69)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 49)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "red-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "red-eco-idle" :fo-max 15)) ) (((pickup-type eco-blue)) (set! (-> obj eco-effect) (-> *part-group-id-table* 42)) (set! (-> obj collect-effect) (-> *part-group-id-table* 67)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 43)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "blue-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "blue-eco-idle" :fo-max 15)) ) (((pickup-type eco-green)) (set! (-> obj eco-effect) (-> *part-group-id-table* 58)) (set! (-> obj collect-effect) (-> *part-group-id-table* 66)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 61)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "green-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "green-eco-idle" :fo-max 15)) ) (((pickup-type eco-pill)) (set! (-> obj eco-effect) (-> *part-group-id-table* 59)) @@ -234,9 +202,9 @@ ) ) (set! (-> obj part) (create-launch-control (-> obj eco-effect) obj)) - (when (-> obj sound-name) - (set! (-> obj sound) (new 'process 'ambient-sound (-> obj sound-name) (-> obj root-override trans))) - ) + (if (-> obj sound-name) + (set! (-> obj sound) (new 'process 'ambient-sound (-> obj sound-name) (-> obj root-override trans))) + ) (none) ) @@ -639,7 +607,7 @@ (logclear! (-> self mask) (process-mask actor-pause)) (set! (-> self actor-pause) #f) (logior! (-> self flags) (collectable-flags fading)) - (logior! (-> self state-flags) 1) + (logior! (-> self state-flags) (state-flags sf00)) (set! (-> gp-0 fade) (* 0.0033333334 (the float v1-10))) ) ) @@ -1525,7 +1493,7 @@ (not *progress-process*) (!= (-> self next-state name) 'pickup) *target* - (zero? (logand (-> *target* state-flags) #x8100)) + (zero? (logand (-> *target* state-flags) (state-flags sf08 sf15))) ) ) ) @@ -1670,13 +1638,12 @@ (set! (-> self state-object) #f) (kill-and-free-particles (-> self part)) (logior! (-> self draw status) (draw-status skip-bones)) - (if (not - (or (logtest? (the-as int (res-lump-value (-> self entity) 'options uint128 :time (the-as float -1000000000.0))) - 4096 - ) - (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9))) - ) - ) + (if (not (or (logtest? (res-lump-value (-> self entity) 'options fact-options :time (the-as float -1000000000.0)) + (fact-options powerup) + ) + (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9))) + ) + ) (send-event *camera* 'teleport-to-other-start-string) ) ) @@ -2115,19 +2082,8 @@ (set! (-> obj base quad) (-> obj root-override trans quad)) (set! (-> obj old-base quad) (-> obj root-override trans quad)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 63) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "powercell-idle") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "powercell-idle" :fo-max 40) (-> obj root-override trans)) ) (set! (-> obj victory-anim) (fuel-cell-pick-anim obj)) obj @@ -2171,11 +2127,10 @@ (go-virtual jump) ) ((and gp-1 - (zero? - (logand (the-as int (res-lump-value (-> self entity) 'options uint128 :time (the-as float -1000000000.0))) - 128 - ) - ) + (zero? (logand (res-lump-value (-> self entity) 'options fact-options :time (the-as float -1000000000.0)) + (fact-options fop7) + ) + ) (zero? (logand (-> self fact options) (fact-options fop7))) ) (set! (-> self jump-pos quad) (-> (the-as vector gp-1) quad)) @@ -2471,19 +2426,8 @@ (set! (-> obj fact) (new 'process 'fact-info obj (pickup-type buzzer) (the-as float 0.0))) (initialize-skeleton obj *buzzer-sg* '()) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 65) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "buzzer") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "buzzer" :fo-max 40) (-> obj root-override trans)) ) (set! (-> obj victory-anim) (fuel-cell-pick-anim obj)) obj diff --git a/goal_src/engine/game/crates.gc b/goal_src/engine/game/crates.gc index 232d13b7b0..65b60e1e47 100644 --- a/goal_src/engine/game/crates.gc +++ b/goal_src/engine/game/crates.gc @@ -537,9 +537,8 @@ ) (else (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y))) - (if (not - (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese))) - ) + (if (not (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese))) + ) (level-hint-spawn (game-text-id sage-voicebox-hint-crate-iron) "sagevb36" @@ -1375,15 +1374,7 @@ (set! (-> obj sound) (new 'process 'ambient-sound - (new 'static 'sound-spec - :mask #x82 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "buzzer") - :volume #x400 - :pitch-mod -762 - :fo-max 40 - ) + (static-sound-spec "buzzer" :pitch-mod -762 :fo-max 40) (-> obj root-override trans) ) ) diff --git a/goal_src/engine/game/effect-control.gc b/goal_src/engine/game/effect-control.gc index efaf7a3532..7f240070af 100644 --- a/goal_src/engine/game/effect-control.gc +++ b/goal_src/engine/game/effect-control.gc @@ -84,39 +84,39 @@ (while (> arg2 0) (case (the int (-> arg1 0)) ((3) - (logior! (-> arg0 mask) 1) + (logior! (-> arg0 mask) (sound-mask volume)) (set! (-> arg0 volume) (the int (* 10.24 (-> arg1 1)))) ) ((4) - (logior! (-> arg0 mask) 1) + (logior! (-> arg0 mask) (sound-mask volume)) (+! (-> arg0 volume) (the int (* 10.24 (* (-> arg1 1) (rand-vu))))) ) ((5) - (logior! (-> arg0 mask) 2) + (logior! (-> arg0 mask) (sound-mask pitch)) (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) ) ((6) - (logior! (-> arg0 mask) 2) + (logior! (-> arg0 mask) (sound-mask pitch)) (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) ) ((9) - (logior! (-> arg0 mask) 4) + (logior! (-> arg0 mask) (sound-mask bend)) (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) ) ((10) - (logior! (-> arg0 mask) 4) + (logior! (-> arg0 mask) (sound-mask bend)) (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) ) ((11) - (logior! (-> arg0 mask) 64) + (logior! (-> arg0 mask) (sound-mask fo-min)) (set! (-> arg0 fo-min) (the int (-> arg1 1))) ) ((12) - (logior! (-> arg0 mask) 128) + (logior! (-> arg0 mask) (sound-mask fo-max)) (set! (-> arg0 fo-max) (the int (-> arg1 1))) ) ((13) - (logior! (-> arg0 mask) 256) + (logior! (-> arg0 mask) (sound-mask fo-curve)) (set! (-> arg0 fo-curve) (the int (-> arg1 1))) ) ((19) @@ -506,10 +506,10 @@ ) (let ((a2-29 (-> *display* frames (-> *display* last-screen) frame run-time))) (cond - ((< 9000 (the-as int a2-29)) + ((< 9000 a2-29) (set! a1-42 (* a1-42 4)) ) - ((< 7000 (the-as int a2-29)) + ((< 7000 a2-29) (set! a1-42 (* a1-42 2)) ) ) @@ -583,7 +583,7 @@ (set! s1-0 (sound-name-with-material 'flut-land arg4 "")) ) (('effect-land-poof) - (when (< (the-as int a0-4) 9000) + (when (< a0-4 9000) (let* ((a0-13 obj) (t9-8 (method-of-object a0-13 dummy-10)) (v1-15 (-> arg4 material)) @@ -650,7 +650,7 @@ ) ) (('effect-run-poof) - (when (< (the-as int a0-4) 9000) + (when (< a0-4 9000) (let* ((a0-14 obj) (t9-9 (method-of-object a0-14 dummy-10)) (v1-20 (-> arg4 material)) @@ -782,7 +782,7 @@ ) ) (('effect-just-poof) - (when (< (the-as int a0-4) 9000) + (when (< a0-4 9000) (let* ((a0-16 obj) (t9-11 (method-of-object a0-16 dummy-10)) (v1-29 (-> arg4 material)) @@ -1075,9 +1075,9 @@ ) ) (set! (-> gp-0 sound-name) s0-0) - (logior! (-> gp-0 mask) 1) + (logior! (-> gp-0 mask) (sound-mask volume)) (set! (-> gp-0 volume) 1024) - (logior! (-> gp-0 mask) 4) + (logior! (-> gp-0 mask) (sound-mask bend)) (set! (-> gp-0 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) (set! sv-112 (new 'static 'res-tag)) (let* ((t9-3 (method-of-type res-lump get-property-data)) @@ -1148,7 +1148,7 @@ #t ) ) - ((logtest? (-> self water flags) 512) + ((logtest? (-> self water flags) (water-flags wt09)) (dummy-10 (-> self skel effect) 'effect-land-water -1.0 -1) ) (else diff --git a/goal_src/engine/game/game-h.gc b/goal_src/engine/game/game-h.gc index 0a6c12fc6b..7956d38a8b 100644 --- a/goal_src/engine/game/game-h.gc +++ b/goal_src/engine/game/game-h.gc @@ -17,6 +17,43 @@ (declare-type water-control basic) (declare-type collide-shape basic) +(defenum state-flags + :bitfield #t + :type uint32 + (sf00) + (sf01) + (sf02) + (sf03) + (sf04) + (sf05) + (sf06) + (sf07) + (sf08) + (sf09) + (sf10) + (sf11) + (sf12) + (sf13) + (sf14) + (sf15) + (sf16) + (sf17) + (sf18) + (sf19) + (sf20) + (sf21) + (sf22) + (sf23) + (sf24) + (sf25) + (sf26) + (sf27) + (sf28) + (sf29) + (sf30) + (sf31) + ) + ;; DECOMP BEGINS @@ -64,7 +101,7 @@ (sound ambient-sound :offset-assert 160) ;; seems to only be used in target? - (state-flags uint32 :offset-assert 164) + (state-flags state-flags :offset-assert 164) ;; the time when we last did something. Used for different things in different objects (state-time time-frame :offset-assert 168) diff --git a/goal_src/engine/game/generic-obs.gc b/goal_src/engine/game/generic-obs.gc index a5f77bdc15..a56f9aa8d1 100644 --- a/goal_src/engine/game/generic-obs.gc +++ b/goal_src/engine/game/generic-obs.gc @@ -2048,7 +2048,7 @@ (set! (-> v1-0 parms volume) -4) (set! (-> v1-0 auto-time) 120) (set! (-> v1-0 auto-from) 2) - (set! (-> v1-0 parms mask) (the-as uint 17)) + (set! (-> v1-0 parms mask) (sound-mask volume time)) (-> v1-0 id) ) (none) diff --git a/goal_src/engine/game/powerups.gc b/goal_src/engine/game/powerups.gc index 73eb5ad188..b2a457ec41 100644 --- a/goal_src/engine/game/powerups.gc +++ b/goal_src/engine/game/powerups.gc @@ -646,7 +646,7 @@ (set! (-> v1-64 parms volume) -4) (set! (-> v1-64 auto-time) 48) (set! (-> v1-64 auto-from) 2) - (set! (-> v1-64 parms mask) (the-as uint 17)) + (set! (-> v1-64 parms mask) (sound-mask volume time)) (-> v1-64 id) ) ) @@ -665,12 +665,12 @@ ) (set! (-> self fact-info-target eco-level) 0.0) (set! (-> self fact-info-target eco-timeout) 0) - (set! (-> self state-flags) (logand -65 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf06)) (send-event self 'reset-collide) (stop! (-> self sound)) ) (when (and (< 0.0 (-> self fact-info-target eco-level)) - (zero? (logand (-> self state-flags) 512)) + (zero? (logand (-> self state-flags) (state-flags sf09))) (zero? (logand (-> self draw status) (draw-status hidden no-anim))) (not (movie?)) (rand-vu-percent? @@ -758,7 +758,9 @@ (change-sound! (-> self sound) (static-sound-name "blue-eco-jak")) (let ((v1-150 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) (cond - ((and (logtest? (-> self control unknown-surface00 flags) 2048) (zero? (logand (-> self control status) 1))) + ((and (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) (set! (-> *part-id-table* 259 init-specs 4 initial-valuef) 0.0) (set! (-> *part-id-table* 259 init-specs 4 random-rangef) 65536.0) ) diff --git a/goal_src/engine/game/projectiles.gc b/goal_src/engine/game/projectiles.gc index 53d14e0f07..20a6aae626 100644 --- a/goal_src/engine/game/projectiles.gc +++ b/goal_src/engine/game/projectiles.gc @@ -142,7 +142,7 @@ (set! sv-80 (logior sv-80 16)) ) (set! sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (zero? (logand (-> arg0 prev-status) 1)) + (if (zero? (logand (-> arg0 prev-status) (cshape-moving-flags onsurf))) (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) ) (set! sv-80 (logior sv-80 4)) @@ -170,7 +170,7 @@ ) ) (logior! (-> arg0 status) sv-80) - (the-as uint sv-80) + (the-as cshape-moving-flags sv-80) ) (defpartgroup group-yellow-eco-fireball @@ -723,7 +723,9 @@ (countdown (v1-35 16) (+! f0-16 (-> self old-dist v1-35)) ) - (if (or (and (logtest? (-> self root-override status) 8) (< f0-16 2048.0)) (< f0-16 204.8)) + (if (or (and (logtest? (-> self root-override status) (cshape-moving-flags twall)) (< f0-16 2048.0)) + (< f0-16 204.8) + ) (set! gp-0 #t) ) ) @@ -745,7 +747,7 @@ (s3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) (f30-0 (vector-length (-> arg0 root-override transv))) ) - (if (logtest? (-> arg0 root-override status) 4) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags tsurf)) (vector-flatten! s5-1 s5-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s5-1 1.0) @@ -989,7 +991,7 @@ (case (-> *target* current-level name) (('swamp) (set! (-> obj water) (new 'process 'water-control obj 0 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water flags) (water-flags wt01 wt04 wt07)) (set! (-> obj water height) (if (logtest? (-> obj options) 64) 8192.0 10240.0 @@ -1000,7 +1002,7 @@ (('ogre) (when (zero? (logand (-> obj options) 128)) (set! (-> obj water) (new 'process 'water-control obj 0 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water flags) (water-flags wt01 wt04 wt07)) (set! (-> obj water height) 129024.0) (logior! (-> obj root-override root-prim collide-with) (collide-kind water)) ) @@ -1008,7 +1010,7 @@ (('finalboss) (set! (-> obj root-override trans y) (+ 4096.0 (-> obj root-override trans y))) (set! (-> obj water) (new 'process 'water-control obj 0 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water flags) (water-flags wt01 wt04 wt07)) (set! (-> obj water height) 1977958.4) (logior! (-> obj root-override root-prim collide-with) (collide-kind water)) ) @@ -1072,7 +1074,7 @@ ) (sound-trans-convert (-> s5-0 parms trans) a1-3) ) - (set! (-> s5-0 parms mask) (the-as uint 32)) + (set! (-> s5-0 parms mask) (sound-mask trans)) (-> s5-0 id) ) 0 diff --git a/goal_src/engine/game/task/process-taskable.gc b/goal_src/engine/game/task/process-taskable.gc index 8eb01b603f..d3643f4645 100644 --- a/goal_src/engine/game/task/process-taskable.gc +++ b/goal_src/engine/game/task/process-taskable.gc @@ -764,7 +764,7 @@ (defbehavior process-taskable-hide-enter process-taskable () (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((v1-3 (-> self draw shadow-ctrl))) - (logior! (-> v1-3 settings flags) 32) + (logior! (-> v1-3 settings flags) (shadow-flags shdf05)) ) 0 (process-taskable-clean-up-after-talking) @@ -786,7 +786,7 @@ (restore-collide-with-as (-> self root-override)) (process-entity-status! self (entity-perm-status bit-3) #t) (let ((v1-7 (-> self draw shadow-ctrl))) - (set! (-> v1-7 settings flags) (logand -33 (-> v1-7 settings flags))) + (logclear! (-> v1-7 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -1052,11 +1052,10 @@ ) ((begin (dummy-46 self) - (and (not - (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) + (and (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) (< (-> (target-pos 0) y) (+ 8192.0 (-> self root-override root-prim prim-core world-sphere y))) (less-than-hack (vector-vector-distance (target-pos 0) (the-as vector (-> self root-override root-prim prim-core))) 32768.0 @@ -1443,7 +1442,7 @@ ) (else (let ((v1-10 gp-0)) - (logior! (-> v1-10 settings flags) 32) + (logior! (-> v1-10 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/engine/gfx/shadow/shadow-cpu-h.gc b/goal_src/engine/gfx/shadow/shadow-cpu-h.gc index 07a797cfab..6a98a3893a 100644 --- a/goal_src/engine/gfx/shadow/shadow-cpu-h.gc +++ b/goal_src/engine/gfx/shadow/shadow-cpu-h.gc @@ -5,9 +5,46 @@ ;; name in dgo: shadow-cpu-h ;; dgos: GAME, ENGINE +(defenum shadow-flags + :bitfield #t + :type int32 + (shdf00) + (shdf01) + (shdf02) + (shdf03) + (shdf04) + (shdf05) + (shdf06) + (shdf07) + (shdf08) + (shdf09) + (shdf10) + (shdf11) + (shdf12) + (shdf13) + (shdf14) + (shdf15) + (shdf16) + (shdf17) + (shdf18) + (shdf19) + (shdf20) + (shdf21) + (shdf22) + (shdf23) + (shdf24) + (shdf25) + (shdf26) + (shdf27) + (shdf28) + (shdf29) + (shdf30) + (shdf31) + ) + (deftype shadow-settings (structure) ((center vector :inline :offset-assert 0) - (flags int32 :offset 12) + (flags shadow-flags :offset 12) (shadow-dir vector :inline :offset-assert 16) (dist-to-locus float :offset 28) (bot-plane plane :inline :offset-assert 32) diff --git a/goal_src/engine/gfx/shadow/shadow-cpu.gc b/goal_src/engine/gfx/shadow/shadow-cpu.gc index a229fbc39e..ecddd88f20 100644 --- a/goal_src/engine/gfx/shadow/shadow-cpu.gc +++ b/goal_src/engine/gfx/shadow/shadow-cpu.gc @@ -5,6 +5,8 @@ ;; name in dgo: shadow-cpu ;; dgos: GAME, ENGINE +;; DECOMP BEGINS + (defmethod asize-of shadow-geo ((obj shadow-geo)) (the-as int (-> obj total-size)) ) @@ -443,6 +445,7 @@ :flag-assert #x900000010 ) + (deftype shadow-dcache (structure) ((vtx-table uint32 :offset-assert 0) (single-edge-table uint32 :offset-assert 4) @@ -599,7 +602,7 @@ 0.0 ) (let ((v1-2 obj)) - (set! (-> v1-2 settings flags) (logand -33 (-> v1-2 settings flags))) + (logclear! (-> v1-2 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-4 obj)) @@ -611,7 +614,7 @@ ) (else (let ((v1-7 obj)) - (logior! (-> v1-7 settings flags) 32) + (logior! (-> v1-7 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -620,4 +623,8 @@ 0 (none) ) - ) \ No newline at end of file + ) + + + + diff --git a/goal_src/engine/gfx/shadow/shadow.gc b/goal_src/engine/gfx/shadow/shadow.gc index 11f21620da..135487715a 100644 --- a/goal_src/engine/gfx/shadow/shadow.gc +++ b/goal_src/engine/gfx/shadow/shadow.gc @@ -154,7 +154,7 @@ ) (defbehavior do-target-shadow target () - (if (and (logtest? (-> self control status) 1) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (!= (-> self control unknown-surface00 mode) 'swim) (!= (-> self control unknown-surface00 mode) 'dive) (!= (-> self next-state name) 'target-flop) diff --git a/goal_src/engine/gfx/water/water-h.gc b/goal_src/engine/gfx/water/water-h.gc index d07ce9e2e1..638494a32d 100644 --- a/goal_src/engine/gfx/water/water-h.gc +++ b/goal_src/engine/gfx/water/water-h.gc @@ -5,59 +5,47 @@ ;; name in dgo: water-h ;; dgos: GAME, ENGINE -(define-extern *water-anim-sunken-dark-eco-qbert-sg* skeleton-group) -(define-extern *water-anim-sunken-dark-eco-platform-room-sg* skeleton-group) -(define-extern *water-anim-sunken-dark-eco-helix-room-sg* skeleton-group) -(define-extern *water-anim-sunken-big-room-sg* skeleton-group) -(define-extern *water-anim-sunken-first-room-from-entrance-sg* skeleton-group) -(define-extern *water-anim-sunken-qbert-room-sg* skeleton-group) -(define-extern *water-anim-sunken-first-right-branch-sg* skeleton-group) -(define-extern *water-anim-sunken-circular-with-bullys-sg* skeleton-group) -(define-extern *water-anim-sunken-hall-with-one-whirlpool-sg* skeleton-group) -(define-extern *water-anim-sunken-hall-with-three-whirlpools-sg* skeleton-group) -(define-extern *water-anim-sunken-start-of-helix-slide-sg* skeleton-group) -(define-extern *water-anim-sunken-room-above-exit-chamber-sg* skeleton-group) -(define-extern *water-anim-sunken-hall-before-big-room-sg* skeleton-group) -(define-extern *water-anim-sunken-short-piece-sg* skeleton-group) -(define-extern *water-anim-sunken-big-room-upper-water-sg* skeleton-group) -(define-extern *water-anim-maincave-center-pool-sg* skeleton-group) -(define-extern *water-anim-maincave-lower-right-pool-sg* skeleton-group) -(define-extern *water-anim-maincave-mid-right-pool-sg* skeleton-group) -(define-extern *water-anim-maincave-lower-left-pool-sg* skeleton-group) -(define-extern *water-anim-maincave-mid-left-pool-sg* skeleton-group) -(define-extern *water-anim-maincave-water-with-crystal-sg* skeleton-group) -(define-extern *water-anim-robocave-main-pool-sg* skeleton-group) -(define-extern *water-anim-misty-mud-by-arena-sg* skeleton-group) -(define-extern *water-anim-misty-mud-above-skeleton-sg* skeleton-group) -(define-extern *water-anim-misty-mud-behind-skeleton-sg* skeleton-group) -(define-extern *water-anim-misty-mud-above-skull-back-sg* skeleton-group) -(define-extern *water-anim-misty-mud-above-skull-front-sg* skeleton-group) -(define-extern *water-anim-misty-mud-other-near-skull-sg* skeleton-group) -(define-extern *water-anim-misty-mud-near-skull-sg* skeleton-group) -(define-extern *water-anim-misty-mud-under-spine-sg* skeleton-group) -(define-extern *water-anim-misty-mud-by-dock-sg* skeleton-group) -(define-extern *water-anim-misty-mud-island-near-dock-sg* skeleton-group) -(define-extern *water-anim-misty-mud-lonely-island-sg* skeleton-group) -(define-extern *water-anim-misty-dark-eco-pool-sg* skeleton-group) -(define-extern *water-anim-ogre-lava-sg* skeleton-group) -(define-extern *water-anim-jungle-river-sg* skeleton-group) -(define-extern *water-anim-village3-lava-sg* skeleton-group) -(define-extern *water-anim-training-lake-sg* skeleton-group) -(define-extern *water-anim-darkcave-water-with-crystal-sg* skeleton-group) -(define-extern *water-anim-rolling-water-back-sg* skeleton-group) -(define-extern *water-anim-rolling-water-front-sg* skeleton-group) -(define-extern *water-anim-finalboss-dark-eco-pool-sg* skeleton-group) -(define-extern *water-anim-lavatube-energy-lava-sg* skeleton-group) -(define-extern *water-anim-village1-rice-paddy-sg* skeleton-group) -(define-extern *water-anim-village1-fountain-sg* skeleton-group) -(define-extern *water-anim-village1-rice-paddy-mid-sg* skeleton-group) -(define-extern *water-anim-village1-rice-paddy-top-sg* skeleton-group) -(define-extern *water-anim-village2-bucket-sg* skeleton-group) +(defenum water-flags + :bitfield #t + :type uint32 + (wt00) + (wt01) + (wt02) + (wt03) + (wt04) + (wt05) + (wt06) + (wt07) + (wt08) + (wt09) + (wt10) + (wt11) + (wt12) + (wt13) + (wt14) + (wt15) + (wt16) + (wt17) + (wt18) + (wt19) + (wt20) + (wt21) + (wt22) + (wt23) + (wt24) + (wt25) + (wt26) + (wt27) + (wt28) + (wt29) + (wt30) + (wt31) + ) ;; DECOMP BEGINS (deftype water-control (basic) - ((flags uint32 :offset-assert 4) + ((flags water-flags :offset-assert 4) (process process-drawable :offset-assert 8) (joint-index int32 :offset-assert 12) (top-y-offset float :offset-assert 16) @@ -110,7 +98,7 @@ (defmethod display-water-marks? water-control ((obj water-control)) - (and *display-water-marks* (logtest? (-> obj flags) 1)) + (and *display-water-marks* (logtest? (-> obj flags) (water-flags wt00))) ) (defmethod new water-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 int) (arg2 float) (arg3 float) (arg4 float)) @@ -133,13 +121,13 @@ ) (deftype water-vol (process-drawable) - ((water-height meters :offset-assert 176) - (wade-height meters :offset-assert 180) - (swim-height meters :offset-assert 184) - (bottom-height meters :offset-assert 188) - (attack-event symbol :offset-assert 192) - (target handle :offset-assert 200) - (flags uint32 :offset-assert 208) + ((water-height meters :offset-assert 176) + (wade-height meters :offset-assert 180) + (swim-height meters :offset-assert 184) + (bottom-height meters :offset-assert 188) + (attack-event symbol :offset-assert 192) + (target handle :offset-assert 200) + (flags water-flags :offset-assert 208) ) :heap-base #x70 :method-count-assert 30 @@ -151,11 +139,11 @@ (TODO-RENAME-22 (_type_) none 22) (reset-root! (_type_) none 23) (set-stack-size! (_type_) none 24) - (TODO-RENAME-25 (_type_) object 25) + (TODO-RENAME-25 (_type_) none 25) (TODO-RENAME-26 (_type_) none 26) (dummy-27 (_type_) none 27) (get-ripple-height (_type_ vector) float 28) - (TODO-RENAME-29 (_type_) uint 29) + (TODO-RENAME-29 (_type_) none 29) ) ) diff --git a/goal_src/engine/gfx/water/water.gc b/goal_src/engine/gfx/water/water.gc index 7d92defab2..7041008186 100644 --- a/goal_src/engine/gfx/water/water.gc +++ b/goal_src/engine/gfx/water/water.gc @@ -679,11 +679,11 @@ (with-pp (let ((s5-0 (-> obj flags))) (cond - ((zero? (logand (-> obj flags) 2)) - (set! (-> obj flags) (logand -97793 (-> obj flags))) + ((zero? (logand (-> obj flags) (water-flags wt01))) + (logclear! (-> obj flags) (water-flags wt09 wt10 wt11 wt12 wt13 wt14 wt16)) ) - ((and (logtest? #x200000 (-> obj flags)) (logtest? (-> obj process state-flags) 256)) - (set! (-> obj flags) (logior #x10000 (-> obj flags))) + ((and (logtest? (water-flags wt21) (-> obj flags)) (logtest? (-> obj process state-flags) (state-flags sf08))) + (set! (-> obj flags) (logior (water-flags wt16) (-> obj flags))) ) ((begin (set! (-> obj top 1 quad) (-> obj top 0 quad)) @@ -691,28 +691,27 @@ (+! (-> obj top 0 y) (-> obj top-y-offset)) (set! (-> obj bottom 1 quad) (-> obj bottom 0 quad)) (set! (-> obj bottom 0 quad) (-> obj process root trans quad)) - (set! (-> obj flags) (logand -31745 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt10 wt11 wt12 wt13 wt14)) (set! (-> obj bob-offset) (update! (-> obj bob))) (cond - ((and (logtest? (-> obj flags) 256) - (zero? - (logand (-> (the-as collide-shape-moving (-> obj process root)) root-prim prim-core action) - (collide-action ca-9) - ) - ) + ((and (logtest? (-> obj flags) (water-flags wt08)) + (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) root-prim prim-core action) + (collide-action ca-9) + ) + ) ) (set! (-> obj real-ocean-offset) (- (ocean-get-height (the-as vector (-> obj bottom))) (-> obj base-height))) - (if (zero? (logand (-> obj flags) 512)) + (if (zero? (logand (-> obj flags) (water-flags wt09))) (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) (set! (-> obj ocean-offset) (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2)) ) ) - ((logtest? #x100000 (-> obj flags)) + ((logtest? (water-flags wt20) (-> obj flags)) (let* ((a0-26 (-> obj volume process 0)) (f30-0 (ripple-find-height (the-as process-drawable a0-26) 0 (the-as vector (-> obj bottom)))) ) (set! (-> obj real-ocean-offset) (- f30-0 (-> obj base-height))) - (if (zero? (logand (-> obj flags) 512)) + (if (zero? (logand (-> obj flags) (water-flags wt09))) (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) (set! (-> obj ocean-offset) (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2)) ) @@ -739,13 +738,13 @@ (set! (-> obj swim-depth) (fmax 0.0 (- (- (-> obj surface-height) (-> obj swim-height)) (-> obj bottom 0 y)))) (>= (-> obj height) (-> obj bottom 0 y)) ) - (if (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 1024) + (if (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags on-water)) (set! (-> obj on-water-time) (-> *display* base-frame-counter)) ) (set! (-> obj drip-wetness) 1.0) (set! (-> obj drip-height) (fmax (- (-> obj surface-height) (-> obj bottom 0 y)) (-> obj drip-height))) (set! (-> obj drip-speed) 15.0) - (if (zero? (logand (-> obj flags) 512)) + (if (zero? (logand (-> obj flags) (water-flags wt09))) (TODO-RENAME-15 obj) ) (cond @@ -756,8 +755,8 @@ (set! (-> s4-0 y) (-> obj surface-height)) (when (and (logtest? (-> obj process draw status) (draw-status was-drawn)) (zero? (-> obj process draw cur-lod)) - (logtest? #x400000 (-> obj flags)) - (logtest? #x800000 (-> obj flags)) + (logtest? (water-flags wt22) (-> obj flags)) + (logtest? (water-flags wt23) (-> obj flags)) ) (let ((f30-1 (y-angle (-> obj process root))) (f28-0 (vector-xz-length (-> obj process root transv))) @@ -812,10 +811,10 @@ ) ) (else - (logior! (-> obj flags) 8192) + (logior! (-> obj flags) (water-flags wt13)) ) ) - (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (when (and (logtest? (-> obj flags) (water-flags wt05)) (logtest? (water-flags wt23) (-> obj flags))) (let* ((v1-124 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) (s4-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data v1-124))) ) @@ -860,22 +859,25 @@ ) ) ) - (if (and (logtest? (-> obj flags) 16) - (and s4-3 (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) 1024))) + (if (and (logtest? (-> obj flags) (water-flags wt04)) + (and s4-3 + (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags on-water)) + ) + ) ) (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) ) (cond - ((and (logtest? (-> obj flags) 8) - (or (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 1024) + ((and (logtest? (-> obj flags) (water-flags wt03)) + (or (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags on-water)) (>= f30-3 (-> obj bottom 0 y)) - (and (logtest? s5-0 2048) - (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 4) - (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) 1)) + (and (logtest? s5-0 (water-flags wt11)) + (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags tsurf)) + (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags onsurf))) (>= (+ 204.8 f30-3) (-> obj bottom 0 y)) ) ) - (or (logtest? s5-0 2048) + (or (logtest? s5-0 (water-flags wt11)) (< 12288.0 (vector-xz-length (-> obj process root transv))) (< (+ (-> *display* base-frame-counter) (seconds -0.2)) (-> obj enter-water-time)) (>= (+ (- 204.8 (fmin 6144.0 (+ (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)))) f30-3) @@ -885,39 +887,39 @@ ) (set! (-> obj swim-time) (-> *display* base-frame-counter)) (send-event (-> obj process) 'swim) - (logior! (-> obj flags) 2048) - (if (zero? (logand s5-0 2048)) + (logior! (-> obj flags) (water-flags wt11)) + (if (zero? (logand s5-0 (water-flags wt11))) (set! (-> obj enter-swim-time) (-> *display* base-frame-counter)) ) (cond - ((and (logtest? (-> obj flags) 16) - (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 4) - (zero? (logand #x10000 (-> obj flags))) + ((and (logtest? (-> obj flags) (water-flags wt04)) + (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags tsurf)) + (zero? (logand (water-flags wt16) (-> obj flags))) ) (let ((v1-200 (new 'stack-no-clear 'vector))) (set! (-> v1-200 quad) (-> obj bottom 0 quad)) (set! (-> v1-200 y) (- (-> obj height) (-> obj swim-height))) (let ((s4-4 (-> obj process root))) - (when (and (zero? (logand (-> (the-as collide-shape-moving s4-4) status) 4096)) - (logtest? (-> obj flags) 2048) + (when (and (zero? (logand (-> (the-as collide-shape-moving s4-4) status) (cshape-moving-flags csmf12))) + (logtest? (-> obj flags) (water-flags wt11)) (zero? (logand (-> (the-as collide-shape-moving s4-4) root-prim prim-core action) (collide-action ca-9))) ) (let ((a1-27 (vector-! (new 'stack-no-clear 'vector) v1-200 (-> s4-4 trans)))) (vector-float*! a1-27 a1-27 (-> *display* frames-per-second)) (integrate-and-collide! (the-as collide-shape-moving s4-4) a1-27) ) - (logior! (-> (the-as collide-shape-moving s4-4) status) 1031) + (logior! (-> (the-as collide-shape-moving s4-4) status) (cshape-moving-flags onsurf onground tsurf on-water)) ) ) ) ) - ((and (< (-> obj bottom 0 y) f30-3) (zero? (logand #x10000 (-> obj flags)))) - (logior! (-> obj flags) 4096) + ((and (< (-> obj bottom 0 y) f30-3) (zero? (logand (water-flags wt16) (-> obj flags)))) + (logior! (-> obj flags) (water-flags wt12)) ) ) ) ((begin - (set! s4-3 (and (logtest? (-> obj flags) 4) + (set! s4-3 (and (logtest? (-> obj flags) (water-flags wt02)) (or (not (!= (-> obj bob amp) 0.0)) (>= (- (-> *display* base-frame-counter) (-> obj swim-time)) (seconds 0.05)) ) @@ -928,15 +930,15 @@ ) (set! (-> obj wade-time) (-> *display* base-frame-counter)) (send-event (-> obj process) 'wade) - (logior! (-> obj flags) 1024) + (logior! (-> obj flags) (water-flags wt10)) ) ) ) - (when (and (logtest? (-> obj flags) 8) + (when (and (logtest? (-> obj flags) (water-flags wt03)) (< (-> obj bottom 1 y) f30-3) - (and (< f30-3 (-> obj bottom 0 y)) (logtest? s5-0 4096)) + (and (< f30-3 (-> obj bottom 0 y)) (logtest? s5-0 (water-flags wt12))) ) - (logior! (-> obj flags) 2048) + (logior! (-> obj flags) (water-flags wt11)) (let ((a1-30 (new 'stack-no-clear 'vector))) (set! (-> a1-30 quad) (-> obj bottom 0 quad)) (let ((s5-1 (-> obj process root))) @@ -944,7 +946,7 @@ (when (zero? (logand (-> (the-as collide-shape-moving s5-1) root-prim prim-core action) (collide-action ca-9))) (let ((f30-4 (-> (the-as collide-shape-moving s5-1) ground-impact-vel))) (move-to-ground-point! (the-as collide-shape-moving s5-1) a1-30 (-> s5-1 transv) *up-vector*) - (logior! (-> (the-as collide-shape-moving s5-1) status) 1024) + (logior! (-> (the-as collide-shape-moving s5-1) status) (cshape-moving-flags on-water)) (set! (-> (the-as collide-shape-moving s5-1) ground-impact-vel) f30-4) ) ) @@ -952,8 +954,10 @@ ) ) ) - (when (and (logtest? #x20000 (-> obj flags)) (= (-> obj process type) target)) - (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 1025) + (when (and (logtest? (water-flags wt17) (-> obj flags)) (= (-> obj process type) target)) + (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) + (cshape-moving-flags onsurf on-water) + ) (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) root-prim prim-core action) (collide-action ca-9) ) @@ -1008,17 +1012,19 @@ ) ) (else - (if (logtest? (-> obj flags) 512) + (if (logtest? (-> obj flags) (water-flags wt09)) (TODO-RENAME-16 obj) ) ) ) ) - (when (not - (or (zero? (logand (-> obj flags) 64)) (zero? (logand #x800000 (-> obj flags))) (= (-> obj drip-wetness) 0.0)) - ) + (when (not (or (zero? (logand (-> obj flags) (water-flags wt06))) + (zero? (logand (water-flags wt23) (-> obj flags))) + (= (-> obj drip-wetness) 0.0) + ) + ) (cond - ((logtest? (-> obj flags) #x8000) + ((logtest? (-> obj flags) (water-flags wt15)) (let ((a2-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data (-> obj drip-joint-index))) ) @@ -1039,7 +1045,7 @@ ) ) (set! (-> obj drip-time) (-> *display* base-frame-counter)) - (set! (-> obj flags) (logand -32769 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt15)) (seek! (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) (if (= (-> obj drip-wetness) 0.0) @@ -1059,7 +1065,7 @@ ) (set! (-> obj drip-joint-index) s5-2) (set! (-> obj drip-old-pos quad) (-> v1-328 quad)) - (logior! (-> obj flags) #x8000) + (logior! (-> obj flags) (water-flags wt15)) ) ) ) @@ -1169,11 +1175,11 @@ (defmethod TODO-RENAME-15 water-control ((obj water-control)) (with-pp - (logior! (-> obj flags) 512) - (set! (-> obj flags) (logand -65537 (-> obj flags))) + (logior! (-> obj flags) (water-flags wt09)) + (logclear! (-> obj flags) (water-flags wt16)) (set! (-> obj enter-water-time) (-> *display* base-frame-counter)) (set-vector! (-> obj enter-water-pos) (-> obj bottom 0 x) (-> obj surface-height) (-> obj bottom 0 z) 1.0) - (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (when (and (logtest? (-> obj flags) (water-flags wt05)) (logtest? (water-flags wt23) (-> obj flags))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) pp) (set! (-> a1-1 num-params) 1) @@ -1189,7 +1195,7 @@ ) ) ) - (if (logtest? #x20000 (-> obj flags)) + (if (logtest? (water-flags wt17) (-> obj flags)) (set! (-> obj swim-height) 2867.2) ) 0 @@ -1198,9 +1204,9 @@ ) (defmethod TODO-RENAME-16 water-control ((obj water-control)) - (set! (-> obj flags) (logand -513 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt09)) (set-zero! (-> obj bob)) - (if (logtest? #x20000 (-> obj flags)) + (if (logtest? (water-flags wt17) (-> obj flags)) (set! (-> obj swim-height) 2867.2) ) 0 @@ -1234,7 +1240,7 @@ ) (defmethod dummy-13 water-control ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector)) - (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (when (and (logtest? (-> obj flags) (water-flags wt05)) (logtest? (water-flags wt23) (-> obj flags))) (let ((a1-3 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) (set! (-> a1-3 y) (-> obj surface-height)) (splash-spawn (the-as basic arg0) (the-as basic a1-3) arg2) @@ -1247,7 +1253,7 @@ (defmethod dummy-27 water-vol ((obj water-vol)) (when (handle->process (-> obj target)) (let ((v1-7 (-> (the-as target (-> obj target process 0)) water))) - (set! (-> v1-7 flags) (logand -129892623 (-> v1-7 flags))) + (logclear! (-> v1-7 flags) (water-flags wt01 wt02 wt03 wt08 wt17 wt18 wt19 wt20 wt21 wt23 wt24 wt25 wt26)) (set! (-> v1-7 volume) (the-as handle #f)) ) (set! (-> obj target) (the-as handle #f)) @@ -1277,8 +1283,8 @@ ) (else (let ((v1-15 (-> (the-as target (-> obj target process 0)) water))) - (when (and (logtest? #x80000 (-> obj flags)) - (logtest? (-> v1-15 flags) 512) + (when (and (logtest? (water-flags wt19) (-> obj flags)) + (logtest? (-> v1-15 flags) (water-flags wt09)) (>= (-> v1-15 surface-height) (-> v1-15 bottom 0 y)) ) (let ((v1-18 (-> obj attack-event))) @@ -1332,7 +1338,7 @@ (process-entity-status! obj (entity-perm-status bit-3) #t) (set! (-> s5-0 volume) (process->handle obj)) (set! (-> obj target) (process->handle *target*)) - (logior! (-> s5-0 flags) 2) + (logior! (-> s5-0 flags) (water-flags wt01)) (set! (-> s5-0 base-height) (-> obj water-height)) (set! (-> s5-0 ocean-offset) 0.0) (logior! (-> s5-0 flags) (-> obj flags)) @@ -1399,10 +1405,10 @@ ) (defmethod TODO-RENAME-25 water-vol ((obj water-vol)) - (the-as object 0) + 0 + (none) ) -;; WARN: disable def twice: 85. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod TODO-RENAME-29 water-vol ((obj water-vol)) (local-vars (sv-16 res-tag)) (set! (-> obj attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) @@ -1440,30 +1446,27 @@ (set! (-> obj wade-height) (-> v1-8 1)) (set! (-> obj swim-height) (-> v1-8 2)) (if (>= (-> sv-16 elt-count) (the-as uint 4)) - (set! (-> obj flags) (the-as uint (the int (-> v1-8 3)))) + (set! (-> obj flags) (the-as water-flags (the int (-> v1-8 3)))) ) (if (>= (-> sv-16 elt-count) (the-as uint 5)) (set! (-> obj bottom-height) (-> v1-8 4)) ) ) ) - (set! (-> obj flags) (logior #x800000 (-> obj flags))) + (set! (-> obj flags) (logior (water-flags wt23) (-> obj flags))) (cond ((zero? (-> obj flags)) (if (< 0.0 (-> obj wade-height)) - (logior! (-> obj flags) 4) + (logior! (-> obj flags) (water-flags wt02)) ) - (when (< 0.0 (-> obj swim-height)) - (let ((v0-4 (logior (-> obj flags) 8))) - (set! (-> obj flags) v0-4) - v0-4 + (if (< 0.0 (-> obj swim-height)) + (logior! (-> obj flags) (water-flags wt03)) ) - ) ) (else - (the-as uint #f) ) ) + (none) ) (defmethod TODO-RENAME-22 water-vol ((obj water-vol)) diff --git a/goal_src/engine/nav/navigate.gc b/goal_src/engine/nav/navigate.gc index c1296cbf58..b0e525bc34 100644 --- a/goal_src/engine/nav/navigate.gc +++ b/goal_src/engine/nav/navigate.gc @@ -1992,7 +1992,9 @@ (s3-0 (new 'stack-no-clear 'vector)) ) (when (and *target* - (or (logtest? (-> obj flags) (nav-control-flags navcf11)) (logtest? (-> *target* state-flags) #x80f8)) + (or (logtest? (-> obj flags) (nav-control-flags navcf11)) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) + ) ) (let ((s2-0 obj) (s1-0 (-> *target* control)) diff --git a/goal_src/engine/sound/gsound-h.gc b/goal_src/engine/sound/gsound-h.gc index 12358035b3..724a8e5781 100644 --- a/goal_src/engine/sound/gsound-h.gc +++ b/goal_src/engine/sound/gsound-h.gc @@ -137,6 +137,20 @@ (default 49) ) +(defenum sound-mask + :bitfield #t + :type uint16 + (volume) + (pitch) + (bend) + (unused) + (time) + (trans) + (fo-min) + (fo-max) + (fo-curve) + ) + ;; like should match the sound type in OVERLORD ;; This is shared between all sound RPCs and acts like the header for the sound messages (deftype sound-rpc-cmd (structure) @@ -149,7 +163,7 @@ ) (deftype sound-play-parms (structure) - ((mask uint16 :offset-assert 0) + ((mask sound-mask :offset-assert 0) (pitch-mod int16 :offset-assert 2) (bend int16 :offset-assert 4) (fo-min int16 :offset-assert 6) @@ -417,12 +431,12 @@ ) (deftype sound-spec (basic) - ((mask uint16 :offset-assert 4) + ((mask sound-mask :offset-assert 4) (num float :offset-assert 8) (group uint8 :offset-assert 12) - (sound-name sound-name :score 20 :offset 16) - (sound-name-char uint8 16 :offset 16) ;; moved to after sound-name - (trans float 4 :offset-assert 32) ;; guess + (sound-name sound-name :score 20 :offset 16) + (sound-name-char uint8 16 :offset 16) ;; moved to after sound-name + (trans float 4 :offset-assert 32) ;; guess (volume int32 :offset-assert 48) (pitch-mod int32 :offset-assert 52) (bend int32 :offset-assert 56) @@ -438,6 +452,37 @@ :flag-assert #x90000004c ) +(defmacro sound-vol (vol) + "convert to sound volume units" + (if (number? vol) + (* 1 (/ (* vol 1024) 100)) + `(the int (/ (* ,vol 1024) 100)) + ) + ) + +(defmacro static-sound-spec (name &key (num 1.0) &key (group 1) + &key (volume #f) + &key (pitch-mod 0) + &key (fo-min 0) &key (fo-max 0) + &key (mask ())) + (let ((snd-mask mask) + (snd-volume 100.0)) + (when (nonzero? fo-max) (cons! snd-mask 'fo-max)) + (when (nonzero? fo-min) (cons! snd-mask 'fo-min)) + (when (nonzero? pitch-mod) (cons! snd-mask 'pitch)) + (when volume (cons! snd-mask 'volume) (set! snd-volume volume)) + `(new 'static 'sound-spec + :sound-name (static-sound-name ,name) + :num ,num + :group ,group + :volume (sound-vol ,snd-volume) + :pitch-mod ,pitch-mod + :fo-min ,fo-min + :fo-max ,fo-max + :mask (sound-mask ,@snd-mask) + )) + ) + ;; each sound command gets a unique ID. (define *current-sound-id* (the sound-id #x10000)) @@ -455,7 +500,7 @@ (falloff-near int32 :offset-assert 80) (falloff-far int32 :offset-assert 84) (falloff-mode int32 :offset-assert 88) - (params (pointer float) :offset-assert 92) + (params (pointer float) :offset-assert 92) (param-count int32 :offset-assert 96) (entity entity :offset-assert 100) (sound-count int32 :offset-assert 104) diff --git a/goal_src/engine/sound/gsound.gc b/goal_src/engine/sound/gsound.gc index 5a59622e14..d090d1ca0f 100644 --- a/goal_src/engine/sound/gsound.gc +++ b/goal_src/engine/sound/gsound.gc @@ -367,7 +367,7 @@ (set! (-> cmd command) (sound-command play)) (set! (-> cmd id) id) (set! (-> cmd name) name) - (set! (-> cmd parms mask) (the-as uint 0)) + (set! (-> cmd parms mask) (sound-mask)) (set! (-> cmd parms group) (the-as uint sv-16)) (set! (-> cmd parms volume) vol) (set! (-> cmd parms pitch-mod) pitch) @@ -583,9 +583,9 @@ (set! (-> obj volume) 1024) (set! (-> obj pitch) 0) (when (and spec (!= spec *ambient-spec*)) - (if (nonzero? (logand (-> spec mask) 1)) + (if (logtest? (-> spec mask) (sound-mask volume)) (set! (-> obj volume) (-> spec volume))) - (if (nonzero? (logand (-> spec mask) 2)) + (if (logtest? (-> spec mask) (sound-mask pitch)) (set! (-> obj pitch) (-> spec pitch-mod))) ) (cond @@ -635,13 +635,9 @@ (set! (-> spec bend) 0) (set! (-> spec sound-name) (-> obj name)) (set! (-> spec fo-max) (-> obj falloff-far)) - (set! (-> spec mask) (the-as uint 0)) + (set! (-> spec mask) (sound-mask)) (if (-> obj params) - (effect-param->sound-spec - spec - (the-as (pointer float) (-> obj params)) - (-> obj param-count) - ) + (effect-param->sound-spec spec (-> obj params) (-> obj param-count)) ) ) (if (and (nonzero? (-> spec fo-max)) @@ -720,7 +716,7 @@ (sound-trans-from-process cmd sound-trans) - (set! (-> cmd parms mask) (the-as uint #x20)) + (set! (-> cmd parms mask) (sound-mask trans)) (-> cmd id) ) ) @@ -735,7 +731,7 @@ (set! (-> cmd command) (sound-command set-param)) (set! (-> cmd id) (-> obj playing-id)) (set! (-> cmd parms volume) (the int (* 10.24 (the float arg0)))) - (set! (-> cmd parms mask) (the-as uint 1)) + (set! (-> cmd parms mask) (sound-mask volume)) (-> cmd id) ) ) diff --git a/goal_src/engine/target/logic-target.gc b/goal_src/engine/target/logic-target.gc index 2b2461b4f2..e4a0381753 100644 --- a/goal_src/engine/target/logic-target.gc +++ b/goal_src/engine/target/logic-target.gc @@ -23,7 +23,7 @@ ) (let ((s5-0 (new-stack-vector0))) (vector-z-quaternion! s5-0 (-> self control unknown-quaternion00)) - (when (logtest? (-> self control unknown-surface00 flags) 2) + (when (logtest? (-> self control unknown-surface00 flags) (surface-flags surf01)) (vector-flatten! s5-0 s5-0 (-> self control dynam gravity-normal)) (vector-normalize! s5-0 1.0) ) @@ -54,10 +54,8 @@ (defbehavior reverse-conversions target ((arg0 vector)) (set! (-> self control unknown-float01) (vector-xz-length (-> self control unknown-vector00))) (vector-matrix*! arg0 (-> self control unknown-vector00) (-> self control unknown-matrix01)) - (let ((v0-2 (-> self control status))) - (set! (-> self control old-status) v0-2) - v0-2 - ) + (set! (-> self control old-status) (-> self control status)) + (none) ) (defun-debug draw-history ((arg0 control-info)) @@ -108,7 +106,7 @@ (meters 0.000024414063) (the-as rgba (+ #x408040 (shl s4-0 24))) ) - (when (zero? (logand (-> s2-0 status) 256)) + (when (zero? (logand (-> s2-0 status) (cshape-moving-flags csmf08))) (add-debug-line (logtest? s5-0 1) (bucket-id debug-no-zbuf) @@ -166,7 +164,7 @@ #t "~6D ~8S #x~8X " (-> s4-0 time) - (if (logtest? (-> s4-0 status) 256) + (if (logtest? (-> s4-0 status) (cshape-moving-flags csmf08)) "air" (-> *pat-mode-info* (-> s4-0 pat mode) name) ) @@ -175,19 +173,19 @@ (format #t "~C~C~C~C~C~C" - (if (zero? (logand s3-0 1)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf00))) 103 87 ) - (if (zero? (logand s3-0 2)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf01))) 103 87 ) (cond - ((logtest? s3-0 2048) + ((logtest? s3-0 (cshape-reaction-flags csrf11)) 71 ) - ((zero? (logand s3-0 4)) + ((zero? (logand s3-0 (cshape-reaction-flags csrf02))) 103 ) (else @@ -195,21 +193,21 @@ ) ) (cond - ((logtest? s3-0 512) + ((logtest? s3-0 (cshape-reaction-flags csrf09)) 66 ) - ((logtest? s3-0 8) + ((logtest? s3-0 (cshape-reaction-flags csrf03)) 76 ) (else 99 ) ) - (if (zero? (logand s3-0 16)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf04))) 110 66 ) - (if (zero? (logand s3-0 32)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf05))) 103 65 ) @@ -217,18 +215,18 @@ (format #t "~C~C " - (if (logtest? s3-0 64) + (if (logtest? s3-0 (cshape-reaction-flags csrf06)) 78 95 ) (cond - ((logtest? s3-0 1024) + ((logtest? s3-0 (cshape-reaction-flags csrf10)) 76 ) - ((logtest? s3-0 256) + ((logtest? s3-0 (cshape-reaction-flags csrf08)) 67 ) - ((logtest? s3-0 128) + ((logtest? s3-0 (cshape-reaction-flags csrf07)) 108 ) (else @@ -325,31 +323,31 @@ (format arg1 "~0k~9S ~9S ~9S ~9S ~9S ~9S~%" - (if (logtest? (-> arg0 control status) 1) + (if (logtest? (-> arg0 control status) (cshape-moving-flags onsurf)) "on-surface" "" ) - (if (logtest? (-> arg0 control status) 2) + (if (logtest? (-> arg0 control status) (cshape-moving-flags onground)) "on-ground" "" ) - (if (logtest? (-> arg0 control status) 4) + (if (logtest? (-> arg0 control status) (cshape-moving-flags tsurf)) "t-surface" "" ) - (if (logtest? (-> arg0 control status) 8) + (if (logtest? (-> arg0 control status) (cshape-moving-flags twall)) "t-wall" "" ) - (if (logtest? (-> arg0 control status) 32) + (if (logtest? (-> arg0 control status) (cshape-moving-flags t-act)) "t-act" "" ) (cond - ((logtest? (-> arg0 control status) 16) + ((logtest? (-> arg0 control status) (cshape-moving-flags t-ciel)) "t-ceil" ) - ((logtest? (-> arg0 control status) 1024) + ((logtest? (-> arg0 control status) (cshape-moving-flags on-water)) "on-water" ) (else @@ -364,24 +362,24 @@ "in water ~A at ~M ~5S ~5S ~5S ~5S " (-> v1-49 name) (-> arg0 water height) - (if (logtest? (-> arg0 water flags) 512) + (if (logtest? (-> arg0 water flags) (water-flags wt09)) "water" "" ) - (if (logtest? (-> arg0 water flags) 1024) + (if (logtest? (-> arg0 water flags) (water-flags wt10)) "wade" "" ) - (if (logtest? (-> arg0 water flags) 2048) + (if (logtest? (-> arg0 water flags) (water-flags wt11)) "swim" "" ) - (if (logtest? (-> arg0 water flags) 4096) + (if (logtest? (-> arg0 water flags) (water-flags wt12)) "under" "" ) ) - (format arg1 "~2S~%" (if (logtest? (-> arg0 water flags) 16) + (format arg1 "~2S~%" (if (logtest? (-> arg0 water flags) (water-flags wt04)) "sg" "" ) @@ -555,7 +553,7 @@ (let ((f1-1 (* 0.0625 f1-0))) (set! (-> self control unknown-int10) a0-3) (set! (-> self control unknown-float100) f1-1) - (if (logtest? (-> self control unknown-surface01 flags) 8) + (if (logtest? (-> self control unknown-surface01 flags) (surface-flags surf03)) (set! (-> v1-6 0) (the-as uint (-> *display* base-frame-counter))) ) (and (>= (the-as uint (- (-> *display* base-frame-counter) (the-as int (-> v1-6 0)))) (the-as uint 300)) @@ -564,7 +562,7 @@ (< 0.7 (-> self control unknown-float20)) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword20)) (seconds 0.3)) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword21)) (seconds 0.3)) - (logtest? (-> self control status) 1) + (logtest? (-> self control status) (cshape-moving-flags onsurf)) (and (< 0.7 (-> self control surface-angle)) #t) ) ) @@ -750,7 +748,9 @@ ) (vector-matrix*! s2-3 s3-3 (-> self control unknown-matrix01)) (let ((f28-2 (vector-vector-xz-distance s3-3 s4-0))) - (when (and (zero? (logand (-> self control status) 4)) (< (vector-xz-length gp-0) (vector-xz-length s3-3))) + (when (and (zero? (logand (-> self control status) (cshape-moving-flags tsurf))) + (< (vector-xz-length gp-0) (vector-xz-length s3-3)) + ) (let ((f0-50 (lerp-scale 163840.0 0.0 f28-2 0.0 20480.0))) (if (and (< f28-2 20480.0) (< (-> s4-0 z) 0.0)) (set! f0-50 (* 2.0 f0-50)) @@ -760,9 +760,9 @@ ) ) ) - (if (and (zero? (logand (-> self control status) 8)) - (logtest? (-> self control old-status) 8) - (logtest? (-> self control unknown-surface00 flags) 2048) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags twall))) + (logtest? (-> self control old-status) (cshape-moving-flags twall)) + (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) (< 0.0 (-> gp-0 y)) (< 0.0 (vector-dot (-> self control dynam gravity-normal) @@ -779,9 +779,9 @@ (if (< (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) (seconds 0.2)) (set! f30-4 (+ 204800.0 f30-4)) ) - (if (and (zero? (logand (-> self control status) 8)) - (and (logtest? (-> self control old-status) 8) - (logtest? (-> self control unknown-surface00 flags) 2048) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags twall))) + (and (logtest? (-> self control old-status) (cshape-moving-flags twall)) + (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) (< 0.0 (-> gp-0 y)) (< (-> gp-0 z) 0.0) ) @@ -898,15 +898,16 @@ (defbehavior do-rotations2 target () (let ((gp-0 (vector-z-quaternion! (new-stack-vector0) (-> self control dir-targ))) (s5-0 - (if (and (or (zero? (logand (logior (-> self control status) (-> self control old-status)) 5)) + (if (and (or (zero? (logand (logior (-> self control status) (-> self control old-status)) (cshape-moving-flags onsurf tsurf)) + ) (< (- (-> *display* base-frame-counter) (-> self control unknown-dword20)) (seconds 0.5)) (!= (-> self next-state name) 'target-walk) (< (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) (< (- (-> *display* base-frame-counter) (-> self control unknown-dword21)) (seconds 0.5)) - (logtest? (-> self control unknown-surface01 flags) 16) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf04)) (!= (-> self control unknown-float41) 0.0) ) - (zero? (logand (-> self control unknown-surface01 flags) 32)) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf05))) ) (-> self control unknown-vector20) (-> self control transv) @@ -993,12 +994,12 @@ (set! (-> self control unknown-vector10 quad) (-> self control transv quad)) ((-> self control unknown-surface01 active-hook)) (cond - ((logtest? (-> self control status) 1) + ((logtest? (-> self control status) (cshape-moving-flags onsurf)) (set! (-> self control unknown-dword11) (-> *display* base-frame-counter)) (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) (if (and (>= (-> self control coverage) 1.0) - (zero? (logand (-> self control status) 1056)) - (logtest? (-> self control status) 2) + (zero? (logand (-> self control status) (cshape-moving-flags t-act on-water))) + (logtest? (-> self control status) (cshape-moving-flags onground)) ) (set! (-> self control last-known-safe-ground quad) (-> self control trans quad)) ) @@ -1006,7 +1007,7 @@ ) (else (let ((v1-25 (-> self control trans))) - (when (logtest? (-> self control old-status) 1) + (when (logtest? (-> self control old-status) (cshape-moving-flags onsurf)) (set! (-> self control unknown-vector110 quad) (-> self control unknown-vector52 quad)) (set! (-> self control unknown-vector111 quad) (-> self control unknown-vector52 quad)) ) @@ -1028,10 +1029,9 @@ (zero? (logand (-> *kernel-context* prevent-from-run) (process-mask movie))) ) (if (and (= (-> self cam-user-mode) 'normal) - (logtest? (-> self control unknown-surface00 flags) 1) - (zero? - (logand (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) - ) + (logtest? (-> self control unknown-surface00 flags) (surface-flags surf00)) + (zero? (logand (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) + ) (-> *setting-control* current allow-look-around) (>= (- (-> *display* base-frame-counter) (-> self no-look-around-wait)) (seconds 0.05)) (not (and (= (-> self control ground-pat material) (pat-material ice)) @@ -1045,7 +1045,7 @@ (when (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2) (not *pause-lock*) - (zero? (logand (-> self state-flags) 768)) + (zero? (logand (-> self state-flags) (state-flags sf08 sf09))) ) (if (!= (-> self next-state name) 'target-falling) (send-event self 'change-mode 'falling) @@ -1090,8 +1090,10 @@ (set! (-> self control surf) *standard-ground-surface*) ) (let ((f0-17 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - (if (and (or (logtest? (-> self control unknown-surface01 flags) 1024) - (and (= (-> self next-state name) 'target-walk) (zero? (logand (-> self control status) 1))) + (if (and (or (logtest? (-> self control unknown-surface01 flags) (surface-flags surf10)) + (and (= (-> self next-state name) 'target-walk) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) ) (< f0-17 0.0) (or (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2))) @@ -1136,10 +1138,10 @@ ) (defbehavior post-flag-setup target () - (if (logtest? (-> self control status) 40) + (if (logtest? (-> self control status) (cshape-moving-flags twall t-act)) (set! (-> self control unknown-dword20) (-> *display* base-frame-counter)) ) - (when (logtest? (-> self state-flags) 32) + (when (logtest? (-> self state-flags) (state-flags sf05)) (if (< (logand (- (-> *display* base-frame-counter) (-> self control unknown-dword80)) 3) 1) (logior! (-> self draw status) (draw-status hidden)) (logclear! (-> self draw status) (draw-status hidden)) @@ -1154,16 +1156,19 @@ ) (defbehavior bend-gravity target () - (set! (-> self control unknown-float82) (if (logtest? (-> self control status) 1) + (set! (-> self control unknown-float82) (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) 32.0 2.0 ) ) - (let ((f0-2 (if (and (logtest? (-> self control status) 8) (zero? (logand (-> self control status) 1))) - 0.0 - (-> self control unknown-float81) - ) + (let ((f0-2 + (if (and (logtest? (-> self control status) (cshape-moving-flags twall)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) + 0.0 + (-> self control unknown-float81) ) + ) ) (seek! (-> self control unknown-float80) @@ -1416,17 +1421,20 @@ (else (let ((v1-11 (-> self water flags))) (cond - ((and (logtest? v1-11 512) (logtest? v1-11 6144)) + ((and (logtest? v1-11 (water-flags wt09)) (logtest? v1-11 (water-flags wt11 wt12))) (vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data)) ) - (if (not (and (logtest? (-> self water flags) 4096) (zero? (logand (-> self water flags) 16)))) + (if (not (and (logtest? (-> self water flags) (water-flags wt12)) + (zero? (logand (-> self water flags) (water-flags wt04))) + ) + ) (set! (-> self control unknown-float30) (- (-> self water base-height) (-> self water swim-height))) ) (&-> (-> self control) unknown-qword00) ) - ((and (logtest? (-> self water flags) 512) (logtest? #x40000 (-> self water flags))) + ((and (logtest? (-> self water flags) (water-flags wt09)) (logtest? (water-flags wt18) (-> self water flags))) (vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data)) @@ -1464,7 +1472,7 @@ (cond ((logtest? (-> self control root-prim prim-core action) (collide-action ca-9 ca-13)) ) - ((logtest? (-> self water flags) 1024) + ((logtest? (-> self water flags) (water-flags wt10)) (let ((f30-0 (- (- (-> self control trans y) (- (-> self water height) (-> self water wade-height)))))) (set! (-> *wade-surface* alignv) (lerp-scale 1.0 0.5 f30-0 0.0 (- (-> self water swim-height) (-> self water wade-height))) @@ -1477,10 +1485,10 @@ ) (set! (-> self control surf) *wade-surface*) ) - ((logtest? (-> self water flags) 2048) + ((logtest? (-> self water flags) (water-flags wt11)) (set! (-> self control surf) *swim-surface*) ) - ((and (logtest? (-> self water flags) 512) (logtest? #x40000 (-> self water flags))) + ((and (logtest? (-> self water flags) (water-flags wt09)) (logtest? (water-flags wt18) (-> self water flags))) (set! (-> self control surf) *quicksand-surface*) ) ) @@ -1508,8 +1516,8 @@ ) ) (target-calc-camera-pos) - (when (logtest? (-> self state-flags) #x4000) - (set! (-> self state-flags) (logand -28673 (-> self state-flags))) + (when (logtest? (-> self state-flags) (state-flags sf14)) + (logclear! (-> self state-flags) (state-flags sf12 sf13 sf14)) (set! (-> self control unknown-float41) 0.0) ) (set! (-> self control unknown-int00) 0) @@ -1903,7 +1911,7 @@ ) (target-exit) (target-timed-invulnerable-off self) - (set! (-> self control status) (the-as uint 0)) + (set! (-> self control status) (cshape-moving-flags)) (set! (-> self control unknown-dynamics00) *standard-dynamics*) (set! (-> self control surf) *standard-ground-surface*) (set! (-> self control unknown-vector02 quad) (-> self control unknown-dynamics00 gravity-normal quad)) @@ -2027,7 +2035,7 @@ (activate-hud self) (set! (-> self fp-hud) (the-as handle #f)) (set! (-> self water) (new 'process 'water-control self 9 0.0 8192.0 2048.0)) - (set! (-> self water flags) (the-as uint #x4000f0)) + (set! (-> self water flags) (water-flags wt04 wt05 wt06 wt07 wt22)) (reset-target-state #t) (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) (set! (-> self control unknown-vector52 y) (+ -819200.0 (-> self control unknown-vector52 y))) @@ -2074,7 +2082,7 @@ (let* ((s5-0 (get-process *target-dead-pool* target #x4000)) (v1-3 (when s5-0 (let ((t9-2 (method-of-type target activate))) - (t9-2 (the-as target s5-0) *target-pool* 'target (&-> *dram-stack* DPROCESS_STACK_SIZE)) + (t9-2 (the-as target s5-0) *target-pool* 'target (&-> *dram-stack* 14336)) ) (run-now-in-process s5-0 init-target arg1) (-> s5-0 ppointer) diff --git a/goal_src/engine/target/surface-h.gc b/goal_src/engine/target/surface-h.gc index 8cb0cd8044..c364f5dae0 100644 --- a/goal_src/engine/target/surface-h.gc +++ b/goal_src/engine/target/surface-h.gc @@ -5,88 +5,118 @@ ;; name in dgo: surface-h ;; dgos: GAME, ENGINE +(defenum surface-flags + :bitfield #t + :type uint32 + (surf00) + (surf01) + (surf02) + (surf03) + (surf04) + (surf05) + (surf06) + (surf07) + (surf08) + (surf09) + (surf10) + (surf11) + (surf12) + (surf13) + (surf14) + (surf15) + (surf16) + (surf17) + (surf18) + (surf19) + (surf20) + (surf21) + (surf22) + (surf23) + (surf24) + (surf25) + (surf26) + (surf27) + (surf28) + (surf29) + (surf30) + (surf31) + ) + ;; The "surface" defines how jak moves on the ground. It includes things like how fast he can go, ;; how slippery it is, and what functions should run when he hits it. ;; Note that "surface" can apply to weird things, like riding the zoomer or swimming as well. (deftype surface (basic) - ((name symbol :offset-assert 4) + ((name symbol :offset-assert 4) ;; data went here - (turnv float :offset-assert 8) - (turnvv float :offset-assert 12) - (tiltv float :offset-assert 16) - (tiltvv float :offset-assert 20) - (transv-max float :offset-assert 24) - (target-speed float :offset-assert 28) - (seek0 float :offset-assert 32) - (seek90 float :offset-assert 36) - (seek180 float :offset-assert 40) - (fric float :offset-assert 44) - (nonlin-fric-dist float :offset-assert 48) - (slip-factor float :offset-assert 52) - (slide-factor float :offset-assert 56) - (slope-up-factor float :offset-assert 60) - (slope-down-factor float :offset-assert 64) - (slope-slip-angle float :offset-assert 68) - (impact-fric float :offset-assert 72) - (bend-factor float :offset-assert 76) - (bend-speed float :offset-assert 80) - (alignv float :offset-assert 84) - (slope-up-traction float :offset-assert 88) - (align-speed float :offset-assert 92) + (turnv float :offset-assert 8) + (turnvv float :offset-assert 12) + (tiltv float :offset-assert 16) + (tiltvv float :offset-assert 20) + (transv-max float :offset-assert 24) + (target-speed float :offset-assert 28) + (seek0 float :offset-assert 32) + (seek90 float :offset-assert 36) + (seek180 float :offset-assert 40) + (fric float :offset-assert 44) + (nonlin-fric-dist float :offset-assert 48) + (slip-factor float :offset-assert 52) + (slide-factor float :offset-assert 56) + (slope-up-factor float :offset-assert 60) + (slope-down-factor float :offset-assert 64) + (slope-slip-angle float :offset-assert 68) + (impact-fric float :offset-assert 72) + (bend-factor float :offset-assert 76) + (bend-speed float :offset-assert 80) + (alignv float :offset-assert 84) + (slope-up-traction float :offset-assert 88) + (align-speed float :offset-assert 92) ;; hook went here - (active-hook (function none) :offset 128) ;; from logic-target::flag-setup not 100% sure but seems to pass no args - (touch-hook (function none) :offset-assert 132) ;; from logic-target::flag-setup not 100% sure but seems to pass no args - (impact-hook function :offset-assert 136) - (mult-hook (function surface surface surface int none) :offset-assert 140) + (active-hook (function none) :offset 128) + (touch-hook (function none) :offset-assert 132) + (impact-hook function :offset-assert 136) + (mult-hook (function surface surface surface int none) :offset-assert 140) ;; dataw went here (mode symbol :offset-assert 144) - (flags uint32 :offset-assert 148) - (data float 30 :offset 8) - (hook function 4 :offset 128) - (dataw uint32 2 :offset 144) + (flags surface-flags :offset-assert 148) + (data float 30 :offset 8) + (hook function 4 :offset 128) + (dataw uint32 2 :offset 144) ) :method-count-assert 9 :size-assert #x98 :flag-assert #x900000098 ) + (defun calc-terminal-vel ((arg0 float) (arg1 float) (arg2 float)) - (- (* (/ (- (* 0.016666668 arg0) arg1) arg2) (- 1.0 arg2)) - arg1) + (- (* (/ (- (* 0.016666668 arg0) arg1) arg2) (- 1.0 arg2)) arg1) ) (defun calc-terminal2-vel ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) (let ((f0-4 (sqrtf (/ (- (* 0.016666668 arg0) arg1) arg2)))) - (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4)))) - ) + (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4)))) + ) ) (defun calc-terminal4-vel ((arg0 float) (arg1 float) (arg2 float)) (let ((f0-5 (sqrtf (sqrtf (/ (- (* 0.016666668 arg0) arg1) arg2))))) - (- f0-5 (+ arg1 (* arg2 (* (* (* f0-5 f0-5) f0-5) f0-5)))) - ) + (- f0-5 (+ arg1 (* arg2 (* f0-5 f0-5 f0-5 f0-5)))) + ) ) (defmethod print surface ((obj surface)) - ;; seems like an off-by-one bug in the format string here. + ;; seems this format string is wrong. (format - #t - "# obj turnv) - (-> obj turnvv) - (-> obj tiltv) - (-> obj tiltvv) - (-> obj transv-max) - 0 ;; seems to be a bug here - ) - (format - #t - " tm:~m rv:~R rvv:~R @ #x~X>" - (-> obj target-speed) - (-> obj seek0) - (-> obj seek90) - obj - ) + #t + "# obj turnv) + (-> obj turnvv) + (-> obj tiltv) + (-> obj tiltvv) + (-> obj transv-max) + 0 + ) + (format #t " tm:~m rv:~R rvv:~R @ #x~X>" (-> obj target-speed) (-> obj seek0) (-> obj seek90) obj) obj ) @@ -96,31 +126,23 @@ ;; iterate through surface data (dotimes (v1-0 30) ;; interpolate between the two - (set! (-> dst data v1-0) - (+ (* (-> src1 data v1-0) amount) - (* (-> src0 data v1-0) (- 1.0 amount))) - ) + (set! (-> dst data v1-0) (+ (* (-> src1 data v1-0) amount) (* (-> src0 data v1-0) (- 1.0 amount)))) ) ;; iterate through hooks. Check src1, then src0 for a nonzero and non-nothing hook. ;; if there is no good hook, set it to nothing. (dotimes (v1-3 4) - (set! (-> dst hook v1-3) - (cond - ((and (nonzero? (-> src1 hook v1-3)) - (!= (-> src1 hook v1-3) nothing) - ) - (-> src1 hook v1-3) - ) - ((and (nonzero? (-> src0 hook v1-3)) - (!= (-> src0 hook v1-3) nothing) - ) - (-> src0 hook v1-3) - ) - (else - nothing - ) - ) + (set! (-> dst hook v1-3) (cond + ((and (nonzero? (-> src1 hook v1-3)) (!= (-> src1 hook v1-3) nothing)) + (-> src1 hook v1-3) + ) + ((and (nonzero? (-> src0 hook v1-3)) (!= (-> src0 hook v1-3) nothing)) + (-> src0 hook v1-3) + ) + (else + nothing + ) + ) ) ) @@ -139,14 +161,17 @@ (set! (-> dst data v1-0) (* (-> src1 data v1-0) (-> src0 data v1-0))) ) (dotimes (v1-3 4) - (set! (-> dst hook v1-3) - (if (and (nonzero? (-> src1 hook v1-3)) (!= (-> src1 hook v1-3) nothing)) - (-> src1 hook v1-3) - (if (and (nonzero? (-> src0 hook v1-3)) (!= (-> src0 hook v1-3) nothing)) - (-> src0 hook v1-3) - nothing - ) - ) + (set! (-> dst hook v1-3) (cond + ((and (nonzero? (-> src1 hook v1-3)) (!= (-> src1 hook v1-3) nothing)) + (-> src1 hook v1-3) + ) + ((and (nonzero? (-> src0 hook v1-3)) (!= (-> src0 hook v1-3) nothing)) + (-> src0 hook v1-3) + ) + (else + nothing + ) + ) ) ) (dotimes (v1-6 2) @@ -168,1104 +193,1041 @@ (none) ) -(define *walk-mods* - (new 'static 'surface - :name 'run - :turnv 131072.0 - :turnvv 524288.0 - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 1.0 - :seek90 1.0 - :seek180 1.0 - :fric 1.0 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :flags #x1 - ) - ) +(define *walk-mods* (new 'static 'surface + :name 'run + :turnv 131072.0 + :turnvv 524288.0 + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flags surf00) + ) + ) -(define *walk-no-turn-mods* - (new 'static 'surface - :name 'run - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 1.0 - :seek90 1.0 - :seek180 1.0 - :fric 1.0 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - ) - ) +(define *walk-no-turn-mods* (new 'static 'surface + :name 'run + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) + ) -(define *turn-around-mods* - (new 'static 'surface - :name 'run - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :fric 0.1 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - ) - ) +(define *turn-around-mods* (new 'static 'surface + :name 'run + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :fric 0.1 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) + ) -(let ((a0-3 - (new 'static 'surface - :name 'duck - :turnv 131072.0 - :turnvv 524288.0 - :tiltv 65536.0 - :tiltvv 291271.12 - :transv-max 16384.0 - :target-speed 16384.0 - :seek0 1.0 - :seek90 1.0 - :seek180 1.0 - :fric 1.0 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :flags #x2000 +(let ((a0-3 (new 'static 'surface + :name 'duck + :turnv 131072.0 + :turnvv 524288.0 + :tiltv 65536.0 + :tiltvv 291271.12 + :transv-max 16384.0 + :target-speed 16384.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flags surf13) + ) ) - )) + ) (set! (-> a0-3 mult-hook) surface-clamp-speed) (define *duck-mods* a0-3) ) -(define *duck-attack-mods* - (new 'static 'surface - :name 'duck - :tiltv 65536.0 - :tiltvv 291271.12 - :transv-max 16384.0 - :target-speed 16384.0 - :seek0 1.0 - :seek90 1.0 - :seek180 1.0 - :fric 1.0 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'attack - :flags #x3000 - ) - ) +(define *duck-attack-mods* (new 'static 'surface + :name 'duck + :tiltv 65536.0 + :tiltvv 291271.12 + :transv-max 16384.0 + :target-speed 16384.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flags surf12 surf13) + ) + ) -(define *jump-mods* - (new 'static 'surface - :name 'jump - :turnv 131072.0 - :turnvv 18204.445 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 0.3 - :seek90 0.3 - :seek180 0.3 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvv 18204.445 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *double-jump-mods* - (new 'static 'surface - :name 'jump-double - :turnv 131072.0 - :turnvv 18204.445 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 32768.0 - :target-speed 32768.0 - :seek0 0.3 - :seek90 0.3 - :seek180 0.3 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *double-jump-mods* (new 'static 'surface + :name 'jump-double + :turnv 131072.0 + :turnvv 18204.445 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 32768.0 + :target-speed 32768.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *smack-jump-mods* - (new 'static 'surface - :name 'jump - :turnv 131072.0 - :turnvv 18204.445 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 0.3 - :seek90 0.3 - :seek180 0.3 - :fric 0.05 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *smack-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvv 18204.445 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.05 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *high-jump-mods* - (new 'static 'surface - :name 'high-jump - :turnv 131072.0 - :turnvv 65536.0 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 26624.0 - :target-speed 26624.0 - :seek0 0.9 - :seek90 0.9 - :seek180 0.9 - :fric 0.3 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *high-jump-mods* (new 'static 'surface + :name 'high-jump + :turnv 131072.0 + :turnvv 65536.0 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 26624.0 + :target-speed 26624.0 + :seek0 0.9 + :seek90 0.9 + :seek180 0.9 + :fric 0.3 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *launch-jump-mods* - (new 'static 'surface - :name 'launch-jump - :turnv 18204.445 - :turnvv 65536.0 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 61440.0 - :target-speed 61440.0 - :seek0 0.9 - :seek90 0.9 - :seek180 0.9 - :fric 0.3 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc80 - ) - ) +(define *launch-jump-mods* (new 'static 'surface + :name 'launch-jump + :turnv 18204.445 + :turnvv 65536.0 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 61440.0 + :target-speed 61440.0 + :seek0 0.9 + :seek90 0.9 + :seek180 0.9 + :fric 0.3 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf07 surf10 surf11) + ) + ) -(define *forward-high-jump-mods* - (new 'static 'surface - :name 'high-jump - :turnv 131072.0 - :turnvv 65536.0 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 45056.0 - :target-speed 45056.0 - :seek0 0.9 - :seek90 0.9 - :seek180 0.9 - :fric 0.3 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *forward-high-jump-mods* (new 'static 'surface + :name 'high-jump + :turnv 131072.0 + :turnvv 65536.0 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 45056.0 + :target-speed 45056.0 + :seek0 0.9 + :seek90 0.9 + :seek180 0.9 + :fric 0.3 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *flip-jump-mods* - (new 'static 'surface - :name 'high-jump - :turnv 131072.0 - :turnvv 65536.0 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 80281.6 - :target-speed 51200.0 - :seek0 0.9 - :seek90 0.9 - :seek180 0.9 - :fric 0.3 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *flip-jump-mods* (new 'static 'surface + :name 'high-jump + :turnv 131072.0 + :turnvv 65536.0 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 80281.6 + :target-speed 51200.0 + :seek0 0.9 + :seek90 0.9 + :seek180 0.9 + :fric 0.3 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *forward-jump-mods* - (new 'static 'surface - :name 'jump - :turnv 131072.0 - :turnvv 18204.445 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 65536.0 - :target-speed 65536.0 - :seek0 0.3 - :seek90 0.3 - :seek180 0.3 - :fric 0.05 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *forward-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvv 18204.445 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 65536.0 + :target-speed 65536.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.05 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *forward-pole-jump-mods* - (new 'static 'surface - :name 'jump - :turnv 131072.0 - :turnvv 18204.445 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 53248.0 - :target-speed 53248.0 - :seek0 0.3 - :seek90 0.3 - :seek180 0.3 - :fric 0.05 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #xc00 - ) - ) +(define *forward-pole-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvv 18204.445 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 53248.0 + :target-speed 53248.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.05 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11) + ) + ) -(define *attack-mods* - (new 'static 'surface - :name 'attack - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 1.0 - :seek90 1.0 - :seek180 1.0 - :fric 1.0 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'attack - :flags #x1000 - ) - ) +(define *attack-mods* (new 'static 'surface + :name 'attack + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flags surf12) + ) + ) -(define *jump-attack-mods* - (new 'static 'surface - :name 'attack - :turnvv 18204.445 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 24576.0 - :target-speed 24576.0 - :seek0 0.9 - :seek90 0.9 - :seek180 0.9 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #x1c00 - ) - ) +(define *jump-attack-mods* (new 'static 'surface + :name 'attack + :turnvv 18204.445 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 24576.0 + :target-speed 24576.0 + :seek0 0.9 + :seek90 0.9 + :seek180 0.9 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11 surf12) + ) + ) -(let ((a0-4 - (new 'static 'surface - :name 'uppercut - :turnvv 18204.445 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 32768.0 - :target-speed 32768.0 - :seek0 0.3 - :seek90 0.3 - :seek180 0.3 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #x1c00 +(let ((a0-4 (new 'static 'surface + :name 'uppercut + :turnvv 18204.445 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 32768.0 + :target-speed 32768.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf10 surf11 surf12) + ) ) - )) + ) (set! (-> a0-4 mult-hook) surface-clamp-speed) (define *uppercut-jump-mods* a0-4) ) -(define *run-attack-mods* - (new 'static 'surface - :name 'wheel-flip - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 91750.4 - :target-speed 122880.0 - :seek90 0.5 - :seek180 0.15 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 0.25 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'attack - :flags #x1018 - ) - ) +(define *run-attack-mods* (new 'static 'surface + :name 'wheel-flip + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 91750.4 + :target-speed 122880.0 + :seek90 0.5 + :seek180 0.15 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flags surf03 surf04 surf12) + ) + ) -(define *wheel-mods* - (new 'static 'surface - :name 'wheel - :turnv 131072.0 - :turnvv 5461.3335 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 91750.4 - :target-speed 11468.8 - :seek0 1.0 - :seek90 1.0 - :seek180 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 0.25 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'attack - :flags #x1000 - ) - ) +(define *wheel-mods* (new 'static 'surface + :name 'wheel + :turnv 131072.0 + :turnvv 5461.3335 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 91750.4 + :target-speed 11468.8 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flags surf12) + ) + ) -(define *wheel-flip-mods* - (new 'static 'surface - :name 'wheel-flip - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 91750.4 - :target-speed 103219.195 - :seek90 0.5 - :seek180 0.15 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 0.25 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'attack - :flags #x1c00 - ) - ) +(define *wheel-flip-mods* (new 'static 'surface + :name 'wheel-flip + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 91750.4 + :target-speed 103219.195 + :seek90 0.5 + :seek180 0.15 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flags surf10 surf11 surf12) + ) + ) -(define *flop-mods* - (new 'static 'surface - :name 'flop - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 1.0 - :seek90 0.3 - :seek180 1.5 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 0.25 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'attack - :flags #x1800 - ) - ) +(define *flop-mods* (new 'static 'surface + :name 'flop + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.0 + :seek90 0.3 + :seek180 1.5 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flags surf11 surf12) + ) + ) -(let ((a0-5 - (new 'static 'surface - :name 'flop - :turnv 9102.223 - :turnvv 9102.223 - :tiltv 32768.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 0.3 - :seek90 0.1 - :seek180 0.15 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 0.25 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'air - :flags #x800 +(let ((a0-5 (new 'static 'surface + :name 'flop + :turnv 9102.223 + :turnvv 9102.223 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 0.3 + :seek90 0.1 + :seek180 0.15 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flags surf11) + ) ) - )) + ) (set! (-> a0-5 mult-hook) surface-clamp-speed) (define *flop-land-mods* a0-5) ) -(define *wade-mods* - (new 'static 'surface - :name 'wade - :turnv 131072.0 - :turnvv 524288.0 - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :seek0 1.0 - :seek90 0.5 - :seek180 0.5 - :fric 1.0 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'wade - :flags #x1 - ) - ) +(define *wade-mods* (new 'static 'surface + :name 'wade + :turnv 131072.0 + :turnvv 524288.0 + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.0 + :seek90 0.5 + :seek180 0.5 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'wade + :flags (surface-flags surf00) + ) + ) -(define *swim-mods* - (new 'static 'surface - :name 'swim - :turnv 49152.0 - :turnvv 524288.0 - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 28672.0 - :target-speed 28672.0 - :seek0 0.75 - :seek90 0.2 - :seek180 0.2 - :fric 0.05 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'swim - ) - ) +(define *swim-mods* (new 'static 'surface + :name 'swim + :turnv 49152.0 + :turnvv 524288.0 + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 28672.0 + :target-speed 28672.0 + :seek0 0.75 + :seek90 0.2 + :seek180 0.2 + :fric 0.05 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'swim + ) + ) -(define *dive-mods* - (new 'static 'surface - :name 'swim - :turnv 21845.334 - :turnvv 32768.0 - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 20480.0 - :target-speed 20480.0 - :seek0 0.05 - :seek90 0.05 - :seek180 0.05 - :fric 1.0 - :nonlin-fric-dist 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :align-speed 1.0 - :mode 'dive - :flags #x2 - ) - ) +(define *dive-mods* (new 'static 'surface + :name 'swim + :turnv 21845.334 + :turnvv 32768.0 + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 20480.0 + :target-speed 20480.0 + :seek0 0.05 + :seek90 0.05 + :seek180 0.05 + :fric 1.0 + :nonlin-fric-dist 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :align-speed 1.0 + :mode 'dive + :flags (surface-flags surf01) + ) + ) -(define *dive-bottom-mods* - (new 'static 'surface - :name 'swim-bottom - :turnv 21845.334 - :turnvv 32768.0 - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 20480.0 - :target-speed 20480.0 - :seek0 0.1 - :seek90 0.05 - :seek180 0.05 - :fric 1.0 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :mode 'dive - :flags #x2 - ) - ) +(define *dive-bottom-mods* (new 'static 'surface + :name 'swim-bottom + :turnv 21845.334 + :turnvv 32768.0 + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 20480.0 + :target-speed 20480.0 + :seek0 0.1 + :seek90 0.05 + :seek180 0.05 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'dive + :flags (surface-flags surf01) + ) + ) (let ((a0-7 (copy *walk-mods* 'global))) (set! (-> a0-7 name) 'pole) - (set! (-> a0-7 flags) 0) + (set! (-> a0-7 flags) (surface-flags)) (define *pole-mods* a0-7) ) (let ((a0-9 (copy *walk-mods* 'global))) (set! (-> a0-9 name) 'grab) - (set! (-> a0-9 flags) 0) + (set! (-> a0-9 flags) (surface-flags)) (define *grab-mods* a0-9) ) (let ((a0-11 (copy *walk-mods* 'global))) (set! (-> a0-11 name) 'edge-grab) - (set! (-> a0-11 flags) 0) + (set! (-> a0-11 flags) (surface-flags)) (define *edge-grab-mods* a0-11) ) -(define *empty-mods* - (new 'static 'surface - :name 'empty - :seek0 1.0 - :seek90 1.0 - :seek180 1.0 - :fric 1.0 - ) - ) +(define *empty-mods* (new 'static 'surface :name 'empty :seek0 1.0 :seek90 1.0 :seek180 1.0 :fric 1.0)) -(define *neutral-mods* - (new 'static 'surface - :name 'walk - :turnv 131072.0 - :turnvv 524288.0 - :tiltv 65536.0 - :tiltvv 131072.0 - :transv-max 40960.0 - :target-speed 40960.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - ) - ) - -(let ((v1-41 - (new 'static 'surface - :name '*stone-surface* - :turnv 1.0 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 1.0 - :target-speed 1.0 - :seek0 153600.0 - :seek90 153600.0 - :seek180 256000.0 - :fric 153600.0 - :nonlin-fric-dist 5120.0 - :slip-factor 1.0 - :slope-down-factor 10240.0 - :slope-slip-angle 8192.0 - :impact-fric 1.0 - :bend-factor 0.8 - :bend-speed 4.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - ) - )) - (define *stone-surface* v1-41) - (set! - (-> v1-41 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) - (set! (-> v1-41 touch-hook) nothing) - (set! (-> v1-41 active-hook) (the-as (function none) nothing)) - ) - -(let ((v1-42 - (new 'static 'surface - :name '*edge-surface* - :turnv 1.0 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 1.0 - :target-speed 1.0 - :seek0 153600.0 - :seek90 153600.0 - :seek180 256000.0 - :fric 30720.0 - :nonlin-fric-dist 5120.0 - :slip-factor 1.0 - :slope-down-factor 18432.0 - :slope-slip-angle 8192.0 - :bend-factor 0.8 - :bend-speed 4.0 - :alignv 1.0 - :align-speed 1.0 - ) - )) - (define *edge-surface* v1-42) - (set! - (-> v1-42 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) - (set! (-> v1-42 touch-hook) nothing) - (set! (-> v1-42 active-hook) (the-as (function none) nothing)) - ) - -(let ((v1-43 - (new 'static 'surface - :name '*wade-surface* - :turnv 1.0 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 0.7 - :target-speed 0.7 - :seek0 153600.0 - :seek90 153600.0 - :seek180 256000.0 - :fric 153600.0 - :nonlin-fric-dist 5120.0 - :slip-factor 1.0 - :slope-down-factor 10240.0 - :slope-slip-angle 8192.0 - :impact-fric 1.0 - :bend-factor 0.8 - :bend-speed 4.0 - :alignv 0.6 - :slope-up-traction 1.0 - :align-speed 0.6 - ) - )) - (define *wade-surface* v1-43) - (set! - (-> v1-43 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) - (set! (-> v1-43 touch-hook) nothing) - (set! (-> v1-43 active-hook) (the-as (function none) nothing)) - ) - -(let ((v1-44 - (new 'static 'surface - :name '*slope-surface* - :turnv 1.0 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 1.0 - :target-speed 1.0 - :seek0 122880.0 - :seek90 245760.0 - :seek180 409600.0 - :fric 122880.0 - :nonlin-fric-dist 4096.0 - :slip-factor 1.0 - :slope-up-factor 40960.0 - :slope-down-factor 8192.0 - :slope-slip-angle 8192.0 - :impact-fric 1.0 - :bend-factor 0.8 - :bend-speed 4.0 - :alignv 1.0 - :align-speed 1.0 - ) +(define *neutral-mods* (new 'static 'surface + :name 'walk + :turnv 131072.0 + :turnvv 524288.0 + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) ) + +(let ((v1-41 (new 'static 'surface + :name '*stone-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 1.0 + :target-speed 1.0 + :seek0 153600.0 + :seek90 153600.0 + :seek180 256000.0 + :fric 153600.0 + :nonlin-fric-dist 5120.0 + :slip-factor 1.0 + :slope-down-factor 10240.0 + :slope-slip-angle 8192.0 + :impact-fric 1.0 + :bend-factor 0.8 + :bend-speed 4.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) + ) + ) + (define *stone-surface* v1-41) + (set! (-> v1-41 mult-hook) (the-as (function surface surface surface int none) nothing)) + (set! (-> v1-41 touch-hook) nothing) + (set! (-> v1-41 active-hook) nothing) + ) + +(let ((v1-42 (new 'static 'surface + :name '*edge-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 1.0 + :target-speed 1.0 + :seek0 153600.0 + :seek90 153600.0 + :seek180 256000.0 + :fric 30720.0 + :nonlin-fric-dist 5120.0 + :slip-factor 1.0 + :slope-down-factor 18432.0 + :slope-slip-angle 8192.0 + :bend-factor 0.8 + :bend-speed 4.0 + :alignv 1.0 + :align-speed 1.0 + ) + ) + ) + (define *edge-surface* v1-42) + (set! (-> v1-42 mult-hook) (the-as (function surface surface surface int none) nothing)) + (set! (-> v1-42 touch-hook) nothing) + (set! (-> v1-42 active-hook) nothing) + ) + +(let ((v1-43 (new 'static 'surface + :name '*wade-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 0.7 + :target-speed 0.7 + :seek0 153600.0 + :seek90 153600.0 + :seek180 256000.0 + :fric 153600.0 + :nonlin-fric-dist 5120.0 + :slip-factor 1.0 + :slope-down-factor 10240.0 + :slope-slip-angle 8192.0 + :impact-fric 1.0 + :bend-factor 0.8 + :bend-speed 4.0 + :alignv 0.6 + :slope-up-traction 1.0 + :align-speed 0.6 + ) + ) + ) + (define *wade-surface* v1-43) + (set! (-> v1-43 mult-hook) (the-as (function surface surface surface int none) nothing)) + (set! (-> v1-43 touch-hook) nothing) + (set! (-> v1-43 active-hook) nothing) + ) + +(let ((v1-44 (new 'static 'surface + :name '*slope-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 1.0 + :target-speed 1.0 + :seek0 122880.0 + :seek90 245760.0 + :seek180 409600.0 + :fric 122880.0 + :nonlin-fric-dist 4096.0 + :slip-factor 1.0 + :slope-up-factor 40960.0 + :slope-down-factor 8192.0 + :slope-slip-angle 8192.0 + :impact-fric 1.0 + :bend-factor 0.8 + :bend-speed 4.0 + :alignv 1.0 + :align-speed 1.0 + ) + ) ) (define *slope-surface* v1-44) - (set! - (-> v1-44 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) + (set! (-> v1-44 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-44 touch-hook) nothing) - (set! (-> v1-44 active-hook) (the-as (function none) nothing)) + (set! (-> v1-44 active-hook) nothing) ) -(let ((v1-45 - (new 'static 'surface - :name '*quicksand-surface* - :turnv 0.25 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 0.5 - :target-speed 0.5 - :seek0 81920.0 - :seek90 83968.0 - :seek180 165888.0 - :fric 329728.0 - :nonlin-fric-dist 5120.0 - :slip-factor 1.0 - :slope-down-factor 10240.0 - :slope-slip-angle 8192.0 - :impact-fric 1.0 - :bend-factor 0.8 - :bend-speed 4.0 - :alignv 0.5 - :slope-up-traction 1.0 - :align-speed 0.5 - ) - ) +(let ((v1-45 (new 'static 'surface + :name '*quicksand-surface* + :turnv 0.25 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 0.5 + :target-speed 0.5 + :seek0 81920.0 + :seek90 83968.0 + :seek180 165888.0 + :fric 329728.0 + :nonlin-fric-dist 5120.0 + :slip-factor 1.0 + :slope-down-factor 10240.0 + :slope-slip-angle 8192.0 + :impact-fric 1.0 + :bend-factor 0.8 + :bend-speed 4.0 + :alignv 0.5 + :slope-up-traction 1.0 + :align-speed 0.5 + ) + ) ) (define *quicksand-surface* v1-45) - (set! - (-> v1-45 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) + (set! (-> v1-45 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-45 touch-hook) nothing) - (set! (-> v1-45 active-hook) (the-as (function none) nothing)) + (set! (-> v1-45 active-hook) nothing) ) -(let ((v1-46 - (new 'static 'surface - :name '*tar-surface* - :turnv 0.25 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 0.4 - :target-speed 0.4 - :seek0 81920.0 - :seek90 83968.0 - :seek180 165888.0 - :fric 329728.0 - :nonlin-fric-dist 5120.0 - :slip-factor 1.0 - :slope-down-factor 10240.0 - :slope-slip-angle 8192.0 - :impact-fric 1.0 - :bend-factor 0.8 - :bend-speed 4.0 - :alignv 0.5 - :slope-up-traction 1.0 - :align-speed 0.5 - ) - ) +(let ((v1-46 (new 'static 'surface + :name '*tar-surface* + :turnv 0.25 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 0.4 + :target-speed 0.4 + :seek0 81920.0 + :seek90 83968.0 + :seek180 165888.0 + :fric 329728.0 + :nonlin-fric-dist 5120.0 + :slip-factor 1.0 + :slope-down-factor 10240.0 + :slope-slip-angle 8192.0 + :impact-fric 1.0 + :bend-factor 0.8 + :bend-speed 4.0 + :alignv 0.5 + :slope-up-traction 1.0 + :align-speed 0.5 + ) + ) ) (define *tar-surface* v1-46) - (set! - (-> v1-46 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) + (set! (-> v1-46 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-46 touch-hook) nothing) - (set! (-> v1-46 active-hook) (the-as (function none) nothing)) + (set! (-> v1-46 active-hook) nothing) ) -(let ((v1-47 - (new 'static 'surface - :name '*grass-surface* - :turnv 1.0 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 1.0 - :target-speed 1.0 - :seek0 122880.0 - :seek90 122880.0 - :seek180 409600.0 - :fric 122880.0 - :nonlin-fric-dist 4096.0 - :slip-factor 1.0 - :slope-slip-angle 16384.0 - :impact-fric 0.5 - :bend-speed 4.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - ) - )) +(let ((v1-47 (new 'static 'surface + :name '*grass-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 1.0 + :target-speed 1.0 + :seek0 122880.0 + :seek90 122880.0 + :seek180 409600.0 + :fric 122880.0 + :nonlin-fric-dist 4096.0 + :slip-factor 1.0 + :slope-slip-angle 16384.0 + :impact-fric 0.5 + :bend-speed 4.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) + ) + ) (define *grass-surface* v1-47) - (set! - (-> v1-47 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) + (set! (-> v1-47 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-47 touch-hook) nothing) - (set! (-> v1-47 active-hook) (the-as (function none) nothing)) + (set! (-> v1-47 active-hook) nothing) ) -(let ((v1-48 - (new 'static 'surface - :name '*ice-surface* - :turnv 0.5 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 1.5 - :target-speed 1.5 - :seek0 24576.0 - :seek90 24576.0 - :seek180 24576.0 - :fric 23756.8 - :nonlin-fric-dist 4091904.0 - :slip-factor 0.7 - :slope-slip-angle 16384.0 - :bend-speed 4.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :flags #x18 - ) - )) +(let ((v1-48 (new 'static 'surface + :name '*ice-surface* + :turnv 0.5 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 1.5 + :target-speed 1.5 + :seek0 24576.0 + :seek90 24576.0 + :seek180 24576.0 + :fric 23756.8 + :nonlin-fric-dist 4091904.0 + :slip-factor 0.7 + :slope-slip-angle 16384.0 + :bend-speed 4.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flags surf03 surf04) + ) + ) + ) (define *ice-surface* v1-48) - (set! - (-> v1-48 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) + (set! (-> v1-48 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-48 touch-hook) nothing) - (set! (-> v1-48 active-hook) (the-as (function none) nothing)) + (set! (-> v1-48 active-hook) nothing) ) -(let ((v1-49 - (new 'static 'surface - :name '*tread-surface* - :turnv 1.0 - :turnvv 1.0 - :tiltv 1.0 - :tiltvv 1.0 - :transv-max 1.0 - :target-speed 1.0 - :seek0 122880.0 - :seek90 245760.0 - :seek180 409600.0 - :fric 122880.0 - :nonlin-fric-dist 4096.0 - :slip-factor 1.0 - :slope-up-factor 8192.0 - :slope-down-factor 8192.0 - :impact-fric 1.0 - :bend-speed 4.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - ) - ) +(let ((v1-49 (new 'static 'surface + :name '*tread-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 1.0 + :target-speed 1.0 + :seek0 122880.0 + :seek90 245760.0 + :seek180 409600.0 + :fric 122880.0 + :nonlin-fric-dist 4096.0 + :slip-factor 1.0 + :slope-up-factor 8192.0 + :slope-down-factor 8192.0 + :impact-fric 1.0 + :bend-speed 4.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) + ) ) (define *tread-surface* v1-49) - (set! - (-> v1-49 mult-hook) - (the-as (function surface surface surface int none) nothing) - ) + (set! (-> v1-49 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-49 touch-hook) nothing) - (set! (-> v1-49 active-hook) (the-as (function none) nothing)) + (set! (-> v1-49 active-hook) nothing) ) (define *standard-ground-surface* *stone-surface*) diff --git a/goal_src/engine/target/target-death.gc b/goal_src/engine/target/target-death.gc index 280591a1f6..428b53517b 100644 --- a/goal_src/engine/target/target-death.gc +++ b/goal_src/engine/target/target-death.gc @@ -111,11 +111,10 @@ (set! (-> *load-state* want 1 force-vis?) #f) (set! (-> *load-state* want 1 force-inside?) #f) (when (not (string= (-> arg0 name) "default")) - (while (not - (and (or (not (-> arg0 lev0)) (not (-> arg0 disp0)) (= (level-status *level* (-> arg0 lev0)) 'active)) - (or (not (-> arg0 lev1)) (not (-> arg0 disp1)) (= (level-status *level* (-> arg0 lev1)) 'active)) - ) - ) + (while (not (and (or (not (-> arg0 lev0)) (not (-> arg0 disp0)) (= (level-status *level* (-> arg0 lev0)) 'active)) + (or (not (-> arg0 lev1)) (not (-> arg0 disp1)) (= (level-status *level* (-> arg0 lev1)) 'active)) + ) + ) (let ((v1-52 (lookup-level-info (-> arg0 level)))) (if (and v1-52 (= (-> *setting-control* current music) (-> v1-52 music-bank)) @@ -272,7 +271,7 @@ ) (until (not v1-10) (suspend) - (set! v1-10 (and *target* (logtest? (-> *target* state-flags) 256))) + (set! v1-10 (and *target* (logtest? (-> *target* state-flags) (state-flags sf08)))) ) (set! (-> *cpad-list* cpads 0 change-time) (-> *display* base-frame-counter)) (reset-actors 'dead) @@ -474,7 +473,7 @@ (set! (-> v1-264 frame-group) (the-as art-joint-anim (-> self draw art-group data 5))) ) (suspend) - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (go target-stance) (none) ) @@ -521,7 +520,7 @@ (none) ) :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -567,7 +566,7 @@ (none) ) :mode 'air - :flags #x818 + :flags (surface-flags surf03 surf04 surf11) ) ) @@ -660,8 +659,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -687,7 +686,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (return (the-as object 'stuck)) ) (let ((s1-0 (new-stack-vector0))) @@ -892,14 +891,14 @@ (set! (-> a0-14 param 1) 1.0) (joint-control-channel-group-eval! a0-14 (the-as art-joint-anim #f) num-func-seek!) ) - (set! v1-40 (or (ja-done? 0) (and arg1 (logtest? (-> self control status) 1)))) + (set! v1-40 (or (ja-done? 0) (and arg1 (logtest? (-> self control status) (cshape-moving-flags onsurf))))) ) - (while (and (or (zero? (logand (-> self control status) 1)) s2-1) (!= s2-1 'stuck)) + (while (and (or (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) s2-1) (!= s2-1 'stuck)) (arg2) (+! f30-1 (* (-> arg0 shove-back) f28-1 (-> *display* seconds-per-frame))) (set! s2-1 (target-hit-push s3-1 s1-1 f30-1 (* (-> arg0 shove-back) f28-1) arg0)) (if (not s2-1) - (set! (-> self state-flags) (logand -9 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03)) ) (suspend) ) @@ -934,7 +933,7 @@ ) ) (if (!= (-> self next-state name) 'target-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) (target-exit) (none) @@ -951,7 +950,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (set! (-> self water flags) (logand -65537 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt16)) (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((gp-0 (-> self attack-info))) (let ((s5-0 (new 'stack-no-clear 'vector))) @@ -996,7 +995,7 @@ ) ) (when (= arg0 'attack) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self game hit-time) (-> *display* base-frame-counter)) (case (-> gp-0 mode) (('endlessfall) @@ -1080,7 +1079,7 @@ (none) ) :post - (the-as (function none :behavior target) target-post) + target-post ) (define *death-spool-array* @@ -1139,7 +1138,7 @@ (send-event *camera* 'joystick 0.0 -1.0) (TODO-RENAME-9 (-> self align)) (let ((s5-0 (new 'stack-no-clear 'vector))) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! s5-0 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (vector-float*! (-> self control transv) s5-0 (-> *display* frames-per-second)) ) @@ -1195,7 +1194,7 @@ ) :exit (behavior () - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'process-mask) (clear-pending-settings-from-process *setting-control* self 'allow-progress) @@ -1225,7 +1224,7 @@ (set-setting! *setting-control* self 'process-mask 'set (the-as float 0.0) #x14a0000) (copy-settings-from-target! *setting-control*) (set! (-> self control transv quad) (the-as uint128 0)) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) (case arg0 (('none 'instant-death) ) @@ -1242,7 +1241,7 @@ ) (('drown 'drown-death) (sound-play-by-name (static-sound-name "death-drown") (new-sound-id) 1024 0 0 1 #t) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (clear-collide-with-as (-> self control)) (set! (-> self control unknown-surface00) *dive-mods*) (set! (-> self control dynam gravity-max) 6144.0) @@ -1274,7 +1273,7 @@ (when (if (and (nonzero? s5-1) (type-type? (-> s5-1 type) water-vol)) s5-1 ) - (set! (-> self state-flags) (logior #x80000 (-> self state-flags))) + (set! (-> self state-flags) (logior (state-flags sf19) (-> self state-flags))) (set! (-> self alt-cam-pos y) (+ 4096.0 (-> self water height))) ) ) @@ -1318,7 +1317,7 @@ (sound-play-by-name (static-sound-name "death-fall") (new-sound-id) 1024 0 0 1 #t) (camera-change-to (the-as string cam-endlessfall) 30 #f) (set! (-> self control pat-ignore-mask unknown-bit) 1) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (let ((f30-2 (fmin -4096.0 (- (-> self control ground-impact-vel))))) (set! (-> self control unknown-uint20) (the-as uint f30-2)) (let ((gp-11 (new-stack-vector0))) @@ -1500,7 +1499,7 @@ (set-setting! *setting-control* self 'allow-progress #f (the-as float 0.0) 0) (target-death-anim gp-18) (when (and (< (rand-vu-int-count (-> *game-info* death-movie-tick)) (* (-> *death-spool-array* length) 2)) - (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self water flags) (water-flags wt09))) (!= (-> self control ground-pat material) 9) (!= (-> self control ground-pat material) 10) ) diff --git a/goal_src/engine/target/target-h.gc b/goal_src/engine/target/target-h.gc index 69f2bff3ba..0987db9cb9 100644 --- a/goal_src/engine/target/target-h.gc +++ b/goal_src/engine/target/target-h.gc @@ -189,7 +189,7 @@ (define-extern target-exit (function none :behavior target)) (define-extern target-generic-event-handler (function process int symbol event-message-block object :behavior target)) (define-extern init-sidekick (function none :behavior sidekick)) -(define-extern racer-collision-reaction (function control-info collide-shape-intersect vector vector uint)) +(define-extern racer-collision-reaction (function control-info collide-shape-intersect vector vector cshape-moving-flags)) (define-extern start-sequence-a (function none)) diff --git a/goal_src/engine/target/target-handler.gc b/goal_src/engine/target/target-handler.gc index 264777d092..d1c53ba1a0 100644 --- a/goal_src/engine/target/target-handler.gc +++ b/goal_src/engine/target/target-handler.gc @@ -40,7 +40,7 @@ object (cond ((= v1-0 'get-pickup) - (when (zero? (logand (-> self state-flags) #x8000)) + (when (zero? (logand (-> self state-flags) (state-flags sf15))) (let ((s4-0 (-> arg3 param 0)) (f28-0 (the-as float (-> arg3 param 1))) ) @@ -133,24 +133,24 @@ (case (-> arg3 param 0) (('save) (set! (-> self alt-cam-pos quad) (-> self control trans quad)) - (set! (-> self state-flags) (logior #x20000 (-> self state-flags))) + (set! (-> self state-flags) (logior (state-flags sf17) (-> self state-flags))) (mem-copy! (the-as pointer (-> arg3 param 1)) (the-as pointer (-> self control trans)) 48) ) (('restore) - (set! (-> self state-flags) (logand -131073 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf17)) (let ((gp-1 (-> arg3 param 1))) (move-to-point! (-> self control) (the-as vector (+ gp-1 0))) (quaternion-copy! (-> self control quat) (the-as quaternion (+ gp-1 16))) ) (rot->dir-targ! (-> self control)) - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! v0-0 (the-as object (-> *display* base-frame-counter))) - (set! (-> self control unknown-dword11) (the-as int v0-0)) + (set! (-> self control unknown-dword11) (the-as time-frame v0-0)) v0-0 ) (('reset) - (set! v0-0 (the-as object (logand -131073 (-> self state-flags)))) - (set! (-> self state-flags) (the-as uint v0-0)) + (set! v0-0 (the-as object (logclear (-> self state-flags) (state-flags sf17)))) + (set! (-> self state-flags) (the-as state-flags v0-0)) v0-0 ) ) @@ -173,13 +173,13 @@ (set! (-> self neck flex-blend) (the-as float (-> arg3 param 0))) (cond ((-> arg3 param 1) - (set! (-> self state-flags) (logior #x40000 (-> self state-flags))) + (set! (-> self state-flags) (logior (state-flags sf18) (-> self state-flags))) (set! (-> self alt-neck-pos quad) (-> (the-as vector (-> arg3 param 1)) quad)) (look-at-enemy! (-> self neck) (-> self alt-neck-pos) 'force arg0) ) (else - (set! v0-0 (the-as object (logand -262145 (-> self state-flags)))) - (set! (-> self state-flags) (the-as uint v0-0)) + (set! v0-0 (the-as object (logclear (-> self state-flags) (state-flags sf18)))) + (set! (-> self state-flags) (the-as state-flags v0-0)) v0-0 ) ) @@ -230,13 +230,13 @@ (cond ((-> arg3 param 0) (let ((v1-108 (-> self draw shadow-ctrl))) - (set! (-> v1-108 settings flags) (logand -33 (-> v1-108 settings flags))) + (logclear! (-> v1-108 settings flags) (shadow-flags shdf05)) ) 0 ) (else (let ((v1-110 (-> self draw shadow-ctrl))) - (logior! (-> v1-110 settings flags) 32) + (logior! (-> v1-110 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -316,10 +316,11 @@ (set! (-> s5-0 attacker) (process->handle arg2)) (set! (-> s5-0 shove-back) arg0) (set! (-> s5-0 shove-up) arg1) - (set! (-> s5-0 angle) (if (zero? (logand (logior (-> self control status) (-> self control old-status)) 1)) - 'air - 'shove - ) + (set! (-> s5-0 angle) + (if (zero? (logand (logior (-> self control status) (-> self control old-status)) (cshape-moving-flags onsurf))) + 'air + 'shove + ) ) (set! (-> s5-0 mask) (the-as uint 2248)) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) @@ -338,15 +339,15 @@ ) (defbehavior target-attacked target ((arg0 symbol) (arg1 attack-info) (arg2 process) (arg3 process) (arg4 (state symbol attack-info target))) - (when (zero? (logand (-> self state-flags) 8)) + (when (zero? (logand (-> self state-flags) (state-flags sf03))) (cond - ((or (logtest? (-> self state-flags) 112) + ((or (logtest? (-> self state-flags) (state-flags sf04 sf05 sf06)) (and (logtest? (-> arg1 mask) 32) (= (-> arg1 mode) 'darkeco) (and (and (= (-> self fact-info-target eco-type) (pickup-type eco-red)) (>= (-> self fact-info-target eco-level) 1.0) ) - (logtest? #x100002 (-> self state-flags)) + (logtest? (state-flags sf01 sf20) (-> self state-flags)) ) ) ) @@ -435,9 +436,9 @@ #t ) (else - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (if (and (= (-> self game mode) 'play) (and (>= 1.0 (-> self fact-info-target health)) (= arg0 'attack))) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) ) (go arg4 arg0 (-> self attack-info-rec)) ) @@ -771,8 +772,8 @@ ) (defbehavior target-apply-tongue target ((arg0 vector)) - (when (zero? (logand (-> self state-flags) 8)) - (logior! (-> self state-flags) #x7000) + (when (zero? (logand (-> self state-flags) (state-flags sf03))) + (logior! (-> self state-flags) (state-flags sf12 sf13 sf14)) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> self control trans)))) (set! (-> self control unknown-float41) (lerp-scale (-> *TARGET-bank* tongue-pull-speed-min) @@ -829,15 +830,16 @@ ) ) (('loading) - (if (not - (or (and (logtest? (-> self control unknown-surface00 flags) 2048) (zero? (logand (-> self control status) 1))) - (or (logtest? (-> self water flags) 512) - (logtest? (-> self state-flags) #x830e) - (logtest? (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) - (>= (-> self no-load-wait) (-> *display* base-frame-counter)) - ) - ) - ) + (if (not (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) + (or (logtest? (-> self water flags) (water-flags wt09)) + (logtest? (-> self state-flags) (state-flags sf01 sf02 sf03 sf08 sf09 sf15)) + (logtest? (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) + (>= (-> self no-load-wait) (-> *display* base-frame-counter)) + ) + ) + ) (go target-load-wait) ) ) @@ -865,12 +867,14 @@ (go target-snowball-start (process->handle (the-as process (-> arg3 param 1)))) ) (('tube) - (if (and (logtest? (-> self control status) 1) (zero? (logand (-> self water flags) 512))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (zero? (logand (-> self water flags) (water-flags wt09))) + ) (go target-tube-start (process->handle (the-as process (-> arg3 param 1)))) ) ) (('periscope) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-periscope (process->handle (the-as process (-> arg3 param 1)))) ) ) @@ -904,7 +908,7 @@ (if (not (or (= (-> self control unknown-surface00 mode) 'swim) (= (-> self control unknown-surface00 mode) 'dive) (= (-> self next-state name) 'target-hit) - (logtest? (-> self state-flags) 8) + (logtest? (-> self state-flags) (state-flags sf03)) ) ) (go target-swim-stance) @@ -1014,7 +1018,7 @@ (-> self control unknown-dword50) (-> self control unknown-dword51) ) - (zero? (logand (-> self state-flags) #x8008)) + (zero? (logand (-> self state-flags) (state-flags sf03 sf15))) ) (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) (target-timed-invulnerable (seconds 0.1) self) @@ -1080,16 +1084,16 @@ target-standard-event-handler (set! (-> self control unknown-vector11 quad) (the-as uint128 0)) (set! (-> self control unknown-float41) 0.0) (set! (-> self control unknown-float81) 0.0) - (set! (-> self state-flags) (logand -1835917 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf02 sf03 sf07 sf08 sf09 sf18 sf19 sf20)) (target-danger-set! 'harmless #f) - (logior! (-> self water flags) 16) - (set! (-> self water flags) (logand -65537 (-> self water flags))) + (logior! (-> self water flags) (water-flags wt04)) + (logclear! (-> self water flags) (water-flags wt16)) (set! (-> self water drip-mult) 1.0) (set! (-> self neck flex-blend) 1.0) (set! (-> self control unknown-float91) 0.0) (logclear! (-> self draw status) (draw-status hidden)) (logclear! (-> self skel status) (janim-status spool)) - (set! (-> self control status) (logand -16385 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags csmf14)) 0 (none) ) diff --git a/goal_src/engine/target/target-util.gc b/goal_src/engine/target/target-util.gc index e7b82559d5..3674dad862 100644 --- a/goal_src/engine/target/target-util.gc +++ b/goal_src/engine/target/target-util.gc @@ -233,7 +233,7 @@ (-> *TARGET-bank* root-radius) ) (set! (-> self control unknown-symbol30) arg0) - (set! (-> self state-flags) (logand -3 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 transform-index) -2) (set! (-> s4-0 prim-core collide-as) (collide-kind)) (set! (-> s4-0 collide-with) (collide-kind)) @@ -260,7 +260,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 9830.4 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -277,7 +277,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 10649.6 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -295,7 +295,7 @@ (set! (-> s5-0 transform-index) 32) ) (('duck-slide) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -313,7 +313,7 @@ (set! (-> s5-0 transform-index) 28) ) (('wheel-solid) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -335,7 +335,7 @@ (set! (-> self control unknown-symbol30) 'roll) ) (('flip) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -362,7 +362,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 11878.4 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -385,7 +385,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 11878.4 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -412,7 +412,7 @@ ) ) (('flop) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -429,7 +429,7 @@ (set! (-> self control unknown-symbol30) 'flop) ) (('flop-down) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -462,7 +462,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 12288.0 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -730,18 +730,20 @@ (not (-> *setting-control* current spooling)) (not (-> *setting-control* current movie)) (not (-> *setting-control* current hint)) - (zero? (logand (-> self control status) 32)) - (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + (zero? (logand (-> self water flags) (water-flags wt09))) ) ) (defbehavior can-jump? target ((arg0 symbol)) - (and (or (logtest? (-> self control status) 1) + (and (or (logtest? (-> self control status) (cshape-moving-flags onsurf)) (< (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) - (and (logtest? (-> self control status) 1) (< 0.866 (-> self control surface-angle))) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (< 0.866 (-> self control surface-angle)) + ) ) - (and (zero? (logand (-> self control unknown-surface01 flags) 64)) - (zero? (logand (-> self state-flags) 2048)) + (and (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf06))) + (zero? (logand (-> self state-flags) (state-flags sf11))) (case arg0 (('target-wheel-flip) (>= 0.5 (-> self control unknown-float61)) @@ -763,7 +765,7 @@ ) (defbehavior fall-test target () - (when (and (zero? (logand (-> self control status) 1)) + (when (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-15 (if (> (-> self skel active-channels) 0) @@ -781,7 +783,7 @@ ) ) (when (and (< (- (-> *display* base-frame-counter) (-> self control rider-time)) (-> *TARGET-bank* ground-timeout)) - (logtest? (-> self control unknown-surface01 flags) #x4000) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf14)) ) (+! (-> self control transv x) (-> self control rider-last-move x)) (+! (-> self control transv z) (-> self control rider-last-move z)) @@ -792,9 +794,9 @@ ) (defbehavior slide-down-test target () - (if (and (zero? (logand (-> self control status) 129)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf csmf07))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) - (logtest? (-> self control status) 4) + (logtest? (-> self control status) (cshape-moving-flags tsurf)) (< 0.5 (-> self control surface-angle)) ) (go target-slide-down) @@ -803,26 +805,29 @@ ) (defbehavior smack-surface? target ((arg0 symbol)) - (and (< 0.7 (-> self control touch-angle)) (and (< (-> self control surface-angle) 0.3) - (logtest? (-> self control status) 8) - (or arg0 (zero? (logand (-> self control status) 32))) - ) + (and (< 0.7 (-> self control touch-angle)) + (and (< (-> self control surface-angle) 0.3) + (logtest? (-> self control status) (cshape-moving-flags twall)) + (or arg0 (zero? (logand (-> self control status) (cshape-moving-flags t-act)))) + ) ) ) (defbehavior can-wheel? target () - (and (logtest? (-> self control status) 1) - (or (zero? (logand (-> self control status) 8)) (>= 0.7 (-> self control touch-angle))) - (and (< (-> self control unknown-float61) 0.7) (zero? (logand (-> self state-flags) 8192))) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (or (zero? (logand (-> self control status) (cshape-moving-flags twall))) + (>= 0.7 (-> self control touch-angle)) + ) + (and (< (-> self control unknown-float61) 0.7) (zero? (logand (-> self state-flags) (state-flags sf13)))) ) ) (defbehavior can-duck? target () - (and (logtest? (-> self control status) 1) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (>= (-> self control unknown-float60) 0.7) - (zero? (logand (-> self water flags) 6144)) - (zero? (logand (-> self state-flags) 8192)) - (or (zero? (logand (-> self water flags) 1024)) + (zero? (logand (-> self water flags) (water-flags wt11 wt12))) + (zero? (logand (-> self state-flags) (state-flags sf13))) + (or (zero? (logand (-> self water flags) (water-flags wt10))) (< (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) ) ) @@ -860,15 +865,15 @@ (pad-buttons square) ) ) - (or (and (logtest? (-> self state-flags) 4096) - (or (zero? (logand (-> self state-flags) #x4000)) + (or (and (logtest? (-> self state-flags) (state-flags sf12)) + (or (zero? (logand (-> self state-flags) (state-flags sf14))) (not (and (= (-> self fact-info-target eco-type) (pickup-type eco-yellow)) (>= (-> self fact-info-target eco-level) 1.0) ) ) ) ) - (logtest? (-> self control unknown-surface01 flags) 384) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf07 surf08)) ) ) #f @@ -900,7 +905,9 @@ (defbehavior can-feet? target () (cond - ((or (logtest? (-> self state-flags) 4096) (logtest? (-> self control unknown-surface01 flags) 640)) + ((or (logtest? (-> self state-flags) (state-flags sf12)) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf07 surf09)) + ) #f ) ((>= (- (-> *display* base-frame-counter) (-> *TARGET-bank* attack-timeout)) (-> self control unknown-dword33)) @@ -975,7 +982,7 @@ ) (defun target-timed-invulnerable ((arg0 time-frame) (arg1 target)) - (logior! (-> arg1 state-flags) 32) + (logior! (-> arg1 state-flags) (state-flags sf05)) (set! (-> arg1 control unknown-dword80) (-> *display* base-frame-counter)) (set! (-> arg1 control unknown-dword81) arg0) (set-collide-kinds (-> arg1 control) 2 (collide-kind target-attack) (collide-kind)) @@ -985,7 +992,7 @@ (defun target-timed-invulnerable-off ((arg0 target)) (logclear! (-> arg0 draw status) (draw-status hidden)) - (set! (-> arg0 state-flags) (logand -33 (-> arg0 state-flags))) + (logclear! (-> arg0 state-flags) (state-flags sf05)) (set-collide-kinds (-> arg0 control) 2 (collide-kind) (collide-kind target-attack)) 0 (none) @@ -1163,7 +1170,7 @@ ((not gp-0) (camera-pos) ) - ((logtest? (-> gp-0 state-flags) 1024) + ((logtest? (-> gp-0 state-flags) (state-flags sf10)) (add-debug-sphere *display-camera-marks* (bucket-id debug-no-zbuf) @@ -1173,7 +1180,7 @@ ) (-> gp-0 alt-cam-pos) ) - ((logtest? #x20000 (-> gp-0 state-flags)) + ((logtest? (state-flags sf17) (-> gp-0 state-flags)) (add-debug-sphere *display-camera-marks* (bucket-id debug-no-zbuf) @@ -1183,7 +1190,7 @@ ) (-> gp-0 alt-cam-pos) ) - ((logtest? #x80000 (-> gp-0 state-flags)) + ((logtest? (state-flags sf19) (-> gp-0 state-flags)) (let ((s5-0 (the-as object (new 'static 'vector)))) (set! (-> (the-as vector s5-0) quad) (-> (&-> (-> gp-0 control) unknown-qword00) 0)) (set! (-> (the-as vector s5-0) y) (fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y))) diff --git a/goal_src/engine/target/target.gc b/goal_src/engine/target/target.gc index 4eec87b683..ce4c2937f6 100644 --- a/goal_src/engine/target/target.gc +++ b/goal_src/engine/target/target.gc @@ -147,12 +147,13 @@ (b! #t cfg-23 :delay (nop!)) (label cfg-7) (cond - ((and (logtest? (-> self control status) 1) (not (= (if (> (-> self skel active-channels) 0) - (-> self skel root-channel 0 frame-group) - ) - (-> self draw art-group data 35) - ) - ) + ((and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 35) + ) + ) ) (ja-channel-push! 1 6) (let ((v1-21 (-> self skel root-channel 0))) @@ -198,14 +199,14 @@ ) (pad-buttons x) ) - (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self water flags) (water-flags wt09))) (< (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 3)) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground #f) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) @@ -215,7 +216,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground 'stuck) ) (if (!= (-> self state-time) (-> *display* base-frame-counter)) @@ -599,7 +600,7 @@ :trans (behavior () ((-> self state-hook)) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-stance) ) (when (= (-> self control ground-pat material) (pat-material ice)) @@ -1625,7 +1626,7 @@ (if (can-hands? #t) (go target-running-attack) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (seconds 0.08)) ) (go target-falling #f) @@ -1683,12 +1684,12 @@ ) :trans (behavior () - (when (or (logtest? (-> self control status) 1) + (when (or (logtest? (-> self control status) (cshape-moving-flags onsurf)) (if (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) #t ) ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-duck-stance) ) (none) @@ -1729,7 +1730,7 @@ ) (defbehavior init-var-jump target ((arg0 float) (arg1 float) (arg2 vector) (arg3 vector) (arg4 vector)) - (set! (-> self control status) (logand -16385 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags csmf14)) (delete-back-vel) (when (< (- (-> *display* base-frame-counter) (-> self control rider-time)) (seconds 0.05)) (let ((f0-1 @@ -1742,7 +1743,7 @@ (set! arg0 (+ arg0 f0-1)) (set! arg1 (+ arg1 f0-1)) ) - (when (or (logtest? (-> self control unknown-surface01 flags) #x4000) + (when (or (logtest? (-> self control unknown-surface01 flags) (surface-flags surf14)) (= (-> self control poly-pat material) (pat-material rotate)) ) (+! (-> self control transv x) (-> self control rider-last-move x)) @@ -1910,10 +1911,9 @@ :trans (behavior () ((-> self state-hook)) - (if (and (or (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) - (logtest? (-> self state-flags) 8192) + (if (and (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) + (logtest? (-> self state-flags) (state-flags sf13)) ) (let ((v1-13 (if (> (-> self skel active-channels) 0) (-> self skel root-channel 0 frame-group) @@ -2064,11 +2064,10 @@ :trans (behavior () ((-> self state-hook)) - (if (and (or (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) - (logtest? (-> self state-flags) 8192) - (and (logtest? (-> self water flags) 1024) + (if (and (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) + (logtest? (-> self state-flags) (state-flags sf13)) + (and (logtest? (-> self water flags) (water-flags wt10)) (>= (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) ) ) @@ -2213,7 +2212,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 716 0 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! arg2 (cond (arg2 (empty) @@ -2256,8 +2255,8 @@ (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 12288.0) (and (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (zero? (logand (-> self water flags) 512)) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self water flags) (water-flags wt09))) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) ) (go target-double-jump (-> *TARGET-bank* double-jump-height-min) (-> *TARGET-bank* double-jump-height-max)) @@ -2268,8 +2267,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -2438,7 +2437,7 @@ ) (set! (-> self state-time) (-> *display* base-frame-counter)) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *double-jump-mods*) (none) ) @@ -2462,8 +2461,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -2549,7 +2548,7 @@ (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 457 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) (set! (-> self control unknown-surface00) (cond @@ -2595,8 +2594,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -2630,7 +2629,7 @@ :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *turn-around-mods*) (none) ) @@ -2699,7 +2698,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 819 -609 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (cond ((= arg2 'launch) (set! (-> self neck flex-blend) 0.0) @@ -2857,7 +2856,9 @@ ) ) ) - (if (and (< (-> *TARGET-bank* fall-far) f0-1) (zero? (logand (-> self control status) 1024))) + (if (and (< (-> *TARGET-bank* fall-far) f0-1) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) (go target-hit-ground-hard f0-1) ) ) @@ -2910,7 +2911,7 @@ (go target-duck-stance) ) (when (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-walk) (go target-walk) ) @@ -3107,7 +3108,9 @@ (behavior () (when (!= (-> self state-time) (-> *display* base-frame-counter)) (if (and (or (smack-surface? #t) - (and (>= (-> self control unknown-float63) 0.7) (zero? (logand (-> self control status) 32))) + (and (>= (-> self control unknown-float63) 0.7) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + ) ) (begin (set! (-> self control unknown-int21) (the-as int (-> *display* base-frame-counter))) @@ -3147,14 +3150,13 @@ (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (and (< 4096.0 (-> self control unknown-float01)) (or (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) - (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) - (pad-buttons square) - ) - ) + (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) + (pad-buttons square) + ) + ) ) - (zero? (logand (-> self state-flags) 6144)) - (zero? (logand (-> self control unknown-surface01 flags) 128)) + (zero? (logand (-> self state-flags) (state-flags sf11 sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07))) ) ) (go @@ -3163,7 +3165,7 @@ (-> *TARGET-bank* attack-jump-height-max) ) ) - (if (and (logtest? (-> self water flags) 512) + (if (and (logtest? (-> self water flags) (water-flags wt09)) (zero? (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21)) ) (dummy-13 @@ -3192,7 +3194,7 @@ ) :code (behavior () - (if (logtest? (-> self water flags) 512) + (if (logtest? (-> self water flags) (water-flags wt09)) (sound-play-by-name (static-sound-name "swim-stroke") (new-sound-id) 1024 0 0 1 #t) ) (ja-channel-push! 1 6) @@ -3215,7 +3217,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) - (and (and (zero? (logand (-> self control status) 1)) + (and (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-39 (if (> (-> self skel active-channels) 0) @@ -3223,12 +3225,11 @@ ) ) ) - (or (not - (or (= v1-39 (-> self draw art-group data 59)) - (= v1-39 (-> self draw art-group data 60)) - (= v1-39 (-> self draw art-group data 61)) - ) - ) + (or (not (or (= v1-39 (-> self draw art-group data 59)) + (= v1-39 (-> self draw art-group data 60)) + (= v1-39 (-> self draw art-group data 61)) + ) + ) (< 4096.0 (target-height-above-ground)) ) ) @@ -3289,7 +3290,7 @@ (+! gp-2 1) ) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-121 (if (> (-> self skel active-channels) 0) @@ -3333,7 +3334,7 @@ :enter (behavior ((arg0 symbol)) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (target-start-attack) (target-danger-set! 'spin-air #f) (set! (-> self control unknown-surface00) *jump-attack-mods*) @@ -3411,7 +3412,7 @@ ) :trans (behavior () - (when (logtest? (-> self control status) 1) + (when (logtest? (-> self control status) (cshape-moving-flags onsurf)) (set-quaternion! (-> self control) (-> self control dir-targ)) (go target-hit-ground #f) ) @@ -3479,11 +3480,10 @@ (let ((f0-8 (target-height-above-ground)) (f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) - (while (not - (or (and (< (fabs (/ f0-8 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) - (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1.7)) - ) - ) + (while (not (or (and (< (fabs (/ f0-8 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1.7)) + ) + ) (quaternion-rotate-y! (-> self control unknown-quaternion00) (-> self control unknown-quaternion00) @@ -3608,7 +3608,7 @@ ) (set! (-> self state-time) (-> *display* base-frame-counter)) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *uppercut-jump-mods*) (target-start-attack) (target-danger-set! 'uppercut #f) @@ -3618,7 +3618,7 @@ target-exit :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground #f) ) (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) @@ -3627,8 +3627,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (set-quaternion! (-> self control) (-> self control dir-targ)) @@ -3755,7 +3755,7 @@ (set-forward-vel (-> self control unknown-float01)) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flop-mods*) (set! (-> self control unknown-uint20) (the-as uint 0)) (set! (-> self control dynam gravity-max) 245760.0) @@ -3789,7 +3789,7 @@ :trans (behavior () (delete-back-vel) - (let ((gp-1 (logtest? (-> self control status) 1))) + (let ((gp-1 (logtest? (-> self control status) (cshape-moving-flags onsurf)))) (when (and (not gp-1) (let ((v1-6 (if (> (-> self skel active-channels) 0) (-> self skel root-channel 0 frame-group) ) @@ -3799,9 +3799,9 @@ ) ) (when (and (or (< (target-move-dist (seconds 0.1)) 1638.4) - (and (logtest? (-> self control status) 8) (< 0.7 (-> self control poly-angle))) + (and (logtest? (-> self control status) (cshape-moving-flags twall)) (< 0.7 (-> self control poly-angle))) ) - (zero? (logand (-> self control status) 32)) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) (>= (-> self control unknown-uint20) (the-as uint 2)) ) (set! (-> self control unknown-dword36) (-> *display* base-frame-counter)) @@ -3809,7 +3809,7 @@ ) ) (when gp-1 - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (when (and (= (-> self fact-info-target eco-type) (pickup-type eco-red)) (>= (-> self fact-info-target eco-level) 1.0) ) @@ -4055,8 +4055,8 @@ (set! (-> self control unknown-uint20) (the-as uint arg0)) (set-forward-vel (the-as float 0.0)) (set! (-> self control unknown-surface00) *flop-land-mods*) - (set! (-> *flop-land-mods* flags) (logand -1025 (-> *flop-land-mods* flags))) - (set! (-> self state-flags) (logior #x100000 (-> self state-flags))) + (logclear! (-> *flop-land-mods* flags) (surface-flags surf10)) + (set! (-> self state-flags) (logior (state-flags sf20) (-> self state-flags))) (none) ) :exit @@ -4092,7 +4092,7 @@ (if (and (or (= v1-33 (-> self draw art-group data 65)) (= v1-33 (-> self draw art-group data 68))) (>= (ja-aframe-num 0) 28.0) ) - (logior! (-> *flop-land-mods* flags) 1024) + (logior! (-> *flop-land-mods* flags) (surface-flags surf10)) ) ) (slide-down-test) @@ -4296,7 +4296,9 @@ (set! (-> s4-0 frame-num) 0.0) ) (let ((f30-0 1.0)) - (until (or (ja-max? 0) (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) 1))) + (until (or (ja-max? 0) + (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (cshape-moving-flags onsurf))) + ) (when (and (>= (ja-aframe-num 0) 3.0) (not (-> self control unknown-symbol30))) (set! (-> self event-hook) target-dangerous-event-handler) (target-start-attack) @@ -4334,7 +4336,7 @@ ) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (while (zero? (logand (-> self control status) 1)) + (while (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.01)) (when (not (= (if (> (-> self skel active-channels) 0) (-> self skel root-channel 0 frame-group) diff --git a/goal_src/engine/target/target2.gc b/goal_src/engine/target/target2.gc index e0e31f8c38..fa6d9e6329 100644 --- a/goal_src/engine/target/target2.gc +++ b/goal_src/engine/target/target2.gc @@ -556,7 +556,7 @@ (behavior () (set! (-> self cam-user-mode) 'look-around) (set! (-> self control unknown-surface00) *duck-mods*) - (logior! (-> self state-flags) 512) + (logior! (-> self state-flags) (state-flags sf09)) (send-event *camera* 'blend-from-as-fixed) (send-event *camera* 'no-intro) (camera-change-to (the-as string 'cam-eye) 60 #f) @@ -740,7 +740,7 @@ (behavior () (set! (-> self neck flex-blend) 0.0) (set! (-> self control unknown-surface00) *duck-mods*) - (logior! (-> self state-flags) 512) + (logior! (-> self state-flags) (state-flags sf09)) (send-event *camera* 'blend-from-as-fixed) (send-event *camera* 'clear-entity) (send-event *camera* 'no-intro) @@ -916,13 +916,13 @@ (behavior () (set! (-> self control unknown-surface00) *grab-mods*) (set! (-> self neck flex-blend) 0.0) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (set! (-> self control unknown-uint20) (the-as uint 'stance)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04)) (target-exit) (none) ) @@ -930,7 +930,7 @@ (behavior () (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) (let ((gp-0 0)) - (while (zero? (logand (-> self control status) 1)) + (while (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (target-falling-anim-trans) (+! gp-0 (- (-> *display* base-frame-counter) (-> *display* old-base-frame-counter))) (suspend) @@ -1133,7 +1133,7 @@ ) :post (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (set! (-> self control transv quad) (the-as uint128 0)) ) (target-no-stick-post) @@ -1178,7 +1178,7 @@ ) (pad-buttons x) ) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self state-flags) (state-flags sf11))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) (set! (-> self control transv quad) (the-as uint128 0)) @@ -1201,7 +1201,7 @@ ) ) ) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (go target-falling 'target-pole-cycle) ) ((>= (ja-aframe-num 0) 14.0) @@ -1502,7 +1502,7 @@ ) (pad-buttons x) ) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) (cond ((or (< -0.2 (local-pad-angle)) @@ -1680,7 +1680,7 @@ (until (ja-done? 0) (target-compute-edge-rider) (TODO-RENAME-9 (-> self align)) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! s4-0 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (move-by-vector! (-> self control) s4-0) ) @@ -1723,7 +1723,7 @@ ) (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! gp-0 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (move-by-vector! (-> self control) gp-0) ) @@ -1739,7 +1739,7 @@ (logclear! (-> self control root-prim prim-core action) (collide-action ca-3 ca-7)) (vector-float*! (-> self control transv) (-> self control unknown-vector101) -40960.0) (when (and (< (- (-> *display* base-frame-counter) (-> self control rider-time)) (seconds 0.2)) - (or (logtest? (-> self control unknown-surface01 flags) #x4000) + (or (logtest? (-> self control unknown-surface01 flags) (surface-flags surf14)) (= (-> self control poly-pat material) (pat-material rotate)) ) ) @@ -1892,7 +1892,7 @@ ) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-stance) (go target-falling #f) ) @@ -1922,7 +1922,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -2044,7 +2044,7 @@ (joint-control-channel-group-eval! a0-22 (the-as art-joint-anim #f) num-func-seek!) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-stance) (go target-falling #f) ) @@ -2103,8 +2103,8 @@ ) (pad-buttons x) ) - (zero? (logand (-> self water flags) 512)) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self water flags) (water-flags wt09))) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) ) @@ -2173,10 +2173,10 @@ :trans (behavior () ((-> self state-hook)) - (when (and (zero? (logand (-> self water flags) 1024)) + (when (and (zero? (logand (-> self water flags) (water-flags wt10))) (>= (- (-> *display* base-frame-counter) (-> self water wade-time)) (seconds 0.05)) ) - (if (logtest? (-> self water flags) 2048) + (if (logtest? (-> self water flags) (water-flags wt11)) (go target-swim-stance) (go target-stance) ) @@ -2224,10 +2224,10 @@ :trans (behavior () ((-> self state-hook)) - (when (and (zero? (logand (-> self water flags) 1024)) + (when (and (zero? (logand (-> self water flags) (water-flags wt10))) (>= (- (-> *display* base-frame-counter) (-> self water wade-time)) (seconds 0.1)) ) - (if (logtest? (-> self water flags) 2048) + (if (logtest? (-> self water flags) (water-flags wt11)) (go target-swim-stance) (go target-stance) ) @@ -2555,7 +2555,7 @@ (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) (set! (-> self control unknown-surface00) *swim-mods*) - (logior! (-> self water flags) 16) + (logior! (-> self water flags) (water-flags wt04)) (none) ) :exit @@ -2577,13 +2577,15 @@ :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) 1) (zero? (logand (-> self control status) 1024))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) (set-zero! (-> self water bob)) ) - (when (and (zero? (logand (-> self water flags) 2048)) + (when (and (zero? (logand (-> self water flags) (water-flags wt11))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-stance) (go target-stance) ) @@ -2728,13 +2730,15 @@ :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) 1) (zero? (logand (-> self control status) 1024))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) (set-zero! (-> self water bob)) ) - (when (and (zero? (logand (-> self water flags) 2048)) + (when (and (zero? (logand (-> self water flags) (water-flags wt11))) (>= (- (-> *display* base-frame-counter) (-> self water swim-time)) (seconds 0.1)) ) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-stance) (go target-stance) ) @@ -2813,7 +2817,7 @@ ) (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) - (if (zero? (logand (-> self align flags) 1)) + (if (zero? (logand (-> self align flags) (align-flags algf00))) (set! (-> self control unknown-surface00 target-speed) (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> *display* frames-per-second)) ) @@ -2843,7 +2847,7 @@ ) (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) - (if (zero? (logand (-> self align flags) 1)) + (if (zero? (logand (-> self align flags) (align-flags algf00))) (set! (-> self control unknown-surface00 target-speed) (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> *display* frames-per-second)) ) @@ -2884,7 +2888,7 @@ :enter (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (set! (-> self control unknown-surface00) *dive-mods*) (set! (-> self control dynam gravity-max) 16384.0) (set! (-> self control dynam gravity-length) 16384.0) @@ -3044,7 +3048,7 @@ (go target-swim-up) ) (if (or (>= (- (-> *display* base-frame-counter) (-> self state-time)) s5-0) - (and (logtest? (-> self control status) 1) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (and (< (-> self water swim-depth) 8192.0) (>= (- (-> *display* base-frame-counter) (-> self state-time)) gp-0) ) @@ -3101,8 +3105,8 @@ :trans (behavior () (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) - (zero? (logand (-> self state-flags) 2048)) - (zero? (logand (-> self water flags) #x6000)) + (zero? (logand (-> self state-flags) (state-flags sf11))) + (zero? (logand (-> self water flags) (water-flags wt13 wt14))) ) (go target-swim-jump-jump @@ -3154,7 +3158,7 @@ (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) ) - (if (and (zero? (logand (-> self water flags) 4096)) + (if (and (zero? (logand (-> self water flags) (water-flags wt12))) (or (>= (ja-aframe-num 0) 222.0) (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) (>= (ja-aframe-num 0) 200.0) @@ -3164,8 +3168,8 @@ (goto cfg-37) ) (TODO-RENAME-9 (-> self align)) - (when (zero? (logand (-> self water flags) 4096)) - (logior! (-> self water flags) 16) + (when (zero? (logand (-> self water flags) (water-flags wt12))) + (logior! (-> self water flags) (water-flags wt04)) (set! gp-0 #f) ) (if gp-0 @@ -3198,14 +3202,14 @@ (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) ) - (if (zero? (logand (-> self water flags) 4096)) + (if (zero? (logand (-> self water flags) (water-flags wt12))) (goto cfg-37) ) (if (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (set! f30-0 2.0) ) (TODO-RENAME-9 (-> self align)) - (when (logtest? (-> self water flags) 4096) + (when (logtest? (-> self water flags) (water-flags wt12)) (TODO-RENAME-10 (-> self align) 2 (the-as float 1.0) (the-as float 1.0) (the-as float 1.0)) (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) ) @@ -3218,7 +3222,7 @@ ) ) (label cfg-37) - (logior! (-> self water flags) 16) + (logior! (-> self water flags) (water-flags wt04)) (set! (-> self water swim-time) (-> *display* base-frame-counter)) (start-bobbing! (-> self water) (the-as float -4096.0) 600 1500) (set! (-> self water bob start-time) (+ (-> *display* base-frame-counter) (seconds -0.05))) @@ -3240,8 +3244,8 @@ (behavior () (cond ((< (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) - (set! (-> self water flags) (logior #x10000 (-> self water flags))) - (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self water flags) (logior (water-flags wt16) (-> self water flags))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) ) (else (set! (-> self trans-hook) (-> target-jump trans)) @@ -3266,7 +3270,7 @@ ((-> target-swim-stance exit)) (die-on-next-update! (-> self water bob)) (set! (-> self water align-offset) 0.0) - (set! (-> self water flags) (logior #x10000 (-> self water flags))) + (set! (-> self water flags) (logior (water-flags wt16) (-> self water flags))) (none) ) :code @@ -3283,7 +3287,7 @@ ) (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) (TODO-RENAME-9 (-> self align)) - (if (zero? (logand (-> self align flags) 1)) + (if (zero? (logand (-> self align flags) (align-flags algf00))) (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) ) (suspend) @@ -3541,15 +3545,15 @@ (behavior () (target-exit) (set! (-> self cam-user-mode) 'normal) - (logior! (-> self state-flags) 256) - (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (logior! (-> self state-flags) (state-flags sf08)) + (logclear! (-> self state-flags) (state-flags sf04)) (none) ) :code (behavior ((arg0 handle)) (set! (-> self neck flex-blend) 0.0) (target-exit) - (logior! (-> self state-flags) 144) + (logior! (-> self state-flags) (state-flags sf04 sf07)) (let ((v1-4 (handle->process arg0))) (if v1-4 (quaterion<-rotate-y-vector (-> self control dir-targ) (vector-! @@ -3620,7 +3624,7 @@ #f (-> self control root-prim collide-with) ) - (logior! (-> self state-flags) 256) + (logior! (-> self state-flags) (state-flags sf08)) (set! (-> self neck flex-blend) 0.0) (none) ) @@ -3675,7 +3679,7 @@ (set! (-> self control unknown-vector102 quad) (-> self control trans quad)) (set! (-> self control unknown-uint20) (the-as uint #t)) (quaternion-copy! (the-as quaternion (-> self control unknown-vector103)) (-> self control quat)) - (logior! (-> self state-flags) 256) + (logior! (-> self state-flags) (state-flags sf08)) (vector-reset! (-> self control transv)) (set! (-> self neck flex-blend) 0.0) (send-event (ppointer->process (-> self sidekick)) 'shadow #t) @@ -3702,7 +3706,7 @@ #t (-> self control root-prim collide-with) ) - (when (logtest? (-> self control status) 1024) + (when (logtest? (-> self control status) (cshape-moving-flags on-water)) (let ((a1-6 (new-stack-vector0))) (set! (-> a1-6 x) (-> self control trans x)) (set! (-> a1-6 y) (-> self water height)) @@ -3720,7 +3724,7 @@ ) ) (rot->dir-targ! (-> self control)) - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-dword11) (-> *display* base-frame-counter)) (ja-channel-set! 0) (ja-post) diff --git a/goal_src/engine/ui/hud.gc b/goal_src/engine/ui/hud.gc index 362c7c2fac..0498b27a43 100644 --- a/goal_src/engine/ui/hud.gc +++ b/goal_src/engine/ui/hud.gc @@ -53,7 +53,7 @@ (not (movie?)) (>= (- (-> *display* base-frame-counter) (-> *game-info* letterbox-time)) (seconds 0.1)) (>= (- (-> *display* base-frame-counter) (-> *game-info* blackout-time)) (seconds 0.1)) - (not (and *target* (logtest? (-> *target* state-flags) 256))) + (not (and *target* (logtest? (-> *target* state-flags) (state-flags sf08)))) ) ) (when (or (!= (-> obj value) arg0) diff --git a/goal_src/goos-lib.gs b/goal_src/goos-lib.gs index 1acae5258a..febd230ca8 100644 --- a/goal_src/goos-lib.gs +++ b/goal_src/goos-lib.gs @@ -229,6 +229,7 @@ ) ) +(defsmacro cons! (lst obj) `(set! ,lst (cons ,obj ,lst))) (desfun append! (lst obj) "adds obj to the end of lst. only edits inplace if lst is not null." @@ -285,6 +286,14 @@ `(type? 'integer ,x) ) +(defsmacro number? (x) + `(or (float? ,x) (integer? ,x)) + ) + +(defsmacro != (a b) `(not (= ,a ,b))) +(defsmacro zero? (x) `(= ,x 0)) +(defsmacro nonzero? (x) `(!= ,x 0)) + (defsmacro pair? (x) `(type? 'pair ,x) ) diff --git a/goal_src/levels/beach/beach-obs.gc b/goal_src/levels/beach/beach-obs.gc index a0f54073a3..92aef15e97 100644 --- a/goal_src/levels/beach/beach-obs.gc +++ b/goal_src/levels/beach/beach-obs.gc @@ -816,7 +816,7 @@ ) (while (< s5-0 2) (cond - ((logtest? (-> self root-override status) 1) + ((logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (when (not gp-0) (+! s5-0 1) (set! f30-0 0.8) @@ -850,7 +850,7 @@ ) (while (< 2048.0 (vector-length (-> self root-override transv))) (cond - ((logtest? (-> self root-override status) 1) + ((logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (vector-float*! (-> self root-override transv) (-> self root-override transv) 0.8) ) (else @@ -1344,7 +1344,7 @@ ) (suspend) (set! v1-25 (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) - (logtest? (-> self root-override status) 1) + (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) ) ) ) diff --git a/goal_src/levels/beach/beach-part.gc b/goal_src/levels/beach/beach-part.gc index 490626f60f..22fcaa5398 100644 --- a/goal_src/levels/beach/beach-part.gc +++ b/goal_src/levels/beach/beach-part.gc @@ -616,9 +616,7 @@ ((sp-flt spt-fade-a -0.014222222)) ) -(define sound-beach-waterfall - (new 'static 'sound-spec :num 1.0 :group #x1 :sound-name (static-sound-name "waterfall") :volume #x400) - ) +(define sound-beach-waterfall (static-sound-spec "waterfall")) (defpartgroup group-beach-butterflies :id 171 diff --git a/goal_src/levels/beach/bird-lady.gc b/goal_src/levels/beach/bird-lady.gc index 34cccae45c..311813dfe8 100644 --- a/goal_src/levels/beach/bird-lady.gc +++ b/goal_src/levels/beach/bird-lady.gc @@ -38,7 +38,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -47,16 +47,19 @@ (defmethod draw-npc-shadow bird-lady ((obj bird-lady)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/beach/lurkercrab.gc b/goal_src/levels/beach/lurkercrab.gc index ce18412444..f954fa13da 100644 --- a/goal_src/levels/beach/lurkercrab.gc +++ b/goal_src/levels/beach/lurkercrab.gc @@ -485,7 +485,7 @@ nav-enemy-default-event-handler ) :trans (behavior () - (if (logtest? (-> *target* state-flags) #x80f8) + (if (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (go-virtual nav-enemy-victory) ) (if (< (ja-aframe-num 0) 2.0) diff --git a/goal_src/levels/beach/mayor.gc b/goal_src/levels/beach/mayor.gc index a17e51e04d..b8f831d5f0 100644 --- a/goal_src/levels/beach/mayor.gc +++ b/goal_src/levels/beach/mayor.gc @@ -44,16 +44,19 @@ (defmethod draw-npc-shadow mayor ((obj mayor)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (set! (-> v1-14 settings flags) (logior (the-as int (-> v1-14 settings flags)) 32)) + (set! (-> v1-14 settings flags) (the-as shadow-flags (logior (the-as int (-> v1-14 settings flags)) 32))) ) 0 ) diff --git a/goal_src/levels/beach/sculptor.gc b/goal_src/levels/beach/sculptor.gc index 63346e5474..24aa583573 100644 --- a/goal_src/levels/beach/sculptor.gc +++ b/goal_src/levels/beach/sculptor.gc @@ -54,16 +54,19 @@ (defmethod draw-npc-shadow sculptor ((obj sculptor)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/beach/seagull.gc b/goal_src/levels/beach/seagull.gc index 0ccd1155f1..6e1fcb60e3 100644 --- a/goal_src/levels/beach/seagull.gc +++ b/goal_src/levels/beach/seagull.gc @@ -34,9 +34,7 @@ ) ) -(define sound-seagull-squall - (new 'static 'sound-spec :num 1.0 :group #x1 :sound-name (static-sound-name "seagulls-2") :volume #x400) - ) +(define sound-seagull-squall (static-sound-spec "seagulls-2")) (deftype seagull (process-drawable) ((root-override collide-shape-moving :offset 112) @@ -1294,8 +1292,8 @@ (set! (-> (the-as seagull s4-1) temp-heading-time) 300) ) (let ((v0-2 (logior s5-0 3))) - (set! (-> arg0 status) (the-as uint v0-2)) - (the-as uint v0-2) + (set! (-> arg0 status) (the-as cshape-moving-flags v0-2)) + (the-as cshape-moving-flags v0-2) ) ) ) diff --git a/goal_src/levels/citadel/citadel-obs.gc b/goal_src/levels/citadel/citadel-obs.gc index bec77d3412..a152defe12 100644 --- a/goal_src/levels/citadel/citadel-obs.gc +++ b/goal_src/levels/citadel/citadel-obs.gc @@ -454,19 +454,8 @@ ) ) (dummy-21 obj) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "rotate-plat") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "rotate-plat" :fo-max 20) (-> obj root-override trans)) ) (logior! (-> obj skel status) (janim-status inited)) (go citb-disc-idle) @@ -1068,19 +1057,8 @@ (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 601) obj)) (logclear! (-> obj mask) (process-mask actor-pause)) (set! (-> obj shield-on) #t) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "robotcage-lp") - :volume #x400 - :fo-max #x96 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "robotcage-lp" :fo-max 150) (-> obj root-override trans)) ) (if (= (get-task-status (-> obj entity extra perm task)) (task-status invalid)) (go citb-robotboss-die) @@ -1755,19 +1733,8 @@ (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 600) obj)) (set! (-> obj part-broken) (create-launch-control (-> *part-group-id-table* 597) obj)) (set! (-> obj part-mushroom) (create-launch-control (-> *part-group-id-table* 599) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "mushroom-gen") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "mushroom-gen" :fo-max 20) (-> obj root-override trans)) ) 0 (none) @@ -1956,7 +1923,7 @@ ) (send-event (handle->process (the-as handle gp-1)) 'mask 2048) (while (handle->process (the-as handle gp-1)) - (set! (-> *target* state-flags) (logand -17 (-> *target* state-flags))) + (logclear! (-> *target* state-flags) (state-flags sf04)) (suspend) ) ) diff --git a/goal_src/levels/citadel/citadel-sages.gc b/goal_src/levels/citadel/citadel-sages.gc index 7234f0812c..f8fbf0b29d 100644 --- a/goal_src/levels/citadel/citadel-sages.gc +++ b/goal_src/levels/citadel/citadel-sages.gc @@ -216,19 +216,8 @@ (set-vector! (-> obj bar-array 10) 0.0 f0-1 f1-0 1.0) (set-vector! (-> obj bar-array 11) f2-0 f0-1 f1-0 1.0) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "sagecage-gen") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "sagecage-gen" :fo-max 20) (-> obj root-override trans)) ) (set! (-> obj bars-on) (not (task-complete? *game-info* (-> obj entity extra perm task)))) (citb-sagecage-update-collision) @@ -525,7 +514,7 @@ (set! (-> a0-3 settings top-plane w) (- 4096.0)) ) 0 - (set! (-> v1-1 settings flags) (logand -13 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02 shdf03)) ) ) (none) @@ -539,14 +528,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -642,7 +631,7 @@ (set! (-> a0-3 settings top-plane w) (- 4096.0)) ) 0 - (set! (-> v1-1 settings flags) (logand -13 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02 shdf03)) ) ) (none) @@ -656,14 +645,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -764,7 +753,7 @@ (set! (-> a0-3 settings top-plane w) (- 4096.0)) ) 0 - (set! (-> v1-1 settings flags) (logand -13 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02 shdf03)) ) ) (none) @@ -778,14 +767,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/citadel/citb-bunny.gc b/goal_src/levels/citadel/citb-bunny.gc index c6ae091fba..79d3c7c947 100644 --- a/goal_src/levels/citadel/citb-bunny.gc +++ b/goal_src/levels/citadel/citb-bunny.gc @@ -91,7 +91,7 @@ (defmethod TODO-RENAME-48 citb-bunny ((obj citb-bunny) (arg0 object)) (dummy-60 obj) (TODO-RENAME-45 obj *citb-bunny-nav-enemy-info*) - (set! (-> obj draw shadow-ctrl settings flags) (logand -9 (-> obj draw shadow-ctrl settings flags))) + (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf03)) (cond ((zero? (res-lump-value (-> obj entity) 'mode uint128)) (set! (-> obj defense) (the-as uint 1)) diff --git a/goal_src/levels/citadel/citb-plat.gc b/goal_src/levels/citadel/citb-plat.gc index 7798aa418c..8625355e2f 100644 --- a/goal_src/levels/citadel/citb-plat.gc +++ b/goal_src/levels/citadel/citb-plat.gc @@ -642,19 +642,8 @@ (set! (-> obj idle-offset) 0.0) (set! (-> obj float-offset) (res-lump-float (-> obj entity) 'height-info :default 4096.0)) (set! (-> obj float-height-offset) (-> obj idle-offset)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-plat-hover") - :volume #x400 - :fo-max 50 - ) - (-> obj root-overlay trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-plat-hover" :fo-max 50) (-> obj root-overlay trans)) ) (let ((s5-0 (-> obj info control-point-count))) (dotimes (s4-0 s5-0) @@ -835,19 +824,8 @@ (defmethod dummy-22 citb-donut ((obj citb-donut)) (initialize-skeleton obj *citb-donut-sg* '()) (setup-params! (-> obj sync) (the-as uint 9000) 0.0 0.15 0.15) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "rotate-plat") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "rotate-plat" :fo-max 20) (-> obj root-override trans)) ) (logclear! (-> obj mask) (process-mask actor-pause)) 0 diff --git a/goal_src/levels/common/basebutton.gc b/goal_src/levels/common/basebutton.gc index 8001174cf6..975f5b4a8a 100644 --- a/goal_src/levels/common/basebutton.gc +++ b/goal_src/levels/common/basebutton.gc @@ -593,7 +593,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x20 + :flags (surface-flags surf05) ) ) @@ -615,20 +615,20 @@ :enter (behavior ((arg0 vector) (arg1 vector)) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *warp-jump-mods*) (set! (-> self control unknown-vector102 quad) (-> arg0 quad)) (set! (-> self control unknown-vector103 quad) (-> arg1 quad)) (set! (-> self control unknown-vector102 y) (+ -4096.0 (-> self control unknown-vector102 y))) (set! (-> self control unknown-uint20) (the-as uint #f)) (vector-reset! (-> self control transv)) - (logior! (-> self state-flags) 1024) + (logior! (-> self state-flags) (state-flags sf10)) (set! (-> self alt-cam-pos quad) (-> arg1 quad)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (none) ) :code diff --git a/goal_src/levels/common/baseplat.gc b/goal_src/levels/common/baseplat.gc index 265230b336..ebc6a162d2 100644 --- a/goal_src/levels/common/baseplat.gc +++ b/goal_src/levels/common/baseplat.gc @@ -5,6 +5,43 @@ ;; name in dgo: baseplat ;; dgos: GAME, COMMON, L1 +(defenum eco-door-flags + :bitfield #t + :type int32 + (ecdf00) + (ecdf01) + (auto-close) + (one-way) + (ecdf04) + (ecdf05) + (ecdf06) + (ecdf07) + (ecdf08) + (ecdf09) + (ecdf10) + (ecdf11) + (ecdf12) + (ecdf13) + (ecdf14) + (ecdf15) + (ecdf16) + (ecdf17) + (ecdf18) + (ecdf19) + (ecdf20) + (ecdf21) + (ecdf22) + (ecdf23) + (ecdf24) + (ecdf25) + (ecdf26) + (ecdf27) + (ecdf28) + (ecdf29) + (ecdf30) + (ecdf31) + ) + ;; DECOMP BEGINS (deftype baseplat (process-drawable) @@ -111,18 +148,18 @@ ) (deftype eco-door (process-drawable) - ((root-override collide-shape :offset 112) - (speed float :offset-assert 176) - (open-distance float :offset-assert 180) - (close-distance float :offset-assert 184) - (out-dir vector :inline :offset-assert 192) - (open-sound sound-name :offset-assert 208) - (close-sound sound-name :offset-assert 224) - (state-actor entity-actor :offset-assert 240) - (flags int32 :offset-assert 244) - (locked symbol :offset-assert 248) - (auto-close symbol :offset-assert 252) - (one-way symbol :offset-assert 256) + ((root-override collide-shape :offset 112) + (speed float :offset-assert 176) + (open-distance float :offset-assert 180) + (close-distance float :offset-assert 184) + (out-dir vector :inline :offset-assert 192) + (open-sound sound-name :offset-assert 208) + (close-sound sound-name :offset-assert 224) + (state-actor entity-actor :offset-assert 240) + (flags eco-door-flags :offset-assert 244) + (locked symbol :offset-assert 248) + (auto-close symbol :offset-assert 252) + (one-way symbol :offset-assert 256) ) :heap-base #xa0 :method-count-assert 27 @@ -323,8 +360,8 @@ eco-door-event-handler (defmethod dummy-26 eco-door ((obj eco-door)) (when (-> obj state-actor) (if (logtest? (-> obj state-actor extra perm status) (entity-perm-status complete)) - (set! (-> obj locked) (logtest? (-> obj flags) 2)) - (set! (-> obj locked) (logtest? (-> obj flags) 1)) + (set! (-> obj locked) (logtest? (-> obj flags) (eco-door-flags ecdf01))) + (set! (-> obj locked) (logtest? (-> obj flags) (eco-door-flags ecdf00))) ) ) 0 @@ -371,10 +408,10 @@ eco-door-event-handler ) ) (set! (-> obj locked) #f) - (set! (-> obj flags) (res-lump-value arg0 'flags int)) + (set! (-> obj flags) (res-lump-value arg0 'flags eco-door-flags)) (dummy-26 obj) - (set! (-> obj auto-close) (logtest? (-> obj flags) 4)) - (set! (-> obj one-way) (logtest? (-> obj flags) 8)) + (set! (-> obj auto-close) (logtest? (-> obj flags) (eco-door-flags auto-close))) + (set! (-> obj one-way) (logtest? (-> obj flags) (eco-door-flags one-way))) (vector-z-quaternion! (-> obj out-dir) (-> obj root-override quat)) (set! (-> obj out-dir w) (- (vector-dot (-> obj out-dir) (-> obj root-override trans)))) (update-transforms! (-> obj root-override)) diff --git a/goal_src/levels/common/dark-eco-pool.gc b/goal_src/levels/common/dark-eco-pool.gc index 4828841a22..578c9777c6 100644 --- a/goal_src/levels/common/dark-eco-pool.gc +++ b/goal_src/levels/common/dark-eco-pool.gc @@ -93,25 +93,24 @@ (let ((t9-0 (method-of-type water-anim TODO-RENAME-25))) (t9-0 obj) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x1000000 (-> obj flags))) - (let ((v0-1 ((the-as - (function res-lump symbol symbol float structure (pointer res-tag) pointer object) - (method-of-type res-lump get-property-struct) - ) - (-> obj entity) - 'attack-event - 'interp - -1000000000.0 - 'dark-eco-pool - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt24) (-> obj flags))) + (set! (-> obj attack-event) + (the-as symbol ((the-as + (function res-lump symbol symbol float structure (pointer res-tag) pointer object) + (method-of-type res-lump get-property-struct) + ) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + 'dark-eco-pool + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) ) - (set! (-> obj attack-event) (the-as symbol v0-1)) - v0-1 - ) + (none) ) (defmethod TODO-RENAME-22 dark-eco-pool ((obj dark-eco-pool)) diff --git a/goal_src/levels/common/nav-enemy.gc b/goal_src/levels/common/nav-enemy.gc index 8711280748..cc17e2bbce 100644 --- a/goal_src/levels/common/nav-enemy.gc +++ b/goal_src/levels/common/nav-enemy.gc @@ -75,9 +75,10 @@ (defmethod common-post nav-enemy ((obj nav-enemy)) (when (and (logtest? (-> obj nav-enemy-flags) (nav-enemy-flags navenmf8)) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> obj touch-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> obj touch-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> obj collide-info) 2 (collide-offense touch)) @@ -481,12 +482,15 @@ nav-enemy-default-event-handler ) (defun nav-enemy-player-vulnerable? () - (the-as symbol (and *target* (zero? (logand (-> *target* state-flags) #x80f8)))) + (the-as + symbol + (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) + ) ) (defmethod TODO-RENAME-46 nav-enemy ((obj nav-enemy) (arg0 float)) (and *target* - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (and (or (zero? (logand (-> obj nav-enemy-flags) (nav-enemy-flags navenmf12))) (< (vector-vector-distance (target-pos 0) (-> obj collide-info trans)) arg0) ) @@ -651,14 +655,14 @@ nav-enemy-default-event-handler (set! (-> v1-14 frame-num) 0.0) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self collide-info status) (logand -8 (-> self collide-info status))) + (logclear! (-> self collide-info status) (cshape-moving-flags onsurf onground tsurf)) (until (ja-done? 0) (cond ((nonzero? (-> self align)) (when (not s4-1) (TODO-RENAME-9 (-> self align)) (TODO-RENAME-10 (-> self align) 4098 1.0 arg1 1.0) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (let ((f0-6 (* (- (-> self align delta trans z)) (-> *display* frames-per-second)))) (set! (-> self collide-info transv x) (* (-> self hit-from-dir x) f0-6)) (set! (-> self collide-info transv z) (* (-> self hit-from-dir z) f0-6)) @@ -1216,7 +1220,7 @@ nav-enemy-default-event-handler ) :trans (behavior () - (if (logtest? (-> *target* state-flags) 128) + (if (logtest? (-> *target* state-flags) (state-flags sf07)) (go-virtual nav-enemy-patrol) ) (if (logtest? (-> self nav-enemy-flags) (nav-enemy-flags navenmf8)) @@ -1305,7 +1309,7 @@ nav-enemy-default-event-handler :trans (behavior () (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) - (if (logtest? (-> *target* state-flags) 128) + (if (logtest? (-> *target* state-flags) (state-flags sf07)) (go-virtual nav-enemy-patrol) ) (if (and (TODO-RENAME-46 self (-> self nav-info notice-distance)) (not (nav-enemy-frustrated?))) @@ -1382,7 +1386,7 @@ nav-enemy-default-event-handler :trans (behavior () (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) - (if (logtest? (-> *target* state-flags) 128) + (if (logtest? (-> *target* state-flags) (state-flags sf07)) (go-virtual nav-enemy-patrol) ) (cond @@ -1397,16 +1401,15 @@ nav-enemy-default-event-handler (set! (-> self notice-time) (-> *display* base-frame-counter)) ) ) - (when (not - (or (and *target* (>= 40960.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)))) - (and (-> self nav-info use-proximity-notice) - *target* - (>= (-> self nav-info proximity-notice-distance) - (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)) - ) - ) - ) - ) + (when (not (or (and *target* (>= 40960.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)))) + (and (-> self nav-info use-proximity-notice) + *target* + (>= (-> self nav-info proximity-notice-distance) + (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)) + ) + ) + ) + ) (logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf2)) (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) (-> self state-timeout)) (go-virtual nav-enemy-give-up) @@ -1700,7 +1703,7 @@ nav-enemy-default-event-handler ) ) ) - (set! (-> self collide-info status) (logand -8 (-> self collide-info status))) + (logclear! (-> self collide-info status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self jump-time) (-> *display* base-frame-counter)) (logior! (-> self nav-enemy-flags) (nav-enemy-flags enable-rotate)) (cond diff --git a/goal_src/levels/common/orb-cache.gc b/goal_src/levels/common/orb-cache.gc index f3a3d40315..4ebff64497 100644 --- a/goal_src/levels/common/orb-cache.gc +++ b/goal_src/levels/common/orb-cache.gc @@ -251,50 +251,47 @@ ) (while #t (calculate-pos self #t) - (while (not - (or (not *target*) (< (-> self inactive-distance) - (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) - ) - ) - ) + (while (not (or (not *target*) (< (-> self inactive-distance) + (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) + ) + ) + ) (pos-logic self #t) (suspend) ) (calculate-pos self #f) - (while (and (not - (and (and *target* (>= (-> self active-distance) - (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) - ) + (while (and (not (and (and *target* (>= (-> self active-distance) + (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) + ) + ) + (let ((a1-11 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-11 from) self) + (set! (-> a1-11 num-params) 2) + (set! (-> a1-11 message) 'query) + (set! (-> a1-11 param 0) (the-as uint 'powerup)) + (set! (-> a1-11 param 1) (the-as uint 3)) + (or (send-event-function *target* a1-11) (-> self activated)) ) - (let ((a1-11 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-11 from) self) - (set! (-> a1-11 num-params) 2) - (set! (-> a1-11 message) 'query) - (set! (-> a1-11 param 0) (the-as uint 'powerup)) - (set! (-> a1-11 param 1) (the-as uint 3)) - (or (send-event-function *target* a1-11) (-> self activated)) - ) - ) - ) + ) + ) (not (pos-logic self #f)) ) (suspend) ) - (if (not - (and (and *target* (>= (-> self active-distance) - (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) - ) + (if (not (and (and *target* (>= (-> self active-distance) + (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) + ) + ) + (let ((a1-14 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-14 from) self) + (set! (-> a1-14 num-params) 2) + (set! (-> a1-14 message) 'query) + (set! (-> a1-14 param 0) (the-as uint 'powerup)) + (set! (-> a1-14 param 1) (the-as uint 3)) + (or (send-event-function *target* a1-14) (-> self activated)) ) - (let ((a1-14 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-14 from) self) - (set! (-> a1-14 num-params) 2) - (set! (-> a1-14 message) 'query) - (set! (-> a1-14 param 0) (the-as uint 'powerup)) - (set! (-> a1-14 param 1) (the-as uint 3)) - (or (send-event-function *target* a1-14) (-> self activated)) - ) - ) - ) + ) + ) (go orb-cache-top-idle arg0) ) ) diff --git a/goal_src/levels/common/plat-button.gc b/goal_src/levels/common/plat-button.gc index 778f695923..45a88e8c0e 100644 --- a/goal_src/levels/common/plat-button.gc +++ b/goal_src/levels/common/plat-button.gc @@ -251,12 +251,13 @@ ) (rider-trans) (when (-> self go-back-if-lost-player?) - (when (or (not *target*) (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) - (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) - ) + (when (or (not *target*) + (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) + ) ) (set! (-> self go-back-if-lost-player?) #f) (go-virtual plat-button-move-upward) @@ -285,7 +286,7 @@ ) (sound-trans-convert (-> gp-1 parms trans) a1-6) ) - (set! (-> gp-1 parms mask) (the-as uint 32)) + (set! (-> gp-1 parms mask) (sound-mask trans)) (-> gp-1 id) ) (if (and (-> self grab-player?) (< 0.2 (-> self path-pos))) @@ -330,12 +331,13 @@ ) (rider-trans) (when (-> self go-back-if-lost-player?) - (when (or (not *target*) (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) - (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) - ) + (when (or (not *target*) + (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) + ) ) (set! (-> self go-back-if-lost-player?) #f) (go-virtual plat-button-move-downward) @@ -364,7 +366,7 @@ ) (sound-trans-convert (-> gp-1 parms trans) a1-6) ) - (set! (-> gp-1 parms mask) (the-as uint 32)) + (set! (-> gp-1 parms mask) (sound-mask trans)) (-> gp-1 id) ) (if (and (-> self grab-player?) (< (-> self path-pos) 0.8)) diff --git a/goal_src/levels/common/sharkey.gc b/goal_src/levels/common/sharkey.gc index 0b93b8142f..87d37f7a7d 100644 --- a/goal_src/levels/common/sharkey.gc +++ b/goal_src/levels/common/sharkey.gc @@ -538,8 +538,8 @@ nav-enemy-default-event-handler (go-virtual nav-enemy-patrol) ) ) - (when (logtest? (-> *target* control status) 2) - (set! (-> self player-in-water) (logtest? (-> *target* control status) 1024)) + (when (logtest? (-> *target* control status) (cshape-moving-flags onground)) + (set! (-> self player-in-water) (logtest? (-> *target* control status) (cshape-moving-flags on-water))) (if (-> self player-in-water) (set! (-> self player-water-time) (-> *display* base-frame-counter)) ) @@ -832,7 +832,7 @@ nav-enemy-default-event-handler (TODO-RENAME-45 obj *sharkey-nav-enemy-info*) (logclear! (-> obj mask) (process-mask actor-pause)) (set! (-> obj water) (new 'process 'water-control obj 3 12288.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint #xc00002)) + (set! (-> obj water flags) (water-flags wt01 wt22 wt23)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 20480.0) (set! (-> obj spawn-point quad) (-> obj collide-info trans quad)) diff --git a/goal_src/levels/common/water-anim.gc b/goal_src/levels/common/water-anim.gc index 88369d01fd..115537378d 100644 --- a/goal_src/levels/common/water-anim.gc +++ b/goal_src/levels/common/water-anim.gc @@ -424,207 +424,95 @@ :skel-group '*water-anim-sunken-big-room-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 70 - :fo-max 80 - ) + (static-sound-spec "water-loop" :fo-min 70 :fo-max 80) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-first-room-from-entrance-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 50 - :fo-max 60 - ) + (static-sound-spec "water-loop" :fo-min 50 :fo-max 60) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-qbert-room-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 48 - :fo-max 58 - ) + (static-sound-spec "water-loop" :fo-min 48 :fo-max 58) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-first-right-branch-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 30 - :fo-max 40 - ) + (static-sound-spec "water-loop" :fo-min 30 :fo-max 40) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-circular-with-bullys-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 15 - :fo-max 25 - ) + (static-sound-spec "water-loop" :fo-min 15 :fo-max 25) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-hall-with-one-whirlpool-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 27 - :fo-max 37 - ) + (static-sound-spec "water-loop" :fo-min 27 :fo-max 37) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-hall-with-three-whirlpools-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 26 - :fo-max 36 - ) + (static-sound-spec "water-loop" :fo-min 26 :fo-max 36) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-start-of-helix-slide-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 25 - :fo-max 35 - ) + (static-sound-spec "water-loop" :fo-min 25 :fo-max 35) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-room-above-exit-chamber-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 45 - :fo-max 55 - ) + (static-sound-spec "water-loop" :fo-min 45 :fo-max 55) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-hall-before-big-room-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 20 - :fo-max 30 - ) + (static-sound-spec "water-loop" :fo-min 20 :fo-max 30) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-dark-eco-qbert-sg* :anim 6 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 40 - :fo-max 50 - ) + (static-sound-spec "darkeco-pool" :fo-min 40 :fo-max 50) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-short-piece-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 20 - :fo-max 30 - ) + (static-sound-spec "water-loop" :fo-min 20 :fo-max 30) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-big-room-upper-water-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 27 - :fo-max 37 - ) + (static-sound-spec "water-loop" :fo-min 27 :fo-max 37) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-dark-eco-platform-room-sg* :anim 6 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 22 - :fo-max 32 - ) + (static-sound-spec "darkeco-pool" :fo-min 22 :fo-max 32) ) (new 'static 'water-anim-look :skel-group @@ -636,88 +524,40 @@ :skel-group '*water-anim-maincave-center-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 70 - :fo-max 80 - ) + (static-sound-spec "darkeco-pool" :fo-min 70 :fo-max 80) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-lower-right-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 40 - :fo-max 50 - ) + (static-sound-spec "darkeco-pool" :fo-min 40 :fo-max 50) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-mid-right-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 37 - :fo-max 47 - ) + (static-sound-spec "darkeco-pool" :fo-min 37 :fo-max 47) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-lower-left-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 20 - :fo-max 30 - ) + (static-sound-spec "darkeco-pool" :fo-min 20 :fo-max 30) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-mid-left-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 51 - :fo-max 61 - ) + (static-sound-spec "darkeco-pool" :fo-min 51 :fo-max 61) ) (new 'static 'water-anim-look :skel-group '*water-anim-robocave-main-pool-sg* :anim 3 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 54 - :fo-max 64 - ) + (static-sound-spec "darkeco-pool" :fo-min 54 :fo-max 64) ) (new 'static 'water-anim-look :skel-group '*water-anim-misty-mud-by-arena-sg* :anim 24 :ambient-sound-spec #f) (new 'static 'water-anim-look @@ -777,15 +617,7 @@ :skel-group '*water-anim-misty-dark-eco-pool-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 17 - :fo-max 27 - ) + (static-sound-spec "darkeco-pool" :fo-min 17 :fo-max 27) ) (new 'static 'water-anim-look :skel-group '*water-anim-ogre-lava-sg* :anim 2 :ambient-sound-spec #f) (new 'static 'water-anim-look :skel-group '*water-anim-jungle-river-sg* :anim 3 :ambient-sound-spec #f) @@ -804,30 +636,14 @@ '*water-anim-sunken-dark-eco-helix-room-sg* :anim 6 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "helix-dark-eco") - :volume #x400 - :fo-min #x78 - :fo-max #x82 - ) + (static-sound-spec "helix-dark-eco" :fo-min 120 :fo-max 130) ) (new 'static 'water-anim-look :skel-group '*water-anim-finalboss-dark-eco-pool-sg* :anim 2 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 19 - :fo-max 29 - ) + (static-sound-spec "darkeco-pool" :fo-min 19 :fo-max 29) ) (new 'static 'water-anim-look :skel-group '*water-anim-lavatube-energy-lava-sg* @@ -920,11 +736,11 @@ ) ) (let ((f0-6 (res-lump-float (-> obj entity) 'rotoffset))) - (the-as object (if (!= f0-6 0.0) - (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-6) - ) - ) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-6) + ) ) + (none) ) (defmethod TODO-RENAME-22 water-anim ((obj water-anim)) diff --git a/goal_src/levels/darkcave/darkcave-obs.gc b/goal_src/levels/darkcave/darkcave-obs.gc index da1ff883a8..28d1ffc9b3 100644 --- a/goal_src/levels/darkcave/darkcave-obs.gc +++ b/goal_src/levels/darkcave/darkcave-obs.gc @@ -270,19 +270,8 @@ (ja-post) (update-transforms! (-> obj root-override)) (TODO-RENAME-9 *cavecrystal-light-control* (-> obj crystal-id) 0.0 obj) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "crystal-on") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "crystal-on" :fo-max 80) (-> obj root-override trans)) ) (go cavecrystal-idle) (none) diff --git a/goal_src/levels/finalboss/final-door.gc b/goal_src/levels/finalboss/final-door.gc index c98cb7bba8..2103ab5981 100644 --- a/goal_src/levels/finalboss/final-door.gc +++ b/goal_src/levels/finalboss/final-door.gc @@ -200,7 +200,7 @@ (ja-post) (while #t (if (and (and *target* (>= 61440.0 (vector-vector-distance (-> self root trans) (-> *target* control trans)))) - (and (zero? (logand (-> *target* state-flags) 256)) + (and (zero? (logand (-> *target* state-flags) (state-flags sf08))) (and (>= (-> *game-info* fuel) 100.0) (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))) (= (get-task-status (game-task finalboss-movies)) (task-status need-reward-speech)) @@ -359,14 +359,14 @@ (behavior ((arg0 basic) (arg1 handle)) (send-event *camera* 'change-to-entity-by-name "camera-403") (set! (-> self control unknown-surface00) *empty-mods*) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (set-setting! *setting-control* self 'allow-progress #f 0.0 0) (none) ) :exit (behavior () (send-event *camera* 'change-state *camera-base-mode* 60) - (set! (-> self state-flags) (logand -273 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04 sf08)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'allow-progress) (none) diff --git a/goal_src/levels/finalboss/green-eco-lurker.gc b/goal_src/levels/finalboss/green-eco-lurker.gc index 1eea85e807..6a36d76fb5 100644 --- a/goal_src/levels/finalboss/green-eco-lurker.gc +++ b/goal_src/levels/finalboss/green-eco-lurker.gc @@ -452,7 +452,7 @@ (v1-7 (-> obj draw shadow-ctrl)) ) (let ((a0-1 v1-7)) - (set! (-> a0-1 settings flags) (logand -33 (-> a0-1 settings flags))) + (logclear! (-> a0-1 settings flags) (shadow-flags shdf05)) ) 0 (let ((a0-3 v1-7)) @@ -465,7 +465,7 @@ ) (else (let ((v1-9 (-> obj draw shadow-ctrl))) - (logior! (-> v1-9 settings flags) 32) + (logior! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -626,9 +626,9 @@ (set! (-> a0-6 settings top-plane w) (- 2048.0)) ) 0 - (set! (-> v1-4 settings flags) (logand -9 (-> v1-4 settings flags))) - (set! (-> v1-4 settings flags) (logand -5 (-> v1-4 settings flags))) - (set! (-> v1-4 settings flags) (logand -33 (-> v1-4 settings flags))) + (logclear! (-> v1-4 settings flags) (shadow-flags shdf03)) + (logclear! (-> v1-4 settings flags) (shadow-flags shdf02)) + (logclear! (-> v1-4 settings flags) (shadow-flags shdf05)) ) 0 (ja-channel-push! 1 60) @@ -801,7 +801,7 @@ (sound-play-by-name (static-sound-name "blob-explode") (new-sound-id) 1024 0 0 1 #t) (activate! *camera-smush-control* 409.6 37 150 1.0 0.99) (let ((v1-14 (-> self draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 (let ((t9-7 (-> (method-of-type nav-enemy nav-enemy-die) enter))) @@ -898,7 +898,7 @@ (set! (-> obj draw origin-joint-index) (the-as uint 3)) (logclear! (-> obj collide-info nav-flags) (nav-flags navf0)) (TODO-RENAME-45 obj *green-eco-lurker-nav-enemy-info*) - (logior! (-> obj draw shadow-ctrl settings flags) 4) + (logior! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf02)) (set! (-> obj neck up) (the-as uint 0)) (set! (-> obj neck nose) (the-as uint 1)) (set! (-> obj neck ear) (the-as uint 2)) diff --git a/goal_src/levels/finalboss/light-eco.gc b/goal_src/levels/finalboss/light-eco.gc index 0369874410..551776212c 100644 --- a/goal_src/levels/finalboss/light-eco.gc +++ b/goal_src/levels/finalboss/light-eco.gc @@ -661,7 +661,7 @@ ) ) (cond - ((and *target* (logtest? (-> *target* state-flags) 256)) + ((and *target* (logtest? (-> *target* state-flags) (state-flags sf08))) (set! (-> obj last-spawned-time) (-> *display* base-frame-counter)) (set! (-> obj delay-til-spawn) (seconds 8)) ) @@ -873,20 +873,8 @@ ) (set! (-> self part) (create-launch-control (-> *part-group-id-table* 691) self)) (set! (-> self part2) (create-launch-control (-> *part-group-id-table* 690) self)) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "white-eco-lp") - :volume #x400 - :fo-min #x12c - :fo-max #x190 - ) - (-> self root trans) - ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "white-eco-lp" :fo-min 300 :fo-max 400) (-> self root trans)) ) (ja-post) (let ((f0-4 0.0)) diff --git a/goal_src/levels/finalboss/robotboss-misc.gc b/goal_src/levels/finalboss/robotboss-misc.gc index b9bc49b944..ee47d2ffcf 100644 --- a/goal_src/levels/finalboss/robotboss-misc.gc +++ b/goal_src/levels/finalboss/robotboss-misc.gc @@ -504,19 +504,8 @@ (initialize-skeleton obj *silodoor-sg* '()) (logior! (-> obj skel status) (janim-status inited)) (set! (-> obj root pause-adjust-distance) 1228800.0) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "silo-moves") - :volume #x400 - :fo-max 80 - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "silo-moves" :fo-max 80) (-> obj root trans)) ) (logclear! (-> obj mask) (process-mask actor-pause crate enemy attackable)) (set! (-> obj part-opened) 0.0) diff --git a/goal_src/levels/finalboss/robotboss-weapon.gc b/goal_src/levels/finalboss/robotboss-weapon.gc index 7544d70f79..0bc9cb7afe 100644 --- a/goal_src/levels/finalboss/robotboss-weapon.gc +++ b/goal_src/levels/finalboss/robotboss-weapon.gc @@ -587,20 +587,7 @@ (arcing-shot-setup arg0 arg1 arg2) (set! (-> self countdown-time) arg4) (set! (-> self flight-time) arg3) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "bomb-spin") - :volume #x400 - :fo-max 80 - ) - (-> self to) - ) - ) + (set! (-> self sound) (new 'process 'ambient-sound (static-sound-spec "bomb-spin" :fo-max 80) (-> self to))) (go darkecobomb-idle) (none) ) @@ -984,19 +971,8 @@ (set! (-> self shot-particle) (create-launch-control (-> *part-group-id-table* 665) self)) (set! (-> self test-particle) (create-launch-control (-> *part-group-id-table* 679) self)) (logior! (-> self draw status) (draw-status hidden)) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "red-fireball") - :volume #x400 - :fo-max 80 - ) - (-> self root-override trans) - ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "red-fireball" :fo-max 80) (-> self root-override trans)) ) (go redshot-idle) (none) diff --git a/goal_src/levels/finalboss/robotboss.gc b/goal_src/levels/finalboss/robotboss.gc index 26136267cd..d6c699c6b1 100644 --- a/goal_src/levels/finalboss/robotboss.gc +++ b/goal_src/levels/finalboss/robotboss.gc @@ -37,7 +37,7 @@ (defbehavior robotboss-cut-cam-exit robotboss () (set! (-> self valid-frames) 0) - (if (and *target* (logtest? (-> *target* state-flags) 256)) + (if (and *target* (logtest? (-> *target* state-flags) (state-flags sf08))) (process-release? *target*) ) (logclear! (-> self skel status) (janim-status inited)) @@ -59,8 +59,8 @@ ) (robotboss-cut-cam-exit) ) - ((or (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + ((or (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (-> self skip-cut) ) @@ -165,15 +165,14 @@ (b! #t cfg-66 :delay (nop!)) (label cfg-19) (b! - (not - (and (-> self des-cam-entity) - (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 188416.0) - (and *target* - (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) - ) - ) - ) - ) + (not (and (-> self des-cam-entity) + (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 188416.0) + (and *target* + (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) + ) + ) + ) + ) cfg-37 :delay (empty-form) @@ -190,13 +189,12 @@ (b! #t cfg-66 :delay (nop!)) (label cfg-37) (b! - (not - (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 73728.0) - (and *target* - (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) - ) - ) - ) + (not (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 73728.0) + (and *target* + (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) + ) + ) + ) cfg-49 :delay (empty-form) @@ -3826,7 +3824,7 @@ (spawn (-> self particle 0) s4-0) (when (and arg1 (nonzero? (-> self looping-sound 0))) (update! (-> self looping-sound 0)) - (when (and *target* (zero? (logand (-> *target* state-flags) #x80f8))) + (when (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) (let ((t2-0 (new 'stack-no-clear 'collide-tri-result)) (a2-0 (new 'stack-no-clear 'vector)) ) @@ -3877,7 +3875,7 @@ (when (and arg1 (nonzero? (-> self looping-sound 1))) (update! (-> self looping-sound 1)) (when (and *target* - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (>= 8192.0 (vector-vector-distance gp-0 (target-pos 0))) ) (let ((a1-16 (new 'stack-no-clear 'event-message-block))) @@ -4533,61 +4531,17 @@ (set! (-> obj particle 4) (create-launch-control (-> *part-group-id-table* 654) obj)) (set! (-> obj particle 5) (create-launch-control (-> *part-group-id-table* 646) obj)) (set! (-> obj particle 6) (create-launch-control (-> *part-group-id-table* 651) obj)) - (set! (-> obj looping-sound 0) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "robo-blue-lp") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 0) + (new 'process 'ambient-sound (static-sound-spec "robo-blue-lp" :fo-max 80) (-> obj root-override trans)) ) - (set! (-> obj looping-sound 1) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-torch") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 1) + (new 'process 'ambient-sound (static-sound-spec "eco-torch" :fo-max 80) (-> obj root-override trans)) ) - (set! (-> obj looping-sound 2) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "red-buzz") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 2) + (new 'process 'ambient-sound (static-sound-spec "red-buzz" :fo-max 80) (-> obj root-override trans)) ) - (set! (-> obj looping-sound 3) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "bfg-buzz") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 3) + (new 'process 'ambient-sound (static-sound-spec "bfg-buzz" :fo-max 80) (-> obj root-override trans)) ) (set! (-> obj blue-smoke) #f) (set! (-> obj red-smoke) #f) diff --git a/goal_src/levels/flut_common/flutflut.gc b/goal_src/levels/flut_common/flutflut.gc index 0408ffeb10..454832a7d2 100644 --- a/goal_src/levels/flut_common/flutflut.gc +++ b/goal_src/levels/flut_common/flutflut.gc @@ -397,19 +397,8 @@ ) ) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "zoom-teleport") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :fo-max 30) (-> obj root-override trans)) ) (go (method-of-object obj wait-for-start)) (none) diff --git a/goal_src/levels/flut_common/target-flut.gc b/goal_src/levels/flut_common/target-flut.gc index 9ee772d14c..254677fe42 100644 --- a/goal_src/levels/flut_common/target-flut.gc +++ b/goal_src/levels/flut_common/target-flut.gc @@ -69,7 +69,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x8 + :flags (surface-flags surf03) ) ) @@ -98,7 +98,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -127,7 +127,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -151,7 +151,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1018 + :flags (surface-flags surf03 surf04 surf12) ) ) @@ -176,7 +176,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1800 + :flags (surface-flags surf11 surf12) ) ) @@ -218,12 +218,13 @@ (b! #t cfg-23 :delay (nop!)) (label cfg-7) (cond - ((and (logtest? (-> self control status) 1) (not (= (if (> (-> self skel active-channels) 0) - (-> self skel root-channel 0 frame-group) - ) - (-> self draw art-group data 145) - ) - ) + ((and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 145) + ) + ) ) (ja-channel-push! 1 6) (let ((v1-21 (-> self skel root-channel 0))) @@ -505,7 +506,7 @@ ) (logclear! (-> self control root-prim prim-core action) (collide-action ca-14)) (set! (-> self control unknown-surface00) *walk-mods*) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max)) (set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length)) (target-collide-set! 'normal (the-as float 0.0)) @@ -648,7 +649,7 @@ (if (can-hands? #t) (go target-flut-running-attack) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-37 (if (> (-> self skel active-channels) 0) @@ -807,7 +808,7 @@ (if (can-hands? #t) (go target-flut-running-attack) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-37 (if (> (-> self skel active-channels) 0) @@ -1024,7 +1025,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 -762 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flut-jump-mods*) (set! (-> self control unknown-float123) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))))) @@ -1048,13 +1049,13 @@ (* 0.003921569 (the float (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) abutton 6))) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 40960.0) - (and (zero? (logand (-> self water flags) 512)) - (zero? (logand (-> self state-flags) 2048)) + (and (zero? (logand (-> self water flags) (water-flags wt09))) + (zero? (logand (-> self state-flags) (state-flags sf11))) (< 4096.0 (target-height-above-ground)) ) ) @@ -1066,8 +1067,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go target-flut-air-attack (-> *FLUT-bank* air-attack-speed)) @@ -1079,7 +1080,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) enter-state 'stuck (go target-flut-hit-ground) @@ -1209,7 +1210,7 @@ (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) (set! (-> self control dynam gravity-max) 40960.0) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flut-double-jump-mods*) (none) ) @@ -1223,7 +1224,7 @@ ) :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) @@ -1233,8 +1234,8 @@ ) (pad-buttons square) ) - (and (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (and (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) @@ -1403,7 +1404,7 @@ (if (move-legs?) (go target-flut-walk) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-34 (if (> (-> self skel active-channels) 0) @@ -1450,7 +1451,7 @@ (-> target-flut-start exit) :trans (behavior () - (when (or (logtest? (-> self control status) 1) + (when (or (logtest? (-> self control status) (cshape-moving-flags onsurf)) (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (/ (the-as int (-> *TARGET-bank* stuck-time)) 2) @@ -1461,7 +1462,7 @@ #t ) ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (seek! @@ -1648,7 +1649,9 @@ (behavior () (when (!= (-> self state-time) (-> *display* base-frame-counter)) (if (and (or (smack-surface? #t) - (and (>= (-> self control unknown-float63) 0.7) (zero? (logand (-> self control status) 32))) + (and (>= (-> self control unknown-float63) 0.7) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + ) ) (begin (set! (-> self control unknown-int21) (the-as int (-> *display* base-frame-counter))) @@ -1680,7 +1683,7 @@ ) (target-shoved (meters 2.0) (-> *TARGET-bank* smack-surface-height) (the-as process #f) target-flut-hit) ) - (if (and (logtest? (-> self water flags) 512) + (if (and (logtest? (-> self water flags) (water-flags wt09)) (zero? (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21)) ) (dummy-13 @@ -1721,7 +1724,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) - (and (and (zero? (logand (-> self control status) 1)) + (and (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-39 (if (> (-> self skel active-channels) 0) @@ -1729,12 +1732,11 @@ ) ) ) - (or (not - (or (= v1-39 (-> self draw art-group data 59)) - (= v1-39 (-> self draw art-group data 60)) - (= v1-39 (-> self draw art-group data 61)) - ) - ) + (or (not (or (= v1-39 (-> self draw art-group data 59)) + (= v1-39 (-> self draw art-group data 60)) + (= v1-39 (-> self draw art-group data 61)) + ) + ) (< 4096.0 (target-height-above-ground)) ) ) @@ -1783,7 +1785,7 @@ (set! f30-0 (* f30-0 (the-as float (fmin 1.0 (the-as float (-> self control unknown-float140)))))) ) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-105 (if (> (-> self skel active-channels) 0) @@ -1866,7 +1868,7 @@ (behavior ((arg0 float)) (set-forward-vel arg0) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flut-air-attack-mods*) (target-start-attack) (target-danger-set! 'flut-attack #f) @@ -1919,8 +1921,8 @@ ) ) ) - (when (logtest? (-> self control status) 1) - (logior! (-> self control status) 1) + (when (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (remove-exit) (go target-flut-air-attack-hit-ground) ) @@ -1931,7 +1933,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (none) @@ -2087,7 +2089,7 @@ :exit (behavior () (if (!= (-> self next-state name) 'target-flut-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) (target-exit) ((-> target-flut-start exit)) @@ -2149,7 +2151,7 @@ ) ) (when (= arg0 'attack) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self game hit-time) (-> *display* base-frame-counter)) (case (-> gp-0 mode) (('endlessfall) @@ -2272,7 +2274,7 @@ (-> target-death event) :exit (behavior () - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'process-mask) (copy-settings-from-target! *setting-control*) @@ -2283,7 +2285,7 @@ :code (behavior ((arg0 symbol)) (local-vars (v1-104 symbol)) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) (set! (-> self neck flex-blend) 0.0) (target-timed-invulnerable-off self) (push-setting! *setting-control* self 'process-mask 'set 0.0 #x14a0000) @@ -2297,7 +2299,7 @@ (sound-play-by-name (static-sound-name "flut-hit") (new-sound-id) 716 -2133 0 1 #t) (camera-change-to (the-as string cam-endlessfall) 30 #f) (set! (-> self control pat-ignore-mask unknown-bit) 1) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (let ((f30-0 (fmin -4096.0 (- (-> self control ground-impact-vel))))) (set! (-> self control unknown-uint20) (the-as uint f30-0)) (let ((gp-3 (new-stack-vector0))) @@ -2363,7 +2365,7 @@ (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) (let ((gp-5 (new 'stack-no-clear 'vector))) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! gp-5 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (vector-float*! (-> self control transv) gp-5 (-> *display* frames-per-second)) ) @@ -2400,7 +2402,7 @@ (behavior ((arg0 handle)) (set! (-> self control transv quad) (the-as uint128 0)) (set! (-> self alt-cam-pos quad) (-> (&-> (-> self control) unknown-qword00) 0)) - (logior! (-> self state-flags) 1024) + (logior! (-> self state-flags) (state-flags sf10)) (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) @@ -2453,7 +2455,7 @@ ) ) (sound-play-by-name (static-sound-name "flut-coo") (new-sound-id) 1024 0 0 1 #t) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (set! (-> self control transv quad) (the-as uint128 0)) (quaternion-copy! (-> self control quat) (-> self control unknown-quaternion00)) (rot->dir-targ! (-> self control)) @@ -2501,7 +2503,7 @@ (behavior ((arg0 handle)) (set-forward-vel (the-as float 0.0)) (let ((s5-0 0)) - (while (zero? (logand (-> self control status) 1)) + (while (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (target-flut-falling-anim-trans) (+! s5-0 (- (-> *display* base-frame-counter) (-> *display* old-base-frame-counter))) (suspend) @@ -2636,7 +2638,7 @@ (-> target-hit-ground enter) :trans (behavior () - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) ((-> target-hit-ground trans)) (none) ) @@ -2693,12 +2695,12 @@ (behavior () (set! (-> self control unknown-surface00) *grab-mods*) (set! (-> self neck flex-blend) 0.0) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -273 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04 sf08)) (target-exit) ((-> target-flut-start exit)) (none) diff --git a/goal_src/levels/jungle/fisher.gc b/goal_src/levels/jungle/fisher.gc index 52c6df183e..fe7a2d9a96 100644 --- a/goal_src/levels/jungle/fisher.gc +++ b/goal_src/levels/jungle/fisher.gc @@ -837,7 +837,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -851,14 +851,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -2196,14 +2196,14 @@ :enter (behavior ((arg0 handle)) (set! (-> self control unknown-surface00) *empty-mods*) - (logior! (-> self state-flags) 16) + (logior! (-> self state-flags) (state-flags sf04)) (set-zero! (-> self control unknown-smush00)) (set! (-> self control unknown-uint20) (the-as uint #f)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04)) (let ((v1-2 (-> self manipy))) (when v1-2 (deactivate (-> v1-2 0)) diff --git a/goal_src/levels/jungle/jungle-mirrors.gc b/goal_src/levels/jungle/jungle-mirrors.gc index d339e339a7..f428b3723c 100644 --- a/goal_src/levels/jungle/jungle-mirrors.gc +++ b/goal_src/levels/jungle/jungle-mirrors.gc @@ -1393,8 +1393,8 @@ (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2 (('touch) - (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) ) @@ -1467,7 +1467,7 @@ (f30-1 81920.0) ) (when (and *target* (>= f30-1 (vector-vector-distance a0-10 (-> *target* control trans)))) - (when (logtest? (-> *target* control status) 1) + (when (logtest? (-> *target* control status) (cshape-moving-flags onsurf)) (let ((f0-7 (fmax 4096.0 (fmin 12288.0 (+ (- 5120.0 (-> self base y)) (-> *target* control trans y)))))) (seek! (-> self y-offset-grips) f0-7 (* 16384.0 (-> *display* seconds-per-frame))) ) @@ -1894,19 +1894,8 @@ (periscope-update-joints) (set! (-> obj grips-moving?) #f) (set! (-> obj sound-id) (new-sound-id)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-beam") - :volume #x400 - :fo-max 50 - ) - (-> obj reflector-trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-beam" :fo-max 50) (-> obj reflector-trans)) ) (set! (-> obj rise-sound-id) (new-sound-id)) (set! (-> obj grips-sound-id) (new-sound-id)) @@ -2169,19 +2158,8 @@ (set! (-> obj link) (new 'process 'actor-link-info obj)) (initialize-skeleton obj *reflector-mirror-sg* '()) (set-vector! (-> obj beam-end) 1805721.6 167936.0 -932659.2 1.0) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-beam") - :volume #x400 - :fo-max 50 - ) - (-> obj beam-end) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-beam" :fo-max 50) (-> obj beam-end)) ) (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) (go reflector-mirror-broken #t) diff --git a/goal_src/levels/jungle/junglefish.gc b/goal_src/levels/jungle/junglefish.gc index eded00dc5c..4209b20756 100644 --- a/goal_src/levels/jungle/junglefish.gc +++ b/goal_src/levels/jungle/junglefish.gc @@ -406,7 +406,7 @@ nav-enemy-default-event-handler (initialize-skeleton obj *junglefish-sg* '()) (TODO-RENAME-45 obj *junglefish-nav-enemy-info*) (set! (-> obj water) (new 'process 'water-control obj 7 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 2)) + (set! (-> obj water flags) (water-flags wt01)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 5734.4) (set! (-> obj collide-info trans y) (+ -4096.0 (-> obj water height))) diff --git a/goal_src/levels/jungle/junglesnake.gc b/goal_src/levels/jungle/junglesnake.gc index e9beddcd62..6bfd3563ce 100644 --- a/goal_src/levels/jungle/junglesnake.gc +++ b/goal_src/levels/jungle/junglesnake.gc @@ -118,7 +118,9 @@ ) ) (cond - ((and (-> self is-lethal?) (zero? (logand (-> *target* state-flags) #x80f8))) + ((and (-> self is-lethal?) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + ) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) self) (set! (-> a1-2 num-params) 2) @@ -438,7 +440,7 @@ junglesnake-default-event-handler (behavior () (if (and (and *target* (>= 24576.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans)))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (-> self refractory-delay)) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) ) (go junglesnake-attack) ) diff --git a/goal_src/levels/jungleb/plant-boss.gc b/goal_src/levels/jungleb/plant-boss.gc index 9b3a219c06..c5216bef56 100644 --- a/goal_src/levels/jungleb/plant-boss.gc +++ b/goal_src/levels/jungleb/plant-boss.gc @@ -1557,7 +1557,7 @@ ) ) *target* - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) ) (go plant-boss-attack 1) ) diff --git a/goal_src/levels/lavatube/lavatube-obs.gc b/goal_src/levels/lavatube/lavatube-obs.gc index c5de11221f..42589981fa 100644 --- a/goal_src/levels/lavatube/lavatube-obs.gc +++ b/goal_src/levels/lavatube/lavatube-obs.gc @@ -888,19 +888,7 @@ (set! (-> obj root-override) (the-as collide-shape-moving (new 'process 'trsqv))) (darkecobarrel-base-init arg0) (set! (-> obj sound) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lav-dark-eco") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (new 'process 'ambient-sound (static-sound-spec "lav-dark-eco" :fo-max 30) (-> obj root-override trans)) ) (logior! (-> obj draw status) (draw-status hidden)) (set! (-> obj speed) (/ 300.0 (res-lump-float (-> obj entity) 'speed :default 61440.0))) @@ -1398,19 +1386,8 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *chainmine-sg* '()) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lava-mine-chain") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "lava-mine-chain" :fo-max 30) (-> obj root-override trans)) ) (go (method-of-object obj idle)) (none) @@ -1680,8 +1657,8 @@ (set! (-> v1-2 global-scale) 2048.0) (set! (-> v1-2 waveform) ripple-for-lavatube-lava) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x2000000 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt25) (-> obj flags))) (set! (-> obj attack-event) 'heat) (none) ) diff --git a/goal_src/levels/lavatube/lavatube-part.gc b/goal_src/levels/lavatube/lavatube-part.gc index 68795a4461..11a7434a78 100644 --- a/goal_src/levels/lavatube/lavatube-part.gc +++ b/goal_src/levels/lavatube/lavatube-part.gc @@ -262,14 +262,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 0.7 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-x (meters 0) (meters 3) 1.0) (sp-flt spt-y (meters -1)) (sp-rnd-flt spt-scale-x (meters 6) (meters 4) 1.0) @@ -361,14 +354,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 0.4 0.3 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 6) (meters 4) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) diff --git a/goal_src/levels/maincave/baby-spider.gc b/goal_src/levels/maincave/baby-spider.gc index b637de21db..445d52f90d 100644 --- a/goal_src/levels/maincave/baby-spider.gc +++ b/goal_src/levels/maincave/baby-spider.gc @@ -225,7 +225,7 @@ baby-spider-default-event-handler (defmethod common-post baby-spider ((obj baby-spider)) - (when (logtest? (-> obj collide-info status) 1) + (when (logtest? (-> obj collide-info status) (cshape-moving-flags onsurf)) (vector-deg-seek (-> obj up-vector) (-> obj up-vector) (-> obj collide-info surface-normal) 910.2222) (vector-normalize! (-> obj up-vector) 1.0) ) @@ -840,7 +840,7 @@ baby-spider-default-event-handler (TODO-RENAME-45 obj *baby-spider-nav-enemy-info*) ) (let ((v1-11 (-> obj draw shadow-ctrl settings))) - (set! (-> v1-11 flags) (logand -9 (-> v1-11 flags))) + (logclear! (-> v1-11 flags) (shadow-flags shdf03)) (set! (-> v1-11 fade-dist) 98304.0) ) (vector-float*! (-> obj collide-info scale) *identity-vector* 0.63) diff --git a/goal_src/levels/maincave/driller-lurker.gc b/goal_src/levels/maincave/driller-lurker.gc index 79b6beacc3..9446ecc2bb 100644 --- a/goal_src/levels/maincave/driller-lurker.gc +++ b/goal_src/levels/maincave/driller-lurker.gc @@ -521,9 +521,10 @@ ) ) (when (and (-> obj hit-player?) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> obj hit-player-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> obj hit-player-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> obj root-overeride) 2 (collide-offense touch)) @@ -1311,34 +1312,10 @@ ) (set! (-> obj draw shadow-ctrl) *driller-lurker-shadow-control*) (set! (-> obj sound) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "drill-idle") - :volume #x400 - :fo-max 40 - ) - (-> obj root-overeride trans) - ) + (new 'process 'ambient-sound (static-sound-spec "drill-idle" :fo-max 40) (-> obj root-overeride trans)) ) (set! (-> obj sound2) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "drill-idle2") - :volume #x400 - :fo-max 60 - ) - (-> obj root-overeride trans) - ) + (new 'process 'ambient-sound (static-sound-spec "drill-idle2" :fo-max 60) (-> obj root-overeride trans)) ) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 331) obj)) (let ((f0-34 (path-distance (-> obj path)))) diff --git a/goal_src/levels/maincave/gnawer.gc b/goal_src/levels/maincave/gnawer.gc index caeb4d6656..5b7cbff778 100644 --- a/goal_src/levels/maincave/gnawer.gc +++ b/goal_src/levels/maincave/gnawer.gc @@ -1769,34 +1769,16 @@ ) ) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 329) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "gnawer-crawl") - :volume #x400 - :fo-min 30 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new + 'process + 'ambient-sound + (static-sound-spec "gnawer-crawl" :fo-min 30 :fo-max 30) + (-> obj root-override trans) + ) ) - (set! (-> obj sound2) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "gnawer-chew") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound2) + (new 'process 'ambient-sound (static-sound-spec "gnawer-chew" :fo-max 40) (-> obj root-override trans)) ) (dotimes (v1-110 10) (let ((a0-59 (-> obj segments v1-110))) diff --git a/goal_src/levels/maincave/maincave-obs.gc b/goal_src/levels/maincave/maincave-obs.gc index 9d3dfaddcc..3b09e7a934 100644 --- a/goal_src/levels/maincave/maincave-obs.gc +++ b/goal_src/levels/maincave/maincave-obs.gc @@ -199,19 +199,8 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *cavecrusher-sg* '()) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "crush-click") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "crush-click" :fo-max 30) (-> obj root-override trans)) ) (ja-channel-push! 1 0) (let ((s5-1 (-> obj skel root-channel 0))) @@ -347,8 +336,8 @@ (until (or (or (not *target*) (< 28672.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) ) - (and (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (and (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-7))) @@ -384,8 +373,8 @@ ) (until (ja-done? 0) (when (and (and *target* (>= 28672.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans)))) - (or (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (or (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-7)) ) @@ -866,20 +855,7 @@ ) (process-drawable-from-entity! obj arg0) (set! (-> obj sound) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "spatula") - :volume #x400 - :fo-min 25 - :fo-max 50 - ) - (-> obj root-override trans) - ) + (new 'process 'ambient-sound (static-sound-spec "spatula" :fo-min 25 :fo-max 50) (-> obj root-override trans)) ) (case (-> (if (-> obj entity) (-> obj entity extra level) @@ -1009,20 +985,8 @@ (set! (-> s5-1 frame-num) 0.0) ) (transform-post) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "spatula") - :volume #x400 - :fo-min 25 - :fo-max 50 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "spatula" :fo-min 25 :fo-max 50) (-> obj root-override trans)) ) (go cavespatulatwo-idle) (none) diff --git a/goal_src/levels/maincave/mother-spider-egg.gc b/goal_src/levels/maincave/mother-spider-egg.gc index 852e958de1..47cac7a4cd 100644 --- a/goal_src/levels/maincave/mother-spider-egg.gc +++ b/goal_src/levels/maincave/mother-spider-egg.gc @@ -189,7 +189,7 @@ 0.0 ) (let ((v1-11 (-> obj draw shadow-ctrl))) - (set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags))) + (logclear! (-> v1-11 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-14 (-> obj draw shadow-ctrl))) @@ -204,7 +204,7 @@ ) (else (let ((v1-22 (-> obj draw shadow-ctrl))) - (logior! (-> v1-22 settings flags) 32) + (logior! (-> v1-22 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -213,7 +213,7 @@ ) (else (let ((v1-25 (-> obj draw shadow-ctrl))) - (logior! (-> v1-25 settings flags) 32) + (logior! (-> v1-25 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -449,7 +449,7 @@ ) ) (let ((v1-37 (-> self draw shadow-ctrl))) - (logior! (-> v1-37 settings flags) 32) + (logior! (-> v1-37 settings flags) (shadow-flags shdf05)) ) 0 (go mother-spider-egg-die-exit) @@ -464,7 +464,7 @@ (behavior () (logclear! (-> self mask) (process-mask actor-pause)) (let ((v1-3 (-> self draw shadow-ctrl))) - (logior! (-> v1-3 settings flags) 32) + (logior! (-> v1-3 settings flags) (shadow-flags shdf05)) ) 0 (lods-assign! (-> self draw) (-> self broken-look)) @@ -528,7 +528,7 @@ (logclear! (-> self mask) (process-mask actor-pause)) (clear-collide-with-as (-> self root-override)) (let ((v1-5 (-> self draw shadow-ctrl))) - (logior! (-> v1-5 settings flags) 32) + (logior! (-> v1-5 settings flags) (shadow-flags shdf05)) ) 0 (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) @@ -581,7 +581,7 @@ (send-event (ppointer->process (-> self parent-override)) 'untrigger) (logior! (-> self draw status) (draw-status hidden)) (let ((v1-8 (-> self draw shadow-ctrl))) - (logior! (-> v1-8 settings flags) 32) + (logior! (-> v1-8 settings flags) (shadow-flags shdf05)) ) 0 (logclear! (-> self root-override nav-flags) (nav-flags navf0)) diff --git a/goal_src/levels/maincave/mother-spider-proj.gc b/goal_src/levels/maincave/mother-spider-proj.gc index 18fd75116f..bfedb96fa6 100644 --- a/goal_src/levels/maincave/mother-spider-proj.gc +++ b/goal_src/levels/maincave/mother-spider-proj.gc @@ -252,7 +252,7 @@ ) (sound-trans-convert (-> s5-0 parms trans) a1-1) ) - (set! (-> s5-0 parms mask) (the-as uint 32)) + (set! (-> s5-0 parms mask) (sound-mask trans)) (-> s5-0 id) ) (let ((f0-5 (* 5120.0 (+ 0.9 (* 0.1 (cos (* 873.81335 (the float (mod (-> *display* base-frame-counter) 75))))))))) @@ -278,7 +278,7 @@ (s4-0 (new 'stack-no-clear 'vector)) (s5-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) ) - (if (logtest? (-> arg0 root-override status) 4) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags tsurf)) (vector-flatten! s3-1 s3-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s3-1 1.0) @@ -348,7 +348,7 @@ ) (defmethod dummy-28 mother-spider-proj ((obj mother-spider-proj)) - (when (and *target* (zero? (logand (-> *target* state-flags) #x80f8))) + (when (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) (let ((gp-0 (-> obj target))) (set! (-> gp-0 quad) (-> (target-pos 0) quad)) (set! (-> gp-0 y) (+ 4915.2 (-> gp-0 y))) diff --git a/goal_src/levels/maincave/mother-spider.gc b/goal_src/levels/maincave/mother-spider.gc index c63a9d88a0..0b38bbb5a0 100644 --- a/goal_src/levels/maincave/mother-spider.gc +++ b/goal_src/levels/maincave/mother-spider.gc @@ -408,8 +408,8 @@ ) (defmethod is-player-stuck? mother-spider ((obj mother-spider)) - (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) ) @@ -453,7 +453,7 @@ 0.0 ) (let ((v1-11 (-> obj draw shadow-ctrl))) - (set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags))) + (logclear! (-> v1-11 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-14 (-> obj draw shadow-ctrl))) @@ -474,7 +474,7 @@ ) (else (let ((v1-23 (-> obj draw shadow-ctrl))) - (logior! (-> v1-23 settings flags) 32) + (logior! (-> v1-23 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -483,7 +483,7 @@ ) (else (let ((v1-25 (-> obj draw shadow-ctrl))) - (logior! (-> v1-25 settings flags) 32) + (logior! (-> v1-25 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -852,7 +852,7 @@ :enter (behavior () (let ((v1-1 (-> self draw shadow-ctrl))) - (logior! (-> v1-1 settings flags) 32) + (logior! (-> v1-1 settings flags) (shadow-flags shdf05)) ) 0 (set! (-> self mode) (the-as uint 0)) @@ -1123,7 +1123,9 @@ ) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector<-cspace! gp-0 (-> self node-list data 6)) - (if (or (logtest? (-> *target* state-flags) #x80f8) (< (vector-vector-distance gp-0 (camera-pos)) 8192.0)) + (if (or (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) + (< (vector-vector-distance gp-0 (camera-pos)) 8192.0) + ) (go mother-spider-traveling (the-as uint 2)) ) ) @@ -1139,8 +1141,8 @@ ) ) ) - (if (or (not *target*) (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (if (or (not *target*) (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) (set! (-> self last-player-in-air-time) (-> *display* base-frame-counter)) @@ -1399,14 +1401,14 @@ (go mother-spider-traveling (the-as uint 0)) ) (if (and (>= (- (-> *display* base-frame-counter) (-> self started-birthing-time)) (seconds 6)) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) ) (go mother-spider-traveling (the-as uint 1)) ) (if (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.25)) (> (-> self birthing-counter) 0) (and (>= 49152.0 (- (-> self max-dist-from-anchor) (-> self dist-from-anchor))) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (TODO-RENAME-21 (-> self nav) (-> self root-override trans)) ) ) diff --git a/goal_src/levels/maincave/spiderwebs.gc b/goal_src/levels/maincave/spiderwebs.gc index 8ab8bf9dd4..3ad2a25102 100644 --- a/goal_src/levels/maincave/spiderwebs.gc +++ b/goal_src/levels/maincave/spiderwebs.gc @@ -32,7 +32,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) diff --git a/goal_src/levels/misty/misty-conveyor.gc b/goal_src/levels/misty/misty-conveyor.gc index 81a5e8cd66..543206554a 100644 --- a/goal_src/levels/misty/misty-conveyor.gc +++ b/goal_src/levels/misty/misty-conveyor.gc @@ -320,7 +320,7 @@ (cond ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) (let ((v1-32 (-> self draw shadow-ctrl))) - (set! (-> v1-32 settings flags) (logand -33 (-> v1-32 settings flags))) + (logclear! (-> v1-32 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-35 (-> self draw shadow-ctrl))) @@ -334,7 +334,7 @@ ) (else (let ((v1-41 (-> self draw shadow-ctrl))) - (logior! (-> v1-41 settings flags) 32) + (logior! (-> v1-41 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-44 (-> self draw shadow-ctrl))) @@ -420,7 +420,7 @@ (f26-0 (- (-> *standard-dynamics* gravity-length))) ) (let ((v1-10 (-> self draw shadow-ctrl))) - (logior! (-> v1-10 settings flags) 32) + (logior! (-> v1-10 settings flags) (shadow-flags shdf05)) ) 0 (clear-collide-with-as (-> self root-override)) @@ -486,7 +486,7 @@ (initialize-skeleton self *keg-sg* '()) (set! (-> self draw shadow-ctrl) (new 'process 'shadow-control 0.0 0.0 614400.0 (the-as float 60) 245760.0)) (let ((v1-25 (-> self draw shadow-ctrl))) - (logior! (-> v1-25 settings flags) 32) + (logior! (-> v1-25 settings flags) (shadow-flags shdf05)) ) 0 (let ((s5-1 (new 'static 'vector :x -514715.0 :y 226968.0 :z 3906894.8 :w 1.0))) diff --git a/goal_src/levels/misty/misty-part.gc b/goal_src/levels/misty/misty-part.gc index d6cfb18e9c..e533b5b68a 100644 --- a/goal_src/levels/misty/misty-part.gc +++ b/goal_src/levels/misty/misty-part.gc @@ -852,14 +852,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -918,14 +911,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -985,14 +971,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1052,14 +1031,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) diff --git a/goal_src/levels/misty/mistycannon.gc b/goal_src/levels/misty/mistycannon.gc index 0d919ac776..9b45553120 100644 --- a/goal_src/levels/misty/mistycannon.gc +++ b/goal_src/levels/misty/mistycannon.gc @@ -731,7 +731,7 @@ ) (restore-collide-with-as (-> self root-override)) (set-vector! (-> self root-override scale) 0.6 0.6 0.6 1.0) - (while (zero? (logand (-> self root-override status) 1)) + (while (zero? (logand (-> self root-override status) (cshape-moving-flags onsurf))) (if (and (zero? (-> self sfx)) (< (if *target* (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) @@ -770,7 +770,7 @@ ) (sound-trans-convert (-> gp-1 parms trans) a1-3) ) - (set! (-> gp-1 parms mask) (the-as uint 32)) + (set! (-> gp-1 parms mask) (sound-mask trans)) (-> gp-1 id) ) ) @@ -846,7 +846,7 @@ (set! (-> self root-override root-prim prim-core offense) (collide-offense indestructible)) (spawn-part self) (when (and (zero? (-> self draw cur-lod)) (logtest? (-> self draw status) (draw-status was-drawn))) - (if (logtest? (-> self root-override status) 1) + (if (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (draw-shadow (-> self root-override shadow-pos) (-> self root-override shadow-pos) @@ -984,24 +984,8 @@ :code (behavior () (if (and *target* (= (-> *target* next-state name) 'target-periscope)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "explosion") - :volume #x400 - :fo-min #xc8 - :fo-max #x190 - ) - (new-sound-id) - (the-as vector #t) - ) - (sound-play-by-spec - (new 'static 'sound-spec :num 1.0 :group #x1 :sound-name (static-sound-name "explosion") :volume #x400) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "explosion" :fo-min 200 :fo-max 400) (new-sound-id) (the-as vector #t)) + (sound-play-by-spec (static-sound-spec "explosion") (new-sound-id) (the-as vector #t)) ) (spawn (-> self part2) (-> self root-override trans)) (ja-channel-set! 0) @@ -1048,7 +1032,7 @@ (vector-float*! (-> arg0 transv) (-> arg0 transv) 0.15) (let ((v0-1 (logior s5-0 7))) (logior! (-> arg0 status) v0-1) - (the-as uint v0-1) + (the-as cshape-moving-flags v0-1) ) ) ) diff --git a/goal_src/levels/misty/mud.gc b/goal_src/levels/misty/mud.gc index 0beb7ced85..d81a44030c 100644 --- a/goal_src/levels/misty/mud.gc +++ b/goal_src/levels/misty/mud.gc @@ -48,8 +48,8 @@ (let ((t9-0 (method-of-type water-anim TODO-RENAME-22))) (t9-0 obj) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x40000 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt18) (-> obj flags))) (let ((gp-0 (new 'process 'ripple-control))) (set! (-> obj draw ripple) gp-0) (set! (-> gp-0 global-scale) 3072.0) diff --git a/goal_src/levels/misty/quicksandlurker.gc b/goal_src/levels/misty/quicksandlurker.gc index 237ed787c9..b19ccffd4b 100644 --- a/goal_src/levels/misty/quicksandlurker.gc +++ b/goal_src/levels/misty/quicksandlurker.gc @@ -367,7 +367,7 @@ (-> self root-override transv) (-> self root-override root-prim collide-with) ) - (if (or (logtest? (-> self root-override status) 8) + (if (or (logtest? (-> self root-override status) (cshape-moving-flags twall)) (< (vector-vector-distance (-> self root-override trans) (the-as vector (-> self root-override trans-old))) 40.96 ) diff --git a/goal_src/levels/ogre/flying-lurker.gc b/goal_src/levels/ogre/flying-lurker.gc index a249b6e460..b77dac8b4e 100644 --- a/goal_src/levels/ogre/flying-lurker.gc +++ b/goal_src/levels/ogre/flying-lurker.gc @@ -48,7 +48,7 @@ (set-setting! *setting-control* self 'allow-progress #f 0.0 0) (logclear! (-> self mask) (process-mask actor-pause)) (process-entity-status! self (entity-perm-status bit-3) #t) - (while (or (not *target*) (logtest? (-> *target* state-flags) #x8008)) + (while (or (not *target*) (logtest? (-> *target* state-flags) (state-flags sf03 sf15))) (suspend) ) (while (not (process-grab? *target*)) @@ -457,7 +457,7 @@ ) (set! s4-0 #t) (let ((v1-17 s5-0)) - (set! (-> v1-17 settings flags) (logand -33 (-> v1-17 settings flags))) + (logclear! (-> v1-17 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-19 s5-0)) @@ -495,7 +495,7 @@ ) ) (when (not s4-0) - (logior! (-> s5-0 settings flags) 32) + (logior! (-> s5-0 settings flags) (shadow-flags shdf05)) 0 (set! (-> obj draw bounds quad) (-> obj default-bounds quad)) (set! (-> obj draw origin-joint-index) (the-as uint 4)) @@ -957,8 +957,8 @@ (logclear! (-> self mask) (process-mask actor-pause)) (close-specific-task! (game-task plunger-lurker-hit) (task-status unknown)) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -1403,7 +1403,7 @@ (new 'process 'shadow-control 131072.0 151552.0 614400.0 (the-as float 60) 409600.0) ) (let ((v1-27 (-> obj draw shadow-ctrl))) - (set! (-> v1-27 settings flags) (logand -33 (-> v1-27 settings flags))) + (logclear! (-> v1-27 settings flags) (shadow-flags shdf05)) ) 0 (set! (-> obj alt-actor) (entity-actor-lookup arg0 'alt-actor 0)) diff --git a/goal_src/levels/ogre/ogre-obs.gc b/goal_src/levels/ogre/ogre-obs.gc index c3c934e1b0..b181f67ba6 100644 --- a/goal_src/levels/ogre/ogre-obs.gc +++ b/goal_src/levels/ogre/ogre-obs.gc @@ -1511,8 +1511,8 @@ (set! (-> v1-2 global-scale) 2048.0) (set! (-> v1-2 waveform) ripple-for-ogre-lava) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x2000000 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt25) (-> obj flags))) (set! (-> obj attack-event) 'lava) (none) ) diff --git a/goal_src/levels/racer_common/collide-reaction-racer.gc b/goal_src/levels/racer_common/collide-reaction-racer.gc index 27fb24efd3..e2c30686d8 100644 --- a/goal_src/levels/racer_common/collide-reaction-racer.gc +++ b/goal_src/levels/racer_common/collide-reaction-racer.gc @@ -61,7 +61,7 @@ (if s3-1 (set! sv-104 (logior sv-104 2)) ) - (when (zero? (logand (-> arg0 prev-status) 1)) + (when (zero? (logand (-> arg0 prev-status) (cshape-moving-flags onsurf))) (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) (set! sv-96 (logior sv-96 2048)) (when (not s3-1) @@ -116,19 +116,18 @@ (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) (cond - ((not - (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) - ) - ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) (seconds 0.3)) - (zero? (logand sv-104 32)) - ) - ) - ) + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) (seconds 0.3)) + (zero? (logand sv-104 32)) + ) + ) + ) ) (else (set! sv-104 (logior sv-104 256)) @@ -183,7 +182,7 @@ ) ) (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as uint sv-104)) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) (update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 @@ -192,7 +191,7 @@ arg2 ) (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as uint sv-96) + (the-as cshape-moving-flags sv-96) ) diff --git a/goal_src/levels/racer_common/racer-states.gc b/goal_src/levels/racer_common/racer-states.gc index f4138010ec..a6ecb22054 100644 --- a/goal_src/levels/racer_common/racer-states.gc +++ b/goal_src/levels/racer_common/racer-states.gc @@ -134,7 +134,7 @@ (set! (-> *hud-parts* power 0 y-sgn) 1) (logclear! (-> self control root-prim prim-core action) (collide-action ca-9 ca-16)) (set! (-> self control unknown-surface00) *walk-mods*) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (send-event *camera* 'clear-slave-option #x6000) (set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max)) (set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length)) @@ -325,7 +325,7 @@ (defbehavior target-racing-smack-check target () (if (and (< 20480.0 (-> self control unknown-float01)) - (and (logtest? (-> self control status) 8) + (and (logtest? (-> self control status) (cshape-moving-flags twall)) (< (-> self control surface-angle) 0.5) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector70) (-> self control trans))) (s5-0 (new 'stack-no-clear 'vector)) @@ -387,7 +387,7 @@ ) ) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (or (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (* (-> *TARGET-bank* ground-timeout) 2) ) @@ -612,14 +612,14 @@ (vector-normalize! (-> self control transv) (+ (-> self control unknown-float01) (-> self racer hill-boost))) ) ) - (if (and (logtest? (-> self control status) 1) (< 16384.0 (-> self control transv y))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (< 16384.0 (-> self control transv y))) (set! (-> self racer hop?) #f) (set! (-> self racer hop?) arg2) ) (set! (-> self racer hop-start-y) (-> self control trans y)) (racer-calc-gravity) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *racer-air-mods*) (set! (-> self control unknown-float123) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))))) @@ -654,9 +654,8 @@ ((cpad-pressed? (-> self control unknown-cpad-info00 number) l1 r1) (set! (-> self racer slide-down-time 0) (-> *display* base-frame-counter)) ) - ((zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) + ((zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) (set! (-> self racer slide-down-time 0) 0) 0 ) @@ -690,7 +689,7 @@ ) ) ) - (if (and (logtest? (-> self control status) 1) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) (go target-racing) @@ -738,7 +737,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (racer-calc-gravity) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-float123) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))))) ) @@ -776,7 +775,7 @@ ) (go target-racing-jump 2048.0 5324.8 #t) ) - (if (and (logtest? (-> self control status) 1) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) (go target-racing) @@ -929,7 +928,7 @@ ) :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-racing) ) (target-racing-smack-check) @@ -980,7 +979,7 @@ :exit (behavior () (if (!= (-> self next-state name) 'target-racing-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) ((-> target-racing-start exit)) (none) @@ -994,7 +993,7 @@ (sound-play-by-name (static-sound-name "oof") (new-sound-id) 1024 0 0 1 #t) ) (set! (-> self game hit-time) (-> *display* base-frame-counter)) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self racer boost-curve) 0.0) (set! (-> self racer boost-level) 0.0) (set! (-> self racer boost-target) 0.0) @@ -1066,7 +1065,7 @@ (-> target-death event) :exit (behavior () - (set! (-> self state-flags) (logand -32769 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf15)) (send-event (ppointer->process (-> self manipy)) 'draw #t) (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) (target-timed-invulnerable-off self) @@ -1083,7 +1082,7 @@ (set! (-> self racer stick-off) #t) (set! (-> self neck flex-blend) 0.0) (target-timed-invulnerable-off self) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) (case (-> self attack-info mode) (('explode 'darkeco 'heat 'death 'deadly 'balloonlurker) ((-> target-racing-start exit)) @@ -1311,7 +1310,7 @@ (behavior ((arg0 handle)) (set! (-> self control transv quad) (the-as uint128 0)) (set! (-> self alt-cam-pos quad) (-> (&-> (-> self control) unknown-qword00) 0)) - (logior! (-> self state-flags) 1024) + (logior! (-> self state-flags) (state-flags sf10)) (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) @@ -1385,7 +1384,7 @@ ) ) ) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (send-event *camera* 'set-slave-option #x6000) (set! (-> self control transv quad) (the-as uint128 0)) (quaternion-copy! (-> self control quat) (-> self control unknown-quaternion00)) @@ -1719,7 +1718,7 @@ (-> target-hit-ground enter) :trans (behavior () - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) ((-> target-hit-ground trans)) (none) ) @@ -1780,15 +1779,15 @@ (behavior () (set! (-> self control unknown-surface00) *grab-mods*) (set! (-> self neck flex-blend) 0.0) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (set! (-> self racer stick-off) #t) (none) ) :exit (behavior () (set! (-> self racer stick-off) #f) - (set! (-> self state-flags) (logand -273 (-> self state-flags))) - (set! (-> self water flags) (logand -65537 (-> self water flags))) + (logclear! (-> self state-flags) (state-flags sf04 sf08)) + (logclear! (-> self water flags) (water-flags wt16)) ((-> target-racing-start exit)) (none) ) diff --git a/goal_src/levels/racer_common/racer.gc b/goal_src/levels/racer_common/racer.gc index bcd542a28a..d7fe43ec3a 100644 --- a/goal_src/levels/racer_common/racer.gc +++ b/goal_src/levels/racer_common/racer.gc @@ -475,19 +475,8 @@ ) ) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "zoom-teleport") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :fo-max 30) (-> obj root-override trans)) ) (go (method-of-object obj wait-for-start)) (none) diff --git a/goal_src/levels/racer_common/target-racer.gc b/goal_src/levels/racer_common/target-racer.gc index fdf5fe7f00..c5b74a841f 100644 --- a/goal_src/levels/racer_common/target-racer.gc +++ b/goal_src/levels/racer_common/target-racer.gc @@ -30,7 +30,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x1 + :flags (surface-flags surf00) ) ) @@ -58,7 +58,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x801 + :flags (surface-flags surf00 surf11) ) ) @@ -91,7 +91,7 @@ ) (defbehavior racer-on-ground? racer () - (logtest? (-> self root-override status) 1) + (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) ) (defbehavior racer-calc-gravity target () @@ -128,16 +128,14 @@ (let ((v1-1 (-> self racer slide-mode))) (cond ((zero? v1-1) - (if (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) + (if (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) (set! (-> self racer slide-mode) -1) ) ) ((= v1-1 1) - (if (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) + (if (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) (set! (-> self racer slide-mode) -1) ) ) @@ -300,11 +298,10 @@ ) (set! f0-13 (cond - ((and (not - (and (= (-> self fact-info-target eco-type) (pickup-type eco-yellow)) - (>= (-> self fact-info-target eco-level) 1.0) - ) - ) + ((and (not (and (= (-> self fact-info-target eco-type) (pickup-type eco-yellow)) + (>= (-> self fact-info-target eco-level) 1.0) + ) + ) (cpad-hold? (-> self control unknown-cpad-info00 number) square) ) (if (and (cpad-hold? (-> self control unknown-cpad-info00 number) x) @@ -452,7 +449,7 @@ ) (deg-diff (vector-y-angle gp-0) (vector-y-angle (-> self control transv))) (let ((f30-2 (vector-xz-length gp-0))) - (when (and (logtest? (-> self control status) 8) + (when (and (logtest? (-> self control status) (cshape-moving-flags twall)) (< 20480.0 f30-2) (and (< (fabs (-> self racer mod-x)) 0.5) (!= (-> self next-state name) 'target-racing-smack)) ) @@ -531,8 +528,10 @@ ) ) (let ((f0-2 - (if (or (and (logtest? (-> self control status) 8) (zero? (logand (-> self control status) 1))) - (logtest? (-> self state-flags) #x8000) + (if (or (and (logtest? (-> self control status) (cshape-moving-flags twall)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) + (logtest? (-> self state-flags) (state-flags sf15)) ) 0.0 (-> self control unknown-float81) @@ -601,7 +600,9 @@ ((and (!= (-> self current-level name) 'ogre) (!= (-> self current-level name) 'lavatube)) #f ) - ((or (logtest? (-> self control status) 2) (< 12288.0 (vector-length (-> self control transv)))) + ((or (logtest? (-> self control status) (cshape-moving-flags onground)) + (< 12288.0 (vector-length (-> self control transv))) + ) (let ((v0-5 (the-as object (-> *display* base-frame-counter)))) (set! (-> self racer unstuck-time) (the-as time-frame v0-5)) v0-5 @@ -818,7 +819,7 @@ ) (cpad-pressed? (-> self control unknown-cpad-info00 number) circle square) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) (seconds 0.25)) - (zero? (logand (-> self state-flags) #x8008)) + (zero? (logand (-> self state-flags) (state-flags sf03 sf15))) ) (let ((gp-6 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat))) (s5-4 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self manipy 0 node-list data 4))) @@ -917,9 +918,8 @@ (set! (-> self racer boost-curve) 0.0) ) ) - (when (or (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons x)) - ) + (when (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons x)) + ) (< (-> self control unknown-float01) 4096.0) (= (-> self racer boost-level) 0.0) ) @@ -930,7 +930,7 @@ (set! (-> v1-241 parms volume) -4) (set! (-> v1-241 auto-time) 120) (set! (-> v1-241 auto-from) 2) - (set! (-> v1-241 parms mask) (the-as uint 17)) + (set! (-> v1-241 parms mask) (sound-mask volume time)) (-> v1-241 id) ) (set! (-> self racer boost-sound-id) (new 'static 'sound-id)) @@ -955,7 +955,7 @@ ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 1 (seconds 0.1)) ) - (when (logtest? (-> self control status) 8) + (when (logtest? (-> self control status) (cshape-moving-flags twall)) (let* ((gp-8 (racer-find-prop-point (new 'stack-no-clear 'vector) (-> self control unknown-vector70))) (v1-274 (-> self control wall-pat material)) (a1-54 @@ -1540,7 +1540,7 @@ ) ) (cond - ((and (logtest? (-> self control status) 8) + ((and (logtest? (-> self control status) (cshape-moving-flags twall)) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (seconds 0.1)) (or (-> self racer stick-lock) (< (target-move-dist (-> *TARGET-bank* stuck-time)) 4096.0)) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2))) diff --git a/goal_src/levels/rolling/rolling-obs.gc b/goal_src/levels/rolling/rolling-obs.gc index b0e7b6c1ea..1da460b13e 100644 --- a/goal_src/levels/rolling/rolling-obs.gc +++ b/goal_src/levels/rolling/rolling-obs.gc @@ -1759,7 +1759,7 @@ (set! (-> v1-2 far-fade-dist) 245760.0) (set! (-> v1-2 waveform) (the-as ripple-wave-set ripple-for-rolling-water)) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) (none) ) diff --git a/goal_src/levels/rolling/rolling-race-ring.gc b/goal_src/levels/rolling/rolling-race-ring.gc index 119656200b..6e6b5cd9f5 100644 --- a/goal_src/levels/rolling/rolling-race-ring.gc +++ b/goal_src/levels/rolling/rolling-race-ring.gc @@ -1086,19 +1086,8 @@ (set! (-> obj part-track) (the-as handle #f)) (set! (-> obj alt-actor) (entity-actor-lookup arg0 'alt-actor 0)) (logior! (-> obj draw status) (draw-status hidden)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "loop-racering") - :volume #x400 - :fo-max 40 - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "loop-racering" :fo-max 40) (-> obj root trans)) ) (let ((f0-1 (res-lump-float arg0 'timeout))) (set! (-> obj timeout) (the-as time-frame (the int (* 300.0 f0-1)))) diff --git a/goal_src/levels/snow/ice-cube.gc b/goal_src/levels/snow/ice-cube.gc index 795f6e9148..8ded5323b2 100644 --- a/goal_src/levels/snow/ice-cube.gc +++ b/goal_src/levels/snow/ice-cube.gc @@ -992,7 +992,7 @@ (dummy-57 self) (logclear! (-> self mask) (process-mask actor-pause)) (if (or (not *target*) - (logtest? (-> *target* state-flags) #x80f8) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (not (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos))) ) (go-virtual nav-enemy-patrol) @@ -1033,7 +1033,7 @@ ) (+! (-> self collide-info transv y) (* -544768.0 (-> *display* seconds-per-frame))) (let* ((v1-26 (>= 0.0 (-> self collide-info transv y))) - (v1-27 (and v1-26 (logtest? (-> self collide-info status) 1))) + (v1-27 (and v1-26 (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)))) ) (set! gp-0 (dummy-60 self (not v1-27))) ) @@ -1045,7 +1045,12 @@ ) ) (while #t - (let ((s5-0 (and (>= 0.0 (-> self collide-info transv y)) (logtest? (-> self collide-info status) 1)))) + (let ((s5-0 + (and (>= 0.0 (-> self collide-info transv y)) + (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) + ) + ) + ) (set! gp-0 (and s5-0 gp-0)) (if gp-0 (goto cfg-26) @@ -1166,7 +1171,7 @@ (logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf2)) (dummy-58 self) (if (or (not *target*) - (logtest? (-> *target* state-flags) #x80f8) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (not (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos))) ) (go ice-cube-retract-spikes) @@ -1207,7 +1212,7 @@ ) (+! (-> self collide-info transv y) (* -544768.0 (-> *display* seconds-per-frame))) (let* ((v1-26 (>= 0.0 (-> self collide-info transv y))) - (v1-27 (and v1-26 (logtest? (-> self collide-info status) 1))) + (v1-27 (and v1-26 (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)))) ) (set! gp-0 (dummy-60 self (not v1-27))) ) @@ -1219,7 +1224,12 @@ ) ) (while #t - (let ((s5-0 (and (>= 0.0 (-> self collide-info transv y)) (logtest? (-> self collide-info status) 1)))) + (let ((s5-0 + (and (>= 0.0 (-> self collide-info transv y)) + (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) + ) + ) + ) (set! gp-0 (and s5-0 gp-0)) (if gp-0 (goto cfg-26) @@ -1279,7 +1289,7 @@ (logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf2)) (set! (-> self next-skid-sound-time) (-> *display* base-frame-counter)) (if (or (not *target*) - (logtest? (-> *target* state-flags) #x80f8) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (not (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos))) ) (go ice-cube-retract-spikes) @@ -1308,7 +1318,7 @@ ) :trans (behavior () - (when (or (not *target*) (logtest? (-> *target* state-flags) 128)) + (when (or (not *target*) (logtest? (-> *target* state-flags) (state-flags sf07))) (cond ((= (-> self speed) 0.0) (go ice-cube-mean-charge-done) diff --git a/goal_src/levels/snow/snow-bumper.gc b/goal_src/levels/snow/snow-bumper.gc index 4716a4b2cd..b670be8b7a 100644 --- a/goal_src/levels/snow/snow-bumper.gc +++ b/goal_src/levels/snow/snow-bumper.gc @@ -435,19 +435,8 @@ (nav-mesh-connect obj (-> obj root) (the-as nav-control #f)) (set! (-> obj link) (new 'process 'actor-link-info obj)) (set! (-> obj bumper-id) (+ (actor-count-before (-> obj link)) 1)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "snow-bumper") - :volume #x400 - :fo-max 40 - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "snow-bumper" :fo-max 40) (-> obj root trans)) ) (ja-channel-set! 1) (let ((s5-1 (-> obj skel root-channel 0))) diff --git a/goal_src/levels/snow/snow-bunny.gc b/goal_src/levels/snow/snow-bunny.gc index b0f6ec0bce..408b55a444 100644 --- a/goal_src/levels/snow/snow-bunny.gc +++ b/goal_src/levels/snow/snow-bunny.gc @@ -208,7 +208,7 @@ (defmethod TODO-RENAME-48 snow-bunny ((obj snow-bunny)) (dummy-60 obj) (TODO-RENAME-45 obj *snow-bunny-nav-enemy-info*) - (set! (-> obj draw shadow-ctrl settings flags) (logand -9 (-> obj draw shadow-ctrl settings flags))) + (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf03)) (cond ((zero? (res-lump-value (-> obj entity) 'mode uint128)) (set! (-> obj defense) (the-as uint 1)) @@ -246,7 +246,7 @@ ) (defmethod dummy-58 snow-bunny ((obj snow-bunny)) - (if (zero? (logand (-> *target* state-flags) 2)) + (if (zero? (logand (-> *target* state-flags) (state-flags sf01))) (set! (-> obj last-nondangerous-time) (-> *display* base-frame-counter)) ) (none) @@ -293,7 +293,7 @@ ) (defmethod dummy-57 snow-bunny ((obj snow-bunny)) - (if (or (not *target*) (zero? (logand (-> *target* state-flags) 2))) + (if (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf01)))) (return #f) ) (let ((f0-0 (vector-vector-xz-distance (target-pos 0) (-> obj collide-info trans)))) @@ -739,7 +739,7 @@ (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) ) ) - (until (logtest? (-> self collide-info status) 1) + (until (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) (let ((a0-11 (-> self skel root-channel 0))) (set! (-> a0-11 param 0) (the float (+ (-> a0-11 frame-group data 0 length) -1))) (set! (-> a0-11 param 1) f30-0) @@ -888,7 +888,7 @@ (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) (set! (-> self should-retreat?) #f) - (if (or (not *target*) (logtest? (-> *target* state-flags) 128)) + (if (or (not *target*) (logtest? (-> *target* state-flags) (state-flags sf07))) (go-virtual nav-enemy-patrol) ) (if (not (TODO-RENAME-46 self (-> self nav-info stop-chase-distance))) @@ -1164,7 +1164,7 @@ (go-virtual nav-enemy-patrol) ) (let ((v1-8 (>= 73728.0 (vector-vector-xz-distance (target-pos 0) (-> self collide-info trans))))) - (when (or (-> self should-retreat?) (and v1-8 (logtest? (-> *target* state-flags) 2))) + (when (or (-> self should-retreat?) (and v1-8 (logtest? (-> *target* state-flags) (state-flags sf01)))) (set! (-> self retreat-timeout-time) (+ (-> *display* base-frame-counter) (the int (* 300.0 (-> self retreat-timeout)))) ) @@ -1172,7 +1172,7 @@ ) (when (or (>= (-> *display* base-frame-counter) (-> self retreat-timeout-time)) (not v1-8)) (if (or (not *target*) - (logtest? (-> *target* state-flags) 128) + (logtest? (-> *target* state-flags) (state-flags sf07)) (not (TODO-RENAME-46 self (-> self nav-info stop-chase-distance))) ) (go-virtual nav-enemy-patrol) @@ -1236,10 +1236,12 @@ (go-virtual snow-bunny-chase-hop) ) ) - (if (not (logtest? (-> *target* state-flags) 2)) + (if (not (logtest? (-> *target* state-flags) (state-flags sf01))) (go-virtual snow-bunny-chase-hop) ) - (if (and (logtest? (-> *target* state-flags) 2) (not (TODO-RENAME-46 self (-> self nav-info notice-distance)))) + (if (and (logtest? (-> *target* state-flags) (state-flags sf01)) + (not (TODO-RENAME-46 self (-> self nav-info notice-distance))) + ) (go-virtual snow-bunny-retreat-hop) ) (none) @@ -1337,7 +1339,7 @@ (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) ) ) - (until (logtest? (-> self collide-info status) 1) + (until (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) (suspend) ) (go-virtual snow-bunny-retreat-hop) diff --git a/goal_src/levels/snow/snow-flutflut-obs.gc b/goal_src/levels/snow/snow-flutflut-obs.gc index 40f6189b6a..4115656a3e 100644 --- a/goal_src/levels/snow/snow-flutflut-obs.gc +++ b/goal_src/levels/snow/snow-flutflut-obs.gc @@ -953,8 +953,8 @@ (behavior () (when *target* (if (and (>= 798720.0 (-> (target-pos 0) y)) - (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) ) diff --git a/goal_src/levels/snow/snow-obs.gc b/goal_src/levels/snow/snow-obs.gc index 8491c8aa49..b62b3f4984 100644 --- a/goal_src/levels/snow/snow-obs.gc +++ b/goal_src/levels/snow/snow-obs.gc @@ -595,19 +595,8 @@ (set! (-> obj root-override trans y) (+ -2662.4 (-> obj root-override trans y))) (update-transforms! (-> obj root-override)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 510) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "electric-loop") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "electric-loop" :fo-max 40) (-> obj root-override trans)) ) (cond ((task-complete? *game-info* (-> obj entity extra perm task)) @@ -1267,19 +1256,8 @@ (set! (-> obj closed-trans quad) (-> obj open-trans quad)) (set! (-> obj open-trans y) (+ -141312.0 (-> obj open-trans y))) (set! (-> obj open-trans z) (+ 32768.0 (-> obj open-trans z))) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lodge-door-mov") - :volume #x400 - :fo-max 80 - ) - (-> obj open-trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "lodge-door-mov" :fo-max 80) (-> obj open-trans)) ) (ja-channel-push! 1 0) (let ((s5-1 (-> obj skel root-channel 0))) @@ -1580,19 +1558,8 @@ (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *snow-gears-sg* '()) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 515) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "snow-engine") - :volume #x400 - :fo-max #x12c - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "snow-engine" :fo-max 300) (-> obj root trans)) ) (go snow-gears-idle) (none) @@ -1680,7 +1647,7 @@ (local-vars (v1-1 symbol)) (until v1-1 (suspend) - (set! v1-1 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-1 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) (sound-play-by-name (static-sound-name "prec-button1") (new-sound-id) 1024 -1524 0 1 #t) (let ((gp-1 (get-process *default-dead-pool* snowcam #x4000))) diff --git a/goal_src/levels/snow/snow-ram-boss.gc b/goal_src/levels/snow/snow-ram-boss.gc index 4be24ad6e0..bb629eedfe 100644 --- a/goal_src/levels/snow/snow-ram-boss.gc +++ b/goal_src/levels/snow/snow-ram-boss.gc @@ -512,7 +512,7 @@ ) (sound-trans-convert (-> s5-0 parms trans) a1-4) ) - (set! (-> s5-0 parms mask) (the-as uint 32)) + (set! (-> s5-0 parms mask) (sound-mask trans)) (-> s5-0 id) ) (none) @@ -527,7 +527,7 @@ (s4-0 (new 'stack-no-clear 'vector)) (s5-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) ) - (if (logtest? (-> arg0 root-override status) 4) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags tsurf)) (vector-flatten! s3-1 s3-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s3-1 1.0) @@ -618,7 +618,7 @@ ) (defmethod dummy-28 ram-boss-proj ((obj ram-boss-proj)) - (when (and *target* (zero? (logand (-> *target* state-flags) #x80f8))) + (when (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) (let ((gp-0 (-> obj target))) (set! (-> gp-0 quad) (-> (target-pos 0) quad)) (set! (-> gp-0 y) (+ 4915.2 (-> gp-0 y))) @@ -1453,7 +1453,7 @@ #f #f ) - (if (logtest? (-> self collide-info status) 1) + (if (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) (go ram-boss-jump-down-hit-ground) ) (none) @@ -1762,7 +1762,7 @@ ) ) (when (and (= (-> self proj-status) 2) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.2)) ) (let ((gp-2 (new 'stack-no-clear 'vector)) diff --git a/goal_src/levels/sunken/bully.gc b/goal_src/levels/sunken/bully.gc index 5439ecac32..7571180698 100644 --- a/goal_src/levels/sunken/bully.gc +++ b/goal_src/levels/sunken/bully.gc @@ -429,9 +429,10 @@ (defbehavior bully-post bully () (when (and (-> self hit-player?) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> self root-override) 2 (collide-offense normal-attack)) @@ -525,7 +526,7 @@ (set! (-> self travel-speed) 0.0) (shut-down! (-> self neck)) (let ((v1-5 (-> self draw shadow-ctrl))) - (logior! (-> v1-5 settings flags) 32) + (logior! (-> v1-5 settings flags) (shadow-flags shdf05)) ) 0 (none) @@ -533,7 +534,7 @@ :exit (behavior () (let ((v1-1 (-> self draw shadow-ctrl))) - (set! (-> v1-1 settings flags) (logand -33 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf05)) ) 0 (none) @@ -639,7 +640,7 @@ (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) ) ) - (until (logtest? (-> self root-override status) 1) + (until (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (let ((a0-7 (-> self skel root-channel 0))) (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) (set! (-> a0-7 param 1) 1.0) diff --git a/goal_src/levels/sunken/double-lurker.gc b/goal_src/levels/sunken/double-lurker.gc index c2149d8968..82d3abb477 100644 --- a/goal_src/levels/sunken/double-lurker.gc +++ b/goal_src/levels/sunken/double-lurker.gc @@ -327,7 +327,7 @@ (behavior ((arg0 object) (arg1 vector) (arg2 vector)) (dummy-51 self) (let ((v1-3 (-> self draw shadow-ctrl))) - (set! (-> v1-3 settings flags) (logand -33 (-> v1-3 settings flags))) + (logclear! (-> v1-3 settings flags) (shadow-flags shdf05)) ) 0 (logclear! (-> self collide-info nav-flags) (nav-flags navf0)) @@ -546,7 +546,7 @@ ) (transform-post) (let ((v1-13 (-> self draw shadow-ctrl))) - (logior! (-> v1-13 settings flags) 32) + (logior! (-> v1-13 settings flags) (shadow-flags shdf05)) ) 0 (go double-lurker-top-on-shoulders) diff --git a/goal_src/levels/sunken/floating-launcher.gc b/goal_src/levels/sunken/floating-launcher.gc index 80415590e2..b01199409b 100644 --- a/goal_src/levels/sunken/floating-launcher.gc +++ b/goal_src/levels/sunken/floating-launcher.gc @@ -40,7 +40,9 @@ (when (< (vector-xz-length (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> self root-override trans))) 81920.0 ) - (if (and (>= (-> (target-pos 0) y) (-> self trigger-height)) (logtest? (-> *target* control status) 2)) + (if (and (>= (-> (target-pos 0) y) (-> self trigger-height)) + (logtest? (-> *target* control status) (cshape-moving-flags onground)) + ) (go floating-launcher-lowering) ) ) diff --git a/goal_src/levels/sunken/helix-water.gc b/goal_src/levels/sunken/helix-water.gc index 26dfc0ea15..7c609ae8b4 100644 --- a/goal_src/levels/sunken/helix-water.gc +++ b/goal_src/levels/sunken/helix-water.gc @@ -276,7 +276,7 @@ (case arg2 (('touch) (when *target* - (when (logtest? (-> *target* control status) 1) + (when (logtest? (-> *target* control status) (cshape-moving-flags onsurf)) (cond ((and (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete))) (not (handle->process (-> self fcell-handle))) @@ -314,7 +314,7 @@ (send-event a0-1 'pickup) (until v1-7 (suspend) - (set! v1-7 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-7 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) ) ) @@ -699,7 +699,7 @@ (seek! (-> self root scale y) 0.8 (* 0.667 (-> *display* seconds-per-frame))) (when *target* (let ((f0-4 (-> (target-pos 0) y))) - (when (zero? (logand (-> *target* state-flags) 256)) + (when (zero? (logand (-> *target* state-flags) (state-flags sf08))) (let* ((f0-5 (- f0-4 (-> self root trans y))) (f0-6 (+ -40960.0 f0-5)) (f0-7 (* 0.000024414063 f0-6)) diff --git a/goal_src/levels/sunken/orbit-plat.gc b/goal_src/levels/sunken/orbit-plat.gc index 39625b0548..6f2f8d3495 100644 --- a/goal_src/levels/sunken/orbit-plat.gc +++ b/goal_src/levels/sunken/orbit-plat.gc @@ -107,14 +107,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 2.0 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-medium") - :volume #x333 - ) - ) + (sp-sound (static-sound-spec "steam-medium" :num 0.05 :volume 80.0)) (sp-rnd-flt spt-scale-x (meters 0.75) (meters 0.75) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) diff --git a/goal_src/levels/sunken/puffer.gc b/goal_src/levels/sunken/puffer.gc index 5f35c0f04d..434dfcbdaa 100644 --- a/goal_src/levels/sunken/puffer.gc +++ b/goal_src/levels/sunken/puffer.gc @@ -141,9 +141,10 @@ (defbehavior puffer-post puffer () (when (and (-> self hit-player?) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> self root-override) 2 (collide-offense normal-attack)) @@ -179,7 +180,7 @@ 0.0 ) (let ((v1-11 (-> obj draw shadow-ctrl))) - (set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags))) + (logclear! (-> v1-11 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-14 (-> obj draw shadow-ctrl))) @@ -193,7 +194,7 @@ ) (else (let ((v1-19 (-> obj draw shadow-ctrl))) - (logior! (-> v1-19 settings flags) 32) + (logior! (-> v1-19 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -202,7 +203,7 @@ ) (else (let ((v1-21 (-> obj draw shadow-ctrl))) - (logior! (-> v1-21 settings flags) 32) + (logior! (-> v1-21 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -237,7 +238,7 @@ (defmethod dummy-25 puffer ((obj puffer) (arg0 float)) (when *target* (let ((gp-0 (target-pos 0))) - (when (and (zero? (logand (-> *target* state-flags) #x80f8)) + (when (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (dummy-24 obj gp-0) (>= (-> gp-0 y) (+ -14336.0 (-> obj attack-bottom-y))) (>= (+ 2048.0 (-> obj top-y)) (-> gp-0 y)) @@ -579,7 +580,7 @@ (set! (-> self attacking?) #f) (shut-down! (-> self neck)) (let ((v1-5 (-> self draw shadow-ctrl))) - (logior! (-> v1-5 settings flags) 32) + (logior! (-> v1-5 settings flags) (shadow-flags shdf05)) ) 0 (none) diff --git a/goal_src/levels/sunken/qbert-plat.gc b/goal_src/levels/sunken/qbert-plat.gc index 7981872be4..83815f130a 100644 --- a/goal_src/levels/sunken/qbert-plat.gc +++ b/goal_src/levels/sunken/qbert-plat.gc @@ -485,7 +485,7 @@ ) (when (and *target* (not (-> self puzzle-beaten?))) (let ((gp-0 #f)) - (let ((s5-1 (logtest? (-> *target* water flags) 512))) + (let ((s5-1 (logtest? (-> *target* water flags) (water-flags wt09)))) (when s5-1 (when (not (-> self player-in-water?)) (set! gp-0 #t) @@ -500,7 +500,7 @@ ) (set! (-> self player-in-water?) s5-1) ) - (when (logtest? (-> *target* control status) 1) + (when (logtest? (-> *target* control status) (cshape-moving-flags onsurf)) (let ((s5-2 #t)) (let ((s3-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) diff --git a/goal_src/levels/sunken/sun-exit-chamber.gc b/goal_src/levels/sunken/sun-exit-chamber.gc index 5212307a30..9af2244a5b 100644 --- a/goal_src/levels/sunken/sun-exit-chamber.gc +++ b/goal_src/levels/sunken/sun-exit-chamber.gc @@ -600,19 +600,8 @@ (-> s5-1 ppointer) ) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "blue-eco-charg") - :volume #x400 - :fo-max 35 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "blue-eco-charg" :fo-max 35) (-> obj root-override trans)) ) (if (zero? (get-reminder (get-task-control (game-task sunken-room)) 0)) (go blue-eco-charger-idle) @@ -1444,15 +1433,7 @@ (set! (-> obj sound) (new 'process 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "chamber-move") - :volume #x400 - :fo-min #x12c - :fo-max #x190 - ) + (static-sound-spec "chamber-move" :fo-min 300 :fo-max 400) (-> obj root-override trans) ) ) diff --git a/goal_src/levels/sunken/sunken-pipegame.gc b/goal_src/levels/sunken/sunken-pipegame.gc index 4fb587d031..21bd588724 100644 --- a/goal_src/levels/sunken/sunken-pipegame.gc +++ b/goal_src/levels/sunken/sunken-pipegame.gc @@ -764,7 +764,7 @@ ) (until v1-112 (suspend) - (set! v1-112 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-112 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) (set! (-> self state-time) (-> *display* base-frame-counter)) (sleep (-> self ticker) (-> self prize (-> self challenge) puzzle-delay)) @@ -917,7 +917,7 @@ (set! (-> self abort-audio-if-beaten?) #f) (until v1-3 (suspend) - (set! v1-3 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-3 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) (if (not (handle->process (-> self prize (-> self challenge) actor-handle))) (logior! (-> self challenges-mask) (ash 1 (-> self challenge))) diff --git a/goal_src/levels/sunken/sunken-water.gc b/goal_src/levels/sunken/sunken-water.gc index 7de20f3274..0d54cbe782 100644 --- a/goal_src/levels/sunken/sunken-water.gc +++ b/goal_src/levels/sunken/sunken-water.gc @@ -135,7 +135,7 @@ ) (set! (-> self draw color-mult w) 0.5) (if (= f30-0 1.0) - (set! (-> self flags) (logior #x80000 (-> self flags))) + (set! (-> self flags) (logior (water-flags wt19) (-> self flags))) ) ) ) @@ -147,7 +147,7 @@ (update! (-> self sound)) ) (else - (set! (-> self flags) (logand -524289 (-> self flags))) + (logclear! (-> self flags) (water-flags wt19)) (when (!= (-> self deadly-fade) 0.0) (seek! (-> self deadly-fade) 0.0 (* 8.0 (-> *display* seconds-per-frame))) (let ((f30-1 (-> self deadly-fade))) @@ -160,7 +160,7 @@ ) (set! (-> self draw color-mult w) 0.5) (if (= f30-1 0.0) - (set! (-> self flags) (logand -524289 (-> self flags))) + (logclear! (-> self flags) (water-flags wt19)) ) ) ) @@ -180,7 +180,7 @@ ) ) (else - (when (logtest? #x80000 (-> self flags)) + (when (logtest? (water-flags wt19) (-> self flags)) (draw-ripple self) (update! (-> self sound)) (set! (-> self playing-deadly-sound?) #t) @@ -194,7 +194,6 @@ ) (defmethod TODO-RENAME-25 sunken-water ((obj sunken-water)) - (local-vars (v0-3 uint)) (let ((t9-0 (method-of-type water-anim TODO-RENAME-25))) (t9-0 obj) ) @@ -210,7 +209,7 @@ (s5-0 0.5 ) - ((logtest? #x80000 (-> obj flags)) + ((logtest? (water-flags wt19) (-> obj flags)) 1.0 ) (else @@ -222,28 +221,21 @@ (when (and s5-0 (or (= f0-16 0.0) (= f0-16 1.0))) (set! s5-0 #f) (if (= f0-16 0.0) - (set! (-> obj flags) (logior #x80000 (-> obj flags))) - (set! (-> obj flags) (logand -524289 (-> obj flags))) + (set! (-> obj flags) (logior (water-flags wt19) (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt19)) ) ) (set! (-> obj use-sync?) s5-0) (set! (-> obj deadly-time) f0-16) ) - (the-as object (when s5-0 - (cond - ((< (get-current-phase (-> obj sync)) (-> obj deadly-time)) - (set! v0-3 (logior (the-as uint #x80000) (-> obj flags))) - (set! (-> obj flags) v0-3) - ) - (else - (set! v0-3 (logand (the-as uint -524289) (-> obj flags))) - (set! (-> obj flags) v0-3) - ) - ) - v0-3 - ) - ) + (when s5-0 + (if (< (get-current-phase (-> obj sync)) (-> obj deadly-time)) + (set! (-> obj flags) (the-as water-flags (logior (water-flags wt19) (-> obj flags)))) + (set! (-> obj flags) (the-as water-flags (logclear (-> obj flags) (water-flags wt19)))) + ) + ) ) + (none) ) (defmethod TODO-RENAME-22 sunken-water ((obj sunken-water)) @@ -252,7 +244,7 @@ ) (set! (-> obj play-ambient-sound?) #f) (cond - ((logtest? #x80000 (-> obj flags)) + ((logtest? (water-flags wt19) (-> obj flags)) (set! (-> obj draw color-mult quad) (-> obj deadly-color-mult quad)) (set! (-> obj draw color-emissive quad) (-> obj deadly-color-emissive quad)) (set! (-> obj deadly-fade) 1.0) diff --git a/goal_src/levels/sunken/target-tube.gc b/goal_src/levels/sunken/target-tube.gc index a2d65d56c4..9f34caefe8 100644 --- a/goal_src/levels/sunken/target-tube.gc +++ b/goal_src/levels/sunken/target-tube.gc @@ -61,7 +61,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -110,7 +110,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x28 + :flags (surface-flags surf03 surf05) ) ) ) @@ -157,7 +157,7 @@ (defbehavior tube-sounds target () (seek! (-> self tube tube-sound-vol) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) 100.0 0.0 ) @@ -196,7 +196,7 @@ (vector-normalize! s4-1 (-> self control unknown-surface01 target-speed)) ) (vector-v++! (-> self control unknown-vector00) s4-1) - (when (logtest? (-> self control status) 8) + (when (logtest? (-> self control status) (cshape-moving-flags twall)) (let ((s3-0 (-> self tube old-transv))) (-> self control unknown-vector00 y) (vector-reflect! s4-1 s3-0 (-> self control unknown-vector71)) @@ -342,7 +342,7 @@ (set! (-> self tube old-transv quad) (-> self control transv quad)) (flag-setup) (build-conversions (-> self control transv)) - (if (logtest? (-> self state-flags) 32) + (if (logtest? (-> self state-flags) (state-flags sf05)) (set! (-> self control unknown-surface01 turnv) (* 3.0 (-> self control unknown-surface01 turnv))) ) (forward-up-nopitch->quaternion @@ -679,7 +679,7 @@ (behavior ((arg0 float) (arg1 float)) (set! (-> self state-time) (-> *display* base-frame-counter)) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *tube-jump-mods*) (none) ) @@ -687,7 +687,7 @@ (-> target-tube-start exit) :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-tube) ) (mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv)) @@ -773,9 +773,9 @@ :exit (behavior () (if (!= (-> self next-state name) 'target-tube-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) - (set! (-> self state-flags) (logand -901 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf02 sf07 sf08 sf09)) ((-> target-tube-start exit)) (none) ) @@ -783,7 +783,7 @@ (behavior ((arg0 symbol) (arg1 attack-info)) (let ((gp-0 (-> self attack-info))) (set! (-> self state-time) (-> *display* base-frame-counter)) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self game hit-time) (-> *display* base-frame-counter)) (when (zero? (logand (-> arg1 mask) 2)) (vector-! @@ -878,7 +878,7 @@ (-> target-death event) :exit (behavior () - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'process-mask) (copy-settings-from-target! *setting-control*) @@ -905,7 +905,7 @@ (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) (let ((gp-2 (new 'stack-no-clear 'vector))) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! gp-2 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (vector-float*! (-> self control transv) gp-2 (-> *display* frames-per-second)) ) diff --git a/goal_src/levels/sunken/whirlpool.gc b/goal_src/levels/sunken/whirlpool.gc index c3f94805f9..cdd3714538 100644 --- a/goal_src/levels/sunken/whirlpool.gc +++ b/goal_src/levels/sunken/whirlpool.gc @@ -19,7 +19,7 @@ :size-assert #xcc :flag-assert #x15006000cc (:methods - (dummy-20 (_type_ float) uint 20) + (dummy-20 (_type_ float) cshape-moving-flags 20) ) (:states whirlpool-idle @@ -340,7 +340,7 @@ ) (+! (-> self spin-ry) (* f30-0 (-> *display* seconds-per-frame))) (quaternion-axis-angle! (-> self root-override quat) 0.0 1.0 0.0 (-> self spin-ry)) - (if (and *target* (logtest? (-> *target* water flags) 512)) + (if (and *target* (logtest? (-> *target* water flags) (water-flags wt09))) (dummy-20 self f30-0) ) (update! (-> self sound)) @@ -397,19 +397,8 @@ (set! (-> obj spin-speed-delta) (- f28-0 f30-0)) ) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 447) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "whirlpool") - :volume #x400 - :fo-max 55 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "whirlpool" :fo-max 55) (-> obj root-override trans)) ) (ja-channel-set! 1) (let ((s5-1 (-> obj skel root-channel 0))) diff --git a/goal_src/levels/swamp/billy.gc b/goal_src/levels/swamp/billy.gc index b374b4cdc3..5604eb1eda 100644 --- a/goal_src/levels/swamp/billy.gc +++ b/goal_src/levels/swamp/billy.gc @@ -706,7 +706,7 @@ ) (else (process-grab? *target*) - (when (and *target* (logtest? (-> *target* state-flags) 256)) + (when (and *target* (logtest? (-> *target* state-flags) (state-flags sf08))) (let ((gp-0 (get-response (-> self query)))) (cond ((and (= gp-0 'yes) (process-release? *target*)) diff --git a/goal_src/levels/swamp/kermit.gc b/goal_src/levels/swamp/kermit.gc index 5b442879e6..8db89c2a72 100644 --- a/goal_src/levels/swamp/kermit.gc +++ b/goal_src/levels/swamp/kermit.gc @@ -75,14 +75,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1f :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "eco-blue-spark1") - :volume #x2cc - ) - ) + (sp-sound (static-sound-spec "eco-blue-spark1" :num 0.05 :volume 70.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) (sp-int spt-rot-x 4) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) @@ -103,14 +96,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x23 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.075 - :group #x1 - :sound-name (static-sound-name "eco-blue-spark2") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "eco-blue-spark2" :num 0.075 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) (sp-int spt-rot-x 4) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) @@ -131,14 +117,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x24 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "eco-blue-spark3") - :volume #x2cc - ) - ) + (sp-sound (static-sound-spec "eco-blue-spark3" :num 0.05 :volume 70.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) (sp-int spt-rot-x 4) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) diff --git a/goal_src/levels/swamp/swamp-rat.gc b/goal_src/levels/swamp/swamp-rat.gc index c1399cb8f7..5585ad6caa 100644 --- a/goal_src/levels/swamp/swamp-rat.gc +++ b/goal_src/levels/swamp/swamp-rat.gc @@ -77,7 +77,7 @@ swamp-rat-default-event-handler (defmethod common-post swamp-rat ((obj swamp-rat)) - (when (logtest? (-> obj collide-info status) 1) + (when (logtest? (-> obj collide-info status) (cshape-moving-flags onsurf)) (vector-deg-seek (-> obj up-vector) (-> obj up-vector) (-> obj collide-info surface-normal) 910.2222) (vector-normalize! (-> obj up-vector) 1.0) ) @@ -464,7 +464,7 @@ swamp-rat-default-event-handler #f #f ) - (when (or (logtest? (-> self collide-info status) 4) + (when (or (logtest? (-> self collide-info status) (cshape-moving-flags tsurf)) (or (< (-> self collide-info trans y) (-> self min-height)) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1)) ) @@ -603,7 +603,7 @@ swamp-rat-default-event-handler (set! (-> obj reaction-time) (rand-vu-int-range (seconds 0.1) (seconds 0.8))) (set! (-> obj chase-rest-time) (seconds 1)) (set! (-> obj water) (new 'process 'water-control obj 7 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 2)) + (set! (-> obj water flags) (water-flags wt01)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 12288.0) (set! (-> obj min-height) (+ -2048.0 (-> obj water height))) diff --git a/goal_src/levels/training/training-obs.gc b/goal_src/levels/training/training-obs.gc index 4e0db4d37a..ea301d91f3 100644 --- a/goal_src/levels/training/training-obs.gc +++ b/goal_src/levels/training/training-obs.gc @@ -92,8 +92,8 @@ ) (when (!= (-> self index) 6) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -811,19 +811,21 @@ (get-middle-of-bsphere-overlap a0-24 (-> self intersection)) (target-pos 0) ) - (the-as symbol (and ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> arg3 param 0)) - (the-as collide-shape-moving (-> self root-override)) - (the-as uint 2) - ) - (or (= (-> self type) scarecrow-a) - (and (= (-> arg0 type) target) - (logtest? (-> (the-as target arg0) control unknown-surface00 flags) 2048) - (zero? (logand (-> (the-as target arg0) control status) 1)) - ) - ) - ) + (the-as + symbol + (and ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 2) ) + (or (= (-> self type) scarecrow-a) + (and (= (-> arg0 type) target) + (logtest? (-> (the-as target arg0) control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> (the-as target arg0) control status) (cshape-moving-flags onsurf))) + ) + ) + ) + ) ) ) ) diff --git a/goal_src/levels/training/training-part.gc b/goal_src/levels/training/training-part.gc index 4bb664239e..9acd727d00 100644 --- a/goal_src/levels/training/training-part.gc +++ b/goal_src/levels/training/training-part.gc @@ -148,16 +148,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x19 :page #x2)) (sp-flt spt-num 0.2) - (sp-sound (new 'static 'sound-spec - :mask #xc0 - :num 0.1 - :group #x1 - :sound-name (static-sound-name "geyser") - :volume #x400 - :fo-min 50 - :fo-max #xc8 - ) - ) + (sp-sound (static-sound-spec "geyser" :num 0.1 :fo-min 50 :fo-max 200)) (sp-rnd-flt spt-x (meters 0) (meters 1) 1.0) (sp-flt spt-y (meters -8)) (sp-flt spt-scale-x (meters 8)) diff --git a/goal_src/levels/village1/assistant.gc b/goal_src/levels/village1/assistant.gc index 8d0e6e9996..a5bf229b47 100644 --- a/goal_src/levels/village1/assistant.gc +++ b/goal_src/levels/village1/assistant.gc @@ -39,7 +39,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -48,16 +48,19 @@ (defmethod draw-npc-shadow assistant ((obj assistant)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/village1/explorer.gc b/goal_src/levels/village1/explorer.gc index 3248780803..d046128c86 100644 --- a/goal_src/levels/village1/explorer.gc +++ b/goal_src/levels/village1/explorer.gc @@ -38,7 +38,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -47,16 +47,19 @@ (defmethod draw-npc-shadow explorer ((obj explorer)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/village1/fishermans-boat.gc b/goal_src/levels/village1/fishermans-boat.gc index a93be42b86..6439039627 100644 --- a/goal_src/levels/village1/fishermans-boat.gc +++ b/goal_src/levels/village1/fishermans-boat.gc @@ -1555,7 +1555,7 @@ (send-event *target* 'end-mode) (update-transforms! (-> self root-overlay)) (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) - (logior! (-> *target* control status) 7) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) (suspend) (send-event *camera* 'teleport-to-other-start-string) ) @@ -1731,7 +1731,7 @@ (send-event *target* 'end-mode) (update-transforms! (-> self root-overlay)) (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) - (logior! (-> *target* control status) 7) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) (suspend) (send-event *camera* 'teleport-to-other-start-string) ) diff --git a/goal_src/levels/village1/village1-part.gc b/goal_src/levels/village1/village1-part.gc index 06bf2f8434..8c4fe2e066 100644 --- a/goal_src/levels/village1/village1-part.gc +++ b/goal_src/levels/village1/village1-part.gc @@ -639,14 +639,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x4 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "fire-pop") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "fire-pop" :volume 100.0)) (sp-rnd-flt spt-x (meters -0.6) (meters 1.3) 1.0) (sp-rnd-flt spt-y (meters 1) (meters 0.5) 1.0) (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) diff --git a/goal_src/levels/village1/village1-part2.gc b/goal_src/levels/village1/village1-part2.gc index 62d41f2b83..37eb63b597 100644 --- a/goal_src/levels/village1/village1-part2.gc +++ b/goal_src/levels/village1/village1-part2.gc @@ -1540,14 +1540,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) (sp-rnd-flt spt-num 2.0 6.0 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "drip-on-wood") - :volume #x200 - ) - ) + (sp-sound (static-sound-spec "drip-on-wood" :volume 50.0)) (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.075) 1.0) (sp-copy-from-other spt-scale-y -4) (sp-rnd-flt spt-g 96.0 128.0 1.0) diff --git a/goal_src/levels/village1/yakow.gc b/goal_src/levels/village1/yakow.gc index b88dd1d3a4..af789f2020 100644 --- a/goal_src/levels/village1/yakow.gc +++ b/goal_src/levels/village1/yakow.gc @@ -993,7 +993,7 @@ yakow-default-event-handler ) (set! (-> obj link) (new 'process 'actor-link-info obj)) (set! (-> obj water) (new 'process 'water-control obj 6 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 2)) + (set! (-> obj water flags) (water-flags wt01)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 12288.0) (set! (-> obj home-base quad) (-> obj root-override trans quad)) diff --git a/goal_src/levels/village2/assistant-village2.gc b/goal_src/levels/village2/assistant-village2.gc index 621708813e..9490db7c74 100644 --- a/goal_src/levels/village2/assistant-village2.gc +++ b/goal_src/levels/village2/assistant-village2.gc @@ -72,7 +72,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -81,16 +81,19 @@ (defmethod draw-npc-shadow assistant-levitator ((obj assistant-levitator)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -1847,19 +1850,8 @@ (set! (-> obj particle 1) (create-launch-control (-> *part-group-id-table* 659) obj)) (set! (-> obj particle 2) (create-launch-control (-> *part-group-id-table* 660) obj)) (set! (-> obj particle 3) (create-launch-control (-> *part-group-id-table* 661) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lev-mach-idle") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "lev-mach-idle" :fo-max 30) (-> obj root-override trans)) ) (if (= (get-task-status (game-task village2-levitator)) (task-status invalid)) (go just-particles) diff --git a/goal_src/levels/village2/village2-obs.gc b/goal_src/levels/village2/village2-obs.gc index 0564b3b95e..bf7604dfe1 100644 --- a/goal_src/levels/village2/village2-obs.gc +++ b/goal_src/levels/village2/village2-obs.gc @@ -943,19 +943,8 @@ (cond ((name= (-> obj name) "fireboulder-6") (quaternion-axis-angle! (-> obj root-override quat) 0.0 1.0 0.0 16384.0) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "rock-hover") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "rock-hover" :fo-max 30) (-> obj root-override trans)) ) ) (else diff --git a/goal_src/levels/village2/village2-part.gc b/goal_src/levels/village2/village2-part.gc index 8a5e30e16b..c0ba8cfaa0 100644 --- a/goal_src/levels/village2/village2-part.gc +++ b/goal_src/levels/village2/village2-part.gc @@ -1629,9 +1629,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 4.0 16.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-flt spt-x (meters 0.9)) (sp-flt spt-y (meters 0.05)) (sp-flt spt-z (meters -0.9)) @@ -1660,9 +1658,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 4.0 16.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-flt spt-x (meters -1.2)) (sp-flt spt-y (meters -0.5)) (sp-flt spt-z (meters 1.2)) @@ -1879,9 +1875,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 2.0 8.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) (sp-copy-from-other spt-scale-y -4) (sp-rnd-flt spt-r 128.0 128.0 1.0) @@ -1907,9 +1901,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 2.0 6.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) (sp-copy-from-other spt-scale-y -4) (sp-rnd-flt spt-r 128.0 128.0 1.0) diff --git a/goal_src/levels/village2/warrior.gc b/goal_src/levels/village2/warrior.gc index 8f4520f2db..73e63ae81b 100644 --- a/goal_src/levels/village2/warrior.gc +++ b/goal_src/levels/village2/warrior.gc @@ -44,16 +44,19 @@ (defmethod draw-npc-shadow warrior ((obj warrior)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/village3/assistant-village3.gc b/goal_src/levels/village3/assistant-village3.gc index ca9196027a..2889d62991 100644 --- a/goal_src/levels/village3/assistant-village3.gc +++ b/goal_src/levels/village3/assistant-village3.gc @@ -44,16 +44,19 @@ (defmethod draw-npc-shadow assistant-villagec ((obj assistant-villagec)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/village3/minecart.gc b/goal_src/levels/village3/minecart.gc index 858de9181a..ec1a94602a 100644 --- a/goal_src/levels/village3/minecart.gc +++ b/goal_src/levels/village3/minecart.gc @@ -114,19 +114,8 @@ (set! (-> self draw origin-joint-index) (the-as uint 3)) (logior! (-> self skel status) (janim-status inited)) (load-params! (-> self sync) self (the-as uint 9000) arg1 0.15 0.15) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "v3-cartride") - :volume #x400 - :fo-max 30 - ) - (-> self root-override trans) - ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "v3-cartride" :fo-max 30) (-> self root-override trans)) ) (set! (-> self index) (res-lump-value arg0 'index int)) (let ((v1-33 (-> self index))) diff --git a/goal_src/levels/village3/miners.gc b/goal_src/levels/village3/miners.gc index 7dad001dbb..c2fc2a910e 100644 --- a/goal_src/levels/village3/miners.gc +++ b/goal_src/levels/village3/miners.gc @@ -65,7 +65,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -74,16 +74,19 @@ (defmethod draw-npc-shadow minertall ((obj minertall)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -246,7 +249,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -255,16 +258,19 @@ (defmethod draw-npc-shadow minershort ((obj minershort)) (-> obj draw shadow-ctrl) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/goal_src/levels/village3/sage-village3.gc b/goal_src/levels/village3/sage-village3.gc index 8569c03c42..9a120dbc2e 100644 --- a/goal_src/levels/village3/sage-village3.gc +++ b/goal_src/levels/village3/sage-village3.gc @@ -319,18 +319,21 @@ (defmethod draw-npc-shadow sage-villagec ((obj sage-villagec)) (let ((v1-1 (-> obj draw shadow-ctrl))) (cond - ((and (-> obj draw shadow) (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn))) - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) - (set! (-> v1-1 settings flags) (logand -5 (-> v1-1 settings flags))) + ((and (-> obj draw shadow) + (zero? (-> obj draw cur-lod)) + (logtest? (-> obj draw status) (draw-status was-drawn)) + ) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02)) (set! (-> v1-1 settings bot-plane w) 20480.0) (let ((a0-8 v1-1)) - (set! (-> a0-8 settings flags) (logand -33 (-> a0-8 settings flags))) + (logclear! (-> a0-8 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day v1-1) ) (else - (logior! (-> v1-1 settings flags) 32) + (logior! (-> v1-1 settings flags) (shadow-flags shdf05)) 0 ) ) diff --git a/goal_src/levels/village3/village3-obs.gc b/goal_src/levels/village3/village3-obs.gc index 7ba2b6c9ff..e96f6468da 100644 --- a/goal_src/levels/village3/village3-obs.gc +++ b/goal_src/levels/village3/village3-obs.gc @@ -70,8 +70,8 @@ (set! (-> v1-2 global-scale) 3072.0) (set! (-> v1-2 waveform) ripple-for-villagec-lava) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x2000000 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt25) (-> obj flags))) (set! (-> obj attack-event) 'lava) (none) ) @@ -221,8 +221,8 @@ ) ) (when (and (< (vector-vector-xz-distance s5-1 (-> *target* control trans)) 18432.0) - (and (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (and (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) (and (< (+ -40960.0 (-> s5-1 y)) (-> *target* control trans y)) @@ -305,7 +305,7 @@ (send-event *target* 'end-mode) (update-transforms! (-> self root-override)) (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) - (logior! (-> *target* control status) 7) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) (suspend) (send-event *camera* 'teleport-to-other-start-string) ) @@ -364,7 +364,7 @@ (send-event *target* 'end-mode) (update-transforms! (-> self root-override)) (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) - (logior! (-> *target* control status) 7) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) (suspend) (send-event *camera* 'teleport-to-other-start-string) ) diff --git a/goal_src/levels/village3/village3-part.gc b/goal_src/levels/village3/village3-part.gc index 6229b34c47..a4b9f22c54 100644 --- a/goal_src/levels/village3/village3-part.gc +++ b/goal_src/levels/village3/village3-part.gc @@ -620,14 +620,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x4 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "fire-pop") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "fire-pop" :volume 100.0)) (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) (sp-rnd-flt spt-y (meters 0.5) (meters 0.5) 1.0) (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) @@ -1343,9 +1336,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1372,9 +1363,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1401,9 +1390,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1430,9 +1417,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1459,9 +1444,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1548,9 +1531,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-y (meters 0.7)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) @@ -2106,9 +2087,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.0) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.3)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -2147,9 +2126,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 4.0 4.0 1.0) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-x (meters 1.5)) (sp-flt spt-y (meters 0.6)) (sp-flt spt-scale-x (meters 1)) diff --git a/goal_src/levels/village_common/oracle.gc b/goal_src/levels/village_common/oracle.gc index 2ca653a7ad..dab15d9dad 100644 --- a/goal_src/levels/village_common/oracle.gc +++ b/goal_src/levels/village_common/oracle.gc @@ -243,19 +243,8 @@ (defmethod init-from-entity! oracle ((obj oracle) (arg0 entity-actor)) (dummy-40 obj arg0 *oracle-sg* 3 4 (new 'static 'vector :y -4096.0 :w 4096.0) -1) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "oracle-sleep") - :volume #x400 - :fo-max 50 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "oracle-sleep" :fo-max 50) (-> obj root-override trans)) ) (set! (-> obj first-task) (the-as uint (-> arg0 extra perm task))) (set! (-> obj second-task) (res-lump-value arg0 'alt-task uint)) diff --git a/goal_src/levels/village_common/villagep-obs.gc b/goal_src/levels/village_common/villagep-obs.gc index f8c0766e6b..96df5e5840 100644 --- a/goal_src/levels/village_common/villagep-obs.gc +++ b/goal_src/levels/village_common/villagep-obs.gc @@ -32,7 +32,7 @@ (- (-> self control unknown-vector103 z) (-> self control unknown-vector102 z)) ) (vector-xz-normalize! (-> self control transv) 49152.0) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground #f) ) (none) @@ -134,9 +134,8 @@ (and (>= (-> self level-slot) 0) (not (movie?)) (not (level-hint-displayed?)) - (zero? - (logand (-> *target* control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) - ) + (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) + ) (let* ((v1-16 (-> self root)) (a1-2 (-> *target* control trans)) (f0-1 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) a1-2 (-> v1-16 trans)))) @@ -1007,8 +1006,8 @@ ) ) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -1020,7 +1019,7 @@ (-> *setting-control* current hint) (-> *setting-control* current ambient) (not *target*) - (logtest? (-> *target* state-flags) #x8008) + (logtest? (-> *target* state-flags) (state-flags sf03 sf15)) ) ) ) @@ -1038,7 +1037,7 @@ (-> *setting-control* current hint) (!= (-> *level* loading-level) (-> *level* level-default)) (not *target*) - (logtest? (-> *target* state-flags) #x8008) + (logtest? (-> *target* state-flags) (state-flags sf03 sf15)) *progress-process* ) (suspend) diff --git a/test/decompiler/reference/decompiler-macros.gc b/test/decompiler/reference/decompiler-macros.gc index b4540efc46..632f8d84a7 100644 --- a/test/decompiler/reference/decompiler-macros.gc +++ b/test/decompiler/reference/decompiler-macros.gc @@ -936,3 +936,37 @@ "Macro to use seekl in-place. place is the base, and where the result is stored." `(set! ,place (seekl ,place ,target ,rate)) ) + +;; gsound-h +(defmacro sound-vol (vol) + "convert to sound volume units" + (if (number? vol) + (* 1 (/ (* vol 1024) 100)) + `(the int (/ (* ,vol 1024) 100)) + ) + ) + +(defmacro static-sound-spec (name &key (num 1.0) &key (group 1) + &key (volume #f) + &key (pitch-mod 0) + &key (fo-min 0) &key (fo-max 0) + &key (mask ())) + (let ((snd-mask mask) + (snd-volume 100.0)) + (when (nonzero? fo-max) (cons! snd-mask 'fo-max)) + (when (nonzero? fo-min) (cons! snd-mask 'fo-min)) + (when (nonzero? pitch-mod) (cons! snd-mask 'pitch)) + (when volume (cons! snd-mask 'volume) (set! snd-volume volume)) + `(new 'static 'sound-spec + :sound-name (static-sound-name ,name) + :num ,num + :group ,group + :volume (sound-vol ,snd-volume) + :pitch-mod ,pitch-mod + :fo-min ,fo-min + :fo-max ,fo-max + :mask (sound-mask ,@snd-mask) + )) + ) + + diff --git a/test/decompiler/reference/engine/ambient/ambient_REF.gc b/test/decompiler/reference/engine/ambient/ambient_REF.gc index 112bc03f17..ffac6afe40 100644 --- a/test/decompiler/reference/engine/ambient/ambient_REF.gc +++ b/test/decompiler/reference/engine/ambient/ambient_REF.gc @@ -231,7 +231,7 @@ ) (and *target* (!= (-> *target* next-state name) 'target-look-around) - (zero? (logand (-> *target* state-flags) #x8008)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf15))) (= *master-mode* 'game) ) ) @@ -778,9 +778,9 @@ (set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0))) (let ((s4-2 (new 'stack 'sound-spec))) (set! (-> s4-2 sound-name) (string->sound-name sv-16)) - (logior! (-> s4-2 mask) 1) + (logior! (-> s4-2 mask) (sound-mask volume)) (set! (-> s4-2 volume) 1024) - (logior! (-> s4-2 mask) 4) + (logior! (-> s4-2 mask) (sound-mask bend)) (set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) (set! sv-112 (new 'static 'res-tag)) (let ((a1-7 ((method-of-type res-lump get-property-data) @@ -833,7 +833,7 @@ (s4-0 (new 'stack 'sound-spec)) ) (set! (-> s4-0 sound-name) (string->sound-name s2-0)) - (logior! (-> s4-0 mask) 1) + (logior! (-> s4-0 mask) (sound-mask volume)) (set! (-> s4-0 volume) 1024) (when (the-as (pointer res-tag) s3-0) (let ((t9-2 effect-param->sound-spec) diff --git a/test/decompiler/reference/engine/ambient/mood_REF.gc b/test/decompiler/reference/engine/ambient/mood_REF.gc index c0211556f7..40c956e0cd 100644 --- a/test/decompiler/reference/engine/ambient/mood_REF.gc +++ b/test/decompiler/reference/engine/ambient/mood_REF.gc @@ -865,7 +865,7 @@ ) (sound-trans-convert (-> gp-3 parms trans) a1-23) ) - (set! (-> gp-3 parms mask) (the-as uint 32)) + (set! (-> gp-3 parms mask) (sound-mask trans)) (-> gp-3 id) ) (let ((gp-4 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -882,7 +882,7 @@ ) (sound-trans-convert (-> gp-4 parms trans) a1-25) ) - (set! (-> gp-4 parms mask) (the-as uint 32)) + (set! (-> gp-4 parms mask) (sound-mask trans)) (-> gp-4 id) ) (let ((gp-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) @@ -899,7 +899,7 @@ ) (sound-trans-convert (-> gp-5 parms trans) a1-27) ) - (set! (-> gp-5 parms mask) (the-as uint 32)) + (set! (-> gp-5 parms mask) (sound-mask trans)) (-> gp-5 id) ) ) diff --git a/test/decompiler/reference/engine/anim/aligner-h_REF.gc b/test/decompiler/reference/engine/anim/aligner-h_REF.gc index df36ac7e5e..c35a24ad17 100644 --- a/test/decompiler/reference/engine/anim/aligner-h_REF.gc +++ b/test/decompiler/reference/engine/anim/aligner-h_REF.gc @@ -3,7 +3,7 @@ ;; definition of type align-control (deftype align-control (basic) - ((flags uint32 :offset-assert 4) + ((flags align-flags :offset-assert 4) (process process-drawable :offset-assert 8) (frame-group art-joint-anim :offset-assert 12) (frame-num float :offset-assert 16) diff --git a/test/decompiler/reference/engine/anim/aligner_REF.gc b/test/decompiler/reference/engine/anim/aligner_REF.gc index 3f53aca505..ce487a0ac5 100644 --- a/test/decompiler/reference/engine/anim/aligner_REF.gc +++ b/test/decompiler/reference/engine/anim/aligner_REF.gc @@ -54,8 +54,8 @@ ) ) (if a0-9 - (logior! (-> obj flags) 1) - (set! (-> obj flags) (logand -2 (-> obj flags))) + (logior! (-> obj flags) (align-flags algf00)) + (logclear! (-> obj flags) (align-flags algf00)) ) (set! (-> obj frame-group) v1-16) (set! (-> obj frame-num) f0-0) @@ -129,7 +129,7 @@ ;; definition for method 10 of type align-control (defmethod TODO-RENAME-10 align-control ((obj align-control) (arg0 int) (arg1 float) (arg2 float) (arg3 float)) - (when (zero? (logand (-> obj flags) 1)) + (when (zero? (logand (-> obj flags) (align-flags algf00))) (let* ((a0-1 (-> obj process)) (t9-0 (method-of-object a0-1 apply-alignment)) (v1-4 (-> obj delta)) @@ -162,7 +162,7 @@ ;; definition for method 11 of type align-control ;; INFO: Return type mismatch trsqv vs none. (defmethod TODO-RENAME-11 align-control ((obj align-control) (arg0 int) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) - (when (zero? (logand (-> obj flags) 1)) + (when (zero? (logand (-> obj flags) (align-flags algf00))) (let ((s5-0 (-> obj delta))) (let ((s3-0 (-> obj process root transv))) (if (logtest? arg0 2) diff --git a/test/decompiler/reference/engine/camera/cam-master_REF.gc b/test/decompiler/reference/engine/camera/cam-master_REF.gc index 33ca6c3939..4d8a0d1730 100644 --- a/test/decompiler/reference/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/engine/camera/cam-master_REF.gc @@ -74,10 +74,11 @@ (set! (-> self foot-offset) (-> *CAMERA_MASTER-bank* onscreen-foot-height)) (set! (-> self head-offset) (-> *CAMERA_MASTER-bank* onscreen-head-height)) (set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height)) - (set! (-> self on-ground) (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) + (set! (-> self on-ground) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) ) (set! (-> self on-pole) #f) (set! (-> self ease-t) 1.0) @@ -108,7 +109,9 @@ ) ) (cond - ((and (logtest? (-> *target* water flags) 4096) (zero? (logand (-> *target* water flags) 16))) + ((and (logtest? (-> *target* water flags) (water-flags wt12)) + (zero? (logand (-> *target* water flags) (water-flags wt04))) + ) (set! (-> self under-water) 2) ) (else @@ -339,7 +342,9 @@ ) ) (cond - ((and (logtest? (-> *target* water flags) 4096) (zero? (logand (-> *target* water flags) 16))) + ((and (logtest? (-> *target* water flags) (water-flags wt12)) + (zero? (logand (-> *target* water flags) (water-flags wt04))) + ) (set! (-> self under-water) 2) ) ((> (-> self under-water) 0) @@ -389,17 +394,18 @@ (vector--float*! s5-2 (-> self tpos-curr) (-> self local-down) (-> self target-height)) (vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2) (vector-! s5-2 s5-2 gp-5) - (let ((f0-20 (fill-and-probe-using-line-sphere - *collide-cache* - s5-2 - gp-5 - 4300.8 - (collide-kind background) - (the-as process #f) - s4-2 - 4098 - ) - ) + (let ((f0-20 + (fill-and-probe-using-line-sphere + *collide-cache* + s5-2 + gp-5 + 4300.8 + (collide-kind background) + (the-as process #f) + s4-2 + 4098 + ) + ) ) (if (and (< 0.0 f0-20) (< f0-20 1.0)) (vector+float*! (-> self tpos-curr) (-> self tpos-curr) gp-5 (+ -1.0 f0-20)) @@ -407,16 +413,17 @@ ) ) ) - (set! (-> self on-ground) (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) + (set! (-> self on-ground) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) ) (let ((gp-6 (new-stack-vector0))) 0.0 (cond - ((and (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + ((and (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (!= (-> *target* control unknown-surface00 name) 'launch-jump) ) @@ -462,7 +469,7 @@ (vector-! gp-6 (-> self tpos-curr) (-> self tpos-old)) (let ((f0-38 (vector-dot gp-6 (-> self local-down)))) (cond - ((logtest? (-> *target* water flags) 512) + ((logtest? (-> *target* water flags) (water-flags wt09)) (set! (-> self upspeed) 0.0) ) ((< 0.0 f0-38) @@ -491,7 +498,7 @@ (reset-follow) ) (let ((v1-196 (-> *target* water flags))) - (when (and (logtest? v1-196 512) (logtest? v1-196 6144)) + (when (and (logtest? v1-196 (water-flags wt09)) (logtest? v1-196 (water-flags wt11 wt12))) (let ((f0-45 (- (-> *target* water base-height) (-> self target-height)))) (if (< (-> self tpos-curr-adj y) f0-45) (set! (-> self tpos-curr-adj y) f0-45) diff --git a/test/decompiler/reference/engine/camera/cam-states_REF.gc b/test/decompiler/reference/engine/camera/cam-states_REF.gc index 59f9336524..19b8712a91 100644 --- a/test/decompiler/reference/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/engine/camera/cam-states_REF.gc @@ -473,7 +473,10 @@ ) :exit (behavior () - (if (and *target* (logtest? (-> *camera* master-options) 2) (logtest? (-> *target* state-flags) 512)) + (if (and *target* + (logtest? (-> *camera* master-options) 2) + (logtest? (-> *target* state-flags) (state-flags sf09)) + ) (send-event *target* 'end-mode) ) (none) diff --git a/test/decompiler/reference/engine/collide/collide-edge-grab_REF.gc b/test/decompiler/reference/engine/collide/collide-edge-grab_REF.gc new file mode 100644 index 0000000000..e343014076 --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-edge-grab_REF.gc @@ -0,0 +1,810 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 20 of type target +;; INFO: Return type mismatch int vs object. +;; Used lq/sq +(defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (let ((gp-0 *collide-edge-work*)) + (set! (-> gp-0 num-verts) (the-as uint 0)) + (set! (-> gp-0 num-edges) (the-as uint 0)) + (set! (-> gp-0 num-tris) (the-as uint 0)) + (let ((v1-0 (-> obj control))) + (set! (-> gp-0 ccache) arg0) + (.lvf vf1 (&-> gp-0 local-cache-fill-box min quad)) + (.lvf vf2 (&-> gp-0 local-cache-fill-box max quad)) + (set! (-> gp-0 cshape) v1-0) + (.lvf vf3 (&-> v1-0 trans quad)) + ) + (.add.vf vf1 vf1 vf3 :mask #b111) + (.add.vf vf2 vf2 vf3 :mask #b111) + (.svf (&-> gp-0 cache-fill-box min quad) vf1) + (.svf (&-> gp-0 cache-fill-box max quad) vf2) + (.lvf vf4 (&-> gp-0 local-within-reach-box min quad)) + (.lvf vf5 (&-> gp-0 local-within-reach-box max quad)) + (.add.vf vf4 vf4 vf3 :mask #b111) + (.add.vf vf5 vf5 vf3 :mask #b111) + (.ftoi.vf vf6 vf4) + (.ftoi.vf vf7 vf5) + (.svf (&-> gp-0 within-reach-box min quad) vf4) + (.svf (&-> gp-0 within-reach-box max quad) vf5) + (.svf (&-> gp-0 within-reach-box4w min quad) vf6) + (.svf (&-> gp-0 within-reach-box4w max quad) vf7) + (fill-using-bounding-box + arg0 + (-> gp-0 cache-fill-box) + (-> obj control root-prim collide-with) + obj + (new 'static 'pat-surface :noentity #x1) + ) + (find-grabbable-tris! gp-0) + (when (nonzero? (-> gp-0 num-tris)) + (find-grabbable-edges! gp-0) + (when (nonzero? (-> gp-0 num-edges)) + (set! (-> gp-0 search-pt quad) (-> *target* control unknown-vector90 quad)) + (when (!= (-> *cpad-list* cpads (-> *target* control unknown-cpad-info00 number) stick0-speed) 0.0) + (set! (-> gp-0 search-dir-vec quad) (-> *target* control unknown-vector20 quad)) + (search-for-edges gp-0 (-> gp-0 hold-list)) + (when (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*) + (send-event *target* 'edge-grab) + (return (the-as object #f)) + ) + ) + (vector-z-quaternion! (-> gp-0 search-dir-vec) (-> *target* control unknown-quaternion00)) + (search-for-edges gp-0 (-> gp-0 hold-list)) + (if (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*) + (send-event *target* 'edge-grab) + ) + 0 + ) + ) + ) + 0 + ) + ) + +;; definition for method 9 of type collide-edge-work +(defmethod search-for-edges collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-list)) + (set! (-> arg0 num-allocs) (the-as uint 0)) + (set! (-> arg0 num-attempts) (the-as uint 0)) + (set! (-> arg0 head) #f) + (let ((s4-0 (the-as collide-edge-hold-item (-> arg0 items))) + (s3-0 (the-as collide-edge-edge (-> obj edges))) + ) + (countdown (s2-0 (-> obj num-edges)) + (when (not (-> s3-0 ignore)) + (compute-center-point! obj s3-0 (-> s4-0 center-pt)) + (when (should-add-to-list? obj s4-0 s3-0) + (add-to-list! arg0 s4-0) + (+! (-> arg0 num-allocs) 1) + (when (= (-> arg0 num-allocs) 32) + (format 0 "ERROR: Reached limit of edge grab hold items!~%") + (return #f) + ) + (&+! s4-0 48) + ) + ) + (&+! s3-0 48) + ) + ) + #f + ) + +;; definition for method 10 of type collide-edge-hold-list +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition of type pbhp-stack-vars +(deftype pbhp-stack-vars (structure) + ((edge collide-edge-edge :offset-assert 0) + (allocated basic :offset-assert 4) + (neg-hold-pt vector :inline :offset-assert 16) + (split-vec vector :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +;; definition for method 3 of type pbhp-stack-vars +(defmethod inspect pbhp-stack-vars ((obj pbhp-stack-vars)) + (format #t "[~8x] ~A~%" obj 'pbhp-stack-vars) + (format #t "~Tedge: #~%" (-> obj edge)) + (format #t "~Tallocated: ~A~%" (-> obj allocated)) + (format #t "~Tneg-hold-pt: #~%" (-> obj neg-hold-pt)) + (format #t "~Tsplit-vec: #~%" (-> obj split-vec)) + obj + ) + +;; definition for method 18 of type collide-edge-work +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for method 19 of type collide-edge-work +;; Used lq/sq +(defmethod check-grab-for-collisions collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info)) + (local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector)) + (let* ((s3-0 (-> arg0 edge)) + (s1-0 (-> s3-0 etri ctri)) + (s4-0 (-> s1-0 prim-index)) + ) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (vector+*! s0-0 (-> arg0 center-pt) (-> s3-0 edge-vec-norm) 1105.92) + (let ((f0-0 (dummy-14 obj (-> arg1 right-hand-hold) s0-0 (the-as int s4-0)))) + (if (< 491.52 f0-0) + (return #f) + ) + ) + (set! sv-144 vector+*!) + (set! sv-160 s0-0) + (set! sv-176 (-> arg0 center-pt)) + (let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm))) + (a3-2 1105.92) + ) + (sv-144 sv-160 sv-176 a2-3 a3-2) + ) + (let ((f0-1 (dummy-14 obj (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) + (if (< 491.52 f0-1) + (return #f) + ) + ) + ) + (set! (-> arg1 tri-vertex 0 quad) (-> s1-0 vertex 0 quad)) + (set! (-> arg1 world-vertex 4 quad) (-> s1-0 vertex 1 quad)) + (set! (-> arg1 world-vertex 5 quad) (-> s1-0 vertex 2 quad)) + (set! (-> arg1 edge-tri-pat) (the-as uint (-> s1-0 pat))) + (set! (-> arg1 center-hold quad) (-> arg0 center-pt quad)) + (set! (-> arg1 world-vertex 0 quad) (-> s3-0 vertex-ptr 0 0 quad)) + (set! (-> arg1 world-vertex 1 quad) (-> s3-0 vertex-ptr 1 0 quad)) + (set! (-> arg1 hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad)) + (vector-normalize! + (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex))) + 1.0 + ) + (vector-normalize! + (vector-cross! + (the-as vector (-> arg1 hanging-matrix)) + (-> arg1 hanging-matrix vector 2) + (-> arg1 hanging-matrix vector 1) + ) + 1.0 + ) + (vector-cross! + (-> arg1 hanging-matrix vector 2) + (the-as vector (-> arg1 hanging-matrix)) + (-> arg1 hanging-matrix vector 1) + ) + (set! (-> arg1 hanging-matrix vector 3 quad) (-> arg1 center-hold quad)) + (transform-vectors! (-> arg1 hanging-matrix) (-> obj world-player-spheres) (-> obj local-player-spheres) 12) + (let ((a1-13 (new 'stack-no-clear 'collide-using-spheres-params))) + (set! (-> a1-13 spheres) (-> obj world-player-spheres)) + (set! (-> a1-13 num-spheres) (the-as uint 12)) + (set! (-> a1-13 collide-with) (-> obj cshape root-prim collide-with)) + (set! (-> a1-13 proc) #f) + (set! (-> a1-13 ignore-pat) (the-as uint 1)) + (set! (-> a1-13 solid-only) #t) + (if (probe-using-spheres (-> obj ccache) a1-13) + (return #f) + ) + ) + (let* ((v1-36 (the-as object (-> obj ccache prims s4-0 prim))) + (a0-35 (-> (the-as collide-shape-prim v1-36) cshape)) + ) + (cond + (a0-35 + (set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as uint (the-as int (-> a0-35 process))))) + (set! (-> arg1 actor-handle) (process->handle (-> a0-35 process))) + (let ((a1-19 + (-> a0-35 process node-list data (-> (the-as collide-shape-prim v1-36) transform-index) bone transform) + ) + (s5-1 (new 'stack-no-clear 'matrix)) + ) + (matrix-4x4-inverse! s5-1 a1-19) + (dotimes (s4-1 6) + (vector-matrix*! (-> arg1 local-vertex s4-1) (-> arg1 world-vertex s4-1) s5-1) + ) + ) + ) + (else + (set! (-> arg1 actor-cshape-prim-offset) 0) + (set! (-> arg1 actor-handle) (the-as handle #f)) + ) + ) + ) + ) + #t + ) + +;; definition for method 9 of type edge-grab-info +;; Used lq/sq +(defmethod dummy-9 edge-grab-info ((obj edge-grab-info)) + (local-vars (v0-0 symbol) (v1-14 float)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (the-as object #f))) + (set! (-> obj center-hold-old quad) (-> obj center-hold quad)) + (let ((v1-1 (-> obj actor-cshape-prim-offset))) + (when (nonzero? v1-1) + (let ((a0-5 (handle->process (-> obj actor-handle)))) + (if (not (the-as process a0-5)) + (return #f) + ) + (set! s5-0 (+ (the-as int a0-5) v1-1)) + (if (zero? (-> (the-as collide-shape-prim s5-0) prim-core collide-as)) + (return #f) + ) + (let ((s4-0 + (-> (the-as process-drawable a0-5) + node-list + data + (-> (the-as collide-shape-prim s5-0) transform-index) + bone + transform + ) + ) + ) + (dotimes (s3-0 6) + (vector-matrix*! (-> obj world-vertex s3-0) (-> obj local-vertex s3-0) s4-0) + ) + ) + ) + (.lvf vf1 (&-> obj world-vertex 3 quad)) + (.lvf vf2 (&-> obj world-vertex 4 quad)) + (.lvf vf3 (&-> obj world-vertex 5 quad)) + (.sub.vf vf4 vf2 vf1) + (.sub.vf vf5 vf3 vf1) + (.outer.product.a.vf acc vf4 vf5) + (.outer.product.b.vf vf6 vf5 vf4 acc) + (.mul.vf vf7 vf6 vf6) + (.mul.x.vf acc vf0 vf7 :mask #b1000) + (.add.mul.y.vf acc vf0 vf7 acc :mask #b1000) + (.add.mul.z.vf vf7 vf0 vf7 acc :mask #b1000) + (.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b11) + (let ((f1-0 0.707)) + (.wait.vf) + (nop!) + (.mul.vf vf6 vf6 Q :mask #b111) + (.mov v1-14 vf6) + (b! (>= (the-as float (gpr->fpr (sar (the-as int v1-14) 32))) f1-0) cfg-17) + ) + (set! v0-0 #f) + (b! #t cfg-27 :delay (nop!)) + (label cfg-17) + (set! (-> obj hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad)) + (vector-normalize! + (vector-! (-> obj hanging-matrix vector 2) (-> obj world-vertex 1) (the-as vector (-> obj world-vertex))) + 1.0 + ) + (vector-normalize! + (vector-cross! + (the-as vector (-> obj hanging-matrix)) + (-> obj hanging-matrix vector 2) + (-> obj hanging-matrix vector 1) + ) + 1.0 + ) + (vector-cross! + (-> obj hanging-matrix vector 2) + (the-as vector (-> obj hanging-matrix)) + (-> obj hanging-matrix vector 1) + ) + (set! (-> obj hanging-matrix vector 3 quad) (-> obj center-hold quad)) + (let ((v1-21 *collide-edge-work*)) + (transform-vectors! + (-> obj hanging-matrix) + (-> v1-21 world-player-spheres) + (-> v1-21 local-player-spheres) + 12 + ) + ) + ) + ) + (let ((v1-22 *collide-edge-work*) + (a1-14 (new 'stack-no-clear 'collide-using-spheres-params)) + ) + (let ((a0-24 'target-edge-grab-jump)) + (b! (!= (-> *target* next-state name) a0-24) cfg-20 :delay (nop!)) + ) + (set! (-> a1-14 spheres) (-> v1-22 world-player-leap-up-spheres)) + (set! (-> a1-14 num-spheres) (the-as uint 6)) + (set! (-> a1-14 collide-with) (-> v1-22 cshape root-prim collide-with)) + (set! (-> a1-14 proc) #f) + (set! (-> a1-14 ignore-pat) (the-as uint 1)) + (set! (-> a1-14 solid-only) #t) + (b! #t cfg-21 :delay (nop!)) + (label cfg-20) + (set! (-> a1-14 spheres) (-> v1-22 world-player-spheres)) + (set! (-> a1-14 num-spheres) (the-as uint 6)) + (set! (-> a1-14 collide-with) (-> v1-22 cshape root-prim collide-with)) + (set! (-> a1-14 proc) #f) + (set! (-> a1-14 ignore-pat) (the-as uint 1)) + (set! (-> a1-14 solid-only) #t) + (label cfg-21) + (b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24 :delay (empty-form)) + ) + (set! v0-0 #f) + (b! #t cfg-27 :delay (nop!)) + (the-as none 0) + (label cfg-24) + (b! (not (the-as int s5-0)) cfg-26 :delay (empty-form)) + (let ((v1-40 (-> (the-as collide-shape-prim s5-0) cshape))) + (send-event (-> v1-40 process) 'edge-grabbed obj) + ) + ) + (label cfg-26) + (set! v0-0 #t) + (label cfg-27) + v0-0 + ) + ) + +;; definition for method 16 of type collide-edge-work +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for method 15 of type collide-edge-work +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for method 14 of type collide-edge-work +;; Used lq/sq +(defmethod dummy-14 collide-edge-work ((obj collide-edge-work) (arg0 vector) (arg1 vector) (arg2 int)) + (let ((f30-0 -1.0)) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (dotimes (s1-0 (the-as int (-> obj num-edges))) + (let ((v1-3 (-> obj edges s1-0))) + (when (not (-> v1-3 ignore)) + (when (= (-> v1-3 etri ctri prim-index) arg2) + (let ((f0-0 (vector-segment-distance-point! arg1 (-> v1-3 vertex-ptr 0 0) (-> v1-3 vertex-ptr 1 0) s2-0))) + (when (or (< f30-0 0.0) (< f0-0 f30-0)) + (set! f30-0 f0-0) + (set! (-> arg0 quad) (-> s2-0 quad)) + ) + ) + ) + ) + ) + ) + ) + f30-0 + ) + ) + +;; definition for method 17 of type collide-edge-work +;; Used lq/sq +(defmethod should-add-to-list? collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-item) (arg1 collide-edge-edge)) + (local-vars + (v1-1 uint128) + (v1-2 uint128) + (v1-4 float) + (v1-5 float) + (v1-6 float) + (a3-1 uint128) + (t0-0 uint128) + (t1-1 uint128) + ) + (rlet ((Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf10 :class vf) + (vf11 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + (vf9 :class vf) + ) + (init-vf0-vector) + (nop!) + (nop!) + (.lvf vf1 (&-> arg0 center-pt quad)) + (nop!) + (let ((a3-0 (-> obj within-reach-box4w min quad))) + (nop!) + (let ((t1-0 (-> obj within-reach-box4w max quad))) + (.ftoi.vf vf2 vf1) + (let ((v1-0 (-> obj cshape))) + (.mov t0-0 vf2) + (.lvf vf3 (&-> arg1 outward quad)) + (.pcgtw t1-1 t0-0 t1-0) + (.lvf vf4 (&-> obj outward-offset quad)) + (.pcgtw a3-1 a3-0 t0-0) + (.lvf vf5 (&-> v1-0 trans quad)) + ) + ) + ) + (.por v1-1 t1-1 a3-1) + (let ((f0-0 (-> obj max-dist-sqrd-to-outward-pt))) + (.ppach v1-2 (the-as uint128 0) v1-1) + (let ((f1-0 (-> obj max-dir-cosa-delta))) + (b! (nonzero? (shl (the-as int v1-2) 16)) cfg-4 :delay (.lvf vf6 (&-> obj search-dir-vec quad))) + (.mul.x.vf vf10 vf3 vf4) + (.lvf vf11 (&-> obj search-pt quad)) + (.add.vf vf10 vf10 vf1) + (.sub.vf vf7 vf5 vf10) + (.mul.vf vf7 vf7 vf7) + (.add.z.vf vf7 vf7 vf7 :mask #b1) + (.mov v1-4 vf7) + (b! (< f0-0 v1-4) cfg-4) + (.sub.vf vf8 vf1 vf5) + (.mul.vf vf7 vf8 vf8) + (.add.z.vf vf7 vf7 vf7 :mask #b1) + (.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b0) + (nop!) + (.wait.vf) + (nop!) + (.mul.vf vf8 vf8 Q :mask #b101) + (.mul.vf vf9 vf8 vf6) + (.add.z.vf vf9 vf9 vf9 :mask #b1) + (.mov v1-5 vf9) + (b! (< v1-5 f1-0) cfg-4) + ) + ) + (.sub.vf vf7 vf11 vf1) + (.svf (&-> arg0 center-pt quad) vf1) + (.mul.vf vf7 vf7 vf7) + (set! (-> arg0 split) 0) + (.svf (&-> arg0 outward-pt quad) vf10) + (.add.z.vf vf7 vf7 vf7 :mask #b1) + (set! (-> arg0 edge) arg1) + (.mov v1-6 vf7) + (set! (-> arg0 rating) v1-6) + (let ((v0-0 #t)) + (b! #t cfg-6 :delay (nop!)) + (label cfg-4) + (set! v0-0 #f) + (b! #t cfg-6 :delay (nop!)) + (set! v0-0 (the-as symbol 0)) + (label cfg-6) + v0-0 + ) + ) + ) + +;; definition for method 13 of type collide-edge-work +(defmethod compute-center-point! collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-edge) (arg1 vector)) + (local-vars (v0-0 float) (v1-1 float) (v1-2 float) (v1-3 float)) + (rlet ((Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf10 :class vf) + (vf11 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + (vf9 :class vf) + ) + (init-vf0-vector) + (.mov.vf vf7 vf0) + (.lvf vf1 (&-> obj search-pt quad)) + (let ((f0-0 0.0)) + (let ((v1-0 (-> arg0 vertex-ptr 0)) + (a0-1 (-> arg0 vertex-ptr 1)) + ) + (.lvf vf2 (&-> v1-0 0 quad)) + (.lvf vf3 (&-> a0-1 0 quad)) + ) + (.sub.vf vf4 vf1 vf2) + (.sub.vf vf5 vf3 vf2) + (.mul.vf vf6 vf5 vf5) + (.add.z.vf vf6 vf6 vf6 :mask #b1) + (.sqrt.vf Q vf6 :ftf #b0) + (nop!) + (.wait.vf) + (nop!) + (.add.vf vf6 vf0 Q :mask #b1) + (.nop.vf) + (.mov v1-1 vf6) + (let ((f1-0 v1-1)) + (.div.vf Q vf0 vf6 :fsf #b11 :ftf #b0) + (.wait.vf) + (nop!) + (.add.vf vf8 vf0 Q :mask #b1) + (.mul.x.vf vf9 vf5 vf8) + (.mov v1-2 vf8) + (.mul.vf vf10 vf9 vf4) + (.add.z.vf vf10 vf10 vf10 :mask #b1) + (let ((f2-0 v1-2)) + (.mov v1-3 vf10) + (let ((f3-0 v1-3)) + (b! (< f3-0 f0-0) cfg-4 :likely-delay (set! f3-0 f0-0)) + (b! (< f1-0 f3-0) cfg-4 :likely-delay (set! f3-0 f1-0)) + (label cfg-4) + (let ((v1-4 (* f3-0 f2-0))) + (.mov vf11 v1-4) + ) + ) + ) + ) + ) + (.mul.x.vf vf7 vf5 vf11 :mask #b111) + (.add.vf vf7 vf7 vf2 :mask #b111) + (.svf (&-> arg1 quad) vf7) + (.mov v0-0 vf7) + v0-0 + ) + ) + +;; definition for method 10 of type edge-grab-info +;; INFO: Return type mismatch object vs symbol. +(defmethod debug-draw edge-grab-info ((obj edge-grab-info)) + (add-debug-line + #t + (bucket-id debug-no-zbuf) + (the-as vector (-> obj world-vertex)) + (-> obj world-vertex 1) + (new 'static 'rgba :r #xff :a #x60) + #f + (the-as rgba -1) + ) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf) + (-> obj center-hold) + 204.8 + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf) + (-> obj left-hand-hold) + 204.8 + (new 'static 'rgba :r #xff :g #xff :a #x60) + ) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf) + (-> obj right-hand-hold) + 204.8 + (new 'static 'rgba :r #xff :g #xff :a #x60) + ) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf) + (the-as vector (-> obj tri-vertex)) + (-> obj world-vertex 4) + (-> obj world-vertex 5) + (new 'static 'rgba :r #xff :a #x30) + ) + (the-as symbol (cond + ((nonzero? (-> obj actor-cshape-prim-offset)) + (if (handle->process (-> obj actor-handle)) + (format *stdcon* "grab: ~A~%" (-> obj actor-handle process 0 name)) + (format *stdcon* "grab: invalid handle~%") + ) + ) + (else + (format *stdcon* "grab: ground~%") + ) + ) + ) + ) + +;; definition for method 10 of type collide-edge-work +(defmethod debug-draw-edges collide-edge-work ((obj collide-edge-work)) + (let ((gp-0 0)) + (dotimes (s4-0 (the-as int (-> obj num-edges))) + (let* ((s3-0 (-> obj edges s4-0)) + (a2-0 (-> s3-0 vertex-ptr 0 0)) + (a3-0 (-> s3-0 vertex-ptr 1 0)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector+! s2-0 a2-0 a3-0) + (vector-float*! s2-0 s2-0 0.5) + (cond + ((-> s3-0 ignore) + (add-debug-line + #t + (bucket-id debug-no-zbuf) + a2-0 + a3-0 + (new 'static 'rgba :r #x7f :g #x7f :b #x7f :a #x50) + #f + (the-as rgba -1) + ) + (+! gp-0 1) + ) + (else + (add-debug-line + #t + (bucket-id debug-no-zbuf) + a2-0 + a3-0 + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x60) + #f + (the-as rgba -1) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf) + s2-0 + (-> s3-0 outward) + (meters 0.3) + (new 'static 'rgba :r #xff :a #x80) + ) + ) + ) + ) + ) + (format *stdcon* "found ~D edges (and ~D ignored)~%" (- (-> obj num-edges) (the-as uint gp-0)) gp-0) + ) + ) + +;; definition for method 12 of type collide-edge-work +(defmethod debug-draw-sphere collide-edge-work ((obj collide-edge-work)) + (dotimes (s5-0 (the-as int (-> obj num-verts))) + (let ((a2-0 (-> obj verts s5-0))) + (add-debug-sphere #t (bucket-id debug-no-zbuf) a2-0 819.2 (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ) + #f + ) + +;; definition for method 9 of type collide-edge-hold-list +;; Used lq/sq +(defmethod debug-draw collide-edge-hold-list ((obj collide-edge-hold-list)) + (let ((s4-0 (-> obj head)) + (s5-0 0) + ) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s2-0 #t) + ) + (set! (-> s3-0 quad) (-> *target* control unknown-vector90 quad)) + (while s4-0 + (+! s5-0 1) + (set! (-> s3-0 y) (-> s4-0 center-pt y)) + (add-debug-sphere #t (bucket-id debug-no-zbuf) s3-0 409.6 (new 'static 'rgba :a #x80)) + (cond + (s2-0 + (set! s2-0 #f) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf) + (-> s4-0 center-pt) + 614.4 + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #xff :a #x80)) + ) + (else + (add-debug-sphere + #t + (bucket-id debug-no-zbuf) + (-> s4-0 center-pt) + 614.4 + (new 'static 'rgba :r #x7f :g #x7f :a #x40) + ) + (add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #x7f :a #x40)) + ) + ) + (set! s4-0 (-> s4-0 next)) + ) + ) + (format *stdcon* "hold list has ~D item(s)~%" s5-0) + ) + (dotimes (s5-1 (the-as int (-> obj num-attempts))) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf) + (the-as vector (-> obj attempts s5-1)) + 409.6 + (new 'static 'rgba :a #x40) + ) + ) + (format *stdcon* "hold list has ~D attempt(s)~%" (-> obj num-attempts)) + ) + +;; definition for method 11 of type collide-edge-work +;; INFO: Return type mismatch symbol vs none. +(defmethod debug-draw-tris collide-edge-work ((obj collide-edge-work)) + (dotimes (s5-0 (the-as int (-> obj num-tris))) + (let* ((v1-3 (-> obj tris s5-0 ctri)) + (t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-3 pat mode) color) a 64)) + ) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf) + (the-as vector (-> v1-3 vertex)) + (-> v1-3 vertex 1) + (-> v1-3 vertex 2) + t1-0 + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(let ((v1-1 + (new 'static 'surface + :name '*rotate-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 1.0 + :target-speed 1.0 + :seek0 153600.0 + :seek90 153600.0 + :seek180 256000.0 + :fric 153600.0 + :nonlin-fric-dist 5120.0 + :slip-factor 1.0 + :slope-down-factor 10240.0 + :slope-slip-angle 8192.0 + :impact-fric 1.0 + :bend-factor 0.8 + :bend-speed 4.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flags surf14) + ) + ) + ) + (set! *rotate-surface* v1-1) + (set! (-> v1-1 mult-hook) + (the-as + (function surface surface surface int none) + (lambda ((arg0 surface) (arg1 object) (arg2 object) (arg3 int)) (when (= arg3 1) + (let ((f0-0 151756.8)) + (set! (-> arg0 fric) f0-0) + f0-0 + ) + ) + ) + ) + ) + (set! (-> v1-1 touch-hook) nothing) + (set! (-> v1-1 active-hook) nothing) + ) + +;; failed to figure out what this is: +(let ((v1-2 (new 'static 'surface + :name '*no-walk-surface* + :turnv 0.5 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 0.7 + :target-speed 0.7 + :seek0 24576.0 + :seek90 24576.0 + :seek180 24576.0 + :fric 23756.8 + :nonlin-fric-dist 4091904.0 + :slope-slip-angle 16384.0 + :bend-speed 4.0 + :alignv 0.5 + :slope-up-traction 0.9 + :align-speed 1.0 + :flags (surface-flags surf03 surf05) + ) + ) + ) + (set! *no-walk-surface* v1-2) + (set! (-> v1-2 mult-hook) (the-as (function surface surface surface int none) nothing)) + (set! (-> v1-2 touch-hook) nothing) + (set! (-> v1-2 active-hook) nothing) + ) diff --git a/test/decompiler/reference/engine/collide/collide-reaction-target_REF.gc b/test/decompiler/reference/engine/collide/collide-reaction-target_REF.gc new file mode 100644 index 0000000000..76c8057577 --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-reaction-target_REF.gc @@ -0,0 +1,436 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function collide-shape-moving-angle-set! +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defun collide-shape-moving-angle-set! ((arg0 collide-shape-moving) (arg1 vector) (arg2 vector)) + (set! (-> arg0 surface-normal quad) (-> arg1 quad)) + (set! (-> arg0 surface-angle) (vector-dot arg1 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) + (set! (-> arg0 touch-angle) + (fmax + (-> arg0 touch-angle) + (vector-dot arg1 (vector-normalize! (vector-negate! (new-stack-vector0) arg2) 1.0)) + ) + ) + 0 + (none) + ) + +;; definition for function poly-find-nearest-edge +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 48 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 48 signed mismatch +;; Used lq/sq +(defun poly-find-nearest-edge ((arg0 vector) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) + (local-vars (sv-32 vector) (sv-36 float) (sv-40 int) (sv-48 float) (sv-80 vector)) + (set! sv-32 (new 'stack-no-clear 'vector)) + (set! sv-36 4095996000.0) + (set! sv-40 -1) + (set! sv-48 0.0) + (dotimes (s2-0 3) + (let ((s0-0 (-> arg1 s2-0))) + (set! sv-80 (-> arg1 (mod (+ s2-0 1) 3))) + (let ((f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) + ) + 0.0 + (vector-normalize! s1-1 1.0) + (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) + (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) + (set! sv-36 f30-0) + (set! sv-40 s2-0) + (set! sv-48 f0-5) + ) + ) + ) + ) + ) + (let ((v1-20 (&-> arg0 x)) + (a0-7 (-> arg1 sv-40 quad)) + ) + (s.q! v1-20 a0-7) + ) + (set! (-> (&+ arg0 16) quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) + arg0 + ) + +;; definition for function target-collision-low-coverage +;; INFO: Return type mismatch int vs uint. +;; Used lq/sq +(defun target-collision-low-coverage ((arg0 control-info) + (arg1 collide-shape-intersect) + (arg2 vector) + (arg3 (pointer uint32)) + (arg4 (pointer uint64)) + (arg5 (pointer symbol)) + ) + (local-vars + (sv-16 vector) + (sv-20 (pointer uint32)) + (sv-24 (pointer uint64)) + (sv-28 (pointer symbol)) + (sv-32 uint) + (sv-40 uint) + (sv-48 symbol) + (sv-52 vector) + (sv-56 vector) + (sv-160 vector) + (sv-164 collide-tri-result) + (sv-208 vector) + (sv-212 vector) + (sv-272 vector) + (sv-276 vector) + ) + (set! sv-16 arg2) + (set! sv-20 arg3) + (set! sv-24 arg4) + (set! sv-28 arg5) + (set! sv-32 (-> arg3 0)) + (set! sv-40 (-> arg4 0)) + (set! sv-48 (-> arg5 0)) + (set! sv-52 (-> arg0 unknown-vector60)) + (set! sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16)) + (vector-normalize! sv-56 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) + (set! sv-32 (logior sv-32 512)) + ) + (vector-cross! sv-52 sv-16 sv-56) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) + (vector-negate! sv-52 sv-52) + ) + (vector-normalize! sv-52 1.0) + (set! sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal))) + (set! sv-164 (new 'stack 'collide-tri-result)) + (vector-normalize! sv-160 1.0) + (if (< (vector-dot sv-160 sv-16) 0.0) + (vector-negate! sv-160 sv-160) + ) + (set! (-> arg0 unknown-float-coverage-0) 4095996000.0) + (set! (-> arg0 unknown-float-coverage-2) 4095996000.0) + (set! sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2)) + (set! sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) + (vector+float*! sv-212 sv-212 sv-160 4096.0) + (when (>= (probe-using-line-sphere *collide-cache* sv-208 sv-212 409.6 (-> arg1 best-from-prim collide-with) sv-164 1) + 0.0 + ) + (set! (-> arg0 unknown-float-coverage-0) + (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect)) + ) + ) + (set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad)) + 0 + ) + (set! sv-272 (vector+float*! + (new 'stack-no-clear 'vector) + (-> arg1 best-tri intersect) + (-> arg0 dynam gravity-normal) + 819.2 + ) + ) + (set! sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)) + (vector+float*! sv-272 sv-272 sv-160 -819.2) + (vector+float*! sv-276 sv-276 sv-160 -4096.0) + (when (>= (probe-using-line-sphere *collide-cache* sv-272 sv-276 409.6 (-> arg1 best-from-prim collide-with) sv-164 1) + 0.0 + ) + (set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect))) + (set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat))) + (set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad)) + 0 + ) + (when (and (zero? (logand sv-32 512)) + (and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1) + ) + (and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w))) + (zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61)) + ) + ) + ) + (set! sv-32 (logior sv-32 128)) + (set! (-> arg0 unknown-dword-coverage) (the-as int (-> *display* base-frame-counter))) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-dword21) (-> *display* base-frame-counter)) + (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22))) + (f0-21 (if (logtest? sv-32 2) + (cos (- 16384.0 (acos (-> arg0 coverage)))) + (-> arg0 coverage) + ) + ) + (f1-11 (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect)) + ) + ) + ) + (if (or (zero? (logand sv-32 32)) (< 0.5 f0-21)) + (set! sv-48 (the-as symbol #f)) + ) + (when (and (or (and (< f0-21 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 32) (< f0-21 0.3)) + (< f1-11 (* -0.25 (-> arg1 best-from-prim local-sphere w))) + ) + (>= (vector-dot sv-52 sv-16) -0.000001) + ) + (set! (-> arg0 surf) *edge-surface*) + (set! sv-32 (logior sv-32 1024)) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 32) + (set! sv-48 #t) + (set! sv-32 (logior sv-32 4096)) + ) + ) + ) + ) + (if (< (-> arg0 surface-angle) 0.0) + (set! sv-48 #t) + ) + (when sv-48 + (cond + ((and (or (= (-> arg0 poly-pat mode) (pat-mode ground)) + (and (logtest? sv-32 8) + (>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0)) + (zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61)) + (< 0.3 (fabs (-> arg0 surface-angle))) + ) + ) + (zero? (logand sv-32 128)) + ) + (set! sv-32 (logior sv-32 64)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-dword21) (-> *display* base-frame-counter)) + (set! sv-48 (the-as symbol #f)) + ) + (#t + (set! sv-32 (logior sv-32 64)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-dword21) (-> *display* base-frame-counter)) + ) + ) + ) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48) + (the-as uint 0) + ) + +;; definition for function target-collision-reaction +;; INFO: Return type mismatch int vs cshape-moving-flags. +;; Used lq/sq +(defun target-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) + (local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-160 symbol)) + (set! sv-80 (new-stack-vector0)) + (set! sv-84 (new-stack-vector0)) + (let ((v1-2 (new 'stack-no-clear 'matrix))) + (dotimes (a0-1 2) + (set! (-> v1-2 vector a0-1 quad) (the-as uint128 0)) + ) + (set! sv-88 v1-2) + ) + (set! sv-96 0) + (set! sv-104 0) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (move-by-vector! arg0 a1-3) + ) + (set-and-handle-pat! arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! sv-104 (logior sv-104 1)) + ) + (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags surf11)) + (set! sv-104 (logior sv-104 32)) + ) + (let ((v1-23 (new 'stack-no-clear 'vector))) + (set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-23 (-> arg1 best-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (set! sv-104 (logior sv-104 24)) + ) + (let ((v1-33 (-> sv-80 quad))) + (set! (-> sv-84 quad) v1-33) + ) + (if (= (-> arg1 best-u) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (the-as vector (-> sv-88 vector))) + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-96 (logior sv-96 16)) + ) + (if (< (-> arg0 poly-angle) 0.0) + (set! sv-96 (logior sv-96 #x4000)) + ) + (set! sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) + (if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle))))) + (set! sv-160 (the-as symbol #f)) + ) + (if sv-160 + (set! sv-104 (logior sv-104 2)) + ) + (if (logtest? sv-104 8) + (target-collision-low-coverage + arg0 + arg1 + sv-84 + (the-as (pointer uint32) (& sv-104)) + (the-as (pointer uint64) (& sv-96)) + (& sv-160) + ) + ) + (when (zero? (logand (-> arg0 prev-status) (cshape-moving-flags onsurf))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (set! sv-96 (logior sv-96 2048)) + (when (not sv-160) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s3-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (the-as vector (-> sv-88 vector)))) + ) + 0.0 + (vector-! s3-1 (the-as vector (-> sv-88 vector)) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0)) + (let* ((f0-20 (vector-length s3-1)) + (f1-9 f0-20) + ) + (if (< f28-0 0.0) + (set! f28-0 (* f28-0 f30-0)) + ) + (vector+! + (the-as vector (-> sv-88 vector)) + (vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s3-1 s3-1 (/ f0-20 f1-9)) + ) + ) + ) + ) + ) + ) + ) + (set! sv-96 (logior sv-96 4)) + (cond + ((-> arg1 best-to-prim) + (set! sv-96 (logior sv-96 32)) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (set! sv-96 (logior sv-96 4096)) + ) + ) + (cond + (sv-160 + (set! sv-104 (logior sv-104 4)) + (set! sv-96 (logior sv-96 8)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad)) + (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) + (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127)) + (cond + (#f + (sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t) + (set! sv-104 (logior sv-104 8192)) + (vector-reflect-flat-above! arg2 (the-as vector (-> sv-88 vector)) sv-84) + ) + (else + (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) + ) + ) + (cond + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) (seconds 0.3)) + (zero? (logand sv-104 32)) + ) + ) + ) + ) + (else + (set! sv-104 (logior sv-104 256)) + (set! sv-104 (logand -65 sv-104)) + (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-4 1.0) + (vector-float*! arg2 s3-4 (vector-dot (the-as vector (-> sv-88 vector)) s3-4)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + ) + ) + (else + (set! sv-96 (logior sv-96 1)) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-from-prim prim-id) 6) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) + (vector+! arg2 arg2 sv-84) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event)))) + (set! sv-96 (logior sv-96 2)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 unknown-dword10) (-> *display* base-frame-counter)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (set! sv-104 (logior sv-104 2048)) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (set! sv-96 (logior sv-96 1024)) + ) + ) + ) + ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) + (update! + (-> arg0 history-data (-> arg0 unknown-halfword00)) + arg0 + (-> arg1 best-tri intersect) + (-> sv-88 vector 1) + arg2 + ) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + (the-as cshape-moving-flags sv-96) + ) + +;; definition for function target-collision-no-reaction +;; INFO: Return type mismatch int vs none. +(defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) + (if (= (-> arg0 unknown-surface00 mode) 'air) + (logior! (-> arg0 reaction-flag) (cshape-reaction-flags csrf05)) + ) + (let ((s5-0 (-> arg0 history-data (-> arg0 unknown-halfword00)))) + (update! s5-0 arg0 (-> arg0 trans) arg3 arg2) + (logior! (-> s5-0 status) (cshape-moving-flags csmf08)) + ) + (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) + 0 + (none) + ) diff --git a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc index f0e6f51b55..18a8ddc00b 100644 --- a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc @@ -454,31 +454,31 @@ ;; definition of type collide-shape-moving (deftype collide-shape-moving (collide-shape) - ((rider-time time-frame :offset-assert 184) - (rider-last-move vector :inline :offset-assert 192) - (trans-old vector 3 :inline :offset-assert 208) - (poly-pat pat-surface :offset-assert 256) - (cur-pat pat-surface :offset-assert 260) - (ground-pat pat-surface :offset-assert 264) - (status uint64 :offset-assert 272) - (old-status uint64 :offset-assert 280) - (prev-status uint64 :offset-assert 288) - (reaction-flag uint32 :offset-assert 296) - (reaction (function collide-shape-moving collide-shape-intersect vector vector uint) :offset-assert 300) - (no-reaction (function collide-shape-moving collide-shape-intersect vector vector none) :offset-assert 304) - (local-normal vector :inline :offset-assert 320) - (surface-normal vector :inline :offset-assert 336) - (poly-normal vector :inline :offset-assert 352) - (ground-poly-normal vector :inline :offset-assert 368) - (ground-touch-point vector :inline :offset-assert 384) - (shadow-pos vector :inline :offset-assert 400) - (ground-impact-vel meters :offset-assert 416) - (surface-angle float :offset-assert 420) - (poly-angle float :offset-assert 424) - (touch-angle float :offset-assert 428) - (coverage float :offset-assert 432) - (dynam dynamics :offset-assert 436) - (surf surface :offset-assert 440) + ((rider-time time-frame :offset-assert 184) + (rider-last-move vector :inline :offset-assert 192) + (trans-old vector 3 :inline :offset-assert 208) + (poly-pat pat-surface :offset-assert 256) + (cur-pat pat-surface :offset-assert 260) + (ground-pat pat-surface :offset-assert 264) + (status cshape-moving-flags :offset-assert 272) + (old-status cshape-moving-flags :offset-assert 280) + (prev-status cshape-moving-flags :offset-assert 288) + (reaction-flag cshape-reaction-flags :offset-assert 296) + (reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags) :offset-assert 300) + (no-reaction (function collide-shape-moving collide-shape-intersect vector vector none) :offset-assert 304) + (local-normal vector :inline :offset-assert 320) + (surface-normal vector :inline :offset-assert 336) + (poly-normal vector :inline :offset-assert 352) + (ground-poly-normal vector :inline :offset-assert 368) + (ground-touch-point vector :inline :offset-assert 384) + (shadow-pos vector :inline :offset-assert 400) + (ground-impact-vel meters :offset-assert 416) + (surface-angle float :offset-assert 420) + (poly-angle float :offset-assert 424) + (touch-angle float :offset-assert 428) + (coverage float :offset-assert 432) + (dynam dynamics :offset-assert 436) + (surf surface :offset-assert 440) ) :method-count-assert 65 :size-assert #x1bc diff --git a/test/decompiler/reference/engine/collide/collide-shape-rider_REF.gc b/test/decompiler/reference/engine/collide/collide-shape-rider_REF.gc new file mode 100644 index 0000000000..809e41fde2 --- /dev/null +++ b/test/decompiler/reference/engine/collide/collide-shape-rider_REF.gc @@ -0,0 +1,488 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 39 of type collide-shape +(defmethod on-platform collide-shape ((obj collide-shape) (arg0 collide-shape) (arg1 collide-overlap-result)) + (let ((v1-0 arg1)) + (set! (-> v1-0 best-dist) 0.0) + (set! (-> v1-0 best-from-prim) #f) + (set! (-> v1-0 best-to-prim) #f) + ) + (set! (-> arg1 best-dist) 122.88) + (let ((s5-0 (-> obj root-prim)) + (s4-0 (-> arg0 root-prim)) + ) + (when (and (logtest? (-> s5-0 collide-with) (-> s4-0 prim-core collide-as)) + (logtest? (-> s5-0 prim-core action) (collide-action ca-1)) + (logtest? (-> s4-0 prim-core action) (collide-action ca-2)) + ) + (let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core))) + (-> s5-0 prim-core world-sphere w) + ) + (-> s4-0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-4 122.88) + (on-platform-test s5-0 s4-0 arg1 f0-4) + ) + ) + ) + ) + (< (-> arg1 best-dist) 122.88) + ) + +;; definition for method 22 of type collide-shape-prim +;; INFO: Return type mismatch object vs none. +(defmethod on-platform-test collide-shape-prim ((obj collide-shape-prim) (arg0 collide-shape-prim) (arg1 collide-overlap-result) (arg2 float)) + (format 0 "ERROR: collide-shape-prim::on-platform-test was called illegally!~%") + (none) + ) + +;; definition for method 22 of type collide-shape-prim-group +;; INFO: Return type mismatch symbol vs none. +(defmethod on-platform-test collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 collide-shape-prim) (arg1 collide-overlap-result) (arg2 float)) + (let ((s3-0 (-> arg0 prim-core collide-as))) + (dotimes (s2-0 (-> obj num-prims)) + (let ((s1-0 (-> obj prims s2-0))) + (when (and (logtest? (-> s1-0 collide-with) s3-0) (logtest? (-> s1-0 prim-core action) (collide-action ca-1))) + (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s1-0 prim-core)) (the-as vector (-> arg0 prim-core))) + (-> s1-0 prim-core world-sphere w) + ) + (-> arg0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-2 122.88) + (on-platform-test s1-0 arg0 arg1 f0-2) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 22 of type collide-shape-prim-mesh +;; INFO: Return type mismatch pat-surface vs none. +;; WARN: Expression building failed: Function (method 22 collide-shape-prim-mesh) has a return type of none, but the expression builder found a return statement. +;; Used lq/sq +(defmethod on-platform-test collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 collide-shape-prim) (arg1 collide-overlap-result) (arg2 float)) + (case (-> arg0 type) + ((collide-shape-prim-group) + (let ((s3-0 (-> obj collide-with))) + (dotimes (s2-0 (-> (the-as collide-shape-prim-group arg0) num-prims)) + (let ((s1-0 (-> (the-as collide-shape-prim-group arg0) prims s2-0))) + (when (and (logtest? s3-0 (-> s1-0 prim-core collide-as)) + (logtest? (-> s1-0 prim-core action) (collide-action ca-2)) + ) + (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> obj prim-core)) (the-as vector (-> s1-0 prim-core))) + (-> obj prim-core world-sphere w) + ) + (-> s1-0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-2 122.88) + (on-platform-test obj s1-0 arg1 f0-2) + ) + ) + ) + ) + ) + ) + ) + ((collide-shape-prim-sphere) + (let ((s3-1 (-> obj mesh))) + (when s3-1 + (let ((s2-1 *collide-mesh-cache*)) + (when (!= (-> obj mesh-cache-id) (-> s2-1 id)) + (let ((v1-17 (allocate! s2-1 (* (the-as uint 96) (-> s3-1 num-tris))))) + (cond + (v1-17 + (set! (-> obj mesh-cache-tris) (the-as (inline-array collide-mesh-cache-tri) v1-17)) + (set! (-> obj mesh-cache-id) (-> s2-1 id)) + (populate-cache! + s3-1 + (the-as collide-mesh-cache-tri (-> obj mesh-cache-tris)) + (-> obj cshape process node-list data (-> obj transform-index) bone transform) + ) + ) + (else + (return #f) + ) + ) + ) + ) + ) + (let* ((s2-2 (new 'stack-no-clear 'collide-tri-result)) + (f0-4 (sphere-on-platform-test + s3-1 + (the-as collide-mesh-cache-tri (-> obj mesh-cache-tris)) + s2-2 + (the-as vector (-> arg0 prim-core)) + (-> arg1 best-dist) + ) + ) + ) + (when (< f0-4 (-> arg1 best-dist)) + (set! (-> arg1 best-dist) f0-4) + (set! (-> arg1 best-from-prim) obj) + (set! (-> arg1 best-to-prim) arg0) + (set! (-> arg1 best-from-tri vertex 0 quad) (-> s2-2 vertex 0 quad)) + (set! (-> arg1 best-from-tri vertex 1 quad) (-> s2-2 vertex 1 quad)) + (set! (-> arg1 best-from-tri vertex 2 quad) (-> s2-2 vertex 2 quad)) + (set! (-> arg1 best-from-tri intersect quad) (-> s2-2 intersect quad)) + (set! (-> arg1 best-from-tri normal quad) (-> s2-2 normal quad)) + (set! (-> arg1 best-from-tri pat) (-> s2-2 pat)) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 9 of type collide-sticky-rider-group +(defmethod add-rider! collide-sticky-rider-group ((obj collide-sticky-rider-group) (arg0 process-drawable)) + (let ((gp-0 (the-as collide-sticky-rider #f))) + (cond + ((< (-> obj num-riders) (-> obj allocated-riders)) + (set! gp-0 (-> obj rider (-> obj num-riders))) + (+! (-> obj num-riders) 1) + (let ((v1-6 gp-0)) + (set! (-> v1-6 rider-handle) (the-as handle arg0)) + (set! (-> v1-6 sticky-prim) #f) + ) + ) + (else + (format 0 "ERROR: Exeeded max number of riders!~%") + ) + ) + gp-0 + ) + ) + +;; definition for method 35 of type collide-shape +(defmethod detect-riders! collide-shape ((obj collide-shape)) + (let ((s5-0 (-> obj riders))) + (when s5-0 + (let* ((v1-0 *collide-mesh-cache*) + (a0-1 (-> v1-0 id)) + ) + (set! (-> v1-0 used-size) (the-as uint 0)) + (let ((a0-2 (the-as int (+ a0-1 1)))) + (b! (zero? (the-as uint a0-2)) cfg-3 :likely-delay (set! a0-2 1)) + (label cfg-3) + (set! (-> v1-0 id) (the-as uint a0-2)) + ) + ) + (set! (-> s5-0 num-riders) 0) + 0 + (let ((s4-0 (-> obj root-prim collide-with))) + (when (logtest? s4-0 (collide-kind target)) + (let ((v1-7 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((s3-0 (-> v1-7 next0))) + (while (!= v1-7 (-> *collide-player-list* alive-list-end)) + (let* ((s2-0 (the-as object (-> (the-as connection v1-7) param1))) + (v1-8 (-> (the-as collide-shape s2-0) root-prim)) + ) + (when (logtest? s4-0 (-> v1-8 prim-core collide-as)) + (when (and (logtest? (-> v1-8 prim-core action) (collide-action ca-2)) + (!= (-> obj process) (-> (the-as collide-shape s2-0) process)) + ) + (let ((s1-0 (new 'stack-no-clear 'collide-overlap-result))) + (when (on-platform obj (the-as collide-shape s2-0) s1-0) + (let ((s4-1 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-0) process))))) + ) + (when s4-1 + (let ((a0-11 (-> s1-0 best-from-prim))) + (set! (-> s4-1 sticky-prim) a0-11) + (let ((s1-1 + (-> (the-as process-drawable (-> obj process)) node-list data (-> a0-11 transform-index) bone transform) + ) + ) + (set! (-> s4-1 prim-ry) (matrix-y-angle s1-1)) + (let ((s0-0 (new 'stack-no-clear 'matrix))) + (matrix-4x4-inverse! s0-0 s1-1) + (vector-matrix*! (-> s4-1 rider-local-pos) (-> (the-as collide-shape s2-0) trans) s0-0) + ) + ) + ) + (send-event (-> obj process) 'ridden s4-1) + ) + ) + (set! s4-0 (-> obj root-prim collide-with)) + ) + ) + ) + ) + ) + (set! v1-7 s3-0) + *collide-player-list* + (set! s3-0 (-> s3-0 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-kind cak-1 cak-2 cak-3)) + (when (logtest? s4-0 (collide-kind cak-1)) + (let ((v1-37 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((s3-1 (-> v1-37 next0))) + (while (!= v1-37 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((s2-1 (the-as object (-> (the-as connection v1-37) param1))) + (v1-38 (-> (the-as collide-shape s2-1) root-prim)) + ) + (when (logtest? s4-0 (-> v1-38 prim-core collide-as)) + (when (and (logtest? (-> v1-38 prim-core action) (collide-action ca-2)) + (!= (-> obj process) (-> (the-as collide-shape s2-1) process)) + ) + (let ((s1-2 (new 'stack-no-clear 'collide-overlap-result))) + (when (on-platform obj (the-as collide-shape s2-1) s1-2) + (let ((s4-2 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-1) process))))) + ) + (when s4-2 + (let ((a0-30 (-> s1-2 best-from-prim))) + (set! (-> s4-2 sticky-prim) a0-30) + (let ((s1-3 (-> obj process node-list data (-> a0-30 transform-index) bone transform))) + (set! (-> s4-2 prim-ry) (matrix-y-angle s1-3)) + (let ((s0-1 (new 'stack-no-clear 'matrix))) + (matrix-4x4-inverse! s0-1 s1-3) + (vector-matrix*! (-> s4-2 rider-local-pos) (-> (the-as collide-shape s2-1) trans) s0-1) + ) + ) + ) + (send-event (-> obj process) 'ridden s4-2) + ) + ) + (set! s4-0 (-> obj root-prim collide-with)) + ) + ) + ) + ) + ) + (set! v1-37 s3-1) + *collide-hit-by-player-list* + (set! s3-1 (-> s3-1 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-kind cak-2)) + (let ((v1-66 (-> *collide-usually-hit-by-player-list* alive-list next0))) + *collide-usually-hit-by-player-list* + (let ((s3-2 (-> v1-66 next0))) + (while (!= v1-66 (-> *collide-usually-hit-by-player-list* alive-list-end)) + (let* ((s2-2 (the-as object (-> (the-as connection v1-66) param1))) + (v1-67 (-> (the-as collide-shape s2-2) root-prim)) + ) + (when (logtest? s4-0 (-> v1-67 prim-core collide-as)) + (when (and (logtest? (-> v1-67 prim-core action) (collide-action ca-2)) + (!= (-> obj process) (-> (the-as collide-shape s2-2) process)) + ) + (let ((s1-4 (new 'stack-no-clear 'collide-overlap-result))) + (when (on-platform obj (the-as collide-shape s2-2) s1-4) + (let ((s4-3 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-2) process))))) + ) + (when s4-3 + (let ((a0-49 (-> s1-4 best-from-prim))) + (set! (-> s4-3 sticky-prim) a0-49) + (let ((s1-5 (-> obj process node-list data (-> a0-49 transform-index) bone transform))) + (set! (-> s4-3 prim-ry) (matrix-y-angle s1-5)) + (let ((s0-2 (new 'stack-no-clear 'matrix))) + (matrix-4x4-inverse! s0-2 s1-5) + (vector-matrix*! (-> s4-3 rider-local-pos) (-> (the-as collide-shape s2-2) trans) s0-2) + ) + ) + ) + (send-event (-> obj process) 'ridden s4-3) + ) + ) + (set! s4-0 (-> obj root-prim collide-with)) + ) + ) + ) + ) + ) + (set! v1-66 s3-2) + *collide-usually-hit-by-player-list* + (set! s3-2 (-> s3-2 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-kind cak-3)) + (let ((v1-94 (-> *collide-hit-by-others-list* alive-list next0))) + *collide-hit-by-others-list* + (let ((s3-3 (-> v1-94 next0))) + (while (!= v1-94 (-> *collide-hit-by-others-list* alive-list-end)) + (let* ((s2-3 (the-as object (-> (the-as connection v1-94) param1))) + (v1-95 (-> (the-as collide-shape s2-3) root-prim)) + ) + (when (logtest? s4-0 (-> v1-95 prim-core collide-as)) + (when (and (logtest? (-> v1-95 prim-core action) (collide-action ca-2)) + (!= (-> obj process) (-> (the-as collide-shape s2-3) process)) + ) + (let ((s1-6 (new 'stack-no-clear 'collide-overlap-result))) + (when (on-platform obj (the-as collide-shape s2-3) s1-6) + (let ((s4-4 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-3) process))))) + ) + (when s4-4 + (let ((a0-68 (-> s1-6 best-from-prim))) + (set! (-> s4-4 sticky-prim) a0-68) + (let ((s1-7 (-> obj process node-list data (-> a0-68 transform-index) bone transform))) + (set! (-> s4-4 prim-ry) (matrix-y-angle s1-7)) + (let ((s0-3 (new 'stack-no-clear 'matrix))) + (matrix-4x4-inverse! s0-3 s1-7) + (vector-matrix*! (-> s4-4 rider-local-pos) (-> (the-as collide-shape s2-3) trans) s0-3) + ) + ) + ) + (send-event (-> obj process) 'ridden s4-4) + ) + ) + (set! s4-0 (-> obj root-prim collide-with)) + ) + ) + ) + ) + ) + (set! v1-94 s3-3) + *collide-hit-by-others-list* + (set! s3-3 (-> s3-3 next0)) + ) + ) + ) + #f + ) + ) + ) + ) + ) + ) + +;; definition for method 44 of type collide-shape +(defmethod pull-riders! collide-shape ((obj collide-shape)) + (let ((s5-0 (-> obj riders))) + (when s5-0 + (let ((s4-0 (new 'stack-no-clear 'pull-rider-info))) + (countdown (s3-0 (-> s5-0 num-riders)) + (let* ((v1-2 (-> s5-0 rider s3-0)) + (a0-1 (-> v1-2 rider-handle)) + ) + (when (handle->process a0-1) + (set! (-> s4-0 rider) v1-2) + (set! (-> s4-0 rider-cshape) + (the-as collide-shape-moving (-> (the-as process-drawable (-> a0-1 process 0)) root)) + ) + (let ((a0-5 (-> v1-2 sticky-prim))) + (when a0-5 + (let ((s2-0 (-> obj process node-list data (-> a0-5 transform-index) bone transform))) + (let ((s1-0 (-> s4-0 rider-dest))) + (vector-matrix*! s1-0 (-> v1-2 rider-local-pos) s2-0) + (vector-float*! s1-0 s1-0 (/ 1.0 (-> s1-0 w))) + ) + (set! (-> s4-0 rider-delta-ry) (deg- (matrix-y-angle s2-0) (-> s4-0 rider prim-ry))) + ) + (pull-rider! obj s4-0) + ) + ) + ) + ) + ) + ) + #f + ) + ) + ) + +;; definition for method 43 of type collide-shape +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defmethod pull-rider! collide-shape ((obj collide-shape) (arg0 pull-rider-info)) + (local-vars (at-0 int) (sv-160 (function collide-shape-moving float collide-kind none))) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (-> arg0 rider-cshape))) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-0 quad) (-> gp-0 trans quad)) + (vector-! s3-0 (-> arg0 rider-dest) s4-0) + (cond + ((logtest? (-> obj root-prim prim-core action) (collide-action ca-4)) + (let ((s1-0 (-> obj root-prim prim-core collide-as))) + (set! (-> obj root-prim prim-core collide-as) (collide-kind)) + (let ((s0-0 gp-0)) + (set! sv-160 (method-of-object s0-0 fill-cache-for-shape!)) + (let ((a1-3 (+ 8192.0 (vector-length s3-0))) + (a2-0 (-> gp-0 root-prim collide-with)) + ) + (sv-160 s0-0 a1-3 a2-0) + ) + ) + (set! (-> obj root-prim prim-core collide-as) s1-0) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 quad) (-> s3-0 quad)) + (let ((v1-12 s2-1)) + (.lvf vf1 (&-> s2-1 quad)) + (let ((f0-2 (-> *display* frames-per-second))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-12 quad) vf1) + ) + (cond + ((type-type? (-> gp-0 type) collide-shape-moving) + (let ((s3-1 (-> gp-0 status))) + (integrate-and-collide! gp-0 s2-1) + (set! (-> gp-0 status) s3-1) + ) + ) + (else + (integrate-and-collide! gp-0 s2-1) + ) + ) + ) + ) + (else + (move-by-vector! gp-0 s3-0) + ) + ) + (when (type-type? (-> gp-0 type) collide-shape-moving) + (let ((v1-18 (new 'stack-no-clear 'vector))) + (vector-! v1-18 (-> gp-0 trans) s4-0) + (vector-float*! (-> gp-0 rider-last-move) v1-18 (-> *display* frames-per-second)) + ) + (set! (-> gp-0 rider-time) (-> *display* base-frame-counter)) + ) + ) + (let ((f0-4 (-> arg0 rider-delta-ry))) + (if (!= f0-4 0.0) + (send-event (-> gp-0 process) 'rotate-y-angle f0-4) + ) + ) + ) + (none) + ) + ) + +;; definition for method 29 of type collide-shape +;; INFO: Return type mismatch object vs none. +(defmethod alloc-riders collide-shape ((obj collide-shape) (arg0 int)) + (if (-> obj riders) + (format 0 "ERROR: colide-shape::alloc-riders is being called multiple times!~%") + (set! (-> obj riders) (new 'process 'collide-sticky-rider-group arg0)) + ) + (none) + ) diff --git a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc index 81e5e6f2cd..057111ca29 100644 --- a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc @@ -3,16 +3,16 @@ ;; definition of type collide-history (deftype collide-history (structure) - ((intersect vector :inline :offset-assert 0) - (trans vector :inline :offset-assert 16) - (transv vector :inline :offset-assert 32) - (transv-out vector :inline :offset-assert 48) - (local-normal vector :inline :offset-assert 64) - (surface-normal vector :inline :offset-assert 80) - (time time-frame :offset-assert 96) - (status uint64 :offset-assert 104) - (pat pat-surface :offset-assert 112) - (reaction-flag uint32 :offset-assert 116) + ((intersect vector :inline :offset-assert 0) + (trans vector :inline :offset-assert 16) + (transv vector :inline :offset-assert 32) + (transv-out vector :inline :offset-assert 48) + (local-normal vector :inline :offset-assert 64) + (surface-normal vector :inline :offset-assert 80) + (time time-frame :offset-assert 96) + (status cshape-moving-flags :offset-assert 104) + (pat pat-surface :offset-assert 112) + (reaction-flag cshape-reaction-flags :offset-assert 116) ) :method-count-assert 10 :size-assert #x78 diff --git a/test/decompiler/reference/engine/debug/default-menu_REF.gc b/test/decompiler/reference/engine/debug/default-menu_REF.gc index 36f8686cf1..648917e8de 100644 --- a/test/decompiler/reference/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/engine/debug/default-menu_REF.gc @@ -3824,15 +3824,18 @@ (function "Play" #f (lambda () (play #t #t))) (function "Start" #f (lambda () (the-as int (start 'debug (get-or-create-continue! *game-info*))))) (function "Stop" #f (lambda () (stop 'debug))) - (flag "Invulnerable" #f (lambda ((arg0 int) (arg1 debug-menu-msg)) - (when (= arg1 (debug-menu-msg press)) - (if *target* - (set! (-> *target* state-flags) (logxor (-> *target* state-flags) 16)) - ) - ) - (the-as symbol (and *target* (logtest? (-> *target* state-flags) 16))) - ) + (flag + "Invulnerable" + #f + (lambda ((arg0 int) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (if *target* + (set! (-> *target* state-flags) (logxor (-> *target* state-flags) (state-flags sf04))) + ) ) + (the-as symbol (and *target* (logtest? (-> *target* state-flags) (state-flags sf04)))) + ) + ) (function "Reset Trans" #f diff --git a/test/decompiler/reference/engine/draw/process-drawable_REF.gc b/test/decompiler/reference/engine/draw/process-drawable_REF.gc index df3a15fd77..16e8a1752a 100644 --- a/test/decompiler/reference/engine/draw/process-drawable_REF.gc +++ b/test/decompiler/reference/engine/draw/process-drawable_REF.gc @@ -1096,8 +1096,8 @@ ;; definition for function process-drawable-delay-player (defbehavior process-drawable-delay-player process-drawable ((arg0 time-frame)) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -1215,11 +1215,10 @@ (else (set! s5-0 (cond ((valid? (-> s2-0 frame-group) art-joint-anim "joint-control frame-group" #t *valid-con*) - (when (not - (and (>= (the int (-> s2-0 frame-num)) 0) - (< (the int (-> s2-0 frame-num)) (-> s2-0 frame-group data 0 length)) - ) - ) + (when (not (and (>= (the int (-> s2-0 frame-num)) 0) + (< (the int (-> s2-0 frame-num)) (-> s2-0 frame-group data 0 length)) + ) + ) (format *valid-con* "ERROR: ~`joint-control-channel`P #~D has an invalid frame-num ~F/~D [0-~D]~%" diff --git a/test/decompiler/reference/engine/game/collectables-part_REF.gc b/test/decompiler/reference/engine/game/collectables-part_REF.gc index 27045dbdf7..8fa1296c19 100644 --- a/test/decompiler/reference/engine/game/collectables-part_REF.gc +++ b/test/decompiler/reference/engine/game/collectables-part_REF.gc @@ -4,7 +4,7 @@ ;; definition for function eco-fadeout ;; INFO: Return type mismatch int vs none. (defun eco-fadeout ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) - (if (zero? (logand (-> (the-as process-drawable (-> arg1 key proc)) state-flags) 1)) + (if (zero? (logand (-> (the-as process-drawable (-> arg1 key proc)) state-flags) (state-flags sf00))) (set! (-> arg1 next-time) (the-as uint (* (-> *sp-frame-time* x) 2))) ) 0 @@ -20,7 +20,7 @@ (set! (-> arg2 y) (-> a0-3 world-sphere y)) (set! (-> arg2 z) (-> a0-3 world-sphere z)) ) - (if (zero? (logand (-> v1-1 state-flags) 1)) + (if (zero? (logand (-> v1-1 state-flags) (state-flags sf00))) (set! (-> arg1 next-time) (the-as uint (* (-> *sp-frame-time* x) 2))) ) ) diff --git a/test/decompiler/reference/engine/game/collectables_REF.gc b/test/decompiler/reference/engine/game/collectables_REF.gc index a857724e62..b529906023 100644 --- a/test/decompiler/reference/engine/game/collectables_REF.gc +++ b/test/decompiler/reference/engine/game/collectables_REF.gc @@ -200,60 +200,28 @@ (set! (-> obj collect-effect) (-> *part-group-id-table* 68)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 57)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "yel-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "yel-eco-idle" :fo-max 15)) ) (((pickup-type eco-red)) (set! (-> obj eco-effect) (-> *part-group-id-table* 48)) (set! (-> obj collect-effect) (-> *part-group-id-table* 69)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 49)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "red-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "red-eco-idle" :fo-max 15)) ) (((pickup-type eco-blue)) (set! (-> obj eco-effect) (-> *part-group-id-table* 42)) (set! (-> obj collect-effect) (-> *part-group-id-table* 67)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 43)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "blue-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "blue-eco-idle" :fo-max 15)) ) (((pickup-type eco-green)) (set! (-> obj eco-effect) (-> *part-group-id-table* 58)) (set! (-> obj collect-effect) (-> *part-group-id-table* 66)) (set! (-> obj collect-effect2) (-> *part-group-id-table* 61)) (set! (-> obj collect-effect-time) (seconds 0.5)) - (set! (-> obj sound-name) (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "green-eco-idle") - :volume #x400 - :fo-max 15 - ) - ) + (set! (-> obj sound-name) (static-sound-spec "green-eco-idle" :fo-max 15)) ) (((pickup-type eco-pill)) (set! (-> obj eco-effect) (-> *part-group-id-table* 59)) @@ -681,7 +649,7 @@ (logclear! (-> self mask) (process-mask actor-pause)) (set! (-> self actor-pause) #f) (logior! (-> self flags) (collectable-flags fading)) - (logior! (-> self state-flags) 1) + (logior! (-> self state-flags) (state-flags sf00)) (set! (-> gp-0 fade) (* 0.0033333334 (the float v1-10))) ) ) @@ -1664,7 +1632,7 @@ (not *progress-process*) (!= (-> self next-state name) 'pickup) *target* - (zero? (logand (-> *target* state-flags) #x8100)) + (zero? (logand (-> *target* state-flags) (state-flags sf08 sf15))) ) ) ) @@ -1810,13 +1778,12 @@ (set! (-> self state-object) #f) (kill-and-free-particles (-> self part)) (logior! (-> self draw status) (draw-status skip-bones)) - (if (not - (or (logtest? (the-as int (res-lump-value (-> self entity) 'options uint128 :time (the-as float -1000000000.0))) - 4096 - ) - (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9))) - ) - ) + (if (not (or (logtest? (res-lump-value (-> self entity) 'options fact-options :time (the-as float -1000000000.0)) + (fact-options powerup) + ) + (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-9))) + ) + ) (send-event *camera* 'teleport-to-other-start-string) ) ) @@ -2257,19 +2224,8 @@ (set! (-> obj base quad) (-> obj root-override trans quad)) (set! (-> obj old-base quad) (-> obj root-override trans quad)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 63) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "powercell-idle") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "powercell-idle" :fo-max 40) (-> obj root-override trans)) ) (set! (-> obj victory-anim) (fuel-cell-pick-anim obj)) obj @@ -2318,11 +2274,10 @@ (go-virtual jump) ) ((and gp-1 - (zero? - (logand (the-as int (res-lump-value (-> self entity) 'options uint128 :time (the-as float -1000000000.0))) - 128 - ) - ) + (zero? (logand (res-lump-value (-> self entity) 'options fact-options :time (the-as float -1000000000.0)) + (fact-options fop7) + ) + ) (zero? (logand (-> self fact options) (fact-options fop7))) ) (set! (-> self jump-pos quad) (-> (the-as vector gp-1) quad)) @@ -2636,19 +2591,8 @@ (set! (-> obj fact) (new 'process 'fact-info obj (pickup-type buzzer) (the-as float 0.0))) (initialize-skeleton obj *buzzer-sg* '()) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 65) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "buzzer") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "buzzer" :fo-max 40) (-> obj root-override trans)) ) (set! (-> obj victory-anim) (fuel-cell-pick-anim obj)) obj diff --git a/test/decompiler/reference/engine/game/crates_REF.gc b/test/decompiler/reference/engine/game/crates_REF.gc index dfbd4b2c8a..3161f9a985 100644 --- a/test/decompiler/reference/engine/game/crates_REF.gc +++ b/test/decompiler/reference/engine/game/crates_REF.gc @@ -584,9 +584,8 @@ ) (else (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y))) - (if (not - (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese))) - ) + (if (not (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese))) + ) (level-hint-spawn (game-text-id sage-voicebox-hint-crate-iron) "sagevb36" @@ -1472,15 +1471,7 @@ (set! (-> obj sound) (new 'process 'ambient-sound - (new 'static 'sound-spec - :mask #x82 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "buzzer") - :volume #x400 - :pitch-mod -762 - :fo-max 40 - ) + (static-sound-spec "buzzer" :pitch-mod -762 :fo-max 40) (-> obj root-override trans) ) ) diff --git a/test/decompiler/reference/engine/game/effect-control_REF.gc b/test/decompiler/reference/engine/game/effect-control_REF.gc index 63bba2302e..bdee61c778 100644 --- a/test/decompiler/reference/engine/game/effect-control_REF.gc +++ b/test/decompiler/reference/engine/game/effect-control_REF.gc @@ -82,39 +82,39 @@ (while (> arg2 0) (case (the int (-> arg1 0)) ((3) - (logior! (-> arg0 mask) 1) + (logior! (-> arg0 mask) (sound-mask volume)) (set! (-> arg0 volume) (the int (* 10.24 (-> arg1 1)))) ) ((4) - (logior! (-> arg0 mask) 1) + (logior! (-> arg0 mask) (sound-mask volume)) (+! (-> arg0 volume) (the int (* 10.24 (* (-> arg1 1) (rand-vu))))) ) ((5) - (logior! (-> arg0 mask) 2) + (logior! (-> arg0 mask) (sound-mask pitch)) (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) ) ((6) - (logior! (-> arg0 mask) 2) + (logior! (-> arg0 mask) (sound-mask pitch)) (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) ) ((9) - (logior! (-> arg0 mask) 4) + (logior! (-> arg0 mask) (sound-mask bend)) (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) ) ((10) - (logior! (-> arg0 mask) 4) + (logior! (-> arg0 mask) (sound-mask bend)) (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) ) ((11) - (logior! (-> arg0 mask) 64) + (logior! (-> arg0 mask) (sound-mask fo-min)) (set! (-> arg0 fo-min) (the int (-> arg1 1))) ) ((12) - (logior! (-> arg0 mask) 128) + (logior! (-> arg0 mask) (sound-mask fo-max)) (set! (-> arg0 fo-max) (the int (-> arg1 1))) ) ((13) - (logior! (-> arg0 mask) 256) + (logior! (-> arg0 mask) (sound-mask fo-curve)) (set! (-> arg0 fo-curve) (the int (-> arg1 1))) ) ((19) @@ -1090,9 +1090,9 @@ ) ) (set! (-> gp-0 sound-name) s0-0) - (logior! (-> gp-0 mask) 1) + (logior! (-> gp-0 mask) (sound-mask volume)) (set! (-> gp-0 volume) 1024) - (logior! (-> gp-0 mask) 4) + (logior! (-> gp-0 mask) (sound-mask bend)) (set! (-> gp-0 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0)))) (set! sv-112 (new 'static 'res-tag)) (let* ((t9-3 (method-of-type res-lump get-property-data)) @@ -1165,7 +1165,7 @@ #t ) ) - ((logtest? (-> self water flags) 512) + ((logtest? (-> self water flags) (water-flags wt09)) (dummy-10 (-> self skel effect) 'effect-land-water -1.0 -1) ) (else diff --git a/test/decompiler/reference/engine/game/game-h_REF.gc b/test/decompiler/reference/engine/game/game-h_REF.gc index 273b6c2fcb..ff1079a783 100644 --- a/test/decompiler/reference/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/engine/game/game-h_REF.gc @@ -16,7 +16,7 @@ (part sparticle-launch-control :offset-assert 152) (water water-control :offset-assert 156) (sound ambient-sound :offset-assert 160) - (state-flags uint32 :offset-assert 164) + (state-flags state-flags :offset-assert 164) (state-time time-frame :offset-assert 168) ) :heap-base #x40 diff --git a/test/decompiler/reference/engine/game/generic-obs_REF.gc b/test/decompiler/reference/engine/game/generic-obs_REF.gc index a299617fdb..6fd65ecbd5 100644 --- a/test/decompiler/reference/engine/game/generic-obs_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs_REF.gc @@ -2185,7 +2185,7 @@ (set! (-> v1-0 parms volume) -4) (set! (-> v1-0 auto-time) 120) (set! (-> v1-0 auto-from) 2) - (set! (-> v1-0 parms mask) (the-as uint 17)) + (set! (-> v1-0 parms mask) (sound-mask volume time)) (-> v1-0 id) ) (none) diff --git a/test/decompiler/reference/engine/game/powerups_REF.gc b/test/decompiler/reference/engine/game/powerups_REF.gc index 7126c1c6d1..cbe49060f0 100644 --- a/test/decompiler/reference/engine/game/powerups_REF.gc +++ b/test/decompiler/reference/engine/game/powerups_REF.gc @@ -674,7 +674,7 @@ (set! (-> v1-64 parms volume) -4) (set! (-> v1-64 auto-time) 48) (set! (-> v1-64 auto-from) 2) - (set! (-> v1-64 parms mask) (the-as uint 17)) + (set! (-> v1-64 parms mask) (sound-mask volume time)) (-> v1-64 id) ) ) @@ -693,12 +693,12 @@ ) (set! (-> self fact-info-target eco-level) 0.0) (set! (-> self fact-info-target eco-timeout) 0) - (set! (-> self state-flags) (logand -65 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf06)) (send-event self 'reset-collide) (stop! (-> self sound)) ) (when (and (< 0.0 (-> self fact-info-target eco-level)) - (zero? (logand (-> self state-flags) 512)) + (zero? (logand (-> self state-flags) (state-flags sf09))) (zero? (logand (-> self draw status) (draw-status hidden no-anim))) (not (movie?)) (rand-vu-percent? @@ -786,7 +786,9 @@ (change-sound! (-> self sound) (static-sound-name "blue-eco-jak")) (let ((v1-150 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) (cond - ((and (logtest? (-> self control unknown-surface00 flags) 2048) (zero? (logand (-> self control status) 1))) + ((and (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) (set! (-> *part-id-table* 259 init-specs 4 initial-valuef) 0.0) (set! (-> *part-id-table* 259 init-specs 4 random-rangef) 65536.0) ) diff --git a/test/decompiler/reference/engine/game/projectiles_REF.gc b/test/decompiler/reference/engine/game/projectiles_REF.gc index 7eb7336104..f552efd8c1 100644 --- a/test/decompiler/reference/engine/game/projectiles_REF.gc +++ b/test/decompiler/reference/engine/game/projectiles_REF.gc @@ -117,7 +117,7 @@ ) ;; definition for function projectile-collision-reaction -;; INFO: Return type mismatch int vs uint. +;; INFO: Return type mismatch int vs cshape-moving-flags. ;; Used lq/sq (defun projectile-collision-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) (local-vars (sv-64 vector) (sv-68 vector) (sv-72 matrix) (sv-80 int) (sv-224 symbol)) @@ -159,7 +159,7 @@ (set! sv-80 (logior sv-80 16)) ) (set! sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (zero? (logand (-> arg0 prev-status) 1)) + (if (zero? (logand (-> arg0 prev-status) (cshape-moving-flags onsurf))) (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) ) (set! sv-80 (logior sv-80 4)) @@ -187,7 +187,7 @@ ) ) (logior! (-> arg0 status) sv-80) - (the-as uint sv-80) + (the-as cshape-moving-flags sv-80) ) ;; failed to figure out what this is: @@ -767,7 +767,9 @@ (countdown (v1-35 16) (+! f0-16 (-> self old-dist v1-35)) ) - (if (or (and (logtest? (-> self root-override status) 8) (< f0-16 2048.0)) (< f0-16 204.8)) + (if (or (and (logtest? (-> self root-override status) (cshape-moving-flags twall)) (< f0-16 2048.0)) + (< f0-16 204.8) + ) (set! gp-0 #t) ) ) @@ -792,7 +794,7 @@ (s3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) (f30-0 (vector-length (-> arg0 root-override transv))) ) - (if (logtest? (-> arg0 root-override status) 4) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags tsurf)) (vector-flatten! s5-1 s5-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s5-1 1.0) @@ -1051,7 +1053,7 @@ (case (-> *target* current-level name) (('swamp) (set! (-> obj water) (new 'process 'water-control obj 0 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water flags) (water-flags wt01 wt04 wt07)) (set! (-> obj water height) (if (logtest? (-> obj options) 64) 8192.0 10240.0 @@ -1062,7 +1064,7 @@ (('ogre) (when (zero? (logand (-> obj options) 128)) (set! (-> obj water) (new 'process 'water-control obj 0 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water flags) (water-flags wt01 wt04 wt07)) (set! (-> obj water height) 129024.0) (logior! (-> obj root-override root-prim collide-with) (collide-kind water)) ) @@ -1070,7 +1072,7 @@ (('finalboss) (set! (-> obj root-override trans y) (+ 4096.0 (-> obj root-override trans y))) (set! (-> obj water) (new 'process 'water-control obj 0 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water flags) (water-flags wt01 wt04 wt07)) (set! (-> obj water height) 1977958.4) (logior! (-> obj root-override root-prim collide-with) (collide-kind water)) ) @@ -1138,7 +1140,7 @@ ) (sound-trans-convert (-> s5-0 parms trans) a1-3) ) - (set! (-> s5-0 parms mask) (the-as uint 32)) + (set! (-> s5-0 parms mask) (sound-mask trans)) (-> s5-0 id) ) 0 diff --git a/test/decompiler/reference/engine/game/task/process-taskable_REF.gc b/test/decompiler/reference/engine/game/task/process-taskable_REF.gc index 060ee414a3..fd69622499 100644 --- a/test/decompiler/reference/engine/game/task/process-taskable_REF.gc +++ b/test/decompiler/reference/engine/game/task/process-taskable_REF.gc @@ -803,7 +803,7 @@ (defbehavior process-taskable-hide-enter process-taskable () (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((v1-3 (-> self draw shadow-ctrl))) - (logior! (-> v1-3 settings flags) 32) + (logior! (-> v1-3 settings flags) (shadow-flags shdf05)) ) 0 (process-taskable-clean-up-after-talking) @@ -827,7 +827,7 @@ (restore-collide-with-as (-> self root-override)) (process-entity-status! self (entity-perm-status bit-3) #t) (let ((v1-7 (-> self draw shadow-ctrl))) - (set! (-> v1-7 settings flags) (logand -33 (-> v1-7 settings flags))) + (logclear! (-> v1-7 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -1088,11 +1088,10 @@ ) ((begin (dummy-46 self) - (and (not - (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) + (and (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) (< (-> (target-pos 0) y) (+ 8192.0 (-> self root-override root-prim prim-core world-sphere y))) (< (vector-vector-distance (target-pos 0) (the-as vector (-> self root-override root-prim prim-core))) 32768.0 @@ -1498,7 +1497,7 @@ ) (else (let ((v1-10 gp-0)) - (logior! (-> v1-10 settings flags) 32) + (logior! (-> v1-10 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/engine/gfx/shadow/shadow_REF.gc b/test/decompiler/reference/engine/gfx/shadow/shadow_REF.gc index 234508baaf..e0fe57ead0 100644 --- a/test/decompiler/reference/engine/gfx/shadow/shadow_REF.gc +++ b/test/decompiler/reference/engine/gfx/shadow/shadow_REF.gc @@ -163,7 +163,7 @@ ;; INFO: Return type mismatch int vs none. ;; Used lq/sq (defbehavior do-target-shadow target () - (if (and (logtest? (-> self control status) 1) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (!= (-> self control unknown-surface00 mode) 'swim) (!= (-> self control unknown-surface00 mode) 'dive) (!= (-> self next-state name) 'target-flop) diff --git a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc index 5fd6e2d09e..7ea656adf6 100644 --- a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc @@ -3,7 +3,7 @@ ;; definition of type water-control (deftype water-control (basic) - ((flags uint32 :offset-assert 4) + ((flags water-flags :offset-assert 4) (process process-drawable :offset-assert 8) (joint-index int32 :offset-assert 12) (top-y-offset float :offset-assert 16) @@ -96,7 +96,7 @@ ;; definition for method 14 of type water-control (defmethod display-water-marks? water-control ((obj water-control)) - (and *display-water-marks* (logtest? (-> obj flags) 1)) + (and *display-water-marks* (logtest? (-> obj flags) (water-flags wt00))) ) ;; definition for method 0 of type water-control @@ -122,13 +122,13 @@ ;; definition of type water-vol (deftype water-vol (process-drawable) - ((water-height meters :offset-assert 176) - (wade-height meters :offset-assert 180) - (swim-height meters :offset-assert 184) - (bottom-height meters :offset-assert 188) - (attack-event symbol :offset-assert 192) - (target handle :offset-assert 200) - (flags uint32 :offset-assert 208) + ((water-height meters :offset-assert 176) + (wade-height meters :offset-assert 180) + (swim-height meters :offset-assert 184) + (bottom-height meters :offset-assert 188) + (attack-event symbol :offset-assert 192) + (target handle :offset-assert 200) + (flags water-flags :offset-assert 208) ) :heap-base #x70 :method-count-assert 30 @@ -140,11 +140,11 @@ (TODO-RENAME-22 (_type_) none 22) (reset-root! (_type_) none 23) (set-stack-size! (_type_) none 24) - (TODO-RENAME-25 (_type_) object 25) + (TODO-RENAME-25 (_type_) none 25) (TODO-RENAME-26 (_type_) none 26) (dummy-27 (_type_) none 27) (get-ripple-height (_type_ vector) float 28) - (TODO-RENAME-29 (_type_) uint 29) + (TODO-RENAME-29 (_type_) none 29) ) ) diff --git a/test/decompiler/reference/engine/gfx/water/water_REF.gc b/test/decompiler/reference/engine/gfx/water/water_REF.gc index 628f988ea4..3f7a2fe469 100644 --- a/test/decompiler/reference/engine/gfx/water/water_REF.gc +++ b/test/decompiler/reference/engine/gfx/water/water_REF.gc @@ -726,11 +726,11 @@ (with-pp (let ((s5-0 (-> obj flags))) (cond - ((zero? (logand (-> obj flags) 2)) - (set! (-> obj flags) (logand -97793 (-> obj flags))) + ((zero? (logand (-> obj flags) (water-flags wt01))) + (logclear! (-> obj flags) (water-flags wt09 wt10 wt11 wt12 wt13 wt14 wt16)) ) - ((and (logtest? #x200000 (-> obj flags)) (logtest? (-> obj process state-flags) 256)) - (set! (-> obj flags) (logior #x10000 (-> obj flags))) + ((and (logtest? (water-flags wt21) (-> obj flags)) (logtest? (-> obj process state-flags) (state-flags sf08))) + (set! (-> obj flags) (logior (water-flags wt16) (-> obj flags))) ) ((begin (set! (-> obj top 1 quad) (-> obj top 0 quad)) @@ -738,28 +738,27 @@ (+! (-> obj top 0 y) (-> obj top-y-offset)) (set! (-> obj bottom 1 quad) (-> obj bottom 0 quad)) (set! (-> obj bottom 0 quad) (-> obj process root trans quad)) - (set! (-> obj flags) (logand -31745 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt10 wt11 wt12 wt13 wt14)) (set! (-> obj bob-offset) (update! (-> obj bob))) (cond - ((and (logtest? (-> obj flags) 256) - (zero? - (logand (-> (the-as collide-shape-moving (-> obj process root)) root-prim prim-core action) - (collide-action ca-9) - ) - ) + ((and (logtest? (-> obj flags) (water-flags wt08)) + (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) root-prim prim-core action) + (collide-action ca-9) + ) + ) ) (set! (-> obj real-ocean-offset) (- (ocean-get-height (the-as vector (-> obj bottom))) (-> obj base-height))) - (if (zero? (logand (-> obj flags) 512)) + (if (zero? (logand (-> obj flags) (water-flags wt09))) (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) (set! (-> obj ocean-offset) (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2)) ) ) - ((logtest? #x100000 (-> obj flags)) + ((logtest? (water-flags wt20) (-> obj flags)) (let* ((a0-26 (-> obj volume process 0)) (f30-0 (ripple-find-height (the-as process-drawable a0-26) 0 (the-as vector (-> obj bottom)))) ) (set! (-> obj real-ocean-offset) (- f30-0 (-> obj base-height))) - (if (zero? (logand (-> obj flags) 512)) + (if (zero? (logand (-> obj flags) (water-flags wt09))) (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) (set! (-> obj ocean-offset) (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2)) ) @@ -786,13 +785,13 @@ (set! (-> obj swim-depth) (fmax 0.0 (- (- (-> obj surface-height) (-> obj swim-height)) (-> obj bottom 0 y)))) (>= (-> obj height) (-> obj bottom 0 y)) ) - (if (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 1024) + (if (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags on-water)) (set! (-> obj on-water-time) (-> *display* base-frame-counter)) ) (set! (-> obj drip-wetness) 1.0) (set! (-> obj drip-height) (fmax (- (-> obj surface-height) (-> obj bottom 0 y)) (-> obj drip-height))) (set! (-> obj drip-speed) 15.0) - (if (zero? (logand (-> obj flags) 512)) + (if (zero? (logand (-> obj flags) (water-flags wt09))) (TODO-RENAME-15 obj) ) (cond @@ -803,8 +802,8 @@ (set! (-> s4-0 y) (-> obj surface-height)) (when (and (logtest? (-> obj process draw status) (draw-status was-drawn)) (zero? (-> obj process draw cur-lod)) - (logtest? #x400000 (-> obj flags)) - (logtest? #x800000 (-> obj flags)) + (logtest? (water-flags wt22) (-> obj flags)) + (logtest? (water-flags wt23) (-> obj flags)) ) (let ((f30-1 (y-angle (-> obj process root))) (f28-0 (vector-xz-length (-> obj process root transv))) @@ -859,10 +858,10 @@ ) ) (else - (logior! (-> obj flags) 8192) + (logior! (-> obj flags) (water-flags wt13)) ) ) - (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (when (and (logtest? (-> obj flags) (water-flags wt05)) (logtest? (water-flags wt23) (-> obj flags))) (let* ((v1-124 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) (s4-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data v1-124))) ) @@ -907,22 +906,25 @@ ) ) ) - (if (and (logtest? (-> obj flags) 16) - (and s4-3 (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) 1024))) + (if (and (logtest? (-> obj flags) (water-flags wt04)) + (and s4-3 + (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags on-water)) + ) + ) ) (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) ) (cond - ((and (logtest? (-> obj flags) 8) - (or (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 1024) + ((and (logtest? (-> obj flags) (water-flags wt03)) + (or (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags on-water)) (>= f30-3 (-> obj bottom 0 y)) - (and (logtest? s5-0 2048) - (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 4) - (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) 1)) + (and (logtest? s5-0 (water-flags wt11)) + (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags tsurf)) + (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags onsurf))) (>= (+ 204.8 f30-3) (-> obj bottom 0 y)) ) ) - (or (logtest? s5-0 2048) + (or (logtest? s5-0 (water-flags wt11)) (< 12288.0 (vector-xz-length (-> obj process root transv))) (< (+ (-> *display* base-frame-counter) (seconds -0.2)) (-> obj enter-water-time)) (>= (+ (- 204.8 (fmin 6144.0 (+ (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)))) f30-3) @@ -932,39 +934,39 @@ ) (set! (-> obj swim-time) (-> *display* base-frame-counter)) (send-event (-> obj process) 'swim) - (logior! (-> obj flags) 2048) - (if (zero? (logand s5-0 2048)) + (logior! (-> obj flags) (water-flags wt11)) + (if (zero? (logand s5-0 (water-flags wt11))) (set! (-> obj enter-swim-time) (-> *display* base-frame-counter)) ) (cond - ((and (logtest? (-> obj flags) 16) - (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 4) - (zero? (logand #x10000 (-> obj flags))) + ((and (logtest? (-> obj flags) (water-flags wt04)) + (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) (cshape-moving-flags tsurf)) + (zero? (logand (water-flags wt16) (-> obj flags))) ) (let ((v1-200 (new 'stack-no-clear 'vector))) (set! (-> v1-200 quad) (-> obj bottom 0 quad)) (set! (-> v1-200 y) (- (-> obj height) (-> obj swim-height))) (let ((s4-4 (-> obj process root))) - (when (and (zero? (logand (-> (the-as collide-shape-moving s4-4) status) 4096)) - (logtest? (-> obj flags) 2048) + (when (and (zero? (logand (-> (the-as collide-shape-moving s4-4) status) (cshape-moving-flags csmf12))) + (logtest? (-> obj flags) (water-flags wt11)) (zero? (logand (-> (the-as collide-shape-moving s4-4) root-prim prim-core action) (collide-action ca-9))) ) (let ((a1-27 (vector-! (new 'stack-no-clear 'vector) v1-200 (-> s4-4 trans)))) (vector-float*! a1-27 a1-27 (-> *display* frames-per-second)) (integrate-and-collide! (the-as collide-shape-moving s4-4) a1-27) ) - (logior! (-> (the-as collide-shape-moving s4-4) status) 1031) + (logior! (-> (the-as collide-shape-moving s4-4) status) (cshape-moving-flags onsurf onground tsurf on-water)) ) ) ) ) - ((and (< (-> obj bottom 0 y) f30-3) (zero? (logand #x10000 (-> obj flags)))) - (logior! (-> obj flags) 4096) + ((and (< (-> obj bottom 0 y) f30-3) (zero? (logand (water-flags wt16) (-> obj flags)))) + (logior! (-> obj flags) (water-flags wt12)) ) ) ) ((begin - (set! s4-3 (and (logtest? (-> obj flags) 4) + (set! s4-3 (and (logtest? (-> obj flags) (water-flags wt02)) (or (not (!= (-> obj bob amp) 0.0)) (>= (- (-> *display* base-frame-counter) (-> obj swim-time)) (seconds 0.05)) ) @@ -975,15 +977,15 @@ ) (set! (-> obj wade-time) (-> *display* base-frame-counter)) (send-event (-> obj process) 'wade) - (logior! (-> obj flags) 1024) + (logior! (-> obj flags) (water-flags wt10)) ) ) ) - (when (and (logtest? (-> obj flags) 8) + (when (and (logtest? (-> obj flags) (water-flags wt03)) (< (-> obj bottom 1 y) f30-3) - (and (< f30-3 (-> obj bottom 0 y)) (logtest? s5-0 4096)) + (and (< f30-3 (-> obj bottom 0 y)) (logtest? s5-0 (water-flags wt12))) ) - (logior! (-> obj flags) 2048) + (logior! (-> obj flags) (water-flags wt11)) (let ((a1-30 (new 'stack-no-clear 'vector))) (set! (-> a1-30 quad) (-> obj bottom 0 quad)) (let ((s5-1 (-> obj process root))) @@ -991,7 +993,7 @@ (when (zero? (logand (-> (the-as collide-shape-moving s5-1) root-prim prim-core action) (collide-action ca-9))) (let ((f30-4 (-> (the-as collide-shape-moving s5-1) ground-impact-vel))) (move-to-ground-point! (the-as collide-shape-moving s5-1) a1-30 (-> s5-1 transv) *up-vector*) - (logior! (-> (the-as collide-shape-moving s5-1) status) 1024) + (logior! (-> (the-as collide-shape-moving s5-1) status) (cshape-moving-flags on-water)) (set! (-> (the-as collide-shape-moving s5-1) ground-impact-vel) f30-4) ) ) @@ -999,8 +1001,10 @@ ) ) ) - (when (and (logtest? #x20000 (-> obj flags)) (= (-> obj process type) target)) - (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) 1025) + (when (and (logtest? (water-flags wt17) (-> obj flags)) (= (-> obj process type) target)) + (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process root)) status) + (cshape-moving-flags onsurf on-water) + ) (zero? (logand (-> (the-as collide-shape-moving (-> obj process root)) root-prim prim-core action) (collide-action ca-9) ) @@ -1055,17 +1059,19 @@ ) ) (else - (if (logtest? (-> obj flags) 512) + (if (logtest? (-> obj flags) (water-flags wt09)) (TODO-RENAME-16 obj) ) ) ) ) - (when (not - (or (zero? (logand (-> obj flags) 64)) (zero? (logand #x800000 (-> obj flags))) (= (-> obj drip-wetness) 0.0)) - ) + (when (not (or (zero? (logand (-> obj flags) (water-flags wt06))) + (zero? (logand (water-flags wt23) (-> obj flags))) + (= (-> obj drip-wetness) 0.0) + ) + ) (cond - ((logtest? (-> obj flags) #x8000) + ((logtest? (-> obj flags) (water-flags wt15)) (let ((a2-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data (-> obj drip-joint-index))) ) @@ -1086,7 +1092,7 @@ ) ) (set! (-> obj drip-time) (-> *display* base-frame-counter)) - (set! (-> obj flags) (logand -32769 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt15)) (seek! (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) (if (= (-> obj drip-wetness) 0.0) @@ -1106,7 +1112,7 @@ ) (set! (-> obj drip-joint-index) s5-2) (set! (-> obj drip-old-pos quad) (-> v1-328 quad)) - (logior! (-> obj flags) #x8000) + (logior! (-> obj flags) (water-flags wt15)) ) ) ) @@ -1222,11 +1228,11 @@ ;; INFO: Return type mismatch int vs none. (defmethod TODO-RENAME-15 water-control ((obj water-control)) (with-pp - (logior! (-> obj flags) 512) - (set! (-> obj flags) (logand -65537 (-> obj flags))) + (logior! (-> obj flags) (water-flags wt09)) + (logclear! (-> obj flags) (water-flags wt16)) (set! (-> obj enter-water-time) (-> *display* base-frame-counter)) (set-vector! (-> obj enter-water-pos) (-> obj bottom 0 x) (-> obj surface-height) (-> obj bottom 0 z) 1.0) - (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (when (and (logtest? (-> obj flags) (water-flags wt05)) (logtest? (water-flags wt23) (-> obj flags))) (let ((a1-1 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-1 from) pp) (set! (-> a1-1 num-params) 1) @@ -1242,7 +1248,7 @@ ) ) ) - (if (logtest? #x20000 (-> obj flags)) + (if (logtest? (water-flags wt17) (-> obj flags)) (set! (-> obj swim-height) 2867.2) ) 0 @@ -1253,9 +1259,9 @@ ;; definition for method 16 of type water-control ;; INFO: Return type mismatch int vs none. (defmethod TODO-RENAME-16 water-control ((obj water-control)) - (set! (-> obj flags) (logand -513 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt09)) (set-zero! (-> obj bob)) - (if (logtest? #x20000 (-> obj flags)) + (if (logtest? (water-flags wt17) (-> obj flags)) (set! (-> obj swim-height) 2867.2) ) 0 @@ -1293,7 +1299,7 @@ ;; definition for method 13 of type water-control ;; INFO: Return type mismatch int vs none. (defmethod dummy-13 water-control ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector)) - (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (when (and (logtest? (-> obj flags) (water-flags wt05)) (logtest? (water-flags wt23) (-> obj flags))) (let ((a1-3 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) (set! (-> a1-3 y) (-> obj surface-height)) (splash-spawn (the-as basic arg0) (the-as basic a1-3) arg2) @@ -1308,7 +1314,7 @@ (defmethod dummy-27 water-vol ((obj water-vol)) (when (handle->process (-> obj target)) (let ((v1-7 (-> (the-as target (-> obj target process 0)) water))) - (set! (-> v1-7 flags) (logand -129892623 (-> v1-7 flags))) + (logclear! (-> v1-7 flags) (water-flags wt01 wt02 wt03 wt08 wt17 wt18 wt19 wt20 wt21 wt23 wt24 wt25 wt26)) (set! (-> v1-7 volume) (the-as handle #f)) ) (set! (-> obj target) (the-as handle #f)) @@ -1340,8 +1346,8 @@ ) (else (let ((v1-15 (-> (the-as target (-> obj target process 0)) water))) - (when (and (logtest? #x80000 (-> obj flags)) - (logtest? (-> v1-15 flags) 512) + (when (and (logtest? (water-flags wt19) (-> obj flags)) + (logtest? (-> v1-15 flags) (water-flags wt09)) (>= (-> v1-15 surface-height) (-> v1-15 bottom 0 y)) ) (let ((v1-18 (-> obj attack-event))) @@ -1395,7 +1401,7 @@ (process-entity-status! obj (entity-perm-status bit-3) #t) (set! (-> s5-0 volume) (process->handle obj)) (set! (-> obj target) (process->handle *target*)) - (logior! (-> s5-0 flags) 2) + (logior! (-> s5-0 flags) (water-flags wt01)) (set! (-> s5-0 base-height) (-> obj water-height)) (set! (-> s5-0 ocean-offset) 0.0) (logior! (-> s5-0 flags) (-> obj flags)) @@ -1467,13 +1473,14 @@ ) ;; definition for method 25 of type water-vol -;; INFO: Return type mismatch int vs object. +;; INFO: Return type mismatch int vs none. (defmethod TODO-RENAME-25 water-vol ((obj water-vol)) - (the-as object 0) + 0 + (none) ) ;; definition for method 29 of type water-vol -;; WARN: disable def twice: 85. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; INFO: Return type mismatch water-flags vs none. ;; Used lq/sq (defmethod TODO-RENAME-29 water-vol ((obj water-vol)) (local-vars (sv-16 res-tag)) @@ -1512,30 +1519,27 @@ (set! (-> obj wade-height) (-> v1-8 1)) (set! (-> obj swim-height) (-> v1-8 2)) (if (>= (-> sv-16 elt-count) (the-as uint 4)) - (set! (-> obj flags) (the-as uint (the int (-> v1-8 3)))) + (set! (-> obj flags) (the-as water-flags (the int (-> v1-8 3)))) ) (if (>= (-> sv-16 elt-count) (the-as uint 5)) (set! (-> obj bottom-height) (-> v1-8 4)) ) ) ) - (set! (-> obj flags) (logior #x800000 (-> obj flags))) + (set! (-> obj flags) (logior (water-flags wt23) (-> obj flags))) (cond ((zero? (-> obj flags)) (if (< 0.0 (-> obj wade-height)) - (logior! (-> obj flags) 4) + (logior! (-> obj flags) (water-flags wt02)) ) - (when (< 0.0 (-> obj swim-height)) - (let ((v0-4 (logior (-> obj flags) 8))) - (set! (-> obj flags) v0-4) - v0-4 + (if (< 0.0 (-> obj swim-height)) + (logior! (-> obj flags) (water-flags wt03)) ) - ) ) (else - (the-as uint #f) ) ) + (none) ) ;; definition for method 22 of type water-vol diff --git a/test/decompiler/reference/engine/nav/navigate_REF.gc b/test/decompiler/reference/engine/nav/navigate_REF.gc index 3f06085620..605781ce33 100644 --- a/test/decompiler/reference/engine/nav/navigate_REF.gc +++ b/test/decompiler/reference/engine/nav/navigate_REF.gc @@ -2124,7 +2124,9 @@ (s3-0 (new 'stack-no-clear 'vector)) ) (when (and *target* - (or (logtest? (-> obj flags) (nav-control-flags navcf11)) (logtest? (-> *target* state-flags) #x80f8)) + (or (logtest? (-> obj flags) (nav-control-flags navcf11)) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) + ) ) (let ((s2-0 obj) (s1-0 (-> *target* control)) diff --git a/test/decompiler/reference/engine/sound/gsound-h_REF.gc b/test/decompiler/reference/engine/sound/gsound-h_REF.gc index e52aae617e..ee1ebffb14 100644 --- a/test/decompiler/reference/engine/sound/gsound-h_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound-h_REF.gc @@ -50,16 +50,16 @@ ;; definition of type sound-play-parms (deftype sound-play-parms (structure) - ((mask uint16 :offset-assert 0) - (pitch-mod int16 :offset-assert 2) - (bend int16 :offset-assert 4) - (fo-min int16 :offset-assert 6) - (fo-max int16 :offset-assert 8) - (fo-curve int8 :offset-assert 10) - (priority int8 :offset-assert 11) - (volume int32 :offset-assert 12) - (trans vector3w :inline :offset-assert 16) - (group uint8 :offset-assert 28) + ((mask sound-mask :offset-assert 0) + (pitch-mod int16 :offset-assert 2) + (bend int16 :offset-assert 4) + (fo-min int16 :offset-assert 6) + (fo-max int16 :offset-assert 8) + (fo-curve int8 :offset-assert 10) + (priority int8 :offset-assert 11) + (volume int32 :offset-assert 12) + (trans vector3w :inline :offset-assert 16) + (group uint8 :offset-assert 28) ) :pack-me :method-count-assert 9 @@ -636,7 +636,7 @@ ;; definition of type sound-spec (deftype sound-spec (basic) - ((mask uint16 :offset-assert 4) + ((mask sound-mask :offset-assert 4) (num float :offset-assert 8) (group uint8 :offset-assert 12) (sound-name sound-name :offset 16) diff --git a/test/decompiler/reference/engine/sound/gsound_REF.gc b/test/decompiler/reference/engine/sound/gsound_REF.gc index cb6acfa28d..c524ece89f 100644 --- a/test/decompiler/reference/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound_REF.gc @@ -450,7 +450,7 @@ (set! (-> cmd command) (sound-command play)) (set! (-> cmd id) id) (set! (-> cmd name) name) - (set! (-> cmd parms mask) (the-as uint 0)) + (set! (-> cmd parms mask) (sound-mask)) (set! (-> cmd parms group) (the-as uint sv-16)) (set! (-> cmd parms volume) vol) (set! (-> cmd parms pitch-mod) pitch) @@ -688,10 +688,10 @@ (set! (-> obj volume) 1024) (set! (-> obj pitch) 0) (when (and sv-16 (!= sv-16 *ambient-spec*)) - (if (logtest? (-> (the-as sound-spec sv-16) mask) 1) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) (set! (-> obj volume) (-> (the-as sound-spec sv-16) volume)) ) - (if (logtest? (-> (the-as sound-spec sv-16) mask) 2) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) (set! (-> obj pitch) (-> (the-as sound-spec sv-16) pitch-mod)) ) ) @@ -738,7 +738,7 @@ (set! (-> spec bend) 0) (set! (-> spec sound-name) (-> obj name)) (set! (-> spec fo-max) (-> obj falloff-far)) - (set! (-> spec mask) (the-as uint 0)) + (set! (-> spec mask) (sound-mask)) (if (-> obj params) (effect-param->sound-spec spec (-> obj params) (-> obj param-count)) ) @@ -827,7 +827,7 @@ ) ) (sound-trans-convert (-> cmd parms trans) arg0) - (set! (-> cmd parms mask) (the-as uint 32)) + (set! (-> cmd parms mask) (sound-mask trans)) (-> cmd id) ) ) @@ -842,7 +842,7 @@ (set! (-> cmd command) (sound-command set-param)) (set! (-> cmd id) (-> obj playing-id)) (set! (-> cmd parms volume) (the int (* 10.24 (the float arg0)))) - (set! (-> cmd parms mask) (the-as uint 1)) + (set! (-> cmd parms mask) (sound-mask volume)) (-> cmd id) ) ) diff --git a/test/decompiler/reference/engine/target/logic-target_REF.gc b/test/decompiler/reference/engine/target/logic-target_REF.gc index 19092c75ca..d147bfb914 100644 --- a/test/decompiler/reference/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/engine/target/logic-target_REF.gc @@ -19,7 +19,7 @@ ) (let ((s5-0 (new-stack-vector0))) (vector-z-quaternion! s5-0 (-> self control unknown-quaternion00)) - (when (logtest? (-> self control unknown-surface00 flags) 2) + (when (logtest? (-> self control unknown-surface00 flags) (surface-flags surf01)) (vector-flatten! s5-0 s5-0 (-> self control dynam gravity-normal)) (vector-normalize! s5-0 1.0) ) @@ -50,13 +50,12 @@ ) ;; definition for function reverse-conversions +;; INFO: Return type mismatch cshape-moving-flags vs none. (defbehavior reverse-conversions target ((arg0 vector)) (set! (-> self control unknown-float01) (vector-xz-length (-> self control unknown-vector00))) (vector-matrix*! arg0 (-> self control unknown-vector00) (-> self control unknown-matrix01)) - (let ((v0-2 (-> self control status))) - (set! (-> self control old-status) v0-2) - v0-2 - ) + (set! (-> self control old-status) (-> self control status)) + (none) ) ;; definition (debug) for function draw-history @@ -108,7 +107,7 @@ (meters 0.000024414063) (the-as rgba (+ #x408040 (shl s4-0 24))) ) - (when (zero? (logand (-> s2-0 status) 256)) + (when (zero? (logand (-> s2-0 status) (cshape-moving-flags csmf08))) (add-debug-line (logtest? s5-0 1) (bucket-id debug-no-zbuf) @@ -168,7 +167,7 @@ #t "~6D ~8S #x~8X " (-> s4-0 time) - (if (logtest? (-> s4-0 status) 256) + (if (logtest? (-> s4-0 status) (cshape-moving-flags csmf08)) "air" (-> *pat-mode-info* (-> s4-0 pat mode) name) ) @@ -177,19 +176,19 @@ (format #t "~C~C~C~C~C~C" - (if (zero? (logand s3-0 1)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf00))) 103 87 ) - (if (zero? (logand s3-0 2)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf01))) 103 87 ) (cond - ((logtest? s3-0 2048) + ((logtest? s3-0 (cshape-reaction-flags csrf11)) 71 ) - ((zero? (logand s3-0 4)) + ((zero? (logand s3-0 (cshape-reaction-flags csrf02))) 103 ) (else @@ -197,21 +196,21 @@ ) ) (cond - ((logtest? s3-0 512) + ((logtest? s3-0 (cshape-reaction-flags csrf09)) 66 ) - ((logtest? s3-0 8) + ((logtest? s3-0 (cshape-reaction-flags csrf03)) 76 ) (else 99 ) ) - (if (zero? (logand s3-0 16)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf04))) 110 66 ) - (if (zero? (logand s3-0 32)) + (if (zero? (logand s3-0 (cshape-reaction-flags csrf05))) 103 65 ) @@ -219,18 +218,18 @@ (format #t "~C~C " - (if (logtest? s3-0 64) + (if (logtest? s3-0 (cshape-reaction-flags csrf06)) 78 95 ) (cond - ((logtest? s3-0 1024) + ((logtest? s3-0 (cshape-reaction-flags csrf10)) 76 ) - ((logtest? s3-0 256) + ((logtest? s3-0 (cshape-reaction-flags csrf08)) 67 ) - ((logtest? s3-0 128) + ((logtest? s3-0 (cshape-reaction-flags csrf07)) 108 ) (else @@ -329,31 +328,31 @@ (format arg1 "~0k~9S ~9S ~9S ~9S ~9S ~9S~%" - (if (logtest? (-> arg0 control status) 1) + (if (logtest? (-> arg0 control status) (cshape-moving-flags onsurf)) "on-surface" "" ) - (if (logtest? (-> arg0 control status) 2) + (if (logtest? (-> arg0 control status) (cshape-moving-flags onground)) "on-ground" "" ) - (if (logtest? (-> arg0 control status) 4) + (if (logtest? (-> arg0 control status) (cshape-moving-flags tsurf)) "t-surface" "" ) - (if (logtest? (-> arg0 control status) 8) + (if (logtest? (-> arg0 control status) (cshape-moving-flags twall)) "t-wall" "" ) - (if (logtest? (-> arg0 control status) 32) + (if (logtest? (-> arg0 control status) (cshape-moving-flags t-act)) "t-act" "" ) (cond - ((logtest? (-> arg0 control status) 16) + ((logtest? (-> arg0 control status) (cshape-moving-flags t-ciel)) "t-ceil" ) - ((logtest? (-> arg0 control status) 1024) + ((logtest? (-> arg0 control status) (cshape-moving-flags on-water)) "on-water" ) (else @@ -368,24 +367,24 @@ "in water ~A at ~M ~5S ~5S ~5S ~5S " (-> v1-49 name) (-> arg0 water height) - (if (logtest? (-> arg0 water flags) 512) + (if (logtest? (-> arg0 water flags) (water-flags wt09)) "water" "" ) - (if (logtest? (-> arg0 water flags) 1024) + (if (logtest? (-> arg0 water flags) (water-flags wt10)) "wade" "" ) - (if (logtest? (-> arg0 water flags) 2048) + (if (logtest? (-> arg0 water flags) (water-flags wt11)) "swim" "" ) - (if (logtest? (-> arg0 water flags) 4096) + (if (logtest? (-> arg0 water flags) (water-flags wt12)) "under" "" ) ) - (format arg1 "~2S~%" (if (logtest? (-> arg0 water flags) 16) + (format arg1 "~2S~%" (if (logtest? (-> arg0 water flags) (water-flags wt04)) "sg" "" ) @@ -569,7 +568,7 @@ (let ((f1-1 (* 0.0625 f1-0))) (set! (-> self control unknown-int10) a0-3) (set! (-> self control unknown-float100) f1-1) - (if (logtest? (-> self control unknown-surface01 flags) 8) + (if (logtest? (-> self control unknown-surface01 flags) (surface-flags surf03)) (set! (-> v1-6 0) (the-as uint (-> *display* base-frame-counter))) ) (and (>= (the-as uint (- (-> *display* base-frame-counter) (the-as int (-> v1-6 0)))) (the-as uint 300)) @@ -578,7 +577,7 @@ (< 0.7 (-> self control unknown-float20)) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword20)) (seconds 0.3)) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword21)) (seconds 0.3)) - (logtest? (-> self control status) 1) + (logtest? (-> self control status) (cshape-moving-flags onsurf)) (and (< 0.7 (-> self control surface-angle)) #t) ) ) @@ -770,7 +769,9 @@ ) (vector-matrix*! s2-3 s3-3 (-> self control unknown-matrix01)) (let ((f28-2 (vector-vector-xz-distance s3-3 s4-0))) - (when (and (zero? (logand (-> self control status) 4)) (< (vector-xz-length gp-0) (vector-xz-length s3-3))) + (when (and (zero? (logand (-> self control status) (cshape-moving-flags tsurf))) + (< (vector-xz-length gp-0) (vector-xz-length s3-3)) + ) (let ((f0-50 (lerp-scale 163840.0 0.0 f28-2 0.0 20480.0))) (if (and (< f28-2 20480.0) (< (-> s4-0 z) 0.0)) (set! f0-50 (* 2.0 f0-50)) @@ -780,9 +781,9 @@ ) ) ) - (if (and (zero? (logand (-> self control status) 8)) - (logtest? (-> self control old-status) 8) - (logtest? (-> self control unknown-surface00 flags) 2048) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags twall))) + (logtest? (-> self control old-status) (cshape-moving-flags twall)) + (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) (< 0.0 (-> gp-0 y)) (< 0.0 (vector-dot (-> self control dynam gravity-normal) @@ -799,9 +800,9 @@ (if (< (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) (seconds 0.2)) (set! f30-4 (+ 204800.0 f30-4)) ) - (if (and (zero? (logand (-> self control status) 8)) - (and (logtest? (-> self control old-status) 8) - (logtest? (-> self control unknown-surface00 flags) 2048) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags twall))) + (and (logtest? (-> self control old-status) (cshape-moving-flags twall)) + (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) (< 0.0 (-> gp-0 y)) (< (-> gp-0 z) 0.0) ) @@ -925,15 +926,16 @@ (defbehavior do-rotations2 target () (let ((gp-0 (vector-z-quaternion! (new-stack-vector0) (-> self control dir-targ))) (s5-0 - (if (and (or (zero? (logand (logior (-> self control status) (-> self control old-status)) 5)) + (if (and (or (zero? (logand (logior (-> self control status) (-> self control old-status)) (cshape-moving-flags onsurf tsurf)) + ) (< (- (-> *display* base-frame-counter) (-> self control unknown-dword20)) (seconds 0.5)) (!= (-> self next-state name) 'target-walk) (< (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) (< (- (-> *display* base-frame-counter) (-> self control unknown-dword21)) (seconds 0.5)) - (logtest? (-> self control unknown-surface01 flags) 16) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf04)) (!= (-> self control unknown-float41) 0.0) ) - (zero? (logand (-> self control unknown-surface01 flags) 32)) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf05))) ) (-> self control unknown-vector20) (-> self control transv) @@ -1025,12 +1027,12 @@ (set! (-> self control unknown-vector10 quad) (-> self control transv quad)) ((-> self control unknown-surface01 active-hook)) (cond - ((logtest? (-> self control status) 1) + ((logtest? (-> self control status) (cshape-moving-flags onsurf)) (set! (-> self control unknown-dword11) (-> *display* base-frame-counter)) (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) (if (and (>= (-> self control coverage) 1.0) - (zero? (logand (-> self control status) 1056)) - (logtest? (-> self control status) 2) + (zero? (logand (-> self control status) (cshape-moving-flags t-act on-water))) + (logtest? (-> self control status) (cshape-moving-flags onground)) ) (set! (-> self control last-known-safe-ground quad) (-> self control trans quad)) ) @@ -1038,7 +1040,7 @@ ) (else (let ((v1-25 (-> self control trans))) - (when (logtest? (-> self control old-status) 1) + (when (logtest? (-> self control old-status) (cshape-moving-flags onsurf)) (set! (-> self control unknown-vector110 quad) (-> self control unknown-vector52 quad)) (set! (-> self control unknown-vector111 quad) (-> self control unknown-vector52 quad)) ) @@ -1060,10 +1062,9 @@ (zero? (logand (-> *kernel-context* prevent-from-run) (process-mask movie))) ) (if (and (= (-> self cam-user-mode) 'normal) - (logtest? (-> self control unknown-surface00 flags) 1) - (zero? - (logand (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) - ) + (logtest? (-> self control unknown-surface00 flags) (surface-flags surf00)) + (zero? (logand (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) + ) (-> *setting-control* current allow-look-around) (>= (- (-> *display* base-frame-counter) (-> self no-look-around-wait)) (seconds 0.05)) (not (and (= (-> self control ground-pat material) (pat-material ice)) @@ -1077,7 +1078,7 @@ (when (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2) (not *pause-lock*) - (zero? (logand (-> self state-flags) 768)) + (zero? (logand (-> self state-flags) (state-flags sf08 sf09))) ) (if (!= (-> self next-state name) 'target-falling) (send-event self 'change-mode 'falling) @@ -1122,8 +1123,10 @@ (set! (-> self control surf) *standard-ground-surface*) ) (let ((f0-17 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - (if (and (or (logtest? (-> self control unknown-surface01 flags) 1024) - (and (= (-> self next-state name) 'target-walk) (zero? (logand (-> self control status) 1))) + (if (and (or (logtest? (-> self control unknown-surface01 flags) (surface-flags surf10)) + (and (= (-> self next-state name) 'target-walk) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) ) (< f0-17 0.0) (or (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2))) @@ -1170,10 +1173,10 @@ ;; definition for function post-flag-setup ;; INFO: Return type mismatch int vs none. (defbehavior post-flag-setup target () - (if (logtest? (-> self control status) 40) + (if (logtest? (-> self control status) (cshape-moving-flags twall t-act)) (set! (-> self control unknown-dword20) (-> *display* base-frame-counter)) ) - (when (logtest? (-> self state-flags) 32) + (when (logtest? (-> self state-flags) (state-flags sf05)) (if (< (logand (- (-> *display* base-frame-counter) (-> self control unknown-dword80)) 3) 1) (logior! (-> self draw status) (draw-status hidden)) (logclear! (-> self draw status) (draw-status hidden)) @@ -1190,16 +1193,19 @@ ;; definition for function bend-gravity ;; Used lq/sq (defbehavior bend-gravity target () - (set! (-> self control unknown-float82) (if (logtest? (-> self control status) 1) + (set! (-> self control unknown-float82) (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) 32.0 2.0 ) ) - (let ((f0-2 (if (and (logtest? (-> self control status) 8) (zero? (logand (-> self control status) 1))) - 0.0 - (-> self control unknown-float81) - ) + (let ((f0-2 + (if (and (logtest? (-> self control status) (cshape-moving-flags twall)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) + 0.0 + (-> self control unknown-float81) ) + ) ) (seek! (-> self control unknown-float80) @@ -1462,17 +1468,20 @@ (else (let ((v1-11 (-> self water flags))) (cond - ((and (logtest? v1-11 512) (logtest? v1-11 6144)) + ((and (logtest? v1-11 (water-flags wt09)) (logtest? v1-11 (water-flags wt11 wt12))) (vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data)) ) - (if (not (and (logtest? (-> self water flags) 4096) (zero? (logand (-> self water flags) 16)))) + (if (not (and (logtest? (-> self water flags) (water-flags wt12)) + (zero? (logand (-> self water flags) (water-flags wt04))) + ) + ) (set! (-> self control unknown-float30) (- (-> self water base-height) (-> self water swim-height))) ) (&-> (-> self control) unknown-qword00) ) - ((and (logtest? (-> self water flags) 512) (logtest? #x40000 (-> self water flags))) + ((and (logtest? (-> self water flags) (water-flags wt09)) (logtest? (water-flags wt18) (-> self water flags))) (vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data)) @@ -1513,7 +1522,7 @@ (cond ((logtest? (-> self control root-prim prim-core action) (collide-action ca-9 ca-13)) ) - ((logtest? (-> self water flags) 1024) + ((logtest? (-> self water flags) (water-flags wt10)) (let ((f30-0 (- (- (-> self control trans y) (- (-> self water height) (-> self water wade-height)))))) (set! (-> *wade-surface* alignv) (lerp-scale 1.0 0.5 f30-0 0.0 (- (-> self water swim-height) (-> self water wade-height))) @@ -1526,10 +1535,10 @@ ) (set! (-> self control surf) *wade-surface*) ) - ((logtest? (-> self water flags) 2048) + ((logtest? (-> self water flags) (water-flags wt11)) (set! (-> self control surf) *swim-surface*) ) - ((and (logtest? (-> self water flags) 512) (logtest? #x40000 (-> self water flags))) + ((and (logtest? (-> self water flags) (water-flags wt09)) (logtest? (water-flags wt18) (-> self water flags))) (set! (-> self control surf) *quicksand-surface*) ) ) @@ -1557,8 +1566,8 @@ ) ) (target-calc-camera-pos) - (when (logtest? (-> self state-flags) #x4000) - (set! (-> self state-flags) (logand -28673 (-> self state-flags))) + (when (logtest? (-> self state-flags) (state-flags sf14)) + (logclear! (-> self state-flags) (state-flags sf12 sf13 sf14)) (set! (-> self control unknown-float41) 0.0) ) (set! (-> self control unknown-int00) 0) @@ -1965,7 +1974,7 @@ ) (target-exit) (target-timed-invulnerable-off self) - (set! (-> self control status) (the-as uint 0)) + (set! (-> self control status) (cshape-moving-flags)) (set! (-> self control unknown-dynamics00) *standard-dynamics*) (set! (-> self control surf) *standard-ground-surface*) (set! (-> self control unknown-vector02 quad) (-> self control unknown-dynamics00 gravity-normal quad)) @@ -2092,7 +2101,7 @@ (activate-hud self) (set! (-> self fp-hud) (the-as handle #f)) (set! (-> self water) (new 'process 'water-control self 9 0.0 8192.0 2048.0)) - (set! (-> self water flags) (the-as uint #x4000f0)) + (set! (-> self water flags) (water-flags wt04 wt05 wt06 wt07 wt22)) (reset-target-state #t) (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) (set! (-> self control unknown-vector52 y) (+ -819200.0 (-> self control unknown-vector52 y))) diff --git a/test/decompiler/reference/engine/target/surface-h_REF.gc b/test/decompiler/reference/engine/target/surface-h_REF.gc index 2641b138cd..57846c1775 100644 --- a/test/decompiler/reference/engine/target/surface-h_REF.gc +++ b/test/decompiler/reference/engine/target/surface-h_REF.gc @@ -31,7 +31,7 @@ (impact-hook function :offset-assert 136) (mult-hook (function surface surface surface int none) :offset-assert 140) (mode symbol :offset-assert 144) - (flags uint32 :offset-assert 148) + (flags surface-flags :offset-assert 148) (data float 30 :offset 8) (hook function 4 :offset 128) (dataw uint32 2 :offset 144) @@ -200,7 +200,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x1 + :flags (surface-flags surf00) ) ) @@ -278,7 +278,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x2000 + :flags (surface-flags surf13) ) ) ) @@ -310,7 +310,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x3000 + :flags (surface-flags surf12 surf13) ) ) @@ -340,7 +340,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -370,7 +370,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -400,7 +400,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -430,7 +430,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -460,7 +460,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc80 + :flags (surface-flags surf07 surf10 surf11) ) ) @@ -490,7 +490,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -520,7 +520,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -550,7 +550,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -580,7 +580,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) @@ -608,7 +608,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1000 + :flags (surface-flags surf12) ) ) @@ -637,7 +637,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x1c00 + :flags (surface-flags surf10 surf11 surf12) ) ) @@ -666,7 +666,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x1c00 + :flags (surface-flags surf10 surf11 surf12) ) ) ) @@ -695,7 +695,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1018 + :flags (surface-flags surf03 surf04 surf12) ) ) @@ -723,7 +723,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1000 + :flags (surface-flags surf12) ) ) @@ -748,7 +748,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1c00 + :flags (surface-flags surf10 surf11 surf12) ) ) @@ -774,7 +774,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1800 + :flags (surface-flags surf11 surf12) ) ) @@ -804,7 +804,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) ) @@ -838,7 +838,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'wade - :flags #x1 + :flags (surface-flags surf00) ) ) @@ -891,7 +891,7 @@ :alignv 1.0 :align-speed 1.0 :mode 'dive - :flags #x2 + :flags (surface-flags surf01) ) ) @@ -921,28 +921,28 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'dive - :flags #x2 + :flags (surface-flags surf01) ) ) ;; failed to figure out what this is: (let ((a0-7 (copy *walk-mods* 'global))) (set! (-> a0-7 name) 'pole) - (set! (-> a0-7 flags) (the-as uint 0)) + (set! (-> a0-7 flags) (surface-flags)) (set! *pole-mods* a0-7) ) ;; failed to figure out what this is: (let ((a0-9 (copy *walk-mods* 'global))) (set! (-> a0-9 name) 'grab) - (set! (-> a0-9 flags) (the-as uint 0)) + (set! (-> a0-9 flags) (surface-flags)) (set! *grab-mods* a0-9) ) ;; failed to figure out what this is: (let ((a0-11 (copy *walk-mods* 'global))) (set! (-> a0-11 name) 'edge-grab) - (set! (-> a0-11 flags) (the-as uint 0)) + (set! (-> a0-11 flags) (surface-flags)) (set! *edge-grab-mods* a0-11) ) @@ -1211,7 +1211,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x18 + :flags (surface-flags surf03 surf04) ) ) ) diff --git a/test/decompiler/reference/engine/target/target-death_REF.gc b/test/decompiler/reference/engine/target/target-death_REF.gc index 34dd8dcd1e..c13e184f75 100644 --- a/test/decompiler/reference/engine/target/target-death_REF.gc +++ b/test/decompiler/reference/engine/target/target-death_REF.gc @@ -110,11 +110,10 @@ (set! (-> *load-state* want 1 force-vis?) #f) (set! (-> *load-state* want 1 force-inside?) #f) (when (not (string= (-> arg0 name) "default")) - (while (not - (and (or (not (-> arg0 lev0)) (not (-> arg0 disp0)) (= (level-status *level* (-> arg0 lev0)) 'active)) - (or (not (-> arg0 lev1)) (not (-> arg0 disp1)) (= (level-status *level* (-> arg0 lev1)) 'active)) - ) - ) + (while (not (and (or (not (-> arg0 lev0)) (not (-> arg0 disp0)) (= (level-status *level* (-> arg0 lev0)) 'active)) + (or (not (-> arg0 lev1)) (not (-> arg0 disp1)) (= (level-status *level* (-> arg0 lev1)) 'active)) + ) + ) (let ((v1-52 (lookup-level-info (-> arg0 level)))) (if (and v1-52 (= (-> *setting-control* current music) (-> v1-52 music-bank)) @@ -271,7 +270,7 @@ ) (until (not v1-10) (suspend) - (set! v1-10 (and *target* (logtest? (-> *target* state-flags) 256))) + (set! v1-10 (and *target* (logtest? (-> *target* state-flags) (state-flags sf08)))) ) (set! (-> *cpad-list* cpads 0 change-time) (-> *display* base-frame-counter)) (reset-actors 'dead) @@ -473,7 +472,7 @@ (set! (-> v1-264 frame-group) (the-as art-joint-anim (-> self draw art-group data 5))) ) (suspend) - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (go target-stance) (none) ) @@ -521,7 +520,7 @@ (none) ) :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -568,7 +567,7 @@ (none) ) :mode 'air - :flags #x818 + :flags (surface-flags surf03 surf04 surf11) ) ) @@ -668,8 +667,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -695,7 +694,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (return (the-as object 'stuck)) ) (let ((s1-0 (new-stack-vector0))) @@ -905,14 +904,14 @@ (set! (-> a0-14 param 1) 1.0) (joint-control-channel-group-eval! a0-14 (the-as art-joint-anim #f) num-func-seek!) ) - (set! v1-40 (or (ja-done? 0) (and arg1 (logtest? (-> self control status) 1)))) + (set! v1-40 (or (ja-done? 0) (and arg1 (logtest? (-> self control status) (cshape-moving-flags onsurf))))) ) - (while (and (or (zero? (logand (-> self control status) 1)) s2-1) (!= s2-1 'stuck)) + (while (and (or (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) s2-1) (!= s2-1 'stuck)) (arg2) (+! f30-1 (* (-> arg0 shove-back) f28-1 (-> *display* seconds-per-frame))) (set! s2-1 (target-hit-push s3-1 s1-1 f30-1 (* (-> arg0 shove-back) f28-1) arg0)) (if (not s2-1) - (set! (-> self state-flags) (logand -9 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03)) ) (suspend) ) @@ -948,7 +947,7 @@ ) ) (if (!= (-> self next-state name) 'target-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) (target-exit) (none) @@ -965,7 +964,7 @@ ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (set! (-> self water flags) (logand -65537 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt16)) (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((gp-0 (-> self attack-info))) (let ((s5-0 (new 'stack-no-clear 'vector))) @@ -1010,7 +1009,7 @@ ) ) (when (= arg0 'attack) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self game hit-time) (-> *display* base-frame-counter)) (case (-> gp-0 mode) (('endlessfall) @@ -1158,7 +1157,7 @@ (send-event *camera* 'joystick 0.0 -1.0) (TODO-RENAME-9 (-> self align)) (let ((s5-0 (new 'stack-no-clear 'vector))) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! s5-0 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (vector-float*! (-> self control transv) s5-0 (-> *display* frames-per-second)) ) @@ -1178,7 +1177,7 @@ (defstate target-death (target) :exit (behavior () - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'process-mask) (clear-pending-settings-from-process *setting-control* self 'allow-progress) @@ -1208,7 +1207,7 @@ (set-setting! *setting-control* self 'process-mask 'set (the-as float 0.0) #x14a0000) (copy-settings-from-target! *setting-control*) (set! (-> self control transv quad) (the-as uint128 0)) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) (case arg0 (('none 'instant-death) ) @@ -1225,7 +1224,7 @@ ) (('drown 'drown-death) (sound-play-by-name (static-sound-name "death-drown") (new-sound-id) 1024 0 0 1 #t) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (clear-collide-with-as (-> self control)) (set! (-> self control unknown-surface00) *dive-mods*) (set! (-> self control dynam gravity-max) 6144.0) @@ -1257,7 +1256,7 @@ (when (if (and (nonzero? s5-1) (type-type? (-> s5-1 type) water-vol)) s5-1 ) - (set! (-> self state-flags) (logior #x80000 (-> self state-flags))) + (set! (-> self state-flags) (logior (state-flags sf19) (-> self state-flags))) (set! (-> self alt-cam-pos y) (+ 4096.0 (-> self water height))) ) ) @@ -1301,7 +1300,7 @@ (sound-play-by-name (static-sound-name "death-fall") (new-sound-id) 1024 0 0 1 #t) (camera-change-to (the-as string cam-endlessfall) 30 #f) (set! (-> self control pat-ignore-mask unknown-bit) 1) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (let ((f30-2 (fmin -4096.0 (- (-> self control ground-impact-vel))))) (set! (-> self control unknown-uint20) (the-as uint f30-2)) (let ((gp-11 (new-stack-vector0))) @@ -1483,7 +1482,7 @@ (set-setting! *setting-control* self 'allow-progress #f (the-as float 0.0) 0) (target-death-anim gp-18) (when (and (< (rand-vu-int-count (-> *game-info* death-movie-tick)) (* (-> *death-spool-array* length) 2)) - (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self water flags) (water-flags wt09))) (!= (-> self control ground-pat material) 9) (!= (-> self control ground-pat material) 10) ) diff --git a/test/decompiler/reference/engine/target/target-handler_REF.gc b/test/decompiler/reference/engine/target/target-handler_REF.gc index dca48992fd..1e7c7d9b7c 100644 --- a/test/decompiler/reference/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/engine/target/target-handler_REF.gc @@ -35,7 +35,7 @@ object (cond ((= v1-0 'get-pickup) - (when (zero? (logand (-> self state-flags) #x8000)) + (when (zero? (logand (-> self state-flags) (state-flags sf15))) (let ((s4-0 (-> arg3 param 0)) (f28-0 (the-as float (-> arg3 param 1))) ) @@ -128,24 +128,24 @@ (case (-> arg3 param 0) (('save) (set! (-> self alt-cam-pos quad) (-> self control trans quad)) - (set! (-> self state-flags) (logior #x20000 (-> self state-flags))) + (set! (-> self state-flags) (logior (state-flags sf17) (-> self state-flags))) (mem-copy! (the-as pointer (-> arg3 param 1)) (the-as pointer (-> self control trans)) 48) ) (('restore) - (set! (-> self state-flags) (logand -131073 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf17)) (let ((gp-1 (-> arg3 param 1))) (move-to-point! (-> self control) (the-as vector (+ gp-1 0))) (quaternion-copy! (-> self control quat) (the-as quaternion (+ gp-1 16))) ) (rot->dir-targ! (-> self control)) - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! v0-0 (the-as none (-> *display* base-frame-counter))) (set! (-> self control unknown-dword11) (the-as time-frame v0-0)) v0-0 ) (('reset) - (set! v0-0 (the-as none (logand -131073 (-> self state-flags)))) - (set! (-> self state-flags) (the-as uint v0-0)) + (set! v0-0 (the-as none (logclear (-> self state-flags) (state-flags sf17)))) + (set! (-> self state-flags) (the-as state-flags v0-0)) v0-0 ) ) @@ -168,13 +168,13 @@ (set! (-> self neck flex-blend) (the-as float (-> arg3 param 0))) (cond ((-> arg3 param 1) - (set! (-> self state-flags) (logior #x40000 (-> self state-flags))) + (set! (-> self state-flags) (logior (state-flags sf18) (-> self state-flags))) (set! (-> self alt-neck-pos quad) (-> (the-as vector (-> arg3 param 1)) quad)) (look-at-enemy! (-> self neck) (-> self alt-neck-pos) 'force arg0) ) (else - (set! v0-0 (the-as none (logand -262145 (-> self state-flags)))) - (set! (-> self state-flags) (the-as uint v0-0)) + (set! v0-0 (the-as none (logclear (-> self state-flags) (state-flags sf18)))) + (set! (-> self state-flags) (the-as state-flags v0-0)) v0-0 ) ) @@ -225,13 +225,13 @@ (cond ((-> arg3 param 0) (let ((v1-108 (-> self draw shadow-ctrl))) - (set! (-> v1-108 settings flags) (logand -33 (-> v1-108 settings flags))) + (logclear! (-> v1-108 settings flags) (shadow-flags shdf05)) ) 0 ) (else (let ((v1-110 (-> self draw shadow-ctrl))) - (logior! (-> v1-110 settings flags) 32) + (logior! (-> v1-110 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -312,10 +312,11 @@ (set! (-> s5-0 attacker) (process->handle arg2)) (set! (-> s5-0 shove-back) arg0) (set! (-> s5-0 shove-up) arg1) - (set! (-> s5-0 angle) (if (zero? (logand (logior (-> self control status) (-> self control old-status)) 1)) - 'air - 'shove - ) + (set! (-> s5-0 angle) + (if (zero? (logand (logior (-> self control status) (-> self control old-status)) (cshape-moving-flags onsurf))) + 'air + 'shove + ) ) (set! (-> s5-0 mask) (the-as uint 2248)) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) @@ -337,15 +338,15 @@ ;; definition for function target-attacked (defbehavior target-attacked target ((arg0 symbol) (arg1 attack-info) (arg2 process) (arg3 process) (arg4 (state symbol attack-info target))) - (when (zero? (logand (-> self state-flags) 8)) + (when (zero? (logand (-> self state-flags) (state-flags sf03))) (cond - ((or (logtest? (-> self state-flags) 112) + ((or (logtest? (-> self state-flags) (state-flags sf04 sf05 sf06)) (and (logtest? (-> arg1 mask) 32) (= (-> arg1 mode) 'darkeco) (and (and (= (-> self fact-info-target eco-type) (pickup-type eco-red)) (>= (-> self fact-info-target eco-level) 1.0) ) - (logtest? #x100002 (-> self state-flags)) + (logtest? (state-flags sf01 sf20) (-> self state-flags)) ) ) ) @@ -434,9 +435,9 @@ #t ) (else - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (if (and (= (-> self game mode) 'play) (and (>= 1.0 (-> self fact-info-target health)) (= arg0 'attack))) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) ) (go arg4 arg0 (-> self attack-info-rec)) ) @@ -774,8 +775,8 @@ ;; definition for function target-apply-tongue (defbehavior target-apply-tongue target ((arg0 vector)) - (when (zero? (logand (-> self state-flags) 8)) - (logior! (-> self state-flags) #x7000) + (when (zero? (logand (-> self state-flags) (state-flags sf03))) + (logior! (-> self state-flags) (state-flags sf12 sf13 sf14)) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> self control trans)))) (set! (-> self control unknown-float41) (lerp-scale (-> *TARGET-bank* tongue-pull-speed-min) @@ -833,15 +834,16 @@ ) ) (('loading) - (if (not - (or (and (logtest? (-> self control unknown-surface00 flags) 2048) (zero? (logand (-> self control status) 1))) - (or (logtest? (-> self water flags) 512) - (logtest? (-> self state-flags) #x830e) - (logtest? (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) - (>= (-> self no-load-wait) (-> *display* base-frame-counter)) - ) - ) - ) + (if (not (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) + (or (logtest? (-> self water flags) (water-flags wt09)) + (logtest? (-> self state-flags) (state-flags sf01 sf02 sf03 sf08 sf09 sf15)) + (logtest? (-> self control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) + (>= (-> self no-load-wait) (-> *display* base-frame-counter)) + ) + ) + ) (go target-load-wait) ) ) @@ -869,12 +871,14 @@ (go target-snowball-start (process->handle (the-as process (-> arg3 param 1)))) ) (('tube) - (if (and (logtest? (-> self control status) 1) (zero? (logand (-> self water flags) 512))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (zero? (logand (-> self water flags) (water-flags wt09))) + ) (go target-tube-start (process->handle (the-as process (-> arg3 param 1)))) ) ) (('periscope) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-periscope (process->handle (the-as process (-> arg3 param 1)))) ) ) @@ -908,7 +912,7 @@ (if (not (or (= (-> self control unknown-surface00 mode) 'swim) (= (-> self control unknown-surface00 mode) 'dive) (= (-> self next-state name) 'target-hit) - (logtest? (-> self state-flags) 8) + (logtest? (-> self state-flags) (state-flags sf03)) ) ) (go target-swim-stance) @@ -1021,7 +1025,7 @@ (-> self control unknown-dword50) (-> self control unknown-dword51) ) - (zero? (logand (-> self state-flags) #x8008)) + (zero? (logand (-> self state-flags) (state-flags sf03 sf15))) ) (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) (target-timed-invulnerable (seconds 0.1) self) @@ -1094,16 +1098,16 @@ target-standard-event-handler (set! (-> self control unknown-vector11 quad) (the-as uint128 0)) (set! (-> self control unknown-float41) 0.0) (set! (-> self control unknown-float81) 0.0) - (set! (-> self state-flags) (logand -1835917 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf02 sf03 sf07 sf08 sf09 sf18 sf19 sf20)) (target-danger-set! 'harmless #f) - (logior! (-> self water flags) 16) - (set! (-> self water flags) (logand -65537 (-> self water flags))) + (logior! (-> self water flags) (water-flags wt04)) + (logclear! (-> self water flags) (water-flags wt16)) (set! (-> self water drip-mult) 1.0) (set! (-> self neck flex-blend) 1.0) (set! (-> self control unknown-float91) 0.0) (logclear! (-> self draw status) (draw-status hidden)) (logclear! (-> self skel status) (janim-status spool)) - (set! (-> self control status) (logand -16385 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags csmf14)) 0 (none) ) diff --git a/test/decompiler/reference/engine/target/target-util_REF.gc b/test/decompiler/reference/engine/target/target-util_REF.gc index 88c9eb5b44..a35e704c88 100644 --- a/test/decompiler/reference/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/engine/target/target-util_REF.gc @@ -319,7 +319,7 @@ (-> *TARGET-bank* root-radius) ) (set! (-> self control unknown-symbol30) arg0) - (set! (-> self state-flags) (logand -3 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 transform-index) -2) (set! (-> s4-0 prim-core collide-as) (collide-kind)) (set! (-> s4-0 collide-with) (collide-kind)) @@ -346,7 +346,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 9830.4 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -363,7 +363,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 10649.6 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -381,7 +381,7 @@ (set! (-> s5-0 transform-index) 32) ) (('duck-slide) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -399,7 +399,7 @@ (set! (-> s5-0 transform-index) 28) ) (('wheel-solid) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -421,7 +421,7 @@ (set! (-> self control unknown-symbol30) 'roll) ) (('flip) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -448,7 +448,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 11878.4 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -471,7 +471,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 11878.4 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -498,7 +498,7 @@ ) ) (('flop) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -515,7 +515,7 @@ (set! (-> self control unknown-symbol30) 'flop) ) (('flop-down) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -548,7 +548,7 @@ (new 'static 'vector :y 6553.6 :w 1.0) 12288.0 ) - (logior! (-> self state-flags) 2) + (logior! (-> self state-flags) (state-flags sf01)) (set! (-> s4-0 prim-core collide-as) (collide-kind target target-attack)) (set! (-> s4-0 collide-with) (collide-kind cak-1 cak-2 cak-3 powerup crate enemy wall-object ground-object mother-spider) @@ -824,19 +824,21 @@ (not (-> *setting-control* current spooling)) (not (-> *setting-control* current movie)) (not (-> *setting-control* current hint)) - (zero? (logand (-> self control status) 32)) - (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + (zero? (logand (-> self water flags) (water-flags wt09))) ) ) ;; definition for function can-jump? (defbehavior can-jump? target ((arg0 symbol)) - (and (or (logtest? (-> self control status) 1) + (and (or (logtest? (-> self control status) (cshape-moving-flags onsurf)) (< (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) - (and (logtest? (-> self control status) 1) (< 0.866 (-> self control surface-angle))) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (< 0.866 (-> self control surface-angle)) + ) ) - (and (zero? (logand (-> self control unknown-surface01 flags) 64)) - (zero? (logand (-> self state-flags) 2048)) + (and (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf06))) + (zero? (logand (-> self state-flags) (state-flags sf11))) (case arg0 (('target-wheel-flip) (>= 0.5 (-> self control unknown-float61)) @@ -862,7 +864,7 @@ ;; definition for function fall-test ;; INFO: Return type mismatch object vs none. (defbehavior fall-test target () - (when (and (zero? (logand (-> self control status) 1)) + (when (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-15 (if (> (-> self skel active-channels) 0) @@ -880,7 +882,7 @@ ) ) (when (and (< (- (-> *display* base-frame-counter) (-> self control rider-time)) (-> *TARGET-bank* ground-timeout)) - (logtest? (-> self control unknown-surface01 flags) #x4000) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf14)) ) (+! (-> self control transv x) (-> self control rider-last-move x)) (+! (-> self control transv z) (-> self control rider-last-move z)) @@ -893,9 +895,9 @@ ;; definition for function slide-down-test ;; INFO: Return type mismatch object vs none. (defbehavior slide-down-test target () - (if (and (zero? (logand (-> self control status) 129)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf csmf07))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) - (logtest? (-> self control status) 4) + (logtest? (-> self control status) (cshape-moving-flags tsurf)) (< 0.5 (-> self control surface-angle)) ) (go target-slide-down) @@ -905,28 +907,31 @@ ;; definition for function smack-surface? (defbehavior smack-surface? target ((arg0 symbol)) - (and (< 0.7 (-> self control touch-angle)) (and (< (-> self control surface-angle) 0.3) - (logtest? (-> self control status) 8) - (or arg0 (zero? (logand (-> self control status) 32))) - ) + (and (< 0.7 (-> self control touch-angle)) + (and (< (-> self control surface-angle) 0.3) + (logtest? (-> self control status) (cshape-moving-flags twall)) + (or arg0 (zero? (logand (-> self control status) (cshape-moving-flags t-act)))) + ) ) ) ;; definition for function can-wheel? (defbehavior can-wheel? target () - (and (logtest? (-> self control status) 1) - (or (zero? (logand (-> self control status) 8)) (>= 0.7 (-> self control touch-angle))) - (and (< (-> self control unknown-float61) 0.7) (zero? (logand (-> self state-flags) 8192))) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (or (zero? (logand (-> self control status) (cshape-moving-flags twall))) + (>= 0.7 (-> self control touch-angle)) + ) + (and (< (-> self control unknown-float61) 0.7) (zero? (logand (-> self state-flags) (state-flags sf13)))) ) ) ;; definition for function can-duck? (defbehavior can-duck? target () - (and (logtest? (-> self control status) 1) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (>= (-> self control unknown-float60) 0.7) - (zero? (logand (-> self water flags) 6144)) - (zero? (logand (-> self state-flags) 8192)) - (or (zero? (logand (-> self water flags) 1024)) + (zero? (logand (-> self water flags) (water-flags wt11 wt12))) + (zero? (logand (-> self state-flags) (state-flags sf13))) + (or (zero? (logand (-> self water flags) (water-flags wt10))) (< (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) ) ) @@ -967,15 +972,15 @@ (pad-buttons square) ) ) - (or (and (logtest? (-> self state-flags) 4096) - (or (zero? (logand (-> self state-flags) #x4000)) + (or (and (logtest? (-> self state-flags) (state-flags sf12)) + (or (zero? (logand (-> self state-flags) (state-flags sf14))) (not (and (= (-> self fact-info-target eco-type) (pickup-type eco-yellow)) (>= (-> self fact-info-target eco-level) 1.0) ) ) ) ) - (logtest? (-> self control unknown-surface01 flags) 384) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf07 surf08)) ) ) #f @@ -1008,7 +1013,9 @@ ;; definition for function can-feet? (defbehavior can-feet? target () (cond - ((or (logtest? (-> self state-flags) 4096) (logtest? (-> self control unknown-surface01 flags) 640)) + ((or (logtest? (-> self state-flags) (state-flags sf12)) + (logtest? (-> self control unknown-surface01 flags) (surface-flags surf07 surf09)) + ) #f ) ((>= (- (-> *display* base-frame-counter) (-> *TARGET-bank* attack-timeout)) (-> self control unknown-dword33)) @@ -1096,7 +1103,7 @@ ;; definition for function target-timed-invulnerable ;; INFO: Return type mismatch int vs none. (defun target-timed-invulnerable ((arg0 time-frame) (arg1 target)) - (logior! (-> arg1 state-flags) 32) + (logior! (-> arg1 state-flags) (state-flags sf05)) (set! (-> arg1 control unknown-dword80) (-> *display* base-frame-counter)) (set! (-> arg1 control unknown-dword81) arg0) (set-collide-kinds (-> arg1 control) 2 (collide-kind target-attack) (collide-kind)) @@ -1108,7 +1115,7 @@ ;; INFO: Return type mismatch int vs none. (defun target-timed-invulnerable-off ((arg0 target)) (logclear! (-> arg0 draw status) (draw-status hidden)) - (set! (-> arg0 state-flags) (logand -33 (-> arg0 state-flags))) + (logclear! (-> arg0 state-flags) (state-flags sf05)) (set-collide-kinds (-> arg0 control) 2 (collide-kind) (collide-kind target-attack)) 0 (none) @@ -1296,7 +1303,7 @@ ((not gp-0) (camera-pos) ) - ((logtest? (-> gp-0 state-flags) 1024) + ((logtest? (-> gp-0 state-flags) (state-flags sf10)) (add-debug-sphere *display-camera-marks* (bucket-id debug-no-zbuf) @@ -1306,7 +1313,7 @@ ) (-> gp-0 alt-cam-pos) ) - ((logtest? #x20000 (-> gp-0 state-flags)) + ((logtest? (state-flags sf17) (-> gp-0 state-flags)) (add-debug-sphere *display-camera-marks* (bucket-id debug-no-zbuf) @@ -1316,7 +1323,7 @@ ) (-> gp-0 alt-cam-pos) ) - ((logtest? #x80000 (-> gp-0 state-flags)) + ((logtest? (state-flags sf19) (-> gp-0 state-flags)) (let ((s5-0 (the-as object (new 'static 'vector)))) (set! (-> (the-as vector s5-0) quad) (-> (&-> (-> gp-0 control) unknown-qword00) 0)) (set! (-> (the-as vector s5-0) y) (fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y))) diff --git a/test/decompiler/reference/engine/target/target2_REF.gc b/test/decompiler/reference/engine/target/target2_REF.gc index 1aaa26b352..29d1e3d38a 100644 --- a/test/decompiler/reference/engine/target/target2_REF.gc +++ b/test/decompiler/reference/engine/target/target2_REF.gc @@ -584,7 +584,7 @@ (behavior () (set! (-> self cam-user-mode) 'look-around) (set! (-> self control unknown-surface00) *duck-mods*) - (logior! (-> self state-flags) 512) + (logior! (-> self state-flags) (state-flags sf09)) (send-event *camera* 'blend-from-as-fixed) (send-event *camera* 'no-intro) (camera-change-to (the-as string 'cam-eye) 60 #f) @@ -769,7 +769,7 @@ (behavior () (set! (-> self neck flex-blend) 0.0) (set! (-> self control unknown-surface00) *duck-mods*) - (logior! (-> self state-flags) 512) + (logior! (-> self state-flags) (state-flags sf09)) (send-event *camera* 'blend-from-as-fixed) (send-event *camera* 'clear-entity) (send-event *camera* 'no-intro) @@ -946,13 +946,13 @@ (behavior () (set! (-> self control unknown-surface00) *grab-mods*) (set! (-> self neck flex-blend) 0.0) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (set! (-> self control unknown-uint20) (the-as uint 'stance)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04)) (target-exit) (none) ) @@ -960,7 +960,7 @@ (behavior () (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) (let ((gp-0 0)) - (while (zero? (logand (-> self control status) 1)) + (while (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (target-falling-anim-trans) (+! gp-0 (- (-> *display* base-frame-counter) (-> *display* old-base-frame-counter))) (suspend) @@ -1163,7 +1163,7 @@ ) :post (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (set! (-> self control transv quad) (the-as uint128 0)) ) (target-no-stick-post) @@ -1209,7 +1209,7 @@ ) (pad-buttons x) ) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self state-flags) (state-flags sf11))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) (set! (-> self control transv quad) (the-as uint128 0)) @@ -1232,7 +1232,7 @@ ) ) ) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (go target-falling 'target-pole-cycle) ) ((>= (ja-aframe-num 0) 14.0) @@ -1538,7 +1538,7 @@ ) (pad-buttons x) ) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) (cond ((or (< -0.2 (local-pad-angle)) @@ -1717,7 +1717,7 @@ (until (ja-done? 0) (target-compute-edge-rider) (TODO-RENAME-9 (-> self align)) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! s4-0 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (move-by-vector! (-> self control) s4-0) ) @@ -1761,7 +1761,7 @@ ) (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! gp-0 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (move-by-vector! (-> self control) gp-0) ) @@ -1777,7 +1777,7 @@ (logclear! (-> self control root-prim prim-core action) (collide-action ca-3 ca-7)) (vector-float*! (-> self control transv) (-> self control unknown-vector101) -40960.0) (when (and (< (- (-> *display* base-frame-counter) (-> self control rider-time)) (seconds 0.2)) - (or (logtest? (-> self control unknown-surface01 flags) #x4000) + (or (logtest? (-> self control unknown-surface01 flags) (surface-flags surf14)) (= (-> self control poly-pat material) (pat-material rotate)) ) ) @@ -1931,7 +1931,7 @@ ) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-stance) (go target-falling #f) ) @@ -1962,7 +1962,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -2085,7 +2085,7 @@ (joint-control-channel-group-eval! a0-22 (the-as art-joint-anim #f) num-func-seek!) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-stance) (go target-falling #f) ) @@ -2145,8 +2145,8 @@ ) (pad-buttons x) ) - (zero? (logand (-> self water flags) 512)) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self water flags) (water-flags wt09))) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) ) @@ -2216,10 +2216,10 @@ :trans (behavior () ((-> self state-hook)) - (when (and (zero? (logand (-> self water flags) 1024)) + (when (and (zero? (logand (-> self water flags) (water-flags wt10))) (>= (- (-> *display* base-frame-counter) (-> self water wade-time)) (seconds 0.05)) ) - (if (logtest? (-> self water flags) 2048) + (if (logtest? (-> self water flags) (water-flags wt11)) (go target-swim-stance) (go target-stance) ) @@ -2268,10 +2268,10 @@ :trans (behavior () ((-> self state-hook)) - (when (and (zero? (logand (-> self water flags) 1024)) + (when (and (zero? (logand (-> self water flags) (water-flags wt10))) (>= (- (-> *display* base-frame-counter) (-> self water wade-time)) (seconds 0.1)) ) - (if (logtest? (-> self water flags) 2048) + (if (logtest? (-> self water flags) (water-flags wt11)) (go target-swim-stance) (go target-stance) ) @@ -2601,7 +2601,7 @@ (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) (set! (-> self control unknown-surface00) *swim-mods*) - (logior! (-> self water flags) 16) + (logior! (-> self water flags) (water-flags wt04)) (none) ) :exit @@ -2623,13 +2623,15 @@ :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) 1) (zero? (logand (-> self control status) 1024))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) (set-zero! (-> self water bob)) ) - (when (and (zero? (logand (-> self water flags) 2048)) + (when (and (zero? (logand (-> self water flags) (water-flags wt11))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-stance) (go target-stance) ) @@ -2775,13 +2777,15 @@ :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) 1) (zero? (logand (-> self control status) 1024))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) (set-zero! (-> self water bob)) ) - (when (and (zero? (logand (-> self water flags) 2048)) + (when (and (zero? (logand (-> self water flags) (water-flags wt11))) (>= (- (-> *display* base-frame-counter) (-> self water swim-time)) (seconds 0.1)) ) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-stance) (go target-stance) ) @@ -2860,7 +2864,7 @@ ) (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) - (if (zero? (logand (-> self align flags) 1)) + (if (zero? (logand (-> self align flags) (align-flags algf00))) (set! (-> self control unknown-surface00 target-speed) (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> *display* frames-per-second)) ) @@ -2890,7 +2894,7 @@ ) (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) - (if (zero? (logand (-> self align flags) 1)) + (if (zero? (logand (-> self align flags) (align-flags algf00))) (set! (-> self control unknown-surface00 target-speed) (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> *display* frames-per-second)) ) @@ -2932,7 +2936,7 @@ :enter (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (set! (-> self control unknown-surface00) *dive-mods*) (set! (-> self control dynam gravity-max) 16384.0) (set! (-> self control dynam gravity-length) 16384.0) @@ -3092,7 +3096,7 @@ (go target-swim-up) ) (if (or (>= (- (-> *display* base-frame-counter) (-> self state-time)) s5-0) - (and (logtest? (-> self control status) 1) + (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (and (< (-> self water swim-depth) 8192.0) (>= (- (-> *display* base-frame-counter) (-> self state-time)) gp-0) ) @@ -3150,8 +3154,8 @@ :trans (behavior () (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) - (zero? (logand (-> self state-flags) 2048)) - (zero? (logand (-> self water flags) #x6000)) + (zero? (logand (-> self state-flags) (state-flags sf11))) + (zero? (logand (-> self water flags) (water-flags wt13 wt14))) ) (go target-swim-jump-jump @@ -3203,7 +3207,7 @@ (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) ) - (if (and (zero? (logand (-> self water flags) 4096)) + (if (and (zero? (logand (-> self water flags) (water-flags wt12))) (or (>= (ja-aframe-num 0) 222.0) (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) (>= (ja-aframe-num 0) 200.0) @@ -3213,8 +3217,8 @@ (goto cfg-37) ) (TODO-RENAME-9 (-> self align)) - (when (zero? (logand (-> self water flags) 4096)) - (logior! (-> self water flags) 16) + (when (zero? (logand (-> self water flags) (water-flags wt12))) + (logior! (-> self water flags) (water-flags wt04)) (set! gp-0 #f) ) (if gp-0 @@ -3247,14 +3251,14 @@ (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) ) - (if (zero? (logand (-> self water flags) 4096)) + (if (zero? (logand (-> self water flags) (water-flags wt12))) (goto cfg-37) ) (if (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (set! f30-0 2.0) ) (TODO-RENAME-9 (-> self align)) - (when (logtest? (-> self water flags) 4096) + (when (logtest? (-> self water flags) (water-flags wt12)) (TODO-RENAME-10 (-> self align) 2 (the-as float 1.0) (the-as float 1.0) (the-as float 1.0)) (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) ) @@ -3267,7 +3271,7 @@ ) ) (label cfg-37) - (logior! (-> self water flags) 16) + (logior! (-> self water flags) (water-flags wt04)) (set! (-> self water swim-time) (-> *display* base-frame-counter)) (start-bobbing! (-> self water) (the-as float -4096.0) 600 1500) (set! (-> self water bob start-time) (+ (-> *display* base-frame-counter) (seconds -0.05))) @@ -3290,8 +3294,8 @@ (behavior () (cond ((< (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) - (set! (-> self water flags) (logior #x10000 (-> self water flags))) - (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self water flags) (logior (water-flags wt16) (-> self water flags))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) ) (else (set! (-> self trans-hook) (-> target-jump trans)) @@ -3317,7 +3321,7 @@ ((-> target-swim-stance exit)) (die-on-next-update! (-> self water bob)) (set! (-> self water align-offset) 0.0) - (set! (-> self water flags) (logior #x10000 (-> self water flags))) + (set! (-> self water flags) (logior (water-flags wt16) (-> self water flags))) (none) ) :code @@ -3334,7 +3338,7 @@ ) (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) (TODO-RENAME-9 (-> self align)) - (if (zero? (logand (-> self align flags) 1)) + (if (zero? (logand (-> self align flags) (align-flags algf00))) (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) ) (suspend) @@ -3595,15 +3599,15 @@ (behavior () (target-exit) (set! (-> self cam-user-mode) 'normal) - (logior! (-> self state-flags) 256) - (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (logior! (-> self state-flags) (state-flags sf08)) + (logclear! (-> self state-flags) (state-flags sf04)) (none) ) :code (behavior ((arg0 handle)) (set! (-> self neck flex-blend) 0.0) (target-exit) - (logior! (-> self state-flags) 144) + (logior! (-> self state-flags) (state-flags sf04 sf07)) (let ((v1-4 (handle->process arg0))) (if v1-4 (quaterion<-rotate-y-vector (-> self control dir-targ) (vector-! @@ -3675,7 +3679,7 @@ #f (-> self control root-prim collide-with) ) - (logior! (-> self state-flags) 256) + (logior! (-> self state-flags) (state-flags sf08)) (set! (-> self neck flex-blend) 0.0) (none) ) @@ -3731,7 +3735,7 @@ (set! (-> self control unknown-vector102 quad) (-> self control trans quad)) (set! (-> self control unknown-uint20) (the-as uint #t)) (quaternion-copy! (the-as quaternion (-> self control unknown-vector103)) (-> self control quat)) - (logior! (-> self state-flags) 256) + (logior! (-> self state-flags) (state-flags sf08)) (vector-reset! (-> self control transv)) (set! (-> self neck flex-blend) 0.0) (send-event (ppointer->process (-> self sidekick)) 'shadow #t) @@ -3758,7 +3762,7 @@ #t (-> self control root-prim collide-with) ) - (when (logtest? (-> self control status) 1024) + (when (logtest? (-> self control status) (cshape-moving-flags on-water)) (let ((a1-6 (new-stack-vector0))) (set! (-> a1-6 x) (-> self control trans x)) (set! (-> a1-6 y) (-> self water height)) @@ -3776,7 +3780,7 @@ ) ) (rot->dir-targ! (-> self control)) - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-dword11) (-> *display* base-frame-counter)) (ja-channel-set! 0) (ja-post) diff --git a/test/decompiler/reference/engine/target/target_REF.gc b/test/decompiler/reference/engine/target/target_REF.gc index 3994a2df1e..f52313abfb 100644 --- a/test/decompiler/reference/engine/target/target_REF.gc +++ b/test/decompiler/reference/engine/target/target_REF.gc @@ -132,12 +132,13 @@ (b! #t cfg-23 :delay (nop!)) (label cfg-7) (cond - ((and (logtest? (-> self control status) 1) (not (= (if (> (-> self skel active-channels) 0) - (-> self skel root-channel 0 frame-group) - ) - (-> self draw art-group data 35) - ) - ) + ((and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 35) + ) + ) ) (ja-channel-push! 1 6) (let ((v1-21 (-> self skel root-channel 0))) @@ -185,14 +186,14 @@ ) (pad-buttons x) ) - (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self water flags) (water-flags wt09))) (< (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 3)) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground #f) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) @@ -202,7 +203,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground 'stuck) ) (if (!= (-> self state-time) (-> *display* base-frame-counter)) @@ -589,7 +590,7 @@ :trans (behavior () ((-> self state-hook)) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-stance) ) (when (= (-> self control ground-pat material) (pat-material ice)) @@ -1617,7 +1618,7 @@ (if (can-hands? #t) (go target-running-attack) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (seconds 0.08)) ) (go target-falling #f) @@ -1676,12 +1677,12 @@ ) :trans (behavior () - (when (or (logtest? (-> self control status) 1) + (when (or (logtest? (-> self control status) (cshape-moving-flags onsurf)) (if (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) #t ) ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-duck-stance) ) (none) @@ -1724,7 +1725,7 @@ ;; definition for function init-var-jump ;; Used lq/sq (defbehavior init-var-jump target ((arg0 float) (arg1 float) (arg2 vector) (arg3 vector) (arg4 vector)) - (set! (-> self control status) (logand -16385 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags csmf14)) (delete-back-vel) (when (< (- (-> *display* base-frame-counter) (-> self control rider-time)) (seconds 0.05)) (let ((f0-1 @@ -1737,7 +1738,7 @@ (set! arg0 (+ arg0 f0-1)) (set! arg1 (+ arg1 f0-1)) ) - (when (or (logtest? (-> self control unknown-surface01 flags) #x4000) + (when (or (logtest? (-> self control unknown-surface01 flags) (surface-flags surf14)) (= (-> self control poly-pat material) (pat-material rotate)) ) (+! (-> self control transv x) (-> self control rider-last-move x)) @@ -1908,10 +1909,9 @@ :trans (behavior () ((-> self state-hook)) - (if (and (or (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) - (logtest? (-> self state-flags) 8192) + (if (and (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) + (logtest? (-> self state-flags) (state-flags sf13)) ) (let ((v1-13 (if (> (-> self skel active-channels) 0) (-> self skel root-channel 0 frame-group) @@ -2063,11 +2063,10 @@ :trans (behavior () ((-> self state-hook)) - (if (and (or (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) - (logtest? (-> self state-flags) 8192) - (and (logtest? (-> self water flags) 1024) + (if (and (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) + (logtest? (-> self state-flags) (state-flags sf13)) + (and (logtest? (-> self water flags) (water-flags wt10)) (>= (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) ) ) @@ -2213,7 +2212,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 716 0 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! arg2 (cond (arg2 (empty) @@ -2256,8 +2255,8 @@ (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 12288.0) (and (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (zero? (logand (-> self water flags) 512)) - (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self water flags) (water-flags wt09))) + (zero? (logand (-> self state-flags) (state-flags sf11))) ) ) (go target-double-jump (-> *TARGET-bank* double-jump-height-min) (-> *TARGET-bank* double-jump-height-max)) @@ -2268,8 +2267,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -2440,7 +2439,7 @@ ) (set! (-> self state-time) (-> *display* base-frame-counter)) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *double-jump-mods*) (none) ) @@ -2464,8 +2463,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -2552,7 +2551,7 @@ (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 457 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) (set! (-> self control unknown-surface00) (cond @@ -2598,8 +2597,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go @@ -2634,7 +2633,7 @@ :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *turn-around-mods*) (none) ) @@ -2704,7 +2703,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 819 -609 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (cond ((= arg2 'launch) (set! (-> self neck flex-blend) 0.0) @@ -2864,7 +2863,9 @@ ) ) ) - (if (and (< (-> *TARGET-bank* fall-far) f0-1) (zero? (logand (-> self control status) 1024))) + (if (and (< (-> *TARGET-bank* fall-far) f0-1) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) (go target-hit-ground-hard f0-1) ) ) @@ -2917,7 +2918,7 @@ (go target-duck-stance) ) (when (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) - (if (logtest? (-> self water flags) 1024) + (if (logtest? (-> self water flags) (water-flags wt10)) (go target-wade-walk) (go target-walk) ) @@ -3116,7 +3117,9 @@ (behavior () (when (!= (-> self state-time) (-> *display* base-frame-counter)) (if (and (or (smack-surface? #t) - (and (>= (-> self control unknown-float63) 0.7) (zero? (logand (-> self control status) 32))) + (and (>= (-> self control unknown-float63) 0.7) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + ) ) (begin (set! (-> self control unknown-int21) (the-as int (-> *display* base-frame-counter))) @@ -3156,14 +3159,13 @@ (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (and (< 4096.0 (-> self control unknown-float01)) (or (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) - (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) - (pad-buttons square) - ) - ) + (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) + (pad-buttons square) + ) + ) ) - (zero? (logand (-> self state-flags) 6144)) - (zero? (logand (-> self control unknown-surface01 flags) 128)) + (zero? (logand (-> self state-flags) (state-flags sf11 sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07))) ) ) (go @@ -3172,7 +3174,7 @@ (-> *TARGET-bank* attack-jump-height-max) ) ) - (if (and (logtest? (-> self water flags) 512) + (if (and (logtest? (-> self water flags) (water-flags wt09)) (zero? (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21)) ) (dummy-13 @@ -3201,7 +3203,7 @@ ) :code (behavior () - (if (logtest? (-> self water flags) 512) + (if (logtest? (-> self water flags) (water-flags wt09)) (sound-play-by-name (static-sound-name "swim-stroke") (new-sound-id) 1024 0 0 1 #t) ) (ja-channel-push! 1 6) @@ -3224,7 +3226,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) - (and (and (zero? (logand (-> self control status) 1)) + (and (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-39 (if (> (-> self skel active-channels) 0) @@ -3232,12 +3234,11 @@ ) ) ) - (or (not - (or (= v1-39 (-> self draw art-group data 59)) - (= v1-39 (-> self draw art-group data 60)) - (= v1-39 (-> self draw art-group data 61)) - ) - ) + (or (not (or (= v1-39 (-> self draw art-group data 59)) + (= v1-39 (-> self draw art-group data 60)) + (= v1-39 (-> self draw art-group data 61)) + ) + ) (< 4096.0 (target-height-above-ground)) ) ) @@ -3298,7 +3299,7 @@ (+! gp-2 1) ) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-121 (if (> (-> self skel active-channels) 0) @@ -3343,7 +3344,7 @@ :enter (behavior ((arg0 symbol)) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (target-start-attack) (target-danger-set! 'spin-air #f) (set! (-> self control unknown-surface00) *jump-attack-mods*) @@ -3421,7 +3422,7 @@ ) :trans (behavior () - (when (logtest? (-> self control status) 1) + (when (logtest? (-> self control status) (cshape-moving-flags onsurf)) (set-quaternion! (-> self control) (-> self control dir-targ)) (go target-hit-ground #f) ) @@ -3489,11 +3490,10 @@ (let ((f0-8 (target-height-above-ground)) (f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) - (while (not - (or (and (< (fabs (/ f0-8 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) - (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1.7)) - ) - ) + (while (not (or (and (< (fabs (/ f0-8 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1.7)) + ) + ) (quaternion-rotate-y! (-> self control unknown-quaternion00) (-> self control unknown-quaternion00) @@ -3620,7 +3620,7 @@ ) (set! (-> self state-time) (-> *display* base-frame-counter)) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *uppercut-jump-mods*) (target-start-attack) (target-danger-set! 'uppercut #f) @@ -3630,7 +3630,7 @@ target-exit :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground #f) ) (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) @@ -3639,8 +3639,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (set-quaternion! (-> self control) (-> self control dir-targ)) @@ -3768,7 +3768,7 @@ (set-forward-vel (-> self control unknown-float01)) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flop-mods*) (set! (-> self control unknown-uint20) (the-as uint 0)) (set! (-> self control dynam gravity-max) 245760.0) @@ -3802,7 +3802,7 @@ :trans (behavior () (delete-back-vel) - (let ((gp-1 (logtest? (-> self control status) 1))) + (let ((gp-1 (logtest? (-> self control status) (cshape-moving-flags onsurf)))) (when (and (not gp-1) (let ((v1-6 (if (> (-> self skel active-channels) 0) (-> self skel root-channel 0 frame-group) ) @@ -3812,9 +3812,9 @@ ) ) (when (and (or (< (target-move-dist (seconds 0.1)) 1638.4) - (and (logtest? (-> self control status) 8) (< 0.7 (-> self control poly-angle))) + (and (logtest? (-> self control status) (cshape-moving-flags twall)) (< 0.7 (-> self control poly-angle))) ) - (zero? (logand (-> self control status) 32)) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) (>= (-> self control unknown-uint20) (the-as uint 2)) ) (set! (-> self control unknown-dword36) (-> *display* base-frame-counter)) @@ -3822,7 +3822,7 @@ ) ) (when gp-1 - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (when (and (= (-> self fact-info-target eco-type) (pickup-type eco-red)) (>= (-> self fact-info-target eco-level) 1.0) ) @@ -4069,8 +4069,8 @@ (set! (-> self control unknown-uint20) (the-as uint arg0)) (set-forward-vel (the-as float 0.0)) (set! (-> self control unknown-surface00) *flop-land-mods*) - (set! (-> *flop-land-mods* flags) (logand -1025 (-> *flop-land-mods* flags))) - (set! (-> self state-flags) (logior #x100000 (-> self state-flags))) + (logclear! (-> *flop-land-mods* flags) (surface-flags surf10)) + (set! (-> self state-flags) (logior (state-flags sf20) (-> self state-flags))) (none) ) :exit @@ -4106,7 +4106,7 @@ (if (and (or (= v1-33 (-> self draw art-group data 65)) (= v1-33 (-> self draw art-group data 68))) (>= (ja-aframe-num 0) 28.0) ) - (logior! (-> *flop-land-mods* flags) 1024) + (logior! (-> *flop-land-mods* flags) (surface-flags surf10)) ) ) (slide-down-test) @@ -4312,7 +4312,9 @@ (set! (-> s4-0 frame-num) 0.0) ) (let ((f30-0 1.0)) - (until (or (ja-max? 0) (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) 1))) + (until (or (ja-max? 0) + (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (cshape-moving-flags onsurf))) + ) (when (and (>= (ja-aframe-num 0) 3.0) (not (-> self control unknown-symbol30))) (set! (-> self event-hook) target-dangerous-event-handler) (target-start-attack) @@ -4350,7 +4352,7 @@ ) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (while (zero? (logand (-> self control status) 1)) + (while (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.01)) (when (not (= (if (> (-> self skel active-channels) 0) (-> self skel root-channel 0 frame-group) diff --git a/test/decompiler/reference/engine/ui/hud_REF.gc b/test/decompiler/reference/engine/ui/hud_REF.gc index fdf20f1af9..13d63db405 100644 --- a/test/decompiler/reference/engine/ui/hud_REF.gc +++ b/test/decompiler/reference/engine/ui/hud_REF.gc @@ -54,7 +54,7 @@ (not (movie?)) (>= (- (-> *display* base-frame-counter) (-> *game-info* letterbox-time)) (seconds 0.1)) (>= (- (-> *display* base-frame-counter) (-> *game-info* blackout-time)) (seconds 0.1)) - (not (and *target* (logtest? (-> *target* state-flags) 256))) + (not (and *target* (logtest? (-> *target* state-flags) (state-flags sf08)))) ) ) (when (or (!= (-> obj value) arg0) diff --git a/test/decompiler/reference/engine/util/glist_REF.gc b/test/decompiler/reference/engine/util/glist_REF.gc new file mode 100644 index 0000000000..1490de39a8 --- /dev/null +++ b/test/decompiler/reference/engine/util/glist_REF.gc @@ -0,0 +1,243 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for function glst-num-elements +(defun glst-num-elements ((arg0 glst-list)) + (-> arg0 numelem) + ) + +;; definition for function glst-remove +(defun glst-remove ((arg0 glst-list) (arg1 glst-node)) + (let ((v1-0 arg1)) + "return the previous node in the list" + (let ((v1-1 (-> v1-0 prev)) + (a2-1 arg1) + ) + "return the next node in the list" + (let ((a2-2 (-> a2-1 next))) + (set! (-> v1-1 next) a2-2) + (set! (-> a2-2 prev) v1-1) + ) + ) + ) + (+! (-> arg0 numelem) -1) + arg1 + ) + +;; definition for function glst-remove-tail +(defun glst-remove-tail ((arg0 glst-list)) + (let ((v1-0 arg0)) + "return the tail of the list" + (let* ((a1-1 (-> v1-0 tailpred)) + (v1-1 a1-1) + ) + "is this node the start of the list. #t = start" + (if (not (not (-> v1-1 prev))) + (glst-remove arg0 a1-1) + (the-as glst-node #f) + ) + ) + ) + ) + +;; definition for function glst-remove-head +(defun glst-remove-head ((arg0 glst-list)) + (let ((v1-0 arg0)) + "return the start of the list" + (let* ((a1-1 (-> v1-0 head)) + (v1-1 a1-1) + ) + "is this node the end of the list. #t = end" + (if (not (not (-> v1-1 next))) + (glst-remove arg0 a1-1) + (the-as glst-node #f) + ) + ) + ) + ) + +;; definition for function glst-insert-before +(defun glst-insert-before ((arg0 glst-list) (arg1 glst-node) (arg2 glst-node)) + (let ((v1-0 arg1)) + "return the previous node in the list" + (let ((v1-1 (-> v1-0 prev))) + (set! (-> arg2 prev) v1-1) + (set! (-> arg2 next) arg1) + (set! (-> v1-1 next) arg2) + ) + ) + (set! (-> arg1 prev) arg2) + (+! (-> arg0 numelem) 1) + arg2 + ) + +;; definition for function glst-insert-after +(defun glst-insert-after ((arg0 glst-list) (arg1 glst-node) (arg2 glst-node)) + (let ((v1-0 arg1)) + "return the next node in the list" + (let ((v1-1 (-> v1-0 next))) + (set! (-> arg2 prev) arg1) + (set! (-> arg2 next) v1-1) + (set! (-> v1-1 prev) arg2) + ) + ) + (set! (-> arg1 next) arg2) + (+! (-> arg0 numelem) 1) + arg2 + ) + +;; definition for function glst-add-tail +(defun glst-add-tail ((arg0 glst-list) (arg1 glst-node)) + (glst-insert-before arg0 (the-as glst-node (&-> arg0 tail)) arg1) + arg1 + ) + +;; definition for function glst-add-head +(defun glst-add-head ((arg0 glst-list) (arg1 glst-node)) + (glst-insert-after arg0 (the-as glst-node arg0) arg1) + arg1 + ) + +;; definition for function glst-init-list! +(defun glst-init-list! ((arg0 glst-list)) + (set! (-> arg0 head) (the-as glst-node (&-> arg0 tail))) + (set! (-> arg0 tail) #f) + (set! (-> arg0 tailpred) (the-as glst-node (&-> arg0 head))) + (set! (-> arg0 numelem) 0) + arg0 + ) + +;; definition for function glst-find-node-by-name +;; WARN: Type Propagation failed: Failed type prop at op 7 ((set! a0 (l.wu (+ v1 8)))): Could not get type of load: (set! a0 (l.wu (+ v1 8))). +;; WARN: Type Propagation failed: Type analysis failed +(defun glst-find-node-by-name ((a0-0 glst-list) (a1-0 string)) + (local-vars + (v0-0 none) + (v0-1 symbol) + (v1-0 glst-list) + (v1-1 glst-node) + (v1-4 none) + (v1-5 none) + (v1-6 glst-node) + (v1-7 glst-node) + (v1-8 symbol) + (a0-1 string) + (a0-2 none) + (a0-3 string) + (s5-0 glst-node) + (t9-0 (function basic basic symbol)) + ) + (set! v1-0 a0-0) + (set! a0-1 L41) + (set! s5-0 (-> v1-0 head)) + (while (begin (set! v1-6 s5-0) (set! a0-3 L40) (set! v1-7 (-> v1-6 next)) (set! v1-8 (not v1-7)) (not v1-8)) + (if (begin + (set! t9-0 name=) + (set! v1-1 s5-0) + (set! a0-2 (the-as none (l.wu (+ v1-1 8)))) + (set! a1-1 (the-as none a1-0)) + (set! v0-0 (the-as none (call!))) + v0-0 + ) + (return (set! v0-1 (the-as symbol s5-0))) + ) + (set! v1-4 (the-as none L44)) + (set! v1-5 (the-as none (l.wu s5-0))) + (set! s5-0 (the-as glst-node v1-5)) + ) + (set! v0-1 #f) + (ret-value v0-1) + ) + +;; definition for function glst-get-node-by-index +(defun glst-get-node-by-index ((arg0 glst-list) (arg1 int)) + (when (and (< arg1 (glst-num-elements arg0)) (>= arg1 0)) + "return the start of the list" + (let ((v1-3 (-> arg0 head))) + (dotimes (a0-3 arg1) + (nop!) + (nop!) + (nop!) + (nop!) + "return the next node in the list" + (set! v1-3 (-> v1-3 next)) + ) + (return v1-3) + ) + ) + (the-as glst-node #f) + ) + +;; definition for function glst-length-of-longest-name +;; WARN: Type Propagation failed: Failed type prop at op 6 ((set! a0 (l.wu (+ v1 8)))): Could not get type of load: (set! a0 (l.wu (+ v1 8))). +;; WARN: Type Propagation failed: Type analysis failed +(defun glst-length-of-longest-name ((a0-0 glst-list)) + (local-vars + (v0-0 none) + (v0-1 int) + (v1-0 glst-list) + (v1-1 glst-node) + (v1-2 none) + (v1-3 none) + (v1-4 none) + (v1-5 none) + (v1-6 glst-node) + (v1-7 glst-node) + (v1-8 symbol) + (a0-1 string) + (a0-2 none) + (a0-5 string) + (s5-0 glst-node) + (t9-0 none) + (gp-0 int) + ) + (set! gp-0 0) + (set! v1-0 a0-0) + (set! a0-1 L41) + (set! s5-0 (-> v1-0 head)) + (while (begin (set! v1-6 s5-0) (set! a0-5 L40) (set! v1-7 (-> v1-6 next)) (set! v1-8 (not v1-7)) (not v1-8)) + (when (begin + (set! v1-1 s5-0) + (set! a0-2 (the-as none (l.wu (+ v1-1 8)))) + (set! v1-2 (the-as none string)) + (set! t9-0 (the-as none (l.wu (+ v1-2 32)))) + (set! v0-0 (the-as none (call!))) + (set! v1-3 (the-as none v0-0)) + (<.si gp-0 v1-3) + ) + (set! gp-0 (the-as int v1-3)) + (set! a0-4 (the-as none gp-0)) + ) + (set! v1-4 (the-as none L44)) + (set! v1-5 (the-as none (l.wu s5-0))) + (set! s5-0 (the-as glst-node v1-5)) + ) + (set! v0-1 gp-0) + (ret-value v0-1) + ) + +;; definition for function glst-get-node-index +(defun glst-get-node-index ((arg0 glst-list) (arg1 glst-node)) + (let ((v1-0 0)) + "return the start of the list" + (let ((a0-1 (-> arg0 head))) + (while (let ((a2-3 a0-1)) + "is this node the end of the list. #t = end" + (not (not (-> a2-3 next))) + ) + (if (= a0-1 arg1) + (return v1-0) + ) + (+! v1-0 1) + "return the next node in the list" + (set! a0-1 (-> a0-1 next)) + ) + ) + ) + -1 + ) + +) diff --git a/test/decompiler/reference/levels/beach/beach-obs_REF.gc b/test/decompiler/reference/levels/beach/beach-obs_REF.gc index 83fe42fc34..75673e39ed 100644 --- a/test/decompiler/reference/levels/beach/beach-obs_REF.gc +++ b/test/decompiler/reference/levels/beach/beach-obs_REF.gc @@ -883,7 +883,7 @@ ) (while (< s5-0 2) (cond - ((logtest? (-> self root-override status) 1) + ((logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (when (not gp-0) (+! s5-0 1) (set! f30-0 0.8) @@ -917,7 +917,7 @@ ) (while (< 2048.0 (vector-length (-> self root-override transv))) (cond - ((logtest? (-> self root-override status) 1) + ((logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (vector-float*! (-> self root-override transv) (-> self root-override transv) 0.8) ) (else @@ -1461,7 +1461,7 @@ ) (suspend) (set! v1-25 (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) - (logtest? (-> self root-override status) 1) + (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) ) ) ) diff --git a/test/decompiler/reference/levels/beach/beach-part_REF.gc b/test/decompiler/reference/levels/beach/beach-part_REF.gc index 1e0501b312..4c0f076936 100644 --- a/test/decompiler/reference/levels/beach/beach-part_REF.gc +++ b/test/decompiler/reference/levels/beach/beach-part_REF.gc @@ -658,9 +658,7 @@ ) ;; definition for symbol sound-beach-waterfall, type sound-spec -(define sound-beach-waterfall - (new 'static 'sound-spec :num 1.0 :group #x1 :sound-name (static-sound-name "waterfall") :volume #x400) - ) +(define sound-beach-waterfall (static-sound-spec "waterfall")) ;; failed to figure out what this is: (defpartgroup group-beach-butterflies diff --git a/test/decompiler/reference/levels/beach/bird-lady_REF.gc b/test/decompiler/reference/levels/beach/bird-lady_REF.gc index 01a1526956..ceb56a623c 100644 --- a/test/decompiler/reference/levels/beach/bird-lady_REF.gc +++ b/test/decompiler/reference/levels/beach/bird-lady_REF.gc @@ -29,7 +29,7 @@ ) ;; definition for method 52 of type bird-lady -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 bird-lady ((obj bird-lady)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -43,7 +43,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -58,14 +58,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/beach/lurkercrab_REF.gc b/test/decompiler/reference/levels/beach/lurkercrab_REF.gc index 23ad8d07ea..b8c6dc42de 100644 --- a/test/decompiler/reference/levels/beach/lurkercrab_REF.gc +++ b/test/decompiler/reference/levels/beach/lurkercrab_REF.gc @@ -507,7 +507,7 @@ nav-enemy-default-event-handler ) :trans (behavior () - (if (logtest? (-> *target* state-flags) #x80f8) + (if (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (go-virtual nav-enemy-victory) ) (if (< (ja-aframe-num 0) 2.0) diff --git a/test/decompiler/reference/levels/beach/mayor_REF.gc b/test/decompiler/reference/levels/beach/mayor_REF.gc index ab46994fea..c7c00417db 100644 --- a/test/decompiler/reference/levels/beach/mayor_REF.gc +++ b/test/decompiler/reference/levels/beach/mayor_REF.gc @@ -55,14 +55,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (set! (-> v1-14 settings flags) (logior (the-as int (-> v1-14 settings flags)) 32)) + (set! (-> v1-14 settings flags) (the-as shadow-flags (logior (the-as int (-> v1-14 settings flags)) 32))) ) 0 ) diff --git a/test/decompiler/reference/levels/beach/sculptor_REF.gc b/test/decompiler/reference/levels/beach/sculptor_REF.gc index 959c288884..1e6d7d0219 100644 --- a/test/decompiler/reference/levels/beach/sculptor_REF.gc +++ b/test/decompiler/reference/levels/beach/sculptor_REF.gc @@ -66,14 +66,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/beach/seagull_REF.gc b/test/decompiler/reference/levels/beach/seagull_REF.gc index 9752790f3c..74ce4356f2 100644 --- a/test/decompiler/reference/levels/beach/seagull_REF.gc +++ b/test/decompiler/reference/levels/beach/seagull_REF.gc @@ -27,9 +27,7 @@ ) ;; definition for symbol sound-seagull-squall, type sound-spec -(define sound-seagull-squall - (new 'static 'sound-spec :num 1.0 :group #x1 :sound-name (static-sound-name "seagulls-2") :volume #x400) - ) +(define sound-seagull-squall (static-sound-spec "seagulls-2")) ;; definition of type seagull (deftype seagull (process-drawable) @@ -1338,7 +1336,7 @@ ) ;; definition for function seagull-reaction -;; INFO: Return type mismatch int vs uint. +;; INFO: Return type mismatch int vs cshape-moving-flags. (defun seagull-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) (let ((s5-0 0)) (let ((a1-1 (new 'stack-no-clear 'vector))) @@ -1359,8 +1357,8 @@ (set! (-> (the-as seagull s4-1) temp-heading-time) 300) ) (let ((v0-2 (logior s5-0 3))) - (set! (-> arg0 status) (the-as uint v0-2)) - (the-as uint v0-2) + (set! (-> arg0 status) (the-as cshape-moving-flags v0-2)) + (the-as cshape-moving-flags v0-2) ) ) ) diff --git a/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc b/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc index 27a2c609e6..640c801ed5 100644 --- a/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc +++ b/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc @@ -578,19 +578,8 @@ ) ) (dummy-21 obj) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "rotate-plat") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "rotate-plat" :fo-max 20) (-> obj root-override trans)) ) (logior! (-> obj skel status) (janim-status inited)) (go citb-disc-idle) @@ -1293,19 +1282,8 @@ (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 601) obj)) (logclear! (-> obj mask) (process-mask actor-pause)) (set! (-> obj shield-on) #t) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "robotcage-lp") - :volume #x400 - :fo-max #x96 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "robotcage-lp" :fo-max 150) (-> obj root-override trans)) ) (if (= (get-task-status (-> obj entity extra perm task)) (task-status invalid)) (go citb-robotboss-die) @@ -2076,19 +2054,8 @@ (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 600) obj)) (set! (-> obj part-broken) (create-launch-control (-> *part-group-id-table* 597) obj)) (set! (-> obj part-mushroom) (create-launch-control (-> *part-group-id-table* 599) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "mushroom-gen") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "mushroom-gen" :fo-max 20) (-> obj root-override trans)) ) 0 (none) @@ -2301,7 +2268,7 @@ ) (send-event (handle->process (the-as handle gp-1)) 'mask 2048) (while (handle->process (the-as handle gp-1)) - (set! (-> *target* state-flags) (logand -17 (-> *target* state-flags))) + (logclear! (-> *target* state-flags) (state-flags sf04)) (suspend) ) ) diff --git a/test/decompiler/reference/levels/citadel/citadel-sages_REF.gc b/test/decompiler/reference/levels/citadel/citadel-sages_REF.gc index 8c1bb026d3..d9787b1d1f 100644 --- a/test/decompiler/reference/levels/citadel/citadel-sages_REF.gc +++ b/test/decompiler/reference/levels/citadel/citadel-sages_REF.gc @@ -228,19 +228,8 @@ (set-vector! (-> obj bar-array 10) 0.0 f0-1 f1-0 1.0) (set-vector! (-> obj bar-array 11) f2-0 f0-1 f1-0 1.0) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "sagecage-gen") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "sagecage-gen" :fo-max 20) (-> obj root-override trans)) ) (set! (-> obj bars-on) (not (task-complete? *game-info* (-> obj entity extra perm task)))) (citb-sagecage-update-collision) @@ -580,7 +569,7 @@ ) ;; definition for method 52 of type red-sagecage -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 red-sagecage ((obj red-sagecage)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -592,7 +581,7 @@ (set! (-> a0-3 settings top-plane w) (- 4096.0)) ) 0 - (set! (-> v1-1 settings flags) (logand -13 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02 shdf03)) ) ) (none) @@ -607,14 +596,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -714,7 +703,7 @@ ) ;; definition for method 52 of type blue-sagecage -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 blue-sagecage ((obj blue-sagecage)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -726,7 +715,7 @@ (set! (-> a0-3 settings top-plane w) (- 4096.0)) ) 0 - (set! (-> v1-1 settings flags) (logand -13 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02 shdf03)) ) ) (none) @@ -741,14 +730,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -853,7 +842,7 @@ ) ;; definition for method 52 of type yellow-sagecage -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 yellow-sagecage ((obj yellow-sagecage)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -865,7 +854,7 @@ (set! (-> a0-3 settings top-plane w) (- 4096.0)) ) 0 - (set! (-> v1-1 settings flags) (logand -13 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02 shdf03)) ) ) (none) @@ -880,14 +869,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/citadel/citb-bunny_REF.gc b/test/decompiler/reference/levels/citadel/citb-bunny_REF.gc index f117da816c..09384fe92e 100644 --- a/test/decompiler/reference/levels/citadel/citb-bunny_REF.gc +++ b/test/decompiler/reference/levels/citadel/citb-bunny_REF.gc @@ -97,7 +97,7 @@ (defmethod TODO-RENAME-48 citb-bunny ((obj citb-bunny) (arg0 object)) (dummy-60 obj) (TODO-RENAME-45 obj *citb-bunny-nav-enemy-info*) - (set! (-> obj draw shadow-ctrl settings flags) (logand -9 (-> obj draw shadow-ctrl settings flags))) + (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf03)) (cond ((zero? (res-lump-value (-> obj entity) 'mode uint128)) (set! (-> obj defense) (the-as uint 1)) diff --git a/test/decompiler/reference/levels/citadel/citb-plat_REF.gc b/test/decompiler/reference/levels/citadel/citb-plat_REF.gc index c0adc32e41..cb6b0b193d 100644 --- a/test/decompiler/reference/levels/citadel/citb-plat_REF.gc +++ b/test/decompiler/reference/levels/citadel/citb-plat_REF.gc @@ -717,19 +717,8 @@ (set! (-> obj idle-offset) 0.0) (set! (-> obj float-offset) (res-lump-float (-> obj entity) 'height-info :default 4096.0)) (set! (-> obj float-height-offset) (-> obj idle-offset)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-plat-hover") - :volume #x400 - :fo-max 50 - ) - (-> obj root-overlay trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-plat-hover" :fo-max 50) (-> obj root-overlay trans)) ) (let ((s5-0 (-> obj info control-point-count))) (dotimes (s4-0 s5-0) @@ -939,19 +928,8 @@ (defmethod dummy-22 citb-donut ((obj citb-donut)) (initialize-skeleton obj *citb-donut-sg* '()) (setup-params! (-> obj sync) (the-as uint 9000) 0.0 0.15 0.15) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "rotate-plat") - :volume #x400 - :fo-max 20 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "rotate-plat" :fo-max 20) (-> obj root-override trans)) ) (logclear! (-> obj mask) (process-mask actor-pause)) 0 diff --git a/test/decompiler/reference/levels/common/basebutton_REF.gc b/test/decompiler/reference/levels/common/basebutton_REF.gc index a28cc018fc..5b8b735ac3 100644 --- a/test/decompiler/reference/levels/common/basebutton_REF.gc +++ b/test/decompiler/reference/levels/common/basebutton_REF.gc @@ -633,7 +633,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x20 + :flags (surface-flags surf05) ) ) @@ -656,20 +656,20 @@ :enter (behavior ((arg0 vector) (arg1 vector)) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *warp-jump-mods*) (set! (-> self control unknown-vector102 quad) (-> arg0 quad)) (set! (-> self control unknown-vector103 quad) (-> arg1 quad)) (set! (-> self control unknown-vector102 y) (+ -4096.0 (-> self control unknown-vector102 y))) (set! (-> self control unknown-uint20) (the-as uint #f)) (vector-reset! (-> self control transv)) - (logior! (-> self state-flags) 1024) + (logior! (-> self state-flags) (state-flags sf10)) (set! (-> self alt-cam-pos quad) (-> arg1 quad)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (none) ) :code diff --git a/test/decompiler/reference/levels/common/baseplat_REF.gc b/test/decompiler/reference/levels/common/baseplat_REF.gc index d08a43d82a..da1414128f 100644 --- a/test/decompiler/reference/levels/common/baseplat_REF.gc +++ b/test/decompiler/reference/levels/common/baseplat_REF.gc @@ -133,18 +133,18 @@ ;; definition of type eco-door (deftype eco-door (process-drawable) - ((root-override collide-shape :offset 112) - (speed float :offset-assert 176) - (open-distance float :offset-assert 180) - (close-distance float :offset-assert 184) - (out-dir vector :inline :offset-assert 192) - (open-sound sound-name :offset-assert 208) - (close-sound sound-name :offset-assert 224) - (state-actor entity-actor :offset-assert 240) - (flags int32 :offset-assert 244) - (locked symbol :offset-assert 248) - (auto-close symbol :offset-assert 252) - (one-way symbol :offset-assert 256) + ((root-override collide-shape :offset 112) + (speed float :offset-assert 176) + (open-distance float :offset-assert 180) + (close-distance float :offset-assert 184) + (out-dir vector :inline :offset-assert 192) + (open-sound sound-name :offset-assert 208) + (close-sound sound-name :offset-assert 224) + (state-actor entity-actor :offset-assert 240) + (flags eco-door-flags :offset-assert 244) + (locked symbol :offset-assert 248) + (auto-close symbol :offset-assert 252) + (one-way symbol :offset-assert 256) ) :heap-base #xa0 :method-count-assert 27 @@ -373,8 +373,8 @@ eco-door-event-handler (defmethod dummy-26 eco-door ((obj eco-door)) (when (-> obj state-actor) (if (logtest? (-> obj state-actor extra perm status) (entity-perm-status complete)) - (set! (-> obj locked) (logtest? (-> obj flags) 2)) - (set! (-> obj locked) (logtest? (-> obj flags) 1)) + (set! (-> obj locked) (logtest? (-> obj flags) (eco-door-flags ecdf01))) + (set! (-> obj locked) (logtest? (-> obj flags) (eco-door-flags ecdf00))) ) ) 0 @@ -427,10 +427,10 @@ eco-door-event-handler ) ) (set! (-> obj locked) #f) - (set! (-> obj flags) (res-lump-value arg0 'flags int)) + (set! (-> obj flags) (res-lump-value arg0 'flags eco-door-flags)) (dummy-26 obj) - (set! (-> obj auto-close) (logtest? (-> obj flags) 4)) - (set! (-> obj one-way) (logtest? (-> obj flags) 8)) + (set! (-> obj auto-close) (logtest? (-> obj flags) (eco-door-flags auto-close))) + (set! (-> obj one-way) (logtest? (-> obj flags) (eco-door-flags one-way))) (vector-z-quaternion! (-> obj out-dir) (-> obj root-override quat)) (set! (-> obj out-dir w) (- (vector-dot (-> obj out-dir) (-> obj root-override trans)))) (update-transforms! (-> obj root-override)) diff --git a/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc b/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc index 1c8c4ccc65..bca7932fd1 100644 --- a/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc +++ b/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc @@ -97,29 +97,29 @@ ) ;; definition for method 25 of type dark-eco-pool +;; INFO: Return type mismatch object vs none. (defmethod TODO-RENAME-25 dark-eco-pool ((obj dark-eco-pool)) (let ((t9-0 (method-of-type water-anim TODO-RENAME-25))) (t9-0 obj) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x1000000 (-> obj flags))) - (let ((v0-1 ((the-as - (function res-lump symbol symbol float structure (pointer res-tag) pointer object) - (method-of-type res-lump get-property-struct) - ) - (-> obj entity) - 'attack-event - 'interp - -1000000000.0 - 'dark-eco-pool - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt24) (-> obj flags))) + (set! (-> obj attack-event) + (the-as symbol ((the-as + (function res-lump symbol symbol float structure (pointer res-tag) pointer object) + (method-of-type res-lump get-property-struct) + ) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + 'dark-eco-pool + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) ) - (set! (-> obj attack-event) (the-as symbol v0-1)) - v0-1 - ) + (none) ) ;; definition for method 22 of type dark-eco-pool diff --git a/test/decompiler/reference/levels/common/nav-enemy_REF.gc b/test/decompiler/reference/levels/common/nav-enemy_REF.gc index 849eee7150..96ef13b010 100644 --- a/test/decompiler/reference/levels/common/nav-enemy_REF.gc +++ b/test/decompiler/reference/levels/common/nav-enemy_REF.gc @@ -80,9 +80,10 @@ ;; INFO: Return type mismatch int vs none. (defmethod common-post nav-enemy ((obj nav-enemy)) (when (and (logtest? (-> obj nav-enemy-flags) (nav-enemy-flags navenmf8)) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> obj touch-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> obj touch-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> obj collide-info) 2 (collide-offense touch)) @@ -536,13 +537,16 @@ nav-enemy-default-event-handler ;; definition for function nav-enemy-player-vulnerable? ;; INFO: Return type mismatch basic vs symbol. (defun nav-enemy-player-vulnerable? () - (the-as symbol (and *target* (zero? (logand (-> *target* state-flags) #x80f8)))) + (the-as + symbol + (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) + ) ) ;; definition for method 46 of type nav-enemy (defmethod TODO-RENAME-46 nav-enemy ((obj nav-enemy) (arg0 float)) (and *target* - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (and (or (zero? (logand (-> obj nav-enemy-flags) (nav-enemy-flags navenmf12))) (< (vector-vector-distance (target-pos 0) (-> obj collide-info trans)) arg0) ) @@ -725,14 +729,14 @@ nav-enemy-default-event-handler (set! (-> v1-14 frame-num) 0.0) ) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self collide-info status) (logand -8 (-> self collide-info status))) + (logclear! (-> self collide-info status) (cshape-moving-flags onsurf onground tsurf)) (until (ja-done? 0) (cond ((nonzero? (-> self align)) (when (not s4-1) (TODO-RENAME-9 (-> self align)) (TODO-RENAME-10 (-> self align) 4098 1.0 arg1 1.0) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (let ((f0-6 (* (- (-> self align delta trans z)) (-> *display* frames-per-second)))) (set! (-> self collide-info transv x) (* (-> self hit-from-dir x) f0-6)) (set! (-> self collide-info transv z) (* (-> self hit-from-dir z) f0-6)) @@ -1306,7 +1310,7 @@ nav-enemy-default-event-handler ) :trans (behavior () - (if (logtest? (-> *target* state-flags) 128) + (if (logtest? (-> *target* state-flags) (state-flags sf07)) (go-virtual nav-enemy-patrol) ) (if (logtest? (-> self nav-enemy-flags) (nav-enemy-flags navenmf8)) @@ -1396,7 +1400,7 @@ nav-enemy-default-event-handler :trans (behavior () (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) - (if (logtest? (-> *target* state-flags) 128) + (if (logtest? (-> *target* state-flags) (state-flags sf07)) (go-virtual nav-enemy-patrol) ) (if (and (TODO-RENAME-46 self (-> self nav-info notice-distance)) (not (nav-enemy-frustrated?))) @@ -1474,7 +1478,7 @@ nav-enemy-default-event-handler :trans (behavior () (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) - (if (logtest? (-> *target* state-flags) 128) + (if (logtest? (-> *target* state-flags) (state-flags sf07)) (go-virtual nav-enemy-patrol) ) (cond @@ -1489,16 +1493,15 @@ nav-enemy-default-event-handler (set! (-> self notice-time) (-> *display* base-frame-counter)) ) ) - (when (not - (or (and *target* (>= 40960.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)))) - (and (-> self nav-info use-proximity-notice) - *target* - (>= (-> self nav-info proximity-notice-distance) - (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)) - ) - ) - ) - ) + (when (not (or (and *target* (>= 40960.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)))) + (and (-> self nav-info use-proximity-notice) + *target* + (>= (-> self nav-info proximity-notice-distance) + (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)) + ) + ) + ) + ) (logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf2)) (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) (-> self state-timeout)) (go-virtual nav-enemy-give-up) @@ -1808,7 +1811,7 @@ nav-enemy-default-event-handler ) ) ) - (set! (-> self collide-info status) (logand -8 (-> self collide-info status))) + (logclear! (-> self collide-info status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self jump-time) (-> *display* base-frame-counter)) (logior! (-> self nav-enemy-flags) (nav-enemy-flags enable-rotate)) (cond diff --git a/test/decompiler/reference/levels/common/orb-cache_REF.gc b/test/decompiler/reference/levels/common/orb-cache_REF.gc index 85f519b644..8860366996 100644 --- a/test/decompiler/reference/levels/common/orb-cache_REF.gc +++ b/test/decompiler/reference/levels/common/orb-cache_REF.gc @@ -271,50 +271,47 @@ ) (while #t (calculate-pos self #t) - (while (not - (or (not *target*) (< (-> self inactive-distance) - (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) - ) - ) - ) + (while (not (or (not *target*) (< (-> self inactive-distance) + (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) + ) + ) + ) (pos-logic self #t) (suspend) ) (calculate-pos self #f) - (while (and (not - (and (and *target* (>= (-> self active-distance) - (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) - ) + (while (and (not (and (and *target* (>= (-> self active-distance) + (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) + ) + ) + (let ((a1-11 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-11 from) self) + (set! (-> a1-11 num-params) 2) + (set! (-> a1-11 message) 'query) + (set! (-> a1-11 param 0) (the-as uint 'powerup)) + (set! (-> a1-11 param 1) (the-as uint 3)) + (or (send-event-function *target* a1-11) (-> self activated)) ) - (let ((a1-11 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-11 from) self) - (set! (-> a1-11 num-params) 2) - (set! (-> a1-11 message) 'query) - (set! (-> a1-11 param 0) (the-as uint 'powerup)) - (set! (-> a1-11 param 1) (the-as uint 3)) - (or (send-event-function *target* a1-11) (-> self activated)) - ) - ) - ) + ) + ) (not (pos-logic self #f)) ) (suspend) ) - (if (not - (and (and *target* (>= (-> self active-distance) - (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) - ) + (if (not (and (and *target* (>= (-> self active-distance) + (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)) + ) + ) + (let ((a1-14 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-14 from) self) + (set! (-> a1-14 num-params) 2) + (set! (-> a1-14 message) 'query) + (set! (-> a1-14 param 0) (the-as uint 'powerup)) + (set! (-> a1-14 param 1) (the-as uint 3)) + (or (send-event-function *target* a1-14) (-> self activated)) ) - (let ((a1-14 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-14 from) self) - (set! (-> a1-14 num-params) 2) - (set! (-> a1-14 message) 'query) - (set! (-> a1-14 param 0) (the-as uint 'powerup)) - (set! (-> a1-14 param 1) (the-as uint 3)) - (or (send-event-function *target* a1-14) (-> self activated)) - ) - ) - ) + ) + ) (go orb-cache-top-idle arg0) ) ) diff --git a/test/decompiler/reference/levels/common/plat-button_REF.gc b/test/decompiler/reference/levels/common/plat-button_REF.gc index 3a429e3a95..d7c3b9f123 100644 --- a/test/decompiler/reference/levels/common/plat-button_REF.gc +++ b/test/decompiler/reference/levels/common/plat-button_REF.gc @@ -273,12 +273,13 @@ ) (rider-trans) (when (-> self go-back-if-lost-player?) - (when (or (not *target*) (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) - (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) - ) + (when (or (not *target*) + (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) + ) ) (set! (-> self go-back-if-lost-player?) #f) (go-virtual plat-button-move-upward) @@ -307,7 +308,7 @@ ) (sound-trans-convert (-> gp-1 parms trans) a1-6) ) - (set! (-> gp-1 parms mask) (the-as uint 32)) + (set! (-> gp-1 parms mask) (sound-mask trans)) (-> gp-1 id) ) (if (and (-> self grab-player?) (< 0.2 (-> self path-pos))) @@ -353,12 +354,13 @@ ) (rider-trans) (when (-> self go-back-if-lost-player?) - (when (or (not *target*) (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) - (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) - ) - ) - ) + (when (or (not *target*) + (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 4)) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) + ) ) (set! (-> self go-back-if-lost-player?) #f) (go-virtual plat-button-move-downward) @@ -387,7 +389,7 @@ ) (sound-trans-convert (-> gp-1 parms trans) a1-6) ) - (set! (-> gp-1 parms mask) (the-as uint 32)) + (set! (-> gp-1 parms mask) (sound-mask trans)) (-> gp-1 id) ) (if (and (-> self grab-player?) (< (-> self path-pos) 0.8)) diff --git a/test/decompiler/reference/levels/common/sharkey_REF.gc b/test/decompiler/reference/levels/common/sharkey_REF.gc index 488df75a60..8bb0041a8c 100644 --- a/test/decompiler/reference/levels/common/sharkey_REF.gc +++ b/test/decompiler/reference/levels/common/sharkey_REF.gc @@ -587,8 +587,8 @@ nav-enemy-default-event-handler (go-virtual nav-enemy-patrol) ) ) - (when (logtest? (-> *target* control status) 2) - (set! (-> self player-in-water) (logtest? (-> *target* control status) 1024)) + (when (logtest? (-> *target* control status) (cshape-moving-flags onground)) + (set! (-> self player-in-water) (logtest? (-> *target* control status) (cshape-moving-flags on-water))) (if (-> self player-in-water) (set! (-> self player-water-time) (-> *display* base-frame-counter)) ) @@ -888,7 +888,7 @@ nav-enemy-default-event-handler (TODO-RENAME-45 obj *sharkey-nav-enemy-info*) (logclear! (-> obj mask) (process-mask actor-pause)) (set! (-> obj water) (new 'process 'water-control obj 3 12288.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint #xc00002)) + (set! (-> obj water flags) (water-flags wt01 wt22 wt23)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 20480.0) (set! (-> obj spawn-point quad) (-> obj collide-info trans quad)) diff --git a/test/decompiler/reference/levels/common/water-anim_REF.gc b/test/decompiler/reference/levels/common/water-anim_REF.gc index 92b7b5e0b3..1309aeb44b 100644 --- a/test/decompiler/reference/levels/common/water-anim_REF.gc +++ b/test/decompiler/reference/levels/common/water-anim_REF.gc @@ -486,207 +486,95 @@ :skel-group '*water-anim-sunken-big-room-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 70 - :fo-max 80 - ) + (static-sound-spec "water-loop" :fo-min 70 :fo-max 80) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-first-room-from-entrance-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 50 - :fo-max 60 - ) + (static-sound-spec "water-loop" :fo-min 50 :fo-max 60) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-qbert-room-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 48 - :fo-max 58 - ) + (static-sound-spec "water-loop" :fo-min 48 :fo-max 58) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-first-right-branch-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 30 - :fo-max 40 - ) + (static-sound-spec "water-loop" :fo-min 30 :fo-max 40) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-circular-with-bullys-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 15 - :fo-max 25 - ) + (static-sound-spec "water-loop" :fo-min 15 :fo-max 25) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-hall-with-one-whirlpool-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 27 - :fo-max 37 - ) + (static-sound-spec "water-loop" :fo-min 27 :fo-max 37) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-hall-with-three-whirlpools-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 26 - :fo-max 36 - ) + (static-sound-spec "water-loop" :fo-min 26 :fo-max 36) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-start-of-helix-slide-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 25 - :fo-max 35 - ) + (static-sound-spec "water-loop" :fo-min 25 :fo-max 35) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-room-above-exit-chamber-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 45 - :fo-max 55 - ) + (static-sound-spec "water-loop" :fo-min 45 :fo-max 55) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-hall-before-big-room-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 20 - :fo-max 30 - ) + (static-sound-spec "water-loop" :fo-min 20 :fo-max 30) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-dark-eco-qbert-sg* :anim 6 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 40 - :fo-max 50 - ) + (static-sound-spec "darkeco-pool" :fo-min 40 :fo-max 50) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-short-piece-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 20 - :fo-max 30 - ) + (static-sound-spec "water-loop" :fo-min 20 :fo-max 30) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-big-room-upper-water-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "water-loop") - :volume #x400 - :fo-min 27 - :fo-max 37 - ) + (static-sound-spec "water-loop" :fo-min 27 :fo-max 37) ) (new 'static 'water-anim-look :skel-group '*water-anim-sunken-dark-eco-platform-room-sg* :anim 6 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 22 - :fo-max 32 - ) + (static-sound-spec "darkeco-pool" :fo-min 22 :fo-max 32) ) (new 'static 'water-anim-look :skel-group @@ -698,88 +586,40 @@ :skel-group '*water-anim-maincave-center-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 70 - :fo-max 80 - ) + (static-sound-spec "darkeco-pool" :fo-min 70 :fo-max 80) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-lower-right-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 40 - :fo-max 50 - ) + (static-sound-spec "darkeco-pool" :fo-min 40 :fo-max 50) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-mid-right-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 37 - :fo-max 47 - ) + (static-sound-spec "darkeco-pool" :fo-min 37 :fo-max 47) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-lower-left-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 20 - :fo-max 30 - ) + (static-sound-spec "darkeco-pool" :fo-min 20 :fo-max 30) ) (new 'static 'water-anim-look :skel-group '*water-anim-maincave-mid-left-pool-sg* :anim 10 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 51 - :fo-max 61 - ) + (static-sound-spec "darkeco-pool" :fo-min 51 :fo-max 61) ) (new 'static 'water-anim-look :skel-group '*water-anim-robocave-main-pool-sg* :anim 3 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 54 - :fo-max 64 - ) + (static-sound-spec "darkeco-pool" :fo-min 54 :fo-max 64) ) (new 'static 'water-anim-look :skel-group '*water-anim-misty-mud-by-arena-sg* :anim 24 :ambient-sound-spec #f) (new 'static 'water-anim-look @@ -839,15 +679,7 @@ :skel-group '*water-anim-misty-dark-eco-pool-sg* :anim 24 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 17 - :fo-max 27 - ) + (static-sound-spec "darkeco-pool" :fo-min 17 :fo-max 27) ) (new 'static 'water-anim-look :skel-group '*water-anim-ogre-lava-sg* :anim 2 :ambient-sound-spec #f) (new 'static 'water-anim-look :skel-group '*water-anim-jungle-river-sg* :anim 3 :ambient-sound-spec #f) @@ -866,30 +698,14 @@ '*water-anim-sunken-dark-eco-helix-room-sg* :anim 6 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "helix-dark-eco") - :volume #x400 - :fo-min #x78 - :fo-max #x82 - ) + (static-sound-spec "helix-dark-eco" :fo-min 120 :fo-max 130) ) (new 'static 'water-anim-look :skel-group '*water-anim-finalboss-dark-eco-pool-sg* :anim 2 :ambient-sound-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "darkeco-pool") - :volume #x400 - :fo-min 19 - :fo-max 29 - ) + (static-sound-spec "darkeco-pool" :fo-min 19 :fo-max 29) ) (new 'static 'water-anim-look :skel-group '*water-anim-lavatube-energy-lava-sg* @@ -974,7 +790,7 @@ ) ;; definition for method 25 of type water-anim -;; INFO: Return type mismatch quaternion vs object. +;; INFO: Return type mismatch quaternion vs none. ;; Used lq/sq (defmethod TODO-RENAME-25 water-anim ((obj water-anim)) (local-vars (sv-16 res-tag)) @@ -989,11 +805,11 @@ ) ) (let ((f0-6 (res-lump-float (-> obj entity) 'rotoffset))) - (the-as object (if (!= f0-6 0.0) - (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-6) - ) - ) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-6) + ) ) + (none) ) ;; definition for method 22 of type water-anim diff --git a/test/decompiler/reference/levels/darkcave/darkcave-obs_REF.gc b/test/decompiler/reference/levels/darkcave/darkcave-obs_REF.gc index 77f60f3a27..2842ade164 100644 --- a/test/decompiler/reference/levels/darkcave/darkcave-obs_REF.gc +++ b/test/decompiler/reference/levels/darkcave/darkcave-obs_REF.gc @@ -295,19 +295,8 @@ (ja-post) (update-transforms! (-> obj root-override)) (TODO-RENAME-9 *cavecrystal-light-control* (-> obj crystal-id) 0.0 obj) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "crystal-on") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "crystal-on" :fo-max 80) (-> obj root-override trans)) ) (go cavecrystal-idle) (none) diff --git a/test/decompiler/reference/levels/finalboss/final-door_REF.gc b/test/decompiler/reference/levels/finalboss/final-door_REF.gc index 2f1d4e0bf3..fe91b2961e 100644 --- a/test/decompiler/reference/levels/finalboss/final-door_REF.gc +++ b/test/decompiler/reference/levels/finalboss/final-door_REF.gc @@ -256,7 +256,7 @@ (ja-post) (while #t (if (and (and *target* (>= 61440.0 (vector-vector-distance (-> self root trans) (-> *target* control trans)))) - (and (zero? (logand (-> *target* state-flags) 256)) + (and (zero? (logand (-> *target* state-flags) (state-flags sf08))) (and (>= (-> *game-info* fuel) 100.0) (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))) (= (get-task-status (game-task finalboss-movies)) (task-status need-reward-speech)) @@ -436,14 +436,14 @@ (behavior ((arg0 basic) (arg1 handle)) (send-event *camera* 'change-to-entity-by-name "camera-403") (set! (-> self control unknown-surface00) *empty-mods*) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (set-setting! *setting-control* self 'allow-progress #f 0.0 0) (none) ) :exit (behavior () (send-event *camera* 'change-state *camera-base-mode* 60) - (set! (-> self state-flags) (logand -273 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04 sf08)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'allow-progress) (none) diff --git a/test/decompiler/reference/levels/finalboss/green-eco-lurker_REF.gc b/test/decompiler/reference/levels/finalboss/green-eco-lurker_REF.gc index 1ee6719af5..af9af4ca14 100644 --- a/test/decompiler/reference/levels/finalboss/green-eco-lurker_REF.gc +++ b/test/decompiler/reference/levels/finalboss/green-eco-lurker_REF.gc @@ -491,7 +491,7 @@ (v1-7 (-> obj draw shadow-ctrl)) ) (let ((a0-1 v1-7)) - (set! (-> a0-1 settings flags) (logand -33 (-> a0-1 settings flags))) + (logclear! (-> a0-1 settings flags) (shadow-flags shdf05)) ) 0 (let ((a0-3 v1-7)) @@ -504,7 +504,7 @@ ) (else (let ((v1-9 (-> obj draw shadow-ctrl))) - (logior! (-> v1-9 settings flags) 32) + (logior! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -667,9 +667,9 @@ (set! (-> a0-6 settings top-plane w) (- 2048.0)) ) 0 - (set! (-> v1-4 settings flags) (logand -9 (-> v1-4 settings flags))) - (set! (-> v1-4 settings flags) (logand -5 (-> v1-4 settings flags))) - (set! (-> v1-4 settings flags) (logand -33 (-> v1-4 settings flags))) + (logclear! (-> v1-4 settings flags) (shadow-flags shdf03)) + (logclear! (-> v1-4 settings flags) (shadow-flags shdf02)) + (logclear! (-> v1-4 settings flags) (shadow-flags shdf05)) ) 0 (ja-channel-push! 1 60) @@ -846,7 +846,7 @@ (sound-play-by-name (static-sound-name "blob-explode") (new-sound-id) 1024 0 0 1 #t) (activate! *camera-smush-control* 409.6 37 150 1.0 0.99) (let ((v1-14 (-> self draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 (let ((t9-7 (-> (method-of-type nav-enemy nav-enemy-die) enter))) @@ -947,7 +947,7 @@ (set! (-> obj draw origin-joint-index) (the-as uint 3)) (logclear! (-> obj collide-info nav-flags) (nav-flags navf0)) (TODO-RENAME-45 obj *green-eco-lurker-nav-enemy-info*) - (logior! (-> obj draw shadow-ctrl settings flags) 4) + (logior! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf02)) (set! (-> obj neck up) (the-as uint 0)) (set! (-> obj neck nose) (the-as uint 1)) (set! (-> obj neck ear) (the-as uint 2)) diff --git a/test/decompiler/reference/levels/finalboss/light-eco_REF.gc b/test/decompiler/reference/levels/finalboss/light-eco_REF.gc index b818a14689..31731a5109 100644 --- a/test/decompiler/reference/levels/finalboss/light-eco_REF.gc +++ b/test/decompiler/reference/levels/finalboss/light-eco_REF.gc @@ -719,7 +719,7 @@ ) ) (cond - ((and *target* (logtest? (-> *target* state-flags) 256)) + ((and *target* (logtest? (-> *target* state-flags) (state-flags sf08))) (set! (-> obj last-spawned-time) (-> *display* base-frame-counter)) (set! (-> obj delay-til-spawn) 2400) ) @@ -943,20 +943,8 @@ ) (set! (-> self part) (create-launch-control (-> *part-group-id-table* 691) self)) (set! (-> self part2) (create-launch-control (-> *part-group-id-table* 690) self)) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "white-eco-lp") - :volume #x400 - :fo-min #x12c - :fo-max #x190 - ) - (-> self root trans) - ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "white-eco-lp" :fo-min 300 :fo-max 400) (-> self root trans)) ) (ja-post) (let ((f0-4 0.0)) diff --git a/test/decompiler/reference/levels/finalboss/robotboss-misc_REF.gc b/test/decompiler/reference/levels/finalboss/robotboss-misc_REF.gc index c325a635c6..66e015f48d 100644 --- a/test/decompiler/reference/levels/finalboss/robotboss-misc_REF.gc +++ b/test/decompiler/reference/levels/finalboss/robotboss-misc_REF.gc @@ -538,19 +538,8 @@ (initialize-skeleton obj *silodoor-sg* '()) (logior! (-> obj skel status) (janim-status inited)) (set! (-> obj root pause-adjust-distance) 1228800.0) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "silo-moves") - :volume #x400 - :fo-max 80 - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "silo-moves" :fo-max 80) (-> obj root trans)) ) (logclear! (-> obj mask) (process-mask actor-pause crate enemy attackable)) (set! (-> obj part-opened) 0.0) diff --git a/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc b/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc index 50f353dd5b..e847ec30d1 100644 --- a/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc +++ b/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc @@ -645,20 +645,7 @@ (arcing-shot-setup arg0 arg1 arg2) (set! (-> self countdown-time) arg4) (set! (-> self flight-time) arg3) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "bomb-spin") - :volume #x400 - :fo-max 80 - ) - (-> self to) - ) - ) + (set! (-> self sound) (new 'process 'ambient-sound (static-sound-spec "bomb-spin" :fo-max 80) (-> self to))) (go darkecobomb-idle) (none) ) @@ -1086,19 +1073,8 @@ (set! (-> self shot-particle) (create-launch-control (-> *part-group-id-table* 665) self)) (set! (-> self test-particle) (create-launch-control (-> *part-group-id-table* 679) self)) (logior! (-> self draw status) (draw-status hidden)) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "red-fireball") - :volume #x400 - :fo-max 80 - ) - (-> self root-override trans) - ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "red-fireball" :fo-max 80) (-> self root-override trans)) ) (go redshot-idle) (none) diff --git a/test/decompiler/reference/levels/finalboss/robotboss_REF.gc b/test/decompiler/reference/levels/finalboss/robotboss_REF.gc index 25a9f18623..1231425d61 100644 --- a/test/decompiler/reference/levels/finalboss/robotboss_REF.gc +++ b/test/decompiler/reference/levels/finalboss/robotboss_REF.gc @@ -37,7 +37,7 @@ ;; INFO: Return type mismatch symbol vs none. (defbehavior robotboss-cut-cam-exit robotboss () (set! (-> self valid-frames) 0) - (if (and *target* (logtest? (-> *target* state-flags) 256)) + (if (and *target* (logtest? (-> *target* state-flags) (state-flags sf08))) (process-release? *target*) ) (logclear! (-> self skel status) (janim-status inited)) @@ -61,8 +61,8 @@ ) (robotboss-cut-cam-exit) ) - ((or (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + ((or (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (-> self skip-cut) ) @@ -169,15 +169,14 @@ (b! #t cfg-66 :delay (nop!)) (label cfg-19) (b! - (not - (and (-> self des-cam-entity) - (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 188416.0) - (and *target* - (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) - ) - ) - ) - ) + (not (and (-> self des-cam-entity) + (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 188416.0) + (and *target* + (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) + ) + ) + ) + ) cfg-37 :delay (empty-form) @@ -194,13 +193,12 @@ (b! #t cfg-66 :delay (nop!)) (label cfg-37) (b! - (not - (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 73728.0) - (and *target* - (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) - ) - ) - ) + (not (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 73728.0) + (and *target* + (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans))) + ) + ) + ) cfg-49 :delay (empty-form) @@ -3892,7 +3890,7 @@ (spawn (-> self particle 0) s4-0) (when (and arg1 (nonzero? (-> self looping-sound 0))) (update! (-> self looping-sound 0)) - (when (and *target* (zero? (logand (-> *target* state-flags) #x80f8))) + (when (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) (let ((t2-0 (new 'stack-no-clear 'collide-tri-result)) (a2-0 (new 'stack-no-clear 'vector)) ) @@ -3943,7 +3941,7 @@ (when (and arg1 (nonzero? (-> self looping-sound 1))) (update! (-> self looping-sound 1)) (when (and *target* - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (>= 8192.0 (vector-vector-distance gp-0 (target-pos 0))) ) (let ((a1-16 (new 'stack-no-clear 'event-message-block))) @@ -4606,61 +4604,17 @@ (set! (-> obj particle 4) (create-launch-control (-> *part-group-id-table* 654) obj)) (set! (-> obj particle 5) (create-launch-control (-> *part-group-id-table* 646) obj)) (set! (-> obj particle 6) (create-launch-control (-> *part-group-id-table* 651) obj)) - (set! (-> obj looping-sound 0) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "robo-blue-lp") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 0) + (new 'process 'ambient-sound (static-sound-spec "robo-blue-lp" :fo-max 80) (-> obj root-override trans)) ) - (set! (-> obj looping-sound 1) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-torch") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 1) + (new 'process 'ambient-sound (static-sound-spec "eco-torch" :fo-max 80) (-> obj root-override trans)) ) - (set! (-> obj looping-sound 2) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "red-buzz") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 2) + (new 'process 'ambient-sound (static-sound-spec "red-buzz" :fo-max 80) (-> obj root-override trans)) ) - (set! (-> obj looping-sound 3) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "bfg-buzz") - :volume #x400 - :fo-max 80 - ) - (-> obj root-override trans) - ) + (set! (-> obj looping-sound 3) + (new 'process 'ambient-sound (static-sound-spec "bfg-buzz" :fo-max 80) (-> obj root-override trans)) ) (set! (-> obj blue-smoke) #f) (set! (-> obj red-smoke) #f) diff --git a/test/decompiler/reference/levels/flut_common/flutflut_REF.gc b/test/decompiler/reference/levels/flut_common/flutflut_REF.gc index c6d9ceb643..50fbc06d4b 100644 --- a/test/decompiler/reference/levels/flut_common/flutflut_REF.gc +++ b/test/decompiler/reference/levels/flut_common/flutflut_REF.gc @@ -420,19 +420,8 @@ ) ) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "zoom-teleport") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :fo-max 30) (-> obj root-override trans)) ) (go (method-of-object obj wait-for-start)) (none) diff --git a/test/decompiler/reference/levels/flut_common/target-flut_REF.gc b/test/decompiler/reference/levels/flut_common/target-flut_REF.gc index 5752f7e8a1..70cd26eee4 100644 --- a/test/decompiler/reference/levels/flut_common/target-flut_REF.gc +++ b/test/decompiler/reference/levels/flut_common/target-flut_REF.gc @@ -89,7 +89,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x8 + :flags (surface-flags surf03) ) ) @@ -119,7 +119,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -149,7 +149,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -174,7 +174,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1018 + :flags (surface-flags surf03 surf04 surf12) ) ) @@ -200,7 +200,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'attack - :flags #x1800 + :flags (surface-flags surf11 surf12) ) ) @@ -249,12 +249,13 @@ (b! #t cfg-23 :delay (nop!)) (label cfg-7) (cond - ((and (logtest? (-> self control status) 1) (not (= (if (> (-> self skel active-channels) 0) - (-> self skel root-channel 0 frame-group) - ) - (-> self draw art-group data 145) - ) - ) + ((and (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 145) + ) + ) ) (ja-channel-push! 1 6) (let ((v1-21 (-> self skel root-channel 0))) @@ -541,7 +542,7 @@ ) (logclear! (-> self control root-prim prim-core action) (collide-action ca-14)) (set! (-> self control unknown-surface00) *walk-mods*) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max)) (set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length)) (target-collide-set! 'normal (the-as float 0.0)) @@ -685,7 +686,7 @@ (if (can-hands? #t) (go target-flut-running-attack) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-37 (if (> (-> self skel active-channels) 0) @@ -845,7 +846,7 @@ (if (can-hands? #t) (go target-flut-running-attack) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-37 (if (> (-> self skel active-channels) 0) @@ -1063,7 +1064,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 -762 0 1 #t) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flut-jump-mods*) (set! (-> self control unknown-float123) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))))) @@ -1087,13 +1088,13 @@ (* 0.003921569 (the float (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) abutton 6))) ) ) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 40960.0) - (and (zero? (logand (-> self water flags) 512)) - (zero? (logand (-> self state-flags) 2048)) + (and (zero? (logand (-> self water flags) (water-flags wt09))) + (zero? (logand (-> self state-flags) (state-flags sf11))) (< 4096.0 (target-height-above-ground)) ) ) @@ -1105,8 +1106,8 @@ (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) ) ) (go target-flut-air-attack (-> *FLUT-bank* air-attack-speed)) @@ -1118,7 +1119,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) enter-state 'stuck (go target-flut-hit-ground) @@ -1249,7 +1250,7 @@ (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #t) (-> self control transv)) (set! (-> self control dynam gravity-max) 40960.0) (set! (-> self control dynam gravity-length) 245760.0) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flut-double-jump-mods*) (none) ) @@ -1263,7 +1264,7 @@ ) :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) @@ -1273,8 +1274,8 @@ ) (pad-buttons square) ) - (and (zero? (logand (-> self state-flags) 4096)) - (zero? (logand (-> self control unknown-surface01 flags) 384)) + (and (zero? (logand (-> self state-flags) (state-flags sf12))) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flags surf07 surf08))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) @@ -1444,7 +1445,7 @@ (if (move-legs?) (go target-flut-walk) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-34 (if (> (-> self skel active-channels) 0) @@ -1492,7 +1493,7 @@ (-> target-flut-start exit) :trans (behavior () - (when (or (logtest? (-> self control status) 1) + (when (or (logtest? (-> self control status) (cshape-moving-flags onsurf)) (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (/ (the-as int (-> *TARGET-bank* stuck-time)) 2) @@ -1503,7 +1504,7 @@ #t ) ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (seek! @@ -1691,7 +1692,9 @@ (behavior () (when (!= (-> self state-time) (-> *display* base-frame-counter)) (if (and (or (smack-surface? #t) - (and (>= (-> self control unknown-float63) 0.7) (zero? (logand (-> self control status) 32))) + (and (>= (-> self control unknown-float63) 0.7) + (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + ) ) (begin (set! (-> self control unknown-int21) (the-as int (-> *display* base-frame-counter))) @@ -1723,7 +1726,7 @@ ) (target-shoved (meters 2.0) (-> *TARGET-bank* smack-surface-height) (the-as process #f) target-flut-hit) ) - (if (and (logtest? (-> self water flags) 512) + (if (and (logtest? (-> self water flags) (water-flags wt09)) (zero? (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21)) ) (dummy-13 @@ -1764,7 +1767,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) - (and (and (zero? (logand (-> self control status) 1)) + (and (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-39 (if (> (-> self skel active-channels) 0) @@ -1772,12 +1775,11 @@ ) ) ) - (or (not - (or (= v1-39 (-> self draw art-group data 59)) - (= v1-39 (-> self draw art-group data 60)) - (= v1-39 (-> self draw art-group data 61)) - ) - ) + (or (not (or (= v1-39 (-> self draw art-group data 59)) + (= v1-39 (-> self draw art-group data 60)) + (= v1-39 (-> self draw art-group data 61)) + ) + ) (< 4096.0 (target-height-above-ground)) ) ) @@ -1826,7 +1828,7 @@ (set! f30-0 (* f30-0 (the-as float (fmin 1.0 (the-as float (-> self control unknown-float140)))))) ) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (-> *FLUT-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) (let ((v1-105 (if (> (-> self skel active-channels) 0) @@ -1910,7 +1912,7 @@ (behavior ((arg0 float)) (set-forward-vel arg0) (set! (-> self state-time) (-> *display* base-frame-counter)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *flut-air-attack-mods*) (target-start-attack) (target-danger-set! 'flut-attack #f) @@ -1963,8 +1965,8 @@ ) ) ) - (when (logtest? (-> self control status) 1) - (logior! (-> self control status) 1) + (when (logtest? (-> self control status) (cshape-moving-flags onsurf)) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (remove-exit) (go target-flut-air-attack-hit-ground) ) @@ -1975,7 +1977,7 @@ ) #t ) - (logior! (-> self control status) 1) + (logior! (-> self control status) (cshape-moving-flags onsurf)) (go target-flut-hit-ground) ) (none) @@ -2133,7 +2135,7 @@ :exit (behavior () (if (!= (-> self next-state name) 'target-flut-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) (target-exit) ((-> target-flut-start exit)) @@ -2195,7 +2197,7 @@ ) ) (when (= arg0 'attack) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self game hit-time) (-> *display* base-frame-counter)) (case (-> gp-0 mode) (('endlessfall) @@ -2319,7 +2321,7 @@ (-> target-death event) :exit (behavior () - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'process-mask) (copy-settings-from-target! *setting-control*) @@ -2330,7 +2332,7 @@ :code (behavior ((arg0 symbol)) (local-vars (v1-104 symbol)) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) (set! (-> self neck flex-blend) 0.0) (target-timed-invulnerable-off self) (push-setting! *setting-control* self 'process-mask 'set 0.0 #x14a0000) @@ -2344,7 +2346,7 @@ (sound-play-by-name (static-sound-name "flut-hit") (new-sound-id) 716 -2133 0 1 #t) (camera-change-to (the-as string cam-endlessfall) 30 #f) (set! (-> self control pat-ignore-mask unknown-bit) 1) - (set! (-> self water flags) (logand -17 (-> self water flags))) + (logclear! (-> self water flags) (water-flags wt04)) (let ((f30-0 (fmin -4096.0 (- (-> self control ground-impact-vel))))) (set! (-> self control unknown-uint20) (the-as uint f30-0)) (let ((gp-3 (new-stack-vector0))) @@ -2410,7 +2412,7 @@ (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) (let ((gp-5 (new 'stack-no-clear 'vector))) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! gp-5 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (vector-float*! (-> self control transv) gp-5 (-> *display* frames-per-second)) ) @@ -2448,7 +2450,7 @@ (behavior ((arg0 handle)) (set! (-> self control transv quad) (the-as uint128 0)) (set! (-> self alt-cam-pos quad) (-> (&-> (-> self control) unknown-qword00) 0)) - (logior! (-> self state-flags) 1024) + (logior! (-> self state-flags) (state-flags sf10)) (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) @@ -2501,7 +2503,7 @@ ) ) (sound-play-by-name (static-sound-name "flut-coo") (new-sound-id) 1024 0 0 1 #t) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (set! (-> self control transv quad) (the-as uint128 0)) (quaternion-copy! (-> self control quat) (-> self control unknown-quaternion00)) (rot->dir-targ! (-> self control)) @@ -2550,7 +2552,7 @@ (behavior ((arg0 handle)) (set-forward-vel (the-as float 0.0)) (let ((s5-0 0)) - (while (zero? (logand (-> self control status) 1)) + (while (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (target-flut-falling-anim-trans) (+! s5-0 (- (-> *display* base-frame-counter) (-> *display* old-base-frame-counter))) (suspend) @@ -2687,7 +2689,7 @@ (-> target-hit-ground enter) :trans (behavior () - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) ((-> target-hit-ground trans)) (none) ) @@ -2745,12 +2747,12 @@ (behavior () (set! (-> self control unknown-surface00) *grab-mods*) (set! (-> self neck flex-blend) 0.0) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -273 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04 sf08)) (target-exit) ((-> target-flut-start exit)) (none) diff --git a/test/decompiler/reference/levels/jungle/fisher_REF.gc b/test/decompiler/reference/levels/jungle/fisher_REF.gc index 7d664a901f..ba76d6eb79 100644 --- a/test/decompiler/reference/levels/jungle/fisher_REF.gc +++ b/test/decompiler/reference/levels/jungle/fisher_REF.gc @@ -904,7 +904,7 @@ ) ;; definition for method 52 of type fisher -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 fisher ((obj fisher)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -918,7 +918,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -933,14 +933,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -2313,14 +2313,14 @@ :enter (behavior ((arg0 handle)) (set! (-> self control unknown-surface00) *empty-mods*) - (logior! (-> self state-flags) 16) + (logior! (-> self state-flags) (state-flags sf04)) (set-zero! (-> self control unknown-smush00)) (set! (-> self control unknown-uint20) (the-as uint #f)) (none) ) :exit (behavior () - (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf04)) (let ((v1-2 (-> self manipy))) (when v1-2 (deactivate (-> v1-2 0)) diff --git a/test/decompiler/reference/levels/jungle/jungle-mirrors_REF.gc b/test/decompiler/reference/levels/jungle/jungle-mirrors_REF.gc index 970e6f8da5..ad10f15a3d 100644 --- a/test/decompiler/reference/levels/jungle/jungle-mirrors_REF.gc +++ b/test/decompiler/reference/levels/jungle/jungle-mirrors_REF.gc @@ -1518,8 +1518,8 @@ (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2 (('touch) - (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) ) @@ -1592,7 +1592,7 @@ (f30-1 81920.0) ) (when (and *target* (>= f30-1 (vector-vector-distance a0-10 (-> *target* control trans)))) - (when (logtest? (-> *target* control status) 1) + (when (logtest? (-> *target* control status) (cshape-moving-flags onsurf)) (let ((f0-7 (fmax 4096.0 (fmin 12288.0 (+ (- 5120.0 (-> self base y)) (-> *target* control trans y)))))) (seek! (-> self y-offset-grips) f0-7 (* 16384.0 (-> *display* seconds-per-frame))) ) @@ -2024,19 +2024,8 @@ (periscope-update-joints) (set! (-> obj grips-moving?) #f) (set! (-> obj sound-id) (new-sound-id)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-beam") - :volume #x400 - :fo-max 50 - ) - (-> obj reflector-trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-beam" :fo-max 50) (-> obj reflector-trans)) ) (set! (-> obj rise-sound-id) (new-sound-id)) (set! (-> obj grips-sound-id) (new-sound-id)) @@ -2310,19 +2299,8 @@ (set! (-> obj link) (new 'process 'actor-link-info obj)) (initialize-skeleton obj *reflector-mirror-sg* '()) (set-vector! (-> obj beam-end) 1805721.6 167936.0 -932659.2 1.0) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "eco-beam") - :volume #x400 - :fo-max 50 - ) - (-> obj beam-end) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-beam" :fo-max 50) (-> obj beam-end)) ) (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) (go reflector-mirror-broken #t) diff --git a/test/decompiler/reference/levels/jungle/junglefish_REF.gc b/test/decompiler/reference/levels/jungle/junglefish_REF.gc index 6275cad9ed..a4a51ad9a8 100644 --- a/test/decompiler/reference/levels/jungle/junglefish_REF.gc +++ b/test/decompiler/reference/levels/jungle/junglefish_REF.gc @@ -423,7 +423,7 @@ nav-enemy-default-event-handler (initialize-skeleton obj *junglefish-sg* '()) (TODO-RENAME-45 obj *junglefish-nav-enemy-info*) (set! (-> obj water) (new 'process 'water-control obj 7 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 2)) + (set! (-> obj water flags) (water-flags wt01)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 5734.4) (set! (-> obj collide-info trans y) (+ -4096.0 (-> obj water height))) diff --git a/test/decompiler/reference/levels/jungle/junglesnake_REF.gc b/test/decompiler/reference/levels/jungle/junglesnake_REF.gc index 5ad287d246..eaa20c9897 100644 --- a/test/decompiler/reference/levels/jungle/junglesnake_REF.gc +++ b/test/decompiler/reference/levels/jungle/junglesnake_REF.gc @@ -153,7 +153,9 @@ ) ) (cond - ((and (-> self is-lethal?) (zero? (logand (-> *target* state-flags) #x80f8))) + ((and (-> self is-lethal?) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + ) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) self) (set! (-> a1-2 num-params) 2) @@ -481,7 +483,7 @@ junglesnake-default-event-handler (behavior () (if (and (and *target* (>= 24576.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans)))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (-> self refractory-delay)) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) ) (go junglesnake-attack) ) diff --git a/test/decompiler/reference/levels/jungleb/plant-boss_REF.gc b/test/decompiler/reference/levels/jungleb/plant-boss_REF.gc index b7b8333e1f..9351b2f338 100644 --- a/test/decompiler/reference/levels/jungleb/plant-boss_REF.gc +++ b/test/decompiler/reference/levels/jungleb/plant-boss_REF.gc @@ -1644,7 +1644,7 @@ ) ) *target* - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) ) (go plant-boss-attack 1) ) diff --git a/test/decompiler/reference/levels/lavatube/lavatube-obs_REF.gc b/test/decompiler/reference/levels/lavatube/lavatube-obs_REF.gc index 21308075f6..f90b50b066 100644 --- a/test/decompiler/reference/levels/lavatube/lavatube-obs_REF.gc +++ b/test/decompiler/reference/levels/lavatube/lavatube-obs_REF.gc @@ -991,19 +991,7 @@ (set! (-> obj root-override) (the-as collide-shape-moving (new 'process 'trsqv))) (darkecobarrel-base-init arg0) (set! (-> obj sound) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lav-dark-eco") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (new 'process 'ambient-sound (static-sound-spec "lav-dark-eco" :fo-max 30) (-> obj root-override trans)) ) (logior! (-> obj draw status) (draw-status hidden)) (set! (-> obj speed) (/ 300.0 (res-lump-float (-> obj entity) 'speed :default 61440.0))) @@ -1547,19 +1535,8 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *chainmine-sg* '()) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lava-mine-chain") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "lava-mine-chain" :fo-max 30) (-> obj root-override trans)) ) (go (method-of-object obj idle)) (none) @@ -1859,8 +1836,8 @@ (set! (-> v1-2 global-scale) 2048.0) (set! (-> v1-2 waveform) ripple-for-lavatube-lava) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x2000000 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt25) (-> obj flags))) (set! (-> obj attack-event) 'heat) (none) ) diff --git a/test/decompiler/reference/levels/lavatube/lavatube-part_REF.gc b/test/decompiler/reference/levels/lavatube/lavatube-part_REF.gc index 1aecbb608e..adf7dfcbb0 100644 --- a/test/decompiler/reference/levels/lavatube/lavatube-part_REF.gc +++ b/test/decompiler/reference/levels/lavatube/lavatube-part_REF.gc @@ -284,14 +284,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 0.7 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-x (meters 0) (meters 3) 1.0) (sp-flt spt-y (meters -1)) (sp-rnd-flt spt-scale-x (meters 6) (meters 4) 1.0) @@ -388,14 +381,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 0.4 0.3 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 6) (meters 4) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) diff --git a/test/decompiler/reference/levels/maincave/baby-spider_REF.gc b/test/decompiler/reference/levels/maincave/baby-spider_REF.gc index d5e66580f7..a70af0a192 100644 --- a/test/decompiler/reference/levels/maincave/baby-spider_REF.gc +++ b/test/decompiler/reference/levels/maincave/baby-spider_REF.gc @@ -267,7 +267,7 @@ baby-spider-default-event-handler ;; definition for method 39 of type baby-spider ;; Used lq/sq (defmethod common-post baby-spider ((obj baby-spider)) - (when (logtest? (-> obj collide-info status) 1) + (when (logtest? (-> obj collide-info status) (cshape-moving-flags onsurf)) (vector-deg-seek (-> obj up-vector) (-> obj up-vector) (-> obj collide-info surface-normal) 910.2222) (vector-normalize! (-> obj up-vector) 1.0) ) @@ -907,7 +907,7 @@ baby-spider-default-event-handler (TODO-RENAME-45 obj *baby-spider-nav-enemy-info*) ) (let ((v1-11 (-> obj draw shadow-ctrl settings))) - (set! (-> v1-11 flags) (logand -9 (-> v1-11 flags))) + (logclear! (-> v1-11 flags) (shadow-flags shdf03)) (set! (-> v1-11 fade-dist) 98304.0) ) (vector-float*! (-> obj collide-info scale) *identity-vector* 0.63) diff --git a/test/decompiler/reference/levels/maincave/driller-lurker_REF.gc b/test/decompiler/reference/levels/maincave/driller-lurker_REF.gc index 5739939c31..3da542dccf 100644 --- a/test/decompiler/reference/levels/maincave/driller-lurker_REF.gc +++ b/test/decompiler/reference/levels/maincave/driller-lurker_REF.gc @@ -554,9 +554,10 @@ ) ) (when (and (-> obj hit-player?) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> obj hit-player-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> obj hit-player-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> obj root-overeride) 2 (collide-offense touch)) @@ -1363,34 +1364,10 @@ ) (set! (-> obj draw shadow-ctrl) *driller-lurker-shadow-control*) (set! (-> obj sound) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "drill-idle") - :volume #x400 - :fo-max 40 - ) - (-> obj root-overeride trans) - ) + (new 'process 'ambient-sound (static-sound-spec "drill-idle" :fo-max 40) (-> obj root-overeride trans)) ) (set! (-> obj sound2) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "drill-idle2") - :volume #x400 - :fo-max 60 - ) - (-> obj root-overeride trans) - ) + (new 'process 'ambient-sound (static-sound-spec "drill-idle2" :fo-max 60) (-> obj root-overeride trans)) ) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 331) obj)) (let ((f0-34 (path-distance (-> obj path)))) diff --git a/test/decompiler/reference/levels/maincave/gnawer_REF.gc b/test/decompiler/reference/levels/maincave/gnawer_REF.gc index 13b0a9177f..4be0472836 100644 --- a/test/decompiler/reference/levels/maincave/gnawer_REF.gc +++ b/test/decompiler/reference/levels/maincave/gnawer_REF.gc @@ -1877,34 +1877,16 @@ ) ) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 329) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "gnawer-crawl") - :volume #x400 - :fo-min 30 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new + 'process + 'ambient-sound + (static-sound-spec "gnawer-crawl" :fo-min 30 :fo-max 30) + (-> obj root-override trans) + ) ) - (set! (-> obj sound2) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "gnawer-chew") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound2) + (new 'process 'ambient-sound (static-sound-spec "gnawer-chew" :fo-max 40) (-> obj root-override trans)) ) (dotimes (v1-110 10) (let ((a0-59 (-> obj segments v1-110))) diff --git a/test/decompiler/reference/levels/maincave/maincave-obs_REF.gc b/test/decompiler/reference/levels/maincave/maincave-obs_REF.gc index b6d4a6cc74..e68d974450 100644 --- a/test/decompiler/reference/levels/maincave/maincave-obs_REF.gc +++ b/test/decompiler/reference/levels/maincave/maincave-obs_REF.gc @@ -228,19 +228,8 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *cavecrusher-sg* '()) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "crush-click") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "crush-click" :fo-max 30) (-> obj root-override trans)) ) (ja-channel-push! 1 0) (let ((s5-1 (-> obj skel root-channel 0))) @@ -388,8 +377,8 @@ (until (or (or (not *target*) (< 28672.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) ) - (and (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (and (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-7))) @@ -425,8 +414,8 @@ ) (until (ja-done? 0) (when (and (and *target* (>= 28672.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans)))) - (or (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (or (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (logtest? (-> *target* control root-prim prim-core action) (collide-action ca-7)) ) @@ -944,20 +933,7 @@ ) (process-drawable-from-entity! obj arg0) (set! (-> obj sound) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "spatula") - :volume #x400 - :fo-min 25 - :fo-max 50 - ) - (-> obj root-override trans) - ) + (new 'process 'ambient-sound (static-sound-spec "spatula" :fo-min 25 :fo-max 50) (-> obj root-override trans)) ) (case (-> (if (-> obj entity) (-> obj entity extra level) @@ -1100,20 +1076,8 @@ (set! (-> s5-1 frame-num) 0.0) ) (transform-post) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "spatula") - :volume #x400 - :fo-min 25 - :fo-max 50 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "spatula" :fo-min 25 :fo-max 50) (-> obj root-override trans)) ) (go cavespatulatwo-idle) (none) diff --git a/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc b/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc index 169293aca9..7f066f6226 100644 --- a/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc +++ b/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc @@ -204,7 +204,7 @@ 0.0 ) (let ((v1-11 (-> obj draw shadow-ctrl))) - (set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags))) + (logclear! (-> v1-11 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-14 (-> obj draw shadow-ctrl))) @@ -219,7 +219,7 @@ ) (else (let ((v1-22 (-> obj draw shadow-ctrl))) - (logior! (-> v1-22 settings flags) 32) + (logior! (-> v1-22 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -228,7 +228,7 @@ ) (else (let ((v1-25 (-> obj draw shadow-ctrl))) - (logior! (-> v1-25 settings flags) 32) + (logior! (-> v1-25 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -467,7 +467,7 @@ ) ) (let ((v1-37 (-> self draw shadow-ctrl))) - (logior! (-> v1-37 settings flags) 32) + (logior! (-> v1-37 settings flags) (shadow-flags shdf05)) ) 0 (go mother-spider-egg-die-exit) @@ -483,7 +483,7 @@ (behavior () (logclear! (-> self mask) (process-mask actor-pause)) (let ((v1-3 (-> self draw shadow-ctrl))) - (logior! (-> v1-3 settings flags) 32) + (logior! (-> v1-3 settings flags) (shadow-flags shdf05)) ) 0 (lods-assign! (-> self draw) (-> self broken-look)) @@ -548,7 +548,7 @@ (logclear! (-> self mask) (process-mask actor-pause)) (clear-collide-with-as (-> self root-override)) (let ((v1-5 (-> self draw shadow-ctrl))) - (logior! (-> v1-5 settings flags) 32) + (logior! (-> v1-5 settings flags) (shadow-flags shdf05)) ) 0 (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) @@ -602,7 +602,7 @@ (send-event (ppointer->process (-> self parent-override)) 'untrigger) (logior! (-> self draw status) (draw-status hidden)) (let ((v1-8 (-> self draw shadow-ctrl))) - (logior! (-> v1-8 settings flags) 32) + (logior! (-> v1-8 settings flags) (shadow-flags shdf05)) ) 0 (logclear! (-> self root-override nav-flags) (nav-flags navf0)) diff --git a/test/decompiler/reference/levels/maincave/mother-spider-proj_REF.gc b/test/decompiler/reference/levels/maincave/mother-spider-proj_REF.gc index 1dc1654e70..92dcfa95bb 100644 --- a/test/decompiler/reference/levels/maincave/mother-spider-proj_REF.gc +++ b/test/decompiler/reference/levels/maincave/mother-spider-proj_REF.gc @@ -266,7 +266,7 @@ ) (sound-trans-convert (-> s5-0 parms trans) a1-1) ) - (set! (-> s5-0 parms mask) (the-as uint 32)) + (set! (-> s5-0 parms mask) (sound-mask trans)) (-> s5-0 id) ) (let ((f0-5 (* 5120.0 (+ 0.9 (* 0.1 (cos (* 873.81335 (the float (mod (-> *display* base-frame-counter) 75))))))))) @@ -294,7 +294,7 @@ (s4-0 (new 'stack-no-clear 'vector)) (s5-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) ) - (if (logtest? (-> arg0 root-override status) 4) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags tsurf)) (vector-flatten! s3-1 s3-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s3-1 1.0) @@ -372,7 +372,7 @@ ;; INFO: Return type mismatch vector vs none. ;; Used lq/sq (defmethod dummy-28 mother-spider-proj ((obj mother-spider-proj)) - (when (and *target* (zero? (logand (-> *target* state-flags) #x80f8))) + (when (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) (let ((gp-0 (-> obj target))) (set! (-> gp-0 quad) (-> (target-pos 0) quad)) (set! (-> gp-0 y) (+ 4915.2 (-> gp-0 y))) diff --git a/test/decompiler/reference/levels/maincave/mother-spider_REF.gc b/test/decompiler/reference/levels/maincave/mother-spider_REF.gc index 7eb6878188..fe7edbde8c 100644 --- a/test/decompiler/reference/levels/maincave/mother-spider_REF.gc +++ b/test/decompiler/reference/levels/maincave/mother-spider_REF.gc @@ -416,8 +416,8 @@ ;; definition for method 31 of type mother-spider (defmethod is-player-stuck? mother-spider ((obj mother-spider)) - (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (when (and *target* (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) ) @@ -467,7 +467,7 @@ 0.0 ) (let ((v1-11 (-> obj draw shadow-ctrl))) - (set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags))) + (logclear! (-> v1-11 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-14 (-> obj draw shadow-ctrl))) @@ -488,7 +488,7 @@ ) (else (let ((v1-23 (-> obj draw shadow-ctrl))) - (logior! (-> v1-23 settings flags) 32) + (logior! (-> v1-23 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -497,7 +497,7 @@ ) (else (let ((v1-25 (-> obj draw shadow-ctrl))) - (logior! (-> v1-25 settings flags) 32) + (logior! (-> v1-25 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -875,7 +875,7 @@ :enter (behavior () (let ((v1-1 (-> self draw shadow-ctrl))) - (logior! (-> v1-1 settings flags) 32) + (logior! (-> v1-1 settings flags) (shadow-flags shdf05)) ) 0 (set! (-> self mode) (the-as uint 0)) @@ -1149,7 +1149,9 @@ ) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector<-cspace! gp-0 (-> self node-list data 6)) - (if (or (logtest? (-> *target* state-flags) #x80f8) (< (vector-vector-distance gp-0 (camera-pos)) 8192.0)) + (if (or (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) + (< (vector-vector-distance gp-0 (camera-pos)) 8192.0) + ) (go mother-spider-traveling (the-as uint 2)) ) ) @@ -1165,8 +1167,8 @@ ) ) ) - (if (or (not *target*) (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (if (or (not *target*) (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) (set! (-> self last-player-in-air-time) (-> *display* base-frame-counter)) @@ -1428,14 +1430,14 @@ (go mother-spider-traveling (the-as uint 0)) ) (if (and (>= (- (-> *display* base-frame-counter) (-> self started-birthing-time)) (seconds 6)) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) ) (go mother-spider-traveling (the-as uint 1)) ) (if (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.25)) (> (-> self birthing-counter) 0) (and (>= 49152.0 (- (-> self max-dist-from-anchor) (-> self dist-from-anchor))) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (TODO-RENAME-21 (-> self nav) (-> self root-override trans)) ) ) diff --git a/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc b/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc index b70c7b66dc..b5191d8846 100644 --- a/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc +++ b/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc @@ -27,7 +27,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #xc00 + :flags (surface-flags surf10 surf11) ) ) diff --git a/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc b/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc index 31c2b5f15f..b5b166c6c7 100644 --- a/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc +++ b/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc @@ -358,7 +358,7 @@ (cond ((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0) (let ((v1-32 (-> self draw shadow-ctrl))) - (set! (-> v1-32 settings flags) (logand -33 (-> v1-32 settings flags))) + (logclear! (-> v1-32 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-35 (-> self draw shadow-ctrl))) @@ -372,7 +372,7 @@ ) (else (let ((v1-41 (-> self draw shadow-ctrl))) - (logior! (-> v1-41 settings flags) 32) + (logior! (-> v1-41 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-44 (-> self draw shadow-ctrl))) @@ -459,7 +459,7 @@ (f26-0 (- (-> *standard-dynamics* gravity-length))) ) (let ((v1-10 (-> self draw shadow-ctrl))) - (logior! (-> v1-10 settings flags) 32) + (logior! (-> v1-10 settings flags) (shadow-flags shdf05)) ) 0 (clear-collide-with-as (-> self root-override)) @@ -529,7 +529,7 @@ (initialize-skeleton self *keg-sg* '()) (set! (-> self draw shadow-ctrl) (new 'process 'shadow-control 0.0 0.0 614400.0 (the-as float 60) 245760.0)) (let ((v1-25 (-> self draw shadow-ctrl))) - (logior! (-> v1-25 settings flags) 32) + (logior! (-> v1-25 settings flags) (shadow-flags shdf05)) ) 0 (let ((s5-1 (new 'static 'vector :x -514715.0 :y 226968.0 :z 3906894.8 :w 1.0))) diff --git a/test/decompiler/reference/levels/misty/misty-part_REF.gc b/test/decompiler/reference/levels/misty/misty-part_REF.gc index 67207b7b1b..a0d7640201 100644 --- a/test/decompiler/reference/levels/misty/misty-part_REF.gc +++ b/test/decompiler/reference/levels/misty/misty-part_REF.gc @@ -901,14 +901,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -970,14 +963,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1040,14 +1026,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1110,14 +1089,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 0.6 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-release") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "steam-release" :num 0.05 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) diff --git a/test/decompiler/reference/levels/misty/mistycannon_REF.gc b/test/decompiler/reference/levels/misty/mistycannon_REF.gc index 9e3bfd2d7b..f717851b40 100644 --- a/test/decompiler/reference/levels/misty/mistycannon_REF.gc +++ b/test/decompiler/reference/levels/misty/mistycannon_REF.gc @@ -788,7 +788,7 @@ ) (restore-collide-with-as (-> self root-override)) (set-vector! (-> self root-override scale) 0.6 0.6 0.6 1.0) - (while (zero? (logand (-> self root-override status) 1)) + (while (zero? (logand (-> self root-override status) (cshape-moving-flags onsurf))) (if (and (zero? (-> self sfx)) (< (if *target* (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) @@ -827,7 +827,7 @@ ) (sound-trans-convert (-> gp-1 parms trans) a1-3) ) - (set! (-> gp-1 parms mask) (the-as uint 32)) + (set! (-> gp-1 parms mask) (sound-mask trans)) (-> gp-1 id) ) ) @@ -903,7 +903,7 @@ (set! (-> self root-override root-prim prim-core offense) (collide-offense indestructible)) (spawn-part self) (when (and (zero? (-> self draw cur-lod)) (logtest? (-> self draw status) (draw-status was-drawn))) - (if (logtest? (-> self root-override status) 1) + (if (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (draw-shadow (-> self root-override shadow-pos) (-> self root-override shadow-pos) @@ -1043,24 +1043,8 @@ :code (behavior () (if (and *target* (= (-> *target* next-state name) 'target-periscope)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "explosion") - :volume #x400 - :fo-min #xc8 - :fo-max #x190 - ) - (new-sound-id) - (the-as vector #t) - ) - (sound-play-by-spec - (new 'static 'sound-spec :num 1.0 :group #x1 :sound-name (static-sound-name "explosion") :volume #x400) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "explosion" :fo-min 200 :fo-max 400) (new-sound-id) (the-as vector #t)) + (sound-play-by-spec (static-sound-spec "explosion") (new-sound-id) (the-as vector #t)) ) (spawn (-> self part2) (-> self root-override trans)) (ja-channel-set! 0) @@ -1093,7 +1077,7 @@ ) ;; definition for function mistycannon-collision-reaction -;; INFO: Return type mismatch int vs uint. +;; INFO: Return type mismatch int vs cshape-moving-flags. (defun mistycannon-collision-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) (let ((s5-0 0)) (let ((a1-1 (new 'stack-no-clear 'vector))) @@ -1109,7 +1093,7 @@ (vector-float*! (-> arg0 transv) (-> arg0 transv) 0.15) (let ((v0-1 (logior s5-0 7))) (logior! (-> arg0 status) v0-1) - (the-as uint v0-1) + (the-as cshape-moving-flags v0-1) ) ) ) diff --git a/test/decompiler/reference/levels/misty/mud_REF.gc b/test/decompiler/reference/levels/misty/mud_REF.gc index 5a2a103313..a8d511996c 100644 --- a/test/decompiler/reference/levels/misty/mud_REF.gc +++ b/test/decompiler/reference/levels/misty/mud_REF.gc @@ -54,8 +54,8 @@ (let ((t9-0 (method-of-type water-anim TODO-RENAME-22))) (t9-0 obj) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x40000 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt18) (-> obj flags))) (let ((gp-0 (new 'process 'ripple-control))) (set! (-> obj draw ripple) gp-0) (set! (-> gp-0 global-scale) 3072.0) diff --git a/test/decompiler/reference/levels/misty/quicksandlurker_REF.gc b/test/decompiler/reference/levels/misty/quicksandlurker_REF.gc index 3c4b643b47..5058c18734 100644 --- a/test/decompiler/reference/levels/misty/quicksandlurker_REF.gc +++ b/test/decompiler/reference/levels/misty/quicksandlurker_REF.gc @@ -383,7 +383,7 @@ (-> self root-override transv) (-> self root-override root-prim collide-with) ) - (if (or (logtest? (-> self root-override status) 8) + (if (or (logtest? (-> self root-override status) (cshape-moving-flags twall)) (< (vector-vector-distance (-> self root-override trans) (the-as vector (-> self root-override trans-old))) 40.96 ) diff --git a/test/decompiler/reference/levels/ogre/flying-lurker_REF.gc b/test/decompiler/reference/levels/ogre/flying-lurker_REF.gc index 07c8d960b5..d461ad7bdd 100644 --- a/test/decompiler/reference/levels/ogre/flying-lurker_REF.gc +++ b/test/decompiler/reference/levels/ogre/flying-lurker_REF.gc @@ -53,7 +53,7 @@ (set-setting! *setting-control* self 'allow-progress #f 0.0 0) (logclear! (-> self mask) (process-mask actor-pause)) (process-entity-status! self (entity-perm-status bit-3) #t) - (while (or (not *target*) (logtest? (-> *target* state-flags) #x8008)) + (while (or (not *target*) (logtest? (-> *target* state-flags) (state-flags sf03 sf15))) (suspend) ) (while (not (process-grab? *target*)) @@ -498,7 +498,7 @@ ) (set! s4-0 #t) (let ((v1-17 s5-0)) - (set! (-> v1-17 settings flags) (logand -33 (-> v1-17 settings flags))) + (logclear! (-> v1-17 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-19 s5-0)) @@ -536,7 +536,7 @@ ) ) (when (not s4-0) - (logior! (-> s5-0 settings flags) 32) + (logior! (-> s5-0 settings flags) (shadow-flags shdf05)) 0 (set! (-> obj draw bounds quad) (-> obj default-bounds quad)) (set! (-> obj draw origin-joint-index) (the-as uint 4)) @@ -1015,8 +1015,8 @@ (logclear! (-> self mask) (process-mask actor-pause)) (close-specific-task! (game-task plunger-lurker-hit) (task-status unknown)) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -1467,7 +1467,7 @@ (new 'process 'shadow-control 131072.0 151552.0 614400.0 (the-as float 60) 409600.0) ) (let ((v1-27 (-> obj draw shadow-ctrl))) - (set! (-> v1-27 settings flags) (logand -33 (-> v1-27 settings flags))) + (logclear! (-> v1-27 settings flags) (shadow-flags shdf05)) ) 0 (set! (-> obj alt-actor) (entity-actor-lookup arg0 'alt-actor 0)) diff --git a/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc b/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc index ae2faabce6..bca978e1ed 100644 --- a/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc +++ b/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc @@ -1692,8 +1692,8 @@ (set! (-> v1-2 global-scale) 2048.0) (set! (-> v1-2 waveform) ripple-for-ogre-lava) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) - (set! (-> obj flags) (logior #x2000000 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt25) (-> obj flags))) (set! (-> obj attack-event) 'lava) (none) ) diff --git a/test/decompiler/reference/levels/racer_common/collide-reaction-racer_REF.gc b/test/decompiler/reference/levels/racer_common/collide-reaction-racer_REF.gc index 41f5e3539c..268182c2fb 100644 --- a/test/decompiler/reference/levels/racer_common/collide-reaction-racer_REF.gc +++ b/test/decompiler/reference/levels/racer_common/collide-reaction-racer_REF.gc @@ -2,7 +2,7 @@ (in-package goal) ;; definition for function racer-collision-reaction -;; INFO: Return type mismatch int vs uint. +;; INFO: Return type mismatch int vs cshape-moving-flags. ;; Used lq/sq (defun racer-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector)) (local-vars (sv-80 vector) (sv-84 vector) (sv-88 (inline-array vector)) (sv-96 int) (sv-104 int)) @@ -58,7 +58,7 @@ (if s3-1 (set! sv-104 (logior sv-104 2)) ) - (when (zero? (logand (-> arg0 prev-status) 1)) + (when (zero? (logand (-> arg0 prev-status) (cshape-moving-flags onsurf))) (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) (set! sv-96 (logior sv-96 2048)) (when (not s3-1) @@ -113,19 +113,18 @@ (set! (-> arg0 wall-pat) (-> arg1 best-tri pat)) (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) (cond - ((not - (and (>= (-> arg1 best-from-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) - ) - ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) (seconds 0.3)) - (zero? (logand sv-104 32)) - ) - ) - ) + ((not (and (>= (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point)) + ) + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) (seconds 0.3)) + (zero? (logand sv-104 32)) + ) + ) + ) ) (else (set! sv-104 (logior sv-104 256)) @@ -180,7 +179,7 @@ ) ) (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) (the-as uint sv-104)) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) (update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 @@ -189,5 +188,5 @@ arg2 ) (set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127)) - (the-as uint sv-96) + (the-as cshape-moving-flags sv-96) ) diff --git a/test/decompiler/reference/levels/racer_common/racer-states_REF.gc b/test/decompiler/reference/levels/racer_common/racer-states_REF.gc index e8df1cd127..3c5e6f6faa 100644 --- a/test/decompiler/reference/levels/racer_common/racer-states_REF.gc +++ b/test/decompiler/reference/levels/racer_common/racer-states_REF.gc @@ -127,7 +127,7 @@ (set! (-> *hud-parts* power 0 y-sgn) 1) (logclear! (-> self control root-prim prim-core action) (collide-action ca-9 ca-16)) (set! (-> self control unknown-surface00) *walk-mods*) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (send-event *camera* 'clear-slave-option #x6000) (set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max)) (set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length)) @@ -321,7 +321,7 @@ ;; Used lq/sq (defbehavior target-racing-smack-check target () (if (and (< 20480.0 (-> self control unknown-float01)) - (and (logtest? (-> self control status) 8) + (and (logtest? (-> self control status) (cshape-moving-flags twall)) (< (-> self control surface-angle) 0.5) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector70) (-> self control trans))) (s5-0 (new 'stack-no-clear 'vector)) @@ -384,7 +384,7 @@ ) ) ) - (if (and (zero? (logand (-> self control status) 1)) + (if (and (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) (or (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (* (-> *TARGET-bank* ground-timeout) 2) ) @@ -610,14 +610,14 @@ (vector-normalize! (-> self control transv) (+ (-> self control unknown-float01) (-> self racer hill-boost))) ) ) - (if (and (logtest? (-> self control status) 1) (< 16384.0 (-> self control transv y))) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (< 16384.0 (-> self control transv y))) (set! (-> self racer hop?) #f) (set! (-> self racer hop?) arg2) ) (set! (-> self racer hop-start-y) (-> self control trans y)) (racer-calc-gravity) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *racer-air-mods*) (set! (-> self control unknown-float123) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))))) @@ -652,9 +652,8 @@ ((cpad-pressed? (-> self control unknown-cpad-info00 number) l1 r1) (set! (-> self racer slide-down-time 0) (-> *display* base-frame-counter)) ) - ((zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) + ((zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) (set! (-> self racer slide-down-time 0) 0) 0 ) @@ -688,7 +687,7 @@ ) ) ) - (if (and (logtest? (-> self control status) 1) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) (go target-racing) @@ -737,7 +736,7 @@ (set! (-> self state-time) (-> *display* base-frame-counter)) (racer-calc-gravity) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-float123) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))))) ) @@ -775,7 +774,7 @@ ) (go target-racing-jump 2048.0 5324.8 #t) ) - (if (and (logtest? (-> self control status) 1) + (if (and (logtest? (-> self control status) (cshape-moving-flags onsurf)) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1)) ) (go target-racing) @@ -930,7 +929,7 @@ ) :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-racing) ) (target-racing-smack-check) @@ -982,7 +981,7 @@ :exit (behavior () (if (!= (-> self next-state name) 'target-racing-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) ((-> target-racing-start exit)) (none) @@ -996,7 +995,7 @@ (sound-play-by-name (static-sound-name "oof") (new-sound-id) 1024 0 0 1 #t) ) (set! (-> self game hit-time) (-> *display* base-frame-counter)) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self racer boost-curve) 0.0) (set! (-> self racer boost-level) 0.0) (set! (-> self racer boost-target) 0.0) @@ -1069,7 +1068,7 @@ (-> target-death event) :exit (behavior () - (set! (-> self state-flags) (logand -32769 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf15)) (send-event (ppointer->process (-> self manipy)) 'draw #t) (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) (target-timed-invulnerable-off self) @@ -1086,7 +1085,7 @@ (set! (-> self racer stick-off) #t) (set! (-> self neck flex-blend) 0.0) (target-timed-invulnerable-off self) - (logior! (-> self state-flags) #x8000) + (logior! (-> self state-flags) (state-flags sf15)) (case (-> self attack-info mode) (('explode 'darkeco 'heat 'death 'deadly 'balloonlurker) ((-> target-racing-start exit)) @@ -1315,7 +1314,7 @@ (behavior ((arg0 handle)) (set! (-> self control transv quad) (the-as uint128 0)) (set! (-> self alt-cam-pos quad) (-> (&-> (-> self control) unknown-qword00) 0)) - (logior! (-> self state-flags) 1024) + (logior! (-> self state-flags) (state-flags sf10)) (set! (-> self state-time) (-> *display* base-frame-counter)) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) @@ -1389,7 +1388,7 @@ ) ) ) - (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf10)) (send-event *camera* 'set-slave-option #x6000) (set! (-> self control transv quad) (the-as uint128 0)) (quaternion-copy! (-> self control quat) (-> self control unknown-quaternion00)) @@ -1726,7 +1725,7 @@ (-> target-hit-ground enter) :trans (behavior () - (logior! (-> self control status) 7) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) ((-> target-hit-ground trans)) (none) ) @@ -1788,15 +1787,15 @@ (behavior () (set! (-> self control unknown-surface00) *grab-mods*) (set! (-> self neck flex-blend) 0.0) - (logior! (-> self state-flags) 272) + (logior! (-> self state-flags) (state-flags sf04 sf08)) (set! (-> self racer stick-off) #t) (none) ) :exit (behavior () (set! (-> self racer stick-off) #f) - (set! (-> self state-flags) (logand -273 (-> self state-flags))) - (set! (-> self water flags) (logand -65537 (-> self water flags))) + (logclear! (-> self state-flags) (state-flags sf04 sf08)) + (logclear! (-> self water flags) (water-flags wt16)) ((-> target-racing-start exit)) (none) ) diff --git a/test/decompiler/reference/levels/racer_common/racer_REF.gc b/test/decompiler/reference/levels/racer_common/racer_REF.gc index bdfb0e3428..ce96df9b3e 100644 --- a/test/decompiler/reference/levels/racer_common/racer_REF.gc +++ b/test/decompiler/reference/levels/racer_common/racer_REF.gc @@ -496,19 +496,8 @@ ) ) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "zoom-teleport") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :fo-max 30) (-> obj root-override trans)) ) (go (method-of-object obj wait-for-start)) (none) diff --git a/test/decompiler/reference/levels/racer_common/target-racer_REF.gc b/test/decompiler/reference/levels/racer_common/target-racer_REF.gc index d701613932..8c3e0f7a71 100644 --- a/test/decompiler/reference/levels/racer_common/target-racer_REF.gc +++ b/test/decompiler/reference/levels/racer_common/target-racer_REF.gc @@ -25,7 +25,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x1 + :flags (surface-flags surf00) ) ) @@ -54,7 +54,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x801 + :flags (surface-flags surf00 surf11) ) ) @@ -89,7 +89,7 @@ ;; definition for function racer-on-ground? (defbehavior racer-on-ground? racer () - (logtest? (-> self root-override status) 1) + (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) ) ;; definition for function racer-calc-gravity @@ -129,16 +129,14 @@ (let ((v1-1 (-> self racer slide-mode))) (cond ((zero? v1-1) - (if (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) + (if (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) (set! (-> self racer slide-mode) -1) ) ) ((= v1-1 1) - (if (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) - ) + (if (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1 r1)) + ) (set! (-> self racer slide-mode) -1) ) ) @@ -306,11 +304,10 @@ ) (set! f0-13 (cond - ((and (not - (and (= (-> self fact-info-target eco-type) (pickup-type eco-yellow)) - (>= (-> self fact-info-target eco-level) 1.0) - ) - ) + ((and (not (and (= (-> self fact-info-target eco-type) (pickup-type eco-yellow)) + (>= (-> self fact-info-target eco-level) 1.0) + ) + ) (cpad-hold? (-> self control unknown-cpad-info00 number) square) ) (if (and (cpad-hold? (-> self control unknown-cpad-info00 number) x) @@ -464,7 +461,7 @@ ) (deg-diff (vector-y-angle gp-0) (vector-y-angle (-> self control transv))) (let ((f30-2 (vector-xz-length gp-0))) - (when (and (logtest? (-> self control status) 8) + (when (and (logtest? (-> self control status) (cshape-moving-flags twall)) (< 20480.0 f30-2) (and (< (fabs (-> self racer mod-x)) 0.5) (!= (-> self next-state name) 'target-racing-smack)) ) @@ -548,8 +545,10 @@ ) ) (let ((f0-2 - (if (or (and (logtest? (-> self control status) 8) (zero? (logand (-> self control status) 1))) - (logtest? (-> self state-flags) #x8000) + (if (or (and (logtest? (-> self control status) (cshape-moving-flags twall)) + (zero? (logand (-> self control status) (cshape-moving-flags onsurf))) + ) + (logtest? (-> self state-flags) (state-flags sf15)) ) 0.0 (-> self control unknown-float81) @@ -619,7 +618,9 @@ ((and (!= (-> self current-level name) 'ogre) (!= (-> self current-level name) 'lavatube)) #f ) - ((or (logtest? (-> self control status) 2) (< 12288.0 (vector-length (-> self control transv)))) + ((or (logtest? (-> self control status) (cshape-moving-flags onground)) + (< 12288.0 (vector-length (-> self control transv))) + ) (let ((v0-5 (the-as object (-> *display* base-frame-counter)))) (set! (-> self racer unstuck-time) (the-as time-frame v0-5)) v0-5 @@ -841,7 +842,7 @@ ) (cpad-pressed? (-> self control unknown-cpad-info00 number) circle square) (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) (seconds 0.25)) - (zero? (logand (-> self state-flags) #x8008)) + (zero? (logand (-> self state-flags) (state-flags sf03 sf15))) ) (let ((gp-6 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat))) (s5-4 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self manipy 0 node-list data 4))) @@ -940,9 +941,8 @@ (set! (-> self racer boost-curve) 0.0) ) ) - (when (or (zero? - (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons x)) - ) + (when (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons x)) + ) (< (-> self control unknown-float01) 4096.0) (= (-> self racer boost-level) 0.0) ) @@ -953,7 +953,7 @@ (set! (-> v1-241 parms volume) -4) (set! (-> v1-241 auto-time) 120) (set! (-> v1-241 auto-from) 2) - (set! (-> v1-241 parms mask) (the-as uint 17)) + (set! (-> v1-241 parms mask) (sound-mask volume time)) (-> v1-241 id) ) (set! (-> self racer boost-sound-id) (new 'static 'sound-id)) @@ -978,7 +978,7 @@ ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 1 (seconds 0.1)) ) - (when (logtest? (-> self control status) 8) + (when (logtest? (-> self control status) (cshape-moving-flags twall)) (let* ((gp-8 (racer-find-prop-point (new 'stack-no-clear 'vector) (-> self control unknown-vector70))) (v1-274 (-> self control wall-pat material)) (a1-54 @@ -1573,7 +1573,7 @@ ) ) (cond - ((and (logtest? (-> self control status) 8) + ((and (logtest? (-> self control status) (cshape-moving-flags twall)) (and (>= (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) (seconds 0.1)) (or (-> self racer stick-lock) (< (target-move-dist (-> *TARGET-bank* stuck-time)) 4096.0)) (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2))) diff --git a/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc b/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc index 7a57b2849d..1c44867f75 100644 --- a/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc +++ b/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc @@ -1975,7 +1975,7 @@ ) ;; definition for method 22 of type rolling-water -;; INFO: Return type mismatch uint vs none. +;; INFO: Return type mismatch water-flags vs none. (defmethod TODO-RENAME-22 rolling-water ((obj rolling-water)) (let ((t9-0 (method-of-type water-anim TODO-RENAME-22))) (t9-0 obj) @@ -1988,6 +1988,6 @@ (set! (-> v1-2 far-fade-dist) 245760.0) (set! (-> v1-2 waveform) (the-as ripple-wave-set ripple-for-rolling-water)) ) - (set! (-> obj flags) (logand -8388609 (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt23)) (none) ) diff --git a/test/decompiler/reference/levels/rolling/rolling-race-ring_REF.gc b/test/decompiler/reference/levels/rolling/rolling-race-ring_REF.gc index 9cb2649661..da31e5010e 100644 --- a/test/decompiler/reference/levels/rolling/rolling-race-ring_REF.gc +++ b/test/decompiler/reference/levels/rolling/rolling-race-ring_REF.gc @@ -1139,19 +1139,8 @@ (set! (-> obj part-track) (the-as handle #f)) (set! (-> obj alt-actor) (entity-actor-lookup arg0 'alt-actor 0)) (logior! (-> obj draw status) (draw-status hidden)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "loop-racering") - :volume #x400 - :fo-max 40 - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "loop-racering" :fo-max 40) (-> obj root trans)) ) (let ((f0-1 (res-lump-float arg0 'timeout))) (set! (-> obj timeout) (the-as time-frame (the int (* 300.0 f0-1)))) diff --git a/test/decompiler/reference/levels/snow/ice-cube_REF.gc b/test/decompiler/reference/levels/snow/ice-cube_REF.gc index 428d1b6c37..0f92780651 100644 --- a/test/decompiler/reference/levels/snow/ice-cube_REF.gc +++ b/test/decompiler/reference/levels/snow/ice-cube_REF.gc @@ -1058,7 +1058,7 @@ (dummy-57 self) (logclear! (-> self mask) (process-mask actor-pause)) (if (or (not *target*) - (logtest? (-> *target* state-flags) #x80f8) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (not (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos))) ) (go-virtual nav-enemy-patrol) @@ -1099,7 +1099,7 @@ ) (+! (-> self collide-info transv y) (* -544768.0 (-> *display* seconds-per-frame))) (let* ((v1-26 (>= 0.0 (-> self collide-info transv y))) - (v1-27 (and v1-26 (logtest? (-> self collide-info status) 1))) + (v1-27 (and v1-26 (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)))) ) (set! gp-0 (dummy-60 self (not v1-27))) ) @@ -1111,7 +1111,12 @@ ) ) (while #t - (let ((s5-0 (and (>= 0.0 (-> self collide-info transv y)) (logtest? (-> self collide-info status) 1)))) + (let ((s5-0 + (and (>= 0.0 (-> self collide-info transv y)) + (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) + ) + ) + ) (set! gp-0 (and s5-0 gp-0)) (if gp-0 (goto cfg-26) @@ -1236,7 +1241,7 @@ (logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf2)) (dummy-58 self) (if (or (not *target*) - (logtest? (-> *target* state-flags) #x80f8) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (not (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos))) ) (go ice-cube-retract-spikes) @@ -1277,7 +1282,7 @@ ) (+! (-> self collide-info transv y) (* -544768.0 (-> *display* seconds-per-frame))) (let* ((v1-26 (>= 0.0 (-> self collide-info transv y))) - (v1-27 (and v1-26 (logtest? (-> self collide-info status) 1))) + (v1-27 (and v1-26 (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)))) ) (set! gp-0 (dummy-60 self (not v1-27))) ) @@ -1289,7 +1294,12 @@ ) ) (while #t - (let ((s5-0 (and (>= 0.0 (-> self collide-info transv y)) (logtest? (-> self collide-info status) 1)))) + (let ((s5-0 + (and (>= 0.0 (-> self collide-info transv y)) + (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) + ) + ) + ) (set! gp-0 (and s5-0 gp-0)) (if gp-0 (goto cfg-26) @@ -1350,7 +1360,7 @@ (logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf2)) (set! (-> self next-skid-sound-time) (-> *display* base-frame-counter)) (if (or (not *target*) - (logtest? (-> *target* state-flags) #x80f8) + (logtest? (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)) (not (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos))) ) (go ice-cube-retract-spikes) @@ -1379,7 +1389,7 @@ ) :trans (behavior () - (when (or (not *target*) (logtest? (-> *target* state-flags) 128)) + (when (or (not *target*) (logtest? (-> *target* state-flags) (state-flags sf07))) (cond ((= (-> self speed) 0.0) (go ice-cube-mean-charge-done) diff --git a/test/decompiler/reference/levels/snow/snow-bumper_REF.gc b/test/decompiler/reference/levels/snow/snow-bumper_REF.gc index 53385dbfd7..aeb8ac242a 100644 --- a/test/decompiler/reference/levels/snow/snow-bumper_REF.gc +++ b/test/decompiler/reference/levels/snow/snow-bumper_REF.gc @@ -456,19 +456,8 @@ (nav-mesh-connect obj (-> obj root) (the-as nav-control #f)) (set! (-> obj link) (new 'process 'actor-link-info obj)) (set! (-> obj bumper-id) (+ (actor-count-before (-> obj link)) 1)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "snow-bumper") - :volume #x400 - :fo-max 40 - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "snow-bumper" :fo-max 40) (-> obj root trans)) ) (ja-channel-set! 1) (let ((s5-1 (-> obj skel root-channel 0))) diff --git a/test/decompiler/reference/levels/snow/snow-bunny_REF.gc b/test/decompiler/reference/levels/snow/snow-bunny_REF.gc index 7c973e28f0..dba329b3b9 100644 --- a/test/decompiler/reference/levels/snow/snow-bunny_REF.gc +++ b/test/decompiler/reference/levels/snow/snow-bunny_REF.gc @@ -241,7 +241,7 @@ (defmethod TODO-RENAME-48 snow-bunny ((obj snow-bunny)) (dummy-60 obj) (TODO-RENAME-45 obj *snow-bunny-nav-enemy-info*) - (set! (-> obj draw shadow-ctrl settings flags) (logand -9 (-> obj draw shadow-ctrl settings flags))) + (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf03)) (cond ((zero? (res-lump-value (-> obj entity) 'mode uint128)) (set! (-> obj defense) (the-as uint 1)) @@ -282,7 +282,7 @@ ;; definition for method 58 of type snow-bunny ;; INFO: Return type mismatch time-frame vs none. (defmethod dummy-58 snow-bunny ((obj snow-bunny)) - (if (zero? (logand (-> *target* state-flags) 2)) + (if (zero? (logand (-> *target* state-flags) (state-flags sf01))) (set! (-> obj last-nondangerous-time) (-> *display* base-frame-counter)) ) (none) @@ -336,7 +336,7 @@ ;; definition for method 57 of type snow-bunny (defmethod dummy-57 snow-bunny ((obj snow-bunny)) - (if (or (not *target*) (zero? (logand (-> *target* state-flags) 2))) + (if (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf01)))) (return #f) ) (let ((f0-0 (vector-vector-xz-distance (target-pos 0) (-> obj collide-info trans)))) @@ -795,7 +795,7 @@ (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) ) ) - (until (logtest? (-> self collide-info status) 1) + (until (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) (let ((a0-11 (-> self skel root-channel 0))) (set! (-> a0-11 param 0) (the float (+ (-> a0-11 frame-group data 0 length) -1))) (set! (-> a0-11 param 1) f30-0) @@ -948,7 +948,7 @@ (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) (set! (-> self should-retreat?) #f) - (if (or (not *target*) (logtest? (-> *target* state-flags) 128)) + (if (or (not *target*) (logtest? (-> *target* state-flags) (state-flags sf07))) (go-virtual nav-enemy-patrol) ) (if (not (TODO-RENAME-46 self (-> self nav-info stop-chase-distance))) @@ -1239,7 +1239,7 @@ (go-virtual nav-enemy-patrol) ) (let ((v1-8 (>= 73728.0 (vector-vector-xz-distance (target-pos 0) (-> self collide-info trans))))) - (when (or (-> self should-retreat?) (and v1-8 (logtest? (-> *target* state-flags) 2))) + (when (or (-> self should-retreat?) (and v1-8 (logtest? (-> *target* state-flags) (state-flags sf01)))) (set! (-> self retreat-timeout-time) (+ (-> *display* base-frame-counter) (the int (* 300.0 (-> self retreat-timeout)))) ) @@ -1247,7 +1247,7 @@ ) (when (or (>= (-> *display* base-frame-counter) (-> self retreat-timeout-time)) (not v1-8)) (if (or (not *target*) - (logtest? (-> *target* state-flags) 128) + (logtest? (-> *target* state-flags) (state-flags sf07)) (not (TODO-RENAME-46 self (-> self nav-info stop-chase-distance))) ) (go-virtual nav-enemy-patrol) @@ -1312,10 +1312,12 @@ (go-virtual snow-bunny-chase-hop) ) ) - (if (not (logtest? (-> *target* state-flags) 2)) + (if (not (logtest? (-> *target* state-flags) (state-flags sf01))) (go-virtual snow-bunny-chase-hop) ) - (if (and (logtest? (-> *target* state-flags) 2) (not (TODO-RENAME-46 self (-> self nav-info notice-distance)))) + (if (and (logtest? (-> *target* state-flags) (state-flags sf01)) + (not (TODO-RENAME-46 self (-> self nav-info notice-distance))) + ) (go-virtual snow-bunny-retreat-hop) ) (none) @@ -1414,7 +1416,7 @@ (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) ) ) - (until (logtest? (-> self collide-info status) 1) + (until (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) (suspend) ) (go-virtual snow-bunny-retreat-hop) diff --git a/test/decompiler/reference/levels/snow/snow-flutflut-obs_REF.gc b/test/decompiler/reference/levels/snow/snow-flutflut-obs_REF.gc index ebba3aff6d..f877f44fb8 100644 --- a/test/decompiler/reference/levels/snow/snow-flutflut-obs_REF.gc +++ b/test/decompiler/reference/levels/snow/snow-flutflut-obs_REF.gc @@ -1003,8 +1003,8 @@ (behavior () (when *target* (if (and (>= 798720.0 (-> (target-pos 0) y)) - (not (and (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) ) ) diff --git a/test/decompiler/reference/levels/snow/snow-obs_REF.gc b/test/decompiler/reference/levels/snow/snow-obs_REF.gc index 0a80ae234c..c312870d4b 100644 --- a/test/decompiler/reference/levels/snow/snow-obs_REF.gc +++ b/test/decompiler/reference/levels/snow/snow-obs_REF.gc @@ -629,19 +629,8 @@ (set! (-> obj root-override trans y) (+ -2662.4 (-> obj root-override trans y))) (update-transforms! (-> obj root-override)) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 510) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "electric-loop") - :volume #x400 - :fo-max 40 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "electric-loop" :fo-max 40) (-> obj root-override trans)) ) (cond ((task-complete? *game-info* (-> obj entity extra perm task)) @@ -1366,19 +1355,8 @@ (set! (-> obj closed-trans quad) (-> obj open-trans quad)) (set! (-> obj open-trans y) (+ -141312.0 (-> obj open-trans y))) (set! (-> obj open-trans z) (+ 32768.0 (-> obj open-trans z))) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lodge-door-mov") - :volume #x400 - :fo-max 80 - ) - (-> obj open-trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "lodge-door-mov" :fo-max 80) (-> obj open-trans)) ) (ja-channel-push! 1 0) (let ((s5-1 (-> obj skel root-channel 0))) @@ -1702,19 +1680,8 @@ (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *snow-gears-sg* '()) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 515) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "snow-engine") - :volume #x400 - :fo-max #x12c - ) - (-> obj root trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "snow-engine" :fo-max 300) (-> obj root trans)) ) (go snow-gears-idle) (none) @@ -1817,7 +1784,7 @@ (local-vars (v1-1 symbol)) (until v1-1 (suspend) - (set! v1-1 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-1 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) (sound-play-by-name (static-sound-name "prec-button1") (new-sound-id) 1024 -1524 0 1 #t) (let ((gp-1 (get-process *default-dead-pool* snowcam #x4000))) diff --git a/test/decompiler/reference/levels/snow/snow-ram-boss_REF.gc b/test/decompiler/reference/levels/snow/snow-ram-boss_REF.gc index 18e53ee293..007e5f6917 100644 --- a/test/decompiler/reference/levels/snow/snow-ram-boss_REF.gc +++ b/test/decompiler/reference/levels/snow/snow-ram-boss_REF.gc @@ -559,7 +559,7 @@ ) (sound-trans-convert (-> s5-0 parms trans) a1-4) ) - (set! (-> s5-0 parms mask) (the-as uint 32)) + (set! (-> s5-0 parms mask) (sound-mask trans)) (-> s5-0 id) ) (none) @@ -576,7 +576,7 @@ (s4-0 (new 'stack-no-clear 'vector)) (s5-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) ) - (if (logtest? (-> arg0 root-override status) 4) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags tsurf)) (vector-flatten! s3-1 s3-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s3-1 1.0) @@ -679,7 +679,7 @@ ;; INFO: Return type mismatch vector vs none. ;; Used lq/sq (defmethod dummy-28 ram-boss-proj ((obj ram-boss-proj)) - (when (and *target* (zero? (logand (-> *target* state-flags) #x80f8))) + (when (and *target* (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15)))) (let ((gp-0 (-> obj target))) (set! (-> gp-0 quad) (-> (target-pos 0) quad)) (set! (-> gp-0 y) (+ 4915.2 (-> gp-0 y))) @@ -1551,7 +1551,7 @@ #f #f ) - (if (logtest? (-> self collide-info status) 1) + (if (logtest? (-> self collide-info status) (cshape-moving-flags onsurf)) (go ram-boss-jump-down-hit-ground) ) (none) @@ -1869,7 +1869,7 @@ ) ) (when (and (= (-> self proj-status) 2) - (zero? (logand (-> *target* state-flags) #x80f8)) + (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.2)) ) (let ((gp-2 (new 'stack-no-clear 'vector)) diff --git a/test/decompiler/reference/levels/sunken/bully_REF.gc b/test/decompiler/reference/levels/sunken/bully_REF.gc index b618efdc03..bfb7e48e83 100644 --- a/test/decompiler/reference/levels/sunken/bully_REF.gc +++ b/test/decompiler/reference/levels/sunken/bully_REF.gc @@ -468,9 +468,10 @@ ;; INFO: Return type mismatch int vs none. (defbehavior bully-post bully () (when (and (-> self hit-player?) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> self root-override) 2 (collide-offense normal-attack)) @@ -567,7 +568,7 @@ (set! (-> self travel-speed) 0.0) (shut-down! (-> self neck)) (let ((v1-5 (-> self draw shadow-ctrl))) - (logior! (-> v1-5 settings flags) 32) + (logior! (-> v1-5 settings flags) (shadow-flags shdf05)) ) 0 (none) @@ -575,7 +576,7 @@ :exit (behavior () (let ((v1-1 (-> self draw shadow-ctrl))) - (set! (-> v1-1 settings flags) (logand -33 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf05)) ) 0 (none) @@ -682,7 +683,7 @@ (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) ) ) - (until (logtest? (-> self root-override status) 1) + (until (logtest? (-> self root-override status) (cshape-moving-flags onsurf)) (let ((a0-7 (-> self skel root-channel 0))) (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) (set! (-> a0-7 param 1) 1.0) diff --git a/test/decompiler/reference/levels/sunken/double-lurker_REF.gc b/test/decompiler/reference/levels/sunken/double-lurker_REF.gc index 82fc4384ac..8448851fb1 100644 --- a/test/decompiler/reference/levels/sunken/double-lurker_REF.gc +++ b/test/decompiler/reference/levels/sunken/double-lurker_REF.gc @@ -349,7 +349,7 @@ (behavior ((arg0 object) (arg1 vector) (arg2 vector)) (dummy-51 self) (let ((v1-3 (-> self draw shadow-ctrl))) - (set! (-> v1-3 settings flags) (logand -33 (-> v1-3 settings flags))) + (logclear! (-> v1-3 settings flags) (shadow-flags shdf05)) ) 0 (logclear! (-> self collide-info nav-flags) (nav-flags navf0)) @@ -579,7 +579,7 @@ ) (transform-post) (let ((v1-13 (-> self draw shadow-ctrl))) - (logior! (-> v1-13 settings flags) 32) + (logior! (-> v1-13 settings flags) (shadow-flags shdf05)) ) 0 (go double-lurker-top-on-shoulders) diff --git a/test/decompiler/reference/levels/sunken/floating-launcher_REF.gc b/test/decompiler/reference/levels/sunken/floating-launcher_REF.gc index 74b1dfbb65..d1c46a756d 100644 --- a/test/decompiler/reference/levels/sunken/floating-launcher_REF.gc +++ b/test/decompiler/reference/levels/sunken/floating-launcher_REF.gc @@ -46,7 +46,9 @@ (when (< (vector-xz-length (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> self root-override trans))) 81920.0 ) - (if (and (>= (-> (target-pos 0) y) (-> self trigger-height)) (logtest? (-> *target* control status) 2)) + (if (and (>= (-> (target-pos 0) y) (-> self trigger-height)) + (logtest? (-> *target* control status) (cshape-moving-flags onground)) + ) (go floating-launcher-lowering) ) ) diff --git a/test/decompiler/reference/levels/sunken/helix-water_REF.gc b/test/decompiler/reference/levels/sunken/helix-water_REF.gc index 1b4f22df40..56930d5165 100644 --- a/test/decompiler/reference/levels/sunken/helix-water_REF.gc +++ b/test/decompiler/reference/levels/sunken/helix-water_REF.gc @@ -316,7 +316,7 @@ (case arg2 (('touch) (when *target* - (when (logtest? (-> *target* control status) 1) + (when (logtest? (-> *target* control status) (cshape-moving-flags onsurf)) (cond ((and (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete))) (not (handle->process (-> self fcell-handle))) @@ -355,7 +355,7 @@ (send-event a0-1 'pickup) (until v1-7 (suspend) - (set! v1-7 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-7 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) ) ) @@ -748,7 +748,7 @@ (seek! (-> self root scale y) 0.8 (* 0.667 (-> *display* seconds-per-frame))) (when *target* (let ((f0-4 (-> (target-pos 0) y))) - (when (zero? (logand (-> *target* state-flags) 256)) + (when (zero? (logand (-> *target* state-flags) (state-flags sf08))) (let* ((f0-5 (- f0-4 (-> self root trans y))) (f0-6 (+ -40960.0 f0-5)) (f0-7 (* 0.000024414063 f0-6)) diff --git a/test/decompiler/reference/levels/sunken/orbit-plat_REF.gc b/test/decompiler/reference/levels/sunken/orbit-plat_REF.gc index d5599c641c..c5f5cee07b 100644 --- a/test/decompiler/reference/levels/sunken/orbit-plat_REF.gc +++ b/test/decompiler/reference/levels/sunken/orbit-plat_REF.gc @@ -128,14 +128,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 1.0 2.0 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "steam-medium") - :volume #x333 - ) - ) + (sp-sound (static-sound-spec "steam-medium" :num 0.05 :volume 80.0)) (sp-rnd-flt spt-scale-x (meters 0.75) (meters 0.75) 1.0) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) diff --git a/test/decompiler/reference/levels/sunken/puffer_REF.gc b/test/decompiler/reference/levels/sunken/puffer_REF.gc index bd2a20a0b4..5e24629576 100644 --- a/test/decompiler/reference/levels/sunken/puffer_REF.gc +++ b/test/decompiler/reference/levels/sunken/puffer_REF.gc @@ -170,9 +170,10 @@ ;; INFO: Return type mismatch int vs none. (defbehavior puffer-post puffer () (when (and (-> self hit-player?) - (or (not *target*) (and (zero? (logand (-> *target* state-flags) #x80f8)) - (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) - ) + (or (not *target*) + (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) + (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.05)) + ) ) ) (set-collide-offense (-> self root-override) 2 (collide-offense normal-attack)) @@ -211,7 +212,7 @@ 0.0 ) (let ((v1-11 (-> obj draw shadow-ctrl))) - (set! (-> v1-11 settings flags) (logand -33 (-> v1-11 settings flags))) + (logclear! (-> v1-11 settings flags) (shadow-flags shdf05)) ) 0 (let ((v1-14 (-> obj draw shadow-ctrl))) @@ -225,7 +226,7 @@ ) (else (let ((v1-19 (-> obj draw shadow-ctrl))) - (logior! (-> v1-19 settings flags) 32) + (logior! (-> v1-19 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -234,7 +235,7 @@ ) (else (let ((v1-21 (-> obj draw shadow-ctrl))) - (logior! (-> v1-21 settings flags) 32) + (logior! (-> v1-21 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -272,7 +273,7 @@ (defmethod dummy-25 puffer ((obj puffer) (arg0 float)) (when *target* (let ((gp-0 (target-pos 0))) - (when (and (zero? (logand (-> *target* state-flags) #x80f8)) + (when (and (zero? (logand (-> *target* state-flags) (state-flags sf03 sf04 sf05 sf06 sf07 sf15))) (dummy-24 obj gp-0) (>= (-> gp-0 y) (+ -14336.0 (-> obj attack-bottom-y))) (>= (+ 2048.0 (-> obj top-y)) (-> gp-0 y)) @@ -633,7 +634,7 @@ (set! (-> self attacking?) #f) (shut-down! (-> self neck)) (let ((v1-5 (-> self draw shadow-ctrl))) - (logior! (-> v1-5 settings flags) 32) + (logior! (-> v1-5 settings flags) (shadow-flags shdf05)) ) 0 (none) diff --git a/test/decompiler/reference/levels/sunken/qbert-plat_REF.gc b/test/decompiler/reference/levels/sunken/qbert-plat_REF.gc index ace3128bfa..30e791d0f1 100644 --- a/test/decompiler/reference/levels/sunken/qbert-plat_REF.gc +++ b/test/decompiler/reference/levels/sunken/qbert-plat_REF.gc @@ -542,7 +542,7 @@ ) (when (and *target* (not (-> self puzzle-beaten?))) (let ((gp-0 #f)) - (let ((s5-1 (logtest? (-> *target* water flags) 512))) + (let ((s5-1 (logtest? (-> *target* water flags) (water-flags wt09)))) (when s5-1 (when (not (-> self player-in-water?)) (set! gp-0 #t) @@ -557,7 +557,7 @@ ) (set! (-> self player-in-water?) s5-1) ) - (when (logtest? (-> *target* control status) 1) + (when (logtest? (-> *target* control status) (cshape-moving-flags onsurf)) (let ((s5-2 #t)) (let ((s3-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) diff --git a/test/decompiler/reference/levels/sunken/sun-exit-chamber_REF.gc b/test/decompiler/reference/levels/sunken/sun-exit-chamber_REF.gc index bca4febc2a..77167f5456 100644 --- a/test/decompiler/reference/levels/sunken/sun-exit-chamber_REF.gc +++ b/test/decompiler/reference/levels/sunken/sun-exit-chamber_REF.gc @@ -664,19 +664,8 @@ (-> s5-1 ppointer) ) ) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "blue-eco-charg") - :volume #x400 - :fo-max 35 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "blue-eco-charg" :fo-max 35) (-> obj root-override trans)) ) (if (zero? (get-reminder (get-task-control (game-task sunken-room)) 0)) (go blue-eco-charger-idle) @@ -1532,15 +1521,7 @@ (set! (-> obj sound) (new 'process 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "chamber-move") - :volume #x400 - :fo-min #x12c - :fo-max #x190 - ) + (static-sound-spec "chamber-move" :fo-min 300 :fo-max 400) (-> obj root-override trans) ) ) diff --git a/test/decompiler/reference/levels/sunken/sunken-pipegame_REF.gc b/test/decompiler/reference/levels/sunken/sunken-pipegame_REF.gc index 564b8e5734..8323f67ad6 100644 --- a/test/decompiler/reference/levels/sunken/sunken-pipegame_REF.gc +++ b/test/decompiler/reference/levels/sunken/sunken-pipegame_REF.gc @@ -832,7 +832,7 @@ ) (until v1-112 (suspend) - (set! v1-112 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-112 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) (set! (-> self state-time) (-> *display* base-frame-counter)) (sleep (-> self ticker) (-> self prize (-> self challenge) puzzle-delay)) @@ -987,7 +987,7 @@ (set! (-> self abort-audio-if-beaten?) #f) (until v1-3 (suspend) - (set! v1-3 (or (not *target*) (zero? (logand (-> *target* state-flags) 256)))) + (set! v1-3 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags sf08))))) ) (if (not (handle->process (-> self prize (-> self challenge) actor-handle))) (logior! (-> self challenges-mask) (ash 1 (-> self challenge))) diff --git a/test/decompiler/reference/levels/sunken/sunken-water_REF.gc b/test/decompiler/reference/levels/sunken/sunken-water_REF.gc index e2a1edfba7..8d9ba1dc05 100644 --- a/test/decompiler/reference/levels/sunken/sunken-water_REF.gc +++ b/test/decompiler/reference/levels/sunken/sunken-water_REF.gc @@ -152,7 +152,7 @@ ) (set! (-> self draw color-mult w) 0.5) (if (= f30-0 1.0) - (set! (-> self flags) (logior #x80000 (-> self flags))) + (set! (-> self flags) (logior (water-flags wt19) (-> self flags))) ) ) ) @@ -164,7 +164,7 @@ (update! (-> self sound)) ) (else - (set! (-> self flags) (logand -524289 (-> self flags))) + (logclear! (-> self flags) (water-flags wt19)) (when (!= (-> self deadly-fade) 0.0) (seek! (-> self deadly-fade) 0.0 (* 8.0 (-> *display* seconds-per-frame))) (let ((f30-1 (-> self deadly-fade))) @@ -177,7 +177,7 @@ ) (set! (-> self draw color-mult w) 0.5) (if (= f30-1 0.0) - (set! (-> self flags) (logand -524289 (-> self flags))) + (logclear! (-> self flags) (water-flags wt19)) ) ) ) @@ -197,7 +197,7 @@ ) ) (else - (when (logtest? #x80000 (-> self flags)) + (when (logtest? (water-flags wt19) (-> self flags)) (draw-ripple self) (update! (-> self sound)) (set! (-> self playing-deadly-sound?) #t) @@ -211,9 +211,8 @@ ) ;; definition for method 25 of type sunken-water -;; INFO: Return type mismatch uint vs object. +;; INFO: Return type mismatch uint vs none. (defmethod TODO-RENAME-25 sunken-water ((obj sunken-water)) - (local-vars (v0-3 uint)) (let ((t9-0 (method-of-type water-anim TODO-RENAME-25))) (t9-0 obj) ) @@ -229,7 +228,7 @@ (s5-0 0.5 ) - ((logtest? #x80000 (-> obj flags)) + ((logtest? (water-flags wt19) (-> obj flags)) 1.0 ) (else @@ -241,28 +240,21 @@ (when (and s5-0 (or (= f0-16 0.0) (= f0-16 1.0))) (set! s5-0 #f) (if (= f0-16 0.0) - (set! (-> obj flags) (logior #x80000 (-> obj flags))) - (set! (-> obj flags) (logand -524289 (-> obj flags))) + (set! (-> obj flags) (logior (water-flags wt19) (-> obj flags))) + (logclear! (-> obj flags) (water-flags wt19)) ) ) (set! (-> obj use-sync?) s5-0) (set! (-> obj deadly-time) f0-16) ) - (the-as object (when s5-0 - (cond - ((< (get-current-phase (-> obj sync)) (-> obj deadly-time)) - (set! v0-3 (logior (the-as uint #x80000) (-> obj flags))) - (set! (-> obj flags) v0-3) - ) - (else - (set! v0-3 (logand (the-as uint -524289) (-> obj flags))) - (set! (-> obj flags) v0-3) - ) - ) - v0-3 - ) - ) + (when s5-0 + (if (< (get-current-phase (-> obj sync)) (-> obj deadly-time)) + (set! (-> obj flags) (the-as water-flags (logior (water-flags wt19) (-> obj flags)))) + (set! (-> obj flags) (the-as water-flags (logclear (-> obj flags) (water-flags wt19)))) + ) + ) ) + (none) ) ;; definition for method 22 of type sunken-water @@ -274,7 +266,7 @@ ) (set! (-> obj play-ambient-sound?) #f) (cond - ((logtest? #x80000 (-> obj flags)) + ((logtest? (water-flags wt19) (-> obj flags)) (set! (-> obj draw color-mult quad) (-> obj deadly-color-mult quad)) (set! (-> obj draw color-emissive quad) (-> obj deadly-color-emissive quad)) (set! (-> obj deadly-fade) 1.0) diff --git a/test/decompiler/reference/levels/sunken/target-tube_REF.gc b/test/decompiler/reference/levels/sunken/target-tube_REF.gc index 5754b81a80..793b014d6f 100644 --- a/test/decompiler/reference/levels/sunken/target-tube_REF.gc +++ b/test/decompiler/reference/levels/sunken/target-tube_REF.gc @@ -54,7 +54,7 @@ :slope-up-traction 1.0 :align-speed 1.0 :mode 'air - :flags #x800 + :flags (surface-flags surf11) ) ) @@ -105,7 +105,7 @@ :alignv 1.0 :slope-up-traction 1.0 :align-speed 1.0 - :flags #x28 + :flags (surface-flags surf03 surf05) ) ) ) @@ -182,7 +182,7 @@ (defbehavior tube-sounds target () (seek! (-> self tube tube-sound-vol) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) 100.0 0.0 ) @@ -224,7 +224,7 @@ (vector-normalize! s4-1 (-> self control unknown-surface01 target-speed)) ) (vector-v++! (-> self control unknown-vector00) s4-1) - (when (logtest? (-> self control status) 8) + (when (logtest? (-> self control status) (cshape-moving-flags twall)) (let ((s3-0 (-> self tube old-transv))) (-> self control unknown-vector00 y) (vector-reflect! s4-1 s3-0 (-> self control unknown-vector71)) @@ -372,7 +372,7 @@ (set! (-> self tube old-transv quad) (-> self control transv quad)) (flag-setup) (build-conversions (-> self control transv)) - (if (logtest? (-> self state-flags) 32) + (if (logtest? (-> self state-flags) (state-flags sf05)) (set! (-> self control unknown-surface01 turnv) (* 3.0 (-> self control unknown-surface01 turnv))) ) (forward-up-nopitch->quaternion @@ -714,7 +714,7 @@ (behavior ((arg0 float) (arg1 float)) (set! (-> self state-time) (-> *display* base-frame-counter)) (init-var-jump arg0 arg1 (the-as vector #t) (the-as vector #f) (-> self control transv)) - (set! (-> self control status) (logand -8 (-> self control status))) + (logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) (set! (-> self control unknown-surface00) *tube-jump-mods*) (none) ) @@ -722,7 +722,7 @@ (-> target-tube-start exit) :trans (behavior () - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-tube) ) (mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv)) @@ -809,9 +809,9 @@ :exit (behavior () (if (!= (-> self next-state name) 'target-tube-death) - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) ) - (set! (-> self state-flags) (logand -901 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf02 sf07 sf08 sf09)) ((-> target-tube-start exit)) (none) ) @@ -819,7 +819,7 @@ (behavior ((arg0 symbol) (arg1 attack-info)) (let ((gp-0 (-> self attack-info))) (set! (-> self state-time) (-> *display* base-frame-counter)) - (logior! (-> self state-flags) 8) + (logior! (-> self state-flags) (state-flags sf03)) (set! (-> self game hit-time) (-> *display* base-frame-counter)) (when (zero? (logand (-> arg1 mask) 2)) (vector-! @@ -915,7 +915,7 @@ (-> target-death event) :exit (behavior () - (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + (logclear! (-> self state-flags) (state-flags sf03 sf15)) (target-exit) (clear-pending-settings-from-process *setting-control* self 'process-mask) (copy-settings-from-target! *setting-control*) @@ -942,7 +942,7 @@ (until (ja-done? 0) (TODO-RENAME-9 (-> self align)) (let ((gp-2 (new 'stack-no-clear 'vector))) - (when (zero? (logand (-> self align flags) 1)) + (when (zero? (logand (-> self align flags) (align-flags algf00))) (vector-matrix*! gp-2 (the-as vector (-> self align delta)) (-> self control unknown-matrix01)) (vector-float*! (-> self control transv) gp-2 (-> *display* frames-per-second)) ) diff --git a/test/decompiler/reference/levels/sunken/whirlpool_REF.gc b/test/decompiler/reference/levels/sunken/whirlpool_REF.gc index 8d6ab0973b..be2d611233 100644 --- a/test/decompiler/reference/levels/sunken/whirlpool_REF.gc +++ b/test/decompiler/reference/levels/sunken/whirlpool_REF.gc @@ -14,7 +14,7 @@ :size-assert #xcc :flag-assert #x15006000cc (:methods - (dummy-20 (_type_ float) uint 20) + (dummy-20 (_type_ float) cshape-moving-flags 20) ) (:states whirlpool-idle @@ -354,7 +354,7 @@ ) (+! (-> self spin-ry) (* f30-0 (-> *display* seconds-per-frame))) (quaternion-axis-angle! (-> self root-override quat) 0.0 1.0 0.0 (-> self spin-ry)) - (if (and *target* (logtest? (-> *target* water flags) 512)) + (if (and *target* (logtest? (-> *target* water flags) (water-flags wt09))) (dummy-20 self f30-0) ) (update! (-> self sound)) @@ -415,19 +415,8 @@ (set! (-> obj spin-speed-delta) (- f28-0 f30-0)) ) (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 447) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "whirlpool") - :volume #x400 - :fo-max 55 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "whirlpool" :fo-max 55) (-> obj root-override trans)) ) (ja-channel-set! 1) (let ((s5-1 (-> obj skel root-channel 0))) diff --git a/test/decompiler/reference/levels/swamp/billy_REF.gc b/test/decompiler/reference/levels/swamp/billy_REF.gc index f2286b8fe0..1bd7552780 100644 --- a/test/decompiler/reference/levels/swamp/billy_REF.gc +++ b/test/decompiler/reference/levels/swamp/billy_REF.gc @@ -769,7 +769,7 @@ ) (else (process-grab? *target*) - (when (and *target* (logtest? (-> *target* state-flags) 256)) + (when (and *target* (logtest? (-> *target* state-flags) (state-flags sf08))) (let ((gp-0 (get-response (-> self query)))) (cond ((and (= gp-0 'yes) (process-release? *target*)) diff --git a/test/decompiler/reference/levels/swamp/kermit_REF.gc b/test/decompiler/reference/levels/swamp/kermit_REF.gc index 16586b59f5..5b54da5974 100644 --- a/test/decompiler/reference/levels/swamp/kermit_REF.gc +++ b/test/decompiler/reference/levels/swamp/kermit_REF.gc @@ -71,14 +71,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1f :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "eco-blue-spark1") - :volume #x2cc - ) - ) + (sp-sound (static-sound-spec "eco-blue-spark1" :num 0.05 :volume 70.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) (sp-int spt-rot-x 4) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) @@ -100,14 +93,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x23 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.075 - :group #x1 - :sound-name (static-sound-name "eco-blue-spark2") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "eco-blue-spark2" :num 0.075 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) (sp-int spt-rot-x 4) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) @@ -129,14 +115,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x24 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 0.05 - :group #x1 - :sound-name (static-sound-name "eco-blue-spark3") - :volume #x2cc - ) - ) + (sp-sound (static-sound-spec "eco-blue-spark3" :num 0.05 :volume 70.0)) (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) (sp-int spt-rot-x 4) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) diff --git a/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc b/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc index 4ca44f90a4..47229fb3c2 100644 --- a/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc +++ b/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc @@ -94,7 +94,7 @@ swamp-rat-default-event-handler ;; definition for method 39 of type swamp-rat ;; Used lq/sq (defmethod common-post swamp-rat ((obj swamp-rat)) - (when (logtest? (-> obj collide-info status) 1) + (when (logtest? (-> obj collide-info status) (cshape-moving-flags onsurf)) (vector-deg-seek (-> obj up-vector) (-> obj up-vector) (-> obj collide-info surface-normal) 910.2222) (vector-normalize! (-> obj up-vector) 1.0) ) @@ -497,7 +497,7 @@ swamp-rat-default-event-handler #f #f ) - (when (or (logtest? (-> self collide-info status) 4) + (when (or (logtest? (-> self collide-info status) (cshape-moving-flags tsurf)) (or (< (-> self collide-info trans y) (-> self min-height)) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1)) ) @@ -642,7 +642,7 @@ swamp-rat-default-event-handler (set! (-> obj reaction-time) (rand-vu-int-range (seconds 0.1) (seconds 0.8))) (set! (-> obj chase-rest-time) (seconds 1)) (set! (-> obj water) (new 'process 'water-control obj 7 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 2)) + (set! (-> obj water flags) (water-flags wt01)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 12288.0) (set! (-> obj min-height) (+ -2048.0 (-> obj water height))) diff --git a/test/decompiler/reference/levels/training/training-obs_REF.gc b/test/decompiler/reference/levels/training/training-obs_REF.gc index 0171005b4c..949d3150fc 100644 --- a/test/decompiler/reference/levels/training/training-obs_REF.gc +++ b/test/decompiler/reference/levels/training/training-obs_REF.gc @@ -113,8 +113,8 @@ ) (when (!= (-> self index) 6) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -903,19 +903,21 @@ (get-middle-of-bsphere-overlap a0-24 (-> self intersection)) (target-pos 0) ) - (the-as symbol (and ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> arg3 param 0)) - (the-as collide-shape-moving (-> self root-override)) - (the-as uint 2) - ) - (or (= (-> self type) scarecrow-a) - (and (= (-> arg0 type) target) - (logtest? (-> (the-as target arg0) control unknown-surface00 flags) 2048) - (zero? (logand (-> (the-as target arg0) control status) 1)) - ) - ) - ) + (the-as + symbol + (and ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 2) ) + (or (= (-> self type) scarecrow-a) + (and (= (-> arg0 type) target) + (logtest? (-> (the-as target arg0) control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> (the-as target arg0) control status) (cshape-moving-flags onsurf))) + ) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/levels/training/training-part_REF.gc b/test/decompiler/reference/levels/training/training-part_REF.gc index ad29af239e..b4f2b4f276 100644 --- a/test/decompiler/reference/levels/training/training-part_REF.gc +++ b/test/decompiler/reference/levels/training/training-part_REF.gc @@ -155,16 +155,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x19 :page #x2)) (sp-flt spt-num 0.2) - (sp-sound (new 'static 'sound-spec - :mask #xc0 - :num 0.1 - :group #x1 - :sound-name (static-sound-name "geyser") - :volume #x400 - :fo-min 50 - :fo-max #xc8 - ) - ) + (sp-sound (static-sound-spec "geyser" :num 0.1 :fo-min 50 :fo-max 200)) (sp-rnd-flt spt-x (meters 0) (meters 1) 1.0) (sp-flt spt-y (meters -8)) (sp-flt spt-scale-x (meters 8)) diff --git a/test/decompiler/reference/levels/village1/assistant_REF.gc b/test/decompiler/reference/levels/village1/assistant_REF.gc index bce0ed7dd5..35a6362452 100644 --- a/test/decompiler/reference/levels/village1/assistant_REF.gc +++ b/test/decompiler/reference/levels/village1/assistant_REF.gc @@ -31,7 +31,7 @@ ) ;; definition for method 52 of type assistant -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 assistant ((obj assistant)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -45,7 +45,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -60,14 +60,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/village1/explorer_REF.gc b/test/decompiler/reference/levels/village1/explorer_REF.gc index 84f320a03b..15ebb6dea6 100644 --- a/test/decompiler/reference/levels/village1/explorer_REF.gc +++ b/test/decompiler/reference/levels/village1/explorer_REF.gc @@ -29,7 +29,7 @@ ) ;; definition for method 52 of type explorer -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 explorer ((obj explorer)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -43,7 +43,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -58,14 +58,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/village1/fishermans-boat_REF.gc b/test/decompiler/reference/levels/village1/fishermans-boat_REF.gc index 6c32329184..6409faa76d 100644 --- a/test/decompiler/reference/levels/village1/fishermans-boat_REF.gc +++ b/test/decompiler/reference/levels/village1/fishermans-boat_REF.gc @@ -1700,7 +1700,7 @@ (send-event *target* 'end-mode) (update-transforms! (-> self root-overlay)) (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) - (logior! (-> *target* control status) 7) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) (suspend) (send-event *camera* 'teleport-to-other-start-string) ) @@ -1877,7 +1877,7 @@ (send-event *target* 'end-mode) (update-transforms! (-> self root-overlay)) (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) - (logior! (-> *target* control status) 7) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) (suspend) (send-event *camera* 'teleport-to-other-start-string) ) diff --git a/test/decompiler/reference/levels/village1/village1-part2_REF.gc b/test/decompiler/reference/levels/village1/village1-part2_REF.gc index 529e56fa38..68f5697cad 100644 --- a/test/decompiler/reference/levels/village1/village1-part2_REF.gc +++ b/test/decompiler/reference/levels/village1/village1-part2_REF.gc @@ -1559,14 +1559,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) (sp-rnd-flt spt-num 2.0 6.0 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "drip-on-wood") - :volume #x200 - ) - ) + (sp-sound (static-sound-spec "drip-on-wood" :volume 50.0)) (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.075) 1.0) (sp-copy-from-other spt-scale-y -4) (sp-rnd-flt spt-g 96.0 128.0 1.0) diff --git a/test/decompiler/reference/levels/village1/village1-part_REF.gc b/test/decompiler/reference/levels/village1/village1-part_REF.gc index ede5e22a32..74ec2b2446 100644 --- a/test/decompiler/reference/levels/village1/village1-part_REF.gc +++ b/test/decompiler/reference/levels/village1/village1-part_REF.gc @@ -676,14 +676,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x4 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "fire-pop") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "fire-pop" :volume 100.0)) (sp-rnd-flt spt-x (meters -0.6) (meters 1.3) 1.0) (sp-rnd-flt spt-y (meters 1) (meters 0.5) 1.0) (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) diff --git a/test/decompiler/reference/levels/village1/yakow_REF.gc b/test/decompiler/reference/levels/village1/yakow_REF.gc index 12e7c175f6..d024776f2d 100644 --- a/test/decompiler/reference/levels/village1/yakow_REF.gc +++ b/test/decompiler/reference/levels/village1/yakow_REF.gc @@ -1074,7 +1074,7 @@ yakow-default-event-handler ) (set! (-> obj link) (new 'process 'actor-link-info obj)) (set! (-> obj water) (new 'process 'water-control obj 6 0.0 8192.0 2048.0)) - (set! (-> obj water flags) (the-as uint 2)) + (set! (-> obj water flags) (water-flags wt01)) (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) (set! (-> obj water ripple-size) 12288.0) (set! (-> obj home-base quad) (-> obj root-override trans quad)) diff --git a/test/decompiler/reference/levels/village2/assistant-village2_REF.gc b/test/decompiler/reference/levels/village2/assistant-village2_REF.gc index 46a624c2f9..8f4c73918a 100644 --- a/test/decompiler/reference/levels/village2/assistant-village2_REF.gc +++ b/test/decompiler/reference/levels/village2/assistant-village2_REF.gc @@ -69,7 +69,7 @@ ) ;; definition for method 52 of type assistant-levitator -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 assistant-levitator ((obj assistant-levitator)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -83,7 +83,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -98,14 +98,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -1912,19 +1912,8 @@ (set! (-> obj particle 1) (create-launch-control (-> *part-group-id-table* 659) obj)) (set! (-> obj particle 2) (create-launch-control (-> *part-group-id-table* 660) obj)) (set! (-> obj particle 3) (create-launch-control (-> *part-group-id-table* 661) obj)) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "lev-mach-idle") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "lev-mach-idle" :fo-max 30) (-> obj root-override trans)) ) (if (= (get-task-status (game-task village2-levitator)) (task-status invalid)) (go just-particles) diff --git a/test/decompiler/reference/levels/village2/village2-obs_REF.gc b/test/decompiler/reference/levels/village2/village2-obs_REF.gc index ce87eb72a6..0a40b70fe4 100644 --- a/test/decompiler/reference/levels/village2/village2-obs_REF.gc +++ b/test/decompiler/reference/levels/village2/village2-obs_REF.gc @@ -1038,19 +1038,8 @@ (cond ((name= (-> obj name) "fireboulder-6") (quaternion-axis-angle! (-> obj root-override quat) 0.0 1.0 0.0 16384.0) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "rock-hover") - :volume #x400 - :fo-max 30 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "rock-hover" :fo-max 30) (-> obj root-override trans)) ) ) (else diff --git a/test/decompiler/reference/levels/village2/village2-part_REF.gc b/test/decompiler/reference/levels/village2/village2-part_REF.gc index 5ab8a160fe..c913480376 100644 --- a/test/decompiler/reference/levels/village2/village2-part_REF.gc +++ b/test/decompiler/reference/levels/village2/village2-part_REF.gc @@ -1713,9 +1713,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 4.0 16.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-flt spt-x (meters 0.9)) (sp-flt spt-y (meters 0.05)) (sp-flt spt-z (meters -0.9)) @@ -1745,9 +1743,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 4.0 16.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-flt spt-x (meters -1.2)) (sp-flt spt-y (meters -0.5)) (sp-flt spt-z (meters 1.2)) @@ -1974,9 +1970,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 2.0 8.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) (sp-copy-from-other spt-scale-y -4) (sp-rnd-flt spt-r 128.0 128.0 1.0) @@ -2003,9 +1997,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) (sp-rnd-flt spt-num 2.0 6.0 1.0) - (sp-sound - (new 'static 'sound-spec :mask #x1 :num 0.1 :group #x1 :sound-name (static-sound-name "spark") :volume #x400) - ) + (sp-sound (static-sound-spec "spark" :num 0.1 :volume 100.0)) (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) (sp-copy-from-other spt-scale-y -4) (sp-rnd-flt spt-r 128.0 128.0 1.0) diff --git a/test/decompiler/reference/levels/village2/warrior_REF.gc b/test/decompiler/reference/levels/village2/warrior_REF.gc index 0a2d45c2b0..ee17225904 100644 --- a/test/decompiler/reference/levels/village2/warrior_REF.gc +++ b/test/decompiler/reference/levels/village2/warrior_REF.gc @@ -55,14 +55,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/village3/assistant-village3_REF.gc b/test/decompiler/reference/levels/village3/assistant-village3_REF.gc index f0c60cd2dc..404c280c21 100644 --- a/test/decompiler/reference/levels/village3/assistant-village3_REF.gc +++ b/test/decompiler/reference/levels/village3/assistant-village3_REF.gc @@ -55,14 +55,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/village3/minecart_REF.gc b/test/decompiler/reference/levels/village3/minecart_REF.gc index 1e5fc1c1f7..cc7d7519cf 100644 --- a/test/decompiler/reference/levels/village3/minecart_REF.gc +++ b/test/decompiler/reference/levels/village3/minecart_REF.gc @@ -122,19 +122,8 @@ (set! (-> self draw origin-joint-index) (the-as uint 3)) (logior! (-> self skel status) (janim-status inited)) (load-params! (-> self sync) self (the-as uint 9000) arg1 0.15 0.15) - (set! (-> self sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "v3-cartride") - :volume #x400 - :fo-max 30 - ) - (-> self root-override trans) - ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "v3-cartride" :fo-max 30) (-> self root-override trans)) ) (set! (-> self index) (res-lump-value arg0 'index int)) (let ((v1-33 (-> self index))) diff --git a/test/decompiler/reference/levels/village3/miners_REF.gc b/test/decompiler/reference/levels/village3/miners_REF.gc index fad1d3b8b3..b1fdedb9f7 100644 --- a/test/decompiler/reference/levels/village3/miners_REF.gc +++ b/test/decompiler/reference/levels/village3/miners_REF.gc @@ -55,7 +55,7 @@ ) ;; definition for method 52 of type minertall -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 minertall ((obj minertall)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -69,7 +69,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -84,14 +84,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) @@ -261,7 +261,7 @@ ) ;; definition for method 52 of type minershort -;; INFO: Return type mismatch int vs none. +;; INFO: Return type mismatch shadow-flags vs none. (defmethod dummy-52 minershort ((obj minershort)) (let ((v1-1 (-> obj draw shadow-ctrl))) (when v1-1 @@ -275,7 +275,7 @@ ) ) 0 - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) ) ) (none) @@ -290,14 +290,14 @@ (logtest? (-> obj draw status) (draw-status was-drawn)) ) (let ((v1-9 (-> obj draw shadow-ctrl))) - (set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags))) + (logclear! (-> v1-9 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day (-> obj draw shadow-ctrl)) ) (else (let ((v1-14 (-> obj draw shadow-ctrl))) - (logior! (-> v1-14 settings flags) 32) + (logior! (-> v1-14 settings flags) (shadow-flags shdf05)) ) 0 ) diff --git a/test/decompiler/reference/levels/village3/sage-village3_REF.gc b/test/decompiler/reference/levels/village3/sage-village3_REF.gc index 2d2ad412ec..f1ec84b606 100644 --- a/test/decompiler/reference/levels/village3/sage-village3_REF.gc +++ b/test/decompiler/reference/levels/village3/sage-village3_REF.gc @@ -340,17 +340,17 @@ (zero? (-> obj draw cur-lod)) (logtest? (-> obj draw status) (draw-status was-drawn)) ) - (set! (-> v1-1 settings flags) (logand -9 (-> v1-1 settings flags))) - (set! (-> v1-1 settings flags) (logand -5 (-> v1-1 settings flags))) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf03)) + (logclear! (-> v1-1 settings flags) (shadow-flags shdf02)) (set! (-> v1-1 settings bot-plane w) 20480.0) (let ((a0-8 v1-1)) - (set! (-> a0-8 settings flags) (logand -33 (-> a0-8 settings flags))) + (logclear! (-> a0-8 settings flags) (shadow-flags shdf05)) ) 0 (update-direction-from-time-of-day v1-1) ) (else - (logior! (-> v1-1 settings flags) 32) + (logior! (-> v1-1 settings flags) (shadow-flags shdf05)) 0 ) ) diff --git a/test/decompiler/reference/levels/village3/village3-obs_REF.gc b/test/decompiler/reference/levels/village3/village3-obs_REF.gc new file mode 100644 index 0000000000..6dd03dac04 --- /dev/null +++ b/test/decompiler/reference/levels/village3/village3-obs_REF.gc @@ -0,0 +1,640 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defskelgroup *med-res-ogre-sg* medres-ogre + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem -200 0 -450 350) + :longest-edge (meters 0.01) + ) + +;; failed to figure out what this is: +(defskelgroup *med-res-ogre2-sg* medres-ogre2 + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem -200 0 -950 320) + :longest-edge (meters 0.01) + ) + +;; failed to figure out what this is: +(defskelgroup *med-res-ogre3-sg* medres-ogre3 + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem -100 0 -1370 300) + :longest-edge (meters 0.01) + ) + +;; failed to figure out what this is: +(defskelgroup *med-res-finalboss-sg* medres-finalboss + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 80 120 -150 470) + :longest-edge (meters 0.01) + ) + +;; definition of type villagec-lava +(deftype villagec-lava (water-anim) + () + :heap-base #x70 + :method-count-assert 30 + :size-assert #xdc + :flag-assert #x1e007000dc + ) + +;; definition for method 3 of type villagec-lava +(defmethod inspect villagec-lava ((obj villagec-lava)) + (let ((t9-0 (method-of-type water-anim inspect))) + (t9-0 obj) + ) + obj + ) + +;; definition for symbol ripple-for-villagec-lava, type ripple-wave-set +(define ripple-for-villagec-lava (new 'static 'ripple-wave-set + :count 2 + :converted #f + :wave + (new 'static 'inline-array ripple-wave 4 + (new 'static 'ripple-wave :scale 40.0 :xdiv 2 :speed 1.5) + (new 'static 'ripple-wave :scale 40.0 :xdiv -2 :zdiv 2 :speed 0.9) + (new 'static 'ripple-wave) + (new 'static 'ripple-wave) + ) + ) + ) + +;; definition for method 22 of type villagec-lava +;; INFO: Return type mismatch symbol vs none. +(defmethod TODO-RENAME-22 villagec-lava ((obj villagec-lava)) + (let ((t9-0 (method-of-type water-anim TODO-RENAME-22))) + (t9-0 obj) + ) + (let ((v1-2 (new 'process 'ripple-control))) + (set! (-> obj draw ripple) v1-2) + (set! (-> v1-2 global-scale) 3072.0) + (set! (-> v1-2 waveform) ripple-for-villagec-lava) + ) + (logclear! (-> obj flags) (water-flags wt23)) + (set! (-> obj flags) (logior (water-flags wt25) (-> obj flags))) + (set! (-> obj attack-event) 'lava) + (none) + ) + +;; definition of type gondola +(deftype gondola (process-drawable) + ((root-override collide-shape-moving :offset 112) + (anim spool-anim :offset-assert 176) + (old-target-pos transformq :inline :offset-assert 192) + ) + :heap-base #x80 + :method-count-assert 23 + :size-assert #xf0 + :flag-assert #x17008000f0 + (:methods + (idle (symbol) _type_ :state 20) + (ride-up () _type_ :state 21) + (ride-down () _type_ :state 22) + ) + ) + +;; definition for method 3 of type gondola +(defmethod inspect gondola ((obj gondola)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tanim: ~A~%" (-> obj anim)) + (format #t "~T~Told-target-pos: #~%" (-> obj old-target-pos)) + obj + ) + +;; failed to figure out what this is: +(defskelgroup *gondola-sg* gondola + 0 + 3 + ((1 (meters 999999))) + :bounds (static-spherem 0 -5.5 0 6.5) + :longest-edge (meters 0) + :shadow 2 + ) + +;; failed to figure out what this is: +(defstate idle (gondola) + :virtual #t + :code + (behavior ((arg0 symbol)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (ja-channel-set! 1) + (cond + (arg0 + (set! (-> self anim) (new 'static 'spool-anim + :name "gondola-ride-down" + :index 6 + :parts 3 + :command-list + '((0 want-levels village3 snow) + (0 shadow target #f) + (0 shadow sidekick #f) + (1 display-level village3 display) + (175 display-level snow #f) + (300 setting-reset music village3) + (618 save) + (619 blackout 20) + (619 shadow target #t) + ) + ) + ) + (let ((v1-5 (-> self skel root-channel 0))) + (set! (-> v1-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 4))) + ) + ) + (else + (set! (-> self anim) (new 'static 'spool-anim + :name "gondola-ride-up" + :index 5 + :parts 3 + :command-list + '((0 want-levels village3 snow) + (0 shadow target #f) + (400 setting-reset music snow) + (400 display-level snow display) + (678 save) + (679 blackout 20) + (679 shadow target #t) + ) + ) + ) + (let ((v1-9 (-> self skel root-channel 0))) + (set! (-> v1-9 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + ) + ) + ) + (transform-post) + (while #t + (when (and *target* (and (< (vector-vector-distance + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3)) + (target-pos 0) + ) + 81920.0 + ) + (not (movie?)) + (not (level-hint-displayed?)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 3)) + (file-status *art-control* (-> self anim name) 0) + ) + ) + (let ((s3-0 (get-reminder (get-task-control (game-task village3-button)) 2)) + (s4-1 (and *cheat-mode* (cpad-hold? 0 l3))) + (s5-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3))) + ) + (cond + ((not (or s4-1 (task-closed? (game-task village3-button) (task-status need-hint)))) + ) + ((and (< (the int (-> *game-info* fuel)) (+ s3-0 2)) (< (the int (-> *game-info* fuel)) 71) (not s4-1)) + (level-hint-spawn + (game-text-id village3-gondola-malfunctioning) + "asstvb75" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (else + (level-hint-spawn + (game-text-id village3-gondola-reactivated) + "asstvb76" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (let ((s4-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> s4-3 from) self) + (set! (-> s4-3 num-params) 0) + (set! (-> s4-3 message) 'update) + (let ((s3-1 send-event-function) + (v1-36 (entity-actor-lookup (-> self entity) 'alt-actor 0)) + ) + (s3-1 + (if v1-36 + (-> v1-36 extra process) + ) + s4-3 + ) + ) + ) + (let ((s4-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> s4-4 from) self) + (set! (-> s4-4 num-params) 0) + (set! (-> s4-4 message) 'update) + (let ((s3-2 send-event-function) + (v1-40 (entity-actor-lookup (-> self entity) 'alt-actor 1)) + ) + (s3-2 + (if v1-40 + (-> v1-40 extra process) + ) + s4-4 + ) + ) + ) + (when (and (< (vector-vector-xz-distance s5-1 (-> *target* control trans)) 18432.0) + (and (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) + ) + ) + (and (< (+ -40960.0 (-> s5-1 y)) (-> *target* control trans y)) + (begin + (hide-hud) + (level-hint-surpress!) + (kill-current-level-hint '() '(sidekick voicebox) 'exit) + (hud-hidden?) + ) + (can-grab-display? self) + ) + ) + ) + (let ((s5-2 + (new 'stack 'font-context *font-default-matrix* 32 160 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-59 s5-2)) + (set! (-> v1-59 width) (the float 440)) + ) + (let ((v1-60 s5-2)) + (set! (-> v1-60 height) (the float 80)) + ) + (set! (-> s5-2 flags) (font-flags shadow kerning large)) + (print-game-text (lookup-text! *common-text* (game-text-id press-to-use) #f) s5-2 #f 128 22) + ) + (when (and (cpad-pressed? 0 circle) (process-grab? *target*)) + (if arg0 + (go-virtual ride-down) + (go-virtual ride-up) + ) + ) + ) + ) + ) + ) + ) + (spool-push *art-control* (-> self anim name) 0 self -99.0) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate ride-up (gondola) + :virtual #t + :code + (behavior () + (process-entity-status! self (entity-perm-status bit-3) #t) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'clone-anim) + (set! (-> a1-1 param 0) (the-as uint self)) + (when (send-event-function *target* a1-1) + (send-event (ppointer->process (-> *target* sidekick)) 'matrix 'play-anim) + (send-event *target* 'blend-shape #t) + (set-setting! *setting-control* self 'sound-flava #f 30.0 4) + (logclear! (-> self mask) (process-mask enemy)) + (let ((gp-0 (get-process *default-dead-pool* othercam #x4000))) + (when gp-0 + (let ((t9-6 (method-of-type othercam activate))) + (t9-6 (the-as othercam gp-0) self 'othercam (the-as pointer #x70004000)) + ) + (run-now-in-process gp-0 othercam-init-by-other self 4 #f #t) + (-> gp-0 ppointer) + ) + ) + (ja-play-spooled-anim + (-> self anim) + (the-as art-joint-anim (-> self draw art-group data 3)) + (the-as art-joint-anim (-> self draw art-group data 4)) + (the-as (function process-drawable symbol) false-func) + ) + (clear-pending-settings-from-process *setting-control* self 'sound-flava) + (send-event *target* 'blend-shape #f) + (when *target* + (vector<-cspace! (the-as vector (-> self old-target-pos)) (-> *target* node-list data 3)) + (send-event *target* 'trans 'restore (-> self old-target-pos)) + (send-event *target* 'end-mode) + (update-transforms! (-> self root-override)) + (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) + (suspend) + (send-event *camera* 'teleport-to-other-start-string) + ) + (load-state-want-vis 'sno) + (set-continue! *game-info* "snow-start") + ) + ) + (process-entity-status! self (entity-perm-status bit-3) #f) + (go-virtual idle #t) + (none) + ) + :post + (behavior () + (ja-post) + (update-direction-from-time-of-day (-> self draw shadow-ctrl)) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate ride-down (gondola) + :virtual #t + :code + (behavior () + (process-entity-status! self (entity-perm-status bit-3) #t) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'clone-anim) + (set! (-> a1-1 param 0) (the-as uint self)) + (when (send-event-function *target* a1-1) + (send-event *target* 'trans 'save (-> self old-target-pos)) + (send-event (ppointer->process (-> *target* sidekick)) 'matrix 'play-anim) + (send-event *target* 'blend-shape #t) + (set-setting! *setting-control* self 'sound-flava #f 30.0 4) + (logclear! (-> self mask) (process-mask enemy)) + (let ((gp-0 (get-process *default-dead-pool* othercam #x4000))) + (when gp-0 + (let ((t9-7 (method-of-type othercam activate))) + (t9-7 (the-as othercam gp-0) self 'othercam (the-as pointer #x70004000)) + ) + (run-now-in-process gp-0 othercam-init-by-other self 4 #f #t) + (-> gp-0 ppointer) + ) + ) + (ja-play-spooled-anim + (-> self anim) + (the-as art-joint-anim (-> self draw art-group data 4)) + (the-as art-joint-anim (-> self draw art-group data 3)) + (the-as (function process-drawable symbol) false-func) + ) + (clear-pending-settings-from-process *setting-control* self 'sound-flava) + (send-event *target* 'blend-shape #f) + (when *target* + (vector<-cspace! (the-as vector (-> self old-target-pos)) (-> *target* node-list data 3)) + (send-event *target* 'trans 'restore (-> self old-target-pos)) + (send-event *target* 'end-mode) + (update-transforms! (-> self root-override)) + (move-to-ground (-> *target* control) 4096.0 40960.0 #t (-> *target* control root-prim collide-with)) + (logior! (-> *target* control status) (cshape-moving-flags onsurf onground tsurf)) + (suspend) + (send-event *camera* 'teleport-to-other-start-string) + ) + (load-state-want-vis 'vi3) + (set-continue! *game-info* "village3-farside") + ) + ) + (process-entity-status! self (entity-perm-status bit-3) #f) + (go-virtual idle #f) + (none) + ) + :post + (-> (method-of-type gondola ride-up) post) + ) + +;; definition for method 11 of type gondola +;; INFO: Return type mismatch object vs none. +(defmethod init-from-entity! gondola ((obj gondola) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 512) + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) default-collision-reaction) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing) + ) + (alloc-riders s4-0 1) + (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-kind ground-object)) + (set! (-> s3-0 collide-with) (collide-kind target)) + (set! (-> s3-0 prim-core action) (collide-action solid ca-1)) + (set! (-> s3-0 prim-core offense) (collide-offense indestructible)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 -24576.0 0.0 26624.0) + (set-root-prim! s4-0 s3-0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (backup-collide-with-as s4-0) + (set! (-> obj root-override) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (quaternion-identity! (-> obj root-override quat)) + (initialize-skeleton obj *gondola-sg* '()) + (set! (-> obj draw origin-joint-index) (the-as uint 3)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj draw shadow-joint-index) (the-as uint 3)) + (set! (-> obj draw shadow-ctrl) (copy *target-shadow-control* 'process)) + (let ((a0-16 (-> obj draw shadow-ctrl))) + (when a0-16 + (let ((v1-32 a0-16)) + (set! (-> v1-32 settings bot-plane w) (- -122880.0)) + ) + 0 + (let ((v1-34 a0-16)) + (set! (-> v1-34 settings top-plane w) (- 4096.0)) + ) + 0 + (update-direction-from-time-of-day a0-16) + ) + ) + (cond + ((< (-> (target-pos 0) y) (+ 204800.0 (-> obj root-override trans y))) + (go (method-of-object obj idle) #f) + ) + (else + (set! (-> obj anim) (new 'static 'spool-anim :name "gondola-ride-down" :index 6 :parts 3 :command-list '())) + (go (method-of-object obj idle) #t) + ) + ) + (none) + ) + +;; definition of type pistons +(deftype pistons (process-drawable) + () + :heap-base #x40 + :method-count-assert 22 + :size-assert #xb0 + :flag-assert #x16004000b0 + (:methods + (idle () _type_ :state 20) + (active (basic symbol) _type_ :state 21) + ) + ) + +;; definition for method 3 of type pistons +(defmethod inspect pistons ((obj pistons)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + obj + ) + +;; failed to figure out what this is: +(defskelgroup *pistons-sg* pistons + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 6 0 8) + :longest-edge (meters 0) + ) + +;; failed to figure out what this is: +(defstate idle (pistons) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('update) + (go-virtual active (the-as basic (process->handle arg0)) #f) + ) + ) + ) + :code + (behavior () + (ja-post) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defstate active (pistons) + :virtual #t + ) + +;; definition for method 11 of type pistons +;; INFO: Return type mismatch object vs none. +(defmethod init-from-entity! pistons ((obj pistons) (arg0 entity-actor)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj *pistons-sg* '()) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "gdl-gen-loop" :fo-max 100) (-> obj root trans)) + ) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) + (go (method-of-object obj active) #f #t) + (go (method-of-object obj idle)) + ) + (none) + ) + +;; definition of type gondolacables +(deftype gondolacables (process-drawable) + () + :heap-base #x40 + :method-count-assert 21 + :size-assert #xb0 + :flag-assert #x15004000b0 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type gondolacables +(defmethod inspect gondolacables ((obj gondolacables)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + obj + ) + +;; failed to figure out what this is: +(defskelgroup *gondolacables-sg* gondolacables + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 120) + :longest-edge (meters 0) + ) + +;; failed to figure out what this is: +(defstate idle (gondolacables) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (when (= v1-0 'update) + (process-entity-status! self (entity-perm-status complete) #t) + (let ((v0-0 1)) + (set! (-> self draw mgeo effect 0 effect-bits) (the-as uint v0-0)) + v0-0 + ) + ) + ) + ) + ) + :code + (behavior () + (while #t + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 frame-group) (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + (set! (-> a0-0 param 0) (the float (+ (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-0 param 1) 1.0) + (set! (-> a0-0 frame-num) 0.0) + (joint-control-channel-group! + a0-0 + (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 param 0) (the float (+ (-> a0-1 frame-group data 0 length) -1))) + (set! (-> a0-1 param 1) 1.0) + (joint-control-channel-group-eval! a0-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior gondolacables) ja-post) + ) + +;; definition for method 11 of type gondolacables +;; INFO: Return type mismatch object vs none. +(defmethod init-from-entity! gondolacables ((obj gondolacables) (arg0 entity-actor)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj *gondolacables-sg* '()) + (set! (-> obj draw mgeo effect 0 effect-bits) + (the-as + uint + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) + 1 + 0 + ) + ) + ) + (go (method-of-object obj idle)) + (none) + ) diff --git a/test/decompiler/reference/levels/village3/village3-part_REF.gc b/test/decompiler/reference/levels/village3/village3-part_REF.gc index 54a397ae66..041b65c90d 100644 --- a/test/decompiler/reference/levels/village3/village3-part_REF.gc +++ b/test/decompiler/reference/levels/village3/village3-part_REF.gc @@ -657,14 +657,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x4 :page #x2)) (sp-flt spt-num 1.0) - (sp-sound (new 'static 'sound-spec - :mask #x1 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "fire-pop") - :volume #x400 - ) - ) + (sp-sound (static-sound-spec "fire-pop" :volume 100.0)) (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) (sp-rnd-flt spt-y (meters 0.5) (meters 0.5) 1.0) (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) @@ -1411,9 +1404,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1441,9 +1432,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1471,9 +1460,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1501,9 +1488,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1531,9 +1516,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -1626,9 +1609,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.5) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-y (meters 0.7)) (sp-flt spt-scale-x (meters 0.4)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) @@ -2207,9 +2188,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-flt spt-num 1.0) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-scale-x (meters 0.3)) (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) (sp-copy-from-other spt-scale-y -4) @@ -2250,9 +2229,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2)) (sp-rnd-flt spt-num 4.0 4.0 1.0) - (sp-sound - (new 'static 'sound-spec :num 0.02 :group #x1 :sound-name (static-sound-name "steam-short") :volume #x400) - ) + (sp-sound (static-sound-spec "steam-short" :num 0.02)) (sp-flt spt-x (meters 1.5)) (sp-flt spt-y (meters 0.6)) (sp-flt spt-scale-x (meters 1)) diff --git a/test/decompiler/reference/levels/village_common/oracle_REF.gc b/test/decompiler/reference/levels/village_common/oracle_REF.gc index 65571a4816..3cefe511c4 100644 --- a/test/decompiler/reference/levels/village_common/oracle_REF.gc +++ b/test/decompiler/reference/levels/village_common/oracle_REF.gc @@ -254,19 +254,8 @@ ;; definition for method 11 of type oracle (defmethod init-from-entity! oracle ((obj oracle) (arg0 entity-actor)) (dummy-40 obj arg0 *oracle-sg* 3 4 (new 'static 'vector :y -4096.0 :w 4096.0) -1) - (set! (-> obj sound) (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #x80 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "oracle-sleep") - :volume #x400 - :fo-max 50 - ) - (-> obj root-override trans) - ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "oracle-sleep" :fo-max 50) (-> obj root-override trans)) ) (set! (-> obj first-task) (the-as uint (-> arg0 extra perm task))) (set! (-> obj second-task) (res-lump-value arg0 'alt-task uint)) diff --git a/test/decompiler/reference/levels/village_common/villagep-obs_REF.gc b/test/decompiler/reference/levels/village_common/villagep-obs_REF.gc index fd7718b022..9b83284d9a 100644 --- a/test/decompiler/reference/levels/village_common/villagep-obs_REF.gc +++ b/test/decompiler/reference/levels/village_common/villagep-obs_REF.gc @@ -58,7 +58,7 @@ (- (-> self control unknown-vector103 z) (-> self control unknown-vector102 z)) ) (vector-xz-normalize! (-> self control transv) 49152.0) - (if (logtest? (-> self control status) 1) + (if (logtest? (-> self control status) (cshape-moving-flags onsurf)) (go target-hit-ground #f) ) (none) @@ -161,9 +161,8 @@ (and (>= (-> self level-slot) 0) (not (movie?)) (not (level-hint-displayed?)) - (zero? - (logand (-> *target* control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) - ) + (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-7 ca-8 ca-9 ca-12 ca-13 ca-14)) + ) (let* ((v1-16 (-> self root)) (a1-2 (-> *target* control trans)) (f0-1 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) a1-2 (-> v1-16 trans)))) @@ -1070,8 +1069,8 @@ ) ) (while (and *target* - (logtest? (-> *target* control unknown-surface00 flags) 2048) - (zero? (logand (-> *target* control status) 1)) + (logtest? (-> *target* control unknown-surface00 flags) (surface-flags surf11)) + (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf))) ) (suspend) ) @@ -1083,7 +1082,7 @@ (-> *setting-control* current hint) (-> *setting-control* current ambient) (not *target*) - (logtest? (-> *target* state-flags) #x8008) + (logtest? (-> *target* state-flags) (state-flags sf03 sf15)) ) ) ) @@ -1101,7 +1100,7 @@ (-> *setting-control* current hint) (!= (-> *level* loading-level) (-> *level* level-default)) (not *target*) - (logtest? (-> *target* state-flags) #x8008) + (logtest? (-> *target* state-flags) (state-flags sf03 sf15)) *progress-process* ) (suspend) diff --git a/test/offline/config.jsonc b/test/offline/config.jsonc index 2d32db673c..9a7e52b45c 100644 --- a/test/offline/config.jsonc +++ b/test/offline/config.jsonc @@ -228,11 +228,26 @@ "tie-near-end-buffer", "(method 19 process-drawable)", - + "curve-evaluate!", "generic-reset-buffers", - "generic-merc-execute-all" + "generic-merc-execute-all", + + /// COLLIDE-EDGE-GRAB + "(method 9 edge-grab-info)", // asm + + /// COLLIDE-SHAPE-RIDER + // type mess + "(method 22 collide-shape-prim-mesh)", + + /// COLLIDE-REACTION-TARGET + "poly-find-nearest-edge", + + /// GLIST + // i dont even want to know + "glst-find-node-by-name", + "glst-length-of-longest-name" ], "skip_compile_states": { @@ -244,9 +259,9 @@ ], "ogreboss-missile-seek": [ "code" // inserts a bad cfg-1 goto + ], + "(active pistons)": [ + "code" // dead code not analyzed properly after a loop ] - // "active": [ // in village3-obs - // "code" // dead-code not analyzed properly after a suspend - // ] } }