From 3d252fe52785e68416f7bfb4c7c0d9324b06f75d Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Feb 2016 05:13:52 +0600 Subject: [PATCH] Refactoring and cleanup. Fixed some critical bugs and typos (carrer_task, tutor, zbot and other) Added command line option `-bots` to run bots in CS 1.6 Removed the tests demo record/player from myself the project and also dependency of the steam library. Fixed the progress bar when generating a nav file. --- dep/cppunitlite/build.gradle | 50 +- regamedll/build.gradle | 66 +- regamedll/common/com_model.h | 456 +-- regamedll/common/const.h | 170 +- regamedll/common/mathlib.h | 22 +- regamedll/dlls/airtank.cpp | 10 +- regamedll/dlls/airtank.h | 4 +- regamedll/dlls/ammo.cpp | 40 - regamedll/dlls/ammo.h | 31 +- regamedll/dlls/animating.cpp | 31 +- regamedll/dlls/animation.cpp | 98 +- regamedll/dlls/animation.h | 31 +- regamedll/dlls/basemonster.h | 41 +- regamedll/dlls/bmodels.cpp | 73 +- regamedll/dlls/bmodels.h | 30 +- regamedll/dlls/bot/cs_bot.cpp | 143 +- regamedll/dlls/bot/cs_bot.h | 223 +- regamedll/dlls/bot/cs_bot_chatter.cpp | 205 +- regamedll/dlls/bot/cs_bot_chatter.h | 91 +- regamedll/dlls/bot/cs_bot_event.cpp | 11 +- regamedll/dlls/bot/cs_bot_init.cpp | 28 +- regamedll/dlls/bot/cs_bot_learn.cpp | 155 +- regamedll/dlls/bot/cs_bot_listen.cpp | 10 +- regamedll/dlls/bot/cs_bot_manager.cpp | 233 +- regamedll/dlls/bot/cs_bot_manager.h | 88 +- regamedll/dlls/bot/cs_bot_nav.cpp | 25 +- regamedll/dlls/bot/cs_bot_pathfind.cpp | 45 +- regamedll/dlls/bot/cs_bot_radio.cpp | 22 +- regamedll/dlls/bot/cs_bot_statemachine.cpp | 53 +- regamedll/dlls/bot/cs_bot_update.cpp | 139 +- regamedll/dlls/bot/cs_bot_vision.cpp | 48 +- regamedll/dlls/bot/cs_bot_weapon.cpp | 91 +- regamedll/dlls/bot/cs_gamestate.cpp | 56 +- regamedll/dlls/bot/cs_gamestate.h | 24 +- regamedll/dlls/bot/states/cs_bot_attack.cpp | 7 - regamedll/dlls/bot/states/cs_bot_buy.cpp | 76 +- .../dlls/bot/states/cs_bot_defuse_bomb.cpp | 12 +- .../bot/states/cs_bot_escape_from_bomb.cpp | 4 - .../dlls/bot/states/cs_bot_fetch_bomb.cpp | 4 - regamedll/dlls/bot/states/cs_bot_follow.cpp | 7 - regamedll/dlls/bot/states/cs_bot_hide.cpp | 43 +- regamedll/dlls/bot/states/cs_bot_hunt.cpp | 22 +- regamedll/dlls/bot/states/cs_bot_idle.cpp | 75 +- .../bot/states/cs_bot_investigate_noise.cpp | 6 - regamedll/dlls/bot/states/cs_bot_move_to.cpp | 18 +- .../dlls/bot/states/cs_bot_plant_bomb.cpp | 5 - .../dlls/bot/states/cs_bot_use_entity.cpp | 4 - regamedll/dlls/buttons.cpp | 197 +- regamedll/dlls/buttons.h | 19 +- regamedll/dlls/career_tasks.cpp | 96 +- regamedll/dlls/career_tasks.h | 17 +- regamedll/dlls/cbase.cpp | 61 +- regamedll/dlls/cbase.h | 86 +- regamedll/dlls/client.cpp | 381 +- regamedll/dlls/client.h | 11 +- regamedll/dlls/combat.cpp | 96 +- regamedll/dlls/debug.cpp | 14 +- regamedll/dlls/debug.h | 10 +- regamedll/dlls/doors.cpp | 85 +- regamedll/dlls/doors.h | 9 +- regamedll/dlls/effects.cpp | 201 +- regamedll/dlls/effects.h | 135 +- regamedll/dlls/enginecallback.h | 4 +- regamedll/dlls/explode.cpp | 31 +- regamedll/dlls/explode.h | 6 +- regamedll/dlls/func_break.cpp | 69 +- regamedll/dlls/func_break.h | 12 +- regamedll/dlls/func_tank.cpp | 89 +- regamedll/dlls/func_tank.h | 18 +- regamedll/dlls/game.cpp | 5 +- regamedll/dlls/game.h | 2 +- regamedll/dlls/gamerules.cpp | 23 +- regamedll/dlls/gamerules.h | 28 +- regamedll/dlls/ggrenade.cpp | 126 +- regamedll/dlls/globals.cpp | 8 +- regamedll/dlls/globals.h | 6 +- regamedll/dlls/h_ai.cpp | 23 +- regamedll/dlls/h_ai.h | 6 +- regamedll/dlls/h_battery.cpp | 13 +- regamedll/dlls/h_battery.h | 2 +- regamedll/dlls/h_cycler.cpp | 62 +- regamedll/dlls/h_cycler.h | 21 +- regamedll/dlls/h_export.cpp | 5 - regamedll/dlls/healthkit.cpp | 17 +- regamedll/dlls/healthkit.h | 6 +- regamedll/dlls/hintmessage.cpp | 8 +- regamedll/dlls/hostage/hostage.cpp | 174 +- regamedll/dlls/hostage/hostage.h | 29 +- regamedll/dlls/hostage/hostage_improv.cpp | 154 +- regamedll/dlls/hostage/hostage_improv.h | 66 +- regamedll/dlls/hostage/hostage_localnav.cpp | 84 +- regamedll/dlls/hostage/hostage_localnav.h | 16 +- regamedll/dlls/hostage/hostage_states.h | 27 +- .../dlls/hostage/states/hostage_animate.cpp | 19 +- .../dlls/hostage/states/hostage_escape.cpp | 15 +- .../dlls/hostage/states/hostage_follow.cpp | 8 +- .../dlls/hostage/states/hostage_idle.cpp | 5 - .../dlls/hostage/states/hostage_retreat.cpp | 3 - regamedll/dlls/items.cpp | 41 +- regamedll/dlls/items.h | 32 +- regamedll/dlls/lights.cpp | 27 +- regamedll/dlls/lights.h | 6 +- regamedll/dlls/maprules.cpp | 49 +- regamedll/dlls/maprules.h | 85 +- regamedll/dlls/monsters.h | 4 +- regamedll/dlls/mortar.cpp | 17 +- regamedll/dlls/mortar.h | 7 +- regamedll/dlls/mpstubb.cpp | 24 +- regamedll/dlls/multiplay_gamerules.cpp | 282 +- regamedll/dlls/observer.cpp | 21 +- regamedll/dlls/pathcorner.cpp | 35 +- regamedll/dlls/pathcorner.h | 3 +- regamedll/dlls/plane.cpp | 3 - regamedll/dlls/plane.h | 5 +- regamedll/dlls/plats.cpp | 210 +- regamedll/dlls/plats.h | 30 +- regamedll/dlls/player.cpp | 834 ++--- regamedll/dlls/player.h | 89 +- regamedll/dlls/revert_saved.h | 19 +- regamedll/dlls/saverestore.h | 8 +- regamedll/dlls/singleplay_gamerules.cpp | 40 - regamedll/dlls/skill.cpp | 2 - regamedll/dlls/skill.h | 2 +- regamedll/dlls/sound.cpp | 122 +- regamedll/dlls/sound.h | 16 +- regamedll/dlls/soundent.cpp | 34 +- regamedll/dlls/soundent.h | 14 +- regamedll/dlls/spectator.cpp | 2 - regamedll/dlls/spectator.h | 2 +- regamedll/dlls/subs.cpp | 72 +- regamedll/dlls/subs.h | 8 +- regamedll/dlls/training_gamerules.cpp | 37 +- regamedll/dlls/training_gamerules.h | 9 +- regamedll/dlls/trains.h | 9 +- regamedll/dlls/triggers.cpp | 252 +- regamedll/dlls/triggers.h | 117 +- regamedll/dlls/tutor.cpp | 7 +- regamedll/dlls/tutor_base_states.cpp | 6 - regamedll/dlls/tutor_base_tutor.cpp | 63 +- regamedll/dlls/tutor_base_tutor.h | 4 +- regamedll/dlls/tutor_cs_states.cpp | 52 +- regamedll/dlls/tutor_cs_states.h | 12 +- regamedll/dlls/tutor_cs_tutor.cpp | 791 ++-- regamedll/dlls/tutor_cs_tutor.h | 12 +- regamedll/dlls/unisignals.h | 7 +- regamedll/dlls/util.cpp | 227 +- regamedll/dlls/util.h | 77 +- regamedll/dlls/vector.h | 87 +- regamedll/dlls/vehicle.cpp | 96 +- regamedll/dlls/vehicle.h | 3 +- regamedll/dlls/weapons.cpp | 205 +- regamedll/dlls/weapons.h | 281 +- regamedll/dlls/weapontype.cpp | 13 - regamedll/dlls/world.cpp | 68 +- regamedll/dlls/wpn_shared/wpn_ak47.cpp | 16 +- regamedll/dlls/wpn_shared/wpn_aug.cpp | 14 +- regamedll/dlls/wpn_shared/wpn_awp.cpp | 15 +- regamedll/dlls/wpn_shared/wpn_c4.cpp | 36 +- regamedll/dlls/wpn_shared/wpn_deagle.cpp | 14 +- regamedll/dlls/wpn_shared/wpn_elite.cpp | 17 +- regamedll/dlls/wpn_shared/wpn_famas.cpp | 15 +- regamedll/dlls/wpn_shared/wpn_fiveseven.cpp | 14 +- regamedll/dlls/wpn_shared/wpn_flashbang.cpp | 15 +- regamedll/dlls/wpn_shared/wpn_g3sg1.cpp | 17 +- regamedll/dlls/wpn_shared/wpn_galil.cpp | 16 +- regamedll/dlls/wpn_shared/wpn_glock18.cpp | 14 +- regamedll/dlls/wpn_shared/wpn_hegrenade.cpp | 13 - regamedll/dlls/wpn_shared/wpn_knife.cpp | 34 +- regamedll/dlls/wpn_shared/wpn_m249.cpp | 15 +- regamedll/dlls/wpn_shared/wpn_m3.cpp | 17 +- regamedll/dlls/wpn_shared/wpn_m4a1.cpp | 20 +- regamedll/dlls/wpn_shared/wpn_mac10.cpp | 13 +- regamedll/dlls/wpn_shared/wpn_mp5navy.cpp | 13 +- regamedll/dlls/wpn_shared/wpn_p228.cpp | 14 +- regamedll/dlls/wpn_shared/wpn_p90.cpp | 14 +- regamedll/dlls/wpn_shared/wpn_scout.cpp | 19 +- regamedll/dlls/wpn_shared/wpn_sg550.cpp | 17 +- regamedll/dlls/wpn_shared/wpn_sg552.cpp | 15 +- .../dlls/wpn_shared/wpn_smokegrenade.cpp | 13 - regamedll/dlls/wpn_shared/wpn_tmp.cpp | 15 +- regamedll/dlls/wpn_shared/wpn_ump45.cpp | 15 +- regamedll/dlls/wpn_shared/wpn_usp.cpp | 5 +- regamedll/dlls/wpn_shared/wpn_xm1014.cpp | 19 +- regamedll/engine/common.h | 25 + regamedll/engine/unicode_strtools.cpp | 42 +- regamedll/engine/unicode_strtools.h | 12 +- regamedll/game_shared/bitvec.h | 12 - regamedll/game_shared/bot/bot.cpp | 82 +- regamedll/game_shared/bot/bot.h | 42 +- regamedll/game_shared/bot/bot_manager.cpp | 40 +- regamedll/game_shared/bot/bot_manager.h | 10 +- regamedll/game_shared/bot/bot_profile.cpp | 51 +- regamedll/game_shared/bot/bot_profile.h | 6 +- regamedll/game_shared/bot/bot_util.cpp | 46 +- regamedll/game_shared/bot/bot_util.h | 48 +- regamedll/game_shared/bot/improv.h | 2 - regamedll/game_shared/bot/nav.h | 34 +- regamedll/game_shared/bot/nav_area.cpp | 405 +- regamedll/game_shared/bot/nav_area.h | 76 +- regamedll/game_shared/bot/nav_file.cpp | 63 +- regamedll/game_shared/bot/nav_file.h | 5 +- regamedll/game_shared/bot/nav_node.cpp | 13 +- regamedll/game_shared/bot/nav_node.h | 9 +- regamedll/game_shared/bot/nav_path.cpp | 52 +- regamedll/game_shared/bot/nav_path.h | 9 +- .../game_shared/bot/simple_state_machine.h | 6 +- regamedll/game_shared/perf_counter.h | 7 +- regamedll/game_shared/shared_util.cpp | 23 +- regamedll/game_shared/shared_util.h | 15 +- regamedll/game_shared/simple_checksum.h | 3 +- regamedll/game_shared/steam_util.h | 3 - regamedll/game_shared/voice_gamemgr.cpp | 19 +- regamedll/game_shared/voice_gamemgr.h | 29 +- regamedll/hookers/6153_hooker.cpp | 204 +- regamedll/hookers/RegameDLLRuntimeConfig.cpp | 101 + regamedll/hookers/RegameDLLRuntimeConfig.h | 16 + regamedll/hookers/hooker.cpp | 72 +- regamedll/hookers/hooker.h | 13 +- regamedll/hookers/hooker_impl.cpp | 9 +- regamedll/hookers/hooker_impl.h | 340 +- regamedll/hookers/main.cpp | 20 +- regamedll/hookers/main_mp.cpp | 11 - regamedll/hookers/memory.cpp | 35 +- regamedll/hookers/memory.h | 2 +- regamedll/hookers/osconfig.h | 13 - regamedll/hookers/regamedll_debug.cpp | 105 - regamedll/hookers/regamedll_debug.h | 23 - regamedll/lib/linux32/libsteam_api.so | Bin 76032 -> 0 bytes regamedll/lib/steam_api.dll | Bin 103920 -> 0 bytes regamedll/lib/steam_api.lib | Bin 15118 -> 0 bytes regamedll/msvc/ReGameDLL.vcxproj | 86 +- regamedll/msvc/ReGameDLL.vcxproj.filters | 81 +- regamedll/pm_shared/pm_debug.cpp | 11 +- regamedll/pm_shared/pm_defs.h | 18 +- regamedll/pm_shared/pm_math.cpp | 123 +- regamedll/pm_shared/pm_math.h | 2 +- regamedll/pm_shared/pm_shared.cpp | 141 +- regamedll/pm_shared/pm_shared.h | 60 +- regamedll/public/MemPool.cpp | 5 - regamedll/public/engine_launcher_api.h | 47 - regamedll/public/idedicatedexports.h | 24 - regamedll/public/keydefs.h | 124 - regamedll/public/particleman.h | 101 - regamedll/public/pman_particlemem.h | 197 - regamedll/public/pman_triangleffect.h | 209 -- regamedll/public/steam/isteamapps.h | 127 - regamedll/public/steam/isteambilling.h | 108 - regamedll/public/steam/isteamclient.h | 349 -- regamedll/public/steam/isteamcontroller.h | 62 - regamedll/public/steam/isteamfriends.h | 606 --- regamedll/public/steam/isteamgameserver.h | 391 -- .../public/steam/isteamgameserverstats.h | 99 - regamedll/public/steam/isteamhttp.h | 176 - regamedll/public/steam/isteammatchmaking.h | 731 ---- regamedll/public/steam/isteamnetworking.h | 306 -- regamedll/public/steam/isteamremotestorage.h | 610 --- regamedll/public/steam/isteamscreenshots.h | 96 - .../public/steam/isteamunifiedmessages.h | 63 - regamedll/public/steam/isteamuser.h | 339 -- regamedll/public/steam/isteamuserstats.h | 463 --- regamedll/public/steam/isteamutils.h | 304 -- regamedll/public/steam/matchmakingtypes.h | 249 -- regamedll/public/steam/steam_api.h | 536 --- regamedll/public/steam/steam_gameserver.h | 163 - regamedll/public/steam/steamclientpublic.h | 1086 ------ regamedll/public/steam/steamhttpenums.h | 94 - regamedll/public/steam/steamtypes.h | 136 - regamedll/public/utlbuffer.h | 341 -- regamedll/public/utlrbtree.h | 1295 ------- regamedll/public/utlsymbol.cpp | 15 +- regamedll/public/utlsymbol.h | 2 - .../regamedll/RegameDLLRuntimeConfig.cpp | 189 - regamedll/regamedll/RegameDLLRuntimeConfig.h | 27 - regamedll/regamedll/dlls.h | 7 +- regamedll/{hookers => regamedll}/engine.h | 62 +- regamedll/regamedll/hookchains_impl.h | 2 +- regamedll/regamedll/mem.cpp | 51 - regamedll/regamedll/mem.h | 19 - regamedll/regamedll/platform.cpp | 232 -- regamedll/regamedll/platform.h | 123 +- regamedll/regamedll/precompiled.h | 17 +- regamedll/regamedll/regamedll.cpp | 9 + regamedll/regamedll/regamedll.h | 3 + regamedll/regamedll/regamedll_debug.cpp | 57 + regamedll/regamedll/regamedll_debug.h | 7 + regamedll/testsuite/demoplayer.cpp | 1100 ------ regamedll/testsuite/demoplayer.h | 209 -- regamedll/testsuite/funccalls.cpp | 3288 ----------------- regamedll/testsuite/funccalls.h | 1272 ------- regamedll/testsuite/recorder.cpp | 996 ----- regamedll/testsuite/recorder.h | 201 - regamedll/testsuite/testsuite.cpp | 514 --- regamedll/testsuite/testsuite.h | 18 - regamedll/unittests/animation_tests.cpp | 2 + regamedll/unittests/struct_offsets_tests.cpp | 4 +- settings.gradle | 1 - shared.gradle | 41 +- 297 files changed, 4374 insertions(+), 26994 deletions(-) create mode 100644 regamedll/hookers/RegameDLLRuntimeConfig.cpp create mode 100644 regamedll/hookers/RegameDLLRuntimeConfig.h delete mode 100644 regamedll/hookers/regamedll_debug.cpp delete mode 100644 regamedll/hookers/regamedll_debug.h delete mode 100644 regamedll/lib/linux32/libsteam_api.so delete mode 100644 regamedll/lib/steam_api.dll delete mode 100644 regamedll/lib/steam_api.lib delete mode 100644 regamedll/public/engine_launcher_api.h delete mode 100644 regamedll/public/idedicatedexports.h delete mode 100644 regamedll/public/keydefs.h delete mode 100644 regamedll/public/particleman.h delete mode 100644 regamedll/public/pman_particlemem.h delete mode 100644 regamedll/public/pman_triangleffect.h delete mode 100644 regamedll/public/steam/isteamapps.h delete mode 100644 regamedll/public/steam/isteambilling.h delete mode 100644 regamedll/public/steam/isteamclient.h delete mode 100644 regamedll/public/steam/isteamcontroller.h delete mode 100644 regamedll/public/steam/isteamfriends.h delete mode 100644 regamedll/public/steam/isteamgameserver.h delete mode 100644 regamedll/public/steam/isteamgameserverstats.h delete mode 100644 regamedll/public/steam/isteamhttp.h delete mode 100644 regamedll/public/steam/isteammatchmaking.h delete mode 100644 regamedll/public/steam/isteamnetworking.h delete mode 100644 regamedll/public/steam/isteamremotestorage.h delete mode 100644 regamedll/public/steam/isteamscreenshots.h delete mode 100644 regamedll/public/steam/isteamunifiedmessages.h delete mode 100644 regamedll/public/steam/isteamuser.h delete mode 100644 regamedll/public/steam/isteamuserstats.h delete mode 100644 regamedll/public/steam/isteamutils.h delete mode 100644 regamedll/public/steam/matchmakingtypes.h delete mode 100644 regamedll/public/steam/steam_api.h delete mode 100644 regamedll/public/steam/steam_gameserver.h delete mode 100644 regamedll/public/steam/steamclientpublic.h delete mode 100644 regamedll/public/steam/steamhttpenums.h delete mode 100644 regamedll/public/steam/steamtypes.h delete mode 100644 regamedll/public/utlbuffer.h delete mode 100644 regamedll/public/utlrbtree.h delete mode 100644 regamedll/regamedll/RegameDLLRuntimeConfig.cpp delete mode 100644 regamedll/regamedll/RegameDLLRuntimeConfig.h rename regamedll/{hookers => regamedll}/engine.h (97%) delete mode 100644 regamedll/regamedll/mem.cpp delete mode 100644 regamedll/regamedll/mem.h create mode 100644 regamedll/regamedll/regamedll.cpp create mode 100644 regamedll/regamedll/regamedll.h create mode 100644 regamedll/regamedll/regamedll_debug.cpp create mode 100644 regamedll/regamedll/regamedll_debug.h delete mode 100644 regamedll/testsuite/demoplayer.cpp delete mode 100644 regamedll/testsuite/demoplayer.h delete mode 100644 regamedll/testsuite/funccalls.cpp delete mode 100644 regamedll/testsuite/funccalls.h delete mode 100644 regamedll/testsuite/recorder.cpp delete mode 100644 regamedll/testsuite/recorder.h delete mode 100644 regamedll/testsuite/testsuite.cpp delete mode 100644 regamedll/testsuite/testsuite.h diff --git a/dep/cppunitlite/build.gradle b/dep/cppunitlite/build.gradle index 6fc45239..496d1603 100644 --- a/dep/cppunitlite/build.gradle +++ b/dep/cppunitlite/build.gradle @@ -9,52 +9,50 @@ apply plugin: 'cpp' apply plugin: IccCompilerPlugin void setupToolchain(NativeBinarySpec b) { - def cfg = rootProject.createToolchainConfig(b) + def cfg = rootProject.createToolchainConfig(b) - ToolchainConfigUtils.apply(project, cfg, b) + ToolchainConfigUtils.apply(project, cfg, b) } model { - buildTypes { - debug - release - } + buildTypes { + debug + release + } - platforms { - x86 { - architecture "x86" - } - } + platforms { + x86 { + architecture "x86" + } + } - toolChains { - visualCpp(VisualCpp) { - } - icc(Icc) { - } - } + toolChains { + visualCpp(VisualCpp) { + } + icc(Icc) { + } + } - components { + components { cppunitlite(NativeLibrarySpec) { targetPlatform 'x86' - + sources { cppul_main(CppSourceSet) { source { srcDir "src" include "**/*.cpp" } - + exportedHeaders { srcDir "include" - } + } } } - - binaries.all { NativeBinarySpec b -> - project.setupToolchain(b) - } + binaries.all { NativeBinarySpec b -> + project.setupToolchain(b) + } } } } - diff --git a/regamedll/build.gradle b/regamedll/build.gradle index a25fd924..91bf9673 100644 --- a/regamedll/build.gradle +++ b/regamedll/build.gradle @@ -55,12 +55,8 @@ void createIntergrationTestTask(NativeBinarySpec b) { if (!GradleCppUtils.windows) return if (regamedllFixes) return - def libLinkTask = GradleCppUtils.getLinkTask(b) String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null - def depFiles = [] - depFiles.addAll(libLinkTask.outputs.files.files) - def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RegamedllPlayTestTask) demoItgTestTask.with { regamedllImageRoot = new File(project.projectDir, '_regamedllTestImg') @@ -69,12 +65,10 @@ void createIntergrationTestTask(NativeBinarySpec b) { testFor = b //inputs/outputs for up-to-date check - inputs.files depFiles inputs.files testDemos.files outputs.dir regamedllTestLogs - //dependencies on library and test executable - dependsOn libLinkTask + //dependencies on test executable if (unitTestTask) { dependsOn unitTestTask } @@ -88,17 +82,6 @@ void createIntergrationTestTask(NativeBinarySpec b) { b.buildTask.dependsOn demoItgTestTask } -void setupUnitTests(NativeBinarySpec bin) { - boolean unitTestExecutable = bin.component.name.endsWith('_tests') - if (!unitTestExecutable) return - - GradleCppUtils.getLinkTask(bin).doLast { - String srcPath = '' + projectDir + (GradleCppUtils.windows ? '/lib/steam_api.dll' : '/lib/linux32/libsteam_api.so') - String dstPath = bin.executableFile.parent + (GradleCppUtils.windows ? '/steam_api.dll' : '/libsteam_api.so') - GradleCppUtils.copyFile(srcPath, dstPath, true) - } -} - void postEvaluate(NativeBinarySpec b) { // attach generateAppVersion task to all 'compile source' tasks @@ -106,7 +89,6 @@ void postEvaluate(NativeBinarySpec b) { t.dependsOn project.generateAppVersion } - setupUnitTests(b) createIntergrationTestTask(b) } @@ -117,7 +99,7 @@ void setupToolchain(NativeBinarySpec b) boolean regamedllFixes = b.flavor.name.contains('regamedllFixes') ToolchainConfig cfg = rootProject.createToolchainConfig(b) - cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/testsuite', '/hookers', '/public', '/public/regamedll') + cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/hookers', '/public', '/public/regamedll') if (unitTestExecutable) { @@ -147,9 +129,6 @@ void setupToolchain(NativeBinarySpec b) cfg.linkerOptions.randomizedBaseAddress = false cfg.linkerOptions.baseAddress = '0x4970000' } - - cfg.projectLibpath(project, '/lib') - cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib' } else if (cfg instanceof GccToolchainConfig) { @@ -172,8 +151,7 @@ void setupToolchain(NativeBinarySpec b) cfg.linkerOptions.args '-no-opt-class-analysis' cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-g' - cfg.projectLibpath(project, '/lib/linux32') - cfg.extraLibs 'dl', 'm', 'stdc++', 'steam_api' + cfg.extraLibs 'dl', 'm', 'stdc++' } if (mpLib && GradleCppUtils.windows && !unitTestExecutable) @@ -183,8 +161,6 @@ void setupToolchain(NativeBinarySpec b) if (!unitTestExecutable) { - //cfg.singleDefines 'CSTRIKE' - if (!mpLib) { cfg.singleDefines 'HOOK_GAMEDLL' @@ -201,7 +177,6 @@ void setupToolchain(NativeBinarySpec b) } ToolchainConfigUtils.apply(project, cfg, b) - GradleCppUtils.onTasksCreated(project, 'postEvaluate', { postEvaluate(b) }) @@ -213,27 +188,21 @@ class RegamedllSrc { source { srcDirs "engine", "dlls", "game_shared", "pm_shared", "regamedll", "public", "version" - if (GradleCppUtils.windows) { - srcDirs "testsuite" - } include "**/*.cpp" exclude "precompiled.cpp" exclude "tier0/dbg.cpp", "utlsymbol.cpp", "utlbuffer.cpp" - if (GradleCppUtils.windows) { + if (GradleCppUtils.windows) + { exclude "tier0/platform_linux.cpp" - } else { + } + else + { exclude "tier0/platform_win32.cpp" exclude "classes_dummy.cpp" } } - - source { - srcDirs "hookers" - include "**/*.cpp" - exclude "6153_hooker.cpp", "hooker.cpp", "main.cpp", "main_mp.cpp", "hooker_impl.cpp" - } } } @@ -250,26 +219,16 @@ class RegamedllSrc { h.regamedll_hooker_src(CppSourceSet) { source { srcDirs "hookers" - include "6153_hooker.cpp", "hooker.cpp", "hooker_impl.cpp" + include "main.cpp", "6153_hooker.cpp", "hooker.cpp", "memory.cpp", "hooker_impl.cpp", "RegameDLLRuntimeConfig.cpp" } } } - static void regamedll_hooker_main_src(def h) { - h.regamedll_hooker_main_src(CppSourceSet) { - source { - srcDirs "hookers" - include "main.cpp" - } - } - } - - static void regamedll_mp_main_src(def h) { - h.regamedll_mp_main_src(CppSourceSet) { + static void regamedll_mp_src(def h) { + h.regamedll_mp_src(CppSourceSet) { source { srcDirs "hookers" include "main_mp.cpp" - exclude "memory.cpp" } } } @@ -318,7 +277,6 @@ model { RegamedllSrc.regamedll_pch(it) RegamedllSrc.regamedll_src(it) RegamedllSrc.regamedll_hooker_src(it) - RegamedllSrc.regamedll_hooker_main_src(it) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } @@ -330,7 +288,7 @@ model { sources { RegamedllSrc.regamedll_pch(it) RegamedllSrc.regamedll_src(it) - RegamedllSrc.regamedll_mp_main_src(it) + RegamedllSrc.regamedll_mp_src(it) } binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } } diff --git a/regamedll/common/com_model.h b/regamedll/common/com_model.h index 73acc2d3..fe568546 100644 --- a/regamedll/common/com_model.h +++ b/regamedll/common/com_model.h @@ -32,7 +32,9 @@ #pragma once #endif +#include "maintypes.h" #include "custom.h" +#include "bspfile.h" #define STUDIO_RENDER 1 #define STUDIO_EVENTS 2 @@ -67,231 +69,231 @@ typedef enum modtype_e mod_studio, } modtype_t; -// must match definition in modelgen.h -#ifndef SYNCTYPE_T -#define SYNCTYPE_T - -typedef enum -{ - ST_SYNC = 0, - ST_RAND -} synctype_t; - +// must match definition in modelgen.h +#ifndef SYNCTYPE_T +#define SYNCTYPE_T + +typedef enum +{ + ST_SYNC = 0, + ST_RAND +} synctype_t; + #endif -// plane_t structure -typedef struct mplane_s -{ - vec3_t normal; // surface normal - float dist; // closest appoach to origin - byte type; // for texture axis selection and fast side tests - byte signbits; // signx + signy<<1 + signz<<1 - byte pad[2]; +// plane_t structure +typedef struct mplane_s +{ + vec3_t normal; // surface normal + float dist; // closest appoach to origin + byte type; // for texture axis selection and fast side tests + byte signbits; // signx + signy<<1 + signz<<1 + byte pad[2]; } mplane_t; -typedef struct -{ - vec3_t position; +typedef struct +{ + vec3_t position; } mvertex_t; -typedef struct -{ - unsigned short v[2]; - unsigned int cachededgeoffset; +typedef struct +{ + unsigned short v[2]; + unsigned int cachededgeoffset; } medge_t; -typedef struct texture_s -{ - char name[16]; - unsigned width; - unsigned height; - int anim_total; // total tenths in sequence ( 0 = no) - int anim_min, anim_max; // time for this frame min <=time< max - struct texture_s *anim_next; // in the animation sequence - struct texture_s *alternate_anims; // bmodels in frame 1 use these - unsigned offsets[ MIPLEVELS ]; // four mip maps stored - unsigned paloffset; +typedef struct texture_s +{ + char name[16]; + unsigned width; + unsigned height; + int anim_total; // total tenths in sequence ( 0 = no) + int anim_min, anim_max; // time for this frame min <=time< max + struct texture_s *anim_next; // in the animation sequence + struct texture_s *alternate_anims; // bmodels in frame 1 use these + unsigned offsets[ MIPLEVELS ]; // four mip maps stored + unsigned paloffset; } texture_t; -typedef struct -{ - float vecs[2][4]; // [s/t] unit vectors in world space. - // [i][3] is the s/t offset relative to the origin. - // s or t = dot(3Dpoint,vecs[i])+vecs[i][3] - - float mipadjust; // ?? mipmap limits for very small surfaces - texture_t *texture; - int flags; // sky or slime, no lightmap or 256 subdivision +typedef struct +{ + float vecs[2][4]; // [s/t] unit vectors in world space. + // [i][3] is the s/t offset relative to the origin. + // s or t = dot(3Dpoint,vecs[i])+vecs[i][3] + + float mipadjust; // ?? mipmap limits for very small surfaces + texture_t *texture; + int flags; // sky or slime, no lightmap or 256 subdivision } mtexinfo_t; -typedef struct mnode_s -{ - int contents; // 0, to differentiate from leafs - int visframe; // node needs to be traversed if current - - short minmaxs[6]; // for bounding box culling - struct mnode_s *parent; - - mplane_t *plane; - struct mnode_s *children[2]; - - unsigned short firstsurface; - unsigned short numsurfaces; +typedef struct mnode_s +{ + int contents; // 0, to differentiate from leafs + int visframe; // node needs to be traversed if current + + short minmaxs[6]; // for bounding box culling + struct mnode_s *parent; + + mplane_t *plane; + struct mnode_s *children[2]; + + unsigned short firstsurface; + unsigned short numsurfaces; } mnode_t; -typedef struct msurface_s msurface_t; +typedef struct msurface_s msurface_t; typedef struct decal_s decal_t; // JAY: Compress this as much as possible -struct decal_s -{ - decal_t *pnext; // linked list for each surface - msurface_t *psurface; // Surface id for persistence / unlinking - short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats) - short dy; - short texture; // Decal texture - byte scale; // Pixel scale - byte flags; // Decal flags - short entityIndex; // Entity this is attached to +struct decal_s +{ + decal_t *pnext; // linked list for each surface + msurface_t *psurface; // Surface id for persistence / unlinking + short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats) + short dy; + short texture; // Decal texture + byte scale; // Pixel scale + byte flags; // Decal flags + short entityIndex; // Entity this is attached to }; -typedef struct mleaf_s -{ -// common with node - int contents; // wil be a negative contents number - int visframe; // node needs to be traversed if current - - short minmaxs[6]; // for bounding box culling - - struct mnode_s *parent; - -// leaf specific - byte *compressed_vis; - struct efrag_s *efrags; - - msurface_t **firstmarksurface; - int nummarksurfaces; - int key; // BSP sequence number for leaf's contents - byte ambient_sound_level[ NUM_AMBIENTS ]; +typedef struct mleaf_s +{ + // common with node + int contents; // wil be a negative contents number + int visframe; // node needs to be traversed if current + + short minmaxs[6]; // for bounding box culling + + struct mnode_s *parent; + + // leaf specific + byte *compressed_vis; + struct efrag_s *efrags; + + msurface_t **firstmarksurface; + int nummarksurfaces; + int key; // BSP sequence number for leaf's contents + byte ambient_sound_level[ NUM_AMBIENTS ]; } mleaf_t; -struct msurface_s -{ - int visframe; // should be drawn when node is crossed - int dlightframe; // last frame the surface was checked by an animated light - int dlightbits; // dynamically generated. Indicates if the surface illumination - // is modified by an animated light. - - mplane_t *plane; // pointer to shared plane - int flags; // see SURF_ #defines - int firstedge; // look up in model->surfedges[], negative numbers - int numedges; // are backwards edges - - struct surfcache_s *cachespots[ MIPLEVELS ]; - - short texturemins[2]; // smallest s/t position on the surface. - short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces - - mtexinfo_t *texinfo; - byte styles[ MAXLIGHTMAPS ]; // index into d_lightstylevalue[] for animated lights - // no one surface can be effected by more than 4 - // animated lights. - - color24 *samples; - decal_t *pdecals; +struct msurface_s +{ + int visframe; // should be drawn when node is crossed + int dlightframe; // last frame the surface was checked by an animated light + int dlightbits; // dynamically generated. Indicates if the surface illumination + // is modified by an animated light. + + mplane_t *plane; // pointer to shared plane + int flags; // see SURF_ #defines + int firstedge; // look up in model->surfedges[], negative numbers + int numedges; // are backwards edges + + struct surfcache_s *cachespots[ MIPLEVELS ]; + + short texturemins[2]; // smallest s/t position on the surface. + short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces + + mtexinfo_t *texinfo; + byte styles[ MAXLIGHTMAPS ]; // index into d_lightstylevalue[] for animated lights + // no one surface can be effected by more than 4 + // animated lights. + + color24 *samples; + decal_t *pdecals; }; -typedef struct hull_s -{ - dclipnode_t *clipnodes; - mplane_t *planes; - int firstclipnode; - int lastclipnode; - vec3_t clip_mins; - vec3_t clip_maxs; +typedef struct hull_s +{ + dclipnode_t *clipnodes; + mplane_t *planes; + int firstclipnode; + int lastclipnode; + vec3_t clip_mins; + vec3_t clip_maxs; } hull_t; -#if !defined(CACHE_USER) && !defined(QUAKEDEF_H) -#define CACHE_USER -typedef struct cache_user_s -{ - void *data; -} cache_user_t; +#if !defined(CACHE_USER) && !defined(QUAKEDEF_H) +#define CACHE_USER +typedef struct cache_user_s +{ + void *data; +} cache_user_t; #endif -typedef struct model_s -{ - char name[ MAX_MODEL_NAME ]; - qboolean needload; // bmodels and sprites don't cache normally - - modtype_t type; - int numframes; - synctype_t synctype; - - int flags; - - // volume occupied by the model - vec3_t mins, maxs; - float radius; - - // brush model - int firstmodelsurface, nummodelsurfaces; - - int numsubmodels; - dmodel_t *submodels; - - int numplanes; - mplane_t *planes; - - int numleafs; // number of visible leafs, not counting 0 - struct mleaf_s *leafs; - - int numvertexes; - mvertex_t *vertexes; - - int numedges; - medge_t *edges; - - int numnodes; - mnode_t *nodes; - - int numtexinfo; - mtexinfo_t *texinfo; - - int numsurfaces; - msurface_t *surfaces; - - int numsurfedges; - int *surfedges; - - int numclipnodes; - dclipnode_t *clipnodes; - - int nummarksurfaces; - msurface_t **marksurfaces; - - hull_t hulls[ MAX_MAP_HULLS ]; - - int numtextures; - texture_t **textures; - - byte *visdata; - color24 *lightdata; - char *entities; - -// additional model data - cache_user_t cache; // only access through Mod_Extradata - +typedef struct model_s +{ + char name[ MAX_MODEL_NAME ]; + qboolean needload; // bmodels and sprites don't cache normally + + modtype_t type; + int numframes; + synctype_t synctype; + + int flags; + + // volume occupied by the model + vec3_t mins, maxs; + float radius; + + // brush model + int firstmodelsurface, nummodelsurfaces; + + int numsubmodels; + dmodel_t *submodels; + + int numplanes; + mplane_t *planes; + + int numleafs; // number of visible leafs, not counting 0 + struct mleaf_s *leafs; + + int numvertexes; + mvertex_t *vertexes; + + int numedges; + medge_t *edges; + + int numnodes; + mnode_t *nodes; + + int numtexinfo; + mtexinfo_t *texinfo; + + int numsurfaces; + msurface_t *surfaces; + + int numsurfedges; + int *surfedges; + + int numclipnodes; + dclipnode_t *clipnodes; + + int nummarksurfaces; + msurface_t **marksurfaces; + + hull_t hulls[ MAX_MAP_HULLS ]; + + int numtextures; + texture_t **textures; + + byte *visdata; + color24 *lightdata; + char *entities; + + // additional model data + cache_user_t cache; // only access through Mod_Extradata + } model_t; typedef vec_t vec4_t[4]; -typedef struct alight_s -{ - int ambientlight; // clip at 128 - int shadelight; // clip at 192 - ambientlight - vec3_t color; - float *plightvec; +typedef struct alight_s +{ + int ambientlight; // clip at 128 + int shadelight; // clip at 192 - ambientlight + vec3_t color; + float *plightvec; } alight_t; typedef struct auxvert_s @@ -299,41 +301,41 @@ typedef struct auxvert_s float fv[3]; // viewspace x, y } auxvert_t; -#define MAX_INFO_STRING 256 +#define MAX_INFO_STRING 256 #define MAX_SCOREBOARDNAME 32 -typedef struct player_info_s -{ - // User id on server - int userid; - - // User info string - char userinfo[ MAX_INFO_STRING ]; - - // Name - char name[ MAX_SCOREBOARDNAME ]; - - // Spectator or not, unused - int spectator; - int ping; - int packet_loss; - - // skin information - char model[MAX_QPATH]; - int topcolor; - int bottomcolor; - - // last frame rendered - int renderframe; - - // Gait frame estimation - int gaitsequence; - float gaitframe; - float gaityaw; - vec3_t prevgaitorigin; - - customization_t customdata; - +typedef struct player_info_s +{ + // User id on server + int userid; + + // User info string + char userinfo[ MAX_INFO_STRING ]; + + // Name + char name[ MAX_SCOREBOARDNAME ]; + + // Spectator or not, unused + int spectator; + int ping; + int packet_loss; + + // skin information + char model[MAX_QPATH]; + int topcolor; + int bottomcolor; + + // last frame rendered + int renderframe; + + // Gait frame estimation + int gaitsequence; + float gaitframe; + float gaityaw; + vec3_t prevgaitorigin; + + customization_t customdata; + } player_info_t; #endif // COM_MODEL_H diff --git a/regamedll/common/const.h b/regamedll/common/const.h index 47fea684..1097ab93 100644 --- a/regamedll/common/const.h +++ b/regamedll/common/const.h @@ -33,10 +33,26 @@ #endif // buttons -#ifndef IN_BUTTONS_H #include "in_buttons.h" -#endif +// Max # of clients allowed in a server. +#define MAX_CLIENTS 32 + +// How many bits to use to encode an edict. +#define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts +// Max # of edicts in a level (2048) +#define MAX_EDICTS (1<flags #define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground #define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) #define FL_CONVEYOR (1<<2) @@ -139,81 +155,81 @@ #define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound #define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles #define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound -#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps -#define TE_TRACER 6 // tracer effect from point to point -#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters +#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps +#define TE_TRACER 6 // tracer effect from point to point +#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters #define TE_BEAMENTS 8 -#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite -#define TE_LAVASPLASH 10 // Quake1 lava splash -#define TE_TELEPORT 11 // Quake1 teleport splash -#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound -#define TE_BSPDECAL 13 // Decal from the .BSP file -#define TE_IMPLOSION 14 // tracers moving toward a point -#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions -#define TE_BEAM 16 // obsolete -#define TE_SPRITE 17 // additive sprite, plays 1 cycle -#define TE_BEAMSPRITE 18 // A beam with a sprite at the end -#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime -#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime -#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime -#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving +#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite +#define TE_LAVASPLASH 10 // Quake1 lava splash +#define TE_TELEPORT 11 // Quake1 teleport splash +#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound +#define TE_BSPDECAL 13 // Decal from the .BSP file +#define TE_IMPLOSION 14 // tracers moving toward a point +#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions +#define TE_BEAM 16 // obsolete +#define TE_SPRITE 17 // additive sprite, plays 1 cycle +#define TE_BEAMSPRITE 18 // A beam with a sprite at the end +#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime +#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime +#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime +#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving #define TE_GLOWSPRITE 23 -#define TE_BEAMRING 24 // connect a beam ring to two entities -#define TE_STREAK_SPLASH 25 // oriented shower of tracers -#define TE_BEAMHOSE 26 // obsolete -#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect -#define TE_ELIGHT 28 // point entity light, no world effect +#define TE_BEAMRING 24 // connect a beam ring to two entities +#define TE_STREAK_SPLASH 25 // oriented shower of tracers +#define TE_BEAMHOSE 26 // obsolete +#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect +#define TE_ELIGHT 28 // point entity light, no world effect #define TE_TEXTMESSAGE 29 #define TE_LINE 30 #define TE_BOX 31 -#define TE_KILLBEAM 99 // kill all beams attached to entity +#define TE_KILLBEAM 99 // kill all beams attached to entity #define TE_LARGEFUNNEL 100 -#define TE_BLOODSTREAM 101 // particle spray -#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds -#define TE_BLOOD 103 // particle spray -#define TE_DECAL 104 // Decal applied to a brush entity (not the world) -#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards -#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits -#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set -#define TE_BREAKMODEL 108 // box of models or sprites -#define TE_GUNSHOTDECAL 109 // decal and ricochet sound -#define TE_SPRITE_SPRAY 110 // spay of alpha sprites -#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound. -#define TE_PLAYERDECAL 112 // ??? -#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards -#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards -#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent) -#define TE_WORLDDECAL 116 // Decal applied to the world brush -#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush -#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256 -#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent) -#define TE_SPRAY 120 // Throws a shower of sprites or models -#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!) -#define TE_PARTICLEBURST 122 // very similar to lavasplash. -#define TE_FIREFIELD 123 // makes a field of fire. +#define TE_BLOODSTREAM 101 // particle spray +#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds +#define TE_BLOOD 103 // particle spray +#define TE_DECAL 104 // Decal applied to a brush entity (not the world) +#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards +#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits +#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set +#define TE_BREAKMODEL 108 // box of models or sprites +#define TE_GUNSHOTDECAL 109 // decal and ricochet sound +#define TE_SPRITE_SPRAY 110 // spay of alpha sprites +#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound. +#define TE_PLAYERDECAL 112 // ??? +#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards +#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards +#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent) +#define TE_WORLDDECAL 116 // Decal applied to the world brush +#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush +#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256 +#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent) +#define TE_SPRAY 120 // Throws a shower of sprites or models +#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!) +#define TE_PARTICLEBURST 122 // very similar to lavasplash. +#define TE_FIREFIELD 123 // makes a field of fire. // to keep network traffic low, this message has associated flags that fit into a byte: -#define TEFIRE_FLAG_ALLFLOAT 1 // all sprites will drift upwards as they animate -#define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance) -#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration. -#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque -#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube. -#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive -#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent) -#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player. -#define TE_MULTIGUNSHOT 126 // much more compact shotgun message -#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization. +#define TEFIRE_FLAG_ALLFLOAT 1 // all sprites will drift upwards as they animate +#define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance) +#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration. +#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque +#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube. +#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive +#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent) +#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player. +#define TE_MULTIGUNSHOT 126 // much more compact shotgun message +#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization. -#define MSG_BROADCAST 0 // unreliable to all -#define MSG_ONE 1 // reliable to one (msg_entity) -#define MSG_ALL 2 // reliable to all -#define MSG_INIT 3 // write to the init string -#define MSG_PVS 4 // Ents in PVS of org -#define MSG_PAS 5 // Ents in PAS of org -#define MSG_PVS_R 6 // Reliable to PVS -#define MSG_PAS_R 7 // Reliable to PAS -#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped ) -#define MSG_SPEC 9 // Sends to all spectator proxies +#define MSG_BROADCAST 0 // unreliable to all +#define MSG_ONE 1 // reliable to one (msg_entity) +#define MSG_ALL 2 // reliable to all +#define MSG_INIT 3 // write to the init string +#define MSG_PVS 4 // Ents in PVS of org +#define MSG_PAS 5 // Ents in PAS of org +#define MSG_PVS_R 6 // Reliable to PVS +#define MSG_PAS_R 7 // Reliable to PAS +#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped ) +#define MSG_SPEC 9 // Sends to all spectator proxies // contents of a spot in the world #define CONTENTS_EMPTY -1 @@ -242,11 +258,11 @@ #define CHAN_VOICE 2 #define CHAN_ITEM 3 #define CHAN_BODY 4 -#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area -#define CHAN_STATIC 6 // allocate channel from the static area -#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network -#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). -#define CHAN_BOT 501 // channel used for bot chatter. +#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area +#define CHAN_STATIC 6 // allocate channel from the static area +#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network +#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). +#define CHAN_BOT 501 // channel used for bot chatter. // attenuation values #define ATTN_NONE 0 @@ -255,8 +271,8 @@ #define ATTN_STATIC 1.25 // pitch values -#define PITCH_NORM 100 // non-pitch shifted -#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high +#define PITCH_NORM 100 // non-pitch shifted +#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high #define PITCH_HIGH 120 // volume values @@ -267,8 +283,8 @@ // Trains #define SF_TRAIN_WAIT_RETRIGGER 1 -#define SF_TRAIN_START_ON 4 // Train is initially moving -#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains +#define SF_TRAIN_START_ON 4 // Train is initially moving +#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains // Break Model Defines #define BREAK_TYPEMASK 0x4F diff --git a/regamedll/common/mathlib.h b/regamedll/common/mathlib.h index 090e7866..36f85229 100644 --- a/regamedll/common/mathlib.h +++ b/regamedll/common/mathlib.h @@ -39,7 +39,7 @@ typedef double float_precision; -#else // PLAY_GAMEDLL +#else typedef float float_precision; @@ -68,29 +68,29 @@ typedef union DLONG_u #define M_PI 3.14159265358979323846 template -T Q_min(T a, T b) { return (a < b) ? a : b; } +T Q_min(T a, T b) { return (a < b) ? a : b; } template -T Q_max(T a, T b) { return (a > b) ? a : b; } +T Q_max(T a, T b) { return (a > b) ? a : b; } template -T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; } +T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; } // bitwise operators templates template::type> -inline T operator~ (T a) { return (T)~(type)a; } +inline T operator~ (T a) { return (T)~(type)a; } template::type> -inline T operator| (T a, T b) { return (T)((type)a | (type)b); } +inline T operator| (T a, T b) { return (T)((type)a | (type)b); } template::type> -inline T operator& (T a, T b) { return (T)((type)a & (type)b); } +inline T operator& (T a, T b) { return (T)((type)a & (type)b); } template::type> -inline T operator^ (T a, T b) { return (T)((type)a ^ (type)b); } +inline T operator^ (T a, T b) { return (T)((type)a ^ (type)b); } template::type> -inline T& operator|= (T& a, T b){ return (T&)((type&)a |= (type)b); } +inline T& operator|= (T& a, T b) { return (T&)((type&)a |= (type)b); } template::type> -inline T& operator&= (T& a, T b){ return (T&)((type&)a &= (type)b); } +inline T& operator&= (T& a, T b) { return (T&)((type&)a &= (type)b); } template::type> -inline T& operator^= (T& a, T b){ return (T&)((type&)a ^= (type)b); } +inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); } #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} diff --git a/regamedll/dlls/airtank.cpp b/regamedll/dlls/airtank.cpp index d1e2f732..6d2bc0cf 100644 --- a/regamedll/dlls/airtank.cpp +++ b/regamedll/dlls/airtank.cpp @@ -10,15 +10,11 @@ TYPEDESCRIPTION CAirtank::m_SaveData[] = DEFINE_FIELD(CAirtank, m_state, FIELD_INTEGER) }; -#endif // HOOK_GAMEDLL +#endif -/* <5329> ../cstrike/dlls/airtank.cpp:41 */ LINK_ENTITY_TO_CLASS(item_airtank, CAirtank); - -/* <5211> ../cstrike/dlls/airtank.cpp:47 */ IMPLEMENT_SAVERESTORE(CAirtank, CGrenade); -/* <50dd> ../cstrike/dlls/airtank.cpp:50 */ void CAirtank::__MAKE_VHOOK(Spawn)() { Precache(); @@ -41,14 +37,12 @@ void CAirtank::__MAKE_VHOOK(Spawn)() m_state = 1; } -/* <4fef> ../cstrike/dlls/airtank.cpp:71 */ void CAirtank::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_oxygen.mdl"); PRECACHE_SOUND("doors/aliendoor3.wav"); } -/* <503d> ../cstrike/dlls/airtank.cpp:78 */ void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) { pev->owner = ENT(pevAttacker); @@ -57,7 +51,6 @@ void CAirtank::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) Explode(pev->origin, Vector(0, 0, -1)); } -/* <5016> ../cstrike/dlls/airtank.cpp:88 */ void CAirtank::TankThink() { // Fire trigger @@ -65,7 +58,6 @@ void CAirtank::TankThink() SUB_UseTargets(this, USE_TOGGLE, 0); } -/* <525d> ../cstrike/dlls/airtank.cpp:96 */ void CAirtank::TankTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) diff --git a/regamedll/dlls/airtank.h b/regamedll/dlls/airtank.h index 1e7294ae..89ff2eb9 100644 --- a/regamedll/dlls/airtank.h +++ b/regamedll/dlls/airtank.h @@ -32,10 +32,8 @@ #pragma once #endif -/* <468c> ../cstrike/dlls/airtank.cpp:23 */ class CAirtank: public CGrenade { - public: virtual void Spawn(); virtual void Precache(); @@ -56,7 +54,7 @@ public: int Restore_(CRestore &restore); void Killed_(entvars_t *pevAttacker, int iGib); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; diff --git a/regamedll/dlls/ammo.cpp b/regamedll/dlls/ammo.cpp index 93882af1..16fa5bfc 100644 --- a/regamedll/dlls/ammo.cpp +++ b/regamedll/dlls/ammo.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* ../cstrike/dlls/ammo.cpp:16 */ void C9MMAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -8,14 +7,12 @@ void C9MMAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:22 */ void C9MMAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:27 */ BOOL C9MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_9MM_BUY, "9mm", MAX_AMMO_9MM) == -1) @@ -27,10 +24,8 @@ BOOL C9MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:37 */ LINK_ENTITY_TO_CLASS(ammo_9mm, C9MMAmmo); -/* ../cstrike/dlls/ammo.cpp:42 */ void CBuckShotAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -38,14 +33,12 @@ void CBuckShotAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:48 */ void CBuckShotAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_shotbox.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:53 */ BOOL CBuckShotAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_BUCKSHOT_BUY, "buckshot", MAX_AMMO_BUCKSHOT) == -1) @@ -57,10 +50,8 @@ BOOL CBuckShotAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:63 */ LINK_ENTITY_TO_CLASS(ammo_buckshot, CBuckShotAmmo); -/* ../cstrike/dlls/ammo.cpp:69 */ void C556NatoAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -68,14 +59,12 @@ void C556NatoAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:75 */ void C556NatoAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:80 */ BOOL C556NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_556NATO_BUY, "556Nato", MAX_AMMO_556NATO) == -1) @@ -87,10 +76,8 @@ BOOL C556NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:90 */ LINK_ENTITY_TO_CLASS(ammo_556nato, C556NatoAmmo); -/* ../cstrike/dlls/ammo.cpp:95 */ void C556NatoBoxAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -98,14 +85,12 @@ void C556NatoBoxAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:101 */ void C556NatoBoxAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:106 */ BOOL C556NatoBoxAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_556NATOBOX_BUY, "556NatoBox", MAX_AMMO_556NATOBOX) == -1) @@ -117,10 +102,8 @@ BOOL C556NatoBoxAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:116 */ LINK_ENTITY_TO_CLASS(ammo_556natobox, C556NatoBoxAmmo); -/* ../cstrike/dlls/ammo.cpp:121 */ void C762NatoAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -128,14 +111,12 @@ void C762NatoAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:127 */ void C762NatoAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:132 */ BOOL C762NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_762NATO_BUY, "762Nato", MAX_AMMO_762NATO) == -1) @@ -147,10 +128,8 @@ BOOL C762NatoAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:142 */ LINK_ENTITY_TO_CLASS(ammo_762nato, C762NatoAmmo); -/* ../cstrike/dlls/ammo.cpp:147 */ void C45ACPAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -158,14 +137,12 @@ void C45ACPAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:153 */ void C45ACPAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:158 */ BOOL C45ACPAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_45ACP_BUY, "45acp", MAX_AMMO_45ACP) == -1) @@ -177,10 +154,8 @@ BOOL C45ACPAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:168 */ LINK_ENTITY_TO_CLASS(ammo_45acp, C45ACPAmmo); -/* ../cstrike/dlls/ammo.cpp:173 */ void C50AEAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -188,14 +163,12 @@ void C50AEAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:179 */ void C50AEAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:184 */ BOOL C50AEAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_50AE_BUY, "50AE", MAX_AMMO_50AE) == -1) @@ -207,10 +180,8 @@ BOOL C50AEAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:194 */ LINK_ENTITY_TO_CLASS(ammo_50ae, C50AEAmmo); -/* ../cstrike/dlls/ammo.cpp:199 */ void C338MagnumAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -218,14 +189,12 @@ void C338MagnumAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:205 */ void C338MagnumAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:210 */ BOOL C338MagnumAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_338MAG_BUY, "338Magnum", MAX_AMMO_338MAGNUM) == -1) @@ -237,10 +206,8 @@ BOOL C338MagnumAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:220 */ LINK_ENTITY_TO_CLASS(ammo_338magnum, C338MagnumAmmo); -/* ../cstrike/dlls/ammo.cpp:226 */ void C57MMAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -248,14 +215,12 @@ void C57MMAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:232 */ void C57MMAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:237 */ BOOL C57MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_57MM_BUY, "57mm", MAX_AMMO_57MM) == -1) @@ -267,10 +232,8 @@ BOOL C57MMAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:247 */ LINK_ENTITY_TO_CLASS(ammo_57mm, C57MMAmmo); -/* ../cstrike/dlls/ammo.cpp:251 */ void C357SIGAmmo::__MAKE_VHOOK(Spawn)() { Precache(); @@ -278,14 +241,12 @@ void C357SIGAmmo::__MAKE_VHOOK(Spawn)() CBasePlayerAmmo::Spawn(); } -/* ../cstrike/dlls/ammo.cpp:257 */ void C357SIGAmmo::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_9mmclip.mdl"); PRECACHE_SOUND("items/9mmclip1.wav"); } -/* ../cstrike/dlls/ammo.cpp:262 */ BOOL C357SIGAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) { if (pOther->GiveAmmo(AMMO_357SIG_BUY, "357SIG", MAX_AMMO_357SIG) == -1) @@ -297,5 +258,4 @@ BOOL C357SIGAmmo::__MAKE_VHOOK(AddAmmo)(CBaseEntity *pOther) return TRUE; } -/* ../cstrike/dlls/ammo.cpp:272 */ LINK_ENTITY_TO_CLASS(ammo_357sig, C357SIGAmmo); diff --git a/regamedll/dlls/ammo.h b/regamedll/dlls/ammo.h index 60f1b316..6118fa28 100644 --- a/regamedll/dlls/ammo.h +++ b/regamedll/dlls/ammo.h @@ -32,7 +32,6 @@ #pragma once #endif -/* <9792> ../cstrike/dlls/ammo.cpp:14 */ class C9MMAmmo: public CBasePlayerAmmo { public: @@ -46,11 +45,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <97df> ../cstrike/dlls/ammo.cpp:40 */ class CBuckShotAmmo: public CBasePlayerAmmo { public: @@ -64,11 +62,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <982c> ../cstrike/dlls/ammo.cpp:67 */ class C556NatoAmmo: public CBasePlayerAmmo { public: @@ -82,11 +79,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <9879> ../cstrike/dlls/ammo.cpp:93 */ class C556NatoBoxAmmo: public CBasePlayerAmmo { public: @@ -100,11 +96,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <98c6> ../cstrike/dlls/ammo.cpp:119 */ class C762NatoAmmo: public CBasePlayerAmmo { public: @@ -118,11 +113,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <9913> ../cstrike/dlls/ammo.cpp:145 */ class C45ACPAmmo: public CBasePlayerAmmo { public: @@ -136,11 +130,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <9960> ../cstrike/dlls/ammo.cpp:171 */ class C50AEAmmo: public CBasePlayerAmmo { public: @@ -154,11 +147,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <99ad> ../cstrike/dlls/ammo.cpp:197 */ class C338MagnumAmmo: public CBasePlayerAmmo { public: @@ -172,11 +164,10 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <99fa> ../cstrike/dlls/ammo.cpp:224 */ class C57MMAmmo: public CBasePlayerAmmo { public: @@ -190,11 +181,9 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL - +#endif }; -/* <9a47> ../cstrike/dlls/ammo.cpp:249 */ class C357SIGAmmo: public CBasePlayerAmmo { public: @@ -208,7 +197,7 @@ public: void Precache_(); BOOL AddAmmo_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; diff --git a/regamedll/dlls/animating.cpp b/regamedll/dlls/animating.cpp index 66872348..fcfcee6d 100644 --- a/regamedll/dlls/animating.cpp +++ b/regamedll/dlls/animating.cpp @@ -14,12 +14,10 @@ TYPEDESCRIPTION CBaseAnimating::m_SaveData[] = DEFINE_FIELD(CBaseMonster, m_fSequenceLoops, FIELD_BOOLEAN), }; -#endif // HOOK_GAMEDLL +#endif -/* <10583> ../cstrike/dlls/animating.cpp:38 */ IMPLEMENT_SAVERESTORE(CBaseAnimating, CBaseDelay); -/* <105cf> ../cstrike/dlls/animating.cpp:45 */ float CBaseAnimating::StudioFrameAdvance(float flInterval) { if (flInterval == 0.0f) @@ -42,7 +40,7 @@ float CBaseAnimating::StudioFrameAdvance(float flInterval) if (pev->frame < 0.0 || pev->frame >= 256.0) { if (m_fSequenceLoops) - pev->frame -= (int)(pev->frame / 256.0) * 256.0; + pev->frame -= int(pev->frame / 256.0) * 256.0; else pev->frame = (pev->frame < 0) ? 0 : 255; @@ -52,21 +50,18 @@ float CBaseAnimating::StudioFrameAdvance(float flInterval) return flInterval; } -/* <10605> ../cstrike/dlls/animating.cpp:77 */ int CBaseAnimating::LookupActivity(int activity) { void *pmodel = GET_MODEL_PTR(ENT(pev)); return ::LookupActivity(pmodel, pev, activity); } -/* <10653> ../cstrike/dlls/animating.cpp:91 */ int CBaseAnimating::LookupActivityHeaviest(int activity) { void *pmodel = GET_MODEL_PTR(ENT(pev)); return ::LookupActivityHeaviest(pmodel, pev, activity); } -/* <107b1> ../cstrike/dlls/animating.cpp:136 */ void CBaseAnimating::DispatchAnimEvents(float flInterval) { MonsterEvent_t event; @@ -100,14 +95,12 @@ void CBaseAnimating::DispatchAnimEvents(float flInterval) } } -/* <106a1> ../cstrike/dlls/animating.cpp:100 */ int CBaseAnimating::LookupSequence(const char *label) { void *pmodel = GET_MODEL_PTR(ENT(pev)); return ::LookupSequence(pmodel, label); } -/* <10711> ../cstrike/dlls/animating.cpp:110 */ void CBaseAnimating::ResetSequenceInfo() { void *pmodel = GET_MODEL_PTR(ENT(pev)); @@ -121,14 +114,12 @@ void CBaseAnimating::ResetSequenceInfo() m_flLastEventCheck = gpGlobals->time; } -/* <1077c> ../cstrike/dlls/animating.cpp:126 */ BOOL CBaseAnimating::GetSequenceFlags() { void *pmodel = GET_MODEL_PTR(ENT(pev)); return ::GetSequenceFlags(pmodel, pev); } -/* <10837> ../cstrike/dlls/animating.cpp:171 */ float CBaseAnimating::SetBoneController(int iController, float flValue) { void *pmodel = GET_MODEL_PTR(ENT(pev)); @@ -136,7 +127,6 @@ float CBaseAnimating::SetBoneController(int iController, float flValue) return SetController(pmodel, pev, iController, flValue); } -/* <10893> ../cstrike/dlls/animating.cpp:180 */ void CBaseAnimating::InitBoneControllers() { void *pmodel = GET_MODEL_PTR(ENT(pev)); @@ -147,26 +137,22 @@ void CBaseAnimating::InitBoneControllers() SetController(pmodel, pev, 3, 0); } -/* <108d3> ../cstrike/dlls/animating.cpp:192 */ NOXREF float CBaseAnimating::SetBlending(int iBlender, float flValue) { void *pmodel = GET_MODEL_PTR(ENT(pev)); return ::SetBlending(pmodel, pev, iBlender, flValue); } -/* <1092f> ../cstrike/dlls/animating.cpp:201 */ NOXREF void CBaseAnimating::GetBonePosition(int iBone, Vector &origin, Vector &angles) { GET_BONE_POSITION(ENT(pev), iBone, origin, angles); } -/* <10984> ../cstrike/dlls/animating.cpp:208 */ NOXREF void CBaseAnimating::GetAttachment(int iAttachment, Vector &origin, Vector &angles) { GET_ATTACHMENT(ENT(pev), iAttachment, origin, angles); } -/* <109d4> ../cstrike/dlls/animating.cpp:215 */ NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence, int *piDir) { void *pmodel = GET_MODEL_PTR(ENT(pev)); @@ -185,31 +171,26 @@ NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence return ::FindTransition(pmodel, iEndingSequence, iGoalSequence, piDir); } -/* <10a5d> ../cstrike/dlls/animating.cpp:234 */ NOXREF void CBaseAnimating::GetAutomovement(Vector &origin, Vector &angles, float flInterval) { ; } -/* <10aad> ../cstrike/dlls/animating.cpp:239 */ NOXREF void CBaseAnimating::SetBodygroup(int iGroup, int iValue) { ::SetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup, iValue); } -/* <10af0> ../cstrike/dlls/animating.cpp:244 */ NOXREF int CBaseAnimating::GetBodygroup(int iGroup) { return ::GetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup); } -/* <10b5f> ../cstrike/dlls/animating.cpp:250 */ int CBaseAnimating::ExtractBbox(int sequence, float *mins, float *maxs) { return ::ExtractBbox(GET_MODEL_PTR(ENT(pev)), sequence, mins, maxs); } -/* <10b99> ../cstrike/dlls/animating.cpp:258 */ void CBaseAnimating::SetSequenceBox() { Vector mins, maxs; @@ -222,10 +203,10 @@ void CBaseAnimating::SetSequenceBox() float yaw = pev->angles.y * (M_PI / 180.0); Vector xvector, yvector; - xvector.x = cos(yaw); - xvector.y = sin(yaw); - yvector.x = -sin(yaw); - yvector.y = cos(yaw); + xvector.x = Q_cos(yaw); + xvector.y = Q_sin(yaw); + yvector.x = -Q_sin(yaw); + yvector.y = Q_cos(yaw); Vector bounds[2]; bounds[0] = mins; diff --git a/regamedll/dlls/animation.cpp b/regamedll/dlls/animation.cpp index 59ec78ca..26c917b4 100644 --- a/regamedll/dlls/animation.cpp +++ b/regamedll/dlls/animation.cpp @@ -5,13 +5,15 @@ */ #ifndef HOOK_GAMEDLL +void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t *angles, const vec_t *origin, const byte *pcontroller, const byte *pblending, int iBone, const edict_t *pEdict); + sv_blending_interface_t svBlending = { SV_BLENDING_INTERFACE_VERSION, SV_StudioSetupBones }; -#endif // HOOK_GAMEDLL +#endif server_studio_api_t IEngineStudio; studiohdr_t *g_pstudiohdr; @@ -19,7 +21,6 @@ studiohdr_t *g_pstudiohdr; float (*g_pRotationMatrix)[3][4]; float (*g_pBoneTransform)[128][3][4]; -/* <1523e> ../cstrike/dlls/animation.cpp:57 */ int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -42,7 +43,6 @@ int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs) return 1; } -/* <152c6> ../cstrike/dlls/animation.cpp:81 */ int LookupActivity(void *pmodel, entvars_t *pev, int activity) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -112,7 +112,6 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity) return ACT_INVALID; } -/* <1539a> ../cstrike/dlls/animation.cpp:149 */ int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -141,7 +140,6 @@ int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity) return seq; } -/* <15439> ../cstrike/dlls/animation.cpp:178 */ NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition) { studiohdr_t *pstudiohdr; @@ -159,7 +157,6 @@ NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition) vecEyePosition[2] = pstudiohdr->eyeposition[2]; } -/* <15485> ../cstrike/dlls/animation.cpp:193 */ int LookupSequence(void *pmodel, const char *label) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -181,7 +178,6 @@ int LookupSequence(void *pmodel, const char *label) return ACT_INVALID; } -/* <1518c> ../cstrike/dlls/animation.cpp:215 */ int IsSoundEvent(int eventNumber) { if (eventNumber == SCRIPT_EVENT_SOUND || eventNumber == SCRIPT_EVENT_SOUND_VOICE) @@ -192,7 +188,6 @@ int IsSoundEvent(int eventNumber) return 0; } -/* <15539> ../cstrike/dlls/animation.cpp:223 */ NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName) { int index = LookupSequence(pmodel, pSequenceName); @@ -229,7 +224,6 @@ NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName) } } -/* <15634> ../cstrike/dlls/animation.cpp:263 */ void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -246,7 +240,7 @@ void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *p return; } - mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; + mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence); if (pseqdesc->numframes <= 1) { *pflFrameRate = 256.0f; @@ -255,11 +249,10 @@ void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *p } *pflFrameRate = pseqdesc->fps * 256.0f / (pseqdesc->numframes - 1); - *pflGroundSpeed = sqrt(pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2]); + *pflGroundSpeed = Q_sqrt(pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2]); *pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1); } -/* <156b3> ../cstrike/dlls/animation.cpp:297 */ int GetSequenceFlags(void *pmodel, entvars_t *pev) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -269,11 +262,10 @@ int GetSequenceFlags(void *pmodel, entvars_t *pev) return 0; } - mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; + mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence); return pseqdesc->flags; } -/* <15717> ../cstrike/dlls/animation.cpp:312 */ int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -283,9 +275,7 @@ int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEven return 0; } - // int events = 0; - - mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; + mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence); mstudioevent_t *pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex); if (pseqdesc->numevents == 0 || index > pseqdesc->numevents) @@ -325,7 +315,6 @@ int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEven return 0; } -/* <157e1> ../cstrike/dlls/animation.cpp:359 */ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -354,10 +343,10 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue if (pbonecontroller->end > pbonecontroller->start + 359.0) { if (flValue > 360.0) - flValue = flValue - (int64_t)(flValue / 360.0) * 360.0; + flValue = flValue - int64(flValue / 360.0) * 360.0; else if (flValue < 0.0) - flValue = flValue + (int64_t)((flValue / -360.0) + 1) * 360.0; + flValue = flValue + int64((flValue / -360.0) + 1) * 360.0; } else { @@ -369,7 +358,7 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue } } - int setting = (int64_t)(255.0f * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start)); + int setting = int64(255.0f * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start)); if (setting < 0) setting = 0; @@ -382,7 +371,6 @@ float SetController(void *pmodel, entvars_t *pev, int iController, float flValue return setting * (1.0f / 255.0f) * (pbonecontroller->end - pbonecontroller->start) + pbonecontroller->start; } -/* <15883> ../cstrike/dlls/animation.cpp:414 */ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -391,7 +379,7 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue) return flValue; } - mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; + mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + int(pev->sequence); if (pseqdesc->blendtype[iBlender] == 0) { @@ -419,7 +407,7 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue) } } - int setting = (int64_t)(255.0f * (flValue - pseqdesc->blendstart[iBlender]) / (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender])); + int setting = int64(255.0f * (flValue - pseqdesc->blendstart[iBlender]) / (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender])); if (setting < 0) setting = 0; @@ -432,7 +420,6 @@ float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue) return setting * (1.0 / 255.0) * (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender]) + pseqdesc->blendstart[iBlender]; } -/* <15917> ../cstrike/dlls/animation.cpp:458 */ int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -497,7 +484,6 @@ int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir) return iGoalAnim; } -/* <159d8> ../cstrike/dlls/animation.cpp:523 */ void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -522,7 +508,6 @@ void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue) pev->body += (iValue - iCurrent) * pbodypart->base; } -/* <15a6d> ../cstrike/dlls/animation.cpp:545 */ int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup) { studiohdr_t *pstudiohdr = (studiohdr_t *)pmodel; @@ -541,7 +526,6 @@ int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup) return iCurrent; } -/* <15aed> ../cstrike/dlls/animation.cpp:605 */ C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_interface_s **ppinterface, struct engine_studio_api_s *pstudio, float *rotationmatrix, float *bonetransform) { if (version != SV_BLENDING_INTERFACE_VERSION) @@ -560,7 +544,6 @@ C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_inte return 1; } -/* <15ba5> ../cstrike/dlls/animation.cpp:630 */ #ifdef REGAMEDLL_FIXES // SSE2 version void AngleQuaternion(vec_t *angles, vec_t *quaternion) { @@ -605,16 +588,16 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion) float ftmp2; angle = angles[ROLL] * 0.5; - sy = sin(angle); - cy = cos(angle); + sy = Q_sin(angle); + cy = Q_cos(angle); angle = angles[YAW] * 0.5; - sp_ = sin(angle); - cp = cos(angle); + sp_ = Q_sin(angle); + cp = Q_cos(angle); angle = angles[PITCH] * 0.5; - sr = sin(angle); - cr = cos(angle); + sr = Q_sin(angle); + cr = Q_cos(angle); ftmp0 = sr * cp; ftmp1 = cr * sp_; @@ -628,7 +611,6 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion) } #endif // REGAMEDLL_FIXES -/* <15c4d> ../cstrike/dlls/animation.cpp:653 */ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt) { int i; @@ -654,13 +636,13 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt) { if ((1.0 - cosom) > 0.00000001) { - float_precision cosomega = acos((float_precision)cosom); + float_precision cosomega = Q_acos(float_precision(cosom)); float omega = cosomega; - float sinom = sin(cosomega); + float sinom = Q_sin(cosomega); - sclp = sin((1.0 - t) * omega) / sinom; - sclq = sin((float_precision)(omega * t)) / sinom; + sclp = Q_sin((1.0 - t) * omega) / sinom; + sclq = Q_sin(float_precision(omega * t)) / sinom; } else { @@ -678,15 +660,14 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt) qt[2] = -q[3]; qt[3] = q[2]; - sclp = sin((1.0 - t) * 0.5 * M_PI); - sclq = sin(t * 0.5 * M_PI); + sclp = Q_sin((1.0 - t) * 0.5 * M_PI); + sclq = Q_sin(t * 0.5 * M_PI); for (i = 0; i < 3; ++i) qt[i] = sclp * p[i] + sclq * qt[i]; } } -/* <15cd0> ../cstrike/dlls/animation.cpp:700 */ void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4]) { matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2]; @@ -702,7 +683,6 @@ void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4]) matrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1]; } -/* <15d12> ../cstrike/dlls/animation.cpp:715 */ mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc) { mstudioseqgroup_t *pseqgroup; @@ -731,7 +711,6 @@ mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc) return (mstudioanim_t *)((byte *)paSequences[ pseqdesc->seqgroup ].data + pseqdesc->animindex); } -/* <15d90> ../cstrike/dlls/animation.cpp:749 */ mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int index) { mstudioanim_t *panim = StudioGetAnim(model, pseqdesc); @@ -741,7 +720,6 @@ mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int i return panim; } -/* <151a9> ../cstrike/dlls/animation.cpp:770 */ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen) { int i, j; @@ -758,7 +736,7 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b // check for 360% wrapping if (pbonecontroller[j].type & STUDIO_RLOOP) { - if (abs(pcontroller1[i] - pcontroller2[i]) > 128) + if (Q_abs(pcontroller1[i] - pcontroller2[i]) > 128) { int a, b; a = (pcontroller1[j] + 128) % 256; @@ -767,7 +745,7 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b } else { - value = ((pcontroller1[i] * dadt + (pcontroller2[i]) * (1.0 - dadt))) * (360.0 / 256.0) + pbonecontroller[j].start; + value = (pcontroller1[i] * dadt + (pcontroller2[i]) * (1.0 - dadt)) * (360.0 / 256.0) + pbonecontroller[j].start; } } else @@ -808,7 +786,6 @@ void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const b } } -/* <15ea6> ../cstrike/dlls/animation.cpp:828 */ void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q) { int j, k; @@ -890,7 +867,6 @@ void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioan AngleQuaternion(angle1, q); } -/* <15f94> ../cstrike/dlls/animation.cpp:908 */ void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos) { int j, k; @@ -944,7 +920,6 @@ void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioani } } -/* <1603c> ../cstrike/dlls/animation.cpp:970 */ void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3], float s) { int i; @@ -974,7 +949,6 @@ void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3], } } -/* <160de> ../cstrike/dlls/animation.cpp:994 */ void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s) { int i; @@ -984,12 +958,11 @@ void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, flo { j = chain[i]; - StudioCalcBoneQuaterion((int)f, s, &pbones[j], &panim[j], adj, q[j]); - StudioCalcBonePosition((int)f, s, &pbones[j], &panim[j], adj, pos[j]); + StudioCalcBoneQuaterion(int(f), s, &pbones[j], &panim[j], adj, q[j]); + StudioCalcBonePosition(int(f), s, &pbones[j], &panim[j], adj, pos[j]); } } -/* <161fd> ../cstrike/dlls/animation.cpp:1006 */ void ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]) { out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0]; @@ -1013,10 +986,9 @@ float_precision StudioEstimateFrame(float frame, mstudioseqdesc_t *pseqdesc) if (pseqdesc->numframes <= 1) return 0; - return (float_precision)(pseqdesc->numframes - 1) * frame / 256; + return float_precision(pseqdesc->numframes - 1) * frame / 256; } -/* <16247> ../cstrike/dlls/animation.cpp:1115 */ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t *angles, const vec_t *origin, const byte *pcontroller, const byte *pblending, int iBone, const edict_t *pEdict) { int i, j; @@ -1063,17 +1035,17 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t } f = StudioEstimateFrame(frame, pseqdesc); - subframe = (int)f; + subframe = int(f); f -= subframe; StudioCalcBoneAdj(0, adj, pcontroller, pcontroller, 0); StudioCalcRotations(pbones, chain, chainlength, adj, pos, q, pseqdesc, panim, subframe, f); - if (pseqdesc->numblends != 9) + if (pseqdesc->numblends != NUM_BLENDING) { if (pseqdesc->numblends > 1) { - float b = (float_precision)pblending[0] / 255.0f; + float b = float_precision(pblending[0]) / 255.0f; pseqdesc = (mstudioseqdesc_t *)((byte *)g_pstudiohdr + g_pstudiohdr->seqindex) + sequence; panim = StudioGetAnim(pModel, pseqdesc); @@ -1215,10 +1187,10 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t VectorCopy(angles, temp_angles); -#ifdef REGAMEDLL_FIXES - if(pEdict != NULL && CBaseEntity::Instance((edict_t*)pEdict)->IsPlayer()) +#ifndef REGAMEDLL_FIXES + if (pEdict != NULL) #else - if(pEdict != NULL) + if (pEdict != NULL && CBaseEntity::Instance(const_cast(pEdict))->IsPlayer()) #endif { temp_angles[1] = UTIL_GetPlayerGaitYaw(ENTINDEX(pEdict)); diff --git a/regamedll/dlls/animation.h b/regamedll/dlls/animation.h index 9134f889..6b42e4d0 100644 --- a/regamedll/dlls/animation.h +++ b/regamedll/dlls/animation.h @@ -32,41 +32,30 @@ #pragma once #endif +#define NUM_BLENDING 9 + #define ANIM_SWIM_1 8 #define ANIM_SWIM_2 9 #define ANIM_FIRST_DEATH_SEQUENCE 101 -#include "com_model.h" -#include "studio.h" -#include "r_studioint.h" +#include "monsterevent.h" + +int IsSoundEvent(int eventNumber); -int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs); int LookupActivity(void *pmodel, entvars_t *pev, int activity); int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity); -NOXREF void GetEyePosition(void *pmodel, float *vecEyePosition); int LookupSequence(void *pmodel, const char *label); -int IsSoundEvent(int eventNumber); -NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName); void GetSequenceInfo(void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed); int GetSequenceFlags(void *pmodel, entvars_t *pev); -int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index); float SetController(void *pmodel, entvars_t *pev, int iController, float flValue); float SetBlending(void *pmodel, entvars_t *pev, int iBlender, float flValue); +void GetEyePosition(void *pmodel, float *vecEyePosition); +void SequencePrecache(void *pmodel, const char *pSequenceName); int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir); void SetBodygroup(void *pmodel, entvars_t *pev, int iGroup, int iValue); int GetBodygroup(void *pmodel, entvars_t *pev, int iGroup); -C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_interface_s **ppinterface, struct engine_studio_api_s *pstudio, float *rotationmatrix, float *bonetransform); -void AngleQuaternion(vec_t *angles, vec_t *quaternion); -void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt); -void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4]); -mstudioanim_t *StudioGetAnim(model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc); -mstudioanim_t *LookupAnimation(model_t *model, mstudioseqdesc_t *pseqdesc, int index); -void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen); -void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q); -void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos); -void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3], float s); -void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s); -void ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]); -void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t *angles, const vec_t *origin, const byte *pcontroller, const byte *pblending, int iBone, const edict_t *pEdict); + +int GetAnimationEvent(void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index); +int ExtractBbox(void *pmodel, int sequence, float *mins, float *maxs); #endif // ANIMATION_H diff --git a/regamedll/dlls/basemonster.h b/regamedll/dlls/basemonster.h index 8b9085b1..e035b9b6 100644 --- a/regamedll/dlls/basemonster.h +++ b/regamedll/dlls/basemonster.h @@ -33,12 +33,9 @@ #endif void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore = 0, int bitsDamageType = 0); -float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity); void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType); void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType); -NOXREF char *vstr(float *v); -/* <48ecff> ../cstrike/dlls/basemonster.h:18 */ class CBaseMonster: public CBaseToggle { public: @@ -54,7 +51,7 @@ public: virtual BOOL HasAlienGibs(); virtual void FadeMonster(); virtual void GibMonster(); - NOXREF virtual Activity GetDeathActivity(); + virtual Activity GetDeathActivity(); virtual void BecomeDead(); virtual BOOL ShouldFadeOnDeath(); virtual int IRelationship(CBaseEntity *pTarget); @@ -89,37 +86,35 @@ public: BOOL FInViewCone_(CBaseEntity *pEntity); BOOL FInViewCone_(const Vector *pOrigin); -#endif // HOOK_GAMEDLL +#endif public: void MakeIdealYaw(Vector vecTarget); - NOXREF Activity GetSmallFlinchActivity(); + Activity GetSmallFlinchActivity(); BOOL ShouldGibMonster(int iGib); void CallGibMonster(); BOOL FCheckAITrigger(); int DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); float DamageForce(float damage); void RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType); - NOXREF void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType); - void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType) - { - ::RadiusDamage2(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * (RANDOM_FLOAT(0.5, 1.5) + 3), iClassIgnore, bitsDamageType); - } - void SetConditions(int iConditions) { m_afConditions |= iConditions; } - void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; } - BOOL HasConditions(int iConditions) { return (m_afConditions & iConditions) ? TRUE : FALSE; } - BOOL HasAllConditions(int iConditions) { return ((m_afConditions & iConditions) == iConditions) ? TRUE : FALSE; } + void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType); + void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType); - void Remember(int iMemory) { m_afMemory |= iMemory; } - void Forget(int iMemory) { m_afMemory &= ~iMemory; } - BOOL HasMemory(int iMemory) { return (m_afMemory & iMemory) ? TRUE : FALSE; } - BOOL HasAllMemories(int iMemory) { return ((m_afMemory & iMemory) == iMemory) ? TRUE : FALSE; } + void SetConditions(int iConditions) { m_afConditions |= iConditions; } + void ClearConditions(int iConditions) { m_afConditions &= ~iConditions; } + BOOL HasConditions(int iConditions) { return (m_afConditions & iConditions) ? TRUE : FALSE; } + BOOL HasAllConditions(int iConditions) { return ((m_afConditions & iConditions) == iConditions) ? TRUE : FALSE; } - void StopAnimation() { pev->framerate = 0.0f; } + void Remember(int iMemory) { m_afMemory |= iMemory; } + void Forget(int iMemory) { m_afMemory &= ~iMemory; } + BOOL HasMemory(int iMemory) { return (m_afMemory & iMemory) ? TRUE : FALSE; } + BOOL HasAllMemories(int iMemory) { return ((m_afMemory & iMemory) == iMemory) ? TRUE : FALSE; } - NOXREF void CorpseFallThink(); - NOXREF CBaseEntity *CheckTraceHullAttack(float flDist, int iDamage, int iDmgType); - NOXREF void MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir); + void StopAnimation() { pev->framerate = 0.0f; } + + void EXPORT CorpseFallThink(); + CBaseEntity *CheckTraceHullAttack(float flDist, int iDamage, int iDmgType); + void MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir); void MonsterUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { m_IdealMonsterState = MONSTERSTATE_ALERT; } void BloodSplat(const Vector &vecSrc, const Vector &vecDir, int HitLocation, int iVelocity); diff --git a/regamedll/dlls/bmodels.cpp b/regamedll/dlls/bmodels.cpp index ba4ec4aa..7b992a4e 100644 --- a/regamedll/dlls/bmodels.cpp +++ b/regamedll/dlls/bmodels.cpp @@ -26,20 +26,16 @@ TYPEDESCRIPTION CPendulum::m_SaveData[] = DEFINE_FIELD(CPendulum, m_start, FIELD_VECTOR), }; -#endif // HOOK_GAMEDLL +#endif // BModelOrigin - calculates origin of a bmodel from absmin/size because all bmodel origins are 0 0 0 - -/* <1c36f> ../cstrike/dlls/bmodels.cpp:43 */ Vector VecBModelOrigin(entvars_t *pevBModel) { return pevBModel->absmin + (pevBModel->size * 0.5); } -/* <1e384> ../cstrike/dlls/bmodels.cpp:63 */ LINK_ENTITY_TO_CLASS(func_wall, CFuncWall); -/* <1d193> ../cstrike/dlls/bmodels.cpp:65 */ void CFuncWall::__MAKE_VHOOK(Spawn)() { pev->angles = g_vecZero; @@ -54,19 +50,16 @@ void CFuncWall::__MAKE_VHOOK(Spawn)() pev->flags |= FL_WORLDBRUSH; } -/* <1d873> ../cstrike/dlls/bmodels.cpp:77 */ void CFuncWall::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { - if (ShouldToggle(useType, (int)(pev->frame))) + if (ShouldToggle(useType, int(pev->frame))) { pev->frame = 1.0 - pev->frame; } } -/* <1e44e> ../cstrike/dlls/bmodels.cpp:96 */ LINK_ENTITY_TO_CLASS(func_wall_toggle, CFuncWallToggle); -/* <1e28f> ../cstrike/dlls/bmodels.cpp:98 */ void CFuncWallToggle::__MAKE_VHOOK(Spawn)() { CFuncWall::Spawn(); @@ -77,7 +70,6 @@ void CFuncWallToggle::__MAKE_VHOOK(Spawn)() } } -/* <1e518> ../cstrike/dlls/bmodels.cpp:106 */ void CFuncWallToggle::TurnOff() { pev->solid = SOLID_NOT; @@ -85,7 +77,6 @@ void CFuncWallToggle::TurnOff() UTIL_SetOrigin(pev, pev->origin); } -/* <1e53a> ../cstrike/dlls/bmodels.cpp:114 */ void CFuncWallToggle::TurnOn() { pev->solid = SOLID_BSP; @@ -93,7 +84,6 @@ void CFuncWallToggle::TurnOn() UTIL_SetOrigin(pev, pev->origin); } -/* <1e55c> ../cstrike/dlls/bmodels.cpp:122 */ BOOL CFuncWallToggle::IsOn() { if (pev->solid == SOLID_NOT) @@ -104,7 +94,6 @@ BOOL CFuncWallToggle::IsOn() return TRUE; } -/* <1e101> ../cstrike/dlls/bmodels.cpp:130 */ void CFuncWallToggle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int status = IsOn(); @@ -118,10 +107,8 @@ void CFuncWallToggle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC } } -/* <1e57d> ../cstrike/dlls/bmodels.cpp:155 */ LINK_ENTITY_TO_CLASS(func_conveyor, CFuncConveyor); -/* <1e1c3> ../cstrike/dlls/bmodels.cpp:156 */ void CFuncConveyor::__MAKE_VHOOK(Spawn)() { SetMovedir(pev); @@ -147,12 +134,10 @@ void CFuncConveyor::__MAKE_VHOOK(Spawn)() } // HACKHACK -- This is ugly, but encode the speed in the rendercolor to avoid adding more data to the network stream - -/* <1e647> ../cstrike/dlls/bmodels.cpp:179 */ void CFuncConveyor::UpdateSpeed(float speed) { // Encode it as an integer with 4 fractional bits - int speedCode = (int)(fabs((float_precision)speed) * 16.0); + int speedCode = int(Q_fabs(float_precision(speed)) * 16.0); if (speed < 0) pev->rendercolor.x = 1; @@ -163,30 +148,26 @@ void CFuncConveyor::UpdateSpeed(float speed) pev->rendercolor.z = (speedCode & 0xFF); } -/* <1e021> ../cstrike/dlls/bmodels.cpp:194 */ void CFuncConveyor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { pev->speed = -pev->speed; UpdateSpeed(pev->speed); } -/* <1e695> ../cstrike/dlls/bmodels.cpp:217 */ LINK_ENTITY_TO_CLASS(func_illusionary, CFuncIllusionary); -/* <1ddc9> ../cstrike/dlls/bmodels.cpp:219 */ void CFuncIllusionary::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { //skin is used for content type if (FStrEq(pkvd->szKeyName, "skin")) { - pev->skin = (int)Q_atof(pkvd->szValue); + pev->skin = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else CBaseToggle::KeyValue(pkvd); } -/* <1d1db> ../cstrike/dlls/bmodels.cpp:230 */ void CFuncIllusionary::__MAKE_VHOOK(Spawn)() { pev->angles = g_vecZero; @@ -203,10 +184,8 @@ void CFuncIllusionary::__MAKE_VHOOK(Spawn)() // MAKE_STATIC(ENT(pev)); } -/* <1e75f> ../cstrike/dlls/bmodels.cpp:262 */ LINK_ENTITY_TO_CLASS(func_monsterclip, CFuncMonsterClip); -/* <1e24f> ../cstrike/dlls/bmodels.cpp:264 */ void CFuncMonsterClip::__MAKE_VHOOK(Spawn)() { CFuncWall::Spawn(); @@ -219,13 +198,10 @@ void CFuncMonsterClip::__MAKE_VHOOK(Spawn)() pev->flags |= FL_MONSTERCLIP; } -/* <1e82c> ../cstrike/dlls/bmodels.cpp:313 */ LINK_ENTITY_TO_CLASS(func_rotating, CFuncRotating); -/* <1d826> ../cstrike/dlls/bmodels.cpp:310 */ IMPLEMENT_SAVERESTORE(CFuncRotating, CBaseEntity); -/* <1dc21> ../cstrike/dlls/bmodels.cpp:315 */ void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "fanfriction")) @@ -275,8 +251,6 @@ void CFuncRotating::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) // "dmg" damage to inflict when blocked (2 default) // REVERSE will cause the it to rotate in the opposite direction. - -/* <1d5c4> ../cstrike/dlls/bmodels.cpp:362 */ void CFuncRotating::__MAKE_VHOOK(Spawn)() { // set final pitch. Must not be PITCH_NORM, since we @@ -375,7 +349,6 @@ void CFuncRotating::__MAKE_VHOOK(Spawn)() Precache(); } -/* <1d28a> ../cstrike/dlls/bmodels.cpp:447 */ void CFuncRotating::__MAKE_VHOOK(Precache)() { char *szSoundFile = (char *)STRING(pev->message); @@ -439,8 +412,6 @@ void CFuncRotating::__MAKE_VHOOK(Precache)() } // Touch - will hurt others based on how fast the brush is spinning - -/* <1dea4> ../cstrike/dlls/bmodels.cpp:517 */ void CFuncRotating::HurtTouch(CBaseEntity *pOther) { entvars_t *pevOther = pOther->pev; @@ -460,7 +431,6 @@ void CFuncRotating::HurtTouch(CBaseEntity *pOther) // RampPitchVol - ramp pitch and volume up to final values, based on difference // between how fast we're going vs how fast we plan to go -/* <1e8f9> ../cstrike/dlls/bmodels.cpp:540 */ void CFuncRotating::RampPitchVol(int fUp) { Vector vecAVel = pev->avelocity; @@ -472,12 +442,12 @@ void CFuncRotating::RampPitchVol(int fUp) int pitch; // get current angular velocity - vecCur = abs((int)(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z))); + vecCur = Q_abs(int(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z))); // get target angular velocity vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z)); vecFinal *= pev->speed; - vecFinal = abs((int)vecFinal); + vecFinal = Q_abs(int(vecFinal)); // calc volume and pitch as % of final vol and pitch fpct = vecCur / vecFinal; @@ -485,7 +455,7 @@ void CFuncRotating::RampPitchVol(int fUp) //if (fUp) //{ // // spinup volume ramps up from 50% max vol - // fvol = m_flVolume * (0.5 + fpct/2.0); + // fvol = m_flVolume * (0.5 + fpct / 2.0); //} //else { @@ -495,7 +465,7 @@ void CFuncRotating::RampPitchVol(int fUp) fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * fpct; - pitch = (int)fpitch; + pitch = int(fpitch); if (pitch == PITCH_NORM) { pitch = PITCH_NORM - 1; @@ -506,8 +476,6 @@ void CFuncRotating::RampPitchVol(int fUp) } // SpinUp - accelerates a non-moving func_rotating up to it's speed - -/* <1ea74> ../cstrike/dlls/bmodels.cpp:585 */ void CFuncRotating::SpinUp() { //rotational velocity @@ -520,9 +488,9 @@ void CFuncRotating::SpinUp() vecAVel = pev->avelocity; // if we've met or exceeded target speed, set target speed and stop thinking - if (abs((int)vecAVel.x) >= abs((int)(pev->movedir.x * pev->speed)) - && abs((int)vecAVel.y) >= abs((int)(pev->movedir.y * pev->speed)) - && abs((int)vecAVel.z) >= abs((int)(pev->movedir.z * pev->speed))) + if (Q_abs(int(vecAVel.x)) >= Q_abs(int(pev->movedir.x * pev->speed)) + && Q_abs(int(vecAVel.y)) >= Q_abs(int(pev->movedir.y * pev->speed)) + && Q_abs(int(vecAVel.z)) >= Q_abs(int(pev->movedir.z * pev->speed))) { // set speed in case we overshot pev->avelocity = pev->movedir * pev->speed; @@ -537,7 +505,6 @@ void CFuncRotating::SpinUp() } } -/* <1e9c3> ../cstrike/dlls/bmodels.cpp:615 */ void CFuncRotating::SpinDown() { //rotational velocity @@ -579,15 +546,12 @@ void CFuncRotating::SpinDown() } } -/* <1d304> ../cstrike/dlls/bmodels.cpp:653 */ void CFuncRotating::Rotate() { pev->nextthink = pev->ltime + 10; } // Rotating Use - when a rotating brush is triggered - -/* <1d60e> ../cstrike/dlls/bmodels.cpp:661 */ void CFuncRotating::RotatingUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // is this a brush that should accelerate and decelerate when turned on/off (fan)? @@ -633,20 +597,14 @@ void CFuncRotating::RotatingUse(CBaseEntity *pActivator, CBaseEntity *pCaller, U } // RotatingBlocked - An entity has blocked the brush - -/* <1d325> ../cstrike/dlls/bmodels.cpp:706 */ void CFuncRotating::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH); } -/* <1eb14> ../cstrike/dlls/bmodels.cpp:747 */ LINK_ENTITY_TO_CLASS(func_pendulum, CPendulum); - -/* <1d7d9> ../cstrike/dlls/bmodels.cpp:761 */ IMPLEMENT_SAVERESTORE(CPendulum, CBaseEntity); -/* <1db2a> ../cstrike/dlls/bmodels.cpp:765 */ void CPendulum::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "distance")) @@ -663,7 +621,6 @@ void CPendulum::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <1d9c7> ../cstrike/dlls/bmodels.cpp:782 */ void CPendulum::__MAKE_VHOOK(Spawn)() { // set the axis of rotation @@ -685,7 +642,7 @@ void CPendulum::__MAKE_VHOOK(Spawn)() pev->speed = 100; // Calculate constant acceleration from speed and distance - m_accel = (pev->speed * pev->speed) / (2 * fabs((float_precision)m_distance)); + m_accel = (pev->speed * pev->speed) / (2 * Q_fabs(float_precision(m_distance))); m_maxSpeed = pev->speed; m_start = pev->angles; m_center = pev->angles + (m_distance * 0.5) * pev->movedir; @@ -705,7 +662,6 @@ void CPendulum::__MAKE_VHOOK(Spawn)() } } -/* <1d8ec> ../cstrike/dlls/bmodels.cpp:821 */ void CPendulum::PendulumUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // Pendulum is moving, stop it and auto-return if necessary @@ -741,7 +697,6 @@ void CPendulum::PendulumUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T } } -/* <1d381> ../cstrike/dlls/bmodels.cpp:852 */ void CPendulum::Stop() { pev->angles = m_start; @@ -750,13 +705,11 @@ void CPendulum::Stop() pev->avelocity = g_vecZero; } -/* <1d3a7> ../cstrike/dlls/bmodels.cpp:861 */ void CPendulum::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { m_time = gpGlobals->time; } -/* <1d533> ../cstrike/dlls/bmodels.cpp:867 */ void CPendulum::Swing() { float delta, dt; @@ -808,7 +761,6 @@ void CPendulum::Swing() } } -/* <1d3f5> ../cstrike/dlls/bmodels.cpp:909 */ void CPendulum::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { entvars_t *pevOther = pOther->pev; @@ -832,7 +784,6 @@ void CPendulum::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) pevOther->velocity = (pevOther->origin - VecBModelOrigin(pev)).Normalize() * damage; } -/* <1da85> ../cstrike/dlls/bmodels.cpp:931 */ void CPendulum::RopeTouch(CBaseEntity *pOther) { entvars_t *pevOther = pOther->pev; diff --git a/regamedll/dlls/bmodels.h b/regamedll/dlls/bmodels.h index 212ac600..c32aa2cd 100644 --- a/regamedll/dlls/bmodels.h +++ b/regamedll/dlls/bmodels.h @@ -56,8 +56,6 @@ #define noiseRunning noise3 // This is just a solid wall if not inhibited - -/* <1c494> ../cstrike/dlls/bmodels.cpp:53 */ class CFuncWall: public CBaseEntity { public: @@ -72,11 +70,10 @@ public: void Spawn_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; -/* <1c4e1> ../cstrike/dlls/bmodels.cpp:86 */ class CFuncWallToggle: public CFuncWall { public: @@ -88,16 +85,14 @@ public: void Spawn_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void TurnOff(); void TurnOn(); BOOL IsOn(); - }; -/* <1c52e> ../cstrike/dlls/bmodels.cpp:147 */ class CFuncConveyor: public CFuncWall { public: @@ -109,16 +104,13 @@ public: void Spawn_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void UpdateSpeed(float speed); - }; // A simple entity that looks solid but lets you walk through it. - -/* <1c65b> ../cstrike/dlls/bmodels.cpp:208 */ class CFuncIllusionary: public CBaseToggle { public: @@ -131,11 +123,10 @@ public: void Spawn_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT SloshTouch(CBaseEntity *pOther); - }; // Monster only clip brush @@ -145,8 +136,6 @@ public: // // otherwise it will be invisible and not solid. This can be used to keep // specific monsters out of certain areas - -/* <1c6a8> ../cstrike/dlls/bmodels.cpp:255 */ class CFuncMonsterClip: public CFuncWall { public: @@ -160,11 +149,10 @@ public: void Spawn_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; -/* <1c6fa> ../cstrike/dlls/bmodels.cpp:274 */ class CFuncRotating: public CBaseEntity { public: @@ -186,7 +174,7 @@ public: int Restore_(CRestore &restore); void Blocked_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT SpinUp(); @@ -199,7 +187,6 @@ public: public: static TYPEDESCRIPTION IMPL(m_SaveData)[5]; -public: float m_flFanFriction; float m_flAttenuation; float m_flVolume; @@ -207,7 +194,6 @@ public: int m_sounds; }; -/* <1c748> ../cstrike/dlls/bmodels.cpp:720 */ class CPendulum: public CBaseEntity { public: @@ -228,7 +214,7 @@ public: void Touch_(CBaseEntity *pOther); void Blocked_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Swing(); @@ -238,9 +224,9 @@ public: // this touch func makes the pendulum a rope void EXPORT RopeTouch(CBaseEntity *pOther); +public: static TYPEDESCRIPTION IMPL(m_SaveData)[8]; -public: float m_accel; // Acceleration float m_distance; float m_time; diff --git a/regamedll/dlls/bot/cs_bot.cpp b/regamedll/dlls/bot/cs_bot.cpp index 0006ee3d..648cfc41 100644 --- a/regamedll/dlls/bot/cs_bot.cpp +++ b/regamedll/dlls/bot/cs_bot.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Return the number of bots following the given player - -/* <2e85c8> ../cstrike/dlls/bot/cs_bot.cpp:24 */ int GetBotFollowCount(CBasePlayer *leader) { int count = 0; @@ -37,8 +35,6 @@ int GetBotFollowCount(CBasePlayer *leader) } // Change movement speed to walking - -/* <2e86df> ../cstrike/dlls/bot/cs_bot.cpp:62 */ void CCSBot::__MAKE_VHOOK(Walk)() { if (m_mustRunTimer.IsElapsed()) @@ -53,8 +49,6 @@ void CCSBot::__MAKE_VHOOK(Walk)() // Return true if jump was started. // This is extended from the base jump to disallow jumping when in a crouch area. - -/* <2e8732> ../cstrike/dlls/bot/cs_bot.cpp:80 */ bool CCSBot::__MAKE_VHOOK(Jump)(bool mustJump) { // prevent jumping if we're crouched, unless we're in a crouchjump area - jump wins @@ -72,8 +66,6 @@ bool CCSBot::__MAKE_VHOOK(Jump)(bool mustJump) // Invoked when injured by something // NOTE: We dont want to directly call Attack() here, or the bots will have super-human reaction times when injured - -/* <2e8e39> ../cstrike/dlls/bot/cs_bot.cpp:97 */ int CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { CBaseEntity *attacker = GetClassPtr((CBaseEntity *)pevInflictor); @@ -151,8 +143,6 @@ int CCSBot::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAtta } // Invoked when killed - -/* <2e8769> ../cstrike/dlls/bot/cs_bot.cpp:171 */ void CCSBot::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) { PrintIfWatched("Killed( attacker = %s )\n", STRING(pevAttacker->netname)); @@ -172,8 +162,6 @@ void CCSBot::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) } // Return true if line segment intersects rectagular volume - -/* <2e7c11> ../cstrike/dlls/bot/cs_bot.cpp:200 */ bool IsIntersectingBox(const Vector *start, const Vector *end, const Vector *boxMin, const Vector *boxMax) { unsigned char startFlags = 0; @@ -220,8 +208,6 @@ bool IsIntersectingBox(const Vector *start, const Vector *end, const Vector *box } // When bot is touched by another entity. - -/* <2e87d9> ../cstrike/dlls/bot/cs_bot.cpp:253 */ void CCSBot::BotTouch(CBaseEntity *other) { // if we have touched a higher-priority player, make way @@ -247,7 +233,7 @@ void CCSBot::BotTouch(CBaseEntity *other) // they are higher priority - make way, unless we're already making way for someone more important if (m_avoid != NULL) { - unsigned int avoidPri = TheCSBots()->GetPlayerPriority(static_cast(static_cast(m_avoid))); + unsigned int avoidPri = TheCSBots()->GetPlayerPriority(static_cast(m_avoid)); if (avoidPri < otherPri) { // ignore 'other' because we're already avoiding someone better @@ -287,7 +273,7 @@ void CCSBot::BotTouch(CBaseEntity *other) if (IsUsingGrenade()) { - EquipBestWeapon(0); + EquipBestWeapon(); return; } @@ -296,12 +282,11 @@ void CCSBot::BotTouch(CBaseEntity *other) } } -/* <2e89e3> ../cstrike/dlls/bot/cs_bot.cpp:335 */ bool CCSBot::IsBusy() const { - if (IsAttacking() || + if (IsAttacking() || IsBuying() || - IsDefusingBomb() || + IsDefusingBomb() || GetTask() == PLANT_BOMB || GetTask() == RESCUE_HOSTAGES || IsSniping()) @@ -312,13 +297,11 @@ bool CCSBot::IsBusy() const return false; } -/* <2e8a0c> ../cstrike/dlls/bot/cs_bot.cpp:351 */ void CCSBot::BotDeathThink() { ; } -/* <2e8a34> ../cstrike/dlls/bot/cs_bot.cpp:358 */ CBasePlayer *CCSBot::FindNearbyPlayer() { CBaseEntity *pEntity = NULL; @@ -333,15 +316,13 @@ CBasePlayer *CCSBot::FindNearbyPlayer() if (!(pEntity->pev->flags & FL_FAKECLIENT)) continue; - return static_cast(pEntity); + return static_cast(pEntity); } return NULL; } // Assign given player as our current enemy to attack - -/* <2e8abd> ../cstrike/dlls/bot/cs_bot.cpp:385 */ void CCSBot::SetEnemy(CBasePlayer *enemy) { if (m_enemy != enemy) @@ -354,8 +335,6 @@ void CCSBot::SetEnemy(CBasePlayer *enemy) // If we are not on the navigation mesh (m_currentArea == NULL), // move towards last known area. // Return false if off mesh. - -/* <2e8af6> ../cstrike/dlls/bot/cs_bot.cpp:400 */ bool CCSBot::StayOnNavMesh() { if (m_currentArea != NULL) @@ -403,7 +382,6 @@ bool CCSBot::StayOnNavMesh() return false; } -/* <2e8c56> ../cstrike/dlls/bot/cs_bot.cpp:450 */ void CCSBot::Panic(CBasePlayer *enemy) { if (IsSurprised()) @@ -424,7 +402,7 @@ void CCSBot::Panic(CBasePlayer *enemy) float size = 100.0f; float_precision shift = RANDOM_FLOAT(-75.0, 75.0); - + if (along > c45) { spot.x = pev->origin.x + dir.x * size + perp.x * shift; @@ -465,7 +443,6 @@ void CCSBot::Panic(CBasePlayer *enemy) PrintIfWatched("Aaaah!\n"); } -/* <2e9047> ../cstrike/dlls/bot/cs_bot.cpp:527 */ bool CCSBot::IsDoingScenario() const { if (cv_bot_defer_to_human.value <= 0.0f) @@ -475,16 +452,12 @@ bool CCSBot::IsDoingScenario() const } // Return true if we noticed the bomb on the ground or on the radar (for T's only) - -/* <2e9070> ../cstrike/dlls/bot/cs_bot.cpp:544 */ bool CCSBot::NoticeLooseBomb() const { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB) + if (TheCSBots()->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB) return false; - CBaseEntity *bomb = ctrl->GetLooseBomb(); + CBaseEntity *bomb = TheCSBots()->GetLooseBomb(); if (bomb != NULL) { @@ -496,16 +469,12 @@ bool CCSBot::NoticeLooseBomb() const } // Return true if can see the bomb lying on the ground - -/* <2e90d4> ../cstrike/dlls/bot/cs_bot.cpp:566 */ bool CCSBot::CanSeeLooseBomb() const { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB) + if (TheCSBots()->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB) return false; - CBaseEntity *bomb = ctrl->GetLooseBomb(); + CBaseEntity *bomb = TheCSBots()->GetLooseBomb(); if (bomb != NULL) { @@ -517,13 +486,9 @@ bool CCSBot::CanSeeLooseBomb() const } // Return true if can see the planted bomb - -/* <2e9140> ../cstrike/dlls/bot/cs_bot.cpp:588 */ bool CCSBot::CanSeePlantedBomb() const { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB) + if (TheCSBots()->GetScenario() != CCSBotManager::SCENARIO_DEFUSE_BOMB) return false; if (!GetGameState()->IsBombPlanted()) @@ -538,8 +503,6 @@ bool CCSBot::CanSeePlantedBomb() const } // Return last enemy that hurt us - -/* <2e918e> ../cstrike/dlls/bot/cs_bot.cpp:610 */ CBasePlayer *CCSBot::GetAttacker() const { if (m_attacker != NULL && m_attacker->IsAlive()) @@ -549,8 +512,6 @@ CBasePlayer *CCSBot::GetAttacker() const } // Immediately jump off of our ladder, if we're on one - -/* <2e91b7> ../cstrike/dlls/bot/cs_bot.cpp:622 */ void CCSBot::GetOffLadder() { if (IsUsingLadder()) @@ -561,8 +522,6 @@ void CCSBot::GetOffLadder() } // Return time when given spot was last checked - -/* <2e91f1> ../cstrike/dlls/bot/cs_bot.cpp:637 */ float CCSBot::GetHidingSpotCheckTimestamp(HidingSpot *spot) const { for (int i = 0; i < m_checkedHidingSpotCount; ++i) @@ -576,8 +535,6 @@ float CCSBot::GetHidingSpotCheckTimestamp(HidingSpot *spot) const // Set the timestamp of the given spot to now. // If the spot is not in the set, overwrite the least recently checked spot. - -/* <2e9240> ../cstrike/dlls/bot/cs_bot.cpp:651 */ void CCSBot::SetHidingSpotCheckTimestamp(HidingSpot *spot) { int leastRecent = 0; @@ -616,8 +573,6 @@ void CCSBot::SetHidingSpotCheckTimestamp(HidingSpot *spot) } // Periodic check of hostage count in case we lost some - -/* <2e92b8> ../cstrike/dlls/bot/cs_bot.cpp:693 */ void CCSBot::UpdateHostageEscortCount() { const float updateInterval = 1.0f; @@ -646,16 +601,12 @@ void CCSBot::UpdateHostageEscortCount() } // Return true if we are outnumbered by enemies - -/* <2e940d> ../cstrike/dlls/bot/cs_bot.cpp:722 */ bool CCSBot::IsOutnumbered() const { return (GetNearbyFriendCount() < GetNearbyEnemyCount() - 1) ? true : false; } // Return number of enemies we are outnumbered by - -/* <2e94a0> ../cstrike/dlls/bot/cs_bot.cpp:731 */ int CCSBot::OutnumberedCount() const { if (IsOutnumbered()) @@ -667,11 +618,8 @@ int CCSBot::OutnumberedCount() const } // Return the closest "important" enemy for the given scenario (bomb carrier, VIP, hostage escorter) - -/* <2e95cb> ../cstrike/dlls/bot/cs_bot.cpp:744 */ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const { - CCSBotManager *ctrl = TheCSBots(); CBasePlayer *nearEnemy = NULL; float nearDist = 999999999.9f; @@ -703,7 +651,7 @@ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const continue; // is it "important" - if (!ctrl->IsImportantPlayer(player)) + if (!TheCSBots()->IsImportantPlayer(player)) continue; // is it closest? @@ -724,8 +672,6 @@ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const } // Sets our current disposition - -/* <2e9719> ../cstrike/dlls/bot/cs_bot.cpp:801 */ void CCSBot::SetDisposition(DispositionType disposition) { m_disposition = disposition; @@ -737,8 +683,6 @@ void CCSBot::SetDisposition(DispositionType disposition) } // Return our current disposition - -/* <2e9762> ../cstrike/dlls/bot/cs_bot.cpp:814 */ CCSBot::DispositionType CCSBot::GetDisposition() const { if (!m_ignoreEnemiesTimer.IsElapsed()) @@ -748,16 +692,12 @@ CCSBot::DispositionType CCSBot::GetDisposition() const } // Ignore enemies for a short durationy - -/* <2e979b> ../cstrike/dlls/bot/cs_bot.cpp:826 */ void CCSBot::IgnoreEnemies(float duration) { m_ignoreEnemiesTimer.Start(duration); } // Increase morale one step - -/* <2e97fc> ../cstrike/dlls/bot/cs_bot.cpp:835 */ void CCSBot::IncreaseMorale() { if (m_morale < EXCELLENT) @@ -767,8 +707,6 @@ void CCSBot::IncreaseMorale() } // Decrease morale one step - -/* <2e9824> ../cstrike/dlls/bot/cs_bot.cpp:845 */ void CCSBot::DecreaseMorale() { if (m_morale > TERRIBLE) @@ -779,13 +717,9 @@ void CCSBot::DecreaseMorale() // Return true if we are acting like a rogue (not listening to teammates, not doing scenario goals) // TODO: Account for morale - -/* <2e984c> ../cstrike/dlls/bot/cs_bot.cpp:857 */ bool CCSBot::IsRogue() const { - CCSBotManager *ctrl = TheCSBots(); - - if (!ctrl->AllowRogues()) + if (!TheCSBots()->AllowRogues()) return false; // periodically re-evaluate our rogue status @@ -799,25 +733,21 @@ bool CCSBot::IsRogue() const m_isRogue = (RANDOM_FLOAT(0, 100) < rogueChance); } - return m_isRogue; + return m_isRogue; } // Return true if we are in a hurry - -/* <2e98f1> ../cstrike/dlls/bot/cs_bot.cpp:882 */ bool CCSBot::IsHurrying() const { if (!m_hurryTimer.IsElapsed()) return true; - CCSBotManager *ctrl = TheCSBots(); - // if the bomb has been planted, we are in a hurry, CT or T (they could be defusing it!) - if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB && ctrl->IsBombPlanted()) + if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB && TheCSBots()->IsBombPlanted()) return true; // if we are a T and hostages are being rescued, we are in a hurry - if (ctrl->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES + if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES && m_iTeam == TERRORIST && GetGameState()->AreAllHostagesBeingRescued()) return true; @@ -826,67 +756,47 @@ bool CCSBot::IsHurrying() const } // Return true if it is the early, "safe", part of the round - -/* <2e9942> ../cstrike/dlls/bot/cs_bot.cpp:906 */ bool CCSBot::IsSafe() const { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->GetElapsedRoundTime() < m_safeTime) + if (TheCSBots()->GetElapsedRoundTime() < m_safeTime) return true; return false; } // Return true if it is well past the early, "safe", part of the round - -/* <2e9987> ../cstrike/dlls/bot/cs_bot.cpp:920 */ bool CCSBot::IsWellPastSafe() const { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->GetElapsedRoundTime() > 1.25f * m_safeTime) + if (TheCSBots()->GetElapsedRoundTime() > 1.25f * m_safeTime) return true; return false; } // Return true if we were in the safe time last update, but not now - -/* <2e99d8> ../cstrike/dlls/bot/cs_bot.cpp:934 */ bool CCSBot::IsEndOfSafeTime() const { return m_wasSafe && !IsSafe(); } // Return the amount of "safe time" we have left - -/* <2e9a3e> ../cstrike/dlls/bot/cs_bot.cpp:943 */ float CCSBot::GetSafeTimeRemaining() const { - CCSBotManager *ctrl = TheCSBots(); - - return m_safeTime - ctrl->GetElapsedRoundTime(); + return m_safeTime - TheCSBots()->GetElapsedRoundTime(); } // Called when enemy seen to adjust safe time for this round - -/* <2e9a8f> ../cstrike/dlls/bot/cs_bot.cpp:954 */ void CCSBot::AdjustSafeTime() { - CCSBotManager *ctrl = TheCSBots(); - // if we spotted an enemy sooner than we thought possible, adjust our notion of "safe" time - if (m_safeTime > ctrl->GetElapsedRoundTime()) + if (m_safeTime > TheCSBots()->GetElapsedRoundTime()) { // since right now is not safe, adjust safe time to be a few seconds ago - m_safeTime = ctrl->GetElapsedRoundTime() - 2.0f; + m_safeTime = TheCSBots()->GetElapsedRoundTime() - 2.0f; } } // Return true if we haven't seen an enemy for "a long time" - -/* <2e9ad0> ../cstrike/dlls/bot/cs_bot.cpp:970 */ bool CCSBot::HasNotSeenEnemyForLongTime() const { const float longTime = 30.0f; @@ -894,16 +804,13 @@ bool CCSBot::HasNotSeenEnemyForLongTime() const } // Pick a random zone and hide near it - -/* <2e9b26> ../cstrike/dlls/bot/cs_bot.cpp:980 */ bool CCSBot::GuardRandomZone(float range) { - CCSBotManager *ctrl = TheCSBots(); - const CCSBotManager::Zone *zone = ctrl->GetRandomZone(); + const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone(); if (zone != NULL) { - CNavArea *rescueArea = ctrl->GetRandomAreaInZone(zone); + CNavArea *rescueArea = TheCSBots()->GetRandomAreaInZone(zone); if (rescueArea != NULL) { Hide(rescueArea, -1.0f, range); @@ -916,8 +823,6 @@ bool CCSBot::GuardRandomZone(float range) // Do a breadth-first search to find a good retreat spot. // Don't pick a spot that a Player is currently occupying. - -/* <2e9c1f> ../cstrike/dlls/bot/cs_bot.cpp:1066 */ const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange) { CNavArea *area = me->GetLastKnownArea(); @@ -938,8 +843,6 @@ const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange) // Return euclidean distance to farthest escorted hostage. // Return -1 if no hostage is following us. - -/* <2eaa1d> ../cstrike/dlls/bot/cs_bot.cpp:1116 */ float CCSBot::GetRangeToFarthestEscortedHostage() const { FarthestHostage away(this); diff --git a/regamedll/dlls/bot/cs_bot.h b/regamedll/dlls/bot/cs_bot.h index 0aac498b..4c6a65e9 100644 --- a/regamedll/dlls/bot/cs_bot.h +++ b/regamedll/dlls/bot/cs_bot.h @@ -56,16 +56,15 @@ extern int _navAreaCount; extern int _currentIndex; -extern struct BuyInfo primaryWeaponBuyInfoCT[ PRIMARY_WEAPON_BUY_COUNT ]; -extern struct BuyInfo secondaryWeaponBuyInfoCT[ SECONDARY_WEAPON_BUY_COUNT ]; +extern struct BuyInfo primaryWeaponBuyInfoCT[PRIMARY_WEAPON_BUY_COUNT]; +extern struct BuyInfo secondaryWeaponBuyInfoCT[SECONDARY_WEAPON_BUY_COUNT]; -extern struct BuyInfo primaryWeaponBuyInfoT[ PRIMARY_WEAPON_BUY_COUNT ]; -extern struct BuyInfo secondaryWeaponBuyInfoT[ SECONDARY_WEAPON_BUY_COUNT ]; +extern struct BuyInfo primaryWeaponBuyInfoT[PRIMARY_WEAPON_BUY_COUNT]; +extern struct BuyInfo secondaryWeaponBuyInfoT[SECONDARY_WEAPON_BUY_COUNT]; class CCSBot; class BotChatterInterface; -/* <3327a8> ../cstrike/dlls/bot/cs_bot.h:44 */ class BotState { public: @@ -75,7 +74,6 @@ public: virtual const char *GetName() const = 0; }; -/* <3328b8> ../cstrike/dlls/bot/cs_bot.h:53 */ class IdleState: public BotState { public: @@ -88,10 +86,9 @@ public: void OnEnter_(CCSBot *me); void OnUpdate_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif }; -/* <3328d9> ../cstrike/dlls/bot/cs_bot.h:61 */ class HuntState: public BotState { public: @@ -106,14 +103,13 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif void ClearHuntArea() { m_huntArea = NULL; } private: CNavArea *m_huntArea; }; -/* <3328fb> ../cstrike/dlls/bot/cs_bot.h:75 */ class AttackState: public BotState { public: @@ -128,7 +124,7 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif void SetCrouchAndHold(bool crouch) { m_crouchAndHold = crouch; } void StopAttacking(CCSBot *me); @@ -160,7 +156,6 @@ protected: CountdownTimer m_retreatTimer; }; -/* <332922> ../cstrike/dlls/bot/cs_bot.h:120 */ class InvestigateNoiseState: public BotState { public: @@ -175,14 +170,13 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif private: void AttendCurrentNoise(CCSBot *me); Vector m_checkNoisePosition; }; -/* <332949> ../cstrike/dlls/bot/cs_bot.h:133 */ class BuyState: public BotState { public: @@ -197,7 +191,7 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif private: bool m_isInitialDelay; @@ -211,7 +205,6 @@ private: bool m_buyPistol; }; -/* <332970> ../cstrike/dlls/bot/cs_bot.h:154 */ class MoveToState: public BotState { public: @@ -226,7 +219,7 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif void SetGoalPosition(const Vector &pos) { m_goalPosition = pos; } void SetRouteType(RouteType route) { m_routeType = route; } @@ -238,7 +231,6 @@ private: bool m_askedForCover; }; -/* <332997> ../cstrike/dlls/bot/cs_bot.h:171 */ class FetchBombState: public BotState { public: @@ -251,11 +243,10 @@ public: void OnEnter_(CCSBot *me); void OnUpdate_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif }; -/* <3329be> ../cstrike/dlls/bot/cs_bot.h:179 */ class PlantBombState: public BotState { public: @@ -270,11 +261,10 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif }; -/* <3329e5> ../cstrike/dlls/bot/cs_bot.h:188 */ class DefuseBombState: public BotState { public: @@ -289,10 +279,9 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif }; -/* <332a0c> ../cstrike/dlls/bot/cs_bot.h:197 */ class HideState: public BotState { public: @@ -307,19 +296,19 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif public: - void SetHidingSpot(const Vector &pos) { m_hidingSpot = pos; } - const Vector &GetHidingSpot() const { return m_hidingSpot; } + void SetHidingSpot(const Vector &pos) { m_hidingSpot = pos; } + const Vector &GetHidingSpot() const { return m_hidingSpot; } - void SetSearchArea(CNavArea *area) { m_searchFromArea = area; } - void SetSearchRange(float range) { m_range = range; } + void SetSearchArea(CNavArea *area) { m_searchFromArea = area; } + void SetSearchRange(float range) { m_range = range; } - void SetDuration(float time) { m_duration = time; } - void SetHoldPosition(bool hold) { m_isHoldingPosition = hold; } + void SetDuration(float time) { m_duration = time; } + void SetHoldPosition(bool hold) { m_isHoldingPosition = hold; } - bool IsAtSpot() const { return m_isAtSpot; } + bool IsAtSpot() const { return m_isAtSpot; } private: CNavArea *m_searchFromArea; @@ -337,7 +326,6 @@ private: Vector m_leaderAnchorPos; }; -/* <332a33> ../cstrike/dlls/bot/cs_bot.h:234 */ class EscapeFromBombState: public BotState { public: @@ -352,11 +340,10 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif }; -/* <332a5a> ../cstrike/dlls/bot/cs_bot.h:243 */ class FollowState: public BotState { public: @@ -371,11 +358,13 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif void SetLeader(CBaseEntity *leader) { m_leader = leader; } +#ifndef HOOK_GAMEDLL private: +#endif void ComputeLeaderMotionState(float leaderSpeed); EHANDLE m_leader; @@ -405,7 +394,6 @@ private: CountdownTimer m_idleTimer; }; -/* <332a81> ../cstrike/dlls/bot/cs_bot.h:282 */ class UseEntityState: public BotState { public: @@ -420,7 +408,7 @@ public: void OnUpdate_(CCSBot *me); void OnExit_(CCSBot *me); -#endif // HOOK_GAMEDLL +#endif void SetEntity(CBaseEntity *entity) { m_entity = entity; } @@ -429,8 +417,6 @@ private: }; // The Counter-strike Bot - -/* <32b267> ../cstrike/dlls/bot/cs_bot.h:300 */ class CCSBot: public CBot { public: @@ -478,7 +464,7 @@ public: bool IsEnemyPartVisible_(VisiblePartType part) const; void RoundRespawn_(); -#endif // HOOK_GAMEDLL +#endif public: void Disconnect(); @@ -494,7 +480,7 @@ public: bool IsEndOfSafeTime() const; // return true if we were in the safe time last update, but not now float GetSafeTimeRemaining() const; // return the amount of "safe time" we have left float GetSafeTime() const; // return what we think the total "safe time" for this map is - NOXREF bool IsUnhealthy() const; // returns true if bot is low on health + //bool IsUnhealthy() const; // returns true if bot is low on health // behaviors void Idle(); @@ -639,7 +625,7 @@ public: CNavArea *GetNoiseArea() const; // return area where noise was heard void ForgetNoise(); // clear the last heard noise bool CanSeeNoisePosition() const; // return true if we directly see where we think the noise came from - NOXREF float GetNoiseRange() const; // return approximate distance to last noise heard + float GetNoiseRange() const; // return approximate distance to last noise heard bool CanHearNearbyEnemyGunfire(float range = -1.0f) const; // return true if we hear nearby threatening enemy gunfire within given range (-1 == infinite) PriorityType GetNoisePriority() const; // return priority of last heard noise @@ -706,14 +692,14 @@ public: #define NO_SPEED_CHANGE false PathResult UpdatePathMovement(bool allowSpeedChange = true); // move along our computed path - if allowSpeedChange is true, bot will walk when near goal to ensure accuracy - NOXREF bool AStarSearch(CNavArea *startArea, CNavArea *goalArea); // find shortest path from startArea to goalArea - don't actually buid the path + bool AStarSearch(CNavArea *startArea, CNavArea *goalArea); // find shortest path from startArea to goalArea - don't actually buid the path bool ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route); // compute path to goal position bool StayOnNavMesh(); CNavArea *GetLastKnownArea() const; // return the last area we know we were inside of const Vector &GetPathEndpoint() const; // return final position of our current path float GetPathDistanceRemaining() const; // eturn estimated distance left to travel along path void ResetStuckMonitor(); - NOXREF bool IsAreaVisible(CNavArea *area) const; // is any portion of the area visible to this bot + bool IsAreaVisible(CNavArea *area) const; // is any portion of the area visible to this bot const Vector &GetPathPosition(int numpath) const; bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL); // find "simple" ground height, treating current nav area as part of the floor @@ -759,7 +745,7 @@ public: // approach points void ComputeApproachPoints(); // determine the set of "approach points" representing where the enemy can enter this region - NOXREF void UpdateApproachPoints(); // recompute the approach point set if we have moved far enough to invalidate the current ones + void UpdateApproachPoints(); // recompute the approach point set if we have moved far enough to invalidate the current ones void ClearApproachPoints(); void DrawApproachPoints(); // for debugging float GetHidingSpotCheckTimestamp(HidingSpot *spot) const; // return time when given spot was last checked @@ -815,7 +801,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif friend class CCSBotManager; // TODO: Get rid of these @@ -874,7 +860,7 @@ private: Vector m_goalPosition; EHANDLE m_goalEntity; void MoveTowardsPosition(const Vector *pos); // move towards position, independant of view angle - NOXREF void MoveAwayFromPosition(const Vector *pos); // move away from position, independant of view angle + void MoveAwayFromPosition(const Vector *pos); // move away from position, independant of view angle void StrafeAwayFromPosition(const Vector *pos); // strafe (sidestep) away from position, independant of view angle void StuckCheck(); // check if we have become stuck @@ -895,7 +881,7 @@ private: Vector pos; // our movement goal position at this point in the path const CNavLadder *ladder; // if "how" refers to a ladder, this is it } - m_path[ MAX_PATH_LENGTH ]; + m_path[MAX_PATH_LENGTH]; int m_pathLength; int m_pathIndex; float m_areaEnteredTimestamp; @@ -993,12 +979,12 @@ private: float m_peripheralTimestamp; enum { MAX_APPROACH_POINTS = 16 }; - Vector m_approachPoint[ MAX_APPROACH_POINTS ]; + Vector m_approachPoint[MAX_APPROACH_POINTS]; unsigned char m_approachPointCount; Vector m_approachPointViewPosition; // the position used when computing current approachPoint set bool BendLineOfSight(const Vector *eye, const Vector *point, Vector *bend) const; // "bend" our line of sight until we can see the target point. Return bend point, false if cant bend. - NOXREF bool FindApproachPointNearestPath(Vector *pos); // find the approach point that is nearest to our current path, ahead of us + bool FindApproachPointNearestPath(Vector *pos); // find the approach point that is nearest to our current path, ahead of us bool m_isWaitingToTossGrenade; // lining up throw CountdownTimer m_tossGrenadeTimer; // timeout timer for grenade tossing @@ -1013,7 +999,7 @@ private: HidingSpot *spot; float timestamp; } - m_checkedHidingSpot[ MAX_CHECKED_SPOTS ]; + m_checkedHidingSpot[MAX_CHECKED_SPOTS]; int m_checkedHidingSpotCount; // view angle mechanism @@ -1052,7 +1038,7 @@ private: float timestamp; bool isEnemy; } - m_watchInfo[ MAX_CLIENTS ]; + m_watchInfo[MAX_CLIENTS]; mutable EHANDLE m_bomber; // points to bomber if we can see him int m_nearbyFriendCount; // number of nearby teammates @@ -1082,7 +1068,7 @@ private: bool isReloading; bool isProtectedByShield; } - m_enemyQueue[ MAX_ENEMY_QUEUE ]; // round-robin queue for simulating reaction times + m_enemyQueue[MAX_ENEMY_QUEUE]; // round-robin queue for simulating reaction times byte m_enemyQueueIndex; byte m_enemyQueueCount; @@ -1099,7 +1085,7 @@ private: float m_stuckJumpTimestamp; // time for next jump when stuck enum { MAX_VEL_SAMPLES = 5 }; - float m_avgVel[ MAX_VEL_SAMPLES ]; + float m_avgVel[MAX_VEL_SAMPLES]; int m_avgVelIndex; int m_avgVelCount; Vector m_lastOrigin; @@ -1154,129 +1140,113 @@ private: }; // Inlines - -/* <51934c> ../cstrike/dlls/bot/cs_bot.h:316 */ inline float CCSBot::GetCombatRange() const { return m_combatRange; } -/* <58de9b> ../cstrike/dlls/bot/cs_bot.h:318 */ inline void CCSBot::SetRogue(bool rogue) { m_isRogue = rogue; } -/* <519617> ../cstrike/dlls/bot/cs_bot.h:320 */ inline void CCSBot::Hurry(float duration) { m_hurryTimer.Start(duration); } -/* <5a0773> ../cstrike/dlls/bot/cs_bot.h:326 */ inline float CCSBot::GetSafeTime() const { return m_safeTime; } -/* <5c4b10> ../cstrike/dlls/bot/cs_bot.h:355 */ inline bool CCSBot::IsCarryingBomb() const { return m_bHasC4; } -/* <5a07aa> ../cstrike/dlls/bot/cs_bot.h:369 */ inline bool CCSBot::IsFollowing() const { return m_isFollowing; } -/* <57bf57> ../cstrike/dlls/bot/cs_bot.h:370 */ inline CBasePlayer *CCSBot::GetFollowLeader() { return m_leader; } -/* <3c5a20> ../cstrike/dlls/bot/cs_bot.h:375 */ inline float CCSBot::GetFollowDuration() const { return gpGlobals->time - m_followTimestamp; } -/* <3c5a39> ../cstrike/dlls/bot/cs_bot.h:376 */ inline bool CCSBot::CanAutoFollow() const { return (gpGlobals->time > m_allowAutoFollowTime); } -/* <3c5a52> ../cstrike/dlls/bot/cs_bot.h:381 */ inline void CCSBot::AimAtEnemy() { m_isAimingAtEnemy = true; } -/* <3c5a70> ../cstrike/dlls/bot/cs_bot.h:382 */ inline void CCSBot::StopAiming() { m_isAimingAtEnemy = false; } -/* <3c5a89> ../cstrike/dlls/bot/cs_bot.h:383 */ inline bool CCSBot::IsAimingAtEnemy() const { return m_isAimingAtEnemy; } -/* <3e9c5e> ../cstrike/dlls/bot/cs_bot.h:385 */ inline bool CCSBot::IsSurprised() const { - return gpGlobals->time - m_surpriseTimestamp < 5.0f; + if (gpGlobals->time - m_surpriseTimestamp < 5.0f) + return true; + + return false; } -/* <3ea00d> ../cstrike/dlls/bot/cs_bot.h:386 */ inline float CCSBot::GetSurpriseDelay() const { - return gpGlobals->time - IsSurprised() ? m_surpriseDelay : 0.0f; + if (!IsSurprised()) + return 0.0f; + + return m_surpriseDelay; } -/* <51938e> ../cstrike/dlls/bot/cs_bot.h:387 */ inline void CCSBot::ClearSurpriseDelay() { m_surpriseDelay = 0.0f; m_surpriseTimestamp = 0.0f; } -/* <5e2f12> ../cstrike/dlls/bot/cs_bot.h:389 */ inline float CCSBot::GetStateTimestamp() const { return m_stateTimestamp; } -/* <5c4c60> ../cstrike/dlls/bot/cs_bot.h:394 */ inline CSGameState *CCSBot::GetGameState() { return &m_gameState; } -/* <2e7d45> ../cstrike/dlls/bot/cs_bot.h:395 */ inline const CSGameState *CCSBot::GetGameState() const { return &m_gameState; } -/* <5c4ce8> ../cstrike/dlls/bot/cs_bot.h:397 */ inline bool CCSBot::IsAtBombsite() { return (m_signals.GetState() & SIGNAL_BOMB) == SIGNAL_BOMB; } -/* <5a07c3> ../cstrike/dlls/bot/cs_bot.h:453 */ inline CCSBot::MoraleType CCSBot::GetMorale() const { return m_morale; } -/* <5b2dba> ../cstrike/dlls/bot/cs_bot.h:459 */ inline bool CCSBot::IsNoiseHeard() const { if (m_noiseTimestamp <= 0.0f) @@ -1289,214 +1259,179 @@ inline bool CCSBot::IsNoiseHeard() const return false; } -/* <5d3f92> ../cstrike/dlls/bot/cs_bot.h:426 */ inline void CCSBot::SetTask(TaskType task, CBaseEntity *entity) { m_task = task; m_taskEntity = entity; } -/* <5e2f30> ../cstrike/dlls/bot/cs_bot.h:427 */ inline CCSBot::TaskType CCSBot::GetTask() const { return m_task; } -/* <5c4c42> ../cstrike/dlls/bot/cs_bot.h:428 */ inline CBaseEntity *CCSBot::GetTaskEntity() { return m_taskEntity; } -/* <5b2d33> ../cstrike/dlls/bot/cs_bot.h:474 */ inline CNavArea *CCSBot::GetNoiseArea() const { return m_noiseArea; } -/* <5b2d51> ../cstrike/dlls/bot/cs_bot.h:475 */ inline void CCSBot::ForgetNoise() { m_noiseTimestamp = 0.0f; } -/* <5b2d6f> ../cstrike/dlls/bot/cs_bot.h:487 */ inline PriorityType CCSBot::GetNoisePriority() const { return m_noisePriority; } -/* <5c4ccf> ../cstrike/dlls/bot/cs_bot.h:491 */ inline BotChatterInterface *CCSBot::GetChatter() { return &m_chatter; } -/* <111238> ../cstrike/dlls/bot/cs_bot.h:508 */ inline bool CCSBot::IsUsingVoice() const { return (m_voiceFeedbackEndTimestamp != 0.0f); } -/* <519493> ../cstrike/dlls/bot/cs_bot.h:513 */ inline CBasePlayer *CCSBot::GetEnemy() { return m_enemy; } -/* <57bfbd> ../cstrike/dlls/bot/cs_bot.h:514 */ inline int CCSBot::GetNearbyEnemyCount() const { return Q_min(GetEnemiesRemaining(), m_nearbyEnemyCount); } -/* <2fecad> ../cstrike/dlls/bot/cs_bot.h:515 */ inline unsigned int CCSBot::GetEnemyPlace() const { return m_enemyPlace; } -/* <2eff13> ../cstrike/dlls/bot/cs_bot.h:516 */ inline bool CCSBot::CanSeeBomber() const { return (m_bomber == NULL) ? false : true; } -/* <3c6110> ../cstrike/dlls/bot/cs_bot.h:517 */ inline CBasePlayer *CCSBot::GetBomber() const { return m_bomber; } -/* <2fecc8> ../cstrike/dlls/bot/cs_bot.h:519 */ inline int CCSBot::GetNearbyFriendCount() const { return Q_min(GetFriendsRemaining(), m_nearbyFriendCount); } -/* <3a138c> ../cstrike/dlls/bot/cs_bot.h:521 */ inline CBasePlayer *CCSBot::GetClosestVisibleFriend() const { return m_closestVisibleFriend; } -/* <3c615b> ../cstrike/dlls/bot/cs_bot.h:521 */ inline CBasePlayer *CCSBot::GetClosestVisibleHumanFriend() const { return m_closestVisibleHumanFriend; } -/* <57bfd6> ../cstrike/dlls/bot/cs_bot.h:536 */ inline float CCSBot::GetTimeSinceAttacked() const { return gpGlobals->time - m_attackedTimestamp; } -/* <56ae2c> ../cstrike/dlls/bot/cs_bot.h:537 */ inline float CCSBot::GetFirstSawEnemyTimestamp() const { return m_firstSawEnemyTimestamp; } -/* <58df07> ../cstrike/dlls/bot/cs_bot.h:538 */ inline float CCSBot::GetLastSawEnemyTimestamp() const { return m_lastSawEnemyTimestamp; } -/* <3e9ccc> ../cstrike/dlls/bot/cs_bot.h:539 */ inline float CCSBot::GetTimeSinceLastSawEnemy() const { return gpGlobals->time - m_lastSawEnemyTimestamp; } -/* <3e9ce5> ../cstrike/dlls/bot/cs_bot.h:540 */ inline float CCSBot::GetTimeSinceAcquiredCurrentEnemy() const { return gpGlobals->time - m_currentEnemyAcquireTimestamp; } -/* <5196d7> ../cstrike/dlls/bot/cs_bot.h:542 */ inline const Vector &CCSBot::GetLastKnownEnemyPosition() const { return m_lastEnemyPosition; } -/* <5e2f49> ../cstrike/dlls/bot/cs_bot.h:543 */ inline bool CCSBot::IsEnemyVisible() const { return m_isEnemyVisible; } -/* <519429> ../cstrike/dlls/bot/cs_bot.h:544 */ inline float CCSBot::GetEnemyDeathTimestamp() const { return m_enemyDeathTimestamp; } -/* <519442> ../cstrike/dlls/bot/cs_bot.h:547 */ inline int CCSBot::GetLastVictimID() const { return m_lastVictimID; } -/* <5b2da1> ../cstrike/dlls/bot/cs_bot.h:550 */ inline bool CCSBot::HasPath() const { return m_pathLength != 0; } -/* <5a07f5> ../cstrike/dlls/bot/cs_bot.h:551 */ inline void CCSBot::DestroyPath() { m_pathLength = 0; m_pathLadder = NULL; } -/* <5a0813> ../cstrike/dlls/bot/cs_bot.h:567 */ inline CNavArea *CCSBot::GetLastKnownArea() const { return m_lastKnownArea; } -/* <51963c> ../cstrike/dlls/bot/cs_bot.h:568 */ inline const Vector &CCSBot::GetPathEndpoint() const { - return m_path[ m_pathLength - 1 ].pos; + return m_path[m_pathLength - 1].pos; } -/* <5c1be3> ../cstrike/dlls/bot/cs_bot.h:571 */ inline const Vector &CCSBot::GetPathPosition(int numpath) const { - return m_path[ numpath ].pos; + return m_path[numpath].pos; } -/* <5c4b79> ../cstrike/dlls/bot/cs_bot.h:577 */ inline bool CCSBot::IsUsingLadder() const { return m_pathLadder != NULL; } -/* <5a0c27> ../cstrike/dlls/bot/cs_bot.h:580 */ inline void CCSBot::SetGoalEntity(CBaseEntity *entity) { m_goalEntity = entity; } -/* <5c4d01> ../cstrike/dlls/bot/cs_bot.h:581 */ inline CBaseEntity *CCSBot::GetGoalEntity() { return m_goalEntity; } -/* <5195f2> ../cstrike/dlls/bot/cs_bot.h:586 */ inline void CCSBot::ForceRun(float duration) { Run(); m_mustRunTimer.Start(duration); } -/* <3d8238> ../cstrike/dlls/bot/cs_bot.h:598 */ inline void CCSBot::SetLookAngles(float yaw, float pitch) { m_lookYaw = yaw; @@ -1508,13 +1443,11 @@ inline void CCSBot::SetForwardAngle(float angle) m_forwardAngle = angle; } -/* <57c008> ../cstrike/dlls/bot/cs_bot.h:609 */ inline void CCSBot::SetLookAheadAngle(float angle) { m_lookAheadAngle = angle; } -/* <5e2f62> ../cstrike/dlls/bot/cs_bot.h:612 */ inline void CCSBot::ClearLookAt() { //PrintIfWatched("ClearLookAt()\n"); @@ -1522,7 +1455,6 @@ inline void CCSBot::ClearLookAt() m_lookAtDesc = NULL; } -/* <3d8287> ../cstrike/dlls/bot/cs_bot.h:618 */ inline bool CCSBot::IsLookingAtSpot(PriorityType pri) const { if (m_lookAtSpotState != NOT_LOOKING_AT_SPOT && m_lookAtSpotPriority >= pri) @@ -1531,7 +1463,6 @@ inline bool CCSBot::IsLookingAtSpot(PriorityType pri) const return false; } -/* <3e9d59> ../cstrike/dlls/bot/cs_bot.h:625 */ inline bool CCSBot::IsViewMoving(float angleVelThreshold) const { if (m_lookYawVel < angleVelThreshold && m_lookYawVel > -angleVelThreshold && @@ -1539,34 +1470,30 @@ inline bool CCSBot::IsViewMoving(float angleVelThreshold) const { return false; } + return true; } -/* <57c047> ../cstrike/dlls/bot/cs_bot.h:651 */ inline void CCSBot::ClearApproachPoints() { m_approachPointCount = 0; } -/* <3e9d7e> ../cstrike/dlls/bot/cs_bot.h:674 */ inline bool CCSBot::IsThrowingGrenade() const { return m_isWaitingToTossGrenade; } -/* <3e9d97> ../cstrike/dlls/bot/cs_bot.h:679 */ inline void CCSBot::StartRapidFire() { m_isRapidFiring = true; } -/* <3e9db0> ../cstrike/dlls/bot/cs_bot.h:680 */ inline void CCSBot::StopRapidFire() { m_isRapidFiring = false; } -/* <51954d> ../cstrike/dlls/bot/cs_bot.h:684 */ inline CCSBot::ZoomType CCSBot::GetZoomLevel() const { if (m_iFOV > 60.0f) @@ -1578,26 +1505,22 @@ inline CCSBot::ZoomType CCSBot::GetZoomLevel() const return HIGH_ZOOM; } -/* <5c4b92> ../cstrike/dlls/bot/cs_bot.h:698 */ inline int CCSBot::GetHostageEscortCount() const { return m_hostageEscortCount; } -/* <5e2f80> ../cstrike/dlls/bot/cs_bot.h:699 */ inline void CCSBot::IncreaseHostageEscortCount() { ++m_hostageEscortCount; } -/* <5a0c4d> ../cstrike/dlls/bot/cs_bot.h:701 */ inline void CCSBot::ResetWaitForHostagePatience() { m_isWaitingForHostage = false; m_inhibitWaitingForHostageTimer.Invalidate(); } -/* <5d402a> ../cstrike/dlls/bot/cs_bot.h:1055 */ inline float CCSBot::GetFeetZ() const { if (IsCrouching()) @@ -1612,7 +1535,6 @@ inline float CCSBot::GetFeetZ() const } } -/* <5b2dd3> ../cstrike/dlls/bot/cs_bot.h:1063 */ inline const Vector *CCSBot::GetNoisePosition() const { if (m_noiseTimestamp > 0.0f) @@ -1621,7 +1543,6 @@ inline const Vector *CCSBot::GetNoisePosition() const return NULL; } -/* <519655> ../cstrike/dlls/bot/cs_bot.h:1071 */ inline bool CCSBot::IsAwareOfEnemyDeath() const { if (GetEnemyDeathTimestamp() == 0.0f) @@ -1636,7 +1557,6 @@ inline bool CCSBot::IsAwareOfEnemyDeath() const return false; } -/* <568b12> ../cstrike/dlls/bot/cs_bot.h:1085 */ inline bool CCSBot::IsNotMoving() const { const float stillSpeed = 10.0f; @@ -1648,7 +1568,6 @@ inline bool CCSBot::HasAnyAmmo(CBasePlayerWeapon *weapon) const return (weapon->m_iClip != 0 || m_rgAmmo[weapon->m_iPrimaryAmmoType] > 0); } -/* <2e8465> ../cstrike/dlls/bot/cs_bot.cpp:1004 */ class CollectRetreatSpotsFunctor { public: @@ -1697,7 +1616,7 @@ public: if (owner != NULL && m_me->m_iTeam != owner->m_iTeam) continue; - m_spot[ m_count++ ] = spot->GetPosition(); + m_spot[m_count++] = spot->GetPosition(); } // if we've filled up, stop searching @@ -1710,11 +1629,10 @@ public: CCSBot *m_me; float m_range; - const Vector *m_spot[ MAX_SPOTS ]; + const Vector *m_spot[MAX_SPOTS]; int m_count; }; -/* <2e7f9f> ../cstrike/dlls/bot/cs_bot.cpp:1088 */ class FarthestHostage { public: @@ -1736,26 +1654,6 @@ public: } return true; - - /*if (hostage->pev->takedamage != DAMAGE_YES) - return true; - - if (hostage->m_improv != NULL) - { - if (!hostage->IsFollowingSomeone() || m_me != hostage->GetLeader()) - return true; - } - else if (!hostage->IsFollowing(m_me)) - return true; - - float range = (hostage->Center() - m_me->pev->origin).Length(); - - if (range > m_farRange) - { - m_farRange = range; - } - - return true;*/ } const CCSBot *m_me; @@ -1763,8 +1661,6 @@ public: }; // Functor used with NavAreaBuildPath() - -/* <5a0af3> ../cstrike/dlls/bot/cs_bot.h:1114 */ class PathCost { public: @@ -1892,7 +1788,7 @@ public: { // cost is proportional to the density of teammates in this area const float costPerFriendPerUnit = 50000.0f; - cost += costPerFriendPerUnit * (float)area->GetPlayerCount(m_bot->m_iTeam, m_bot) / size; + cost += costPerFriendPerUnit * float(area->GetPlayerCount(m_bot->m_iTeam, m_bot)) / size; } } @@ -1907,7 +1803,6 @@ private: RouteType m_route; }; -/* <568fae> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:95 */ class FollowTargetCollector { public: @@ -1941,8 +1836,6 @@ public: } enum { MAX_TARGET_AREAS = 128 }; - - /* <568dc3> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:124 */ bool operator()(CNavArea *area) { if (m_targetAreaCount >= MAX_TARGET_AREAS) @@ -1953,7 +1846,7 @@ public: { if (m_forward.IsZero()) { - m_targetArea[ m_targetAreaCount++ ] = area; + m_targetArea[m_targetAreaCount++] = area; } else { @@ -1963,7 +1856,7 @@ public: //if (DotProduct(to, m_forward) > 0.7071f) if ((to.x * m_forward.x + to.y * m_forward.y) > 0.7071f) - m_targetArea[ m_targetAreaCount++ ] = area; + m_targetArea[m_targetAreaCount++] = area; } } @@ -1973,7 +1866,7 @@ public: CBasePlayer *m_player; Vector2D m_forward; Vector2D m_cutoff; - CNavArea *m_targetArea[ MAX_TARGET_AREAS ]; + CNavArea *m_targetArea[MAX_TARGET_AREAS]; int m_targetAreaCount; }; diff --git a/regamedll/dlls/bot/cs_bot_chatter.cpp b/regamedll/dlls/bot/cs_bot_chatter.cpp index 8b3e6dda..0cb35a0e 100644 --- a/regamedll/dlls/bot/cs_bot_chatter.cpp +++ b/regamedll/dlls/bot/cs_bot_chatter.cpp @@ -11,9 +11,8 @@ CBaseEntity *g_pSelectedZombieSpawn = NULL; CountdownTimer BotChatterInterface::m_encourageTimer; IntervalTimer BotChatterInterface::m_radioSilenceInterval[ 2 ]; -#endif // HOOK_GAMEDLL +#endif -/* <303469> ../cstrike/dlls/bot/cs_bot_chatter.cpp:32 */ const Vector *GetRandomSpotAtPlace(Place place) { int count = 0; @@ -45,8 +44,6 @@ const Vector *GetRandomSpotAtPlace(Place place) } // Transmit meme to other bots - -/* <303541> ../cstrike/dlls/bot/cs_bot_chatter.cpp:62 */ void BotMeme::Transmit(CCSBot *sender) const { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -89,8 +86,6 @@ void BotMeme::Transmit(CCSBot *sender) const } // A teammate called for help - respond - -/* <301f03> ../cstrike/dlls/bot/cs_bot_chatter.cpp:104 */ void BotHelpMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { const float maxHelpRange = 3000.0f; // 2000 @@ -98,8 +93,6 @@ void BotHelpMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) cons } // A teammate reported information about a bombsite - -/* <306b4f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:114 */ void BotBombsiteStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { // remember this bombsite's status @@ -120,8 +113,6 @@ void BotBombsiteStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *rece } // A teammate reported information about the bomb - -/* <306ab6> ../cstrike/dlls/bot/cs_bot_chatter.cpp:137 */ void BotBombStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { // update our gamestate based on teammate's report @@ -152,8 +143,6 @@ void BotBombStatusMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver } // A teammate has asked that we follow him - -/* <302c87> ../cstrike/dlls/bot/cs_bot_chatter.cpp:167 */ void BotFollowMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { if (receiver->IsRogue()) @@ -180,8 +169,6 @@ void BotFollowMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) co } // A teammate has asked us to defend a place - -/* <302759> ../cstrike/dlls/bot/cs_bot_chatter.cpp:200 */ void BotDefendHereMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { if (receiver->IsRogue()) @@ -213,8 +200,6 @@ void BotDefendHereMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver } // A teammate has asked where the bomb is planted - -/* <3082a5> ../cstrike/dlls/bot/cs_bot_chatter.cpp:234 */ void BotWhereBombMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { int zone = receiver->GetGameState()->GetPlantedBombsite(); @@ -224,16 +209,12 @@ void BotWhereBombMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) } // A teammate has asked us to report in - -/* <30a56e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:246 */ void BotRequestReportMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { receiver->GetChatter()->ReportingIn(); } // A teammate told us all the hostages are gone - -/* <3025b5> ../cstrike/dlls/bot/cs_bot_chatter.cpp:256 */ void BotAllHostagesGoneMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { receiver->GetGameState()->AllHostagesGone(); @@ -243,8 +224,6 @@ void BotAllHostagesGoneMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *rec } // A teammate told us a CT is talking to a hostage - -/* <3029a9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:269 */ void BotHostageBeingTakenMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *receiver) const { receiver->GetGameState()->HostageWasTaken(); @@ -259,13 +238,11 @@ void BotHostageBeingTakenMeme::__MAKE_VHOOK(Interpret)(CCSBot *sender, CCSBot *r receiver->GetChatter()->Say("Affirmative"); } -/* <303609> ../cstrike/dlls/bot/cs_bot_chatter.cpp:285 */ BotSpeakable::BotSpeakable() { m_phrase = NULL; } -/* <303655> ../cstrike/dlls/bot/cs_bot_chatter.cpp:291 */ BotSpeakable::~BotSpeakable() { if (m_phrase != NULL) @@ -275,7 +252,6 @@ BotSpeakable::~BotSpeakable() } } -/* <30ba3b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:303 */ BotPhrase::BotPhrase(unsigned int id, bool isPlace) { m_name = NULL; @@ -290,12 +266,11 @@ BotPhrase::BotPhrase(unsigned int id, bool isPlace) InitVoiceBank(0); } -/* <3036c2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:314 */ BotPhrase::~BotPhrase() { - for (uint32 bank = 0; bank < m_voiceBank.size(); ++bank) + for (size_t bank = 0; bank < m_voiceBank.size(); ++bank) { - for (uint32 speakable = 0; speakable < m_voiceBank[bank]->size(); ++speakable) + for (size_t speakable = 0; speakable < m_voiceBank[bank]->size(); ++speakable) { delete (*m_voiceBank[bank])[speakable]; } @@ -303,10 +278,12 @@ BotPhrase::~BotPhrase() } if (m_name != NULL) - delete [] m_name; + { + delete[] m_name; + m_name = NULL; + } } -/* <30b837> ../cstrike/dlls/bot/cs_bot_chatter.cpp:326 */ void BotPhrase::InitVoiceBank(int bankIndex) { while (m_numVoiceBanks <= bankIndex) @@ -319,8 +296,6 @@ void BotPhrase::InitVoiceBank(int bankIndex) } // Return a random speakable - avoid repeating - -/* <303917> ../cstrike/dlls/bot/cs_bot_chatter.cpp:340 */ char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const { if (bankIndex < 0 || bankIndex >= m_numVoiceBanks || m_count[bankIndex] == 0) @@ -376,19 +351,16 @@ char *BotPhrase::GetSpeakable(int bankIndex, float *duration) const } // Randomly shuffle the speakable order - -/* <30395a> ../cstrike/dlls/bot/cs_bot_chatter.cpp:395 */ #ifndef HOOK_GAMEDLL void BotPhrase::Randomize() { - for (uint32 i = 0; i < m_voiceBank.size(); ++i) + for (size_t i = 0; i < m_voiceBank.size(); ++i) { std::random_shuffle(m_voiceBank[i]->begin(), m_voiceBank[i]->end()); } } -#endif // HOOK_GAMEDLL +#endif -/* <303b3f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:409 */ BotPhraseManager::BotPhraseManager() { for (int i = 0; i < MAX_PLACES_PER_MAP; ++i) @@ -398,16 +370,12 @@ BotPhraseManager::BotPhraseManager() } // Invoked when map changes - -/* <303c45> ../cstrike/dlls/bot/cs_bot_chatter.cpp:417 */ void BotPhraseManager::OnMapChange() { m_placeCount = 0; } // Invoked when the round resets - -/* <303c70> ../cstrike/dlls/bot/cs_bot_chatter.cpp:425 */ void BotPhraseManager::OnRoundRestart() { // effectively reset all interval timers @@ -427,8 +395,6 @@ void BotPhraseManager::OnRoundRestart() } // Initialize phrase system from database file - -/* <30c1fc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:443 */ bool BotPhraseManager::Initialize(const char *filename, int bankIndex) { bool isDefault = (bankIndex == 0); @@ -672,44 +638,27 @@ bool BotPhraseManager::Initialize(const char *filename, int bankIndex) } FREE_FILE(phraseDataFile); - return true; } -/* <30409e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:682 */ BotPhraseManager::~BotPhraseManager() { BotPhraseList::iterator iter; for (iter = m_list.begin(); iter != m_list.end(); ++iter) - { - const BotPhrase *phrase = *iter; - - if (phrase != NULL) - { - delete phrase; - } - } + delete (*iter); for (iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) - { - const BotPhrase *phrase = *iter; - - if (phrase != NULL) - { - delete phrase; - } - } + delete (*iter); m_list.clear(); m_placeList.clear(); } -/* <3043ec> ../cstrike/dlls/bot/cs_bot_chatter.cpp:708 */ Place BotPhraseManager::NameToID(const char *name) const { for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (!Q_stricmp(phrase->m_name, name)) return phrase->m_id; @@ -717,7 +666,7 @@ Place BotPhraseManager::NameToID(const char *name) const for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (!Q_stricmp(phrase->m_name, name)) return phrase->m_id; @@ -726,12 +675,11 @@ Place BotPhraseManager::NameToID(const char *name) const return 0; } -/* <3044b4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:732 */ const char *BotPhraseManager::IDToName(Place id) const { for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (phrase->m_id == id) return phrase->m_name; @@ -739,7 +687,7 @@ const char *BotPhraseManager::IDToName(Place id) const for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (phrase->m_id == id) return phrase->m_name; @@ -749,13 +697,11 @@ const char *BotPhraseManager::IDToName(Place id) const } // Given a name, return the associated phrase collection - -/* <304597> ../cstrike/dlls/bot/cs_bot_chatter.cpp:758 */ const BotPhrase *BotPhraseManager::GetPhrase(const char *name) const { for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (!Q_stricmp(phrase->m_name, name)) return phrase; @@ -765,15 +711,14 @@ const BotPhrase *BotPhraseManager::GetPhrase(const char *name) const return NULL; } +/* // Given an id, return the associated phrase collection // TODO: Store phrases in a vector to make this fast - -/* const BotPhrase *BotPhraseManager::GetPhrase(unsigned int id) const { for (BotPhraseList::const_iterator iter = m_list.begin(); iter != m_list.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (phrase->m_id == id) return phrase; @@ -785,8 +730,6 @@ const BotPhrase *BotPhraseManager::GetPhrase(unsigned int id) const */ // Given a name, return the associated Place phrase collection - -/* <304654> ../cstrike/dlls/bot/cs_bot_chatter.cpp:793 */ const BotPhrase *BotPhraseManager::GetPlace(const char *name) const { if (name == NULL) @@ -794,7 +737,7 @@ const BotPhrase *BotPhraseManager::GetPlace(const char *name) const for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (!Q_stricmp(phrase->m_name, name)) return phrase; @@ -804,8 +747,6 @@ const BotPhrase *BotPhraseManager::GetPlace(const char *name) const } // Given a place, return the associated Place phrase collection - -/* <3046eb> ../cstrike/dlls/bot/cs_bot_chatter.cpp:811 */ const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const { if (place == UNDEFINED_PLACE) @@ -813,7 +754,7 @@ const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const for (BotPhraseList::const_iterator iter = m_placeList.begin(); iter != m_placeList.end(); ++iter) { - const BotPhrase *phrase = *iter; + const BotPhrase *phrase = (*iter); if (phrase->m_id == place) return phrase; @@ -822,7 +763,6 @@ const BotPhrase *BotPhraseManager::GetPlace(PlaceCriteria place) const return NULL; } -/* <30477e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:830 */ BotStatement::BotStatement(BotChatterInterface *chatter, BotStatementType type, float expireDuration) { m_chatter = chatter; @@ -847,32 +787,27 @@ BotStatement::BotStatement(BotChatterInterface *chatter, BotStatementType type, m_conditionCount = 0; } -/* <3047bd> ../cstrike/dlls/bot/cs_bot_chatter.cpp:855 */ BotStatement::~BotStatement() { if (m_meme != NULL) { delete m_meme; + m_meme = NULL; } } -/* <3047e0> ../cstrike/dlls/bot/cs_bot_chatter.cpp:863 */ CCSBot *BotStatement::GetOwner() const { return m_chatter->GetOwner(); } // Attach a meme to this statement, to be transmitted to other friendly bots when spoken - -/* <304803> ../cstrike/dlls/bot/cs_bot_chatter.cpp:872 */ void BotStatement::AttachMeme(BotMeme *meme) { m_meme = meme; } // Add a conditions that must be true for the statement to be spoken - -/* <30482f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:881 */ void BotStatement::AddCondition(ConditionType condition) { if (m_conditionCount < MAX_BOT_CONDITIONS) @@ -880,8 +815,6 @@ void BotStatement::AddCondition(ConditionType condition) } // Return true if this statement is "important" and not personality chatter - -/* <30485b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:891 */ bool BotStatement::IsImportant() const { // if a statement contains any important phrases, it is important @@ -899,8 +832,6 @@ bool BotStatement::IsImportant() const } // Verify all attached conditions - -/* <3048bc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:911 */ bool BotStatement::IsValid() const { for (int i = 0; i < m_conditionCount; ++i) @@ -932,8 +863,6 @@ bool BotStatement::IsValid() const } // Return true if this statement is essentially the same as the given one - -/* <30492d> ../cstrike/dlls/bot/cs_bot_chatter.cpp:950 */ bool BotStatement::IsRedundant(const BotStatement *say) const { // special cases @@ -970,8 +899,6 @@ bool BotStatement::IsRedundant(const BotStatement *say) const } // Return true if this statement is no longer appropriate to say - -/* <304977> ../cstrike/dlls/bot/cs_bot_chatter.cpp:990 */ bool BotStatement::IsObsolete() const { // if the round is over, the only things we should say are emotes @@ -995,8 +922,6 @@ bool BotStatement::IsObsolete() const } // Possibly change what were going to say base on what teammate is saying - -/* <3049b6> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1008 */ void BotStatement::Convert(const BotStatement *say) { if (GetType() == REPORT_MY_PLAN && say->GetType() == REPORT_MY_PLAN) @@ -1025,7 +950,6 @@ void BotStatement::Convert(const BotStatement *say) } } -/* <304a7c> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1037 */ void BotStatement::AppendPhrase(const BotPhrase *phrase) { if (phrase == NULL) @@ -1039,8 +963,6 @@ void BotStatement::AppendPhrase(const BotPhrase *phrase) } // Special phrases that depend on the context - -/* <304acf> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1052 */ void BotStatement::AppendPhrase(ContextType contextPhrase) { if (m_count < MAX_BOT_PHRASES) @@ -1052,8 +974,6 @@ void BotStatement::AppendPhrase(ContextType contextPhrase) // Say our statement // m_index refers to the phrase currently being spoken, or -1 if we havent started yet - -/* <304b22> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1065 */ bool BotStatement::Update() { CCSBot *me = GetOwner(); @@ -1249,8 +1169,6 @@ bool BotStatement::Update() // If this statement refers to a specific place, return that place // Places can be implicit in the statement, or explicitly defined - -/* <2fee36> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1266 */ Place BotStatement::GetPlace() const { // return any explicitly set place if we have one @@ -1268,8 +1186,6 @@ Place BotStatement::GetPlace() const } // Return true if this statement has an associated count - -/* <305289> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1283 */ bool BotStatement::HasCount() const { for (int i = 0; i < m_count; ++i) @@ -1285,7 +1201,6 @@ enum PitchHack { P_HI, P_NORMAL, P_LOW }; static int nextPitch = P_HI; -/* <305543> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1308 */ BotChatterInterface::BotChatterInterface(CCSBot *me) { m_me = me; @@ -1308,7 +1223,6 @@ BotChatterInterface::BotChatterInterface(CCSBot *me) Reset(); } -/* <305307> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1334 */ BotChatterInterface::~BotChatterInterface() { // free pending statements @@ -1321,8 +1235,6 @@ BotChatterInterface::~BotChatterInterface() } // Reset to initial state - -/* <305386> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1347 */ void BotChatterInterface::Reset() { BotStatement *msg, *nextMsg; @@ -1354,8 +1266,6 @@ void BotChatterInterface::Reset() } // Register a statement for speaking - -/* <305661> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1381 */ void BotChatterInterface::AddStatement(BotStatement *statement, bool mustAdd) { // don't add statements if bot chatter is shut off @@ -1443,8 +1353,6 @@ void BotChatterInterface::AddStatement(BotStatement *statement, bool mustAdd) } // Remove a statement - -/* <3056fa> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1462 */ void BotChatterInterface::RemoveStatement(BotStatement *statement) { if (statement->m_next != NULL) @@ -1459,8 +1367,6 @@ void BotChatterInterface::RemoveStatement(BotStatement *statement) } // Track nearby enemy count and report enemy activity - -/* <3087ee> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1479 */ void BotChatterInterface::ReportEnemies() { if (!m_me->IsAlive()) @@ -1492,15 +1398,12 @@ void BotChatterInterface::ReportEnemies() } } -/* <305743> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1515 */ void BotChatterInterface::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { ; } // Invoked when we die - -/* <30579e> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1524 */ void BotChatterInterface::OnDeath() { if (IsTalking()) @@ -1524,8 +1427,6 @@ void BotChatterInterface::OnDeath() } // Process ongoing chatter for this bot - -/* <308852> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1549 */ void BotChatterInterface::Update() { // report enemy activity @@ -1605,8 +1506,6 @@ void BotChatterInterface::Update() } // Returns the statement that is being spoken, or is next to be spoken if no-one is speaking now - -/* <305915> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1635 */ BotStatement *BotChatterInterface::GetActiveStatement() { // keep track of statement waiting longest to be spoken - it is next @@ -1664,8 +1563,6 @@ BotStatement *BotChatterInterface::GetActiveStatement() } // Return true if we speaking makes sense now - -/* <305a35> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1694 */ bool BotChatterInterface::ShouldSpeak() const { // don't talk to non-existent friends @@ -1679,27 +1576,22 @@ bool BotChatterInterface::ShouldSpeak() const return true; } -/* <305a8f> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1708 */ float BotChatterInterface::GetRadioSilenceDuration() { return IMPL(m_radioSilenceInterval)[ m_me->m_iTeam - 1 ].GetElapsedTime(); } -/* <305b15> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1714 */ void BotChatterInterface::ResetRadioSilenceDuration() { IMPL(m_radioSilenceInterval)[m_me->m_iTeam - 1].Reset(); } -/* <305d7b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1732 */ inline void SayWhere(BotStatement *say, Place place) { say->AppendPhrase(TheBotPhrases->GetPlace(place)); } // Report enemy sightings - -/* <305b50> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1740 */ void BotChatterInterface::EnemySpotted() { // NOTE: This could be a few seconds out of date (enemy is in an adjacent place) @@ -1718,7 +1610,6 @@ void BotChatterInterface::EnemySpotted() AddStatement(say); } -/* <305da4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1759 */ NOXREF void BotChatterInterface::Clear(Place place) { BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f); @@ -1729,8 +1620,6 @@ NOXREF void BotChatterInterface::Clear(Place place) } // Request enemy activity report - -/* <305ffa> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1773 */ void BotChatterInterface::ReportIn() { BotStatement *say = new BotStatement(this, REPORT_REQUEST_INFORMATION, 10.0f); @@ -1742,11 +1631,8 @@ void BotChatterInterface::ReportIn() } // Report our situtation - -/* <309851> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1788 */ void BotChatterInterface::ReportingIn() { - CCSBotManager *ctrl = TheCSBots(); BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f); // where are we @@ -1768,10 +1654,10 @@ void BotChatterInterface::ReportingIn() } case CCSBot::GUARD_LOOSE_BOMB: { - if (ctrl->GetLooseBomb()) + if (TheCSBots()->GetLooseBomb()) { say->AppendPhrase(TheBotPhrases->GetPhrase("GuardingLooseBomb")); - say->AttachMeme(new BotBombStatusMeme(CSGameState::LOOSE, ctrl->GetLooseBomb()->pev->origin)); + say->AttachMeme(new BotBombStatusMeme(CSGameState::LOOSE, TheCSBots()->GetLooseBomb()->pev->origin)); } break; } @@ -1841,7 +1727,6 @@ void BotChatterInterface::ReportingIn() AddStatement(say); } -/* <3084cf> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1896 */ bool BotChatterInterface::NeedBackup() { const float minRequestInterval = 10.0f; @@ -1873,7 +1758,6 @@ bool BotChatterInterface::NeedBackup() return true; } -/* <3061a8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1929 */ void BotChatterInterface::PinnedDown() { // this is a form of "need backup" @@ -1896,7 +1780,6 @@ void BotChatterInterface::PinnedDown() AddStatement(say); } -/* <3064e2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1952 */ void BotChatterInterface::HeardNoise(const Vector *pos) { if (TheCSBots()->IsRoundOver()) @@ -1920,7 +1803,6 @@ void BotChatterInterface::HeardNoise(const Vector *pos) } } -/* <3066a7> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1978 */ void BotChatterInterface::KilledMyEnemy(int victimID) { // only report if we killed the last enemy in the area @@ -1933,7 +1815,6 @@ void BotChatterInterface::KilledMyEnemy(int victimID) AddStatement(say); } -/* <306853> ../cstrike/dlls/bot/cs_bot_chatter.cpp:1993 */ void BotChatterInterface::EnemiesRemaining() { // only report if we killed the last enemy in the area @@ -1946,7 +1827,6 @@ void BotChatterInterface::EnemiesRemaining() AddStatement(say); } -/* <306974> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2008 */ void BotChatterInterface::Affirmative() { BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f); @@ -1954,7 +1834,6 @@ void BotChatterInterface::Affirmative() AddStatement(say); } -/* <306bb2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2018 */ void BotChatterInterface::Negative() { BotStatement *say = new BotStatement(this, REPORT_ACKNOWLEDGE, 3.0f); @@ -1962,7 +1841,6 @@ void BotChatterInterface::Negative() AddStatement(say); } -/* <306cf4> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2028 */ void BotChatterInterface::GoingToPlantTheBomb(Place place) { if (TheCSBots()->IsRoundOver()) @@ -1981,7 +1859,6 @@ void BotChatterInterface::GoingToPlantTheBomb(Place place) AddStatement(say); } -/* <306ef6> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2050 */ void BotChatterInterface::PlantingTheBomb(Place place) { if (TheCSBots()->IsRoundOver()) @@ -1994,7 +1871,6 @@ void BotChatterInterface::PlantingTheBomb(Place place) AddStatement(say); } -/* <3070c8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2066 */ void BotChatterInterface::TheyPickedUpTheBomb() { if (TheCSBots()->IsRoundOver()) @@ -2014,7 +1890,6 @@ void BotChatterInterface::TheyPickedUpTheBomb() AddStatement(say); } -/* <307272> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2090 */ void BotChatterInterface::SpottedBomber(CBasePlayer *bomber) { if (m_me->GetGameState()->IsBombMoving()) @@ -2044,7 +1919,6 @@ void BotChatterInterface::SpottedBomber(CBasePlayer *bomber) AddStatement(say); } -/* <30761a> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2122 */ void BotChatterInterface::SpottedLooseBomb(CBaseEntity *bomb) { if (TheCSBots()->IsRoundOver()) @@ -2078,7 +1952,6 @@ void BotChatterInterface::SpottedLooseBomb(CBaseEntity *bomb) } } -/* <30795b> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2157 */ NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb) { if (TheCSBots()->IsRoundOver() || !bomb) @@ -2090,7 +1963,7 @@ NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb) return; m_planInterval.Reset(); -#endif // REGAMEDLL_FIXES +#endif // update our gamestate m_me->GetGameState()->UpdateLooseBomb(&bomb->pev->origin); @@ -2110,7 +1983,6 @@ NOXREF void BotChatterInterface::GuardingLooseBomb(CBaseEntity *bomb) AddStatement(say); } -/* <307c56> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2186 */ void BotChatterInterface::RequestBombLocation() { // only ask once per round @@ -2126,7 +1998,6 @@ void BotChatterInterface::RequestBombLocation() AddStatement(say); } -/* <307de2> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2205 */ void BotChatterInterface::BombsiteClear(int zoneIndex) { const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex); @@ -2141,7 +2012,6 @@ void BotChatterInterface::BombsiteClear(int zoneIndex) AddStatement(say); } -/* <3080b8> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2223 */ void BotChatterInterface::FoundPlantedBomb(int zoneIndex) { const CCSBotManager::Zone *zone = TheCSBots()->GetZone(zoneIndex); @@ -2155,7 +2025,6 @@ void BotChatterInterface::FoundPlantedBomb(int zoneIndex) AddStatement(say); } -/* <308308> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2242 */ void BotChatterInterface::Scared() { const float minInterval = 10.0f; @@ -2170,7 +2039,6 @@ void BotChatterInterface::Scared() AddStatement(say); } -/* <308b60> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2259 */ void BotChatterInterface::CelebrateWin() { BotStatement *say = new BotStatement(this, REPORT_EMOTE, 15.0f); @@ -2179,19 +2047,18 @@ void BotChatterInterface::CelebrateWin() say->SetStartTime(gpGlobals->time + RANDOM_FLOAT(2.0f, 5.0f)); const float quickRound = 45.0f; - CCSBotManager *ctrl = TheCSBots(); if (m_me->GetFriendsRemaining() == 0) { // we were the last man standing - if (ctrl->GetElapsedRoundTime() < quickRound) + if (TheCSBots()->GetElapsedRoundTime() < quickRound) say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly")); else if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f) say->AppendPhrase(TheBotPhrases->GetPhrase("LastManStanding")); } else { - if (ctrl->GetElapsedRoundTime() < quickRound) + if (TheCSBots()->GetElapsedRoundTime() < quickRound) { if (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f) say->AppendPhrase(TheBotPhrases->GetPhrase("WonRoundQuickly")); @@ -2205,11 +2072,9 @@ void BotChatterInterface::CelebrateWin() AddStatement(say); } -/* <308e52> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2294 */ void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place) { - CCSBotManager *ctrl = TheCSBots(); - if (ctrl->IsRoundOver()) + if (TheCSBots()->IsRoundOver()) return; BotStatement *say = new BotStatement(this, REPORT_MY_PLAN, 10.0f); @@ -2217,11 +2082,10 @@ void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place) say->SetPlace(place); // wait at least a short time after round start - say->SetStartTime(ctrl->GetRoundStartTime() + RANDOM_FLOAT(2.0, 3.0f)); + say->SetStartTime(TheCSBots()->GetRoundStartTime() + RANDOM_FLOAT(2.0, 3.0f)); AddStatement(say); } -/* <308fdd> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2312 */ void BotChatterInterface::GuardingHostages(Place place, bool isPlan) { if (TheCSBots()->IsRoundOver()) @@ -2233,7 +2097,7 @@ void BotChatterInterface::GuardingHostages(Place place, bool isPlan) #ifdef REGAMEDLL_FIXES m_planInterval.Reset(); -#endif // REGAMEDLL_FIXES +#endif if (isPlan) AnnouncePlan("GoingToGuardHostages", place); @@ -2241,7 +2105,6 @@ void BotChatterInterface::GuardingHostages(Place place, bool isPlan) Say("GuardingHostages"); } -/* <3091eb> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2329 */ void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan) { if (TheCSBots()->IsRoundOver()) @@ -2253,7 +2116,7 @@ void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan) #ifdef REGAMEDLL_FIXES m_planInterval.Reset(); -#endif // REGAMEDLL_FIXES +#endif if (isPlan) AnnouncePlan("GoingToGuardHostageEscapeZone", UNDEFINED_PLACE); @@ -2261,7 +2124,6 @@ void BotChatterInterface::GuardingHostageEscapeZone(bool isPlan) Say("GuardingHostageEscapeZone"); } -/* <3093a9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2346 */ void BotChatterInterface::HostagesBeingTaken() { if (TheCSBots()->IsRoundOver()) @@ -2273,7 +2135,6 @@ void BotChatterInterface::HostagesBeingTaken() AddStatement(say); } -/* <309542> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2361 */ void BotChatterInterface::HostagesTaken() { if (TheCSBots()->IsRoundOver()) @@ -2284,13 +2145,11 @@ void BotChatterInterface::HostagesTaken() AddStatement(say); } -/* <309691> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2375 */ void BotChatterInterface::TalkingToHostages() { ; } -/* <3096bc> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2380 */ void BotChatterInterface::EscortingHostages() { if (TheCSBots()->IsRoundOver()) @@ -2307,7 +2166,6 @@ void BotChatterInterface::EscortingHostages() } } -/* <30a5b9> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2400 */ NOXREF void BotChatterInterface::HostageDown() { if (TheCSBots()->IsRoundOver()) @@ -2318,7 +2176,6 @@ NOXREF void BotChatterInterface::HostageDown() AddStatement(say); } -/* <30a708> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2414 */ void BotChatterInterface::Encourage(const char *phraseName, float repeatInterval, float lifetime) { if (IMPL(m_encourageTimer).IsElapsed()) @@ -2328,7 +2185,6 @@ void BotChatterInterface::Encourage(const char *phraseName, float repeatInterval } } -/* <30a905> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2427 */ void BotChatterInterface::KilledFriend() { BotStatement *say = new BotStatement(this, REPORT_KILLED_FRIEND, 2.0f); @@ -2339,7 +2195,6 @@ void BotChatterInterface::KilledFriend() AddStatement(say); } -/* <30aa67> ../cstrike/dlls/bot/cs_bot_chatter.cpp:2440 */ void BotChatterInterface::FriendlyFire() { BotStatement *say = new BotStatement(this, REPORT_FRIENDLY_FIRE, 1.0f); diff --git a/regamedll/dlls/bot/cs_bot_chatter.h b/regamedll/dlls/bot/cs_bot_chatter.h index 2fef3a8f..3eab9bd4 100644 --- a/regamedll/dlls/bot/cs_bot_chatter.h +++ b/regamedll/dlls/bot/cs_bot_chatter.h @@ -45,8 +45,6 @@ typedef unsigned int CountCriteria; // A meme is a unit information that bots use to // transmit information to each other via the radio - -/* <2fe97b> ../cstrike/dlls/bot/cs_bot_chatter.h:42 */ class BotMeme { public: @@ -63,7 +61,7 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif }; @@ -76,11 +74,10 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif }; -/* <2ff7ef> ../cstrike/dlls/bot/cs_bot_chatter.h:53 */ class BotHelpMeme: public BotMeme { public: @@ -94,13 +91,12 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif private: Place m_place; }; -/* <2ff65e> ../cstrike/dlls/bot/cs_bot_chatter.h:70 */ class BotBombsiteStatusMeme: public BotMeme { public: @@ -117,14 +113,13 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif private: int m_zoneIndex; // the bombsite StatusType m_status; // whether it is cleared or the bomb is there (planted) }; -/* <2ff6de> ../cstrike/dlls/bot/cs_bot_chatter.h:87 */ class BotBombStatusMeme: public BotMeme { public: @@ -141,14 +136,13 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif private: CSGameState::BombState m_state; Vector m_pos; }; -/* <2ff75d> ../cstrike/dlls/bot/cs_bot_chatter.h:101 */ class BotFollowMeme: public BotMeme { public: @@ -158,10 +152,9 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif }; -/* <2ff731> ../cstrike/dlls/bot/cs_bot_chatter.h:111 */ class BotDefendHereMeme: public BotMeme { public: @@ -175,13 +168,12 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif private: Vector m_pos; }; -/* <2ff696> ../cstrike/dlls/bot/cs_bot_chatter.h:123 */ class BotWhereBombMeme: public BotMeme { public: @@ -191,10 +183,9 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif }; -/* <2ff81b> ../cstrike/dlls/bot/cs_bot_chatter.h:130 */ class BotRequestReportMeme: public BotMeme { public: @@ -204,7 +195,7 @@ public: void Interpret_(CCSBot *sender, CCSBot *receiver) const; -#endif // HOOK_GAMEDLL +#endif }; @@ -258,17 +249,17 @@ public: void SetPlaceCriteria(PlaceCriteria place) const; // all returned phrases must have this place criteria void SetCountCriteria(CountCriteria count) const; // all returned phrases must have this count criteria - const char *GetName() const { return m_name; } - Place GetID() const { return m_id; } - GameEventType GetRadioEquivalent() const { return m_radioEvent; } - bool IsImportant() const { return m_isImportant; } // return true if this phrase is part of an important statement + const char *GetName() const { return m_name; } + Place GetID() const { return m_id; } + GameEventType GetRadioEquivalent() const { return m_radioEvent; } + bool IsImportant() const { return m_isImportant; } // return true if this phrase is part of an important statement - bool IsPlace() const { return m_isPlace; } + bool IsPlace() const { return m_isPlace; } void Randomize(); // randomly shuffle the speakable order #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif friend class BotPhraseManager; BotPhrase(unsigned int id, bool isPlace); @@ -292,20 +283,17 @@ private: typedef std::STD_LIST BotPhraseList; -/* <2fea0e> ../cstrike/dlls/bot/cs_bot_chatter.h:239 */ inline void BotPhrase::ClearCriteria() const { m_placeCriteria = ANY_PLACE; m_countCriteria = UNDEFINED_COUNT; } -/* <2fea2a> ../cstrike/dlls/bot/cs_bot_chatter.h:245 */ inline void BotPhrase::SetPlaceCriteria(PlaceCriteria place) const { m_placeCriteria = place; } -/* <2fea52> ../cstrike/dlls/bot/cs_bot_chatter.h:250 */ inline void BotPhrase::SetCountCriteria(CountCriteria count) const { m_countCriteria = count; @@ -338,7 +326,7 @@ public: // given an id, return the associated Place phrase collection const BotPhrase *GetPlace(PlaceCriteria place) const; - const BotPhraseList *GetPlaceList() const { return &m_placeList; } + const BotPhraseList *GetPlaceList() const { return &m_placeList; } // return time last statement of given type was emitted by a teammate for the given place float GetPlaceStatementInterval(Place place) const; @@ -348,7 +336,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif int FindPlaceIndex(Place where) const; @@ -364,11 +352,10 @@ private: IntervalTimer timer; }; - mutable PlaceTimeInfo m_placeStatementHistory[ MAX_PLACES_PER_MAP ]; + mutable PlaceTimeInfo m_placeStatementHistory[MAX_PLACES_PER_MAP]; mutable int m_placeCount; }; -/* <2fea95> ../cstrike/dlls/bot/cs_bot_chatter.h:298 */ inline int BotPhraseManager::FindPlaceIndex(Place where) const { for (int i = 0; i < m_placeCount; ++i) @@ -387,7 +374,6 @@ inline int BotPhraseManager::FindPlaceIndex(Place where) const return -1; } -/* <2ff83d> ../cstrike/dlls/bot/cs_bot_chatter.h:319 */ inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const { int index = FindPlaceIndex(place); @@ -398,10 +384,9 @@ inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const if (index >= m_placeCount) return 999999.9f; - return m_placeStatementHistory[ index ].timer.GetElapsedTime(); + return m_placeStatementHistory[index].timer.GetElapsedTime(); } -/* <2ff876> ../cstrike/dlls/bot/cs_bot_chatter.h:335 */ inline void BotPhraseManager::ResetPlaceStatementInterval(Place place) const { int index = FindPlaceIndex(place); @@ -423,19 +408,19 @@ public: ~BotStatement(); public: - BotChatterInterface *GetChatter() const { return m_chatter; } + BotChatterInterface *GetChatter() const { return m_chatter; } CCSBot *GetOwner() const; - BotStatementType GetType() const { return m_type; } // return the type of statement this is + BotStatementType GetType() const { return m_type; } // return the type of statement this is bool IsImportant() const; // return true if this statement is "important" and not personality chatter - bool HasSubject() const { return (m_subject != UNDEFINED_SUBJECT); } - void SetSubject(int playerID) { m_subject = playerID; } // who this statement is about - int GetSubject() const { return m_subject; } // who this statement is about + bool HasSubject() const { return (m_subject != UNDEFINED_SUBJECT); } + void SetSubject(int playerID) { m_subject = playerID; } // who this statement is about + int GetSubject() const { return m_subject; } // who this statement is about - bool HasPlace() const { return (GetPlace()) ? true : false; } + bool HasPlace() const { return (GetPlace()) ? true : false; } Place GetPlace() const; // if this statement refers to a specific place, return that place - void SetPlace(Place where) { m_place = where; } // explicitly set place + void SetPlace(Place where) { m_place = where; } // explicitly set place bool HasCount() const; // return true if this statement has an associated count @@ -445,8 +430,8 @@ public: void AppendPhrase(const BotPhrase *phrase); - void SetStartTime(float timestamp) { m_startTime = timestamp; } // define the earliest time this statement can be spoken - float GetStartTime() const { return m_startTime; } + void SetStartTime(float timestamp) { m_startTime = timestamp; } // define the earliest time this statement can be spoken + float GetStartTime() const { return m_startTime; } enum ConditionType { @@ -470,8 +455,8 @@ public: void AppendPhrase(ContextType contextPhrase); // special phrases that depend on the context bool Update(); // emit statement over time, return false if statement is done - bool IsSpeaking() const { return m_isSpeaking; } // return true if this statement is currently being spoken - float GetTimestamp() const { return m_timestamp; } // get time statement was created (but not necessarily started talking) + bool IsSpeaking() const { return m_isSpeaking; } // return true if this statement is currently being spoken + float GetTimestamp() const { return m_timestamp; } // get time statement was created (but not necessarily started talking) void AttachMeme(BotMeme *meme); // attach a meme to this statement, to be transmitted to other friendly bots when spoken @@ -506,10 +491,10 @@ public: }; } - m_statement[ MAX_BOT_PHRASES ]; + m_statement[MAX_BOT_PHRASES]; enum { MAX_BOT_CONDITIONS = 4 }; - ConditionType m_condition[ MAX_BOT_CONDITIONS ]; // conditions that must be true for the statement to be said + ConditionType m_condition[MAX_BOT_CONDITIONS]; // conditions that must be true for the statement to be said int m_conditionCount; int m_index; // m_index refers to the phrase currently being spoken, or -1 if we havent started yet @@ -565,7 +550,7 @@ public: void KilledMyEnemy(int victimID); void EnemiesRemaining(); - NOXREF void Clear(Place place); + void Clear(Place place); void ReportIn(); // ask for current situation void ReportingIn(); // report current situation @@ -582,7 +567,7 @@ public: void PlantingTheBomb(Place place); void SpottedBomber(CBasePlayer *bomber); void SpottedLooseBomb(CBaseEntity *bomb); - NOXREF void GuardingLooseBomb(CBaseEntity *bomb); + void GuardingLooseBomb(CBaseEntity *bomb); void RequestBombLocation(); #define IS_PLAN true @@ -592,7 +577,7 @@ public: void HostagesTaken(); void TalkingToHostages(); void EscortingHostages(); - NOXREF void HostageDown(); + void HostageDown(); void CelebrateWin(); @@ -605,7 +590,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif BotStatement *m_statementList; // list of all active/pending messages for this bot void ReportEnemies(); // track nearby enemy count and generate enemy activity statements @@ -632,7 +617,6 @@ private: static CountdownTimer IMPL(m_encourageTimer); // timer to know when we can "encourage" the human player again - shared by all bots }; -/* <2fec2d> ../cstrike/dlls/bot/cs_bot_chatter.h:572 */ inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() const { const char *string = cv_bot_chatter.string; @@ -652,7 +636,6 @@ inline BotChatterInterface::VerbosityType BotChatterInterface::GetVerbosity() co return NORMAL; } -/* <2fec4a> ../cstrike/dlls/bot/cs_bot_chatter.h:590 */ inline bool BotChatterInterface::IsTalking() const { if (m_statementList != NULL) @@ -663,7 +646,6 @@ inline bool BotChatterInterface::IsTalking() const return false; } -/* <3f2bad> ../cstrike/dlls/bot/cs_bot_chatter.h:596 */ inline BotStatement *BotChatterInterface::GetStatement() const { return m_statementList; @@ -672,7 +654,6 @@ inline BotStatement *BotChatterInterface::GetStatement() const extern BotPhraseManager *TheBotPhrases; extern CBaseEntity *g_pSelectedZombieSpawn; -/* <5c4dcf> ../cstrike/dlls/bot/cs_bot_chatter.h:604 */ inline void BotChatterInterface::Say(const char *phraseName, float lifetime, float delay) { BotStatement *say = new BotStatement(this, REPORT_MY_INTENTION, lifetime); diff --git a/regamedll/dlls/bot/cs_bot_event.cpp b/regamedll/dlls/bot/cs_bot_event.cpp index fd9baf17..9f4e2913 100644 --- a/regamedll/dlls/bot/cs_bot_event.cpp +++ b/regamedll/dlls/bot/cs_bot_event.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <31d087> ../cstrike/dlls/bot/cs_bot_event.cpp:22 */ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { GetGameState()->OnEvent(event, entity, other); @@ -47,7 +46,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa CBasePlayer *killer = static_cast(other); // check that attacker is an enemy (for friendly fire, etc) - if (killer && killer->IsPlayer()) + if (killer != NULL && killer->IsPlayer()) { // check if we saw our friend die - dont check FOV - assume we're aware of our surroundings in combat // snipers stay put @@ -75,10 +74,10 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa case EVENT_PLAYER_DIED: { CBasePlayer *victim = player; - CBasePlayer *killer = (other && other->IsPlayer()) ? static_cast(other) : NULL; + CBasePlayer *killer = (other != NULL && other->IsPlayer()) ? static_cast(other) : NULL; // if the human player died in the single player game, tell the team - if (g_pGameRules->IsCareer() && !victim->IsBot() && victim->m_iTeam == m_iTeam) + if (CSGameRules()->IsCareer() && !victim->IsBot() && victim->m_iTeam == m_iTeam) { GetChatter()->Say("CommanderDown", 20.0f); } @@ -136,7 +135,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa if (IsVisible(&victim->pev->origin, CHECK_FOV)) { // congratulate teammates on their kills - if (killer != NULL && killer != this) + if (killer != this) { float delay = RANDOM_FLOAT(2.0f, 3.0f); if (killer->IsBot()) @@ -147,7 +146,7 @@ void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBa else { // humans get the honorific - if (g_pGameRules->IsCareer()) + if (CSGameRules()->IsCareer()) GetChatter()->Say("NiceShotCommander", 3.0f, delay); else GetChatter()->Say("NiceShotSir", 3.0f, delay); diff --git a/regamedll/dlls/bot/cs_bot_init.cpp b/regamedll/dlls/bot/cs_bot_init.cpp index 979a4aa6..836365da 100644 --- a/regamedll/dlls/bot/cs_bot_init.cpp +++ b/regamedll/dlls/bot/cs_bot_init.cpp @@ -35,9 +35,8 @@ cvar_t cv_bot_defer_to_human = { "bot_defer_to_human", "0", FCVAR_SERVER, 0.0f, cvar_t cv_bot_chatter = { "bot_chatter", "normal", FCVAR_SERVER, 0.0f, NULL }; cvar_t cv_bot_profile_db = { "bot_profile_db", "BotProfile.db", FCVAR_SERVER, 0.0f, NULL }; -#endif // HOOK_GAMEDLL +#endif -/* <333bca> ../cstrike/dlls/bot/cs_bot_init.cpp:57 */ void InstallBotControl() { if (TheBots != NULL) @@ -49,8 +48,6 @@ void InstallBotControl() } // Engine callback for custom server commands - -/* <333cb3> ../cstrike/dlls/bot/cs_bot_init.cpp:68 */ void Bot_ServerCommand() { if (TheBots != NULL) @@ -60,10 +57,9 @@ void Bot_ServerCommand() } } -/* <333cec> ../cstrike/dlls/bot/cs_bot_init.cpp:81 */ void Bot_RegisterCvars() { - if (!g_bIsCzeroGame) + if (!AreBotsAllowed()) return; CVAR_REGISTER(&cv_bot_traceview); @@ -98,16 +94,12 @@ void Bot_RegisterCvars() } // Constructor - -/* <333d1e> ../cstrike/dlls/bot/cs_bot_init.cpp:129 */ CCSBot::CCSBot() : m_chatter(this), m_gameState(this) { ; } // Prepare bot for action - -/* <3342ac> ../cstrike/dlls/bot/cs_bot_init.cpp:137 */ bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile) { // extend @@ -134,8 +126,6 @@ bool CCSBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile) } // Reset internal data to initial state - -/* <3341dc> ../cstrike/dlls/bot/cs_bot_init.cpp:167 */ void CCSBot::ResetValues() { m_chatter.Reset(); @@ -282,7 +272,7 @@ void CCSBot::ResetValues() m_enemyQueue[i].isReloading = false; m_enemyQueue[i].isProtectedByShield = false; } -#endif // REGAMEDLL_FIXES +#endif // start in idle state StopAttacking(); @@ -291,13 +281,9 @@ void CCSBot::ResetValues() // Called when bot is placed in map, and when bots are reset after a round ends. // NOTE: For some reason, this can be called twice when a bot is added. - -/* <3342e4> ../cstrike/dlls/bot/cs_bot_init.cpp:336 */ void CCSBot::__MAKE_VHOOK(SpawnBot)() { - CCSBotManager *ctrl = TheCSBots(); - - ctrl->ValidateMapData(); + TheCSBots()->ValidateMapData(); ResetValues(); Q_strcpy(m_name, STRING(pev->netname)); @@ -305,14 +291,13 @@ void CCSBot::__MAKE_VHOOK(SpawnBot)() SetState(&m_buyState); SetTouch(&CCSBot::BotTouch); - if (TheNavAreaList.empty() && !ctrl->IsLearningMap()) + if (TheNavAreaList.empty() && !TheCSBots()->IsLearningMap()) { - ctrl->SetLearningMapFlag(); + TheCSBots()->SetLearningMapFlag(); StartLearnProcess(); } } -/* <3338f7> ../cstrike/dlls/bot/cs_bot_init.cpp:366 */ void CCSBot::__MAKE_VHOOK(RoundRespawn)() { // do the normal player spawn process @@ -320,7 +305,6 @@ void CCSBot::__MAKE_VHOOK(RoundRespawn)() EndVoiceFeedback(); } -/* <334332> ../cstrike/dlls/bot/cs_bot_init.cpp:378 */ void CCSBot::Disconnect() { EndVoiceFeedback(); diff --git a/regamedll/dlls/bot/cs_bot_learn.cpp b/regamedll/dlls/bot/cs_bot_learn.cpp index 679885eb..63f27146 100644 --- a/regamedll/dlls/bot/cs_bot_learn.cpp +++ b/regamedll/dlls/bot/cs_bot_learn.cpp @@ -5,14 +5,12 @@ const float updateTimesliceDuration = 0.5f; int _navAreaCount = 0; int _currentIndex = 0; -/* <343cbe> ../cstrike/dlls/bot/cs_bot_learn.cpp:95 */ inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirType mountDir) { Vector center = *pos; AddDirectionVector(¢er, mountDir, HalfHumanWidth); // Test the ladder dismount point first, then each cardinal direction one and two steps away - for (int d = (-1); d < 2 * NUM_DIRECTIONS; ++d) { Vector tryPos = center; @@ -36,13 +34,12 @@ inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirT TraceResult result; UTIL_TraceLine(center + Vector(0, 0, fudge), tryPos + Vector(0, 0, fudge), ignore_monsters, dont_ignore_glass, ENT(entity->pev), &result); -#ifndef REGAMEDLL_FIXES - if (result.flFraction != 1.0f) + if (result.flFraction != 1.0f +#ifdef REGAMEDLL_FIXES + || result.fStartSolid +#endif + ) continue; -#else - if (result.flFraction != 1.0f || result.fStartSolid) - continue; -#endif // REGAMEDLL_ADD // if no node exists here, create one and continue the search if (CNavNode::GetNode(&tryPos) == NULL) @@ -54,7 +51,6 @@ inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirT return NULL; } -/* <343a56> ../cstrike/dlls/bot/cs_bot_learn.cpp:30 */ CNavNode *CCSBot::AddNode(const Vector *destPos, const Vector *normal, NavDirType dir, CNavNode *source) { // check if a node exists at this location @@ -73,7 +69,7 @@ CNavNode *CCSBot::AddNode(const Vector *destPos, const Vector *normal, NavDirTyp // optimization: if deltaZ changes very little, assume connection is commutative const float zTolerance = 10.0f; // 50.0f; - if (fabs(source->GetPosition()->z - destPos->z) < zTolerance) + if (Q_fabs(source->GetPosition()->z - destPos->z) < zTolerance) { node->ConnectTo(source, OppositeDirection(dir)); node->MarkAsVisited(OppositeDirection(dir)); @@ -119,17 +115,15 @@ CNavNode *CCSBot::AddNode(const Vector *destPos, const Vector *normal, NavDirTyp return node; } -/* <343b40> ../cstrike/dlls/bot/cs_bot_learn.cpp:150 */ void drawProgressMeter(float progress, char *title) { MESSAGE_BEGIN(MSG_ALL, gmsgBotProgress); WRITE_BYTE(FLAG_PROGRESS_DRAW); - WRITE_BYTE((int)progress); + WRITE_BYTE(int(progress * 100.0f)); WRITE_STRING(title); MESSAGE_END(); } -/* <3435ce> ../cstrike/dlls/bot/cs_bot_learn.cpp:159 */ void startProgressMeter(const char *title) { MESSAGE_BEGIN(MSG_ALL, gmsgBotProgress); @@ -138,7 +132,6 @@ void startProgressMeter(const char *title) MESSAGE_END(); } -/* <3435a8> ../cstrike/dlls/bot/cs_bot_learn.cpp:167 */ void hideProgressMeter() { MESSAGE_BEGIN(MSG_ALL, gmsgBotProgress); @@ -146,28 +139,27 @@ void hideProgressMeter() MESSAGE_END(); } -/* <343b63> ../cstrike/dlls/bot/cs_bot_learn.cpp:182 */ void CCSBot::StartLearnProcess() { - startProgressMeter("#CZero_LearningMap"); - drawProgressMeter(0, "#CZero_LearningMap"); - BuildLadders(); - - Vector normal; - Vector pos = pev->origin; - - SnapToGrid(&pos.x); - SnapToGrid(&pos.y); - - if (!GetGroundHeight(&pos, &pos.z, &normal)) - { - CONSOLE_ECHO("ERROR: Start position invalid\n\n"); - m_processMode = PROCESS_NORMAL; - return; - } - - m_currentNode = new CNavNode(&pos, &normal); - m_goalPosition = pev->origin; + startProgressMeter("#CZero_LearningMap"); + drawProgressMeter(0, "#CZero_LearningMap"); + BuildLadders(); + + Vector normal; + Vector pos = pev->origin; + + SnapToGrid(&pos.x); + SnapToGrid(&pos.y); + + if (!GetGroundHeight(&pos, &pos.z, &normal)) + { + CONSOLE_ECHO("ERROR: Start position invalid\n\n"); + m_processMode = PROCESS_NORMAL; + return; + } + + m_currentNode = new CNavNode(&pos, &normal); + m_goalPosition = pev->origin; m_processMode = PROCESS_LEARN; } @@ -176,8 +168,6 @@ void CCSBot::StartLearnProcess() // outwards, tracking all valid steps and generating a directed graph of CNavNodes. // Sample the map one "step" in a cardinal direction to learn the map. // Returns true if sampling needs to continue, or false if done. - -/* <343d37> ../cstrike/dlls/bot/cs_bot_learn.cpp:217 */ bool CCSBot::LearnStep() { // take a step @@ -338,7 +328,7 @@ bool CCSBot::LearnStep() { walkable = false; } -#endif // REGAMEDLL_FIXES +#endif if (walkable) { // we can move here @@ -355,21 +345,19 @@ bool CCSBot::LearnStep() } } -/* <34489e> ../cstrike/dlls/bot/cs_bot_learn.cpp:392 */ void CCSBot::UpdateLearnProcess() { float startTime = g_engfuncs.pfnTime(); while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration) { - if (LearnStep() == false) - { - StartAnalyzeAlphaProcess(); - return; + if (LearnStep() == false) + { + StartAnalyzeAlphaProcess(); + return; } } } -/* <344750> ../cstrike/dlls/bot/cs_bot_learn.cpp:409 */ void CCSBot::StartAnalyzeAlphaProcess() { m_processMode = PROCESS_ANALYZE_ALPHA; @@ -385,7 +373,6 @@ void CCSBot::StartAnalyzeAlphaProcess() drawProgressMeter(0, "#CZero_AnalyzingHidingSpots"); } -/* <34396c> ../cstrike/dlls/bot/cs_bot_learn.cpp:427 */ bool CCSBot::AnalyzeAlphaStep() { ++_currentIndex; @@ -400,26 +387,24 @@ bool CCSBot::AnalyzeAlphaStep() return true; } -/* <3448de> ../cstrike/dlls/bot/cs_bot_learn.cpp:443 */ void CCSBot::UpdateAnalyzeAlphaProcess() { - float startTime = g_engfuncs.pfnTime(); - while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration) - { - if (AnalyzeAlphaStep() == false) - { - drawProgressMeter(50, "#CZero_AnalyzingHidingSpots"); - CleanupApproachAreaAnalysisPrep(); - StartAnalyzeBetaProcess(); - return; - } - } - - float progress = _currentIndex / _navAreaCount * 50.0f; + float startTime = g_engfuncs.pfnTime(); + while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration) + { + if (AnalyzeAlphaStep() == false) + { + drawProgressMeter(0.5f, "#CZero_AnalyzingHidingSpots"); + CleanupApproachAreaAnalysisPrep(); + StartAnalyzeBetaProcess(); + return; + } + } + + float progress = (double(_currentIndex) / double(_navAreaCount)) * 0.5f; drawProgressMeter(progress, "#CZero_AnalyzingHidingSpots"); } -/* <344aed> ../cstrike/dlls/bot/cs_bot_learn.cpp:467 */ void CCSBot::StartAnalyzeBetaProcess() { m_processMode = PROCESS_ANALYZE_BETA; @@ -429,46 +414,42 @@ void CCSBot::StartAnalyzeBetaProcess() _currentIndex = 0; } -/* <3437c8> ../cstrike/dlls/bot/cs_bot_learn.cpp:479 */ bool CCSBot::AnalyzeBetaStep() { - ++_currentIndex; - if (m_analyzeIter == TheNavAreaList.end()) - return false; - - CNavArea *area = (*m_analyzeIter); - area->ComputeSpotEncounters(); - area->ComputeSniperSpots(); - ++m_analyzeIter; - + ++_currentIndex; + if (m_analyzeIter == TheNavAreaList.end()) + return false; + + CNavArea *area = (*m_analyzeIter); + area->ComputeSpotEncounters(); + area->ComputeSniperSpots(); + ++m_analyzeIter; + return true; } -/* <344b8d> ../cstrike/dlls/bot/cs_bot_learn.cpp:495 */ void CCSBot::UpdateAnalyzeBetaProcess() { - float startTime = g_engfuncs.pfnTime(); - while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration) - { - if (AnalyzeBetaStep() == false) - { - drawProgressMeter(100, "#CZero_AnalyzingApproachPoints"); - StartSaveProcess(); - return; - } - } - - float progress = ((_currentIndex / _navAreaCount) + 1.0f) * 50.0f; + float startTime = g_engfuncs.pfnTime(); + while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration) + { + if (AnalyzeBetaStep() == false) + { + drawProgressMeter(1, "#CZero_AnalyzingApproachPoints"); + StartSaveProcess(); + return; + } + } + + float progress = (double(_currentIndex) / double(_navAreaCount) + 1.0f) * 0.5f; drawProgressMeter(progress, "#CZero_AnalyzingApproachPoints"); } -/* <344d1f> ../cstrike/dlls/bot/cs_bot_learn.cpp:517 */ void CCSBot::StartSaveProcess() { m_processMode = PROCESS_SAVE; } -/* <344d41> ../cstrike/dlls/bot/cs_bot_learn.cpp:527 */ void CCSBot::UpdateSaveProcess() { char filename[256]; @@ -489,11 +470,15 @@ void CCSBot::UpdateSaveProcess() hideProgressMeter(); StartNormalProcess(); +#ifndef REGAMEDLL_FIXES Q_sprintf(cmd, "map %s\n", STRING(gpGlobals->mapname)); +#else + Q_sprintf(cmd, "changelevel %s\n", STRING(gpGlobals->mapname)); +#endif + SERVER_COMMAND(cmd); } -/* <344e24> ../cstrike/dlls/bot/cs_bot_learn.cpp:554 */ void CCSBot::StartNormalProcess() { m_processMode = PROCESS_NORMAL; diff --git a/regamedll/dlls/bot/cs_bot_listen.cpp b/regamedll/dlls/bot/cs_bot_listen.cpp index 94171af2..3102b5b5 100644 --- a/regamedll/dlls/bot/cs_bot_listen.cpp +++ b/regamedll/dlls/bot/cs_bot_listen.cpp @@ -2,8 +2,6 @@ // Listen for enemy noises, and determine if we should react to them. // Returns true if heard a noise and should move to investigate. - -/* <354545> ../cstrike/dlls/bot/cs_bot_listen.cpp:17 */ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist) { if (m_isNoiseTravelRangeChecked) @@ -25,7 +23,7 @@ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist) float noiseDist = toNoise.Length(); float const oneStoreyHeight = 120.0f; - if (abs(int64(toNoise.z)) > oneStoreyHeight) + if (Q_abs(int64(toNoise.z)) > oneStoreyHeight) { PathCost pc(this); float travelDistToNoise = NavAreaTravelDistance(m_lastKnownArea, m_noiseArea, pc); @@ -72,8 +70,6 @@ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist) // Return true if we hear nearby threatening enemy gunfire within given range // -1 == infinite range - -/* <354c8d> ../cstrike/dlls/bot/cs_bot_listen.cpp:104 */ bool CCSBot::CanHearNearbyEnemyGunfire(float range) const { // only attend to noise if it just happened @@ -108,8 +104,6 @@ bool CCSBot::CanHearNearbyEnemyGunfire(float range) const // Return true if we directly see where we think the noise came from // NOTE: Dont check FOV, since this is used to determine if we should turn our head to look at the noise // NOTE: Dont use IsVisible(), because smoke shouldnt cause us to not look toward noises - -/* <354e7b> ../cstrike/dlls/bot/cs_bot_listen.cpp:141 */ bool CCSBot::CanSeeNoisePosition() const { TraceResult result; @@ -126,8 +120,6 @@ bool CCSBot::CanSeeNoisePosition() const // Return true if we decided to look towards the most recent noise source // Assumes m_noisePosition is valid. - -/* <354f48> ../cstrike/dlls/bot/cs_bot_listen.cpp:160 */ bool CCSBot::UpdateLookAtNoise() { // make sure a noise exists diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index 6d9d2149..647d9889 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -13,23 +13,8 @@ bool CCSBotManager::m_isLearningMap = false; bool CCSBotManager::m_isAnalysisRequested = false; NavEditCmdType CCSBotManager::m_editCmd = EDIT_NONE; -#endif // HOOK_GAMEDLL +#endif -// Determine whether bots can be used or not -inline bool AreBotsAllowed() -{ - // If they pass in -nobots, don't allow bots. This is for people who host servers, to - // allow them to disallow bots to enforce CPU limits. - int nobots = ENG_CHECK_PARM("-nobots", NULL); - if (nobots) - { - return false; - } - - return true; -} - -/* <36b3b4> ../cstrike/dlls/bot/cs_bot_manager.cpp:45 */ CCSBotManager::CCSBotManager() { IMPL(m_flNextCVarCheck) = 0.0f; @@ -44,7 +29,7 @@ CCSBotManager::CCSBotManager() IMPL(m_isAnalysisRequested) = false; IMPL(m_editCmd) = EDIT_NONE; - m_navPlace = false; + m_navPlace = 0; m_roundStartTimestamp = 0.0f; m_bServerActive = false; @@ -102,8 +87,6 @@ CCSBotManager::CCSBotManager() } // Invoked when a new round begins - -/* <36b22a> ../cstrike/dlls/bot/cs_bot_manager.cpp:111 */ void CCSBotManager::__MAKE_VHOOK(RestartRound)() { // extend @@ -133,7 +116,6 @@ void CCSBotManager::__MAKE_VHOOK(RestartRound)() m_canRespawn = true; } -/* <36aebc> ../cstrike/dlls/bot/cs_bot_manager.cpp:142 */ void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue) { Vector v[8]; @@ -187,7 +169,6 @@ void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue) // Called each frame -/* <36b13d> ../cstrike/dlls/bot/cs_bot_manager.cpp:195 */ void CCSBotManager::__MAKE_VHOOK(StartFrame)() { // EXTEND @@ -206,8 +187,6 @@ void CCSBotManager::__MAKE_VHOOK(StartFrame)() } // Return true if the bot can use this weapon - -/* <36b62a> ../cstrike/dlls/bot/cs_bot_manager.cpp:276 */ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const { if (item == NULL) @@ -226,7 +205,7 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const #ifndef REGAMEDLL_FIXES // TODO: already is checked shotguns! || (!AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) -#endif // REGAMEDLL_FIXES +#endif || (!AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE) || (!AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN) || (!AllowTacticalShield() && item->m_iId == WEAPON_SHIELDGUN) @@ -240,8 +219,6 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const } // Return true if this player is on "defense" - -/* <36b68c> ../cstrike/dlls/bot/cs_bot_manager.cpp:306 */ bool CCSBotManager::IsOnDefense(CBasePlayer *player) const { switch (GetScenario()) @@ -260,16 +237,12 @@ bool CCSBotManager::IsOnDefense(CBasePlayer *player) const } // Return true if this player is on "offense" - -/* <36b6b8> ../cstrike/dlls/bot/cs_bot_manager.cpp:327 */ bool CCSBotManager::IsOnOffense(CBasePlayer *player) const { return !IsOnDefense(player); } // Invoked when a map has just been loaded - -/* <36a3b6> ../cstrike/dlls/bot/cs_bot_manager.cpp:331 */ void CCSBotManager::__MAKE_VHOOK(ServerActivate)() { DestroyNavigationMap(); @@ -290,17 +263,11 @@ void CCSBotManager::__MAKE_VHOOK(ServerActivate)() TheBotPhrases->OnMapChange(); } -/* <36afcd> ../cstrike/dlls/bot/cs_bot_manager.cpp:369 */ void CCSBotManager::__MAKE_VHOOK(AddServerCommand)(const char *cmd) { -#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS) - ADD_SERVER_COMMAND((char *)cmd, (xcommand_t)GetOriginalFuncAddrOrDefault("_Z17Bot_ServerCommandv", (void *)Bot_ServerCommand)); -#else ADD_SERVER_COMMAND((char *)cmd, Bot_ServerCommand); -#endif // HOOK_GAMEDLL } -/* <36b0e0> ../cstrike/dlls/bot/cs_bot_manager.cpp:375 */ void CCSBotManager::__MAKE_VHOOK(AddServerCommands)() { static bool fFirstTime = true; @@ -310,65 +277,63 @@ void CCSBotManager::__MAKE_VHOOK(AddServerCommands)() fFirstTime = false; - if (g_bIsCzeroGame) - { - AddServerCommand("bot_about"); - AddServerCommand("bot_add"); - AddServerCommand("bot_add_t"); - AddServerCommand("bot_add_ct"); - AddServerCommand("bot_kill"); - AddServerCommand("bot_kick"); - AddServerCommand("bot_knives_only"); - AddServerCommand("bot_pistols_only"); - AddServerCommand("bot_snipers_only"); - AddServerCommand("bot_all_weapons"); - AddServerCommand("entity_dump"); - AddServerCommand("bot_nav_delete"); - AddServerCommand("bot_nav_split"); - AddServerCommand("bot_nav_merge"); - AddServerCommand("bot_nav_mark"); - AddServerCommand("bot_nav_begin_area"); - AddServerCommand("bot_nav_end_area"); - AddServerCommand("bot_nav_connect"); - AddServerCommand("bot_nav_disconnect"); - AddServerCommand("bot_nav_splice"); - AddServerCommand("bot_nav_crouch"); - AddServerCommand("bot_nav_jump"); - AddServerCommand("bot_nav_precise"); - AddServerCommand("bot_nav_no_jump"); - AddServerCommand("bot_nav_analyze"); - AddServerCommand("bot_nav_strip"); - AddServerCommand("bot_nav_save"); - AddServerCommand("bot_nav_load"); - AddServerCommand("bot_nav_use_place"); - AddServerCommand("bot_nav_place_floodfill"); - AddServerCommand("bot_nav_place_pick"); - AddServerCommand("bot_nav_toggle_place_mode"); - AddServerCommand("bot_nav_toggle_place_painting"); - AddServerCommand("bot_goto_mark"); - AddServerCommand("bot_memory_usage"); - AddServerCommand("bot_nav_mark_unnamed"); - AddServerCommand("bot_nav_warp"); - AddServerCommand("bot_nav_corner_select"); - AddServerCommand("bot_nav_corner_raise"); - AddServerCommand("bot_nav_corner_lower"); - AddServerCommand("bot_nav_check_consistency"); - } + if (!AreBotsAllowed()) + return; + + AddServerCommand("bot_about"); + AddServerCommand("bot_add"); + AddServerCommand("bot_add_t"); + AddServerCommand("bot_add_ct"); + AddServerCommand("bot_kill"); + AddServerCommand("bot_kick"); + AddServerCommand("bot_knives_only"); + AddServerCommand("bot_pistols_only"); + AddServerCommand("bot_snipers_only"); + AddServerCommand("bot_all_weapons"); + AddServerCommand("entity_dump"); + AddServerCommand("bot_nav_delete"); + AddServerCommand("bot_nav_split"); + AddServerCommand("bot_nav_merge"); + AddServerCommand("bot_nav_mark"); + AddServerCommand("bot_nav_begin_area"); + AddServerCommand("bot_nav_end_area"); + AddServerCommand("bot_nav_connect"); + AddServerCommand("bot_nav_disconnect"); + AddServerCommand("bot_nav_splice"); + AddServerCommand("bot_nav_crouch"); + AddServerCommand("bot_nav_jump"); + AddServerCommand("bot_nav_precise"); + AddServerCommand("bot_nav_no_jump"); + AddServerCommand("bot_nav_analyze"); + AddServerCommand("bot_nav_strip"); + AddServerCommand("bot_nav_save"); + AddServerCommand("bot_nav_load"); + AddServerCommand("bot_nav_use_place"); + AddServerCommand("bot_nav_place_floodfill"); + AddServerCommand("bot_nav_place_pick"); + AddServerCommand("bot_nav_toggle_place_mode"); + AddServerCommand("bot_nav_toggle_place_painting"); + AddServerCommand("bot_goto_mark"); + AddServerCommand("bot_memory_usage"); + AddServerCommand("bot_nav_mark_unnamed"); + AddServerCommand("bot_nav_warp"); + AddServerCommand("bot_nav_corner_select"); + AddServerCommand("bot_nav_corner_raise"); + AddServerCommand("bot_nav_corner_lower"); + AddServerCommand("bot_nav_check_consistency"); } -/* <36b2ac> ../cstrike/dlls/bot/cs_bot_manager.cpp:413 */ void CCSBotManager::__MAKE_VHOOK(ServerDeactivate)() { m_bServerActive = false; } -/* <36b5fa> ../cstrike/dlls/bot/cs_bot_manager.cpp:415 */ void CCSBotManager::__MAKE_VHOOK(ClientDisconnect)(CBasePlayer *pPlayer) { if (pPlayer != NULL && pPlayer->IsBot()) { entvars_t *temp = VARS(pPlayer->edict()); - CCSBot *pBot = static_cast(pPlayer); + CCSBot *pBot = dynamic_cast(pPlayer); if (pBot != NULL) { @@ -388,7 +353,6 @@ void CCSBotManager::__MAKE_VHOOK(ClientDisconnect)(CBasePlayer *pPlayer) } } -/* <36b714> ../cstrike/dlls/bot/cs_bot_manager.cpp:464 */ void PrintAllEntities() { for (int i = 1; i < gpGlobals->maxEntities; ++i) @@ -402,10 +366,9 @@ void PrintAllEntities() } } -/* <36ace2> ../cstrike/dlls/bot/cs_bot_manager.cpp:484 */ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) { - if (!m_bServerActive || !g_bIsCzeroGame) + if (!m_bServerActive || !AreBotsAllowed()) return; char buffer[400]; @@ -491,7 +454,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) // adjust bot quota so kicked bot is not immediately added back in int newQuota = cv_bot_quota.value - 1; SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", name)); - CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, (int)cv_bot_quota.value)); + CVAR_SET_FLOAT("bot_quota", clamp(newQuota, 0, int(cv_bot_quota.value))); } } } @@ -633,10 +596,12 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) const BotPhraseList *placeList = TheBotPhrases->GetPlaceList(); for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter, ++i) { - if ((*iter)->GetID() == GetNavPlace()) - CONSOLE_ECHO("--> %-26s", (*iter)->GetName()); + const BotPhrase *phrase = (*iter); + + if (phrase->GetID() == GetNavPlace()) + CONSOLE_ECHO("--> %-26s", phrase->GetName()); else - CONSOLE_ECHO("%-30s", (*iter)->GetName()); + CONSOLE_ECHO("%-30s", phrase->GetName()); if (!(i % 3)) CONSOLE_ECHO("\n"); @@ -651,12 +616,14 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) bool isAmbiguous = false; for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter) { - if (!Q_strnicmp((*iter)->GetName(), msg, Q_strlen(msg))) + const BotPhrase *phrase = (*iter); + + if (!Q_strnicmp(phrase->GetName(), msg, Q_strlen(msg))) { // check for exact match in case of subsets of other strings - if (!Q_strcmp((*iter)->GetName(), msg)) + if (!Q_strcmp(phrase->GetName(), msg)) { - found = (*iter); + found = phrase; isAmbiguous = false; break; } @@ -667,7 +634,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) } else { - found = (*iter); + found = phrase; } } } @@ -790,7 +757,6 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) } } -/* <36b6e1> ../cstrike/dlls/bot/cs_bot_manager.cpp:896 */ BOOL CCSBotManager::__MAKE_VHOOK(ClientCommand)(CBasePlayer *pPlayer, const char *pcmd) { #ifndef REGAMEDLL_FIXES @@ -798,14 +764,12 @@ BOOL CCSBotManager::__MAKE_VHOOK(ClientCommand)(CBasePlayer *pPlayer, const char { UTIL_GetLocalPlayer(); } -#endif // REGAMEDLL_FIXES +#endif return FALSE; } // Process the "bot_add" console command - -/* <36c3c2> ../cstrike/dlls/bot/cs_bot_manager.cpp:903 */ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole) { // dont allow bots to join if the Navigation Area is being generated @@ -852,9 +816,7 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole) { // in career, ignore humans bool ignoreHumans = false; - CHalfLifeMultiplay *mp = g_pGameRules; - - if (mp != NULL && mp->IsCareer()) + if (CSGameRules() != NULL && CSGameRules()->IsCareer()) ignoreHumans = true; if (UTIL_IsNameTaken(CMD_ARGV(1), ignoreHumans)) @@ -885,14 +847,14 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole) } // Keep a minimum quota of bots in the game - -/* <36d10f> ../cstrike/dlls/bot/cs_bot_manager.cpp:979 */ void CCSBotManager::MaintainBotQuota() { + if (!AreBotsAllowed()) + return; + if (IMPL(m_isLearningMap)) return; - CHalfLifeMultiplay *mp = g_pGameRules; int totalHumansInGame = UTIL_HumansInGame(); int humanPlayersInGame = UTIL_HumansInGame(IGNORE_SPECTATORS); @@ -900,12 +862,12 @@ void CCSBotManager::MaintainBotQuota() if (!IS_DEDICATED_SERVER() && totalHumansInGame == 0) return; - int desiredBotCount = (int)cv_bot_quota.value; + int desiredBotCount = int(cv_bot_quota.value); int botsInGame = UTIL_BotsInGame(); if (cv_bot_quota_match.value > 0.0) { - desiredBotCount = (int)(humanPlayersInGame * cv_bot_quota_match.value); + desiredBotCount = int(humanPlayersInGame * cv_bot_quota_match.value); } // wait for a player to join, if necessary @@ -925,7 +887,7 @@ void CCSBotManager::MaintainBotQuota() if (desiredBotCount > botsInGame) { // don't try to add a bot if all teams are full - if (!mp->TeamFull(TERRORIST) || !mp->TeamFull(CT)) + if (!CSGameRules()->TeamFull(TERRORIST) || !CSGameRules()->TeamFull(CT)) BotAddCommand(BOT_TEAM_ANY); } else if (desiredBotCount < botsInGame) @@ -939,20 +901,20 @@ void CCSBotManager::MaintainBotQuota() TeamName kickTeam; // remove from the team that has more players - if (mp->m_iNumTerrorist > mp->m_iNumCT) + if (CSGameRules()->m_iNumTerrorist > CSGameRules()->m_iNumCT) { kickTeam = TERRORIST; } - else if (mp->m_iNumTerrorist < mp->m_iNumCT) + else if (CSGameRules()->m_iNumTerrorist < CSGameRules()->m_iNumCT) { kickTeam = CT; } // remove from the team that's winning - else if (mp->m_iNumTerroristWins > mp->m_iNumCTWins) + else if (CSGameRules()->m_iNumTerroristWins > CSGameRules()->m_iNumCTWins) { kickTeam = TERRORIST; } - else if (mp->m_iNumCTWins > mp->m_iNumTerroristWins) + else if (CSGameRules()->m_iNumCTWins > CSGameRules()->m_iNumTerroristWins) { kickTeam = CT; } @@ -974,21 +936,21 @@ void CCSBotManager::MaintainBotQuota() } else { - if (mp != NULL && !mp->IsCareer()) + if (CSGameRules() != NULL && !CSGameRules()->IsCareer()) return; bool humansAreCTs = (Q_strcmp(humans_join_team.string, "CT") == 0); if (humansAreCTs) { - if (mp->m_iNumCT <= 6) + if (CSGameRules()->m_iNumCT <= 6) return; UTIL_KickBotFromTeam(CT); } else { - if (mp->m_iNumTerrorist <= 6) + if (CSGameRules()->m_iNumTerrorist <= 6) return; UTIL_KickBotFromTeam(TERRORIST); @@ -998,7 +960,6 @@ void CCSBotManager::MaintainBotQuota() } } -/* <36d1dd> ../cstrike/dlls/bot/cs_bot_manager.cpp:1086 */ void CCSBotManager::MonitorBotCVars() { if (cv_bot_nav_edit.value != 0.0f) @@ -1050,11 +1011,9 @@ private: }; // Search the map entities to determine the game scenario and define important zones. - -/* <36b780> ../cstrike/dlls/bot/cs_bot_manager.cpp:1109 */ void CCSBotManager::ValidateMapData() { - if (IMPL(m_isMapDataLoaded) || !g_bIsCzeroGame) + if (IMPL(m_isMapDataLoaded) || !AreBotsAllowed()) return; IMPL(m_isMapDataLoaded) = true; @@ -1192,17 +1151,12 @@ void CCSBotManager::ValidateMapData() } } -/* <36c2b2> ../cstrike/dlls/bot/cs_bot_manager.cpp:1278 */ -#ifndef HOOK_GAMEDLL bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team) { - if (!g_bIsCzeroGame) + if (!AreBotsAllowed()) return false; - CHalfLifeMultiplay *mp = g_pGameRules; - int nTeamSlot = UNASSIGNED; - if (team == BOT_TEAM_ANY) { // if team not specified, check cv_bot_join_team cvar for preference @@ -1223,13 +1177,13 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team) nTeamSlot = SelectDefaultTeam(); } - if (nTeamSlot == UNASSIGNED || mp->TeamFull(nTeamSlot)) + if (nTeamSlot == UNASSIGNED || CSGameRules()->TeamFull(nTeamSlot)) { CONSOLE_ECHO("Could not add bot to the game: Team is full\n"); return false; } - if (mp->TeamStacked(nTeamSlot, UNASSIGNED)) + if (CSGameRules()->TeamStacked(nTeamSlot, UNASSIGNED)) { CONSOLE_ECHO("Could not add bot to the game: Team is stacked (to disable this check, set mp_limitteams and mp_autoteambalance to zero and restart the round).\n"); return false; @@ -1270,11 +1224,8 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team) return false; } -#endif // HOOK_GAMEDLL // Return the zone that contains the given position - -/* <36bb90> ../cstrike/dlls/bot/cs_bot_manager.cpp:1375 */ const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) const { for (int z = 0; z < m_zoneCount; ++z) @@ -1289,8 +1240,6 @@ const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) const } // Return the closest zone to the given position - -/* <36bbfd> ../cstrike/dlls/bot/cs_bot_manager.cpp:1392 */ const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) const { const Zone *close = NULL; @@ -1311,8 +1260,6 @@ const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) cons } // Return a random position inside the given zone - -/* <36bcc9> ../cstrike/dlls/bot/cs_bot_manager.cpp:1415 */ const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const { static Vector pos; @@ -1351,8 +1298,6 @@ const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const } // Return a random area inside the given zone - -/* <36bd64> ../cstrike/dlls/bot/cs_bot_manager.cpp:1458 */ CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const { // TODO: improvement is needed @@ -1362,7 +1307,6 @@ CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const return zone->m_area[ RANDOM_LONG(0, zone->m_areaCount - 1) ]; } -/* <36b02d> ../cstrike/dlls/bot/cs_bot_manager.cpp:1477 */ void CCSBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { switch (event) @@ -1404,14 +1348,11 @@ void CCSBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *enti } // Get the time remaining before the planted bomb explodes - -/* <36bdb3> ../cstrike/dlls/bot/cs_bot_manager.cpp:1541 */ float CCSBotManager::GetBombTimeLeft() const { - return (g_pGameRules->m_iC4Timer - (gpGlobals->time - m_bombPlantTimestamp)); + return (CSGameRules()->m_iC4Timer - (gpGlobals->time - m_bombPlantTimestamp)); } -/* <36bddb> ../cstrike/dlls/bot/cs_bot_manager.cpp:1547 */ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb) { m_looseBomb = bomb; @@ -1427,8 +1368,6 @@ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb) } // Return true if player is important to scenario (VIP, bomb carrier, etc) - -/* <36b14d> ../cstrike/dlls/bot/cs_bot_manager.cpp:1565 */ bool CCSBotManager::__MAKE_VHOOK(IsImportantPlayer)(CBasePlayer *player) const { switch (GetScenario()) @@ -1460,8 +1399,6 @@ bool CCSBotManager::__MAKE_VHOOK(IsImportantPlayer)(CBasePlayer *player) const } // Return priority of player (0 = max pri) - -/* <36b1a7> ../cstrike/dlls/bot/cs_bot_manager.cpp:1602 */ unsigned int CCSBotManager::__MAKE_VHOOK(GetPlayerPriority)(CBasePlayer *player) const { const unsigned int lowestPriority = 0xFFFFFFFF; @@ -1513,8 +1450,6 @@ unsigned int CCSBotManager::__MAKE_VHOOK(GetPlayerPriority)(CBasePlayer *player) // Return the last time the given radio message was sent for given team // 'teamID' can be TEAM_CT or TEAM_TERRORIST - -/* <36be2e> ../cstrike/dlls/bot/cs_bot_manager.cpp:1655 */ float CCSBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) const { if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO) @@ -1525,8 +1460,6 @@ float CCSBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) c } // Return the interval since the last time this message was sent - -/* <36be76> ../cstrike/dlls/bot/cs_bot_manager.cpp:1667 */ float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) const { if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO) @@ -1538,8 +1471,6 @@ float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) co // Set the given radio message timestamp. // 'teamID' can be TEAM_CT or TEAM_TERRORIST - -/* <36bebe> ../cstrike/dlls/bot/cs_bot_manager.cpp:1680 */ void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID) { if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO) @@ -1550,8 +1481,6 @@ void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID) } // Reset all radio message timestamps - -/* <36bf06> ../cstrike/dlls/bot/cs_bot_manager.cpp:1690 */ void CCSBotManager::ResetRadioMessageTimestamps() { for (int t = 0; t < ARRAYSIZE(m_radioMsgTimestamp[0]); ++t) diff --git a/regamedll/dlls/bot/cs_bot_manager.h b/regamedll/dlls/bot/cs_bot_manager.h index 5e796117..8ed2d3b1 100644 --- a/regamedll/dlls/bot/cs_bot_manager.h +++ b/regamedll/dlls/bot/cs_bot_manager.h @@ -72,15 +72,15 @@ public: unsigned int GetPlayerPriority_(CBasePlayer *player) const; bool IsImportantPlayer_(CBasePlayer *player) const; -#endif // HOOK_GAMEDLL +#endif public: void ValidateMapData(); - bool IsLearningMap() const { return IMPL(m_isLearningMap); } - void SetLearningMapFlag() { IMPL(m_isLearningMap) = true;} - bool IsAnalysisRequested() const { return IMPL(m_isAnalysisRequested); } - void RequestAnalysis() { IMPL(m_isAnalysisRequested) = true; } - void AckAnalysisRequest() { IMPL(m_isAnalysisRequested) = false; } + bool IsLearningMap() const { return IMPL(m_isLearningMap); } + void SetLearningMapFlag() { IMPL(m_isLearningMap) = true; } + bool IsAnalysisRequested() const { return IMPL(m_isAnalysisRequested); } + void RequestAnalysis() { IMPL(m_isAnalysisRequested) = true; } + void AckAnalysisRequest() { IMPL(m_isAnalysisRequested) = false; } // difficulty levels static BotDifficultyType GetDifficultyLevel() @@ -105,7 +105,7 @@ public: SCENARIO_RESCUE_HOSTAGES, SCENARIO_ESCORT_VIP }; - GameScenarioType GetScenario() const { return m_gameScenario; } + GameScenarioType GetScenario() const { return m_gameScenario; } // "zones" // depending on the game mode, these are bomb zones, rescue zones, etc. @@ -122,11 +122,11 @@ public: Extent m_extent; }; - const Zone *GetZone(int i) const { return &m_zone[i]; } + const Zone *GetZone(int i) const { return &m_zone[i]; } const Zone *GetZone(const Vector *pos) const; // return the zone that contains the given position const Zone *GetClosestZone(const Vector *pos) const; // return the closest zone to the given position - const Zone *GetClosestZone(const CBaseEntity *entity) const { return GetClosestZone(&entity->pev->origin); } // return the closest zone to the given entity - int GetZoneCount() const { return m_zoneCount; } + const Zone *GetClosestZone(const CBaseEntity *entity) const { return GetClosestZone(&entity->pev->origin); } // return the closest zone to the given entity + int GetZoneCount() const { return m_zoneCount; } const Vector *GetRandomPositionInZone(const Zone *zone) const; CNavArea *GetRandomAreaInZone(const Zone *zone) const; @@ -168,16 +168,16 @@ public: if (!m_zoneCount) return NULL; - return &m_zone[ RANDOM_LONG(0, m_zoneCount - 1) ]; + return &m_zone[RANDOM_LONG(0, m_zoneCount - 1)]; } - bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted - float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted - bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb - CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL - float GetBombTimeLeft() const; // get the time remaining before the planted bomb explodes - CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground - CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near + bool IsBombPlanted() const { return m_isBombPlanted; } // returns true if bomb has been planted + float GetBombPlantTimestamp() const { return m_bombPlantTimestamp; } // return time bomb was planted + bool IsTimeToPlantBomb() const { return (gpGlobals->time >= m_earliestBombPlantTimestamp); } // return true if it's ok to try to plant bomb + CBasePlayer *GetBombDefuser() const { return m_bombDefuser; } // return the player currently defusing the bomb, or NULL + float GetBombTimeLeft() const; // get the time remaining before the planted bomb explodes + CBaseEntity *GetLooseBomb() { return m_looseBomb; } // return the bomb if it is loose on the ground + CNavArea *GetLooseBombArea() const { return m_looseBombArea; } // return area that bomb is in/near void SetLooseBomb(CBaseEntity *bomb); float GetRadioMessageTimestamp(GameEventType event, int teamID) const; // return the last time the given radio message was sent for given team @@ -185,36 +185,36 @@ public: void SetRadioMessageTimestamp(GameEventType event, int teamID); void ResetRadioMessageTimestamps(); - float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy - void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; } + float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy + void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; } - float GetRoundStartTime() const { return m_roundStartTimestamp; } - float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began + float GetRoundStartTime() const { return m_roundStartTimestamp; } + float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began - bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; } - bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; } - bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; } - bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; } - bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; } - bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; } - bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; } - bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; } - bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; } - bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; } + bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; } + bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; } + bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; } + bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; } + bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; } + bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; } + bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; } + bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; } + bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; } + bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; } bool IsWeaponUseable(CBasePlayerItem *item) const; // return true if the bot can use this weapon - bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round + bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round bool IsOnDefense(CBasePlayer *player) const; // return true if this player is on "defense" bool IsOnOffense(CBasePlayer *player) const; // return true if this player is on "offense" - bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended + bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended - unsigned int GetNavPlace() const { return m_navPlace; } - void SetNavPlace(unsigned int place) { m_navPlace = place; } + unsigned int GetNavPlace() const { return m_navPlace; } + void SetNavPlace(unsigned int place) { m_navPlace = place; } enum SkillType { LOW, AVERAGE, HIGH, RANDOM }; - NOXREF const char *GetRandomBotName(SkillType skill); + const char *GetRandomBotName(SkillType skill); static void MonitorBotCVars(); static void MaintainBotQuota(); @@ -225,7 +225,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif static float IMPL(m_flNextCVarCheck); static bool IMPL(m_isMapDataLoaded); // true if we've attempted to load map data static bool IMPL(m_isLearningMap); @@ -233,7 +233,7 @@ private: GameScenarioType m_gameScenario; // what kind of game are we playing - Zone m_zone[ MAX_ZONES ]; + Zone m_zone[MAX_ZONES]; int m_zoneCount; bool m_isBombPlanted; // true if bomb has been planted @@ -260,18 +260,22 @@ private: bool m_bServerActive; }; -/* <2e81a8> ../cstrike/dlls/bot/cs_bot_manager.h:24 */ -NOXREF inline int OtherTeam(int team) +inline int OtherTeam(int team) { return (team == TERRORIST) ? CT : TERRORIST; } -/* <111bd2> ../cstrike/dlls/bot/cs_bot_manager.h:266 */ inline CCSBotManager *TheCSBots() { return reinterpret_cast(TheBots); } +// Determine whether bots can be used or not +inline bool AreBotsAllowed() +{ + return g_bAllowedCSBot; +} + void PrintAllEntities(); void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue); diff --git a/regamedll/dlls/bot/cs_bot_nav.cpp b/regamedll/dlls/bot/cs_bot_nav.cpp index 26171ac9..2ecb720b 100644 --- a/regamedll/dlls/bot/cs_bot_nav.cpp +++ b/regamedll/dlls/bot/cs_bot_nav.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Reset the stuck-checker. - -/* <37c284> ../cstrike/dlls/bot/cs_bot_nav.cpp:16 */ void CCSBot::ResetStuckMonitor() { if (m_isStuck) @@ -24,8 +22,6 @@ void CCSBot::ResetStuckMonitor() } // Test if we have become stuck - -/* <37c2a6> ../cstrike/dlls/bot/cs_bot_nav.cpp:37 */ void CCSBot::StuckCheck() { if (m_isStuck) @@ -99,8 +95,6 @@ void CCSBot::StuckCheck() } // Check if we need to jump due to height change - -/* <37c05d> ../cstrike/dlls/bot/cs_bot_nav.cpp:114 */ bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump) { // don't try to jump again. @@ -141,8 +135,6 @@ bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump) } // Find "simple" ground height, treating current nav area as part of the floor - -/* <37c448> ../cstrike/dlls/bot/cs_bot_nav.cpp:154 */ bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal) { if (GetSimpleGroundHeight(pos, height, normal)) @@ -159,7 +151,6 @@ bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Ve return false; } -/* <37c4b8> ../cstrike/dlls/bot/cs_bot_nav.cpp:172 */ Place CCSBot::GetPlace() const { if (m_lastKnownArea != NULL) @@ -168,7 +159,6 @@ Place CCSBot::GetPlace() const return UNDEFINED_PLACE; } -/* <37c4de> ../cstrike/dlls/bot/cs_bot_nav.cpp:184 */ void CCSBot::MoveTowardsPosition(const Vector *pos) { // Jump up on ledges @@ -179,8 +169,8 @@ void CCSBot::MoveTowardsPosition(const Vector *pos) // NOTE: We need to do this frequently to catch edges at the right time // TODO: Look ahead *along path* instead of straight line - if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & NAV_NO_JUMP)) && - !IsOnLadder() && !m_isJumpCrouching) + if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & NAV_NO_JUMP)) + && !IsOnLadder() && !m_isJumpCrouching) { float ground; Vector aheadRay(pos->x - pev->origin.x, pos->y - pev->origin.y, 0); @@ -263,8 +253,6 @@ void CCSBot::MoveTowardsPosition(const Vector *pos) } // Move away from position, independant of view angle - -/* <37ca96> ../cstrike/dlls/bot/cs_bot_nav.cpp:282 */ NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos) { // compute our current forward and lateral vectors @@ -294,8 +282,6 @@ NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos) } // Strafe (sidestep) away from position, independant of view angle - -/* <37cb85> ../cstrike/dlls/bot/cs_bot_nav.cpp:314 */ void CCSBot::StrafeAwayFromPosition(const Vector *pos) { // compute our current forward and lateral vectors @@ -317,8 +303,6 @@ void CCSBot::StrafeAwayFromPosition(const Vector *pos) } // For getting un-stuck - -/* <37cc52> ../cstrike/dlls/bot/cs_bot_nav.cpp:338 */ void CCSBot::Wiggle() { if (IsCrouching()) @@ -361,8 +345,6 @@ void CCSBot::Wiggle() } // Determine approach points from eye position and approach areas of current area - -/* <37cc94> ../cstrike/dlls/bot/cs_bot_nav.cpp:383 */ void CCSBot::ComputeApproachPoints() { m_approachPointCount = 0; @@ -407,7 +389,6 @@ void CCSBot::ComputeApproachPoints() } } -/* <37cd67> ../cstrike/dlls/bot/cs_bot_nav.cpp:422 */ void CCSBot::DrawApproachPoints() { for (int i = 0; i < m_approachPointCount; ++i) @@ -417,8 +398,6 @@ void CCSBot::DrawApproachPoints() } // Find the approach point that is nearest to our current path, ahead of us - -/* <37ce12> ../cstrike/dlls/bot/cs_bot_nav.cpp:435 */ NOXREF bool CCSBot::FindApproachPointNearestPath(Vector *pos) { if (!HasPath()) diff --git a/regamedll/dlls/bot/cs_bot_pathfind.cpp b/regamedll/dlls/bot/cs_bot_pathfind.cpp index 10f2ba37..1d70e908 100644 --- a/regamedll/dlls/bot/cs_bot_pathfind.cpp +++ b/regamedll/dlls/bot/cs_bot_pathfind.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Determine actual path positions bot will move between along the path - -/* <38db02> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:30 */ bool CCSBot::ComputePathPositions() { if (m_pathLength == 0) @@ -125,8 +123,6 @@ bool CCSBot::ComputePathPositions() } // If next step of path uses a ladder, prepare to traverse it - -/* <38d424> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:155 */ void CCSBot::SetupLadderMovement() { if (m_pathIndex < 1 || m_pathLength == 0) @@ -187,8 +183,6 @@ void CCSBot::SetupLadderMovement() } // TODO: What about ladders whose top AND bottom are messed up? - -/* <38dd85> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:213 */ void CCSBot::ComputeLadderEndpoint(bool isAscending) { TraceResult result; @@ -221,8 +215,6 @@ void CCSBot::ComputeLadderEndpoint(bool isAscending) // Navigate our current ladder. Return true if we are doing ladder navigation. // TODO: Need Push() and Pop() for run/walk context to keep ladder speed contained. - -/* <38de76> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:248 */ bool CCSBot::UpdateLadderMovement() { if (m_pathLadder == NULL) @@ -303,7 +295,7 @@ bool CCSBot::UpdateLadderMovement() { Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x); - if (abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal) + if (Q_abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal) approached = true; } @@ -359,7 +351,7 @@ bool CCSBot::UpdateLadderMovement() { Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x); - if (abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal) + if (Q_abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal) approached = true; } @@ -582,8 +574,6 @@ bool CCSBot::UpdateLadderMovement() // Compute closest point on path to given point // NOTE: This does not do line-of-sight tests, so closest point may be thru the floor, etc - -/* <38e44d> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:609 */ bool CCSBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const { if (!HasPath() || close == NULL) @@ -637,8 +627,6 @@ bool CCSBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int // Return the closest point to our current position on our current path // If "local" is true, only check the portion of the path surrounding m_pathIndex. - -/* <38e6d0> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:665 */ int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const { if (!HasPath()) @@ -724,8 +712,6 @@ int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const } // Test for un-jumpable height change, or unrecoverable fall - -/* <38c911> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:752 */ bool CCSBot::IsStraightLinePathWalkable(const Vector *goal) const { // this is causing hang-up problems when crawling thru ducts/windows that drop off into rooms (they fail the "falling" check) @@ -782,8 +768,6 @@ return true; // Compute a point a fixed distance ahead along our path. // Returns path index just after point. - -/* <38ec40> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:810 */ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex) { // find path index just past aheadRange @@ -859,8 +843,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex) } // we need the point just *ahead* of us - ++startIndex; - if (startIndex >= m_pathLength) + if (++startIndex >= m_pathLength) startIndex = m_pathLength - 1; // if we hit a ladder, stop, or jump area, must stop @@ -1021,8 +1004,6 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex) } // Set the current index along the path - -/* <38f761> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1052 */ void CCSBot::SetPathIndex(int newIndex) { m_pathIndex = Q_min(newIndex, m_pathLength - 1); @@ -1045,8 +1026,6 @@ void CCSBot::SetPathIndex(int newIndex) } // Return true if nearing a jump in the path - -/* <38cafc> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1077 */ bool CCSBot::IsNearJump() const { if (m_pathIndex == 0 || m_pathIndex >= m_pathLength) @@ -1067,8 +1046,6 @@ bool CCSBot::IsNearJump() const } // Return approximately how much damage will will take from the given fall height - -/* <38f844> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1100 */ float CCSBot::GetApproximateFallDamage(float height) const { // empirically discovered height values @@ -1084,8 +1061,6 @@ float CCSBot::GetApproximateFallDamage(float height) const } // Return true if a friend is between us and the given position - -/* <38f89b> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1118 */ bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const { // do this check less often to ease CPU burden @@ -1161,8 +1136,6 @@ bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const } // Do reflex avoidance movements if our "feelers" are touched - -/* <38fbd5> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1197 */ void CCSBot::FeelerReflexAdjustment(Vector *goalPosition) { // if we are in a "precise" area, do not do feeler adjustments @@ -1267,8 +1240,6 @@ void CCSBot::FeelerReflexAdjustment(Vector *goalPosition) } // Move along the path. Return false if end of path reached. - -/* <3912bf> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1300 */ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange) { if (m_pathLength == 0) @@ -1574,8 +1545,6 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange) } // Build trivial path to goal, assuming we are already in the same area - -/* <3906a6> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1634 */ void CCSBot::BuildTrivialPath(const Vector *goal) { m_pathIndex = 1; @@ -1602,8 +1571,6 @@ void CCSBot::BuildTrivialPath(const Vector *goal) // Compute shortest path to goal position via A* algorithm // If 'goalArea' is NULL, path will get as close as it can. - -/* <3907cd> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1664 */ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route) { // Throttle re-pathing @@ -1631,7 +1598,7 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route pathEndPosition = *goal; // make sure path end position is on the ground - if (goalArea) + if (goalArea != NULL) pathEndPosition.z = goalArea->GetZ(&pathEndPosition); else GetGroundHeight(&pathEndPosition, &pathEndPosition.z); @@ -1731,8 +1698,6 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route } // Return estimated distance left to travel along path - -/* <390ef6> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1798 */ float CCSBot::GetPathDistanceRemaining() const { if (!HasPath()) @@ -1753,8 +1718,6 @@ float CCSBot::GetPathDistanceRemaining() const } // Draw a portion of our current path for debugging. - -/* <390fb1> ../cstrike/dlls/bot/cs_bot_pathfind.cpp:1821 */ void CCSBot::DrawPath() { if (!HasPath()) diff --git a/regamedll/dlls/bot/cs_bot_radio.cpp b/regamedll/dlls/bot/cs_bot_radio.cpp index 2abe8b27..19acb6e6 100644 --- a/regamedll/dlls/bot/cs_bot_radio.cpp +++ b/regamedll/dlls/bot/cs_bot_radio.cpp @@ -2,7 +2,6 @@ // Returns true if the radio message is an order to do something // NOTE: "Report in" is not considered a "command" because it doesnt ask the bot to go somewhere, or change its mind -/* <3a3689> ../cstrike/dlls/bot/cs_bot_radio.cpp:19 */ bool CCSBot::IsRadioCommand(GameEventType event) const { if (event == EVENT_RADIO_AFFIRMATIVE @@ -18,8 +17,6 @@ bool CCSBot::IsRadioCommand(GameEventType event) const } // Respond to radio commands from HUMAN players - -/* <3a36e0> ../cstrike/dlls/bot/cs_bot_radio.cpp:37 */ void CCSBot::RespondToRadioCommands() { // bots use the chatter system to respond to each other @@ -74,7 +71,6 @@ void CCSBot::RespondToRadioCommands() return; } - CCSBotManager *ctrl = TheCSBots(); CBasePlayer *player = m_radioSubject; if (player == NULL) return; @@ -142,7 +138,7 @@ void CCSBot::RespondToRadioCommands() } case EVENT_RADIO_GET_OUT_OF_THERE: { - if (ctrl->IsBombPlanted()) + if (TheCSBots()->IsBombPlanted()) { EscapeFromBomb(); player->InhibitAutoFollow(inhibitAutoFollowDuration); @@ -154,11 +150,11 @@ void CCSBot::RespondToRadioCommands() { // if this is a defusal scenario, and the bomb is planted, // and a human player cleared a bombsite, check it off our list too - if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB) + if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB) { - if (m_iTeam == CT && ctrl->IsBombPlanted()) + if (m_iTeam == CT && TheCSBots()->IsBombPlanted()) { - const CCSBotManager::Zone *zone = ctrl->GetClosestZone(player); + const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(player); if (zone != NULL) { @@ -196,8 +192,6 @@ void CCSBot::RespondToRadioCommands() } // Send voice chatter. Also sends the entindex. - -/* <3a397f> ../cstrike/dlls/bot/cs_bot_radio.cpp:220 */ void CCSBot::StartVoiceFeedback(float duration) { m_voiceFeedbackStartTimestamp = gpGlobals->time; @@ -213,7 +207,6 @@ void CCSBot::StartVoiceFeedback(float duration) } } -/* <3a3a32> ../cstrike/dlls/bot/cs_bot_radio.cpp:241 */ void CCSBot::EndVoiceFeedback(bool force) { if (!force && !m_voiceFeedbackEndTimestamp) @@ -228,8 +221,6 @@ void CCSBot::EndVoiceFeedback(bool force) } // Decide if we should move to help the player, return true if we will - -/* <3a3bcd> ../cstrike/dlls/bot/cs_bot_radio.cpp:259 */ bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange) { if (IsRogue()) @@ -290,8 +281,6 @@ bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange } // Send a radio message - -/* <3a4316> ../cstrike/dlls/bot/cs_bot_radio.cpp:319 */ void CCSBot::SendRadioMessage(GameEventType event) { // make sure this is a radio event @@ -300,11 +289,10 @@ void CCSBot::SendRadioMessage(GameEventType event) return; } - CCSBotManager *ctrl = TheCSBots(); PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]); // note the time the message was sent - ctrl->SetRadioMessageTimestamp(event, m_iTeam); + TheCSBots()->SetRadioMessageTimestamp(event, m_iTeam); m_lastRadioSentTimestamp = gpGlobals->time; diff --git a/regamedll/dlls/bot/cs_bot_statemachine.cpp b/regamedll/dlls/bot/cs_bot_statemachine.cpp index 3db5f5ed..5dfaeaed 100644 --- a/regamedll/dlls/bot/cs_bot_statemachine.cpp +++ b/regamedll/dlls/bot/cs_bot_statemachine.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // This method is the ONLY legal way to change a bot's current state - -/* <3b3a2a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:16 */ void CCSBot::SetState(BotState *state) { PrintIfWatched("SetState: %s -> %s\n", (m_state != NULL) ? m_state->GetName() : "NULL", state->GetName()); @@ -20,21 +18,18 @@ void CCSBot::SetState(BotState *state) m_stateTimestamp = gpGlobals->time; } -/* <3b3ab4> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:34 */ void CCSBot::Idle() { SetTask(SEEK_AND_DESTROY); SetState(&m_idleState); } -/* <3b3afa> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:41 */ void CCSBot::EscapeFromBomb() { SetTask(ESCAPE_FROM_BOMB); SetState(&m_escapeFromBombState); } -/* <3b3b4b> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:48 */ void CCSBot::Follow(CBasePlayer *player) { if (player == NULL) @@ -53,8 +48,6 @@ void CCSBot::Follow(CBasePlayer *player) } // Continue following our leader after finishing what we were doing - -/* <3b3bd1> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:69 */ void CCSBot::ContinueFollowing() { SetTask(FOLLOW); @@ -63,8 +56,6 @@ void CCSBot::ContinueFollowing() } // Stop following - -/* <3b3c57> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:83 */ void CCSBot::StopFollowing() { m_isFollowing = false; @@ -73,16 +64,12 @@ void CCSBot::StopFollowing() } // Begin process of rescuing hostages - -/* <3b3c7e> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:94 */ void CCSBot::RescueHostages() { SetTask(RESCUE_HOSTAGES); } // Use the entity - -/* <3b3cc9> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:103 */ void CCSBot::UseEntity(CBaseEntity *entity) { m_useEntityState.SetEntity(entity); @@ -92,8 +79,6 @@ void CCSBot::UseEntity(CBaseEntity *entity) // DEPRECATED: Use TryToHide() instead. // Move to a hiding place. // If 'searchFromArea' is non-NULL, hiding spots are looked for from that area first. - -/* <3b3d23> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:116 */ void CCSBot::Hide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition) { DestroyPath(); @@ -152,8 +137,6 @@ void CCSBot::Hide(CNavArea *searchFromArea, float duration, float hideRange, boo } // Move to the given hiding place - -/* <3b3e98> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:171 */ void CCSBot::Hide(const Vector *hidingSpot, float duration, bool holdPosition) { CNavArea *hideArea = TheNavAreaGrid.GetNearestNavArea(hidingSpot); @@ -185,8 +168,6 @@ void CCSBot::Hide(const Vector *hidingSpot, float duration, bool holdPosition) // Try to hide nearby. Return true if hiding, false if can't hide here. // If 'searchFromArea' is non-NULL, hiding spots are looked for from that area first. - -/* <3b3fc1> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:205 */ bool CCSBot::TryToHide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition, bool useNearest) { CNavArea *source; @@ -235,8 +216,6 @@ bool CCSBot::TryToHide(CNavArea *searchFromArea, float duration, float hideRange } // Retreat to a nearby hiding spot, away from enemies - -/* <3b40ed> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:256 */ bool CCSBot::TryToRetreat() { const float maxRange = 1000.0f; @@ -261,7 +240,6 @@ bool CCSBot::TryToRetreat() return false; } -/* <3b426a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:280 */ void CCSBot::Hunt() { SetState(&m_huntState); @@ -269,8 +247,6 @@ void CCSBot::Hunt() // Attack our the given victim // NOTE: Attacking does not change our task. - -/* <3b4291> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:290 */ void CCSBot::Attack(CBasePlayer *victim) { if (victim == NULL) @@ -309,7 +285,7 @@ void CCSBot::Attack(CBasePlayer *victim) Vector toEnemy = victim->pev->origin - pev->origin; Vector idealAngle = UTIL_VecToAngles(toEnemy); - float deltaYaw = abs((int)(m_lookYaw - idealAngle.y)); + float_precision deltaYaw = float_precision(Q_abs(int64(m_lookYaw - idealAngle.y))); while (deltaYaw > 180.0f) deltaYaw -= 360.0f; @@ -319,7 +295,7 @@ void CCSBot::Attack(CBasePlayer *victim) // immediately aim at enemy - accuracy penalty depending on how far we must turn to aim // accuracy is halved if we have to turn 180 degrees - float turn = deltaYaw / 180.0f; + float turn = deltaYaw * 0.0055555557;/// 180.0f; float accuracy = GetProfile()->GetSkill() / (1.0f + turn); SetAimOffset(accuracy); @@ -330,8 +306,6 @@ void CCSBot::Attack(CBasePlayer *victim) } // Exit the Attack state - -/* <3b4416> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:366 */ void CCSBot::StopAttacking() { PrintIfWatched("ATTACK END\n"); @@ -345,15 +319,12 @@ void CCSBot::StopAttacking() } } -/* <3b447d> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:378 */ bool CCSBot::IsAttacking() const { return m_isAttacking; } // Return true if we are escaping from the bomb - -/* <3b449f> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:387 */ bool CCSBot::IsEscapingFromBomb() const { if (m_state == static_cast(&m_escapeFromBombState)) @@ -363,8 +334,6 @@ bool CCSBot::IsEscapingFromBomb() const } // Return true if we are defusing the bomb - -/* <3b44c6> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:399 */ bool CCSBot::IsDefusingBomb() const { if (m_state == static_cast(&m_defuseBombState)) @@ -374,8 +343,6 @@ bool CCSBot::IsDefusingBomb() const } // Return true if we are hiding - -/* <3b44ed> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:411 */ bool CCSBot::IsHiding() const { if (m_state == static_cast(&m_hideState)) @@ -385,8 +352,6 @@ bool CCSBot::IsHiding() const } // Return true if we are hiding and at our hiding spot - -/* <3b450f> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:423 */ bool CCSBot::IsAtHidingSpot() const { if (!IsHiding()) @@ -396,8 +361,6 @@ bool CCSBot::IsAtHidingSpot() const } // Return true if we are huting - -/* <3b454a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:435 */ bool CCSBot::IsHunting() const { if (m_state == static_cast(&m_huntState)) @@ -407,8 +370,6 @@ bool CCSBot::IsHunting() const } // Return true if we are in the MoveTo state - -/* <3b4571> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:447 */ bool CCSBot::IsMovingTo() const { if (m_state == static_cast(&m_moveToState)) @@ -418,8 +379,6 @@ bool CCSBot::IsMovingTo() const } // Return true if we are buying - -/* <3b4598> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:460 */ bool CCSBot::IsBuying() const { if (m_state == static_cast(&m_buyState)) @@ -429,8 +388,6 @@ bool CCSBot::IsBuying() const } // Move to potentially distant position - -/* <3b45bf> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:472 */ void CCSBot::MoveTo(const Vector *pos, RouteType route) { m_moveToState.SetGoalPosition(*pos); @@ -438,29 +395,23 @@ void CCSBot::MoveTo(const Vector *pos, RouteType route) SetState(&m_moveToState); } -/* <3b463c> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:480 */ void CCSBot::PlantBomb() { SetState(&m_plantBombState); } // Bomb has been dropped - go get it - -/* <3b4663> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:489 */ void CCSBot::FetchBomb() { SetState(&m_fetchBombState); } -/* <3b468a> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:495 */ void CCSBot::DefuseBomb() { SetState(&m_defuseBombState); } // Investigate recent enemy noise - -/* <3b46b1> ../cstrike/dlls/bot/cs_bot_statemachine.cpp:504 */ void CCSBot::InvestigateNoise() { SetState(&m_investigateNoiseState); diff --git a/regamedll/dlls/bot/cs_bot_update.cpp b/regamedll/dlls/bot/cs_bot_update.cpp index e3462d47..94e75ef9 100644 --- a/regamedll/dlls/bot/cs_bot_update.cpp +++ b/regamedll/dlls/bot/cs_bot_update.cpp @@ -1,13 +1,9 @@ #include "precompiled.h" // Lightweight maintenance, invoked frequently - -/* <3c635f> ../cstrike/dlls/bot/cs_bot_update.cpp:26 */ void CCSBot::__MAKE_VHOOK(Upkeep)() { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->IsLearningMap() || !IsAlive()) + if (TheCSBots()->IsLearningMap() || !IsAlive()) return; if (m_isRapidFiring) @@ -151,15 +147,11 @@ void CCSBot::__MAKE_VHOOK(Upkeep)() } // Heavyweight processing, invoked less often - -/* <3c6e1e> ../cstrike/dlls/bot/cs_bot_update.cpp:208 */ void CCSBot::__MAKE_VHOOK(Update)() { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL) + if (TheCSBots()->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL) { - ctrl->AckAnalysisRequest(); + TheCSBots()->AckAnalysisRequest(); StartAnalyzeAlphaProcess(); } @@ -191,7 +183,7 @@ void CCSBot::__MAKE_VHOOK(Update)() } // show line of fire - if ((cv_bot_traceview.value == 100.0f && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 101.0f) + if ((cv_bot_traceview.value == 100.0 && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 101.0) { UTIL_MakeVectors(pev->punchangle + pev->v_angle); @@ -207,18 +199,46 @@ void CCSBot::__MAKE_VHOOK(Update)() } } + // // Debug beam rendering - if (cv_bot_traceview.value == 2.0f && IsLocalPlayerWatchingMe() || cv_bot_traceview.value == 3.0f) + // + + // show approach points + if ((cv_bot_traceview.value == 2.0f && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 3.0f) DrawApproachPoints(); - if (cv_bot_traceview.value == 4.0f && IsLocalPlayerWatchingMe() || cv_bot_traceview.value == 5.0f) + // show encounter spot data + if ((cv_bot_traceview.value == 4.0f && IsLocalPlayerWatchingMe()) || cv_bot_traceview.value == 5.0f) { - // ... + if (m_spotEncounter != NULL) + { + UTIL_DrawBeamPoints(m_spotEncounter->path.from, m_spotEncounter->path.to, 3, 0, 0, 255); + + Vector dir = m_spotEncounter->path.to - m_spotEncounter->path.from; + float length = dir.NormalizeInPlace(); + + const SpotOrder *order; + Vector along; + + for (SpotOrderList::const_iterator iter = m_spotEncounter->spotList.begin(); iter != m_spotEncounter->spotList.end(); ++iter) + { + order = &(*iter); + + along = m_spotEncounter->path.from + order->t * length * dir; + + UTIL_DrawBeamPoints(along, *order->spot->GetPosition(), 3, 0, 255, 255); + } + } } + // show path navigation data if (cv_bot_traceview.value == 1.0f && IsLocalPlayerWatchingMe()) { - // ... + Vector from = GetEyePosition(); + const float size = 50.0f; + + Vector arrow(size * float(Q_cos(m_lookAheadAngle * M_PI / 180.0f)), size * float(Q_sin(m_lookAheadAngle * M_PI / 180.0f)), 0.0f); + UTIL_DrawBeamPoints(from, from + arrow, 1, 0, 255, 255); } if (cv_bot_stop.value != 0.0f) @@ -275,6 +295,7 @@ void CCSBot::__MAKE_VHOOK(Update)() default: Crouch(); break; } } + if (m_blindFire) { PrimaryAttack(); @@ -294,10 +315,14 @@ void CCSBot::__MAKE_VHOOK(Update)() // adjust our personal "safe" time AdjustSafeTime(); - // Decide if we should attack - bool doAttack = false; - if (!IsUsingGrenade()) + if (IsUsingGrenade()) { + ThrowGrenade(&threat->pev->origin); + } + else + { + // Decide if we should attack + bool doAttack = false; switch (GetDisposition()) { case IGNORE_ENEMIES: @@ -327,50 +352,48 @@ void CCSBot::__MAKE_VHOOK(Update)() break; } } + + if (doAttack) + { + if (GetEnemy() == NULL || threat != GetEnemy() || !IsAttacking()) + { + if (IsUsingKnife() && IsHiding()) + { + // if hiding with a knife, wait until threat is close + const float knifeAttackRange = 250.0f; + if ((pev->origin - threat->pev->origin).IsLengthLessThan(knifeAttackRange)) + { + Attack(threat); + } + } + else + { + Attack(threat); + } + } + } + else + { + // dont attack, but keep track of nearby enemies + SetEnemy(threat); + m_isEnemyVisible = true; + } } - else - ThrowGrenade(&pev->origin); // if we aren't attacking but we are being attacked, retaliate - if (!doAttack && !IsAttacking() && GetDisposition() != IGNORE_ENEMIES) + if (GetDisposition() != IGNORE_ENEMIES && !IsAttacking()) { const float recentAttackDuration = 1.0f; if (GetTimeSinceAttacked() < recentAttackDuration) { // we may not be attacking our attacker, but at least we're not just taking it // (since m_attacker isn't reaction-time delayed, we can't directly use it) - doAttack = true; + Attack(threat); PrintIfWatched("Ouch! Retaliating!\n"); } } - if (doAttack) - { - if (GetEnemy() == NULL || !IsAttacking() || threat != GetEnemy()) - { - if (IsUsingKnife() && IsHiding()) - { - // if hiding with a knife, wait until threat is close - const float knifeAttackRange = 250.0f; - if ((pev->origin - threat->pev->origin).IsLengthLessThan(knifeAttackRange)) - { - Attack(threat); - } - } - else - { - Attack(threat); - } - } - } - else - { - // dont attack, but keep track of nearby enemies - SetEnemy(threat); - m_isEnemyVisible = true; - } - - ctrl->SetLastSeenEnemyTimestamp(); + TheCSBots()->SetLastSeenEnemyTimestamp(); } // Validate existing enemy, if any @@ -384,6 +407,7 @@ void CCSBot::__MAKE_VHOOK(Update)() } else { + const int dada = offsetof(CCSBot, m_visibleEnemyParts); // check LOS to current enemy (chest & head), in case he's dead (GetNearestEnemy() only returns live players) // note we're not checking FOV - once we've acquired an enemy (which does check FOV), assume we know roughly where he is if (IsVisible(m_enemy, false, &m_visibleEnemyParts)) @@ -462,7 +486,6 @@ void CCSBot::__MAKE_VHOOK(Update)() m_isWaitingToTossGrenade = false; } - if (IsHunting() && IsWellPastSafe() && IsUsingGrenade()) { EquipBestWeapon(MUST_EQUIP); @@ -540,10 +563,10 @@ void CCSBot::__MAKE_VHOOK(Update)() GetChatter()->SpottedBomber(GetBomber()); if (CanSeeLooseBomb()) - GetChatter()->SpottedLooseBomb(ctrl->GetLooseBomb()); + GetChatter()->SpottedLooseBomb(TheCSBots()->GetLooseBomb()); // Scenario interrupts - switch (ctrl->GetScenario()) + switch (TheCSBots()->GetScenario()) { case CCSBotManager::SCENARIO_DEFUSE_BOMB: { @@ -556,9 +579,9 @@ void CCSBot::__MAKE_VHOOK(Update)() gonnaBlowTime *= 0.66f; if (!IsEscapingFromBomb() // we aren't already escaping the bomb - && ctrl->IsBombPlanted() // is the bomb planted + && TheCSBots()->IsBombPlanted() // is the bomb planted && GetGameState()->IsPlantedBombLocationKnown() // we know where the bomb is - && ctrl->GetBombTimeLeft() < gonnaBlowTime // is the bomb about to explode + && TheCSBots()->GetBombTimeLeft() < gonnaBlowTime // is the bomb about to explode && !IsDefusingBomb() // we aren't defusing the bomb && !IsAttacking()) // we aren't in the midst of a firefight { @@ -598,7 +621,7 @@ void CCSBot::__MAKE_VHOOK(Update)() // give us a chance to do something else. const float earliestAutoFollowTime = 5.0f; const float minAutoFollowTeamwork = 0.4f; - if (ctrl->GetElapsedRoundTime() > earliestAutoFollowTime + if (TheCSBots()->GetElapsedRoundTime() > earliestAutoFollowTime && GetProfile()->GetTeamwork() > minAutoFollowTeamwork && CanAutoFollow() && !IsBusy() @@ -629,7 +652,7 @@ void CCSBot::__MAKE_VHOOK(Update)() Follow(leader); PrintIfWatched("Auto-Following %s\n", STRING(leader->pev->netname)); - if (g_pGameRules->IsCareer()) + if (CSGameRules()->IsCareer()) { GetChatter()->Say("FollowingCommander", 10.0f); } @@ -678,7 +701,7 @@ void CCSBot::__MAKE_VHOOK(Update)() { if (GetMorale() * -40.0 > RANDOM_FLOAT(0.0f, 100.0f)) { - if (ctrl->IsOnOffense(this) || !ctrl->IsDefenseRushing()) + if (TheCSBots()->IsOnOffense(this) || !TheCSBots()->IsDefenseRushing()) { SetDisposition(OPPORTUNITY_FIRE); Hide(m_lastKnownArea, RANDOM_FLOAT(3.0f, 15.0f)); diff --git a/regamedll/dlls/bot/cs_bot_vision.cpp b/regamedll/dlls/bot/cs_bot_vision.cpp index aa70052d..3c5cb842 100644 --- a/regamedll/dlls/bot/cs_bot_vision.cpp +++ b/regamedll/dlls/bot/cs_bot_vision.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Used to update view angles to stay on a ladder - -/* <3d8352> ../cstrike/dlls/bot/cs_bot_vision.cpp:16 */ float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder) { // determine our facing @@ -25,12 +23,10 @@ float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder) return 0.0f; } +#ifndef HOOK_GAMEDLL // Move actual view angles towards desired ones. // This is the only place v_angle is altered. // TODO: Make stiffness and turn rate constants timestep invariant. - -/* <3d882c> ../cstrike/dlls/bot/cs_bot_vision.cpp:48 */ -#ifndef HOOK_GAMEDLL void CCSBot::UpdateLookAngles() { const float deltaT = g_flBotCommandInterval; @@ -198,8 +194,6 @@ void CCSBot::UpdateLookAngles() #endif // HOOK_GAMEDLL // Return true if we can see the point - -/* <3d8c91> ../cstrike/dlls/bot/cs_bot_vision.cpp:238 */ bool CCSBot::__MAKE_VHOOK(IsVisible)(const Vector *pos, bool testFOV) const { // we can't see anything if we're blind @@ -227,8 +221,6 @@ bool CCSBot::__MAKE_VHOOK(IsVisible)(const Vector *pos, bool testFOV) const // Return true if we can see any part of the player // Check parts in order of importance. Return the first part seen in "visParts" if it is non-NULL. - -/* <3d8d9b> ../cstrike/dlls/bot/cs_bot_vision.cpp:269 */ bool CCSBot::__MAKE_VHOOK(IsVisible)(CBasePlayer *player, bool testFOV, unsigned char *visParts) const { Vector spot = player->pev->origin; @@ -283,7 +275,6 @@ bool CCSBot::__MAKE_VHOOK(IsVisible)(CBasePlayer *player, bool testFOV, unsigned return false; } -/* <3d8f9f> ../cstrike/dlls/bot/cs_bot_vision.cpp:302 */ bool CCSBot::__MAKE_VHOOK(IsEnemyPartVisible)(VisiblePartType part) const { if (!IsEnemyVisible()) @@ -292,7 +283,6 @@ bool CCSBot::__MAKE_VHOOK(IsEnemyPartVisible)(VisiblePartType part) const return (m_visibleEnemyParts & part) != 0; } -/* <3d8f0d> ../cstrike/dlls/bot/cs_bot_vision.cpp:331 */ void CCSBot::UpdateLookAt() { Vector to = m_lookAtSpot - EyePosition(); @@ -303,8 +293,6 @@ void CCSBot::UpdateLookAt() } // Look at the given point in space for the given duration (-1 means forever) - -/* <3d900c> ../cstrike/dlls/bot/cs_bot_vision.cpp:345 */ void CCSBot::SetLookAt(const char *desc, const Vector *pos, PriorityType pri, float duration, bool clearIfClose, float angleTolerance) { if (pos == NULL) @@ -338,16 +326,12 @@ void CCSBot::SetLookAt(const char *desc, const Vector *pos, PriorityType pri, fl } // Block all "look at" and "look around" behavior for given duration - just look ahead - -/* <3d90a7> ../cstrike/dlls/bot/cs_bot_vision.cpp:383 */ void CCSBot::InhibitLookAround(float duration) { m_inhibitLookAroundTimestamp = gpGlobals->time + duration; } // Update enounter spot timestamps, etc - -/* <3d90d3> ../cstrike/dlls/bot/cs_bot_vision.cpp:392 */ void CCSBot::UpdatePeripheralVision() { // if we update at 10Hz, this ensures we test once every three @@ -383,8 +367,6 @@ void CCSBot::UpdatePeripheralVision() } // Update the "looking around" behavior. - -/* <3d91af> ../cstrike/dlls/bot/cs_bot_vision.cpp:429 */ void CCSBot::UpdateLookAround(bool updateNow) { // check if looking around has been inhibited @@ -504,8 +486,8 @@ void CCSBot::UpdateLookAround(bool updateNow) // figure out how far along the path segment we are Vector delta = m_spotEncounter->path.to - m_spotEncounter->path.from; float_precision length = delta.Length(); - float adx = (float)abs(int64(delta.x)); - float ady = (float)abs(int64(delta.y)); + float adx = float(Q_abs(int64(delta.x))); + float ady = float(Q_abs(int64(delta.y))); float_precision t; if (adx > ady) @@ -523,7 +505,7 @@ void CCSBot::UpdateLookAround(bool updateNow) t = 1.0f; // collect the unchecked spots so far - #define MAX_DANGER_SPOTS 8 + const int MAX_DANGER_SPOTS = 8; HidingSpot *dangerSpot[MAX_DANGER_SPOTS]; int dangerSpotCount = 0; int dangerIndex = 0; @@ -571,8 +553,6 @@ void CCSBot::UpdateLookAround(bool updateNow) } // "Bend" our line of sight around corners until we can "see" the point. - -/* <3d9618> ../cstrike/dlls/bot/cs_bot_vision.cpp:628 */ bool CCSBot::BendLineOfSight(const Vector *eye, const Vector *point, Vector *bend) const { // if we can directly see the point, use it @@ -652,7 +632,6 @@ bool CCSBot::BendLineOfSight(const Vector *eye, const Vector *point, Vector *ben return false; } -/* <3d99e8> ../cstrike/dlls/bot/cs_bot_vision.cpp:707 */ CBasePlayer *CCSBot::FindMostDangerousThreat() { // maximum number of simulataneously attendable threats @@ -907,8 +886,6 @@ CBasePlayer *CCSBot::FindMostDangerousThreat() } // Update our reaction time queue - -/* <3d9f7d> ../cstrike/dlls/bot/cs_bot_vision.cpp:960 */ void CCSBot::UpdateReactionQueue() { // zombies dont see any threats @@ -935,8 +912,7 @@ void CCSBot::UpdateReactionQueue() } // queue is round-robin - ++m_enemyQueueIndex; - if (m_enemyQueueIndex >= MAX_ENEMY_QUEUE) + if (++m_enemyQueueIndex >= MAX_ENEMY_QUEUE) m_enemyQueueIndex = 0; if (m_enemyQueueCount < MAX_ENEMY_QUEUE) @@ -949,18 +925,16 @@ void CCSBot::UpdateReactionQueue() reactionTime = maxReactionTime; // "rewind" time back to our reaction time - int reactionTimeSteps = (int)((reactionTime / g_flBotFullThinkInterval) + 0.5f); + int reactionTimeSteps = int((reactionTime / g_flBotFullThinkInterval) + 0.5f); int i = now - reactionTimeSteps; if (i < 0) i += MAX_ENEMY_QUEUE; - m_enemyQueueAttendIndex = (byte)i; + m_enemyQueueAttendIndex = byte(i); } // Return the most dangerous threat we are "conscious" of - -/* <3da052> ../cstrike/dlls/bot/cs_bot_vision.cpp:1013 */ CBasePlayer *CCSBot::GetRecognizedEnemy() { if (m_enemyQueueAttendIndex >= m_enemyQueueCount) @@ -970,8 +944,6 @@ CBasePlayer *CCSBot::GetRecognizedEnemy() } // Return true if the enemy we are "conscious" of is reloading - -/* <3da075> ../cstrike/dlls/bot/cs_bot_vision.cpp:1025 */ bool CCSBot::IsRecognizedEnemyReloading() { if (m_enemyQueueAttendIndex >= m_enemyQueueCount) @@ -981,8 +953,6 @@ bool CCSBot::IsRecognizedEnemyReloading() } // Return true if the enemy we are "conscious" of is hiding behind a shield - -/* <3da09d> ../cstrike/dlls/bot/cs_bot_vision.cpp:1037 */ bool CCSBot::IsRecognizedEnemyProtectedByShield() { if (m_enemyQueueAttendIndex >= m_enemyQueueCount) @@ -992,8 +962,6 @@ bool CCSBot::IsRecognizedEnemyProtectedByShield() } // Return distance to closest enemy we are "conscious" of - -/* <3da0c5> ../cstrike/dlls/bot/cs_bot_vision.cpp:1049 */ float CCSBot::GetRangeToNearestRecognizedEnemy() { const CBasePlayer *enemy = GetRecognizedEnemy(); @@ -1007,8 +975,6 @@ float CCSBot::GetRangeToNearestRecognizedEnemy() } // Blind the bot for the given duration - -/* <3da170> ../cstrike/dlls/bot/cs_bot_vision.cpp:1063 */ void CCSBot::__MAKE_VHOOK(Blind)(float duration, float holdTime, float fadeTime, int alpha) { // extend diff --git a/regamedll/dlls/bot/cs_bot_weapon.cpp b/regamedll/dlls/bot/cs_bot_weapon.cpp index 581ff721..db91a411 100644 --- a/regamedll/dlls/bot/cs_bot_weapon.cpp +++ b/regamedll/dlls/bot/cs_bot_weapon.cpp @@ -2,8 +2,6 @@ // Fire our active weapon towards our current enemy // NOTE: Aiming our weapon is handled in RunBotUpkeep() - -/* <3eb434> ../cstrike/dlls/bot/cs_bot_weapon.cpp:17 */ void CCSBot::FireWeaponAtEnemy() { CBasePlayer *enemy = GetEnemy(); @@ -38,7 +36,7 @@ void CCSBot::FireWeaponAtEnemy() const float_precision halfPI = (M_PI / 180.0f); float_precision yaw = pev->v_angle[ YAW ] * halfPI; - Vector2D dir(cos(yaw), sin(yaw)); + Vector2D dir(Q_cos(yaw), Q_sin(yaw)); float_precision onTarget = DotProduct(toAimSpot, dir); // aim more precisely with a sniper rifle @@ -46,7 +44,7 @@ void CCSBot::FireWeaponAtEnemy() const float_precision halfSize = (IsUsingSniperRifle()) ? HalfHumanWidth : 2.0f * HalfHumanWidth; // aiming tolerance depends on how close the target is - closer targets subtend larger angles - float_precision aimTolerance = cos(atan(halfSize / rangeToEnemy)); + float_precision aimTolerance = Q_cos(Q_atan(halfSize / rangeToEnemy)); if (onTarget > aimTolerance) { @@ -150,8 +148,6 @@ void CCSBot::FireWeaponAtEnemy() } // Set the current aim offset using given accuracy (1.0 = perfect aim, 0.0f = terrible aim) - -/* <3ea12d> ../cstrike/dlls/bot/cs_bot_weapon.cpp:210 */ void CCSBot::SetAimOffset(float accuracy) { // if our accuracy is less than perfect, it will improve as we "focus in" while not rotating our view @@ -181,7 +177,7 @@ void CCSBot::SetAimOffset(float accuracy) PrintIfWatched("Accuracy = %4.3f\n", accuracy); float range = (m_lastEnemyPosition - pev->origin).Length(); - const float_precision maxOffset = range * ((float_precision)m_iFOV / DEFAULT_FOV) * 0.1; + const float_precision maxOffset = range * (float_precision(m_iFOV) / DEFAULT_FOV) * 0.1; float error = maxOffset * (1 - accuracy); m_aimOffsetGoal[0] = RANDOM_FLOAT(-error, error); @@ -189,12 +185,10 @@ void CCSBot::SetAimOffset(float accuracy) m_aimOffsetGoal[2] = RANDOM_FLOAT(-error, error); // define time when aim offset will automatically be updated - m_aimOffsetTimestamp = gpGlobals->time + RANDOM_FLOAT(0.25, 1); + m_aimOffsetTimestamp = gpGlobals->time + RANDOM_FLOAT(0.25f, 1.0f); } // Wiggle aim error based on GetProfile()->GetSkill() - -/* <3ea224> ../cstrike/dlls/bot/cs_bot_weapon.cpp:252 */ void CCSBot::UpdateAimOffset() { if (gpGlobals->time >= m_aimOffsetTimestamp) @@ -213,8 +207,6 @@ void CCSBot::UpdateAimOffset() // Change our zoom level to be appropriate for the given range. // Return true if the zoom level changed. - -/* <3ea2b7> ../cstrike/dlls/bot/cs_bot_weapon.cpp:271 */ bool CCSBot::AdjustZoom(float range) { bool adjustZoom = false; @@ -269,8 +261,6 @@ bool CCSBot::AdjustZoom(float range) } // Return true if the given weapon is a sniper rifle - -/* <3e9e2d> ../cstrike/dlls/bot/cs_bot_weapon.cpp:320 */ bool isSniperRifle(CBasePlayerItem *item) { switch (item->m_iId) @@ -286,7 +276,6 @@ bool isSniperRifle(CBasePlayerItem *item) } } -/* <3ea3ab> ../cstrike/dlls/bot/cs_bot_weapon.cpp:342 */ bool CCSBot::IsUsingAWP() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -298,8 +287,6 @@ bool CCSBot::IsUsingAWP() const } // Returns true if we are using a weapon with a removable silencer - -/* <3ea3ce> ../cstrike/dlls/bot/cs_bot_weapon.cpp:357 */ bool CCSBot::DoesActiveWeaponHaveSilencer() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -314,8 +301,6 @@ bool CCSBot::DoesActiveWeaponHaveSilencer() const } // Return true if we are using a sniper rifle - -/* <3ea3f1> ../cstrike/dlls/bot/cs_bot_weapon.cpp:375 */ bool CCSBot::IsUsingSniperRifle() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -327,8 +312,6 @@ bool CCSBot::IsUsingSniperRifle() const } // Return true if we have a sniper rifle in our inventory - -/* <3ea462> ../cstrike/dlls/bot/cs_bot_weapon.cpp:387 */ bool CCSBot::IsSniper() const { for (int i = 0; i < MAX_ITEM_TYPES; ++i) @@ -348,8 +331,6 @@ bool CCSBot::IsSniper() const } // Return true if we are actively sniping (moving to sniper spot or settled in) - -/* <3ea4c1> ../cstrike/dlls/bot/cs_bot_weapon.cpp:405 */ bool CCSBot::IsSniping() const { if (GetTask() == MOVE_TO_SNIPER_SPOT || GetTask() == SNIPING) @@ -359,8 +340,6 @@ bool CCSBot::IsSniping() const } // Return true if we are using a shotgun - -/* <3ea4e8> ../cstrike/dlls/bot/cs_bot_weapon.cpp:417 */ bool CCSBot::IsUsingShotgun() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -375,8 +354,6 @@ bool CCSBot::IsUsingShotgun() const } // Returns true if using the big 'ol machinegun - -/* <3ea50f> ../cstrike/dlls/bot/cs_bot_weapon.cpp:437 */ bool CCSBot::IsUsingMachinegun() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -388,8 +365,6 @@ bool CCSBot::IsUsingMachinegun() const } // Return true if primary weapon doesn't exist or is totally out of ammo - -/* <3ea532> ../cstrike/dlls/bot/cs_bot_weapon.cpp:449 */ bool CCSBot::IsPrimaryWeaponEmpty() const { CBasePlayerWeapon *weapon = static_cast(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); @@ -405,8 +380,6 @@ bool CCSBot::IsPrimaryWeaponEmpty() const } // Return true if pistol doesn't exist or is totally out of ammo - -/* <3ea578> ../cstrike/dlls/bot/cs_bot_weapon.cpp:467 */ bool CCSBot::IsPistolEmpty() const { CBasePlayerWeapon *weapon = static_cast(m_rgpPlayerItems[ PISTOL_SLOT ]); @@ -424,8 +397,6 @@ bool CCSBot::IsPistolEmpty() const } // Equip the given item - -/* <3ea5d9> ../cstrike/dlls/bot/cs_bot_weapon.cpp:485 */ bool CCSBot::DoEquip(CBasePlayerWeapon *gun) { if (gun == NULL) @@ -446,38 +417,35 @@ bool CCSBot::DoEquip(CBasePlayerWeapon *gun) const float minEquipInterval = 5.0f; // Equip the best weapon we are carrying that has ammo - -/* <3ea621> ../cstrike/dlls/bot/cs_bot_weapon.cpp:510 */ void CCSBot::EquipBestWeapon(bool mustEquip) { // throttle how often equipping is allowed if (!mustEquip && m_equipTimer.GetElapsedTime() < minEquipInterval) return; - CCSBotManager *ctrl = TheCSBots(); CBasePlayerWeapon *primary = static_cast(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); if (primary != NULL) { WeaponClassType weaponClass = WeaponIDToWeaponClass(primary->m_iId); - if ((ctrl->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) - || (ctrl->AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN) - || (ctrl->AllowRifles() && weaponClass == WEAPONCLASS_RIFLE) + if ((TheCSBots()->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) + || (TheCSBots()->AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN) + || (TheCSBots()->AllowRifles() && weaponClass == WEAPONCLASS_RIFLE) #ifndef REGAMEDLL_FIXES // TODO: already is checked shotguns! - || (ctrl->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) -#endif // REGAMEDLL_FIXES - || (ctrl->AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE) - || (ctrl->AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN) - || (ctrl->AllowTacticalShield() && primary->m_iId == WEAPON_SHIELDGUN)) + || (TheCSBots()->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN) +#endif + || (TheCSBots()->AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE) + || (TheCSBots()->AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN) + || (TheCSBots()->AllowTacticalShield() && primary->m_iId == WEAPON_SHIELDGUN)) { if (DoEquip(primary)) return; } } - if (ctrl->AllowPistols()) + if (TheCSBots()->AllowPistols()) { if (DoEquip(static_cast(m_rgpPlayerItems[ PISTOL_SLOT ]))) return; @@ -488,8 +456,6 @@ void CCSBot::EquipBestWeapon(bool mustEquip) } // Equip our pistol - -/* <3ea7fe> ../cstrike/dlls/bot/cs_bot_weapon.cpp:557 */ void CCSBot::EquipPistol() { // throttle how often equipping is allowed @@ -504,8 +470,6 @@ void CCSBot::EquipPistol() } // Equip the knife - -/* <3ea91a> ../cstrike/dlls/bot/cs_bot_weapon.cpp:575 */ void CCSBot::EquipKnife() { if (!IsUsingKnife()) @@ -519,8 +483,6 @@ void CCSBot::EquipKnife() } // Return true if we have a grenade in our inventory - -/* <3ea98b> ../cstrike/dlls/bot/cs_bot_weapon.cpp:589 */ bool CCSBot::HasGrenade() const { CBasePlayerWeapon *grenade = static_cast(m_rgpPlayerItems[ GRENADE_SLOT ]); @@ -528,8 +490,6 @@ bool CCSBot::HasGrenade() const } // Equip a grenade, return false if we cant - -/* <3ea9ae> ../cstrike/dlls/bot/cs_bot_weapon.cpp:598 */ bool CCSBot::EquipGrenade(bool noSmoke) { // snipers don't use grenades @@ -557,8 +517,6 @@ bool CCSBot::EquipGrenade(bool noSmoke) } // Returns true if we have knife equipped - -/* <3eaa8c> ../cstrike/dlls/bot/cs_bot_weapon.cpp:624 */ bool CCSBot::IsUsingKnife() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -570,8 +528,6 @@ bool CCSBot::IsUsingKnife() const } // Returns true if we have pistol equipped - -/* <3eaac2> ../cstrike/dlls/bot/cs_bot_weapon.cpp:638 */ bool CCSBot::IsUsingPistol() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -583,8 +539,6 @@ bool CCSBot::IsUsingPistol() const } // Returns true if we have a grenade equipped - -/* <3eab09> ../cstrike/dlls/bot/cs_bot_weapon.cpp:652 */ bool CCSBot::IsUsingGrenade() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -600,7 +554,6 @@ bool CCSBot::IsUsingGrenade() const return false; } -/* <3eab3f> ../cstrike/dlls/bot/cs_bot_weapon.cpp:672 */ bool CCSBot::IsUsingHEGrenade() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -612,8 +565,6 @@ bool CCSBot::IsUsingHEGrenade() const } // Begin the process of throwing the grenade - -/* <3eab80> ../cstrike/dlls/bot/cs_bot_weapon.cpp:690 */ void CCSBot::ThrowGrenade(const Vector *target) { if (IsUsingGrenade() && !m_isWaitingToTossGrenade) @@ -628,8 +579,6 @@ void CCSBot::ThrowGrenade(const Vector *target) } // Find spot to throw grenade ahead of us and "around the corner" along our path - -/* <3eac08> ../cstrike/dlls/bot/cs_bot_weapon.cpp:709 */ bool CCSBot::FindGrenadeTossPathTarget(Vector *pos) { if (!HasPath()) @@ -728,8 +677,6 @@ bool CCSBot::FindGrenadeTossPathTarget(Vector *pos) } // Reload our weapon if we must - -/* <3eaf22> ../cstrike/dlls/bot/cs_bot_weapon.cpp:810 */ void CCSBot::ReloadCheck() { const float safeReloadWaitTime = 3.0f; @@ -802,8 +749,6 @@ void CCSBot::ReloadCheck() } // Silence/unsilence our weapon if we must - -/* <3eb0ac> ../cstrike/dlls/bot/cs_bot_weapon.cpp:885 */ void CCSBot::SilencerCheck() { // longer than reload check because reloading should take precedence @@ -819,7 +764,7 @@ void CCSBot::SilencerCheck() #ifdef REGAMEDLL_FIXES if (GetTimeSinceLastSawEnemy() < safeSilencerWaitTime) return; -#endif // REGAMEDLL_FIXES +#endif // don't touch the silencer if there are enemies nearby if (GetNearbyEnemyCount() == 0) @@ -839,7 +784,7 @@ void CCSBot::SilencerCheck() // equip silencer if we want to and we don't have a shield. if (isSilencerOn != (GetProfile()->PrefersSilencer() || GetProfile()->GetSkill() > 0.7f) && !HasShield()) -#endif // REGAMEDLL_FIXES +#endif { PrintIfWatched("%s silencer!\n", (isSilencerOn) ? "Unequipping" : "Equipping"); myGun->SecondaryAttack(); @@ -848,8 +793,6 @@ void CCSBot::SilencerCheck() } // Invoked when in contact with a CWeaponBox - -/* <3eb1a9> ../cstrike/dlls/bot/cs_bot_weapon.cpp:926 */ void CCSBot::__MAKE_VHOOK(OnTouchingWeapon)(CWeaponBox *box) { CBasePlayerItem *droppedGun = dynamic_cast(box->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); @@ -896,8 +839,6 @@ void CCSBot::__MAKE_VHOOK(OnTouchingWeapon)(CWeaponBox *box) // Return true if a friend is in our weapon's way // TODO: Check more rays for safety. - -/* <3eb277> ../cstrike/dlls/bot/cs_bot_weapon.cpp:977 */ bool CCSBot::IsFriendInLineOfFire() { UTIL_MakeVectors(pev->punchangle + pev->v_angle); @@ -928,8 +869,6 @@ bool CCSBot::IsFriendInLineOfFire() // Return line-of-sight distance to obstacle along weapon fire ray // TODO: Re-use this computation with IsFriendInLineOfFire() - -/* <3eb84d> ../cstrike/dlls/bot/cs_bot_weapon.cpp:1009 */ float CCSBot::ComputeWeaponSightRange() { UTIL_MakeVectors(pev->punchangle + pev->v_angle); diff --git a/regamedll/dlls/bot/cs_gamestate.cpp b/regamedll/dlls/bot/cs_gamestate.cpp index 09e3c02d..5467abd8 100644 --- a/regamedll/dlls/bot/cs_gamestate.cpp +++ b/regamedll/dlls/bot/cs_gamestate.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <3fcd6b> ../cstrike/dlls/bot/cs_gamestate.cpp:27 */ CSGameState::CSGameState(CCSBot *owner) { m_owner = owner; @@ -29,20 +28,16 @@ CSGameState::CSGameState(CCSBot *owner) } // Reset at round start - -/* <3fd4f4> ../cstrike/dlls/bot/cs_gamestate.cpp:55 */ void CSGameState::Reset() { int i; - CCSBotManager *ctrl = TheCSBots(); - m_isRoundOver = false; // bomb m_bombState = MOVING; m_lastSawBomber.Invalidate(); m_lastSawLooseBomb.Invalidate(); - m_bombsiteCount = ctrl->GetZoneCount(); + m_bombsiteCount = TheCSBots()->GetZoneCount(); m_isPlantedBombPosKnown = false; m_plantedBombsite = UNKNOWN; @@ -70,8 +65,6 @@ void CSGameState::Reset() } // Update game state based on events we have received - -/* <3fce67> ../cstrike/dlls/bot/cs_gamestate.cpp:97 */ void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { switch (event) @@ -103,14 +96,11 @@ void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity } // True if round has been won or lost (but not yet reset) - -/* <3fcf9c> ../cstrike/dlls/bot/cs_gamestate.cpp:144 */ bool CSGameState::IsRoundOver() const { return m_isRoundOver; } -/* <3fcfc6> ../cstrike/dlls/bot/cs_gamestate.cpp:150 */ void CSGameState::SetBombState(BombState state) { // if state changed, reset "last seen" timestamps @@ -120,7 +110,6 @@ void CSGameState::SetBombState(BombState state) } } -/* <3fcff2> ../cstrike/dlls/bot/cs_gamestate.cpp:160 */ void CSGameState::UpdateLooseBomb(const Vector *pos) { m_looseBombPos = *pos; @@ -130,13 +119,11 @@ void CSGameState::UpdateLooseBomb(const Vector *pos) SetBombState(LOOSE); } -/* <3fd06e> ../cstrike/dlls/bot/cs_gamestate.cpp:170 */ float CSGameState::TimeSinceLastSawLooseBomb() const { return m_lastSawLooseBomb.GetElapsedTime(); } -/* <3fd0f4> ../cstrike/dlls/bot/cs_gamestate.cpp:176 */ bool CSGameState::IsLooseBombLocationKnown() const { if (m_bombState != LOOSE) @@ -145,7 +132,6 @@ bool CSGameState::IsLooseBombLocationKnown() const return (m_lastSawLooseBomb.HasStarted()) ? true : false; } -/* <3fd135> ../cstrike/dlls/bot/cs_gamestate.cpp:185 */ void CSGameState::UpdateBomber(const Vector *pos) { m_bomberPos = *pos; @@ -155,13 +141,11 @@ void CSGameState::UpdateBomber(const Vector *pos) SetBombState(MOVING); } -/* <3fd1b1> ../cstrike/dlls/bot/cs_gamestate.cpp:195 */ float CSGameState::TimeSinceLastSawBomber() const { return m_lastSawBomber.GetElapsedTime(); } -/* <3fd237> ../cstrike/dlls/bot/cs_gamestate.cpp:201 */ bool CSGameState::IsPlantedBombLocationKnown() const { if (m_bombState != PLANTED) @@ -171,8 +155,6 @@ bool CSGameState::IsPlantedBombLocationKnown() const } // Return the zone index of the planted bombsite, or UNKNOWN - -/* <3fd25a> ../cstrike/dlls/bot/cs_gamestate.cpp:213 */ int CSGameState::GetPlantedBombsite() const { if (m_bombState != PLANTED) @@ -182,15 +164,12 @@ int CSGameState::GetPlantedBombsite() const } // Return true if we are currently in the bombsite where the bomb is planted - -/* <3fd284> ../cstrike/dlls/bot/cs_gamestate.cpp:225 */ bool CSGameState::IsAtPlantedBombsite() const { if (m_bombState != PLANTED) return false; - CCSBotManager *ctrl = TheCSBots(); - const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&m_owner->pev->origin); + const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&m_owner->pev->origin); if (zone != NULL) { @@ -201,8 +180,6 @@ bool CSGameState::IsAtPlantedBombsite() const } // Return the zone index of the next bombsite to search - -/* <3fd2d2> ../cstrike/dlls/bot/cs_gamestate.cpp:246 */ int CSGameState::GetNextBombsiteToSearch() { if (m_bombsiteCount <= 0) @@ -232,8 +209,6 @@ int CSGameState::GetNextBombsiteToSearch() // Returns position of bomb in its various states (moving, loose, planted), // or NULL if we don't know where the bomb is - -/* <3fd32c> ../cstrike/dlls/bot/cs_gamestate.cpp:277 */ const Vector *CSGameState::GetBombPosition() const { switch (m_bombState) @@ -265,12 +240,9 @@ const Vector *CSGameState::GetBombPosition() const } // We see the planted bomb at 'pos' - -/* <3fd373> ../cstrike/dlls/bot/cs_gamestate.cpp:313 */ void CSGameState::UpdatePlantedBomb(const Vector *pos) { - CCSBotManager *ctrl = TheCSBots(); - const CCSBotManager::Zone *zone = ctrl->GetClosestZone(pos); + const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(pos); if (zone == NULL) { @@ -288,8 +260,6 @@ void CSGameState::UpdatePlantedBomb(const Vector *pos) } // Someone told us where the bomb is planted - -/* <3fd3dd> ../cstrike/dlls/bot/cs_gamestate.cpp:337 */ void CSGameState::MarkBombsiteAsPlanted(int zoneIndex) { m_plantedBombsite = zoneIndex; @@ -297,15 +267,12 @@ void CSGameState::MarkBombsiteAsPlanted(int zoneIndex) } // Someone told us a bombsite is clear - -/* <3fd43a> ../cstrike/dlls/bot/cs_gamestate.cpp:347 */ void CSGameState::ClearBombsite(int zoneIndex) { if (zoneIndex >= 0 && zoneIndex < m_bombsiteCount) m_isBombsiteClear[zoneIndex] = true; } -/* <3fd475> ../cstrike/dlls/bot/cs_gamestate.cpp:354 */ bool CSGameState::IsBombsiteClear(int zoneIndex) const { if (zoneIndex >= 0 && zoneIndex < m_bombsiteCount) @@ -314,7 +281,6 @@ bool CSGameState::IsBombsiteClear(int zoneIndex) const return false; } -/* <3fd4b0> ../cstrike/dlls/bot/cs_gamestate.cpp:367 */ void CSGameState::InitializeHostageInfo() { m_hostageCount = 0; @@ -344,9 +310,7 @@ void CSGameState::InitializeHostageInfo() // Otherwise, this is based on our individual memory of the game state. // If NULL is returned, we don't think there are any hostages left, or we dont know where they are. // NOTE: a T can remember a hostage who has died. knowPos will be filled in, but NULL will be -// returned, since CHostages get deleted when they die. - -/* <3fd5ab> ../cstrike/dlls/bot/cs_gamestate.cpp:398 */ +// returned, since CHostages get deleted when they die. CHostage *CSGameState::GetNearestFreeHostage(Vector *knowPos) const { if (m_owner == NULL) @@ -412,8 +376,6 @@ CHostage *CSGameState::GetNearestFreeHostage(Vector *knowPos) const } // Return the location of a "free" hostage, or NULL if we dont know of any - -/* <3fdbd3> ../cstrike/dlls/bot/cs_gamestate.cpp:461 */ const Vector *CSGameState::GetRandomFreeHostagePosition() { // TODO: use static? @@ -460,8 +422,6 @@ const Vector *CSGameState::GetRandomFreeHostagePosition() // If we can see any of the positions where we think a hostage is, validate it // Return status of any changes (a hostage died or was moved) - -/* <3fdcd2> ../cstrike/dlls/bot/cs_gamestate.cpp:509 */ CSGameState::ValidateStatusType CSGameState::ValidateHostagePositions() { // limit how often we validate @@ -578,8 +538,6 @@ CSGameState::ValidateStatusType CSGameState::ValidateHostagePositions() // Return the nearest visible free hostage // Since we can actually see any hostage we return, we know its actual position - -/* <3fdef7> ../cstrike/dlls/bot/cs_gamestate.cpp:626 */ CHostage *CSGameState::GetNearestVisibleFreeHostage() const { CHostage *close = NULL; @@ -621,8 +579,6 @@ CHostage *CSGameState::GetNearestVisibleFreeHostage() const } // Return true if there are no free hostages - -/* <3fe064> ../cstrike/dlls/bot/cs_gamestate.cpp:668 */ bool CSGameState::AreAllHostagesBeingRescued() const { // if the hostages have all been rescued, they are not being rescued any longer @@ -664,8 +620,6 @@ bool CSGameState::AreAllHostagesBeingRescued() const } // All hostages have been rescued or are dead - -/* <3fe148> ../cstrike/dlls/bot/cs_gamestate.cpp:712 */ bool CSGameState::AreAllHostagesGone() const { if (m_allHostagesRescued) @@ -693,8 +647,6 @@ bool CSGameState::AreAllHostagesGone() const } // Someone told us all the hostages are gone - -/* <3fe1a2> ../cstrike/dlls/bot/cs_gamestate.cpp:742 */ void CSGameState::AllHostagesGone() { for (int i = 0; i < m_hostageCount; ++i) diff --git a/regamedll/dlls/bot/cs_gamestate.h b/regamedll/dlls/bot/cs_gamestate.h index 5bbb8755..efefde49 100644 --- a/regamedll/dlls/bot/cs_gamestate.h +++ b/regamedll/dlls/bot/cs_gamestate.h @@ -55,13 +55,13 @@ public: EXPLODED, // the bomb has exploded }; - bool IsBombMoving() const { return (m_bombState == MOVING); } - bool IsBombLoose() const { return (m_bombState == LOOSE); } - bool IsBombPlanted() const { return (m_bombState == PLANTED); } - bool IsBombDefused() const { return (m_bombState == DEFUSED); } - bool IsBombExploded() const { return (m_bombState == EXPLODED); } - - void UpdateLooseBomb(const Vector *pos); // we see the loose bomb + bool IsBombMoving() const { return (m_bombState == MOVING); } + bool IsBombLoose() const { return (m_bombState == LOOSE); } + bool IsBombPlanted() const { return (m_bombState == PLANTED); } + bool IsBombDefused() const { return (m_bombState == DEFUSED); } + bool IsBombExploded() const { return (m_bombState == EXPLODED); } + + void UpdateLooseBomb(const Vector *pos); // we see the loose bomb float TimeSinceLastSawLooseBomb() const; // how long has is been since we saw the loose bomb bool IsLooseBombLocationKnown() const; // do we know where the loose bomb is @@ -72,7 +72,7 @@ public: bool IsPlantedBombLocationKnown() const; // do we know where the bomb was planted void MarkBombsiteAsPlanted(int zoneIndex); // mark bombsite as the location of the planted bomb - enum { UNKNOWN = -1 }; + enum { UNKNOWN = -1 }; int GetPlantedBombsite() const; // return the zone index of the planted bombsite, or UNKNOWN bool IsAtPlantedBombsite() const; // return true if we are currently in the bombsite where the bomb is planted @@ -105,7 +105,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif CCSBot *m_owner; // who owns this gamestate bool m_isRoundOver; // true if round is over, but no yet reset @@ -139,12 +139,12 @@ private: Vector knownPos; bool isValid; bool isAlive; - bool isFree; // not being escorted by a CT + bool isFree; // not being escorted by a CT } - m_hostage[ MAX_HOSTAGES ]; + m_hostage[MAX_HOSTAGES]; int m_hostageCount; // number of hostages left in map CountdownTimer m_validateInterval; - NOXREF CBaseEntity *GetNearestHostage() const; // return the closest live hostage + CBaseEntity *GetNearestHostage() const; // return the closest live hostage void InitializeHostageInfo(); // initialize our knowledge of the number and location of hostages bool m_allHostagesRescued; // if true, so every hostages been is rescued diff --git a/regamedll/dlls/bot/states/cs_bot_attack.cpp b/regamedll/dlls/bot/states/cs_bot_attack.cpp index 81e061b2..4af030d9 100644 --- a/regamedll/dlls/bot/states/cs_bot_attack.cpp +++ b/regamedll/dlls/bot/states/cs_bot_attack.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Begin attacking - -/* <519735> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:16 */ void AttackState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { CBasePlayer *enemy = me->GetEnemy(); @@ -113,7 +111,6 @@ void AttackState::__MAKE_VHOOK(OnEnter)(CCSBot *me) m_isCoward = (RANDOM_FLOAT(0.0f, 100.0f) > 100.0f * me->GetProfile()->GetAggression()); } -/* <51a140> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:135 */ void AttackState::StopAttacking(CCSBot *me) { if (me->m_task == CCSBot::SNIPING) @@ -128,8 +125,6 @@ void AttackState::StopAttacking(CCSBot *me) } // Perform attack behavior - -/* <51997e> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:152 */ void AttackState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // can't be stuck while attacking @@ -540,8 +535,6 @@ void AttackState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } // Finish attack - -/* <5198d4> ../cstrike/dlls/bot/states/cs_bot_attack.cpp:578 */ void AttackState::__MAKE_VHOOK(OnExit)(CCSBot *me) { me->PrintIfWatched("AttackState:OnExit()\n"); diff --git a/regamedll/dlls/bot/states/cs_bot_buy.cpp b/regamedll/dlls/bot/states/cs_bot_buy.cpp index 5d024273..e1442c5f 100644 --- a/regamedll/dlls/bot/states/cs_bot_buy.cpp +++ b/regamedll/dlls/bot/states/cs_bot_buy.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <5291fd> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:18 */ bool HasDefaultPistol(CCSBot *me) { CBasePlayerWeapon *pistol = static_cast(me->m_rgpPlayerItems[ PISTOL_SLOT ]); @@ -18,12 +17,8 @@ bool HasDefaultPistol(CCSBot *me) } // Buy weapons, armor, etc. - -/* <5299e4> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:37 */ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { - CCSBotManager *ctrl = TheCSBots(); - m_retries = 0; m_prefRetries = 0; m_prefIndex = 0; @@ -39,10 +34,10 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me) if (me->m_iTeam == CT) { - if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB) + if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB) { // CT's sometimes buy defuse kits in the bomb scenario (except in career mode, where the player should defuse) - if (g_pGameRules->IsCareer() == false) + if (!CSGameRules()->IsCareer()) { const float buyDefuseKitChance = 50.0f; // 100.0f * (me->GetProfile()->GetSkill() + 0.2f); if (RANDOM_FLOAT(0.0f, 100.0f) < buyDefuseKitChance) @@ -53,7 +48,7 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } // determine if we want a tactical shield - if (!me->m_bHasPrimary && ctrl->AllowTacticalShield()) + if (!me->m_bHasPrimary && TheCSBots()->AllowTacticalShield()) { if (me->m_iAccount > 2500) { @@ -65,7 +60,7 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } } - if (ctrl->AllowGrenades()) + if (TheCSBots()->AllowGrenades()) { m_buyGrenade = (RANDOM_FLOAT(0.0f, 100.0f) < 33.3f) ? true : false; } @@ -76,7 +71,7 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me) m_buyPistol = false; - if (ctrl->AllowPistols()) + if (TheCSBots()->AllowPistols()) { CBasePlayerWeapon *pistol = static_cast(me->m_rgpPlayerItems[ PISTOL_SLOT ]); @@ -87,12 +82,12 @@ void BuyState::__MAKE_VHOOK(OnEnter)(CCSBot *me) if (HasDefaultPistol(me)) { // if everything other than pistols is disallowed, buy a pistol - if (ctrl->AllowShotguns() == false && - ctrl->AllowSubMachineGuns() == false && - ctrl->AllowRifles() == false && - ctrl->AllowMachineGuns() == false && - ctrl->AllowTacticalShield() == false && - ctrl->AllowSnipers() == false) + if (TheCSBots()->AllowShotguns() == false && + TheCSBots()->AllowSubMachineGuns() == false && + TheCSBots()->AllowRifles() == false && + TheCSBots()->AllowMachineGuns() == false && + TheCSBots()->AllowTacticalShield() == false && + TheCSBots()->AllowSnipers() == false) { m_buyPistol = (RANDOM_FLOAT(0, 100) < 75.0f); } @@ -201,8 +196,6 @@ BuyInfo secondaryWeaponBuyInfoT[ SECONDARY_WEAPON_BUY_COUNT ]; #endif // HOOK_GAMEDLL // Given a weapon alias, return the kind of weapon it is - -/* <52972b> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:212 */ inline WeaponType GetWeaponType(const char *alias) { int i; @@ -227,7 +220,6 @@ inline WeaponType GetWeaponType(const char *alias) return NUM_WEAPON_TYPES; } -/* <529753> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:241 */ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // wait for a Navigation Mesh @@ -247,11 +239,22 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // if we're done buying and still in the freeze period, wait if (m_doneBuying) { - if (g_pGameRules->IsMultiplayer() && g_pGameRules->IsFreezePeriod()) + if (CSGameRules()->IsMultiplayer() && CSGameRules()->IsFreezePeriod()) + { +#ifdef REGAMEDLL_FIXES + // make sure we're locked and loaded + me->EquipBestWeapon(MUST_EQUIP); + me->Reload(); + me->ResetStuckMonitor(); +#endif return; + } me->Idle(); - //return; + +#ifdef REGAMEDLL_FIXES + return; +#endif } // is the bot spawned outside of a buy zone? @@ -262,8 +265,6 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) return; } - CCSBotManager *ctrl = TheCSBots(); - // try to buy some weapons const float buyInterval = 0.2f; // 0.02f if (gpGlobals->time - me->GetStateTimestamp() > buyInterval) @@ -307,7 +308,7 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (weaponPreference == WEAPON_SHIELDGUN) { - if (ctrl->AllowTacticalShield()) + if (TheCSBots()->AllowTacticalShield()) buyAlias = "shield"; } else @@ -318,27 +319,27 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) switch (type) { case PISTOL: - if (!ctrl->AllowPistols()) + if (!TheCSBots()->AllowPistols()) buyAlias = NULL; break; case SHOTGUN: - if (!ctrl->AllowShotguns()) + if (!TheCSBots()->AllowShotguns()) buyAlias = NULL; break; case SUB_MACHINE_GUN: - if (!ctrl->AllowSubMachineGuns()) + if (!TheCSBots()->AllowSubMachineGuns()) buyAlias = NULL; break; case RIFLE: - if (!ctrl->AllowRifles()) + if (!TheCSBots()->AllowRifles()) buyAlias = NULL; break; case MACHINE_GUN: - if (!ctrl->AllowMachineGuns()) + if (!TheCSBots()->AllowMachineGuns()) buyAlias = NULL; break; case SNIPER_RIFLE: - if (!ctrl->AllowSnipers()) + if (!TheCSBots()->AllowSnipers()) buyAlias = NULL; break; } @@ -382,11 +383,11 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) for (int i = 0; i < PRIMARY_WEAPON_BUY_COUNT; ++i) { - if ((masterPrimary[i].type == SHOTGUN && ctrl->AllowShotguns()) || - (masterPrimary[i].type == SUB_MACHINE_GUN && ctrl->AllowSubMachineGuns()) || - (masterPrimary[i].type == RIFLE && ctrl->AllowRifles()) || - (masterPrimary[i].type == SNIPER_RIFLE && ctrl->AllowSnipers() && wantSniper) || - (masterPrimary[i].type == MACHINE_GUN && ctrl->AllowMachineGuns())) + if ((masterPrimary[i].type == SHOTGUN && TheCSBots()->AllowShotguns()) || + (masterPrimary[i].type == SUB_MACHINE_GUN && TheCSBots()->AllowSubMachineGuns()) || + (masterPrimary[i].type == RIFLE && TheCSBots()->AllowRifles()) || + (masterPrimary[i].type == SNIPER_RIFLE && TheCSBots()->AllowSnipers() && wantSniper) || + (masterPrimary[i].type == MACHINE_GUN && TheCSBots()->AllowMachineGuns())) { stockPrimary[ stockPrimaryCount++ ] = &masterPrimary[i]; } @@ -398,7 +399,7 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) int which; // on hard difficulty levels, bots try to buy preferred weapons on the first pass - if (m_retries == 0 && ctrl->GetDifficultyLevel() >= BOT_HARD) + if (m_retries == 0 && TheCSBots()->GetDifficultyLevel() >= BOT_HARD) { // count up available preferred weapons int prefCount = 0; @@ -448,7 +449,7 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) me->ClientCommand("vest"); // pistols - if we have no preferred pistol, buy at random - if (ctrl->AllowPistols() && !me->GetProfile()->HasPistolPreference()) + if (TheCSBots()->AllowPistols() && !me->GetProfile()->HasPistolPreference()) { if (m_buyPistol) { @@ -515,7 +516,6 @@ void BuyState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } -/* <5296f1> ../cstrike/dlls/bot/states/cs_bot_buy.cpp:529 */ void BuyState::__MAKE_VHOOK(OnExit)(CCSBot *me) { me->ResetStuckMonitor(); diff --git a/regamedll/dlls/bot/states/cs_bot_defuse_bomb.cpp b/regamedll/dlls/bot/states/cs_bot_defuse_bomb.cpp index ff74d0b3..379b41c8 100644 --- a/regamedll/dlls/bot/states/cs_bot_defuse_bomb.cpp +++ b/regamedll/dlls/bot/states/cs_bot_defuse_bomb.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Begin defusing the bomb - -/* <539f0e> ../cstrike/dlls/bot/states/cs_bot_defuse_bomb.cpp:16 */ void DefuseBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { me->Crouch(); @@ -11,12 +9,9 @@ void DefuseBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } // Defuse the bomb - -/* <539eac> ../cstrike/dlls/bot/states/cs_bot_defuse_bomb.cpp:27 */ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { const Vector *bombPos = me->GetGameState()->GetBombPosition(); - CCSBotManager *ctrl = TheCSBots(); if (bombPos == NULL) { @@ -34,13 +29,13 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (gpGlobals->time - me->GetStateTimestamp() > 1.0f) { // if we missed starting the defuse, give up - if (ctrl->GetBombDefuser() == NULL) + if (TheCSBots()->GetBombDefuser() == NULL) { me->PrintIfWatched("Failed to start defuse, giving up\n"); me->Idle(); return; } - else if (ctrl->GetBombDefuser() != me) + else if (TheCSBots()->GetBombDefuser() != me) { // if someone else got the defuse, give up me->PrintIfWatched("Someone else started defusing, giving up\n"); @@ -50,14 +45,13 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } // if bomb has been defused, give up - if (!ctrl->IsBombPlanted()) + if (!TheCSBots()->IsBombPlanted()) { me->Idle(); return; } } -/* <539e36> ../cstrike/dlls/bot/states/cs_bot_defuse_bomb.cpp:73 */ void DefuseBombState::__MAKE_VHOOK(OnExit)(CCSBot *me) { me->StandUp(); diff --git a/regamedll/dlls/bot/states/cs_bot_escape_from_bomb.cpp b/regamedll/dlls/bot/states/cs_bot_escape_from_bomb.cpp index ca4e84f9..6670ef6b 100644 --- a/regamedll/dlls/bot/states/cs_bot_escape_from_bomb.cpp +++ b/regamedll/dlls/bot/states/cs_bot_escape_from_bomb.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <5499ae> ../cstrike/dlls/bot/states/cs_bot_escape_from_bomb.cpp:16 */ void EscapeFromBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { me->StandUp(); @@ -10,8 +9,6 @@ void EscapeFromBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } // Escape from the bomb - -/* <549be9> ../cstrike/dlls/bot/states/cs_bot_escape_from_bomb.cpp:28 */ void EscapeFromBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { const Vector *bombPos = me->GetGameState()->GetBombPosition(); @@ -40,7 +37,6 @@ void EscapeFromBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } -/* <549976> ../cstrike/dlls/bot/states/cs_bot_escape_from_bomb.cpp:60 */ void EscapeFromBombState::__MAKE_VHOOK(OnExit)(CCSBot *me) { me->EquipBestWeapon(); diff --git a/regamedll/dlls/bot/states/cs_bot_fetch_bomb.cpp b/regamedll/dlls/bot/states/cs_bot_fetch_bomb.cpp index 3b69a86a..1e40f695 100644 --- a/regamedll/dlls/bot/states/cs_bot_fetch_bomb.cpp +++ b/regamedll/dlls/bot/states/cs_bot_fetch_bomb.cpp @@ -1,16 +1,12 @@ #include "precompiled.h" // Move to the bomb on the floor and pick it up - -/* <5587b3> ../cstrike/dlls/bot/states/cs_bot_fetch_bomb.cpp:17 */ void FetchBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { me->DestroyPath(); } // Move to the bomb on the floor and pick it up - -/* <5587fa> ../cstrike/dlls/bot/states/cs_bot_fetch_bomb.cpp:26 */ void FetchBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { if (me->IsCarryingBomb()) diff --git a/regamedll/dlls/bot/states/cs_bot_follow.cpp b/regamedll/dlls/bot/states/cs_bot_follow.cpp index 6f66cb6e..9241f60c 100644 --- a/regamedll/dlls/bot/states/cs_bot_follow.cpp +++ b/regamedll/dlls/bot/states/cs_bot_follow.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Follow our leader - -/* <56918b> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:16 */ void FollowState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { me->StandUp(); @@ -32,8 +30,6 @@ void FollowState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } // Determine the leader's motion state by tracking his speed - -/* <569268> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:48 */ void FollowState::ComputeLeaderMotionState(float leaderSpeed) { // walk = 130, run = 250 @@ -76,8 +72,6 @@ void FollowState::ComputeLeaderMotionState(float leaderSpeed) // Follow our leader // TODO: Clean up this nasty mess - -/* <569368> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:164 */ void FollowState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // if we lost our leader, give up @@ -260,7 +254,6 @@ void FollowState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } -/* <569231> ../cstrike/dlls/bot/states/cs_bot_follow.cpp:353 */ void FollowState::__MAKE_VHOOK(OnExit)(CCSBot *me) { ; diff --git a/regamedll/dlls/bot/states/cs_bot_hide.cpp b/regamedll/dlls/bot/states/cs_bot_hide.cpp index 2a04cb44..78355680 100644 --- a/regamedll/dlls/bot/states/cs_bot_hide.cpp +++ b/regamedll/dlls/bot/states/cs_bot_hide.cpp @@ -2,8 +2,6 @@ // Begin moving to a nearby hidey-hole. // NOTE: Do not forget this state may include a very long "move-to" time to get to our hidey spot! - -/* <57c261> ../cstrike/dlls/bot/states/cs_bot_hide.cpp:22 */ void HideState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { m_isAtSpot = false; @@ -42,12 +40,8 @@ void HideState::__MAKE_VHOOK(OnEnter)(CCSBot *me) // Move to a nearby hidey-hole. // NOTE: Do not forget this state may include a very long "move-to" time to get to our hidey spot! - -/* <57c35e> ../cstrike/dlls/bot/states/cs_bot_hide.cpp:59 */ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { - CCSBotManager *ctrl = TheCSBots(); - // wait until finished reloading to leave hide state if (!me->IsActiveWeaponReloading()) { @@ -56,16 +50,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB) { // if we're guarding the loose bomb, continue to guard it but pick a new spot - me->Hide(ctrl->GetLooseBombArea()); + me->Hide(TheCSBots()->GetLooseBombArea()); return; } else if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE) { // if we're guarding a bombsite, continue to guard it but pick a new spot - const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&me->pev->origin); + const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&me->pev->origin); if (zone != NULL) { - CNavArea *area = ctrl->GetRandomAreaInZone(zone); + CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone); if (area != NULL) { me->Hide(area); @@ -117,7 +111,7 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // TODO: Perhaps tie in to TakeDamage(), so it works for human players, too // Scenario logic - switch (ctrl->GetScenario()) + switch (TheCSBots()->GetScenario()) { case CCSBotManager::SCENARIO_DEFUSE_BOMB: { @@ -125,22 +119,22 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // if we are just holding position (due to a radio order) and the bomb has just planted, go defuse it if (me->GetTask() == CCSBot::HOLD_POSITION && - ctrl->IsBombPlanted() && - ctrl->GetBombPlantTimestamp() > me->GetStateTimestamp()) + TheCSBots()->IsBombPlanted() && + TheCSBots()->GetBombPlantTimestamp() > me->GetStateTimestamp()) { me->Idle(); return; } // if we are guarding the defuser and he dies/gives up, stop hiding (to choose another defuser) - if (me->GetTask() == CCSBot::GUARD_BOMB_DEFUSER && ctrl->GetBombDefuser() == NULL) + if (me->GetTask() == CCSBot::GUARD_BOMB_DEFUSER && TheCSBots()->GetBombDefuser() == NULL) { me->Idle(); return; } // if we are guarding the loose bomb and it is picked up, stop hiding - if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB && ctrl->GetLooseBomb() == NULL) + if (me->GetTask() == CCSBot::GUARD_LOOSE_BOMB && TheCSBots()->GetLooseBomb() == NULL) { me->GetChatter()->TheyPickedUpTheBomb(); me->Idle(); @@ -155,7 +149,7 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } // if we are guarding (bombsite, initial encounter, etc) and the bomb is planted, go defuse it - if (me->IsDoingScenario() && me->GetTask() == CCSBot::GUARD_BOMB_ZONE && ctrl->IsBombPlanted()) + if (me->IsDoingScenario() && me->GetTask() == CCSBot::GUARD_BOMB_ZONE && TheCSBots()->IsBombPlanted()) { me->Idle(); return; @@ -166,16 +160,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) else { // if we are near the ticking bomb and someone starts defusing it, attack! - if (ctrl->GetBombDefuser()) + if (TheCSBots()->GetBombDefuser()) { - Vector toDefuser = ctrl->GetBombDefuser()->pev->origin; + Vector toDefuser = TheCSBots()->GetBombDefuser()->pev->origin; const float hearDefuseRange = 2000.0f; if ((toDefuser - me->pev->origin).IsLengthLessThan(hearDefuseRange)) { // if we are nearby, attack, otherwise move to the bomb (which will cause us to attack when we see defuser) if (me->CanSeePlantedBomb()) { - me->Attack(ctrl->GetBombDefuser()); + me->Attack(TheCSBots()->GetBombDefuser()); } else { @@ -286,16 +280,16 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { if (me->m_iTeam == CT) { - if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE && me->IsAtHidingSpot() && ctrl->IsBombPlanted()) + if (me->GetTask() == CCSBot::GUARD_BOMB_ZONE && me->IsAtHidingSpot() && TheCSBots()->IsBombPlanted()) { if (me->GetNearbyEnemyCount() == 0) { const float someTime = 30.0f; const float littleTime = 11.0; - if (ctrl->GetBombTimeLeft() > someTime) + if (TheCSBots()->GetBombTimeLeft() > someTime) me->GetChatter()->Encourage("BombsiteSecure", RANDOM_FLOAT(10.0f, 15.0f)); - else if (ctrl->GetBombTimeLeft() > littleTime) + else if (TheCSBots()->GetBombTimeLeft() > littleTime) me->GetChatter()->Encourage("WaitingForHumanToDefuseBomb", RANDOM_FLOAT(5.0f, 8.0f)); else me->GetChatter()->Encourage("WaitingForHumanToDefuseBombPanic", RANDOM_FLOAT(3.0f, 4.0f)); @@ -401,9 +395,15 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) me->PrintIfWatched("No available hiding spots - hiding where I'm at.\n"); // hide where we are +#ifndef REGAMEDLL_FIXES m_hidingSpot.x = me->pev->origin.x; m_hidingSpot.x = me->pev->origin.y; m_hidingSpot.z = me->GetFeetZ(); +#else + m_hidingSpot.x = me->pev->origin.x; + m_hidingSpot.y = me->pev->origin.y; + m_hidingSpot.z = me->GetFeetZ(); +#endif } else { @@ -421,7 +421,6 @@ void HideState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } -/* <57c2c8> ../cstrike/dlls/bot/states/cs_bot_hide.cpp:450 */ void HideState::__MAKE_VHOOK(OnExit)(CCSBot *me) { m_isHoldingPosition = false; diff --git a/regamedll/dlls/bot/states/cs_bot_hunt.cpp b/regamedll/dlls/bot/states/cs_bot_hunt.cpp index d505e1d6..813e9a2d 100644 --- a/regamedll/dlls/bot/states/cs_bot_hunt.cpp +++ b/regamedll/dlls/bot/states/cs_bot_hunt.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Begin the hunt - -/* <58e6e0> ../cstrike/dlls/bot/states/cs_bot_hunt.cpp:18 */ void HuntState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { // lurking death @@ -18,8 +16,6 @@ void HuntState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } // Hunt down our enemies - -/* <58e452> ../cstrike/dlls/bot/states/cs_bot_hunt.cpp:38 */ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // if we've been hunting for a long time, drop into Idle for a moment to @@ -34,10 +30,8 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) return; } - CCSBotManager *ctrl = TheCSBots(); - // scenario logic - if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB) + if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB) { if (me->m_iTeam == TERRORIST) { @@ -45,7 +39,7 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (me->IsCarryingBomb()) { const float safeTime = 3.0f; - if (ctrl->IsTimeToPlantBomb() || (me->IsAtBombsite() && gpGlobals->time - me->GetLastSawEnemyTimestamp() > safeTime)) + if (TheCSBots()->IsTimeToPlantBomb() || (me->IsAtBombsite() && gpGlobals->time - me->GetLastSawEnemyTimestamp() > safeTime)) { me->Idle(); return; @@ -75,14 +69,14 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // if we are near the loose bomb and can see it, hide nearby and guard it me->SetTask(CCSBot::GUARD_LOOSE_BOMB); - me->Hide(ctrl->GetLooseBombArea()); - me->GetChatter()->AnnouncePlan("GoingToGuardLooseBomb", ctrl->GetLooseBombArea()->GetPlace()); + me->Hide(TheCSBots()->GetLooseBombArea()); + me->GetChatter()->AnnouncePlan("GoingToGuardLooseBomb", TheCSBots()->GetLooseBombArea()->GetPlace()); return; } - else if (ctrl->IsBombPlanted()) + else if (TheCSBots()->IsBombPlanted()) { // rogues will defuse a bomb, but not guard the defuser - if (!me->IsRogue() || !ctrl->GetBombDefuser()) + if (!me->IsRogue() || !TheCSBots()->GetBombDefuser()) { // search for the planted bomb to defuse me->Idle(); @@ -91,7 +85,7 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } } - else if (ctrl->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES) + else if (TheCSBots()->GetScenario() == CCSBotManager::SCENARIO_RESCUE_HOSTAGES) { if (me->m_iTeam == TERRORIST) { @@ -194,8 +188,6 @@ void HuntState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } // Done hunting - -/* <58e418> ../cstrike/dlls/bot/states/cs_bot_hunt.cpp:211 */ void HuntState::__MAKE_VHOOK(OnExit)(CCSBot *me) { ; diff --git a/regamedll/dlls/bot/states/cs_bot_idle.cpp b/regamedll/dlls/bot/states/cs_bot_idle.cpp index 00eca4ad..6fce13d7 100644 --- a/regamedll/dlls/bot/states/cs_bot_idle.cpp +++ b/regamedll/dlls/bot/states/cs_bot_idle.cpp @@ -6,8 +6,6 @@ const float sniperHideRange = 2000.0f; // The Idle state. // We never stay in the Idle state - it is a "home base" for the state machine that // does various checks to determine what we should do next. - -/* <5a12ee> ../cstrike/dlls/bot/states/cs_bot_idle.cpp:26 */ void IdleState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { me->DestroyPath(); @@ -22,7 +20,6 @@ void IdleState::__MAKE_VHOOK(OnEnter)(CCSBot *me) me->SetDisposition(CCSBot::ENGAGE_AND_INVESTIGATE); } -/* <5a0c66> ../cstrike/dlls/bot/states/cs_bot_idle.cpp:46 */ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // all other states assume GetLastKnownArea() is valid, ensure that it is @@ -50,19 +47,17 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } - CCSBotManager *ctrl = TheCSBots(); - // if round is over, hunt if (me->GetGameState()->IsRoundOver()) { // if we are escorting hostages, try to get to the rescue zone if (me->GetHostageEscortCount()) { - const CCSBotManager::Zone *zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE)); + const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE)); me->SetTask(CCSBot::RESCUE_HOSTAGES); me->Run(); me->SetDisposition(CCSBot::SELF_DEFENSE); - me->MoveTo(ctrl->GetRandomPositionInZone(zone), FASTEST_ROUTE); + me->MoveTo(TheCSBots()->GetRandomPositionInZone(zone), FASTEST_ROUTE); me->PrintIfWatched("Trying to rescue hostages at the end of the round\n"); return; } @@ -82,7 +77,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } // Scenario logic - switch (ctrl->GetScenario()) + switch (TheCSBots()->GetScenario()) { case CCSBotManager::SCENARIO_DEFUSE_BOMB: { @@ -97,7 +92,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (me->GetGameState()->GetPlantedBombsite() != CSGameState::UNKNOWN) { // T's always know where the bomb is - go defend it - const CCSBotManager::Zone *zone = ctrl->GetZone(me->GetGameState()->GetPlantedBombsite()); + const CCSBotManager::Zone *zone = TheCSBots()->GetZone(me->GetGameState()->GetPlantedBombsite()); me->SetTask(CCSBot::GUARD_TICKING_BOMB); Place place = TheNavAreaGrid.GetPlace(&zone->m_center); @@ -125,7 +120,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) int zoneIndex = me->GetGameState()->GetNextBombsiteToSearch(); // move to bombsite - if we reach it, we'll update its cleared status, causing us to select another - const Vector *pos = ctrl->GetRandomPositionInZone(ctrl->GetZone(zoneIndex)); + const Vector *pos = TheCSBots()->GetRandomPositionInZone(TheCSBots()->GetZone(zoneIndex)); if (pos != NULL) { me->SetTask(CCSBot::FIND_TICKING_BOMB); @@ -148,14 +143,14 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) return; } - else if (ctrl->IsTimeToPlantBomb()) + else if (TheCSBots()->IsTimeToPlantBomb()) { // move to the closest bomb site - const CCSBotManager::Zone *zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me)); + const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me)); if (zone != NULL) { // pick a random spot within the bomb zone - const Vector *pos = ctrl->GetRandomPositionInZone(zone); + const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone); if (pos != NULL) { // move to bombsite @@ -210,7 +205,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (bombPos != NULL) { // if someone is defusing the bomb, guard them - if (ctrl->GetBombDefuser()) + if (TheCSBots()->GetBombDefuser()) { if (!me->IsRogue()) { @@ -239,7 +234,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) else if (me->GetGameState()->GetPlantedBombsite() != CSGameState::UNKNOWN) { // we know which bombsite, but not exactly where the bomb is, go there - const CCSBotManager::Zone *zone = ctrl->GetZone(me->GetGameState()->GetPlantedBombsite()); + const CCSBotManager::Zone *zone = TheCSBots()->GetZone(me->GetGameState()->GetPlantedBombsite()); if (zone != NULL) { if (me->IsDoingScenario()) @@ -266,9 +261,9 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) const CCSBotManager::Zone *zone = NULL; float travelDistance = 9999999.9f; - for (int z = 0; z < ctrl->GetZoneCount(); ++z) + for (int z = 0; z < TheCSBots()->GetZoneCount(); ++z) { - if (ctrl->GetZone(z)->m_areaCount == 0) + if (TheCSBots()->GetZone(z)->m_areaCount == 0) continue; // don't check bombsites that have been cleared @@ -277,11 +272,11 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // just use the first overlapping nav area as a reasonable approximation ShortestPathCost pathCost = ShortestPathCost(); - float_precision dist = NavAreaTravelDistance(me->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&ctrl->GetZone(z)->m_center), pathCost); + float_precision dist = NavAreaTravelDistance(me->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&TheCSBots()->GetZone(z)->m_center), pathCost); if (/*dist >= 0.0f && */dist < travelDistance) { - zone = ctrl->GetZone(z); + zone = TheCSBots()->GetZone(z); travelDistance = dist; } } @@ -299,13 +294,13 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (zone == NULL) { int zoneIndex = me->GetGameState()->GetNextBombsiteToSearch(); - zone = ctrl->GetZone(zoneIndex); + zone = TheCSBots()->GetZone(zoneIndex); } // move to bombsite - if we reach it, we'll update its cleared status, causing us to select another if (zone != NULL) { - const Vector *pos = ctrl->GetRandomPositionInZone(zone); + const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone); if (pos != NULL) { me->SetTask(CCSBot::FIND_TICKING_BOMB); @@ -334,10 +329,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) else { // snipe bomb zone(s) - const CCSBotManager::Zone *zone = ctrl->GetRandomZone(); + const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone(); if (zone != NULL) { - snipingArea = ctrl->GetRandomAreaInZone(zone); + snipingArea = TheCSBots()->GetRandomAreaInZone(zone); me->PrintIfWatched("Sniping near bombsite\n"); } } @@ -355,7 +350,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // rogues just hunt, unless they want to snipe // if the whole team has decided to rush, hunt // if we know the bomb is dropped, hunt for enemies and the loose bomb - if (me->IsRogue() || ctrl->IsDefenseRushing() || me->GetGameState()->IsLooseBombLocationKnown()) + if (me->IsRogue() || TheCSBots()->IsDefenseRushing() || me->GetGameState()->IsLooseBombLocationKnown()) { me->Hunt(); return; @@ -372,10 +367,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) float guardRange = 500.0f + 100.0f * (me->GetMorale() + 3); // guard bomb zone(s) - const CCSBotManager::Zone *zone = ctrl->GetRandomZone(); + const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone(); if (zone != NULL) { - CNavArea *area = ctrl->GetRandomAreaInZone(zone); + CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone); if (area != NULL) { me->PrintIfWatched("I'm guarding a bombsite\n"); @@ -401,10 +396,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (RANDOM_FLOAT(0, 100) <= defenseSniperCampChance) { // snipe escape zone(s) - const CCSBotManager::Zone *zone = ctrl->GetRandomZone(); + const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone(); if (zone != NULL) { - CNavArea *area = ctrl->GetRandomAreaInZone(zone); + CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone); if (area != NULL) { me->SetTask(CCSBot::MOVE_TO_SNIPER_SPOT); @@ -419,7 +414,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // rogues just hunt, unless they want to snipe // if the whole team has decided to rush, hunt - if (me->IsRogue() || ctrl->IsDefenseRushing()) + if (me->IsRogue() || TheCSBots()->IsDefenseRushing()) break; // the lower our morale gets, the more we want to camp the escape zone(s) @@ -428,10 +423,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (RANDOM_FLOAT(0.0f, 100.0f) < guardEscapeZoneChance) { // guard escape zone(s) - const CCSBotManager::Zone *zone = ctrl->GetRandomZone(); + const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone(); if (zone != NULL) { - CNavArea *area = ctrl->GetRandomAreaInZone(zone); + CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone); if (area != NULL) { // guard the escape zone - stay closer if our morale is low @@ -455,21 +450,21 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) const float earlyTime = 20.0f; const CCSBotManager::Zone *zone = NULL; - if (ctrl->GetElapsedRoundTime() < earlyTime) + if (TheCSBots()->GetElapsedRoundTime() < earlyTime) { // pick random zone - zone = ctrl->GetRandomZone(); + zone = TheCSBots()->GetRandomZone(); } else { // pick closest zone - zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me)); + zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me)); } if (zone != NULL) { // pick a random spot within the escape zone - const Vector *pos = ctrl->GetRandomPositionInZone(zone); + const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone); if (pos != NULL) { // move to escape zone @@ -479,7 +474,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // tell team to follow const float repeatTime = 30.0f; - if (me->GetFriendsRemaining() && ctrl->GetRadioMessageInterval(EVENT_RADIO_FOLLOW_ME, me->m_iTeam) > repeatTime) + if (me->GetFriendsRemaining() && TheCSBots()->GetRadioMessageInterval(EVENT_RADIO_FOLLOW_ME, me->m_iTeam) > repeatTime) me->SendRadioMessage(EVENT_RADIO_FOLLOW_ME); return; } @@ -518,7 +513,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) else { // later in the game, camp either hostages or escape zone - const float campZoneChance = 100.0f * (ctrl->GetElapsedRoundTime() - me->GetSafeTime()) / 120.0f; + const float campZoneChance = 100.0f * (TheCSBots()->GetElapsedRoundTime() - me->GetSafeTime()) / 120.0f; campHostages = (RANDOM_FLOAT(0, 100) > campZoneChance) ? true : false; } @@ -576,7 +571,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // if the whole team has decided to rush, hunt if (me->GetFriendsRemaining()) { - if (me->IsRogue() || ctrl->IsDefenseRushing() || RANDOM_FLOAT(0, 100) < huntChance) + if (me->IsRogue() || TheCSBots()->IsDefenseRushing() || RANDOM_FLOAT(0, 100) < huntChance) { me->Hunt(); return; @@ -673,7 +668,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) // if we are escorting hostages, determine where to take them if (me->GetHostageEscortCount()) - zone = ctrl->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE)); + zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE)); // if we are escorting hostages and there are more hostages to rescue, // determine whether it's faster to rescue the ones we have, or go get the remaining ones @@ -727,7 +722,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) me->SetTask(CCSBot::RESCUE_HOSTAGES); me->Run(); me->SetDisposition(CCSBot::SELF_DEFENSE); - me->MoveTo(ctrl->GetRandomPositionInZone(zone), FASTEST_ROUTE); + me->MoveTo(TheCSBots()->GetRandomPositionInZone(zone), FASTEST_ROUTE); me->PrintIfWatched("I'm rescuing hostages\n"); me->GetChatter()->EscortingHostages(); return; diff --git a/regamedll/dlls/bot/states/cs_bot_investigate_noise.cpp b/regamedll/dlls/bot/states/cs_bot_investigate_noise.cpp index 41ff8ec9..65861167 100644 --- a/regamedll/dlls/bot/states/cs_bot_investigate_noise.cpp +++ b/regamedll/dlls/bot/states/cs_bot_investigate_noise.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Move towards currently heard noise - -/* <5b3114> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:17 */ void InvestigateNoiseState::AttendCurrentNoise(CCSBot *me) { if (!me->IsNoiseHeard() && me->GetNoisePosition()) @@ -23,15 +21,12 @@ void InvestigateNoiseState::AttendCurrentNoise(CCSBot *me) me->ForgetNoise(); } -/* <5b2f37> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:38 */ void InvestigateNoiseState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { AttendCurrentNoise(me); } // Use TravelDistance instead of distance... - -/* <5b2fa2> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:47 */ void InvestigateNoiseState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { float newNoiseDist; @@ -109,7 +104,6 @@ void InvestigateNoiseState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } -/* <5b2e95> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:129 */ void InvestigateNoiseState::__MAKE_VHOOK(OnExit)(CCSBot *me) { // reset to run mode in case we were sneaking about diff --git a/regamedll/dlls/bot/states/cs_bot_move_to.cpp b/regamedll/dlls/bot/states/cs_bot_move_to.cpp index 0f582e44..efe3eb27 100644 --- a/regamedll/dlls/bot/states/cs_bot_move_to.cpp +++ b/regamedll/dlls/bot/states/cs_bot_move_to.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Move to a potentially far away position. - -/* <5c4e91> ../cstrike/dlls/bot/states/cs_bot_move_to.cpp:21 */ void MoveToState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { if (me->IsUsingKnife() && me->IsWellPastSafe() && !me->IsHurrying()) @@ -37,12 +35,8 @@ void MoveToState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } // Move to a potentially far away position. - -/* <5c4edf> ../cstrike/dlls/bot/states/cs_bot_move_to.cpp:55 */ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { - CCSBotManager *ctrl = TheCSBots(); - // assume that we are paying attention and close enough to know our enemy died if (me->GetTask() == CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION) { @@ -60,7 +54,7 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) me->UpdateLookAround(); // Scenario logic - switch (ctrl->GetScenario()) + switch (TheCSBots()->GetScenario()) { case CCSBotManager::SCENARIO_DEFUSE_BOMB: { @@ -83,13 +77,13 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } // check off bombsites that we explore or happen to stumble into - for (int z = 0; z < ctrl->GetZoneCount(); ++z) + for (int z = 0; z < TheCSBots()->GetZoneCount(); ++z) { // don't re-check zones if (me->GetGameState()->IsBombsiteClear(z)) continue; - if (ctrl->GetZone(z)->m_extent.Contains(&me->pev->origin)) + if (TheCSBots()->GetZone(z)->m_extent.Contains(&me->pev->origin)) { // note this bombsite is clear me->GetGameState()->ClearBombsite(z); @@ -118,7 +112,7 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) case CCSBot::DEFUSE_BOMB: { // if we are trying to defuse the bomb, and someone has started defusing, guard them instead - if (me->CanSeePlantedBomb() && ctrl->GetBombDefuser()) + if (me->CanSeePlantedBomb() && TheCSBots()->GetBombDefuser()) { me->GetChatter()->Say("CoveringFriend"); me->Idle(); @@ -263,7 +257,8 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) if (bombPos != NULL) { const float defuseRange = 100.0f; - Vector toBomb = *bombPos - me->pev->origin + Vector(0, 0, me->GetFeetZ()); + Vector toBomb = *bombPos - me->pev->origin; + toBomb.z = bombPos->z - me->GetFeetZ(); if (toBomb.IsLengthLessThan(defuseRange)) { @@ -292,7 +287,6 @@ void MoveToState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } -/* <5c4e54> ../cstrike/dlls/bot/states/cs_bot_move_to.cpp:320 */ void MoveToState::__MAKE_VHOOK(OnExit)(CCSBot *me) { // reset to run in case we were walking near our goal position diff --git a/regamedll/dlls/bot/states/cs_bot_plant_bomb.cpp b/regamedll/dlls/bot/states/cs_bot_plant_bomb.cpp index e9ed472c..01a0b856 100644 --- a/regamedll/dlls/bot/states/cs_bot_plant_bomb.cpp +++ b/regamedll/dlls/bot/states/cs_bot_plant_bomb.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Plant the bomb. - -/* <5d4160> ../cstrike/dlls/bot/states/cs_bot_plant_bomb.cpp:17 */ void PlantBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { me->Crouch(); @@ -16,8 +14,6 @@ void PlantBombState::__MAKE_VHOOK(OnEnter)(CCSBot *me) } // Plant the bomb. - -/* <5d40d0> ../cstrike/dlls/bot/states/cs_bot_plant_bomb.cpp:36 */ void PlantBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { CBasePlayerWeapon *gun = me->GetActiveWeapon(); @@ -48,7 +44,6 @@ void PlantBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) me->Idle(); } -/* <5d4088> ../cstrike/dlls/bot/states/cs_bot_plant_bomb.cpp:65 */ void PlantBombState::__MAKE_VHOOK(OnExit)(CCSBot *me) { // equip our rifle (in case we were interrupted while holding C4) diff --git a/regamedll/dlls/bot/states/cs_bot_use_entity.cpp b/regamedll/dlls/bot/states/cs_bot_use_entity.cpp index f0b396b4..b6b536df 100644 --- a/regamedll/dlls/bot/states/cs_bot_use_entity.cpp +++ b/regamedll/dlls/bot/states/cs_bot_use_entity.cpp @@ -2,14 +2,11 @@ // Face the entity and "use" it // NOTE: This state assumes we are standing in range of the entity to be used, with no obstructions. - -/* <5e3017> ../cstrike/dlls/bot/states/cs_bot_use_entity.cpp:17 */ void UseEntityState::__MAKE_VHOOK(OnEnter)(CCSBot *me) { ; } -/* <5e308c> ../cstrike/dlls/bot/states/cs_bot_use_entity.cpp:21 */ void UseEntityState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) { // in the very rare situation where two or more bots "used" a hostage at the same time, @@ -41,7 +38,6 @@ void UseEntityState::__MAKE_VHOOK(OnUpdate)(CCSBot *me) } } -/* <5e304a> ../cstrike/dlls/bot/states/cs_bot_use_entity.cpp:54 */ void UseEntityState::__MAKE_VHOOK(OnExit)(CCSBot *me) { me->ClearLookAt(); diff --git a/regamedll/dlls/buttons.cpp b/regamedll/dlls/buttons.cpp index 2132f4b5..339a32de 100644 --- a/regamedll/dlls/buttons.cpp +++ b/regamedll/dlls/buttons.cpp @@ -52,13 +52,9 @@ TYPEDESCRIPTION CEnvSpark::m_SaveData[] = #endif // HOOK_GAMEDLL -/* <260d6> ../cstrike/dlls/buttons.cpp:62 */ IMPLEMENT_SAVERESTORE(CEnvGlobal, CBaseEntity); - -/* <272af> ../cstrike/dlls/buttons.cpp:64 */ LINK_ENTITY_TO_CLASS(env_global, CEnvGlobal); -/* <26863> ../cstrike/dlls/buttons.cpp:66 */ void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { pkvd->fHandled = TRUE; @@ -80,7 +76,6 @@ void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <26486> ../cstrike/dlls/buttons.cpp:80 */ void CEnvGlobal::__MAKE_VHOOK(Spawn)() { if (!m_globalstate) @@ -98,7 +93,6 @@ void CEnvGlobal::__MAKE_VHOOK(Spawn)() } } -/* <25ee7> ../cstrike/dlls/buttons.cpp:95 */ void CEnvGlobal::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { GLOBALESTATE oldState = gGlobalState.EntityGetState(m_globalstate); @@ -140,15 +134,10 @@ void CEnvGlobal::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller gGlobalState.EntityAdd(m_globalstate, gpGlobals->mapname, newState); } -/* <2616f> ../cstrike/dlls/buttons.cpp:141 */ IMPLEMENT_SAVERESTORE(CMultiSource, CBaseEntity); - -/* <27379> ../cstrike/dlls/buttons.cpp:143 */ LINK_ENTITY_TO_CLASS(multisource, CMultiSource); // Cache user-entity-field values until spawn is called. - -/* <26d1e> ../cstrike/dlls/buttons.cpp:148 */ void CMultiSource::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "style") @@ -168,13 +157,12 @@ void CMultiSource::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <256e2> ../cstrike/dlls/buttons.cpp:168 */ void CMultiSource::__MAKE_VHOOK(Spawn)() { // set up think for later registration pev->solid = SOLID_NOT; pev->movetype = MOVETYPE_NONE; - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; // Until it's initialized pev->spawnflags |= SF_MULTI_INIT; @@ -182,7 +170,6 @@ void CMultiSource::__MAKE_VHOOK(Spawn)() SetThink(&CMultiSource::Register); } -/* <2633b> ../cstrike/dlls/buttons.cpp:179 */ void CMultiSource::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int i = 0; @@ -219,7 +206,6 @@ void CMultiSource::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall } } -/* <26419> ../cstrike/dlls/buttons.cpp:211 */ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *) { // Is everything triggered? @@ -227,7 +213,7 @@ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *) // Still initializing? if (pev->spawnflags & SF_MULTI_INIT) - return 0; + return FALSE; while (i < m_iTotal) { @@ -240,14 +226,13 @@ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *) { if (FStringNull(m_globalstate) || gGlobalState.EntityGetState(m_globalstate) == GLOBAL_ON) { - return 1; + return TRUE; } } - return 0; + return FALSE; } -/* <25d5a> ../cstrike/dlls/buttons.cpp:236 */ void CMultiSource::Register() { edict_t *pentTarget = NULL; @@ -288,10 +273,8 @@ void CMultiSource::Register() pev->spawnflags &= ~SF_MULTI_INIT; } -/* <262ee> ../cstrike/dlls/buttons.cpp:287 */ IMPLEMENT_SAVERESTORE(CBaseButton, CBaseToggle); -/* <25709> ../cstrike/dlls/buttons.cpp:289 */ void CBaseButton::__MAKE_VHOOK(Precache)() { char *pszSound; @@ -310,14 +293,14 @@ void CBaseButton::__MAKE_VHOOK(Precache)() // get door button sounds, for doors which require buttons to open if (m_bLockedSound) { - pszSound = ButtonSound((int)m_bLockedSound); + pszSound = ButtonSound(int(m_bLockedSound)); PRECACHE_SOUND(pszSound); m_ls.sLockedSound = ALLOC_STRING(pszSound); } if (m_bUnlockedSound) { - pszSound = ButtonSound((int)m_bUnlockedSound); + pszSound = ButtonSound(int(m_bUnlockedSound)); PRECACHE_SOUND(pszSound); m_ls.sUnlockedSound = ALLOC_STRING(pszSound); } @@ -352,8 +335,6 @@ void CBaseButton::__MAKE_VHOOK(Precache)() } // Cache user-entity-field values until spawn is called. - -/* <269cb> ../cstrike/dlls/buttons.cpp:355 */ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "changetarget")) @@ -363,22 +344,22 @@ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } else if (FStrEq(pkvd->szKeyName, "locked_sound")) { - m_bLockedSound = (int)Q_atof(pkvd->szValue); + m_bLockedSound = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "locked_sentence")) { - m_bLockedSentence = (int)Q_atof(pkvd->szValue); + m_bLockedSentence = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sound")) { - m_bUnlockedSound = (int)Q_atof(pkvd->szValue); + m_bUnlockedSound = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sentence")) { - m_bUnlockedSentence = (int)Q_atof(pkvd->szValue); + m_bUnlockedSentence = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "sounds")) @@ -391,8 +372,6 @@ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } // ButtonShot - -/* <26e90> ../cstrike/dlls/buttons.cpp:394 */ int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { BUTTON_CODE code = ButtonResponseToTouch(); @@ -446,11 +425,8 @@ int CBaseButton::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe // 1) wooden clunk // 2) metallic click // 3) in-out - -/* <27443> ../cstrike/dlls/buttons.cpp:439 */ LINK_ENTITY_TO_CLASS(func_button, CBaseButton); -/* <25c2c> ../cstrike/dlls/buttons.cpp:442 */ void CBaseButton::__MAKE_VHOOK(Spawn)() { char *pszSound; @@ -471,7 +447,7 @@ void CBaseButton::__MAKE_VHOOK(Spawn)() SetThink(&CBaseButton::ButtonSpark); // no hurry, make sure everything else spawns - pev->nextthink = gpGlobals->time + 0.5; + pev->nextthink = gpGlobals->time + 0.5f; } SetMovedir(pev); @@ -503,7 +479,7 @@ void CBaseButton::__MAKE_VHOOK(Spawn)() m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big - m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs((float_precision)(pev->movedir.x * (pev->size.x - 2))) + fabs((float_precision)(pev->movedir.y * (pev->size.y - 2))) + fabs((float_precision)(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); + m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); // Is this a non-moving button? if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE)) @@ -529,65 +505,61 @@ void CBaseButton::__MAKE_VHOOK(Spawn)() // Button sound table. // Also used by CBaseDoor to get 'touched' door lock/unlock sounds - -/* <24738> ../cstrike/dlls/buttons.cpp:511 */ char *ButtonSound(int sound) { char *pszSound; switch (sound) { - case 0: pszSound = "common/null.wav"; break; - case 1: pszSound = "buttons/button1.wav"; break; - case 2: pszSound = "buttons/button2.wav"; break; - case 3: pszSound = "buttons/button3.wav"; break; - case 4: pszSound = "buttons/button4.wav"; break; - case 5: pszSound = "buttons/button5.wav"; break; - case 6: pszSound = "buttons/button6.wav"; break; - case 7: pszSound = "buttons/button7.wav"; break; - case 8: pszSound = "buttons/button8.wav"; break; - case 9: pszSound = "buttons/button9.wav"; break; - case 10: pszSound = "buttons/button10.wav"; break; - case 11: pszSound = "buttons/button11.wav"; break; - case 12: pszSound = "buttons/latchlocked1.wav"; break; - case 13: pszSound = "buttons/latchunlocked1.wav"; break; - case 14: pszSound = "buttons/lightswitch2.wav"; break; + case 0: pszSound = "common/null.wav"; break; + case 1: pszSound = "buttons/button1.wav"; break; + case 2: pszSound = "buttons/button2.wav"; break; + case 3: pszSound = "buttons/button3.wav"; break; + case 4: pszSound = "buttons/button4.wav"; break; + case 5: pszSound = "buttons/button5.wav"; break; + case 6: pszSound = "buttons/button6.wav"; break; + case 7: pszSound = "buttons/button7.wav"; break; + case 8: pszSound = "buttons/button8.wav"; break; + case 9: pszSound = "buttons/button9.wav"; break; + case 10: pszSound = "buttons/button10.wav"; break; + case 11: pszSound = "buttons/button11.wav"; break; + case 12: pszSound = "buttons/latchlocked1.wav"; break; + case 13: pszSound = "buttons/latchunlocked1.wav"; break; + case 14: pszSound = "buttons/lightswitch2.wav"; break; - // next 6 slots reserved for any additional sliding button sounds we may add - case 21: pszSound = "buttons/lever1.wav"; break; - case 22: pszSound = "buttons/lever2.wav"; break; - case 23: pszSound = "buttons/lever3.wav"; break; - case 24: pszSound = "buttons/lever4.wav"; break; - case 25: pszSound = "buttons/lever5.wav"; break; - default: pszSound = "buttons/button9.wav"; break; + // next 6 slots reserved for any additional sliding button sounds we may add + case 21: pszSound = "buttons/lever1.wav"; break; + case 22: pszSound = "buttons/lever2.wav"; break; + case 23: pszSound = "buttons/lever3.wav"; break; + case 24: pszSound = "buttons/lever4.wav"; break; + case 25: pszSound = "buttons/lever5.wav"; break; + default: pszSound = "buttons/button9.wav"; break; } return pszSound; } // Makes flagged buttons spark when turned off - -/* <2752e> ../cstrike/dlls/buttons.cpp:551 */ void DoSpark(entvars_t *pev, const Vector &location) { - Vector tmp = location + (pev->size * 0.5); + Vector tmp = location + (pev->size * 0.5f); UTIL_Sparks(tmp); //random volume range - float flVolume = RANDOM_FLOAT(0.25 , 0.75) * 0.4; + float flVolume = RANDOM_FLOAT(0.25f, 0.75f) * 0.4f; + // NOTE: not to change it switch ((int)(RANDOM_FLOAT(0, 1) * 6)) { - case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM); break; - case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark2.wav", flVolume, ATTN_NORM); break; - case 2: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark3.wav", flVolume, ATTN_NORM); break; - case 3: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark4.wav", flVolume, ATTN_NORM); break; - case 4: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM); break; - case 5: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break; + case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM); break; + case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark2.wav", flVolume, ATTN_NORM); break; + case 2: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark3.wav", flVolume, ATTN_NORM); break; + case 3: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark4.wav", flVolume, ATTN_NORM); break; + case 4: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark5.wav", flVolume, ATTN_NORM); break; + case 5: EMIT_SOUND(ENT(pev), CHAN_VOICE, "buttons/spark6.wav", flVolume, ATTN_NORM); break; } } -/* <277fa> ../cstrike/dlls/buttons.cpp:568 */ void CBaseButton::ButtonSpark() { SetThink(&CBaseButton::ButtonSpark); @@ -599,8 +571,6 @@ void CBaseButton::ButtonSpark() } // Button's Use function - -/* <2719b> ../cstrike/dlls/buttons.cpp:580 */ void CBaseButton::ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // Ignore touches if button is moving, or pushed-in and waiting to auto-come-out. @@ -622,11 +592,12 @@ void CBaseButton::ButtonUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T ButtonActivate(); } -/* <27821> ../cstrike/dlls/buttons.cpp:603 */ CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch() { // Ignore touches if button is moving, or pushed-in and waiting to auto-come-out. - if (m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN || (m_toggle_state == TS_AT_TOP && !m_fStayPushed && !(pev->spawnflags & SF_BUTTON_TOGGLE))) + if (m_toggle_state == TS_GOING_UP + || m_toggle_state == TS_GOING_DOWN + || (m_toggle_state == TS_AT_TOP && !m_fStayPushed && !(pev->spawnflags & SF_BUTTON_TOGGLE))) { return BUTTON_NOTHING; } @@ -645,8 +616,6 @@ CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch() } // Touching a button simply "activates" it. - -/* <27047> ../cstrike/dlls/buttons.cpp:628 */ void CBaseButton::ButtonTouch(CBaseEntity *pOther) { // Ignore touches by anything but players @@ -683,8 +652,6 @@ void CBaseButton::ButtonTouch(CBaseEntity *pOther) } // Starts the button moving "in/up". - -/* <27843> ../cstrike/dlls/buttons.cpp:664 */ void CBaseButton::ButtonActivate() { EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), VOL_NORM, ATTN_NORM); @@ -716,8 +683,6 @@ void CBaseButton::ButtonActivate() } // Button has reached the "in/up" position. Activate its "targets", and pause before "popping out". - -/* <263dd> ../cstrike/dlls/buttons.cpp:693 */ void CBaseButton::TriggerAndWait() { assert(m_toggle_state == TS_GOING_UP); @@ -752,8 +717,6 @@ void CBaseButton::TriggerAndWait() } // Starts the button moving "out/down". - -/* <25bb7> ../cstrike/dlls/buttons.cpp:730 */ void CBaseButton::ButtonReturn() { assert(m_toggle_state == TS_AT_TOP); @@ -774,8 +737,6 @@ void CBaseButton::ButtonReturn() } // Button has returned to start state. Quiesce it. - -/* <26658> ../cstrike/dlls/buttons.cpp:748 */ void CBaseButton::ButtonBackHome() { assert(m_toggle_state == TS_GOING_DOWN); @@ -791,10 +752,8 @@ void CBaseButton::ButtonBackHome() { edict_t *pentTarget = NULL; - while (true) + while ((pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target))) != NULL) { - pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target)); - if (FNullEnt(pentTarget)) break; @@ -826,14 +785,12 @@ void CBaseButton::ButtonBackHome() SetThink(&CBaseButton::ButtonSpark); // no hurry. - pev->nextthink = gpGlobals->time + 0.5; + pev->nextthink = gpGlobals->time + 0.5f; } } -/* <278a4> ../cstrike/dlls/buttons.cpp:806 */ LINK_ENTITY_TO_CLASS(func_rot_button, CRotButton); -/* <25a06> ../cstrike/dlls/buttons.cpp:808 */ void CRotButton::__MAKE_VHOOK(Spawn)() { char *pszSound; @@ -898,13 +855,9 @@ void CRotButton::__MAKE_VHOOK(Spawn)() //SetTouch(ButtonTouch); } -/* <262a1> ../cstrike/dlls/buttons.cpp:918 */ IMPLEMENT_SAVERESTORE(CMomentaryRotButton, CBaseToggle); - -/* <27971> ../cstrike/dlls/buttons.cpp:920 */ LINK_ENTITY_TO_CLASS(momentary_rot_button, CMomentaryRotButton); -/* <25acc> ../cstrike/dlls/buttons.cpp:922 */ void CMomentaryRotButton::__MAKE_VHOOK(Spawn)() { CBaseToggle::AxisDir(pev); @@ -945,7 +898,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(Spawn)() m_lastUsed = 0; } -/* <2678f> ../cstrike/dlls/buttons.cpp:958 */ void CMomentaryRotButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "returnspeed")) @@ -962,7 +914,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseToggle::KeyValue(pkvd); } -/* <27a57> ../cstrike/dlls/buttons.cpp:974 */ void CMomentaryRotButton::PlaySound() { EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), VOL_NORM, ATTN_NORM); @@ -971,8 +922,6 @@ void CMomentaryRotButton::PlaySound() // BUGBUG: This design causes a latentcy. When the button is retriggered, the first impulse // will send the target in the wrong direction because the parameter is calculated based on the // current, not future position. - -/* <27dc0> ../cstrike/dlls/buttons.cpp:982 */ void CMomentaryRotButton::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { pev->ideal_yaw = CBaseToggle::AxisDelta(pev->spawnflags, pev->angles, m_start) / m_flMoveDistance; @@ -988,7 +937,6 @@ void CMomentaryRotButton::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity #endif } -/* <27c49> ../cstrike/dlls/buttons.cpp:990 */ void CMomentaryRotButton::UpdateAllButtons(float value, int start) { // Update all rot buttons attached to the same target @@ -1016,14 +964,13 @@ void CMomentaryRotButton::UpdateAllButtons(float value, int start) } } -/* <27ab8> ../cstrike/dlls/buttons.cpp:1015 */ void CMomentaryRotButton::UpdateSelf(float value) { - BOOL fplaysound = FALSE; + bool fplaysound = false; if (!m_lastUsed) { - fplaysound = TRUE; + fplaysound = true; m_direction = -m_direction; } @@ -1050,25 +997,22 @@ void CMomentaryRotButton::UpdateSelf(float value) // HACKHACK -- If we're going slow, we'll get multiple player packets per frame, bump nexthink on each one to avoid stalling if (pev->nextthink < pev->ltime) - pev->nextthink = pev->ltime + 0.1; + pev->nextthink = pev->ltime + 0.1f; else - pev->nextthink += 0.1; + pev->nextthink += 0.1f; pev->avelocity = (m_direction * pev->speed) * pev->movedir; SetThink(&CMomentaryRotButton::Off); } -/* <26550> ../cstrike/dlls/buttons.cpp:1053 */ void CMomentaryRotButton::UpdateTarget(float value) { if (!FStringNull(pev->target)) { edict_t *pentTarget = NULL; - while (true) + while ((pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target))) != NULL) { - pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target)); - if (FNullEnt(pentTarget)) break; @@ -1082,7 +1026,6 @@ void CMomentaryRotButton::UpdateTarget(float value) } } -/* <25f88> ../cstrike/dlls/buttons.cpp:1072 */ void CMomentaryRotButton::Off() { pev->avelocity = g_vecZero; @@ -1098,7 +1041,6 @@ void CMomentaryRotButton::Off() SetThink(NULL); } -/* <27d60> ../cstrike/dlls/buttons.cpp:1086 */ void CMomentaryRotButton::Return() { float value = CBaseToggle::AxisDelta(pev->spawnflags, pev->angles, m_start) / m_flMoveDistance; @@ -1112,7 +1054,6 @@ void CMomentaryRotButton::Return() } } -/* <27bce> ../cstrike/dlls/buttons.cpp:1096 */ void CMomentaryRotButton::UpdateSelfReturn(float value) { if (value <= 0) @@ -1125,20 +1066,14 @@ void CMomentaryRotButton::UpdateSelfReturn(float value) else { pev->avelocity = -m_returnSpeed * pev->movedir; - pev->nextthink = pev->ltime + 0.1; + pev->nextthink = pev->ltime + 0.1f; } } -/* <26122> ../cstrike/dlls/buttons.cpp:1141 */ IMPLEMENT_SAVERESTORE(CEnvSpark, CBaseEntity); - -/* <27e77> ../cstrike/dlls/buttons.cpp:1143 */ LINK_ENTITY_TO_CLASS(env_spark, CEnvSpark); - -/* <27f44> ../cstrike/dlls/buttons.cpp:1144 */ LINK_ENTITY_TO_CLASS(env_debris, CEnvSpark); -/* <257b7> ../cstrike/dlls/buttons.cpp:1146 */ void CEnvSpark::__MAKE_VHOOK(Spawn)() { SetThink(NULL); @@ -1162,17 +1097,16 @@ void CEnvSpark::__MAKE_VHOOK(Spawn)() else SetThink(&CEnvSpark::SparkThink); - pev->nextthink = gpGlobals->time + (0.1 + RANDOM_FLOAT(0, 1.5)); + pev->nextthink = gpGlobals->time + (0.1f + RANDOM_FLOAT(0.0f, 1.5f)); - if (m_flDelay <= 0) + if (m_flDelay <= 0.0f) { - m_flDelay = 1.5; + m_flDelay = 1.5f; } Precache(); } -/* <257de> ../cstrike/dlls/buttons.cpp:1173 */ void CEnvSpark::__MAKE_VHOOK(Precache)() { PRECACHE_SOUND("buttons/spark1.wav"); @@ -1183,7 +1117,6 @@ void CEnvSpark::__MAKE_VHOOK(Precache)() PRECACHE_SOUND("buttons/spark6.wav"); } -/* <26b97> ../cstrike/dlls/buttons.cpp:1183 */ void CEnvSpark::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "MaxDelay")) @@ -1202,32 +1135,27 @@ void CEnvSpark::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <277d3> ../cstrike/dlls/buttons.cpp:1201 */ void CEnvSpark::SparkThink() { - pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT(0, m_flDelay); + pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT(0, m_flDelay); DoSpark(pev, pev->origin); } -/* <25805> ../cstrike/dlls/buttons.cpp:1207 */ void CEnvSpark::SparkStart(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { SetUse(&CEnvSpark::SparkStop); SetThink(&CEnvSpark::SparkThink); - pev->nextthink = gpGlobals->time + (0.1 + RANDOM_FLOAT(0, m_flDelay)); + pev->nextthink = gpGlobals->time + (0.1f + RANDOM_FLOAT(0, m_flDelay)); } -/* <25868> ../cstrike/dlls/buttons.cpp:1214 */ void CEnvSpark::SparkStop(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { SetUse(&CEnvSpark::SparkStart); SetThink(NULL); } -/* <28011> ../cstrike/dlls/buttons.cpp:1233 */ LINK_ENTITY_TO_CLASS(button_target, CButtonTarget); -/* <258ca> ../cstrike/dlls/buttons.cpp:1235 */ void CButtonTarget::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_PUSH; @@ -1242,10 +1170,9 @@ void CButtonTarget::__MAKE_VHOOK(Spawn)() } } -/* <25fc3> ../cstrike/dlls/buttons.cpp:1246 */ void CButtonTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { - if (!ShouldToggle(useType, (int)pev->frame)) + if (!ShouldToggle(useType, int(pev->frame))) return; pev->frame = 1 - pev->frame; @@ -1258,10 +1185,9 @@ void CButtonTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal SUB_UseTargets(pActivator, USE_OFF, 0); } -/* <258f1> ../cstrike/dlls/buttons.cpp:1258 */ int CButtonTarget::__MAKE_VHOOK(ObjectCaps)() { - int caps = CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; + int caps = (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); if (pev->spawnflags & SF_BTARGET_USE) return caps | FCAP_IMPULSE_USE; @@ -1269,7 +1195,6 @@ int CButtonTarget::__MAKE_VHOOK(ObjectCaps)() return caps; } -/* <2592e> ../cstrike/dlls/buttons.cpp:1269 */ int CButtonTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { Use(Instance(pevAttacker), this, USE_TOGGLE, 0); diff --git a/regamedll/dlls/buttons.h b/regamedll/dlls/buttons.h index 2eb68945..eeefd34f 100644 --- a/regamedll/dlls/buttons.h +++ b/regamedll/dlls/buttons.h @@ -54,7 +54,6 @@ #define SF_BTARGET_USE 0x0001 #define SF_BTARGET_ON 0x0002 -/* <249a3> ../cstrike/dlls/buttons.cpp:38 */ class CEnvGlobal: public CPointEntity { public: @@ -72,18 +71,16 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[3]; -public: string_t m_globalstate; int m_triggermode; int m_initialstate; }; -/* <24b67> ../cstrike/dlls/buttons.cpp:800 */ class CRotButton: public CBaseButton { public: @@ -93,11 +90,9 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL - +#endif }; -/* <24bba> ../cstrike/dlls/buttons.cpp:873 */ class CMomentaryRotButton: public CBaseToggle { public: @@ -126,7 +121,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Off(); @@ -139,8 +134,6 @@ public: public: static CMomentaryRotButton *Instance(edict_t *pent) { return (CMomentaryRotButton *)GET_PRIVATE(pent); } - -public: static TYPEDESCRIPTION IMPL(m_SaveData)[6]; int m_lastUsed; @@ -151,7 +144,6 @@ public: int m_sounds; }; -/* <24c08> ../cstrike/dlls/buttons.cpp:1117 */ class CEnvSpark: public CBaseEntity { public: @@ -169,7 +161,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT SparkThink(); @@ -182,7 +174,6 @@ public: float m_flDelay; }; -/* <24c24> ../cstrike/dlls/buttons.cpp:1223 */ class CButtonTarget: public CBaseEntity { public: @@ -198,7 +189,7 @@ public: int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; diff --git a/regamedll/dlls/career_tasks.cpp b/regamedll/dlls/career_tasks.cpp index 1ce7c539..1bb1011d 100644 --- a/regamedll/dlls/career_tasks.cpp +++ b/regamedll/dlls/career_tasks.cpp @@ -32,9 +32,8 @@ const TaskInfo taskInfo[] = { NULL, EVENT_INVALID, &CCareerTask::NewTask } }; -#endif // HOOK_GAMEDLL +#endif -/* <1ef647> ../cstrike/dlls/career_tasks.cpp:133 */ CCareerTask *CPreventDefuseTask::NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete) { CPreventDefuseTask *pNewTask = new CPreventDefuseTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete); @@ -42,10 +41,9 @@ CCareerTask *CPreventDefuseTask::NewTask(const char *taskName, GameEventType eve pNewTask->m_bombPlantedThisRound = false; pNewTask->m_defuseStartedThisRound = false; - return (CCareerTask *)pNewTask; + return reinterpret_cast(pNewTask); } -/* <1ef5db> ../cstrike/dlls/career_tasks.cpp:139 */ CPreventDefuseTask::CPreventDefuseTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete) { CCareerTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete); @@ -54,7 +52,6 @@ CPreventDefuseTask::CPreventDefuseTask(const char *taskName, GameEventType event m_defuseStartedThisRound = false; } -/* <1ef296> ../cstrike/dlls/career_tasks.cpp:147 */ void CPreventDefuseTask::__MAKE_VHOOK(Reset)() { m_bombPlantedThisRound = false; @@ -63,7 +60,6 @@ void CPreventDefuseTask::__MAKE_VHOOK(Reset)() CCareerTask::Reset(); } -/* <1efbf8> ../cstrike/dlls/career_tasks.cpp:156 */ void CPreventDefuseTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim) { if (IsComplete()) @@ -87,14 +83,12 @@ void CPreventDefuseTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer } } -/* <1ef4e1> ../cstrike/dlls/career_tasks.cpp:186 */ CCareerTask *CCareerTask::NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete) { CCareerTask *pTask = new CCareerTask(taskName, event, weaponName, n, mustLive, crossRounds, id, isComplete); return pTask; } -/* <1ef43f> ../cstrike/dlls/career_tasks.cpp:192 */ CCareerTask::CCareerTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete) { m_isComplete = isComplete; @@ -129,7 +123,6 @@ CCareerTask::CCareerTask(const char *taskName, GameEventType event, const char * } } -/* <1ef211> ../cstrike/dlls/career_tasks.cpp:240 */ void CCareerTask::__MAKE_VHOOK(Reset)() { m_eventsSeen = 0; @@ -147,7 +140,6 @@ void CCareerTask::__MAKE_VHOOK(Reset)() MESSAGE_END(); } -/* <1ef74c> ../cstrike/dlls/career_tasks.cpp:256 */ void CCareerTask::SendPartialNotification() { MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer); @@ -159,18 +151,13 @@ void CCareerTask::SendPartialNotification() UTIL_LogPrintf("Career Task Partial %d %d\n", m_id, m_eventsSeen); } -/* <1efc6c> ../cstrike/dlls/career_tasks.cpp:268 */ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim) { - if (m_isComplete || m_event != EVENT_KILL && (m_event != EVENT_HEADSHOT || !headshot)) - { + if (m_isComplete || (m_event != EVENT_KILL && (m_event != EVENT_HEADSHOT || !headshot))) return; - } if (!pVictim || (m_defuser && !pVictim->m_bIsDefusing) || (m_vip && !pVictim->m_bIsVIP)) - { return; - } if (m_rescuer) { @@ -187,7 +174,7 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b if (!hostage->IsFollowingSomeone()) continue; - if (hostage->IsValid() && hostage->m_target == pAttacker) + if (hostage->IsValid() && hostage->m_target == pVictim) ++hostages_; } @@ -195,33 +182,30 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b return; } - if (m_weaponId == WEAPON_SHIELDGUN) - { - if (!killerHasShield) - return; - } - else if (m_weaponId) - { - if (m_weaponId != weaponId) - return; - } - else if (m_weaponClassId) - { - if (m_weaponClassId != weaponClassId) - return; - } - + if (m_weaponId == WEAPON_SHIELDGUN) + { + if (!killerHasShield) + return; + } + else if (m_weaponId) + { + if (m_weaponId != weaponId) + return; + } + else + { + if (!m_weaponClassId || m_weaponClassId != weaponClassId) + return; + } + ++m_eventsSeen; SendPartialNotification(); } -/* <1efe16> ../cstrike/dlls/career_tasks.cpp:348 */ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker) { if (m_isComplete || m_event != EVENT_PLAYER_TOOK_DAMAGE) - { return; - } if (m_weaponId == WEAPON_SHIELDGUN) { @@ -233,9 +217,9 @@ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerH if (m_weaponId != weaponId) return; } - else if (m_weaponClassId) + else { - if (m_weaponClassId != weaponClassId) + if (!m_weaponClassId || m_weaponClassId != weaponClassId) return; } @@ -243,7 +227,6 @@ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerH SendPartialNotification(); } -/* <1ef79d> ../cstrike/dlls/career_tasks.cpp:385 */ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVictim, CBasePlayer *pAttacker) { if (m_isComplete) @@ -279,9 +262,9 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti } } - if (m_event != EVENT_KILL || (!m_weaponId && !m_weaponClassId) - && m_event != EVENT_HEADSHOT || (!m_weaponId && !m_weaponClassId) - && m_event != EVENT_PLAYER_TOOK_DAMAGE || (!m_weaponId && !m_weaponClassId)) + if ((m_event != EVENT_KILL || (!m_weaponId && !m_weaponClassId)) + && (m_event != EVENT_HEADSHOT || (!m_weaponId && !m_weaponClassId)) + && (m_event != EVENT_PLAYER_TOOK_DAMAGE || (!m_weaponId && !m_weaponClassId))) { if (m_event == EVENT_ROUND_WIN) { @@ -363,7 +346,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast")) { - TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime()); + TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime())); UTIL_GetLocalPlayer()->SyncRoundTimer(); } } @@ -395,7 +378,7 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast")) { - TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime()); + TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime())); UTIL_GetLocalPlayer()->SyncRoundTimer(); } @@ -416,7 +399,6 @@ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVicti } } -/* <1efeed> ../cstrike/dlls/career_tasks.cpp:623 */ void CCareerTaskManager::Create() { if (TheCareerTasks != NULL) @@ -428,22 +410,18 @@ void CCareerTaskManager::Create() TheCareerTasks = new CCareerTaskManager; } -/* <1eff77> ../cstrike/dlls/career_tasks.cpp:636 */ CCareerTaskManager::CCareerTaskManager() { m_taskTime = 0; Reset(); } -/* <1effeb> ../cstrike/dlls/career_tasks.cpp:643 */ void CCareerTaskManager::Reset(bool deleteTasks) { if (deleteTasks) { for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) - { delete (*it); - } m_tasks.clear(); m_nextId = 0; @@ -464,16 +442,12 @@ void CCareerTaskManager::Reset(bool deleteTasks) m_roundStartTime = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime"); } -/* <1f014e> ../cstrike/dlls/career_tasks.cpp:671 */ void CCareerTaskManager::SetFinishedTaskTime(int val) { - CHalfLifeMultiplay *mp = g_pGameRules; - m_finishedTaskTime = val; - m_finishedTaskRound = mp->m_iTotalRoundsPlayed; + m_finishedTaskRound = CSGameRules()->m_iTotalRoundsPlayed; } -/* <1f018b> ../cstrike/dlls/career_tasks.cpp:679 */ void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, bool isComplete) { ++m_nextId; @@ -521,7 +495,6 @@ void CCareerTaskManager::AddTask(const char *taskName, const char *weaponName, i MESSAGE_END(); } -/* <1f0381> ../cstrike/dlls/career_tasks.cpp:721 */ void CCareerTaskManager::HandleEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim) { if (event == EVENT_ROUND_START) @@ -542,7 +515,6 @@ void CCareerTaskManager::HandleEvent(GameEventType event, CBasePlayer *pAttacker } } -/* <1f0462> ../cstrike/dlls/career_tasks.cpp:748 */ void CCareerTaskManager::HandleWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim) { for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) @@ -551,11 +523,9 @@ void CCareerTaskManager::HandleWeaponKill(int weaponId, int weaponClassId, bool } } -/* <1f04ed> ../cstrike/dlls/career_tasks.cpp:757 */ void CCareerTaskManager::HandleEnemyKill(bool wasBlind, const char *weaponName, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim) { HandleWeaponKill(AliasToWeaponID(weaponName), AliasToWeaponClass(weaponName), headshot, killerHasShield, pAttacker, pVictim); - HandleEvent(EVENT_KILL, pAttacker, pVictim); if (headshot) @@ -568,7 +538,6 @@ void CCareerTaskManager::HandleEnemyKill(bool wasBlind, const char *weaponName, } } -/* <1f079c> ../cstrike/dlls/career_tasks.cpp:768 */ void CCareerTaskManager::HandleWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker) { for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) @@ -577,14 +546,12 @@ void CCareerTaskManager::HandleWeaponInjury(int weaponId, int weaponClassId, boo } } -/* <1f0815> ../cstrike/dlls/career_tasks.cpp:777 */ void CCareerTaskManager::HandleEnemyInjury(const char *weaponName, bool attackerHasShield, CBasePlayer *pAttacker) { HandleWeaponInjury(AliasToWeaponID(weaponName), AliasToWeaponClass(weaponName), attackerHasShield, pAttacker); HandleEvent(EVENT_PLAYER_TOOK_DAMAGE); } -/* <1f094e> ../cstrike/dlls/career_tasks.cpp:784 */ void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker) { int enemyTeam = (Q_strcmp(humans_join_team.string, "CT") != 0) ? CT : TERRORIST; @@ -607,7 +574,6 @@ void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker) } } -/* <1f0a5d> ../cstrike/dlls/career_tasks.cpp:805 */ bool CCareerTaskManager::AreAllTasksComplete() { for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) @@ -619,32 +585,28 @@ bool CCareerTaskManager::AreAllTasksComplete() return true; } -/* <1f0abc> ../cstrike/dlls/career_tasks.cpp:818 */ int CCareerTaskManager::GetNumRemainingTasks() { int ret = 0; for (CareerTaskListIt it = m_tasks.begin(); it != m_tasks.end(); ++it) { if (!(*it)->IsComplete()) - ret++; + ++ret; } return ret; } -/* <1f0b33> ../cstrike/dlls/career_tasks.cpp:832 */ float CCareerTaskManager::GetRoundElapsedTime() { return (gpGlobals->time - m_roundStartTime); } -/* <1f0b56> ../cstrike/dlls/career_tasks.cpp:838 */ void CCareerTaskManager::LatchRoundEndMessage() { m_shouldLatchRoundEndMessage = true; } -/* <1f0b81> ../cstrike/dlls/career_tasks.cpp:844 */ void CCareerTaskManager::UnlatchRoundEndMessage() { m_shouldLatchRoundEndMessage = false; diff --git a/regamedll/dlls/career_tasks.h b/regamedll/dlls/career_tasks.h index b7dadf11..89ac3c55 100644 --- a/regamedll/dlls/career_tasks.h +++ b/regamedll/dlls/career_tasks.h @@ -34,7 +34,6 @@ #include -/* <1ef43f> ../cstrike/dlls/career_tasks.cpp:192 */ class CCareerTask { public: @@ -50,7 +49,7 @@ public: void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); void Reset_(); -#endif // HOOK_GAMEDLL +#endif public: static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); @@ -58,13 +57,13 @@ public: void OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim); void OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker); - bool IsComplete() { return m_isComplete;} - const char *GetTaskName() { return m_name; } + bool IsComplete() { return m_isComplete; } + const char *GetTaskName() { return m_name; } - int GetWeaponId() { return m_weaponId; } - int GetWeaponClassId() { return m_weaponClassId; } + int GetWeaponId() { return m_weaponId; } + int GetWeaponClassId() { return m_weaponClassId; } - bool IsValidFor(CBasePlayer *pPlayer) { return true; } + bool IsValidFor(CBasePlayer *pPlayer) { return true; } void SendPartialNotification(); private: @@ -89,7 +88,6 @@ typedef CareerTaskList::iterator CareerTaskListIt; typedef CCareerTask *(*TaskFactoryFunction)(const char *taskName, GameEventType event, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, int nextId, bool isComplete); -/* <1ef56d> ../cstrike/dlls/career_tasks.cpp:139 */ class CPreventDefuseTask: public CCareerTask { public: @@ -104,7 +102,7 @@ public: void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); void Reset_(); -#endif // HOOK_GAMEDLL +#endif public: static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); @@ -114,7 +112,6 @@ protected: bool m_defuseStartedThisRound; }; -/* <1efed1> ../cstrike/dlls/career_tasks.cpp:636 */ class CCareerTaskManager { public: diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index 92f028af..9ac5ba3e 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -81,7 +81,6 @@ BOOL gTouchDisabled = FALSE; #endif // HOOK_GAMEDLL -/* <30850> ../cstrike/dlls/cbase.cpp:117 */ int CaseInsensitiveHash(const char *string, int iBounds) { unsigned int hash = 0; @@ -102,7 +101,6 @@ int CaseInsensitiveHash(const char *string, int iBounds) return (hash % iBounds); } -/* <30d81> ../cstrike/dlls/cbase.cpp:136 */ void EmptyEntityHashTable() { int i; @@ -127,7 +125,6 @@ void EmptyEntityHashTable() } } -/* <2f053> ../cstrike/dlls/cbase.cpp:156 */ void AddEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldType) { int count; @@ -201,7 +198,6 @@ void AddEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldTyp } } -/* <2f0c8> ../cstrike/dlls/cbase.cpp:255 */ void RemoveEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldType) { int hash; @@ -269,7 +265,6 @@ void RemoveEntityHashValue(entvars_t *pev, const char *value, hash_types_e field } } -/* <31125> ../cstrike/dlls/cbase.cpp:337 */ void printEntities() { for (int i = 0; i < stringsHashTable.Count(); ++i) @@ -288,8 +283,7 @@ void printEntities() } } -/* <311e9> ../cstrike/dlls/cbase.cpp:354 */ -edict_t *CREATE_NAMED_ENTITY(string_t iClass) +NOINLINE edict_t *CREATE_NAMED_ENTITY(string_t iClass) { edict_t *named = g_engfuncs.pfnCreateNamedEntity(iClass); if (named != NULL) @@ -300,7 +294,6 @@ edict_t *CREATE_NAMED_ENTITY(string_t iClass) return named; } -/* <31249> ../cstrike/dlls/cbase.cpp:366 */ void REMOVE_ENTITY(edict_t *e) { if (e != NULL) @@ -309,7 +302,6 @@ void REMOVE_ENTITY(edict_t *e) } } -/* <30158> ../cstrike/dlls/cbase.cpp:375 */ void CONSOLE_ECHO_(char *pszMsg, ...) { va_list argptr; @@ -322,7 +314,6 @@ void CONSOLE_ECHO_(char *pszMsg, ...) SERVER_PRINT(szStr); } -/* <31273> ../cstrike/dlls/cbase.cpp:386 */ void loopPerformance() { CPerformanceCounter loopCounter; @@ -375,7 +366,6 @@ void loopPerformance() CONSOLE_ECHO(" Time in new search loop %.4f\n", (end - start) * 1000.0); } -/* <313df> ../cstrike/dlls/cbase.cpp:451 */ C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion) { if (!pFunctionTable || interfaceVersion != INTERFACE_VERSION) @@ -392,7 +382,6 @@ C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion return 1; } -/* <3161a> ../cstrike/dlls/cbase.cpp:471 */ NOXREF int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion) { if (!pFunctionTable || *interfaceVersion != INTERFACE_VERSION) @@ -405,7 +394,6 @@ NOXREF int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion) return 1; } -/* <3165b> ../cstrike/dlls/cbase.cpp:485 */ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion) { if (!pFunctionTable || *interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) @@ -418,7 +406,6 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *inter return 1; } -/* <30ab0> ../cstrike/dlls/cbase.cpp:498 */ int EXT_FUNC DispatchSpawn(edict_t *pent) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -437,7 +424,7 @@ int EXT_FUNC DispatchSpawn(edict_t *pent) if (pEntity != NULL) { - if (g_pGameRules && !g_pGameRules->IsAllowedToSpawn(pEntity)) + if (g_pGameRules != NULL && !g_pGameRules->IsAllowedToSpawn(pEntity)) { // return that this entity should be deleted return -1; @@ -479,7 +466,6 @@ int EXT_FUNC DispatchSpawn(edict_t *pent) return 0; } -/* <2e8a0> ../cstrike/dlls/cbase.cpp:549 */ void EXT_FUNC DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd) { if (!pkvd || !pentKeyvalue) @@ -503,8 +489,6 @@ void EXT_FUNC DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd) // HACKHACK -- this is a hack to keep the node graph entity from "touching" things (like triggers) // while it builds the graph - -/* <2e7db> ../cstrike/dlls/cbase.cpp:574 */ void EXT_FUNC DispatchTouch(edict_t *pentTouched, edict_t *pentOther) { if (gTouchDisabled) @@ -517,19 +501,17 @@ void EXT_FUNC DispatchTouch(edict_t *pentTouched, edict_t *pentOther) pEntity->Touch(pOther); } -/* <2fa9b> ../cstrike/dlls/cbase.cpp:587 */ void EXT_FUNC DispatchUse(edict_t *pentUsed, edict_t *pentOther) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentUsed); CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther); - if (pEntity && !(pEntity->pev->flags & FL_KILLME)) + if (pEntity != NULL && !(pEntity->pev->flags & FL_KILLME)) { pEntity->Use(pOther, pOther, USE_TOGGLE, 0); } } -/* <2fb2f> ../cstrike/dlls/cbase.cpp:596 */ void EXT_FUNC DispatchThink(edict_t *pent) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -545,7 +527,6 @@ void EXT_FUNC DispatchThink(edict_t *pent) } } -/* <2fb89> ../cstrike/dlls/cbase.cpp:612 */ void EXT_FUNC DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentBlocked); @@ -557,7 +538,6 @@ void EXT_FUNC DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther) } } -/* <2ff56> ../cstrike/dlls/cbase.cpp:621 */ void EXT_FUNC DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -598,8 +578,6 @@ void EXT_FUNC DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData) // Find the matching global entity. Spit out an error if the designer made entities of // different classes with the same global name - -/* <31697> ../cstrike/dlls/cbase.cpp:656 */ CBaseEntity *FindGlobalEntity(string_t classname, string_t globalname) { edict_t *pent = FIND_ENTITY_BY_STRING(NULL, "globalname", STRING(globalname)); @@ -617,7 +595,6 @@ CBaseEntity *FindGlobalEntity(string_t classname, string_t globalname) return pReturn; } -/* <3179c> ../cstrike/dlls/cbase.cpp:673 */ int EXT_FUNC DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -732,7 +709,6 @@ int EXT_FUNC DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int glob return 0; } -/* <2fdcd> ../cstrike/dlls/cbase.cpp:776 */ void EXT_FUNC DispatchObjectCollsionBox(edict_t *pent) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -746,21 +722,18 @@ void EXT_FUNC DispatchObjectCollsionBox(edict_t *pent) } -/* <2fe94> ../cstrike/dlls/cbase.cpp:788 */ void EXT_FUNC SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) { CSave saveHelper(pSaveData); saveHelper.WriteFields(pname, pBaseData, pFields, fieldCount); } -/* <30047> ../cstrike/dlls/cbase.cpp:795 */ void EXT_FUNC SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) { CRestore restoreHelper(pSaveData); restoreHelper.ReadFields(pname, pBaseData, pFields, fieldCount); } -/* <31a74> ../cstrike/dlls/cbase.cpp:802 */ edict_t *EHANDLE::Get() { if (!m_pent || m_pent->serialnumber != m_serialnumber) @@ -769,7 +742,6 @@ edict_t *EHANDLE::Get() return m_pent; } -/* <31a95> ../cstrike/dlls/cbase.cpp:814 */ edict_t *EHANDLE::Set(edict_t *pent) { m_pent = pent; @@ -779,13 +751,11 @@ edict_t *EHANDLE::Set(edict_t *pent) return pent; } -/* <31ace> ../cstrike/dlls/cbase.cpp:823 */ EHANDLE::operator CBaseEntity *() { return (CBaseEntity *)GET_PRIVATE(Get()); } -/* <31b30> ../cstrike/dlls/cbase.cpp:829 */ CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity) { if (pEntity != NULL) @@ -803,19 +773,16 @@ CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity) return pEntity; } -/* <31b69> ../cstrike/dlls/cbase.cpp:845 */ EHANDLE::operator int() { return Get() != NULL; } -/* <31bac> ../cstrike/dlls/cbase.cpp:850 */ CBaseEntity *EHANDLE::operator->() { return (CBaseEntity *)GET_PRIVATE(Get()); } -/* <301be> ../cstrike/dlls/cbase.cpp:857 */ int CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType) { if (pev->takedamage == DAMAGE_NO) @@ -834,7 +801,6 @@ int CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType) return 1; } -/* <305af> ../cstrike/dlls/cbase.cpp:876 */ int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { Vector vecTemp; @@ -845,11 +811,13 @@ int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe // UNDONE: some entity types may be immune or resistant to some bitsDamageType // if Attacker == Inflictor, the attack was a melee or other instant-hit attack. // (that is, no actual entity projectile was involved in the attack so use the shooter's origin). +#ifndef REGAMEDLL_FIXES if (pevAttacker == pevInflictor) { vecTemp = pevInflictor->origin - (VecBModelOrigin(pev)); } else +#endif { // an actual missile was involved. vecTemp = pevInflictor->origin - (VecBModelOrigin(pev)); @@ -884,7 +852,6 @@ int CBaseEntity::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe return 1; } -/* <2fe50> ../cstrike/dlls/cbase.cpp:927 */ void CBaseEntity::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) { pev->takedamage = DAMAGE_NO; @@ -892,7 +859,6 @@ void CBaseEntity::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) UTIL_Remove(this); } -/* <2fc1c> ../cstrike/dlls/cbase.cpp:935 */ CBaseEntity *CBaseEntity::__MAKE_VHOOK(GetNextTarget)() { if (FStringNull(pev->target)) @@ -908,7 +874,6 @@ CBaseEntity *CBaseEntity::__MAKE_VHOOK(GetNextTarget)() return Instance(pTarget); } -/* <302a6> ../cstrike/dlls/cbase.cpp:958 */ int CBaseEntity::__MAKE_VHOOK(Save)(CSave &save) { if (save.WriteEntVars("ENTVARS", pev)) @@ -919,7 +884,6 @@ int CBaseEntity::__MAKE_VHOOK(Save)(CSave &save) return 0; } -/* <30440> ../cstrike/dlls/cbase.cpp:966 */ int CBaseEntity::__MAKE_VHOOK(Restore)(CRestore &restore) { int status; @@ -949,7 +913,6 @@ int CBaseEntity::__MAKE_VHOOK(Restore)(CRestore &restore) return status; } -/* <2fcf6> ../cstrike/dlls/cbase.cpp:991 */ void SetObjectCollisionBox(entvars_t *pev) { if ((pev->solid == SOLID_BSP) && (pev->angles.x || pev->angles.y || pev->angles.z)) @@ -961,13 +924,13 @@ void SetObjectCollisionBox(entvars_t *pev) max = 0; for (i = 0; i < 3; ++i) { - v = fabs((float_precision)((float *)pev->mins)[i]); + v = Q_fabs(float_precision(((float *)pev->mins)[i])); if (v > max) { max = v; } - v = fabs((float_precision)((float *)pev->maxs)[i]); + v = Q_fabs(float_precision(((float *)pev->maxs)[i])); if (v > max) { max = v; @@ -994,13 +957,11 @@ void SetObjectCollisionBox(entvars_t *pev) pev->absmax.z += 1; } -/* <2fe2a> ../cstrike/dlls/cbase.cpp:1030 */ void CBaseEntity::__MAKE_VHOOK(SetObjectCollisionBox)() { ::SetObjectCollisionBox(pev); } -/* <31c0e> ../cstrike/dlls/cbase.cpp:1036 */ int CBaseEntity::Intersects(CBaseEntity *pOther) { if (pOther->pev->absmin.x > pev->absmax.x @@ -1013,7 +974,6 @@ int CBaseEntity::Intersects(CBaseEntity *pOther) return 1; } -/* <31c43> ../cstrike/dlls/cbase.cpp:1048 */ void CBaseEntity::MakeDormant() { pev->flags |= FL_DORMANT; @@ -1034,13 +994,11 @@ void CBaseEntity::MakeDormant() UTIL_SetOrigin(pev, pev->origin); } -/* <31c66> ../cstrike/dlls/cbase.cpp:1064 */ int CBaseEntity::IsDormant() { return (pev->flags & FL_DORMANT) == FL_DORMANT; } -/* <30221> ../cstrike/dlls/cbase.cpp:1069 */ BOOL CBaseEntity::__MAKE_VHOOK(IsInWorld)() { // position @@ -1066,7 +1024,6 @@ BOOL CBaseEntity::__MAKE_VHOOK(IsInWorld)() return TRUE; } -/* <31c8c> ../cstrike/dlls/cbase.cpp:1089 */ int CBaseEntity::ShouldToggle(USE_TYPE useType, BOOL currentState) { if (useType != USE_TOGGLE && useType != USE_SET) @@ -1078,7 +1035,6 @@ int CBaseEntity::ShouldToggle(USE_TYPE useType, BOOL currentState) return 1; } -/* <30258> ../cstrike/dlls/cbase.cpp:1100 */ int CBaseEntity::__MAKE_VHOOK(DamageDecal)(int bitsDamageType) { if (pev->rendermode == kRenderTransAlpha) @@ -1092,8 +1048,6 @@ int CBaseEntity::__MAKE_VHOOK(DamageDecal)(int bitsDamageType) // NOTE: szName must be a pointer to constant memory, e.g. "monster_class" because the entity // will keep a pointer to it after this call. - -/* <31cd1> ../cstrike/dlls/cbase.cpp:1115 */ CBaseEntity *CBaseEntity::Create(char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner) { edict_t *pent; @@ -1117,7 +1071,6 @@ CBaseEntity *CBaseEntity::Create(char *szName, const Vector &vecOrigin, const Ve return pEntity; } -/* <30885> ../cstrike/dlls/cbase.cpp:1134 */ void OnFreeEntPrivateData(edict_t *pEnt) { CBaseEntity *pEntity = CBaseEntity::Instance(pEnt); diff --git a/regamedll/dlls/cbase.h b/regamedll/dlls/cbase.h index 5dead5c9..f3944783 100644 --- a/regamedll/dlls/cbase.h +++ b/regamedll/dlls/cbase.h @@ -32,11 +32,10 @@ #pragma once #endif +#include "saverestore.h" +#include "schedule.h" #include "monsterevent.h" -#include -#include "game_shared/perf_counter.h" - #undef CREATE_NAMED_ENTITY #undef REMOVE_ENTITY @@ -182,10 +181,7 @@ #define EXPORT /**/ #endif // _WIN32 -enum hash_types_e -{ - CLASSNAME -}; +enum hash_types_e { CLASSNAME }; typedef struct hash_item_s { @@ -246,7 +242,7 @@ public: operator int(); operator CBaseEntity*(); - operator CBasePlayer*() { return static_cast(GET_PRIVATE(Get())); } + operator CBasePlayer*() { return static_cast(GET_PRIVATE(Get())); } CBaseEntity *operator=(CBaseEntity *pEntity); CBaseEntity *operator->(); @@ -256,7 +252,6 @@ private: int m_serialnumber; }; -/* <48e9c1> ../cstrike/dlls/cbase.h:166 */ class CBaseEntity { public: @@ -360,11 +355,11 @@ public: BOOL FVisible_(CBaseEntity *pEntity); BOOL FVisible_(const Vector &vecOrigin); -#endif // HOOK_GAMEDLL +#endif public: void *operator new(size_t stAllocateBlock, entvars_t *pevnew) { return ALLOC_PRIVATE(ENT(pevnew), stAllocateBlock); } - void operator delete(void *pMem, entvars_t *pev) { pev->flags |= FL_KILLME; } + void operator delete(void *pMem, entvars_t *pevnew) { pevnew->flags |= FL_KILLME; } void UpdateOnRemove(); void EXPORT SUB_Remove(); void EXPORT SUB_DoNothing(); @@ -447,19 +442,9 @@ public: bool has_disconnected; }; -/* <48d2a5> ../cstrike/dlls/cbase.h:273 */ -inline int FNullEnt(CBaseEntity *ent) -{ - return (ent == NULL || FNullEnt(ent->edict())); -} +inline int FNullEnt(CBaseEntity *ent) { return (ent == NULL || FNullEnt(ent->edict())); } +inline int FNullEnt(EHANDLE hent) { return (hent == NULL || FNullEnt(OFFSET(hent.Get()))); } -/* <48d67d> ../cstrike/dlls/cbase.h:273 */ -inline int FNullEnt(EHANDLE hent) -{ - return (hent == NULL || FNullEnt(OFFSET(hent.Get()))); -} - -/* <19e6b5> ../cstrike/dlls/cbase.h:450 */ class CPointEntity: public CBaseEntity { public: @@ -470,11 +455,10 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; -/* <249f0> ../cstrike/dlls/cbase.h:484 */ class CMultiSource: public CPointEntity { public: @@ -495,7 +479,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Register(); @@ -509,7 +493,6 @@ public: string_t m_globalstate; }; -/* <48ea00> ../cstrike/dlls/cbase.h:509 */ class CBaseDelay: public CBaseEntity { public: @@ -523,7 +506,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value); @@ -535,7 +518,6 @@ public: int m_iszKillTarget; }; -/* <48ea6f> ../cstrike/dlls/cbase.h:526 */ class CBaseAnimating: public CBaseDelay { public: @@ -548,7 +530,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: float StudioFrameAdvance(float flInterval = 0.0f); @@ -561,13 +543,13 @@ public: float SetBoneController(int iController, float flValue = 0.0f); void InitBoneControllers(); - NOXREF float SetBlending(int iBlender, float flValue); - NOXREF void GetBonePosition(int iBone, Vector &origin, Vector &angles); - NOXREF void GetAutomovement(Vector &origin, Vector &angles, float flInterval = 0.1f); - NOXREF int FindTransition(int iEndingSequence, int iGoalSequence, int *piDir); - NOXREF void GetAttachment(int iAttachment, Vector &origin, Vector &angles); - NOXREF void SetBodygroup(int iGroup, int iValue); - NOXREF int GetBodygroup(int iGroup); + float SetBlending(int iBlender, float flValue); + void GetBonePosition(int iBone, Vector &origin, Vector &angles); + void GetAutomovement(Vector &origin, Vector &angles, float flInterval = 0.1f); + int FindTransition(int iEndingSequence, int iGoalSequence, int *piDir); + void GetAttachment(int iAttachment, Vector &origin, Vector &angles); + void SetBodygroup(int iGroup, int iValue); + int GetBodygroup(int iGroup); int ExtractBbox(int sequence, float *mins, float *maxs); void SetSequenceBox(); @@ -581,7 +563,6 @@ public: BOOL m_fSequenceLoops; }; -/* <48eb06> ../cstrike/dlls/cbase.h:569 */ class CBaseToggle: public CBaseAnimating { public: @@ -597,14 +578,14 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void LinearMove(Vector vecDest, float flSpeed); void EXPORT LinearMoveDone(); void AngularMove(Vector vecDestAngle, float flSpeed); void EXPORT AngularMoveDone(); - NOXREF BOOL IsLockedByMaster(); + BOOL IsLockedByMaster(); public: static float AxisValue(int flags, const Vector &angles); @@ -638,8 +619,6 @@ public: #include "basemonster.h" // Generic Button - -/* <24b19> ../cstrike/dlls/cbase.h:745 */ class CBaseButton: public CBaseToggle { enum BUTTON_CODE @@ -675,14 +654,14 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: - NOXREF void RotSpawn(); + void RotSpawn(); void ButtonActivate(); - NOXREF void SparkSoundCache(); + void SparkSoundCache(); - NOXREF void EXPORT ButtonShot(); + void EXPORT ButtonShot(); void EXPORT ButtonTouch(CBaseEntity *pOther); void EXPORT ButtonSpark(); void EXPORT TriggerAndWait(); @@ -706,7 +685,6 @@ public: int m_sounds; }; -/* <1da023> ../cstrike/dlls/cbase.h:861 */ class CWorld: public CBaseEntity { public: @@ -720,7 +698,7 @@ public: void Precache_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif }; @@ -738,14 +716,19 @@ T *GetClassPtr(T *a) #if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) VirtualTableInit((void *)a, stripClass(typeid(T).name())); -#endif // _WIN32 && HOOK_GAMEDLL +#endif } return a; } +#ifdef REGAMEDLL_SELF extern CUtlVector stringsHashTable; +#endif + +C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); +C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); int CaseInsensitiveHash(const char *string, int iBounds); void EmptyEntityHashTable(); @@ -756,11 +739,6 @@ edict_t *CREATE_NAMED_ENTITY(string_t iClass); void REMOVE_ENTITY(edict_t *e); void CONSOLE_ECHO_(char *pszMsg, ...); void loopPerformance(); - -C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); -NOXREF int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); -C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); - int DispatchSpawn(edict_t *pent); void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd); void DispatchTouch(edict_t *pentTouched, edict_t *pentOther); diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index d9ab7db9..d949b637 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -65,7 +65,6 @@ PLAYERPVSSTATUS g_PVSStatus[MAX_CLIENTS]; unsigned short m_usResetDecals; unsigned short g_iShadowSprite; -/* <47b45> ../cstrike/dlls/client.cpp:76 */ int CMD_ARGC_() { if (!UseBotArgs) @@ -79,7 +78,6 @@ int CMD_ARGC_() return i; } -/* <47b84> ../cstrike/dlls/client.cpp:90 */ const char *CMD_ARGV_(int i) { if (!UseBotArgs) @@ -91,7 +89,6 @@ const char *CMD_ARGV_(int i) return NULL; } -/* <47eac> ../cstrike/dlls/client.cpp:180 */ NOXREF void set_suicide_frame(entvars_t *pev) { if (!FStrEq(STRING(pev->model), "models/player.mdl")) @@ -103,7 +100,6 @@ NOXREF void set_suicide_frame(entvars_t *pev) pev->nextthink = -1; } -/* <47a58> ../cstrike/dlls/client.cpp:192 */ void TeamChangeUpdate(CBasePlayer *player, int team_id) { MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); @@ -131,7 +127,6 @@ void TeamChangeUpdate(CBasePlayer *player, int team_id) } } -/* <4731f> ../cstrike/dlls/client.cpp:222 */ void BlinkAccount(CBasePlayer *player, int numBlinks) { MESSAGE_BEGIN(MSG_ONE, gmsgBlinkAcct, NULL, player->pev); @@ -139,13 +134,11 @@ void BlinkAccount(CBasePlayer *player, int numBlinks) MESSAGE_END(); } -/* <47efd> ../cstrike/dlls/client.cpp:236 */ BOOL EXT_FUNC ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) { return g_pGameRules->ClientConnected(pEntity, pszName, pszAddress, szRejectReason); } -/* <47f5b> ../cstrike/dlls/client.cpp:255 */ void EXT_FUNC ClientDisconnect(edict_t *pEntity) { CBasePlayer *pPlayer = dynamic_cast(CBaseEntity::Instance(pEntity)); @@ -155,7 +148,7 @@ void EXT_FUNC ClientDisconnect(edict_t *pEntity) UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_disconnected", STRING(pEntity->v.netname)); CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(pEntity)); - if (pSound) + if (pSound != NULL) pSound->Reset(); pEntity->v.takedamage = DAMAGE_NO; @@ -175,19 +168,16 @@ void EXT_FUNC ClientDisconnect(edict_t *pEntity) } } -/* <4c477> ../cstrike/dlls/client.cpp:306 */ void respawn(entvars_t *pev, BOOL fCopyCorpse) { if (gpGlobals->coop || gpGlobals->deathmatch) { - CHalfLifeMultiplay *mp = g_pGameRules; - - if (mp->m_iTotalRoundsPlayed > 0) - mp->MarkSpawnSkipped(); + if (CSGameRules()->m_iTotalRoundsPlayed > 0) + CSGameRules()->MarkSpawnSkipped(); CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev); - if (mp->IsCareer() && mp->ShouldSkipSpawn() && pPlayer->IsAlive()) + if (CSGameRules()->IsCareer() && CSGameRules()->ShouldSkipSpawn() && pPlayer->IsAlive()) g_skipCareerInitialSpawn = true; pPlayer->Spawn(); @@ -200,12 +190,9 @@ void respawn(entvars_t *pev, BOOL fCopyCorpse) } // Suicide... - -/* <48013> ../cstrike/dlls/client.cpp:347 */ void EXT_FUNC ClientKill(edict_t *pEntity) { entvars_t *pev = &pEntity->v; - CHalfLifeMultiplay *mp = g_pGameRules; CBasePlayer *pl = (CBasePlayer *)CBasePlayer::Instance(pev); if (pl->IsObserver()) @@ -227,13 +214,12 @@ void EXT_FUNC ClientKill(edict_t *pEntity) pEntity->v.health = 0; pl->Killed(pev, GIB_NEVER); - if (mp->m_pVIP == pl) + if (CSGameRules()->m_pVIP == pl) { - mp->m_iConsecutiveVIP = 10; + CSGameRules()->m_iConsecutiveVIP = 10; } } -/* <47a8a> ../cstrike/dlls/client.cpp:379 */ void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText) { MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pPlayer->pev); @@ -244,7 +230,6 @@ void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL f MESSAGE_END(); } -/* <4735f> ../cstrike/dlls/client.cpp:390 */ void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu) { if (pPlayer->m_bVGUIMenus || MenuType > VGUI_Menu_Buy_Item) @@ -261,7 +246,6 @@ void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMe ShowMenu(pPlayer, BitMask, -1, 0, szOldMenu); } -/* <4c3c5> ../cstrike/dlls/client.cpp:414 */ NOXREF int CountTeams() { int iNumCT = 0, iNumTerrorist = 0; @@ -293,7 +277,6 @@ NOXREF int CountTeams() return iNumCT - iNumTerrorist; } -/* <4c2be> ../cstrike/dlls/client.cpp:443 */ void ListPlayers(CBasePlayer *current) { char message[120], cNumber[12]; @@ -323,7 +306,6 @@ void ListPlayers(CBasePlayer *current) ClientPrint(current->pev, HUD_PRINTCONSOLE, "\n"); } -/* <4c200> ../cstrike/dlls/client.cpp:475 */ int CountTeamPlayers(int iTeam) { CBaseEntity *pPlayer = NULL; @@ -344,7 +326,6 @@ int CountTeamPlayers(int iTeam) return i; } -/* <4c4ef> ../cstrike/dlls/client.cpp:494 */ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer) { CBaseEntity *pTempEntity; @@ -389,7 +370,7 @@ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer) iVotesNeeded = iValidVotes; fKickPercent = (iTeamCount * kick_percent.value + 0.5); - if (iVotesNeeded >= (int)fKickPercent) + if (iVotesNeeded >= int(fKickPercent)) { UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Game_kicked", STRING(pKickPlayer->pev->netname)); SERVER_COMMAND(UTIL_VarArgs("kick # %d\n", iVoteID)); @@ -411,26 +392,24 @@ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer) } } -/* <48298> ../cstrike/dlls/client.cpp:580 */ TeamName SelectDefaultTeam() { TeamName team = UNASSIGNED; - CHalfLifeMultiplay *mp = g_pGameRules; - if (mp->m_iNumTerrorist < mp->m_iNumCT) + if (CSGameRules()->m_iNumTerrorist < CSGameRules()->m_iNumCT) { team = TERRORIST; } - else if (mp->m_iNumTerrorist > mp->m_iNumCT) + else if (CSGameRules()->m_iNumTerrorist > CSGameRules()->m_iNumCT) { team = CT; } // Choose the team that's losing - else if (mp->m_iNumTerroristWins < mp->m_iNumCTWins) + else if (CSGameRules()->m_iNumTerroristWins < CSGameRules()->m_iNumCTWins) { team = TERRORIST; } - else if (mp->m_iNumCTWins < mp->m_iNumTerroristWins) + else if (CSGameRules()->m_iNumCTWins < CSGameRules()->m_iNumTerroristWins) { team = CT; } @@ -447,7 +426,7 @@ TeamName SelectDefaultTeam() } } - if (mp->TeamFull(team)) + if (CSGameRules()->TeamFull(team)) { // Pick the opposite team if (team == TERRORIST) @@ -460,7 +439,7 @@ TeamName SelectDefaultTeam() } // No choices left - if (mp->TeamFull(team)) + if (CSGameRules()->TeamFull(team)) { return UNASSIGNED; } @@ -470,10 +449,9 @@ TeamName SelectDefaultTeam() } -/* <473a3> ../cstrike/dlls/client.cpp:638 */ void CheckStartMoney() { - int money = (int)startmoney.value; + int money = int(startmoney.value); #ifndef REGAMEDLL_ADD if (money > 16000) @@ -481,7 +459,7 @@ void CheckStartMoney() else if (money < 800) CVAR_SET_FLOAT("mp_startmoney", 800); #else - int max_money = (int)maxmoney.value; + int max_money = int(maxmoney.value); if (money > max_money) CVAR_SET_FLOAT("mp_startmoney", max_money); @@ -491,17 +469,15 @@ void CheckStartMoney() } -/* <4c084> ../cstrike/dlls/client.cpp:661 */ void EXT_FUNC ClientPutInServer(edict_t *pEntity) { entvars_t *pev = &pEntity->v; CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev); - CHalfLifeMultiplay *mp = g_pGameRules; pPlayer->SetCustomDecalFrames(-1); pPlayer->SetPrefsFromUserinfo(GET_INFO_BUFFER(pEntity)); - if (!mp->IsMultiplayer()) + if (!g_pGameRules->IsMultiplayer()) { pPlayer->Spawn(); return; @@ -517,7 +493,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity) CheckStartMoney(); - pPlayer->m_iAccount = (int)startmoney.value; + pPlayer->m_iAccount = int(startmoney.value); pPlayer->m_fGameHUDInitialized = FALSE; pPlayer->m_flDisplayHistory &= ~DHF_ROUND_STARTED; pPlayer->pev->flags |= FL_SPECTATOR; @@ -552,15 +528,15 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity) CBaseEntity *Target = UTIL_FindEntityByClassname(NULL, "trigger_camera"); pPlayer->m_pIntroCamera = Target; - if (mp && mp->m_bMapHasCameras == MAP_HAS_CAMERAS_INIT) + if (CSGameRules() != NULL && CSGameRules()->m_bMapHasCameras == MAP_HAS_CAMERAS_INIT) { - mp->m_bMapHasCameras = (Target != NULL); + CSGameRules()->m_bMapHasCameras = (Target != NULL); } - if (pPlayer->m_pIntroCamera) + if (pPlayer->m_pIntroCamera != NULL) Target = UTIL_FindEntityByTargetname(NULL, STRING(pPlayer->m_pIntroCamera->pev->target)); - if (pPlayer->m_pIntroCamera && Target) + if (pPlayer->m_pIntroCamera != NULL && Target != NULL) { Vector CamAngles = UTIL_VecToAngles((Target->pev->origin - pPlayer->m_pIntroCamera->pev->origin).Normalize()); CamAngles.x = -CamAngles.x; @@ -577,9 +553,9 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity) { pPlayer->m_iTeam = CT; - if (mp) + if (g_pGameRules != NULL) { - mp->GetPlayerSpawnSpot(pPlayer); + g_pGameRules->GetPlayerSpawnSpot(pPlayer); } pPlayer->m_iTeam = UNASSIGNED; @@ -606,7 +582,6 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity) UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_connected", (sName[0] != '\0') ? sName : ""); } -/* <478f7> ../cstrike/dlls/client.cpp:792 */ int Q_strlen_(const char *str) { int count = 0; @@ -617,7 +592,6 @@ int Q_strlen_(const char *str) return count; } -/* <4bbff> ../cstrike/dlls/client.cpp:814 */ void Host_Say(edict_t *pEntity, int teamonly) { CBasePlayer *client; @@ -680,7 +654,7 @@ void Host_Say(edict_t *pEntity, int teamonly) } // make sure the text has content - if (!p || !p[0] || !Q_UnicodeValidate(p)) + if (/*!p || */!p[0] || !Q_UnicodeValidate(p)) { // no character found, so say nothing return; @@ -831,7 +805,7 @@ void Host_Say(edict_t *pEntity, int teamonly) continue; // can the receiver hear the sender? or has he muted him? - if (gpGlobals->deathmatch != 0.0f && g_pGameRules->m_VoiceGameMgr.PlayerHasBlockedPlayer(client, player)) + if (gpGlobals->deathmatch != 0.0f && CSGameRules()->m_VoiceGameMgr.PlayerHasBlockedPlayer(client, player)) continue; if (teamonly && client->m_iTeam != player->m_iTeam) @@ -895,21 +869,11 @@ void Host_Say(edict_t *pEntity, int teamonly) char *szTeam = GetTeam(player->m_iTeam); - UTIL_LogPrintf - ( - "\"%s<%i><%s><%s>\" %s \"%s\"%s\n", - STRING(player->pev->netname), - GETPLAYERUSERID(player->edict()), - GETPLAYERAUTHID(player->edict()), - szTeam, - temp, - fullText, - deadText - ); + UTIL_LogPrintf("\"%s<%i><%s><%s>\" %s \"%s\"%s\n", STRING(player->pev->netname), GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict()), + szTeam, temp, fullText, deadText); } } -/* <4865e> ../cstrike/dlls/client.cpp:1160 */ void DropSecondary(CBasePlayer *pPlayer) { if (pPlayer->HasShield()) @@ -931,7 +895,6 @@ void DropSecondary(CBasePlayer *pPlayer) } -/* <473db> ../cstrike/dlls/client.cpp:1182 */ void DropPrimary(CBasePlayer *pPlayer) { if (pPlayer->HasShield()) @@ -946,11 +909,8 @@ void DropPrimary(CBasePlayer *pPlayer) } } -/* <483a2> ../cstrike/dlls/client.cpp:1197 */ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon) { - CHalfLifeMultiplay *mp = g_pGameRules; - if (pPlayer->HasShield() && iWeapon == WEAPON_ELITE) { return false; @@ -986,7 +946,7 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon) return false; } - if (!CanBuyWeaponByMaptype(pPlayer->m_iTeam, (WeaponIdType)iWeapon, (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES))) + if (!CanBuyWeaponByMaptype(pPlayer->m_iTeam, (WeaponIdType)iWeapon, (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES))) { if (g_bClientPrintEnable) { @@ -999,7 +959,6 @@ bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon) return true; } -/* <48696> ../cstrike/dlls/client.cpp:1247 */ void BuyPistol(CBasePlayer *pPlayer, int iSlot) { int iWeapon = 0; @@ -1092,7 +1051,6 @@ void BuyPistol(CBasePlayer *pPlayer, int iSlot) } } -/* <487b0> ../cstrike/dlls/client.cpp:1325 */ void BuyShotgun(CBasePlayer *pPlayer, int iSlot) { int iWeapon = 0; @@ -1154,7 +1112,6 @@ void BuyShotgun(CBasePlayer *pPlayer, int iSlot) } } -/* <488b5> ../cstrike/dlls/client.cpp:1378 */ void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot) { int iWeapon = 0; @@ -1240,7 +1197,6 @@ void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot) } } -/* <489bb> ../cstrike/dlls/client.cpp:1450 */ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID) { if (!pPlayer->CanPlayerBuy(true)) @@ -1289,7 +1245,6 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID) } } -/* <48adf> ../cstrike/dlls/client.cpp:1498 */ void BuyRifle(CBasePlayer *pPlayer, int iSlot) { int iWeapon = 0; @@ -1443,7 +1398,6 @@ void BuyRifle(CBasePlayer *pPlayer, int iSlot) } } -/* <48bf5> ../cstrike/dlls/client.cpp:1629 */ void BuyMachineGun(CBasePlayer *pPlayer, int iSlot) { int iWeapon = WEAPON_M249; @@ -1487,10 +1441,8 @@ void BuyMachineGun(CBasePlayer *pPlayer, int iSlot) } } -/* <473f8> ../cstrike/dlls/client.cpp:1677 */ void BuyItem(CBasePlayer *pPlayer, int iSlot) { - //int iItem = 0; int iItemPrice = 0; const char *pszItem = NULL; @@ -1510,7 +1462,6 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) int fullArmor = (pPlayer->pev->armorvalue >= 100); int helmet = (pPlayer->m_iKevlar == ARMOR_TYPE_HELMET); - //int price; int enoughMoney = 1; switch (iSlot) @@ -1706,7 +1657,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) } case MENU_SLOT_ITEM_DEFUSEKIT: { - if (pPlayer->m_iTeam != CT || !g_pGameRules->m_bMapHasBombTarget) + if (pPlayer->m_iTeam != CT || !CSGameRules()->m_bMapHasBombTarget) { return; } @@ -1790,10 +1741,8 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) } } -/* <48d40> ../cstrike/dlls/client.cpp:1998 */ void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot) { - CHalfLifeMultiplay *mp = g_pGameRules; int numSkins = g_bIsCzeroGame ? CZ_NUM_SKIN : CS_NUM_SKIN; struct @@ -1909,17 +1858,17 @@ void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot) // Reset the player's state if (player->m_iJoiningState == JOINED) { - mp->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); } else if (player->m_iJoiningState == PICKINGTEAM) { player->m_iJoiningState = GETINTOGAME; - if (mp->IsCareer()) + if (CSGameRules()->IsCareer()) { if (!player->IsBot()) { - mp->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); } } } @@ -1930,17 +1879,17 @@ void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot) SET_CLIENT_KEY_VALUE(player->entindex(), GET_INFO_BUFFER(player->edict()), "model", appearance.model_name); player->SetNewPlayerModel(sPlayerModelFiles[ appearance.model_name_index ]); - if (mp->m_iMapHasVIPSafetyZone == MAP_VIP_SAFETYZONE_UNINITIALIZED) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_VIP_SAFETYZONE_UNINITIALIZED) { if ((UTIL_FindEntityByClassname(NULL, "func_vip_safetyzone")) != NULL) - mp->m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_YES; + CSGameRules()->m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_YES; else - mp->m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_NO; + CSGameRules()->m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_NO; } - if (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES) { - if (!mp->m_pVIP && player->m_iTeam == CT) + if (!CSGameRules()->m_pVIP && player->m_iTeam == CT) { player->MakeVIP(); } @@ -1949,12 +1898,8 @@ void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot) // returns true if the selection has been handled and the player's menu // can be closed...false if the menu should be displayed again - -/* <48e4b> ../cstrike/dlls/client.cpp:2214 */ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) { - CHalfLifeMultiplay *mp = g_pGameRules; - int oldTeam; char *szOldTeam; char *szNewTeam; @@ -1972,7 +1917,7 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) return TRUE; } - else if (g_pGameRules->IsVIPQueueEmpty()) + else if (CSGameRules()->IsVIPQueueEmpty()) { ClientPrint(player->pev, HUD_PRINTCENTER, "#Cannot_Switch_From_VIP"); CLIENT_COMMAND(ENT(player->pev), "slot10\n"); @@ -1993,9 +1938,9 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) break; case MENU_SLOT_TEAM_VIP: { - if (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == CT) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == CT) { - mp->AddToVIPQueue(player); + CSGameRules()->AddToVIPQueue(player); CLIENT_COMMAND(ENT(player->pev), "slot10\n"); return TRUE; } @@ -2052,7 +1997,7 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) // Only spectate if we are in the freeze period or dead. // This is done here just in case. - if (mp->IsFreezePeriod() || player->pev->deadflag != DEAD_NO) + if (g_pGameRules->IsFreezePeriod() || player->pev->deadflag != DEAD_NO) { if (player->m_iTeam != UNASSIGNED && player->pev->deadflag == DEAD_NO) { @@ -2068,14 +2013,8 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) if (player->m_iTeam != SPECTATOR) { // notify other clients of player joined to team spectator - UTIL_LogPrintf - ( - "\"%s<%i><%s><%s>\" joined team \"SPECTATOR\"\n", - STRING(player->pev->netname), - GETPLAYERUSERID(player->edict()), - GETPLAYERAUTHID(player->edict()), - GetTeam(player->m_iTeam) - ); + UTIL_LogPrintf("\"%s<%i><%s><%s>\" joined team \"SPECTATOR\"\n", STRING(player->pev->netname), + GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict()), GetTeam(player->m_iTeam)); } player->m_iTeam = SPECTATOR; @@ -2091,7 +2030,7 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) MESSAGE_BEGIN(MSG_BROADCAST, gmsgScoreInfo); WRITE_BYTE(ENTINDEX(player->edict())); - WRITE_SHORT((int)player->pev->frags); + WRITE_SHORT(int(player->pev->frags)); WRITE_SHORT(player->m_iDeaths); WRITE_SHORT(0); WRITE_SHORT(0); @@ -2107,8 +2046,8 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) TeamChangeUpdate(player, player->m_iTeam); - edict_t *pentSpawnSpot = mp->GetPlayerSpawnSpot(player); - player->StartObserver(VARS(pentSpawnSpot)->origin, VARS(pentSpawnSpot)->angles); + edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot(player); + player->StartObserver(pentSpawnSpot->v.origin, pentSpawnSpot->v.angles); MESSAGE_BEGIN(MSG_ALL, gmsgSpectator); WRITE_BYTE(ENTINDEX(player->edict())); @@ -2141,7 +2080,7 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) // Player is switching to a new team (It is possible to switch to the // same team just to choose a new appearance) - if (mp->TeamFull(team)) + if (CSGameRules()->TeamFull(team)) { // The specified team is full // attempt to kick a bot to make room for this player @@ -2161,7 +2100,7 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) } // players are allowed to change to their own team so they can just change their model - if (mp->TeamStacked(team, player->m_iTeam)) + if (CSGameRules()->TeamStacked(team, player->m_iTeam)) { // The specified team is full ClientPrint(player->pev, HUD_PRINTCENTER, (team == TERRORIST) ? "#Too_Many_Terrorists" : "#Too_Many_CTs"); @@ -2208,7 +2147,7 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) CheckStartMoney(); // all players start with "mp_startmoney" bucks - player->m_iAccount = (int)startmoney.value; + player->m_iAccount = int(startmoney.value); player->pev->solid = SOLID_NOT; player->pev->movetype = MOVETYPE_NOCLIP; @@ -2231,7 +2170,7 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) SET_MODEL(ENT(player->pev), "models/player.mdl"); } - if (!g_pGameRules->IsCareer()) + if (!CSGameRules()->IsCareer()) { switch (team) { @@ -2277,27 +2216,13 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) szNewTeam = GetTeam(team); // Notify others that this player has joined a new team - UTIL_ClientPrintAll - ( - HUD_PRINTNOTIFY, - (team == TERRORIST) ? "#Game_join_terrorist" : "#Game_join_ct", - (STRING(player->pev->netname) && STRING(player->pev->netname)[0] != 0) ? STRING(player->pev->netname) : "" - ); - - UTIL_LogPrintf - ( - "\"%s<%i><%s><%s>\" joined team \"%s\"\n", - STRING(player->pev->netname), - GETPLAYERUSERID(player->edict()), - GETPLAYERAUTHID(player->edict()), - szOldTeam, - szNewTeam - ); + UTIL_ClientPrintAll(HUD_PRINTNOTIFY, (team == TERRORIST) ? "#Game_join_terrorist" : "#Game_join_ct", + (STRING(player->pev->netname) && STRING(player->pev->netname)[0] != 0) ? STRING(player->pev->netname) : ""); + UTIL_LogPrintf("\"%s<%i><%s><%s>\" joined team \"%s\"\n", STRING(player->pev->netname), GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict()), szOldTeam, szNewTeam); return TRUE; } -/* <474a0> ../cstrike/dlls/client.cpp:2553 */ void Radio1(CBasePlayer *player, int slot) { if (player->m_flRadioTime >= gpGlobals->time) @@ -2341,7 +2266,6 @@ void Radio1(CBasePlayer *player, int slot) } } -/* <474ca> ../cstrike/dlls/client.cpp:2596 */ void Radio2(CBasePlayer *player, int slot) { if (player->m_flRadioTime >= gpGlobals->time) @@ -2385,7 +2309,6 @@ void Radio2(CBasePlayer *player, int slot) } } -/* <474f4> ../cstrike/dlls/client.cpp:2639 */ void Radio3(CBasePlayer *player, int slot) { if (player->m_flRadioTime >= gpGlobals->time) @@ -2442,7 +2365,6 @@ void Radio3(CBasePlayer *player, int slot) } } -/* <49402> ../cstrike/dlls/client.cpp:2698 */ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney) { int cost; @@ -2548,7 +2470,6 @@ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney) return false; } -/* <4751e> ../cstrike/dlls/client.cpp:2884 */ bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney) { if (!player->CanPlayerBuy(true)) @@ -2590,7 +2511,6 @@ bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney) return false; } -/* <4bb4a> ../cstrike/dlls/client.cpp:2933 */ CBaseEntity *EntityFromUserID(int userID) { CBaseEntity *pTempEntity = NULL; @@ -2611,7 +2531,6 @@ CBaseEntity *EntityFromUserID(int userID) return NULL; } -/* <4baa5> ../cstrike/dlls/client.cpp:2958 */ NOXREF int CountPlayersInServer() { int count = 0; @@ -2636,8 +2555,6 @@ NOXREF int CountPlayersInServer() // Handles the special "buy" alias commands we're creating to accommodate the buy // scripts players use (now that we've rearranged the buy menus and broken the scripts) // ** Returns TRUE if we've handled the command ** - -/* <4958c> ../cstrike/dlls/client.cpp:2983 */ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) { // Let them buy it if it's got a weapon data string. @@ -2651,7 +2568,7 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) { // Ok, we have weapon info ID. // assasination maps have a specific set of weapons that can be used in them. - if (CanBuyWeaponByMaptype(pPlayer->m_iTeam, weaponID, (g_pGameRules->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES))) + if (CanBuyWeaponByMaptype(pPlayer->m_iTeam, weaponID, (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES))) { bRetVal = TRUE; BuyWeaponByWeaponID(pPlayer, weaponID); @@ -2781,7 +2698,6 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) return bRetVal; } -/* <49c3e> ../cstrike/dlls/client.cpp:3113 */ BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) { BOOL bRetVal = FALSE; @@ -2896,13 +2812,10 @@ BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) } // Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command. - -/* <4c6c1> ../cstrike/dlls/client.cpp:3234 */ void EXT_FUNC ClientCommand(edict_t *pEntity) { const char *pcmd = CMD_ARGV_(0); const char *pstr = NULL; - CHalfLifeMultiplay *mp = g_pGameRules; // Is the client spawned yet? if (!pEntity->pvPrivateData) @@ -2913,33 +2826,33 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) if (FStrEq(pcmd, "say")) { - if (gpGlobals->time >= player->m_flLastCommandTime[0]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_SAY]) { - player->m_flLastCommandTime[0] = gpGlobals->time + 0.3f; + player->m_flLastCommandTime[CMD_SAY] = gpGlobals->time + 0.3f; Host_Say(pEntity, 0); } } else if (FStrEq(pcmd, "say_team")) { - if (gpGlobals->time >= player->m_flLastCommandTime[1]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_SAYTEAM]) { - player->m_flLastCommandTime[1] = gpGlobals->time + 0.3f; + player->m_flLastCommandTime[CMD_SAYTEAM] = gpGlobals->time + 0.3f; Host_Say(pEntity, 1); } } else if (FStrEq(pcmd, "fullupdate")) { - if (gpGlobals->time >= player->m_flLastCommandTime[2]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_FULLUPDATE]) { - player->m_flLastCommandTime[2] = gpGlobals->time + 0.6f; + player->m_flLastCommandTime[CMD_FULLUPDATE] = gpGlobals->time + 0.6f; player->ForceClientDllUpdate(); } } else if (FStrEq(pcmd, "vote")) { - if (gpGlobals->time >= player->m_flLastCommandTime[3]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_VOTE]) { - player->m_flLastCommandTime[3] = gpGlobals->time + 0.3f; + player->m_flLastCommandTime[CMD_VOTE] = gpGlobals->time + 0.3f; if (gpGlobals->time < player->m_flNextVoteTime) { @@ -3012,17 +2925,17 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } else if (FStrEq(pcmd, "listmaps")) { - if (gpGlobals->time >= player->m_flLastCommandTime[5]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_LISTMAPS]) { - player->m_flLastCommandTime[5] = gpGlobals->time + 0.3f; - mp->DisplayMaps(player, 0); + player->m_flLastCommandTime[CMD_LISTMAPS] = gpGlobals->time + 0.3f; + CSGameRules()->DisplayMaps(player, 0); } } else if (FStrEq(pcmd, "votemap")) { - if (gpGlobals->time >= player->m_flLastCommandTime[4]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_VOTEMAP]) { - player->m_flLastCommandTime[4] = gpGlobals->time + 0.3f; + player->m_flLastCommandTime[CMD_VOTEMAP] = gpGlobals->time + 0.3f; if (gpGlobals->time < player->m_flNextVoteTime) { @@ -3063,7 +2976,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) if (iFailed) { - mp->DisplayMaps(player, 0); + CSGameRules()->DisplayMaps(player, 0); ClientPrint(player->pev, HUD_PRINTCONSOLE, "#Game_votemap_usage"); return; } @@ -3076,17 +2989,15 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) if (player->m_iMapVote) { - mp->m_iMapVotes[ player->m_iMapVote ]--; - - if (mp->m_iMapVotes[player->m_iMapVote] < 0) + if (--CSGameRules()->m_iMapVotes[player->m_iMapVote] < 0) { - mp->m_iMapVotes[player->m_iMapVote] = 0; + CSGameRules()->m_iMapVotes[player->m_iMapVote] = 0; } } ClientPrint(player->pev, HUD_PRINTCONSOLE, "#Game_voted_for_map", UTIL_dtos1(iVoteID)); player->m_iMapVote = iVoteID; - mp->ProcessMapVote(player, iVoteID); + CSGameRules()->ProcessMapVote(player, iVoteID); } } } @@ -3094,7 +3005,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) { if (gpGlobals->time > player->m_iTimeCheckAllowed) { - player->m_iTimeCheckAllowed = (int)(gpGlobals->time + 1); + player->m_iTimeCheckAllowed = int(gpGlobals->time + 1); if (!timelimit.value) { @@ -3102,13 +3013,13 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) return; } - int iTimeRemaining = (int)(g_flTimeLimit - gpGlobals->time); + int iTimeRemaining = int(g_flTimeLimit - gpGlobals->time); if (iTimeRemaining < 0) iTimeRemaining = 0; - int iMinutes = (int)(iTimeRemaining % 60); - int iSeconds = (int)(iTimeRemaining / 60); + int iMinutes = int(iTimeRemaining % 60); + int iSeconds = int(iTimeRemaining / 60); char secs[5]; char *temp = UTIL_dtos2(iMinutes); @@ -3131,9 +3042,9 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } else if (FStrEq(pcmd, "listplayers")) { - if (gpGlobals->time >= player->m_flLastCommandTime[6]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_LISTPLAYERS]) { - player->m_flLastCommandTime[6] = gpGlobals->time + 0.3f; + player->m_flLastCommandTime[CMD_LISTPLAYERS] = gpGlobals->time + 0.3f; ListPlayers(player); } } @@ -3168,7 +3079,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) { int slot = Q_atoi(CMD_ARGV_(1)); - if (player->m_iJoiningState == JOINED || (player->m_iMenu != SPECTATOR && player->m_iMenu != TERRORIST)) + if (player->m_iJoiningState == JOINED || (player->m_iMenu != Menu_ChooseAppearance && player->m_iMenu != Menu_ChooseTeam)) { if (slot == 10) { @@ -3228,7 +3139,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } case VGUI_MenuSlot_Buy_ShotGun: { - if (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == TERRORIST) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == TERRORIST) ShowVGUIMenu(player, VGUI_Menu_Buy_ShotGun, MENU_KEY_0, "#AS_BuyShotgun"); else ShowVGUIMenu(player, VGUI_Menu_Buy_ShotGun, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_0), "#BuyShotgun"); @@ -3238,7 +3149,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } case VGUI_MenuSlot_Buy_SubMachineGun: { - if (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES) { if (player->m_iTeam == CT) ShowVGUIMenu(player, VGUI_Menu_Buy_SubMachineGun, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_0), "#AS_CT_BuySubMachineGun"); @@ -3258,7 +3169,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } case VGUI_MenuSlot_Buy_Rifle: { - if (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES) { if (player->m_iTeam == CT) ShowVGUIMenu(player, VGUI_Menu_Buy_Rifle, (MENU_KEY_1 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_0), "#AS_CT_BuyRifle"); @@ -3278,7 +3189,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } case VGUI_MenuSlot_Buy_MachineGun: { - if (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == TERRORIST) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iTeam == TERRORIST) ShowVGUIMenu(player, VGUI_Menu_Buy_MachineGun, MENU_KEY_0, "#AS_T_BuyMachineGun"); else ShowVGUIMenu(player, VGUI_Menu_Buy_MachineGun, (MENU_KEY_1 | MENU_KEY_0), "#BuyMachineGun"); @@ -3328,7 +3239,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) { if (player->m_signals.GetState() & SIGNAL_BUY) { - if (mp->m_bMapHasBombTarget) + if (CSGameRules()->m_bMapHasBombTarget) { if (player->m_iTeam == CT) ShowVGUIMenu(player, VGUI_Menu_Buy_Item, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_0), "#DCT_BuyItem"); @@ -3435,18 +3346,18 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } } - if (!mp->IsCareer()) + if (!CSGameRules()->IsCareer()) { - if (mp->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iJoiningState == JOINED && player->m_iTeam == CT) + if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_HAVE_VIP_SAFETYZONE_YES && player->m_iJoiningState == JOINED && player->m_iTeam == CT) { - if (mp->IsFreezePeriod() || player->pev->deadflag != DEAD_NO) + if (CSGameRules()->IsFreezePeriod() || player->pev->deadflag != DEAD_NO) ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_0), "#IG_VIP_Team_Select_Spect"); else ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_5 | MENU_KEY_0), "#IG_VIP_Team_Select"); } else { - if (mp->IsFreezePeriod() || player->pev->deadflag != DEAD_NO) + if (CSGameRules()->IsFreezePeriod() || player->pev->deadflag != DEAD_NO) ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_0), "#IG_Team_Select_Spect"); else ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5 | MENU_KEY_0), "#IG_Team_Select"); @@ -3500,7 +3411,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) return; } - mp->AddToVIPQueue(player); + CSGameRules()->AddToVIPQueue(player); } else if (FStrEq(pcmd, "spectate") && (player->pev->flags & FL_PROXY)) // always allow proxies to become a spectator { @@ -3547,7 +3458,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } else { - if (mp->ClientCommand_DeadOrAlive(GetClassPtr((CBasePlayer *)pev), pcmd)) + if (g_pGameRules->ClientCommand_DeadOrAlive(GetClassPtr((CBasePlayer *)pev), pcmd)) return; if (TheBots != NULL) @@ -3604,9 +3515,9 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) { if (FStrEq(pcmd, "nightvision")) { - if (gpGlobals->time >= player->m_flLastCommandTime[7]) + if (gpGlobals->time >= player->m_flLastCommandTime[CMD_NIGHTVISION]) { - player->m_flLastCommandTime[7] = gpGlobals->time + 0.3f; + player->m_flLastCommandTime[CMD_NIGHTVISION] = gpGlobals->time + 0.3f; if (!player->m_bHasNightVision) return; @@ -3702,7 +3613,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) if (g_flWeaponCheat && CMD_ARGC() > 1) GetClassPtr((CBasePlayer *)pev)->m_iFOV = Q_atoi(CMD_ARGV(1)); else - CLIENT_PRINTF(pEntity, print_console, UTIL_VarArgs("\"fov\" is \"%d\"\n", (int)GetClassPtr((CBasePlayer *)pev)->m_iFOV)); + CLIENT_PRINTF(pEntity, print_console, UTIL_VarArgs("\"fov\" is \"%d\"\n", int(GetClassPtr((CBasePlayer *)pev)->m_iFOV))); #endif } else if (FStrEq(pcmd, "use")) @@ -3747,7 +3658,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) { if (player->m_signals.GetState() & SIGNAL_BUY) { - if (mp->m_bMapHasBombTarget) + if (CSGameRules()->m_bMapHasBombTarget) { if (player->m_iTeam == CT) ShowVGUIMenu(player, VGUI_Menu_Buy_Item, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_0), "#DCT_BuyItem"); @@ -3854,7 +3765,6 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) } } -/* <4b959> ../cstrike/dlls/client.cpp:4282 */ void EXT_FUNC ClientUserInfoChanged(edict_t *pEntity, char *infobuffer) { // Is the client spawned yet? @@ -3904,22 +3814,13 @@ void EXT_FUNC ClientUserInfoChanged(edict_t *pEntity, char *infobuffer) WRITE_STRING(szName); MESSAGE_END(); - UTIL_LogPrintf - ( - "\"%s<%i><%s><%s>\" changed name to \"%s\"\n", - STRING(pEntity->v.netname), - GETPLAYERUSERID(pEntity), - GETPLAYERAUTHID(pEntity), - GetTeam(pPlayer->m_iTeam), - szName - ); + UTIL_LogPrintf("\"%s<%i><%s><%s>\" changed name to \"%s\"\n", STRING(pEntity->v.netname), GETPLAYERUSERID(pEntity), GETPLAYERAUTHID(pEntity), GetTeam(pPlayer->m_iTeam), szName); } } g_pGameRules->ClientUserInfoChanged(GetClassPtr((CBasePlayer *)&pEntity->v), infobuffer); } -/* <4a378> ../cstrike/dlls/client.cpp:4362 */ void EXT_FUNC ServerDeactivate() { // It's possible that the engine will call this function more times than is necessary @@ -3946,7 +3847,6 @@ void EXT_FUNC ServerDeactivate() } } -/* <4a392> ../cstrike/dlls/client.cpp:4400 */ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) { int i; @@ -3971,7 +3871,7 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) pClass = CBaseEntity::Instance(pEdict); // Activate this entity if it's got a class & isn't dormant - if (pClass && !(pClass->pev->flags & FL_DORMANT)) + if (pClass != NULL && !(pClass->pev->flags & FL_DORMANT)) { AddEntityHashValue(&pEdict->v, STRING(pEdict->v.classname), CLASSNAME); pClass->Activate(); @@ -4000,7 +3900,6 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) } } -/* <4a404> ../cstrike/dlls/client.cpp:4459 */ void EXT_FUNC PlayerPreThink(edict_t *pEntity) { entvars_t *pev = &pEntity->v; @@ -4012,7 +3911,6 @@ void EXT_FUNC PlayerPreThink(edict_t *pEntity) } } -/* <4a47c> ../cstrike/dlls/client.cpp:4475 */ void EXT_FUNC PlayerPostThink(edict_t *pEntity) { entvars_t *pev = &pEntity->v; @@ -4024,13 +3922,11 @@ void EXT_FUNC PlayerPostThink(edict_t *pEntity) } } -/* <4a4f4> ../cstrike/dlls/client.cpp:4486 */ void EXT_FUNC ParmsNewLevel() { ; } -/* <4a50d> ../cstrike/dlls/client.cpp:4491 */ void EXT_FUNC ParmsChangeLevel() { // retrieve the pointer to the save data @@ -4042,7 +3938,6 @@ void EXT_FUNC ParmsChangeLevel() } } -/* <4a548> ../cstrike/dlls/client.cpp:4504 */ void EXT_FUNC StartFrame() { if (g_pGameRules != NULL) @@ -4064,7 +3959,7 @@ void EXT_FUNC StartFrame() gpGlobals->teamplay = 1.0f; if (skill != NULL) - g_iSkillLevel = (int)skill->value; + g_iSkillLevel = int(skill->value); else g_iSkillLevel = 0; @@ -4079,10 +3974,12 @@ void EXT_FUNC StartFrame() TheTutor->StartFrame(gpGlobals->time); } +#ifndef REGAMEDLL_FIXES + // it is noxref ++g_ulFrameCount; +#endif } -/* <4a581> ../cstrike/dlls/client.cpp:4534 */ void ClientPrecache() { int i; @@ -4492,23 +4389,8 @@ void ClientPrecache() PRECACHE_GENERIC("sprites/scope_arc_sw.tga"); m_usResetDecals = g_engfuncs.pfnPrecacheEvent(1, "events/decal_reset.sc"); - - /*Vector temp = g_vecZero; - ENGINE_FORCE_UNMODIFIED(force_exactfile, (float *)&temp, (float *)&temp, "sprites/scope_arc.tga"); - ENGINE_FORCE_UNMODIFIED(force_exactfile, (float *)&temp, (float *)&temp, "sprites/scope_arc_nw.tga"); - ENGINE_FORCE_UNMODIFIED(force_exactfile, (float *)&temp, (float *)&temp, "sprites/scope_arc_ne.tga"); - ENGINE_FORCE_UNMODIFIED(force_exactfile, (float *)&temp, (float *)&temp, "sprites/scope_arc_sw.tga"); - - - PRECACHE_GENERIC("sprites/scope_arc.tga"); - PRECACHE_GENERIC("sprites/scope_arc_nw.tga"); - PRECACHE_GENERIC("sprites/scope_arc_ne.tga"); - PRECACHE_GENERIC("sprites/scope_arc_sw.tga"); - - m_usResetDecals = g_engfuncs.pfnPrecacheEvent(1, "events/decal_reset.sc");*/ } -/* <4a6e5> ../cstrike/dlls/client.cpp:4996 */ const char *EXT_FUNC GetGameDescription() { if (g_bIsCzeroGame) @@ -4517,13 +4399,11 @@ const char *EXT_FUNC GetGameDescription() return "Counter-Strike"; } -/* <4a703> ../cstrike/dlls/client.cpp:5022 */ void EXT_FUNC Sys_Error(const char *error_string) { ; } -/* <4a731> ../cstrike/dlls/client.cpp:5039 */ void EXT_FUNC PlayerCustomization(edict_t *pEntity, customization_t *pCust) { CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE(pEntity); @@ -4555,7 +4435,6 @@ void EXT_FUNC PlayerCustomization(edict_t *pEntity, customization_t *pCust) } } -/* <4a7b9> ../cstrike/dlls/client.cpp:5079 */ void EXT_FUNC SpectatorConnect(edict_t *pEntity) { CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE(pEntity); @@ -4566,7 +4445,6 @@ void EXT_FUNC SpectatorConnect(edict_t *pEntity) } } -/* <4a83d> ../cstrike/dlls/client.cpp:5095 */ void EXT_FUNC SpectatorDisconnect(edict_t *pEntity) { CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE(pEntity); @@ -4577,7 +4455,6 @@ void EXT_FUNC SpectatorDisconnect(edict_t *pEntity) } } -/* <4a8b5> ../cstrike/dlls/client.cpp:5111 */ void EXT_FUNC SpectatorThink(edict_t *pEntity) { CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE(pEntity); @@ -4588,7 +4465,6 @@ void EXT_FUNC SpectatorThink(edict_t *pEntity) } } -/* <4a92d> ../cstrike/dlls/client.cpp:5160 */ void EXT_FUNC SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas) { edict_t *pView = pClient; @@ -4628,7 +4504,6 @@ void EXT_FUNC SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned c *pas = ENGINE_SET_PAS((float *)&org); } -/* <4aa75> ../cstrike/dlls/client.cpp:5226 */ void ResetPlayerPVS(edict_t *client, int clientnum) { PLAYERPVSSTATUS *pvs = &g_PVSStatus[clientnum]; @@ -4639,7 +4514,6 @@ void ResetPlayerPVS(edict_t *client, int clientnum) Q_memcpy(pvs->leafnums, client->leafnums, sizeof(pvs->leafnums)); } -/* <4aae8> ../cstrike/dlls/client.cpp:5240 */ bool CheckPlayerPVSLeafChanged(edict_t *client, int clientnum) { PLAYERPVSSTATUS *pvs = &g_PVSStatus[clientnum]; @@ -4654,7 +4528,6 @@ bool CheckPlayerPVSLeafChanged(edict_t *client, int clientnum) return false; } -/* <475e3> ../cstrike/dlls/client.cpp:5263 */ void MarkEntityInPVS(int clientnum, int entitynum, float time, bool inpvs) { PLAYERPVSSTATUS *pvs; @@ -4669,7 +4542,6 @@ void MarkEntityInPVS(int clientnum, int entitynum, float time, bool inpvs) es->m_fTimeEnteredPVS = 0; } -/* <47581> ../cstrike/dlls/client.cpp:5275 */ bool CheckEntityRecentlyInPVS(int clientnum, int entitynum, float currenttime) { PLAYERPVSSTATUS *pvs; @@ -4686,7 +4558,6 @@ bool CheckEntityRecentlyInPVS(int clientnum, int entitynum, float currenttime) return false; } -/* <4ac57> ../cstrike/dlls/client.cpp:5312 */ int EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet) { if ((ent->v.effects & EF_NODRAW) == EF_NODRAW && ent != host) @@ -4750,7 +4621,7 @@ int EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, ed if (ent->v.flags & FL_CUSTOMENTITY) state->entityType = ENTITY_BEAM; - state->animtime = (int)(1000.0 * ent->v.animtime) / 1000.0; + state->animtime = int(1000.0 * ent->v.animtime) / 1000.0; Q_memcpy(state->origin, ent->v.origin, sizeof(float) * 3); Q_memcpy(state->angles, ent->v.angles, sizeof(float) * 3); @@ -4784,11 +4655,11 @@ int EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, ed state->blending[i] = ent->v.blending[i]; state->rendermode = ent->v.rendermode; - state->renderamt = (int)ent->v.renderamt; + state->renderamt = int(ent->v.renderamt); state->renderfx = ent->v.renderfx; - state->rendercolor.r = (byte)ent->v.rendercolor.x; - state->rendercolor.g = (byte)ent->v.rendercolor.y; - state->rendercolor.b = (byte)ent->v.rendercolor.z; + state->rendercolor.r = byte(ent->v.rendercolor.x); + state->rendercolor.g = byte(ent->v.rendercolor.y); + state->rendercolor.b = byte(ent->v.rendercolor.z); state->aiment = 0; @@ -4815,7 +4686,7 @@ int EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, ed state->friction = ent->v.friction; state->gravity = ent->v.gravity; state->usehull = (ent->v.flags & FL_DUCKING) ? 1 : 0; - state->health = (int)ent->v.health; + state->health = int(ent->v.health); } else state->playerclass = ent->v.playerclass; @@ -4825,8 +4696,6 @@ int EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, ed } // Creates baselines used for network encoding, especially for player data since players are not spawned until connect time. - -/* <4aef3> ../cstrike/dlls/client.cpp:5516 */ void EXT_FUNC CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, Vector player_mins, Vector player_maxs) { baseline->origin = entity->v.origin; @@ -4836,12 +4705,12 @@ void EXT_FUNC CreateBaseline(int player, int eindex, struct entity_state_s *base baseline->skin = (short)entity->v.skin; // render information - baseline->rendermode = (byte)entity->v.rendermode; - baseline->renderamt = (byte)entity->v.renderamt; - baseline->rendercolor.r = (byte)entity->v.rendercolor.x; - baseline->rendercolor.g = (byte)entity->v.rendercolor.y; - baseline->rendercolor.b = (byte)entity->v.rendercolor.z; - baseline->renderfx = (byte)entity->v.renderfx; + baseline->rendermode = byte(entity->v.rendermode); + baseline->renderamt = byte(entity->v.renderamt); + baseline->rendercolor.r = byte(entity->v.rendercolor.x); + baseline->rendercolor.g = byte(entity->v.rendercolor.y); + baseline->rendercolor.b = byte(entity->v.rendercolor.z); + baseline->renderfx = byte(entity->v.renderfx); if (player) { @@ -4874,7 +4743,6 @@ void EXT_FUNC CreateBaseline(int player, int eindex, struct entity_state_s *base } } -/* <47d8a> ../cstrike/dlls/client.cpp:5586 */ void Entity_FieldInit(struct delta_s *pFields) { entity_field_alias[ FIELD_ORIGIN0 ].field = DELTA_FINDFIELD(pFields, entity_field_alias[ FIELD_ORIGIN0 ].name); @@ -4886,8 +4754,6 @@ void Entity_FieldInit(struct delta_s *pFields) } // Callback for sending entity_state_t info over network. - -/* <47da7> ../cstrike/dlls/client.cpp:5604 */ void Entity_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to) { entity_state_t *f, *t; @@ -4936,7 +4802,6 @@ void Entity_Encode(struct delta_s *pFields, const unsigned char *from, const uns } } -/* <47cb4> ../cstrike/dlls/client.cpp:5662 */ void Player_FieldInit(struct delta_s *pFields) { player_field_alias[ FIELD_ORIGIN0 ].field = DELTA_FINDFIELD(pFields, player_field_alias[ FIELD_ORIGIN0 ].name); @@ -4945,8 +4810,6 @@ void Player_FieldInit(struct delta_s *pFields) } // Callback for sending entity_state_t for players info over network. - -/* <47cd1> ../cstrike/dlls/client.cpp:5676 */ void Player_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to) { entity_state_t *f, *t; @@ -4985,7 +4848,6 @@ void Player_Encode(struct delta_s *pFields, const unsigned char *from, const uns } } -/* <4afc4> ../cstrike/dlls/client.cpp:5738 */ void Custom_Entity_FieldInit(delta_s *pFields) { custom_entity_field_alias[ CUSTOMFIELD_ORIGIN0 ].field = DELTA_FINDFIELD(pFields, custom_entity_field_alias[ CUSTOMFIELD_ORIGIN0 ].name); @@ -5000,8 +4862,6 @@ void Custom_Entity_FieldInit(delta_s *pFields) } // Callback for sending entity_state_t info ( for custom entities ) over network. - -/* <4aff3> ../cstrike/dlls/client.cpp:5759 */ void Custom_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to) { entity_state_t *f, *t; @@ -5041,14 +4901,12 @@ void Custom_Encode(struct delta_s *pFields, const unsigned char *from, const uns // animtime is compared by rounding first // see if we really shouldn't actually send it - - if ((int)f->animtime == (int)t->animtime) + if (int(f->animtime) == int(t->animtime)) { DELTA_UNSETBYINDEX(pFields, custom_entity_field_alias[ CUSTOMFIELD_ANIMTIME ].field); } } -/* <4b08a> ../cstrike/dlls/client.cpp:5811 */ void EXT_FUNC RegisterEncoders() { DELTA_ADDENCODER("Entity_Encode", Entity_Encode); @@ -5056,7 +4914,6 @@ void EXT_FUNC RegisterEncoders() DELTA_ADDENCODER("Player_Encode", Player_Encode); } -/* <4b0a4> ../cstrike/dlls/client.cpp:5818 */ int EXT_FUNC GetWeaponData(edict_s *player, struct weapon_data_s *info) { entvars_t *pev = &player->v; @@ -5111,7 +4968,6 @@ int EXT_FUNC GetWeaponData(edict_s *player, struct weapon_data_s *info) return 1; } -/* <4b1fd> ../cstrike/dlls/client.cpp:5889 */ void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd) { if (!ent || !ent->pvPrivateData) @@ -5144,7 +5000,7 @@ void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struc cd->flTimeStepSound = pev->flTimeStepSound; cd->flDuckTime = pev->flDuckTime; cd->flSwimTime = pev->flSwimTime; - cd->waterjumptime = (int)pev->teleport_time; + cd->waterjumptime = int(pev->teleport_time); Q_strcpy(cd->physinfo, ENGINE_GETPHYSINFO(ent)); @@ -5232,7 +5088,6 @@ void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struc } } -/* <4b3ee> ../cstrike/dlls/client.cpp:6050 */ void EXT_FUNC CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed) { entvars_t *pev = const_cast(&player->v); @@ -5249,7 +5104,6 @@ void EXT_FUNC CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsig } } -/* <4b4eb> ../cstrike/dlls/client.cpp:6074 */ void EXT_FUNC CmdEnd(const edict_t *player) { entvars_t *pev = const_cast(&player->v); @@ -5265,7 +5119,6 @@ void EXT_FUNC CmdEnd(const edict_t *player) } } -/* <4b644> ../cstrike/dlls/client.cpp:6101 */ int EXT_FUNC ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size) { // Parse stuff from args @@ -5280,7 +5133,6 @@ int EXT_FUNC ConnectionlessPacket(const struct netadr_s *net_from, const char *a return 0; } -/* <4b6c2> ../cstrike/dlls/client.cpp:6122 */ int EXT_FUNC GetHullBounds(int hullnumber, float *mins, float *maxs) { return hullnumber < 3; @@ -5288,10 +5140,9 @@ int EXT_FUNC GetHullBounds(int hullnumber, float *mins, float *maxs) // Create pseudo-baselines for items that aren't placed in the map at spawn time, but which are likely // to be created during play ( e.g., grenades, ammo packs, projectiles, corpses, etc. ) - -/* <4b733> ../cstrike/dlls/client.cpp:6156 */ void EXT_FUNC CreateInstancedBaselines() { +#ifndef REGAMEDLL_FIXES int iret = 0; entity_state_t state; @@ -5302,9 +5153,9 @@ void EXT_FUNC CreateInstancedBaselines() // Destroy objects. // UTIL_Remove(pc); +#endif } -/* <4b77c> ../cstrike/dlls/client.cpp:6179 */ int EXT_FUNC InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message) { // Server doesn't care? @@ -5323,8 +5174,6 @@ int EXT_FUNC InconsistentFile(const edict_t *player, const char *filename, char // Most games right now should return 0, until client-side weapon prediction code is written // and tested for them ( note you can predict weapons, but not do lag compensation, too, // if you want. - -/* <4b7cf> ../cstrike/dlls/client.cpp:6204 */ int EXT_FUNC AllowLagCompensation() { return 1; diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index 394e2fba..acfeb394 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -101,7 +101,10 @@ struct entity_field_alias_t int field; }; -extern float g_flTimeLimit; +C_DLLEXPORT float g_flTimeLimit; +C_DLLEXPORT int CountTeams(); +C_DLLEXPORT int CountTeamPlayers(int iTeam); + extern float g_flResetTime; extern bool g_skipCareerInitialSpawn; @@ -110,7 +113,7 @@ extern unsigned short g_iShadowSprite; int CMD_ARGC_(); const char *CMD_ARGV_(int i); -NOXREF void set_suicide_frame(entvars_t *pev); +void set_suicide_frame(entvars_t *pev); void TeamChangeUpdate(CBasePlayer *player, int team_id); void BlinkAccount(CBasePlayer *player, int numBlinks); BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason); @@ -119,9 +122,7 @@ void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE); void ClientKill(edict_t *pEntity); void ShowMenu(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText); void ShowVGUIMenu(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu); -NOXREF C_DLLEXPORT int CountTeams(); void ListPlayers(CBasePlayer *current); -C_DLLEXPORT int CountTeamPlayers(int iTeam); void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer); TeamName SelectDefaultTeam(); void CheckStartMoney(); @@ -146,7 +147,7 @@ void Radio3(CBasePlayer *player, int slot); bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney); bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney); CBaseEntity *EntityFromUserID(int userID); -NOXREF int CountPlayersInServer(); +int CountPlayersInServer(); BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand); BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand); void ClientCommand(edict_t *pEntity); diff --git a/regamedll/dlls/combat.cpp b/regamedll/dlls/combat.cpp index 08cc6712..750c48a0 100644 --- a/regamedll/dlls/combat.cpp +++ b/regamedll/dlls/combat.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <5f4cb> ../cstrike/dlls/combat.cpp:52 */ void CGib::LimitVelocity() { float length = pev->velocity.Length(); @@ -14,7 +13,6 @@ void CGib::LimitVelocity() } } -/* <60320> ../cstrike/dlls/combat.cpp:63 */ NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs) { int i; @@ -78,7 +76,6 @@ NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cG } } -/* <5ff7f> ../cstrike/dlls/combat.cpp:132 */ void CGib::SpawnHeadGib(entvars_t *pevVictim) { CGib *pGib = GetClassPtr((CGib *)NULL); @@ -112,6 +109,7 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim) } else { + // TODO: fix test demo pGib->pev->velocity.z = RANDOM_FLOAT(200, 300); pGib->pev->velocity.y = RANDOM_FLOAT(-100, 100); pGib->pev->velocity.x = RANDOM_FLOAT(-100, 100); @@ -138,7 +136,6 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim) pGib->LimitVelocity(); } -/* <606c8> ../cstrike/dlls/combat.cpp:190 */ void CGib::SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human) { int cSplat; @@ -207,7 +204,6 @@ void CGib::SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human) } } -/* <5f58a> ../cstrike/dlls/combat.cpp:263 */ BOOL CBaseMonster::__MAKE_VHOOK(HasHumanGibs)() { int myClass = Classify(); @@ -221,7 +217,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(HasHumanGibs)() return FALSE; } -/* <5f5ca> ../cstrike/dlls/combat.cpp:278 */ BOOL CBaseMonster::__MAKE_VHOOK(HasAlienGibs)() { int myClass = Classify(); @@ -236,7 +231,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(HasAlienGibs)() return FALSE; } -/* <5f60a> ../cstrike/dlls/combat.cpp:295 */ void CBaseMonster::__MAKE_VHOOK(FadeMonster)() { StopAnimation(); @@ -250,11 +244,10 @@ void CBaseMonster::__MAKE_VHOOK(FadeMonster)() SUB_StartFadeOut(); } -/* <60a59> ../cstrike/dlls/combat.cpp:310 */ void CBaseMonster::__MAKE_VHOOK(GibMonster)() { TraceResult tr; - BOOL gibbed = FALSE; + bool gibbed = false; EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/bodysplat.wav", VOL_NORM, ATTN_NORM); @@ -269,7 +262,7 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)() // throw some human gibs. CGib::SpawnRandomGibs(pev, 4, 1); } - gibbed = TRUE; + gibbed = true; } else if (HasAlienGibs()) { @@ -279,7 +272,7 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)() // Throw alien gibs CGib::SpawnRandomGibs(pev, 4, 0); } - gibbed = TRUE; + gibbed = true; } if (!IsPlayer()) @@ -297,8 +290,6 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)() // GetDeathActivity - determines the best type of death // anim to play. - -/* <5f65e> ../cstrike/dlls/combat.cpp:355 */ Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)() { Activity deathActivity; @@ -417,8 +408,6 @@ Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)() // GetSmallFlinchActivity - determines the best type of flinch // anim to play. - -/* <5f848> ../cstrike/dlls/combat.cpp:476 */ NOXREF Activity CBaseMonster::GetSmallFlinchActivity() { Activity flinchActivity; @@ -466,7 +455,6 @@ NOXREF Activity CBaseMonster::GetSmallFlinchActivity() return flinchActivity; } -/* <5f8a6> ../cstrike/dlls/combat.cpp:525 */ void CBaseMonster::__MAKE_VHOOK(BecomeDead)() { // don't let autoaim aim at corpses. @@ -482,7 +470,6 @@ void CBaseMonster::__MAKE_VHOOK(BecomeDead)() pev->movetype = MOVETYPE_TOSS; } -/* <5f8cc> ../cstrike/dlls/combat.cpp:542 */ BOOL CBaseMonster::ShouldGibMonster(int iGib) { if ((iGib == GIB_NORMAL && pev->health < GIB_HEALTH_VALUE) || (iGib == GIB_ALWAYS)) @@ -493,7 +480,6 @@ BOOL CBaseMonster::ShouldGibMonster(int iGib) return FALSE; } -/* <5f8f8> ../cstrike/dlls/combat.cpp:551 */ void CBaseMonster::CallGibMonster() { BOOL fade = FALSE; @@ -537,7 +523,6 @@ void CBaseMonster::CallGibMonster() UTIL_Remove(this); } -/* <5f938> ../cstrike/dlls/combat.cpp:598 */ void CBaseMonster::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) { // unsigned int cCount = 0; @@ -586,7 +571,6 @@ void CBaseMonster::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) m_IdealMonsterState = MONSTERSTATE_DEAD; } -/* <5e84e> ../cstrike/dlls/combat.cpp:652 */ void CBaseEntity::SUB_StartFadeOut() { if (pev->rendermode == kRenderNormal) @@ -602,7 +586,6 @@ void CBaseEntity::SUB_StartFadeOut() SetThink(&CBaseEntity::SUB_FadeOut); } -/* <5ea72> ../cstrike/dlls/combat.cpp:667 */ void CBaseEntity::SUB_FadeOut() { if (pev->renderamt > 7) @@ -618,7 +601,6 @@ void CBaseEntity::SUB_FadeOut() } } -/* <5eab1> ../cstrike/dlls/combat.cpp:688 */ void CGib::WaitTillLand() { if (!IsInWorld()) @@ -639,7 +621,6 @@ void CGib::WaitTillLand() pev->nextthink = gpGlobals->time + 0.5f; } -/* <5eee0> ../cstrike/dlls/combat.cpp:718 */ void CGib::BounceGibTouch(CBaseEntity *pOther) { if (pev->flags & FL_ONGROUND) @@ -663,7 +644,7 @@ void CGib::BounceGibTouch(CBaseEntity *pOther) if (m_material != matNone && !RANDOM_LONG(0, 2)) { - float zvel = fabs(pev->velocity.z); + float zvel = Q_fabs(pev->velocity.z); float volume = 0.8 * Q_min(1.0f, zvel / 450); CBreakable::MaterialSoundRandom(edict(), (Materials)m_material, volume); @@ -672,8 +653,6 @@ void CGib::BounceGibTouch(CBaseEntity *pOther) } // Sticky gib puts blood on the wall and stays put. - -/* <5ed6d> ../cstrike/dlls/combat.cpp:761 */ void CGib::StickyGibTouch(CBaseEntity *pOther) { Vector vecSpot; @@ -700,7 +679,6 @@ void CGib::StickyGibTouch(CBaseEntity *pOther) pev->movetype = MOVETYPE_NONE; } -/* <5fb0b> ../cstrike/dlls/combat.cpp:789 */ void CGib::Spawn(const char *szGibModel) { pev->movetype = MOVETYPE_BOUNCE; @@ -717,11 +695,7 @@ void CGib::Spawn(const char *szGibModel) /// hopefully this will fix the VELOCITY TOO LOW crap pev->solid = SOLID_SLIDEBOX; - if (pev->classname) - RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); - MAKE_STRING_CLASS("gib", pev); - AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); SET_MODEL(ENT(pev), szGibModel); UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); @@ -738,7 +712,6 @@ void CGib::Spawn(const char *szGibModel) m_cBloodDecals = 5; } -/* <60aea> ../cstrike/dlls/combat.cpp:815 */ int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType) { if (pev->takedamage == DAMAGE_NO) @@ -758,8 +731,6 @@ int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType) // // Time-based damage: only occurs while the monster is within the trigger_hurt. // When a monster is poisoned via an arrow etc it takes all the poison damage at once. - -/* <60d7a> ../cstrike/dlls/combat.cpp:845 */ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { float flTake; @@ -801,7 +772,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p vecDir = NormalizeSubtract< float_precision, float, float_precision, float_precision >(Center(), pInflictor->Center() - Vector(0, 0, 10)); -#endif // PLAY_GAMEDLL +#endif vecDir = g_vecAttackDir = vecDir.Normalize(); } } @@ -853,20 +824,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p } else { - //m_vecEnemyLKP = pev->origin + (g_vecAttackDir * 64); - - Vector v38; - float v37 = g_vecAttackDir[2] * 64.0; - v38[0] = g_vecAttackDir[0] * 64.0 + pev->origin[0]; - v38[1] = g_vecAttackDir[1] * 64.0 + pev->origin[1]; - double dbl_v29 = v37 + pev->origin[2]; - float v30 = v38[1]; - - m_vecEnemyLKP[0] = v38[0]; - v38[2] = dbl_v29; - float v32 = v38[2]; - m_vecEnemyLKP[1] = v30; - m_vecEnemyLKP[2] = v32; + m_vecEnemyLKP = pev->origin + (g_vecAttackDir * 64); } MakeIdealYaw(m_vecEnemyLKP); @@ -887,8 +845,6 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p } // DeadTakeDamage - takedamage function called when a monster's corpse is damaged. - -/* <60b32> ../cstrike/dlls/combat.cpp:981 */ int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { // grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit). @@ -935,7 +891,6 @@ int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker return 1; } -/* <61120> ../cstrike/dlls/combat.cpp:1027 */ float CBaseMonster::DamageForce(float damage) { float_precision force = damage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5; @@ -947,7 +902,6 @@ float CBaseMonster::DamageForce(float damage) return force; } -/* <61174> ../cstrike/dlls/combat.cpp:1044 */ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType) { CBaseEntity *pEntity = NULL; @@ -1070,7 +1024,6 @@ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, } } -/* <5f042> ../cstrike/dlls/combat.cpp:1185 */ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity) { float retval = 0.0f; @@ -1139,7 +1092,6 @@ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity) return retval; } -/* <5dc27> ../cstrike/dlls/combat.cpp:1262 */ void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType) { CBaseEntity *pEntity = NULL; @@ -1208,7 +1160,6 @@ void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker } } -/* <5dcf9> ../cstrike/dlls/combat.cpp:1349 */ void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType) { CBaseEntity *pEntity = NULL; @@ -1274,22 +1225,20 @@ void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke } } -/* <5e0d2> ../cstrike/dlls/combat.cpp:1442 */ void CBaseMonster::RadiusDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType) { if (flDamage > 80) ::RadiusDamage(pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType); else - RadiusDamage2(pev->origin, pevInflictor, pevAttacker, flDamage, iClassIgnore, bitsDamageType); + ::RadiusDamage2(pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * (RANDOM_FLOAT(0.5, 1.5) + 3), iClassIgnore, bitsDamageType); } -/* <5e0d2> ../cstrike/dlls/combat.cpp:1448 */ NOXREF void CBaseMonster::RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType) { if (flDamage > 80) ::RadiusDamage(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * 3.5, iClassIgnore, bitsDamageType); else - RadiusDamage2(vecSrc, pevInflictor, pevAttacker, flDamage, iClassIgnore, bitsDamageType); + ::RadiusDamage2(vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * (RANDOM_FLOAT(0.5, 1.5) + 3), iClassIgnore, bitsDamageType); } // CheckTraceHullAttack - expects a length to trace, amount @@ -1298,8 +1247,6 @@ NOXREF void CBaseMonster::RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, e // other stuff to the victim (punchangle, etc) // // Used for many contact-range melee attacks. Bites, claws, etc. - -/* <61949> ../cstrike/dlls/combat.cpp:1454 */ NOXREF CBaseEntity *CBaseMonster::CheckTraceHullAttack(float flDist, int iDamage, int iDmgType) { TraceResult tr; @@ -1333,8 +1280,6 @@ NOXREF CBaseEntity *CBaseMonster::CheckTraceHullAttack(float flDist, int iDamage // FInViewCone - returns true is the passed ent is in // the caller's forward view cone. The dot product is performed // in 2d, making the view cone infinitely tall. - -/* <61ae6> ../cstrike/dlls/combat.cpp:1490 */ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(CBaseEntity *pEntity) { Vector2D vec2LOS; @@ -1360,8 +1305,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(CBaseEntity *pEntity) // FInViewCone - returns true is the passed vector is in // the caller's forward view cone. The dot product is performed // in 2d, making the view cone infinitely tall. - -/* <61be6> ../cstrike/dlls/combat.cpp:1517 */ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(const Vector *pOrigin) { Vector2D vec2LOS; @@ -1386,8 +1329,6 @@ BOOL CBaseMonster::__MAKE_VHOOK(FInViewCone)(const Vector *pOrigin) // FVisible - returns true if a line can be traced from // the caller's eyes to the target - -/* <5ecb4> ../cstrike/dlls/combat.cpp:1543 */ BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(CBaseEntity *pEntity) { TraceResult tr; @@ -1421,8 +1362,6 @@ BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(CBaseEntity *pEntity) // FVisible - returns true if a line can be traced from // the caller's eyes to the target vector - -/* <5e9bb> ../cstrike/dlls/combat.cpp:1576 */ BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(const Vector &vecOrigin) { TraceResult tr; @@ -1445,7 +1384,6 @@ BOOL CBaseEntity::__MAKE_VHOOK(FVisible)(const Vector &vecOrigin) } } -/* <5e872> ../cstrike/dlls/combat.cpp:1600 */ void CBaseEntity::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { Vector vecOrigin = ptr->vecEndPos - vecDir * 4; @@ -1464,7 +1402,6 @@ void CBaseEntity::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDama } } -/* <61ce5> ../cstrike/dlls/combat.cpp:1647 */ void CBaseMonster::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { Vector vecOrigin = ptr->vecEndPos - vecDir * 4; @@ -1510,7 +1447,6 @@ void CBaseMonster::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDam } } -/* <61df9> ../cstrike/dlls/combat.cpp:1704 */ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker) { static int tracerCount; @@ -1606,7 +1542,7 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting break; case BULLET_PLAYER_BUCKSHOT: flDamage = ((1 - tr.flFraction) * 20); - pEntity->TraceAttack(pevAttacker, (int)flDamage, vecDir, &tr, DMG_BULLET); + pEntity->TraceAttack(pevAttacker, int(flDamage), vecDir, &tr, DMG_BULLET); break; case BULLET_PLAYER_357: pEntity->TraceAttack(pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET); @@ -1649,13 +1585,12 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting } // make bullet trails - UTIL_BubbleTrail(vecSrc, tr.vecEndPos, (int)((flDistance * tr.flFraction) / 64)); + UTIL_BubbleTrail(vecSrc, tr.vecEndPos, int((flDistance * tr.flFraction) / 64)); } ApplyMultiDamage(pev, pevAttacker); } -/* <62693> ../cstrike/dlls/combat.cpp:1856 */ NOXREF char *vstr(float *v) { static int idx = 0; @@ -1669,8 +1604,6 @@ NOXREF char *vstr(float *v) // Go to the trouble of combining multiple pellets into a single damage call. // This version is used by Players, uses the random seed generator to sync client and server side shots. - -/* <62709> ../cstrike/dlls/combat.cpp:1869 */ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand) { int iOriginalPenetration = iPenetration; @@ -1826,7 +1759,7 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec iPenetration--; flCurrentDistance = tr.flFraction * flDistance; - iCurrentDamage *= pow(flRangeModifier, flCurrentDistance / 500); + iCurrentDamage *= Q_pow(flRangeModifier, flCurrentDistance / 500); if (flCurrentDistance > flPenetrationDistance) { @@ -1886,7 +1819,6 @@ Vector CBaseEntity::FireBullets3(Vector vecSrc, Vector vecDirShooting, float vec return Vector(x * vecSpread, y * vecSpread, 0); } -/* <5eb17> ../cstrike/dlls/combat.cpp:2075 */ void CBaseEntity::__MAKE_VHOOK(TraceBleed)(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if (BloodColor() == DONT_BLEED) @@ -1941,7 +1873,6 @@ void CBaseEntity::__MAKE_VHOOK(TraceBleed)(float flDamage, Vector vecDir, TraceR } } -/* <62e0e> ../cstrike/dlls/combat.cpp:2145 */ NOXREF void CBaseMonster::MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir) { // make blood decal on the wall! @@ -1971,14 +1902,13 @@ NOXREF void CBaseMonster::MakeDamageBloodDecal(int cCount, float flNoise, TraceR UTIL_TraceLine(ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * 172, ignore_monsters, ENT(pev), &Bloodtr); - if (Bloodtr.flFraction != 1.0) + if (Bloodtr.flFraction != 1.0f) { UTIL_BloodDecalTrace(&Bloodtr, BloodColor()); } } } -/* <62f3e> ../cstrike/dlls/combat.cpp:2197 */ void CBaseMonster::BloodSplat(const Vector &vecSrc, const Vector &vecDir, int HitLocation, int iVelocity) { if (HitLocation != HITGROUP_HEAD) diff --git a/regamedll/dlls/debug.cpp b/regamedll/dlls/debug.cpp index f6be1dbd..b412f091 100644 --- a/regamedll/dlls/debug.cpp +++ b/regamedll/dlls/debug.cpp @@ -18,15 +18,13 @@ DebugOutputLevel outputLevel[ NUM_LEVELS ] = unsigned int theDebugOutputTypes; static char theDebugBuffer[ DebugBufferSize ]; -#endif // HOOK_GAMEDLL +#endif -/* <22fe8b> ../cstrike/dlls/debug.cpp:39 */ bool IsDeveloper() { return (CVAR_GET_FLOAT("developer") > 0.0); } -/* <22ff69> ../cstrike/dlls/debug.cpp:45 */ NOXREF void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...) { if (!IsDeveloper()) @@ -43,7 +41,6 @@ NOXREF void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...) } } -/* <22fe23> ../cstrike/dlls/debug.cpp:56 */ void UTIL_DPrintf(char *pszMsg, ...) { if (!IsDeveloper()) @@ -57,7 +54,6 @@ void UTIL_DPrintf(char *pszMsg, ...) SERVER_PRINT(theDebugBuffer); } -/* <22fe97> ../cstrike/dlls/debug.cpp:78 */ void PrintDebugFlags() { char *tmp; @@ -75,7 +71,6 @@ void PrintDebugFlags() SERVER_PRINT(theDebugBuffer); } -/* <22fed4> ../cstrike/dlls/debug.cpp:94 */ void SetDebugFlag(const char *flagStr, bool state) { if (flagStr != NULL) @@ -103,7 +98,6 @@ void SetDebugFlag(const char *flagStr, bool state) SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr)); } -/* <23001f> ../cstrike/dlls/debug.cpp:126 */ void PrintDebugFlag(const char *flagStr) { if (flagStr != NULL) @@ -125,7 +119,6 @@ void PrintDebugFlag(const char *flagStr) SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr)); } -/* <2300a9> ../cstrike/dlls/debug.cpp:149 */ void UTIL_SetDprintfFlags(const char *flagStr) { if (!IsDeveloper()) @@ -145,7 +138,6 @@ void UTIL_SetDprintfFlags(const char *flagStr) PrintDebugFlags(); } -/* <23012d> ../cstrike/dlls/debug.cpp:175 */ NOXREF void UTIL_BotDPrintf(char *pszMsg, ...) { if (!IsDeveloper()) @@ -162,7 +154,6 @@ NOXREF void UTIL_BotDPrintf(char *pszMsg, ...) } } -/* <230181> ../cstrike/dlls/debug.cpp:193 */ void UTIL_CareerDPrintf(char *pszMsg, ...) { if (!IsDeveloper()) @@ -179,7 +170,6 @@ void UTIL_CareerDPrintf(char *pszMsg, ...) } } -/* <2301d5> ../cstrike/dlls/debug.cpp:211 */ NOXREF void UTIL_TutorDPrintf(char *pszMsg, ...) { if (!IsDeveloper()) @@ -196,7 +186,6 @@ NOXREF void UTIL_TutorDPrintf(char *pszMsg, ...) } } -/* <230229> ../cstrike/dlls/debug.cpp:229 */ NOXREF void UTIL_StatsDPrintf(char *pszMsg, ...) { if (!IsDeveloper()) @@ -213,7 +202,6 @@ NOXREF void UTIL_StatsDPrintf(char *pszMsg, ...) } } -/* <23027d> ../cstrike/dlls/debug.cpp:247 */ NOXREF void UTIL_HostageDPrintf(char *pszMsg, ...) { if (!IsDeveloper()) diff --git a/regamedll/dlls/debug.h b/regamedll/dlls/debug.h index f747609c..7915e32d 100644 --- a/regamedll/dlls/debug.h +++ b/regamedll/dlls/debug.h @@ -54,7 +54,7 @@ struct DebugOutputLevel }; bool IsDeveloper(); -NOXREF void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...); +void UTIL_DPrintf(DebugOutputType outputType, char *pszMsg, ...); void UTIL_DPrintf(char *pszMsg, ...); void PrintDebugFlags(); @@ -62,10 +62,10 @@ void SetDebugFlag(const char *flagStr, bool state); void PrintDebugFlag(const char *flagStr); void UTIL_SetDprintfFlags(const char *flagStr); -NOXREF void UTIL_BotDPrintf(char *pszMsg, ...); +void UTIL_BotDPrintf(char *pszMsg, ...); void UTIL_CareerDPrintf(char *pszMsg, ...); -NOXREF void UTIL_TutorDPrintf(char *pszMsg, ...); -NOXREF void UTIL_StatsDPrintf(char *pszMsg, ...); -NOXREF void UTIL_HostageDPrintf(char *pszMsg, ...); +void UTIL_TutorDPrintf(char *pszMsg, ...); +void UTIL_StatsDPrintf(char *pszMsg, ...); +void UTIL_HostageDPrintf(char *pszMsg, ...); #endif // DEBUG_H diff --git a/regamedll/dlls/doors.cpp b/regamedll/dlls/doors.cpp index b2dc8c92..05edec55 100644 --- a/regamedll/dlls/doors.cpp +++ b/regamedll/dlls/doors.cpp @@ -21,9 +21,8 @@ TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] = DEFINE_FIELD(CMomentaryDoor, m_bMoveSnd, FIELD_CHARACTER), }; -#endif // HOOK_GAMEDLL +#endif -/* <693c0> ../cstrike/dlls/doors.cpp:98 */ IMPLEMENT_SAVERESTORE(CBaseDoor, CBaseToggle); // play door or button locked or unlocked sounds. @@ -31,8 +30,6 @@ IMPLEMENT_SAVERESTORE(CBaseDoor, CBaseToggle); // if flocked is true, play 'door is locked' sound, // otherwise play 'door is unlocked' sound // NOTE: this routine is shared by doors and buttons - -/* <68561> ../cstrike/dlls/doors.cpp:112 */ void PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton) { // LOCKED SOUND @@ -116,49 +113,47 @@ void PlayLockSounds(entvars_t *pev, locksound_t *pls, int flocked, int fbutton) } // Cache user-entity-field values until spawn is called. - -/* <69a4f> ../cstrike/dlls/doors.cpp:201 */ void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { //skin is used for content type if (FStrEq(pkvd->szKeyName, "skin")) { - pev->skin = (int)Q_atof(pkvd->szValue); + pev->skin = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "movesnd")) { - m_bMoveSnd = (int)Q_atof(pkvd->szValue); + m_bMoveSnd = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "stopsnd")) { - m_bStopSnd = (int)Q_atof(pkvd->szValue); + m_bStopSnd = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "healthvalue")) { - m_bHealthValue = (int)Q_atof(pkvd->szValue); + m_bHealthValue = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "locked_sound")) { - m_bLockedSound = (int)Q_atof(pkvd->szValue); + m_bLockedSound = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "locked_sentence")) { - m_bLockedSentence = (int)Q_atof(pkvd->szValue); + m_bLockedSentence = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sound")) { - m_bUnlockedSound = (int)Q_atof(pkvd->szValue); + m_bUnlockedSound = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sentence")) { - m_bUnlockedSentence = (int)Q_atof(pkvd->szValue); + m_bUnlockedSentence = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "WaveHeight")) @@ -192,22 +187,17 @@ void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) // 2) base // 3) stone chain // 4) screechy metal - -/* <69f8b> ../cstrike/dlls/doors.cpp:278 */ LINK_ENTITY_TO_CLASS(func_door, CBaseDoor); // func_water - same as a door. - -/* <6a058> ../cstrike/dlls/doors.cpp:282 */ LINK_ENTITY_TO_CLASS(func_water, CBaseDoor); -/* <690bc> ../cstrike/dlls/doors.cpp:285 */ void CBaseDoor::__MAKE_VHOOK(Spawn)() { Precache(); SetMovedir(pev); - //normal door + // normal door if (pev->skin == 0) { if (pev->spawnflags & SF_DOOR_PASSABLE) @@ -233,7 +223,7 @@ void CBaseDoor::__MAKE_VHOOK(Spawn)() m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big - m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs((float_precision)(pev->movedir.x * (pev->size.x - 2))) + fabs((float_precision)(pev->movedir.y * (pev->size.y - 2))) + fabs((float_precision)(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); + m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2)); @@ -261,7 +251,6 @@ void CBaseDoor::__MAKE_VHOOK(Spawn)() m_lastBlockedTimestamp = 0; } -/* <69949> ../cstrike/dlls/doors.cpp:334 */ void CBaseDoor::__MAKE_VHOOK(Restart)() { SetMovedir(pev); @@ -274,7 +263,6 @@ void CBaseDoor::__MAKE_VHOOK(Restart)() SetTouch(&CBaseDoor::DoorTouch); } -/* <69289> ../cstrike/dlls/doors.cpp:350 */ void CBaseDoor::__MAKE_VHOOK(SetToggleState)(int state) { if (state == TS_AT_TOP) @@ -286,7 +274,6 @@ void CBaseDoor::__MAKE_VHOOK(SetToggleState)(int state) #define noiseMoving noise1 #define noiseArrived noise2 -/* <6924c> ../cstrike/dlls/doors.cpp:359 */ void CBaseDoor::__MAKE_VHOOK(Precache)() { char *pszSound; @@ -388,14 +375,14 @@ void CBaseDoor::__MAKE_VHOOK(Precache)() // get door button sounds, for doors which are directly 'touched' to open if (m_bLockedSound) { - pszSound = ButtonSound((int)m_bLockedSound); + pszSound = ButtonSound(int(m_bLockedSound)); PRECACHE_SOUND(pszSound); m_ls.sLockedSound = ALLOC_STRING(pszSound); } if (m_bUnlockedSound) { - pszSound = ButtonSound((int)m_bUnlockedSound); + pszSound = ButtonSound(int(m_bUnlockedSound)); PRECACHE_SOUND(pszSound); m_ls.sUnlockedSound = ALLOC_STRING(pszSound); } @@ -430,8 +417,6 @@ void CBaseDoor::__MAKE_VHOOK(Precache)() } // Doors not tied to anything (e.g. button, another door) can be touched, to make them activate. - -/* <6a3b8> ../cstrike/dlls/doors.cpp:508 */ void CBaseDoor::DoorTouch(CBaseEntity *pOther) { entvars_t *pevToucher = pOther->pev; @@ -467,8 +452,6 @@ void CBaseDoor::DoorTouch(CBaseEntity *pOther) } // Used by SUB_UseTargets, when a door is the target of a button. - -/* <6a33b> ../cstrike/dlls/doors.cpp:543 */ void CBaseDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { m_hActivator = pActivator; @@ -481,8 +464,6 @@ void CBaseDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, } // Causes the door to "do its thing", i.e. start moving, and cascade activation. - -/* <6a319> ../cstrike/dlls/doors.cpp:554 */ int CBaseDoor::DoorActivate() { if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) @@ -512,8 +493,6 @@ int CBaseDoor::DoorActivate() } // Starts the door going to its "up" position (simply ToggleData->vecPosition2). - -/* <6a125> ../cstrike/dlls/doors.cpp:588 */ void CBaseDoor::DoorGoUp() { entvars_t *pevActivator; @@ -571,14 +550,14 @@ void CBaseDoor::DoorGoUp() { if (toActivator.y < loY) { - if (abs((int)momentArmY) > abs((int)momentArmX)) + if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX))) sign = (momentArmY < 0) ? 1 : -1; else sign = (momentArmX > 0) ? 1 : -1; } else if (toActivator.y > hiY) { - if (abs((int)momentArmY) > abs((int)momentArmX)) + if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX))) sign = (momentArmY < 0) ? 1 : -1; else sign = (momentArmX < 0) ? 1 : -1; @@ -597,14 +576,14 @@ void CBaseDoor::DoorGoUp() } else if (toActivator.y < loY) { - if (abs((int)momentArmY) > abs((int)momentArmX)) + if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX))) sign = (momentArmY > 0) ? 1 : -1; else sign = (momentArmX > 0) ? 1 : -1; } else if (toActivator.y > hiY) { - if (abs((int)momentArmY) > abs((int)momentArmX)) + if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX))) sign = (momentArmY > 0) ? 1 : -1; else sign = (momentArmX < 0) ? 1 : -1; @@ -627,8 +606,6 @@ void CBaseDoor::DoorGoUp() } // The door has reached the "up" position. Either go back down, or wait for another activation. - -/* <6940c> ../cstrike/dlls/doors.cpp:721 */ void CBaseDoor::DoorHitTop() { if (!(pev->spawnflags & SF_DOOR_SILENT)) @@ -672,8 +649,6 @@ void CBaseDoor::DoorHitTop() } // Starts the door going to its "down" position (simply ToggleData->vecPosition1). - -/* <697ad> ../cstrike/dlls/doors.cpp:762 */ void CBaseDoor::DoorGoDown() { bool isReversing = (m_toggle_state == TS_GOING_UP); @@ -696,7 +671,7 @@ void CBaseDoor::DoorGoDown() #ifdef DOOR_ASSERT assert(m_toggle_state == TS_AT_TOP); -#endif // DOOR_ASSERT +#endif m_toggle_state = TS_GOING_DOWN; @@ -712,8 +687,6 @@ void CBaseDoor::DoorGoDown() } // The door has reached the "down" position. Back to quiescence. - -/* <694a5> ../cstrike/dlls/doors.cpp:791 */ void CBaseDoor::DoorHitBottom() { if (!(pev->spawnflags & SF_DOOR_SILENT)) @@ -747,7 +720,6 @@ void CBaseDoor::DoorHitBottom() } } -/* <6a465> ../cstrike/dlls/doors.cpp:817 */ void CBaseDoor::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { edict_t *pentTarget = NULL; @@ -868,12 +840,8 @@ void CBaseDoor::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) // 2) base // 3) stone chain // 4) screechy metal - - -/* <6a767> ../cstrike/dlls/doors.cpp:943 */ LINK_ENTITY_TO_CLASS(func_door_rotating, CRotDoor); -/* <698be> ../cstrike/dlls/doors.cpp:946 */ void CRotDoor::__MAKE_VHOOK(Restart)() { CBaseToggle::AxisDir(pev); @@ -901,7 +869,6 @@ void CRotDoor::__MAKE_VHOOK(Restart)() DoorGoDown(); } -/* <69177> ../cstrike/dlls/doors.cpp:978 */ void CRotDoor::__MAKE_VHOOK(Spawn)() { Precache(); @@ -961,7 +928,6 @@ void CRotDoor::__MAKE_VHOOK(Spawn)() } } -/* <68fcc> ../cstrike/dlls/doors.cpp:1028 */ void CRotDoor::__MAKE_VHOOK(SetToggleState)(int state) { if (state == TS_AT_TOP) @@ -972,13 +938,9 @@ void CRotDoor::__MAKE_VHOOK(SetToggleState)(int state) UTIL_SetOrigin(pev, pev->origin); } -/* <6a834> ../cstrike/dlls/doors.cpp:1056 */ LINK_ENTITY_TO_CLASS(momentary_door, CMomentaryDoor); - -/* <69373> ../cstrike/dlls/doors.cpp:1063 */ IMPLEMENT_SAVERESTORE(CMomentaryDoor, CBaseToggle); -/* <69001> ../cstrike/dlls/doors.cpp:1065 */ void CMomentaryDoor::__MAKE_VHOOK(Spawn)() { SetMovedir(pev); @@ -998,7 +960,7 @@ void CMomentaryDoor::__MAKE_VHOOK(Spawn)() m_vecPosition1 = pev->origin; // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big - m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs((float_precision)(pev->movedir.x * (pev->size.x - 2))) + fabs((float_precision)(pev->movedir.y * (pev->size.y - 2))) + fabs((float_precision)(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); + m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2)); if (pev->spawnflags & SF_DOOR_START_OPEN) @@ -1014,7 +976,6 @@ void CMomentaryDoor::__MAKE_VHOOK(Spawn)() Precache(); } -/* <68fa5> ../cstrike/dlls/doors.cpp:1096 */ void CMomentaryDoor::__MAKE_VHOOK(Precache)() { // set the door's "in-motion" sound @@ -1061,29 +1022,27 @@ void CMomentaryDoor::__MAKE_VHOOK(Precache)() } } -/* <69970> ../cstrike/dlls/doors.cpp:1143 */ void CMomentaryDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "movesnd")) { - m_bMoveSnd = (int)Q_atof(pkvd->szValue); + m_bMoveSnd = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "stopsnd")) { - //m_bStopSnd =(int) Q_atof(pkvd->szValue); + //m_bStopSnd = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "healthvalue")) { - //m_bHealthValue = (int)Q_atof(pkvd->szValue); + //m_bHealthValue = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else CBaseToggle::KeyValue(pkvd); } -/* <6953e> ../cstrike/dlls/doors.cpp:1165 */ void CMomentaryDoor::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // Momentary buttons will pass down a float in here diff --git a/regamedll/dlls/doors.h b/regamedll/dlls/doors.h index 9611edc5..7f266b32 100644 --- a/regamedll/dlls/doors.h +++ b/regamedll/dlls/doors.h @@ -48,7 +48,6 @@ #define SF_DOOR_NOMONSTERS 512 // Monster can't open #define SF_DOOR_SILENT 0x80000000 -/* <6840f> ../cstrike/dlls/doors.cpp:34 */ class CBaseDoor: public CBaseToggle { public: @@ -81,7 +80,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Blocked_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[7]; @@ -110,7 +109,6 @@ public: float m_lastBlockedTimestamp; }; -/* <684c0> ../cstrike/dlls/doors.cpp:935 */ class CRotDoor: public CBaseDoor { public: @@ -124,11 +122,10 @@ public: void Restart_(); void SetToggleState_(int state); -#endif // HOOK_GAMEDLL +#endif }; -/* <68513> ../cstrike/dlls/doors.cpp:1039 */ class CMomentaryDoor: public CBaseToggle { public: @@ -149,7 +146,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; diff --git a/regamedll/dlls/effects.cpp b/regamedll/dlls/effects.cpp index 38c60515..0cf32c2a 100644 --- a/regamedll/dlls/effects.cpp +++ b/regamedll/dlls/effects.cpp @@ -61,16 +61,10 @@ TYPEDESCRIPTION CGibShooter::m_SaveData[] = #endif // HOOK_GAMEDLL -/* <76042> ../cstrike/dlls/effects.cpp:33 */ LINK_ENTITY_TO_CLASS(info_target, CPointEntity); - -/* <7610e> ../cstrike/dlls/effects.cpp:57 */ LINK_ENTITY_TO_CLASS(env_bubbles, CBubbling); - -/* <741e0> ../cstrike/dlls/effects.cpp:68 */ IMPLEMENT_SAVERESTORE(CBubbling, CBaseEntity); -/* <7344d> ../cstrike/dlls/effects.cpp:73 */ void CBubbling::__MAKE_VHOOK(Spawn)() { Precache(); @@ -101,14 +95,12 @@ void CBubbling::__MAKE_VHOOK(Spawn)() m_state = 0; } -/* <73489> ../cstrike/dlls/effects.cpp:99 */ void CBubbling::__MAKE_VHOOK(Precache)() { // Precache bubble sprite m_bubbleModel = PRECACHE_MODEL("sprites/bubble.spr"); } -/* <742a4> ../cstrike/dlls/effects.cpp:105 */ void CBubbling::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (ShouldToggle(useType, m_state)) @@ -126,7 +118,6 @@ void CBubbling::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, } } -/* <74aae> ../cstrike/dlls/effects.cpp:123 */ void CBubbling::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "density")) @@ -148,7 +139,6 @@ void CBubbling::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <73d03> ../cstrike/dlls/effects.cpp:145 */ void CBubbling::FizzThink() { MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, VecBModelOrigin(pev)); @@ -164,10 +154,8 @@ void CBubbling::FizzThink() pev->nextthink = gpGlobals->time + 2.5f - (0.1f * m_frequency); } -/* <7620c> ../cstrike/dlls/effects.cpp:166 */ LINK_ENTITY_TO_CLASS(beam, CBeam); -/* <734b0> ../cstrike/dlls/effects.cpp:168 */ void CBeam::__MAKE_VHOOK(Spawn)() { // Remove model & collisions @@ -175,7 +163,6 @@ void CBeam::__MAKE_VHOOK(Spawn)() Precache(); } -/* <734d6> ../cstrike/dlls/effects.cpp:174 */ void CBeam::__MAKE_VHOOK(Precache)() { if (pev->owner) @@ -188,21 +175,18 @@ void CBeam::__MAKE_VHOOK(Precache)() } } -/* <762d8> ../cstrike/dlls/effects.cpp:182 */ void CBeam::SetStartEntity(int entityIndex) { pev->sequence = (entityIndex & 0x0FFF) | ((pev->sequence & 0xF000) << 12); pev->owner = INDEXENT(entityIndex); } -/* <76303> ../cstrike/dlls/effects.cpp:188 */ void CBeam::SetEndEntity(int entityIndex) { pev->skin = (entityIndex & 0x0FFF) | ((pev->skin & 0xF000) << 12); pev->aiment = INDEXENT(entityIndex); } -/* <7632e> ../cstrike/dlls/effects.cpp:196 */ const Vector &CBeam::GetStartPos() { if (GetType() == BEAM_ENTS) @@ -214,7 +198,6 @@ const Vector &CBeam::GetStartPos() return pev->origin; } -/* <7639a> ../cstrike/dlls/effects.cpp:207 */ const Vector &CBeam::GetEndPos() { int type = GetType(); @@ -232,24 +215,17 @@ const Vector &CBeam::GetEndPos() return pev->angles; } -/* <76540> ../cstrike/dlls/effects.cpp:222 */ CBeam *CBeam::BeamCreate(const char *pSpriteName, int width) { // Create a new entity with CBeam private data CBeam *pBeam = GetClassPtr((CBeam *)NULL); - if (pBeam->pev->classname) - RemoveEntityHashValue(pBeam->pev, STRING(pBeam->pev->classname), CLASSNAME); - MAKE_STRING_CLASS("beam", pBeam->pev); - AddEntityHashValue(pBeam->pev, STRING(pBeam->pev->classname), CLASSNAME); - pBeam->BeamInit(pSpriteName, width); return pBeam; } -/* <76422> ../cstrike/dlls/effects.cpp:234 */ void CBeam::BeamInit(const char *pSpriteName, int width) { pev->flags |= FL_CUSTOMENTITY; @@ -268,7 +244,6 @@ void CBeam::BeamInit(const char *pSpriteName, int width) pev->rendermode = 0; } -/* <76a56> ../cstrike/dlls/effects.cpp:251 */ void CBeam::PointsInit(const Vector &start, const Vector &end) { SetType(BEAM_POINTS); @@ -279,7 +254,6 @@ void CBeam::PointsInit(const Vector &start, const Vector &end) RelinkBeam(); } -/* <7695b> ../cstrike/dlls/effects.cpp:262 */ void CBeam::HoseInit(const Vector &start, const Vector &direction) { SetType(BEAM_HOSE); @@ -290,7 +264,6 @@ void CBeam::HoseInit(const Vector &start, const Vector &direction) RelinkBeam(); } -/* <76887> ../cstrike/dlls/effects.cpp:273 */ void CBeam::PointEntInit(const Vector &start, int endIndex) { SetType(BEAM_ENTPOINT); @@ -301,7 +274,6 @@ void CBeam::PointEntInit(const Vector &start, int endIndex) RelinkBeam(); } -/* <767ab> ../cstrike/dlls/effects.cpp:283 */ void CBeam::EntsInit(int startIndex, int endIndex) { SetType(BEAM_ENTS); @@ -312,7 +284,6 @@ void CBeam::EntsInit(int startIndex, int endIndex) RelinkBeam(); } -/* <7663a> ../cstrike/dlls/effects.cpp:294 */ void CBeam::RelinkBeam() { const Vector &startPos = GetStartPos(); @@ -333,7 +304,6 @@ void CBeam::RelinkBeam() UTIL_SetOrigin(pev, pev->origin); } -/* <77305> ../cstrike/dlls/effects.cpp:311 */ void CBeam::TriggerTouch(CBaseEntity *pOther) { if (pOther->pev->flags & (FL_CLIENT | FL_MONSTER)) @@ -347,7 +317,6 @@ void CBeam::TriggerTouch(CBaseEntity *pOther) } } -/* <773e2> ../cstrike/dlls/effects.cpp:325 */ CBaseEntity *CBeam::RandomTargetname(const char *szName) { int total = 0; @@ -366,7 +335,6 @@ CBaseEntity *CBeam::RandomTargetname(const char *szName) return pEntity; } -/* <77431> ../cstrike/dlls/effects.cpp:341 */ void CBeam::DoSparks(const Vector &start, const Vector &end) { if (pev->spawnflags & (SF_BEAM_SPARKSTART | SF_BEAM_SPARKEND)) @@ -382,16 +350,10 @@ void CBeam::DoSparks(const Vector &start, const Vector &end) } } -/* <774c2> ../cstrike/dlls/effects.cpp:402 */ LINK_ENTITY_TO_CLASS(env_lightning, CLightning); - -/* <77592> ../cstrike/dlls/effects.cpp:403 */ LINK_ENTITY_TO_CLASS(env_beam, CLightning); - -/* <74192> ../cstrike/dlls/effects.cpp:441 */ IMPLEMENT_SAVERESTORE(CLightning, CBeam); -/* <744b2> ../cstrike/dlls/effects.cpp:444 */ void CLightning::__MAKE_VHOOK(Spawn)() { if (FStringNull(m_iszSpriteName)) @@ -443,21 +405,18 @@ void CLightning::__MAKE_VHOOK(Spawn)() } } -/* <7357f> ../cstrike/dlls/effects.cpp:493 */ void CLightning::__MAKE_VHOOK(Precache)() { m_spriteTexture = PRECACHE_MODEL((char *)STRING(m_iszSpriteName)); CBeam::Precache(); } -/* <786a1> ../cstrike/dlls/effects.cpp:500 */ void CLightning::__MAKE_VHOOK(Activate)() { if (ServerSide()) BeamUpdateVars(); } -/* <7536c> ../cstrike/dlls/effects.cpp:507 */ void CLightning::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "LightningStart")) @@ -519,7 +478,6 @@ void CLightning::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBeam::KeyValue(pkvd); } -/* <75ad3> ../cstrike/dlls/effects.cpp:569 */ void CLightning::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!ShouldToggle(useType, m_active)) @@ -545,7 +503,6 @@ void CLightning::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY } } -/* <7422d> ../cstrike/dlls/effects.cpp:593 */ void CLightning::StrikeUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!ShouldToggle(useType, m_active)) @@ -566,7 +523,6 @@ void CLightning::StrikeUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY SetUse(NULL); } -/* <71e66> ../cstrike/dlls/effects.cpp:614 */ int IsPointEntity(CBaseEntity *pEnt) { if (!pEnt->pev->modelindex) @@ -580,7 +536,6 @@ int IsPointEntity(CBaseEntity *pEnt) return 0; } -/* <77f64> ../cstrike/dlls/effects.cpp:625 */ void CLightning::StrikeThink() { if (m_life != 0.0f) @@ -671,13 +626,13 @@ void CLightning::StrikeThink() WRITE_SHORT(m_spriteTexture); WRITE_BYTE(m_frameStart); // framestart - WRITE_BYTE((int)pev->framerate); // framerate - WRITE_BYTE((int)(m_life*10.0)); // life + WRITE_BYTE(int(pev->framerate)); // framerate + WRITE_BYTE(int(m_life * 10.0)); // life WRITE_BYTE(m_boltWidth); // width WRITE_BYTE(m_noiseAmplitude); // noise - WRITE_BYTE((int)pev->rendercolor.x); // r, g, b - WRITE_BYTE((int)pev->rendercolor.y); // r, g, b - WRITE_BYTE((int)pev->rendercolor.z); // r, g, b + WRITE_BYTE(int(pev->rendercolor.x)); // r, g, b + WRITE_BYTE(int(pev->rendercolor.y)); // r, g, b + WRITE_BYTE(int(pev->rendercolor.z)); // r, g, b WRITE_BYTE(pev->renderamt); // brightness WRITE_BYTE(m_speed); // speed MESSAGE_END(); @@ -693,7 +648,6 @@ void CLightning::StrikeThink() } } -/* <77680> ../cstrike/dlls/effects.cpp:731 */ void CBeam::BeamDamage(TraceResult *ptr) { RelinkBeam(); @@ -721,7 +675,6 @@ void CBeam::BeamDamage(TraceResult *ptr) pev->dmgtime = gpGlobals->time; } -/* <777dd> ../cstrike/dlls/effects.cpp:753 */ void CLightning::DamageThink() { pev->nextthink = gpGlobals->time + 0.1f; @@ -731,7 +684,6 @@ void CLightning::DamageThink() BeamDamage(&tr); } -/* <77a90> ../cstrike/dlls/effects.cpp:763 */ void CLightning::Zap(const Vector &vecSrc, const Vector &vecDest) { MESSAGE_BEGIN(MSG_BROADCAST, SVC_TEMPENTITY); @@ -744,21 +696,20 @@ void CLightning::Zap(const Vector &vecSrc, const Vector &vecDest) WRITE_COORD(vecDest.z); WRITE_SHORT(m_spriteTexture); WRITE_BYTE(m_frameStart); // framestart - WRITE_BYTE((int)pev->framerate); // framerate - WRITE_BYTE((int)(m_life * 10.0)); // life + WRITE_BYTE(int(pev->framerate)); // framerate + WRITE_BYTE(int(m_life * 10.0)); // life WRITE_BYTE(m_boltWidth); // width WRITE_BYTE(m_noiseAmplitude); // noise - WRITE_BYTE((int)pev->rendercolor.x); // r, g, b - WRITE_BYTE((int)pev->rendercolor.y); // r, g, b - WRITE_BYTE((int)pev->rendercolor.z); // r, g, b - WRITE_BYTE((int)pev->renderamt); // brightness + WRITE_BYTE(int(pev->rendercolor.x)); // r, g, b + WRITE_BYTE(int(pev->rendercolor.y)); // r, g, b + WRITE_BYTE(int(pev->rendercolor.z)); // r, g, b + WRITE_BYTE(int(pev->renderamt)); // brightness WRITE_BYTE(m_speed); // speed MESSAGE_END(); DoSparks(vecSrc, vecDest); } -/* <77b45> ../cstrike/dlls/effects.cpp:789 */ void CLightning::RandomArea() { for (int iLoops = 0; iLoops < 10; iLoops++) @@ -801,7 +752,6 @@ void CLightning::RandomArea() } } -/* <77de8> ../cstrike/dlls/effects.cpp:831 */ void CLightning::RandomPoint(Vector &vecSrc) { for (int iLoops = 0; iLoops < 10; iLoops++) @@ -823,7 +773,6 @@ void CLightning::RandomPoint(Vector &vecSrc) } } -/* <78313> ../cstrike/dlls/effects.cpp:855 */ void CLightning::BeamUpdateVars() { int beamType; @@ -897,13 +846,9 @@ void CLightning::BeamUpdateVars() } } -/* <786d8> ../cstrike/dlls/effects.cpp:920 */ LINK_ENTITY_TO_CLASS(env_laser, CLaser); - -/* <74144> ../cstrike/dlls/effects.cpp:929 */ IMPLEMENT_SAVERESTORE(CLaser, CBeam); -/* <76b3f> ../cstrike/dlls/effects.cpp:931 */ void CLaser::__MAKE_VHOOK(Spawn)() { if (FStringNull(pev->model)) @@ -935,7 +880,6 @@ void CLaser::__MAKE_VHOOK(Spawn)() TurnOn(); } -/* <73d82> ../cstrike/dlls/effects.cpp:960 */ void CLaser::__MAKE_VHOOK(Precache)() { pev->modelindex = PRECACHE_MODEL((char *)STRING(pev->model)); @@ -946,7 +890,6 @@ void CLaser::__MAKE_VHOOK(Precache)() } } -/* <74ff2> ../cstrike/dlls/effects.cpp:968 */ void CLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "LaserTarget")) @@ -993,7 +936,6 @@ void CLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBeam::KeyValue(pkvd); } -/* <787a8> ../cstrike/dlls/effects.cpp:1015 */ int CLaser::IsOn() { if (pev->effects & EF_NODRAW) @@ -1002,7 +944,6 @@ int CLaser::IsOn() return 1; } -/* <787c9> ../cstrike/dlls/effects.cpp:1023 */ void CLaser::TurnOff() { pev->effects |= EF_NODRAW; @@ -1014,7 +955,6 @@ void CLaser::TurnOff() } } -/* <78804> ../cstrike/dlls/effects.cpp:1032 */ void CLaser::TurnOn() { pev->effects &= ~EF_NODRAW; @@ -1028,7 +968,6 @@ void CLaser::TurnOn() pev->nextthink = gpGlobals->time; } -/* <75f0a> ../cstrike/dlls/effects.cpp:1042 */ void CLaser::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int active = IsOn(); @@ -1042,7 +981,6 @@ void CLaser::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, US TurnOn(); } -/* <78841> ../cstrike/dlls/effects.cpp:1059 */ void CLaser::FireAtPoint(TraceResult &tr) { SetEndPos(tr.vecEndPos); @@ -1054,7 +992,6 @@ void CLaser::FireAtPoint(TraceResult &tr) DoSparks(GetStartPos(), tr.vecEndPos); } -/* <778f6> ../cstrike/dlls/effects.cpp:1069 */ void CLaser::StrikeThink() { CBaseEntity *pEnd = RandomTargetname(STRING(pev->message)); @@ -1068,13 +1005,9 @@ void CLaser::StrikeThink() pev->nextthink = gpGlobals->time + 0.1f; } -/* <7894f> ../cstrike/dlls/effects.cpp:1099 */ LINK_ENTITY_TO_CLASS(env_glow, CGlow); - -/* <740f6> ../cstrike/dlls/effects.cpp:1107 */ IMPLEMENT_SAVERESTORE(CGlow, CPointEntity); -/* <735a6> ../cstrike/dlls/effects.cpp:1109 */ void CGlow::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -1085,7 +1018,7 @@ void CGlow::__MAKE_VHOOK(Spawn)() PRECACHE_MODEL((char *)STRING(pev->model)); SET_MODEL(ENT(pev), STRING(pev->model)); - m_maxFrame = (float)MODEL_FRAMES(pev->modelindex) - 1; + m_maxFrame = float(MODEL_FRAMES(pev->modelindex) - 1); if (m_maxFrame > 1.0f && pev->framerate != 0.0f) { @@ -1095,7 +1028,6 @@ void CGlow::__MAKE_VHOOK(Spawn)() m_lastTime = gpGlobals->time; } -/* <74606> ../cstrike/dlls/effects.cpp:1127 */ void CGlow::__MAKE_VHOOK(Think)() { Animate(pev->framerate * (gpGlobals->time - m_lastTime)); @@ -1104,22 +1036,21 @@ void CGlow::__MAKE_VHOOK(Think)() m_lastTime = gpGlobals->time; } -/* <78a1f> ../cstrike/dlls/effects.cpp:1136 */ void CGlow::Animate(float frames) { if (m_maxFrame > 0) - pev->frame = fmod((float_precision)(pev->frame + frames), (float_precision)m_maxFrame); + { + pev->frame = Q_fmod(float_precision(pev->frame + frames), float_precision(m_maxFrame)); + } } -/* <78a4a> ../cstrike/dlls/effects.cpp:1157 */ LINK_ENTITY_TO_CLASS(env_bombglow, CBombGlow); -/* <735cd> ../cstrike/dlls/effects.cpp:1161 */ void CBombGlow::__MAKE_VHOOK(Spawn)() { #ifdef REGAMEDLL_FIXES PRECACHE_MODEL("sprites/flare1.spr"); -#endif // REGAMEDLL_FIXES +#endif pev->solid = SOLID_NOT; pev->movetype = MOVETYPE_NONE; @@ -1138,7 +1069,6 @@ void CBombGlow::__MAKE_VHOOK(Spawn)() m_bSetModel = false; } -/* <73a40> ../cstrike/dlls/effects.cpp:1184 */ void CBombGlow::__MAKE_VHOOK(Think)() { if (!m_bSetModel) @@ -1166,13 +1096,9 @@ void CBombGlow::__MAKE_VHOOK(Think)() pev->nextthink = gpGlobals->time + 0.05f; } -/* <78b1a> ../cstrike/dlls/effects.cpp:1226 */ LINK_ENTITY_TO_CLASS(env_sprite, CSprite); - -/* <740a8> ../cstrike/dlls/effects.cpp:1234 */ IMPLEMENT_SAVERESTORE(CSprite, CPointEntity); -/* <75dc8> ../cstrike/dlls/effects.cpp:1236 */ void CSprite::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -1182,7 +1108,7 @@ void CSprite::__MAKE_VHOOK(Spawn)() Precache(); SET_MODEL(ENT(pev), STRING(pev->model)); - m_maxFrame = (float)MODEL_FRAMES(pev->modelindex) - 1; + m_maxFrame = float(MODEL_FRAMES(pev->modelindex) - 1); if (pev->targetname && !(pev->spawnflags & SF_SPRITE_STARTON)) TurnOff(); @@ -1197,7 +1123,6 @@ void CSprite::__MAKE_VHOOK(Spawn)() } } -/* <75d55> ../cstrike/dlls/effects.cpp:1260 */ void CSprite::__MAKE_VHOOK(Restart)() { pev->solid = SOLID_NOT; @@ -1211,7 +1136,6 @@ void CSprite::__MAKE_VHOOK(Restart)() TurnOn(); } -/* <74436> ../cstrike/dlls/effects.cpp:1273 */ void CSprite::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL((char *)STRING(pev->model)); @@ -1227,7 +1151,6 @@ void CSprite::__MAKE_VHOOK(Precache)() } } -/* <78bea> ../cstrike/dlls/effects.cpp:1289 */ void CSprite::SpriteInit(const char *pSpriteName, const Vector &origin) { pev->model = MAKE_STRING(pSpriteName); @@ -1235,17 +1158,12 @@ void CSprite::SpriteInit(const char *pSpriteName, const Vector &origin) Spawn(); } -/* <78c1d> ../cstrike/dlls/effects.cpp:1296 */ CSprite *CSprite::SpriteCreate(const char *pSpriteName, const Vector &origin, BOOL animate) { CSprite *pSprite = GetClassPtr((CSprite *)NULL); pSprite->SpriteInit(pSpriteName, origin); - if (pSprite->pev->classname) - RemoveEntityHashValue(pSprite->pev, STRING(pSprite->pev->classname), CLASSNAME); - MAKE_STRING_CLASS("env_sprite", pSprite->pev); - AddEntityHashValue(pSprite->pev, STRING(pSprite->pev->classname), CLASSNAME); pSprite->pev->solid = SOLID_NOT; pSprite->pev->movetype = MOVETYPE_NOCLIP; @@ -1258,7 +1176,6 @@ CSprite *CSprite::SpriteCreate(const char *pSpriteName, const Vector &origin, BO return pSprite; } -/* <75679> ../cstrike/dlls/effects.cpp:1310 */ void CSprite::AnimateThink() { Animate(pev->framerate * (gpGlobals->time - m_lastTime)); @@ -1266,7 +1183,6 @@ void CSprite::AnimateThink() m_lastTime = gpGlobals->time; } -/* <78d6b> ../cstrike/dlls/effects.cpp:1318 */ void CSprite::AnimateUntilDead() { if (gpGlobals->time > pev->dmgtime) @@ -1280,7 +1196,6 @@ void CSprite::AnimateUntilDead() } } -/* <78de9> ../cstrike/dlls/effects.cpp:1329 */ NOXREF void CSprite::Expand(float scaleSpeed, float fadeSpeed) { pev->speed = scaleSpeed; @@ -1291,7 +1206,6 @@ NOXREF void CSprite::Expand(float scaleSpeed, float fadeSpeed) m_lastTime = gpGlobals->time; } -/* <73e2e> ../cstrike/dlls/effects.cpp:1340 */ void CSprite::ExpandThink() { float frametime = gpGlobals->time - m_lastTime; @@ -1311,7 +1225,6 @@ void CSprite::ExpandThink() } } -/* <78e2e> ../cstrike/dlls/effects.cpp:1358 */ void CSprite::Animate(float frames) { pev->frame += frames; @@ -1322,18 +1235,16 @@ void CSprite::Animate(float frames) TurnOff(); else if (m_maxFrame > 0) - pev->frame = fmod((float_precision)pev->frame, (float_precision)m_maxFrame); + pev->frame = Q_fmod(float_precision(pev->frame), float_precision(m_maxFrame)); } } -/* <78e73> ../cstrike/dlls/effects.cpp:1376 */ void CSprite::TurnOff() { pev->effects = EF_NODRAW; pev->nextthink = 0; } -/* <78e94> ../cstrike/dlls/effects.cpp:1383 */ void CSprite::TurnOn() { pev->effects = 0; @@ -1348,7 +1259,6 @@ void CSprite::TurnOn() pev->frame = 0; } -/* <75e27> ../cstrike/dlls/effects.cpp:1396 */ void CSprite::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int on = pev->effects != EF_NODRAW; @@ -1362,13 +1272,9 @@ void CSprite::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, U } } -/* <7405a> ../cstrike/dlls/effects.cpp:1448 */ IMPLEMENT_SAVERESTORE(CGibShooter, CBaseDelay); - -/* <78eb7> ../cstrike/dlls/effects.cpp:1449 */ LINK_ENTITY_TO_CLASS(gibshooter, CGibShooter); -/* <73dbb> ../cstrike/dlls/effects.cpp:1452 */ void CGibShooter::__MAKE_VHOOK(Precache)() { if (g_Language == LANGUAGE_GERMAN) @@ -1381,7 +1287,6 @@ void CGibShooter::__MAKE_VHOOK(Precache)() } } -/* <74886> ../cstrike/dlls/effects.cpp:1465 */ void CGibShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "m_iGibs")) @@ -1408,14 +1313,12 @@ void CGibShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseDelay::KeyValue(pkvd); } -/* <735f4> ../cstrike/dlls/effects.cpp:1493 */ void CGibShooter::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { SetThink(&CGibShooter::ShootThink); pev->nextthink = gpGlobals->time; } -/* <73cb5> ../cstrike/dlls/effects.cpp:1499 */ void CGibShooter::__MAKE_VHOOK(Spawn)() { Precache(); @@ -1437,7 +1340,6 @@ void CGibShooter::__MAKE_VHOOK(Spawn)() pev->body = MODEL_FRAMES(m_iGibModelIndex); } -/* <744ff> ../cstrike/dlls/effects.cpp:1521 */ CGib *CGibShooter::__MAKE_VHOOK(CreateGib)() { if (CVAR_GET_FLOAT("violence_hgibs") == 0) @@ -1459,7 +1361,6 @@ CGib *CGibShooter::__MAKE_VHOOK(CreateGib)() return pGib; } -/* <75751> ../cstrike/dlls/effects.cpp:1541 */ void CGibShooter::ShootThink() { pev->nextthink = m_flDelay + gpGlobals->time; @@ -1524,10 +1425,8 @@ void CGibShooter::ShootThink() } } -/* <78f87> ../cstrike/dlls/effects.cpp:1600 */ LINK_ENTITY_TO_CLASS(env_shooter, CEnvShooter); -/* <749e7> ../cstrike/dlls/effects.cpp:1602 */ void CEnvShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "shootmodel")) @@ -1567,14 +1466,12 @@ void CEnvShooter::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CGibShooter::KeyValue(pkvd); } -/* <73cdc> ../cstrike/dlls/effects.cpp:1644 */ void CEnvShooter::__MAKE_VHOOK(Precache)() { m_iGibModelIndex = PRECACHE_MODEL((char *)STRING(pev->model)); CBreakable::MaterialSoundPrecache((Materials)m_iGibMaterial); } -/* <7464b> ../cstrike/dlls/effects.cpp:1651 */ CGib *CEnvShooter::__MAKE_VHOOK(CreateGib)() { CGib *pGib = GetClassPtr((CGib *)NULL); @@ -1600,22 +1497,18 @@ CGib *CEnvShooter::__MAKE_VHOOK(CreateGib)() return pGib; } -/* <79057> ../cstrike/dlls/effects.cpp:1696 */ LINK_ENTITY_TO_CLASS(test_effect, CTestEffect); -/* <73656> ../cstrike/dlls/effects.cpp:1698 */ void CTestEffect::__MAKE_VHOOK(Spawn)() { Precache(); } -/* <7367c> ../cstrike/dlls/effects.cpp:1703 */ void CTestEffect::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("sprites/lgtning.spr"); } -/* <76e39> ../cstrike/dlls/effects.cpp:1708 */ void CTestEffect::TestThink() { int i; @@ -1627,7 +1520,13 @@ void CTestEffect::TestThink() TraceResult tr; Vector vecSrc = pev->origin; - Vector vecDir = Vector(RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1),RANDOM_FLOAT(-1, 1)); + Vector vecDir; + + // TODO: fix test demo + vecDir.z = RANDOM_FLOAT(-1, 1); + vecDir.y = RANDOM_FLOAT(-1, 1); + vecDir.x = RANDOM_FLOAT(-1, 1); + vecDir = vecDir.Normalize(); UTIL_TraceLine(vecSrc, vecSrc + vecDir * 128, ignore_monsters, ENT(pev), &tr); @@ -1638,18 +1537,17 @@ void CTestEffect::TestThink() pbeam->SetScrollRate(12); m_flBeamTime[m_iBeam] = gpGlobals->time; - m_pBeam[m_iBeam] = pbeam; - m_iBeam++; - + m_pBeam[m_iBeam++] = pbeam; } if (t < 3.0) { for (i = 0; i < m_iBeam; ++i) { - t = (gpGlobals->time - m_flBeamTime[i]) / (3 + m_flStartTime - m_flBeamTime[i]); - m_pBeam[i]->SetBrightness(255 * t); + t = (gpGlobals->time - m_flBeamTime[i]) / (3.0f + m_flStartTime - m_flBeamTime[i]); + m_pBeam[i]->SetBrightness(int(255.0f * t)); } + pev->nextthink = gpGlobals->time + 0.1f; } else @@ -1665,7 +1563,6 @@ void CTestEffect::TestThink() } } -/* <736a2> ../cstrike/dlls/effects.cpp:1759 */ void CTestEffect::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { SetThink(&CTestEffect::TestThink); @@ -1674,10 +1571,8 @@ void CTestEffect::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCalle m_flStartTime = gpGlobals->time; } -/* <79127> ../cstrike/dlls/effects.cpp:1788 */ LINK_ENTITY_TO_CLASS(env_blood, CBlood); -/* <73c8f> ../cstrike/dlls/effects.cpp:1797 */ void CBlood::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -1688,7 +1583,6 @@ void CBlood::__MAKE_VHOOK(Spawn)() SetMovedir(pev); } -/* <74c34> ../cstrike/dlls/effects.cpp:1807 */ void CBlood::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "color")) @@ -1715,7 +1609,6 @@ void CBlood::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <791f7> ../cstrike/dlls/effects.cpp:1834 */ Vector CBlood::Direction() { if (pev->spawnflags & SF_BLOOD_RANDOM) @@ -1724,7 +1617,6 @@ Vector CBlood::Direction() return pev->movedir; } -/* <79256> ../cstrike/dlls/effects.cpp:1843 */ Vector CBlood::BloodPosition(CBaseEntity *pActivator) { if (pev->spawnflags & SF_BLOOD_PLAYER) @@ -1745,13 +1637,12 @@ Vector CBlood::BloodPosition(CBaseEntity *pActivator) return pev->origin; } -/* <79351> ../cstrike/dlls/effects.cpp:1863 */ void CBlood::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (pev->spawnflags & SF_BLOOD_STREAM) - UTIL_BloodStream(BloodPosition(pActivator), Direction(), (Color() == BLOOD_COLOR_RED) ? 70 : Color(), (int)BloodAmount()); + UTIL_BloodStream(BloodPosition(pActivator), Direction(), (Color() == BLOOD_COLOR_RED) ? 70 : Color(), int(BloodAmount())); else - UTIL_BloodDrips(BloodPosition(pActivator), Direction(), Color(), (int)BloodAmount()); + UTIL_BloodDrips(BloodPosition(pActivator), Direction(), Color(), int(BloodAmount())); if (pev->spawnflags & SF_BLOOD_DECAL) { @@ -1768,10 +1659,8 @@ void CBlood::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, US } } -/* <79594> ../cstrike/dlls/effects.cpp:1905 */ LINK_ENTITY_TO_CLASS(env_shake, CShake); -/* <73705> ../cstrike/dlls/effects.cpp:1919 */ void CShake::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -1783,7 +1672,6 @@ void CShake::__MAKE_VHOOK(Spawn)() pev->dmg = 0; } -/* <74d76> ../cstrike/dlls/effects.cpp:1931 */ void CShake::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "amplitude")) @@ -1810,16 +1698,13 @@ void CShake::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <73c2d> ../cstrike/dlls/effects.cpp:1958 */ void CShake::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { UTIL_ScreenShake(pev->origin, Amplitude(), Frequency(), Duration(), Radius()); } -/* <79664> ../cstrike/dlls/effects.cpp:1979 */ LINK_ENTITY_TO_CLASS(env_fade, CFade); -/* <7372b> ../cstrike/dlls/effects.cpp:1987 */ void CFade::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -1828,7 +1713,6 @@ void CFade::__MAKE_VHOOK(Spawn)() pev->frame = 0; } -/* <74efa> ../cstrike/dlls/effects.cpp:1996 */ void CFade::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "duration")) @@ -1845,7 +1729,6 @@ void CFade::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <73bb4> ../cstrike/dlls/effects.cpp:2013 */ void CFade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int fadeFlags = 0; @@ -1860,19 +1743,17 @@ void CFade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE { if (pActivator->IsNetClient()) { - UTIL_ScreenFade(pActivator, pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags); + UTIL_ScreenFade(pActivator, pev->rendercolor, Duration(), HoldTime(), int(pev->renderamt), fadeFlags); } } else - UTIL_ScreenFadeAll(pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, fadeFlags); + UTIL_ScreenFadeAll(pev->rendercolor, Duration(), HoldTime(), int(pev->renderamt), fadeFlags); SUB_UseTargets(this, USE_TOGGLE, 0); } -/* <79734> ../cstrike/dlls/effects.cpp:2048 */ LINK_ENTITY_TO_CLASS(env_message, CMessage); -/* <73751> ../cstrike/dlls/effects.cpp:2051 */ void CMessage::__MAKE_VHOOK(Spawn)() { Precache(); @@ -1906,7 +1787,6 @@ void CMessage::__MAKE_VHOOK(Spawn)() pev->scale = 1.0f; } -/* <73df7> ../cstrike/dlls/effects.cpp:2085 */ void CMessage::__MAKE_VHOOK(Precache)() { if (pev->noise) @@ -1915,7 +1795,6 @@ void CMessage::__MAKE_VHOOK(Precache)() } } -/* <74765> ../cstrike/dlls/effects.cpp:2091 */ void CMessage::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "messagesound")) @@ -1937,7 +1816,6 @@ void CMessage::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <73aa5> ../cstrike/dlls/effects.cpp:2113 */ void CMessage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { CBaseEntity *pPlayer = NULL; @@ -1967,16 +1845,13 @@ void CMessage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, SUB_UseTargets(this, USE_TOGGLE, 0); } -/* <79804> ../cstrike/dlls/effects.cpp:2160 */ LINK_ENTITY_TO_CLASS(env_funnel, CEnvFunnel); -/* <73778> ../cstrike/dlls/effects.cpp:2155 */ void CEnvFunnel::__MAKE_VHOOK(Precache)() { m_iSprite = PRECACHE_MODEL("sprites/flare6.spr"); } -/* <7379f> ../cstrike/dlls/effects.cpp:2162 */ void CEnvFunnel::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { MESSAGE_BEGIN(MSG_BROADCAST, SVC_TEMPENTITY); @@ -2003,7 +1878,6 @@ void CEnvFunnel::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller pev->nextthink = gpGlobals->time; } -/* <7382b> ../cstrike/dlls/effects.cpp:2187 */ void CEnvFunnel::__MAKE_VHOOK(Spawn)() { Precache(); @@ -2011,17 +1885,14 @@ void CEnvFunnel::__MAKE_VHOOK(Spawn)() pev->effects = EF_NODRAW; } -/* <73852> ../cstrike/dlls/effects.cpp:2207 */ void CEnvBeverage::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/can.mdl"); PRECACHE_SOUND("weapons/g_bounce3.wav"); } -/* <798d4> ../cstrike/dlls/effects.cpp:2213 */ LINK_ENTITY_TO_CLASS(env_beverage, CEnvBeverage); -/* <7439c> ../cstrike/dlls/effects.cpp:2215 */ void CEnvBeverage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (pev->frags != 0.0f || pev->health <= 0.0f) @@ -2044,7 +1915,6 @@ void CEnvBeverage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall pev->health--; } -/* <73879> ../cstrike/dlls/effects.cpp:2242 */ void CEnvBeverage::__MAKE_VHOOK(Spawn)() { Precache(); @@ -2058,16 +1928,13 @@ void CEnvBeverage::__MAKE_VHOOK(Spawn)() } } -/* <738a0> ../cstrike/dlls/effects.cpp:2267 */ void CItemSoda::__MAKE_VHOOK(Precache)() { ; } -/* <799a4> ../cstrike/dlls/effects.cpp:2271 */ LINK_ENTITY_TO_CLASS(item_sodacan, CItemSoda); -/* <738c6> ../cstrike/dlls/effects.cpp:2273 */ void CItemSoda::__MAKE_VHOOK(Spawn)() { Precache(); @@ -2081,7 +1948,6 @@ void CItemSoda::__MAKE_VHOOK(Spawn)() pev->nextthink = gpGlobals->time + 0.5f; } -/* <73961> ../cstrike/dlls/effects.cpp:2286 */ void CItemSoda::CanThink() { EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/g_bounce3.wav", VOL_NORM, ATTN_NORM); @@ -2093,7 +1959,6 @@ void CItemSoda::CanThink() SetTouch(&CItemSoda::CanTouch); } -/* <7431d> ../cstrike/dlls/effects.cpp:2296 */ void CItemSoda::CanTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) diff --git a/regamedll/dlls/effects.h b/regamedll/dlls/effects.h index 20295bef..7e6a38f1 100644 --- a/regamedll/dlls/effects.h +++ b/regamedll/dlls/effects.h @@ -68,7 +68,6 @@ #define SF_MESSAGE_ONCE 0x0001 // Fade in, not out #define SF_MESSAGE_ALL 0x0002 // Send to all clients -/* <7249d> ../cstrike/dlls/effects.h:33 */ class CSprite: public CPointEntity { public: @@ -96,14 +95,14 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT AnimateThink(); void EXPORT ExpandThink(); void Animate(float frames); - NOXREF void Expand(float scaleSpeed, float fadeSpeed); + void Expand(float scaleSpeed, float fadeSpeed); void SpriteInit(const char *pSpriteName, const Vector &origin); void SetAttachment(edict_t *pEntity, int attachment) @@ -131,10 +130,10 @@ public: pev->renderfx = fx; } - void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; } - void SetScale(float scale) { pev->scale = scale; } - void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; } - void SetBrightness(int brightness) { pev->renderamt = brightness; } + void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; } + void SetScale(float scale) { pev->scale = scale; } + void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; } + void SetBrightness(int brightness) { pev->renderamt = brightness; } void AnimateAndDie(float_precision framerate) { @@ -154,7 +153,6 @@ private: float m_maxFrame; }; -/* <723cb> ../cstrike/dlls/effects.h:105 */ class CBeam: public CBaseEntity { public: @@ -175,42 +173,42 @@ public: void Spawn_(); void Precache_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT TriggerTouch(CBaseEntity *pOther); - void SetType(int type) { pev->rendermode = (pev->rendermode & 0xF0) | (type & 0x0F); } - void SetFlags(int flags) { pev->rendermode = (pev->rendermode & 0x0F) | (flags & 0xF0); } - void SetStartPos(const Vector &pos) { pev->origin = pos; } - void SetEndPos(const Vector &pos) { pev->angles = pos; } + void SetType(int type) { pev->rendermode = (pev->rendermode & 0xF0) | (type & 0x0F); } + void SetFlags(int flags) { pev->rendermode = (pev->rendermode & 0x0F) | (flags & 0xF0); } + void SetStartPos(const Vector &pos) { pev->origin = pos; } + void SetEndPos(const Vector &pos) { pev->angles = pos; } void SetStartEntity(int entityIndex); void SetEndEntity(int entityIndex); - void SetStartAttachment(int attachment) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment & 0xF) << 12); } - void SetEndAttachment(int attachment) { pev->skin = (pev->skin & 0x0FFF) | ((attachment & 0xF) << 12); } - void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; } - void SetWidth(int width) { pev->scale = width; } - void SetNoise(int amplitude) { pev->body = amplitude; } - void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; } - void SetBrightness(int brightness) { pev->renderamt = brightness;} - void SetFrame(float frame) { pev->frame = frame; } - void SetScrollRate(int speed) { pev->animtime = speed; } - int GetType() const { return pev->rendermode & 0x0F; } - int GetFlags() const { return pev->rendermode & 0xF0; } - int GetStartEntity() const { return pev->sequence & 0xFFF; } - int GetEndEntity() const { return pev->skin & 0xFFF; } + void SetStartAttachment(int attachment) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment & 0xF) << 12); } + void SetEndAttachment(int attachment) { pev->skin = (pev->skin & 0x0FFF) | ((attachment & 0xF) << 12); } + void SetTexture(int spriteIndex) { pev->modelindex = spriteIndex; } + void SetWidth(int width) { pev->scale = width; } + void SetNoise(int amplitude) { pev->body = amplitude; } + void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; } + void SetBrightness(int brightness) { pev->renderamt = brightness; } + void SetFrame(float frame) { pev->frame = frame; } + void SetScrollRate(int speed) { pev->animtime = speed; } + int GetType() const { return pev->rendermode & 0x0F; } + int GetFlags() const { return pev->rendermode & 0xF0; } + int GetStartEntity() const { return pev->sequence & 0xFFF; } + int GetEndEntity() const { return pev->skin & 0xFFF; } const Vector &GetStartPos(); const Vector &GetEndPos(); - int GetTexture() const { return pev->modelindex; } - int GetWidth() const { return pev->scale; } - int GetNoise() const { return pev->body; } - int GetBrightness() const { return pev->renderamt; } - int GetFrame() const { return pev->frame; } - int GetScrollRate() const { return pev->animtime; } + int GetTexture() const { return pev->modelindex; } + int GetWidth() const { return pev->scale; } + int GetNoise() const { return pev->body; } + int GetBrightness() const { return pev->renderamt; } + int GetFrame() const { return pev->frame; } + int GetScrollRate() const { return pev->animtime; } void RelinkBeam(); void DoSparks(const Vector &start, const Vector &end); @@ -237,7 +235,6 @@ public: } }; -/* <72402> ../cstrike/dlls/effects.h:188 */ class CLaser: public CBeam { public: @@ -257,7 +254,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void TurnOn(); @@ -275,7 +272,6 @@ public: Vector m_firePosition; }; -/* <7237e> ../cstrike/dlls/effects.cpp:36 */ class CBubbling: public CBaseEntity { public: @@ -296,7 +292,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT FizzThink(); @@ -310,7 +306,6 @@ public: int m_state; }; -/* <723e6> ../cstrike/dlls/effects.cpp:357 */ class CLightning: public CBeam { public: @@ -330,7 +325,7 @@ public: int Restore_(CRestore &restore); void Activate_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT StrikeThink(); @@ -368,7 +363,6 @@ public: float m_radius; }; -/* <7244f> ../cstrike/dlls/effects.cpp:1085 */ class CGlow: public CPointEntity { public: @@ -384,7 +378,7 @@ public: int Restore_(CRestore &restore); void Think_(); -#endif // HOOK_GAMEDLL +#endif void Animate(float frames); @@ -395,7 +389,6 @@ public: float m_maxFrame; }; -/* <724b8> ../cstrike/dlls/effects.cpp:1146 */ class CBombGlow: public CSprite { public: @@ -407,7 +400,7 @@ public: void Spawn_(); void Think_(); -#endif // HOOK_GAMEDLL +#endif public: float m_lastTime; @@ -415,7 +408,6 @@ public: bool m_bSetModel; }; -/* <72581> ../cstrike/dlls/effects.cpp:1413 */ class CGibShooter: public CBaseDelay { public: @@ -437,7 +429,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); CGib *CreateGib_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT ShootThink(); @@ -455,7 +447,6 @@ public: float m_flGibLife; }; -/* <725ef> ../cstrike/dlls/effects.cpp:1592 */ class CEnvShooter: public CGibShooter { public: @@ -469,13 +460,12 @@ public: void KeyValue_(KeyValueData *pkvd); CGib *CreateGib_(); -#endif // HOOK_GAMEDLL +#endif }; #define MAX_BEAM 24 -/* <7263d> ../cstrike/dlls/effects.cpp:1679 */ class CTestEffect: public CBaseDelay { public: @@ -489,7 +479,7 @@ public: void Precache_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT TestThink(); @@ -504,7 +494,6 @@ public: float m_flStartTime; }; -/* <72690> ../cstrike/dlls/effects.cpp:1769 */ class CBlood: public CPointEntity { public: @@ -518,21 +507,20 @@ public: void KeyValue_(KeyValueData *pkvd); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: - int Color() const { return pev->impulse; } - float BloodAmount() const { return pev->dmg; } + int Color() const { return pev->impulse; } + float BloodAmount() const { return pev->dmg; } - void SetColor(int color) { pev->impulse = color; } - void SetBloodAmount(float amount) { pev->dmg = amount; } + void SetColor(int color) { pev->impulse = color; } + void SetBloodAmount(float amount) { pev->dmg = amount; } public: Vector Direction(); Vector BloodPosition(CBaseEntity *pActivator); }; -/* <726de> ../cstrike/dlls/effects.cpp:1886 */ class CShake: public CPointEntity { public: @@ -546,21 +534,20 @@ public: void KeyValue_(KeyValueData *pkvd); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: - float Amplitude() const { return pev->scale; } - float Frequency() const { return pev->dmg_save; } - float Duration() const { return pev->dmg_take; } - float Radius() const { return pev->dmg; } + float Amplitude() const { return pev->scale; } + float Frequency() const { return pev->dmg_save; } + float Duration() const { return pev->dmg_take; } + float Radius() const { return pev->dmg; } - void SetAmplitude(float amplitude) { pev->scale = amplitude; } - void SetFrequency(float frequency) { pev->dmg_save = frequency; } - void SetDuration(float duration) { pev->dmg_take = duration; } - void SetRadius(float radius) { pev->dmg = radius; } + void SetAmplitude(float amplitude) { pev->scale = amplitude; } + void SetFrequency(float frequency) { pev->dmg_save = frequency; } + void SetDuration(float duration) { pev->dmg_take = duration; } + void SetRadius(float radius) { pev->dmg = radius; } }; -/* <7272c> ../cstrike/dlls/effects.cpp:1964 */ class CFade: public CPointEntity { public: @@ -574,17 +561,16 @@ public: void KeyValue_(KeyValueData *pkvd); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: float Duration() const { return pev->dmg_take; } float HoldTime() const { return pev->dmg_save; } - void SetDuration(float duration) { pev->dmg_take = duration; } - void SetHoldTime(float hold) { pev->dmg_save = hold; } + void SetDuration(float duration) { pev->dmg_take = duration; } + void SetHoldTime(float hold) { pev->dmg_save = hold; } }; -/* <7277a> ../cstrike/dlls/effects.cpp:2038 */ class CMessage: public CPointEntity { public: @@ -600,11 +586,10 @@ public: void KeyValue_(KeyValueData *pkvd); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; -/* <727c8> ../cstrike/dlls/effects.cpp:2145 */ class CEnvFunnel: public CBaseDelay { public: @@ -618,13 +603,12 @@ public: void Precache_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: int m_iSprite; }; -/* <7281b> ../cstrike/dlls/effects.cpp:2199 */ class CEnvBeverage: public CBaseDelay { public: @@ -638,11 +622,10 @@ public: void Precache_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; -/* <72869> ../cstrike/dlls/effects.cpp:2258 */ class CItemSoda: public CBaseEntity { public: @@ -654,7 +637,7 @@ public: void Spawn_(); void Precache_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT CanThink(); diff --git a/regamedll/dlls/enginecallback.h b/regamedll/dlls/enginecallback.h index 8b99e226..58f3cedb 100644 --- a/regamedll/dlls/enginecallback.h +++ b/regamedll/dlls/enginecallback.h @@ -93,13 +93,11 @@ extern enginefuncs_t g_engfuncs; #define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown) #define ENG_CHECK_PARM (*g_engfuncs.pfnEngCheckParm) -/* <472a4> ../cstrike/dlls/enginecallback.h:77 */ inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL) { (*g_engfuncs.pfnMessageBegin)(msg_dest,msg_type,pOrigin,ed); } -/* <464e> ../cstrike/dlls/enginecallback.h:97 */ inline void *GET_PRIVATE(edict_t *pent) { if (pent) @@ -185,4 +183,4 @@ inline void *GET_PRIVATE(edict_t *pent) #define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified) #define PLAYER_CNX_STATS (*g_engfuncs.pfnGetPlayerStats) -#endif //ENGINECALLBACK_H +#endif // ENGINECALLBACK_H diff --git a/regamedll/dlls/explode.cpp b/regamedll/dlls/explode.cpp index 4f9f9fbc..476e18b7 100644 --- a/regamedll/dlls/explode.cpp +++ b/regamedll/dlls/explode.cpp @@ -11,12 +11,10 @@ TYPEDESCRIPTION CEnvExplosion::m_SaveData[] = DEFINE_FIELD(CEnvExplosion, m_spriteScale, FIELD_INTEGER), }; -#endif // HOOK_GAMEDLL +#endif -/* <7f660> ../cstrike/dlls/explode.cpp:37 */ LINK_ENTITY_TO_CLASS(spark_shower, CShower); -/* <7f49c> ../cstrike/dlls/explode.cpp:39 */ void CShower::__MAKE_VHOOK(Spawn)() { pev->velocity = RANDOM_FLOAT(200, 300) * pev->angles; @@ -42,7 +40,6 @@ void CShower::__MAKE_VHOOK(Spawn)() pev->angles = g_vecZero; } -/* <7f475> ../cstrike/dlls/explode.cpp:61 */ void CShower::__MAKE_VHOOK(Think)() { UTIL_Sparks(pev->origin); @@ -57,7 +54,6 @@ void CShower::__MAKE_VHOOK(Think)() pev->flags &= ~FL_ONGROUND; } -/* <7f122> ../cstrike/dlls/explode.cpp:73 */ void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (pev->flags & FL_ONGROUND) @@ -71,13 +67,9 @@ void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) } } -/* <7f566> ../cstrike/dlls/explode.cpp:106 */ IMPLEMENT_SAVERESTORE(CEnvExplosion, CBaseMonster); - -/* <7f72a> ../cstrike/dlls/explode.cpp:107 */ LINK_ENTITY_TO_CLASS(env_explosion, CEnvExplosion); -/* <7f5b2> ../cstrike/dlls/explode.cpp:109 */ void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "iMagnitude")) @@ -89,7 +81,6 @@ void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <7f1a5> ../cstrike/dlls/explode.cpp:120 */ void CEnvExplosion::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -103,16 +94,15 @@ void CEnvExplosion::__MAKE_VHOOK(Spawn)() flSpriteScale = 10.0f; } - m_spriteScale = (int)flSpriteScale; + m_spriteScale = int(flSpriteScale); } -/* <7f233> ../cstrike/dlls/explode.cpp:150 */ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { TraceResult tr; - pev->model = iStringNull;//invisible - pev->solid = SOLID_NOT;//intangible + pev->model = iStringNull;// invisible + pev->solid = SOLID_NOT;// intangible Vector vecSpot;// trace starts here! @@ -125,15 +115,11 @@ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal { pev->origin = tr.vecEndPos + (tr.vecPlaneNormal * (m_iMagnitude - 24) * 0.6f); } - else - { - pev->origin = pev->origin; - } // draw decal if (! (pev->spawnflags & SF_ENVEXPLOSION_NODECAL)) { - if (RANDOM_FLOAT(0, 1) < 0.5) + if (RANDOM_FLOAT(0, 1) < 0.5f) { UTIL_DecalTrace(&tr, DECAL_SCORCH1); } @@ -152,7 +138,7 @@ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal WRITE_COORD(pev->origin.y); WRITE_COORD(pev->origin.z); WRITE_SHORT(g_sModelIndexFireball); - WRITE_BYTE((byte)m_spriteScale); // scale * 10 + WRITE_BYTE(byte(m_spriteScale)); // scale * 10 WRITE_BYTE(15); // framerate WRITE_BYTE(TE_EXPLFLAG_NONE); MESSAGE_END(); @@ -192,7 +178,6 @@ void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal } } -/* <7f1e1> ../cstrike/dlls/explode.cpp:235 */ void CEnvExplosion::Smoke() { if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSMOKE)) @@ -203,7 +188,7 @@ void CEnvExplosion::Smoke() WRITE_COORD(pev->origin.y); WRITE_COORD(pev->origin.z); WRITE_SHORT(g_sModelIndexSmoke); - WRITE_BYTE((byte)m_spriteScale); // scale * 10 + WRITE_BYTE(byte(m_spriteScale)); // scale * 10 WRITE_BYTE(12); // framerate MESSAGE_END(); } @@ -215,8 +200,6 @@ void CEnvExplosion::Smoke() } // HACKHACK -- create one of these and fake a keyvalue to get the right explosion setup - -/* <7f7f4> ../cstrike/dlls/explode.cpp:258 */ void ExplosionCreate(const Vector ¢er, Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage) { KeyValueData kvd; diff --git a/regamedll/dlls/explode.h b/regamedll/dlls/explode.h index 68ace26d..eaf5e8be 100644 --- a/regamedll/dlls/explode.h +++ b/regamedll/dlls/explode.h @@ -39,7 +39,6 @@ #define SF_ENVEXPLOSION_NODECAL (1<<4) // don't make a scorch mark #define SF_ENVEXPLOSION_NOSPARKS (1<<5) // don't make a scorch mark -/* <7e4a8> ../cstrike/dlls/explode.cpp:29 */ class CShower: public CBaseEntity { public: @@ -54,11 +53,10 @@ public: void Think_(); void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <7e66b> ../cstrike/dlls/explode.cpp:84 */ class CEnvExplosion: public CBaseMonster { public: @@ -76,7 +74,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Smoke(); diff --git a/regamedll/dlls/func_break.cpp b/regamedll/dlls/func_break.cpp index 6ff621a9..cc8ad433 100644 --- a/regamedll/dlls/func_break.cpp +++ b/regamedll/dlls/func_break.cpp @@ -106,7 +106,6 @@ TYPEDESCRIPTION CPushable::m_SaveData[] = #endif // HOOK_GAMEDLL -/* <85bf3> ../cstrike/dlls/func_break.cpp:76 */ void CBreakable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { // UNDONE_WC: explicitly ignoring these fields, but they shouldn't be in the map file! @@ -170,13 +169,9 @@ void CBreakable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseDelay::KeyValue(pkvd); } -/* <86426> ../cstrike/dlls/func_break.cpp:139 */ LINK_ENTITY_TO_CLASS(func_breakable, CBreakable); - -/* <85b30> ../cstrike/dlls/func_break.cpp:155 */ IMPLEMENT_SAVERESTORE(CBreakable, CBaseEntity); -/* <85663> ../cstrike/dlls/func_break.cpp:157 */ void CBreakable::__MAKE_VHOOK(Spawn)() { Precache(); @@ -217,7 +212,6 @@ void CBreakable::__MAKE_VHOOK(Spawn)() } } -/* <8568a> ../cstrike/dlls/func_break.cpp:191 */ void CBreakable::__MAKE_VHOOK(Restart)() { pev->solid = SOLID_BSP; @@ -248,7 +242,6 @@ void CBreakable::__MAKE_VHOOK(Restart)() } } -/* <864f1> ../cstrike/dlls/func_break.cpp:260 */ const char **CBreakable::MaterialSoundList(Materials precacheMaterial, int &soundCount) { const char **pSoundList = NULL; @@ -298,7 +291,6 @@ const char **CBreakable::MaterialSoundList(Materials precacheMaterial, int &soun return pSoundList; } -/* <86526> ../cstrike/dlls/func_break.cpp:303 */ void CBreakable::MaterialSoundPrecache(Materials precacheMaterial) { const char **pSoundList; @@ -312,7 +304,6 @@ void CBreakable::MaterialSoundPrecache(Materials precacheMaterial) } } -/* <86598> ../cstrike/dlls/func_break.cpp:316 */ void CBreakable::MaterialSoundRandom(edict_t *pEdict, Materials soundMaterial, float volume) { int soundCount = 0; @@ -324,7 +315,6 @@ void CBreakable::MaterialSoundRandom(edict_t *pEdict, Materials soundMaterial, f } } -/* <8634b> ../cstrike/dlls/func_break.cpp:328 */ void CBreakable::__MAKE_VHOOK(Precache)() { const char *pGibName = NULL; @@ -402,7 +392,6 @@ void CBreakable::__MAKE_VHOOK(Precache)() } } -/* <86676> ../cstrike/dlls/func_break.cpp:401 */ void CBreakable::DamageSound() { int pitch; @@ -476,7 +465,6 @@ void CBreakable::DamageSound() } } -/* <8691c> ../cstrike/dlls/func_break.cpp:475 */ void CBreakable::BreakTouch(CBaseEntity *pOther) { float flDamage; @@ -497,7 +485,7 @@ void CBreakable::BreakTouch(CBaseEntity *pOther) pev->takedamage = DAMAGE_NO; pev->deadflag = DEAD_DEAD; pev->effects = EF_NODRAW; -#endif // REGAMEDLL_FIXES +#endif Die(); } @@ -538,8 +526,6 @@ void CBreakable::BreakTouch(CBaseEntity *pOther) // Smash the our breakable object // Break when triggered - -/* <85f2d> ../cstrike/dlls/func_break.cpp:538 */ void CBreakable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (IsBreakable()) @@ -552,13 +538,12 @@ void CBreakable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller pev->takedamage = DAMAGE_NO; pev->deadflag = DEAD_DEAD; pev->effects = EF_NODRAW; -#endif // REGAMEDLL_FIXES +#endif Die(); } } -/* <85964> ../cstrike/dlls/func_break.cpp:554 */ void CBreakable::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { // random spark if this is a 'computer' object @@ -595,8 +580,6 @@ void CBreakable::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamag // Special takedamage for func_breakable. Allows us to make // exceptions that are breakable-specific // bitsDamageType indicates the type of damage sustained ie: DMG_CRUSH - -/* <86719> ../cstrike/dlls/func_break.cpp:588 */ int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { Vector vecTemp; @@ -646,7 +629,7 @@ int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev pev->takedamage = DAMAGE_NO; pev->deadflag = DEAD_DEAD; pev->effects = EF_NODRAW; -#endif // REGAMEDLL_FIXES +#endif Die(); if (m_flDelay == 0.0f) @@ -664,7 +647,6 @@ int CBreakable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev return 1; } -/* <856fe> ../cstrike/dlls/func_break.cpp:653 */ void CBreakable::Die() { Vector vecSpot; // shard origin @@ -678,7 +660,7 @@ void CBreakable::Die() pev->takedamage = DAMAGE_NO; pev->deadflag = DEAD_DEAD; pev->effects = EF_NODRAW; -#endif // REGAMEDLL_FIXES +#endif pitch = 95 + RANDOM_LONG(0, 29); @@ -687,7 +669,7 @@ void CBreakable::Die() // The more negative pev->health, the louder // the sound should be. - fvol = RANDOM_FLOAT(0.85, 1.0) + (abs((int)pev->health) / 100.0f); + fvol = RANDOM_FLOAT(0.85f, 1.0f) + (Q_abs(int(pev->health)) / 100.0f); if (fvol > 1.0f) fvol = 1.0f; @@ -791,7 +773,7 @@ void CBreakable::Die() vecVelocity.z = 0; } - vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5; + vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5f; MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecSpot); WRITE_BYTE(TE_BREAKMODEL); @@ -827,13 +809,10 @@ void CBreakable::Die() CBaseEntity *pList[256]; int count = UTIL_EntitiesInBox(pList, ARRAYSIZE(pList), mins, maxs, FL_ONGROUND); - if (count) + for (int i = 0; i < count; ++i) { - for (int i = 0; i < count; ++i) - { - pList[i]->pev->flags &= ~FL_ONGROUND; - pList[i]->pev->groundentity = NULL; - } + pList[i]->pev->flags &= ~FL_ONGROUND; + pList[i]->pev->groundentity = NULL; } pev->solid = SOLID_NOT; @@ -853,13 +832,11 @@ void CBreakable::Die() } } -/* <86992> ../cstrike/dlls/func_break.cpp:833 */ BOOL CBreakable::IsBreakable() { return m_Material != matUnbreakableGlass; } -/* <85a99> ../cstrike/dlls/func_break.cpp:839 */ int CBreakable::__MAKE_VHOOK(DamageDecal)(int bitsDamageType) { if (m_Material == matGlass) @@ -871,13 +848,9 @@ int CBreakable::__MAKE_VHOOK(DamageDecal)(int bitsDamageType) return CBaseEntity::DamageDecal(bitsDamageType); } -/* <869b4> ../cstrike/dlls/func_break.cpp:888 */ LINK_ENTITY_TO_CLASS(func_pushable, CPushable); - -/* <85e0b> ../cstrike/dlls/func_break.cpp:886 */ IMPLEMENT_SAVERESTORE(CPushable, CBreakable); -/* <856d7> ../cstrike/dlls/func_break.cpp:893 */ void CPushable::__MAKE_VHOOK(Spawn)() { if (pev->spawnflags & SF_PUSH_BREAKABLE) @@ -905,11 +878,10 @@ void CPushable::__MAKE_VHOOK(Spawn)() UTIL_SetOrigin(pev, pev->origin); // Multiply by area of the box's cross-section (assume 1000 units^3 standard volume) - pev->skin = (int)((pev->skin * (pev->maxs.x - pev->mins.x) * (pev->maxs.y - pev->mins.y)) * 0.0005); + pev->skin = int((pev->skin * (pev->maxs.x - pev->mins.x) * (pev->maxs.y - pev->mins.y)) * 0.0005); m_soundTime = 0; } -/* <863eb> ../cstrike/dlls/func_break.cpp:920 */ void CPushable::__MAKE_VHOOK(Precache)() { for (int i = 0; i < 3; ++i) @@ -923,7 +895,6 @@ void CPushable::__MAKE_VHOOK(Precache)() } } -/* <85fa3> ../cstrike/dlls/func_break.cpp:930 */ void CPushable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "size")) @@ -950,11 +921,10 @@ void CPushable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) UTIL_SetSize(pev, VEC_HULL_MIN, VEC_HULL_MAX); break; } - } else if (FStrEq(pkvd->szKeyName, "buoyancy")) { - pev->skin = (int)Q_atof(pkvd->szValue); + pev->skin = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else @@ -962,8 +932,6 @@ void CPushable::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } // Pull the func_pushable - -/* <86c0d> ../cstrike/dlls/func_break.cpp:969 */ void CPushable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!pActivator || !pActivator->IsPlayer()) @@ -982,7 +950,6 @@ void CPushable::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, } } -/* <86b99> ../cstrike/dlls/func_break.cpp:983 */ void CPushable::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (FClassnameIs(pOther->pev, "worldspawn")) @@ -991,11 +958,10 @@ void CPushable::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) Move(pOther, 1); } -/* <86a82> ../cstrike/dlls/func_break.cpp:992 */ void CPushable::Move(CBaseEntity *pOther, int push) { entvars_t *pevToucher = pOther->pev; - int playerTouch = 0; + bool bPlayerTouch = false; // Is entity standing on this pushable ? if ((pevToucher->flags & FL_ONGROUND) && pevToucher->groundentity && VARS(pevToucher->groundentity) == pev) @@ -1017,12 +983,12 @@ void CPushable::Move(CBaseEntity *pOther, int push) return; } - playerTouch = 1; + bPlayerTouch = true; } float_precision factor; - if (playerTouch) + if (bPlayerTouch) { // Don't push away from jumping/falling players unless in water if (!(pevToucher->flags & FL_ONGROUND)) @@ -1041,7 +1007,7 @@ void CPushable::Move(CBaseEntity *pOther, int push) pev->velocity.x += pevToucher->velocity.x * factor; pev->velocity.y += pevToucher->velocity.y * factor; - float_precision length = sqrt(pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y); + float_precision length = Q_sqrt(pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y); if (push && (length > MaxSpeed())) { @@ -1049,7 +1015,7 @@ void CPushable::Move(CBaseEntity *pOther, int push) pev->velocity.y = (pev->velocity.y * MaxSpeed() / length); } - if (playerTouch) + if (bPlayerTouch) { pevToucher->velocity.x = pev->velocity.x; pevToucher->velocity.y = pev->velocity.y; @@ -1064,7 +1030,7 @@ void CPushable::Move(CBaseEntity *pOther, int push) EMIT_SOUND(ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound], 0.5, ATTN_NORM); //SetThink(StopSound); - //pev->nextthink = pev->ltime + 0.1; + //pev->nextthink = pev->ltime + 0.1f; } else STOP_SOUND(ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound]); @@ -1072,7 +1038,6 @@ void CPushable::Move(CBaseEntity *pOther, int push) } } -/* <868b0> ../cstrike/dlls/func_break.cpp:1061 */ int CPushable::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { if (pev->spawnflags & SF_PUSH_BREAKABLE) diff --git a/regamedll/dlls/func_break.h b/regamedll/dlls/func_break.h index 8d524505..0d15d4f2 100644 --- a/regamedll/dlls/func_break.h +++ b/regamedll/dlls/func_break.h @@ -67,7 +67,6 @@ typedef enum } Materials; -/* <84d53> ../cstrike/dlls/func_break.h:23 */ class CBreakable: public CBaseDelay { public: @@ -102,19 +101,19 @@ public: int DamageDecal_(int bitsDamageType); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT BreakTouch(CBaseEntity *pOther); void DamageSound(); BOOL IsBreakable(); - NOXREF BOOL SparkWhenHit(); + BOOL SparkWhenHit(); void EXPORT Die(); - BOOL Explodable() const { return ExplosionMagnitude() > 0; } - int ExplosionMagnitude() const { return pev->impulse; } + BOOL Explodable() const { return ExplosionMagnitude() > 0; } + int ExplosionMagnitude() const { return pev->impulse; } void ExplosionSetMagnitude(int magnitude) { pev->impulse = magnitude; } @@ -141,7 +140,6 @@ public: float m_flHealth; }; -/* <84da0> ../cstrike/dlls/func_break.cpp:851 */ class CPushable: public CBreakable { public: @@ -166,7 +164,7 @@ public: void Touch_(CBaseEntity *pOther); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void Move(CBaseEntity *pMover, int push); diff --git a/regamedll/dlls/func_tank.cpp b/regamedll/dlls/func_tank.cpp index 9168456c..83d9de7c 100644 --- a/regamedll/dlls/func_tank.cpp +++ b/regamedll/dlls/func_tank.cpp @@ -57,12 +57,10 @@ Vector gTankSpread[] = #endif // HOOK_GAMEDLL -#define MAX_FIRING_SPREADS ARRAYSIZE(gTankSpread) +const int MAX_FIRING_SPREADS = ARRAYSIZE(gTankSpread); -/* <8d76a> ../cstrike/dlls/func_tank.cpp:164 */ IMPLEMENT_SAVERESTORE(CFuncTank, CBaseEntity); -/* <8ea25> ../cstrike/dlls/func_tank.cpp:177 */ void CFuncTank::__MAKE_VHOOK(Spawn)() { Precache(); @@ -92,7 +90,6 @@ void CFuncTank::__MAKE_VHOOK(Spawn)() pev->oldorigin = pev->origin; } -/* <8d64d> ../cstrike/dlls/func_tank.cpp:202 */ void CFuncTank::__MAKE_VHOOK(Precache)() { if (m_iszSpriteSmoke) @@ -111,7 +108,6 @@ void CFuncTank::__MAKE_VHOOK(Precache)() } } -/* <8e19e> ../cstrike/dlls/func_tank.cpp:214 */ void CFuncTank::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "yawrate")) @@ -223,7 +219,6 @@ void CFuncTank::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <8dca8> ../cstrike/dlls/func_tank.cpp:329 */ BOOL CFuncTank::__MAKE_VHOOK(OnControls)(entvars_t *pevTest) { if (!(pev->spawnflags & SF_TANK_CANCONTROL)) @@ -239,7 +234,6 @@ BOOL CFuncTank::__MAKE_VHOOK(OnControls)(entvars_t *pevTest) return FALSE; } -/* <8eba8> ../cstrike/dlls/func_tank.cpp:342 */ BOOL CFuncTank::StartControl(CBasePlayer *pController) { if (m_pController != NULL) @@ -265,7 +259,7 @@ BOOL CFuncTank::StartControl(CBasePlayer *pController) #ifdef REGAMEDLL_FIXES m_pController->pev->viewmodel = 0; m_pController->m_iFOV = DEFAULT_FOV; -#endif // REGAMEDLL_FIXES +#endif } m_pController->m_iHideHUD |= HIDEHUD_WEAPONS; @@ -276,7 +270,6 @@ BOOL CFuncTank::StartControl(CBasePlayer *pController) return TRUE; } -/* <8ebde> ../cstrike/dlls/func_tank.cpp:372 */ void CFuncTank::StopControl() { // TODO: bring back the controllers current weapon @@ -306,7 +299,6 @@ void CFuncTank::StopControl() } } -/* <8ec15> ../cstrike/dlls/func_tank.cpp:398 */ void CFuncTank::ControllerPostFrame() { assert(m_pController != NULL); @@ -314,7 +306,7 @@ void CFuncTank::ControllerPostFrame() if (gpGlobals->time < m_flNextAttack) return; - if (m_pController->pev->button & IN_ATTACK) + if (m_pController != NULL && m_pController->pev->button & IN_ATTACK) { Vector vecForward; UTIL_MakeVectorsPrivate(pev->angles, vecForward, NULL, NULL); @@ -322,7 +314,7 @@ void CFuncTank::ControllerPostFrame() m_fireLast = gpGlobals->time - (1.0f / m_fireRate) - 0.01f; Fire(BarrelPosition(), vecForward, m_pController->pev); - if (m_pController && m_pController->IsPlayer()) + if (m_pController->IsPlayer()) { m_pController->m_iWeaponVolume = LOUD_GUN_VOLUME; } @@ -331,7 +323,6 @@ void CFuncTank::ControllerPostFrame() } } -/* <8ee12> ../cstrike/dlls/func_tank.cpp:424 */ void CFuncTank::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // player controlled turret @@ -366,13 +357,11 @@ void CFuncTank::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, } } -/* <8ef04> ../cstrike/dlls/func_tank.cpp:459 */ edict_t *CFuncTank::FindTarget(edict_t *pPlayer) { return pPlayer; } -/* <8ef2d> ../cstrike/dlls/func_tank.cpp:466 */ BOOL CFuncTank::InRange(float range) { if (range < m_minRange) @@ -384,24 +373,22 @@ BOOL CFuncTank::InRange(float range) return TRUE; } -/* <8f717> ../cstrike/dlls/func_tank.cpp:477 */ void CFuncTank::__MAKE_VHOOK(Think)() { pev->avelocity = g_vecZero; TrackTarget(); - if (fabs((float_precision)pev->avelocity.x) > 1 || fabs((float_precision)pev->avelocity.y) > 1) + if (Q_fabs(float_precision(pev->avelocity.x)) > 1 || Q_fabs(float_precision(pev->avelocity.y)) > 1) StartRotSound(); else StopRotSound(); } -/* <8efe4> ../cstrike/dlls/func_tank.cpp:488 */ void CFuncTank::TrackTarget() { TraceResult tr; edict_t *pPlayer = FIND_CLIENT_IN_PVS(edict()); - BOOL updateTime = FALSE, lineOfSight; + bool updateTime = false, lineOfSight = false; Vector angles, direction, targetPosition, barrelEnd; edict_t *pTarget = NULL; @@ -446,17 +433,16 @@ void CFuncTank::TrackTarget() return; UTIL_TraceLine(barrelEnd, targetPosition, dont_ignore_monsters, edict(), &tr); - lineOfSight = FALSE; // No line of sight, don't track if (tr.flFraction == 1.0f || tr.pHit == pTarget) { - lineOfSight = TRUE; + lineOfSight = true; CBaseEntity *pInstance = CBaseEntity::Instance(pTarget); if (InRange(range) && pInstance && pInstance->IsAlive()) { - updateTime = TRUE; + updateTime = true; m_sightOrigin = UpdateTargetPosition(pInstance); } } @@ -483,14 +469,14 @@ void CFuncTank::TrackTarget() angles.y = m_yawCenter + m_yawRange; // Don't update if you saw the player, but out of range - updateTime = FALSE; + updateTime = false; } else if (angles.y < (m_yawCenter - m_yawRange)) { angles.y = (m_yawCenter - m_yawRange); // Don't update if you saw the player, but out of range - updateTime = FALSE; + updateTime = false; } if (updateTime) @@ -539,9 +525,9 @@ void CFuncTank::TrackTarget() return; } - if (CanFire() && ((fabs(distX) < m_pitchTolerance && fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT))) + if (CanFire() && ((Q_fabs(distX) < m_pitchTolerance && Q_fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT))) { - BOOL fire = FALSE; + bool fire = false; Vector forward; UTIL_MakeVectorsPrivate(pev->angles, forward, NULL, NULL); @@ -552,11 +538,11 @@ void CFuncTank::TrackTarget() if (tr.pHit == pTarget) { - fire = TRUE; + fire = true; } } else - fire = TRUE; + fire = true; if (fire) { @@ -570,8 +556,6 @@ void CFuncTank::TrackTarget() } // If barrel is offset, add in additional rotation - -/* <8ef79> ../cstrike/dlls/func_tank.cpp:632 */ void CFuncTank::AdjustAnglesForBarrel(Vector &angles, float distance) { float_precision r2, d2; @@ -584,20 +568,18 @@ void CFuncTank::AdjustAnglesForBarrel(Vector &angles, float distance) if (m_barrelPos.y) { r2 = m_barrelPos.y * m_barrelPos.y; - angles.y += (180.0f / M_PI) * atan2(m_barrelPos.y, sqrt(d2 - r2)); + angles.y += (180.0f / M_PI) * Q_atan2(m_barrelPos.y, Q_sqrt(d2 - r2)); } if (m_barrelPos.z) { r2 = m_barrelPos.z * m_barrelPos.z; - angles.x += (180.0f / M_PI) * atan2(-m_barrelPos.z, sqrt(d2 - r2)); + angles.x += (180.0f / M_PI) * Q_atan2(-m_barrelPos.z, Q_sqrt(d2 - r2)); } } } // Fire targets and spawn sprites - -/* <8d4ad> ../cstrike/dlls/func_tank.cpp:656 */ void CFuncTank::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) { if (m_fireLast != 0.0f) @@ -630,7 +612,6 @@ void CFuncTank::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forwar m_fireLast = gpGlobals->time; } -/* <8f830> ../cstrike/dlls/func_tank.cpp:684 */ void CFuncTank::TankTrace(const Vector &vecStart, const Vector &vecForward, const Vector &vecSpread, TraceResult &tr) { // get circular gaussian spread @@ -652,7 +633,6 @@ void CFuncTank::TankTrace(const Vector &vecStart, const Vector &vecForward, cons UTIL_TraceLine(vecStart, vecEnd, dont_ignore_monsters, edict(), &tr); } -/* <8f9c0> ../cstrike/dlls/func_tank.cpp:703 */ void CFuncTank::StartRotSound() { if (!pev->noise || (pev->spawnflags & SF_TANK_SOUNDON)) @@ -664,7 +644,6 @@ void CFuncTank::StartRotSound() EMIT_SOUND(edict(), CHAN_STATIC, (char *)STRING(pev->noise), 0.85, ATTN_NORM); } -/* <8fa1b> ../cstrike/dlls/func_tank.cpp:712 */ void CFuncTank::StopRotSound() { if (pev->spawnflags & SF_TANK_SOUNDON) @@ -675,10 +654,8 @@ void CFuncTank::StopRotSound() pev->spawnflags &= ~SF_TANK_SOUNDON; } -/* <8fa65> ../cstrike/dlls/func_tank.cpp:724 */ LINK_ENTITY_TO_CLASS(func_tank, CFuncTankGun); -/* <8c3d5> ../cstrike/dlls/func_tank.cpp:726 */ void CFuncTankGun::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) { if (m_fireLast != 0.0f) @@ -686,7 +663,7 @@ void CFuncTankGun::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &for // FireBullets needs gpGlobals->v_up, etc. UTIL_MakeAimVectors(pev->angles); - int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate); + int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate); if (bulletCount > 0) { @@ -716,13 +693,9 @@ void CFuncTankGun::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &for CFuncTank::Fire(barrelEnd, forward, pevAttacker); } -/* <8fb34> ../cstrike/dlls/func_tank.cpp:785 */ LINK_ENTITY_TO_CLASS(func_tanklaser, CFuncTankLaser); - -/* <8e07c> ../cstrike/dlls/func_tank.cpp:793 */ IMPLEMENT_SAVERESTORE(CFuncTankLaser, CFuncTank); -/* <8deed> ../cstrike/dlls/func_tank.cpp:795 */ void CFuncTankLaser::__MAKE_VHOOK(Activate)() { if (!GetLaser()) @@ -736,7 +709,6 @@ void CFuncTankLaser::__MAKE_VHOOK(Activate)() } } -/* <8e8ca> ../cstrike/dlls/func_tank.cpp:809 */ void CFuncTankLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "laserentity")) @@ -748,7 +720,6 @@ void CFuncTankLaser::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CFuncTank::KeyValue(pkvd); } -/* <8dd79> ../cstrike/dlls/func_tank.cpp:821 */ CLaser *CFuncTankLaser::GetLaser() { if (m_pLaser != NULL) @@ -773,7 +744,6 @@ CLaser *CFuncTankLaser::GetLaser() return m_pLaser; } -/* <8f809> ../cstrike/dlls/func_tank.cpp:845 */ void CFuncTankLaser::__MAKE_VHOOK(Think)() { if (m_pLaser != NULL && gpGlobals->time > m_laserTime) @@ -784,7 +754,6 @@ void CFuncTankLaser::__MAKE_VHOOK(Think)() CFuncTank::Think(); } -/* <8df51> ../cstrike/dlls/func_tank.cpp:854 */ void CFuncTankLaser::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) { int i; @@ -795,7 +764,8 @@ void CFuncTankLaser::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &f // TankTrace needs gpGlobals->v_up, etc. UTIL_MakeAimVectors(pev->angles); - int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate); + int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate); + if (bulletCount) { for (i = 0; i < bulletCount; ++i) @@ -819,24 +789,22 @@ void CFuncTankLaser::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &f } } -/* <8fc2f> ../cstrike/dlls/func_tank.cpp:893 */ LINK_ENTITY_TO_CLASS(func_tankrocket, CFuncTankRocket); -/* <8e736> ../cstrike/dlls/func_tank.cpp:895 */ void CFuncTankRocket::__MAKE_VHOOK(Precache)() { UTIL_PrecacheOther("rpg_rocket"); CFuncTank::Precache(); } -/* <8d7b6> ../cstrike/dlls/func_tank.cpp:903 */ void CFuncTankRocket::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) { int i; if (m_fireLast != 0.0f) { - int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate); + int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate); + if (bulletCount > 0) { for (i = 0; i < bulletCount; ++i) @@ -851,10 +819,8 @@ void CFuncTankRocket::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector & CFuncTank::Fire(barrelEnd, forward, pev); } -/* <8fcfe> ../cstrike/dlls/func_tank.cpp:930 */ LINK_ENTITY_TO_CLASS(func_tankmortar, CFuncTankMortar); -/* <8e790> ../cstrike/dlls/func_tank.cpp:933 */ void CFuncTankMortar::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "iMagnitude")) @@ -866,12 +832,11 @@ void CFuncTankMortar::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CFuncTank::KeyValue(pkvd); } -/* <8dbfa> ../cstrike/dlls/func_tank.cpp:945 */ void CFuncTankMortar::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) { if (m_fireLast != 0.0f) { - int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate); + int bulletCount = int((gpGlobals->time - m_fireLast) * m_fireRate); // Only create 1 explosion if (bulletCount > 0) @@ -892,17 +857,13 @@ void CFuncTankMortar::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector & CFuncTank::Fire(barrelEnd, forward, pev); } -/* <8fdcd> ../cstrike/dlls/func_tank.cpp:988 */ LINK_ENTITY_TO_CLASS(func_tankcontrols, CFuncTankControls); - -/* <8d71d> ../cstrike/dlls/func_tank.cpp:995 */ IMPLEMENT_SAVERESTORE(CFuncTankControls, CBaseEntity); -/* <8d310> ../cstrike/dlls/func_tank.cpp:1003 */ void CFuncTankControls::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // pass the Use command onto the controls - if (m_pTank) + if (m_pTank != NULL) { m_pTank->Use(pActivator, pCaller, useType, value); } @@ -911,7 +872,6 @@ void CFuncTankControls::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity * assert(m_pTank != NULL); } -/* <8d39a> ../cstrike/dlls/func_tank.cpp:1012 */ void CFuncTankControls::__MAKE_VHOOK(Think)() { edict_t *pTarget = NULL; @@ -920,7 +880,7 @@ void CFuncTankControls::__MAKE_VHOOK(Think)() { pTarget = FIND_ENTITY_BY_TARGETNAME(pTarget, STRING(pev->target)); } - while (!FNullEnt(pTarget) && Q_strncmp(STRING(pTarget->v.classname), "func_tank", 9)); + while (!FNullEnt(pTarget) && Q_strncmp(STRING(pTarget->v.classname), "func_tank", 9) != 0); if (FNullEnt(pTarget)) { @@ -931,7 +891,6 @@ void CFuncTankControls::__MAKE_VHOOK(Think)() m_pTank = static_cast(Instance(pTarget)); } -/* <8d373> ../cstrike/dlls/func_tank.cpp:1030 */ void CFuncTankControls::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_TRIGGER; diff --git a/regamedll/dlls/func_tank.h b/regamedll/dlls/func_tank.h index 044a0311..a21a8b4b 100644 --- a/regamedll/dlls/func_tank.h +++ b/regamedll/dlls/func_tank.h @@ -48,7 +48,6 @@ enum TANKBULLET TANK_BULLET_12MM, // explosion? }; -/* <8c75e> ../cstrike/dlls/func_tank.cpp:46 */ class CFuncTank: public CBaseEntity { public: @@ -78,7 +77,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); -#endif // HOOK_GAMEDLL +#endif public: void TrackTarget(); @@ -157,7 +156,6 @@ protected: int m_iszMaster; // Master entity (game_team_master or multisource) }; -/* <8c79a> ../cstrike/dlls/func_tank.cpp:719 */ class CFuncTankGun: public CFuncTank { public: @@ -167,11 +165,10 @@ public: void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); -#endif // HOOK_GAMEDLL +#endif }; -/* <8c7e8> ../cstrike/dlls/func_tank.cpp:768 */ class CFuncTankLaser: public CFuncTank { public: @@ -191,7 +188,7 @@ public: void Think_(); void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); -#endif // HOOK_GAMEDLL +#endif CLaser *GetLaser(); @@ -203,7 +200,6 @@ private: float m_laserTime; }; -/* <8c836> ../cstrike/dlls/func_tank.cpp:887 */ class CFuncTankRocket: public CFuncTank { public: @@ -215,11 +211,10 @@ public: void Precache_(); void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); -#endif // HOOK_GAMEDLL +#endif }; -/* <8c884> ../cstrike/dlls/func_tank.cpp:924 */ class CFuncTankMortar: public CFuncTank { public: @@ -231,11 +226,10 @@ public: void KeyValue_(KeyValueData *pkvd); void Fire_(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker); -#endif // HOOK_GAMEDLL +#endif }; -/* <8c8d2> ../cstrike/dlls/func_tank.cpp:974 */ class CFuncTankControls: public CBaseEntity { public: @@ -254,7 +248,7 @@ public: void Think_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 076d120b..d2758ca4 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -111,11 +111,8 @@ void GameDLL_Version_f() CONSOLE_ECHO("ReGameDLL API version %i.%i\n", REGAMEDLL_API_VERSION_MAJOR, REGAMEDLL_API_VERSION_MINOR); } -/* <9c900> ../cstrike/dlls/game.cpp:500 */ void EXT_FUNC GameDLLInit() { - g_bIsCzeroGame = UTIL_IsGame("czero"); - g_psv_gravity = CVAR_GET_POINTER("sv_gravity"); g_psv_aim = CVAR_GET_POINTER("sv_aim"); g_footsteps = CVAR_GET_POINTER("mp_footsteps"); @@ -163,6 +160,7 @@ void EXT_FUNC GameDLLInit() // Remove unused cvars #ifndef REGAMEDLL_FIXES + CVAR_REGISTER(&sk_plr_9mm_bullet1); CVAR_REGISTER(&sk_plr_9mm_bullet2); CVAR_REGISTER(&sk_plr_9mm_bullet3); @@ -205,6 +203,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&sk_scientist_heal1); CVAR_REGISTER(&sk_scientist_heal2); CVAR_REGISTER(&sk_scientist_heal3); + #endif // REGAMEDLL_FIXES #ifdef REGAMEDLL_ADD diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 4935e5d3..18358028 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -136,7 +136,7 @@ extern cvar_t sk_scientist_heal3; extern cvar_t maxmoney; extern cvar_t round_infinite; -#endif // REGAMEDLL_ADD +#endif void GameDLLInit(); diff --git a/regamedll/dlls/gamerules.cpp b/regamedll/dlls/gamerules.cpp index f9e4c642..4fb2cb54 100644 --- a/regamedll/dlls/gamerules.cpp +++ b/regamedll/dlls/gamerules.cpp @@ -5,11 +5,10 @@ */ #ifndef HOOK_GAMEDLL -CHalfLifeMultiplay *g_pGameRules = NULL; +CGameRules *g_pGameRules = NULL; -#endif //HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/gamerules.cpp:36 */ BOOL CGameRules::__MAKE_VHOOK(CanHaveAmmo)(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry) { int iAmmoIndex; @@ -31,7 +30,6 @@ BOOL CGameRules::__MAKE_VHOOK(CanHaveAmmo)(CBasePlayer *pPlayer, const char *psz return FALSE; } -/* ../cstrike/dlls/gamerules.cpp:59 */ edict_t *CGameRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer) { // gat valid spawn point @@ -39,23 +37,22 @@ edict_t *CGameRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer) // Move the player to the place it said. #ifndef PLAY_GAMEDLL - pPlayer->pev->origin = VARS(pentSpawnSpot)->origin + Vector(0, 0, 1); + pPlayer->pev->origin = pentSpawnSpot->v.origin + Vector(0, 0, 1); #else // TODO: fix test demo - pPlayer->pev->origin = VARS(pentSpawnSpot)->origin; + pPlayer->pev->origin = pentSpawnSpot->v.origin; pPlayer->pev->origin.z += 1; -#endif // PLAY_GAMEDLL +#endif pPlayer->pev->v_angle = g_vecZero; pPlayer->pev->velocity = g_vecZero; - pPlayer->pev->angles = VARS(pentSpawnSpot)->angles; + pPlayer->pev->angles = pentSpawnSpot->v.angles; pPlayer->pev->punchangle = g_vecZero; pPlayer->pev->fixangle = 1; return pentSpawnSpot; } -/* ../cstrike/dlls/gamerules.cpp:75 */ BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) { // only living players can have items @@ -64,9 +61,7 @@ BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlay return FALSE; } - CCSBotManager *ctrl = TheCSBots(); - - if (pPlayer->IsBot() && ctrl != NULL && !ctrl->IsWeaponUseable(pWeapon)) + if (pPlayer->IsBot() && TheCSBots() != NULL && !TheCSBots()->IsWeaponUseable(pWeapon)) { return FALSE; } @@ -96,10 +91,9 @@ BOOL CGameRules::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlay return TRUE; } -/* ../cstrike/dlls/gamerules.cpp:119 */ void CGameRules::__MAKE_VHOOK(RefreshSkillData)() { - int iSkill = (int)CVAR_GET_FLOAT("skill"); + int iSkill = int(CVAR_GET_FLOAT("skill")); if (iSkill < 1) iSkill = 1; @@ -119,7 +113,6 @@ void CGameRules::__MAKE_VHOOK(RefreshSkillData)() gSkillData.healthkitCapacity = 15; } -/* ../cstrike/dlls/gamerules.cpp:157 */ CGameRules *InstallGameRules() { SERVER_COMMAND("exec game.cfg\n"); diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index 6b55c1c3..d2f498b4 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -128,6 +128,8 @@ enum RewardAccount REWARD_KILLED_VIP = 2500, REWARD_VIP_HAVE_SELF_RESCUED = 2500, + REWARD_TAKEN_HOSTAGE = 1000 + }; // custom enum @@ -185,7 +187,6 @@ enum class CItem; -/* <166901> ../cstrike/dlls/gamerules.h:86 */ class CGameRules { public: @@ -262,7 +263,7 @@ public: BOOL CanHavePlayerItem_(CBasePlayer *pPlayer, CBasePlayerItem *pItem); BOOL CanHaveAmmo_(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry); -#endif // HOOK_GAMEDLL +#endif public: BOOL m_bFreezePeriod; @@ -416,9 +417,9 @@ public: virtual int DeadPlayerAmmo(CBasePlayer *pPlayer); virtual const char *GetTeamID(CBaseEntity *pEntity) { return ""; } virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget); - virtual BOOL PlayTextureSounds() { return FALSE;} + virtual BOOL PlayTextureSounds() { return FALSE; } virtual BOOL FAllowMonsters(); - virtual void EndMultiplayerGame() { GoToIntermission();} + virtual void EndMultiplayerGame() { GoToIntermission(); } virtual void ServerDeactivate(); virtual void CheckMapConditions(); @@ -536,7 +537,7 @@ public: void CareerRestart(); bool ShouldSkipSpawn() const { return m_bSkipSpawn; } void MarkSpawnSkipped() { m_bSkipSpawn = false; } - NOXREF void PlayerJoinedTeam(CBasePlayer *pPlayer) { } + void PlayerJoinedTeam(CBasePlayer *pPlayer) { } float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; } BOOL TeamFull(int team_id); BOOL TeamStacked(int newTeam_id, int curTeam_id); @@ -627,7 +628,7 @@ public: int m_iTotalArmourCount; int m_iUnBalancedRounds; // keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2 int m_iNumEscapeRounds; // keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds - int m_iMapVotes[ MAX_VOTE_MAPS ]; + int m_iMapVotes[MAX_VOTE_MAPS]; int m_iLastPick; int m_iMaxMapTime; int m_iMaxRounds; @@ -638,7 +639,7 @@ public: float m_flForceChaseCamValue; float m_flFadeToBlackValue; CBasePlayer *m_pVIP; - CBasePlayer *VIPQueue[ MAX_VIP_QUEUES ]; + CBasePlayer *VIPQueue[MAX_VIP_QUEUES]; protected: float m_flIntermissionEndTime; @@ -671,7 +672,6 @@ typedef struct mapcycle_s } mapcycle_t; -/* <11192b> ../cstrike/dlls/multiplay_gamerules.cpp:257 */ class CMapInfo: public CPointEntity { public: @@ -683,14 +683,13 @@ public: void Spawn_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif public: int m_iBuyingStatus; float m_flBombRadius; }; -/* <111732> ../cstrike/dlls/multiplay_gamerules.cpp:292 */ class CCStrikeGameMgrHelper: public IVoiceGameMgrHelper { public: @@ -700,14 +699,19 @@ public: bool CanPlayerHearPlayer_(CBasePlayer *pListener, CBasePlayer *pSender); -#endif // HOOK_GAMEDLL +#endif }; -extern CHalfLifeMultiplay *g_pGameRules; +extern CGameRules *g_pGameRules; CGameRules *InstallGameRules(); +inline CHalfLifeMultiplay *CSGameRules() +{ + return reinterpret_cast(g_pGameRules); +} + bool IsBotSpeaking(); void SV_Continue_f(); void SV_Tutor_Toggle_f(); diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index 38850f7a..0460e1e2 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -24,12 +24,10 @@ TYPEDESCRIPTION CGrenade::m_SaveData[] = DEFINE_FIELD(CGrenade, m_usEvent, FIELD_INTEGER), }; -#endif // HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/ggrenade.cpp:52 */ LINK_ENTITY_TO_CLASS(grenade, CGrenade); -/* ../cstrike/dlls/ggrenade.cpp:60 */ void CGrenade::Explode(Vector vecSrc, Vector vecAim) { TraceResult tr; @@ -38,8 +36,6 @@ void CGrenade::Explode(Vector vecSrc, Vector vecAim) } // UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution. - -/* ../cstrike/dlls/ggrenade.cpp:69 */ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType) { float flRndSound; // sound randomizer @@ -57,11 +53,7 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType) int iContents = UTIL_PointContents(pev->origin); CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3); - entvars_t *pevOwner; - if (pev->owner) - pevOwner = VARS(pev->owner); - else - pevOwner = NULL; + entvars_t *pevOwner = VARS(pev->owner); if (TheBots != NULL) { @@ -101,11 +93,9 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType) } } -/* ../cstrike/dlls/ggrenade.cpp:186 */ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType) { float flRndSound; // sound randomizer - CHalfLifeMultiplay *mp = g_pGameRules; pev->model = iStringNull; // invisible pev->solid = SOLID_NOT; // intangible @@ -113,9 +103,9 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType) UTIL_ScreenShake(pTrace->vecEndPos, 25, 150, 1, 3000); - mp->m_bTargetBombed = true; + CSGameRules()->m_bTargetBombed = true; - if (mp->IsCareer()) + if (CSGameRules()->IsCareer()) { if (TheCareerTasks != NULL) { @@ -124,7 +114,7 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType) } m_bJustBlew = true; - mp->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); // Pull out of the wall a bit if (pTrace->flFraction != 1.0f) @@ -178,16 +168,12 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType) EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/c4_explode1.wav", VOL_NORM, 0.25); CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3); - entvars_t *pevOwner; - if (pev->owner) - pevOwner = VARS(pev->owner); - else - pevOwner = NULL; + entvars_t *pevOwner = VARS(pev->owner); pev->owner = NULL; - RadiusDamage(pev, pevOwner, mp->m_flBombRadius, CLASS_NONE, bitsDamageType); + RadiusDamage(pev, pevOwner, CSGameRules()->m_flBombRadius, CLASS_NONE, bitsDamageType); - if (mp->IsCareer()) + if (CSGameRules()->IsCareer()) { if (TheCareerTasks != NULL) { @@ -235,7 +221,6 @@ void CGrenade::Explode2(TraceResult *pTrace, int bitsDamageType) } } -/* ../cstrike/dlls/ggrenade.cpp:330 */ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType) { float flRndSound; // sound randomizer @@ -274,11 +259,7 @@ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType) CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3); - entvars_t *pevOwner; - if (pev->owner) - pevOwner = VARS(pev->owner); - else - pevOwner = NULL; + entvars_t *pevOwner = VARS(pev->owner); if (TheBots != NULL) { @@ -313,7 +294,6 @@ void CGrenade::Explode3(TraceResult *pTrace, int bitsDamageType) Create("spark_shower", pev->origin, pTrace->vecPlaneNormal, NULL); } -/* ../cstrike/dlls/ggrenade.cpp:420 */ NOXREF void CGrenade::SG_Explode(TraceResult *pTrace, int bitsDamageType) { float flRndSound; // sound randomizer @@ -363,7 +343,6 @@ NOXREF void CGrenade::SG_Explode(TraceResult *pTrace, int bitsDamageType) } } -/* ../cstrike/dlls/ggrenade.cpp:475 */ void CGrenade::Smoke3_C() { if (UTIL_PointContents(pev->origin) == CONTENTS_WATER) @@ -386,7 +365,6 @@ void CGrenade::Smoke3_C() UTIL_Remove(this); } -/* ../cstrike/dlls/ggrenade.cpp:497 */ void CGrenade::Smoke3_B() { if (UTIL_PointContents(pev->origin) == CONTENTS_WATER) @@ -406,11 +384,10 @@ void CGrenade::Smoke3_B() MESSAGE_END(); } - pev->nextthink = gpGlobals->time + 0.15; + pev->nextthink = gpGlobals->time + 0.15f; SetThink(&CGrenade::Smoke3_A); } -/* ../cstrike/dlls/ggrenade.cpp:520 */ void CGrenade::Smoke3_A() { if (UTIL_PointContents(pev->origin) == CONTENTS_WATER) @@ -431,7 +408,6 @@ void CGrenade::Smoke3_A() } } -/* ../cstrike/dlls/ggrenade.cpp:544 */ void CGrenade::Smoke2() { if (UTIL_PointContents(pev->origin) == CONTENTS_WATER) @@ -454,7 +430,6 @@ void CGrenade::Smoke2() UTIL_Remove(this); } -/* ../cstrike/dlls/ggrenade.cpp:567 */ void CGrenade::Smoke() { if (UTIL_PointContents(pev->origin) == CONTENTS_WATER) @@ -477,7 +452,6 @@ void CGrenade::Smoke() UTIL_Remove(this); } -/* ../cstrike/dlls/ggrenade.cpp:591 */ void CGrenade::SG_Smoke() { int iMaxSmokePuffs = 100; @@ -496,12 +470,12 @@ void CGrenade::SG_Smoke() origin = gpGlobals->v_forward * RANDOM_FLOAT(3, 8); - flSmokeInterval = RANDOM_FLOAT(1.5, 3.5) * iMaxSmokePuffs; + flSmokeInterval = RANDOM_FLOAT(1.5f, 3.5f) * iMaxSmokePuffs; R_angle = m_angle / (180.00433335 / M_PI); - x_old = cos((float_precision)R_angle); - y_old = sin((float_precision)R_angle); + x_old = Q_cos(float_precision(R_angle)); + y_old = Q_sin(float_precision(R_angle)); angle.x = origin.x * x_old - origin.y * y_old; angle.y = origin.x * y_old + origin.y * x_old; @@ -529,22 +503,18 @@ void CGrenade::SG_Smoke() } } -/* ../cstrike/dlls/ggrenade.cpp:664 */ void CGrenade::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) { Detonate(); } // Timed grenade, this think is called when time runs out. - -/* ../cstrike/dlls/ggrenade.cpp:671 */ void CGrenade::DetonateUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { SetThink(&CGrenade::Detonate); pev->nextthink = gpGlobals->time; } -/* ../cstrike/dlls/ggrenade.cpp:677 */ void CGrenade::PreDetonate() { CSoundEnt::InsertSound(bits_SOUND_DANGER, pev->origin, 400, 0.3); @@ -553,7 +523,6 @@ void CGrenade::PreDetonate() pev->nextthink = gpGlobals->time + 1.0f; } -/* ../cstrike/dlls/ggrenade.cpp:686 */ void CGrenade::Detonate() { TraceResult tr; @@ -564,7 +533,6 @@ void CGrenade::Detonate() Explode(&tr, DMG_BLAST); } -/* ../cstrike/dlls/ggrenade.cpp:698 */ void CGrenade::SG_Detonate() { TraceResult tr; @@ -590,9 +558,8 @@ void CGrenade::SG_Detonate() CBaseEntity *pEnt = CBaseEntity::Instance(pentFind); - if (pEnt) + if (pEnt != NULL) { - //float_precision float fDistance = (pEnt->pev->origin - pev->origin).Length(); if (fDistance != 0.0f && fDistance <= 250.0f) @@ -617,7 +584,6 @@ void CGrenade::SG_Detonate() SetThink(&CGrenade::SG_Smoke); } -/* ../cstrike/dlls/ggrenade.cpp:752 */ void CGrenade::Detonate2() { TraceResult tr; @@ -629,7 +595,6 @@ void CGrenade::Detonate2() Explode2(&tr, DMG_BLAST); } -/* ../cstrike/dlls/ggrenade.cpp:764 */ void CGrenade::Detonate3() { TraceResult tr; @@ -641,8 +606,6 @@ void CGrenade::Detonate3() } // Contact grenade, explode when it touches something - -/* ../cstrike/dlls/ggrenade.cpp:780 */ void CGrenade::ExplodeTouch(CBaseEntity *pOther) { TraceResult tr; @@ -655,7 +618,6 @@ void CGrenade::ExplodeTouch(CBaseEntity *pOther) Explode(&tr, DMG_BLAST); } -/* ../cstrike/dlls/ggrenade.cpp:794 */ void CGrenade::DangerSoundThink() { if (!IsInWorld()) @@ -673,7 +635,6 @@ void CGrenade::DangerSoundThink() } } -/* ../cstrike/dlls/ggrenade.cpp:812 */ void CGrenade::BounceTouch(CBaseEntity *pOther) { // don't hit the guy that launched this grenade @@ -740,7 +701,6 @@ void CGrenade::BounceTouch(CBaseEntity *pOther) } } -/* ../cstrike/dlls/ggrenade.cpp:880 */ void CGrenade::SlideTouch(CBaseEntity *pOther) { // don't hit the guy that launched this grenade @@ -758,7 +718,6 @@ void CGrenade::SlideTouch(CBaseEntity *pOther) } } -/* ../cstrike/dlls/ggrenade.cpp:904 */ void CGrenade::__MAKE_VHOOK(BounceSound)() { if (pev->dmg > 50.0f) @@ -775,7 +734,6 @@ void CGrenade::__MAKE_VHOOK(BounceSound)() } } -/* ../cstrike/dlls/ggrenade.cpp:919 */ void CGrenade::TumbleThink() { if (!IsInWorld()) @@ -809,7 +767,6 @@ void CGrenade::TumbleThink() } } -/* ../cstrike/dlls/ggrenade.cpp:949 */ void CGrenade::SG_TumbleThink() { if (!IsInWorld()) @@ -846,19 +803,12 @@ void CGrenade::SG_TumbleThink() } } -/* ../cstrike/dlls/ggrenade.cpp:985 */ void CGrenade::__MAKE_VHOOK(Spawn)() { m_iBounceCount = 0; pev->movetype = MOVETYPE_BOUNCE; - if (pev->classname) - { - RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); - } - MAKE_STRING_CLASS("grenade", pev); - AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); m_bIsC4 = false; pev->solid = SOLID_BBOX; @@ -870,7 +820,6 @@ void CGrenade::__MAKE_VHOOK(Spawn)() m_fRegisteredSound = FALSE; } -/* ../cstrike/dlls/ggrenade.cpp:1000 */ NOXREF CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); @@ -899,7 +848,6 @@ NOXREF CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Ve return pGrenade; } -/* ../cstrike/dlls/ggrenade.cpp:1028 */ CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); @@ -934,7 +882,6 @@ CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vec return pGrenade; } -/* ../cstrike/dlls/ggrenade.cpp:1069 */ CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); @@ -976,7 +923,6 @@ CGrenade *CGrenade::ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecV return pGrenade; } -/* ../cstrike/dlls/ggrenade.cpp:1113 */ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!m_bIsC4) @@ -1004,7 +950,7 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, TheBots->OnEvent(EVENT_BOMB_DEFUSING, pActivator); } - if (g_pGameRules->IsCareer()) + if (CSGameRules()->IsCareer()) { if (TheCareerTasks != NULL) { @@ -1039,7 +985,7 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict())); - // TODO show messages on clients on event + // TODO: show messages on clients on event ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit"); EMIT_SOUND(ENT(player->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM); @@ -1054,17 +1000,12 @@ void CGrenade::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, } } -/* ../cstrike/dlls/ggrenade.cpp:1178 */ CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecAngles) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); pGrenade->pev->movetype = MOVETYPE_TOSS; - if (pGrenade->pev->classname) - RemoveEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME); - MAKE_STRING_CLASS("grenade", pGrenade->pev); - AddEntityHashValue(pGrenade->pev, STRING(pGrenade->pev->classname), CLASSNAME); pGrenade->pev->solid = SOLID_BBOX; @@ -1085,8 +1026,8 @@ CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vec pGrenade->pev->spawnflags = SF_DETONATE; pGrenade->pev->nextthink = gpGlobals->time + 0.1f; - pGrenade->m_flC4Blow = gpGlobals->time + g_pGameRules->m_iC4Timer; - pGrenade->m_flNextFreqInterval = (g_pGameRules->m_iC4Timer / 4); + pGrenade->m_flC4Blow = gpGlobals->time + CSGameRules()->m_iC4Timer; + pGrenade->m_flNextFreqInterval = float(CSGameRules()->m_iC4Timer / 4); pGrenade->m_flNextFreq = gpGlobals->time; pGrenade->m_iCurWave = 0; @@ -1113,7 +1054,6 @@ CGrenade *CGrenade::ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vec return pGrenade; } -/* ../cstrike/dlls/ggrenade.cpp:1238 */ CGrenade *CGrenade::ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent) { CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL); @@ -1150,7 +1090,6 @@ CGrenade *CGrenade::ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vect return pGrenade; } -/* ../cstrike/dlls/ggrenade.cpp:1284 */ void AnnounceFlashInterval(float interval, float offset) { if (!g_bIsCzeroGame) @@ -1160,12 +1099,11 @@ void AnnounceFlashInterval(float interval, float offset) WRITE_BYTE(1); WRITE_STRING("bombticking"); WRITE_BYTE(255); - WRITE_SHORT((int)interval); // interval - WRITE_SHORT((int)offset); + WRITE_SHORT(int(interval)); // interval + WRITE_SHORT(int(offset)); MESSAGE_END(); } -/* ../cstrike/dlls/ggrenade.cpp:1300 */ void CGrenade::C4Think() { if (!IsInWorld()) @@ -1358,7 +1296,7 @@ void CGrenade::C4Think() WRITE_BYTE(0); MESSAGE_END(); - if (g_pGameRules->IsCareer() && !pPlayer->IsBot()) + if (CSGameRules()->IsCareer() && !pPlayer->IsBot()) { if (TheCareerTasks != NULL) { @@ -1366,8 +1304,8 @@ void CGrenade::C4Think() } } - g_pGameRules->m_bBombDefused = true; - g_pGameRules->CheckWinConditions(); + CSGameRules()->m_bBombDefused = true; + CSGameRules()->CheckWinConditions(); // give the defuser credit for defusing the bomb m_pBombDefuser->pev->frags += 3.0f; @@ -1398,33 +1336,29 @@ void CGrenade::C4Think() } } -/* ../cstrike/dlls/ggrenade.cpp:1523 */ void CGrenade::C4Touch(CBaseEntity *pOther) { ; } -/* ../cstrike/dlls/ggrenade.cpp:1528 */ NOXREF void CGrenade::UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code) { - edict_t *pentFind; - edict_t *pentOwner; - if (!pevOwner) return; + edict_t *pentFind = NULL; CBaseEntity *pOwner = CBaseEntity::Instance(pevOwner); - pentOwner = pOwner->edict(); - - pentFind = FIND_ENTITY_BY_CLASSNAME(NULL, "grenade"); - while (!FNullEnt(pentFind)) + while ((pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade")) != NULL) { + if (FNullEnt(pentFind)) + break; + CBaseEntity *pEnt = Instance(pentFind); if (pEnt != NULL) { - if ((pEnt->pev->spawnflags & SF_DETONATE) && pEnt->pev->owner == pentOwner) + if ((pEnt->pev->spawnflags & SF_DETONATE) && pEnt->pev->owner == pOwner->edict()) { if (code == SATCHEL_DETONATE) pEnt->Use(pOwner, pOwner, USE_ON, 0); @@ -1435,9 +1369,7 @@ NOXREF void CGrenade::UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code) } } } - pentFind = FIND_ENTITY_BY_CLASSNAME(pentFind, "grenade"); } } -/* ../cstrike/dlls/ggrenade.cpp:1579 */ IMPLEMENT_SAVERESTORE(CGrenade, CBaseMonster); diff --git a/regamedll/dlls/globals.cpp b/regamedll/dlls/globals.cpp index 95e57c55..f38f5f48 100644 --- a/regamedll/dlls/globals.cpp +++ b/regamedll/dlls/globals.cpp @@ -6,15 +6,17 @@ #ifndef HOOK_GAMEDLL const Vector g_vecZero = Vector(0, 0, 0); -u_long g_ulFrameCount = 0; +NOXREF u_long g_ulFrameCount = 0; -#endif // HOOK_GAMEDLL +#endif int g_Language; -u_long g_ulModelIndexEyes; +NOXREF u_long g_ulModelIndexEyes; Vector g_vecAttackDir; int g_iSkillLevel; int gDisplayTitle; BOOL g_fGameOver; bool g_bIsCzeroGame = false; +bool g_bAllowedCSBot = false; +bool g_bHostageImprov = false; diff --git a/regamedll/dlls/globals.h b/regamedll/dlls/globals.h index 15889dad..5e5e2a8b 100644 --- a/regamedll/dlls/globals.h +++ b/regamedll/dlls/globals.h @@ -35,13 +35,15 @@ extern const Vector g_vecZero; extern int g_Language; -extern NOXREF u_long g_ulFrameCount; -extern NOXREF u_long g_ulModelIndexEyes; +extern u_long g_ulFrameCount; +extern u_long g_ulModelIndexEyes; extern Vector g_vecAttackDir; extern int g_iSkillLevel; extern int gDisplayTitle; extern BOOL g_fGameOver; extern bool g_bIsCzeroGame; +extern bool g_bAllowedCSBot; +extern bool g_bHostageImprov; #endif // GLOBALS_H diff --git a/regamedll/dlls/h_ai.cpp b/regamedll/dlls/h_ai.cpp index d2f00bf5..173f025b 100644 --- a/regamedll/dlls/h_ai.cpp +++ b/regamedll/dlls/h_ai.cpp @@ -2,7 +2,6 @@ BOOL g_fDrawLines = FALSE; -/* ../cstrike/dlls/h_ai.cpp:47 */ NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize) { // don't look through water @@ -41,8 +40,6 @@ NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecT // VecCheckToss - returns the velocity at which an object should be lobbed from vecspot1 to land near vecspot2. // returns g_vecZero if toss is not feasible. - -/* ../cstrike/dlls/h_ai.cpp:78 */ NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj) { TraceResult tr; @@ -71,8 +68,8 @@ NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpo // How much time does it take to get there? // get a rough idea of how high it can be thrown - vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5; - UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0,0,500), ignore_monsters, ENT(pev), &tr); + vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5f; + UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0, 0, 500), ignore_monsters, ENT(pev), &tr); vecMidPoint = tr.vecEndPos; // (subtract 15 so the grenade doesn't hit the ceiling) @@ -89,10 +86,10 @@ NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpo float distance2 = (vecMidPoint.z - vecSpot2.z); // How long will it take for the grenade to travel this distance - float time1 = sqrt(distance1 / (0.5 * flGravity)); - float time2 = sqrt(distance2 / (0.5 * flGravity)); + float time1 = Q_sqrt(distance1 / (0.5f * flGravity)); + float time2 = Q_sqrt(distance2 / (0.5f * flGravity)); - if (time1 < 0.1) + if (time1 < 0.1f) { // too close return g_vecZero; @@ -128,8 +125,6 @@ NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpo // VecCheckThrow - returns the velocity vector at which an object should be thrown from vecspot1 to hit vecspot2. // returns g_vecZero if throw is not feasible. - -/* ../cstrike/dlls/h_ai.cpp:164 */ NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj) { float flGravity = g_psv_gravity->value * flGravityAdj; @@ -138,13 +133,13 @@ NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSp // throw at a constant time float time = vecGrenadeVel.Length() / flSpeed; - vecGrenadeVel = vecGrenadeVel * (1.0 / time); + vecGrenadeVel = vecGrenadeVel * (1.0f / time); // adjust upward toss to compensate for gravity loss - vecGrenadeVel.z += flGravity * time * 0.5; + vecGrenadeVel.z += flGravity * time * 0.5f; - Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5; - vecApex.z += 0.5 * flGravity * (time * 0.5) * (time * 0.5); + Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5f; + vecApex.z += 0.5f * flGravity * (time * 0.5f) * (time * 0.5f); TraceResult tr; UTIL_TraceLine(vecSpot1, vecApex, dont_ignore_monsters, ENT(pev), &tr); diff --git a/regamedll/dlls/h_ai.h b/regamedll/dlls/h_ai.h index cf17042f..ed3a50df 100644 --- a/regamedll/dlls/h_ai.h +++ b/regamedll/dlls/h_ai.h @@ -35,8 +35,8 @@ #define NUM_LATERAL_CHECKS 13 // how many checks are made on each side of a monster looking for lateral cover #define NUM_LATERAL_LOS_CHECKS 6 // how many checks are made on each side of a monster looking for lateral cover -NOXREF BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize); -NOXREF Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj); -NOXREF Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj); +BOOL FBoxVisible(entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetOrigin, float flSize); +Vector VecCheckToss(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flGravityAdj); +Vector VecCheckThrow(entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj); #endif // H_AI_H diff --git a/regamedll/dlls/h_battery.cpp b/regamedll/dlls/h_battery.cpp index 1addde74..08a11186 100644 --- a/regamedll/dlls/h_battery.cpp +++ b/regamedll/dlls/h_battery.cpp @@ -14,15 +14,11 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] = DEFINE_FIELD(CRecharge, m_flSoundTime, FIELD_TIME), }; -#endif // HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/h_battery.cpp:61 */ IMPLEMENT_SAVERESTORE(CRecharge, CBaseEntity); - -/* ../cstrike/dlls/h_battery.cpp:63 */ LINK_ENTITY_TO_CLASS(func_recharge, CRecharge); -/* ../cstrike/dlls/h_battery.cpp:66 */ void CRecharge::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "style") @@ -42,7 +38,6 @@ void CRecharge::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseToggle::KeyValue(pkvd); } -/* ../cstrike/dlls/h_battery.cpp:85 */ void CRecharge::__MAKE_VHOOK(Spawn)() { Precache(); @@ -55,11 +50,10 @@ void CRecharge::__MAKE_VHOOK(Spawn)() UTIL_SetSize(pev, pev->mins, pev->maxs); SET_MODEL(ENT(pev), STRING(pev->model)); - m_iJuice = (int)gSkillData.suitchargerCapacity; + m_iJuice = int(gSkillData.suitchargerCapacity); pev->frame = 0; } -/* ../cstrike/dlls/h_battery.cpp:99 */ void CRecharge::__MAKE_VHOOK(Precache)() { PRECACHE_SOUND("items/suitcharge1.wav"); @@ -67,7 +61,6 @@ void CRecharge::__MAKE_VHOOK(Precache)() PRECACHE_SOUND("items/suitchargeok1.wav"); } -/* ../cstrike/dlls/h_battery.cpp:107 */ void CRecharge::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // if it's not a player, ignore @@ -138,7 +131,6 @@ void CRecharge::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, m_flNextCharge = gpGlobals->time + 0.1f; } -/* ../cstrike/dlls/h_battery.cpp:178 */ void CRecharge::Recharge() { m_iJuice = gSkillData.suitchargerCapacity; @@ -146,7 +138,6 @@ void CRecharge::Recharge() SetThink(&CRecharge::SUB_DoNothing); } -/* ../cstrike/dlls/h_battery.cpp:185 */ void CRecharge::Off() { // Stop looping sound. diff --git a/regamedll/dlls/h_battery.h b/regamedll/dlls/h_battery.h index e6f6074b..d9e6fa67 100644 --- a/regamedll/dlls/h_battery.h +++ b/regamedll/dlls/h_battery.h @@ -52,7 +52,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Off(); diff --git a/regamedll/dlls/h_cycler.cpp b/regamedll/dlls/h_cycler.cpp index ba3feb5e..ddbf9071 100644 --- a/regamedll/dlls/h_cycler.cpp +++ b/regamedll/dlls/h_cycler.cpp @@ -22,24 +22,18 @@ TYPEDESCRIPTION CWreckage::m_SaveData[] = DEFINE_FIELD(CWreckage, m_flStartTime, FIELD_TIME), }; -#endif // HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/h_cycler.cpp:61 */ IMPLEMENT_SAVERESTORE(CCycler, CBaseToggle); -/* ../cstrike/dlls/h_cycler.cpp:70 */ void CGenericCycler::__MAKE_VHOOK(Spawn)() { GenericCyclerSpawn((char *)STRING(pev->model), Vector(-16, -16, 0), Vector(16, 16, 72)); } -/* ../cstrike/dlls/h_cycler.cpp:72 */ LINK_ENTITY_TO_CLASS(cycler, CGenericCycler); - -/* ../cstrike/dlls/h_cycler.cpp:85 */ LINK_ENTITY_TO_CLASS(cycler_prdroid, CCyclerProbe); -/* ../cstrike/dlls/h_cycler.cpp:86 */ void CCyclerProbe::__MAKE_VHOOK(Spawn)() { pev->origin = pev->origin + Vector(0, 0, 16); @@ -47,8 +41,6 @@ void CCyclerProbe::__MAKE_VHOOK(Spawn)() } // Cycler member functions - -/* ../cstrike/dlls/h_cycler.cpp:96 */ void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax) { if (!szModel || !szModel[0]) @@ -58,13 +50,7 @@ void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax) return; } - if (pev->classname) - { - RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); - } - MAKE_STRING_CLASS("cycler", pev); - AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); PRECACHE_MODEL(szModel); SET_MODEL(ENT(pev), szModel); @@ -74,7 +60,6 @@ void CCycler::GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax) UTIL_SetSize(pev, vecMin, vecMax); } -/* ../cstrike/dlls/h_cycler.cpp:115 */ void CCycler::__MAKE_VHOOK(Spawn)() { InitBoneControllers(); @@ -110,8 +95,6 @@ void CCycler::__MAKE_VHOOK(Spawn)() } // cycler think - -/* ../cstrike/dlls/h_cycler.cpp:151 */ void CCycler::__MAKE_VHOOK(Think)() { pev->nextthink = gpGlobals->time + 0.1f; @@ -140,8 +123,6 @@ void CCycler::__MAKE_VHOOK(Think)() } // CyclerUse - starts a rotation trend - -/* ../cstrike/dlls/h_cycler.cpp:176 */ void CCycler::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { m_animate = !m_animate; @@ -153,8 +134,6 @@ void CCycler::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, U } // CyclerPain , changes sequences when shot - -/* ../cstrike/dlls/h_cycler.cpp:189 */ int CCycler::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { if (m_animate) @@ -182,13 +161,9 @@ int CCycler::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAtt return 0; } -/* ../cstrike/dlls/h_cycler.cpp:246 */ LINK_ENTITY_TO_CLASS(cycler_sprite, CCyclerSprite); - -/* ../cstrike/dlls/h_cycler.cpp:255 */ IMPLEMENT_SAVERESTORE(CCyclerSprite, CBaseEntity); -/* ../cstrike/dlls/h_cycler.cpp:258 */ void CCyclerSprite::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_SLIDEBOX; @@ -204,19 +179,14 @@ void CCyclerSprite::__MAKE_VHOOK(Spawn)() PRECACHE_MODEL((char *)STRING(pev->model)); SET_MODEL(ENT(pev), STRING(pev->model)); - m_maxFrame = (float)MODEL_FRAMES(pev->modelindex) - 1; + m_maxFrame = float(MODEL_FRAMES(pev->modelindex) - 1); m_renderfx = pev->renderfx; m_rendermode = pev->rendermode; m_renderamt = pev->renderamt; - - for (int i = 0; i < ARRAYSIZE(pev->rendercolor); ++i) - { - pev->rendercolor[i] = m_rendercolor[i]; - } + m_rendercolor = pev->rendercolor; } -/* ../cstrike/dlls/h_cycler.cpp:284 */ void CCyclerSprite::__MAKE_VHOOK(Restart)() { pev->solid = SOLID_SLIDEBOX; @@ -232,14 +202,9 @@ void CCyclerSprite::__MAKE_VHOOK(Restart)() pev->renderfx = m_renderfx; pev->rendermode = m_rendermode; pev->renderamt = m_renderamt; - - for (int i = 0; i < ARRAYSIZE(pev->rendercolor); ++i) - { - pev->rendercolor[i] = m_rendercolor[i]; - } + pev->rendercolor = m_rendercolor; } -/* ../cstrike/dlls/h_cycler.cpp:305 */ void CCyclerSprite::__MAKE_VHOOK(Think)() { if (ShouldAnimate()) @@ -251,14 +216,12 @@ void CCyclerSprite::__MAKE_VHOOK(Think)() m_lastTime = gpGlobals->time; } -/* ../cstrike/dlls/h_cycler.cpp:315 */ void CCyclerSprite::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { m_animate = !m_animate; ALERT(at_console, "Sprite: %s\n", STRING(pev->model)); } -/* ../cstrike/dlls/h_cycler.cpp:322 */ int CCyclerSprite::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { if (m_maxFrame > 1.0) @@ -269,21 +232,18 @@ int CCyclerSprite::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t * return 1; } -/* ../cstrike/dlls/h_cycler.cpp:331 */ void CCyclerSprite::Animate(float frames) { pev->frame += frames; if (m_maxFrame > 0) { - pev->frame = fmod((float_precision)pev->frame, (float_precision)m_maxFrame); + pev->frame = Q_fmod(float_precision(pev->frame), float_precision(m_maxFrame)); } } -/* ../cstrike/dlls/h_cycler.cpp:358 */ LINK_ENTITY_TO_CLASS(cycler_weapon, CWeaponCycler); -/* ../cstrike/dlls/h_cycler.cpp:361 */ void CWeaponCycler::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_SLIDEBOX; @@ -300,7 +260,6 @@ void CWeaponCycler::__MAKE_VHOOK(Spawn)() SetTouch(&CWeaponCycler::DefaultTouch); } -/* ../cstrike/dlls/h_cycler.cpp:378 */ BOOL CWeaponCycler::__MAKE_VHOOK(Deploy)() { m_pPlayer->pev->viewmodel = m_iszModel; @@ -312,20 +271,17 @@ BOOL CWeaponCycler::__MAKE_VHOOK(Deploy)() return TRUE; } -/* ../cstrike/dlls/h_cycler.cpp:388 */ void CWeaponCycler::__MAKE_VHOOK(Holster)(int skiplocal) { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; } -/* ../cstrike/dlls/h_cycler.cpp:394 */ void CWeaponCycler::__MAKE_VHOOK(PrimaryAttack)() { SendWeaponAnim(pev->sequence); m_flNextPrimaryAttack = gpGlobals->time + 0.3f; } -/* ../cstrike/dlls/h_cycler.cpp:403 */ void CWeaponCycler::__MAKE_VHOOK(SecondaryAttack)() { float flFrameRate, flGroundSpeed; @@ -346,13 +302,9 @@ void CWeaponCycler::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = gpGlobals->time + 0.3f; } -/* ../cstrike/dlls/h_cycler.cpp:443 */ IMPLEMENT_SAVERESTORE(CWreckage, CBaseToggle); - -/* ../cstrike/dlls/h_cycler.cpp:446 */ LINK_ENTITY_TO_CLASS(cycler_wreckage, CWreckage); -/* ../cstrike/dlls/h_cycler.cpp:448 */ void CWreckage::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -370,10 +322,9 @@ void CWreckage::__MAKE_VHOOK(Spawn)() } // pev->scale = 5.0; - m_flStartTime = (int)gpGlobals->time; + m_flStartTime = int(gpGlobals->time); } -/* ../cstrike/dlls/h_cycler.cpp:468 */ void CWreckage::__MAKE_VHOOK(Precache)() { if (!FStringNull(pev->model)) @@ -382,7 +333,6 @@ void CWreckage::__MAKE_VHOOK(Precache)() } } -/* ../cstrike/dlls/h_cycler.cpp:474 */ void CWreckage::__MAKE_VHOOK(Think)() { StudioFrameAdvance(); diff --git a/regamedll/dlls/h_cycler.h b/regamedll/dlls/h_cycler.h index d4c6c840..bc5af4db 100644 --- a/regamedll/dlls/h_cycler.h +++ b/regamedll/dlls/h_cycler.h @@ -32,7 +32,6 @@ #pragma once #endif -/* ../cstrike/dlls/h_cycler.cpp:35 */ class CCycler: public CBaseMonster { public: @@ -56,7 +55,7 @@ public: void Think_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax); @@ -68,8 +67,6 @@ public: }; // we should get rid of all the other cyclers and replace them with this. - -/* ../cstrike/dlls/h_cycler.cpp:67 */ class CGenericCycler: public CCycler { public: @@ -79,13 +76,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; // Probe droid imported for tech demo compatibility - -/* ../cstrike/dlls/h_cycler.cpp:80 */ class CCyclerProbe: public CCycler { public: @@ -95,11 +90,10 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/h_cycler.cpp:218 */ class CCyclerSprite: public CBaseEntity { public: @@ -122,7 +116,7 @@ public: void Think_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void Animate(float frames); @@ -140,7 +134,6 @@ public: vec3_t m_rendercolor; }; -/* ../cstrike/dlls/h_cycler.cpp:344 */ class CWeaponCycler: public CBasePlayerWeapon { public: @@ -160,7 +153,7 @@ public: void PrimaryAttack_(); void SecondaryAttack_(); -#endif // HOOK_GAMEDLL +#endif public: int m_iszModel; @@ -168,8 +161,6 @@ public: }; // Flaming Wreakage - -/* ../cstrike/dlls/h_cycler.cpp:427 */ class CWreckage: public CBaseMonster { public: @@ -187,7 +178,7 @@ public: int Restore_(CRestore &restore); void Think_(); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; diff --git a/regamedll/dlls/h_export.cpp b/regamedll/dlls/h_export.cpp index 489889e9..85e3260b 100644 --- a/regamedll/dlls/h_export.cpp +++ b/regamedll/dlls/h_export.cpp @@ -7,15 +7,10 @@ globalvars_t *gpGlobals; // Receive engine function table from engine. // This appears to be the _first_ DLL routine called by the engine, so we // do some setup operations here. - -/* ../cstrike/dlls/h_export.cpp:58 */ C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, globalvars_t *pGlobals) { Q_memcpy(&g_engfuncs, pEnginefuncsTable, sizeof(enginefuncs_t)); gpGlobals = pGlobals; -#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS) Regamedll_Game_Init(); -#endif // HOOK_GAMEDLL - } diff --git a/regamedll/dlls/healthkit.cpp b/regamedll/dlls/healthkit.cpp index 6eec3a67..f65b956c 100644 --- a/regamedll/dlls/healthkit.cpp +++ b/regamedll/dlls/healthkit.cpp @@ -14,12 +14,10 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] = DEFINE_FIELD(CWallHealth, m_flSoundTime, FIELD_TIME), }; -#endif // HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/healthkit.cpp:43 */ LINK_ENTITY_TO_CLASS(item_healthkit, CHealthKit); -/* ../cstrike/dlls/healthkit.cpp:55 */ void CHealthKit::__MAKE_VHOOK(Spawn)() { Precache(); @@ -28,14 +26,12 @@ void CHealthKit::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/healthkit.cpp:63 */ void CHealthKit::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_medkit.mdl"); PRECACHE_SOUND("items/smallmedkit1.wav"); } -/* ../cstrike/dlls/healthkit.cpp:69 */ BOOL CHealthKit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { if (pPlayer->TakeHealth(gSkillData.healthkitCapacity, DMG_GENERIC)) @@ -57,13 +53,9 @@ BOOL CHealthKit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return FALSE; } -/* ../cstrike/dlls/healthkit.cpp:130 */ IMPLEMENT_SAVERESTORE(CWallHealth, CBaseEntity); - -/* ../cstrike/dlls/healthkit.cpp:132 */ LINK_ENTITY_TO_CLASS(func_healthcharger, CWallHealth); -/* ../cstrike/dlls/healthkit.cpp:135 */ void CWallHealth::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "style") || FStrEq(pkvd->szKeyName, "height") || FStrEq(pkvd->szKeyName, "value1") || FStrEq(pkvd->szKeyName, "value2") || FStrEq(pkvd->szKeyName, "value3")) @@ -79,7 +71,6 @@ void CWallHealth::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseToggle::KeyValue(pkvd); } -/* ../cstrike/dlls/healthkit.cpp:154 */ void CWallHealth::__MAKE_VHOOK(Spawn)() { Precache(); @@ -93,11 +84,10 @@ void CWallHealth::__MAKE_VHOOK(Spawn)() SET_MODEL(ENT(pev), STRING(pev->model)); - m_iJuice = (int)gSkillData.healthchargerCapacity; + m_iJuice = int(gSkillData.healthchargerCapacity); pev->frame = 0.0f; } -/* ../cstrike/dlls/healthkit.cpp:169 */ void CWallHealth::__MAKE_VHOOK(Precache)() { PRECACHE_SOUND("items/medshot4.wav"); @@ -105,7 +95,6 @@ void CWallHealth::__MAKE_VHOOK(Precache)() PRECACHE_SOUND("items/medcharge4.wav"); } -/* ../cstrike/dlls/healthkit.cpp:177 */ void CWallHealth::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // Make sure that we have a caller @@ -163,7 +152,6 @@ void CWallHealth::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCalle m_flNextCharge = gpGlobals->time + 0.1f; } -/* ../cstrike/dlls/healthkit.cpp:236 */ void CWallHealth::Recharge() { EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/medshot4.wav", VOL_NORM, ATTN_NORM); @@ -172,7 +160,6 @@ void CWallHealth::Recharge() SetThink(&CWallHealth::SUB_DoNothing); } -/* ../cstrike/dlls/healthkit.cpp:244 */ void CWallHealth::Off() { // Stop looping sound. diff --git a/regamedll/dlls/healthkit.h b/regamedll/dlls/healthkit.h index 3ebbf5cb..6242628c 100644 --- a/regamedll/dlls/healthkit.h +++ b/regamedll/dlls/healthkit.h @@ -32,7 +32,6 @@ #pragma once #endif -/* ../cstrike/dlls/healthkit.cpp:27 */ class CHealthKit: public CItem { public: @@ -46,11 +45,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/healthkit.cpp:99 */ class CWallHealth: public CBaseToggle { public: @@ -71,7 +69,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Off(); diff --git a/regamedll/dlls/hintmessage.cpp b/regamedll/dlls/hintmessage.cpp index df8e13cc..449ce440 100644 --- a/regamedll/dlls/hintmessage.cpp +++ b/regamedll/dlls/hintmessage.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* ../cstrike/dlls/hintmessage.cpp:11 */ CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector *args, float duration) { m_hintString = hintString; @@ -14,22 +13,19 @@ CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector ../cstrike/dlls/hintmessage.cpp:27 */ CHintMessage::~CHintMessage() { for (int i = 0; i < m_args.Count(); ++i) - delete [] m_args[i]; + delete[] m_args[i]; m_args.RemoveAll(); } -/* ../cstrike/dlls/hintmessage.cpp:37 */ void CHintMessage::Send(CBaseEntity *client) { UTIL_ShowMessageArgs(m_hintString, client, &m_args, m_isHint); } -/* ../cstrike/dlls/hintmessage.cpp:43 */ void CHintMessageQueue::Reset() { m_tmMessageEnd = 0; @@ -40,7 +36,6 @@ void CHintMessageQueue::Reset() m_messages.RemoveAll(); } -/* ../cstrike/dlls/hintmessage.cpp:54 */ void CHintMessageQueue::Update(CBaseEntity *client) { if (gpGlobals->time <= m_tmMessageEnd) @@ -56,7 +51,6 @@ void CHintMessageQueue::Update(CBaseEntity *client) m_messages.Remove(0); } -/* ../cstrike/dlls/hintmessage.cpp:70 */ bool CHintMessageQueue::AddMessage(const char *message, float duration, bool isHint, CUtlVector *args) { CHintMessage *msg = new CHintMessage(message, isHint, args, duration); diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index d253a905..0928388b 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -11,15 +11,11 @@ cvar_t cv_hostage_stop = { "hostage_stop", "0", FCVAR_SERVER, 0.0f, NULL }; CHostageManager *g_pHostages = NULL; int g_iHostageNumber = 0; -#endif // HOOK_GAMEDLL +#endif -/* <45c3fa> ../cstrike/dlls/hostage/hostage.cpp:47 */ LINK_ENTITY_TO_CLASS(hostage_entity, CHostage); - -/* <45c4d3> ../cstrike/dlls/hostage/hostage.cpp:48 */ LINK_ENTITY_TO_CLASS(monster_scientist, CHostage); -/* <45c228> ../cstrike/dlls/hostage/hostage.cpp:54 */ void CHostage::__MAKE_VHOOK(Spawn)() { if (!g_pHostages) @@ -29,13 +25,7 @@ void CHostage::__MAKE_VHOOK(Spawn)() Precache(); - if (pev->classname) - { - RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); - } - MAKE_STRING_CLASS("hostage_entity", pev); - AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); pev->movetype = MOVETYPE_STEP; pev->solid = SOLID_SLIDEBOX; @@ -76,12 +66,12 @@ void CHostage::__MAKE_VHOOK(Spawn)() DROP_TO_FLOOR(edict()); -#ifdef HOOK_GAMEDLL +#ifndef HOOK_GAMEDLL + SetThink(&CHostage::IdleThink); +#else // TODO: fix test demo SetThink(pCHostage__IdleThink); -#else - SetThink(&CHostage::IdleThink); -#endif // HOOK_GAMEDLL +#endif pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2); @@ -96,7 +86,7 @@ void CHostage::__MAKE_VHOOK(Spawn)() m_flLastPathCheck = -1; m_flPathAcquired = -1; - m_flPathCheckInterval = 0.1; + m_flPathCheckInterval = 0.1f; m_flNextRadarTime = gpGlobals->time + RANDOM_FLOAT(0, 1); m_LocalNav = new CLocalNav(this); @@ -105,7 +95,6 @@ void CHostage::__MAKE_VHOOK(Spawn)() m_improv = NULL; } -/* <45bf91> ../cstrike/dlls/hostage/hostage.cpp:137 */ void CHostage::__MAKE_VHOOK(Precache)() { static int which = 0; @@ -153,14 +142,13 @@ void CHostage::__MAKE_VHOOK(Precache)() PRECACHE_MODEL("sprites/smoke.spr"); } -/* <45c5ac> ../cstrike/dlls/hostage/hostage.cpp:179 */ void CHostage::SetActivity(int act) { if (m_Activity != act) { int sequence = LookupActivity(act); - if (sequence != -1) + if (sequence != ACT_INVALID) { if (pev->sequence != sequence) { @@ -178,7 +166,6 @@ void CHostage::SetActivity(int act) } } -/* <45f194> ../cstrike/dlls/hostage/hostage.cpp:204 */ void CHostage::IdleThink() { float flInterval; @@ -186,15 +173,11 @@ void CHostage::IdleThink() const float giveUpTime = (1 / 30.0f); float const updateRate = 0.1f; - if (!TheNavAreaList.empty()) + if (AreImprovAllowed() && !TheNavAreaList.empty()) { if (!m_improv) { m_improv = new CHostageImprov(this); - - #if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) - VirtualTableInit((void *)m_improv, "CHostageImprov"); - #endif // HOOK_GAMEDLL && _WIN32 && !REGAMEDLL_UNIT_TESTS } } else @@ -202,14 +185,13 @@ void CHostage::IdleThink() if (m_improv != NULL) { delete m_improv; + m_improv = NULL; } - - m_improv = NULL; } pev->nextthink = gpGlobals->time + giveUpTime; - flInterval = StudioFrameAdvance(0); + flInterval = StudioFrameAdvance(); DispatchAnimEvents(flInterval); if (m_improv != NULL) @@ -222,7 +204,7 @@ void CHostage::IdleThink() return; } - m_flNextFullThink = gpGlobals->time + 0.1; + m_flNextFullThink = gpGlobals->time + 0.1f; if (pev->deadflag == DEAD_DEAD) { @@ -251,19 +233,17 @@ void CHostage::IdleThink() if (player == NULL || player->m_iTeam == CT) { - if (!g_pGameRules->m_bMapHasRescueZone) + if (!CSGameRules()->m_bMapHasRescueZone) { - BOOL bContinue = FALSE; - BOOL bResHostagePt = FALSE; + bool bResHostagePt = false; if (UTIL_FindEntityByClassname(NULL, "info_hostage_rescue")) - bResHostagePt = TRUE; + bResHostagePt = true; CBaseEntity *pSpot = NULL; - while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue")) != NULL) { - if ((pSpot->pev->origin - pev->origin).Length() < 256) + if ((pSpot->pev->origin - pev->origin).Length() < RESCUE_HOSTAGES_RADIUS) { m_bRescueMe = TRUE; break; @@ -276,7 +256,7 @@ void CHostage::IdleThink() while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")) != NULL) { - if ((pSpot->pev->origin - pev->origin).Length() < 256) + if ((pSpot->pev->origin - pev->origin).Length() < RESCUE_HOSTAGES_RADIUS) { m_bRescueMe = TRUE; break; @@ -292,7 +272,7 @@ void CHostage::IdleThink() TheBots->OnEvent(EVENT_HOSTAGE_RESCUED, player, this); } - if (TheCareerTasks != NULL && g_pGameRules->IsCareer() && player != NULL && !player->IsBot()) + if (TheCareerTasks != NULL && CSGameRules()->IsCareer() && player != NULL && !player->IsBot()) { TheCareerTasks->HandleEvent(EVENT_HOSTAGE_RESCUED, player); } @@ -301,7 +281,7 @@ void CHostage::IdleThink() if (player != NULL) { - player->AddAccount(1000); + player->AddAccount(REWARD_TAKEN_HOSTAGE); UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname), GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict())); } @@ -319,8 +299,8 @@ void CHostage::IdleThink() pev->effects |= EF_NODRAW; Remove(); - g_pGameRules->m_iHostagesRescued++; - g_pGameRules->CheckWinConditions(); + CSGameRules()->m_iHostagesRescued++; + CSGameRules()->CheckWinConditions(); Broadcast((player != NULL) ? "rescued" : "escaped"); } @@ -337,11 +317,11 @@ void CHostage::IdleThink() if (gpGlobals->time >= m_flFlinchTime) { - if (pev->velocity.Length() > 160) + if (pev->velocity.Length() > 160.0f) { SetActivity(ACT_RUN); } - else if (pev->velocity.Length() > 15) + else if (pev->velocity.Length() > 15.0f) { SetActivity(ACT_WALK); } @@ -358,22 +338,21 @@ void CHostage::IdleThink() { Vector vDistance = m_vOldPos - pev->origin; - if (vDistance.Length() > 1) + if (vDistance.Length() > 1.0f) { m_vOldPos = pev->origin; - if (!g_pGameRules->m_fTeamCount) + if (!CSGameRules()->m_fTeamCount) { SendHostagePositionMsg(); } } - m_flNextRadarTime = gpGlobals->time + 1; + m_flNextRadarTime = gpGlobals->time + 1.0f; } } } -/* <45c041> ../cstrike/dlls/hostage/hostage.cpp:413 */ void CHostage::Remove() { pev->movetype = MOVETYPE_NONE; @@ -385,7 +364,6 @@ void CHostage::Remove() m_flNextFullThink = -1; } -/* <45c624> ../cstrike/dlls/hostage/hostage.cpp:426 */ void CHostage::RePosition() { pev->health = pev->max_health; @@ -412,13 +390,12 @@ void CHostage::RePosition() DROP_TO_FLOOR(edict()); SetActivity(ACT_IDLE); -#ifdef HOOK_GAMEDLL +#ifndef HOOK_GAMEDLL + SetThink(&CHostage::IdleThink); +#else // TODO: fix test demo SetThink(pCHostage__IdleThink); -#else - SetThink(&CHostage::IdleThink); -#endif // HOOK_GAMEDLL - +#endif pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2); m_fHasPath = FALSE; @@ -430,7 +407,6 @@ void CHostage::RePosition() m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2); } -/* <45ee7f> ../cstrike/dlls/hostage/hostage.cpp:469 */ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { float flActualDamage; @@ -470,14 +446,14 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt } } - if (pev->health > 0) + if (pev->health > 0.0f) { - m_flFlinchTime = gpGlobals->time + 0.75; + m_flFlinchTime = gpGlobals->time + 0.75f; SetFlinchActivity(); if (pAttacker != NULL) { - pAttacker->AddAccount(-20 * (unsigned __int64)(signed __int64)flActualDamage); + pAttacker->AddAccount(-20 * int(flActualDamage)); if (TheBots != NULL) { @@ -503,7 +479,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt if (pAttacker != NULL) { - pAttacker->AddAccount(20 * (-25 - (unsigned __int64)(signed __int64)flActualDamage)); + pAttacker->AddAccount(20 * (-25 - int(flActualDamage))); AnnounceDeath(pAttacker); ApplyHostagePenalty(pAttacker); } @@ -522,19 +498,18 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt m_improv->Chatter(HOSTAGE_CHATTER_DEATH_CRY); } - g_pGameRules->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); - if (!g_pGameRules->m_fTeamCount) + if (!CSGameRules()->m_fTeamCount) SendHostageEventMsg(); - pev->nextthink = gpGlobals->time + 3; + pev->nextthink = gpGlobals->time + 3.0f; SetThink(&CHostage::Remove); } return 0; } -/* <45c783> ../cstrike/dlls/hostage/hostage.cpp:578 */ float CHostage::GetModifiedDamage(float flDamage, int nHitGroup) { switch (nHitGroup) @@ -553,7 +528,6 @@ float CHostage::GetModifiedDamage(float flDamage, int nHitGroup) return flDamage; } -/* <45c7d3> ../cstrike/dlls/hostage/hostage.cpp:597 */ void CHostage::PlayPainSound() { if (m_LastHitGroup != HITGROUP_HEAD) @@ -566,7 +540,6 @@ void CHostage::PlayPainSound() } } -/* <45c8c4> ../cstrike/dlls/hostage/hostage.cpp:612 */ void CHostage::SetFlinchActivity() { Activity activity = ACT_SMALL_FLINCH; @@ -580,7 +553,6 @@ void CHostage::SetFlinchActivity() SetActivity(activity); } -/* <45c960> ../cstrike/dlls/hostage/hostage.cpp:642 */ void CHostage::SetDeathActivity() { if (m_improv != NULL && m_improv->IsCrouching()) @@ -636,7 +608,6 @@ void CHostage::SetDeathActivity() } } -/* <45cc41> ../cstrike/dlls/hostage/hostage.cpp:684 */ void CHostage::AnnounceDeath(CBasePlayer *pAttacker) { ClientPrint(pAttacker->pev, HUD_PRINTCENTER, "#Killed_Hostage"); @@ -664,13 +635,12 @@ void CHostage::AnnounceDeath(CBasePlayer *pAttacker) MESSAGE_END(); } -/* <45cd6b> ../cstrike/dlls/hostage/hostage.cpp:717 */ void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker) { if (pAttacker->m_iTeam != TERRORIST) return; - int iHostagePenalty = (int)CVAR_GET_FLOAT("mp_hostagepenalty"); + int iHostagePenalty = int(CVAR_GET_FLOAT("mp_hostagepenalty")); if (iHostagePenalty) { @@ -684,12 +654,11 @@ void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker) SERVER_COMMAND(UTIL_VarArgs("kick #%d\n", GETPLAYERUSERID(pAttacker->edict()))); #else CLIENT_COMMAND(pAttacker->edict(), "disconnect\n"); - #endif // REGAMEDLL_FIXES + #endif } } } -/* <45cfd6> ../cstrike/dlls/hostage/hostage.cpp:740 */ void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!pActivator->IsPlayer()) @@ -713,7 +682,7 @@ void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, if (gpGlobals->time >= m_flNextChange) { - m_flNextChange = gpGlobals->time + 1; + m_flNextChange = gpGlobals->time + 1.0f; if (m_improv != NULL) { @@ -767,7 +736,6 @@ void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, } } -/* <45cdba> ../cstrike/dlls/hostage/hostage.cpp:833 */ void CHostage::PlayFollowRescueSound() { switch (RANDOM_LONG(0, 4)) @@ -780,26 +748,23 @@ void CHostage::PlayFollowRescueSound() } } -/* <45d1ff> ../cstrike/dlls/hostage/hostage.cpp:851 */ void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer) { if (m_bTouched) return; m_bTouched = TRUE; - g_pGameRules->m_iAccountCT += 100; + CSGameRules()->m_iAccountCT += 100; pPlayer->AddAccount(150); UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Touched_A_Hostage\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict())); } -/* <45bf69> ../cstrike/dlls/hostage/hostage.cpp:869 */ int CHostage::__MAKE_VHOOK(ObjectCaps)() { return (CBaseMonster::ObjectCaps() | FCAP_MUST_SPAWN | FCAP_ONOFF_USE); } -/* <45c0e3> ../cstrike/dlls/hostage/hostage.cpp:876 */ void CHostage::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { Vector2D vPush; @@ -834,10 +799,9 @@ void CHostage::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) #else // TODO: fix test demo pev->velocity = pev->velocity + NormalizeMulScalar(vPush, pushForce); -#endif // PLAY_GAMEDLL +#endif } -/* <45dd66> ../cstrike/dlls/hostage/hostage.cpp:910 */ void CHostage::DoFollow() { CBaseEntity *pFollowing; @@ -848,7 +812,7 @@ void CHostage::DoFollow() if (m_hTargetEnt == NULL) return; - if (cv_hostage_stop.value > 0.0) + if (cv_hostage_stop.value > 0.0f) { m_State = STAND; m_hTargetEnt = NULL; @@ -863,14 +827,14 @@ void CHostage::DoFollow() vecDest.z += pFollowing->pev->mins.z; flDistToDest = (vecDest - pev->origin).Length(); - if (flDistToDest < 80 && (m_fHasPath || m_LocalNav->PathTraversable(pev->origin, vecDest, TRUE))) + if (flDistToDest < 80.0f && (m_fHasPath || m_LocalNav->PathTraversable(pev->origin, vecDest, TRUE))) return; if (pev->flags & FL_ONGROUND) { if (m_flPathCheckInterval + m_flLastPathCheck < gpGlobals->time) { - if (!m_fHasPath || pFollowing->pev->velocity.Length2D() > 1) + if (!m_fHasPath || pFollowing->pev->velocity.Length2D() > 1.0f) { m_flLastPathCheck = gpGlobals->time; m_LocalNav->RequestNav(this); @@ -912,7 +876,7 @@ void CHostage::DoFollow() { if (IsFollowingSomeone()) { - if (!m_bStuck && flDistToDest > 200) + if (!m_bStuck && flDistToDest > 200.0f) { m_bStuck = TRUE; m_flStuckTime = gpGlobals->time; @@ -932,7 +896,6 @@ void CHostage::DoFollow() } } -/* <45d278> ../cstrike/dlls/hostage/hostage.cpp:1018 */ void CHostage::PointAt(const Vector &vecLoc) { pev->angles.x = 0; @@ -940,7 +903,6 @@ void CHostage::PointAt(const Vector &vecLoc) pev->angles.z = 0; } -/* <45d34c> ../cstrike/dlls/hostage/hostage.cpp:1025 */ void CHostage::MoveToward(const Vector &vecLoc) { int nFwdMove; @@ -988,7 +950,7 @@ void CHostage::MoveToward(const Vector &vecLoc) pev->velocity.x = vecFwd.x * flSpeed; pev->velocity.y = vecFwd.y * flSpeed; - if (nFwdMove != PATH_TRAVERSABLE_STEP && nFwdMove == PATH_TRAVERSABLE_STEPJUMPABLE) + if (nFwdMove == PATH_TRAVERSABLE_STEPJUMPABLE) { if (pev->flags & FL_ONGROUND) { @@ -998,18 +960,16 @@ void CHostage::MoveToward(const Vector &vecLoc) } } -/* <45d704> ../cstrike/dlls/hostage/hostage.cpp:1102 */ BOOL CHostage::IsOnLadder() { return pev->movetype == MOVETYPE_FLY; } -/* <45d727> ../cstrike/dlls/hostage/hostage.cpp:1106 */ void CHostage::NavReady() { CBaseEntity *pFollowing; Vector vecDest; - float flRadius = 40.0; + float flRadius = 40.0f; if (!m_hTargetEnt) { @@ -1041,7 +1001,7 @@ void CHostage::NavReady() { if (!m_fHasPath) { - m_flPathCheckInterval += 0.1; + m_flPathCheckInterval += 0.1f; if (m_flPathCheckInterval >= 0.5f) { @@ -1054,13 +1014,12 @@ void CHostage::NavReady() m_fHasPath = TRUE; nTargetNode = -1; m_flPathAcquired = gpGlobals->time; - m_flPathCheckInterval = 0.5; + m_flPathCheckInterval = 0.5f; m_nPathNodes = m_LocalNav->SetupPathNodes(nindexPath, vecNodes, 1); } } -/* <45edaa> ../cstrike/dlls/hostage/hostage.cpp:1159 */ void CHostage::SendHostagePositionMsg() { CBaseEntity *pEntity = NULL; @@ -1091,7 +1050,6 @@ void CHostage::SendHostagePositionMsg() } } -/* <45ecd5> ../cstrike/dlls/hostage/hostage.cpp:1189 */ void CHostage::SendHostageEventMsg() { CBaseEntity *pEntity = NULL; @@ -1121,7 +1079,6 @@ void CHostage::SendHostageEventMsg() } } -/* <45d8a6> ../cstrike/dlls/hostage/hostage.cpp:1292 */ void CHostage::Wiggle() { TraceResult tr; @@ -1155,12 +1112,11 @@ void CHostage::Wiggle() vec.y = vec.y + RANDOM_FLOAT(-3.0, 3.0); vec.x = vec.x + RANDOM_FLOAT(-3.0, 3.0); -#endif // PLAY_GAMEDLL +#endif pev->velocity = pev->velocity + (vec.Normalize() * 100); } -/* <45e00c> ../cstrike/dlls/hostage/hostage.cpp:1346 */ void CHostage::PreThink() { Vector vecSrc; @@ -1193,14 +1149,14 @@ void CHostage::PreThink() TRACE_MONSTER_HULL(edict(), vecSrc, vecDest, dont_ignore_monsters, edict(), &tr); - if (tr.fStartSolid || tr.flFraction == 1.0f || tr.vecPlaneNormal.z > 0.7f) + if (tr.fStartSolid || tr.flFraction == 1.0f || tr.vecPlaneNormal.z > MaxUnitZSlope) { return; } flOrigDist = (tr.vecEndPos - pev->origin).Length2D(); vecSrc.z += flInterval; - vecDest = vecSrc + (pev->velocity.Normalize() * 0.1); + vecDest = vecSrc + (pev->velocity.Normalize() * 0.1f); vecDest.z = vecSrc.z; TRACE_MONSTER_HULL(edict(), vecSrc, vecDest, dont_ignore_monsters, edict(), &tr); @@ -1216,7 +1172,7 @@ void CHostage::PreThink() TRACE_MONSTER_HULL(edict(), vecSrc, vecDest, dont_ignore_monsters, edict(), &tr); - if (tr.vecPlaneNormal.z < 0.7f) + if (tr.vecPlaneNormal.z < MaxUnitZSlope) { return; } @@ -1233,20 +1189,18 @@ void CHostage::PreThink() } } -/* <45e24e> ../cstrike/dlls/hostage/hostage.cpp:1421 */ void Hostage_RegisterCVars() { // These cvars are only used in czero #ifdef REGAMEDLL_FIXES if (!g_bIsCzeroGame) return; -#endif // REGAMEDLL_FIXES +#endif CVAR_REGISTER(&cv_hostage_debug); CVAR_REGISTER(&cv_hostage_stop); } -/* <45e2a6> ../cstrike/dlls/hostage/hostage.cpp:1430 */ void InstallHostageManager() { if (g_pHostages != NULL) @@ -1258,14 +1212,12 @@ void InstallHostageManager() g_pHostages = new CHostageManager; } -/* <45e375> ../cstrike/dlls/hostage/hostage.cpp:1443 */ CHostageManager::CHostageManager() { Q_memset(&m_chatter, 0, sizeof(m_chatter)); m_hostageCount = 0; } -/* <45e39b> ../cstrike/dlls/hostage/hostage.cpp:1456 */ void CHostageManager::ServerActivate() { m_hostageCount = 0; @@ -1411,13 +1363,11 @@ void CHostageManager::ServerActivate() } } -/* <45e3a2> ../cstrike/dlls/hostage/hostage.cpp:1624 */ void CHostageManager::ServerDeactivate() { ; } -/* <45e3f7> ../cstrike/dlls/hostage/hostage.cpp:1631 */ void CHostageManager::RestartRound() { for (int i = 0; i < m_hostageCount; ++i) @@ -1429,7 +1379,6 @@ void CHostageManager::RestartRound() } } -/* <45e43d> ../cstrike/dlls/hostage/hostage.cpp:1640 */ void CHostageManager::AddHostage(CHostage *hostage) { if (m_hostageCount >= MAX_HOSTAGES) @@ -1451,7 +1400,6 @@ void CHostageManager::AddHostage(CHostage *hostage) } } -/* <45e47f> ../cstrike/dlls/hostage/hostage.cpp:1657 */ bool CHostageManager::IsNearbyHostageTalking(CHostageImprov *improv) { for (int i = 0; i < m_hostageCount; ++i) @@ -1474,7 +1422,6 @@ bool CHostageManager::IsNearbyHostageTalking(CHostageImprov *improv) return false; } -/* <45e57b> ../cstrike/dlls/hostage/hostage.cpp:1689 */ bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv) { for (int i = 0; i < m_hostageCount; ++i) @@ -1497,7 +1444,6 @@ bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv) return false; } -/* <45e642> ../cstrike/dlls/hostage/hostage.cpp:1716 */ void CHostageManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { for (int i = 0; i < m_hostageCount; ++i) @@ -1511,7 +1457,6 @@ void CHostageManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEnt } } -/* <45e6b8> ../cstrike/dlls/hostage/hostage.cpp:1726 */ SimpleChatter::SimpleChatter() { for (int i = 0; i < ARRAYSIZE(m_chatter); ++i) @@ -1522,22 +1467,18 @@ SimpleChatter::SimpleChatter() } } -/* <45e6f0> ../cstrike/dlls/hostage/hostage.cpp:1737 */ SimpleChatter::~SimpleChatter() { for (int i = 0; i < ARRAYSIZE(m_chatter); ++i) { for (int f = 0; f < m_chatter[i].count; f++) { - if (m_chatter[i].file[f].filename != NULL) - { - delete[] m_chatter[i].file[f].filename; - } + delete[] m_chatter[i].file[f].filename; + m_chatter[i].file[f].filename = NULL; } } } -/* <45e736> ../cstrike/dlls/hostage/hostage.cpp:1752 */ void SimpleChatter::AddSound(HostageChatterType type, char *filename) { ChatterSet *chatter; @@ -1556,7 +1497,6 @@ void SimpleChatter::AddSound(HostageChatterType type, char *filename) PRECACHE_SOUND(filename); } -/* <45e8c7> ../cstrike/dlls/hostage/hostage.cpp:1773 */ void SimpleChatter::Shuffle(ChatterSet *chatter) { if (!chatter->needsShuffle) @@ -1582,7 +1522,6 @@ void SimpleChatter::Shuffle(ChatterSet *chatter) chatter->needsShuffle = false; } -/* <45e979> ../cstrike/dlls/hostage/hostage.cpp:1793 */ char *SimpleChatter::GetSound(HostageChatterType type, float *duration) { ChatterSet *chatter = &m_chatter[type]; @@ -1600,7 +1539,6 @@ char *SimpleChatter::GetSound(HostageChatterType type, float *duration) return sound; } -/* <45ea1b> ../cstrike/dlls/hostage/hostage.cpp:1818 */ float SimpleChatter::PlaySound(CBaseEntity *entity, HostageChatterType type) { CHostage *hostage; diff --git a/regamedll/dlls/hostage/hostage.h b/regamedll/dlls/hostage/hostage.h index 641445a5..541744c8 100644 --- a/regamedll/dlls/hostage/hostage.h +++ b/regamedll/dlls/hostage/hostage.h @@ -39,14 +39,15 @@ #define MAX_HOSTAGES 12 #define MAX_HOSTAGES_NAV 20 -#define HOSTAGE_STEPSIZE 26.0 -#define HOSTAGE_STEPSIZE_DEFAULT 18.0 +#define HOSTAGE_STEPSIZE 26.0f +#define HOSTAGE_STEPSIZE_DEFAULT 18.0f #define VEC_HOSTAGE_VIEW Vector(0, 0, 12) #define VEC_HOSTAGE_HULL_MIN Vector(-10, -10, 0) #define VEC_HOSTAGE_HULL_MAX Vector(10, 10, 62) #define VEC_HOSTAGE_CROUCH Vector(10, 10, 30) +#define RESCUE_HOSTAGES_RADIUS 256.0f // rescue zones from legacy info_* class CHostage; class CLocalNav; @@ -86,8 +87,6 @@ extern cvar_t cv_hostage_debug; extern cvar_t cv_hostage_stop; // A Counter-Strike Hostage Simple - -/* <4858e5> ../cstrike/dlls/hostage/hostage.h:32 */ class CHostage: public CBaseMonster { public: @@ -109,7 +108,7 @@ public: void Touch_(CBaseEntity *pOther); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT IdleThink(); @@ -185,7 +184,7 @@ public: CBasePlayer *m_target; CLocalNav *m_LocalNav; int nTargetNode; - Vector vecNodes[ MAX_NODES ]; + Vector vecNodes[MAX_NODES]; EHANDLE m_hStoppedTargetEnt; float m_flNextFullThink; float m_flPathCheckInterval; @@ -224,11 +223,6 @@ public: }; void AddSound(HostageChatterType type, char *filename); - -#ifdef _WIN32 - #undef PlaySound -#endif // _WIN32 - float PlaySound(CBaseEntity *entity, HostageChatterType type); char *GetSound(HostageChatterType type, float *duration); void Shuffle(ChatterSet *chatter); @@ -237,7 +231,6 @@ private: ChatterSet m_chatter[21]; }; -/* <45b018> ../cstrike/dlls/hostage/hostage.h:247 */ class CHostageManager { public: @@ -282,12 +275,12 @@ public: for (int i = 0; i < m_hostageCount; i++) { - range = (m_hostage[ i ]->pev->origin - pos).Length(); + range = (m_hostage[i]->pev->origin - pos).Length(); if (range < closeRange) { closeRange = range; - close = m_hostage[ i ]; + close = m_hostage[i]; } } @@ -298,11 +291,17 @@ public: } private: - CHostage *m_hostage[ MAX_HOSTAGES ]; + CHostage *m_hostage[MAX_HOSTAGES]; int m_hostageCount; SimpleChatter m_chatter; }; +// Determine whether hostage improv can be used or not +inline bool AreImprovAllowed() +{ + return g_bHostageImprov; +} + void Hostage_RegisterCVars(); void InstallHostageManager(); diff --git a/regamedll/dlls/hostage/hostage_improv.cpp b/regamedll/dlls/hostage/hostage_improv.cpp index ca11120b..7cd7a22a 100644 --- a/regamedll/dlls/hostage/hostage_improv.cpp +++ b/regamedll/dlls/hostage/hostage_improv.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <4703fc> ../cstrike/dlls/hostage/hostage_improv.cpp:19 */ inline void DrawAxes(const Vector &origin, int red, int green, int blue) { float size = 10; @@ -13,20 +12,18 @@ inline void DrawAxes(const Vector &origin, int red, int green, int blue) UTIL_DrawBeamPoints(origin + Vector(0, 0, size), origin - Vector(0, 0, size), 2, red, green, blue); } -/* <47353e> ../cstrike/dlls/hostage/hostage_improv.cpp:41 */ CHostageImprov::CHostageImprov(CBaseEntity *entity) { + m_animateState.Reset(); m_hostage = static_cast(entity); OnReset(); } -/* <470d33> ../cstrike/dlls/hostage/hostage_improv.cpp:52 */ bool CHostageImprov::__MAKE_VHOOK(IsAlive)() const { return m_hostage->pev->deadflag != DEAD_DEAD; } -/* <474809> ../cstrike/dlls/hostage/hostage_improv.cpp:61 */ void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal) { m_moveGoal = goal; @@ -40,8 +37,6 @@ void CHostageImprov::__MAKE_VHOOK(MoveTo)(const Vector &goal) } // Find "simple" ground height, treating current nav area as part of the floor - -/* <4717e4> ../cstrike/dlls/hostage/hostage_improv.cpp:78 */ bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector *pos, float *height, Vector *normal) { if (GetSimpleGroundHeight(pos, height, normal)) @@ -57,8 +52,6 @@ bool CHostageImprov::__MAKE_VHOOK(GetSimpleGroundHeightWithFloor)(const Vector * } // Check if we need to jump due to height change - -/* <473da4> ../cstrike/dlls/hostage/hostage_improv.cpp:96 */ bool CHostageImprov::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump) { // Don't try to jump if in the air or crouching. @@ -81,33 +74,28 @@ bool CHostageImprov::DiscontinuityJump(float ground, bool onlyJumpDown, bool mus return false; } -/* <470d5b> ../cstrike/dlls/hostage/hostage_improv.cpp:116 */ void CHostageImprov::__MAKE_VHOOK(LookAt)(const Vector &target) { m_isLookingAt = true; m_viewGoal = target; } -/* <470d97> ../cstrike/dlls/hostage/hostage_improv.cpp:126 */ void CHostageImprov::__MAKE_VHOOK(ClearLookAt)() { m_isLookingAt = false; } -/* <470dbf> ../cstrike/dlls/hostage/hostage_improv.cpp:135 */ void CHostageImprov::__MAKE_VHOOK(FaceTo)(const Vector &goal) { m_isFacingTo = true; m_faceGoal = goal; } -/* <470dfb> ../cstrike/dlls/hostage/hostage_improv.cpp:145 */ void CHostageImprov::__MAKE_VHOOK(ClearFaceTo)() { m_isFacingTo = false; } -/* <476a30> ../cstrike/dlls/hostage/hostage_improv.cpp:154 */ void CHostageImprov::MoveTowards(const Vector &pos, float deltaT) { Vector move; @@ -122,10 +110,10 @@ void CHostageImprov::MoveTowards(const Vector &pos, float deltaT) // // NOTE: We need to do this frequently to catch edges at the right time // TODO: Look ahead *along path* instead of straight line - ClearPath(); - if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & 8)) && !IsUsingLadder() && !IsJumping() && IsOnGround() && !IsCrouching()) + if ((m_lastKnownArea == NULL || !(m_lastKnownArea->GetAttributes() & NAV_NO_JUMP)) + && !IsUsingLadder() && !IsJumping() && IsOnGround() && !IsCrouching()) { float ground; Vector aheadRay(pos.x - GetFeet().x, pos.y - GetFeet().y, 0); @@ -205,10 +193,9 @@ void CHostageImprov::MoveTowards(const Vector &pos, float deltaT) m_vel.y = move.y * accelRate * deltaT + m_vel.y; } -/* <473e46> ../cstrike/dlls/hostage/hostage_improv.cpp:262 */ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT) { - float error = 0; + bool bError = false; Vector2D to = (target - GetFeet()).Make2D(); #ifndef PLAY_GAMEDLL @@ -229,7 +216,7 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT) to.x = float_x / flLen; to.y = float_y / flLen; } -#endif // PLAY_GAMEDLL +#endif float moveAngle = GetMoveAngle(); @@ -245,12 +232,12 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT) else dot = -1.0f; - error = 1; + bError = true; } const float maxTurnRate = 0.05f; - if (error || fabs(dot) >= maxTurnRate) + if (bError || Q_fabs(dot) >= maxTurnRate) { const float tolerance = 300.0f; float moveRatio = dot * deltaT * tolerance + moveAngle; @@ -267,7 +254,6 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT) return true; } -/* <47402b> ../cstrike/dlls/hostage/hostage_improv.cpp:308 */ void CHostageImprov::FaceOutwards() { TraceResult result; @@ -304,21 +290,17 @@ void CHostageImprov::FaceOutwards() FaceTo(to); } -/* <470e23> ../cstrike/dlls/hostage/hostage_improv.cpp:344 */ bool CHostageImprov::__MAKE_VHOOK(IsAtMoveGoal)(float error) const { return (GetFeet() - m_moveGoal).IsLengthLessThan(error); } -/* <470eab> ../cstrike/dlls/hostage/hostage_improv.cpp:353 */ bool CHostageImprov::__MAKE_VHOOK(IsAtFaceGoal)() const { return false; } // Return true if a friend is between us and the given position - -/* <46fb4b> ../cstrike/dlls/hostage/hostage_improv.cpp:395 */ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(const Vector &goalPos) const { // do this check less often to ease CPU burden @@ -367,8 +349,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(const Vector &goalPos) const } // Return true if a friend is between us and the given entity - -/* <472b83> ../cstrike/dlls/hostage/hostage_improv.cpp:453 */ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const Vector &goalPos) const { if (m_hostage == myFriend) @@ -412,7 +392,7 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const if (!myFriend->pev->velocity.IsZero()) { - if (DotProduct(myFriend->pev->velocity, m_hostage->pev->velocity) >= 0.0) + if (DotProduct(myFriend->pev->velocity, m_hostage->pev->velocity) >= 0.0f) return false; } @@ -420,7 +400,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsFriendInTheWay)(CBaseEntity *myFriend, const return true; } -/* <474309> ../cstrike/dlls/hostage/hostage_improv.cpp:557 */ bool CHostageImprov::IsFriendInTheWay() const { CheckAhead check(this); @@ -430,13 +409,11 @@ bool CHostageImprov::IsFriendInTheWay() const return check.IsBlocked(); } -/* <474631> ../cstrike/dlls/hostage/hostage_improv.cpp:568 */ float CHostageImprov::GetSpeed() { return -1.0f; } -/* <46f249> ../cstrike/dlls/hostage/hostage_improv.cpp:592 */ bool CHostageImprov::__MAKE_VHOOK(Jump)() { if (IsCrouching() || g_pHostages->IsNearbyHostageJumping(this)) @@ -466,19 +443,16 @@ bool CHostageImprov::__MAKE_VHOOK(Jump)() return true; } -/* <470ed3> ../cstrike/dlls/hostage/hostage_improv.cpp:632 */ void CHostageImprov::__MAKE_VHOOK(Run)() { m_moveType = m_moveLimit; } -/* <470efb> ../cstrike/dlls/hostage/hostage_improv.cpp:638 */ void CHostageImprov::__MAKE_VHOOK(Walk)() { m_moveType = (m_moveLimit > Walking) ? Walking : m_moveLimit; } -/* <470f23> ../cstrike/dlls/hostage/hostage_improv.cpp:644 */ void CHostageImprov::__MAKE_VHOOK(Stop)() { MoveTo(GetFeet()); @@ -490,40 +464,34 @@ void CHostageImprov::__MAKE_VHOOK(Stop)() m_moveType = m_moveLimit; } -/* <470f4c> ../cstrike/dlls/hostage/hostage_improv.cpp:655 */ const Vector &CHostageImprov::__MAKE_VHOOK(GetFeet)() const { return m_hostage->pev->origin; } -/* <470f74> ../cstrike/dlls/hostage/hostage_improv.cpp:661 */ const Vector &CHostageImprov::__MAKE_VHOOK(GetCentroid)() const { - m_centroid = m_hostage->pev->origin + Vector(0, 0, 36); + m_centroid = m_hostage->pev->origin + Vector(0, 0, HalfHumanHeight); return m_centroid; } -/* <470f9c> ../cstrike/dlls/hostage/hostage_improv.cpp:671 */ const Vector &CHostageImprov::__MAKE_VHOOK(GetEyes)() const { - m_eye = m_hostage->pev->origin + Vector(0, 0, 72) - Vector(0, 0, 7); + m_eye = m_hostage->pev->origin + Vector(0, 0, HumanHeight) - Vector(0, 0, 7); return m_eye; } -/* <470fc4> ../cstrike/dlls/hostage/hostage_improv.cpp:681 */ bool CHostageImprov::__MAKE_VHOOK(IsOnGround)() const { return (m_hostage->pev->flags & FL_ONGROUND) != 0; } -/* <470fec> ../cstrike/dlls/hostage/hostage_improv.cpp:687 */ bool CHostageImprov::__MAKE_VHOOK(IsMoving)() const { float const epsilon = 10.0f; return m_actualVel.IsLengthGreaterThan(epsilon); } -/* <4715d1> ../cstrike/dlls/hostage/hostage_improv.cpp:697 */ bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) const { const Vector eye = GetEyes(); @@ -533,7 +501,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsVisible)(const Vector &pos, bool testFOV) co return result.flFraction == 1.0f; } -/* <472938> ../cstrike/dlls/hostage/hostage_improv.cpp:728 */ bool CHostageImprov::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other, float cosTolerance) const { Vector2D toOther = (other->pev->origin - GetCentroid()).Make2D(); @@ -555,7 +522,6 @@ bool CHostageImprov::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other, float return false; } -/* <472a9f> ../cstrike/dlls/hostage/hostage_improv.cpp:757 */ CBasePlayer *CHostageImprov::__MAKE_VHOOK(IsAnyPlayerLookingAtMe)(int team, float cosTolerance) const { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -577,7 +543,6 @@ CBasePlayer *CHostageImprov::__MAKE_VHOOK(IsAnyPlayerLookingAtMe)(int team, floa return NULL; } -/* <472e7b> ../cstrike/dlls/hostage/hostage_improv.cpp:783 */ CBasePlayer *CHostageImprov::__MAKE_VHOOK(GetClosestPlayerByTravelDistance)(int team, float *range) const { CBasePlayer *close = NULL; @@ -614,7 +579,6 @@ CBasePlayer *CHostageImprov::__MAKE_VHOOK(GetClosestPlayerByTravelDistance)(int return close; } -/* <47166d> ../cstrike/dlls/hostage/hostage_improv.cpp:822 */ void CHostageImprov::__MAKE_VHOOK(OnReset)() { m_moveFlags = 0; @@ -671,13 +635,12 @@ void CHostageImprov::__MAKE_VHOOK(OnReset)() Idle(); } -/* <474659> ../cstrike/dlls/hostage/hostage_improv.cpp:886 */ void CHostageImprov::UpdateVision() { if (!m_visionTimer.IsElapsed()) return; - m_visiblePlayerCount = false; + m_visiblePlayerCount = 0; for (int i = 1; i <= gpGlobals->maxClients; ++i) { @@ -706,10 +669,9 @@ void CHostageImprov::UpdateVision() } } - m_visionTimer.Start(RANDOM_FLOAT(0.4, 0.6)); + m_visionTimer.Start(RANDOM_FLOAT(0.4f, 0.6f)); } -/* <476e49> ../cstrike/dlls/hostage/hostage_improv.cpp:997 */ void CHostageImprov::__MAKE_VHOOK(TrackPath)(const Vector &pathGoal, float deltaT) { FaceTowards(pathGoal, deltaT); @@ -719,7 +681,6 @@ void CHostageImprov::__MAKE_VHOOK(TrackPath)(const Vector &pathGoal, float delta DrawAxes(pathGoal, 255, 0, 255); } -/* <474781> ../cstrike/dlls/hostage/hostage_improv.cpp:1014 */ void CHostageImprov::SetKnownGoodPosition(const Vector &pos) { if (IsJumping() || IsCrouching()) @@ -739,7 +700,6 @@ void CHostageImprov::SetKnownGoodPosition(const Vector &pos) m_knownGoodPos = pos; } -/* <47486d> ../cstrike/dlls/hostage/hostage_improv.cpp:1038 */ void CHostageImprov::ResetToKnownGoodPosition() { const float tolerance = 10.0f; @@ -771,13 +731,11 @@ void CHostageImprov::ResetToKnownGoodPosition() Stop(); } -/* <47105c> ../cstrike/dlls/hostage/hostage_improv.cpp:1082 */ void CHostageImprov::__MAKE_VHOOK(StartLadder)(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos) { m_traversingLadder = true; } -/* <4710c4> ../cstrike/dlls/hostage/hostage_improv.cpp:1094 */ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) { Vector goal; @@ -787,7 +745,7 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT goal = ladder->m_bottom; AddDirectionVector(&goal, ladder->m_dir, 16); - if (ladder->m_top.z - 36.0f > GetFeet().z) + if (ladder->m_top.z - HalfHumanHeight > GetFeet().z) { const float atGoalRange = 50.0f; if ((GetFeet() - goal).Make2D().IsLengthLessThan(atGoalRange)) @@ -796,7 +754,7 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT } } - if (ladder->m_bottom.z + 36.0f > GetFeet().z) + if (ladder->m_bottom.z + HalfHumanHeight > GetFeet().z) return true; } else if (m_traversingLadder) @@ -883,7 +841,6 @@ bool CHostageImprov::__MAKE_VHOOK(TraverseLadder)(const CNavLadder *ladder, NavT return false; } -/* <477691> ../cstrike/dlls/hostage/hostage_improv.cpp:1214 */ void CHostageImprov::UpdatePosition(float deltaT) { CNavArea *area = TheNavAreaGrid.GetNavArea(&m_hostage->pev->origin); @@ -912,10 +869,17 @@ void CHostageImprov::UpdatePosition(float deltaT) dir = m_jumpTarget - GetFeet(); dir.z = 0; +#ifndef PLAY_GAMEDLL + // TODO: fix test demo dir.NormalizeInPlace(); m_hostage->pev->velocity.x = dir.x * pushSpeed; m_hostage->pev->velocity.y = dir.y * pushSpeed; +#else + Vector vecRet = NormalizeMulScalar(dir, pushSpeed); + m_hostage->pev->velocity.x = vecRet.x; + m_hostage->pev->velocity.y = vecRet.y; +#endif m_hostage->SetBoneController(0); m_hostage->SetBoneController(1); @@ -1020,7 +984,6 @@ void CHostageImprov::UpdatePosition(float deltaT) m_moveFlags = 0; } -/* <47837a> ../cstrike/dlls/hostage/hostage_improv.cpp:1384 */ void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT) { if (IsAlive()) @@ -1029,7 +992,6 @@ void CHostageImprov::__MAKE_VHOOK(OnUpkeep)(float deltaT) } } -/* <4749f9> ../cstrike/dlls/hostage/hostage_improv.cpp:1396 */ bool CHostageImprov::IsTerroristNearby() { if (m_nearbyTerroristTimer.IsElapsed()) @@ -1041,7 +1003,6 @@ bool CHostageImprov::IsTerroristNearby() return true; } -/* <474ae7> ../cstrike/dlls/hostage/hostage_improv.cpp:1412 */ void CHostageImprov::CheckForNearbyTerrorists() { if (!m_checkNearbyTerroristTimer.IsElapsed()) @@ -1063,7 +1024,6 @@ void CHostageImprov::CheckForNearbyTerrorists() } } -/* <4753ba> ../cstrike/dlls/hostage/hostage_improv.cpp:1440 */ void CHostageImprov::UpdateGrenadeReactions() { if (m_coughTimer.IsElapsed()) @@ -1081,7 +1041,7 @@ void CHostageImprov::UpdateGrenadeReactions() CBaseEntity *entity = NULL; const float watchGrenadeRadius = 500.0f; - m_grenadeTimer.Start(RANDOM_FLOAT(0.4, 0.6)); + m_grenadeTimer.Start(RANDOM_FLOAT(0.4f, 0.6f)); while ((entity = UTIL_FindEntityInSphere(entity, GetCentroid(), watchGrenadeRadius)) != NULL) { @@ -1109,7 +1069,6 @@ void CHostageImprov::UpdateGrenadeReactions() } } -/* <475ce3> ../cstrike/dlls/hostage/hostage_improv.cpp:1502 */ void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT) { if (!IsAlive() || cv_hostage_stop.value > 0.0f) @@ -1124,7 +1083,7 @@ void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT) } else { - m_blinkTimer.Start(RANDOM_FLOAT(0.5, 2.0)); + m_blinkTimer.Start(RANDOM_FLOAT(0.5f, 2.0f)); m_blinkCounter = RANDOM_LONG(1, 2); } @@ -1266,7 +1225,6 @@ void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT) m_animateState.OnUpdate(this); } -/* <47552a> ../cstrike/dlls/hostage/hostage_improv.cpp:1705 */ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { switch (event) @@ -1290,7 +1248,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity if (!entity->IsPlayer() || entity->IsPlayer() && ((CBasePlayer *)entity)->m_iTeam != TERRORIST) { - DelayedChatter(RANDOM_FLOAT(0.5, 0.7), HOSTAGE_CHATTER_SCARED_OF_MURDER, true); + DelayedChatter(RANDOM_FLOAT(0.5f, 0.7f), HOSTAGE_CHATTER_SCARED_OF_MURDER, true); } if (!entity->IsPlayer()) { @@ -1310,15 +1268,13 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity case EVENT_TERRORISTS_WIN: Frighten(SCARED); m_isDelayedChatterPending = false; - DelayedChatter(RANDOM_FLOAT(1.0, 4.0), HOSTAGE_CHATTER_TERRORISTS_WIN); + DelayedChatter(RANDOM_FLOAT(1.0f, 4.0f), HOSTAGE_CHATTER_TERRORISTS_WIN); return; case EVENT_CTS_WIN: m_scaredTimer.Invalidate(); m_isDelayedChatterPending = false; - DelayedChatter(RANDOM_FLOAT(1.0, 4.0), HOSTAGE_CHATTER_CTS_WIN); + DelayedChatter(RANDOM_FLOAT(1.0f, 4.0f), HOSTAGE_CHATTER_CTS_WIN); return; - default: - break; } float range; @@ -1341,7 +1297,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity { case EVENT_WEAPON_FIRED: { - DelayedChatter(RANDOM_FLOAT(0.3, 1.0), HOSTAGE_CHATTER_SCARED_OF_GUNFIRE); + DelayedChatter(RANDOM_FLOAT(0.3f, 1.0f), HOSTAGE_CHATTER_SCARED_OF_GUNFIRE); break; } case EVENT_HE_GRENADE_EXPLODED: @@ -1351,7 +1307,7 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity case EVENT_BREAK_METAL: case EVENT_BREAK_FLESH: case EVENT_BREAK_CONCRETE: - DelayedChatter(RANDOM_FLOAT(0.3, 1.0), HOSTAGE_CHATTER_LOOK_OUT); + DelayedChatter(RANDOM_FLOAT(0.3f, 1.0f), HOSTAGE_CHATTER_LOOK_OUT); break; default: @@ -1368,13 +1324,12 @@ void CHostageImprov::__MAKE_VHOOK(OnGameEvent)(GameEventType event, CBaseEntity if ((GetEyes() - *impactPos).IsLengthLessThan(flashRange) && IsVisible(*impactPos)) { - DelayedChatter(RANDOM_FLOAT(0.0, 1.0), HOSTAGE_CHATTER_BLINDED, true); + DelayedChatter(RANDOM_FLOAT(0.0f, 1.0f), HOSTAGE_CHATTER_BLINDED, true); Frighten(TERRIFIED); } } } -/* <471e27> ../cstrike/dlls/hostage/hostage_improv.cpp:1854 */ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other) { const char *classname; @@ -1413,14 +1368,14 @@ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other) Vector pos = alongFloor * lookAheadRange; - for (double offset = 1.0f; offset <= 18.0f; offset += 3.0f) + for (float_precision offset = 1.0f; offset <= 18.0f; offset += 3.0f) { Vector vecStart = GetFeet(); vecStart.z += offset; UTIL_TraceLine(vecStart, vecStart + pos, ignore_monsters, dont_ignore_glass, m_hostage->pev->pContainingEntity, &result); - if (result.flFraction < 1.0f && result.vecPlaneNormal[2] < 0.7f) + if (result.flFraction < 1.0f && result.vecPlaneNormal.z < MaxUnitZSlope) { isStep = true; break; @@ -1499,28 +1454,23 @@ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other) } } -/* <474ba8> ../cstrike/dlls/hostage/hostage_improv.cpp:2006 */ void CHostageImprov::ApplyForce(Vector force) { m_vel.x += force.x; m_vel.y += force.y; } -/* <474bd5> ../cstrike/dlls/hostage/hostage_improv.cpp:2016 */ bool CHostageImprov::IsAtHome() const { return m_hostage->IsAtHome(); } -/* <474c76> ../cstrike/dlls/hostage/hostage_improv.cpp:2025 */ bool CHostageImprov::CanSeeRescueZone() const { - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl == NULL) + if (TheCSBots() == NULL) return false; - const CCSBotManager::Zone *zone = ctrl->GetClosestZone(&GetCentroid()); + const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(&GetCentroid()); if (zone != NULL) return IsVisible(zone->m_center); @@ -1528,7 +1478,6 @@ bool CHostageImprov::CanSeeRescueZone() const return false; } -/* <474cd3> ../cstrike/dlls/hostage/hostage_improv.cpp:2047 */ CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team) { CBasePlayer *close = NULL; @@ -1553,7 +1502,6 @@ CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team) return close; } -/* <474db2> ../cstrike/dlls/hostage/hostage_improv.cpp:2080 */ float CHostageImprov::GetTimeSinceLastSawPlayer(int team) { float timeCT = m_lastSawCT.GetElapsedTime(); @@ -1570,19 +1518,16 @@ float CHostageImprov::GetTimeSinceLastSawPlayer(int team) } } -/* <474f2c> ../cstrike/dlls/hostage/hostage_improv.cpp:2098 */ float CHostageImprov::GetTimeSinceLastInjury() { return m_lastInjuryTimer.GetElapsedTime(); } -/* <474fb3> ../cstrike/dlls/hostage/hostage_improv.cpp:2107 */ float CHostageImprov::GetTimeSinceLastNoise() { return m_lastNoiseTimer.GetElapsedTime(); } -/* <47503a> ../cstrike/dlls/hostage/hostage_improv.cpp:2117 */ bool CHostageImprov::IsScared() const { if (m_scaredTimer.IsElapsed()) @@ -1593,7 +1538,6 @@ bool CHostageImprov::IsScared() const return true; } -/* <47506e> ../cstrike/dlls/hostage/hostage_improv.cpp:2129 */ void CHostageImprov::Frighten(ScareType scare) { const float ignoreTime = 10.0f; @@ -1621,7 +1565,6 @@ void CHostageImprov::Frighten(ScareType scare) } } -/* <475200> ../cstrike/dlls/hostage/hostage_improv.cpp:2165 */ void CHostageImprov::Afraid() { char animInto[32]; @@ -1652,7 +1595,6 @@ void CHostageImprov::Afraid() } } -/* <475290> ../cstrike/dlls/hostage/hostage_improv.cpp:2201 */ void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget) { if (m_animateState.IsBusy()) @@ -1662,19 +1604,18 @@ void CHostageImprov::UpdateIdleActivity(Activity activity, Activity fidget) if (m_didFidget || fidget == ACT_RESET) { - m_animateState.AddSequence(this, activity, RANDOM_FLOAT(1, 10), RANDOM_FLOAT(0.9, 1.1)); + m_animateState.AddSequence(this, activity, RANDOM_FLOAT(1, 10), RANDOM_FLOAT(0.9f, 1.1f)); m_didFidget = false; } else { - m_animateState.AddSequence(this, fidget, -1, RANDOM_FLOAT(0.9, 1.5)); + m_animateState.AddSequence(this, fidget, -1, RANDOM_FLOAT(0.9f, 1.5f)); m_didFidget = true; } } -/* <4752d9> ../cstrike/dlls/hostage/hostage_improv.cpp:2226 */ void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak) { if (!IsAlive() && sayType != HOSTAGE_CHATTER_DEATH_CRY) @@ -1691,7 +1632,6 @@ void CHostageImprov::Chatter(HostageChatterType sayType, bool mustSpeak) } } -/* <475b35> ../cstrike/dlls/hostage/hostage_improv.cpp:2249 */ void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak) { if (!IsAlive()) @@ -1706,7 +1646,6 @@ void CHostageImprov::DelayedChatter(float delayTime, HostageChatterType sayType, } } -/* <475bd4> ../cstrike/dlls/hostage/hostage_improv.cpp:2268 */ void CHostageImprov::UpdateDelayedChatter() { if (!m_isDelayedChatterPending) @@ -1720,7 +1659,7 @@ void CHostageImprov::UpdateDelayedChatter() switch (m_delayedChatterType) { case HOSTAGE_CHATTER_SCARED_OF_GUNFIRE: - if (RANDOM_FLOAT(0, 100) <= 25) + if (RANDOM_FLOAT(0, 100) <= 25.0f) { Chatter(m_delayedChatterType, m_delayedChatterMustSpeak); } @@ -1728,7 +1667,7 @@ void CHostageImprov::UpdateDelayedChatter() case HOSTAGE_CHATTER_LOOK_OUT: case HOSTAGE_CHATTER_PLEASE_RESCUE_ME: case HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE: - if (RANDOM_FLOAT(0, 100) <= 60) + if (RANDOM_FLOAT(0, 100) <= 60.0f) { Chatter(m_delayedChatterType, m_delayedChatterMustSpeak); } @@ -1739,7 +1678,6 @@ void CHostageImprov::UpdateDelayedChatter() } } -/* <4761eb> ../cstrike/dlls/hostage/hostage_improv.cpp:2307 */ void CHostageImprov::Flinch(Activity activity) { Chatter(HOSTAGE_CHATTER_PAIN, true); @@ -1752,31 +1690,27 @@ void CHostageImprov::Flinch(Activity activity) } } -/* <4762fe> ../cstrike/dlls/hostage/hostage_improv.cpp:2329 */ void CHostageImprov::CrouchDie() { m_animateState.Reset(); m_animateState.AddSequence(this, ACT_CROUCH_DIE); } -/* <476327> ../cstrike/dlls/hostage/hostage_improv.cpp:2339 */ void CHostageImprov::Agree() { m_animateState.Reset(); m_animateState.AddSequence(this, ACT_YES); } -/* <476350> ../cstrike/dlls/hostage/hostage_improv.cpp:2349 */ void CHostageImprov::Disagree() { if (m_animateState.GetPerformance() != HostageAnimateState::Disagreeing) { m_animateState.Reset(); - m_animateState.AddSequence(this, ACT_NO, -1.0, RANDOM_FLOAT(1.5, 3.0)); + m_animateState.AddSequence(this, ACT_NO, -1.0, RANDOM_FLOAT(1.5f, 3.0f)); } } -/* <476395> ../cstrike/dlls/hostage/hostage_improv.cpp:2363 */ void CHostageImprov::Wave() { m_animateState.Reset(); @@ -1785,8 +1719,6 @@ void CHostageImprov::Wave() } // Invoked when an improv fails to reach a MoveTo goal - -/* <474938> ../cstrike/dlls/hostage/hostage_improv.cpp:2375 */ void CHostageImprov::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFailureType reason) { m_behavior.OnMoveToFailure(goal, reason); @@ -1797,14 +1729,13 @@ void CHostageImprov::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFai } } -/* <4763d7> ../cstrike/dlls/hostage/hostage_improv.cpp:2391 */ void CHostageImprov::Wiggle() { // for wiggling if (m_wiggleTimer.IsElapsed()) { m_wiggleDirection = static_cast(RANDOM_LONG(FORWARD, LEFT)); - m_wiggleTimer.Start(RANDOM_FLOAT(0.3, 0.5)); + m_wiggleTimer.Start(RANDOM_FLOAT(0.3f, 0.5f)); } const float force = 15.0f; @@ -1839,7 +1770,6 @@ void CHostageImprov::Wiggle() } } -/* <4766cc> ../cstrike/dlls/hostage/hostage_improv.cpp:2438 */ void CHostageImprov::ClearPath() { Vector start; @@ -1849,7 +1779,7 @@ void CHostageImprov::ClearPath() if (!m_clearPathTimer.IsElapsed()) return; - m_clearPathTimer.Start(RANDOM_FLOAT(0.3, 0.5)); + m_clearPathTimer.Start(RANDOM_FLOAT(0.3f, 0.5f)); const Vector eye = GetEyes(); start = eye; @@ -1887,7 +1817,6 @@ void CHostageImprov::ClearPath() } } -/* <471b3f> ../cstrike/dlls/hostage/hostage_improv.cpp:2497 */ void CHostageImprov::__MAKE_VHOOK(Crouch)() { const float minCrouchTime = 1.0f; @@ -1900,7 +1829,6 @@ void CHostageImprov::__MAKE_VHOOK(Crouch)() UTIL_SetSize(m_hostage->pev, VEC_HOSTAGE_HULL_MIN, VEC_HOSTAGE_CROUCH); } -/* <47195c> ../cstrike/dlls/hostage/hostage_improv.cpp:2516 */ void CHostageImprov::__MAKE_VHOOK(StandUp)() { if (!IsCrouching() || !m_minCrouchTimer.IsElapsed()) @@ -1921,6 +1849,7 @@ void CHostageImprov::__MAKE_VHOOK(StandUp)() } } + // HalfHumanHeight if (y == 36) { m_animateState.Reset(); @@ -1929,7 +1858,6 @@ void CHostageImprov::__MAKE_VHOOK(StandUp)() } } -/* <477114> ../cstrike/dlls/hostage/hostage_improv.cpp:2558 */ void CHostageImprov::UpdateStationaryAnimation() { m_behavior.UpdateStationaryAnimation(this); diff --git a/regamedll/dlls/hostage/hostage_improv.h b/regamedll/dlls/hostage/hostage_improv.h index 4617c0b9..bd1f9c90 100644 --- a/regamedll/dlls/hostage/hostage_improv.h +++ b/regamedll/dlls/hostage/hostage_improv.h @@ -152,6 +152,10 @@ public: #endif // HOOK_GAMEDLL +#ifdef PLAY_GAMEDLL + void ApplyForce2(float_precision x, float_precision y); +#endif + public: enum MoveType { Stopped, Walking, Running }; enum ScareType { NERVOUS, SCARED, TERRIFIED }; @@ -161,28 +165,8 @@ public: void SetKnownGoodPosition(const Vector &pos); const Vector &GetKnownGoodPosition() const { return m_knownGoodPos; } void ResetToKnownGoodPosition(); - void ResetJump() - { - if (m_hasJumpedIntoAir) - { - if (IsOnGround()) - { - m_jumpTimer.Invalidate(); - } - } - else if (!IsOnGround()) - { - m_hasJumpedIntoAir = true; - } - } + void ResetJump(); void ApplyForce(Vector force); // apply a force to the hostage -#ifdef PLAY_GAMEDLL - void ApplyForce2(float_precision x, float_precision y) - { - m_vel.x += x; - m_vel.y += y; - } -#endif // PLAY_GAMEDLL const Vector GetActualVelocity() const { return m_actualVel; } void SetMoveLimit(MoveType limit) { m_moveLimit = limit; } MoveType GetMoveLimit() const { return m_moveLimit; } @@ -217,11 +201,11 @@ public: void Frighten(ScareType scare); bool IsScared() const; ScareType GetScareIntensity() const { return m_scareIntensity; } - bool IsIgnoringTerrorists() const { m_ignoreTerroristTimer.IsElapsed(); } + bool IsIgnoringTerrorists() const { return m_ignoreTerroristTimer.IsElapsed(); } float GetAggression() const { return m_aggression; } void Chatter(HostageChatterType sayType, bool mustSpeak = true); void DelayedChatter(float delayTime, HostageChatterType sayType, bool mustSpeak = false); - NOXREF void UpdateDelayedChatter(); + void UpdateDelayedChatter(); bool IsTalking() const { return m_talkingTimer.IsElapsed(); } void UpdateGrenadeReactions(); void Afraid(); @@ -234,7 +218,7 @@ public: void UpdateStationaryAnimation(); CHostage *GetEntity() const { return m_hostage; } void CheckForNearbyTerrorists(); - void UpdatePosition(float); + void UpdatePosition(float deltaT); void MoveTowards(const Vector &pos, float deltaT); bool FaceTowards(const Vector &target, float deltaT); // rotate body to face towards "target" float GetSpeed(); @@ -317,12 +301,11 @@ private: Vector m_jumpTarget; CountdownTimer m_clearPathTimer; bool m_traversingLadder; - EHANDLE m_visiblePlayer[ MAX_CLIENTS ]; + EHANDLE m_visiblePlayer[MAX_CLIENTS]; int m_visiblePlayerCount; CountdownTimer m_visionTimer; }; -/* <46fac7> ../cstrike/dlls/hostage/hostage_improv.cpp:363 */ class CheckWayFunctor { public: @@ -350,8 +333,6 @@ public: // Functor used with NavAreaBuildPath() for building Hostage paths. // Once we hook up crouching and ladders, this can be removed and ShortestPathCost() can be used instead. - -/* <46f426> ../cstrike/dlls/hostage/hostage_improv.h:400 */ class HostagePathCost { public: @@ -398,7 +379,6 @@ public: } }; -/* <4700b6> ../cstrike/dlls/hostage/hostage_improv.cpp:931 */ class KeepPersonalSpace { public: @@ -427,7 +407,8 @@ public: range = to.NormalizeInPlace(); #else range = to.NormalizeInPlace(); -#endif // PLAY_GAMEDLL +#endif + CBasePlayer *player = static_cast(entity); const float spring = 50.0f; @@ -448,7 +429,7 @@ public: #else // TODO: fix test demo m_improv->ApplyForce2(to.x * ds, to.y * ds); -#endif // PLAY_GAMEDLL +#endif const float force = 0.1f; m_improv->ApplyForce(m_speed * -force * m_velDir); @@ -462,7 +443,6 @@ private: float m_speed; }; -/* <46fbb8> ../cstrike/dlls/hostage/hostage_improv.cpp:518 */ class CheckAhead { public: @@ -498,4 +478,26 @@ private: bool m_isBlocked; }; +#ifdef PLAY_GAMEDLL +inline void CHostageImprov::ApplyForce2(float_precision x, float_precision y) +{ + m_vel.x += x; + m_vel.y += y; +} +#endif +inline void CHostageImprov::ResetJump() +{ + if (m_hasJumpedIntoAir) + { + if (IsOnGround()) + { + m_jumpTimer.Invalidate(); + } + } + else if (!IsOnGround()) + { + m_hasJumpedIntoAir = true; + } +} + #endif // HOSTAGE_IMPROV_H diff --git a/regamedll/dlls/hostage/hostage_localnav.cpp b/regamedll/dlls/hostage/hostage_localnav.cpp index d58949f4..7ca4a078 100644 --- a/regamedll/dlls/hostage/hostage_localnav.cpp +++ b/regamedll/dlls/hostage/hostage_localnav.cpp @@ -15,9 +15,8 @@ float CLocalNav::flLastThinkTime; EHANDLE CLocalNav::hostages[MAX_HOSTAGES_NAV]; int CLocalNav::tot_hostages; -#endif // HOOK_GAMEDLL +#endif -/* <485b67> ../cstrike/dlls/hostage/hostage_localnav.cpp:45 */ CLocalNav::CLocalNav(CHostage *pOwner) { m_pOwner = pOwner; @@ -32,19 +31,18 @@ CLocalNav::CLocalNav(CHostage *pOwner) hostages[tot_hostages++] = pOwner; } -/* <485b09> ../cstrike/dlls/hostage/hostage_localnav.cpp:68 */ CLocalNav::~CLocalNav() { delete m_nodeArr; + m_nodeArr = NULL; } -/* <485b91> ../cstrike/dlls/hostage/hostage_localnav.cpp:74 */ node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int offsetX, int offsetY, byte bDepth) { localnode_t *nodeNew; if (m_nindexAvailableNode == MAX_NODES) - return -1; + return NODE_INVALID_EMPTY; nodeNew = GetNode(m_nindexAvailableNode); @@ -58,13 +56,11 @@ node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int o return m_nindexAvailableNode++; } -/* <485570> ../cstrike/dlls/hostage/hostage_localnav.cpp:94 */ localnode_t *CLocalNav::GetNode(node_index_t nindex) { return &m_nodeArr[ nindex ]; } -/* <485c01> ../cstrike/dlls/hostage/hostage_localnav.cpp:100 */ node_index_t CLocalNav::NodeExists(int offsetX, int offsetY) { node_index_t nindexCurrent = NODE_INVALID_EMPTY; @@ -83,7 +79,6 @@ node_index_t CLocalNav::NodeExists(int offsetX, int offsetY) return nindexCurrent; } -/* <486d46> ../cstrike/dlls/hostage/hostage_localnav.cpp:123 */ void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters) { AddPathNode(nindexSource, 1, 0, fNoMonsters); @@ -96,14 +91,13 @@ void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters) AddPathNode(nindexSource, -1, -1, fNoMonsters); } -/* <486adb> ../cstrike/dlls/hostage/hostage_localnav.cpp:138 */ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters) { int bDepth; Vector vecSource, vecDest; int offsetXAbs, offsetYAbs; - if (nindexSource == -1) + if (nindexSource == NODE_INVALID_EMPTY) { bDepth = 1; @@ -111,7 +105,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, offsetYAbs = offsetY; vecSource = m_vecStartingLoc; - vecDest = vecSource + Vector(((float_precision)offsetX * HOSTAGE_STEPSIZE), ((float_precision)offsetY * HOSTAGE_STEPSIZE), 0); + vecDest = vecSource + Vector(float_precision(offsetX) * HOSTAGE_STEPSIZE, float_precision(offsetY) * HOSTAGE_STEPSIZE, 0); } else { @@ -131,7 +125,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, } vecSource = nodeCurrent->vecLoc; - vecDest = vecSource + Vector(((float_precision)offsetX * HOSTAGE_STEPSIZE), ((float_precision)offsetY * HOSTAGE_STEPSIZE), 0); + vecDest = vecSource + Vector((float_precision(offsetX) * HOSTAGE_STEPSIZE), (float_precision(offsetY) * HOSTAGE_STEPSIZE), 0); if (m_nindexAvailableNode) { @@ -186,7 +180,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, } vecSource = nodeCurrent->vecLoc; - bDepth = ((int)nodeCurrent->bDepth) + 1; + bDepth = int(nodeCurrent->bDepth) + 1; } if (PathTraversable(vecSource, vecDest, fNoMonsters) != PATH_TRAVERSABLE_EMPTY) @@ -195,7 +189,6 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, } } -/* <485c63> ../cstrike/dlls/hostage/hostage_localnav.cpp:205 */ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest) { node_index_t nindexCurrent; @@ -203,7 +196,7 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest) node_index_t nindexBest; float flBestVal; - nindexBest = -1; + nindexBest = NODE_INVALID_EMPTY; nindexCurrent = 0; flBestVal = 1000000.0; @@ -234,7 +227,7 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest) else flZDiff = 1.25; - flCurrentVal = flZDiff * (((float_precision)nodeCurrent->bDepth * HOSTAGE_STEPSIZE) + flDistFromStart); + flCurrentVal = flZDiff * (float_precision(nodeCurrent->bDepth) * HOSTAGE_STEPSIZE + flDistFromStart); if (flCurrentVal < flBestVal) { flBestVal = flCurrentVal; @@ -248,13 +241,12 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest) return nindexBest; } -/* <485d79> ../cstrike/dlls/hostage/hostage_localnav.cpp:263 */ int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters) { node_index_t nCurrentIndex = nindex; int nNodeCount = 0; - while (nCurrentIndex != -1) + while (nCurrentIndex != NODE_INVALID_EMPTY) { localnode_t *nodeCurrent = GetNode(nCurrentIndex); Vector vecCurrentLoc = nodeCurrent->vecLoc; @@ -266,7 +258,6 @@ int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMons return nNodeCount; } -/* <486a56> ../cstrike/dlls/hostage/hostage_localnav.cpp:290 */ int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters) { int nCount = 0; @@ -281,12 +272,11 @@ int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNod return -1; } -/* <486d8d> ../cstrike/dlls/hostage/hostage_localnav.cpp:304 */ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters) { node_index_t nIndexBest = FindDirectPath(vecStart, vecDest, flTargetRadius, fNoMonsters); - if (nIndexBest != -1) + if (nIndexBest != NODE_INVALID_EMPTY) { return nIndexBest; } @@ -298,10 +288,10 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg m_vecStartingLoc = vecStart; m_nindexAvailableNode = 0; - AddPathNodes(-1, fNoMonsters); + AddPathNodes(NODE_INVALID_EMPTY, fNoMonsters); nIndexBest = GetBestNode(vecStart, vecDest); - while (nIndexBest != -1) + while (nIndexBest != NODE_INVALID_EMPTY) { node = GetNode(nIndexBest); node->fSearched = TRUE; @@ -318,7 +308,7 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg if (((flDistToDest - flTargetRadius) > ((MAX_NODES - m_nindexAvailableNode) * HOSTAGE_STEPSIZE)) || m_nindexAvailableNode == MAX_NODES) { - nIndexBest = -1; + nIndexBest = NODE_INVALID_EMPTY; break; } @@ -379,7 +369,6 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg return nIndexBest; } -/* <4867dc> ../cstrike/dlls/hostage/hostage_localnav.cpp:413 */ node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters) { Vector vecActualDest; @@ -392,10 +381,10 @@ node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float if (PathTraversable(vecStart, vecActualDest, fNoMonsters) == PATH_TRAVERSABLE_EMPTY) { - return -1; + return NODE_INVALID_EMPTY; } - nindexLast = -1; + nindexLast = NODE_INVALID_EMPTY; vecNodeLoc = vecStart; m_nindexAvailableNode = 0; @@ -406,14 +395,13 @@ node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float vecNodeLoc = vecNodeLoc + (vecPathDir * HOSTAGE_STEPSIZE); nindexLast = AddNode(nindexCurrent, vecNodeLoc); - if (nindexLast == -1) + if (nindexLast == NODE_INVALID_EMPTY) break; } return nindexLast; } -/* <485e40> ../cstrike/dlls/hostage/hostage_localnav.cpp:449 */ BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr) { TRACE_MONSTER_HULL(m_pOwner->edict(), vecOrigin, vecDest, fNoMonsters, m_pOwner->edict(), &tr); @@ -433,7 +421,6 @@ BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, T return FALSE; } -/* <485ecf> ../cstrike/dlls/hostage/hostage_localnav.cpp:472 */ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters) { TraceResult tr; @@ -451,7 +438,7 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste flTotal = vecDestTmp.Length2D(); - while (flTotal > 1.0) + while (flTotal > 1.0f) { if (flTotal >= s_flStepSize) { @@ -460,9 +447,9 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste #else // TODO: fix test demo vecDestTmp[0] = vecSrcTmp[0] + (vecDir[0] * s_flStepSize); - vecDestTmp[1] = vecSrcTmp[1] + (float)(vecDir[1] * s_flStepSize); + vecDestTmp[1] = vecSrcTmp[1] + float(vecDir[1] * s_flStepSize); vecDestTmp[2] = vecSrcTmp[2] + (vecDir[2] * s_flStepSize); -#endif // PLAY_GAMEDLL +#endif } else @@ -496,7 +483,7 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste vecSrcTmp = tr.vecEndPos; - if (tr.vecPlaneNormal.z <= 0.7) + if (tr.vecPlaneNormal.z <= MaxUnitZSlope) { if (StepTraversable(vecSrcTmp, vecDestTmp, fNoMonsters, tr)) { @@ -558,7 +545,6 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste return retval; } -/* <486ea0> ../cstrike/dlls/hostage/hostage_localnav.cpp:593 */ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) { Vector vecSlopeEnd; @@ -569,14 +555,14 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons vecDown = vecDest - vecSource; vecAngles = UTIL_VecToAngles(tr.vecPlaneNormal); - vecSlopeEnd.z = vecDown.Length2D() * tan((float_precision)((90.0 - vecAngles.x) * (M_PI / 180))) + vecSource.z; + vecSlopeEnd.z = vecDown.Length2D() * Q_tan(float_precision((90.0 - vecAngles.x) * (M_PI / 180))) + vecSource.z; if (!PathClear(vecSource, vecSlopeEnd, fNoMonsters, tr)) { if (tr.fStartSolid) return FALSE; - if ((tr.vecEndPos - vecSource).Length2D() < 1.0) + if ((tr.vecEndPos - vecSource).Length2D() < 1.0f) return FALSE; } @@ -598,7 +584,6 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons return TRUE; } -/* <487085> ../cstrike/dlls/hostage/hostage_localnav.cpp:635 */ BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) { Vector vecStepStart; @@ -613,7 +598,7 @@ BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMon if (tr.fStartSolid) return FALSE; - if ((tr.vecEndPos - vecStepStart).Length() < 1) + if ((tr.vecEndPos - vecStepStart).Length() < 1.0f) return FALSE; } @@ -623,7 +608,6 @@ BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMon return PathTraversable(vecStepStart, vecDest, fNoMonsters); } -/* <4871ef> ../cstrike/dlls/hostage/hostage_localnav.cpp:662 */ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) { Vector vecStepStart; @@ -644,7 +628,7 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst flFwdFraction = (tr.vecEndPos - vecStepStart).Length(); - if (flFwdFraction < 1.0) + if (flFwdFraction < 1.0f) return FALSE; } @@ -666,21 +650,20 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst return TRUE; } -/* <4873b3> ../cstrike/dlls/hostage/hostage_localnav.cpp:713 */ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) { Vector vecStepStart; Vector vecStepDest; //BOOL fFwdTrace = FALSE; // unused? float flFwdFraction; - float flJumpHeight = s_flStepSize + 1.0; + float flJumpHeight = s_flStepSize + 1.0f; //BOOL fJumpClear = FALSE; // unused? //edict_t *hit = NULL; // unused? vecStepStart = vecSource; vecStepStart.z += flJumpHeight; - while (flJumpHeight < 40.0) + while (flJumpHeight < 40.0f) { vecStepDest = vecDest; vecStepDest.z = vecStepStart.z; @@ -692,10 +675,10 @@ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters flFwdFraction = (tr.vecEndPos - vecStepStart).Length2D(); - if (flFwdFraction < 1.0) + if (flFwdFraction < 1.0f) { - flJumpHeight += 10.0; - vecStepStart.z += 10.0; + flJumpHeight += 10.0f; + vecStepStart.z += 10.0f; continue; } @@ -721,7 +704,6 @@ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters return FALSE; } -/* <487588> ../cstrike/dlls/hostage/hostage_localnav.cpp:824 */ BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr) { Vector vecFwd, vecRight, vecUp; @@ -762,7 +744,6 @@ BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr) return false; } -/* <487eeb> ../cstrike/dlls/hostage/hostage_localnav.cpp:851 */ void CLocalNav::Think() { EHANDLE hCallback; @@ -778,7 +759,7 @@ void CLocalNav::Think() s_flStepSize = s_flStepSize ? sv_stepsize->value : HOSTAGE_STEPSIZE_DEFAULT; } - flNextCvarCheck = gpGlobals->time + 1; + flNextCvarCheck = gpGlobals->time + 1.0f; } HostagePrethink(); @@ -831,7 +812,6 @@ void CLocalNav::Think() } } -/* <487ccd> ../cstrike/dlls/hostage/hostage_localnav.cpp:922 */ void CLocalNav::RequestNav(CHostage *pCaller) { int curr = qptr; @@ -863,7 +843,6 @@ void CLocalNav::RequestNav(CHostage *pCaller) ++tot_inqueue; } -/* <487e03> ../cstrike/dlls/hostage/hostage_localnav.cpp:964 */ void CLocalNav::Reset() { flNextCvarCheck = 0; @@ -874,7 +853,6 @@ void CLocalNav::Reset() tot_hostages = 0; } -/* <487e14> ../cstrike/dlls/hostage/hostage_localnav.cpp:976 */ void CLocalNav::HostagePrethink() { for (int iCount = 0; iCount < tot_hostages; ++iCount) diff --git a/regamedll/dlls/hostage/hostage_localnav.h b/regamedll/dlls/hostage/hostage_localnav.h index 4824f128..be6d1c75 100644 --- a/regamedll/dlls/hostage/hostage_localnav.h +++ b/regamedll/dlls/hostage/hostage_localnav.h @@ -41,7 +41,6 @@ typedef int node_index_t; -/* <48522d> ../cstrike/dlls/hostage/hostage_localnav.h:43 */ typedef struct localnode_s { Vector vecLoc; @@ -57,9 +56,8 @@ typedef struct localnode_s #define s_flStepSize_LocalNav m_LocalNav->s_flStepSize -#endif // HOOK_GAMEDLL +#endif -/* <45aaa2> ../cstrike/dlls/hostage/hostage_localnav.h:58 */ class CLocalNav { public: @@ -68,7 +66,7 @@ public: void SetTargetEnt(CBaseEntity *pTarget) { - if (pTarget) + if (pTarget != NULL) m_pTargetEnt = pTarget->edict(); else m_pTargetEnt = NULL; @@ -105,21 +103,17 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif - static EHANDLE _queue[ MAX_HOSTAGES_NAV ]; + static EHANDLE _queue[MAX_HOSTAGES_NAV]; static int qptr; static int tot_inqueue; static float nodeval; static float flNextCvarCheck; static float flLastThinkTime; - static EHANDLE hostages[ MAX_HOSTAGES_NAV ]; + static EHANDLE hostages[MAX_HOSTAGES_NAV]; static int tot_hostages; -#ifdef HOOK_GAMEDLL -private: -#endif // HOOK_GAMEDLL - CHostage *m_pOwner; edict_t *m_pTargetEnt; BOOL m_fTargetEntHit; diff --git a/regamedll/dlls/hostage/hostage_states.h b/regamedll/dlls/hostage/hostage_states.h index ae388482..0aea8085 100644 --- a/regamedll/dlls/hostage/hostage_states.h +++ b/regamedll/dlls/hostage/hostage_states.h @@ -34,7 +34,6 @@ class CHostageImprov; -/* <46f85d> ../cstrike/dlls/hostage/hostage_states.h:16 */ class HostageState: public SimpleState, public IImprovEvent { public: @@ -42,7 +41,6 @@ public: virtual void UpdateStationaryAnimation(CHostageImprov *improv) {}; }; -/* <46f922> ../cstrike/dlls/hostage/hostage_states.h:26 */ class HostageStateMachine: public SimpleStateMachine, public IImprovEvent { public: @@ -68,7 +66,6 @@ public: } }; -/* <46fccf> ../cstrike/dlls/hostage/hostage_states.h:38 */ class HostageIdleState: public HostageState { public: @@ -90,7 +87,7 @@ public: void OnExit_(CHostageImprov *improv); void UpdateStationaryAnimation_(CHostageImprov *improv); -#endif // HOOK_GAMEDLL +#endif private: CountdownTimer m_waveTimer; @@ -112,7 +109,6 @@ private: bool m_mustFlee; }; -/* <46f8ec> ../cstrike/dlls/hostage/hostage_states.h:71 */ class HostageEscapeToCoverState: public HostageState { public: @@ -131,7 +127,7 @@ public: void OnExit_(CHostageImprov *improv); void OnMoveToFailure_(const Vector &goal, MoveToFailureType reason); -#endif // HOOK_GAMEDLL +#endif public: void SetRescueGoal(const Vector &rescueGoal) { m_rescueGoal = rescueGoal; } @@ -142,7 +138,6 @@ private: bool m_canEscape; }; -/* <46f907> ../cstrike/dlls/hostage/hostage_states.h:92 */ class HostageEscapeLookAroundState: public HostageState { public: @@ -159,13 +154,12 @@ public: void OnUpdate_(CHostageImprov *improv); void OnExit_(CHostageImprov *improv); -#endif // HOOK_GAMEDLL +#endif private: CountdownTimer m_timer; }; -/* <46fcea> ../cstrike/dlls/hostage/hostage_states.h:109 */ class HostageEscapeState: public HostageState { public: @@ -188,7 +182,7 @@ public: void OnUpdate_(CHostageImprov *improv); void OnExit_(CHostageImprov *improv); -#endif // HOOK_GAMEDLL +#endif public: void ToCover() { m_behavior.SetState(&m_toCoverState); } @@ -202,7 +196,6 @@ private: CountdownTimer m_runTimer; }; -/* <46fd03> ../cstrike/dlls/hostage/hostage_states.h:138 */ class HostageRetreatState: public HostageState { public: @@ -219,11 +212,10 @@ public: void OnUpdate_(CHostageImprov *improv); void OnExit_(CHostageImprov *improv); -#endif // HOOK_GAMEDLL +#endif }; -/* <46fd1e> ../cstrike/dlls/hostage/hostage_states.h:149 */ class HostageFollowState: public HostageState { public: @@ -242,7 +234,7 @@ public: void OnExit_(CHostageImprov *improv); void UpdateStationaryAnimation_(CHostageImprov *improv); -#endif // HOOK_GAMEDLL +#endif public: void SetLeader(CBaseEntity *leader) { m_leader = leader; } @@ -260,7 +252,6 @@ private: CountdownTimer m_waitForFriendTimer; }; -/* <46fd39> ../cstrike/dlls/hostage/hostage_states.h:186 */ class HostageAnimateState: public HostageState { public: @@ -277,7 +268,7 @@ public: void OnUpdate_(CHostageImprov *improv); void OnExit_(CHostageImprov *improv); -#endif // HOOK_GAMEDLL +#endif public: struct SeqInfo @@ -312,7 +303,7 @@ public: void AddSequence(CHostageImprov *improv, int activity, float holdTime = -1.0f, float rate = 1.0f); bool IsBusy() const { return (m_sequenceCount > 0); } - NOXREF bool IsPlaying(CHostageImprov *improv, const char *seqName) const; + bool IsPlaying(CHostageImprov *improv, const char *seqName) const; int GetCurrentSequenceID() { return m_currentSequence; } PerformanceType GetPerformance() const { return m_performance; } void SetPerformance(PerformanceType performance) { m_performance = performance; } @@ -321,7 +312,7 @@ public: private: enum { MAX_SEQUENCES = 8 }; - struct SeqInfo m_sequence[ MAX_SEQUENCES ]; + struct SeqInfo m_sequence[MAX_SEQUENCES]; int m_sequenceCount; int m_currentSequence; enum PerformanceType m_performance; diff --git a/regamedll/dlls/hostage/states/hostage_animate.cpp b/regamedll/dlls/hostage/states/hostage_animate.cpp index 40886d4d..493d2627 100644 --- a/regamedll/dlls/hostage/states/hostage_animate.cpp +++ b/regamedll/dlls/hostage/states/hostage_animate.cpp @@ -1,13 +1,11 @@ #include "precompiled.h" -/* <4110a1> ../cstrike/dlls/hostage/states/hostage_animate.cpp:13 */ void HostageAnimateState::Reset() { m_sequenceCount = 0; m_performance = None; } -/* <4110c7> ../cstrike/dlls/hostage/states/hostage_animate.cpp:20 */ void HostageAnimateState::StartSequence(CHostageImprov *improv, const SeqInfo *seqInfo) { if (seqInfo->seqID >= 0) @@ -24,13 +22,12 @@ void HostageAnimateState::StartSequence(CHostageImprov *improv, const SeqInfo *s m_isHolding = false; } -/* <41110a> ../cstrike/dlls/hostage/states/hostage_animate.cpp:41 */ void HostageAnimateState::AddSequence(CHostageImprov *improv, const char *seqName, float holdTime, float rate) { int seqIndex; CHostage *hostage = improv->GetEntity(); - if (m_sequenceCount >= 8) + if (m_sequenceCount >= MAX_SEQUENCES) return; if (seqName != NULL) @@ -40,15 +37,12 @@ void HostageAnimateState::AddSequence(CHostageImprov *improv, const char *seqNam m_sequence[m_sequenceCount].seqID = seqIndex; m_sequence[m_sequenceCount].holdTime = holdTime; - m_sequence[m_sequenceCount].rate = rate; - + m_sequence[m_sequenceCount++].rate = rate; m_currentSequence = 0; - m_sequenceCount++; StartSequence(improv, m_sequence); } -/* <4111be> ../cstrike/dlls/hostage/states/hostage_animate.cpp:62 */ void HostageAnimateState::AddSequence(CHostageImprov *improv, int activity, float holdTime, float rate) { CHostage *hostage = improv->GetEntity(); @@ -58,16 +52,13 @@ void HostageAnimateState::AddSequence(CHostageImprov *improv, int activity, floa { m_sequence[m_sequenceCount].seqID = LookupActivity(model, hostage->pev, activity); m_sequence[m_sequenceCount].holdTime = holdTime; - m_sequence[m_sequenceCount].rate = rate; - + m_sequence[m_sequenceCount++].rate = rate; m_currentSequence = 0; - m_sequenceCount++; } StartSequence(improv, m_sequence); } -/* <41127f> ../cstrike/dlls/hostage/states/hostage_animate.cpp:81 */ bool HostageAnimateState::IsDoneHolding() { if (m_sequence[m_currentSequence].holdTime < 0) @@ -81,13 +72,11 @@ bool HostageAnimateState::IsDoneHolding() return false; } -/* <410d45> ../cstrike/dlls/hostage/states/hostage_animate.cpp:103 */ void HostageAnimateState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) { ; } -/* <410fb2> ../cstrike/dlls/hostage/states/hostage_animate.cpp:108 */ void HostageAnimateState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) { if (m_sequenceCount <= 0) @@ -114,13 +103,11 @@ void HostageAnimateState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) StartSequence(improv, &m_sequence[m_currentSequence]); } -/* <410d79> ../cstrike/dlls/hostage/states/hostage_animate.cpp:139 */ void HostageAnimateState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv) { ; } -/* <4112d1> ../cstrike/dlls/hostage/states/hostage_animate.cpp:147 */ NOXREF bool HostageAnimateState::IsPlaying(CHostageImprov *improv, const char *seqName) const { int id = 0; diff --git a/regamedll/dlls/hostage/states/hostage_escape.cpp b/regamedll/dlls/hostage/states/hostage_escape.cpp index ac052af3..19e3e36d 100644 --- a/regamedll/dlls/hostage/states/hostage_escape.cpp +++ b/regamedll/dlls/hostage/states/hostage_escape.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <4205b1> ../cstrike/dlls/hostage/states/hostage_escape.cpp:12 */ void HostageEscapeToCoverState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) { CNavPath path; @@ -36,7 +35,6 @@ void HostageEscapeToCoverState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) m_canEscape = true; } -/* <41fd51> ../cstrike/dlls/hostage/states/hostage_escape.cpp:52 */ void HostageEscapeToCoverState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) { if (!m_canEscape) @@ -69,22 +67,17 @@ void HostageEscapeToCoverState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) } } -/* <41f65f> ../cstrike/dlls/hostage/states/hostage_escape.cpp:95 */ void HostageEscapeToCoverState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv) { ; } -/* <41faaf> ../cstrike/dlls/hostage/states/hostage_escape.cpp:100 */ -#ifndef HOOK_GAMEDLL void HostageEscapeToCoverState::__MAKE_VHOOK(OnMoveToFailure)(const Vector &goal, MoveToFailureType reason) { HostageEscapeState *escape = static_cast(GetParent()); escape->LookAround(); } -#endif // HOOK_GAMEDLL -/* <41fa2f> ../cstrike/dlls/hostage/states/hostage_escape.cpp:110 */ void HostageEscapeLookAroundState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) { m_timer.Start(RANDOM_FLOAT(5, 10)); @@ -93,7 +86,6 @@ void HostageEscapeLookAroundState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) improv->FaceOutwards(); } -/* <41fc67> ../cstrike/dlls/hostage/states/hostage_escape.cpp:119 */ void HostageEscapeLookAroundState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) { improv->UpdateIdleActivity(ACT_IDLE_SNEAKY, ACT_IDLE_SNEAKY_FIDGET); @@ -105,17 +97,14 @@ void HostageEscapeLookAroundState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv } } -/* <41f693> ../cstrike/dlls/hostage/states/hostage_escape.cpp:133 */ void HostageEscapeLookAroundState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv) { improv->ClearFaceTo(); } -/* <41fb6b> ../cstrike/dlls/hostage/states/hostage_escape.cpp:145 */ void HostageEscapeState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) { - CCSBotManager *ctrl = TheCSBots(); - const CCSBotManager::Zone *zone = ctrl->GetRandomZone(); + const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone(); if (zone != NULL) { @@ -128,7 +117,6 @@ void HostageEscapeState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) m_canEscape = true; } -/* <41fe8e> ../cstrike/dlls/hostage/states/hostage_escape.cpp:167 */ void HostageEscapeState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) { if (!m_canEscape || (improv->IsScared() && improv->GetScareIntensity() == CHostageImprov::TERRIFIED)) @@ -176,7 +164,6 @@ void HostageEscapeState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) } } -/* <41f6c7> ../cstrike/dlls/hostage/states/hostage_escape.cpp:230 */ void HostageEscapeState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv) { improv->Run(); diff --git a/regamedll/dlls/hostage/states/hostage_follow.cpp b/regamedll/dlls/hostage/states/hostage_follow.cpp index b34a83a1..dcb141c5 100644 --- a/regamedll/dlls/hostage/states/hostage_follow.cpp +++ b/regamedll/dlls/hostage/states/hostage_follow.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <42e3e3> ../cstrike/dlls/hostage/states/hostage_follow.cpp:12 */ void HostageFollowState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) { improv->Chatter(HOSTAGE_CHATTER_START_FOLLOW); @@ -22,7 +21,6 @@ void HostageFollowState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) } } -/* <42deaf> ../cstrike/dlls/hostage/states/hostage_follow.cpp:40 */ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) { // if we lost our leader, give up @@ -44,7 +42,7 @@ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) const float maxPathLength = 3000.0f; const float giveUpRange = 1000.0f; - if (range > giveUpRange || improv->GetPath()->GetSegmentCount() > 0 && improv->GetPath()->GetLength() > maxPathLength) + if (range > giveUpRange || (improv->GetPath()->GetSegmentCount() > 0 && improv->GetPath()->GetLength() > maxPathLength)) { improv->Idle(); return; @@ -162,7 +160,7 @@ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) if (GetGroundHeight(&sideStepPos, &ground)) { - if (abs((int)(ground - improv->GetFeet().z)) < 18.0f) + if (Q_abs(int(ground - improv->GetFeet().z)) < 18.0f) { const float push = 20.0f; Vector lat = cross * push; @@ -194,13 +192,11 @@ void HostageFollowState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) } } -/* <42e1aa> ../cstrike/dlls/hostage/states/hostage_follow.cpp:256 */ void HostageFollowState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv) { improv->Stop(); } -/* <42e38f> ../cstrike/dlls/hostage/states/hostage_follow.cpp:270 */ void HostageFollowState::__MAKE_VHOOK(UpdateStationaryAnimation)(CHostageImprov *improv) { if (improv->IsScared()) diff --git a/regamedll/dlls/hostage/states/hostage_idle.cpp b/regamedll/dlls/hostage/states/hostage_idle.cpp index a5bf40ef..624e99c6 100644 --- a/regamedll/dlls/hostage/states/hostage_idle.cpp +++ b/regamedll/dlls/hostage/states/hostage_idle.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <43c558> ../cstrike/dlls/hostage/states/hostage_idle.cpp:15 */ void HostageIdleState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) { m_moveState = MoveDone; @@ -8,7 +7,6 @@ void HostageIdleState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) m_mustFlee = false; } -/* <43c197> ../cstrike/dlls/hostage/states/hostage_idle.cpp:23 */ void HostageIdleState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) { if (!UTIL_ActivePlayersInGame()) @@ -228,17 +226,14 @@ void HostageIdleState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) } } } - } -/* <43c59b> ../cstrike/dlls/hostage/states/hostage_idle.cpp:297 */ void HostageIdleState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv) { improv->StandUp(); improv->ClearFaceTo(); } -/* <43c783> ../cstrike/dlls/hostage/states/hostage_idle.cpp:307 */ void HostageIdleState::__MAKE_VHOOK(UpdateStationaryAnimation)(CHostageImprov *improv) { if (improv->IsScared()) diff --git a/regamedll/dlls/hostage/states/hostage_retreat.cpp b/regamedll/dlls/hostage/states/hostage_retreat.cpp index 787815d6..7c7ce1a4 100644 --- a/regamedll/dlls/hostage/states/hostage_retreat.cpp +++ b/regamedll/dlls/hostage/states/hostage_retreat.cpp @@ -1,13 +1,11 @@ #include "precompiled.h" -/* <449fee> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:12 */ void HostageRetreatState::__MAKE_VHOOK(OnEnter)(CHostageImprov *improv) { improv->Walk(); improv->MoveTo(improv->GetEntity()->m_vStart); } -/* <44a220> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:20 */ void HostageRetreatState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) { if (improv->IsAtHome()) @@ -39,7 +37,6 @@ void HostageRetreatState::__MAKE_VHOOK(OnUpdate)(CHostageImprov *improv) improv->Walk(); } -/* <44a023> ../cstrike/dlls/hostage/states/hostage_retreat.cpp:79 */ void HostageRetreatState::__MAKE_VHOOK(OnExit)(CHostageImprov *improv) { ; diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp index bcdfe6be..d3a50f86 100644 --- a/regamedll/dlls/items.cpp +++ b/regamedll/dlls/items.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* ../cstrike/dlls/items.cpp:46 */ LINK_ENTITY_TO_CLASS(world_items, CWorldItem); -/* ../cstrike/dlls/items.cpp:48 */ void CWorldItem::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "type")) @@ -15,7 +13,6 @@ void CWorldItem::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* ../cstrike/dlls/items.cpp:59 */ void CWorldItem::__MAKE_VHOOK(Spawn)() { CBaseEntity *pEntity = NULL; @@ -48,7 +45,6 @@ void CWorldItem::__MAKE_VHOOK(Spawn)() REMOVE_ENTITY(edict()); } -/* ../cstrike/dlls/items.cpp:94 */ void CItem::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_TOSS; @@ -66,7 +62,6 @@ void CItem::__MAKE_VHOOK(Spawn)() } } -/* ../cstrike/dlls/items.cpp:112 */ void CItem::ItemTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer() || pOther->pev->deadflag != DEAD_NO) @@ -92,7 +87,6 @@ void CItem::ItemTouch(CBaseEntity *pOther) UTIL_Remove(this); } -/* ../cstrike/dlls/items.cpp:154 */ CBaseEntity *CItem::__MAKE_VHOOK(Respawn)() { SetTouch(NULL); @@ -108,7 +102,6 @@ CBaseEntity *CItem::__MAKE_VHOOK(Respawn)() return this; } -/* ../cstrike/dlls/items.cpp:166 */ void CItem::Materialize() { if (pev->effects & EF_NODRAW) @@ -123,7 +116,6 @@ void CItem::Materialize() SetTouch(&CItem::ItemTouch); } -/* ../cstrike/dlls/items.cpp:190 */ void CItemSuit::__MAKE_VHOOK(Spawn)() { Precache(); @@ -131,14 +123,12 @@ void CItemSuit::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:196 */ void CItemSuit::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_kevlar.mdl"); PRECACHE_SOUND("items/tr_kevlar.wav"); } -/* ../cstrike/dlls/items.cpp:201 */ BOOL CItemSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { if (pPlayer->pev->weapons & (1 << WEAPON_SUIT)) @@ -152,10 +142,8 @@ BOOL CItemSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return TRUE; } -/* ../cstrike/dlls/items.cpp:216 */ LINK_ENTITY_TO_CLASS(item_suit, CItemSuit); -/* ../cstrike/dlls/items.cpp:221 */ void CItemBattery::__MAKE_VHOOK(Spawn)() { Precache(); @@ -163,14 +151,12 @@ void CItemBattery::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:227 */ void CItemBattery::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_battery.mdl"); PRECACHE_SOUND("items/gunpickup2.wav"); } -/* ../cstrike/dlls/items.cpp:232 */ BOOL CItemBattery::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { if (pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY && (pPlayer->pev->weapons & (1 << WEAPON_SUIT))) @@ -189,7 +175,7 @@ BOOL CItemBattery::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) // Suit reports new power level // For some reason this wasn't working in release build -- round it. - pct = (int)((float)(pPlayer->pev->armorvalue * 100.0f) * (1.0f / MAX_NORMAL_BATTERY) + 0.5f); + pct = int(float(pPlayer->pev->armorvalue * 100.0f) * (1.0f / MAX_NORMAL_BATTERY) + 0.5f); pct = (pct / 5); if (pct > 0) @@ -203,10 +189,8 @@ BOOL CItemBattery::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return FALSE; } -/* ../cstrike/dlls/items.cpp:266 */ LINK_ENTITY_TO_CLASS(item_battery, CItemBattery); -/* ../cstrike/dlls/items.cpp:271 */ void CItemAntidote::__MAKE_VHOOK(Spawn)() { Precache(); @@ -214,13 +198,11 @@ void CItemAntidote::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:277 */ void CItemAntidote::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_antidote.mdl"); } -/* ../cstrike/dlls/items.cpp:281 */ BOOL CItemAntidote::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { pPlayer->SetSuitUpdate("!HEV_DET4", FALSE, SUIT_NEXT_IN_1MIN); @@ -229,10 +211,8 @@ BOOL CItemAntidote::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return TRUE; } -/* ../cstrike/dlls/items.cpp:290 */ LINK_ENTITY_TO_CLASS(item_antidote, CItemAntidote); -/* ../cstrike/dlls/items.cpp:295 */ void CItemSecurity::__MAKE_VHOOK(Spawn)() { Precache(); @@ -240,23 +220,19 @@ void CItemSecurity::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:301 */ void CItemSecurity::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_security.mdl"); } -/* ../cstrike/dlls/items.cpp:305 */ BOOL CItemSecurity::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { pPlayer->m_rgItems[ ITEM_SECURITY ] += 1; return TRUE; } -/* ../cstrike/dlls/items.cpp:312 */ LINK_ENTITY_TO_CLASS(item_security, CItemSecurity); -/* ../cstrike/dlls/items.cpp:316 */ void CItemLongJump::__MAKE_VHOOK(Spawn)() { Precache(); @@ -264,13 +240,11 @@ void CItemLongJump::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:322 */ void CItemLongJump::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_longjump.mdl"); } -/* ../cstrike/dlls/items.cpp:326 */ BOOL CItemLongJump::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { if (pPlayer->m_fLongJump) @@ -294,10 +268,8 @@ BOOL CItemLongJump::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return FALSE; } -/* ../cstrike/dlls/items.cpp:350 */ LINK_ENTITY_TO_CLASS(item_longjump, CItemLongJump); -/* ../cstrike/dlls/items.cpp:354 */ void CItemKevlar::__MAKE_VHOOK(Spawn)() { Precache(); @@ -305,13 +277,11 @@ void CItemKevlar::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:360 */ void CItemKevlar::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_kevlar.mdl"); } -/* ../cstrike/dlls/items.cpp:364 */ BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { if (pPlayer->m_iKevlar == ARMOR_TYPE_EMPTY) @@ -336,10 +306,8 @@ BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return TRUE; } -/* ../cstrike/dlls/items.cpp:390 */ LINK_ENTITY_TO_CLASS(item_kevlar, CItemKevlar); -/* ../cstrike/dlls/items.cpp:395 */ void CItemAssaultSuit::__MAKE_VHOOK(Spawn)() { Precache(); @@ -347,13 +315,11 @@ void CItemAssaultSuit::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:401 */ void CItemAssaultSuit::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_assault.mdl"); } -/* ../cstrike/dlls/items.cpp:405 */ BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { pPlayer->m_iKevlar = ARMOR_TYPE_HELMET; @@ -377,10 +343,8 @@ BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return TRUE; } -/* ../cstrike/dlls/items.cpp:429 */ LINK_ENTITY_TO_CLASS(item_assaultsuit, CItemAssaultSuit); -/* ../cstrike/dlls/items.cpp:434 */ void CItemThighPack::__MAKE_VHOOK(Spawn)() { Precache(); @@ -388,13 +352,11 @@ void CItemThighPack::__MAKE_VHOOK(Spawn)() CItem::Spawn(); } -/* ../cstrike/dlls/items.cpp:440 */ void CItemThighPack::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_thighpack.mdl"); } -/* ../cstrike/dlls/items.cpp:444 */ BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { if (pPlayer->m_iTeam != CT || pPlayer->m_bHasDefuser) @@ -424,5 +386,4 @@ BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) return TRUE; } -/* ../cstrike/dlls/items.cpp:474 */ LINK_ENTITY_TO_CLASS(item_thighpack, CItemThighPack); diff --git a/regamedll/dlls/items.h b/regamedll/dlls/items.h index 3ca049f3..3ff709f0 100644 --- a/regamedll/dlls/items.h +++ b/regamedll/dlls/items.h @@ -39,27 +39,25 @@ #define ITEM_BATTERY 4 #define ITEM_SUIT 5 -/* ../cstrike/dlls/items.h:19 */ class CItem: public CBaseEntity { public: virtual void Spawn(); virtual CBaseEntity *Respawn(); - virtual BOOL MyTouch(CBasePlayer *pPlayer) { return FALSE;} + virtual BOOL MyTouch(CBasePlayer *pPlayer) { return FALSE; } #ifdef HOOK_GAMEDLL void Spawn_(); CBaseEntity *Respawn_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT ItemTouch(CBaseEntity *pOther); void EXPORT Materialize(); }; -/* ../cstrike/dlls/items.cpp:38 */ class CWorldItem: public CBaseEntity { public: @@ -71,13 +69,12 @@ public: void Spawn_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif public: int m_iType; }; -/* ../cstrike/dlls/items.cpp:188 */ class CItemSuit: public CItem { public: @@ -91,11 +88,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/items.cpp:219 */ class CItemBattery: public CItem { public: @@ -109,11 +105,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/items.cpp:269 */ class CItemAntidote: public CItem { public: @@ -127,11 +122,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/items.cpp:293 */ class CItemSecurity: public CItem { public: @@ -145,11 +139,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/items.cpp:314 */ class CItemLongJump: public CItem { public: @@ -163,11 +156,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/items.cpp:352 */ class CItemKevlar: public CItem { public: @@ -181,11 +173,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/items.cpp:393 */ class CItemAssaultSuit: public CItem { public: @@ -199,11 +190,10 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; -/* ../cstrike/dlls/items.cpp:432 */ class CItemThighPack: public CItem { public: @@ -217,7 +207,7 @@ public: void Precache_(); BOOL MyTouch_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif }; diff --git a/regamedll/dlls/lights.cpp b/regamedll/dlls/lights.cpp index 432a056a..c6cf696d 100644 --- a/regamedll/dlls/lights.cpp +++ b/regamedll/dlls/lights.cpp @@ -11,17 +11,12 @@ TYPEDESCRIPTION CLight::m_SaveData[] = DEFINE_FIELD(CLight, m_iszPattern, FIELD_STRING), }; -#endif // HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/lights.cpp:48 */ LINK_ENTITY_TO_CLASS(light, CLight); - -/* ../cstrike/dlls/lights.cpp:56 */ IMPLEMENT_SAVERESTORE(CLight, CPointEntity); // Cache user-entity-field values until spawn is called. - -/* ../cstrike/dlls/lights.cpp:62 */ void CLight::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "style")) @@ -43,7 +38,6 @@ void CLight::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* ../cstrike/dlls/lights.cpp:92 */ void CLight::__MAKE_VHOOK(Spawn)() { // inert light @@ -67,7 +61,6 @@ void CLight::__MAKE_VHOOK(Spawn)() } } -/* ../cstrike/dlls/lights.cpp:117 */ void CLight::__MAKE_VHOOK(Restart)() { if (m_iStyle >= 32) @@ -89,7 +82,6 @@ void CLight::__MAKE_VHOOK(Restart)() } } -/* ../cstrike/dlls/lights.cpp:139 */ void CLight::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (m_iStyle >= 32) @@ -114,19 +106,15 @@ void CLight::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, US } } -/* ../cstrike/dlls/lights.cpp:165 */ LINK_ENTITY_TO_CLASS(light_spot, CLight); - -/* ../cstrike/dlls/lights.cpp:175 */ LINK_ENTITY_TO_CLASS(light_environment, CEnvLight); -/* ../cstrike/dlls/lights.cpp:177 */ void CEnvLight::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "_light")) { int r, g, b, v, j; - j = sscanf(pkvd->szValue, "%d %d %d %d\n", &r, &g, &b, &v); + j = Q_sscanf(pkvd->szValue, "%d %d %d %d\n", &r, &g, &b, &v); if (j == 1) g = b = r; @@ -139,9 +127,9 @@ void CEnvLight::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } // simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling - r = pow(r / 114.0, 0.6) * 264; - g = pow(g / 114.0, 0.6) * 264; - b = pow(b / 114.0, 0.6) * 264; + r = Q_pow(r / 114.0, 0.6) * 264; + g = Q_pow(g / 114.0, 0.6) * 264; + b = Q_pow(b / 114.0, 0.6) * 264; pkvd->fHandled = TRUE; @@ -157,10 +145,9 @@ void CEnvLight::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CLight::KeyValue(pkvd); } -/* ../cstrike/dlls/lights.cpp:215 */ void CEnvLight::__MAKE_VHOOK(Spawn)() { -#if defined(HOOK_GAMEDLL) +#ifdef HOOK_GAMEDLL // NOTE: fix negative the values for function sprintf from STD C++: // expected - sv_skyvec_y "0.000000" // with using sprintf from STD C++, got - sv_skyvec_y "-0.000000" @@ -168,7 +155,7 @@ void CEnvLight::__MAKE_VHOOK(Spawn)() #define SPRINTF_OLD_STD_FIX + 0 #else #define SPRINTF_OLD_STD_FIX -#endif // HOOK_GAMEDLL +#endif char szVector[64]; UTIL_MakeAimVectors(pev->angles); diff --git a/regamedll/dlls/lights.h b/regamedll/dlls/lights.h index 75a90fa0..d722b743 100644 --- a/regamedll/dlls/lights.h +++ b/regamedll/dlls/lights.h @@ -34,7 +34,6 @@ #define SF_LIGHT_START_OFF 1 -/* ../cstrike/dlls/lights.cpp:29 */ class CLight: public CPointEntity { public: @@ -54,7 +53,7 @@ public: void KeyValue_(KeyValueData *pkvd); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif static TYPEDESCRIPTION IMPL(m_SaveData)[2]; @@ -64,7 +63,6 @@ private: BOOL m_iStartedOff; }; -/* ../cstrike/dlls/lights.cpp:168 */ class CEnvLight: public CLight { public: @@ -76,7 +74,7 @@ public: void Spawn_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif }; diff --git a/regamedll/dlls/maprules.cpp b/regamedll/dlls/maprules.cpp index 7c130379..c7eb1858 100644 --- a/regamedll/dlls/maprules.cpp +++ b/regamedll/dlls/maprules.cpp @@ -25,12 +25,10 @@ TYPEDESCRIPTION CGamePlayerZone::m_SaveData[] = DEFINE_FIELD(CGamePlayerZone, m_iszOutCount, FIELD_STRING), }; -#endif // HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/maprules.cpp:57 */ IMPLEMENT_SAVERESTORE(CRuleEntity, CBaseEntity); -/* ../cstrike/dlls/maprules.cpp:60 */ void CRuleEntity::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -38,7 +36,6 @@ void CRuleEntity::__MAKE_VHOOK(Spawn)() pev->effects = EF_NODRAW; } -/* ../cstrike/dlls/maprules.cpp:68 */ void CRuleEntity::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "master")) @@ -50,7 +47,6 @@ void CRuleEntity::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* ../cstrike/dlls/maprules.cpp:79 */ BOOL CRuleEntity::CanFireForActivator(CBaseEntity *pActivator) { if (!FStringNull(m_iszMaster)) @@ -64,7 +60,6 @@ BOOL CRuleEntity::CanFireForActivator(CBaseEntity *pActivator) return TRUE; } -/* ../cstrike/dlls/maprules.cpp:101 */ void CRulePointEntity::__MAKE_VHOOK(Spawn)() { CRuleEntity::Spawn(); @@ -72,23 +67,19 @@ void CRulePointEntity::__MAKE_VHOOK(Spawn)() pev->model = 0; } -/* ../cstrike/dlls/maprules.cpp:120 */ void CRuleBrushEntity::__MAKE_VHOOK(Spawn)() { SET_MODEL(edict(), STRING(pev->model)); CRuleEntity::Spawn(); } -/* ../cstrike/dlls/maprules.cpp:151 */ LINK_ENTITY_TO_CLASS(game_score, CGameScore); -/* ../cstrike/dlls/maprules.cpp:154 */ void CGameScore::__MAKE_VHOOK(Spawn)() { CRulePointEntity::Spawn(); } -/* ../cstrike/dlls/maprules.cpp:160 */ void CGameScore::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "points")) @@ -100,7 +91,6 @@ void CGameScore::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CRulePointEntity::KeyValue(pkvd); } -/* ../cstrike/dlls/maprules.cpp:173 */ void CGameScore::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -120,10 +110,8 @@ void CGameScore::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller } } -/* ../cstrike/dlls/maprules.cpp:202 */ LINK_ENTITY_TO_CLASS(game_end, CGameEnd); -/* ../cstrike/dlls/maprules.cpp:205 */ void CGameEnd::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -132,13 +120,9 @@ void CGameEnd::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, g_pGameRules->EndMultiplayerGame(); } -/* ../cstrike/dlls/maprules.cpp:242 */ LINK_ENTITY_TO_CLASS(game_text, CGameText); - -/* ../cstrike/dlls/maprules.cpp:251 */ IMPLEMENT_SAVERESTORE(CGameText, CRulePointEntity); -/* ../cstrike/dlls/maprules.cpp:254 */ void CGameText::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "channel")) @@ -209,7 +193,6 @@ void CGameText::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CRulePointEntity::KeyValue(pkvd); } -/* ../cstrike/dlls/maprules.cpp:321 */ void CGameText::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -228,10 +211,8 @@ void CGameText::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, } } -/* ../cstrike/dlls/maprules.cpp:371 */ LINK_ENTITY_TO_CLASS(game_team_master, CGameTeamMaster); -/* ../cstrike/dlls/maprules.cpp:373 */ void CGameTeamMaster::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "teamindex")) @@ -262,7 +243,6 @@ void CGameTeamMaster::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CRulePointEntity::KeyValue(pkvd); } -/* ../cstrike/dlls/maprules.cpp:402 */ void CGameTeamMaster::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -293,13 +273,11 @@ void CGameTeamMaster::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC } } -/* ../cstrike/dlls/maprules.cpp:429 */ BOOL CGameTeamMaster::__MAKE_VHOOK(IsTriggered)(CBaseEntity *pActivator) { return TeamMatch(pActivator); } -/* ../cstrike/dlls/maprules.cpp:435 */ const char *CGameTeamMaster::__MAKE_VHOOK(TeamID)() { // Currently set to "no team" @@ -312,7 +290,6 @@ const char *CGameTeamMaster::__MAKE_VHOOK(TeamID)() return g_pGameRules->GetIndexedTeamName(m_teamIndex); } -/* ../cstrike/dlls/maprules.cpp:444 */ BOOL CGameTeamMaster::TeamMatch(CBaseEntity *pActivator) { if (m_teamIndex < 0 && AnyTeam()) @@ -324,10 +301,8 @@ BOOL CGameTeamMaster::TeamMatch(CBaseEntity *pActivator) return UTIL_TeamsMatch(pActivator->TeamID(), TeamID()); } -/* ../cstrike/dlls/maprules.cpp:474 */ LINK_ENTITY_TO_CLASS(game_team_set, CGameTeamSet); -/* ../cstrike/dlls/maprules.cpp:477 */ void CGameTeamSet::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -348,13 +323,9 @@ void CGameTeamSet::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall } } -/* ../cstrike/dlls/maprules.cpp:519 */ LINK_ENTITY_TO_CLASS(game_zone_player, CGamePlayerZone); - -/* ../cstrike/dlls/maprules.cpp:528 */ IMPLEMENT_SAVERESTORE(CGamePlayerZone, CRuleBrushEntity); -/* ../cstrike/dlls/maprules.cpp:530 */ void CGamePlayerZone::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "intarget")) @@ -381,7 +352,6 @@ void CGamePlayerZone::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CRuleBrushEntity::KeyValue(pkvd); } -/* ../cstrike/dlls/maprules.cpp:556 */ void CGamePlayerZone::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int playersInCount = 0; @@ -440,10 +410,8 @@ void CGamePlayerZone::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC } -/* ../cstrike/dlls/maprules.cpp:628 */ LINK_ENTITY_TO_CLASS(game_player_hurt, CGamePlayerHurt); -/* ../cstrike/dlls/maprules.cpp:631 */ void CGamePlayerHurt::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -465,10 +433,8 @@ void CGamePlayerHurt::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC } } -/* ../cstrike/dlls/maprules.cpp:684 */ LINK_ENTITY_TO_CLASS(game_counter, CGameCounter); -/* ../cstrike/dlls/maprules.cpp:686 */ void CGameCounter::__MAKE_VHOOK(Spawn)() { // Save off the initial count @@ -476,7 +442,6 @@ void CGameCounter::__MAKE_VHOOK(Spawn)() CRulePointEntity::Spawn(); } -/* ../cstrike/dlls/maprules.cpp:694 */ void CGameCounter::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -494,7 +459,7 @@ void CGameCounter::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall break; case USE_SET: - SetCountValue((int)value); + SetCountValue(int(value)); break; } @@ -514,10 +479,8 @@ void CGameCounter::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall } } -/* ../cstrike/dlls/maprules.cpp:747 */ LINK_ENTITY_TO_CLASS(game_counter_set, CGameCounterSet); -/* ../cstrike/dlls/maprules.cpp:750 */ void CGameCounterSet::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) @@ -531,10 +494,8 @@ void CGameCounterSet::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC } } -/* ../cstrike/dlls/maprules.cpp:788 */ LINK_ENTITY_TO_CLASS(game_player_equip, CGamePlayerEquip); -/* ../cstrike/dlls/maprules.cpp:791 */ void CGamePlayerEquip::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { CRulePointEntity::KeyValue(pkvd); @@ -559,7 +520,6 @@ void CGamePlayerEquip::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } } -/* ../cstrike/dlls/maprules.cpp:816 */ void CGamePlayerEquip::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (!CanFireForActivator(pOther)) @@ -571,7 +531,6 @@ void CGamePlayerEquip::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) EquipPlayer(pOther); } -/* ../cstrike/dlls/maprules.cpp:827 */ void CGamePlayerEquip::EquipPlayer(CBaseEntity *pEntity) { CBasePlayer *pPlayer = NULL; @@ -596,16 +555,13 @@ void CGamePlayerEquip::EquipPlayer(CBaseEntity *pEntity) } } -/* ../cstrike/dlls/maprules.cpp:851 */ void CGamePlayerEquip::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { EquipPlayer(pActivator); } -/* ../cstrike/dlls/maprules.cpp:881 */ LINK_ENTITY_TO_CLASS(game_player_team, CGamePlayerTeam); -/* ../cstrike/dlls/maprules.cpp:884 */ const char *CGamePlayerTeam::TargetTeamName(const char *pszTargetName) { CBaseEntity *pTeamEntity = NULL; @@ -619,7 +575,6 @@ const char *CGamePlayerTeam::TargetTeamName(const char *pszTargetName) return NULL; } -/* ../cstrike/dlls/maprules.cpp:898 */ void CGamePlayerTeam::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) diff --git a/regamedll/dlls/maprules.h b/regamedll/dlls/maprules.h index a7e337f0..77bd162a 100644 --- a/regamedll/dlls/maprules.h +++ b/regamedll/dlls/maprules.h @@ -57,7 +57,6 @@ #define SF_PTEAM_KILL 0x0002 #define SF_PTEAM_GIB 0x0004 -/* ../cstrike/dlls/maprules.cpp:34 */ class CRuleEntity: public CBaseEntity { public: @@ -73,15 +72,13 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; - void SetMaster(int iszMaster) - { - m_iszMaster = iszMaster; - } + void SetMaster(int iszMaster) { m_iszMaster = iszMaster; } + protected: BOOL CanFireForActivator(CBaseEntity *pActivator); @@ -90,8 +87,6 @@ private: }; // CRulePointEntity -- base class for all rule "point" entities (not brushes) - -/* ../cstrike/dlls/maprules.cpp:95 */ class CRulePointEntity: public CRuleEntity { public: @@ -101,14 +96,12 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; // CRuleBrushEntity -- base class for all rule "brush" entities (not brushes) // Default behavior is to set up like a trigger, invisible, but keep the model for volume testing - -/* ../cstrike/dlls/maprules.cpp:112 */ class CRuleBrushEntity: public CRuleEntity { public: @@ -118,7 +111,7 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; @@ -126,8 +119,6 @@ public: // Points +/- total // Flag: Allow negative scores SF_SCORE_NEGATIVE // Flag: Award points to team in teamplay SF_SCORE_TEAM - -/* ../cstrike/dlls/maprules.cpp:135 */ class CGameScore: public CRulePointEntity { public: @@ -141,10 +132,10 @@ public: void KeyValue_(KeyValueData *pkvd); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: - int Points() const { return (int)(pev->frags); } + int Points() const { return int(pev->frags); } BOOL AllowNegativeScore() { return pev->spawnflags & SF_SCORE_NEGATIVE; } BOOL AwardToTeam() const { return pev->spawnflags & SF_SCORE_TEAM; } @@ -152,8 +143,6 @@ public: }; // CGameEnd / game_end -- Ends the game in MP - -/* ../cstrike/dlls/maprules.cpp:195 */ class CGameEnd: public CRulePointEntity { public: @@ -163,14 +152,12 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; // CGameText / game_text -- NON-Localized HUD Message (use env_message to display a titles.txt message) // Flag: All players SF_ENVTEXT_ALLPLAYERS - -/* ../cstrike/dlls/maprules.cpp:223 */ class CGameText: public CRulePointEntity { public: @@ -186,7 +173,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: BOOL MessageToAll() const { return (pev->spawnflags & SF_ENVTEXT_ALLPLAYERS) == SF_ENVTEXT_ALLPLAYERS; } @@ -202,12 +189,10 @@ private: // CGameTeamMaster / game_team_master -- "Masters" like multisource, but based on the team of the activator // Only allows mastered entity to fire if the team matches my team - +// // team index (pulled from server team list "mp_teamlist" // Flag: Remove on Fire // Flag: Any team until set? -- Any team can use this until the team is set (otherwise no teams can use it) - -/* ../cstrike/dlls/maprules.cpp:352 */ class CGameTeamMaster: public CRulePointEntity { public: @@ -224,7 +209,7 @@ public: const char *TeamID_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: BOOL RemoveOnFire() const { return (pev->spawnflags & SF_TEAMMASTER_FIREONCE) == SF_TEAMMASTER_FIREONCE; } @@ -241,8 +226,6 @@ public: // CGameTeamSet / game_team_set -- Changes the team of the entity it targets to the activator's team // Flag: Fire once // Flag: Clear team -- Sets the team to "NONE" instead of activator - -/* ../cstrike/dlls/maprules.cpp:464 */ class CGameTeamSet: public CRulePointEntity { public: @@ -252,7 +235,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: BOOL RemoveOnFire() const { return (pev->spawnflags & SF_TEAMSET_FIREONCE) == SF_TEAMSET_FIREONCE; } @@ -261,8 +244,6 @@ public: // CGamePlayerZone / game_player_zone -- players in the zone fire my target when I'm fired // Needs master? - -/* ../cstrike/dlls/maprules.cpp:502 */ class CGamePlayerZone: public CRuleBrushEntity { public: @@ -278,7 +259,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[4]; @@ -292,8 +273,6 @@ private: // CGamePlayerHurt / game_player_hurt -- Damages the player who fires it // Flag: Fire once - -/* ../cstrike/dlls/maprules.cpp:619 */ class CGamePlayerHurt: public CRulePointEntity { public: @@ -303,7 +282,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: BOOL RemoveOnFire() const { return (pev->spawnflags & SF_PKILL_FIREONCE) == SF_PKILL_FIREONCE; } @@ -312,8 +291,6 @@ public: // CGameCounter / game_counter -- Counts events and fires target // Flag: Fire once // Flag: Reset on Fire - -/* ../cstrike/dlls/maprules.cpp:662 */ class CGameCounter: public CRulePointEntity { public: @@ -325,19 +302,19 @@ public: void Spawn_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: BOOL RemoveOnFire() const { return (pev->spawnflags & SF_GAMECOUNT_FIREONCE) == SF_GAMECOUNT_FIREONCE; } BOOL ResetOnFire() const { return (pev->spawnflags & SF_GAMECOUNT_RESET) == SF_GAMECOUNT_RESET; } - void CountUp() { pev->frags++; } - void CountDown() { pev->frags--; } - void ResetCount() { pev->frags = pev->dmg; } + void CountUp() { pev->frags++; } + void CountDown() { pev->frags--; } + void ResetCount() { pev->frags = pev->dmg; } - int CountValue() const { return (int)(pev->frags); } - int LimitValue() const { return (int)(pev->health); } - BOOL HitLimit() const { return CountValue() == LimitValue(); } + int CountValue() const { return int(pev->frags); } + int LimitValue() const { return int(pev->health); } + BOOL HitLimit() const { return CountValue() == LimitValue(); } private: void SetCountValue(int value) { pev->frags = value; } @@ -346,8 +323,6 @@ private: // CGameCounterSet / game_counter_set -- Sets the counter's value // Flag: Fire once - -/* ../cstrike/dlls/maprules.cpp:738 */ class CGameCounterSet: public CRulePointEntity { public: @@ -357,7 +332,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: BOOL RemoveOnFire() const { return (pev->spawnflags & SF_GAMECOUNTSET_FIREONCE) == SF_GAMECOUNTSET_FIREONCE; } @@ -365,8 +340,6 @@ public: // CGamePlayerEquip / game_playerequip -- Sets the default player equipment // Flag: USE Only - -/* ../cstrike/dlls/maprules.cpp:771 */ class CGamePlayerEquip: public CRulePointEntity { public: @@ -380,7 +353,7 @@ public: void Touch_(CBaseEntity *pOther); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: BOOL UseOnly() const { return (pev->spawnflags & SF_PLAYEREQUIP_USEONLY) == SF_PLAYEREQUIP_USEONLY; } @@ -393,12 +366,10 @@ public: int m_weaponCount[ MAX_EQUIP ]; }; -// CGamePlayerTeam / game_player_team -- Changes the team of the player who fired it +// CGamePlayerTeam / game_player_team -- Changes the team of the player who fired it // Flag: Fire once // Flag: Kill Player // Flag: Gib Player - -/* ../cstrike/dlls/maprules.cpp:867 */ class CGamePlayerTeam: public CRulePointEntity { public: @@ -408,12 +379,12 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif private: - BOOL RemoveOnFire() const { return (pev->spawnflags & SF_PTEAM_FIREONCE) == SF_PTEAM_FIREONCE; } - BOOL ShouldKillPlayer() const { return (pev->spawnflags & SF_PTEAM_KILL) == SF_PTEAM_KILL; } - BOOL ShouldGibPlayer() const { return (pev->spawnflags & SF_PTEAM_GIB) == SF_PTEAM_GIB; } + BOOL RemoveOnFire() const { return (pev->spawnflags & SF_PTEAM_FIREONCE) == SF_PTEAM_FIREONCE; } + BOOL ShouldKillPlayer() const { return (pev->spawnflags & SF_PTEAM_KILL) == SF_PTEAM_KILL; } + BOOL ShouldGibPlayer() const { return (pev->spawnflags & SF_PTEAM_GIB) == SF_PTEAM_GIB; } const char *TargetTeamName(const char *pszTargetName); }; diff --git a/regamedll/dlls/monsters.h b/regamedll/dlls/monsters.h index 65dbe9c5..29079e08 100644 --- a/regamedll/dlls/monsters.h +++ b/regamedll/dlls/monsters.h @@ -79,7 +79,6 @@ #define bits_MEMORY_CUSTOM2 (1 << 30) // Monster-specific memory #define bits_MEMORY_CUSTOM1 (1 << 31) // Monster-specific memory -//TODO: unused? enum { AITRIGGER_NONE = 0, @@ -110,7 +109,6 @@ enum HitBoxGroup NUM_HITGROUPS, }; -/* <725cf> ../cstrike/dlls/monsters.h:61 */ class CGib: public CBaseEntity { public: @@ -126,7 +124,7 @@ public: public: static void SpawnHeadGib(entvars_t *pevVictim); static void SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human); - NOXREF static void SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs); + static void SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs); public: int m_bloodColor; diff --git a/regamedll/dlls/mortar.cpp b/regamedll/dlls/mortar.cpp index 941781f2..1e595106 100644 --- a/regamedll/dlls/mortar.cpp +++ b/regamedll/dlls/mortar.cpp @@ -15,15 +15,11 @@ TYPEDESCRIPTION CFuncMortarField::m_SaveData[] = DEFINE_FIELD(CFuncMortarField, m_fControl, FIELD_INTEGER), }; -#endif // HOOK_GAMEDLL +#endif -/* ../cstrike/dlls/mortar.cpp:56 */ LINK_ENTITY_TO_CLASS(func_mortar_field, CFuncMortarField); - -/* ../cstrike/dlls/mortar.cpp:68 */ IMPLEMENT_SAVERESTORE(CFuncMortarField, CBaseToggle); -/* ../cstrike/dlls/mortar.cpp:71 */ void CFuncMortarField::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "m_iszXController")) @@ -54,8 +50,6 @@ void CFuncMortarField::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } // Drop bombs from above - -/* ../cstrike/dlls/mortar.cpp:102 */ void CFuncMortarField::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -69,7 +63,6 @@ void CFuncMortarField::__MAKE_VHOOK(Spawn)() Precache(); } -/* ../cstrike/dlls/mortar.cpp:113 */ void CFuncMortarField::__MAKE_VHOOK(Precache)() { PRECACHE_SOUND("weapons/mortar.wav"); @@ -78,8 +71,6 @@ void CFuncMortarField::__MAKE_VHOOK(Precache)() } // If connected to a table, then use the table controllers, else hit where the trigger is. - -/* ../cstrike/dlls/mortar.cpp:122 */ void CFuncMortarField::FieldUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Vector vecStart; @@ -134,7 +125,7 @@ void CFuncMortarField::FieldUse(CBaseEntity *pActivator, CBaseEntity *pCaller, U EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "weapons/mortar.wav", VOL_NORM, ATTN_NONE, 0, pitch); - float t = 2.5; + float t = 2.5f; for (int i = 0; i < m_iCount; ++i) { Vector vecSpot = vecStart; @@ -161,10 +152,8 @@ void CFuncMortarField::FieldUse(CBaseEntity *pActivator, CBaseEntity *pCaller, U } } -/* ../cstrike/dlls/mortar.cpp:203 */ LINK_ENTITY_TO_CLASS(monster_mortar, CMortar); -/* ../cstrike/dlls/mortar.cpp:205 */ void CMortar::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_NONE; @@ -176,13 +165,11 @@ void CMortar::__MAKE_VHOOK(Spawn)() Precache(); } -/* ../cstrike/dlls/mortar.cpp:221 */ void CMortar::__MAKE_VHOOK(Precache)() { m_spriteTexture = PRECACHE_MODEL("sprites/lgtning.spr"); } -/* ../cstrike/dlls/mortar.cpp:226 */ void CMortar::MortarExplode() { // mortar beam diff --git a/regamedll/dlls/mortar.h b/regamedll/dlls/mortar.h index d634ec71..a2fe8303 100644 --- a/regamedll/dlls/mortar.h +++ b/regamedll/dlls/mortar.h @@ -32,7 +32,6 @@ #pragma once #endif -/* ../cstrike/dlls/mortar.cpp:31 */ class CFuncMortarField: public CBaseToggle { public: @@ -53,7 +52,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT FieldUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); @@ -61,7 +60,6 @@ public: public: static TYPEDESCRIPTION IMPL(m_SaveData)[6]; -public: int m_iszXController; int m_iszYController; float m_flSpread; @@ -70,7 +68,6 @@ public: int m_fControl; }; -/* ../cstrike/dlls/mortar.cpp:192 */ class CMortar: public CGrenade { public: @@ -82,7 +79,7 @@ public: void Spawn_(); void Precache_(); -#endif // HOOK_GAMEDLL +#endif void EXPORT MortarExplode(); diff --git a/regamedll/dlls/mpstubb.cpp b/regamedll/dlls/mpstubb.cpp index 46f14789..7a3f2ac1 100644 --- a/regamedll/dlls/mpstubb.cpp +++ b/regamedll/dlls/mpstubb.cpp @@ -2,67 +2,56 @@ CGraph WorldGraph; -/* ../cstrike/dlls/mpstubb.cpp:32 */ void CGraph::InitGraph() { ; } -/* ../cstrike/dlls/mpstubb.cpp:33 */ int CGraph::FLoadGraph(char *szMapName) { return 0; } -/* ../cstrike/dlls/mpstubb.cpp:34 */ int CGraph::AllocNodes() { return 0; } -/* ../cstrike/dlls/mpstubb.cpp:35 */ int CGraph::CheckNODFile(char *szMapName) { return 0; } -/* ../cstrike/dlls/mpstubb.cpp:36 */ int CGraph::FSetGraphPointers() { return 0; } -/* ../cstrike/dlls/mpstubb.cpp:37 */ void CGraph::ShowNodeConnections(int iNode) { ; } -/* ../cstrike/dlls/mpstubb.cpp:38 */ int CGraph::FindNearestNode(const Vector &vecOrigin, int afNodeTypes) { return 0; } -/* ../cstrike/dlls/mpstubb.cpp:38 */ int CGraph::FindNearestNode(const Vector &vecOrigin, CBaseEntity *pEntity) { return 0; } -/* ../cstrike/dlls/mpstubb.cpp:45 */ float CBaseMonster::__MAKE_VHOOK(ChangeYaw)(int speed) { return 0.0f; } -/* ../cstrike/dlls/mpstubb.cpp:46 */ void CBaseMonster::MakeIdealYaw(Vector vecTarget) { ; } -/* ../cstrike/dlls/mpstubb.cpp:49 */ NOXREF void CBaseMonster::CorpseFallThink() { if (pev->flags & FL_ONGROUND) @@ -74,10 +63,9 @@ NOXREF void CBaseMonster::CorpseFallThink() UTIL_SetOrigin(pev, pev->origin); } else - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } -/* ../cstrike/dlls/mpstubb.cpp:62 */ void CBaseMonster::__MAKE_VHOOK(MonsterInitDead)() { InitBoneControllers(); @@ -97,28 +85,24 @@ void CBaseMonster::__MAKE_VHOOK(MonsterInitDead)() BecomeDead(); SetThink(&CBaseEntity::SUB_Remove); - pev->nextthink = gpGlobals->time + 0.5; + pev->nextthink = gpGlobals->time + 0.5f; } -/* ../cstrike/dlls/mpstubb.cpp:89 */ BOOL CBaseMonster::__MAKE_VHOOK(ShouldFadeOnDeath)() { return FALSE; } -/* ../cstrike/dlls/mpstubb.cpp:94 */ BOOL CBaseMonster::FCheckAITrigger() { return FALSE; } -/* ../cstrike/dlls/mpstubb.cpp:99 */ void CBaseMonster::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { CBaseToggle::KeyValue(pkvd); } -/* ../cstrike/dlls/mpstubb.cpp:104 */ int CBaseMonster::__MAKE_VHOOK(IRelationship)(CBaseEntity *pTarget) { static int const iEnemy[14][14] = @@ -152,8 +136,6 @@ int CBaseMonster::__MAKE_VHOOK(IRelationship)(CBaseEntity *pTarget) // Function also sets the Looker's m_pLink // to the head of a link list that contains all visible ents. // (linked via each ent's m_pLink field) - -/* ../cstrike/dlls/mpstubb.cpp:140 */ void CBaseMonster::__MAKE_VHOOK(Look)(int iDistance) { int iSighted = 0; @@ -231,8 +213,6 @@ void CBaseMonster::__MAKE_VHOOK(Look)(int iDistance) // // UNDONE: currently, this only returns the closest enemy. // we'll want to consider distance, relationship, attack types, back turned, etc. - -/* ../cstrike/dlls/mpstubb.cpp:220 */ CBaseEntity *CBaseMonster::__MAKE_VHOOK(BestVisibleEnemy)() { CBaseEntity *pReturn; diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 7f69bbf8..3eceaa5a 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -8,12 +8,11 @@ static char mp_com_token[ COM_TOKEN_LEN ]; cvar_t *sv_clienttrace = NULL; -#endif // HOOK_GAMEDLL +#endif CCStrikeGameMgrHelper g_GameMgrHelper; CHalfLifeMultiplay *g_pMPGameRules = NULL; -/* <1153e2> ../cstrike/dlls/multiplay_gamerules.cpp:92 */ bool IsBotSpeaking() { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -32,14 +31,11 @@ bool IsBotSpeaking() return false; } -/* <1116dd> ../cstrike/dlls/multiplay_gamerules.cpp:111 */ void SV_Continue_f() { - CHalfLifeMultiplay *mp = g_pGameRules; - - if (mp->IsCareer() && mp->m_fTeamCount > 100000.0) + if (CSGameRules()->IsCareer() && CSGameRules()->m_fTeamCount > 100000.0) { - mp->m_fTeamCount = gpGlobals->time; + CSGameRules()->m_fTeamCount = gpGlobals->time; // go continue MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer); @@ -61,29 +57,22 @@ void SV_Continue_f() } } -/* <112860> ../cstrike/dlls/multiplay_gamerules.cpp:133 */ void SV_Tutor_Toggle_f() { CVAR_SET_FLOAT("tutor_enable", (CVAR_GET_FLOAT("tutor_enable") <= 0.0)); } -/* <11538f> ../cstrike/dlls/multiplay_gamerules.cpp:139 */ void SV_Career_Restart_f() { - CHalfLifeMultiplay *mp = g_pGameRules; - - if (mp->IsCareer()) + if (CSGameRules()->IsCareer()) { - mp->CareerRestart(); + CSGameRules()->CareerRestart(); } } -/* <111695> ../cstrike/dlls/multiplay_gamerules.cpp:149 */ void SV_Career_EndRound_f() { - CHalfLifeMultiplay *mp = g_pGameRules; - - if (!mp->IsCareer() || !mp->IsInCareerRound()) + if (!CSGameRules()->IsCareer() || !CSGameRules()->IsInCareerRound()) { return; } @@ -109,13 +98,11 @@ void SV_Career_EndRound_f() } } -/* <1145dd> ../cstrike/dlls/multiplay_gamerules.cpp:173 */ bool CHalfLifeMultiplay::IsInCareerRound() { return IsMatchStarted() ? false : true; } -/* <110ba1> ../cstrike/dlls/multiplay_gamerules.cpp:180 */ void SV_CareerAddTask_f() { if (CMD_ARGC() != 7) @@ -135,7 +122,6 @@ void SV_CareerAddTask_f() } } -/* <111640> ../cstrike/dlls/multiplay_gamerules.cpp:213 */ void SV_CareerMatchLimit_f() { if (CMD_ARGC() != 3) @@ -143,15 +129,12 @@ void SV_CareerMatchLimit_f() return; } - CHalfLifeMultiplay *mp = g_pGameRules; - - if (mp->IsCareer()) + if (CSGameRules()->IsCareer()) { - mp->SetCareerMatchLimit(Q_atoi(CMD_ARGV(1)), Q_atoi(CMD_ARGV(2))); + CSGameRules()->SetCareerMatchLimit(Q_atoi(CMD_ARGV(1)), Q_atoi(CMD_ARGV(2))); } } -/* <114600> ../cstrike/dlls/multiplay_gamerules.cpp:227 */ void CHalfLifeMultiplay::SetCareerMatchLimit(int minWins, int winDifference) { if (!IsCareer()) @@ -166,13 +149,11 @@ void CHalfLifeMultiplay::SetCareerMatchLimit(int minWins, int winDifference) } } -/* <114650> ../cstrike/dlls/multiplay_gamerules.cpp:238 */ BOOL CHalfLifeMultiplay::IsCareer() { return IS_CAREER_MATCH(); } -/* <113ca2> ../cstrike/dlls/multiplay_gamerules.cpp:241 */ void CHalfLifeMultiplay::__MAKE_VHOOK(ServerDeactivate)() { if (!IsCareer()) @@ -185,7 +166,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ServerDeactivate)() UTIL_LogPrintf("Career End\n"); } -/* <113e08> ../cstrike/dlls/multiplay_gamerules.cpp:263 */ void CMapInfo::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "buying")) @@ -204,7 +184,6 @@ void CMapInfo::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } } -/* <112879> ../cstrike/dlls/multiplay_gamerules.cpp:280 */ void CMapInfo::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_NONE; @@ -212,10 +191,8 @@ void CMapInfo::__MAKE_VHOOK(Spawn)() pev->effects |= EF_NODRAW; } -/* <114673> ../cstrike/dlls/multiplay_gamerules.cpp:288 */ LINK_ENTITY_TO_CLASS(info_map_parameters, CMapInfo); -/* <11124e> ../cstrike/dlls/multiplay_gamerules.cpp:293 */ bool CCStrikeGameMgrHelper::__MAKE_VHOOK(CanPlayerHearPlayer)(CBasePlayer *pListener, CBasePlayer *pSender) { if (!pSender->IsPlayer() || pListener->m_iTeam != pSender->m_iTeam) @@ -245,7 +222,6 @@ bool CCStrikeGameMgrHelper::__MAKE_VHOOK(CanPlayerHearPlayer)(CBasePlayer *pList return (bListenerAlive == bSenderAlive); } -/* <11474f> ../cstrike/dlls/multiplay_gamerules.cpp:331 */ void Broadcast(const char *sentence) { char text[32]; @@ -265,7 +241,6 @@ void Broadcast(const char *sentence) MESSAGE_END(); } -/* <111767> ../cstrike/dlls/multiplay_gamerules.cpp:348 */ char *GetTeam(int teamNo) { switch (teamNo) @@ -283,13 +258,11 @@ char *GetTeam(int teamNo) return ""; } -/* <114805> ../cstrike/dlls/multiplay_gamerules.cpp:364 */ void EndRoundMessage(const char *sentence, int event) { - CHalfLifeMultiplay *mp = g_pGameRules; char *team = NULL; const char *message = &(sentence[1]); - int teamTriggered = 1; + bool bTeamTriggered = true; UTIL_ClientPrintAll(HUD_PRINTCENTER, sentence); @@ -324,7 +297,7 @@ void EndRoundMessage(const char *sentence, int event) } break; default: - teamTriggered = false; + bTeamTriggered = false; // tell bots the round was a draw if (TheBots != NULL) { @@ -333,28 +306,27 @@ void EndRoundMessage(const char *sentence, int event) break; } - if (mp != NULL) + if (CSGameRules() != NULL) { - if (teamTriggered) + if (bTeamTriggered) { - UTIL_LogPrintf("Team \"%s\" triggered \"%s\" (CT \"%i\") (T \"%i\")\n", team, message, mp->m_iNumCTWins, mp->m_iNumTerroristWins); + UTIL_LogPrintf("Team \"%s\" triggered \"%s\" (CT \"%i\") (T \"%i\")\n", team, message, CSGameRules()->m_iNumCTWins, CSGameRules()->m_iNumTerroristWins); } else { - UTIL_LogPrintf("World triggered \"%s\" (CT \"%i\") (T \"%i\")\n", message, mp->m_iNumCTWins, mp->m_iNumTerroristWins); + UTIL_LogPrintf("World triggered \"%s\" (CT \"%i\") (T \"%i\")\n", message, CSGameRules()->m_iNumCTWins, CSGameRules()->m_iNumTerroristWins); } } UTIL_LogPrintf("World triggered \"Round_End\"\n"); } -/* <1128a1> ../cstrike/dlls/multiplay_gamerules.cpp:419 */ void ReadMultiplayCvars(CHalfLifeMultiplay *mp) { - mp->m_iRoundTime = (int)(CVAR_GET_FLOAT("mp_roundtime") * 60); - mp->m_iC4Timer = (int)CVAR_GET_FLOAT("mp_c4timer"); - mp->m_iIntroRoundTime = (int)CVAR_GET_FLOAT("mp_freezetime"); - mp->m_iLimitTeams = (int)CVAR_GET_FLOAT("mp_limitteams"); + mp->m_iRoundTime = int(CVAR_GET_FLOAT("mp_roundtime") * 60); + mp->m_iC4Timer = int(CVAR_GET_FLOAT("mp_c4timer")); + mp->m_iIntroRoundTime = int(CVAR_GET_FLOAT("mp_freezetime")); + mp->m_iLimitTeams = int(CVAR_GET_FLOAT("mp_limitteams")); #ifndef REGAMEDLL_ADD if (mp->m_iRoundTime > 540) @@ -380,7 +352,7 @@ void ReadMultiplayCvars(CHalfLifeMultiplay *mp) CVAR_SET_FLOAT("mp_roundtime", 0); mp->m_iRoundTime = 0; } -#endif // REGAMEDLL_ADD +#endif if (mp->m_iIntroRoundTime > 60) { @@ -416,7 +388,6 @@ void ReadMultiplayCvars(CHalfLifeMultiplay *mp) } } -/* <11492c> ../cstrike/dlls/multiplay_gamerules.cpp:479 */ CHalfLifeMultiplay::CHalfLifeMultiplay() { m_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients); @@ -467,7 +438,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() g_iHostageNumber = 0; m_bBombDropped = FALSE; - m_iMaxRounds = (int)CVAR_GET_FLOAT("mp_maxrounds"); + m_iMaxRounds = int(CVAR_GET_FLOAT("mp_maxrounds")); if (m_iMaxRounds < 0) { @@ -476,7 +447,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() } m_iTotalRoundsPlayed = 0; - m_iMaxRoundsWon = (int)CVAR_GET_FLOAT("mp_winlimit"); + m_iMaxRoundsWon = int(CVAR_GET_FLOAT("mp_winlimit")); if (m_iMaxRoundsWon < 0) { @@ -491,7 +462,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() m_iMapHasVIPSafetyZone = 0; m_bMapHasBombZone = false; m_bMapHasRescueZone = false; - m_iStoredSpectValue = (int)allow_spectators.value; + m_iStoredSpectValue = int(allow_spectators.value); for (int j = 0; j < MAX_VIP_QUEUES; ++j) { @@ -550,7 +521,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() #ifndef CSTRIKE InstallBotControl(); -#endif // CSTRIKE +#endif InstallHostageManager(); @@ -560,41 +531,26 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() if (!installedCommands) { + installedCommands = true; if (g_bIsCzeroGame) { -#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS) - ADD_SERVER_COMMAND("career_continue", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z13SV_Continue_fv", (void *)SV_Continue_f)); - ADD_SERVER_COMMAND("career_matchlimit", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z21SV_CareerMatchLimit_fv", (void *)SV_CareerMatchLimit_f)); - ADD_SERVER_COMMAND("career_add_task", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z18SV_CareerAddTask_fv", (void *)SV_CareerAddTask_f)); - ADD_SERVER_COMMAND("career_endround", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z20SV_Career_EndRound_fv", (void *)SV_Career_EndRound_f)); - ADD_SERVER_COMMAND("career_restart", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z19SV_Career_Restart_fv", (void *)SV_Career_Restart_f)); - ADD_SERVER_COMMAND("tutor_toggle", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z17SV_Tutor_Toggle_fv", (void *)SV_Tutor_Toggle_f)); -#else ADD_SERVER_COMMAND("career_continue", SV_Continue_f); ADD_SERVER_COMMAND("career_matchlimit", SV_CareerMatchLimit_f); ADD_SERVER_COMMAND("career_add_task", SV_CareerAddTask_f); ADD_SERVER_COMMAND("career_endround", SV_Career_EndRound_f); ADD_SERVER_COMMAND("career_restart", SV_Career_Restart_f); ADD_SERVER_COMMAND("tutor_toggle", SV_Tutor_Toggle_f); -#endif // HOOK_GAMEDLL } -#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS) - ADD_SERVER_COMMAND("perf_test", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z15loopPerformancev", (void *)loopPerformance)); - ADD_SERVER_COMMAND("print_ent", (xcommand_t)GetOriginalFuncAddrOrDefault("_Z13printEntitiesv", (void *)printEntities)); -#else ADD_SERVER_COMMAND("perf_test", loopPerformance); ADD_SERVER_COMMAND("print_ent", printEntities); -#endif // HOOK_GAMEDLL - - installedCommands = true; } m_fCareerRoundMenuTime = 0; m_fCareerMatchMenuTime = 0; m_iCareerMatchWins = 0; - m_iRoundWinDifference = (int)CVAR_GET_FLOAT("mp_windifference"); + m_iRoundWinDifference = int(CVAR_GET_FLOAT("mp_windifference")); CCareerTaskManager::Create(); if (m_iRoundWinDifference < 1) @@ -609,7 +565,6 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() g_pMPGameRules = this; } -/* <113b92> ../cstrike/dlls/multiplay_gamerules.cpp:678 */ void CHalfLifeMultiplay::__MAKE_VHOOK(RefreshSkillData)() { CGameRules::RefreshSkillData(); @@ -624,7 +579,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RefreshSkillData)() gSkillData.plrDmgRPG = 120; } -/* <113b51> ../cstrike/dlls/multiplay_gamerules.cpp:713 */ void CHalfLifeMultiplay::__MAKE_VHOOK(RemoveGuns)() { CBaseEntity *toremove = NULL; @@ -641,7 +595,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RemoveGuns)() } } -/* <1149e8> ../cstrike/dlls/multiplay_gamerules.cpp:733 */ void CHalfLifeMultiplay::UpdateTeamScores() { MESSAGE_BEGIN(MSG_ALL, gmsgTeamScore); @@ -655,7 +608,6 @@ void CHalfLifeMultiplay::UpdateTeamScores() MESSAGE_END(); } -/* <113aee> ../cstrike/dlls/multiplay_gamerules.cpp:747 */ void CHalfLifeMultiplay::__MAKE_VHOOK(CleanUpMap)() { // Recreate all the map entities from the map data (preserving their indices), @@ -771,7 +723,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(CleanUpMap)() PLAYBACK_EVENT((FEV_GLOBAL | FEV_RELIABLE), 0, m_usResetDecals); } -/* <118585> ../cstrike/dlls/multiplay_gamerules.cpp:862 */ void CHalfLifeMultiplay::__MAKE_VHOOK(GiveC4)() { int iTeamCount; @@ -883,7 +834,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(GiveC4)() } } -/* <11541f> ../cstrike/dlls/multiplay_gamerules.cpp:981 */ void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus) { m_iRoundWinStatus = iWinStatus; @@ -891,7 +841,6 @@ void CHalfLifeMultiplay::TerminateRound(float tmDelay, int iWinStatus) m_bRoundTerminating = true; } -/* <114a6a> ../cstrike/dlls/multiplay_gamerules.cpp:995 */ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus) { if (TheCareerTasks == NULL) @@ -991,14 +940,12 @@ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus) } // Check if the scenario has been won/lost. - -/* <117750> ../cstrike/dlls/multiplay_gamerules.cpp:1084 */ void CHalfLifeMultiplay::__MAKE_VHOOK(CheckWinConditions)() { #ifdef REGAMEDLL_ADD if (round_infinite.string[0] == '1') return; -#endif // REGAMEDLL_ADD +#endif // If a winner has already been determined and game of started.. then get the heck out of here if (m_bFirstConnected && m_iRoundWinStatus != WINNER_NONE) @@ -1011,7 +958,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(CheckWinConditions)() #else // the icc compiler will cut out all of the code which refers to it int scenarioFlags = 0; -#endif // REGAMEDLL_ADD +#endif // Initialize the player counts.. int NumDeadCT, NumDeadTerrorist, NumAliveTerrorist, NumAliveCT; @@ -1252,7 +1199,7 @@ bool CHalfLifeMultiplay::PrisonRoundEndCheck(int NumAliveTerrorist, int NumAlive // checks to scenario Escaped Terrorist's if (m_bMapHasEscapeZone) { - float_precision flEscapeRatio = (float_precision)m_iHaveEscaped / (float_precision)m_iNumEscapers; + float_precision flEscapeRatio = float_precision(m_iHaveEscaped) / float_precision(m_iNumEscapers); if (flEscapeRatio >= m_flRequiredEscapeRatio) { @@ -1400,7 +1347,7 @@ bool CHalfLifeMultiplay::TeamExterminationCheck(int NumAliveTerrorist, int NumAl nowin = true; #ifdef REGAMEDLL_FIXES break; -#endif // REGAMEDLL_FIXES +#endif } } @@ -1528,7 +1475,6 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck(bool bNeededPlayers) return false; } -/* <117336> ../cstrike/dlls/multiplay_gamerules.cpp:1499 */ void CHalfLifeMultiplay::SwapAllPlayers() { CBaseEntity *pPlayer = NULL; @@ -1556,7 +1502,6 @@ void CHalfLifeMultiplay::SwapAllPlayers() UpdateTeamScores(); } -/* <1171eb> ../cstrike/dlls/multiplay_gamerules.cpp:1525 */ void CHalfLifeMultiplay::BalanceTeams() { int iTeamToSwap = UNASSIGNED; @@ -1569,9 +1514,9 @@ void CHalfLifeMultiplay::BalanceTeams() // uneven number of players if ((m_iNumCT + m_iNumTerrorist) % 2 != 0) - iDesiredNumCT = (int)((m_iNumCT + m_iNumTerrorist) * 0.55f) + 1; + iDesiredNumCT = int((m_iNumCT + m_iNumTerrorist) * 0.55f) + 1; else - iDesiredNumCT = (int)((m_iNumCT + m_iNumTerrorist) / 2); + iDesiredNumCT = int((m_iNumCT + m_iNumTerrorist) / 2); iDesiredNumTerrorist = (m_iNumCT + m_iNumTerrorist) - iDesiredNumCT; @@ -1647,7 +1592,6 @@ void CHalfLifeMultiplay::BalanceTeams() } } -/* <113158> ../cstrike/dlls/multiplay_gamerules.cpp:1608 */ void CHalfLifeMultiplay::__MAKE_VHOOK(CheckMapConditions)() { // Check to see if this map has a bomb target in it @@ -1684,7 +1628,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(CheckMapConditions)() m_iMapHasVIPSafetyZone = MAP_HAVE_VIP_SAFETYZONE_NO; } -/* <11745e> ../cstrike/dlls/multiplay_gamerules.cpp:1676 */ void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)() { // tell bots that the round is restarting @@ -1768,7 +1711,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)() // Reset total # of rounds played m_iTotalRoundsPlayed = 0; - m_iMaxRounds = (int)CVAR_GET_FLOAT("mp_maxrounds"); + m_iMaxRounds = int(CVAR_GET_FLOAT("mp_maxrounds")); if (m_iMaxRounds < 0) { @@ -1776,7 +1719,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)() CVAR_SET_FLOAT("mp_maxrounds", 0); } - m_iMaxRoundsWon = (int)CVAR_GET_FLOAT("mp_winlimit"); + m_iMaxRoundsWon = int(CVAR_GET_FLOAT("mp_winlimit")); if (m_iMaxRoundsWon < 0) { @@ -2074,7 +2017,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(RestartRound)() m_bCompleteReset = false; } -/* <114ca3> ../cstrike/dlls/multiplay_gamerules.cpp:2073 */ BOOL CHalfLifeMultiplay::IsThereABomber() { CBasePlayer *pPlayer = NULL; @@ -2095,37 +2037,33 @@ BOOL CHalfLifeMultiplay::IsThereABomber() return FALSE; } -/* <114d20> ../cstrike/dlls/multiplay_gamerules.cpp:2097 */ BOOL CHalfLifeMultiplay::IsThereABomb() { CGrenade *pC4 = NULL; CBaseEntity *pWeaponC4 = NULL; - BOOL bFoundBomb = FALSE; + bool bFoundBomb = false; while ((pWeaponC4 = UTIL_FindEntityByClassname(pWeaponC4, "grenade")) != NULL) { if (!pWeaponC4) continue; - pC4 = (CGrenade *)pWeaponC4; + pC4 = static_cast(pWeaponC4); if (pC4->m_bIsC4) { - bFoundBomb = TRUE; + bFoundBomb = true; break; } } if (bFoundBomb || (UTIL_FindEntityByClassname(NULL, "weapon_c4")) != NULL) - { return TRUE; - } return FALSE; } -/* <114d83> ../cstrike/dlls/multiplay_gamerules.cpp:2129 */ BOOL CHalfLifeMultiplay::TeamFull(int team_id) { switch (team_id) @@ -2141,8 +2079,6 @@ BOOL CHalfLifeMultiplay::TeamFull(int team_id) } // checks to see if the desired team is stacked, returns true if it is - -/* <114dbb> ../cstrike/dlls/multiplay_gamerules.cpp:2144 */ BOOL CHalfLifeMultiplay::TeamStacked(int newTeam_id, int curTeam_id) { // players are allowed to change to their own team @@ -2169,7 +2105,6 @@ BOOL CHalfLifeMultiplay::TeamStacked(int newTeam_id, int curTeam_id) return FALSE; } -/* <114e2b> ../cstrike/dlls/multiplay_gamerules.cpp:2214 */ void CHalfLifeMultiplay::StackVIPQueue() { for (int i = MAX_VIP_QUEUES - 2; i > 0; --i) @@ -2191,7 +2126,6 @@ void CHalfLifeMultiplay::StackVIPQueue() } } -/* <114e63> ../cstrike/dlls/multiplay_gamerules.cpp:2232 */ bool CHalfLifeMultiplay::IsVIPQueueEmpty() { for (int i = 0; i < MAX_VIP_QUEUES; ++i) @@ -2208,7 +2142,6 @@ bool CHalfLifeMultiplay::IsVIPQueueEmpty() return (VIPQueue[0] == NULL && VIPQueue[1] == NULL && VIPQueue[2] == NULL && VIPQueue[3] == NULL && VIPQueue[4] == NULL); } -/* <114eea> ../cstrike/dlls/multiplay_gamerules.cpp:2257 */ bool CHalfLifeMultiplay::AddToVIPQueue(CBasePlayer *toAdd) { for (int i = 0; i < MAX_VIP_QUEUES; ++i) @@ -2253,7 +2186,6 @@ bool CHalfLifeMultiplay::AddToVIPQueue(CBasePlayer *toAdd) return FALSE; } -/* <114f80> ../cstrike/dlls/multiplay_gamerules.cpp:2290 */ void CHalfLifeMultiplay::ResetCurrentVIP() { char *infobuffer = GET_INFO_BUFFER(m_pVIP->edict()); @@ -2290,7 +2222,6 @@ void CHalfLifeMultiplay::ResetCurrentVIP() m_pVIP->m_bNotKilled = false; } -/* <11706f> ../cstrike/dlls/multiplay_gamerules.cpp:2335 */ void CHalfLifeMultiplay::PickNextVIP() { if (!IsVIPQueueEmpty()) @@ -2389,7 +2320,6 @@ void CHalfLifeMultiplay::PickNextVIP() } } -/* <115458> ../cstrike/dlls/multiplay_gamerules.cpp:2435 */ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)() { MonitorTutorStatus(); @@ -2447,7 +2377,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)() m_iStoredSpectValue = allow_spectators.value; MESSAGE_BEGIN(MSG_ALL, gmsgAllowSpec); - WRITE_BYTE((int)allow_spectators.value); + WRITE_BYTE(int(allow_spectators.value)); MESSAGE_END(); } @@ -2471,7 +2401,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)() { bool isBotSpeaking = false; - if (m_fTeamCount + 10.0 > gpGlobals->time) + if (m_fTeamCount + 10.0f > gpGlobals->time) { isBotSpeaking = IsBotSpeaking(); } @@ -2554,20 +2484,20 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)() if (g_psv_accelerate->value != 5.0f) { - CVAR_SET_FLOAT("sv_accelerate", 5.0); + CVAR_SET_FLOAT("sv_accelerate", 5.0f); } if (g_psv_friction->value != 4.0f) { - CVAR_SET_FLOAT("sv_friction", 4.0); + CVAR_SET_FLOAT("sv_friction", 4.0f); } if (g_psv_stopspeed->value != 75.0f) { - CVAR_SET_FLOAT("sv_stopspeed", 75.0); + CVAR_SET_FLOAT("sv_stopspeed", 75.0f); } - m_iMaxRounds = (int)maxrounds.value; + m_iMaxRounds = int(maxrounds.value); if (m_iMaxRounds < 0) { @@ -2575,7 +2505,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)() CVAR_SET_FLOAT("mp_maxrounds", 0); } - m_iMaxRoundsWon = (int)winlimit.value; + m_iMaxRoundsWon = int(winlimit.value); if (m_iMaxRoundsWon < 0) { @@ -2616,7 +2546,7 @@ bool CHalfLifeMultiplay::CheckGameOver() // someone else quit the game already if (g_fGameOver) { - int time = (int)CVAR_GET_FLOAT("mp_chattime"); + int time = int(CVAR_GET_FLOAT("mp_chattime")); if (time < 1) CVAR_SET_STRING("mp_chattime", "1"); @@ -2809,7 +2739,7 @@ void CHalfLifeMultiplay::CheckRoundTimeExpired() #ifdef REGAMEDLL_ADD if (round_infinite.string[0] == '1' || (UTIL_ReadFlags(round_infinite.string) & SCENARIO_BLOCK_TIME_EXPRIRED)) return; -#endif // REGAMEDLL_ADD +#endif if (!HasRoundTimeExpired()) return; @@ -2926,7 +2856,7 @@ void CHalfLifeMultiplay::CheckLevelInitialized() void CHalfLifeMultiplay::CheckRestartRound() { // Restart the round if specified by the server - int iRestartDelay = (int)restartround.value; + int iRestartDelay = int(restartround.value); if (!iRestartDelay) { @@ -2957,7 +2887,6 @@ void CHalfLifeMultiplay::CheckRestartRound() } } -/* <115189> ../cstrike/dlls/multiplay_gamerules.cpp:2922 */ bool CHalfLifeMultiplay::HasRoundTimeExpired() { // We haven't completed other objectives, so go for this!. @@ -2979,7 +2908,6 @@ bool CHalfLifeMultiplay::HasRoundTimeExpired() return false; } -/* <1151f4> ../cstrike/dlls/multiplay_gamerules.cpp:2945 */ bool CHalfLifeMultiplay::IsBombPlanted() { if (m_bMapHasBombTarget) @@ -3000,8 +2928,6 @@ bool CHalfLifeMultiplay::IsBombPlanted() // living players on the given team need to be marked as not receiving any money // next round. - -/* <115229> ../cstrike/dlls/multiplay_gamerules.cpp:2971 */ void CHalfLifeMultiplay::MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int iTeam) { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -3021,7 +2947,6 @@ void CHalfLifeMultiplay::MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int } } -/* <1152e2> ../cstrike/dlls/multiplay_gamerules.cpp:2987 */ void CHalfLifeMultiplay::CareerRestart() { g_fGameOver = FALSE; @@ -3057,25 +2982,21 @@ void CHalfLifeMultiplay::CareerRestart() } } -/* <1128cb> ../cstrike/dlls/multiplay_gamerules.cpp:3017 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(IsMultiplayer)() { return TRUE; } -/* <1128f3> ../cstrike/dlls/multiplay_gamerules.cpp:3024 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(IsDeathmatch)() { return TRUE; } -/* <11291b> ../cstrike/dlls/multiplay_gamerules.cpp:3031 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(IsCoOp)() { return gpGlobals->coop; } -/* <113fcf> ../cstrike/dlls/multiplay_gamerules.cpp:3038 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) { if (!pWeapon->CanDeploy()) @@ -3096,7 +3017,6 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, return FALSE; } -/* <113eec> ../cstrike/dlls/multiplay_gamerules.cpp:3071 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(GetNextBestWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) { CBasePlayerItem *pCheck; @@ -3153,26 +3073,22 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(GetNextBestWeapon)(CBasePlayer *pPlayer, C return TRUE; } -/* <113aa5> ../cstrike/dlls/multiplay_gamerules.cpp:3132 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(ClientCommand_DeadOrAlive)(CBasePlayer *pPlayer, const char *pcmd) { return m_VoiceGameMgr.ClientCommand(pPlayer, pcmd); } -/* <113afe> ../cstrike/dlls/multiplay_gamerules.cpp:3138 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(ClientCommand)(CBasePlayer *pPlayer, const char *pcmd) { return FALSE; } -/* <113a3c> ../cstrike/dlls/multiplay_gamerules.cpp:3145 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(ClientConnected)(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) { m_VoiceGameMgr.ClientConnected(pEntity); return TRUE; } -/* <11298b> ../cstrike/dlls/multiplay_gamerules.cpp:3156 */ void CHalfLifeMultiplay::__MAKE_VHOOK(UpdateGameMode)(CBasePlayer *pPlayer) { MESSAGE_BEGIN(MSG_ONE, gmsgGameMode, NULL, pPlayer->edict()); @@ -3180,7 +3096,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(UpdateGameMode)(CBasePlayer *pPlayer) MESSAGE_END(); } -/* <11642b> ../cstrike/dlls/multiplay_gamerules.cpp:3163 */ void CHalfLifeMultiplay::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl) { int i; @@ -3230,7 +3145,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl) { MESSAGE_BEGIN(MSG_ONE, gmsgScoreInfo, NULL, pl->edict()); WRITE_BYTE(i); // client number - WRITE_SHORT((int)plr->pev->frags); + WRITE_SHORT(int(plr->pev->frags)); WRITE_SHORT(plr->m_iDeaths); WRITE_SHORT(0); WRITE_SHORT(plr->m_iTeam); @@ -3249,7 +3164,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl) MESSAGE_END(); MESSAGE_BEGIN(MSG_ONE, gmsgAllowSpec, NULL, pl->edict()); - WRITE_BYTE((int)allow_spectators.value); + WRITE_BYTE(int(allow_spectators.value)); MESSAGE_END(); MESSAGE_BEGIN(MSG_ONE, gmsgForceCam, NULL, pl->edict()); @@ -3325,7 +3240,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl) } } -/* <1137c1> ../cstrike/dlls/multiplay_gamerules.cpp:3318 */ void CHalfLifeMultiplay::__MAKE_VHOOK(ClientDisconnected)(edict_t *pClient) { if (pClient != NULL) @@ -3420,14 +3334,12 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ClientDisconnected)(edict_t *pClient) CheckWinConditions(); } -/* <112a05> ../cstrike/dlls/multiplay_gamerules.cpp:3428 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer) { pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED; return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED * 1.25; } -/* <112a3d> ../cstrike/dlls/multiplay_gamerules.cpp:3436 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FPlayerCanTakeDamage)(CBasePlayer *pPlayer, CBaseEntity *pAttacker) { if (!pAttacker || PlayerRelationship(pPlayer, pAttacker) != GR_TEAMMATE) @@ -3443,7 +3355,6 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FPlayerCanTakeDamage)(CBasePlayer *pPlayer return FALSE; } -/* <11370c> ../cstrike/dlls/multiplay_gamerules.cpp:3454 */ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) { if (g_fGameOver) @@ -3512,8 +3423,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) } // Purpose: Player has just spawned. Equip them. - -/* <113bcf> ../cstrike/dlls/multiplay_gamerules.cpp:3523 */ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer) { // This is tied to the joining state (m_iJoiningState).. add it when the joining state is there. @@ -3544,7 +3453,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer) pPlayer->SetPlayerModel(false); } -/* <113d74> ../cstrike/dlls/multiplay_gamerules.cpp:3553 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer) { // Player cannot respawn twice in a round @@ -3584,13 +3492,11 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer) return TRUE; } -/* <112a86> ../cstrike/dlls/multiplay_gamerules.cpp:3591 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlPlayerSpawnTime)(CBasePlayer *pPlayer) { return gpGlobals->time;//now! } -/* <112abe> ../cstrike/dlls/multiplay_gamerules.cpp:3596 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(AllowAutoTargetCrosshair)() { return FALSE; @@ -3598,14 +3504,11 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(AllowAutoTargetCrosshair)() // IPointsForKill - how many points awarded to anyone // that kills this player? - -/* <112ae6> ../cstrike/dlls/multiplay_gamerules.cpp:3619 */ int CHalfLifeMultiplay::__MAKE_VHOOK(IPointsForKill)(CBasePlayer *pAttacker, CBasePlayer *pKilled) { return 1; } -/* <116cbd> ../cstrike/dlls/multiplay_gamerules.cpp:3627 */ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) { DeathNotice(pVictim, pKiller, pInflictor); @@ -3652,7 +3555,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvar #ifdef REGAMEDLL_ADD if (friendlyfire.string[0] == '2') killedByFFA = true; -#endif // REGAMEDLL_ADD +#endif if (killer->m_iTeam == pVictim->m_iTeam && !killedByFFA) { @@ -3726,7 +3629,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvar // killed scores MESSAGE_BEGIN(MSG_BROADCAST, gmsgScoreInfo); WRITE_BYTE(ENTINDEX(pVictim->edict())); - WRITE_SHORT((int)pVictim->pev->frags); + WRITE_SHORT(int(pVictim->pev->frags)); WRITE_SHORT(pVictim->m_iDeaths); WRITE_SHORT(0); WRITE_SHORT(pVictim->m_iTeam); @@ -3741,7 +3644,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvar MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo); WRITE_BYTE(ENTINDEX(PK->edict())); - WRITE_SHORT((int)PK->pev->frags); + WRITE_SHORT(int(PK->pev->frags)); WRITE_SHORT(PK->m_iDeaths); WRITE_SHORT(0); WRITE_SHORT(PK->m_iTeam); @@ -3752,7 +3655,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvar } } -/* <113273> ../cstrike/dlls/multiplay_gamerules.cpp:3772 */ void CHalfLifeMultiplay::__MAKE_VHOOK(DeathNotice)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) { // Work out what killed the player, and send a message to all clients about it @@ -3873,8 +3775,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(DeathNotice)(CBasePlayer *pVictim, entvars // PlayerGotWeapon - player has grabbed a weapon that was // sitting in the world - -/* <112b2e> ../cstrike/dlls/multiplay_gamerules.cpp:3916 */ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerGotWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) { ; @@ -3882,8 +3782,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerGotWeapon)(CBasePlayer *pPlayer, CBa // FlWeaponRespawnTime - what is the time in the future // at which this weapon may spawn? - -/* <112b76> ../cstrike/dlls/multiplay_gamerules.cpp:3924 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlWeaponRespawnTime)(CBasePlayerItem *pWeapon) { return gpGlobals->time + WEAPON_RESPAWN_TIME; @@ -3892,8 +3790,6 @@ float CHalfLifeMultiplay::__MAKE_VHOOK(FlWeaponRespawnTime)(CBasePlayerItem *pWe // FlWeaponRespawnTime - Returns 0 if the weapon can respawn // now, otherwise it returns the time at which it can try // to spawn again. - -/* <114058> ../cstrike/dlls/multiplay_gamerules.cpp:3938 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlWeaponTryRespawn)(CBasePlayerItem *pWeapon) { if (pWeapon && pWeapon->m_iId && (pWeapon->iFlags() & ITEM_FLAG_LIMITINWORLD)) @@ -3908,13 +3804,11 @@ float CHalfLifeMultiplay::__MAKE_VHOOK(FlWeaponTryRespawn)(CBasePlayerItem *pWea return 0; } -/* <112bae> ../cstrike/dlls/multiplay_gamerules.cpp:3956 */ Vector CHalfLifeMultiplay::__MAKE_VHOOK(VecWeaponRespawnSpot)(CBasePlayerItem *pWeapon) { return pWeapon->pev->origin; } -/* <112c11> ../cstrike/dlls/multiplay_gamerules.cpp:3965 */ int CHalfLifeMultiplay::__MAKE_VHOOK(WeaponShouldRespawn)(CBasePlayerItem *pWeapon) { if (pWeapon->pev->spawnflags & SF_NORESPAWN) @@ -3925,25 +3819,21 @@ int CHalfLifeMultiplay::__MAKE_VHOOK(WeaponShouldRespawn)(CBasePlayerItem *pWeap return GR_WEAPON_RESPAWN_YES; } -/* <11322b> ../cstrike/dlls/multiplay_gamerules.cpp:3979 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(CanHavePlayerItem)(CBasePlayer *pPlayer, CBasePlayerItem *pItem) { return CGameRules::CanHavePlayerItem(pPlayer, pItem); } -/* <112c49> ../cstrike/dlls/multiplay_gamerules.cpp:3986 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(CanHaveItem)(CBasePlayer *pPlayer, CItem *pItem) { return TRUE; } -/* <112c91> ../cstrike/dlls/multiplay_gamerules.cpp:3993 */ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerGotItem)(CBasePlayer *pPlayer, CItem *pItem) { ; } -/* <112cd9> ../cstrike/dlls/multiplay_gamerules.cpp:3999 */ int CHalfLifeMultiplay::__MAKE_VHOOK(ItemShouldRespawn)(CItem *pItem) { if (pItem->pev->spawnflags & SF_NORESPAWN) @@ -3954,31 +3844,26 @@ int CHalfLifeMultiplay::__MAKE_VHOOK(ItemShouldRespawn)(CItem *pItem) return GR_ITEM_RESPAWN_YES; } -/* <112d11> ../cstrike/dlls/multiplay_gamerules.cpp:4013 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlItemRespawnTime)(CItem *pItem) { return gpGlobals->time + ITEM_RESPAWN_TIME; } -/* <112d49> ../cstrike/dlls/multiplay_gamerules.cpp:4022 */ Vector CHalfLifeMultiplay::__MAKE_VHOOK(VecItemRespawnSpot)(CItem *pItem) { return pItem->pev->origin; } -/* <112dac> ../cstrike/dlls/multiplay_gamerules.cpp:4029 */ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerGotAmmo)(CBasePlayer *pPlayer, char *szName, int iCount) { ; } -/* <112e04> ../cstrike/dlls/multiplay_gamerules.cpp:4035 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(IsAllowedToSpawn)(CBaseEntity *pEntity) { return TRUE; } -/* <112e3c> ../cstrike/dlls/multiplay_gamerules.cpp:4045 */ int CHalfLifeMultiplay::__MAKE_VHOOK(AmmoShouldRespawn)(CBasePlayerAmmo *pAmmo) { if (pAmmo->pev->spawnflags & SF_NORESPAWN) @@ -3989,43 +3874,36 @@ int CHalfLifeMultiplay::__MAKE_VHOOK(AmmoShouldRespawn)(CBasePlayerAmmo *pAmmo) return GR_AMMO_RESPAWN_YES; } -/* <112e74> ../cstrike/dlls/multiplay_gamerules.cpp:4057 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlAmmoRespawnTime)(CBasePlayerAmmo *pAmmo) { return gpGlobals->time + 20.0f; } -/* <112eac> ../cstrike/dlls/multiplay_gamerules.cpp:4064 */ Vector CHalfLifeMultiplay::__MAKE_VHOOK(VecAmmoRespawnSpot)(CBasePlayerAmmo *pAmmo) { return pAmmo->pev->origin; } -/* <112f0f> ../cstrike/dlls/multiplay_gamerules.cpp:4071 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlHealthChargerRechargeTime)() { return 60; } -/* <112f37> ../cstrike/dlls/multiplay_gamerules.cpp:4077 */ float CHalfLifeMultiplay::__MAKE_VHOOK(FlHEVChargerRechargeTime)() { return 30; } -/* <112f5f> ../cstrike/dlls/multiplay_gamerules.cpp:4084 */ int CHalfLifeMultiplay::__MAKE_VHOOK(DeadPlayerWeapons)(CBasePlayer *pPlayer) { return GR_PLR_DROP_GUN_ACTIVE; } -/* <112f97> ../cstrike/dlls/multiplay_gamerules.cpp:4091 */ int CHalfLifeMultiplay::__MAKE_VHOOK(DeadPlayerAmmo)(CBasePlayer *pPlayer) { return GR_PLR_DROP_AMMO_ACTIVE; } -/* <1131d6> ../cstrike/dlls/multiplay_gamerules.cpp:4096 */ edict_t *CHalfLifeMultiplay::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer) { // gat valid spawn point @@ -4042,7 +3920,6 @@ edict_t *CHalfLifeMultiplay::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlay return pentSpawnSpot; } -/* <116c24> ../cstrike/dlls/multiplay_gamerules.cpp:4110 */ int CHalfLifeMultiplay::__MAKE_VHOOK(PlayerRelationship)(CBasePlayer *pPlayer, CBaseEntity *pTarget) { if (!pPlayer || !pTarget) @@ -4066,7 +3943,6 @@ int CHalfLifeMultiplay::__MAKE_VHOOK(PlayerRelationship)(CBasePlayer *pPlayer, C return GR_TEAMMATE; } -/* <112fcf> ../cstrike/dlls/multiplay_gamerules.cpp:4128 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FAllowFlashlight)() { static cvar_t *mp_flashlight = NULL; @@ -4080,13 +3956,11 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FAllowFlashlight)() return FALSE; } -/* <113012> ../cstrike/dlls/multiplay_gamerules.cpp:4145 */ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FAllowMonsters)() { return CVAR_GET_FLOAT("mp_allowmonsters") != 0; } -/* <114155> ../cstrike/dlls/multiplay_gamerules.cpp:4156 */ void CHalfLifeMultiplay::__MAKE_VHOOK(GoToIntermission)() { if (g_fGameOver) @@ -4126,7 +4000,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(GoToIntermission)() SERVER_COMMAND("setpause\n"); } - int time = (int)CVAR_GET_FLOAT("mp_chattime"); + int time = int(CVAR_GET_FLOAT("mp_chattime")); if (time < 1) CVAR_SET_STRING("mp_chattime", "1"); @@ -4134,7 +4008,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(GoToIntermission)() else if (time > MAX_INTERMISSION_TIME) CVAR_SET_STRING("mp_chattime", UTIL_dtos1(MAX_INTERMISSION_TIME)); - m_flIntermissionEndTime = gpGlobals->time + (int)mp_chattime.value; + m_flIntermissionEndTime = gpGlobals->time + int(mp_chattime.value); m_flIntermissionStartTime = gpGlobals->time; g_fGameOver = TRUE; @@ -4145,8 +4019,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(GoToIntermission)() } // Clean up memory used by mapcycle when switching it - -/* <115c98> ../cstrike/dlls/multiplay_gamerules.cpp:4241 */ void DestroyMapCycle(mapcycle_t *cycle) { mapcycle_item_t *p, *n, *start; @@ -4170,13 +4042,11 @@ void DestroyMapCycle(mapcycle_t *cycle) cycle->next_item = NULL; } -/* <115d30> ../cstrike/dlls/multiplay_gamerules.cpp:4271 */ char *MP_COM_GetToken() { return mp_com_token; } -/* <115d4d> ../cstrike/dlls/multiplay_gamerules.cpp:4283 */ char *MP_COM_Parse(char *data) { int c; @@ -4256,7 +4126,6 @@ skipwhite: return data; } -/* <115db1> ../cstrike/dlls/multiplay_gamerules.cpp:4360 */ int MP_COM_TokenWaiting(char *buffer) { char *p; @@ -4264,7 +4133,7 @@ int MP_COM_TokenWaiting(char *buffer) p = buffer; while (*p && *p != '\n') { - if (!isspace(*p) || isalnum(*p)) + if (!Q_isspace(*p) || Q_isalnum(*p)) return 1; ++p; @@ -4273,7 +4142,6 @@ int MP_COM_TokenWaiting(char *buffer) return 0; } -/* <115e11> ../cstrike/dlls/multiplay_gamerules.cpp:4384 */ int ReloadMapCycleFile(char *filename, mapcycle_t *cycle) { char szBuffer[ MAX_RULE_BUFFER ]; @@ -4394,8 +4262,6 @@ int ReloadMapCycleFile(char *filename, mapcycle_t *cycle) } // Determine the current # of active players on the server for map cycling logic - -/* <115f76> ../cstrike/dlls/multiplay_gamerules.cpp:4510 */ int CountPlayers() { int num = 0; @@ -4414,8 +4280,6 @@ int CountPlayers() } // Parse commands/key value pairs to issue right after map xxx command is issued on server level transition - -/* <116002> ../cstrike/dlls/multiplay_gamerules.cpp:4535 */ void ExtractCommandString(char *s, char *szCommand) { // Now make rules happen @@ -4475,7 +4339,6 @@ void ExtractCommandString(char *s, char *szCommand) } } -/* <116b52> ../cstrike/dlls/multiplay_gamerules.cpp:4582 */ void CHalfLifeMultiplay::ResetAllMapVotes() { CBaseEntity *pTempEntity = NULL; @@ -4497,7 +4360,6 @@ void CHalfLifeMultiplay::ResetAllMapVotes() m_iMapVotes[j] = 0; } -/* <11624e> ../cstrike/dlls/multiplay_gamerules.cpp:4608 */ int GetMapCount() { static mapcycle_t mapcycle2; @@ -4518,7 +4380,6 @@ int GetMapCount() return iCount; } -/* <1187d2> ../cstrike/dlls/multiplay_gamerules.cpp:4629 */ void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote) { static mapcycle_t mapcycle2; @@ -4561,7 +4422,7 @@ void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote) return; } - if (Q_strcmp(pszNewMap, STRING(gpGlobals->mapname))) + if (Q_strcmp(pszNewMap, STRING(gpGlobals->mapname)) != 0) { CHANGE_LEVEL(pszNewMap, NULL); return; @@ -4576,7 +4437,6 @@ void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote) ResetAllMapVotes(); } -/* <11895b> ../cstrike/dlls/multiplay_gamerules.cpp:4702 */ void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote) { CBaseEntity *pTempEntity = NULL; @@ -4607,16 +4467,16 @@ void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote) ratio = 1; CVAR_SET_STRING("mp_mapvoteratio", "1.0"); } - else if (mapvoteratio.value < 0.35) + else if (mapvoteratio.value < 0.35f) { - ratio = 0.35; + ratio = 0.35f; CVAR_SET_STRING("mp_mapvoteratio", "0.35"); } int iRequiredVotes = 2; if (iNumPlayers > 2) { - iRequiredVotes = (int)(iNumPlayers * ratio + 0.5); + iRequiredVotes = int(iNumPlayers * ratio + 0.5f); } if (iValidVotes < iRequiredVotes) @@ -4629,8 +4489,6 @@ void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote) } // Server is changing to a new level, check mapcycle.txt for map name and setup info - -/* <116089> ../cstrike/dlls/multiplay_gamerules.cpp:4773 */ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() { static char szPreviousMapCycleFile[256]; @@ -4646,7 +4504,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() Q_strcpy(szFirstMapInList, "hldm1"); int curplayers; - BOOL do_cycle = TRUE; + bool do_cycle = true; // find the map to change to char *mapcfile = (char *)CVAR_GET_STRING("mapcyclefile"); @@ -4658,7 +4516,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() curplayers = CountPlayers(); // Has the map cycle filename changed? - if (Q_stricmp(mapcfile, szPreviousMapCycleFile)) + if (Q_stricmp(mapcfile, szPreviousMapCycleFile) != 0) { Q_strcpy(szPreviousMapCycleFile, mapcfile); @@ -4667,14 +4525,14 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() if (!ReloadMapCycleFile(mapcfile, &mapcycle) || !mapcycle.items) { ALERT(at_console, "Unable to load map cycle file %s\n", mapcfile); - do_cycle = FALSE; + do_cycle = false; } } if (do_cycle && mapcycle.items) { - BOOL keeplooking = FALSE; - BOOL found = FALSE; + bool keeplooking = false; + bool found = false; mapcycle_item_s *item; // Assume current map @@ -4684,7 +4542,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() // Traverse list for (item = mapcycle.next_item; item->next != mapcycle.next_item; item = item->next) { - keeplooking = FALSE; + keeplooking = false; assert(item != NULL); @@ -4692,12 +4550,12 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() { if (curplayers >= item->minplayers) { - found = TRUE; + found = true; minplayers = item->minplayers; } else { - keeplooking = TRUE; + keeplooking = true; } } @@ -4705,12 +4563,12 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() { if (curplayers <= item->maxplayers) { - found = TRUE; + found = true; maxplayers = item->maxplayers; } else { - keeplooking = TRUE; + keeplooking = true; } } @@ -4719,7 +4577,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() continue; } - found = TRUE; + found = true; break; } @@ -4762,7 +4620,6 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(ChangeLevel)() } } -/* <116317> ../cstrike/dlls/multiplay_gamerules.cpp:4903 */ void CHalfLifeMultiplay::SendMOTDToClient(edict_t *client) { // read from the MOTD.txt file @@ -4808,7 +4665,6 @@ void CHalfLifeMultiplay::SendMOTDToClient(edict_t *client) FREE_FILE(aFileList); } -/* <1181ac> ../cstrike/dlls/multiplay_gamerules.cpp:4961 */ void CHalfLifeMultiplay::__MAKE_VHOOK(ClientUserInfoChanged)(CBasePlayer *pPlayer, char *infobuffer) { pPlayer->SetPlayerModel(pPlayer->m_bHasC4); diff --git a/regamedll/dlls/observer.cpp b/regamedll/dlls/observer.cpp index 3a932ebf..8949a284 100644 --- a/regamedll/dlls/observer.cpp +++ b/regamedll/dlls/observer.cpp @@ -6,10 +6,10 @@ int GetForceCamera_api(CBasePlayer *pObserver) if (!fadetoblack.value) { - retVal = (int)CVAR_GET_FLOAT("mp_forcechasecam"); + retVal = int(CVAR_GET_FLOAT("mp_forcechasecam")); if (retVal == CAMERA_MODE_SPEC_ANYONE) - retVal = (int)CVAR_GET_FLOAT("mp_forcecamera"); + retVal = int(CVAR_GET_FLOAT("mp_forcecamera")); } else retVal = CAMERA_MODE_SPEC_ONLY_FRIST_PERSON; @@ -17,7 +17,6 @@ int GetForceCamera_api(CBasePlayer *pObserver) return retVal; } -/* <11c190> ../cstrike/dlls/observer.cpp:36 */ int GetForceCamera(CBasePlayer *pObserver) { return g_ReGameHookchains.m_GetForceCamera.callChain(GetForceCamera_api, pObserver); @@ -32,7 +31,6 @@ CBasePlayer *Observer_IsValidTarget_api(CBasePlayer *pPlayer, CBasePlayer *pEnti return pEntity; } -/* <11c4fa> ../cstrike/dlls/observer.cpp:49 */ CBaseEntity *CBasePlayer::Observer_IsValidTarget(int iPlayerIndex, bool bSameTeam) { if (iPlayerIndex > gpGlobals->maxClients || iPlayerIndex < 1) @@ -42,7 +40,6 @@ CBaseEntity *CBasePlayer::Observer_IsValidTarget(int iPlayerIndex, bool bSameTea return g_ReGameHookchains.m_Observer_IsValidTarget.callChain(Observer_IsValidTarget_api, this, pEnt, iPlayerIndex, bSameTeam); } -/* <11c2c7> ../cstrike/dlls/observer.cpp:82 */ void UpdateClientEffects(CBasePlayer *pObserver, int oldMode) { bool clearProgress = false; @@ -67,7 +64,7 @@ void UpdateClientEffects(CBasePlayer *pObserver, int oldMode) if (pPlayer->m_progressEnd > gpGlobals->time) { float percentRemaining = gpGlobals->time - pPlayer->m_progressStart; - pObserver->SetProgressBarTime2((int)(pPlayer->m_progressEnd - pPlayer->m_progressStart), percentRemaining); + pObserver->SetProgressBarTime2(int(pPlayer->m_progressEnd - pPlayer->m_progressStart), percentRemaining); clearProgress = false; } } @@ -82,7 +79,7 @@ void UpdateClientEffects(CBasePlayer *pObserver, int oldMode) clearBlindness = false; fadeTime = pPlayer->m_blindFadeTime; - alpha = (float)pPlayer->m_blindAlpha; + alpha = float(pPlayer->m_blindAlpha); holdTime = pPlayer->m_blindHoldTime + pPlayer->m_blindStartTime - gpGlobals->time; if (holdTime <= 0) @@ -134,8 +131,6 @@ void UpdateClientEffects(CBasePlayer *pObserver, int oldMode) } // Find the next client in the game for this player to spectate - -/* <11c7e4> ../cstrike/dlls/observer.cpp:175 */ void CBasePlayer::Observer_FindNextPlayer(bool bReverse, const char *name) { int iStart; @@ -194,7 +189,7 @@ void CBasePlayer::Observer_FindNextPlayer(bool bReverse, const char *name) m_hObserverTarget->pev->health = 0.0f; MESSAGE_BEGIN(MSG_ONE, gmsgSpecHealth2, NULL, pev); - WRITE_BYTE((int)m_hObserverTarget->pev->health); + WRITE_BYTE(int(m_hObserverTarget->pev->health)); WRITE_BYTE(ENTINDEX(m_hObserverTarget->edict())); MESSAGE_END(); @@ -207,8 +202,6 @@ void CBasePlayer::Observer_FindNextPlayer(bool bReverse, const char *name) } // Handle buttons in observer mode - -/* <11c9ac> ../cstrike/dlls/observer.cpp:254 */ void CBasePlayer::Observer_HandleButtons() { // Slow down mouse clicks @@ -258,7 +251,6 @@ void CBasePlayer::Observer_HandleButtons() } } -/* <11c9d3> ../cstrike/dlls/observer.cpp:304 */ void CBasePlayer::Observer_CheckTarget() { if (pev->iuser1 == OBS_ROAMING && !m_bWasFollowing) @@ -313,7 +305,6 @@ void CBasePlayer::Observer_CheckTarget() } } -/* <11cb26> ../cstrike/dlls/observer.cpp:380 */ void CBasePlayer::Observer_CheckProperties() { // try to find a traget if we have no current one @@ -439,8 +430,6 @@ void CBasePlayer::Observer_CheckProperties() } // Attempt to change the observer mode - -/* <11c6db> ../cstrike/dlls/observer.cpp:506 */ void CBasePlayer::Observer_SetMode(int iMode) { int _forcecamera; diff --git a/regamedll/dlls/pathcorner.cpp b/regamedll/dlls/pathcorner.cpp index 0a16d761..0a932732 100644 --- a/regamedll/dlls/pathcorner.cpp +++ b/regamedll/dlls/pathcorner.cpp @@ -19,15 +19,11 @@ TYPEDESCRIPTION CPathTrack::m_SaveData[] = DEFINE_FIELD(CPathTrack, m_altName, FIELD_STRING), }; -#endif // HOOK_GAMEDLL +#endif -/* <122843> ../cstrike/dlls/pathcorner.cpp:41 */ LINK_ENTITY_TO_CLASS(path_corner, CPathCorner); - -/* <1225b6> ../cstrike/dlls/pathcorner.cpp:49 */ IMPLEMENT_SAVERESTORE(CPathCorner, CPointEntity); -/* <122697> ../cstrike/dlls/pathcorner.cpp:54 */ void CPathCorner::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "wait")) @@ -39,19 +35,14 @@ void CPathCorner::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <122325> ../cstrike/dlls/pathcorner.cpp:66 */ void CPathCorner::__MAKE_VHOOK(Spawn)() { assert(("path_corner without a targetname", !FStringNull(pev->targetname))); } -/* <12256a> ../cstrike/dlls/pathcorner.cpp:80 */ IMPLEMENT_SAVERESTORE(CPathTrack, CBaseEntity); - -/* <12290d> ../cstrike/dlls/pathcorner.cpp:81 */ LINK_ENTITY_TO_CLASS(path_track, CPathTrack); -/* <122602> ../cstrike/dlls/pathcorner.cpp:86 */ void CPathTrack::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "altpath")) @@ -63,7 +54,6 @@ void CPathTrack::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <122433> ../cstrike/dlls/pathcorner.cpp:97 */ void CPathTrack::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int on; @@ -95,7 +85,6 @@ void CPathTrack::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller } } -/* <122a12> ../cstrike/dlls/pathcorner.cpp:128 */ void CPathTrack::Link() { edict_t *pentTarget; @@ -134,7 +123,6 @@ void CPathTrack::Link() } } -/* <12239a> ../cstrike/dlls/pathcorner.cpp:165 */ void CPathTrack::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_TRIGGER; @@ -144,7 +132,6 @@ void CPathTrack::__MAKE_VHOOK(Spawn)() m_pprevious = NULL; } -/* <122c76> ../cstrike/dlls/pathcorner.cpp:180 */ void CPathTrack::__MAKE_VHOOK(Activate)() { // Link to next, and back-link @@ -154,7 +141,6 @@ void CPathTrack::__MAKE_VHOOK(Activate)() } } -/* <122c9c> ../cstrike/dlls/pathcorner.cpp:186 */ CPathTrack *CPathTrack::ValidPath(CPathTrack *ppath, int testFlag) { if (!ppath) @@ -166,7 +152,6 @@ CPathTrack *CPathTrack::ValidPath(CPathTrack *ppath, int testFlag) return ppath; } -/* <122745> ../cstrike/dlls/pathcorner.cpp:198 */ void CPathTrack::Project(CPathTrack *pstart, CPathTrack *pend, Vector *origin, float dist) { if (pstart && pend) @@ -178,10 +163,9 @@ void CPathTrack::Project(CPathTrack *pstart, CPathTrack *pend, Vector *origin, f } } -/* <122d0f> ../cstrike/dlls/pathcorner.cpp:208 */ CPathTrack *CPathTrack::GetNext() { - if (m_paltpath && (pev->spawnflags & SF_PATH_ALTERNATE) && !(pev->spawnflags & SF_PATH_ALTREVERSE)) + if (m_paltpath != NULL && (pev->spawnflags & SF_PATH_ALTERNATE) && !(pev->spawnflags & SF_PATH_ALTREVERSE)) { return m_paltpath; } @@ -189,10 +173,9 @@ CPathTrack *CPathTrack::GetNext() return m_pnext; } -/* <122d30> ../cstrike/dlls/pathcorner.cpp:218 */ CPathTrack *CPathTrack::GetPrevious() { - if (m_paltpath && (pev->spawnflags & SF_PATH_ALTERNATE) && (pev->spawnflags & SF_PATH_ALTREVERSE)) + if (m_paltpath != NULL && (pev->spawnflags & SF_PATH_ALTERNATE) && (pev->spawnflags & SF_PATH_ALTREVERSE)) { return m_paltpath; } @@ -200,19 +183,16 @@ CPathTrack *CPathTrack::GetPrevious() return m_pprevious; } -/* <122d51> ../cstrike/dlls/pathcorner.cpp:228 */ void CPathTrack::SetPrevious(CPathTrack *pprev) { // Only set previous if this isn't my alternate path - if (pprev && !FStrEq(STRING(pprev->pev->targetname), STRING(m_altName))) + if (pprev != NULL && !FStrEq(STRING(pprev->pev->targetname), STRING(m_altName))) { m_pprevious = pprev; } } // Assumes this is ALWAYS enabled - -/* <122d95> ../cstrike/dlls/pathcorner.cpp:237 */ CPathTrack *CPathTrack::LookAhead(Vector *origin, float dist, int move) { CPathTrack *pcurrent; @@ -248,7 +228,7 @@ CPathTrack *CPathTrack::LookAhead(Vector *origin, float dist, int move) // enough left in this path to move else if (length > dist) { - *origin = currentPos + (dir * ((float)(dist / length))); + *origin = currentPos + (dir * float(dist / length)); return pcurrent; } else @@ -301,7 +281,7 @@ CPathTrack *CPathTrack::LookAhead(Vector *origin, float dist, int move) // enough left in this path to move if (length > dist) { - *origin = currentPos + (dir * ((float)(dist / length))); + *origin = currentPos + (dir * float(dist / length)); return pcurrent; } else @@ -321,8 +301,6 @@ CPathTrack *CPathTrack::LookAhead(Vector *origin, float dist, int move) } // Assumes this is ALWAYS enabled - -/* <123220> ../cstrike/dlls/pathcorner.cpp:320 */ CPathTrack *CPathTrack::Nearest(Vector origin) { int deadCount; @@ -362,7 +340,6 @@ CPathTrack *CPathTrack::Nearest(Vector origin) return pnearest; } -/* <123375> ../cstrike/dlls/pathcorner.cpp:358 */ CPathTrack *CPathTrack::Instance(edict_t *pent) { if (FClassnameIs(pent, "path_track")) diff --git a/regamedll/dlls/pathcorner.h b/regamedll/dlls/pathcorner.h index 9f8232c0..cfcbd893 100644 --- a/regamedll/dlls/pathcorner.h +++ b/regamedll/dlls/pathcorner.h @@ -32,7 +32,6 @@ #pragma once #endif -/* <121944> ../cstrike/dlls/pathcorner.cpp:25 */ class CPathCorner: public CPointEntity { public: @@ -48,7 +47,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif float GetDelay() const { return m_flWait; } diff --git a/regamedll/dlls/plane.cpp b/regamedll/dlls/plane.cpp index e9ec1174..88eb5c9f 100644 --- a/regamedll/dlls/plane.cpp +++ b/regamedll/dlls/plane.cpp @@ -1,12 +1,10 @@ #include "precompiled.h" -/* <1262b3> ../cstrike/dlls/plane.cpp:24 */ CPlane::CPlane() { m_fInitialized = FALSE; } -/* <1262d4> ../cstrike/dlls/plane.cpp:33 */ NOXREF void CPlane::InitializePlane(const Vector &vecNormal, const Vector &vecPoint) { m_vecNormal = vecNormal; @@ -14,7 +12,6 @@ NOXREF void CPlane::InitializePlane(const Vector &vecNormal, const Vector &vecPo m_flDist = DotProduct(m_vecNormal, vecPoint); } -/* <126343> ../cstrike/dlls/plane.cpp:45 */ NOXREF BOOL CPlane::PointInFront(const Vector &vecPoint) { if (!m_fInitialized) diff --git a/regamedll/dlls/plane.h b/regamedll/dlls/plane.h index d158ae07..52a410ba 100644 --- a/regamedll/dlls/plane.h +++ b/regamedll/dlls/plane.h @@ -32,14 +32,13 @@ #pragma once #endif -/* <1262b3> ../cstrike/dlls/plane.cpp:24 */ class CPlane { public: CPlane(); - NOXREF void InitializePlane(const Vector &vecNormal, const Vector &vecPoint); - NOXREF BOOL PointInFront(const Vector &vecPoint); + void InitializePlane(const Vector &vecNormal, const Vector &vecPoint); + BOOL PointInFront(const Vector &vecPoint); private: Vector m_vecNormal; diff --git a/regamedll/dlls/plats.cpp b/regamedll/dlls/plats.cpp index ff2c58cd..0d0d5cc8 100644 --- a/regamedll/dlls/plats.cpp +++ b/regamedll/dlls/plats.cpp @@ -61,10 +61,8 @@ TYPEDESCRIPTION CGunTarget::m_SaveData[] = #endif // HOOK_GAMEDLL -/* <12e11a> ../cstrike/dlls/plats.cpp:59 */ IMPLEMENT_SAVERESTORE(CBasePlatTrain, CBaseToggle); -/* <12ea9b> ../cstrike/dlls/plats.cpp:61 */ void CBasePlatTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "lip")) @@ -89,12 +87,12 @@ void CBasePlatTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } else if (FStrEq(pkvd->szKeyName, "movesnd")) { - m_bMoveSnd = (BYTE)Q_atof(pkvd->szValue); + m_bMoveSnd = byte(Q_atof(pkvd->szValue)); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "stopsnd")) { - m_bStopSnd = (BYTE)Q_atof(pkvd->szValue); + m_bStopSnd = byte(Q_atof(pkvd->szValue)); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "volume")) @@ -109,7 +107,6 @@ void CBasePlatTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) #define noiseMoving noise #define noiseArrived noise1 -/* <12d675> ../cstrike/dlls/plats.cpp:105 */ void CBasePlatTrain::__MAKE_VHOOK(Precache)() { // set the plat's "in-motion" sound @@ -220,25 +217,21 @@ void CBasePlatTrain::__MAKE_VHOOK(Precache)() } } -/* <12d69c> ../cstrike/dlls/plats.cpp:235 */ void CFuncPlat::CallGoDown() { GoDown(); } -/* <12d6c2> ../cstrike/dlls/plats.cpp:236 */ void CFuncPlat::CallHitTop() { HitTop(); } -/* <12d6e8> ../cstrike/dlls/plats.cpp:237 */ void CFuncPlat::CallHitBottom() { HitBottom(); } -/* <130666> ../cstrike/dlls/plats.cpp:244 */ LINK_ENTITY_TO_CLASS(func_plat, CFuncPlat); #define noiseMovement noise @@ -258,8 +251,6 @@ LINK_ENTITY_TO_CLASS(func_plat, CFuncPlat); // Set "sounds" to one of the following: // 1) base fast // 2) chain slow - -/* <130730> ../cstrike/dlls/plats.cpp:275 */ void CFuncPlat::Setup() { if (m_flTLength == 0) @@ -290,18 +281,17 @@ void CFuncPlat::Setup() m_vecPosition2.z = pev->origin.z - pev->size.z + 8; } - if (pev->speed == 0) + if (pev->speed == 0.0f) { - pev->speed = 150; + pev->speed = 150.0f; } - if (m_volume == 0) + if (m_volume == 0.0f) { - m_volume = 0.85; + m_volume = 0.85f; } } -/* <13088e> ../cstrike/dlls/plats.cpp:309 */ void CFuncPlat::__MAKE_VHOOK(Precache)() { CBasePlatTrain::Precache(); @@ -313,7 +303,6 @@ void CFuncPlat::__MAKE_VHOOK(Precache)() } } -/* <130757> ../cstrike/dlls/plats.cpp:319 */ void CFuncPlat::__MAKE_VHOOK(Spawn)() { Setup(); @@ -334,15 +323,12 @@ void CFuncPlat::__MAKE_VHOOK(Spawn)() } } -/* <12c8bb> ../cstrike/dlls/plats.cpp:342 */ void PlatSpawnInsideTrigger(entvars_t *pevPlatform) { GetClassPtr((CPlatTrigger *)NULL)->SpawnInsideTrigger(GetClassPtr((CFuncPlat *)pevPlatform)); } // Create a trigger entity for a platform. - -/* <130792> ../cstrike/dlls/plats.cpp:351 */ void CPlatTrigger::SpawnInsideTrigger(CFuncPlat *pPlatform) { m_pPlatform = pPlatform; @@ -373,7 +359,6 @@ void CPlatTrigger::SpawnInsideTrigger(CFuncPlat *pPlatform) UTIL_SetSize(pev, vecTMin, vecTMax); } -/* <12e7e7> ../cstrike/dlls/plats.cpp:380 */ void CPlatTrigger::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { // Ignore touches by non-players @@ -396,14 +381,12 @@ void CPlatTrigger::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) else if (m_pPlatform->m_toggle_state == TS_AT_TOP) { // delay going down - m_pPlatform->pev->nextthink = m_pPlatform->pev->ltime + 1; + m_pPlatform->pev->nextthink = m_pPlatform->pev->ltime + 1.0f; } } // Used by SUB_UseTargets, when a platform is the target of a button. // Start bringing platform down. - -/* <12df02> ../cstrike/dlls/plats.cpp:403 */ void CFuncPlat::PlatUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (IsTogglePlat()) @@ -435,8 +418,6 @@ void CFuncPlat::PlatUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE } // Platform is at top, now starts moving down. - -/* <12e49b> ../cstrike/dlls/plats.cpp:431 */ void CFuncPlat::__MAKE_VHOOK(GoDown)() { if (pev->noiseMovement) @@ -452,8 +433,6 @@ void CFuncPlat::__MAKE_VHOOK(GoDown)() } // Platform has hit bottom. Stops and waits forever. - -/* <12f381> ../cstrike/dlls/plats.cpp:446 */ void CFuncPlat::__MAKE_VHOOK(HitBottom)() { if (pev->noiseMovement) @@ -472,8 +451,6 @@ void CFuncPlat::__MAKE_VHOOK(HitBottom)() } // Platform is at bottom, now starts moving up - -/* <12e52d> ../cstrike/dlls/plats.cpp:462 */ void CFuncPlat::__MAKE_VHOOK(GoUp)() { if (pev->noiseMovement) @@ -489,8 +466,6 @@ void CFuncPlat::__MAKE_VHOOK(GoUp)() } // Platform has hit top. Pauses, then starts back down again. - -/* <12f452> ../cstrike/dlls/plats.cpp:477 */ void CFuncPlat::__MAKE_VHOOK(HitTop)() { if (pev->noiseMovement) @@ -511,11 +486,10 @@ void CFuncPlat::__MAKE_VHOOK(HitTop)() { // After a delay, the platform will automatically start going down again. SetThink(&CFuncPlat::CallGoDown); - pev->nextthink = pev->ltime + 3; + pev->nextthink = pev->ltime + 3.0f; } } -/* <12f524> ../cstrike/dlls/plats.cpp:497 */ void CFuncPlat::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { ALERT(at_aiconsole, "%s Blocked by %s\n", STRING(pev->classname), STRING(pOther->pev->classname)); @@ -541,13 +515,9 @@ void CFuncPlat::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) } } -/* <130a7b> ../cstrike/dlls/plats.cpp:533 */ LINK_ENTITY_TO_CLASS(func_platrot, CFuncPlatRot); - -/* <12f1ce> ../cstrike/dlls/plats.cpp:540 */ IMPLEMENT_SAVERESTORE(CFuncPlatRot, CFuncPlat); -/* <130b48> ../cstrike/dlls/plats.cpp:543 */ void CFuncPlatRot::SetupRotation() { // This plat rotates too! @@ -570,14 +540,12 @@ void CFuncPlatRot::SetupRotation() } } -/* <130bc4> ../cstrike/dlls/plats.cpp:563 */ void CFuncPlatRot::__MAKE_VHOOK(Spawn)() { CFuncPlat::Spawn(); SetupRotation(); } -/* <12fe63> ../cstrike/dlls/plats.cpp:569 */ void CFuncPlatRot::__MAKE_VHOOK(GoDown)() { CFuncPlat::GoDown(); @@ -585,8 +553,6 @@ void CFuncPlatRot::__MAKE_VHOOK(GoDown)() } // Platform has hit bottom. Stops and waits forever. - -/* <12f430> ../cstrike/dlls/plats.cpp:579 */ void CFuncPlatRot::__MAKE_VHOOK(HitBottom)() { CFuncPlat::HitBottom(); @@ -595,8 +561,6 @@ void CFuncPlatRot::__MAKE_VHOOK(HitBottom)() } // Platform is at bottom, now starts moving up - -/* <12fdad> ../cstrike/dlls/plats.cpp:590 */ void CFuncPlatRot::__MAKE_VHOOK(GoUp)() { CFuncPlat::GoUp(); @@ -604,8 +568,6 @@ void CFuncPlatRot::__MAKE_VHOOK(GoUp)() } // Platform has hit top. Pauses, then starts back down again. - -/* <12f502> ../cstrike/dlls/plats.cpp:600 */ void CFuncPlatRot::__MAKE_VHOOK(HitTop)() { CFuncPlat::HitTop(); @@ -613,31 +575,26 @@ void CFuncPlatRot::__MAKE_VHOOK(HitTop)() pev->angles = m_end; } -/* <130c54> ../cstrike/dlls/plats.cpp:608 */ void CFuncPlatRot::RotMove(Vector &destAngle, float time) { // set destdelta to the vector needed to move Vector vecDestDelta = destAngle - pev->angles; // Travel time is so short, we're practically there already; so make it so. - if (time >= 0.1) + if (time >= 0.1f) { pev->avelocity = vecDestDelta / time; } else { pev->avelocity = vecDestDelta; - pev->nextthink = pev->ltime + 1; + pev->nextthink = pev->ltime + 1.0f; } } -/* <130ce8> ../cstrike/dlls/plats.cpp:657 */ LINK_ENTITY_TO_CLASS(func_train, CFuncTrain); - -/* <12f13d> ../cstrike/dlls/plats.cpp:665 */ IMPLEMENT_SAVERESTORE(CFuncTrain, CBasePlatTrain); -/* <130390> ../cstrike/dlls/plats.cpp:668 */ void CFuncTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "sounds")) @@ -649,18 +606,16 @@ void CFuncTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBasePlatTrain::KeyValue(pkvd); } -/* <12de63> ../cstrike/dlls/plats.cpp:679 */ void CFuncTrain::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { if (gpGlobals->time < m_flActivateFinished) return; - m_flActivateFinished = gpGlobals->time + 0.5; + m_flActivateFinished = gpGlobals->time + 0.5f; pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH); } -/* <12fa23> ../cstrike/dlls/plats.cpp:691 */ void CFuncTrain::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (pev->spawnflags & SF_TRAIN_WAIT_RETRIGGER) @@ -687,7 +642,6 @@ void CFuncTrain::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller } } -/* <12f914> ../cstrike/dlls/plats.cpp:713 */ void CFuncTrain::Wait() { if (m_pevCurrentTarget != NULL) @@ -744,8 +698,6 @@ void CFuncTrain::Wait() } // Train next - path corner needs to change to next target - -/* <12f6a8> ../cstrike/dlls/plats.cpp:760 */ void CFuncTrain::Next() { CBaseEntity *pTarg; @@ -819,7 +771,6 @@ void CFuncTrain::Next() } } -/* <12e1fd> ../cstrike/dlls/plats.cpp:818 */ void CFuncTrain::__MAKE_VHOOK(Activate)() { // Not yet active, so teleport to first target @@ -838,7 +789,7 @@ void CFuncTrain::__MAKE_VHOOK(Activate)() if (FStringNull(pev->targetname)) { // not triggered, so start immediately - pev->nextthink = pev->ltime + 0.1; + pev->nextthink = pev->ltime + 0.1f; SetThink(&CFuncTrain::Next); } else @@ -855,8 +806,6 @@ void CFuncTrain::__MAKE_VHOOK(Activate)() // dmg default 2 // sounds // 1) ratchet metal - -/* <12dcad> ../cstrike/dlls/plats.cpp:852 */ void CFuncTrain::__MAKE_VHOOK(Spawn)() { Precache(); @@ -888,11 +837,10 @@ void CFuncTrain::__MAKE_VHOOK(Spawn)() m_activated = FALSE; - if (m_volume == 0) - m_volume = 0.85; + if (m_volume == 0.0f) + m_volume = 0.85f; } -/* <12dab7> ../cstrike/dlls/plats.cpp:886 */ void CFuncTrain::__MAKE_VHOOK(Restart)() { if (pev->speed == 0) @@ -908,17 +856,15 @@ void CFuncTrain::__MAKE_VHOOK(Restart)() m_activated = FALSE; - if (m_volume == 0) - m_volume = 0.85; + if (m_volume == 0.0f) + m_volume = 0.85f; } -/* <12d734> ../cstrike/dlls/plats.cpp:907 */ void CFuncTrain::__MAKE_VHOOK(Precache)() { CBasePlatTrain::Precache(); } -/* <12e166> ../cstrike/dlls/plats.cpp:913 */ void CFuncTrain::__MAKE_VHOOK(OverrideReset)() { CBaseEntity *pTarg; @@ -939,18 +885,14 @@ void CFuncTrain::__MAKE_VHOOK(OverrideReset)() else // Keep moving for 0.1 secs, then find path_corner again and restart { SetThink(&CFuncTrain::Next); - pev->nextthink = pev->ltime + 0.1; + pev->nextthink = pev->ltime + 0.1f; } } } -/* <12e0cd> ../cstrike/dlls/plats.cpp:961 */ IMPLEMENT_SAVERESTORE(CFuncTrackTrain, CBaseEntity); - -/* <130db5> ../cstrike/dlls/plats.cpp:962 */ LINK_ENTITY_TO_CLASS(func_tracktrain, CFuncTrackTrain); -/* <12e88e> ../cstrike/dlls/plats.cpp:964 */ void CFuncTrackTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "wheels")) @@ -975,8 +917,10 @@ void CFuncTrackTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } else if (FStrEq(pkvd->szKeyName, "volume")) { - m_flVolume = (float)Q_atoi(pkvd->szValue); - m_flVolume *= 0.1; + // rounding values to integer + m_flVolume = Q_atoi(pkvd->szValue); + m_flVolume *= 0.1f; + pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "bank")) @@ -988,7 +932,6 @@ void CFuncTrackTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <130e82> ../cstrike/dlls/plats.cpp:1002 */ void CFuncTrackTrain::NextThink(float thinkTime, BOOL alwaysThink) { if (alwaysThink) @@ -999,7 +942,6 @@ void CFuncTrackTrain::NextThink(float thinkTime, BOOL alwaysThink) pev->nextthink = thinkTime; } -/* <12ee6d> ../cstrike/dlls/plats.cpp:1013 */ void CFuncTrackTrain::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { entvars_t *pevOther = pOther->pev; @@ -1007,7 +949,7 @@ void CFuncTrackTrain::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) // Blocker is on-ground on the train if ((pevOther->flags & FL_ONGROUND) && VARS(pevOther->groundentity) == pev) { - float_precision deltaSpeed = fabs((float_precision)pev->speed); + float_precision deltaSpeed = Q_fabs(float_precision(pev->speed)); if (deltaSpeed > 50) { @@ -1037,7 +979,6 @@ void CFuncTrackTrain::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) #endif } -/* <1312c7> ../cstrike/dlls/plats.cpp:1038 */ void CFuncTrackTrain::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (useType != USE_SET) @@ -1061,7 +1002,7 @@ void CFuncTrackTrain::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC } else { - float_precision delta = ((int)(pev->speed * 4) / (int)m_speed) * 0.25 + 0.25 * value; + float_precision delta = (int(pev->speed * 4.0f) / int(m_speed)) * 0.25 + 0.25 * value; if (delta > 1) delta = 1; @@ -1081,7 +1022,6 @@ void CFuncTrackTrain::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pC } } -/* <12bc89> ../cstrike/dlls/plats.cpp:1082 */ float_precision Fix(float_precision v) { float_precision angle = v; @@ -1095,7 +1035,6 @@ float_precision Fix(float_precision v) return angle; } -/* <130f04> ../cstrike/dlls/plats.cpp:1093 */ void FixupAngles(Vector &v) { v.x = Fix(v.x); @@ -1103,7 +1042,6 @@ void FixupAngles(Vector &v) v.z = Fix(v.z); } -/* <130eb3> ../cstrike/dlls/plats.cpp:1104 */ void CFuncTrackTrain::StopSound() { // if sound playing, stop it @@ -1121,7 +1059,6 @@ void CFuncTrackTrain::StopSound() m_soundPlaying = 0; } -/* <12e31d> ../cstrike/dlls/plats.cpp:1130 */ void CFuncTrackTrain::UpdateSound() { float flpitch; @@ -1129,19 +1066,19 @@ void CFuncTrackTrain::UpdateSound() if (!pev->noise) return; - flpitch = TRAIN_STARTPITCH + (abs(pev->speed) * (TRAIN_MAXPITCH - TRAIN_STARTPITCH) / TRAIN_MAXSPEED); + flpitch = TRAIN_STARTPITCH + (Q_abs(pev->speed) * (TRAIN_MAXPITCH - TRAIN_STARTPITCH) / TRAIN_MAXSPEED); if (!m_soundPlaying) { // play startup sound for train EMIT_SOUND_DYN(ENT(pev), CHAN_ITEM, "plats/ttrain_start1.wav", m_flVolume, ATTN_NORM, 0, 100); - EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noise), m_flVolume, ATTN_NORM, 0, (int)flpitch); + EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noise), m_flVolume, ATTN_NORM, 0, int(flpitch)); m_soundPlaying = 1; } else { // update pitch - // EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noise), m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, (int)flpitch); + // EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noise), m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, int(flpitch)); // volume 0.0 - 1.0 - 6 bits // m_sounds 3 bits @@ -1159,10 +1096,9 @@ void CFuncTrackTrain::UpdateSound() } } -/* <130f1c> ../cstrike/dlls/plats.cpp:1171 */ void CFuncTrackTrain::Next() { - float time = 0.5; + float time = 0.5f; if (!pev->speed) { @@ -1190,10 +1126,10 @@ void CFuncTrackTrain::Next() pev->velocity = (nextPos - pev->origin) * 10; #else // TODO: fix test demo - pev->velocity.x = ((float_precision)(nextPos.x - pev->origin.x) * 10.0f); - pev->velocity.y = ((float_precision)(nextPos.y - pev->origin.y) * 10.0f); + pev->velocity.x = (float_precision(nextPos.x - pev->origin.x) * 10.0f); + pev->velocity.y = (float_precision(nextPos.y - pev->origin.y) * 10.0f); pev->velocity.z = ((nextPos.z - pev->origin.z) * 10.0f); -#endif // PLAY_GAMEDLL +#endif Vector nextFront = pev->origin; nextFront.z -= m_height; @@ -1223,7 +1159,7 @@ void CFuncTrackTrain::Next() angles.z = Fix(angles.z); FixupAngles(pev->angles); -#endif // PLAY_GAMEDLL +#endif if (!pnext || (delta.x == 0 && delta.y == 0)) angles = pev->angles; @@ -1326,7 +1262,6 @@ void CFuncTrackTrain::Next() } } -/* <12de16> ../cstrike/dlls/plats.cpp:1308 */ void CFuncTrackTrain::DeadEnd() { // Fire the dead-end target if there is one @@ -1360,7 +1295,7 @@ void CFuncTrackTrain::DeadEnd() { pNext = pTrack->ValidPath(pTrack->GetNext(), TRUE); - if (pNext) + if (pNext != NULL) { pTrack = pNext; } @@ -1385,7 +1320,6 @@ void CFuncTrackTrain::DeadEnd() ALERT(at_aiconsole, "\n"); } -/* <131370> ../cstrike/dlls/plats.cpp:1354 */ void CFuncTrackTrain::SetControls(entvars_t *pevControls) { Vector offset = pevControls->origin - pev->oldorigin; @@ -1394,7 +1328,6 @@ void CFuncTrackTrain::SetControls(entvars_t *pevControls) m_controlMaxs = pevControls->maxs + offset; } -/* <12dd23> ../cstrike/dlls/plats.cpp:1363 */ BOOL CFuncTrackTrain::__MAKE_VHOOK(OnControls)(entvars_t *pevTest) { Vector offset = pevTest->origin - pev->origin; @@ -1417,7 +1350,6 @@ BOOL CFuncTrackTrain::__MAKE_VHOOK(OnControls)(entvars_t *pevTest) return FALSE; } -/* <12e636> ../cstrike/dlls/plats.cpp:1385 */ void CFuncTrackTrain::Find() { m_ppath = CPathTrack::Instance(FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->target))); @@ -1454,14 +1386,13 @@ void CFuncTrackTrain::Find() } UTIL_SetOrigin(pev, nextPos); - NextThink(pev->ltime + 0.1, FALSE); + NextThink(pev->ltime + 0.1f, FALSE); SetThink(&CFuncTrackTrain::Next); pev->speed = m_startSpeed; UpdateSound(); } -/* <12ecdd> ../cstrike/dlls/plats.cpp:1422 */ void CFuncTrackTrain::NearestPath() { CBaseEntity *pTrack = NULL; @@ -1510,19 +1441,17 @@ void CFuncTrackTrain::NearestPath() if (pev->speed != 0) { - NextThink(pev->ltime + 0.1, FALSE); + NextThink(pev->ltime + 0.1f, FALSE); SetThink(&CFuncTrackTrain::Next); } } -/* <12d75a> ../cstrike/dlls/plats.cpp:1470 */ void CFuncTrackTrain::__MAKE_VHOOK(OverrideReset)() { - NextThink(pev->ltime + 0.1, FALSE); + NextThink(pev->ltime + 0.1f, FALSE); SetThink(&CFuncTrackTrain::NearestPath); } -/* <131434> ../cstrike/dlls/plats.cpp:1477 */ CFuncTrackTrain *CFuncTrackTrain::Instance(edict_t *pent) { if (FClassnameIs(pent, "func_tracktrain")) @@ -1533,7 +1462,6 @@ CFuncTrackTrain *CFuncTrackTrain::Instance(edict_t *pent) return NULL; } -/* <12dcd4> ../cstrike/dlls/plats.cpp:1495 */ void CFuncTrackTrain::__MAKE_VHOOK(Spawn)() { if (pev->speed == 0) @@ -1546,8 +1474,7 @@ void CFuncTrackTrain::__MAKE_VHOOK(Spawn)() pev->speed = 0; pev->velocity = g_vecZero; pev->avelocity = g_vecZero; - pev->impulse = (int)m_speed; - + pev->impulse = int(m_speed); m_dir = 1; if (FStringNull(pev->target)) @@ -1575,12 +1502,11 @@ void CFuncTrackTrain::__MAKE_VHOOK(Spawn)() // start trains on the next frame, to make sure their targets have had // a chance to spawn/activate - NextThink(pev->ltime + 0.1, FALSE); + NextThink(pev->ltime + 0.1f, FALSE); SetThink(&CFuncTrackTrain::Find); Precache(); } -/* <12dbdf> ../cstrike/dlls/plats.cpp:1539 */ void CFuncTrackTrain::__MAKE_VHOOK(Restart)() { ALERT(at_console, "M_speed = %f\n", m_speed); @@ -1588,7 +1514,7 @@ void CFuncTrackTrain::__MAKE_VHOOK(Restart)() pev->speed = 0; pev->velocity = g_vecZero; pev->avelocity = g_vecZero; - pev->impulse = (int)m_speed; + pev->impulse = int(m_speed); m_dir = 1; if (FStringNull(pev->target)) @@ -1597,15 +1523,14 @@ void CFuncTrackTrain::__MAKE_VHOOK(Restart)() } UTIL_SetOrigin(pev, pev->oldorigin); - NextThink(pev->ltime + 0.1, FALSE); + NextThink(pev->ltime + 0.1f, FALSE); SetThink(&CFuncTrackTrain::Find); } -/* <12d7a5> ../cstrike/dlls/plats.cpp:1562 */ void CFuncTrackTrain::__MAKE_VHOOK(Precache)() { - if (m_flVolume == 0.0) - m_flVolume = 1.0; + if (m_flVolume == 0.0f) + m_flVolume = 1.0f; switch (m_sounds) { @@ -1627,10 +1552,8 @@ void CFuncTrackTrain::__MAKE_VHOOK(Precache)() m_usAdjustPitch = PRECACHE_EVENT(1, "events/train.sc"); } -/* <1314d9> ../cstrike/dlls/plats.cpp:1595 */ LINK_ENTITY_TO_CLASS(func_traincontrols, CFuncTrainControls); -/* <12fb10> ../cstrike/dlls/plats.cpp:1598 */ void CFuncTrainControls::Find() { edict_t *pTarget = NULL; @@ -1652,7 +1575,6 @@ void CFuncTrainControls::Find() UTIL_Remove(this); } -/* <12dc86> ../cstrike/dlls/plats.cpp:1619 */ void CFuncTrainControls::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -1666,19 +1588,14 @@ void CFuncTrainControls::__MAKE_VHOOK(Spawn)() pev->nextthink = gpGlobals->time; } -/* <12d7f2> ../cstrike/dlls/plats.cpp:1673 */ BOOL CFuncTrackChange::__MAKE_VHOOK(IsTogglePlat)() { return TRUE; } -/* <1315a6> ../cstrike/dlls/plats.cpp:1698 */ LINK_ENTITY_TO_CLASS(func_trackchange, CFuncTrackChange); - -/* <12ef8f> ../cstrike/dlls/plats.cpp:1713 */ IMPLEMENT_SAVERESTORE(CFuncTrackChange, CFuncPlatRot); -/* <130c1d> ../cstrike/dlls/plats.cpp:1715 */ void CFuncTrackChange::__MAKE_VHOOK(Spawn)() { Setup(); @@ -1705,12 +1622,11 @@ void CFuncTrackChange::__MAKE_VHOOK(Spawn)() } EnableUse(); - pev->nextthink = pev->ltime + 2.0; + pev->nextthink = pev->ltime + 2.0f; SetThink(&CFuncTrackChange::Find); Precache(); } -/* <130a3b> ../cstrike/dlls/plats.cpp:1744 */ void CFuncTrackChange::__MAKE_VHOOK(Precache)() { // Can't trigger sound @@ -1720,8 +1636,6 @@ void CFuncTrackChange::__MAKE_VHOOK(Precache)() } // UNDONE: Filter touches before re-evaluating the train. - -/* <12d818> ../cstrike/dlls/plats.cpp:1753 */ void CFuncTrackChange::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { #if 0 @@ -1730,7 +1644,6 @@ void CFuncTrackChange::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) #endif } -/* <1304ca> ../cstrike/dlls/plats.cpp:1758 */ void CFuncTrackChange::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "train")) @@ -1755,14 +1668,12 @@ void CFuncTrackChange::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } } -/* <12d84d> ../cstrike/dlls/plats.cpp:1782 */ void CFuncTrackChange::__MAKE_VHOOK(OverrideReset)() { - pev->nextthink = pev->ltime + 1.0; + pev->nextthink = pev->ltime + 1.0f; SetThink(&CFuncTrackChange::Find); } -/* <12ff19> ../cstrike/dlls/plats.cpp:1788 */ void CFuncTrackChange::Find() { // Find track entities @@ -1789,7 +1700,7 @@ void CFuncTrackChange::Find() return; } - Vector center = (pev->absmin + pev->absmax) * 0.5; + Vector center = (pev->absmin + pev->absmax) * 0.5f; m_trackBottom = m_trackBottom->Nearest(center); m_trackTop = m_trackTop->Nearest(center); UpdateAutoTargets(m_toggle_state); @@ -1809,7 +1720,6 @@ void CFuncTrackChange::Find() ALERT(at_error, "Can't find top track for track change! %s\n", STRING(m_trackTopName)); } -/* <131673> ../cstrike/dlls/plats.cpp:1832 */ TRAIN_CODE CFuncTrackChange::EvaluateTrain(CPathTrack *pcurrent) { // Go ahead and work, we don't have anything to switch, so just be an elevator @@ -1839,7 +1749,6 @@ TRAIN_CODE CFuncTrackChange::EvaluateTrain(CPathTrack *pcurrent) } -/* <1317f9> ../cstrike/dlls/plats.cpp:1858 */ void CFuncTrackChange::UpdateTrain(Vector &dest) { float_precision time = (pev->nextthink - pev->ltime); @@ -1867,7 +1776,6 @@ void CFuncTrackChange::UpdateTrain(Vector &dest) m_train->pev->velocity = pev->velocity + (local * (1.0 / time)); } -/* <131ade> ../cstrike/dlls/plats.cpp:1883 */ void CFuncTrackChange::__MAKE_VHOOK(GoDown)() { if (m_code == TRAIN_BLOCKING) @@ -1901,8 +1809,6 @@ void CFuncTrackChange::__MAKE_VHOOK(GoDown)() } // Platform is at bottom, now starts moving up - -/* <1319f9> ../cstrike/dlls/plats.cpp:1919 */ void CFuncTrackChange::__MAKE_VHOOK(GoUp)() { if (m_code == TRAIN_BLOCKING) @@ -1937,8 +1843,6 @@ void CFuncTrackChange::__MAKE_VHOOK(GoUp)() } // Normal track change - -/* <12deb0> ../cstrike/dlls/plats.cpp:1954 */ void CFuncTrackChange::__MAKE_VHOOK(UpdateAutoTargets)(int toggleState) { if (!m_trackTop || !m_trackBottom) @@ -1955,7 +1859,6 @@ void CFuncTrackChange::__MAKE_VHOOK(UpdateAutoTargets)(int toggleState) m_trackBottom->pev->spawnflags |= SF_PATH_DISABLED; } -/* <131725> ../cstrike/dlls/plats.cpp:1971 */ void CFuncTrackChange::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (m_toggle_state != TS_AT_TOP && m_toggle_state != TS_AT_BOTTOM) @@ -1994,8 +1897,6 @@ void CFuncTrackChange::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *p } // Platform has hit bottom. Stops and waits forever. - -/* <12f618> ../cstrike/dlls/plats.cpp:2005 */ void CFuncTrackChange::__MAKE_VHOOK(HitBottom)() { CFuncPlatRot::HitBottom(); @@ -2012,8 +1913,6 @@ void CFuncTrackChange::__MAKE_VHOOK(HitBottom)() } // Platform has hit bottom. Stops and waits forever. - -/* <12f588> ../cstrike/dlls/plats.cpp:2025 */ void CFuncTrackChange::__MAKE_VHOOK(HitTop)() { CFuncPlatRot::HitTop(); @@ -2031,12 +1930,9 @@ void CFuncTrackChange::__MAKE_VHOOK(HitTop)() EnableUse(); } -/* <131bc3> ../cstrike/dlls/plats.cpp:2050 */ LINK_ENTITY_TO_CLASS(func_trackautochange, CFuncTrackAuto); // Auto track change - -/* <12dc2a> ../cstrike/dlls/plats.cpp:2053 */ void CFuncTrackAuto::__MAKE_VHOOK(UpdateAutoTargets)(int toggleState) { CPathTrack *pTarget, *pNextTarget; @@ -2071,7 +1967,6 @@ void CFuncTrackAuto::__MAKE_VHOOK(UpdateAutoTargets)(int toggleState) } } -/* <1301f9> ../cstrike/dlls/plats.cpp:2083 */ void CFuncTrackAuto::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { CPathTrack *pTarget; @@ -2126,13 +2021,9 @@ void CFuncTrackAuto::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCa } } -/* <131c90> ../cstrike/dlls/plats.cpp:2163 */ LINK_ENTITY_TO_CLASS(func_guntarget, CGunTarget); - -/* <12e080> ../cstrike/dlls/plats.cpp:2170 */ IMPLEMENT_SAVERESTORE(CGunTarget, CBaseMonster); -/* <12dbb8> ../cstrike/dlls/plats.cpp:2173 */ void CGunTarget::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_BSP; @@ -2156,11 +2047,10 @@ void CGunTarget::__MAKE_VHOOK(Spawn)() if (pev->spawnflags & FGUNTARGET_START_ON) { SetThink(&CGunTarget::Start); - pev->nextthink = pev->ltime + 0.3; + pev->nextthink = pev->ltime + 0.3f; } } -/* <12dade> ../cstrike/dlls/plats.cpp:2199 */ void CGunTarget::__MAKE_VHOOK(Activate)() { CBaseEntity *pTarg; @@ -2171,17 +2061,15 @@ void CGunTarget::__MAKE_VHOOK(Activate)() if (pTarg != NULL) { m_hTargetEnt = pTarg; - UTIL_SetOrigin(pev, pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5); + UTIL_SetOrigin(pev, pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5f); } } -/* <12d947> ../cstrike/dlls/plats.cpp:2213 */ void CGunTarget::Start() { Use(this, this, USE_ON, 0); } -/* <12d96e> ../cstrike/dlls/plats.cpp:2219 */ void CGunTarget::Next() { SetThink(NULL); @@ -2199,7 +2087,6 @@ void CGunTarget::Next() LinearMove(pTarget->pev->origin - (pev->mins + pev->maxs) * 0.5, pev->speed); } -/* <12da61> ../cstrike/dlls/plats.cpp:2236 */ void CGunTarget::Wait() { CBaseEntity *pTarget = m_hTargetEnt; @@ -2237,7 +2124,6 @@ void CGunTarget::Wait() } } -/* <131d5d> ../cstrike/dlls/plats.cpp:2269 */ void CGunTarget::Stop() { pev->velocity = g_vecZero; @@ -2245,7 +2131,6 @@ void CGunTarget::Stop() pev->takedamage = DAMAGE_NO; } -/* <12e371> ../cstrike/dlls/plats.cpp:2277 */ int CGunTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { if (pev->health > 0) @@ -2257,7 +2142,7 @@ int CGunTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev pev->health = 0; Stop(); - if (pev->message) + if (!FStringNull(pev->message)) { FireTargets(STRING(pev->message), this, this, USE_TOGGLE, 0); } @@ -2267,7 +2152,6 @@ int CGunTarget::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pev return 0; } -/* <12e408> ../cstrike/dlls/plats.cpp:2294 */ void CGunTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!ShouldToggle(useType, m_on)) diff --git a/regamedll/dlls/plats.h b/regamedll/dlls/plats.h index 3d8379dd..08dc479f 100644 --- a/regamedll/dlls/plats.h +++ b/regamedll/dlls/plats.h @@ -46,7 +46,6 @@ #define FGUNTARGET_START_ON 0x0001 -/* <12c817> ../cstrike/dlls/plats.cpp:33 */ class CBasePlatTrain: public CBaseToggle { public: @@ -66,7 +65,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[3]; @@ -76,7 +75,6 @@ public: float m_volume; }; -/* <12c853> ../cstrike/dlls/plats.cpp:223 */ class CFuncPlat: public CBasePlatTrain { public: @@ -98,7 +96,7 @@ public: void HitTop_(); void HitBottom_(); -#endif // HOOK_GAMEDLL +#endif public: void Setup(); @@ -108,7 +106,6 @@ public: void EXPORT CallHitBottom(); }; -/* <12c86e> ../cstrike/dlls/plats.cpp:248 */ class CPlatTrigger: public CBaseEntity { public: @@ -119,7 +116,7 @@ public: void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: void SpawnInsideTrigger(CFuncPlat *pPlatform); @@ -127,7 +124,6 @@ public: CFuncPlat *m_pPlatform; }; -/* <12c8ee> ../cstrike/dlls/plats.cpp:515 */ class CFuncPlatRot: public CFuncPlat { public: @@ -150,7 +146,7 @@ public: void HitTop_(); void HitBottom_(); -#endif // HOOK_GAMEDLL +#endif public: void SetupRotation(); @@ -163,7 +159,6 @@ public: Vector m_start; }; -/* <12c93c> ../cstrike/dlls/plats.cpp:628 */ class CFuncTrain: public CBasePlatTrain { public: @@ -191,7 +186,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Blocked_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Wait(); @@ -207,7 +202,6 @@ public: BOOL m_activated; }; -/* <12c9d7> ../cstrike/dlls/plats.cpp:1588 */ class CFuncTrainControls: public CBaseEntity { public: @@ -218,13 +212,12 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Find(); }; -/* <12ca2a> ../cstrike/dlls/plats.cpp:1654 */ class CFuncTrackChange: public CFuncPlatRot { public: @@ -262,7 +255,7 @@ public: void HitTop_(); void UpdateAutoTargets_(int toggleState); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Find(); @@ -290,7 +283,6 @@ public: int m_use; }; -/* <12ca78> ../cstrike/dlls/plats.cpp:2043 */ class CFuncTrackAuto: public CFuncTrackChange { public: @@ -302,18 +294,17 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void UpdateAutoTargets_(int toggleState); -#endif // HOOK_GAMEDLL +#endif }; -/* <12caec> ../cstrike/dlls/plats.cpp:2136 */ class CGunTarget: public CBaseMonster { public: virtual void Spawn(); virtual int Save(CSave &save); virtual int Restore(CRestore &restore); - virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);} + virtual int ObjectCaps() { return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); } virtual void Activate(); virtual int Classify() { return CLASS_MACHINE; } virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); @@ -330,7 +321,7 @@ public: int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Next(); @@ -346,7 +337,6 @@ private: }; void PlatSpawnInsideTrigger(entvars_t *pevPlatform); -//float Fix(float angle); void FixupAngles(Vector &v); #endif // PLATS_H diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 9a0afb4f..bb8b1334 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -188,9 +188,8 @@ char *CDeadHEV::m_szPoses[] = "deadtable" }; -#endif //HOOK_GAMEDLL +#endif // HOOK_GAMEDLL -//int giPrecacheGrunt; int gEvilImpulse101; char g_szMapBriefingText[512]; @@ -199,7 +198,6 @@ CBaseEntity *g_pLastSpawn; CBaseEntity *g_pLastCTSpawn; CBaseEntity *g_pLastTerroristSpawn; -/* <14e3fc> ../cstrike/dlls/player.cpp:5868 */ struct ZombieSpawn { CBaseEntity *entity; @@ -209,7 +207,6 @@ struct ZombieSpawn ZombieSpawn zombieSpawn[256]; int zombieSpawnCount; -/* <15353b> ../cstrike/dlls/player.cpp:282 */ void LinkUserMessages() { if (gmsgCurWeapon) @@ -297,7 +294,6 @@ void LinkUserMessages() gmsgHudTextArgs = REG_USER_MSG("HudTextArgs", -1); } -/* <1535a5> ../cstrike/dlls/player.cpp:380 */ void WriteSigonMessages() { for (int i = 0; i < MAX_WEAPONS; ++i) @@ -327,10 +323,8 @@ void WriteSigonMessages() } } -/* <15f281> ../cstrike/dlls/player.cpp:425 */ LINK_ENTITY_TO_CLASS(player, CBasePlayer); -/* <1536a9> ../cstrike/dlls/player.cpp:429 */ void SendItemStatus(CBasePlayer *pPlayer) { int itemStatus = 0; @@ -345,7 +339,6 @@ void SendItemStatus(CBasePlayer *pPlayer) MESSAGE_END(); } -/* <150ed5> ../cstrike/dlls/player.cpp:438 */ const char *GetCSModelName(int item_id) { const char *modelName = NULL; @@ -388,7 +381,6 @@ const char *GetCSModelName(int item_id) return modelName; } -/* <153737> ../cstrike/dlls/player.cpp:572 */ void CBasePlayer::SetPlayerModel(BOOL HasC4) { char *infobuffer = GET_INFO_BUFFER(edict()); @@ -474,22 +466,21 @@ void CBasePlayer::SetPlayerModel(BOOL HasC4) else model = "urban"; - if (Q_strcmp(GET_KEY_VALUE(infobuffer, "model"), model)) + if (Q_strcmp(GET_KEY_VALUE(infobuffer, "model"), model) != 0) { SET_CLIENT_KEY_VALUE(entindex(), infobuffer, "model", model); } } -/* <15f129> ../cstrike/dlls/player.cpp:659 */ CBasePlayer *CBasePlayer::GetNextRadioRecipient(CBasePlayer *pStartPlayer) { - CBaseEntity *pEntity = (CBaseEntity *)pStartPlayer; + CBaseEntity *pEntity = static_cast(pStartPlayer); while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL) { if (FNullEnt(pEntity->edict())) break; - BOOL bSend = FALSE; + bool bSend = false; CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pEntity->pev); if (pEntity->IsPlayer()) @@ -498,7 +489,7 @@ CBasePlayer *CBasePlayer::GetNextRadioRecipient(CBasePlayer *pStartPlayer) continue; if (pPlayer && pPlayer->m_iTeam == m_iTeam) - bSend = TRUE; + bSend = true; } else if (pPlayer) { @@ -512,9 +503,9 @@ CBasePlayer *CBasePlayer::GetNextRadioRecipient(CBasePlayer *pStartPlayer) CBasePlayer *pTarget = (CBasePlayer *)CBaseEntity::Instance(pPlayer->m_hObserverTarget->pev); - if (pTarget && pTarget->m_iTeam == m_iTeam) + if (pTarget != NULL && pTarget->m_iTeam == m_iTeam) { - bSend = TRUE; + bSend = true; } } @@ -527,7 +518,6 @@ CBasePlayer *CBasePlayer::GetNextRadioRecipient(CBasePlayer *pStartPlayer) return NULL; } -/* <15edd2> ../cstrike/dlls/player.cpp:705 */ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch, bool showIcon) { // Spectators don't say radio messages. @@ -544,7 +534,7 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch if (FNullEnt(pEntity->edict())) break; - BOOL bSend = FALSE; + bool bSend = false; CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pEntity->pev); if (pPlayer == NULL) @@ -558,7 +548,7 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch // is this player on our team? (even dead players hear our radio calls) if (pPlayer->m_iTeam == m_iTeam) - bSend = TRUE; + bSend = true; } // this means we're a spectator else @@ -572,11 +562,11 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch if (!FNullEnt(pPlayer->m_hObserverTarget)) continue; - CBasePlayer *pTarget = (CBasePlayer *)CBaseEntity::Instance(pPlayer->m_hObserverTarget->pev); + CBasePlayer *pTarget = static_cast(CBaseEntity::Instance(pPlayer->m_hObserverTarget->pev)); - if (pTarget && pTarget->m_iTeam == m_iTeam) + if (pTarget != NULL && pTarget->m_iTeam == m_iTeam) { - bSend = TRUE; + bSend = true; } } @@ -622,10 +612,10 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch // put an icon over this guys head to show that he used the radio MESSAGE_BEGIN(MSG_ONE, SVC_TEMPENTITY, NULL, pEntity->pev); WRITE_BYTE(TE_PLAYERATTACHMENT); - WRITE_BYTE(ENTINDEX(edict())); // byte (entity index of player) - WRITE_COORD(35); // coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset) - WRITE_SHORT(g_sModelIndexRadio); // short (model index) of tempent - WRITE_SHORT(15); // short (life * 10 ) e.g. 40 = 4 seconds + WRITE_BYTE(ENTINDEX(edict())); // byte (entity index of player) + WRITE_COORD(35); // coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset) + WRITE_SHORT(g_sModelIndexRadio); // short (model index) of tempent + WRITE_SHORT(15); // short (life * 10 ) e.g. 40 = 4 seconds MESSAGE_END(); } } @@ -633,18 +623,16 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch } } -/* <1537f3> ../cstrike/dlls/player.cpp:812 */ void CBasePlayer::SmartRadio() { ; } -/* <15381b> ../cstrike/dlls/player.cpp:816 */ -void CBasePlayer::Pain(int m_LastHitGroup, bool HasArmour) +void CBasePlayer::Pain(int iLastHitGroup, bool HasArmour) { int temp = RANDOM_LONG(0, 2); - if (m_LastHitGroup == HITGROUP_HEAD) + if (iLastHitGroup == HITGROUP_HEAD) { if (m_iKevlar == ARMOR_TYPE_HELMET) { @@ -661,7 +649,7 @@ void CBasePlayer::Pain(int m_LastHitGroup, bool HasArmour) } else { - if (m_LastHitGroup != HITGROUP_LEFTLEG && m_LastHitGroup != HITGROUP_RIGHTLEG) + if (iLastHitGroup != HITGROUP_LEFTLEG && iLastHitGroup != HITGROUP_RIGHTLEG) { if (HasArmour) { @@ -679,7 +667,6 @@ void CBasePlayer::Pain(int m_LastHitGroup, bool HasArmour) } } -/* <153b48> ../cstrike/dlls/player.cpp:864 */ Vector VecVelocityForDamage(float flDamage) { Vector vec(RANDOM_FLOAT(-100, 100), RANDOM_FLOAT(-100, 100), RANDOM_FLOAT(200, 300)); @@ -694,23 +681,22 @@ Vector VecVelocityForDamage(float flDamage) return vec; } -/* <14edfb> ../cstrike/dlls/player.cpp:878 */ int TrainSpeed(int iSpeed, int iMax) { float fMax; float fSpeed; int iRet = 0; - fMax = (float)iMax; + fMax = float(iMax); fSpeed = iSpeed / fMax; if (iSpeed < 0) iRet = TRAIN_BACK; else if (iSpeed == 0) iRet = TRAIN_NEUTRAL; - else if (fSpeed < 0.33) + else if (fSpeed < 0.33f) iRet = TRAIN_SLOW; - else if (fSpeed < 0.66) + else if (fSpeed < 0.66f) iRet = TRAIN_MEDIUM; else iRet = TRAIN_FAST; @@ -718,7 +704,6 @@ int TrainSpeed(int iSpeed, int iMax) return iRet; } -/* <153c8e> ../cstrike/dlls/player.cpp:902 */ void CBasePlayer::DeathSound() { // temporarily using pain sounds for death sounds @@ -733,20 +718,16 @@ void CBasePlayer::DeathSound() // override takehealth // bitsDamageType indicates type of damage healed. - -/* <151213> ../cstrike/dlls/player.cpp:937 */ int CBasePlayer::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType) { return CBaseMonster::TakeHealth(flHealth, bitsDamageType); } -/* <150f1c> ../cstrike/dlls/player.cpp:943 */ Vector CBasePlayer::__MAKE_VHOOK(GetGunPosition)() { return pev->origin + pev->view_ofs; } -/* <15412b> ../cstrike/dlls/player.cpp:953 */ bool CBasePlayer::IsHittingShield(Vector &vecDirection, TraceResult *ptr) { if ((m_pActiveItem != NULL && m_pActiveItem->m_iId == WEAPON_C4) || !HasShield()) @@ -761,7 +742,6 @@ bool CBasePlayer::IsHittingShield(Vector &vecDirection, TraceResult *ptr) return false; } -/* <152b58> ../cstrike/dlls/player.cpp:989 */ void CBasePlayer::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { bool bShouldBleed = true; @@ -911,7 +891,6 @@ void CBasePlayer::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDama AddMultiDamage(pevAttacker, this, flDamage, bitsDamageType); } -/* <1541c2> ../cstrike/dlls/player.cpp:1171 */ const char *GetWeaponName(entvars_t *pevInflictor, entvars_t *pKiller) { const char *killer_weapon_name = "world"; @@ -942,13 +921,12 @@ const char *GetWeaponName(entvars_t *pevInflictor, entvars_t *pKiller) else if (!Q_strncmp(killer_weapon_name, "monster_", 8)) killer_weapon_name += 8; - else if (Q_strncmp(killer_weapon_name, "func_", 5)) + else if (Q_strncmp(killer_weapon_name, "func_", 5) != 0) killer_weapon_name += 5; return killer_weapon_name; } -/* <14e061> ../cstrike/dlls/player.cpp:1214 */ void LogAttack(CBasePlayer *pAttacker, CBasePlayer *pVictim, int teamAttack, int healthHit, int armorHit, int newHealth, int newArmor, const char *killer_weapon_name) { int detail = logdetail.value; @@ -961,23 +939,10 @@ void LogAttack(CBasePlayer *pAttacker, CBasePlayer *pVictim, int teamAttack, int if ((teamAttack && (detail & LOG_TEAMMATEATTACK)) || (!teamAttack && (detail & LOG_ENEMYATTACK))) { - UTIL_LogPrintf - ( - "\"%s<%i><%s><%s>\" attacked \"%s<%i><%s><%s>\" with \"%s\" (damage \"%d\") (damage_armor \"%d\") (health \"%d\") (armor \"%d\")\n", - STRING(pAttacker->pev->netname), - GETPLAYERUSERID(pAttacker->edict()), - GETPLAYERAUTHID(pAttacker->edict()), - GetTeam(pAttacker->m_iTeam), - STRING(pVictim->pev->netname), - GETPLAYERUSERID(pVictim->edict()), - GETPLAYERAUTHID(pVictim->edict()), - GetTeam(pVictim->m_iTeam), - killer_weapon_name, - healthHit, - armorHit, - newHealth, - newArmor - ); + UTIL_LogPrintf("\"%s<%i><%s><%s>\" attacked \"%s<%i><%s><%s>\" with \"%s\" (damage \"%d\") (damage_armor \"%d\") (health \"%d\") (armor \"%d\")\n", + STRING(pAttacker->pev->netname), GETPLAYERUSERID(pAttacker->edict()), GETPLAYERAUTHID(pAttacker->edict()), GetTeam(pAttacker->m_iTeam), + STRING(pVictim->pev->netname), GETPLAYERUSERID(pVictim->edict()), GETPLAYERAUTHID(pVictim->edict()), + GetTeam(pVictim->m_iTeam), killer_weapon_name, healthHit, armorHit, newHealth, newArmor); } } @@ -985,8 +950,6 @@ void LogAttack(CBasePlayer *pAttacker, CBasePlayer *pVictim, int teamAttack, int // NOTE: each call to TakeDamage with bitsDamageType set to a time-based damage // type will cause the damage time countdown to be reset. Thus the ongoing effects of poison, radiation // etc are implemented with subsequent calls to TakeDamage using DMG_GENERIC. - -/* <15dff9> ../cstrike/dlls/player.cpp:1241 */ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) { int fTookDamage; @@ -994,7 +957,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe float flBonus = ARMOR_BONUS; int iGunType = 0; float flShieldRatio = 0; - int teamAttack = FALSE; + BOOL bTeamAttack = FALSE; int armorHit = 0; CBasePlayer *pAttack = NULL; CBaseEntity *pAttacker = NULL; @@ -1014,9 +977,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe if (bitsDamageType & (DMG_EXPLOSION | DMG_BLAST)) { if (!IsAlive()) - { return 0; - } if (bitsDamageType & DMG_EXPLOSION) { @@ -1028,12 +989,14 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe if (CVAR_GET_FLOAT("mp_friendlyfire")) { - if (pGrenade->m_iTeam == m_iTeam) - teamAttack = TRUE; #ifdef REGAMEDLL_ADD if (friendlyfire.string[0] == '2') - teamAttack = FALSE; -#endif // REGAMEDLL_ADD + bTeamAttack = FALSE; + else +#endif + if (pGrenade->m_iTeam == m_iTeam) + bTeamAttack = TRUE; + pAttack = dynamic_cast(CBasePlayer::Instance(pevAttacker)); } else if (pGrenade->m_iTeam == m_iTeam && (&edict()->v != pevAttacker)) @@ -1095,19 +1058,17 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe m_bKilledByGrenade = true; } - LogAttack(pAttack, this, teamAttack, (int)flDamage, armorHit, pev->health - flDamage, pev->armorvalue, GetWeaponName(pevInflictor, pevAttacker)); - fTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, (int)flDamage, bitsDamageType); + LogAttack(pAttack, this, bTeamAttack, int(flDamage), armorHit, pev->health - flDamage, pev->armorvalue, GetWeaponName(pevInflictor, pevAttacker)); + fTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, int(flDamage), bitsDamageType); if (fTookDamage > 0) { - CHalfLifeMultiplay *mp = g_pGameRules; - if (TheBots != NULL) { TheBots->OnEvent(EVENT_PLAYER_TOOK_DAMAGE, this, pAttack); } - if (mp->IsCareer()) + if (CSGameRules()->IsCareer()) { for (int i = 1; i <= gpGlobals->maxClients; ++i) { @@ -1149,7 +1110,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe MESSAGE_BEGIN(MSG_SPEC, gmsgHLTV); WRITE_BYTE(ENTINDEX(edict())); - WRITE_BYTE((int)Q_max(pev->health, 0.0f) | DRC_FLAG_FACEPLAYER); + WRITE_BYTE(int(Q_max(pev->health, 0.0f)) | DRC_FLAG_FACEPLAYER); MESSAGE_END(); for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -1160,7 +1121,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe continue; MESSAGE_BEGIN(MSG_ONE, gmsgSpecHealth, NULL, pPlayer->edict()); - WRITE_BYTE((int)Q_max(pev->health, 0.0f)); + WRITE_BYTE(int(Q_max(pev->health, 0.0f))); MESSAGE_END(); } @@ -1169,7 +1130,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe pAttacker = CBaseEntity::Instance(pevAttacker); - if (!g_pGameRules->FPlayerCanTakeDamage(this, pAttacker) && Q_strcmp("grenade", STRING(pevInflictor->classname))) + if (!g_pGameRules->FPlayerCanTakeDamage(this, pAttacker) && Q_strcmp("grenade", STRING(pevInflictor->classname)) != 0) { // Refuse the damage return 0; @@ -1195,7 +1156,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe #ifdef REGAMEDLL_ADD if (friendlyfire.string[0] == '2') bAttackFFA = true; -#endif // REGAMEDLL_ADD +#endif // warn about team attacks if (pAttack != this && pAttack->m_iTeam == m_iTeam && !bAttackFFA) @@ -1213,9 +1174,9 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe pAttack->m_flDisplayHistory |= DHF_FRIEND_INJURED; pAttack->HintMessage("#Hint_try_not_to_injure_teammates"); } -#endif // REGAMEDLL_FIXES +#endif - teamAttack = TRUE; + bTeamAttack = TRUE; if (gpGlobals->time > pAttack->m_flLastAttackedTeammate + 0.6f) { CBaseEntity *pBasePlayer = NULL; @@ -1250,22 +1211,22 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe switch (iGunType) { case WEAPON_AUG: - case WEAPON_M4A1: flRatio *= 1.4; break; + case WEAPON_M4A1: flRatio *= 1.4; break; case WEAPON_AWP: flRatio *= 1.95; break; case WEAPON_G3SG1: flRatio *= 1.65; break; case WEAPON_SG550: flRatio *= 1.45; break; - case WEAPON_M249: flRatio *= 1.5; break; + case WEAPON_M249: flRatio *= 1.5; break; case WEAPON_ELITE: flRatio *= 1.05; break; - case WEAPON_DEAGLE: flRatio *= 1.5; break; + case WEAPON_DEAGLE: flRatio *= 1.5; break; case WEAPON_GLOCK18: flRatio *= 1.05; break; case WEAPON_FIVESEVEN: - case WEAPON_P90: flRatio *= 1.5; break; + case WEAPON_P90: flRatio *= 1.5; break; case WEAPON_MAC10: flRatio *= 0.95; break; case WEAPON_P228: flRatio *= 1.25; break; case WEAPON_SCOUT: - case WEAPON_KNIFE: flRatio *= 1.7; break; + case WEAPON_KNIFE: flRatio *= 1.7; break; case WEAPON_FAMAS: - case WEAPON_SG552: flRatio *= 1.4; break; + case WEAPON_SG552: flRatio *= 1.4; break; case WEAPON_GALIL: case WEAPON_AK47: flRatio *= 1.55; break; } @@ -1335,22 +1296,20 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe else Pain(m_LastHitGroup, false); - LogAttack(pAttack, this, teamAttack, flDamage, armorHit, pev->health - flDamage, pev->armorvalue, GetWeaponName(pevInflictor, pevAttacker)); + LogAttack(pAttack, this, bTeamAttack, flDamage, armorHit, pev->health - flDamage, pev->armorvalue, GetWeaponName(pevInflictor, pevAttacker)); // this cast to INT is critical!!! If a player ends up with 0.5 health, the engine will get that // as an int (zero) and think the player is dead! (this will incite a clientside screentilt, etc) - fTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, (int)flDamage, bitsDamageType); + fTookDamage = CBaseMonster::TakeDamage(pevInflictor, pevAttacker, int(flDamage), bitsDamageType); if (fTookDamage > 0) { - CHalfLifeMultiplay *mp = g_pGameRules; - if (TheBots != NULL) { TheBots->OnEvent(EVENT_PLAYER_TOOK_DAMAGE, this, pAttack); } - if (mp->IsCareer()) + if (CSGameRules()->IsCareer()) { for (int i = 1; i <= gpGlobals->maxClients; ++i) { @@ -1392,7 +1351,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe MESSAGE_BEGIN(MSG_SPEC, gmsgHLTV); WRITE_BYTE(ENTINDEX(edict())); - WRITE_BYTE((int)Q_max(pev->health, 0.0f) | DRC_FLAG_FACEPLAYER); + WRITE_BYTE(int(Q_max(pev->health, 0.0f)) | DRC_FLAG_FACEPLAYER); MESSAGE_END(); for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -1405,7 +1364,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe if (pPlayer->m_hObserverTarget == this) { MESSAGE_BEGIN(MSG_ONE, gmsgSpecHealth, NULL, pPlayer->edict()); - WRITE_BYTE((int)Q_max(pev->health, 0.0f)); + WRITE_BYTE(int(Q_max(pev->health, 0.0f))); MESSAGE_END(); } } @@ -1419,7 +1378,6 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe return fTookDamage; } -/* <1516a0> ../cstrike/dlls/player.cpp:1706 */ void packPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) { if (pItem == NULL) @@ -1436,7 +1394,7 @@ void packPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) pWeaponBox->pev->velocity = pPlayer->pev->velocity * 0.75; pWeaponBox->SetThink(&CWeaponBox::Kill); - pWeaponBox->pev->nextthink = gpGlobals->time + 300; + pWeaponBox->pev->nextthink = gpGlobals->time + 300.0f; pWeaponBox->PackWeapon(pItem); if (packAmmo) @@ -1447,7 +1405,6 @@ void packPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) } } -/* <15f739> ../cstrike/dlls/player.cpp:1756 */ void CBasePlayer::PackDeadPlayerItems() { bool bPackGun = (g_pGameRules->DeadPlayerWeapons(this) != GR_PLR_DROP_GUN_NO); @@ -1492,10 +1449,10 @@ void CBasePlayer::PackDeadPlayerItems() } packPlayerItem(this, pBestItem, bPackAmmo); } + RemoveAllItems(TRUE); } -/* <15f710> ../cstrike/dlls/player.cpp:1829 */ void CBasePlayer::GiveDefaultItems() { RemoveAllItems(FALSE); @@ -1507,21 +1464,18 @@ void CBasePlayer::GiveDefaultItems() GiveNamedItem("weapon_knife"); GiveNamedItem("weapon_usp"); GiveAmmo(m_bIsVIP ? 12 : 24, "45acp", MAX_AMMO_45ACP); - break; case TERRORIST: GiveNamedItem("weapon_knife"); GiveNamedItem("weapon_glock18"); GiveAmmo(40, "9mm", MAX_AMMO_9MM); - break; } } -/* <15f406> ../cstrike/dlls/player.cpp:1871 */ void CBasePlayer::RemoveAllItems(BOOL removeSuit) { - BOOL bKillProgBar = false; + bool bKillProgBar = false; int i; if (m_bHasDefuser) @@ -1556,7 +1510,7 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit) if (bKillProgBar) SetProgressBarTime(0); - if (m_pActiveItem) + if (m_pActiveItem != NULL) { ResetAutoaim(); @@ -1569,7 +1523,7 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit) { m_pActiveItem = m_rgpPlayerItems[i]; - while (m_pActiveItem) + while (m_pActiveItem != NULL) { CBasePlayerItem *pPendingItem = m_pActiveItem->m_pNext; @@ -1603,7 +1557,6 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit) MESSAGE_END(); } -/* <15436c> ../cstrike/dlls/player.cpp:1962 */ void CBasePlayer::SetBombIcon(BOOL bFlash) { if (m_bHasC4) @@ -1627,7 +1580,6 @@ void CBasePlayer::SetBombIcon(BOOL bFlash) SetScoreboardAttributes(); } -/* <15f2ab> ../cstrike/dlls/player.cpp:1985 */ void CBasePlayer::SetProgressBarTime(int time) { if (time) @@ -1664,7 +1616,6 @@ void CBasePlayer::SetProgressBarTime(int time) } } -/* <15dcb4> ../cstrike/dlls/player.cpp:2027 */ void CBasePlayer::SetProgressBarTime2(int time, float timeElapsed) { if (time) @@ -1706,7 +1657,6 @@ void CBasePlayer::SetProgressBarTime2(int time, float timeElapsed) } } -/* <14e0e9> ../cstrike/dlls/player.cpp:2073 */ void BuyZoneIcon_Set(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1718,7 +1668,6 @@ void BuyZoneIcon_Set(CBasePlayer *player) MESSAGE_END(); } -/* <14e106> ../cstrike/dlls/player.cpp:2086 */ void BuyZoneIcon_Clear(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1740,24 +1689,21 @@ void BuyZoneIcon_Clear(CBasePlayer *player) } } -/* <14e62c> ../cstrike/dlls/player.cpp:2115 */ void BombTargetFlash_Set(CBasePlayer *player) { if (player->m_bHasC4 && !(player->m_flDisplayHistory & DHF_IN_TARGET_ZONE)) { player->m_flDisplayHistory |= DHF_IN_TARGET_ZONE; - player->HintMessage("#Hint_you_are_in_targetzone", TRUE); // TODO: send also for dead the players? + player->HintMessage("#Hint_you_are_in_targetzone"); } player->SetBombIcon(TRUE); } -/* <14e649> ../cstrike/dlls/player.cpp:2129 */ void BombTargetFlash_Clear(CBasePlayer *player) { player->SetBombIcon(FALSE); } -/* <158292> ../cstrike/dlls/player.cpp:2136 */ void RescueZoneIcon_Set(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1771,11 +1717,10 @@ void RescueZoneIcon_Set(CBasePlayer *player) if (player->m_iTeam == CT && !(player->m_flDisplayHistory & DHF_IN_RESCUE_ZONE)) { player->m_flDisplayHistory |= DHF_IN_RESCUE_ZONE; - player->HintMessage("#Hint_hostage_rescue_zone", TRUE); // TODO: send also for dead the players? + player->HintMessage("#Hint_hostage_rescue_zone"); } } -/* <14e666> ../cstrike/dlls/player.cpp:2156 */ void RescueZoneIcon_Clear(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1797,7 +1742,6 @@ void RescueZoneIcon_Clear(CBasePlayer *player) } } -/* <1582af> ../cstrike/dlls/player.cpp:2185 */ void EscapeZoneIcon_Set(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1818,7 +1762,6 @@ void EscapeZoneIcon_Set(CBasePlayer *player) } } -/* <14e683> ../cstrike/dlls/player.cpp:2203 */ void EscapeZoneIcon_Clear(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1840,7 +1783,6 @@ void EscapeZoneIcon_Clear(CBasePlayer *player) } } -/* <1582cc> ../cstrike/dlls/player.cpp:2231 */ void VIP_SafetyZoneIcon_Set(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1866,7 +1808,6 @@ void VIP_SafetyZoneIcon_Set(CBasePlayer *player) } } -/* <14e6a0> ../cstrike/dlls/player.cpp:2255 */ void VIP_SafetyZoneIcon_Clear(CBasePlayer *player) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, player->pev); @@ -1888,10 +1829,9 @@ void VIP_SafetyZoneIcon_Clear(CBasePlayer *player) } } -/* <154417> ../cstrike/dlls/player.cpp:2282 */ void CBasePlayer::SendFOV(int fov) { - pev->fov = (float_precision)fov; + pev->fov = float_precision(fov); m_iClientFOV = fov; m_iFOV = fov; @@ -1900,7 +1840,6 @@ void CBasePlayer::SendFOV(int fov) MESSAGE_END(); } -/* <160a1a> ../cstrike/dlls/player.cpp:2300 */ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) { m_canSwitchObserverModes = false; @@ -1914,7 +1853,8 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) { TheBots->OnEvent(EVENT_PLAYER_DIED, this, pAttackerEntity); } - if (g_pGameRules->IsCareer()) + + if (CSGameRules()->IsCareer()) { bool killerHasShield = false; bool wasBlind = false; @@ -1999,20 +1939,20 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) CSound *pSound = CSoundEnt::SoundPointerForIndex(CSoundEnt::ClientSoundIndex(edict())); - if (pSound) + if (pSound != NULL) { pSound->Reset(); } SetAnimation(PLAYER_DIE); - if (m_pActiveItem && m_pActiveItem->m_pPlayer) + if (m_pActiveItem != NULL && m_pActiveItem->m_pPlayer != NULL) { switch (m_pActiveItem->m_iId) { case WEAPON_HEGRENADE: { - CHEGrenade *pHEGrenade = (CHEGrenade *)m_pActiveItem; + CHEGrenade *pHEGrenade = static_cast(m_pActiveItem); if ((pev->button & IN_ATTACK) && m_rgAmmo[ pHEGrenade->m_iPrimaryAmmoType ]) { CGrenade::ShootTimed2(pev, (pev->origin + pev->view_ofs), pev->angles, 1.5, m_iTeam, pHEGrenade->m_usCreateExplosion); @@ -2029,7 +1969,7 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) } case WEAPON_SMOKEGRENADE: { - CSmokeGrenade *pSmoke = (CSmokeGrenade *)m_pActiveItem; + CSmokeGrenade *pSmoke = static_cast(m_pActiveItem); if ((pev->button & IN_ATTACK) && m_rgAmmo[ pSmoke->m_iPrimaryAmmoType ]) { CGrenade::ShootSmokeGrenade(pev, (pev->origin + pev->view_ofs), pev->angles, 1.5, pSmoke->m_usCreateSmoke); @@ -2074,19 +2014,15 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) case THROW_FORWARD: { UTIL_MakeVectors(pev->angles); - pev->velocity = gpGlobals->v_forward * RANDOM_FLOAT(100, 200); pev->velocity.z = RANDOM_FLOAT(50, 100); - break; } case THROW_BACKWARD: { UTIL_MakeVectors(pev->angles); - pev->velocity = gpGlobals->v_forward * RANDOM_FLOAT(-100, -200); pev->velocity.z = RANDOM_FLOAT(50, 100); - break; } case THROW_HITVEL: @@ -2098,21 +2034,19 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) pev->velocity = gpGlobals->v_forward * RANDOM_FLOAT(200, 300); pev->velocity.z = RANDOM_FLOAT(200, 300); } - break; } case THROW_BOMB: { - pev->velocity = m_vBlastVector * (1 / m_vBlastVector.Length()) * (2300 - m_vBlastVector.Length()) * 0.25; - pev->velocity.z = (2300 - m_vBlastVector.Length()) / 2.75; - + // TODO: fix test demo + pev->velocity = m_vBlastVector * (1.0f / m_vBlastVector.Length()) * float(2300.0f - m_vBlastVector.Length()) * 0.25f; + pev->velocity.z = (2300.0f - m_vBlastVector.Length()) / 2.75f; break; } case THROW_GRENADE: { pev->velocity = m_vBlastVector * (1 / m_vBlastVector.Length()) * (500 - m_vBlastVector.Length()); pev->velocity.z = (350 - m_vBlastVector.Length()) * 1.5; - break; } case THROW_HITVEL_MINUS_AIRVEL: @@ -2122,7 +2056,6 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) UTIL_MakeVectors(pevAttacker->angles); pev->velocity = gpGlobals->v_forward * RANDOM_FLOAT(200, 300); } - break; } default: @@ -2150,7 +2083,7 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) SendFOV(0); - g_pGameRules->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); m_bNotKilled = false; if (m_bHasC4) @@ -2196,9 +2129,7 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) pev->solid = SOLID_NOT; GibMonster(); pev->effects |= EF_NODRAW; - - g_pGameRules->CheckWinConditions(); - + CSGameRules()->CheckWinConditions(); return; } @@ -2214,7 +2145,6 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) } } -/* <154478> ../cstrike/dlls/player.cpp:2625 */ BOOL CBasePlayer::IsBombGuy() { if (!g_pGameRules->IsMultiplayer()) @@ -2223,7 +2153,6 @@ BOOL CBasePlayer::IsBombGuy() return m_bHasC4; } -/* <1544a1> ../cstrike/dlls/player.cpp:2636 */ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim) { int animDesired; @@ -2516,7 +2445,7 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim) } if (m_Activity == ACT_RUN) { - //TODO: maybe away used variable 'speed'? + // TODO: maybe away used variable 'speed'? //if (speed > 150.0f) if (pev->velocity.Length2D() > 150.0f) { @@ -2546,7 +2475,7 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim) // TODO: why? this condition was checked! if ((playerAnim == PLAYER_FLINCH || playerAnim == PLAYER_LARGE_FLINCH) && HasShield()) return; -#endif // REGAMEDLL_FIXES +#endif switch (m_LastHitGroup) { @@ -2793,7 +2722,6 @@ void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim) } } -/* <1544f4> ../cstrike/dlls/player.cpp:3264 */ void CBasePlayer::WaterMove() { int air; @@ -2808,7 +2736,6 @@ void CBasePlayer::WaterMove() // waterlevel 1 - feet in water // waterlevel 2 - waist in water // waterlevel 3 - head in water - if (pev->waterlevel != 3) { // not underwater @@ -2877,7 +2804,7 @@ void CBasePlayer::WaterMove() } // make bubbles - air = (int)(pev->air_finished - gpGlobals->time); + air = int(pev->air_finished - gpGlobals->time); if (!RANDOM_LONG(0, 0x1f) && RANDOM_LONG(0, AIRTIME - 1) >= air) { @@ -2907,13 +2834,11 @@ void CBasePlayer::WaterMove() } } -/* <15493f> ../cstrike/dlls/player.cpp:3380 */ BOOL CBasePlayer::IsOnLadder() { return pev->movetype == MOVETYPE_FLY; } -/* <160720> ../cstrike/dlls/player.cpp:3387 */ NOXREF void CBasePlayer::ThrowWeapon(char *pszItemName) { for (int i = 0; i < MAX_WEAPON_SLOTS; ++i) @@ -2933,10 +2858,8 @@ NOXREF void CBasePlayer::ThrowWeapon(char *pszItemName) } } -/* <154967> ../cstrike/dlls/player.cpp:3424 */ LINK_ENTITY_TO_CLASS(weapon_shield, CWShield); -/* <151962> ../cstrike/dlls/player.cpp:3426 */ void CWShield::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_TOSS; @@ -2946,7 +2869,6 @@ void CWShield::__MAKE_VHOOK(Spawn)() SET_MODEL(ENT(pev), "models/w_shield.mdl"); } -/* <152e95> ../cstrike/dlls/player.cpp:3436 */ void CWShield::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -2988,7 +2910,6 @@ void CWShield::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) } } -/* <154a43> ../cstrike/dlls/player.cpp:3480 */ void CBasePlayer::GiveShield(bool bDeploy) { m_bOwnsShield = true; @@ -2996,7 +2917,7 @@ void CBasePlayer::GiveShield(bool bDeploy) if (m_pActiveItem != NULL) { - CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)m_pActiveItem; + CBasePlayerWeapon *pWeapon = static_cast(m_pActiveItem); if (bDeploy) { @@ -3011,7 +2932,6 @@ void CBasePlayer::GiveShield(bool bDeploy) pev->gamestate = 0; } -/* <154a70> ../cstrike/dlls/player.cpp:3504 */ void CBasePlayer::RemoveShield() { if (HasShield()) @@ -3025,19 +2945,18 @@ void CBasePlayer::RemoveShield() } } -/* <154ad5> ../cstrike/dlls/player.cpp:3521 */ void CBasePlayer::DropShield(bool bDeploy) { if (!HasShield()) return; - if (m_pActiveItem && !m_pActiveItem->CanHolster()) + if (m_pActiveItem != NULL && !m_pActiveItem->CanHolster()) return; - if (m_pActiveItem) - { - CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)m_pActiveItem; + CBasePlayerWeapon *pWeapon = static_cast(m_pActiveItem); + if (pWeapon != NULL) + { if (pWeapon->m_iId == WEAPON_HEGRENADE || pWeapon->m_iId == WEAPON_FLASHBANG || pWeapon->m_iId == WEAPON_SMOKEGRENADE) { if (m_rgAmmo[ pWeapon->m_iPrimaryAmmoType ] <= 0) @@ -3045,30 +2964,26 @@ void CBasePlayer::DropShield(bool bDeploy) } } - if (m_pActiveItem) + if (m_pActiveItem != NULL) { - CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)m_pActiveItem; - - if (pWeapon->m_flStartThrow != 0) + if (m_pActiveItem->m_flStartThrow != 0.0f) m_pActiveItem->Holster(); } if (IsReloading()) { - CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)m_pActiveItem; - pWeapon->m_fInReload = FALSE; m_flNextAttack = 0; } - if (IsProtectedByShield() && m_pActiveItem) + if (m_pActiveItem != NULL && IsProtectedByShield()) ((CBasePlayerWeapon *)m_pActiveItem)->SecondaryAttack(); m_bShieldDrawn = false; RemoveShield(); - if (m_pActiveItem && bDeploy) + if (m_pActiveItem != NULL && bDeploy) m_pActiveItem->Deploy(); UTIL_MakeVectors(pev->angles); @@ -3077,22 +2992,17 @@ void CBasePlayer::DropShield(bool bDeploy) pShield->pev->angles.x = 0; pShield->pev->angles.z = 0; - pShield->pev->velocity = gpGlobals->v_forward * 400; - pShield->SetThink(&CBaseEntity::SUB_Remove); pShield->pev->nextthink = gpGlobals->time + 300; - pShield->SetCantBePickedUpByUser(this, 2.0); } -/* <154b15> ../cstrike/dlls/player.cpp:3588 */ bool CBasePlayer::HasShield() { return m_bOwnsShield; } -/* <1615d2> ../cstrike/dlls/player.cpp:3593 */ NOXREF void CBasePlayer::ThrowPrimary() { ThrowWeapon("weapon_m249"); @@ -3113,7 +3023,6 @@ NOXREF void CBasePlayer::ThrowPrimary() DropShield(); } -/* <154b6d> ../cstrike/dlls/player.cpp:3624 */ void CBasePlayer::AddAccount(int amount, bool bTrackChange) { m_iAccount += amount; @@ -3126,7 +3035,7 @@ void CBasePlayer::AddAccount(int amount, bool bTrackChange) m_iAccount = 16000; #else - int mmoney = (int)maxmoney.value; + int mmoney = int(maxmoney.value); if (m_iAccount < 0) m_iAccount = 0; @@ -3134,7 +3043,7 @@ void CBasePlayer::AddAccount(int amount, bool bTrackChange) else if (m_iAccount > mmoney) m_iAccount = mmoney; -#endif // REGAMEDLL_ADD +#endif // Send money update to HUD MESSAGE_BEGIN(MSG_ONE, gmsgMoney, NULL, pev); @@ -3143,7 +3052,6 @@ void CBasePlayer::AddAccount(int amount, bool bTrackChange) MESSAGE_END(); } -/* <154bf8> ../cstrike/dlls/player.cpp:3640 */ void CBasePlayer::ResetMenu() { MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pev); @@ -3155,18 +3063,16 @@ void CBasePlayer::ResetMenu() #ifdef REGAMEDLL_FIXES m_iMenu = Menu_OFF; -#endif // REGAMEDLL_FIXES +#endif } -/* <154c50> ../cstrike/dlls/player.cpp:3651 */ void CBasePlayer::SyncRoundTimer() { float tmRemaining; - CHalfLifeMultiplay *mp = g_pGameRules; - if (mp->IsMultiplayer()) - tmRemaining = mp->TimeRemaining(); + if (CSGameRules()->IsMultiplayer()) + tmRemaining = CSGameRules()->TimeRemaining(); else tmRemaining = 0; @@ -3174,20 +3080,20 @@ void CBasePlayer::SyncRoundTimer() tmRemaining = 0; MESSAGE_BEGIN(MSG_ONE, gmsgRoundTime, NULL, pev); - WRITE_SHORT((int)tmRemaining); + WRITE_SHORT(int(tmRemaining)); MESSAGE_END(); - if (!mp->IsMultiplayer()) + if (!CSGameRules()->IsMultiplayer()) return; - if (mp->IsFreezePeriod() && TheTutor != NULL && !IsObserver()) + if (CSGameRules()->IsFreezePeriod() && TheTutor != NULL && !IsObserver()) { MESSAGE_BEGIN(MSG_ONE, gmsgBlinkAcct, NULL, pev); WRITE_BYTE(MONEY_BLINK_AMOUNT); MESSAGE_END(); } - if (TheCareerTasks != NULL && mp->IsCareer()) + if (TheCareerTasks != NULL && CSGameRules()->IsCareer()) { int remaining = 0; bool shouldCountDown = false; @@ -3195,23 +3101,23 @@ void CBasePlayer::SyncRoundTimer() if (tmRemaining != 0.0f) { - remaining = TheCareerTasks->GetTaskTime() - (gpGlobals->time - mp->m_fRoundCount); + remaining = TheCareerTasks->GetTaskTime() - (gpGlobals->time - CSGameRules()->m_fRoundCount); } if (remaining < 0) remaining = 0; - if (mp->IsFreezePeriod()) + if (CSGameRules()->IsFreezePeriod()) remaining = -1; if (TheCareerTasks->GetFinishedTaskTime()) remaining = -TheCareerTasks->GetFinishedTaskTime(); - if (!mp->IsFreezePeriod() && !TheCareerTasks->GetFinishedTaskTime()) + if (!CSGameRules()->IsFreezePeriod() && !TheCareerTasks->GetFinishedTaskTime()) { shouldCountDown = true; } - if (!mp->IsFreezePeriod()) + if (!CSGameRules()->IsFreezePeriod()) { if (TheCareerTasks->GetFinishedTaskTime() || (TheCareerTasks->GetTaskTime() <= TheCareerTasks->GetRoundElapsedTime())) { @@ -3219,7 +3125,7 @@ void CBasePlayer::SyncRoundTimer() } } - if (!TheCareerTasks->GetFinishedTaskTime() || TheCareerTasks->GetFinishedTaskRound() == mp->m_iTotalRoundsPlayed) + if (!TheCareerTasks->GetFinishedTaskTime() || TheCareerTasks->GetFinishedTaskRound() == CSGameRules()->m_iTotalRoundsPlayed) { MESSAGE_BEGIN(MSG_ONE, gmsgTaskTime, NULL, pev); WRITE_SHORT(remaining); // remaining of time, -1 the timer is disappears @@ -3230,7 +3136,6 @@ void CBasePlayer::SyncRoundTimer() } } -/* <154db6> ../cstrike/dlls/player.cpp:3711 */ void CBasePlayer::RemoveLevelText() { ResetMenu(); @@ -3246,7 +3151,6 @@ void ShowMenu2(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, int f MESSAGE_END(); } -/* <154e29> ../cstrike/dlls/player.cpp:3721 */ void CBasePlayer::MenuPrint(const char *msg) { const char *msg_portion = msg; @@ -3274,7 +3178,6 @@ void CBasePlayer::MenuPrint(const char *msg) MESSAGE_END(); } -/* <154f3d> ../cstrike/dlls/player.cpp:3753 */ void CBasePlayer::MakeVIP() { pev->body = 0; @@ -3287,11 +3190,10 @@ void CBasePlayer::MakeVIP() m_bIsVIP = true; m_bNotKilled = false; - g_pGameRules->m_pVIP = this; - g_pGameRules->m_iConsecutiveVIP = 1; + CSGameRules()->m_pVIP = this; + CSGameRules()->m_iConsecutiveVIP = 1; } -/* <154fe5> ../cstrike/dlls/player.cpp:3785 */ void CBasePlayer::JoiningThink() { switch (m_iJoiningState) @@ -3326,13 +3228,10 @@ void CBasePlayer::JoiningThink() RemoveLevelText(); m_iJoiningState = SHOWTEAMSELECT; } - break; } case GETINTOGAME: { - CHalfLifeMultiplay *mp = g_pGameRules; - m_bNotKilled = false; m_iIgnoreGlobalChat = IGNOREMSG_NONE; @@ -3348,47 +3247,41 @@ void CBasePlayer::JoiningThink() ResetMaxSpeed(); m_iJoiningState = JOINED; - if (mp->m_bMapHasEscapeZone && m_iTeam == CT) + if (CSGameRules()->m_bMapHasEscapeZone && m_iTeam == CT) { m_iAccount = 0; CheckStartMoney(); AddAccount(startmoney.value); } - if (mp->FPlayerCanRespawn(this)) + if (g_pGameRules->FPlayerCanRespawn(this)) { Spawn(); - mp->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); - if (!mp->m_fTeamCount && mp->m_bMapHasBombTarget && !mp->IsThereABomber() && !mp->IsThereABomb()) + if (!CSGameRules()->m_fTeamCount && CSGameRules()->m_bMapHasBombTarget && !CSGameRules()->IsThereABomber() && !CSGameRules()->IsThereABomb()) { - mp->GiveC4(); + CSGameRules()->GiveC4(); } if (m_iTeam == TERRORIST) { - mp->m_iNumEscapers++; + CSGameRules()->m_iNumEscapers++; } } else { pev->deadflag = DEAD_RESPAWNABLE; - if (pev->classname) - { - RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); - } - MAKE_STRING_CLASS("player", pev); - AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); pev->flags &= (FL_PROXY | FL_FAKECLIENT); pev->flags |= (FL_SPECTATOR | FL_CLIENT); - edict_t *pentSpawnSpot = mp->GetPlayerSpawnSpot(this); - StartObserver(pev->origin, VARS(pentSpawnSpot)->angles); + edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot(this); + StartObserver(pev->origin, pentSpawnSpot->v.angles); - mp->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); WRITE_BYTE(entindex()); @@ -3416,7 +3309,7 @@ void CBasePlayer::JoiningThink() MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo); WRITE_BYTE(ENTINDEX(edict())); - WRITE_SHORT((int)pev->frags); + WRITE_SHORT(int(pev->frags)); WRITE_SHORT(m_iDeaths); WRITE_SHORT(0); WRITE_SHORT(m_iTeam); @@ -3428,12 +3321,11 @@ void CBasePlayer::JoiningThink() m_flDisplayHistory |= DHF_SPEC_DUCK; } } - return; } } - if (m_pIntroCamera && gpGlobals->time >= m_fIntroCamTime) + if (m_pIntroCamera != NULL && gpGlobals->time >= m_fIntroCamTime) { m_pIntroCamera = UTIL_FindEntityByClassname(m_pIntroCamera, "trigger_camera"); @@ -3444,7 +3336,7 @@ void CBasePlayer::JoiningThink() CBaseEntity *Target = UTIL_FindEntityByTargetname(NULL, STRING(m_pIntroCamera->pev->target)); - if (Target) + if (Target != NULL) { Vector CamAngles = UTIL_VecToAngles((Target->pev->origin - m_pIntroCamera->pev->origin).Normalize()); @@ -3466,7 +3358,6 @@ void CBasePlayer::JoiningThink() } } -/* <16076f> ../cstrike/dlls/player.cpp:3952 */ void CBasePlayer::Disappear() { if (m_pTank != NULL) @@ -3504,7 +3395,7 @@ void CBasePlayer::Disappear() SendFOV(0); - g_pGameRules->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); m_bNotKilled = false; if (m_bHasC4) @@ -3536,7 +3427,6 @@ void CBasePlayer::Disappear() pev->angles.z = 0; } -/* <15f83d> ../cstrike/dlls/player.cpp:4039 */ void CBasePlayer::PlayerDeathThink() { if (m_iJoiningState != JOINED) @@ -3591,7 +3481,7 @@ void CBasePlayer::PlayerDeathThink() // choose to respawn. if (g_pGameRules->IsMultiplayer()) { - if (gpGlobals->time > m_fDeadTime + 3.0 && !(m_afPhysicsFlags & PFLAG_OBSERVER)) + if (gpGlobals->time > m_fDeadTime + 3.0f && !(m_afPhysicsFlags & PFLAG_OBSERVER)) { // Send message to everybody to spawn a corpse. SpawnClientSideCorpse(); @@ -3612,11 +3502,11 @@ void CBasePlayer::PlayerDeathThink() { pev->deadflag = DEAD_RESPAWNABLE; - if (g_pGameRules->IsMultiplayer()) - g_pGameRules->CheckWinConditions(); + if (CSGameRules()->IsMultiplayer()) + CSGameRules()->CheckWinConditions(); } - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } else if (pev->deadflag == DEAD_RESPAWNABLE) { @@ -3627,7 +3517,6 @@ void CBasePlayer::PlayerDeathThink() } } -/* <153042> ../cstrike/dlls/player.cpp:4134 */ void CBasePlayer::__MAKE_VHOOK(RoundRespawn)() { m_canSwitchObserverModes = true; @@ -3644,7 +3533,7 @@ void CBasePlayer::__MAKE_VHOOK(RoundRespawn)() { ClientKill(ENT(pev)); } -#endif // REGAMEDLL_FIXES +#endif m_bPunishedForTK = true; } if (m_iMenu != Menu_ChooseAppearance) @@ -3668,8 +3557,6 @@ void CBasePlayer::__MAKE_VHOOK(RoundRespawn)() // StartDeathCam - find an intermission spot and send the // player off into observer mode - -/* <155577> ../cstrike/dlls/player.cpp:4172 */ void CBasePlayer::StartDeathCam() { if (pev->view_ofs == g_vecZero) @@ -3686,7 +3573,6 @@ void CBasePlayer::StartDeathCam() } } -/* <155616> ../cstrike/dlls/player.cpp:4190 */ void CBasePlayer::StartObserver(Vector vecPosition, Vector vecViewAngle) { // clear any clientside entities attached to this player @@ -3750,9 +3636,8 @@ void CBasePlayer::StartObserver(Vector vecPosition, Vector vecViewAngle) pev->iuser1 = OBS_NONE; static int iFirstTime = 1; - CHalfLifeMultiplay *mp = g_pGameRules; - if (iFirstTime && mp && mp->IsCareer() && !IsBot()) + if (iFirstTime != 0 && CSGameRules() != NULL && CSGameRules()->IsCareer() && !IsBot()) { Observer_SetMode(OBS_CHASE_LOCKED); CLIENT_COMMAND(edict(), "spec_autodirector_internal 1\n"); @@ -3770,7 +3655,6 @@ void CBasePlayer::StartObserver(Vector vecPosition, Vector vecViewAngle) MESSAGE_END(); } -/* <14d785> ../cstrike/dlls/player.cpp:4272 */ bool CanSeeUseable(CBasePlayer *me, CBaseEntity *entity) { TraceResult result; @@ -3800,7 +3684,6 @@ bool CanSeeUseable(CBasePlayer *me, CBaseEntity *entity) return true; } -/* <155815> ../cstrike/dlls/player.cpp:4307 */ void CBasePlayer::PlayerUse() { // Was use pressed or released? @@ -3964,7 +3847,6 @@ void CBasePlayer::PlayerUse() } } -/* <155f41> ../cstrike/dlls/player.cpp:4486 */ void CBasePlayer::HostageUsed() { if (m_flDisplayHistory & DHF_HOSTAGE_USED) @@ -3979,7 +3861,6 @@ void CBasePlayer::HostageUsed() m_flDisplayHistory |= DHF_HOSTAGE_USED; } -/* <153f69> ../cstrike/dlls/player.cpp:4507 */ void CBasePlayer::__MAKE_VHOOK(Jump)() { if (pev->flags & FL_WATERJUMP) @@ -4034,8 +3915,6 @@ void CBasePlayer::__MAKE_VHOOK(Jump)() // This is a glorious hack to find free space when you've crouched into some solid space // Our crouching collisions do not work correctly for some reason and this is easier // than fixing the problem :( - -/* <155fe2> ../cstrike/dlls/player.cpp:4565 */ NOXREF void FixPlayerCrouchStuck(edict_t *pPlayer) { TraceResult trace; @@ -4052,7 +3931,6 @@ NOXREF void FixPlayerCrouchStuck(edict_t *pPlayer) } } -/* <153ef5> ../cstrike/dlls/player.cpp:4580 */ void CBasePlayer::__MAKE_VHOOK(Duck)() { if (pev->button & IN_DUCK) @@ -4060,14 +3938,11 @@ void CBasePlayer::__MAKE_VHOOK(Duck)() } // ID's player as such. - -/* <150f8f> ../cstrike/dlls/player.cpp:4591 */ int CBasePlayer::__MAKE_VHOOK(Classify)() { return CLASS_PLAYER; } -/* <150fb7> ../cstrike/dlls/player.cpp:4597 */ void CBasePlayer::__MAKE_VHOOK(AddPoints)(int score, BOOL bAllowNegativeScore) { // Positive score always adds @@ -4088,14 +3963,13 @@ void CBasePlayer::__MAKE_VHOOK(AddPoints)(int score, BOOL bAllowNegativeScore) MESSAGE_BEGIN(MSG_BROADCAST, gmsgScoreInfo); WRITE_BYTE(ENTINDEX(edict())); - WRITE_SHORT((int)pev->frags); + WRITE_SHORT(int(pev->frags)); WRITE_SHORT(m_iDeaths); WRITE_SHORT(0); WRITE_SHORT(m_iTeam); MESSAGE_END(); } -/* <15125b> ../cstrike/dlls/player.cpp:4626 */ void CBasePlayer::__MAKE_VHOOK(AddPointsToTeam)(int score, BOOL bAllowNegativeScore) { int index = entindex(); @@ -4114,12 +3988,9 @@ void CBasePlayer::__MAKE_VHOOK(AddPointsToTeam)(int score, BOOL bAllowNegativeSc } } -/* <156047> ../cstrike/dlls/player.cpp:4645 */ bool CBasePlayer::CanPlayerBuy(bool display) { - CHalfLifeMultiplay *mp = g_pGameRules; - - if (!mp->IsMultiplayer()) + if (!g_pGameRules->IsMultiplayer()) { return CHalfLifeTraining::PlayerCanBuy(this); } @@ -4136,7 +4007,7 @@ bool CBasePlayer::CanPlayerBuy(bool display) return false; } - int buyTime = (int)(CVAR_GET_FLOAT("mp_buytime") * 60.0f); + int buyTime = int(CVAR_GET_FLOAT("mp_buytime") * 60.0f); if (buyTime < MIN_BUY_TIME) { @@ -4144,7 +4015,7 @@ bool CBasePlayer::CanPlayerBuy(bool display) CVAR_SET_FLOAT("mp_buytime", (MIN_BUY_TIME / 60.0f)); } - if (gpGlobals->time - mp->m_fRoundCount > buyTime) + if (gpGlobals->time - CSGameRules()->m_fRoundCount > buyTime) { if (display) { @@ -4164,7 +4035,7 @@ bool CBasePlayer::CanPlayerBuy(bool display) return false; } - if (mp->m_bCTCantBuy && m_iTeam == CT) + if (CSGameRules()->m_bCTCantBuy && m_iTeam == CT) { if (display) { @@ -4174,7 +4045,7 @@ bool CBasePlayer::CanPlayerBuy(bool display) return false; } - if (mp->m_bTCantBuy && m_iTeam == TERRORIST) + if (CSGameRules()->m_bTCantBuy && m_iTeam == TERRORIST) { if (display) { @@ -4187,7 +4058,6 @@ bool CBasePlayer::CanPlayerBuy(bool display) return true; } -/* <15f9ac> ../cstrike/dlls/player.cpp:4717 */ void CBasePlayer::__MAKE_VHOOK(PreThink)() { // These buttons have changed this frame @@ -4257,28 +4127,21 @@ void CBasePlayer::__MAKE_VHOOK(PreThink)() float_precision flLastMove = gpGlobals->time - m_fLastMovement; //check if this player has been inactive for 2 rounds straight - if (flLastMove > g_pGameRules->m_fMaxIdlePeriod) + if (flLastMove > CSGameRules()->m_fMaxIdlePeriod) { if (!IsBot() && CVAR_GET_FLOAT("mp_autokick") != 0.0f) { // Log the kick - UTIL_LogPrintf - ( - "\"%s<%i><%s><%s>\" triggered \"Game_idle_kick\" (auto)\n", - STRING(pev->netname), - GETPLAYERUSERID(edict()), - GETPLAYERAUTHID(edict()), - GetTeam(m_iTeam) - ); - + UTIL_LogPrintf("\"%s<%i><%s><%s>\" triggered \"Game_idle_kick\" (auto)\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), GetTeam(m_iTeam)); UTIL_ClientPrintAll(HUD_PRINTCONSOLE, "#Game_idle_kick", STRING(pev->netname)); + SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", STRING(pev->netname))); m_fLastMovement = gpGlobals->time; } } } - if (g_pGameRules && g_pGameRules->FAllowFlashlight()) + if (g_pGameRules != NULL && g_pGameRules->FAllowFlashlight()) m_iHideHUD &= ~HIDEHUD_FLASHLIGHT; else m_iHideHUD |= HIDEHUD_FLASHLIGHT; @@ -4454,8 +4317,6 @@ void CBasePlayer::__MAKE_VHOOK(PreThink)() // The m_bitsDamageType bit MUST be set if any damage is to be taken. // This routine will detect the initial on value of the m_bitsDamageType // and init the appropriate counter. Only processes damage every second. - -/* <156096> ../cstrike/dlls/player.cpp:5146 */ void CBasePlayer::CheckTimeBasedDamage() { int i; @@ -4466,7 +4327,7 @@ void CBasePlayer::CheckTimeBasedDamage() return; // only check for time based damage approx. every 2 seconds - if (abs((int64_t)(gpGlobals->time - m_tbdPrev)) < 2.0f) + if (Q_abs(int64(gpGlobals->time - m_tbdPrev)) < 2.0f) return; m_tbdPrev = gpGlobals->time; @@ -4551,7 +4412,6 @@ void CBasePlayer::CheckTimeBasedDamage() } } -/* <156112> ../cstrike/dlls/player.cpp:5312 */ void CBasePlayer::UpdateGeigerCounter() { BYTE range; @@ -4563,7 +4423,7 @@ void CBasePlayer::UpdateGeigerCounter() m_flgeigerDelay = gpGlobals->time + 0.25; // send range to radition source to client - range = (byte)(m_flgeigerRange / 4.0);//* 0.25); // TODO: ACHECK! + range = byte(m_flgeigerRange / 4.0);//* 0.25); // TODO: ACHECK! if (range != m_igeigerRangePrev) { @@ -4581,7 +4441,6 @@ void CBasePlayer::UpdateGeigerCounter() } } -/* <156189> ../cstrike/dlls/player.cpp:5352 */ void CBasePlayer::CheckSuitUpdate() { int i; @@ -4644,15 +4503,12 @@ void CBasePlayer::CheckSuitUpdate() // sentence name ie: !HEV_AA0. If iNoRepeat is specified in // seconds, then we won't repeat playback of this word or sentence // for at least that number of seconds. - -/* <156201> ../cstrike/dlls/player.cpp:5414 */ void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) { ; } -/* <15623f> ../cstrike/dlls/player.cpp:5519 */ -void CBasePlayer::CheckPowerups(entvars_t *pev) +void CBasePlayer::CheckPowerups() { if (pev->health <= 0.0f) return; @@ -4661,7 +4517,6 @@ void CBasePlayer::CheckPowerups(entvars_t *pev) pev->modelindex = m_modelIndexPlayer; } -/* <15626b> ../cstrike/dlls/player.cpp:5531 */ void CBasePlayer::SetNewPlayerModel(const char *modelName) { SET_MODEL(edict(), modelName); @@ -4670,8 +4525,6 @@ void CBasePlayer::SetNewPlayerModel(const char *modelName) // UpdatePlayerSound - updates the position of the player's // reserved sound slot in the sound list. - -/* <1562a4> ../cstrike/dlls/player.cpp:5543 */ void CBasePlayer::UpdatePlayerSound() { int iBodyVolume; @@ -4780,7 +4633,6 @@ void CBasePlayer::UpdatePlayerSound() gpGlobals->v_forward.z = 0; } -/* <15a182> ../cstrike/dlls/player.cpp:5667 */ void CBasePlayer::__MAKE_VHOOK(PostThink)() { // intermission or finale @@ -4871,7 +4723,7 @@ void CBasePlayer::__MAKE_VHOOK(PostThink)() } StudioFrameAdvance(); - CheckPowerups(pev); + CheckPowerups(); UpdatePlayerSound(); pt_end: @@ -4918,8 +4770,6 @@ pt_end: } // checks if the spot is clear of players - -/* <14e39d> ../cstrike/dlls/player.cpp:5837 */ BOOL IsSpawnPointValid(CBaseEntity *pPlayer, CBaseEntity *pSpot) { CBaseEntity *ent = NULL; @@ -4937,7 +4787,6 @@ BOOL IsSpawnPointValid(CBaseEntity *pPlayer, CBaseEntity *pSpot) return TRUE; } -/* <1563a8> ../cstrike/dlls/player.cpp:5879 */ NOXREF void InitZombieSpawns() { CBaseEntity *spot = NULL; @@ -4957,7 +4806,6 @@ NOXREF void InitZombieSpawns() } } -/* <14e440> ../cstrike/dlls/player.cpp:5906 */ NOXREF CBaseEntity *FindZombieSpawn(CBaseEntity *player, bool forceSpawn) { return NULL; @@ -5010,7 +4858,7 @@ bool CBasePlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot { // if ent is a client, kill em (unless they are ourselves) if (ent->IsPlayer() && ent->edict() != player) - ent->TakeDamage(VARS(INDEXENT(0)), VARS(INDEXENT(0)), 200, DMG_GENERIC); + ent->TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 200, DMG_GENERIC); } // if so, go to pSpot @@ -5020,7 +4868,6 @@ bool CBasePlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot return false; } -/* <15645f> ../cstrike/dlls/player.cpp:6060 */ edict_t *EntSelectSpawnPoint(CBaseEntity *pPlayer) { CBaseEntity *pSpot; @@ -5105,7 +4952,6 @@ ReturnSpot: return pSpot->edict(); } -/* <15331b> ../cstrike/dlls/player.cpp:6237 */ void SetScoreAttrib(CBasePlayer *dest, CBasePlayer *src) { int state = 0; @@ -5127,7 +4973,6 @@ void SetScoreAttrib(CBasePlayer *dest, CBasePlayer *src) } } -/* <15fdba> ../cstrike/dlls/player.cpp:6264 */ void CBasePlayer::__MAKE_VHOOK(Spawn)() { int i; @@ -5141,13 +4986,7 @@ void CBasePlayer::__MAKE_VHOOK(Spawn)() m_progressStart = 0; m_progressEnd = 0; - if (!FStringNull(pev->classname)) - { - RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); - } - MAKE_STRING_CLASS("player", pev); - AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); pev->health = 100; @@ -5259,7 +5098,7 @@ void CBasePlayer::__MAKE_VHOOK(Spawn)() } MESSAGE_BEGIN(MSG_ONE, SVC_ROOMTYPE, NULL, pev); - WRITE_SHORT((int)CVAR_GET_FLOAT("room_type")); + WRITE_SHORT(int(CVAR_GET_FLOAT("room_type"))); MESSAGE_END(); if (g_pGameRules->IsFreezePeriod()) @@ -5440,7 +5279,7 @@ void CBasePlayer::__MAKE_VHOOK(Spawn)() MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo); WRITE_BYTE(ENTINDEX(edict())); - WRITE_SHORT((int)pev->frags); + WRITE_SHORT(int(pev->frags)); WRITE_SHORT(m_iDeaths); WRITE_SHORT(0); WRITE_SHORT(m_iTeam); @@ -5471,11 +5310,10 @@ void CBasePlayer::__MAKE_VHOOK(Spawn)() sv_aim = CVAR_GET_POINTER("sv_aim"); - for (i = 0; i < ARRAYSIZE(m_flLastCommandTime); ++i) + for (i = 0; i < COMMANDS_TO_TRACK; ++i) m_flLastCommandTime[i] = -1; } -/* <153555> ../cstrike/dlls/player.cpp:6620 */ void CBasePlayer::__MAKE_VHOOK(Precache)() { // in the event that the player JUST spawned, and the level node graph @@ -5517,7 +5355,6 @@ void CBasePlayer::__MAKE_VHOOK(Precache)() m_fInitHUD = TRUE; } -/* <151a77> ../cstrike/dlls/player.cpp:6671 */ int CBasePlayer::__MAKE_VHOOK(Save)(CSave &save) { if (!CBaseMonster::Save(save)) @@ -5526,7 +5363,6 @@ int CBasePlayer::__MAKE_VHOOK(Save)(CSave &save) return save.WriteFields("PLAYER", this, IMPL_CLASS(CBasePlayer, m_playerSaveData), ARRAYSIZE(IMPL_CLASS(CBasePlayer, m_playerSaveData))); } -/* <153355> ../cstrike/dlls/player.cpp:6685 */ void CBasePlayer::SetScoreboardAttributes(CBasePlayer *destination) { if (destination != NULL) @@ -5545,14 +5381,11 @@ void CBasePlayer::SetScoreboardAttributes(CBasePlayer *destination) } // Marks everything as new so the player will resend this to the hud. - -/* <156e88> ../cstrike/dlls/player.cpp:6712 */ NOXREF void CBasePlayer::RenewItems() { ; } -/* <156b9b> ../cstrike/dlls/player.cpp:6718 */ int CBasePlayer::__MAKE_VHOOK(Restore)(CRestore &restore) { if (!CBaseMonster::Restore(restore)) @@ -5569,8 +5402,8 @@ int CBasePlayer::__MAKE_VHOOK(Restore)(CRestore &restore) // default to normal spawn edict_t *pentSpawnSpot = EntSelectSpawnPoint(this); - pev->origin = VARS(pentSpawnSpot)->origin + Vector(0, 0, 1); - pev->angles = VARS(pentSpawnSpot)->angles; + pev->origin = pentSpawnSpot->v.origin + Vector(0, 0, 1); + pev->angles = pentSpawnSpot->v.angles; } // Clear out roll @@ -5595,7 +5428,6 @@ int CBasePlayer::__MAKE_VHOOK(Restore)(CRestore &restore) return status; } -/* <156eab> ../cstrike/dlls/player.cpp:6771 */ void CBasePlayer::Reset() { pev->frags = 0; @@ -5622,7 +5454,6 @@ void CBasePlayer::Reset() MESSAGE_END(); } -/* <157066> ../cstrike/dlls/player.cpp:6794 */ NOXREF void CBasePlayer::SelectNextItem(int iItem) { CBasePlayerItem *pItem = m_rgpPlayerItems[ iItem ]; @@ -5679,7 +5510,6 @@ NOXREF void CBasePlayer::SelectNextItem(int iItem) } } -/* <15714a> ../cstrike/dlls/player.cpp:6851 */ void CBasePlayer::SelectItem(const char *pstr) { if (!pstr) @@ -5741,7 +5571,6 @@ void CBasePlayer::SelectItem(const char *pstr) } } -/* <157268> ../cstrike/dlls/player.cpp:6909 */ void CBasePlayer::SelectLastItem() { if (m_pActiveItem && !m_pActiveItem->CanHolster()) @@ -5792,8 +5621,6 @@ void CBasePlayer::SelectLastItem() } // HasWeapons - do I have any weapons at all? - -/* <15733a> ../cstrike/dlls/player.cpp:6967 */ BOOL CBasePlayer::HasWeapons() { for (int i = 0; i < MAX_ITEM_TYPES; ++i) @@ -5805,13 +5632,11 @@ BOOL CBasePlayer::HasWeapons() return FALSE; } -/* <157372> ../cstrike/dlls/player.cpp:6982 */ NOXREF void CBasePlayer::SelectPrevItem(int iItem) { ; } -/* <15106c> ../cstrike/dlls/player.cpp:6987 */ const char *CBasePlayer::__MAKE_VHOOK(TeamID)() { // Not fully connected yet @@ -5822,7 +5647,6 @@ const char *CBasePlayer::__MAKE_VHOOK(TeamID)() return m_szTeamName; } -/* <1573aa> ../cstrike/dlls/player.cpp:7010 */ void CSprayCan::Spawn(entvars_t *pevOwner) { pev->origin = pevOwner->origin + Vector(0, 0, 32); @@ -5834,7 +5658,6 @@ void CSprayCan::Spawn(entvars_t *pevOwner) EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/sprayer.wav", VOL_NORM, ATTN_NORM); } -/* <151815> ../cstrike/dlls/player.cpp:7021 */ void CSprayCan::__MAKE_VHOOK(Think)() { TraceResult tr; @@ -5872,7 +5695,6 @@ void CSprayCan::__MAKE_VHOOK(Think)() pev->nextthink = gpGlobals->time + 0.1; } -/* <157481> ../cstrike/dlls/player.cpp:7064 */ void CBloodSplat::Spawn(entvars_t *pevOwner) { pev->origin = pevOwner->origin + Vector(0, 0, 32); @@ -5883,7 +5705,6 @@ void CBloodSplat::Spawn(entvars_t *pevOwner) pev->nextthink = gpGlobals->time + 0.1; } -/* <151758> ../cstrike/dlls/player.cpp:7074 */ void CBloodSplat::Spray() { TraceResult tr; @@ -5898,7 +5719,6 @@ void CBloodSplat::Spray() pev->nextthink = gpGlobals->time + 0.1; } -/* <1574d3> ../cstrike/dlls/player.cpp:7093 */ void CBasePlayer::GiveNamedItem(const char *pszName) { string_t istr = MAKE_STRING(pszName); @@ -5910,14 +5730,13 @@ void CBasePlayer::GiveNamedItem(const char *pszName) return; } - VARS(pent)->origin = pev->origin; + pent->v.origin = pev->origin; pent->v.spawnflags |= SF_NORESPAWN; DispatchSpawn(pent); DispatchTouch(pent, ENT(pev)); } -/* <157568> ../cstrike/dlls/player.cpp:7114 */ CBaseEntity *FindEntityForward(CBaseEntity *pMe) { TraceResult tr; @@ -5934,13 +5753,11 @@ CBaseEntity *FindEntityForward(CBaseEntity *pMe) return NULL; } -/* <15777b> ../cstrike/dlls/player.cpp:7129 */ BOOL CBasePlayer::FlashlightIsOn() { return pev->effects & EF_DIMLIGHT; } -/* <15779e> ../cstrike/dlls/player.cpp:7135 */ void CBasePlayer::FlashlightTurnOn() { if (!g_pGameRules->FAllowFlashlight()) @@ -5961,7 +5778,6 @@ void CBasePlayer::FlashlightTurnOn() } } -/* <157816> ../cstrike/dlls/player.cpp:7157 */ void CBasePlayer::FlashlightTurnOff() { EMIT_SOUND(ENT(pev), CHAN_ITEM, SOUND_FLASHLIGHT_OFF, VOL_NORM, ATTN_NORM); @@ -5975,7 +5791,6 @@ void CBasePlayer::FlashlightTurnOff() m_flFlashLightTime = gpGlobals->time + FLASH_CHARGE_TIME; } -/* <158ae7> ../cstrike/dlls/player.cpp:7179 */ void CBasePlayer::ForceClientDllUpdate() { m_iClientHealth = -1; @@ -5988,7 +5803,6 @@ void CBasePlayer::ForceClientDllUpdate() HandleSignals(); } -/* <157f8d> ../cstrike/dlls/player.cpp:7202 */ void CBasePlayer::__MAKE_VHOOK(ImpulseCommands)() { TraceResult tr; @@ -6062,7 +5876,6 @@ void CBasePlayer::__MAKE_VHOOK(ImpulseCommands)() pev->impulse = 0; } -/* <15786e> ../cstrike/dlls/player.cpp:7280 */ void CBasePlayer::CheatImpulseCommands(int iImpulse) { if (!g_flWeaponCheat) @@ -6241,7 +6054,6 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) } } -/* <158256> ../cstrike/dlls/player.cpp:7474 */ void OLD_CheckBuyZone(CBasePlayer *player) { const char *pszSpawnClass = NULL; @@ -6263,7 +6075,6 @@ void OLD_CheckBuyZone(CBasePlayer *player) } } -/* <14e5a9> ../cstrike/dlls/player.cpp:7514 */ void OLD_CheckBombTarget(CBasePlayer *player) { CBaseEntity *pSpot = NULL; @@ -6274,7 +6085,6 @@ void OLD_CheckBombTarget(CBasePlayer *player) } } -/* <14e5d5> ../cstrike/dlls/player.cpp:7532 */ void OLD_CheckRescueZone(CBasePlayer *player) { CBaseEntity *pSpot = NULL; @@ -6285,20 +6095,17 @@ void OLD_CheckRescueZone(CBasePlayer *player) } } -/* <1582e9> ../cstrike/dlls/player.cpp:7553 */ void CBasePlayer::HandleSignals() { - CHalfLifeMultiplay *mp = g_pGameRules; - - if (mp->IsMultiplayer()) + if (CSGameRules()->IsMultiplayer()) { - if (!mp->m_bMapHasBuyZone) + if (!CSGameRules()->m_bMapHasBuyZone) OLD_CheckBuyZone(this); - if (!mp->m_bMapHasBombZone) + if (!CSGameRules()->m_bMapHasBombZone) OLD_CheckBombTarget(this); - if (!mp->m_bMapHasRescueZone) + if (!CSGameRules()->m_bMapHasRescueZone) OLD_CheckRescueZone(this); } @@ -6345,8 +6152,6 @@ void CBasePlayer::HandleSignals() } // Add a weapon to the player (Item == Weapon == Selectable Object) - -/* <15325f> ../cstrike/dlls/player.cpp:7625 */ BOOL CBasePlayer::__MAKE_VHOOK(AddPlayerItem)(CBasePlayerItem *pItem) { CBasePlayerItem *pInsert = m_rgpPlayerItems[ pItem->iItemSlot() ]; @@ -6409,7 +6214,6 @@ BOOL CBasePlayer::__MAKE_VHOOK(AddPlayerItem)(CBasePlayerItem *pItem) return FALSE; } -/* <1534bd> ../cstrike/dlls/player.cpp:7692 */ BOOL CBasePlayer::__MAKE_VHOOK(RemovePlayerItem)(CBasePlayerItem *pItem) { if (m_pActiveItem == pItem) @@ -6436,17 +6240,16 @@ BOOL CBasePlayer::__MAKE_VHOOK(RemovePlayerItem)(CBasePlayerItem *pItem) while (pPrev && pPrev->m_pNext != pItem) pPrev = pPrev->m_pNext; - if (pPrev) + if (pPrev != NULL) { pPrev->m_pNext = pItem->m_pNext; return TRUE; } + return FALSE; } // Returns the unique ID for the ammo, or -1 if error - -/* <15997b> ../cstrike/dlls/player.cpp:7731 */ int CBasePlayer::__MAKE_VHOOK(GiveAmmo)(int iCount, char *szName, int iMax) { if (pev->flags & FL_SPECTATOR) @@ -6465,7 +6268,6 @@ int CBasePlayer::__MAKE_VHOOK(GiveAmmo)(int iCount, char *szName, int iMax) } int i = GetAmmoIndex(szName); - if (i < 0 || i >= MAX_AMMO_SLOTS) return -1; @@ -6484,14 +6286,12 @@ int CBasePlayer::__MAKE_VHOOK(GiveAmmo)(int iCount, char *szName, int iMax) WRITE_BYTE(iAdd); // amount MESSAGE_END(); } - TabulateAmmo(); + TabulateAmmo(); return i; } // Called every frame by the player PreThink - -/* <158b10> ../cstrike/dlls/player.cpp:7784 */ void CBasePlayer::ItemPreFrame() { #ifdef CLIENT_WEAPONS @@ -6500,7 +6300,7 @@ void CBasePlayer::ItemPreFrame() #else if (gpGlobals->time < m_flNextAttack) return; -#endif // CLIENT_WEAPONS +#endif if (!m_pActiveItem) return; @@ -6509,8 +6309,6 @@ void CBasePlayer::ItemPreFrame() } // Called every frame by the player PostThink - -/* <158b33> ../cstrike/dlls/player.cpp:7805 */ void CBasePlayer::ItemPostFrame() { static int fInSelect = FALSE; @@ -6532,7 +6330,7 @@ void CBasePlayer::ItemPostFrame() if (m_flNextAttack > 0) #else if (gpGlobals->time < m_flNextAttack) -#endif // CLIENT_WEAPONS +#endif return; ImpulseCommands(); @@ -6541,7 +6339,6 @@ void CBasePlayer::ItemPostFrame() m_pActiveItem->ItemPostFrame(); } -/* <158b71> ../cstrike/dlls/player.cpp:7834 */ int CBasePlayer::AmmoInventory(int iAmmoIndex) { if (iAmmoIndex == -1) @@ -6550,7 +6347,6 @@ int CBasePlayer::AmmoInventory(int iAmmoIndex) return m_rgAmmo[iAmmoIndex]; } -/* <158b9d> ../cstrike/dlls/player.cpp:7844 */ int CBasePlayer::GetAmmoIndex(const char *psz) { if (!psz) @@ -6564,10 +6360,10 @@ int CBasePlayer::GetAmmoIndex(const char *psz) if (!Q_stricmp(psz, IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName)) return i; } + return -1; } -/* <158bf7> ../cstrike/dlls/player.cpp:7865 */ void CBasePlayer::SendAmmoUpdate() { for (int i = 0; i < MAX_AMMO_SLOTS; ++i) @@ -6585,7 +6381,6 @@ void CBasePlayer::SendAmmoUpdate() } } -/* <158d4b> ../cstrike/dlls/player.cpp:7885 */ void CBasePlayer::SendHostagePos() { CBaseEntity *pHostage = NULL; @@ -6604,7 +6399,6 @@ void CBasePlayer::SendHostagePos() SendHostageIcons(); } -/* <158c66> ../cstrike/dlls/player.cpp:7908 */ void CBasePlayer::SendHostageIcons() { CBaseEntity *pHostage = NULL; @@ -6617,31 +6411,30 @@ void CBasePlayer::SendHostageIcons() while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")) != NULL) { if (pHostage && pHostage->pev->deadflag == DEAD_NO) - numHostages++; + ++numHostages; } - if (numHostages > 4) - numHostages = 4; + if (numHostages > MAX_HOSTAGE_ICON) + numHostages = MAX_HOSTAGE_ICON; Q_snprintf(buf, ARRAYSIZE(buf), "hostage%d", numHostages); if (numHostages) { MESSAGE_BEGIN(MSG_ONE, gmsgScenarioIcon, NULL, pev); - WRITE_BYTE(1); - WRITE_STRING(buf); + WRITE_BYTE(1); // active + WRITE_STRING(buf); // sprite WRITE_BYTE(0); MESSAGE_END(); } else { MESSAGE_BEGIN(MSG_ONE, gmsgScenarioIcon, NULL, pev); - WRITE_BYTE(0); + WRITE_BYTE(0); // active MESSAGE_END(); } } -/* <158dc6> ../cstrike/dlls/player.cpp:7949 */ void CBasePlayer::SendWeatherInfo() { CBaseEntity *pPoint = UTIL_FindEntityByClassname(NULL, "env_rain"); @@ -6650,7 +6443,7 @@ void CBasePlayer::SendWeatherInfo() if (pPoint != NULL || pPoint2 != NULL) { MESSAGE_BEGIN(MSG_ONE, gmsgReceiveW, NULL, pev); - WRITE_BYTE(1); + WRITE_BYTE(1); // rainy weather MESSAGE_END(); } else @@ -6661,7 +6454,7 @@ void CBasePlayer::SendWeatherInfo() if (pPoint != NULL || pPoint2 != NULL) { MESSAGE_BEGIN(MSG_ONE, gmsgReceiveW, NULL, pev); - WRITE_BYTE(2); + WRITE_BYTE(2); // snowy weather MESSAGE_END(); } } @@ -6672,8 +6465,6 @@ void CBasePlayer::SendWeatherInfo() // Also called at start of demo recording and playback by // ForceClientDllUpdate to ensure the demo gets messages // reflecting all of the HUD state info. - -/* <159d3c> ../cstrike/dlls/player.cpp:7963 */ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() { if (m_fInitHUD) @@ -6685,8 +6476,6 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() MESSAGE_BEGIN(MSG_ONE, gmsgResetHUD, NULL, pev); MESSAGE_END(); - CHalfLifeMultiplay *mp = g_pGameRules; - if (!m_fGameHUDInitialized) { MESSAGE_BEGIN(MSG_ONE, gmsgInitHUD, NULL, pev); @@ -6694,13 +6483,13 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() CBaseEntity *pEntity = UTIL_FindEntityByClassname(NULL, "env_fog"); - if (pEntity) + if (pEntity != NULL) { - CClientFog *pFog = (CClientFog *)pEntity; + CClientFog *pFog = static_cast(pEntity); - int r = clamp((int)pFog->pev->rendercolor[0], 0, 255); - int g = clamp((int)pFog->pev->rendercolor[1], 0, 255); - int b = clamp((int)pFog->pev->rendercolor[2], 0, 255); + int r = clamp(int(pFog->pev->rendercolor[0]), 0, 255); + int g = clamp(int(pFog->pev->rendercolor[1]), 0, 255); + int b = clamp(int(pFog->pev->rendercolor[2]), 0, 255); union { @@ -6722,10 +6511,10 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() MESSAGE_END(); } - mp->InitHUD(this); + g_pGameRules->InitHUD(this); m_fGameHUDInitialized = TRUE; - if (mp->IsMultiplayer()) + if (g_pGameRules->IsMultiplayer()) { FireTargets("game_playerjoin", this, this, USE_TOGGLE, 0); } @@ -6759,16 +6548,16 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() SendHostagePos(); SendWeatherInfo(); - if (mp->IsMultiplayer()) + if (g_pGameRules->IsMultiplayer()) { MESSAGE_BEGIN(MSG_ONE, gmsgTeamScore, NULL, pev); WRITE_STRING(GetTeam(CT)); - WRITE_SHORT(mp->m_iNumCTWins); + WRITE_SHORT(CSGameRules()->m_iNumCTWins); MESSAGE_END(); MESSAGE_BEGIN(MSG_ONE, gmsgTeamScore, NULL, pev); WRITE_STRING(GetTeam(TERRORIST)); - WRITE_SHORT(mp->m_iNumTerroristWins); + WRITE_SHORT(CSGameRules()->m_iNumTerroristWins); MESSAGE_END(); } } @@ -6807,9 +6596,9 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() gDisplayTitle = FALSE; } - if ((int)pev->health != m_iClientHealth) + if (int(pev->health) != m_iClientHealth) { - int iHealth = clamp((int)pev->health, 0, 255); + int iHealth = clamp(int(pev->health), 0, 255); if (pev->health > 0.0f && pev->health <= 1.0f) iHealth = 1; @@ -6819,18 +6608,18 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() WRITE_BYTE(iHealth); MESSAGE_END(); - m_iClientHealth = (int)pev->health; + m_iClientHealth = int(pev->health); } - if ((int)pev->armorvalue != m_iClientBattery) + if (int(pev->armorvalue) != m_iClientBattery) { - m_iClientBattery = (int)pev->armorvalue; + m_iClientBattery = int(pev->armorvalue); assert(gmsgBattery > 0); // send "armor" update message MESSAGE_BEGIN(MSG_ONE, gmsgBattery, NULL, pev); - WRITE_SHORT((int)pev->armorvalue); + WRITE_SHORT(int(pev->armorvalue)); MESSAGE_END(); } @@ -6847,7 +6636,7 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() { CBaseEntity *pEntity = CBaseEntity::Instance(other); - if (pEntity) + if (pEntity != NULL) { damageOrigin = pEntity->Center(); } @@ -6857,8 +6646,8 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() int visibleDamageBits = m_bitsDamageType & DMG_SHOWNHUD; MESSAGE_BEGIN(MSG_ONE, gmsgDamage, NULL, pev); - WRITE_BYTE((int)pev->dmg_save); - WRITE_BYTE((int)pev->dmg_take); + WRITE_BYTE(int(pev->dmg_save)); + WRITE_BYTE(int(pev->dmg_take)); WRITE_LONG(visibleDamageBits); WRITE_COORD(damageOrigin.x); WRITE_COORD(damageOrigin.y); @@ -6881,9 +6670,8 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() if (m_iFlashBattery) { m_flFlashLightTime = gpGlobals->time + FLASH_DRAIN_TIME; - m_iFlashBattery--; - if (!m_iFlashBattery) + if (--m_iFlashBattery <= 0) { FlashlightTurnOff(); } @@ -6937,18 +6725,18 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() if (m_flNextSBarUpdateTime < gpGlobals->time) { UpdateStatusBar(); - m_flNextSBarUpdateTime = gpGlobals->time + 0.2; + m_flNextSBarUpdateTime = gpGlobals->time + 0.2f; } if (!(m_flDisplayHistory & DHF_AMMO_EXHAUSTED)) { if (m_pActiveItem && m_pActiveItem->IsWeapon()) { - CBasePlayerWeapon *w = (CBasePlayerWeapon *)m_pActiveItem; + CBasePlayerWeapon *weapon = static_cast(m_pActiveItem); - if (!(w->iFlags() & ITEM_FLAG_EXHAUSTIBLE)) + if (!(weapon->iFlags() & ITEM_FLAG_EXHAUSTIBLE)) { - if (AmmoInventory(w->m_iPrimaryAmmoType) < 1 && w->m_iClip == 0) + if (AmmoInventory(weapon->m_iPrimaryAmmoType) < 1 && weapon->m_iClip == 0) { m_flDisplayHistory |= DHF_AMMO_EXHAUSTED; HintMessage("#Hint_out_of_ammo"); @@ -6971,9 +6759,10 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() #ifdef REGAMEDLL_ADD if (friendlyfire.string[0] == '2') vecOrigin = g_vecZero; -#endif // REGAMEDLL_ADD +#endif - if ((pev->origin - m_vLastOrigin).Length() >= 64) + const float flToleranceDist = 64.0f; + if ((pev->origin - m_vLastOrigin).Length() >= flToleranceDist) { for (int i = 1; i <= gpGlobals->maxClients; ++i) { @@ -7006,28 +6795,23 @@ void CBasePlayer::__MAKE_VHOOK(UpdateClientData)() } } -/* <1510bc> ../cstrike/dlls/player.cpp:8330 */ BOOL CBasePlayer::__MAKE_VHOOK(FBecomeProne)() { m_afPhysicsFlags |= PFLAG_ONBARNACLE; return TRUE; } -/* <158e8a> ../cstrike/dlls/player.cpp:8341 */ NOXREF void CBasePlayer::BarnacleVictimBitten(entvars_t *pevBarnacle) { TakeDamage(pevBarnacle, pevBarnacle, pev->armorvalue + pev->health, DMG_SLASH | DMG_ALWAYSGIB); } -/* <158ec3> ../cstrike/dlls/player.cpp:8350 */ NOXREF void CBasePlayer::BarnacleVictimReleased() { m_afPhysicsFlags &= ~PFLAG_ONBARNACLE; } // return player light level plus virtual muzzle flash - -/* <1510e4> ../cstrike/dlls/player.cpp:8360 */ int CBasePlayer::__MAKE_VHOOK(Illumination)() { int iIllum = CBaseEntity::Illumination(); @@ -7040,7 +6824,6 @@ int CBasePlayer::__MAKE_VHOOK(Illumination)() return iIllum; } -/* <158eeb> ../cstrike/dlls/player.cpp:8371 */ void CBasePlayer::EnableControl(BOOL fControl) { if (!fControl) @@ -7049,7 +6832,6 @@ void CBasePlayer::EnableControl(BOOL fControl) pev->flags &= ~FL_FROZEN; } -/* <151142> ../cstrike/dlls/player.cpp:8387 */ void CBasePlayer::__MAKE_VHOOK(ResetMaxSpeed)() { float speed; @@ -7083,7 +6865,6 @@ void CBasePlayer::__MAKE_VHOOK(ResetMaxSpeed)() pev->maxspeed = speed; } -/* <158f23> ../cstrike/dlls/player.cpp:8436 */ bool CBasePlayer::HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead, BOOL bOverride) { if (!bDisplayIfPlayerDead && !IsAlive()) @@ -7095,7 +6876,6 @@ bool CBasePlayer::HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead, B return true; } -/* <1513f7> ../cstrike/dlls/player.cpp:8473 */ Vector CBasePlayer::__MAKE_VHOOK(GetAutoaimVector)(float flDelta) { Vector vecSrc; @@ -7161,14 +6941,12 @@ Vector CBasePlayer::__MAKE_VHOOK(GetAutoaimVector)(float flDelta) return gpGlobals->v_forward; } -/* <158f62> ../cstrike/dlls/player.cpp:8553 */ Vector CBasePlayer::AutoaimDeflection(Vector &vecSrc, float flDist, float flDelta) { m_fOnTarget = FALSE; return g_vecZero; } -/* <158fc1> ../cstrike/dlls/player.cpp:8686 */ void CBasePlayer::ResetAutoaim() { if (m_vecAutoAim.x != 0.0f || m_vecAutoAim.y != 0.0f) @@ -7181,8 +6959,6 @@ void CBasePlayer::ResetAutoaim() // UNDONE: Determine real frame limit, 8 is a placeholder. // Note: -1 means no custom frames present. - -/* <158ff6> ../cstrike/dlls/player.cpp:8704 */ void CBasePlayer::SetCustomDecalFrames(int nFrames) { if (nFrames > 0 && nFrames < 8) @@ -7192,14 +6968,11 @@ void CBasePlayer::SetCustomDecalFrames(int nFrames) } // Returns the # of custom frames this player's custom clan logo contains. - -/* <15902e> ../cstrike/dlls/player.cpp:8720 */ int CBasePlayer::GetCustomDecalFrames() { return m_nCustomSprayFrames; } -/* <151183> ../cstrike/dlls/player.cpp:8731 */ void CBasePlayer::__MAKE_VHOOK(Blind)(float duration, float holdTime, float fadeTime, int alpha) { m_blindUntilTime = gpGlobals->time + duration; @@ -7210,14 +6983,12 @@ void CBasePlayer::__MAKE_VHOOK(Blind)(float duration, float holdTime, float fade m_blindAlpha = alpha; } -/* <159051> ../cstrike/dlls/player.cpp:8741 */ void CBasePlayer::InitStatusBar() { m_flStatusBarDisappearDelay = 0.0f; m_SbarString0[0] = '\0'; } -/* <159079> ../cstrike/dlls/player.cpp:8749 */ void CBasePlayer::UpdateStatusBar() { int newSBarState[ SBAR_END ]; @@ -7256,7 +7027,7 @@ void CBasePlayer::UpdateStatusBar() else Q_strcpy(sbuf0, " "); - newSBarState[ SBAR_ID_TARGETHEALTH ] = (int)((pEntity->pev->health / pEntity->pev->max_health) * 100); + newSBarState[ SBAR_ID_TARGETHEALTH ] = int((pEntity->pev->health / pEntity->pev->max_health) * 100); if (!(m_flDisplayHistory & DHF_FRIEND_SEEN) && !(pev->flags & FL_SPECTATOR)) { @@ -7288,7 +7059,7 @@ void CBasePlayer::UpdateStatusBar() Q_strcpy(sbuf0, " "); newSBarState[ SBAR_ID_TARGETTYPE ] = SBAR_TARGETTYPE_HOSTAGE; - newSBarState[ SBAR_ID_TARGETHEALTH ] = (int)((pEntity->pev->health / pEntity->pev->max_health) * 100); + newSBarState[ SBAR_ID_TARGETHEALTH ] = int((pEntity->pev->health / pEntity->pev->max_health) * 100); if (!(m_flDisplayHistory & DHF_HOSTAGE_SEEN_FAR) && tr.flFraction > 0.1f) { @@ -7318,9 +7089,9 @@ void CBasePlayer::UpdateStatusBar() newSBarState[ SBAR_ID_TARGETHEALTH ] = m_izSBarState[ SBAR_ID_TARGETHEALTH ]; } - BOOL bForceResend = FALSE; + bool bForceResend = false; - if (Q_strcmp(sbuf0, m_SbarString0)) + if (Q_strcmp(sbuf0, m_SbarString0) != 0) { MESSAGE_BEGIN(MSG_ONE, gmsgStatusText, NULL, pev); WRITE_BYTE(0); @@ -7330,7 +7101,7 @@ void CBasePlayer::UpdateStatusBar() Q_strcpy(m_SbarString0, sbuf0); // make sure everything's resent - bForceResend = TRUE; + bForceResend = true; } // Check values and send if they don't match @@ -7348,7 +7119,6 @@ void CBasePlayer::UpdateStatusBar() } } -/* <1603f0> ../cstrike/dlls/player.cpp:8926 */ void CBasePlayer::DropPlayerItem(const char *pszItemName) { if (!Q_strlen(pszItemName)) @@ -7413,17 +7183,12 @@ void CBasePlayer::DropPlayerItem(const char *pszItemName) SetBombIcon(FALSE); pWeapon->m_pPlayer->SetProgressBarTime(0); - if (!g_pGameRules->m_fTeamCount) + if (!CSGameRules()->m_fTeamCount) { - UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Dropped_The_Bomb\"\n", - STRING(pev->netname), - GETPLAYERUSERID(edict()), - GETPLAYERAUTHID(edict())); - + UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Dropped_The_Bomb\"\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict())); g_pGameRules->m_bBombDropped = TRUE; CBaseEntity *pEntity = NULL; - while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL) { if (FNullEnt(pEntity->edict())) @@ -7464,9 +7229,9 @@ void CBasePlayer::DropPlayerItem(const char *pszItemName) { pWeaponBox->m_bIsBomb = true; pWeaponBox->SetThink(&CWeaponBox::BombThink); - pWeaponBox->pev->nextthink = gpGlobals->time + 1; + pWeaponBox->pev->nextthink = gpGlobals->time + 1.0f; - if (TheBots != NULL) + if (TheCSBots() != NULL) { // tell the bots about the dropped bomb TheCSBots()->SetLooseBomb(pWeaponBox); @@ -7497,7 +7262,6 @@ void CBasePlayer::DropPlayerItem(const char *pszItemName) } } -/* <1594a2> ../cstrike/dlls/player.cpp:9094 */ BOOL CBasePlayer::HasPlayerItem(CBasePlayerItem *pCheckItem) { CBasePlayerItem *pItem = m_rgpPlayerItems[ pCheckItem->iItemSlot() ]; @@ -7508,16 +7272,15 @@ BOOL CBasePlayer::HasPlayerItem(CBasePlayerItem *pCheckItem) pItem = pItem->m_pNext; } + return FALSE; } -/* <159534> ../cstrike/dlls/player.cpp:9113 */ BOOL CBasePlayer::HasNamedPlayerItem(const char *pszItemName) { CBasePlayerItem *pItem; - int i; - for (i = 0; i < MAX_ITEM_TYPES; ++i) + for (int i = 0; i < MAX_ITEM_TYPES; ++i) { pItem = m_rgpPlayerItems[ i ]; @@ -7533,7 +7296,6 @@ BOOL CBasePlayer::HasNamedPlayerItem(const char *pszItemName) return FALSE; } -/* <1619fd> ../cstrike/dlls/player.cpp:9137 */ void CBasePlayer::SwitchTeam() { int oldTeam; @@ -7686,15 +7448,7 @@ void CBasePlayer::SwitchTeam() szOldTeam = GetTeam(oldTeam); szNewTeam = GetTeam(m_iTeam); - UTIL_LogPrintf - ( - "\"%s<%i><%s><%s>\" joined team \"%s\" (auto)\n", - STRING(pev->netname), - GETPLAYERUSERID(edict()), - GETPLAYERAUTHID(edict()), - szOldTeam, - szNewTeam - ); + UTIL_LogPrintf("\"%s<%i><%s><%s>\" joined team \"%s\" (auto)\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), szOldTeam, szNewTeam); CCSBot *pBot = static_cast(this); @@ -7704,15 +7458,15 @@ void CBasePlayer::SwitchTeam() if (pProfile != NULL) { - bool kick = false; + bool bKick = false; if (m_iTeam == CT && !pProfile->IsValidForTeam(BOT_TEAM_CT)) - kick = true; + bKick = true; else if (m_iTeam == TERRORIST && !pProfile->IsValidForTeam(BOT_TEAM_T)) - kick = true; + bKick = true; - if (kick) + if (bKick) { SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", STRING(pev->netname))); } @@ -7720,7 +7474,6 @@ void CBasePlayer::SwitchTeam() } } -/* <159594> ../cstrike/dlls/player.cpp:9302 */ void CBasePlayer::UpdateShieldCrosshair(bool draw) { if (draw) @@ -7729,7 +7482,6 @@ void CBasePlayer::UpdateShieldCrosshair(bool draw) m_iHideHUD |= HIDEHUD_CROSSHAIR; } -/* <152fbc> ../cstrike/dlls/player.cpp:9313 */ BOOL CBasePlayer::SwitchWeapon(CBasePlayerItem *pWeapon) { if (!pWeapon->CanDeploy()) @@ -7739,7 +7491,7 @@ BOOL CBasePlayer::SwitchWeapon(CBasePlayerItem *pWeapon) ResetAutoaim(); - if (m_pActiveItem) + if (m_pActiveItem != NULL) { m_pActiveItem->Holster(); } @@ -7749,7 +7501,7 @@ BOOL CBasePlayer::SwitchWeapon(CBasePlayerItem *pWeapon) m_pLastItem = pTemp; pWeapon->Deploy(); - if (pWeapon->m_pPlayer) + if (pWeapon->m_pPlayer != NULL) { pWeapon->m_pPlayer->ResetMaxSpeed(); } @@ -7762,7 +7514,6 @@ BOOL CBasePlayer::SwitchWeapon(CBasePlayerItem *pWeapon) return TRUE; } -/* <1595ed> ../cstrike/dlls/player.cpp:9342 */ void CBasePlayer::TabulateAmmo() { ammo_buckshot = AmmoInventory(GetAmmoIndex("buckshot")); @@ -7777,13 +7528,11 @@ void CBasePlayer::TabulateAmmo() ammo_357sig = AmmoInventory(GetAmmoIndex("357SIG")); } -/* <1511eb> ../cstrike/dlls/player.cpp:9365 */ int CDeadHEV::__MAKE_VHOOK(Classify)() { return CLASS_HUMAN_MILITARY; } -/* <152451> ../cstrike/dlls/player.cpp:9375 */ void CDeadHEV::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "pose")) @@ -7795,10 +7544,8 @@ void CDeadHEV::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseMonster::KeyValue(pkvd); } -/* <159a88> ../cstrike/dlls/player.cpp:9386 */ LINK_ENTITY_TO_CLASS(monster_hevsuit_dead, CDeadHEV); -/* <1513ce> ../cstrike/dlls/player.cpp:9391 */ void CDeadHEV::__MAKE_VHOOK(Spawn)() { PRECACHE_MODEL("models/player.mdl"); @@ -7824,15 +7571,13 @@ void CDeadHEV::__MAKE_VHOOK(Spawn)() MonsterInitDead(); } -/* <159b64> ../cstrike/dlls/player.cpp:9426 */ LINK_ENTITY_TO_CLASS(player_weaponstrip, CStripWeapons); -/* <15f62f> ../cstrike/dlls/player.cpp:9428 */ void CStripWeapons::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { CBasePlayer *pPlayer = NULL; - if (pActivator && pActivator->IsPlayer()) + if (pActivator != NULL && pActivator->IsPlayer()) { pPlayer = (CBasePlayer *)pActivator; } @@ -7841,19 +7586,15 @@ void CStripWeapons::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal pPlayer = (CBasePlayer *)Instance(INDEXENT(1)); } - if (pPlayer) + if (pPlayer != NULL) { pPlayer->RemoveAllItems(FALSE); } } -/* <159c40> ../cstrike/dlls/player.cpp:9473 */ LINK_ENTITY_TO_CLASS(player_loadsaved, CRevertSaved); - -/* <151a24> ../cstrike/dlls/player.cpp:9481 */ IMPLEMENT_SAVERESTORE(CRevertSaved, CPointEntity); -/* <152540> ../cstrike/dlls/player.cpp:9483 */ void CRevertSaved::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "duration")) @@ -7880,15 +7621,13 @@ void CRevertSaved::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <151365> ../cstrike/dlls/player.cpp:9509 */ void CRevertSaved::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { - UTIL_ScreenFadeAll(pev->rendercolor, Duration(), HoldTime(), (int)pev->renderamt, FFADE_OUT); + UTIL_ScreenFadeAll(pev->rendercolor, Duration(), HoldTime(), int(pev->renderamt), FFADE_OUT); pev->nextthink = gpGlobals->time + MessageTime(); SetThink(&CRevertSaved::MessageThink); } -/* <152a96> ../cstrike/dlls/player.cpp:9517 */ void CRevertSaved::MessageThink() { float nextThink = LoadTime() - MessageTime(); @@ -7903,14 +7642,12 @@ void CRevertSaved::MessageThink() LoadThink(); } -/* <15198b> ../cstrike/dlls/player.cpp:9531 */ void CRevertSaved::LoadThink() { if (!gpGlobals->deathmatch) SERVER_COMMAND("reload\n"); } -/* <15133c> ../cstrike/dlls/player.cpp:9549 */ void CInfoIntermission::__MAKE_VHOOK(Spawn)() { UTIL_SetOrigin(pev, pev->origin); @@ -7918,10 +7655,9 @@ void CInfoIntermission::__MAKE_VHOOK(Spawn)() pev->solid = SOLID_NOT; pev->effects = EF_NODRAW; pev->v_angle = g_vecZero; - pev->nextthink = gpGlobals->time + 2; + pev->nextthink = gpGlobals->time + 2.0f; } -/* <1530e6> ../cstrike/dlls/player.cpp:9560 */ void CInfoIntermission::__MAKE_VHOOK(Think)() { edict_t *pTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->target)); @@ -7933,10 +7669,8 @@ void CInfoIntermission::__MAKE_VHOOK(Think)() } } -/* <159d1c> ../cstrike/dlls/player.cpp:9574 */ LINK_ENTITY_TO_CLASS(info_intermission, CInfoIntermission); -/* <159df8> ../cstrike/dlls/player.cpp:9586 */ void CBasePlayer::StudioEstimateGait() { float_precision dt; @@ -7972,9 +7706,9 @@ void CBasePlayer::StudioEstimateGait() if (!est_velocity.x && !est_velocity.y) { float_precision flYawDiff = pev->angles.y - m_flGaityaw; - float_precision flYaw = fmod(flYawDiff, 360); + float_precision flYaw = Q_fmod(flYawDiff, 360); - flYawDiff = flYawDiff - (int64_t)(flYawDiff / 360) * 360; + flYawDiff = flYawDiff - int64(flYawDiff / 360) * 360; if (flYawDiff > 180) flYawDiff -= 360; @@ -7989,27 +7723,27 @@ void CBasePlayer::StudioEstimateGait() flYaw -= 360; if (flYaw > -5 && flYaw < 5) - m_flYawModifier = 0.05; + m_flYawModifier = 0.05f; if (flYaw < -90 || flYaw > 90) - m_flYawModifier = 3.5; + m_flYawModifier = 3.5f; - if (dt < 0.25) + if (dt < 0.25f) flYawDiff *= dt * m_flYawModifier; else flYawDiff *= dt; - if ((float_precision)abs((int64_t)flYawDiff) < 0.1) + if (float_precision(Q_abs(int64(flYawDiff))) < 0.1f) flYawDiff = 0; m_flGaityaw += flYawDiff; - m_flGaityaw -= (int64_t)(m_flGaityaw / 360) * 360; + m_flGaityaw -= int64(m_flGaityaw / 360) * 360; m_flGaitMovement = 0; } else { - m_flGaityaw = (atan2((float_precision)est_velocity.y, (float_precision)est_velocity.x) * 180 / M_PI); + m_flGaityaw = (Q_atan2(float_precision(est_velocity.y), float_precision(est_velocity.x)) * 180 / M_PI); if (m_flGaityaw > 180) m_flGaityaw = 180; @@ -8019,11 +7753,10 @@ void CBasePlayer::StudioEstimateGait() } } -/* <159f01> ../cstrike/dlls/player.cpp:9685 */ void CBasePlayer::StudioPlayerBlend(int *pBlend, float *pPitch) { // calc up/down pointing - float range = (float)(int64_t)(*pPitch * 3.0f); + float range = float(int64(*pPitch * 3.0f)); *pBlend = range; @@ -8039,12 +7772,11 @@ void CBasePlayer::StudioPlayerBlend(int *pBlend, float *pPitch) } else { - *pBlend = (int64_t)((45.0f - range) * (255.0f / 90.0f)); + *pBlend = int64((45.0f - range) * (255.0f / 90.0f)); *pPitch = 0; } } -/* <159f81> ../cstrike/dlls/player.cpp:9709 */ void CBasePlayer::CalculatePitchBlend() { int iBlend; @@ -8056,7 +7788,6 @@ void CBasePlayer::CalculatePitchBlend() m_flPitch = iBlend; } -/* <15a007> ../cstrike/dlls/player.cpp:9720 */ void CBasePlayer::CalculateYawBlend() { float dt; @@ -8067,16 +7798,16 @@ void CBasePlayer::CalculateYawBlend() dt = gpGlobals->frametime; - if (dt < 0.0) + if (dt < 0.0f) dt = 0; - else if (dt > 1.0) + else if (dt > 1.0f) dt = 1; StudioEstimateGait(); // calc side to side turning - flYaw = fmod((float_precision)(pev->angles.y - m_flGaityaw), 360); + flYaw = Q_fmod(float_precision(pev->angles.y - m_flGaityaw), 360); if (flYaw < -180) flYaw += 360; @@ -8110,11 +7841,10 @@ void CBasePlayer::CalculateYawBlend() blend_yaw = maxyaw - flYaw; - pev->blending[0] = (int64_t)blend_yaw; + pev->blending[0] = int64(blend_yaw); m_flYaw = blend_yaw; } -/* <15a07b> ../cstrike/dlls/player.cpp:9776 */ void CBasePlayer::StudioProcessGait() { mstudioseqdesc_t *pseqdesc; @@ -8129,13 +7859,11 @@ void CBasePlayer::StudioProcessGait() CalculateYawBlend(); CalculatePitchBlend(); - model_t *model = (model_t *)GET_MODEL_PTR(edict()); + studiohdr_t *pstudiohdr = (studiohdr_t *)GET_MODEL_PTR(edict()); - if (!model) + if (!pstudiohdr) return; - studiohdr_t *pstudiohdr = (studiohdr_t *)model; - pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + pev->gaitsequence; // calc gait frame @@ -8145,13 +7873,12 @@ void CBasePlayer::StudioProcessGait() m_flGaitframe += pev->framerate * pseqdesc->fps * dt; // do modulo - m_flGaitframe -= (int)(m_flGaitframe / pseqdesc->numframes) * pseqdesc->numframes; + m_flGaitframe -= int(m_flGaitframe / pseqdesc->numframes) * pseqdesc->numframes; if (m_flGaitframe < 0) m_flGaitframe += pseqdesc->numframes; } -/* <15a444> ../cstrike/dlls/player.cpp:9821 */ void CBasePlayer::ResetStamina() { pev->fuser1 = 0; @@ -8159,7 +7886,6 @@ void CBasePlayer::ResetStamina() pev->fuser2 = 0; } -/* <15a467> ../cstrike/dlls/player.cpp:9829 */ float_precision GetPlayerPitch(const edict_t *pEdict) { entvars_t *pev = VARS(const_cast(pEdict)); @@ -8171,7 +7897,6 @@ float_precision GetPlayerPitch(const edict_t *pEdict) return pPlayer->m_flPitch; } -/* <15a530> ../cstrike/dlls/player.cpp:9846 */ float_precision GetPlayerYaw(const edict_t *pEdict) { entvars_t *pev = VARS(const_cast(pEdict)); @@ -8183,7 +7908,6 @@ float_precision GetPlayerYaw(const edict_t *pEdict) return pPlayer->m_flYaw; } -/* <15a5f9> ../cstrike/dlls/player.cpp:9863 */ int GetPlayerGaitsequence(const edict_t *pEdict) { entvars_t *pev = VARS(const_cast(pEdict)); @@ -8195,7 +7919,6 @@ int GetPlayerGaitsequence(const edict_t *pEdict) return pPlayer->m_iGaitsequence; } -/* <15a6c2> ../cstrike/dlls/player.cpp:9880 */ void CBasePlayer::SpawnClientSideCorpse() { char *infobuffer = GET_INFO_BUFFER(edict()); @@ -8224,7 +7947,6 @@ void CBasePlayer::SpawnClientSideCorpse() } } -/* <15a7a2> ../cstrike/dlls/player.cpp:9909 */ BOOL CBasePlayer::IsArmored(int nHitGroup) { BOOL fApplyArmor = FALSE; @@ -8251,7 +7973,6 @@ BOOL CBasePlayer::IsArmored(int nHitGroup) return fApplyArmor; } -/* <15a847> ../cstrike/dlls/player.cpp:9939 */ BOOL CBasePlayer::ShouldDoLargeFlinch(int nHitGroup, int nGunType) { if (pev->flags & FL_DUCKING) @@ -8280,34 +8001,32 @@ BOOL CBasePlayer::ShouldDoLargeFlinch(int nHitGroup, int nGunType) return FALSE; } -/* <15a87d> ../cstrike/dlls/player.cpp:9971 */ void CBasePlayer::SetPrefsFromUserinfo(char *infobuffer) { const char *pszKeyVal; pszKeyVal = GET_KEY_VALUE(infobuffer, "_cl_autowepswitch"); - if (Q_strcmp(pszKeyVal, "")) + if (Q_strcmp(pszKeyVal, "") != 0) m_iAutoWepSwitch = Q_atoi(pszKeyVal); else m_iAutoWepSwitch = 1; pszKeyVal = GET_KEY_VALUE(infobuffer, "_vgui_menus"); - if (Q_strcmp(pszKeyVal, "")) + if (Q_strcmp(pszKeyVal, "") != 0) m_bVGUIMenus = Q_atoi(pszKeyVal) != 0; else m_bVGUIMenus = true; pszKeyVal = GET_KEY_VALUE(infobuffer, "_ah"); - if (Q_strcmp(pszKeyVal, "")) + if (Q_strcmp(pszKeyVal, "") != 0) m_bShowHints = Q_atoi(pszKeyVal) != 0; else m_bShowHints = true; } -/* <15a92a> ../cstrike/dlls/player.cpp:10013 */ bool CBasePlayer::IsLookingAtPosition(Vector *pos, float angleTolerance) { Vector to = *pos - EyePosition(); @@ -8318,11 +8037,10 @@ bool CBasePlayer::IsLookingAtPosition(Vector *pos, float angleTolerance) float deltaYaw = NormalizeAngle(idealAngle.y - pev->v_angle.y); float deltaPitch = NormalizeAngle(idealAngle.x - pev->v_angle.x); - return (abs(deltaYaw) < angleTolerance - && abs(deltaPitch) < angleTolerance); + return (Q_abs(deltaYaw) < angleTolerance + && Q_abs(deltaPitch) < angleTolerance); } -/* <15aa7b> ../cstrike/dlls/player.cpp:10083 */ bool CBasePlayer::CanAffordPrimary() { int account = m_iAccount; @@ -8353,10 +8071,9 @@ bool CBasePlayer::CanAffordPrimary() return false; } -/* <15ab2c> ../cstrike/dlls/player.cpp:10139 */ bool CBasePlayer::CanAffordPrimaryAmmo() { - CBasePlayerWeapon *primary = (CBasePlayerWeapon *)&m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]; + CBasePlayerWeapon *primary = static_cast(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); for (int i = 0; i < MAX_WEAPONS; ++i) { @@ -8369,10 +8086,9 @@ bool CBasePlayer::CanAffordPrimaryAmmo() return false; } -/* <15aba0> ../cstrike/dlls/player.cpp:10169 */ bool CBasePlayer::CanAffordSecondaryAmmo() { - CBasePlayerWeapon *secondary = (CBasePlayerWeapon *)&m_rgpPlayerItems[ PISTOL_SLOT ]; + CBasePlayerWeapon *secondary = static_cast(m_rgpPlayerItems[ PISTOL_SLOT ]); for (int i = 0; i < MAX_WEAPONS; ++i) { @@ -8385,7 +8101,6 @@ bool CBasePlayer::CanAffordSecondaryAmmo() return false; } -/* <15ac14> ../cstrike/dlls/player.cpp:10199 */ bool CBasePlayer::CanAffordArmor() { if (m_iKevlar == ARMOR_TYPE_KEVLAR && pev->armorvalue == 100.0f && m_iAccount >= HELMET_PRICE) @@ -8394,22 +8109,19 @@ bool CBasePlayer::CanAffordArmor() return (m_iAccount >= KEVLAR_PRICE); } -/* <15ac3c> ../cstrike/dlls/player.cpp:10217 */ bool CBasePlayer::CanAffordDefuseKit() { return (m_iAccount >= DEFUSEKIT_PRICE); } -/* <15ac64> ../cstrike/dlls/player.cpp:10227 */ bool CBasePlayer::CanAffordGrenade() { return (m_iAccount >= FLASHBANG_PRICE); } -/* <15ac8c> ../cstrike/dlls/player.cpp:10247 */ bool CBasePlayer::NeedsPrimaryAmmo() { - CBasePlayerWeapon *primary = (CBasePlayerWeapon *)&m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]; + CBasePlayerWeapon *primary = static_cast(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); if (!primary || primary->m_iId == WEAPON_SHIELDGUN) return false; @@ -8417,10 +8129,9 @@ bool CBasePlayer::NeedsPrimaryAmmo() return (m_rgAmmo[ primary->m_iPrimaryAmmoType ] < primary->iMaxAmmo1()); } -/* <15ace1> ../cstrike/dlls/player.cpp:10268 */ bool CBasePlayer::NeedsSecondaryAmmo() { - CBasePlayerWeapon *secondary = (CBasePlayerWeapon *)&m_rgpPlayerItems[ PISTOL_SLOT ]; + CBasePlayerWeapon *secondary = static_cast(m_rgpPlayerItems[ PISTOL_SLOT ]); if (!secondary) return false; @@ -8428,7 +8139,6 @@ bool CBasePlayer::NeedsSecondaryAmmo() return (m_rgAmmo[ secondary->m_iPrimaryAmmoType ] < secondary->iMaxAmmo1()); } -/* <15ad36> ../cstrike/dlls/player.cpp:10285 */ bool CBasePlayer::NeedsArmor() { if (m_iKevlar == ARMOR_TYPE_EMPTY) @@ -8437,18 +8147,14 @@ bool CBasePlayer::NeedsArmor() return (pev->armorvalue < 50.0f); } -/* <15ad5e> ../cstrike/dlls/player.cpp:10300 */ bool CBasePlayer::NeedsDefuseKit() { - CHalfLifeMultiplay *mpRules = g_pGameRules; - if (m_bHasDefuser || m_iTeam != CT) return false; - return (mpRules->m_bMapHasBombTarget); + return (CSGameRules()->m_bMapHasBombTarget); } -/* <15ad9a> ../cstrike/dlls/player.cpp:10325 */ bool CBasePlayer::NeedsGrenade() { int iAmmoIndex = GetAmmoIndex("HEGrenade"); @@ -8469,7 +8175,6 @@ bool CBasePlayer::NeedsGrenade() return true; } -/* <15aeab> ../cstrike/dlls/player.cpp:10381 */ void CBasePlayer::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3) { BotArgs[0] = cmd; @@ -8482,7 +8187,6 @@ void CBasePlayer::ClientCommand(const char *cmd, const char *arg1, const char *a UseBotArgs = false; } -/* <15aea9> ../cstrike/dlls/player.cpp:10401 */ const char *GetBuyStringForWeaponClass(int weaponClass) { switch (weaponClass) @@ -8506,27 +8210,28 @@ const char *GetBuyStringForWeaponClass(int weaponClass) return NULL; } -/* <15aee9> ../cstrike/dlls/player.cpp:10454 */ void CBasePlayer::ClearAutoBuyData() { m_autoBuyString[0] = '\0'; } -/* <15af11> ../cstrike/dlls/player.cpp:10459 */ void CBasePlayer::AddAutoBuyData(const char *str) { int len = Q_strlen(m_autoBuyString); - if (len < MAX_AUTOBUY_LENGTH - 1) + if (len < sizeof(m_autoBuyString) - 1) { if (len > 0) m_autoBuyString[ len ] = ' '; - Q_strncat(m_autoBuyString, str, MAX_AUTOBUY_LENGTH - len); +#ifndef REGAMEDLL_FIXES + Q_strncat(m_autoBuyString, str, sizeof(m_autoBuyString) - len); +#else + Q_strncat(m_autoBuyString, str, sizeof(m_autoBuyString) - len - 1); +#endif } } -/* <15af66> ../cstrike/dlls/player.cpp:10478 */ void CBasePlayer::InitRebuyData(const char *str) { if (!str || Q_strlen(str) > MAX_REBUY_LENGTH) @@ -8545,7 +8250,6 @@ void CBasePlayer::InitRebuyData(const char *str) m_rebuyString[ Q_strlen(str) ] = '\0'; } -/* <15be4f> ../cstrike/dlls/player.cpp:10500 */ void CBasePlayer::AutoBuy() { const char *c = NULL; @@ -8602,13 +8306,11 @@ void CBasePlayer::AutoBuy() } } -/* <14ea4e> ../cstrike/dlls/player.cpp:10556 */ bool IsPrimaryWeaponClass(int classId) { return (classId >= WEAPONCLASS_SUBMACHINEGUN && classId <= WEAPONCLASS_SNIPERRIFLE); } -/* <15afbe> ../cstrike/dlls/player.cpp:10571 */ bool IsPrimaryWeaponId(int id) { int classId = WEAPONCLASS_NONE; @@ -8622,13 +8324,11 @@ bool IsPrimaryWeaponId(int id) return IsPrimaryWeaponClass(classId); } -/* <14ea6f> ../cstrike/dlls/player.cpp:10583 */ bool IsSecondaryWeaponClass(int classId) { return (classId == WEAPONCLASS_PISTOL); } -/* <15b059> ../cstrike/dlls/player.cpp:10588 */ bool IsSecondaryWeaponId(int id) { int classId = WEAPONCLASS_NONE; @@ -8642,7 +8342,6 @@ bool IsSecondaryWeaponId(int id) return IsSecondaryWeaponClass(classId); } -/* <15b0f1> ../cstrike/dlls/player.cpp:10600 */ const char *GetWeaponAliasFromName(const char *weaponName) { if (!Q_strncmp(weaponName, "weapon_", 7)) @@ -8653,7 +8352,6 @@ const char *GetWeaponAliasFromName(const char *weaponName) return weaponName; } -/* <15b133> ../cstrike/dlls/player.cpp:10607 */ bool CurrentWeaponSatisfies(CBasePlayerWeapon *pWeapon, int id, int classId) { if (pWeapon == NULL) @@ -8670,7 +8368,6 @@ bool CurrentWeaponSatisfies(CBasePlayerWeapon *pWeapon, int id, int classId) return false; } -/* <15b1eb> ../cstrike/dlls/player.cpp:10623 */ const char *CBasePlayer::PickPrimaryCareerTaskWeapon() { const int BufLen = 256; @@ -8742,17 +8439,16 @@ const char *CBasePlayer::PickPrimaryCareerTaskWeapon() CCareerTask *pTask = taskVector[i]; if (IsPrimaryWeaponId(pTask->GetWeaponId())) - Q_strncat(buf, WeaponIDToAlias(pTask->GetWeaponId()), sizeof(buf)); + Q_strncat(buf, WeaponIDToAlias(pTask->GetWeaponId()), sizeof(buf) - Q_strlen(buf) - 1); else - Q_strncat(buf, GetBuyStringForWeaponClass(pTask->GetWeaponClassId()), sizeof(buf)); + Q_strncat(buf, GetBuyStringForWeaponClass(pTask->GetWeaponClassId()), sizeof(buf) - Q_strlen(buf) - 1); - Q_strncat(buf, " ", sizeof(buf)); + Q_strncat(buf, " ", sizeof(buf) - Q_strlen(buf) - 1); } return buf; } -/* <15b5d7> ../cstrike/dlls/player.cpp:10690 */ const char *CBasePlayer::PickSecondaryCareerTaskWeapon() { const int BufLen = 256; @@ -8825,17 +8521,16 @@ const char *CBasePlayer::PickSecondaryCareerTaskWeapon() CCareerTask *pTask = taskVector[i]; if (IsSecondaryWeaponId(pTask->GetWeaponId())) - Q_strncat(buf, WeaponIDToAlias(pTask->GetWeaponId()), sizeof(buf)); + Q_strncat(buf, WeaponIDToAlias(pTask->GetWeaponId()), sizeof(buf) - Q_strlen(buf) - 1); else - Q_strncat(buf, GetBuyStringForWeaponClass(pTask->GetWeaponClassId()), sizeof(buf)); + Q_strncat(buf, GetBuyStringForWeaponClass(pTask->GetWeaponClassId()), sizeof(buf) - Q_strlen(buf) - 1); - Q_strncat(buf, " ", sizeof(buf)); + Q_strncat(buf, " ", sizeof(buf) - Q_strlen(buf) - 1); } return buf; } -/* <15b9ea> ../cstrike/dlls/player.cpp:10759 */ const char *CBasePlayer::PickFlashKillWeaponString() { if (TheCareerTasks == NULL) @@ -8860,7 +8555,6 @@ const char *CBasePlayer::PickFlashKillWeaponString() return NULL; } -/* <15baa1> ../cstrike/dlls/player.cpp:10787 */ const char *CBasePlayer::PickGrenadeKillWeaponString() { if (TheCareerTasks == NULL) @@ -8886,8 +8580,6 @@ const char *CBasePlayer::PickGrenadeKillWeaponString() } // PostAutoBuyCommandProcessing - reorders the tokens in autobuyString based on the order of tokens in the priorityString. - -/* <15bb0c> ../cstrike/dlls/player.cpp:10816 */ void CBasePlayer::PrioritizeAutoBuyString(char *autobuyString, const char *priorityString) { char newString[ MAX_AUTOBUY_LENGTH ]; @@ -8965,7 +8657,6 @@ void CBasePlayer::PrioritizeAutoBuyString(char *autobuyString, const char *prior Q_sprintf(autobuyString, "%s", newString); } -/* <15bcd5> ../cstrike/dlls/player.cpp:10899 */ void CBasePlayer::ParseAutoBuyString(const char *string, bool &boughtPrimary, bool &boughtSecondary) { char command[32]; @@ -9024,7 +8715,6 @@ void CBasePlayer::ParseAutoBuyString(const char *string, bool &boughtPrimary, bo } } -/* <15bb6b> ../cstrike/dlls/player.cpp:10957 */ bool CBasePlayer::ShouldExecuteAutoBuyCommand(AutoBuyInfoStruct *commandInfo, bool boughtPrimary, bool boughtSecondary) { if (!commandInfo) @@ -9047,7 +8737,6 @@ bool CBasePlayer::ShouldExecuteAutoBuyCommand(AutoBuyInfoStruct *commandInfo, bo return true; } -/* <15bbfa> ../cstrike/dlls/player.cpp:10978 */ AutoBuyInfoStruct *CBasePlayer::GetAutoBuyCommandInfo(const char *command) { int i = 0; @@ -9071,7 +8760,6 @@ AutoBuyInfoStruct *CBasePlayer::GetAutoBuyCommandInfo(const char *command) return ret; } -/* <15bc49> ../cstrike/dlls/player.cpp:11000 */ void CBasePlayer::PostAutoBuyCommandProcessing(AutoBuyInfoStruct *commandInfo, bool &boughtPrimary, bool &boughtSecondary) { if (commandInfo == NULL) @@ -9079,8 +8767,8 @@ void CBasePlayer::PostAutoBuyCommandProcessing(AutoBuyInfoStruct *commandInfo, b return; } - CBasePlayerWeapon *primary = (CBasePlayerWeapon *)m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]; - CBasePlayerWeapon *secondary = (CBasePlayerWeapon *)m_rgpPlayerItems[ PISTOL_SLOT ]; + CBasePlayerWeapon *primary = static_cast(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); + CBasePlayerWeapon *secondary = static_cast(m_rgpPlayerItems[ PISTOL_SLOT ]); if (primary != NULL && (Q_stricmp(STRING(primary->pev->classname), commandInfo->m_classname) == 0)) { @@ -9099,7 +8787,6 @@ void CBasePlayer::PostAutoBuyCommandProcessing(AutoBuyInfoStruct *commandInfo, b } } -/* <15c0b4> ../cstrike/dlls/player.cpp:11027 */ void CBasePlayer::BuildRebuyStruct() { if (m_bIsInRebuy) @@ -9108,8 +8795,8 @@ void CBasePlayer::BuildRebuyStruct() return; } - CBasePlayerWeapon *primary = (CBasePlayerWeapon *)m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]; - CBasePlayerWeapon *secondary = (CBasePlayerWeapon *)m_rgpPlayerItems[ PISTOL_SLOT ]; + CBasePlayerWeapon *primary = static_cast(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); + CBasePlayerWeapon *secondary = static_cast(m_rgpPlayerItems[ PISTOL_SLOT ]); // do the primary weapon/ammo stuff. if (primary == NULL) @@ -9173,7 +8860,6 @@ void CBasePlayer::BuildRebuyStruct() m_rebuyStruct.m_armor = m_iKevlar; // check for armor. } -/* <15c37d> ../cstrike/dlls/player.cpp:11134 */ void CBasePlayer::Rebuy() { char *fileData = m_rebuyString; @@ -9221,7 +8907,6 @@ void CBasePlayer::Rebuy() } } -/* <15c96a> ../cstrike/dlls/player.cpp:11200 */ void CBasePlayer::RebuyPrimaryWeapon() { if (!m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]) @@ -9236,10 +8921,9 @@ void CBasePlayer::RebuyPrimaryWeapon() } } -/* <15c9e4> ../cstrike/dlls/player.cpp:11217 */ void CBasePlayer::RebuyPrimaryAmmo() { - CBasePlayerWeapon *primary = (CBasePlayerWeapon *)m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]; + CBasePlayerWeapon *primary = static_cast(m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]); if (primary != NULL) { @@ -9249,7 +8933,6 @@ void CBasePlayer::RebuyPrimaryAmmo() } } -/* <15ca68> ../cstrike/dlls/player.cpp:11233 */ void CBasePlayer::RebuySecondaryWeapon() { if (m_rebuyStruct.m_secondaryWeapon) @@ -9261,10 +8944,9 @@ void CBasePlayer::RebuySecondaryWeapon() } } -/* <15cae2> ../cstrike/dlls/player.cpp:11245 */ void CBasePlayer::RebuySecondaryAmmo() { - CBasePlayerWeapon *secondary = (CBasePlayerWeapon *)m_rgpPlayerItems[ PISTOL_SLOT ]; + CBasePlayerWeapon *secondary = static_cast(m_rgpPlayerItems[ PISTOL_SLOT ]); if (secondary) { @@ -9273,7 +8955,6 @@ void CBasePlayer::RebuySecondaryAmmo() } } -/* <15cb66> ../cstrike/dlls/player.cpp:11259 */ void CBasePlayer::RebuyHEGrenade() { int iAmmoIndex = GetAmmoIndex("HEGrenade"); @@ -9287,7 +8968,6 @@ void CBasePlayer::RebuyHEGrenade() ClientCommand("hegren"); } -/* <15cc3f> ../cstrike/dlls/player.cpp:11279 */ void CBasePlayer::RebuyFlashbang() { int iAmmoIndex = GetAmmoIndex("Flashbang"); @@ -9301,7 +8981,6 @@ void CBasePlayer::RebuyFlashbang() ClientCommand("flash"); } -/* <15cd18> ../cstrike/dlls/player.cpp:11299 */ void CBasePlayer::RebuySmokeGrenade() { int iAmmoIndex = GetAmmoIndex("SmokeGrenade"); @@ -9315,7 +8994,6 @@ void CBasePlayer::RebuySmokeGrenade() ClientCommand("sgren"); } -/* <15cdf1> ../cstrike/dlls/player.cpp:11319 */ void CBasePlayer::RebuyDefuser() { // If we don't have a defuser, and we want one, buy it! @@ -9325,7 +9003,6 @@ void CBasePlayer::RebuyDefuser() } } -/* <15ce59> ../cstrike/dlls/player.cpp:11330 */ void CBasePlayer::RebuyNightVision() { // If we don't have night vision and we want one, buy it! @@ -9335,7 +9012,6 @@ void CBasePlayer::RebuyNightVision() } } -/* <15cec1> ../cstrike/dlls/player.cpp:11341 */ void CBasePlayer::RebuyArmor() { if (m_rebuyStruct.m_armor) @@ -9350,7 +9026,6 @@ void CBasePlayer::RebuyArmor() } } -/* <15cf7c> ../cstrike/dlls/player.cpp:11366 */ bool CBasePlayer::IsObservingPlayer(CBasePlayer *pPlayer) { if (!pPlayer || pev->flags == FL_DORMANT) @@ -9362,10 +9037,9 @@ bool CBasePlayer::IsObservingPlayer(CBasePlayer *pPlayer) return (IsObserver() == OBS_IN_EYE && pev->iuser2 == pPlayer->entindex()) != 0; } -/* <15d049> ../cstrike/dlls/player.cpp:11380 */ void CBasePlayer::UpdateLocation(bool forceUpdate) { - if (!forceUpdate && m_flLastUpdateTime >= gpGlobals->time + 2) + if (!forceUpdate && m_flLastUpdateTime >= gpGlobals->time + 2.0f) return; const char *placeName = ""; diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 53def6fc..9751d064 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -32,7 +32,10 @@ #pragma once #endif +#include "pm_materials.h" #include "hintmessage.h" +#include "unisignals.h" +#include "weapons.h" #define MIN_BUY_TIME 15 // the minimum threshold values for cvar mp_buytime 15 sec's @@ -44,6 +47,7 @@ #define MAX_REBUY_LENGTH 256 #define MAX_RECENT_PATH 20 +#define MAX_HOSTAGE_ICON 4 // the maximum number of icons of the hostages in the HUD #define SUITUPDATETIME 3.5 #define SUITFIRSTUPDATETIME 0.1 @@ -52,11 +56,11 @@ #define PLAYER_MAX_SAFE_FALL_SPEED 500.0f #define PLAYER_USE_RADIUS 64.0f -#define ARMOR_RATIO 0.5 // Armor Takes 50% of the damage -#define ARMOR_BONUS 0.5 // Each Point of Armor is work 1/x points of health +#define ARMOR_RATIO 0.5 // Armor Takes 50% of the damage +#define ARMOR_BONUS 0.5 // Each Point of Armor is work 1/x points of health -#define FLASH_DRAIN_TIME 1.2 // 100 units/3 minutes -#define FLASH_CHARGE_TIME 0.2 // 100 units/20 seconds (seconds per unit) +#define FLASH_DRAIN_TIME 1.2 // 100 units/3 minutes +#define FLASH_CHARGE_TIME 0.2 // 100 units/20 seconds (seconds per unit) // damage per unit per second. #define DAMAGE_FOR_FALL_SPEED 100.0f / (PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED) @@ -271,7 +275,6 @@ struct WeaponStruct int m_ammoPrice; }; -/* <14efbf> ../cstrike/dlls/player.cpp:9418 */ class CStripWeapons: public CPointEntity { public: @@ -281,11 +284,10 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; -/* <14f06c> ../cstrike/dlls/player.cpp:9543 */ class CInfoIntermission: public CPointEntity { public: @@ -297,11 +299,10 @@ public: void Spawn_(); void Think_(); -#endif // HOOK_GAMEDLL +#endif }; -/* <14ef4d> ../cstrike/dlls/player.cpp:9361 */ class CDeadHEV: public CBaseMonster { public: @@ -315,14 +316,13 @@ public: void KeyValue_(KeyValueData *pkvd); int Classify_(); -#endif // HOOK_GAMEDLL +#endif public: int m_iPose; static char *m_szPoses[4]; }; -/* <14ee80> ../cstrike/dlls/player.cpp:7001 */ class CSprayCan: public CBaseEntity { public: @@ -336,13 +336,12 @@ public: void Think_(); -#endif // HOOK_GAMEDLL +#endif public: void Spawn(entvars_t *pevOwner); }; -/* <14eea3> ../cstrike/dlls/player.cpp:7057 */ class CBloodSplat: public CBaseEntity { public: @@ -350,7 +349,6 @@ public: void Spray(); }; -/* <48ed5e> ../cstrike/dlls/player.h:250 */ class CBasePlayer: public CBaseMonster { public: @@ -436,24 +434,24 @@ public: void Observer_CheckTarget(); void Observer_CheckProperties(); int IsObserver() { return pev->iuser1; } - NOXREF void PlantC4(); + void PlantC4(); void Radio(const char *msg_id, const char *msg_verbose = NULL, short pitch = 100, bool showIcon = true); CBasePlayer *GetNextRadioRecipient(CBasePlayer *pStartPlayer); void SmartRadio(); - NOXREF void ThrowWeapon(char *pszItemName); - NOXREF void ThrowPrimary(); + void ThrowWeapon(char *pszItemName); + void ThrowPrimary(); void AddAccount(int amount, bool bTrackChange = true); void Disappear(); void MakeVIP(); bool CanPlayerBuy(bool display = false); void SwitchTeam(); void TabulateAmmo(); - void Pain(int m_LastHitGroup, bool HasArmour); + void Pain(int iLastHitGroup, bool HasArmour); BOOL IsBombGuy(); bool IsLookingAtPosition(Vector *pos, float angleTolerance = 20.0f); void Reset(); void SetScoreboardAttributes(CBasePlayer *destination = NULL); - NOXREF void RenewItems(); + void RenewItems(); void PackDeadPlayerItems(); void GiveDefaultItems(); void RemoveAllItems(BOOL removeSuit); @@ -463,7 +461,7 @@ public: void SetPlayerModel(BOOL HasC4); void SetNewPlayerModel(const char *modelName); BOOL SwitchWeapon(CBasePlayerItem *pWeapon); - void CheckPowerups(entvars_t *pev); + void CheckPowerups(); bool CanAffordPrimary(); bool CanAffordPrimaryAmmo(); bool CanAffordSecondaryAmmo(); @@ -482,7 +480,7 @@ public: void UpdatePlayerSound(); void DeathSound(); void SetAnimation(PLAYER_ANIM playerAnim); - NOXREF void SetWeaponAnimType(const char *szExtention) { Q_strcpy(m_szAnimExtention, szExtention); } + void SetWeaponAnimType(const char *szExtention) { Q_strcpy(m_szAnimExtention, szExtention); } void CheatImpulseCommands(int iImpulse); void StartDeathCam(); void StartObserver(Vector vecPosition, Vector vecViewAngle); @@ -491,8 +489,8 @@ public: BOOL HasPlayerItem(CBasePlayerItem *pCheckItem); BOOL HasNamedPlayerItem(const char *pszItemName); BOOL HasWeapons(); - NOXREF void SelectPrevItem(int iItem); - NOXREF void SelectNextItem(int iItem); + void SelectPrevItem(int iItem); + void SelectNextItem(int iItem); void SelectLastItem(); void SelectItem(const char *pstr); void ItemPreFrame(); @@ -515,8 +513,8 @@ public: void SetSuitUpdate(char *name = NULL, int fgroup = 0, int iNoRepeatTime = 0); void UpdateGeigerCounter(); void CheckTimeBasedDamage(); - NOXREF void BarnacleVictimBitten(entvars_t *pevBarnacle); - NOXREF void BarnacleVictimReleased(); + void BarnacleVictimBitten(entvars_t *pevBarnacle); + void BarnacleVictimReleased(); static int GetAmmoIndex(const char *psz); int AmmoInventory(int iAmmoIndex); void ResetAutoaim(); @@ -590,7 +588,7 @@ public: void SetObserverAutoDirector(bool val) { m_bObserverAutoDirector = val; } bool IsObservingPlayer(CBasePlayer *pPlayer); bool CanSwitchObserverModes() const { return m_canSwitchObserverModes; } - NOXREF void Intense() + void Intense() { //m_musicState = INTENSE; //m_intenseTimestamp = gpGlobals->time; @@ -634,7 +632,7 @@ public: int m_iIgnoreGlobalChat; bool m_bHasNightVision; bool m_bNightVisionOn; - Vector m_vRecentPath[ MAX_RECENT_PATH ]; + Vector m_vRecentPath[MAX_RECENT_PATH]; float m_flIdleCheckTime; float m_flRadioTime; int m_iRadioMessages; @@ -667,7 +665,7 @@ public: bool m_bReceivesNoMoneyNextRound; int m_iTimeCheckAllowed; bool m_bHasChangedName; - char m_szNewName[ MAX_PLAYER_NAME_LENGTH ]; + char m_szNewName[MAX_PLAYER_NAME_LENGTH]; bool m_bIsDefusing; float m_tmHandleSignals; CUnifiedSignals m_signals; @@ -687,7 +685,7 @@ public: float m_flSndRoomtype; float m_flSndRange; float m_flFallVelocity; - int m_rgItems[ MAX_ITEMS ]; + int m_rgItems[MAX_ITEMS]; int m_fNewAmmo; unsigned int m_afPhysicsFlags; float m_fNextSuicideTime; @@ -697,17 +695,17 @@ public: float m_flDuckTime; float m_flWallJumpTime; float m_flSuitUpdate; - int m_rgSuitPlayList[ CSUITPLAYLIST ]; + int m_rgSuitPlayList[CSUITPLAYLIST]; int m_iSuitPlayNext; - int m_rgiSuitNoRepeat[ CSUITNOREPEAT ]; - float m_rgflSuitNoRepeatTime[ CSUITNOREPEAT ]; + int m_rgiSuitNoRepeat[CSUITNOREPEAT]; + float m_rgflSuitNoRepeatTime[CSUITNOREPEAT]; int m_lastDamageAmount; float m_tbdPrev; float m_flgeigerRange; float m_flgeigerDelay; int m_igeigerRangePrev; int m_iStepLeft; - char m_szTextureName[ CBTEXTURENAMEMAX ]; + char m_szTextureName[CBTEXTURENAMEMAX]; char m_chTextureType; int m_idrowndmg; int m_idrownrestored; @@ -730,24 +728,24 @@ public: int m_iClientFOV; int m_iNumSpawns; CBaseEntity *m_pObserver; - CBasePlayerItem *m_rgpPlayerItems[ MAX_ITEM_TYPES ]; + CBasePlayerItem *m_rgpPlayerItems[MAX_ITEM_TYPES]; CBasePlayerItem *m_pActiveItem; CBasePlayerItem *m_pClientActiveItem; CBasePlayerItem *m_pLastItem; - int m_rgAmmo[ MAX_AMMO_SLOTS ]; - int m_rgAmmoLast[ MAX_AMMO_SLOTS ]; + int m_rgAmmo[MAX_AMMO_SLOTS]; + int m_rgAmmoLast[MAX_AMMO_SLOTS]; Vector m_vecAutoAim; BOOL m_fOnTarget; int m_iDeaths; int m_izSBarState[SBAR_END]; float m_flNextSBarUpdateTime; float m_flStatusBarDisappearDelay; - char m_SbarString0[ SBAR_STRING_SIZE ]; + char m_SbarString0[SBAR_STRING_SIZE]; int m_lastx; int m_lasty; int m_nCustomSprayFrames; float m_flNextDecalTime; - char m_szTeamName[ TEAM_NAME_LENGTH ]; + char m_szTeamName[TEAM_NAME_LENGTH]; static TYPEDESCRIPTION IMPL(m_playerSaveData)[40]; @@ -776,12 +774,12 @@ public: float m_blindFadeTime; int m_blindAlpha; float m_allowAutoFollowTime; - char m_autoBuyString[ MAX_AUTOBUY_LENGTH ]; + char m_autoBuyString[MAX_AUTOBUY_LENGTH]; char *m_rebuyString; RebuyStruct m_rebuyStruct; bool m_bIsInRebuy; float m_flLastUpdateTime; - char m_lastLocation[ MaxLocationLen ]; + char m_lastLocation[MaxLocationLen]; float m_progressStart; float m_progressEnd; bool m_bObserverAutoDirector; @@ -790,10 +788,9 @@ public: float m_intenseTimestamp; float m_silentTimestamp; MusicState m_musicState; - float m_flLastCommandTime[8]; + float m_flLastCommandTime[COMMANDS_TO_TRACK]; }; -/* <14ed87> ../cstrike/dlls/player.cpp:3407 */ class CWShield: public CBaseEntity { public: @@ -805,7 +802,7 @@ public: void Spawn_(); void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: void SetCantBePickedUpByUser(CBaseEntity *pEntity, float time) @@ -937,10 +934,10 @@ const char *GetWeaponName(entvars_t *pevInflictor, entvars_t *pKiller); void LogAttack(CBasePlayer *pAttacker, CBasePlayer *pVictim, int teamAttack, int healthHit, int armorHit, int newHealth, int newArmor, const char *killer_weapon_name); void packPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo); bool CanSeeUseable(CBasePlayer *me, CBaseEntity *entity); -NOXREF void FixPlayerCrouchStuck(edict_t *pPlayer); +void FixPlayerCrouchStuck(edict_t *pPlayer); BOOL IsSpawnPointValid(CBaseEntity *pPlayer, CBaseEntity *pSpot); -NOXREF void InitZombieSpawns(); -NOXREF CBaseEntity *FindZombieSpawn(CBaseEntity *player, bool forceSpawn); +void InitZombieSpawns(); +CBaseEntity *FindZombieSpawn(CBaseEntity *player, bool forceSpawn); edict_t *EntSelectSpawnPoint(CBaseEntity *pPlayer); void SetScoreAttrib(CBasePlayer *dest, CBasePlayer *src); CBaseEntity *FindEntityForward(CBaseEntity *pMe); diff --git a/regamedll/dlls/revert_saved.h b/regamedll/dlls/revert_saved.h index c06e41fc..ac7f9519 100644 --- a/regamedll/dlls/revert_saved.h +++ b/regamedll/dlls/revert_saved.h @@ -32,7 +32,6 @@ #pragma once #endif -/* <14f018> ../cstrike/dlls/player.cpp:9446 */ class CRevertSaved: public CPointEntity { public: @@ -48,22 +47,22 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT MessageThink(); void EXPORT LoadThink(); public: - float Duration() const { return pev->dmg_take; } - float HoldTime() const { return pev->dmg_save; } - float MessageTime() const { return m_messageTime; } - float LoadTime() const { return m_loadTime; } + float Duration() const { return pev->dmg_take; } + float HoldTime() const { return pev->dmg_save; } + float MessageTime() const { return m_messageTime; } + float LoadTime() const { return m_loadTime; } - void SetDuration(float duration) { pev->dmg_take = duration; } - void SetHoldTime(float hold) { pev->dmg_save = hold; } - void SetMessageTime(float time) { m_messageTime = time; } - void SetLoadTime(float time) { m_loadTime = time; } + void SetDuration(float duration) { pev->dmg_take = duration; } + void SetHoldTime(float hold) { pev->dmg_save = hold; } + void SetMessageTime(float time) { m_messageTime = time; } + void SetLoadTime(float time) { m_loadTime = time; } public: static TYPEDESCRIPTION IMPL(m_SaveData)[2]; diff --git a/regamedll/dlls/saverestore.h b/regamedll/dlls/saverestore.h index 5bdd53fb..6421d4fc 100644 --- a/regamedll/dlls/saverestore.h +++ b/regamedll/dlls/saverestore.h @@ -42,7 +42,7 @@ #define IMPL_CLASS(baseClass,var)\ baseClass::var -#endif // HOOK_GAMEDLL +#endif #define IMPLEMENT_SAVERESTORE(derivedClass, baseClass)\ int derivedClass::__MAKE_VHOOK(Save)(CSave &save)\ @@ -85,7 +85,6 @@ typedef struct class CBaseEntity; -/* <39a4f3> ../cstrike/dlls/saverestore.h:33 */ class CSaveRestoreBuffer { public: @@ -108,7 +107,6 @@ protected: unsigned int HashString(const char *pszToken); }; -/* <19e94e> ../cstrike/dlls/saverestore.h:50 */ class CSave: public CSaveRestoreBuffer { public: @@ -132,7 +130,7 @@ private: #ifdef HOOK_GAMEDLL public: -#endif // HOOK_GAMEDLL +#endif int DataEmpty(const char *pdata, int size); void BufferField(const char *pname, int size, const char *pdata); @@ -141,7 +139,6 @@ public: void BufferHeader(const char *pname, int size); }; -/* <1d9f06> ../cstrike/dlls/saverestore.h:82 */ class CRestore: public CSaveRestoreBuffer { public: @@ -175,7 +172,6 @@ private: BOOL m_precache; }; -/* <245f6> ../cstrike/dlls/saverestore.h:153 */ class CGlobalState { public: diff --git a/regamedll/dlls/singleplay_gamerules.cpp b/regamedll/dlls/singleplay_gamerules.cpp index 5ddba2dc..d05b29df 100644 --- a/regamedll/dlls/singleplay_gamerules.cpp +++ b/regamedll/dlls/singleplay_gamerules.cpp @@ -1,37 +1,31 @@ #include "precompiled.h" -/* <1676c5> ../cstrike/dlls/singleplay_gamerules.cpp:32 */ CHalfLifeRules::CHalfLifeRules() { m_bFreezePeriod = FALSE; RefreshSkillData(); } -/* <166d5d> ../cstrike/dlls/singleplay_gamerules.cpp:40 */ void CHalfLifeRules::__MAKE_VHOOK(Think)() { ; } -/* <166d83> ../cstrike/dlls/singleplay_gamerules.cpp:46 */ BOOL CHalfLifeRules::__MAKE_VHOOK(IsMultiplayer)() { return FALSE; } -/* <166da9> ../cstrike/dlls/singleplay_gamerules.cpp:53 */ BOOL CHalfLifeRules::__MAKE_VHOOK(IsDeathmatch)() { return FALSE; } -/* <166dcf> ../cstrike/dlls/singleplay_gamerules.cpp:60 */ BOOL CHalfLifeRules::__MAKE_VHOOK(IsCoOp)() { return FALSE; } -/* <166df5> ../cstrike/dlls/singleplay_gamerules.cpp:68 */ BOOL CHalfLifeRules::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) { if (!pPlayer->m_pActiveItem) @@ -48,31 +42,26 @@ BOOL CHalfLifeRules::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, CBa return TRUE; } -/* <166e38> ../cstrike/dlls/singleplay_gamerules.cpp:86 */ BOOL CHalfLifeRules::__MAKE_VHOOK(GetNextBestWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) { return FALSE; } -/* <166e7a> ../cstrike/dlls/singleplay_gamerules.cpp:93 */ BOOL CHalfLifeRules::__MAKE_VHOOK(ClientConnected)(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) { return TRUE; } -/* <166ed8> ../cstrike/dlls/singleplay_gamerules.cpp:98 */ void CHalfLifeRules::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl) { ; } -/* <166f0b> ../cstrike/dlls/singleplay_gamerules.cpp:104 */ void CHalfLifeRules::__MAKE_VHOOK(ClientDisconnected)(edict_t *pClient) { ; } -/* <166f3f> ../cstrike/dlls/singleplay_gamerules.cpp:110 */ float CHalfLifeRules::__MAKE_VHOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer) { // subtract off the speed at which a player is allowed to fall without being hurt, @@ -81,7 +70,6 @@ float CHalfLifeRules::__MAKE_VHOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer) return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED; } -/* <167677> ../cstrike/dlls/singleplay_gamerules.cpp:120 */ void CHalfLifeRules::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer) { pPlayer->pev->weapons |= (1 << WEAPON_SUIT); @@ -95,73 +83,61 @@ void CHalfLifeRules::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer) pPlayer->GiveAmmo(24, "45acp", 100); } -/* <166f73> ../cstrike/dlls/singleplay_gamerules.cpp:135 */ BOOL CHalfLifeRules::__MAKE_VHOOK(AllowAutoTargetCrosshair)() { return (g_iSkillLevel == SKILL_EASY); } -/* <166f99> ../cstrike/dlls/singleplay_gamerules.cpp:142 */ void CHalfLifeRules::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) { ; } -/* <166fcd> ../cstrike/dlls/singleplay_gamerules.cpp:149 */ BOOL CHalfLifeRules::__MAKE_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer) { return TRUE; } -/* <167001> ../cstrike/dlls/singleplay_gamerules.cpp:156 */ float CHalfLifeRules::__MAKE_VHOOK(FlPlayerSpawnTime)(CBasePlayer *pPlayer) { return gpGlobals->time; } -/* <167035> ../cstrike/dlls/singleplay_gamerules.cpp:165 */ int CHalfLifeRules::__MAKE_VHOOK(IPointsForKill)(CBasePlayer *pAttacker, CBasePlayer *pKilled) { return 1; } -/* <167077> ../cstrike/dlls/singleplay_gamerules.cpp:173 */ void CHalfLifeRules::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) { ; } -/* <1670c7> ../cstrike/dlls/singleplay_gamerules.cpp:180 */ void CHalfLifeRules::__MAKE_VHOOK(DeathNotice)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) { ; } -/* <167117> ../cstrike/dlls/singleplay_gamerules.cpp:188 */ void CHalfLifeRules::__MAKE_VHOOK(PlayerGotWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) { ; } -/* <167159> ../cstrike/dlls/singleplay_gamerules.cpp:196 */ float CHalfLifeRules::__MAKE_VHOOK(FlWeaponRespawnTime)(CBasePlayerItem *pWeapon) { return -1; } -/* <16718d> ../cstrike/dlls/singleplay_gamerules.cpp:206 */ float CHalfLifeRules::__MAKE_VHOOK(FlWeaponTryRespawn)(CBasePlayerItem *pWeapon) { return 0; } -/* <1671c1> ../cstrike/dlls/singleplay_gamerules.cpp:215 */ Vector CHalfLifeRules::__MAKE_VHOOK(VecWeaponRespawnSpot)(CBasePlayerItem *pWeapon) { return pWeapon->pev->origin; } -/* <1675e6> ../cstrike/dlls/singleplay_gamerules.cpp:220 */ edict_t *CHalfLifeRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer) { CBaseEntity *pSpot = UTIL_FindEntityByClassname(NULL, "info_player_start"); @@ -182,98 +158,82 @@ edict_t *CHalfLifeRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer) return pSpot->edict(); } -/* <16721c> ../cstrike/dlls/singleplay_gamerules.cpp:243 */ int CHalfLifeRules::__MAKE_VHOOK(WeaponShouldRespawn)(CBasePlayerItem *pWeapon) { return GR_WEAPON_RESPAWN_NO; } -/* <167250> ../cstrike/dlls/singleplay_gamerules.cpp:250 */ BOOL CHalfLifeRules::__MAKE_VHOOK(CanHaveItem)(CBasePlayer *pPlayer, CItem *pItem) { return TRUE; } -/* <167292> ../cstrike/dlls/singleplay_gamerules.cpp:257 */ void CHalfLifeRules::__MAKE_VHOOK(PlayerGotItem)(CBasePlayer *pPlayer, CItem *pItem) { ; } -/* <1672d6> ../cstrike/dlls/singleplay_gamerules.cpp:263 */ int CHalfLifeRules::__MAKE_VHOOK(ItemShouldRespawn)(CItem *pItem) { return GR_ITEM_RESPAWN_NO; } -/* <16730b> ../cstrike/dlls/singleplay_gamerules.cpp:272 */ float CHalfLifeRules::__MAKE_VHOOK(FlItemRespawnTime)(CItem *pItem) { return -1; } -/* <167340> ../cstrike/dlls/singleplay_gamerules.cpp:281 */ Vector CHalfLifeRules::__MAKE_VHOOK(VecItemRespawnSpot)(CItem *pItem) { return pItem->pev->origin; } -/* <16739d> ../cstrike/dlls/singleplay_gamerules.cpp:288 */ BOOL CHalfLifeRules::__MAKE_VHOOK(IsAllowedToSpawn)(CBaseEntity *pEntity) { return TRUE; } -/* <1673d2> ../cstrike/dlls/singleplay_gamerules.cpp:295 */ void CHalfLifeRules::__MAKE_VHOOK(PlayerGotAmmo)(CBasePlayer *pPlayer, char *szName, int iCount) { ; } -/* <167425> ../cstrike/dlls/singleplay_gamerules.cpp:301 */ int CHalfLifeRules::__MAKE_VHOOK(AmmoShouldRespawn)(CBasePlayerAmmo *pAmmo) { return GR_AMMO_RESPAWN_NO; } -/* <16745a> ../cstrike/dlls/singleplay_gamerules.cpp:308 */ float CHalfLifeRules::__MAKE_VHOOK(FlAmmoRespawnTime)(CBasePlayerAmmo *pAmmo) { return -1; } -/* <16748f> ../cstrike/dlls/singleplay_gamerules.cpp:315 */ Vector CHalfLifeRules::__MAKE_VHOOK(VecAmmoRespawnSpot)(CBasePlayerAmmo *pAmmo) { return pAmmo->pev->origin; } -/* <1674ec> ../cstrike/dlls/singleplay_gamerules.cpp:322 */ float CHalfLifeRules::__MAKE_VHOOK(FlHealthChargerRechargeTime)() { return 0; } -/* <167512> ../cstrike/dlls/singleplay_gamerules.cpp:329 */ int CHalfLifeRules::__MAKE_VHOOK(DeadPlayerWeapons)(CBasePlayer *pPlayer) { return GR_PLR_DROP_GUN_NO; } -/* <167547> ../cstrike/dlls/singleplay_gamerules.cpp:336 */ int CHalfLifeRules::__MAKE_VHOOK(DeadPlayerAmmo)(CBasePlayer *pPlayer) { return GR_PLR_DROP_AMMO_NO; } -/* <16757c> ../cstrike/dlls/singleplay_gamerules.cpp:343 */ int CHalfLifeRules::__MAKE_VHOOK(PlayerRelationship)(CBasePlayer *pPlayer, CBaseEntity *pTarget) { // why would a single player in half life need this? return GR_NOTTEAMMATE; } -/* <1675c0> ../cstrike/dlls/singleplay_gamerules.cpp:351 */ BOOL CHalfLifeRules::__MAKE_VHOOK(FAllowMonsters)() { return TRUE; diff --git a/regamedll/dlls/skill.cpp b/regamedll/dlls/skill.cpp index 84e17428..a5e0e1bf 100644 --- a/regamedll/dlls/skill.cpp +++ b/regamedll/dlls/skill.cpp @@ -4,8 +4,6 @@ skilldata_t gSkillData; // take the name of a cvar, tack a digit for the skill level // on, and return the value.of that Cvar - -/* <16a558> ../cstrike/dlls/skill.cpp:30 */ NOXREF float GetSkillCvar(char *pName) { int iCount; diff --git a/regamedll/dlls/skill.h b/regamedll/dlls/skill.h index feab2056..88ca0bbc 100644 --- a/regamedll/dlls/skill.h +++ b/regamedll/dlls/skill.h @@ -57,6 +57,6 @@ struct skilldata_t extern skilldata_t gSkillData; -NOXREF float GetSkillCvar(char *pName); +float GetSkillCvar(char *pName); #endif // SKILL_H diff --git a/regamedll/dlls/sound.cpp b/regamedll/dlls/sound.cpp index 330f04a4..1bf196a1 100644 --- a/regamedll/dlls/sound.cpp +++ b/regamedll/dlls/sound.cpp @@ -76,10 +76,7 @@ char grgchTextureType[ CTEXTURESMAX ]; int fTextureTypeInit; int gcTextures; -/* <172311> ../cstrike/dlls/sound.cpp:140 */ LINK_ENTITY_TO_CLASS(ambient_generic, CAmbientGeneric); - -/* <171c1f> ../cstrike/dlls/sound.cpp:155 */ IMPLEMENT_SAVERESTORE(CAmbientGeneric, CBaseEntity); // -1 : "Default" @@ -87,8 +84,6 @@ IMPLEMENT_SAVERESTORE(CAmbientGeneric, CBaseEntity); // 200 : "Small Radius" // 125 : "Medium Radius" // 80 : "Large Radius" - -/* <1718ea> ../cstrike/dlls/sound.cpp:160 */ void CAmbientGeneric::__MAKE_VHOOK(Spawn)() { if (pev->spawnflags & AMBIENT_SOUND_EVERYWHERE) @@ -146,7 +141,6 @@ void CAmbientGeneric::__MAKE_VHOOK(Spawn)() Precache(); } -/* <1724f8> ../cstrike/dlls/sound.cpp:223 */ void CAmbientGeneric::__MAKE_VHOOK(Restart)() { if (pev->spawnflags & AMBIENT_SOUND_EVERYWHERE) @@ -213,7 +207,6 @@ void CAmbientGeneric::__MAKE_VHOOK(Restart)() } } -/* <1724bb> ../cstrike/dlls/sound.cpp:296 */ void CAmbientGeneric::__MAKE_VHOOK(Precache)() { char *szSoundFile = (char *)STRING(pev->message); @@ -249,8 +242,6 @@ void CAmbientGeneric::__MAKE_VHOOK(Precache)() // pitch or volume of the playing sound. This function will // ramp pitch and/or volume up or down, modify pitch/volume // with lfo if active. - -/* <171973> ../cstrike/dlls/sound.cpp:328 */ void CAmbientGeneric::RampThink() { char *szSoundFile = (char *)STRING(pev->message); @@ -377,14 +368,14 @@ void CAmbientGeneric::RampThink() if (m_dpv.lfofrac < 0) { m_dpv.lfofrac = 0; - m_dpv.lforate = abs(m_dpv.lforate); + m_dpv.lforate = Q_abs(m_dpv.lforate); pos = 0; } else if (pos > 255) { pos = 255; m_dpv.lfofrac = (255 << 8); - m_dpv.lforate = -abs(m_dpv.lforate); + m_dpv.lforate = -Q_abs(m_dpv.lforate); } switch (m_dpv.lfotype) @@ -463,8 +454,6 @@ void CAmbientGeneric::RampThink() // Init all ramp params in preparation to // play a new sound - -/* <1723db> ../cstrike/dlls/sound.cpp:521 */ void CAmbientGeneric::InitModulationParms() { int pitchinc; @@ -474,6 +463,7 @@ void CAmbientGeneric::InitModulationParms() if (m_dpv.volrun > 100) m_dpv.volrun = 100; + if (m_dpv.volrun < 0) m_dpv.volrun = 0; @@ -538,7 +528,7 @@ void CAmbientGeneric::InitModulationParms() m_dpv.volfrac = m_dpv.vol << 8; m_dpv.lfofrac = 0; - m_dpv.lforate = abs(m_dpv.lforate); + m_dpv.lforate = Q_abs(m_dpv.lforate); m_dpv.cspincount = 1; @@ -565,8 +555,6 @@ void CAmbientGeneric::InitModulationParms() // ambient is a looping sound, mark sound as active (m_fActive) // if it's playing, innactive if not. If the sound is not // a looping sound, never mark it as active. - -/* <172418> ../cstrike/dlls/sound.cpp:605 */ void CAmbientGeneric::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { char *szSoundFile = (char *)STRING(pev->message); @@ -667,8 +655,6 @@ void CAmbientGeneric::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, U // KeyValue - load keyvalue pairs into member data of the // ambient generic. NOTE: called BEFORE spawn! - -/* <171f38> ../cstrike/dlls/sound.cpp:717 */ void CAmbientGeneric::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { // NOTE: changing any of the modifiers in this code @@ -865,13 +851,9 @@ void CAmbientGeneric::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <172566> ../cstrike/dlls/sound.cpp:891 */ LINK_ENTITY_TO_CLASS(env_sound, CEnvSound); - -/* <171bd2> ../cstrike/dlls/sound.cpp:898 */ IMPLEMENT_SAVERESTORE(CEnvSound, CBaseEntity); -/* <171d61> ../cstrike/dlls/sound.cpp:901 */ void CEnvSound::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "radius")) @@ -888,8 +870,6 @@ void CEnvSound::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) // returns TRUE if the given sound entity (pev) is in range // and can see the given player entity (pevTarget) - -/* <172633> ../cstrike/dlls/sound.cpp:919 */ BOOL FEnvSoundInRange(entvars_t *pev, entvars_t *pevTarget, float *pflRange) { CEnvSound *pSound = GetClassPtr((CEnvSound *)pev); @@ -928,16 +908,13 @@ BOOL FEnvSoundInRange(entvars_t *pev, entvars_t *pevTarget, float *pflRange) // sound entity to the client will set the client's room_type. // A client's room_type will remain set to its prior value until // a new in-range, visible sound entity resets a new room_type. - +// // CONSIDER: if player in water state, autoset roomtype to 14,15 or 16. - -/* <17428e> ../cstrike/dlls/sound.cpp:960 */ void CEnvSound::__MAKE_VHOOK(Think)() { // get pointer to client if visible; FIND_CLIENT_IN_PVS will // cycle through visible clients on consecutive calls. edict_t *pentPlayer = FIND_CLIENT_IN_PVS(edict()); - CBasePlayer *pPlayer = NULL; if (FNullEnt(pentPlayer)) { @@ -945,7 +922,7 @@ void CEnvSound::__MAKE_VHOOK(Think)() goto env_sound_Think_slow; } - pPlayer = GetClassPtr((CBasePlayer *)VARS(pentPlayer)); + CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)VARS(pentPlayer)); float flRange; // check to see if this is the sound entity that is @@ -1026,8 +1003,6 @@ env_sound_Think_slow: // env_sound - spawn a sound entity that will set player roomtype // when player moves in range and sight. - -/* <171926> ../cstrike/dlls/sound.cpp:1053 */ void CEnvSound::__MAKE_VHOOK(Spawn)() { // spread think times @@ -1035,8 +1010,6 @@ void CEnvSound::__MAKE_VHOOK(Spawn)() } // randomize list of sentence name indices - -/* <17093f> ../cstrike/dlls/sound.cpp:1084 */ void USENTENCEG_InitLRU(unsigned char *plru, int count) { int i, j, k; @@ -1068,8 +1041,6 @@ void USENTENCEG_InitLRU(unsigned char *plru, int count) // ipick is passed in as the requested sentence ordinal. // ipick 'next' is returned. // return of -1 indicates an error. - -/* <17290a> ../cstrike/dlls/sound.cpp:1115 */ int USENTENCEG_PickSequential(int isentenceg, char *szfound, int ipick, int freset) { char *szgroupname; @@ -1114,8 +1085,6 @@ int USENTENCEG_PickSequential(int isentenceg, char *szfound, int ipick, int fres // rest of the lru filled with -1. The first integer in the lru is // actually the size of the list. Returns ipick, the ordinal // of the picked sentence within the group. - -/* <1729cb> ../cstrike/dlls/sound.cpp:1163 */ int USENTENCEG_Pick(int isentenceg, char *szfound) { char *szgroupname; @@ -1167,8 +1136,6 @@ int USENTENCEG_Pick(int isentenceg, char *szfound) // Given sentence group rootname (name without number suffix), // get sentence group index (isentenceg). Returns -1 if no such name. - -/* <172b0c> ../cstrike/dlls/sound.cpp:1213 */ int SENTENCEG_GetIndex(const char *szgroupname) { int i; @@ -1194,8 +1161,6 @@ int SENTENCEG_GetIndex(const char *szgroupname) // returns ipick - which sentence was picked to // play from the group. Ipick is only needed if you plan on stopping // the sound before playback is done (see SENTENCEG_Stop). - -/* <170eb5> ../cstrike/dlls/sound.cpp:1238 */ int SENTENCEG_PlayRndI(edict_t *entity, int isentenceg, float volume, float attenuation, int flags, int pitch) { char name[64]; @@ -1207,15 +1172,20 @@ int SENTENCEG_PlayRndI(edict_t *entity, int isentenceg, float volume, float atte name[0] = '\0'; ipick = USENTENCEG_Pick(isentenceg, name); + +#ifndef REGAMEDLL_FIXES if (ipick > 0 && name) +#else + if (ipick > 0 /*&& name[0] != '\0'*/) +#endif + { EMIT_SOUND_DYN(entity, CHAN_VOICE, name, volume, attenuation, flags, pitch); + } return ipick; } // same as above, but takes sentence group name instead of index - -/* <170a36> ../cstrike/dlls/sound.cpp:1257 */ int SENTENCEG_PlayRndSz(edict_t *entity, const char *szgroupname, float volume, float attenuation, int flags, int pitch) { char name[64]; @@ -1245,8 +1215,6 @@ int SENTENCEG_PlayRndSz(edict_t *entity, const char *szgroupname, float volume, } // play sentences in sequential order from sentence group. Reset after last sentence. - -/* <173125> ../cstrike/dlls/sound.cpp:1285 */ int SENTENCEG_PlaySequentialSz(edict_t *entity, const char *szgroupname, float volume, float attenuation, int flags, int pitch, int ipick, int freset) { char name[64]; @@ -1273,8 +1241,6 @@ int SENTENCEG_PlaySequentialSz(edict_t *entity, const char *szgroupname, float v // for this entity, for the given sentence within the sentence group, stop // the sentence. - -/* <173360> ../cstrike/dlls/sound.cpp:1311 */ NOXREF void SENTENCEG_Stop(edict_t *entity, int isentenceg, int ipick) { char buffer[64]; @@ -1297,8 +1263,6 @@ NOXREF void SENTENCEG_Stop(edict_t *entity, int isentenceg, int ipick) // open sentences.txt, scan for groups, build rgsentenceg // Should be called from world spawn, only works on the // first call and is ignored subsequently. - -/* <1734e4> ../cstrike/dlls/sound.cpp:1334 */ void SENTENCEG_Init() { char buffer[512]; @@ -1334,7 +1298,7 @@ void SENTENCEG_Init() if (!buffer[i]) continue; - if (buffer[i] == '/' || !isalpha(buffer[i])) + if (buffer[i] == '/' || !Q_isalpha(buffer[i])) continue; // get sentence name @@ -1362,8 +1326,7 @@ void SENTENCEG_Init() Q_strcpy(gszallsentencenames[gcallsentences++], pString); - j--; - if (j <= i) + if (--j <= i) continue; if (!isdigit(buffer[j])) @@ -1381,7 +1344,7 @@ void SENTENCEG_Init() // if new name doesn't match previous group name, // make a new group. - if (Q_strcmp(szgroup, &(buffer[i]))) + if (Q_strcmp(szgroup, &(buffer[i])) != 0) { // name doesn't match with prev name, // copy name into group, init count to 1 @@ -1423,8 +1386,6 @@ void SENTENCEG_Init() } // convert sentence (sample) name to !sentencenum, return !sentencenum - -/* <172b37> ../cstrike/dlls/sound.cpp:1457 */ int SENTENCEG_Lookup(const char *sample, char *sentencenum) { char sznum[8]; @@ -1442,6 +1403,7 @@ int SENTENCEG_Lookup(const char *sample, char *sentencenum) Q_sprintf(sznum, "%d", i); Q_strcat(sentencenum, sznum); } + return i; } } @@ -1450,7 +1412,6 @@ int SENTENCEG_Lookup(const char *sample, char *sentencenum) return -1; } -/* <170992> ../cstrike/dlls/sound.cpp:1483 */ void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch) { if (sample && *sample == '!') @@ -1466,8 +1427,6 @@ void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volu } // play a specific sentence over the HEV suit speaker - just pass player entity, and !sentencename - -/* <173770> ../cstrike/dlls/sound.cpp:1500 */ void EMIT_SOUND_SUIT(edict_t *entity, const char *sample) { float fvol; @@ -1482,8 +1441,6 @@ void EMIT_SOUND_SUIT(edict_t *entity, const char *sample) } // play a sentence, randomly selected from the passed in group id, over the HEV suit speaker - -/* <1738c3> ../cstrike/dlls/sound.cpp:1515 */ void EMIT_GROUPID_SUIT(edict_t *entity, int isentenceg) { float fvol; @@ -1500,8 +1457,6 @@ void EMIT_GROUPID_SUIT(edict_t *entity, int isentenceg) } // play a sentence, randomly selected from the passed in groupname - -/* <173a7b> ../cstrike/dlls/sound.cpp:1530 */ NOXREF void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname) { float fvol; @@ -1518,7 +1473,6 @@ NOXREF void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname) } } -/* <171cc9> ../cstrike/dlls/sound.cpp:1561 */ char *memfgets(byte *pMemFile, int fileSize, int &filePos, char *pBuffer, int bufferSize) { // Bullet-proofing @@ -1566,7 +1520,6 @@ char *memfgets(byte *pMemFile, int fileSize, int &filePos, char *pBuffer, int bu return NULL; } -/* <173cc2> ../cstrike/dlls/sound.cpp:1610 */ void TEXTURETYPE_Init() { char buffer[512]; @@ -1593,21 +1546,21 @@ void TEXTURETYPE_Init() { // skip whitespace i = 0; - while (buffer[i] && isspace(buffer[i])) + while (buffer[i] && Q_isspace(buffer[i])) ++i; if (!buffer[i]) continue; // skip comment lines - if (buffer[i] == '/' || !isalpha(buffer[i])) + if (buffer[i] == '/' || !Q_isalpha(buffer[i])) continue; // get texture type - grgchTextureType[gcTextures] = toupper(buffer[i++]); + grgchTextureType[gcTextures] = Q_toupper(buffer[i++]); // skip whitespace - while (buffer[i] && isspace(buffer[i])) + while (buffer[i] && Q_isspace(buffer[i])) ++i; if (!buffer[i]) @@ -1615,7 +1568,7 @@ void TEXTURETYPE_Init() // get sentence name j = i; - while (buffer[j] && !isspace(buffer[j])) + while (buffer[j] && !Q_isspace(buffer[j])) j++; if (!buffer[j]) @@ -1634,11 +1587,9 @@ void TEXTURETYPE_Init() // given texture name, find texture type // if not found, return type 'concrete' - +// // NOTE: this routine should ONLY be called if the // current texture under the player changes! - -/* <173d41> ../cstrike/dlls/sound.cpp:1680 */ char TEXTURETYPE_Find(char *name) { // CONSIDER: pre-sort texture names and perform faster binary search here @@ -1655,8 +1606,6 @@ char TEXTURETYPE_Find(char *name) // play a strike sound based on the texture that was hit by the attack traceline. VecSrc/VecEnd are the // original traceline endpoints used by the attacker, iBulletType is the type of bullet that hit the texture. // returns volume of strike instrument (crowbar) to play - -/* <173d99> ../cstrike/dlls/sound.cpp:1697 */ float TEXTURETYPE_PlaySound(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType) { // hit the world, try to play sound based on texture material type @@ -1860,15 +1809,10 @@ float TEXTURETYPE_PlaySound(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int return fvolbar; } -/* <17406b> ../cstrike/dlls/sound.cpp:1885 */ LINK_ENTITY_TO_CLASS(speaker, CSpeaker); - -/* <171b85> ../cstrike/dlls/sound.cpp:1891 */ IMPLEMENT_SAVERESTORE(CSpeaker, CBaseEntity); // ambient_generic - general-purpose user-defined static sound - -/* <171c6b> ../cstrike/dlls/sound.cpp:1896 */ void CSpeaker::__MAKE_VHOOK(Spawn)() { char *szSoundFile = (char *)STRING(pev->message); @@ -1893,7 +1837,6 @@ void CSpeaker::__MAKE_VHOOK(Spawn)() Precache(); } -/* <171a16> ../cstrike/dlls/sound.cpp:1924 */ void CSpeaker::__MAKE_VHOOK(Precache)() { if (!(pev->spawnflags & SPEAKER_START_SILENT)) @@ -1903,7 +1846,6 @@ void CSpeaker::__MAKE_VHOOK(Precache)() } } -/* <172b7a> ../cstrike/dlls/sound.cpp:1930 */ void CSpeaker::SpeakerThink() { char *szSoundFile = NULL; @@ -1947,7 +1889,7 @@ void CSpeaker::SpeakerThink() // if is null - return; return; } -#endif // REGAMEDLL_FIXES +#endif if (szSoundFile[0] == '!') { @@ -1977,18 +1919,16 @@ void CSpeaker::SpeakerThink() } // ToggleUse - if an announcement is pending, cancel it. If no announcement is pending, start one. - -/* <171a4e> ../cstrike/dlls/sound.cpp:1997 */ void CSpeaker::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { - int fActive = (pev->nextthink > 0.0f); + bool bActive = (pev->nextthink > 0.0f); - // fActive is TRUE only if an announcement is pending + // bActive is TRUE only if an announcement is pending if (useType != USE_TOGGLE) { // ignore if we're just turning something on that's already on, or // turning something off that's already off. - if ((fActive && useType == USE_ON) || (!fActive && useType == USE_OFF)) + if ((bActive && useType == USE_ON) || (!bActive && useType == USE_OFF)) { return; } @@ -2004,16 +1944,16 @@ void CSpeaker::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE if (useType == USE_OFF) { // turn off announcements - pev->nextthink = 0.0; + pev->nextthink = 0.0f; return; } // Toggle announcements - if (fActive) + if (bActive) { // turn off announcements - pev->nextthink = 0.0; + pev->nextthink = 0.0f; } else { @@ -2024,8 +1964,6 @@ void CSpeaker::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE // KeyValue - load keyvalue pairs into member data // NOTE: called BEFORE spawn! - -/* <171e86> ../cstrike/dlls/sound.cpp:2044 */ void CSpeaker::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { // preset diff --git a/regamedll/dlls/sound.h b/regamedll/dlls/sound.h index a38737bf..2fdbfc20 100644 --- a/regamedll/dlls/sound.h +++ b/regamedll/dlls/sound.h @@ -105,7 +105,6 @@ typedef struct dynpitchvol } dynpitchvol_t; -/* <170b59> ../cstrike/dlls/sound.cpp:117 */ class CAmbientGeneric: public CBaseEntity { public: @@ -126,7 +125,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); @@ -142,7 +141,6 @@ public: BOOL m_fLooping; // TRUE when the sound played will loop }; -/* <170bc2> ../cstrike/dlls/sound.cpp:875 */ class CEnvSound: public CPointEntity { public: @@ -160,7 +158,7 @@ public: int Restore_(CRestore &restore); void Think_(); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[2]; @@ -169,7 +167,6 @@ public: float m_flRoomtype; }; -/* <170ced> ../cstrike/dlls/sound.cpp:1867 */ class CSpeaker: public CBaseEntity { public: @@ -188,11 +185,12 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT SpeakerThink(); + public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; @@ -207,19 +205,19 @@ int SENTENCEG_GetIndex(const char *szgroupname); int SENTENCEG_PlayRndI(edict_t *entity, int isentenceg, float volume, float attenuation, int flags, int pitch); int SENTENCEG_PlayRndSz(edict_t *entity, const char *szgroupname, float volume, float attenuation, int flags, int pitch); int SENTENCEG_PlaySequentialSz(edict_t *entity, const char *szgroupname, float volume, float attenuation, int flags, int pitch, int ipick, int freset); -NOXREF void SENTENCEG_Stop(edict_t *entity, int isentenceg, int ipick); +void SENTENCEG_Stop(edict_t *entity, int isentenceg, int ipick); void SENTENCEG_Init(); int SENTENCEG_Lookup(const char *sample, char *sentencenum); void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch); void EMIT_SOUND_SUIT(edict_t *entity, const char *sample); void EMIT_GROUPID_SUIT(edict_t *entity, int isentenceg); -NOXREF void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname); +void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname); char *memfgets(byte *pMemFile, int fileSize, int &filePos, char *pBuffer, int bufferSize); void TEXTURETYPE_Init(); char TEXTURETYPE_Find(char *name); float TEXTURETYPE_PlaySound(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType); -extern char gszallsentencenames[ CVOXFILESENTENCEMAX ][ CBSENTENCENAME_MAX ]; +extern char gszallsentencenames[CVOXFILESENTENCEMAX][CBSENTENCENAME_MAX]; extern int gcTextures; #endif // SOUND_H diff --git a/regamedll/dlls/soundent.cpp b/regamedll/dlls/soundent.cpp index f93db423..70bd6abc 100644 --- a/regamedll/dlls/soundent.cpp +++ b/regamedll/dlls/soundent.cpp @@ -2,12 +2,9 @@ CSoundEnt *pSoundEnt; -/* <178ca4> ../cstrike/dlls/soundent.cpp:22 */ LINK_ENTITY_TO_CLASS(soundent, CSoundEnt); // CSound - Clear - zeros all fields for a sound - -/* <178d6e> ../cstrike/dlls/soundent.cpp:29 */ void CSound::Clear() { m_vecOrigin = g_vecZero; @@ -20,8 +17,6 @@ void CSound::Clear() // Reset - clears the volume, origin, and type for a sound, // but doesn't expire or unlink it. - -/* <178d8f> ../cstrike/dlls/soundent.cpp:43 */ void CSound::Reset() { m_vecOrigin = g_vecZero; @@ -31,8 +26,6 @@ void CSound::Reset() } // FIsSound - returns TRUE if the sound is an Audible sound - -/* <178db7> ../cstrike/dlls/soundent.cpp:54 */ NOXREF BOOL CSound::FIsSound() { if (m_iType & (bits_SOUND_COMBAT | bits_SOUND_WORLD | bits_SOUND_PLAYER | bits_SOUND_DANGER)) @@ -44,8 +37,6 @@ NOXREF BOOL CSound::FIsSound() } // FIsScent - returns TRUE if the sound is actually a scent - -/* <178ddf> ../cstrike/dlls/soundent.cpp:67 */ NOXREF BOOL CSound::FIsScent() { if (m_iType & (bits_SOUND_CARCASS | bits_SOUND_MEAT | bits_SOUND_GARBAGE)) @@ -56,7 +47,6 @@ NOXREF BOOL CSound::FIsScent() return FALSE; } -/* <17900a> ../cstrike/dlls/soundent.cpp:80 */ void CSoundEnt::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -68,8 +58,6 @@ void CSoundEnt::__MAKE_VHOOK(Spawn)() // Think - at interval, the entire active sound list is checked // for sounds that have ExpireTimes less than or equal // to the current world time, and these sounds are deallocated. - -/* <178b0c> ../cstrike/dlls/soundent.cpp:93 */ void CSoundEnt::__MAKE_VHOOK(Think)() { int iSound; @@ -107,8 +95,6 @@ void CSoundEnt::__MAKE_VHOOK(Think)() } // Precache - dummy function - -/* <178a76> ../cstrike/dlls/soundent.cpp:132 */ void CSoundEnt::__MAKE_VHOOK(Precache)() { ; @@ -117,8 +103,6 @@ void CSoundEnt::__MAKE_VHOOK(Precache)() // FreeSound - clears the passed active sound and moves it // to the top of the free list. TAKE CARE to only call this // function for sounds in the Active list - -/* <178e07> ../cstrike/dlls/soundent.cpp:141 */ void CSoundEnt::FreeSound(int iSound, int iPrevious) { if (!pSoundEnt) @@ -147,8 +131,6 @@ void CSoundEnt::FreeSound(int iSound, int iPrevious) // IAllocSound - moves a sound from the Free list to the // Active list returns the index of the alloc'd sound - -/* <178e2d> ../cstrike/dlls/soundent.cpp:171 */ int CSoundEnt::IAllocSound() { int iNewSound; @@ -180,8 +162,6 @@ int CSoundEnt::IAllocSound() // InsertSound - Allocates a free sound and fills it with // sound info. - -/* <178e94> ../cstrike/dlls/soundent.cpp:200 */ void CSoundEnt::InsertSound(int iType, const Vector &vecOrigin, int iVolume, float flDuration) { int iThisSound; @@ -208,8 +188,6 @@ void CSoundEnt::InsertSound(int iType, const Vector &vecOrigin, int iVolume, flo // Initialize - clears all sounds and moves them into the // free sound list. - -/* <178f4e> ../cstrike/dlls/soundent.cpp:228 */ void CSoundEnt::Initialize() { int i; @@ -255,8 +233,6 @@ void CSoundEnt::Initialize() // ISoundsInList - returns the number of sounds in the desired // sound list. - -/* <179031> ../cstrike/dlls/soundent.cpp:274 */ int CSoundEnt::ISoundsInList(int iListType) { int i; @@ -292,8 +268,6 @@ int CSoundEnt::ISoundsInList(int iListType) } // ActiveList - returns the head of the active sound list - -/* <179073> ../cstrike/dlls/soundent.cpp:312 */ NOXREF int CSoundEnt::ActiveList() { if (!pSoundEnt) @@ -305,8 +279,6 @@ NOXREF int CSoundEnt::ActiveList() } // FreeList - returns the head of the free sound list - -/* <179083> ../cstrike/dlls/soundent.cpp:325 */ NOXREF int CSoundEnt::FreeList() { if (!pSoundEnt) @@ -319,8 +291,6 @@ NOXREF int CSoundEnt::FreeList() // SoundPointerForIndex - returns a pointer to the instance // of CSound at index's position in the sound pool. - -/* <179093> ../cstrike/dlls/soundent.cpp:339 */ CSound *CSoundEnt::SoundPointerForIndex(int iIndex) { if (!pSoundEnt) @@ -347,8 +317,6 @@ CSound *CSoundEnt::SoundPointerForIndex(int iIndex) // reserved sounds in the soundlist are from 0 to MAXCLIENTS - 1, // so this function ensures that a client gets the proper index // to his reserved sound in the soundlist. - -/* <1790b8> ../cstrike/dlls/soundent.cpp:367 */ int CSoundEnt::ClientSoundIndex(edict_t *pClient) { int iReturn = ENTINDEX(pClient) - 1; @@ -360,7 +328,7 @@ int CSoundEnt::ClientSoundIndex(edict_t *pClient) ALERT(at_console, "** ClientSoundIndex returning a bogus value! **\n"); } -#endif // _DEBUG && !HOOK_GAMEDLL +#endif return iReturn; } diff --git a/regamedll/dlls/soundent.h b/regamedll/dlls/soundent.h index e0fc1a7c..7ca31394 100644 --- a/regamedll/dlls/soundent.h +++ b/regamedll/dlls/soundent.h @@ -55,16 +55,14 @@ #define SOUND_NEVER_EXPIRE -1 // with this set as a sound's ExpireTime, the sound will never expire. // CSound - an instance of a sound in the world. - -/* <1da071> ../cstrike/dlls/soundent.h:44 */ class CSound { public: void Clear(); void Reset(); - NOXREF BOOL FIsSound(); - NOXREF BOOL FIsScent(); + BOOL FIsSound(); + BOOL FIsScent(); public: Vector m_vecOrigin; // sound's location in space @@ -78,8 +76,6 @@ public: // CSoundEnt - a single instance of this entity spawns when // the world spawns. The SoundEnt's job is to update the // world's Free and Active sound lists. - -/* <1da0b5> ../cstrike/dlls/soundent.h:67 */ class CSoundEnt: public CBaseEntity { public: @@ -95,7 +91,7 @@ public: void Precache_(); void Think_(); -#endif // HOOK_GAMEDLL +#endif public: void Initialize(); @@ -104,10 +100,10 @@ public: static void FreeSound(int iSound, int iPrevious); // return the head of the active list - NOXREF static int ActiveList(); + static int ActiveList(); // return the head of the free list - NOXREF static int FreeList(); + static int FreeList(); // return a pointer for this index in the sound list static CSound *SoundPointerForIndex(int iIndex); diff --git a/regamedll/dlls/spectator.cpp b/regamedll/dlls/spectator.cpp index becf98c9..0bcffdfe 100644 --- a/regamedll/dlls/spectator.cpp +++ b/regamedll/dlls/spectator.cpp @@ -14,7 +14,6 @@ void CBaseSpectator::SpectatorDisconnect() ; } -/* <17d35d> ../cstrike/dlls/spectator.cpp:61 */ void CBaseSpectator::SpectatorImpulseCommand() { static edict_t *pGoal = NULL; @@ -90,7 +89,6 @@ void CBaseSpectator::SpectatorThink() } } -/* <17d297> ../cstrike/dlls/spectator.cpp:142 */ void CBaseSpectator::__MAKE_VHOOK(Spawn)() { pev->flags = FL_SPECTATOR; diff --git a/regamedll/dlls/spectator.h b/regamedll/dlls/spectator.h index e57aa419..2b4148e2 100644 --- a/regamedll/dlls/spectator.h +++ b/regamedll/dlls/spectator.h @@ -46,7 +46,7 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif private: void SpectatorImpulseCommand(); diff --git a/regamedll/dlls/subs.cpp b/regamedll/dlls/subs.cpp index cb94906a..97634956 100644 --- a/regamedll/dlls/subs.cpp +++ b/regamedll/dlls/subs.cpp @@ -36,48 +36,30 @@ TYPEDESCRIPTION CBaseToggle::m_SaveData[] = DEFINE_FIELD(CBaseToggle, m_bitsDamageInflict, FIELD_INTEGER), // damage type inflicted }; -#endif // HOOK_GAMEDLL +#endif // Landmark class - -/* <1832bc> ../cstrike/dlls/subs.cpp:38 */ void CPointEntity::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; } // Null Entity, remove on startup - -/* <183417> ../cstrike/dlls/subs.cpp:53 */ void CNullEntity::__MAKE_VHOOK(Spawn)() { REMOVE_ENTITY(ENT(pev)); } -/* <1838f5> ../cstrike/dlls/subs.cpp:57 */ LINK_ENTITY_TO_CLASS(info_null, CNullEntity); // These are the new entry points to entities. - -/* <1839f1> ../cstrike/dlls/subs.cpp:69 */ LINK_ENTITY_TO_CLASS(info_player_deathmatch, CBaseDMStart); - -/* <183aed> ../cstrike/dlls/subs.cpp:70 */ LINK_ENTITY_TO_CLASS(info_player_start, CPointEntity); - -/* <183bb7> ../cstrike/dlls/subs.cpp:71 */ LINK_ENTITY_TO_CLASS(info_vip_start, CBaseDMStart); - -/* <183c81> ../cstrike/dlls/subs.cpp:72 */ LINK_ENTITY_TO_CLASS(info_landmark, CPointEntity); - -/* <183d4b> ../cstrike/dlls/subs.cpp:75 */ LINK_ENTITY_TO_CLASS(info_hostage_rescue, CPointEntity); - -/* <183e15> ../cstrike/dlls/subs.cpp:77 */ LINK_ENTITY_TO_CLASS(info_bomb_target, CPointEntity); -/* <183647> ../cstrike/dlls/subs.cpp:79 */ void CBaseDMStart::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "master")) @@ -89,7 +71,6 @@ void CBaseDMStart::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <18331c> ../cstrike/dlls/subs.cpp:90 */ BOOL CBaseDMStart::__MAKE_VHOOK(IsTriggered)(CBaseEntity *pEntity) { BOOL master = UTIL_IsMasterTriggered(pev->netname, pEntity); @@ -98,17 +79,13 @@ BOOL CBaseDMStart::__MAKE_VHOOK(IsTriggered)(CBaseEntity *pEntity) } // This updates global tables that need to know about entities being removed - -/* <183f03> ../cstrike/dlls/subs.cpp:98 */ void CBaseEntity::UpdateOnRemove() { - int i; - if (pev->flags & FL_GRAPHED) { // this entity was a LinkEnt in the world node graph, so we must remove it from // the graph since we are removing it from the world. - for (i = 0; i < WorldGraph.m_cLinks; ++i) + for (int i = 0; i < WorldGraph.m_cLinks; ++i) { if (WorldGraph.m_pLinkPool[i].m_pLinkEnt == pev) { @@ -125,8 +102,6 @@ void CBaseEntity::UpdateOnRemove() } // Convenient way to delay removing oneself - -/* <183f38> ../cstrike/dlls/subs.cpp:120 */ void CBaseEntity::SUB_Remove() { UpdateOnRemove(); @@ -141,17 +116,13 @@ void CBaseEntity::SUB_Remove() } // Convenient way to explicitly do nothing (passed to functions that require a method) - -/* <183f8a> ../cstrike/dlls/subs.cpp:135 */ void CBaseEntity::SUB_DoNothing() { ; } -/* <183523> ../cstrike/dlls/subs.cpp:147 */ IMPLEMENT_SAVERESTORE(CBaseDelay, CBaseEntity); -/* <18356f> ../cstrike/dlls/subs.cpp:149 */ void CBaseDelay::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "delay")) @@ -170,14 +141,12 @@ void CBaseDelay::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) // If self.delay is set, a DelayedUse entity will be created that will actually // do the SUB_UseTargets after that many seconds have passed. - +// // Removes all entities with a targetname that match self.killtarget, // and removes them, so some events can remove other triggers. - +// // Search for (string)targetname in all entities that // match (string)self.target and call their .use function (if they have one) - -/* <1840d5> ../cstrike/dlls/subs.cpp:183 */ void CBaseEntity::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value) { // fire targets @@ -187,7 +156,6 @@ void CBaseEntity::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, floa } } -/* <183fb0> ../cstrike/dlls/subs.cpp:195 */ void FireTargets(const char *targetName, CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { edict_t *pentTarget = NULL; @@ -204,7 +172,7 @@ void FireTargets(const char *targetName, CBaseEntity *pActivator, CBaseEntity *p CBaseEntity *pTarget = CBaseEntity::Instance(pentTarget); // Don't use dying ents - if (pTarget && !(pTarget->pev->flags & FL_KILLME)) + if (pTarget != NULL && !(pTarget->pev->flags & FL_KILLME)) { ALERT(at_aiconsole, "Found: %s, firing (%s)\n", STRING(pTarget->pev->classname), targetName); pTarget->Use(pActivator, pCaller, useType, value); @@ -212,10 +180,8 @@ void FireTargets(const char *targetName, CBaseEntity *pActivator, CBaseEntity *p } } -/* <1843f8> ../cstrike/dlls/subs.cpp:249 */ LINK_ENTITY_TO_CLASS(DelayedUse, CBaseDelay); -/* <1844c2> ../cstrike/dlls/subs.cpp:252 */ void CBaseDelay::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value) { // exit immediatly if we don't have a target or kill target @@ -227,19 +193,14 @@ void CBaseDelay::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float { // create a temp object to fire at a later time CBaseDelay *pTemp = GetClassPtr((CBaseDelay *)NULL); - if (pTemp->pev->classname) - { - RemoveEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME); - } MAKE_STRING_CLASS("DelayedUse", pTemp->pev); - AddEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME); pTemp->pev->nextthink = gpGlobals->time + m_flDelay; pTemp->SetThink(&CBaseDelay::DelayThink); // Save the useType - pTemp->pev->button = (int)useType; + pTemp->pev->button = int(useType); pTemp->m_iszKillTarget = m_iszKillTarget; // prevent "recursion" @@ -290,8 +251,6 @@ void CBaseDelay::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float // QuakeEd only writes a single float for angles (bad idea), so up and down are // just constant angles. - -/* <1846d9> ../cstrike/dlls/subs.cpp:335 */ void SetMovedir(entvars_t *pev) { if (pev->angles == Vector(0, -1, 0)) @@ -311,7 +270,6 @@ void SetMovedir(entvars_t *pev) pev->angles = g_vecZero; } -/* <184158> ../cstrike/dlls/subs.cpp:357 */ void CBaseDelay::DelayThink() { CBaseEntity *pActivator = NULL; @@ -327,10 +285,8 @@ void CBaseDelay::DelayThink() REMOVE_ENTITY(ENT(pev)); } -/* <1834d6> ../cstrike/dlls/subs.cpp:394 */ IMPLEMENT_SAVERESTORE(CBaseToggle, CBaseAnimating); -/* <1836dc> ../cstrike/dlls/subs.cpp:397 */ void CBaseToggle::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "lip")) @@ -359,8 +315,6 @@ void CBaseToggle::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) // calculate pev->velocity and pev->nextthink to reach vecDest from // pev->origin traveling at flSpeed - -/* <18474d> ../cstrike/dlls/subs.cpp:431 */ void CBaseToggle::LinearMove(Vector vecDest, float flSpeed) { assert(("LinearMove: no speed is defined!", flSpeed != 0)); @@ -386,12 +340,10 @@ void CBaseToggle::LinearMove(Vector vecDest, float flSpeed) SetThink(&CBaseToggle::LinearMoveDone); // scale the destdelta vector by the time spent traveling to get velocity - pev->velocity = vecDestDelta * (float)(1 / flTravelTime); + pev->velocity = vecDestDelta * float(1 / flTravelTime); } // After moving, set origin to exact final destination, call "move done" function - -/* <18337e> ../cstrike/dlls/subs.cpp:465 */ void CBaseToggle::LinearMoveDone() { UTIL_SetOrigin(pev, m_vecFinalDest); @@ -404,7 +356,6 @@ void CBaseToggle::LinearMoveDone() } } -/* <184855> ../cstrike/dlls/subs.cpp:474 */ NOXREF BOOL CBaseToggle::IsLockedByMaster() { if (!FStringNull(m_sMaster) && !UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) @@ -416,8 +367,6 @@ NOXREF BOOL CBaseToggle::IsLockedByMaster() // calculate pev->velocity and pev->nextthink to reach vecDest from // pev->origin traveling at flSpeed // Just like LinearMove, but rotational. - -/* <18487c> ../cstrike/dlls/subs.cpp:491 */ void CBaseToggle::AngularMove(Vector vecDestAngle, float flSpeed) { assert(("AngularMove: no speed is defined!", flSpeed != 0)); @@ -447,8 +396,6 @@ void CBaseToggle::AngularMove(Vector vecDestAngle, float flSpeed) } // After rotating, set angle to exact final angle, call "move done" function - -/* <1832fb> ../cstrike/dlls/subs.cpp:525 */ void CBaseToggle::AngularMoveDone() { pev->angles = m_vecFinalAngle; @@ -461,7 +408,6 @@ void CBaseToggle::AngularMoveDone() } } -/* <184984> ../cstrike/dlls/subs.cpp:535 */ float CBaseToggle::AxisValue(int flags, const Vector &angles) { if (flags & SF_DOOR_ROTATE_Z) @@ -473,7 +419,6 @@ float CBaseToggle::AxisValue(int flags, const Vector &angles) return angles.y; } -/* <1849bd> ../cstrike/dlls/subs.cpp:546 */ void CBaseToggle::AxisDir(entvars_t *pev) { if (pev->spawnflags & SF_DOOR_ROTATE_Z) @@ -493,7 +438,6 @@ void CBaseToggle::AxisDir(entvars_t *pev) } } -/* <1849e3> ../cstrike/dlls/subs.cpp:557 */ float CBaseToggle::AxisDelta(int flags, const Vector &angle1, const Vector &angle2) { if (flags & SF_DOOR_ROTATE_Z) @@ -506,8 +450,6 @@ float CBaseToggle::AxisDelta(int flags, const Vector &angle1, const Vector &angl } // returns TRUE if the passed entity is visible to caller, even if not infront () - -/* <184a30> ../cstrike/dlls/subs.cpp:577 */ NOXREF BOOL FEntIsVisible(entvars_t *pev, entvars_t *pevTarget) { Vector vecSpot1 = pev->origin + pev->view_ofs; diff --git a/regamedll/dlls/subs.h b/regamedll/dlls/subs.h index 7d2ddbd6..9ce5173b 100644 --- a/regamedll/dlls/subs.h +++ b/regamedll/dlls/subs.h @@ -32,7 +32,6 @@ #pragma once #endif -/* <182770> ../cstrike/dlls/subs.cpp:45 */ class CNullEntity: public CBaseEntity { public: @@ -42,11 +41,10 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; -/* <1827de> ../cstrike/dlls/subs.cpp:59 */ class CBaseDMStart: public CPointEntity { public: @@ -58,12 +56,12 @@ public: void KeyValue_(KeyValueData *pkvd); BOOL IsTriggered_(CBaseEntity *pEntity); -#endif // HOOK_GAMEDLL +#endif }; void FireTargets(const char *targetName, CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void SetMovedir(entvars_t *pev); -NOXREF BOOL FEntIsVisible(entvars_t *pev, entvars_t *pevTarget); +BOOL FEntIsVisible(entvars_t *pev, entvars_t *pevTarget); #endif // SUBS_H diff --git a/regamedll/dlls/training_gamerules.cpp b/regamedll/dlls/training_gamerules.cpp index 6d17817b..a6d584e8 100644 --- a/regamedll/dlls/training_gamerules.cpp +++ b/regamedll/dlls/training_gamerules.cpp @@ -24,38 +24,33 @@ TYPEDESCRIPTION CBaseGrenCatch::m_SaveData[] = DEFINE_FIELD(CBaseGrenCatch, sDisableOnGrenade, FIELD_STRING), }; -#endif // HOOK_GAMEDLL +#endif -/* <18bcc4> ../cstrike/dlls/training_gamerules.cpp:23 */ CHalfLifeTraining::CHalfLifeTraining() { PRECACHE_MODEL("models/w_weaponbox.mdl"); } -/* <18ae1b> ../cstrike/dlls/training_gamerules.cpp:27 */ BOOL CHalfLifeTraining::__MAKE_VHOOK(IsDeathmatch)() { return FALSE; } -/* <18ae41> ../cstrike/dlls/training_gamerules.cpp:28 */ void CHalfLifeTraining::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl) { ; } -/* <18bcff> ../cstrike/dlls/training_gamerules.cpp:29 */ void CHalfLifeTraining::HostageDied() { CBasePlayer *pPlayer = static_cast(UTIL_PlayerByIndex(1)); if (pPlayer != NULL) { - pPlayer->pev->radsuit_finished = gpGlobals->time + 3; + pPlayer->pev->radsuit_finished = gpGlobals->time + 3.0f; } } -/* <18b005> ../cstrike/dlls/training_gamerules.cpp:34 */ edict_t *CHalfLifeTraining::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer) { CBaseEntity *pSpot = UTIL_FindEntityByClassname(NULL, "info_player_start"); @@ -76,7 +71,6 @@ edict_t *CHalfLifeTraining::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlaye return pSpot->edict(); } -/* <18b4aa> ../cstrike/dlls/training_gamerules.cpp:52 */ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) { if (pPlayer->pev->radsuit_finished && gpGlobals->time > pPlayer->pev->radsuit_finished) @@ -88,7 +82,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) { if (pPlayer->pev->scale) { - pPlayer->m_iAccount = (int)pPlayer->pev->scale; + pPlayer->m_iAccount = int(pPlayer->pev->scale); } } @@ -99,7 +93,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) } m_iHostagesRescued = 0; - m_iRoundTimeSecs = (int)(gpGlobals->time + 1.0f); + m_iRoundTimeSecs = int(gpGlobals->time + 1.0f); m_bFreezePeriod = FALSE; g_fGameOver = FALSE; @@ -167,7 +161,7 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) fInBuyArea = TRUE; if (pPlayer->m_iAccount < 16000 && FillAccountTime == 0.0f) - FillAccountTime = gpGlobals->time + 5; + FillAccountTime = gpGlobals->time + 5.0f; if (FillAccountTime != 0.0f && gpGlobals->time > FillAccountTime) { @@ -206,7 +200,6 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer) } } -/* <18b79c> ../cstrike/dlls/training_gamerules.cpp:151 */ void CHalfLifeTraining::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer) { if (pPlayer->m_bNotKilled) @@ -237,32 +230,27 @@ void CHalfLifeTraining::__MAKE_VHOOK(PlayerSpawn)(CBasePlayer *pPlayer) pPlayer->m_iHideHUD |= (HIDEHUD_WEAPONS | HIDEHUD_HEALTH | HIDEHUD_TIMER | HIDEHUD_MONEY); } -/* <18ae74> ../cstrike/dlls/training_gamerules.cpp:182 */ int CHalfLifeTraining::__MAKE_VHOOK(ItemShouldRespawn)(CItem *pItem) { return GR_ITEM_RESPAWN_NO; } -/* <18aea8> ../cstrike/dlls/training_gamerules.cpp:186 */ BOOL CHalfLifeTraining::__MAKE_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer) { return TRUE; } -/* <18bd40> ../cstrike/dlls/training_gamerules.cpp:190 */ bool CHalfLifeTraining::PlayerCanBuy(CBasePlayer *pPlayer) { return (pPlayer->m_signals.GetState() & SIGNAL_BUY) != 0; } -/* <18afa5> ../cstrike/dlls/training_gamerules.cpp:195 */ void CHalfLifeTraining::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) { SET_VIEW(pVictim->edict(), pVictim->edict()); FireTargets("game_playerdie", pVictim, pVictim, USE_TOGGLE, 0); } -/* <18b0fb> ../cstrike/dlls/training_gamerules.cpp:202 */ void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)() { CBaseEntity *pHostage = NULL; @@ -340,13 +328,9 @@ void CHalfLifeTraining::__MAKE_VHOOK(CheckWinConditions)() } } -/* <18b74f> ../cstrike/dlls/training_gamerules.cpp:280 */ IMPLEMENT_SAVERESTORE(CBaseGrenCatch, CBaseEntity); - -/* <18bd74> ../cstrike/dlls/training_gamerules.cpp:282 */ LINK_ENTITY_TO_CLASS(func_grencatch, CBaseGrenCatch); -/* <18af02> ../cstrike/dlls/training_gamerules.cpp:284 */ void CBaseGrenCatch::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_TRIGGER; @@ -357,7 +341,6 @@ void CBaseGrenCatch::__MAKE_VHOOK(Spawn)() pev->nextthink = gpGlobals->time + 0.1f; } -/* <18af50> ../cstrike/dlls/training_gamerules.cpp:293 */ void CBaseGrenCatch::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (!pOther) @@ -371,7 +354,6 @@ void CBaseGrenCatch::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) } } -/* <18b835> ../cstrike/dlls/training_gamerules.cpp:300 */ void CBaseGrenCatch::__MAKE_VHOOK(Think)() { CGrenade *pGrenade; @@ -436,7 +418,6 @@ void CBaseGrenCatch::__MAKE_VHOOK(Think)() pev->nextthink = gpGlobals->time + 0.1f; } -/* <18ba09> ../cstrike/dlls/training_gamerules.cpp:358 */ void CBaseGrenCatch::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "triggerongrenade")) @@ -466,7 +447,6 @@ void CBaseGrenCatch::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <18af29> ../cstrike/dlls/training_gamerules.cpp:400 */ void CFuncWeaponCheck::__MAKE_VHOOK(Spawn)() { pev->dmgtime = 0; @@ -477,13 +457,9 @@ void CFuncWeaponCheck::__MAKE_VHOOK(Spawn)() SET_MODEL(ENT(pev), STRING(pev->model)); } -/* <18b702> ../cstrike/dlls/training_gamerules.cpp:420 */ IMPLEMENT_SAVERESTORE(CFuncWeaponCheck, CBaseEntity); - -/* <18be46> ../cstrike/dlls/training_gamerules.cpp:422 */ LINK_ENTITY_TO_CLASS(func_weaponcheck, CFuncWeaponCheck); -/* <18b5f6> ../cstrike/dlls/training_gamerules.cpp:424 */ void CFuncWeaponCheck::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (!UTIL_IsMasterTriggered(sMaster, pOther)) @@ -495,7 +471,7 @@ void CFuncWeaponCheck::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) if (!pOther->IsPlayer()) return; - CBasePlayer *pPlayer = (CBasePlayer *)pOther; + CBasePlayer *pPlayer = static_cast(pOther); for (int i = 1; i <= iItemCount; ++i) { if (iAnyWeapon) @@ -530,7 +506,6 @@ void CFuncWeaponCheck::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) SUB_Remove(); } -/* <18bb28> ../cstrike/dlls/training_gamerules.cpp:462 */ void CFuncWeaponCheck::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "trigger_items")) diff --git a/regamedll/dlls/training_gamerules.h b/regamedll/dlls/training_gamerules.h index 70eb353d..ccc28dfa 100644 --- a/regamedll/dlls/training_gamerules.h +++ b/regamedll/dlls/training_gamerules.h @@ -32,7 +32,6 @@ #pragma once #endif -/* <18bcdd> ../cstrike/dlls/training_gamerules.cpp:23 */ class CHalfLifeTraining: public CHalfLifeMultiplay { public: @@ -62,7 +61,7 @@ public: int ItemShouldRespawn_(CItem *pItem); void CheckWinConditions_(); -#endif // HOOK_GAMEDLL +#endif public: static void HostageDied(); @@ -75,7 +74,6 @@ public: bool fVGUIMenus; }; -/* <18a1d5> ../cstrike/dlls/training_gamerules.cpp:252 */ class CBaseGrenCatch: public CBaseEntity { public: @@ -96,7 +94,7 @@ public: void Think_(); void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[5]; @@ -108,7 +106,6 @@ public: bool m_fFlashTouched; }; -/* <18a222> ../cstrike/dlls/training_gamerules.cpp:385 */ class CFuncWeaponCheck: public CBaseEntity { public: @@ -126,7 +123,7 @@ public: int Restore_(CRestore &restore); void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[6]; diff --git a/regamedll/dlls/trains.h b/regamedll/dlls/trains.h index 7f70445e..2ca13b63 100644 --- a/regamedll/dlls/trains.h +++ b/regamedll/dlls/trains.h @@ -50,7 +50,6 @@ #define SF_CORNER_TELEPORT 0x002 #define SF_CORNER_FIREONCE 0x004 -/* <121991> ../cstrike/dlls/trains.h:37 */ class CPathTrack: public CPointEntity { public: @@ -70,7 +69,7 @@ public: void Activate_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif void SetPrevious(CPathTrack *pprevious); void Link(); @@ -97,7 +96,6 @@ public: CPathTrack *m_paltpath; }; -/* <12c98a> ../cstrike/dlls/trains.h:75 */ class CFuncTrackTrain: public CBaseEntity { public: @@ -126,7 +124,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Blocked_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Next(); @@ -164,7 +162,6 @@ private: unsigned short m_usAdjustPitch; }; -/* <1ba5f9> ../cstrike/dlls/trains.h:134 */ class CFuncVehicle: public CBaseEntity { public: @@ -195,7 +192,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Blocked_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Next(); diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index b3af6dfc..80e29047 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -35,8 +35,8 @@ TYPEDESCRIPTION CMultiManager::m_SaveData[] = // Global Savedata for changelevel trigger TYPEDESCRIPTION CChangeLevel::m_SaveData[] = { - DEFINE_ARRAY(CChangeLevel, m_szMapName, FIELD_CHARACTER, 32), - DEFINE_ARRAY(CChangeLevel, m_szLandmarkName, FIELD_CHARACTER, 32), + DEFINE_ARRAY(CChangeLevel, m_szMapName, FIELD_CHARACTER, cchMapNameMost), + DEFINE_ARRAY(CChangeLevel, m_szLandmarkName, FIELD_CHARACTER, cchMapNameMost), DEFINE_FIELD(CChangeLevel, m_changeTarget, FIELD_STRING), DEFINE_FIELD(CChangeLevel, m_changeTargetDelay, FIELD_FLOAT), }; @@ -68,13 +68,9 @@ TYPEDESCRIPTION CTriggerCamera::m_SaveData[] = char st_szNextMap[cchMapNameMost]; char st_szNextSpot[cchMapNameMost]; -/* <1a257e> ../cstrike/dlls/triggers.cpp:60 */ LINK_ENTITY_TO_CLASS(func_friction, CFrictionModifier); - -/* <1a0ad7> ../cstrike/dlls/triggers.cpp:68 */ IMPLEMENT_SAVERESTORE(CFrictionModifier, CBaseEntity); -/* <19fa7d> ../cstrike/dlls/triggers.cpp:72 */ void CFrictionModifier::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_TRIGGER; @@ -87,8 +83,6 @@ void CFrictionModifier::__MAKE_VHOOK(Spawn)() } // Sets toucher's friction to m_frictionFraction (1.0 = normal friction) - -/* <19faa6> ../cstrike/dlls/triggers.cpp:82 */ void CFrictionModifier::ChangeFriction(CBaseEntity *pOther) { if (pOther->pev->movetype != MOVETYPE_BOUNCEMISSILE && pOther->pev->movetype != MOVETYPE_BOUNCE) @@ -98,26 +92,20 @@ void CFrictionModifier::ChangeFriction(CBaseEntity *pOther) } // Sets toucher's friction to m_frictionFraction (1.0 = normal friction) - -/* <1a1c39> ../cstrike/dlls/triggers.cpp:91 */ void CFrictionModifier::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "modifier")) { - m_frictionFraction = Q_atof(pkvd->szValue) / 100.0; + m_frictionFraction = Q_atof(pkvd->szValue) / 100.0f; pkvd->fHandled = TRUE; } else CBaseEntity::KeyValue(pkvd); } -/* <1a2657> ../cstrike/dlls/triggers.cpp:126 */ LINK_ENTITY_TO_CLASS(trigger_auto, CAutoTrigger); - -/* <1a0a85> ../cstrike/dlls/triggers.cpp:134 */ IMPLEMENT_SAVERESTORE(CAutoTrigger, CBaseDelay); -/* <1a1b64> ../cstrike/dlls/triggers.cpp:136 */ void CAutoTrigger::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "globalstate")) @@ -146,19 +134,16 @@ void CAutoTrigger::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseDelay::KeyValue(pkvd); } -/* <19fb05> ../cstrike/dlls/triggers.cpp:165 */ void CAutoTrigger::__MAKE_VHOOK(Spawn)() { Precache(); } -/* <19fb2d> ../cstrike/dlls/triggers.cpp:171 */ void CAutoTrigger::__MAKE_VHOOK(Precache)() { pev->nextthink = gpGlobals->time + 0.1f; } -/* <19d48c> ../cstrike/dlls/triggers.cpp:177 */ void CAutoTrigger::__MAKE_VHOOK(Think)() { if (!m_globalstate || gGlobalState.EntityGetState(m_globalstate) == GLOBAL_ON) @@ -172,13 +157,9 @@ void CAutoTrigger::__MAKE_VHOOK(Think)() } } -/* <1a2730> ../cstrike/dlls/triggers.cpp:207 */ LINK_ENTITY_TO_CLASS(trigger_relay, CTriggerRelay); - -/* <1a0a33> ../cstrike/dlls/triggers.cpp:214 */ IMPLEMENT_SAVERESTORE(CTriggerRelay, CBaseDelay); -/* <1a1abc> ../cstrike/dlls/triggers.cpp:216 */ void CTriggerRelay::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "triggerstate")) @@ -202,13 +183,11 @@ void CTriggerRelay::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseDelay::KeyValue(pkvd); } -/* <19fb7e> ../cstrike/dlls/triggers.cpp:240 */ void CTriggerRelay::__MAKE_VHOOK(Spawn)() { ; } -/* <1a01d7> ../cstrike/dlls/triggers.cpp:247 */ void CTriggerRelay::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { SUB_UseTargets(this, triggerType, 0); @@ -218,13 +197,9 @@ void CTriggerRelay::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCal } } -/* <1a283f> ../cstrike/dlls/triggers.cpp:304 */ LINK_ENTITY_TO_CLASS(multi_manager, CMultiManager); - -/* <1a09e0> ../cstrike/dlls/triggers.cpp:316 */ IMPLEMENT_SAVERESTORE(CMultiManager, CBaseToggle); -/* <1a19ed> ../cstrike/dlls/triggers.cpp:318 */ void CMultiManager::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "wait")) @@ -249,7 +224,6 @@ void CMultiManager::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } } -/* <19fbce> ../cstrike/dlls/triggers.cpp:347 */ void CMultiManager::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -281,7 +255,6 @@ void CMultiManager::__MAKE_VHOOK(Spawn)() } } -/* <1a03e5> ../cstrike/dlls/triggers.cpp:377 */ void CMultiManager::__MAKE_VHOOK(Restart)() { edict_t *pentTarget = NULL; @@ -298,9 +271,9 @@ void CMultiManager::__MAKE_VHOOK(Restart)() if (FNullEnt(pentTarget)) break; - CBaseEntity *pTarget = (CBaseEntity *)CBaseEntity::Instance(pentTarget); + CBaseEntity *pTarget = static_cast(CBaseEntity::Instance(pentTarget)); - if (pTarget && !(pTarget->pev->flags & FL_KILLME)) + if (pTarget != NULL && !(pTarget->pev->flags & FL_KILLME)) { pTarget->Restart(); } @@ -318,7 +291,6 @@ void CMultiManager::__MAKE_VHOOK(Restart)() m_index = 0; } -/* <1a1402> ../cstrike/dlls/triggers.cpp:420 */ BOOL CMultiManager::__MAKE_VHOOK(HasTarget)(string_t targetname) { for (int i = 0; i < m_cTargets; ++i) @@ -334,8 +306,6 @@ BOOL CMultiManager::__MAKE_VHOOK(HasTarget)(string_t targetname) // Designers were using this to fire targets that may or may not exist -- // so I changed it to use the standard target fire code, made it a little simpler. - -/* <1a0393> ../cstrike/dlls/triggers.cpp:432 */ void CMultiManager::ManagerThink() { float time; @@ -364,7 +334,6 @@ void CMultiManager::ManagerThink() pev->nextthink = m_startTime + m_flTargetDelay[ m_index ]; } -/* <1a291b> ../cstrike/dlls/triggers.cpp:457 */ CMultiManager *CMultiManager::Clone() { CMultiManager *pMulti = GetClassPtr((CMultiManager *)NULL); @@ -383,8 +352,6 @@ CMultiManager *CMultiManager::Clone() } // The USE function builds the time table and starts the entity thinking. - -/* <1a2a24> ../cstrike/dlls/triggers.cpp:475 */ void CMultiManager::ManagerUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // In multiplayer games, clone the MM and execute in the clone (like a thread) @@ -407,25 +374,20 @@ void CMultiManager::ManagerUse(CBaseEntity *pActivator, CBaseEntity *pCaller, US pev->nextthink = gpGlobals->time; } -/* <1a2ada> ../cstrike/dlls/triggers.cpp:532 */ LINK_ENTITY_TO_CLASS(env_render, CRenderFxManager); -/* <19fc52> ../cstrike/dlls/triggers.cpp:535 */ void CRenderFxManager::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; } -/* <1a0c95> ../cstrike/dlls/triggers.cpp:540 */ void CRenderFxManager::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!FStringNull(pev->target)) { edict_t *pentTarget = NULL; - while (true) + while ((pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target))) != NULL) { - pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target)); - if (FNullEnt(pentTarget)) break; @@ -446,10 +408,8 @@ void CRenderFxManager::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *p } } -/* <1a2bb6> ../cstrike/dlls/triggers.cpp:583 */ LINK_ENTITY_TO_CLASS(trigger, CBaseTrigger); -/* <1a2c92> ../cstrike/dlls/triggers.cpp:590 */ void CBaseTrigger::InitTrigger() { // trigger angles are used for one-way touches. An angle of 0 is assumed @@ -472,8 +432,6 @@ void CBaseTrigger::InitTrigger() } // Cache user-entity-field values until spawn is called. - -/* <1a17cf> ../cstrike/dlls/triggers.cpp:608 */ void CBaseTrigger::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "damage")) @@ -483,7 +441,7 @@ void CBaseTrigger::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } else if (FStrEq(pkvd->szKeyName, "count")) { - m_cTriggersLeft = (int)Q_atof(pkvd->szValue); + m_cTriggersLeft = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "damagetype")) @@ -495,13 +453,9 @@ void CBaseTrigger::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseToggle::KeyValue(pkvd); } -/* <1a3060> ../cstrike/dlls/triggers.cpp:636 */ LINK_ENTITY_TO_CLASS(trigger_hurt, CTriggerHurt); - -/* <1a313c> ../cstrike/dlls/triggers.cpp:649 */ LINK_ENTITY_TO_CLASS(trigger_monsterjump, CTriggerMonsterJump); -/* <1a2fdc> ../cstrike/dlls/triggers.cpp:652 */ void CTriggerMonsterJump::__MAKE_VHOOK(Spawn)() { SetMovedir(pev); @@ -523,7 +477,6 @@ void CTriggerMonsterJump::__MAKE_VHOOK(Spawn)() } } -/* <1a00e4> ../cstrike/dlls/triggers.cpp:671 */ void CTriggerMonsterJump::__MAKE_VHOOK(Think)() { // kill the trigger for now UNDONE @@ -534,7 +487,6 @@ void CTriggerMonsterJump::__MAKE_VHOOK(Think)() SetThink(NULL); } -/* <19fca2> ../cstrike/dlls/triggers.cpp:678 */ void CTriggerMonsterJump::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { entvars_t *pevOther = pOther->pev; @@ -559,13 +511,10 @@ void CTriggerMonsterJump::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) pev->nextthink = gpGlobals->time; } -/* <1a3218> ../cstrike/dlls/triggers.cpp:715 */ LINK_ENTITY_TO_CLASS(trigger_cdaudio, CTriggerCDAudio); // Changes tracks or stops CD when player touches // HACK: overloaded HEALTH to avoid adding new field - -/* <1a2382> ../cstrike/dlls/triggers.cpp:721 */ void CTriggerCDAudio::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { // only clients may trigger these events @@ -577,19 +526,16 @@ void CTriggerCDAudio::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) PlayTrack(); } -/* <1a2fb4> ../cstrike/dlls/triggers.cpp:731 */ void CTriggerCDAudio::__MAKE_VHOOK(Spawn)() { InitTrigger(); } -/* <1a2288> ../cstrike/dlls/triggers.cpp:736 */ void CTriggerCDAudio::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { PlayTrack(); } -/* <19e08b> ../cstrike/dlls/triggers.cpp:741 */ void PlayCDTrack(int iTrack) { edict_t *pClient; @@ -621,20 +567,16 @@ void PlayCDTrack(int iTrack) } // only plays for ONE client, so only use in single play! - -/* <1a3372> ../cstrike/dlls/triggers.cpp:773 */ void CTriggerCDAudio::PlayTrack() { - PlayCDTrack((int)pev->health); + PlayCDTrack(int(pev->health)); SetTouch(NULL); UTIL_Remove(this); } -/* <1a340c> ../cstrike/dlls/triggers.cpp:794 */ LINK_ENTITY_TO_CLASS(target_cdaudio, CTargetCDAudio); -/* <1a170f> ../cstrike/dlls/triggers.cpp:796 */ void CTargetCDAudio::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "radius")) @@ -646,7 +588,6 @@ void CTargetCDAudio::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CPointEntity::KeyValue(pkvd); } -/* <1a066a> ../cstrike/dlls/triggers.cpp:807 */ void CTargetCDAudio::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -654,19 +595,16 @@ void CTargetCDAudio::__MAKE_VHOOK(Spawn)() if (pev->scale > 0) { - pev->nextthink = gpGlobals->time + 1.0; + pev->nextthink = gpGlobals->time + 1.0f; } } -/* <1a2175> ../cstrike/dlls/triggers.cpp:816 */ void CTargetCDAudio::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { Play(); } // only plays for ONE client, so only use in single play! - -/* <1a2465> ../cstrike/dlls/triggers.cpp:822 */ void CTargetCDAudio::__MAKE_VHOOK(Think)() { edict_t *pClient; @@ -678,7 +616,7 @@ void CTargetCDAudio::__MAKE_VHOOK(Think)() if (!pClient) return; - pev->nextthink = gpGlobals->time + 0.5; + pev->nextthink = gpGlobals->time + 0.5f; if ((pClient->v.origin - pev->origin).Length() <= pev->scale) { @@ -686,14 +624,12 @@ void CTargetCDAudio::__MAKE_VHOOK(Think)() } } -/* <1a34e8> ../cstrike/dlls/triggers.cpp:840 */ void CTargetCDAudio::Play() { - PlayCDTrack((int)pev->health); + PlayCDTrack(int(pev->health)); UTIL_Remove(this); } -/* <1a2f8b> ../cstrike/dlls/triggers.cpp:853 */ void CTriggerHurt::__MAKE_VHOOK(Spawn)() { InitTrigger(); @@ -727,8 +663,6 @@ void CTriggerHurt::__MAKE_VHOOK(Spawn)() // trigger hurt that causes radiation will do a radius // check and set the player's geiger counter level // according to distance from center of trigger - -/* <1a5df2> ../cstrike/dlls/triggers.cpp:883 */ void CTriggerHurt::RadiationThink() { edict_t *pentPlayer; @@ -748,8 +682,8 @@ void CTriggerHurt::RadiationThink() origin = pev->origin; view_ofs = pev->view_ofs; - pev->origin = (pev->absmin + pev->absmax) * 0.5; - pev->view_ofs = pev->view_ofs * 0.0; + pev->origin = (pev->absmin + pev->absmax) * 0.5f; + pev->view_ofs = pev->view_ofs * 0.0f; pentPlayer = FIND_CLIENT_IN_PVS(edict()); @@ -764,8 +698,8 @@ void CTriggerHurt::RadiationThink() pevTarget = VARS(pentPlayer); // get range to player; - vecSpot1 = (pev->absmin + pev->absmax) * 0.5; - vecSpot2 = (pevTarget->absmin + pevTarget->absmax) * 0.5; + vecSpot1 = (pev->absmin + pev->absmax) * 0.5f; + vecSpot2 = (pevTarget->absmin + pevTarget->absmax) * 0.5f; vecRange = vecSpot1 - vecSpot2; flRange = vecRange.Length(); @@ -780,12 +714,10 @@ void CTriggerHurt::RadiationThink() } } - pev->nextthink = gpGlobals->time + 0.25; + pev->nextthink = gpGlobals->time + 0.25f; } // ToggleUse - If this is the USE function for a trigger, its state will toggle every time it's fired - -/* <1a007c> ../cstrike/dlls/triggers.cpp:942 */ void CBaseTrigger::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (pev->solid == SOLID_NOT) @@ -806,8 +738,6 @@ void CBaseTrigger::ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ } // When touched, a hurt trigger does DMG points of damage each half-second - -/* <1a0d93> ../cstrike/dlls/triggers.cpp:959 */ void CBaseTrigger::HurtTouch(CBaseEntity *pOther) { float fldmg; @@ -884,7 +814,7 @@ void CBaseTrigger::HurtTouch(CBaseEntity *pOther) // leaving the trigger // 0.5 seconds worth of damage, pev->dmg is damage/second - fldmg = pev->dmg * 0.5; + fldmg = pev->dmg * 0.5f; if (fldmg < 0) { @@ -900,7 +830,7 @@ void CBaseTrigger::HurtTouch(CBaseEntity *pOther) // Apply damage every half second // half second delay until this trigger can hurt toucher again - pev->dmgtime = gpGlobals->time + 0.5; + pev->dmgtime = gpGlobals->time + 0.5f; if (pev->target) { @@ -922,14 +852,12 @@ void CBaseTrigger::HurtTouch(CBaseEntity *pOther) } } -/* <1a3582> ../cstrike/dlls/triggers.cpp:1086 */ LINK_ENTITY_TO_CLASS(trigger_multiple, CTriggerMultiple); -/* <1a2f67> ../cstrike/dlls/triggers.cpp:1089 */ void CTriggerMultiple::__MAKE_VHOOK(Spawn)() { - if (m_flWait == 0) - m_flWait = 0.2; + if (m_flWait == 0.0f) + m_flWait = 0.2f; InitTrigger(); @@ -958,17 +886,14 @@ void CTriggerMultiple::__MAKE_VHOOK(Spawn)() } } -/* <1a365e> ../cstrike/dlls/triggers.cpp:1135 */ LINK_ENTITY_TO_CLASS(trigger_once, CTriggerOnce); -/* <1a301c> ../cstrike/dlls/triggers.cpp:1136 */ void CTriggerOnce::__MAKE_VHOOK(Spawn)() { m_flWait = -1; CTriggerMultiple::Spawn(); } -/* <1a20a4> ../cstrike/dlls/triggers.cpp:1145 */ void CBaseTrigger::MultiTouch(CBaseEntity *pOther) { entvars_t *pevToucher; @@ -987,8 +912,6 @@ void CBaseTrigger::MultiTouch(CBaseEntity *pOther) // the trigger was just touched/killed/used // self.enemy should be set to the activator so it can be held through a delay // so wait for the delay time before firing - -/* <1a373a> ../cstrike/dlls/triggers.cpp:1167 */ void CBaseTrigger::ActivateMultiTrigger(CBaseEntity *pActivator) { if (pev->nextthink > gpGlobals->time) @@ -1035,20 +958,17 @@ void CBaseTrigger::ActivateMultiTrigger(CBaseEntity *pActivator) // we can't just remove (self) here, because this is a touch function // called while C code is looping through area links... SetTouch(NULL); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; SetThink(&CBaseTrigger::SUB_Remove); } } // the wait time has passed, so set back up for another activation - -/* <19fd1a> ../cstrike/dlls/triggers.cpp:1214 */ void CBaseTrigger::MultiWaitOver() { SetThink(NULL); } -/* <1a1f98> ../cstrike/dlls/triggers.cpp:1231 */ void CBaseTrigger::CounterUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { m_cTriggersLeft--; @@ -1087,10 +1007,8 @@ void CBaseTrigger::CounterUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE ActivateMultiTrigger(m_hActivator); } -/* <1a3767> ../cstrike/dlls/triggers.cpp:1278 */ LINK_ENTITY_TO_CLASS(trigger_counter, CTriggerCounter); -/* <19fd42> ../cstrike/dlls/triggers.cpp:1280 */ void CTriggerCounter::__MAKE_VHOOK(Spawn)() { // By making the flWait be -1, this counter-trigger will disappear after it's activated @@ -1105,12 +1023,9 @@ void CTriggerCounter::__MAKE_VHOOK(Spawn)() SetUse(&CTriggerCounter::CounterUse); } -/* <1a3843> ../cstrike/dlls/triggers.cpp:1299 */ LINK_ENTITY_TO_CLASS(trigger_transition, CTriggerVolume); // Define space that travels across a level transition - -/* <19fd6a> ../cstrike/dlls/triggers.cpp:1302 */ void CTriggerVolume::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; @@ -1123,44 +1038,29 @@ void CTriggerVolume::__MAKE_VHOOK(Spawn)() pev->modelindex = 0; } -/* <1a3955> ../cstrike/dlls/triggers.cpp:1321 */ LINK_ENTITY_TO_CLASS(fireanddie, CFireAndDie); -/* <1a0618> ../cstrike/dlls/triggers.cpp:1323 */ void CFireAndDie::__MAKE_VHOOK(Spawn)() { - if (pev->classname) - { - RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); - } - MAKE_STRING_CLASS("fireanddie", pev); - AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); // Don't call Precache() - it should be called on restore } -/* <19fdbb> ../cstrike/dlls/triggers.cpp:1330 */ void CFireAndDie::__MAKE_VHOOK(Precache)() { pev->nextthink = gpGlobals->time + m_flDelay; } -/* <1a01ae> ../cstrike/dlls/triggers.cpp:1337 */ void CFireAndDie::__MAKE_VHOOK(Think)() { SUB_UseTargets(this, USE_TOGGLE, 0); UTIL_Remove(this); } -/* <1a3a67> ../cstrike/dlls/triggers.cpp:1371 */ LINK_ENTITY_TO_CLASS(trigger_changelevel, CChangeLevel); - -/* <1a098d> ../cstrike/dlls/triggers.cpp:1382 */ IMPLEMENT_SAVERESTORE(CChangeLevel, CBaseTrigger); // Cache user-entity-field values until spawn is called. - -/* <1a1d4a> ../cstrike/dlls/triggers.cpp:1388 */ void CChangeLevel::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "map")) @@ -1197,7 +1097,6 @@ void CChangeLevel::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseTrigger::KeyValue(pkvd); } -/* <1a2f25> ../cstrike/dlls/triggers.cpp:1423 */ void CChangeLevel::__MAKE_VHOOK(Spawn)() { if (FStrEq(m_szMapName, "")) @@ -1222,7 +1121,6 @@ void CChangeLevel::__MAKE_VHOOK(Spawn)() } } -/* <19fde3> ../cstrike/dlls/triggers.cpp:1441 */ void CChangeLevel::ExecuteChangeLevel() { MESSAGE_BEGIN(MSG_ALL, SVC_CDTRACK); @@ -1234,7 +1132,6 @@ void CChangeLevel::ExecuteChangeLevel() MESSAGE_END(); } -/* <1a3b43> ../cstrike/dlls/triggers.cpp:1456 */ edict_t *CChangeLevel::FindLandmark(const char *pLandmarkName) { edict_t *pentLandmark = FIND_ENTITY_BY_STRING(NULL, "targetname", pLandmarkName); @@ -1253,14 +1150,11 @@ edict_t *CChangeLevel::FindLandmark(const char *pLandmarkName) // CChangeLevel::Use - allows level transitions to be // triggered by buttons, etc. - -/* <1a3e4f> ../cstrike/dlls/triggers.cpp:1479 */ void CChangeLevel::UseChangeLevel(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { ChangeLevelNow(pActivator); } -/* <1a3fb2> ../cstrike/dlls/triggers.cpp:1484 */ void CChangeLevel::ChangeLevelNow(CBaseEntity *pActivator) { edict_t *pentLandmark; @@ -1326,7 +1220,6 @@ void CChangeLevel::ChangeLevelNow(CBaseEntity *pActivator) CHANGE_LEVEL(st_szNextMap, st_szNextSpot); } -/* <1a3ef5> ../cstrike/dlls/triggers.cpp:1545 */ void CChangeLevel::TouchChangeLevel(CBaseEntity *pOther) { if (!FClassnameIs(pOther->pev, "player")) @@ -1339,8 +1232,6 @@ void CChangeLevel::TouchChangeLevel(CBaseEntity *pOther) // Add a transition to the list, but ignore duplicates // (a designer may have placed multiple trigger_changelevels with the same landmark) - -/* <1a3ff8> ../cstrike/dlls/triggers.cpp:1556 */ int CChangeLevel::AddTransitionToList(LEVELLIST *pLevelList, int listCount, const char *pMapName, const char *pLandmarkName, edict_t *pentLandmark) { int i; @@ -1367,13 +1258,11 @@ int CChangeLevel::AddTransitionToList(LEVELLIST *pLevelList, int listCount, cons return 1; } -/* <1a44ba> ../cstrike/dlls/triggers.cpp:1576 */ int BuildChangeList(LEVELLIST *pLevelList, int maxList) { CChangeLevel::ChangeList(pLevelList, maxList); } -/* <1a4075> ../cstrike/dlls/triggers.cpp:1582 */ int CChangeLevel::InTransitionVolume(CBaseEntity *pEntity, char *pVolumeName) { edict_t *pentVolume; @@ -1422,8 +1311,6 @@ int CChangeLevel::InTransitionVolume(CBaseEntity *pEntity, char *pVolumeName) // Can we make this more elegant? // This builds the list of all transitions on this level and which entities are in their PVS's and can / should // be moved across. - -/* <1a40b1> ../cstrike/dlls/triggers.cpp:1625 */ int CChangeLevel::ChangeList(LEVELLIST *pLevelList, int maxList) { edict_t *pentChangelevel, *pentLandmark; @@ -1477,7 +1364,7 @@ int CChangeLevel::ChangeList(LEVELLIST *pLevelList, int maxList) while (!FNullEnt(pent)) { CBaseEntity *pEntity = CBaseEntity::Instance(pent); - if (pEntity) + if (pEntity != NULL) { int caps = pEntity->ObjectCaps(); @@ -1527,8 +1414,6 @@ int CChangeLevel::ChangeList(LEVELLIST *pLevelList, int maxList) // go to the next level for deathmatch // only called if a time or frag limit has expired - -/* <1a44fc> ../cstrike/dlls/triggers.cpp:1722 */ NOXREF void NextLevel() { edict_t *pent; @@ -1553,22 +1438,18 @@ NOXREF void NextLevel() if (pChange->pev->nextthink < gpGlobals->time) { pChange->SetThink(&CChangeLevel::ExecuteChangeLevel); - pChange->pev->nextthink = gpGlobals->time + 0.1; + pChange->pev->nextthink = gpGlobals->time + 0.1f; } } -/* <1a4709> ../cstrike/dlls/triggers.cpp:1760 */ LINK_ENTITY_TO_CLASS(func_ladder, CLadder); -/* <1a1937> ../cstrike/dlls/triggers.cpp:1763 */ void CLadder::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { CBaseTrigger::KeyValue(pkvd); } // func_ladder - makes an area vertically negotiable - -/* <19fe6c> ../cstrike/dlls/triggers.cpp:1772 */ void CLadder::__MAKE_VHOOK(Precache)() { // Do all of this in here because we need to 'convert' old saved games @@ -1584,7 +1465,6 @@ void CLadder::__MAKE_VHOOK(Precache)() pev->effects &= ~EF_NODRAW; } -/* <19fe95> ../cstrike/dlls/triggers.cpp:1786 */ void CLadder::__MAKE_VHOOK(Spawn)() { Precache(); @@ -1594,16 +1474,13 @@ void CLadder::__MAKE_VHOOK(Spawn)() pev->movetype = MOVETYPE_PUSH; } -/* <1a47e5> ../cstrike/dlls/triggers.cpp:1804 */ LINK_ENTITY_TO_CLASS(trigger_push, CTriggerPush); -/* <1a18ff> ../cstrike/dlls/triggers.cpp:1807 */ void CTriggerPush::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { CBaseTrigger::KeyValue(pkvd); } -/* <1a2eda> ../cstrike/dlls/triggers.cpp:1817 */ void CTriggerPush::__MAKE_VHOOK(Spawn)() { if (pev->angles == g_vecZero) @@ -1630,7 +1507,6 @@ void CTriggerPush::__MAKE_VHOOK(Spawn)() UTIL_SetOrigin(pev, pev->origin); } -/* <1a023c> ../cstrike/dlls/triggers.cpp:1835 */ void CTriggerPush::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { entvars_t *pevToucher = pOther->pev; @@ -1674,7 +1550,6 @@ void CTriggerPush::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) } } -/* <1a051f> ../cstrike/dlls/triggers.cpp:1878 */ void CBaseTrigger::TeleportTouch(CBaseEntity *pOther) { entvars_t *pevToucher = pOther->pev; @@ -1740,23 +1615,17 @@ void CBaseTrigger::TeleportTouch(CBaseEntity *pOther) pevToucher->velocity = pevToucher->basevelocity = g_vecZero; } -/* <1a48c1> ../cstrike/dlls/triggers.cpp:1940 */ LINK_ENTITY_TO_CLASS(trigger_teleport, CTriggerTeleport); -/* <1a2eb1> ../cstrike/dlls/triggers.cpp:1942 */ void CTriggerTeleport::__MAKE_VHOOK(Spawn)() { InitTrigger(); SetTouch(&CTriggerTeleport::TeleportTouch); } -/* <1a499d> ../cstrike/dlls/triggers.cpp:1950 */ LINK_ENTITY_TO_CLASS(info_teleport_destination, CPointEntity); - -/* <1a4a79> ../cstrike/dlls/triggers.cpp:1970 */ LINK_ENTITY_TO_CLASS(func_buyzone, CBuyZone); -/* <1a2e71> ../cstrike/dlls/triggers.cpp:1973 */ void CBuyZone::__MAKE_VHOOK(Spawn)() { InitTrigger(); @@ -1769,7 +1638,6 @@ void CBuyZone::__MAKE_VHOOK(Spawn)() } } -/* <1a116b> ../cstrike/dlls/triggers.cpp:1986 */ void CBuyZone::BuyTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -1783,10 +1651,8 @@ void CBuyZone::BuyTouch(CBaseEntity *pOther) } } -/* <1a4b55> ../cstrike/dlls/triggers.cpp:2016 */ LINK_ENTITY_TO_CLASS(func_bomb_target, CBombTarget); -/* <1a2e48> ../cstrike/dlls/triggers.cpp:2019 */ void CBombTarget::__MAKE_VHOOK(Spawn)() { InitTrigger(); @@ -1795,7 +1661,6 @@ void CBombTarget::__MAKE_VHOOK(Spawn)() SetUse(&CBombTarget::BombTargetUse); } -/* <1a10c1> ../cstrike/dlls/triggers.cpp:2027 */ void CBombTarget::BombTargetTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -1810,23 +1675,19 @@ void CBombTarget::BombTargetTouch(CBaseEntity *pOther) } } -/* <1a0014> ../cstrike/dlls/triggers.cpp:2042 */ void CBombTarget::BombTargetUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { SUB_UseTargets(NULL, USE_TOGGLE, 0); } -/* <1a4c31> ../cstrike/dlls/triggers.cpp:2064 */ LINK_ENTITY_TO_CLASS(func_hostage_rescue, CHostageRescue); -/* <1a2e1f> ../cstrike/dlls/triggers.cpp:2067 */ void CHostageRescue::__MAKE_VHOOK(Spawn)() { InitTrigger(); SetTouch(&CHostageRescue::HostageRescueTouch); } -/* <19ffbf> ../cstrike/dlls/triggers.cpp:2074 */ void CHostageRescue::HostageRescueTouch(CBaseEntity *pOther) { if (pOther->IsPlayer()) @@ -1840,17 +1701,14 @@ void CHostageRescue::HostageRescueTouch(CBaseEntity *pOther) } } -/* <1a4d0d> ../cstrike/dlls/triggers.cpp:2105 */ LINK_ENTITY_TO_CLASS(func_escapezone, CEscapeZone); -/* <1a2df6> ../cstrike/dlls/triggers.cpp:2108 */ void CEscapeZone::__MAKE_VHOOK(Spawn)() { InitTrigger(); SetTouch(&CEscapeZone::EscapeTouch); } -/* <1a0f88> ../cstrike/dlls/triggers.cpp:2115 */ void CEscapeZone::EscapeTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -1864,15 +1722,9 @@ void CEscapeZone::EscapeTouch(CBaseEntity *pOther) if (!p->m_bEscaped) { p->m_bEscaped = true; - g_pGameRules->CheckWinConditions(); + CSGameRules()->CheckWinConditions(); - UTIL_LogPrintf - ( - "\"%s<%i><%s>\" triggered \"Terrorist_Escaped\"\n", - STRING(p->pev->netname), - GETPLAYERUSERID(p->edict()), - GETPLAYERAUTHID(p->edict()) - ); + UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Terrorist_Escaped\"\n", STRING(p->pev->netname), GETPLAYERUSERID(p->edict()), GETPLAYERAUTHID(p->edict())); for (int i = 1; i <= gpGlobals->maxClients; ++i) { @@ -1894,17 +1746,14 @@ void CEscapeZone::EscapeTouch(CBaseEntity *pOther) } } -/* <1a4de9> ../cstrike/dlls/triggers.cpp:2163 */ LINK_ENTITY_TO_CLASS(func_vip_safetyzone, CVIP_SafetyZone); -/* <1a2dcd> ../cstrike/dlls/triggers.cpp:2166 */ void CVIP_SafetyZone::__MAKE_VHOOK(Spawn)() { InitTrigger(); SetTouch(&CVIP_SafetyZone::VIP_SafetyTouch); } -/* <1a0ec7> ../cstrike/dlls/triggers.cpp:2173 */ void CVIP_SafetyZone::VIP_SafetyTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -1915,13 +1764,8 @@ void CVIP_SafetyZone::VIP_SafetyTouch(CBaseEntity *pOther) if (p->m_bIsVIP) { - UTIL_LogPrintf - ( - "\"%s<%i><%s>\" triggered \"Escaped_As_VIP\"\n", - STRING(p->pev->netname), - GETPLAYERUSERID(p->edict()), - GETPLAYERAUTHID(p->edict()) - ); + UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Escaped_As_VIP\"\n", + STRING(p->pev->netname), GETPLAYERUSERID(p->edict()), GETPLAYERAUTHID(p->edict())); p->m_bEscaped = true; @@ -1930,10 +1774,8 @@ void CVIP_SafetyZone::VIP_SafetyTouch(CBaseEntity *pOther) } } -/* <1a4ec5> ../cstrike/dlls/triggers.cpp:2204 */ LINK_ENTITY_TO_CLASS(trigger_autosave, CTriggerSave); -/* <1a2d8e> ../cstrike/dlls/triggers.cpp:2206 */ void CTriggerSave::__MAKE_VHOOK(Spawn)() { if (g_pGameRules->IsDeathmatch()) @@ -1946,7 +1788,6 @@ void CTriggerSave::__MAKE_VHOOK(Spawn)() SetTouch(&CTriggerSave::SaveTouch); } -/* <1a0c01> ../cstrike/dlls/triggers.cpp:2218 */ void CTriggerSave::SaveTouch(CBaseEntity *pOther) { if (!UTIL_IsMasterTriggered(m_sMaster, pOther)) @@ -1961,10 +1802,8 @@ void CTriggerSave::SaveTouch(CBaseEntity *pOther) SERVER_COMMAND("autosave\n"); } -/* <1a4fa1> ../cstrike/dlls/triggers.cpp:2242 */ LINK_ENTITY_TO_CLASS(trigger_endsection, CTriggerEndSection); -/* <1a0b7f> ../cstrike/dlls/triggers.cpp:2245 */ void CTriggerEndSection::EndSectionUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // Only save on clients @@ -1980,7 +1819,6 @@ void CTriggerEndSection::EndSectionUse(CBaseEntity *pActivator, CBaseEntity *pCa UTIL_Remove(this); } -/* <1a2d4f> ../cstrike/dlls/triggers.cpp:2260 */ void CTriggerEndSection::__MAKE_VHOOK(Spawn)() { if (g_pGameRules->IsDeathmatch()) @@ -1999,7 +1837,6 @@ void CTriggerEndSection::__MAKE_VHOOK(Spawn)() } } -/* <1a0b29> ../cstrike/dlls/triggers.cpp:2276 */ void CTriggerEndSection::EndSectionTouch(CBaseEntity *pOther) { // Only save on clients @@ -2015,7 +1852,6 @@ void CTriggerEndSection::EndSectionTouch(CBaseEntity *pOther) UTIL_Remove(this); } -/* <1a196f> ../cstrike/dlls/triggers.cpp:2291 */ void CTriggerEndSection::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "section")) @@ -2028,17 +1864,14 @@ void CTriggerEndSection::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseTrigger::KeyValue(pkvd); } -/* <1a507d> ../cstrike/dlls/triggers.cpp:2311 */ LINK_ENTITY_TO_CLASS(trigger_gravity, CTriggerGravity); -/* <1a2d26> ../cstrike/dlls/triggers.cpp:2313 */ void CTriggerGravity::__MAKE_VHOOK(Spawn)() { InitTrigger(); SetTouch(&CTriggerGravity::GravityTouch); } -/* <19febe> ../cstrike/dlls/triggers.cpp:2319 */ void CTriggerGravity::GravityTouch(CBaseEntity *pOther) { // Only save on clients @@ -2048,13 +1881,9 @@ void CTriggerGravity::GravityTouch(CBaseEntity *pOther) pOther->pev->gravity = pev->gravity; } -/* <1a5159> ../cstrike/dlls/triggers.cpp:2351 */ LINK_ENTITY_TO_CLASS(trigger_changetarget, CTriggerChangeTarget); - -/* <1a093a> ../cstrike/dlls/triggers.cpp:2358 */ IMPLEMENT_SAVERESTORE(CTriggerChangeTarget, CBaseDelay); -/* <1a1691> ../cstrike/dlls/triggers.cpp:2360 */ void CTriggerChangeTarget::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "m_iszNewTarget")) @@ -2066,13 +1895,11 @@ void CTriggerChangeTarget::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseDelay::KeyValue(pkvd); } -/* <19ff1f> ../cstrike/dlls/triggers.cpp:2371 */ void CTriggerChangeTarget::__MAKE_VHOOK(Spawn)() { ; } -/* <1a010d> ../cstrike/dlls/triggers.cpp:2376 */ void CTriggerChangeTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { CBaseEntity *pTarget = UTIL_FindEntityByString(NULL, "targetname", STRING(pev->target)); @@ -2083,20 +1910,16 @@ void CTriggerChangeTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntit CBaseMonster *pMonster = pTarget->MyMonsterPointer(); - if (pMonster) + if (pMonster != NULL) { pMonster->m_pGoalEnt = NULL; } } } -/* <1a5235> ../cstrike/dlls/triggers.cpp:2425 */ LINK_ENTITY_TO_CLASS(trigger_camera, CTriggerCamera); - -/* <1a08e7> ../cstrike/dlls/triggers.cpp:2445 */ IMPLEMENT_SAVERESTORE(CTriggerCamera, CBaseDelay); -/* <19ff6f> ../cstrike/dlls/triggers.cpp:2447 */ void CTriggerCamera::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_NOCLIP; @@ -2120,7 +1943,6 @@ void CTriggerCamera::__MAKE_VHOOK(Spawn)() } } -/* <1a1537> ../cstrike/dlls/triggers.cpp:2462 */ void CTriggerCamera::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "wait")) @@ -2147,7 +1969,6 @@ void CTriggerCamera::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseDelay::KeyValue(pkvd); } -/* <1a55e4> ../cstrike/dlls/triggers.cpp:2490 */ void CTriggerCamera::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!ShouldToggle(useType, m_state)) @@ -2159,7 +1980,7 @@ void CTriggerCamera::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCa { m_flReturnTime = gpGlobals->time; - if (pActivator->IsPlayer()) + if (pActivator != NULL && pActivator->IsPlayer()) { ((CBasePlayer *)pActivator)->ResetMaxSpeed(); } @@ -2247,7 +2068,6 @@ void CTriggerCamera::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCa Move(); } -/* <1a5494> ../cstrike/dlls/triggers.cpp:2587 */ void CTriggerCamera::FollowTarget() { if (m_hPlayer == NULL) @@ -2295,7 +2115,7 @@ void CTriggerCamera::FollowTarget() if (!(pev->spawnflags & SF_CAMERA_PLAYER_TAKECONTROL)) { - pev->velocity = pev->velocity * 0.8; + pev->velocity = pev->velocity * 0.8f; if (pev->velocity.Length() < 10.0) { @@ -2307,7 +2127,6 @@ void CTriggerCamera::FollowTarget() Move(); } -/* <1a5311> ../cstrike/dlls/triggers.cpp:2644 */ void CTriggerCamera::Move() { // Not moving on a path, return @@ -2366,25 +2185,16 @@ void CTriggerCamera::Move() pev->velocity = ((pev->movedir * pev->speed) * fraction) + (pev->velocity * (1 - fraction)); } -/* <1a5815> ../cstrike/dlls/triggers.cpp:2699 */ LINK_ENTITY_TO_CLASS(env_snow, CWeather); - -/* <1a58f1> ../cstrike/dlls/triggers.cpp:2700 */ LINK_ENTITY_TO_CLASS(func_snow, CWeather); - -/* <1a59cd> ../cstrike/dlls/triggers.cpp:2701 */ LINK_ENTITY_TO_CLASS(env_rain, CWeather); - -/* <1a5aa9> ../cstrike/dlls/triggers.cpp:2702 */ LINK_ENTITY_TO_CLASS(func_rain, CWeather); -/* <1a2cfe> ../cstrike/dlls/triggers.cpp:2704 */ void CWeather::__MAKE_VHOOK(Spawn)() { InitTrigger(); } -/* <1a1477> ../cstrike/dlls/triggers.cpp:2716 */ void CClientFog::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { #if 0 @@ -2413,7 +2223,6 @@ void CClientFog::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <19ff97> ../cstrike/dlls/triggers.cpp:2735 */ void CClientFog::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_NOCLIP; @@ -2422,5 +2231,4 @@ void CClientFog::__MAKE_VHOOK(Spawn)() pev->rendermode = kRenderTransTexture; } -/* <1a5ba9> ../cstrike/dlls/triggers.cpp:2744 */ LINK_ENTITY_TO_CLASS(env_fog, CClientFog); diff --git a/regamedll/dlls/triggers.h b/regamedll/dlls/triggers.h index b2dd8a41..6d727d1c 100644 --- a/regamedll/dlls/triggers.h +++ b/regamedll/dlls/triggers.h @@ -84,7 +84,7 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT ChangeFriction(CBaseEntity *pOther); @@ -95,8 +95,6 @@ public: // This trigger will fire when the level spawns (or respawns if not fire once) // It will check a global state before firing. It supports delay and killtargets - -/* <19e39c> ../cstrike/dlls/triggers.cpp:108 */ class CAutoTrigger: public CBaseDelay { public: @@ -117,7 +115,7 @@ public: int Restore_(CRestore &restore); void Think_(); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[2]; @@ -126,7 +124,6 @@ public: USE_TYPE triggerType; }; -/* <19e3ed> ../cstrike/dlls/triggers.cpp:191 */ class CTriggerRelay: public CBaseDelay { public: @@ -145,7 +142,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; @@ -157,8 +154,6 @@ public: // at specified times. // FLAG: THREAD (create clones when triggered) // FLAG: CLONE (this is a clone for a threaded execution) - -/* <19e4d6> ../cstrike/dlls/triggers.cpp:264 */ class CMultiManager: public CBaseToggle { public: @@ -179,14 +174,13 @@ public: int Restore_(CRestore &restore); BOOL HasTarget_(string_t targetname); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT ManagerThink(); void EXPORT ManagerUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); private: - /* <19dfe1> ../cstrike/dlls/triggers.cpp:293 */ BOOL IsClone() { if (pev->spawnflags & SF_MULTIMAN_CLONE) @@ -196,7 +190,6 @@ private: return FALSE; } - /* <19e4f3> ../cstrike/dlls/triggers.cpp:294 */ BOOL ShouldClone() { if (IsClone()) @@ -227,8 +220,6 @@ public: // // This entity will copy its render parameters (renderfx, rendermode, rendercolor, renderamt) // to its targets when triggered. - -/* <19e50c> ../cstrike/dlls/triggers.cpp:525 */ class CRenderFxManager: public CBaseEntity { public: @@ -240,11 +231,10 @@ public: void Spawn_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif }; -/* <19e55f> ../cstrike/dlls/triggers.cpp:566 */ class CBaseTrigger: public CBaseToggle { public: @@ -255,13 +245,13 @@ public: void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT TeleportTouch(CBaseEntity *pOther); void EXPORT MultiTouch(CBaseEntity *pOther); void EXPORT HurtTouch(CBaseEntity *pOther); - NOXREF void EXPORT CDAudioTouch(CBaseEntity *pOther); + void EXPORT CDAudioTouch(CBaseEntity *pOther); void ActivateMultiTrigger(CBaseEntity *pActivator); void EXPORT MultiWaitOver(); void EXPORT CounterUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); @@ -271,8 +261,6 @@ public: // trigger_hurt - hurts anything that touches it. if the trigger has a targetname, firing it will toggle state // int gfToggleState = 0; // used to determine when all radiation trigger hurts have called 'RadiationThink' - -/* <19e5b2> ../cstrike/dlls/triggers.cpp:629 */ class CTriggerHurt: public CBaseTrigger { public: @@ -282,12 +270,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif void EXPORT RadiationThink(); }; -/* <19e60a> ../cstrike/dlls/triggers.cpp:641 */ class CTriggerMonsterJump: public CBaseTrigger { public: @@ -301,13 +288,11 @@ public: void Think_(); void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; // trigger_cdaudio - starts/stops cd audio tracks - -/* <19e65d> ../cstrike/dlls/triggers.cpp:705 */ class CTriggerCDAudio: public CBaseTrigger { public: @@ -321,15 +306,13 @@ public: void Touch_(CBaseEntity *pOther); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void PlayTrack(); }; // This plays a CD track when fired or when the player enters it's radius - -/* <19e6d2> ../cstrike/dlls/triggers.cpp:783 */ class CTargetCDAudio: public CPointEntity { public: @@ -345,7 +328,7 @@ public: void Think_(); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void Play(); @@ -365,8 +348,6 @@ public: // 4) // NEW // if a trigger has a NETNAME, that NETNAME will become the TARGET of the triggered object. - -/* <19e725> ../cstrike/dlls/triggers.cpp:1080 */ class CTriggerMultiple: public CBaseTrigger { public: @@ -376,7 +357,7 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; @@ -391,8 +372,6 @@ public: // 2) beep beep // 3) large switch // 4) - -/* <19e77d> ../cstrike/dlls/triggers.cpp:1129 */ class CTriggerOnce: public CTriggerMultiple { public: @@ -402,7 +381,7 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; @@ -411,8 +390,6 @@ public: // If nomessage is not set, it will print "1 more.. " etc when triggered and // "sequence complete" when finished. After the counter has been triggered "cTriggersLeft" // times (default 2), it will fire all of it's targets and remove itself. - -/* <19e7d5> ../cstrike/dlls/triggers.cpp:1273 */ class CTriggerCounter: public CBaseTrigger { public: @@ -422,13 +399,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; // Derive from point entity so this doesn't move across levels - -/* <19e82d> ../cstrike/dlls/triggers.cpp:1293 */ class CTriggerVolume: public CPointEntity { public: @@ -438,13 +413,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; // Fires a target after level transition and then dies - -/* <19e885> ../cstrike/dlls/triggers.cpp:1313 */ class CFireAndDie: public CBaseDelay { public: @@ -459,14 +432,12 @@ public: void Precache_(); void Think_(); -#endif // HOOK_GAMEDLL +#endif }; // QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION // When the player touches this, he gets sent to the map listed in the "map" variable. Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats. - -/* <19e906> ../cstrike/dlls/triggers.cpp:1345 */ class CChangeLevel: public CBaseTrigger { public: @@ -482,11 +453,11 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT UseChangeLevel(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); - NOXREF void EXPORT TriggerChangeLevel(); + void EXPORT TriggerChangeLevel(); void EXPORT ExecuteChangeLevel(); void EXPORT TouchChangeLevel(CBaseEntity *pOther); void ChangeLevelNow(CBaseEntity *pActivator); @@ -499,13 +470,12 @@ public: public: static TYPEDESCRIPTION IMPL(m_SaveData)[4]; - char m_szMapName[ cchMapNameMost ]; // trigger_changelevel only: next map - char m_szLandmarkName[ cchMapNameMost ]; // trigger_changelevel only: landmark on next map + char m_szMapName[cchMapNameMost]; // trigger_changelevel only: next map + char m_szLandmarkName[cchMapNameMost]; // trigger_changelevel only: landmark on next map int m_changeTarget; float m_changeTargetDelay; }; -/* <19e99d> ../cstrike/dlls/triggers.cpp:1753 */ class CLadder: public CBaseTrigger { public: @@ -519,11 +489,10 @@ public: void Precache_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif }; -/* <19e9f5> ../cstrike/dlls/triggers.cpp:1797 */ class CTriggerPush: public CBaseTrigger { public: @@ -537,11 +506,10 @@ public: void KeyValue_(KeyValueData *pkvd); void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif }; -/* <19ea4d> ../cstrike/dlls/triggers.cpp:1935 */ class CTriggerTeleport: public CBaseTrigger { public: @@ -551,11 +519,10 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; -/* <19eadb> ../cstrike/dlls/triggers.cpp:1962 */ class CBuyZone: public CBaseTrigger { public: @@ -565,12 +532,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif void EXPORT BuyTouch(CBaseEntity *pOther); }; -/* <19eb2e> ../cstrike/dlls/triggers.cpp:2007 */ class CBombTarget: public CBaseTrigger { public: @@ -580,14 +546,13 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT BombTargetTouch(CBaseEntity *pOther); void EXPORT BombTargetUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); }; -/* <19eb81> ../cstrike/dlls/triggers.cpp:2056 */ class CHostageRescue: public CBaseTrigger { public: @@ -597,13 +562,12 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT HostageRescueTouch(CBaseEntity *pOther); }; -/* <19ebd9> ../cstrike/dlls/triggers.cpp:2098 */ class CEscapeZone: public CBaseTrigger { public: @@ -613,12 +577,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif void EXPORT EscapeTouch(CBaseEntity *pOther); }; -/* <19ec2c> ../cstrike/dlls/triggers.cpp:2155 */ class CVIP_SafetyZone: public CBaseTrigger { public: @@ -628,12 +591,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif void EXPORT VIP_SafetyTouch(CBaseEntity *pOther); }; -/* <19ec7f> ../cstrike/dlls/triggers.cpp:2198 */ class CTriggerSave: public CBaseTrigger { public: @@ -643,12 +605,11 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif void EXPORT SaveTouch(CBaseEntity *pOther); }; -/* <19ecd2> ../cstrike/dlls/triggers.cpp:2234 */ class CTriggerEndSection: public CBaseTrigger { public: @@ -660,14 +621,13 @@ public: void Spawn_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT EndSectionTouch(CBaseEntity *pOther); void EXPORT EndSectionUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); }; -/* <19ed25> ../cstrike/dlls/triggers.cpp:2305 */ class CTriggerGravity: public CBaseTrigger { public: @@ -677,14 +637,12 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif void EXPORT GravityTouch(CBaseEntity *pOther); }; // this is a really bad idea. - -/* <19ed7d> ../cstrike/dlls/triggers.cpp:2335 */ class CTriggerChangeTarget: public CBaseDelay { public: @@ -703,7 +661,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: static TYPEDESCRIPTION IMPL(m_SaveData)[1]; @@ -712,7 +670,6 @@ private: int m_iszNewTarget; }; -/* <19edd0> ../cstrike/dlls/triggers.cpp:2391 */ class CTriggerCamera: public CBaseDelay { public: @@ -731,7 +688,7 @@ public: int Restore_(CRestore &restore); void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT FollowTarget(); @@ -754,7 +711,6 @@ public: int m_state; }; -/* <19ee23> ../cstrike/dlls/triggers.cpp:2693 */ class CWeather: public CBaseTrigger { public: @@ -764,11 +720,10 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif }; -/* <1a5b85> ../cstrike/dlls/triggers.cpp:2710 */ class CClientFog: public CBaseEntity { public: @@ -780,7 +735,7 @@ public: void Spawn_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif public: int m_iStartDist; @@ -790,6 +745,6 @@ public: void PlayCDTrack(int iTrack); int BuildChangeList(LEVELLIST * pLevelList, int maxList); -NOXREF void NextLevel(); +void NextLevel(); #endif // TRIGGERS_H diff --git a/regamedll/dlls/tutor.cpp b/regamedll/dlls/tutor.cpp index 71cfe882..36e75167 100644 --- a/regamedll/dlls/tutor.cpp +++ b/regamedll/dlls/tutor.cpp @@ -16,12 +16,11 @@ cvar_t cv_tutor_message_minimum_display_time = { "_tutor_message_minimum_display cvar_t cv_tutor_message_character_display_time_coefficient = { "_tutor_message_character_display_time_coefficient", "0.07", FCVAR_SERVER, 0.0f, NULL }; cvar_t cv_tutor_hint_interval_time = { "_tutor_hint_interval_time", "10.0", FCVAR_SERVER, 0.0f, NULL }; -#endif // HOOK_GAMEDLL +#endif bool s_tutorDisabledThisGame; float s_nextCvarCheckTime; -/* <1dfdbc> ../cstrike/dlls/tutor.cpp:32 */ void InstallTutor(bool start) { if (TheTutor != NULL) @@ -39,13 +38,12 @@ void InstallTutor(bool start) s_nextCvarCheckTime = gpGlobals->time; } -/* <1dfde7> ../cstrike/dlls/tutor.cpp:51 */ void Tutor_RegisterCVars() { #ifdef REGAMEDLL_FIXES if (!g_bIsCzeroGame) return; -#endif // REGAMEDLL_FIXES +#endif CVAR_REGISTER(&cv_tutor_message_repeats); CVAR_REGISTER(&cv_tutor_debug_level); @@ -59,7 +57,6 @@ void Tutor_RegisterCVars() CVAR_REGISTER(&cv_tutor_hint_interval_time); } -/* <1dfdff> ../cstrike/dlls/tutor.cpp:66 */ void MonitorTutorStatus() { static cvar_t *tutor_enable = NULL; diff --git a/regamedll/dlls/tutor_base_states.cpp b/regamedll/dlls/tutor_base_states.cpp index 94193e4a..2be0ce1d 100644 --- a/regamedll/dlls/tutor_base_states.cpp +++ b/regamedll/dlls/tutor_base_states.cpp @@ -1,18 +1,15 @@ #include "precompiled.h" -/* <21bf94> ../cstrike/dlls/tutor_base_states.cpp:6 */ CBaseTutorStateSystem::CBaseTutorStateSystem() { ; } -/* <21bec7> ../cstrike/dlls/tutor_base_states.cpp:10 */ CBaseTutorStateSystem::~CBaseTutorStateSystem() { ; } -/* <21bfb5> ../cstrike/dlls/tutor_base_states.cpp:14 */ int CBaseTutorStateSystem::GetCurrentStateType() const { if (m_currentState != NULL) @@ -23,19 +20,16 @@ int CBaseTutorStateSystem::GetCurrentStateType() const return 0; } -/* <21c00d> ../cstrike/dlls/tutor_base_states.cpp:28 */ CBaseTutorState::CBaseTutorState() { ; } -/* <21bcc6> ../cstrike/dlls/tutor_base_states.cpp:32 */ CBaseTutorState::~CBaseTutorState() { ; } -/* <21c02e> ../cstrike/dlls/tutor_base_states.cpp:36 */ int CBaseTutorState::GetType() const { return m_type; diff --git a/regamedll/dlls/tutor_base_tutor.cpp b/regamedll/dlls/tutor_base_tutor.cpp index 5e6fc4bf..ae3d02ca 100644 --- a/regamedll/dlls/tutor_base_tutor.cpp +++ b/regamedll/dlls/tutor_base_tutor.cpp @@ -2,7 +2,6 @@ CBaseTutor *TheTutor = NULL; -/* <1f545d> ../cstrike/dlls/tutor_base_tutor.cpp:22 */ TutorMessageEvent::TutorMessageEvent(int mid, int duplicateID, float time, float lifetime, int priority) { m_messageID = mid; @@ -16,67 +15,55 @@ TutorMessageEvent::TutorMessageEvent(int mid, int duplicateID, float time, float m_next = NULL; } -/* <1f4d07> ../cstrike/dlls/tutor_base_tutor.cpp:34 */ TutorMessageEvent::~TutorMessageEvent() { ; } -/* <1f54a6> ../cstrike/dlls/tutor_base_tutor.cpp:38 */ bool TutorMessageEvent::IsActive(float time) { return (m_lifetime + m_activationTime >= time); } -/* <1f54da> ../cstrike/dlls/tutor_base_tutor.cpp:48 */ int TutorMessageEvent::GetPriority() { return m_priority; } -/* <1f5500> ../cstrike/dlls/tutor_base_tutor.cpp:53 */ float TutorMessageEvent::GetTimeActive(float time) { return (time - m_activationTime); } -/* <1f5534> ../cstrike/dlls/tutor_base_tutor.cpp:58 */ void TutorMessageEvent::SetActivationTime(float time) { m_activationTime = time; } -/* <1f5568> ../cstrike/dlls/tutor_base_tutor.cpp:63 */ int TutorMessageEvent::GetID() { return m_messageID; } -/* <1f5589> ../cstrike/dlls/tutor_base_tutor.cpp:68 */ int TutorMessageEvent::GetDuplicateID() { return m_duplicateID; } -/* <1f55af> ../cstrike/dlls/tutor_base_tutor.cpp:73 */ void TutorMessageEvent::SetNext(TutorMessageEvent *next) { m_next = next; } -/* <1f55e3> ../cstrike/dlls/tutor_base_tutor.cpp:78 */ TutorMessageEvent *TutorMessageEvent::GetNext() { return m_next; } -/* <1f5604> ../cstrike/dlls/tutor_base_tutor.cpp:83 */ void TutorMessageEvent::AddParameter(char *str) { if (str == NULL) - { return; - } TutorMessageEventParam *param = new TutorMessageEventParam; @@ -103,15 +90,12 @@ void TutorMessageEvent::AddParameter(char *str) } } -/* <1f565d> ../cstrike/dlls/tutor_base_tutor.cpp:117 */ char *TutorMessageEvent::GetNextParameter(char *buf, int buflen) { TutorMessageEventParam *param = m_paramList; if (param == NULL) - { return NULL; - } m_numParameters--; m_paramList = param->m_next; @@ -120,19 +104,17 @@ char *TutorMessageEvent::GetNextParameter(char *buf, int buflen) #ifdef REGAMEDLL_FIXES buf[buflen] = '\0'; -#endif // REGAMEDLL_FIXES +#endif delete param; return buf; } -/* <1f569e> ../cstrike/dlls/tutor_base_tutor.cpp:136 */ int TutorMessageEvent::GetNumParameters() { return m_numParameters; } -/* <1f56d8> ../cstrike/dlls/tutor_base_tutor.cpp:144 */ CBaseTutor::CBaseTutor() { m_eventList = NULL; @@ -140,7 +122,6 @@ CBaseTutor::CBaseTutor() m_roundStartTime = 0; } -/* <1f4d28> ../cstrike/dlls/tutor_base_tutor.cpp:152 */ CBaseTutor::~CBaseTutor() { TutorMessageEvent *event = m_eventList; @@ -154,20 +135,17 @@ CBaseTutor::~CBaseTutor() } } -/* <1f5766> ../cstrike/dlls/tutor_base_tutor.cpp:163 */ void CBaseTutor::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { CallEventHandler(event, entity, other); CheckForStateTransition(event, entity, other); } -/* <1f5842> ../cstrike/dlls/tutor_base_tutor.cpp:172 */ void CBaseTutor::ShotFired(Vector source, Vector target) { HandleShotFired(source, target); } -/* <1f58ca> ../cstrike/dlls/tutor_base_tutor.cpp:178 */ void CBaseTutor::CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { if (m_stateSystem->UpdateState(event, entity, other)) @@ -176,13 +154,11 @@ void CBaseTutor::CheckForStateTransition(GameEventType event, CBaseEntity *entit } } -/* <1f58f5> ../cstrike/dlls/tutor_base_tutor.cpp:189 */ void CBaseTutor::StartFrame(float time) { TutorThink(time); } -/* <1f5993> ../cstrike/dlls/tutor_base_tutor.cpp:192 */ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char *szMessage, TutorMessageEvent *event) { TutorMessage *definition; @@ -242,7 +218,6 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char } } -/* <1f5ad1> ../cstrike/dlls/tutor_base_tutor.cpp:264 */ NOXREF void CBaseTutor::DrawLineToEntity(CBasePlayer *player, int entindex, int id) { MESSAGE_BEGIN(MSG_ONE, gmsgTutorLine, NULL, player->pev); @@ -251,18 +226,14 @@ NOXREF void CBaseTutor::DrawLineToEntity(CBasePlayer *player, int entindex, int MESSAGE_END(); } -/* <1f5b4f> ../cstrike/dlls/tutor_base_tutor.cpp:275 */ void CBaseTutor::DisplayNewStateDescriptionToPlayer() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); if (localPlayer == NULL) - { return; - } char *desc = m_stateSystem->GetCurrentStateString(); - if (!desc) { MESSAGE_BEGIN(MSG_ONE, gmsgTutorState, NULL, localPlayer->pev); @@ -271,7 +242,6 @@ void CBaseTutor::DisplayNewStateDescriptionToPlayer() } } -/* <1f5bb4> ../cstrike/dlls/tutor_base_tutor.cpp:293 */ void CBaseTutor::CloseCurrentWindow() { CBasePlayer *localPlayer = (CBasePlayer *)UTIL_GetLocalPlayer(); @@ -285,24 +255,18 @@ void CBaseTutor::CloseCurrentWindow() } } -/* <1f5c26> ../cstrike/dlls/tutor_base_tutor.cpp:307 */ void CBaseTutor::CalculatePathForObjective(CBaseEntity *player) { ; } -/* <1f52e6> ../cstrike/dlls/tutor_base_tutor.cpp:312 */ bool CBaseTutor::__MAKE_VHOOK(IsEntityInViewOfPlayer)(CBaseEntity *entity, CBasePlayer *player) { if (entity == NULL || player == NULL) - { return false; - } if (cv_tutor_view_distance.value < (entity->pev->origin - player->pev->origin).Length()) - { return false; - } if (player->FInViewCone(entity)) { @@ -320,18 +284,13 @@ bool CBaseTutor::__MAKE_VHOOK(IsEntityInViewOfPlayer)(CBaseEntity *entity, CBase return false; } -/* <1f508a> ../cstrike/dlls/tutor_base_tutor.cpp:343 */ bool CBaseTutor::__MAKE_VHOOK(IsPlayerLookingAtPosition)(Vector *origin, CBasePlayer *player) { if (origin == NULL || player == NULL) - { return false; - } if (cv_tutor_look_distance.value < (*origin - player->pev->origin).Length()) - { return false; - } if (player->IsLookingAtPosition(origin, cv_tutor_look_angle.value)) { @@ -347,13 +306,10 @@ bool CBaseTutor::__MAKE_VHOOK(IsPlayerLookingAtPosition)(Vector *origin, CBasePl return false; } -/* <1f4e92> ../cstrike/dlls/tutor_base_tutor.cpp:373 */ bool CBaseTutor::__MAKE_VHOOK(IsPlayerLookingAtEntity)(CBaseEntity *entity, CBasePlayer *player) { if (entity == NULL || player == NULL) - { return false; - } UTIL_MakeVectors(player->pev->v_angle); @@ -374,20 +330,15 @@ bool CBaseTutor::__MAKE_VHOOK(IsPlayerLookingAtEntity)(CBaseEntity *entity, CBas return false; } -/* <1f51b0> ../cstrike/dlls/tutor_base_tutor.cpp:402 */ bool CBaseTutor::__MAKE_VHOOK(IsBombsiteInViewOfPlayer)(CBaseEntity *entity, CBasePlayer *player) { if (entity == NULL || player == NULL) - { return false; - } - Vector bombSiteCenter = (entity->pev->absmax + entity->pev->absmin) * 0.5; + Vector bombSiteCenter = (entity->pev->absmax + entity->pev->absmin) * 0.5f; if (cv_tutor_view_distance.value < (bombSiteCenter - player->pev->origin).Length()) - { return false; - } if (player->FInViewCone(entity)) { @@ -405,13 +356,10 @@ bool CBaseTutor::__MAKE_VHOOK(IsBombsiteInViewOfPlayer)(CBaseEntity *entity, CBa return false; } -/* <1f4e37> ../cstrike/dlls/tutor_base_tutor.cpp:436 */ bool CBaseTutor::__MAKE_VHOOK(IsEntityInBombsite)(CBaseEntity *bombsite, CBaseEntity *entity) { if (bombsite == NULL || entity == NULL) - { return false; - } if (entity->pev->origin.x <= bombsite->pev->absmax.x && entity->pev->origin.y <= bombsite->pev->absmax.y @@ -426,26 +374,19 @@ bool CBaseTutor::__MAKE_VHOOK(IsEntityInBombsite)(CBaseEntity *bombsite, CBaseEn return false; } -/* <1f5c5b> ../cstrike/dlls/tutor_base_tutor.cpp:457 */ bool CBaseTutor::DoMessagesHaveSameID(int id1, int id2) { if (id1 == id2) - { return true; - } TutorMessage *message1 = GetTutorMessageDefinition(id1); TutorMessage *message2 = GetTutorMessageDefinition(id2); if (message1 == NULL || message2 == NULL) - { return false; - } if (message1->m_duplicateID && message2->m_duplicateID) - { return true; - } return false; } diff --git a/regamedll/dlls/tutor_base_tutor.h b/regamedll/dlls/tutor_base_tutor.h index 20ac3865..424bd9ce 100644 --- a/regamedll/dlls/tutor_base_tutor.h +++ b/regamedll/dlls/tutor_base_tutor.h @@ -89,7 +89,7 @@ public: bool IsPlayerLookingAtPosition_(Vector *origin, CBasePlayer *player); bool IsPlayerLookingAtEntity_(CBaseEntity *entity, CBasePlayer *player); -#endif // HOOK_GAMEDLL +#endif public: void StartFrame(float time); @@ -97,7 +97,7 @@ public: void ShotFired(Vector source, Vector target); void DisplayMessageToPlayer(CBasePlayer *player, int id, const char *szMessage, TutorMessageEvent *event); - NOXREF void DrawLineToEntity(CBasePlayer *player, int entindex, int id); + void DrawLineToEntity(CBasePlayer *player, int entindex, int id); void DisplayNewStateDescriptionToPlayer(); void CloseCurrentWindow(); void CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other); diff --git a/regamedll/dlls/tutor_cs_states.cpp b/regamedll/dlls/tutor_cs_states.cpp index 88ee6dfe..ddecc0ab 100644 --- a/regamedll/dlls/tutor_cs_states.cpp +++ b/regamedll/dlls/tutor_cs_states.cpp @@ -29,15 +29,13 @@ char *const g_TutorStateStrings[20] = "#Cstrike_TutorState_Waiting_For_Start" }; -#endif // HOOK_GAMEDLL +#endif -/* <22bf8e> ../cstrike/dlls/tutor_cs_states.cpp:53 */ CCSTutorStateSystem::CCSTutorStateSystem() { m_currentState = new CCSTutorUndefinedState; } -/* <22bd56> ../cstrike/dlls/tutor_cs_states.cpp:58 */ CCSTutorStateSystem::~CCSTutorStateSystem() { if (m_currentState != NULL) @@ -47,7 +45,6 @@ CCSTutorStateSystem::~CCSTutorStateSystem() } } -/* <22bccf> ../cstrike/dlls/tutor_cs_states.cpp:68 */ bool CCSTutorStateSystem::__MAKE_VHOOK(UpdateState)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { if (m_currentState == NULL) @@ -61,14 +58,8 @@ bool CCSTutorStateSystem::__MAKE_VHOOK(UpdateState)(GameEventType event, CBaseEn if (nextStateType != TUTORSTATE_UNDEFINED) { - if (m_currentState != NULL) - { - delete m_currentState; - } - - m_currentState = NULL; + delete m_currentState; m_currentState = ConstructNewState(nextStateType); - return true; } } @@ -76,7 +67,6 @@ bool CCSTutorStateSystem::__MAKE_VHOOK(UpdateState)(GameEventType event, CBaseEn return false; } -/* <22b96f> ../cstrike/dlls/tutor_cs_states.cpp:108 */ char *CCSTutorStateSystem::__MAKE_VHOOK(GetCurrentStateString)() { if (m_currentState != NULL) @@ -87,43 +77,28 @@ char *CCSTutorStateSystem::__MAKE_VHOOK(GetCurrentStateString)() return NULL; } -/* <22bbfe> ../cstrike/dlls/tutor_cs_states.cpp:118 */ CBaseTutorState *CCSTutorStateSystem::__MAKE_VHOOK(ConstructNewState)(int stateType) { - CBaseTutorState *ret = NULL; - - if (stateType != TUTORSTATE_UNDEFINED) + switch (stateType) { - if (stateType == TUTORSTATE_BUYTIME) - { - ret = new CCSTutorBuyMenuState; - } - else if (stateType == TUTORSTATE_WAITING_FOR_START) - { - ret = new CCSTutorWaitingForStartState; - } - } - else - { - ret = new CCSTutorUndefinedState; + case TUTORSTATE_BUYTIME: return new CCSTutorBuyMenuState; + case TUTORSTATE_WAITING_FOR_START: return new CCSTutorWaitingForStartState; + case TUTORSTATE_UNDEFINED: return new CCSTutorUndefinedState; } - return ret; + return NULL; } -/* <22bfcb> ../cstrike/dlls/tutor_cs_states.cpp:141 */ CCSTutorUndefinedState::CCSTutorUndefinedState() { m_type = 0; } -/* <22bb33> ../cstrike/dlls/tutor_cs_states.cpp:146 */ CCSTutorUndefinedState::~CCSTutorUndefinedState() { ; } -/* <22bdd8> ../cstrike/dlls/tutor_cs_states.cpp:150 */ int CCSTutorUndefinedState::__MAKE_VHOOK(CheckForStateTransition)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { if (event == EVENT_PLAYER_SPAWNED) @@ -134,7 +109,6 @@ int CCSTutorUndefinedState::__MAKE_VHOOK(CheckForStateTransition)(GameEventType return 0; } -/* <22bfed> ../cstrike/dlls/tutor_cs_states.cpp:163 */ int CCSTutorUndefinedState::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -153,25 +127,21 @@ int CCSTutorUndefinedState::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity return 0; } -/* <22b995> ../cstrike/dlls/tutor_cs_states.cpp:190 */ char *CCSTutorUndefinedState::__MAKE_VHOOK(GetStateString)() { return NULL; } -/* <22c03e> ../cstrike/dlls/tutor_cs_states.cpp:198 */ CCSTutorWaitingForStartState::CCSTutorWaitingForStartState() { m_type = (TUTORMESSAGETYPE_ENEMY_DEATH | TUTORMESSAGETYPE_BUY); } -/* <22bab6> ../cstrike/dlls/tutor_cs_states.cpp:203 */ CCSTutorWaitingForStartState::~CCSTutorWaitingForStartState() { ; } -/* <22beca> ../cstrike/dlls/tutor_cs_states.cpp:207 */ int CCSTutorWaitingForStartState::__MAKE_VHOOK(CheckForStateTransition)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { switch (event) @@ -185,13 +155,11 @@ int CCSTutorWaitingForStartState::__MAKE_VHOOK(CheckForStateTransition)(GameEven return 0; } -/* <22b9bb> ../cstrike/dlls/tutor_cs_states.cpp:224 */ char *CCSTutorWaitingForStartState::__MAKE_VHOOK(GetStateString)() { return g_TutorStateStrings[m_type]; } -/* <22c060> ../cstrike/dlls/tutor_cs_states.cpp:230 */ int CCSTutorWaitingForStartState::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -210,25 +178,21 @@ int CCSTutorWaitingForStartState::HandlePlayerSpawned(CBaseEntity *entity, CBase return 0; } -/* <22c0b1> ../cstrike/dlls/tutor_cs_states.cpp:257 */ int CCSTutorWaitingForStartState::HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other) { return TUTOR_STATE_FLAG_2; } -/* <22c0e2> ../cstrike/dlls/tutor_cs_states.cpp:266 */ CCSTutorBuyMenuState::CCSTutorBuyMenuState() { m_type = (TUTORMESSAGETYPE_DEFAULT | TUTORMESSAGETYPE_FRIEND_DEATH | TUTORMESSAGETYPE_BUY); } -/* <22ba5a> ../cstrike/dlls/tutor_cs_states.cpp:271 */ CCSTutorBuyMenuState::~CCSTutorBuyMenuState() { ; } -/* <22b9e1> ../cstrike/dlls/tutor_cs_states.cpp:275 */ int CCSTutorBuyMenuState::__MAKE_VHOOK(CheckForStateTransition)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { if (event == EVENT_ROUND_START) @@ -239,13 +203,11 @@ int CCSTutorBuyMenuState::__MAKE_VHOOK(CheckForStateTransition)(GameEventType ev return 0; } -/* <22ba34> ../cstrike/dlls/tutor_cs_states.cpp:288 */ char *CCSTutorBuyMenuState::__MAKE_VHOOK(GetStateString)() { return g_TutorStateStrings[m_type]; } -/* <22c104> ../cstrike/dlls/tutor_cs_states.cpp:293 */ int CCSTutorBuyMenuState::HandleRoundStart(CBaseEntity *entity, CBaseEntity *other) { return TUTOR_STATE_FLAG_1; diff --git a/regamedll/dlls/tutor_cs_states.h b/regamedll/dlls/tutor_cs_states.h index 4affc1b4..9b8e19a0 100644 --- a/regamedll/dlls/tutor_cs_states.h +++ b/regamedll/dlls/tutor_cs_states.h @@ -61,7 +61,6 @@ enum TutorStateType TUTORSTATE_WAITING_FOR_START, }; -/* <22bf75> ../cstrike/dlls/tutor_cs_states.cpp:53 */ class CCSTutorStateSystem: public CBaseTutorStateSystem { public: @@ -77,13 +76,12 @@ public: char *GetCurrentStateString_(); CBaseTutorState *ConstructNewState_(int stateType); -#endif // HOOK_GAMEDLL +#endif protected: virtual CBaseTutorState *ConstructNewState(int stateType); }; -/* <22bfcb> ../cstrike/dlls/tutor_cs_states.cpp:141 */ class CCSTutorUndefinedState: public CBaseTutorState { public: @@ -98,13 +96,12 @@ public: int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); char *GetStateString_(); -#endif // HOOK_GAMEDLL +#endif protected: int HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other); }; -/* <22c03e> ../cstrike/dlls/tutor_cs_states.cpp:198 */ class CCSTutorWaitingForStartState: public CBaseTutorState { public: @@ -119,14 +116,13 @@ public: int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); char *GetStateString_(); -#endif // HOOK_GAMEDLL +#endif protected: int HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other); int HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other); }; -/* <22c0e2> ../cstrike/dlls/tutor_cs_states.cpp:266 */ class CCSTutorBuyMenuState: public CBaseTutorState { public: @@ -141,7 +137,7 @@ public: int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); char *GetStateString_(); -#endif // HOOK_GAMEDLL +#endif protected: int HandleRoundStart(CBaseEntity *entity, CBaseEntity *other); diff --git a/regamedll/dlls/tutor_cs_tutor.cpp b/regamedll/dlls/tutor_cs_tutor.cpp index f21505d3..0e8f07b0 100644 --- a/regamedll/dlls/tutor_cs_tutor.cpp +++ b/regamedll/dlls/tutor_cs_tutor.cpp @@ -161,7 +161,6 @@ const char *TutorIdentifierList[] = #endif // HOOK_GAMEDLL -/* <212575> ../cstrike/dlls/tutor_cs_tutor.cpp:197 */ CCSTutor::CCSTutor() { m_stateSystem = new CCSTutorStateSystem; @@ -180,12 +179,12 @@ CCSTutor::CCSTutor() ResetPlayerDeathInfo(); } -/* <217e69> ../cstrike/dlls/tutor_cs_tutor.cpp:221 */ CCSTutor::~CCSTutor() { if (m_stateSystem != NULL) { delete m_stateSystem; + m_stateSystem = NULL; } if (m_currentMessageEvent != NULL) @@ -204,7 +203,6 @@ CCSTutor::~CCSTutor() ClearEventList(); } -/* <21066a> ../cstrike/dlls/tutor_cs_tutor.cpp:246 */ void ParseMessageParameters(char *&messageData, TutorMessage *ret) { char *token; @@ -348,7 +346,6 @@ void ParseMessageParameters(char *&messageData, TutorMessage *ret) } } -/* <20ffde> ../cstrike/dlls/tutor_cs_tutor.cpp:405 */ TutorMessage *ConstructTutorMessage(char *&messageData, TutorMessage *defaults) { TutorMessage *ret = new TutorMessage; @@ -374,13 +371,11 @@ TutorMessage *ConstructTutorMessage(char *&messageData, TutorMessage *defaults) return ret; } -/* <21005d> ../cstrike/dlls/tutor_cs_tutor.cpp:431 */ void ReadDefaultValues(char *&messageData, TutorMessage *defaults) { ParseMessageParameters(messageData, defaults); } -/* <21164e> ../cstrike/dlls/tutor_cs_tutor.cpp:436 */ void CCSTutor::ReadTutorMessageFile() { int messageFileLen = 0; @@ -443,7 +438,6 @@ void CCSTutor::ReadTutorMessageFile() FREE_FILE(messageFile); } -/* <2126f8> ../cstrike/dlls/tutor_cs_tutor.cpp:491 */ void CCSTutor::ApplyPersistentDecay() { for (TutorMessageID mid = YOU_FIRED_A_SHOT; mid < TUTOR_NUM_MESSAGES; mid++) @@ -462,26 +456,19 @@ void CCSTutor::ApplyPersistentDecay() } } -/* <21275b> ../cstrike/dlls/tutor_cs_tutor.cpp:511 */ bool CCSTutor::HasCurrentWindowBeenActiveLongEnough(float time) { return (m_currentlyShownMessageID < 0 || m_currentlyShownMessageID >= TUTOR_NUM_MESSAGES || time > m_currentlyShownMessageMinimumCloseTime); } -/* <212787> ../cstrike/dlls/tutor_cs_tutor.cpp:528 */ bool CCSTutor::ShouldShowMessageEvent(TutorMessageEvent *event, float time) { if (event == NULL) - { return false; - } TutorMessage *message = GetTutorMessageDefinition(event->GetID()); - if (message == NULL) - { return false; - } if (message->m_class == TUTORMESSAGECLASS_NORMAL) { @@ -493,26 +480,17 @@ bool CCSTutor::ShouldShowMessageEvent(TutorMessageEvent *event, float time) } if (!(m_messageTypeMask & message->m_type) || (time - message->m_lastCloseTime < message->m_minRepeatInterval)) - { return false; - } if (HasCurrentWindowBeenActiveLongEnough(time)) - { return true; - } if (message->m_interruptFlag != TUTORMESSAGEINTERRUPTFLAG_NOW_DAMMIT) - { return false; - } TutorMessage *current = GetTutorMessageDefinition(m_currentlyShownMessageID); - if (current == NULL || (DoMessagesHaveSameID(event->GetID(), m_currentlyShownMessageID) && current->m_keepOld != TUTORMESSAGEKEEPOLDTYPE_DONT_KEEP_OLD)) - { return false; - } if (message->m_priority > current->m_priority || message->m_priority == current->m_priority @@ -524,7 +502,6 @@ bool CCSTutor::ShouldShowMessageEvent(TutorMessageEvent *event, float time) return false; } -/* <21362f> ../cstrike/dlls/tutor_cs_tutor.cpp:597 */ void CCSTutor::CheckForInterruptingMessageEvent(float time) { bool newEvent = false; @@ -534,9 +511,7 @@ void CCSTutor::CheckForInterruptingMessageEvent(float time) TutorMessageEvent *oldEvent = m_currentMessageEvent; if (event == NULL) - { return; - } while (event != NULL) { @@ -570,7 +545,6 @@ void CCSTutor::CheckForInterruptingMessageEvent(float time) ConstructMessageAndDisplay(); } -/* <215ff3> ../cstrike/dlls/tutor_cs_tutor.cpp:642 */ void CCSTutor::__MAKE_VHOOK(TutorThink)(float time) { if (m_nextViewableCheckTime <= time) @@ -614,16 +588,12 @@ void CCSTutor::__MAKE_VHOOK(TutorThink)(float time) CheckForInterruptingMessageEvent(time); } -/* <213556> ../cstrike/dlls/tutor_cs_tutor.cpp:691 */ void CCSTutor::CheckForWindowClose(float time) { - if (m_currentlyShownMessageID < 0 || m_currentlyShownMessageID >= 150 || time <= m_currentlyShownMessageCloseTime) - { + if (m_currentlyShownMessageID < 0 || m_currentlyShownMessageID >= TUTOR_NUM_MESSAGES || time <= m_currentlyShownMessageCloseTime) return; - } TutorMessageEvent *event = GetTutorMessageUpdateEvent(); - if (event == NULL) { ClearCurrentEvent(); @@ -634,20 +604,14 @@ void CCSTutor::CheckForWindowClose(float time) DeleteEventFromEventList(event); } -/* <2134a7> ../cstrike/dlls/tutor_cs_tutor.cpp:715 */ void CCSTutor::CheckForContentUpdate() { - if (m_currentlyShownMessageID < 0 || m_currentlyShownMessageID >= 150) - { + if (m_currentlyShownMessageID < 0 || m_currentlyShownMessageID >= TUTOR_NUM_MESSAGES) return; - } TutorMessage *definition = GetTutorMessageDefinition(m_currentlyShownMessageID); - if (definition == NULL || definition->m_keepOld != TUTORMESSAGEKEEPOLDTYPE_UPDATE_CONTENT) - { return; - } TutorMessageEvent *event = GetTutorMessageUpdateEvent(); @@ -658,7 +622,6 @@ void CCSTutor::CheckForContentUpdate() } } -/* <21281f> ../cstrike/dlls/tutor_cs_tutor.cpp:744 */ void CCSTutor::ClearCurrentEvent(bool closeWindow, bool processDeathsForEvent) { TutorMessage *oldMessage = GetTutorMessageDefinition(m_currentlyShownMessageID); @@ -689,13 +652,10 @@ void CCSTutor::ClearCurrentEvent(bool closeWindow, bool processDeathsForEvent) } } -/* <2128d0> ../cstrike/dlls/tutor_cs_tutor.cpp:775 */ void CCSTutor::ProcessShownDeathsForEvent(TutorMessageEvent *event) { if (event == NULL) - { return; - } for (int i = 0; i < ARRAYSIZE(m_playerDeathInfo); ++i) { @@ -707,15 +667,12 @@ void CCSTutor::ProcessShownDeathsForEvent(TutorMessageEvent *event) } } -/* <212949> ../cstrike/dlls/tutor_cs_tutor.cpp:794 */ TutorMessageEvent *CCSTutor::GetTutorMessageUpdateEvent() { TutorMessage *definition = GetTutorMessageDefinition(m_currentlyShownMessageID); if (definition == NULL || definition->m_keepOld == TUTORMESSAGEKEEPOLDTYPE_DONT_KEEP_OLD) - { return NULL; - } for (TutorMessageEvent *event = m_eventList; event != NULL; event = event->GetNext()) { @@ -728,7 +685,6 @@ TutorMessageEvent *CCSTutor::GetTutorMessageUpdateEvent() return NULL; } -/* <212988> ../cstrike/dlls/tutor_cs_tutor.cpp:816 */ bool CCSTutor::GetDuplicateMessagesFromEventList(TutorMessageEvent *&event1, TutorMessageEvent *&event2) { for (event1 = m_eventList; event1 != NULL; event1 = event1->GetNext()) @@ -745,7 +701,6 @@ bool CCSTutor::GetDuplicateMessagesFromEventList(TutorMessageEvent *&event1, Tut return false; } -/* <212f62> ../cstrike/dlls/tutor_cs_tutor.cpp:836 */ void CCSTutor::CheckForInactiveEvents(float time) { TutorMessageEvent *event = m_eventList; @@ -768,9 +723,7 @@ void CCSTutor::CheckForInactiveEvents(float time) TutorMessageEvent *event1 = NULL; TutorMessageEvent *event2 = NULL; - bool foundDup = GetDuplicateMessagesFromEventList(event1, event2); - - if (foundDup) + if (GetDuplicateMessagesFromEventList(event1, event2)) { if (event1->GetTimeActive(time) < event2->GetTimeActive(time)) { @@ -787,13 +740,10 @@ void CCSTutor::CheckForInactiveEvents(float time) } } -/* <21314d> ../cstrike/dlls/tutor_cs_tutor.cpp:886 */ void CCSTutor::CancelEvent(TutorMessageID mid) { if (m_currentlyShownMessageID == mid) - { ClearCurrentEvent(); - } TutorMessageEvent *event = m_eventList; @@ -817,15 +767,13 @@ void CCSTutor::CancelEvent(TutorMessageID mid) } } -/* <2129db> ../cstrike/dlls/tutor_cs_tutor.cpp:920 */ NOXREF void CCSTutor::LookupHotKey(TutorMessageID mid, int paramNum, wchar_t *buf, int buflen) { #ifdef _WIN32 _snwprintf(buf, buflen - 1, L"KEY%d", paramNum); -#endif // _WIN32 +#endif } -/* <212aa0> ../cstrike/dlls/tutor_cs_tutor.cpp:930 */ TutorMessageEvent *CCSTutor::CreateTutorMessageEvent(TutorMessageID mid, CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer; @@ -838,16 +786,12 @@ TutorMessageEvent *CCSTutor::CreateTutorMessageEvent(TutorMessageID mid, CBaseEn localPlayer = UTIL_GetLocalPlayer(); if (localPlayer == NULL) - { return NULL; - } message = GetTutorMessageDefinition(mid); if (message == NULL) - { return NULL; - } event = new TutorMessageEvent ( @@ -969,19 +913,14 @@ TutorMessageEvent *CCSTutor::CreateTutorMessageEvent(TutorMessageID mid, CBaseEn ConstructRecentDeathsList(localPlayer->m_iTeam, teammateList, sizeof(teammateList), event); event->AddParameter(teammateList); - break; } - default: - break; } - } return event; } -/* <212d0e> ../cstrike/dlls/tutor_cs_tutor.cpp:1096 */ void CCSTutor::AddToEventList(TutorMessageEvent *event) { if (event != NULL) @@ -991,7 +930,6 @@ void CCSTutor::AddToEventList(TutorMessageEvent *event) } } -/* <212d3b> ../cstrike/dlls/tutor_cs_tutor.cpp:1108 */ void CCSTutor::CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *entity, CBaseEntity *other) { TutorMessageEvent *event; @@ -1018,13 +956,10 @@ void CCSTutor::CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *entity, } } -/* <212e1a> ../cstrike/dlls/tutor_cs_tutor.cpp:1136 */ void CCSTutor::DeleteEventFromEventList(TutorMessageEvent *event) { if (event == NULL) - { return; - } TutorMessageEvent *temp = m_eventList; @@ -1052,7 +987,6 @@ void CCSTutor::DeleteEventFromEventList(TutorMessageEvent *event) m_eventList = m_eventList->GetNext(); } -/* <213215> ../cstrike/dlls/tutor_cs_tutor.cpp:1163 */ void CCSTutor::ClearEventList() { while (m_eventList != NULL) @@ -1064,7 +998,6 @@ void CCSTutor::ClearEventList() } } -/* <213289> ../cstrike/dlls/tutor_cs_tutor.cpp:1175 */ void CCSTutor::DeleteEvent(TutorMessageEvent *event) { for (int i = 0; i < ARRAYSIZE(m_playerDeathInfo); ++i) @@ -1075,13 +1008,9 @@ void CCSTutor::DeleteEvent(TutorMessageEvent *event) } } - if (event != NULL) - { - delete event; - } + delete event; } -/* <210a17> ../cstrike/dlls/tutor_cs_tutor.cpp:1189 */ void CCSTutor::__MAKE_VHOOK(PurgeMessages)() { ClearCurrentEvent(); @@ -1094,7 +1023,6 @@ void CCSTutor::__MAKE_VHOOK(PurgeMessages)() } } -/* <2132ca> ../cstrike/dlls/tutor_cs_tutor.cpp:1203 */ void CCSTutor::ComputeDisplayTimesForMessage() { TutorMessage *message = GetTutorMessageDefinition(m_currentlyShownMessageID); @@ -1130,7 +1058,6 @@ void CCSTutor::ComputeDisplayTimesForMessage() } } -/* <21333e> ../cstrike/dlls/tutor_cs_tutor.cpp:1241 */ NOXREF bool CCSTutor::ShouldUpdateCurrentMessage(TutorMessageID messageID) { if (DoMessagesHaveSameID(messageID, m_currentlyShownMessageID)) @@ -1146,7 +1073,6 @@ NOXREF bool CCSTutor::ShouldUpdateCurrentMessage(TutorMessageID messageID) return false; } -/* <213393> ../cstrike/dlls/tutor_cs_tutor.cpp:1259 */ void CCSTutor::UpdateCurrentMessage(TutorMessageEvent *event) { TransferDeathEvents(m_currentMessageEvent, event); @@ -1179,15 +1105,12 @@ void CCSTutor::UpdateCurrentMessage(TutorMessageEvent *event) } } -/* <21060a> ../cstrike/dlls/tutor_cs_tutor.cpp:1299 */ void CCSTutor::__MAKE_VHOOK(ShowTutorMessage)(TutorMessageEvent *event) { TutorMessageID mid = static_cast(event->GetID()); if (mid < 0 || mid >= TUTOR_NUM_MESSAGES) - { return; - } TutorMessage *message = GetTutorMessageDefinition(mid); @@ -1201,7 +1124,6 @@ void CCSTutor::__MAKE_VHOOK(ShowTutorMessage)(TutorMessageEvent *event) } } -/* <2135cc> ../cstrike/dlls/tutor_cs_tutor.cpp:1324 */ void CCSTutor::ConstructMessageAndDisplay() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -1211,9 +1133,7 @@ void CCSTutor::ConstructMessageAndDisplay() TutorMessageID mid = static_cast(m_currentMessageEvent->GetID()); if (mid < 0 || mid >= TUTOR_NUM_MESSAGES) - { return; - } TutorMessage *message = GetTutorMessageDefinition(mid); @@ -1226,7 +1146,6 @@ void CCSTutor::ConstructMessageAndDisplay() } } -/* <2161ea> ../cstrike/dlls/tutor_cs_tutor.cpp:1356 */ void CCSTutor::__MAKE_VHOOK(CallEventHandler)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { switch (event) @@ -1398,7 +1317,6 @@ void CCSTutor::__MAKE_VHOOK(CallEventHandler)(GameEventType event, CBaseEntity * } } -/* <215cc0> ../cstrike/dlls/tutor_cs_tutor.cpp:1594 */ void CCSTutor::HandleWeaponFired(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -1414,35 +1332,33 @@ void CCSTutor::HandleWeaponFired(CBaseEntity *entity, CBaseEntity *other) } } -/* <21371d> ../cstrike/dlls/tutor_cs_tutor.cpp:1616 */ void CCSTutor::HandleWeaponFiredOnEmpty(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) + if (localPlayer == NULL) + return; + + CBasePlayer *player = static_cast(entity); + + if (player != NULL && player->IsPlayer() && player == localPlayer) { - CBasePlayer *player = static_cast(entity); + CBasePlayerWeapon *currentWeapon = static_cast(player->m_pActiveItem); - if (player != NULL && player->IsPlayer() && player == localPlayer) + if (currentWeapon != NULL && player->m_rgAmmo[currentWeapon->m_iPrimaryAmmoType] <= 0) { - CBasePlayerWeapon *currentWeapon = static_cast(player->m_pActiveItem); + TutorMessage *message = GetTutorMessageDefinition(YOU_ARE_OUT_OF_AMMO); - if (currentWeapon != NULL && player->m_rgAmmo[currentWeapon->m_iPrimaryAmmoType] <= 0) + if (message != NULL) { - TutorMessage *message = GetTutorMessageDefinition(YOU_ARE_OUT_OF_AMMO); - - if (message != NULL) - { - message->m_lastCloseTime = 0; - } - - CreateAndAddEventToList(YOU_ARE_OUT_OF_AMMO); + message->m_lastCloseTime = 0; } + + CreateAndAddEventToList(YOU_ARE_OUT_OF_AMMO); } } } -/* <213817> ../cstrike/dlls/tutor_cs_tutor.cpp:1654 */ void CCSTutor::HandleWeaponReloaded(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *player = static_cast(entity); @@ -1453,28 +1369,21 @@ void CCSTutor::HandleWeaponReloaded(CBaseEntity *entity, CBaseEntity *other) } } -/* <21385d> ../cstrike/dlls/tutor_cs_tutor.cpp:1673 */ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); if (localPlayer == NULL) - { return; - } CBasePlayer *victim = static_cast(entity); CBasePlayer *attacker = static_cast(other); if (victim != NULL && !victim->IsPlayer()) - { victim = NULL; - } if (attacker != NULL && !attacker->IsPlayer()) - { attacker = NULL; - } if (victim == localPlayer && !attacker) { @@ -1526,7 +1435,6 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other) CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT, entity, other); break; } - break; } case TERRORIST: @@ -1565,7 +1473,6 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other) CreateAndAddEventToList(YOU_KILLED_PLAYER, entity, other); break; } - break; } case TERRORIST: @@ -1623,7 +1530,6 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other) CreateAndAddEventToList(TEAMMATE_KILLED, entity, other); } } - break; } case TERRORIST: @@ -1654,7 +1560,6 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other) CreateAndAddEventToList(TEAMMATE_KILLED, entity, other); } } - break; } } @@ -1677,7 +1582,6 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other) CreateAndAddEventToList(ENEMY_KILLED, entity, other); break; } - break; } case TERRORIST: @@ -1700,54 +1604,51 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other) } } -/* <21394c> ../cstrike/dlls/tutor_cs_tutor.cpp:1945 */ void CCSTutor::HandlePlayerTookDamage(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) + if (localPlayer == NULL) + return; + + CBasePlayer *victim = static_cast(entity); + CBasePlayer *attacker = static_cast(other); + + if (victim != NULL && !victim->IsPlayer()) { - CBasePlayer *victim = static_cast(entity); - CBasePlayer *attacker = static_cast(other); + victim = NULL; + } - if (victim != NULL && !victim->IsPlayer()) - { - victim = NULL; - } + if (attacker != NULL && !attacker->IsPlayer()) + { + attacker = NULL; + } - if (attacker != NULL && !attacker->IsPlayer()) - { - attacker = NULL; - } - - if (victim != NULL && victim == localPlayer) - { - CreateAndAddEventToList(YOU_WERE_JUST_HURT); - } - else if (attacker != NULL && victim != NULL && attacker == localPlayer && victim->m_iTeam == localPlayer->m_iTeam) - { - CreateAndAddEventToList(YOU_ATTACKED_TEAMMATE); - } + if (victim != NULL && victim == localPlayer) + { + CreateAndAddEventToList(YOU_WERE_JUST_HURT); + } + else if (attacker != NULL && victim != NULL && attacker == localPlayer && victim->m_iTeam == localPlayer->m_iTeam) + { + CreateAndAddEventToList(YOU_ATTACKED_TEAMMATE); } } -/* <213a21> ../cstrike/dlls/tutor_cs_tutor.cpp:1985 */ void CCSTutor::HandlePlayerBlindedByFlashbang(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) - { - CBasePlayer *player = static_cast(entity); + if (localPlayer == NULL) + return; - if (player != NULL && player->IsPlayer() && player == localPlayer) - { - CreateAndAddEventToList(YOU_ARE_BLIND_FROM_FLASHBANG); - } + CBasePlayer *player = static_cast(entity); + + if (player != NULL && player->IsPlayer() && player == localPlayer) + { + CreateAndAddEventToList(YOU_ARE_BLIND_FROM_FLASHBANG); } } -/* <213ab7> ../cstrike/dlls/tutor_cs_tutor.cpp:2008 */ void CCSTutor::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *player = static_cast(entity); @@ -1760,15 +1661,12 @@ void CCSTutor::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other) } } -/* <21868e> ../cstrike/dlls/tutor_cs_tutor.cpp:2033 */ NOXREF void CCSTutor::HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *player = static_cast(entity); if (player == NULL || !player->IsPlayer()) - { return; - } ClientCorpseStruct *corpse = new ClientCorpseStruct; @@ -1778,7 +1676,6 @@ NOXREF void CCSTutor::HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity m_clientCorpseList.push_back(corpse); } -/* <215fbd> ../cstrike/dlls/tutor_cs_tutor.cpp:2050 */ void CCSTutor::HandleBuyMenuOpenned(CBaseEntity *entity, CBaseEntity *other) { if (m_currentlyShownMessageID == BUY_TIME_BEGIN) @@ -1788,7 +1685,6 @@ void CCSTutor::HandleBuyMenuOpenned(CBaseEntity *entity, CBaseEntity *other) } } -/* <213b32> ../cstrike/dlls/tutor_cs_tutor.cpp:2060 */ void CCSTutor::HandleAutoBuy(CBaseEntity *entity, CBaseEntity *other) { if (m_currentlyShownMessageID == BUY_TIME_BEGIN) @@ -1797,13 +1693,11 @@ void CCSTutor::HandleAutoBuy(CBaseEntity *entity, CBaseEntity *other) } } -/* <213b67> ../cstrike/dlls/tutor_cs_tutor.cpp:2069 */ NOXREF void CCSTutor::HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other) { ; } -/* <213b9c> ../cstrike/dlls/tutor_cs_tutor.cpp:2074 */ void CCSTutor::HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other) { m_messageTypeMask = (TUTORMESSAGETYPE_DEFAULT | TUTORMESSAGETYPE_FRIEND_DEATH | TUTORMESSAGETYPE_ENEMY_DEATH | TUTORMESSAGETYPE_SCENARIO | TUTORMESSAGETYPE_CAREER | TUTORMESSAGETYPE_INGAME_HINT | TUTORMESSAGETYPE_END_GAME); @@ -1819,15 +1713,12 @@ void CCSTutor::HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other) } } -/* <213cbb> ../cstrike/dlls/tutor_cs_tutor.cpp:2092 */ void CCSTutor::HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *player = UTIL_GetLocalPlayer(); if (player == NULL) - { return; - } if (player->IsAlive() && player->m_iTeam == CT) { @@ -1839,276 +1730,247 @@ void CCSTutor::HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other) } } -/* <213d02> ../cstrike/dlls/tutor_cs_tutor.cpp:2112 */ void CCSTutor::HandleBombDefused(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) + if (localPlayer == NULL) + return; + + CBasePlayer *defuser = static_cast(entity); + + if (defuser != NULL && defuser->IsPlayer() && defuser == localPlayer) { - CBasePlayer *defuser = static_cast(entity); - - if (defuser != NULL && defuser->IsPlayer() && defuser == localPlayer) - { - CreateAndAddEventToList(YOU_DEFUSED_BOMB); - } - else - { - switch (localPlayer->m_iTeam) - { - case CT: - CreateAndAddEventToList(BOMB_DEFUSED_CT); - break; - case TERRORIST: - CreateAndAddEventToList(BOMB_DEFUSED_T); - break; - default: - CreateAndAddEventToList(ROUND_OVER); - break; - } - } + CreateAndAddEventToList(YOU_DEFUSED_BOMB); } -} - -/* <213dc6> ../cstrike/dlls/tutor_cs_tutor.cpp:2148 */ -void CCSTutor::HandleBombDefusing(CBaseEntity *entity, CBaseEntity *other) -{ - CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - - if (localPlayer != NULL) - { - CBasePlayer *player = static_cast(entity); - - if (player != NULL && player->IsPlayer() && player == localPlayer && !player->m_bHasDefuser) - { - CreateAndAddEventToList(DEFUSING_WITHOUT_KIT); - } - } -} - -/* <213e5b> ../cstrike/dlls/tutor_cs_tutor.cpp:2172 */ -void CCSTutor::HandleBombExploded(CBaseEntity *entity, CBaseEntity *other) -{ - CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - - if (localPlayer != NULL) + else { switch (localPlayer->m_iTeam) { case CT: - CreateAndAddEventToList(BOMB_EXPLODED_CT); + CreateAndAddEventToList(BOMB_DEFUSED_CT); break; case TERRORIST: - CreateAndAddEventToList(BOMB_EXPLODED_T); + CreateAndAddEventToList(BOMB_DEFUSED_T); break; default: + CreateAndAddEventToList(ROUND_OVER); break; } } } -/* <213ebd> ../cstrike/dlls/tutor_cs_tutor.cpp:2191 */ +void CCSTutor::HandleBombDefusing(CBaseEntity *entity, CBaseEntity *other) +{ + CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); + + if (localPlayer == NULL) + return; + + CBasePlayer *player = static_cast(entity); + + if (player != NULL && player->IsPlayer() && player == localPlayer && !player->m_bHasDefuser) + { + CreateAndAddEventToList(DEFUSING_WITHOUT_KIT); + } +} + +void CCSTutor::HandleBombExploded(CBaseEntity *entity, CBaseEntity *other) +{ + CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); + + if (localPlayer == NULL) + return; + + switch (localPlayer->m_iTeam) + { + case CT: + CreateAndAddEventToList(BOMB_EXPLODED_CT); + break; + case TERRORIST: + CreateAndAddEventToList(BOMB_EXPLODED_T); + break; + default: + break; + } +} + void CCSTutor::HandleRoundStart(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *player = UTIL_GetLocalPlayer(); m_roundStartTime = gpGlobals->time; - if (player != NULL) + if (player == NULL) + return; + + if (IsBombMap()) { - if (IsBombMap()) + switch (player->m_iTeam) { - switch (player->m_iTeam) - { - case CT: - CreateAndAddEventToList(ROUND_START_DE_CT); - break; - case TERRORIST: - { - if (player->m_bHasC4) - CreateAndAddEventToList(YOU_ARE_BOMB_CARRIER, entity, other); - else - CreateAndAddEventToList(ROUND_START_DE_T); - break; - } - default: - break; - } + case CT: + CreateAndAddEventToList(ROUND_START_DE_CT); + break; + case TERRORIST: + { + if (player->m_bHasC4) + CreateAndAddEventToList(YOU_ARE_BOMB_CARRIER, entity, other); + else + CreateAndAddEventToList(ROUND_START_DE_T); + break; } - else if (IsHostageMap()) + } + } + else if (IsHostageMap()) + { + switch (player->m_iTeam) { - switch (player->m_iTeam) - { - case CT: - CreateAndAddEventToList(ROUND_START_CS_CT); - break; - case TERRORIST: - CreateAndAddEventToList(ROUND_START_CS_T); - break; - default: - break; - } + case CT: + CreateAndAddEventToList(ROUND_START_CS_CT); + break; + case TERRORIST: + CreateAndAddEventToList(ROUND_START_CS_T); + break; } } } -/* <213fc1> ../cstrike/dlls/tutor_cs_tutor.cpp:2239 */ void CCSTutor::HandleBeingShotAt(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) - { - CBasePlayer *player = static_cast(entity); + if (localPlayer == NULL) + return; - if (player != NULL && player->IsPlayer() && player == localPlayer && localPlayer->IsAlive()) - { - CreateAndAddEventToList(YOU_HAVE_BEEN_SHOT_AT, entity, other); - } + CBasePlayer *player = static_cast(entity); + + if (player != NULL && player->IsPlayer() && player == localPlayer && localPlayer->IsAlive()) + { + CreateAndAddEventToList(YOU_HAVE_BEEN_SHOT_AT, entity, other); } } -/* <2158b5> ../cstrike/dlls/tutor_cs_tutor.cpp:2265 */ void CCSTutor::HandleHostageUsed(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) - { - CBasePlayer *activator = static_cast(entity); + if (localPlayer == NULL) + return; - if (activator != NULL && activator->IsPlayer()) + CBasePlayer *activator = static_cast(entity); + if (activator != NULL && activator->IsPlayer()) + { + bool unusedHostages = !CheckForAllHostagesFollowingSomeone(); + + if (activator == localPlayer) { - bool unusedHostages = !CheckForAllHostagesFollowingSomeone(); - - if (activator == localPlayer) - { - CreateAndAddEventToList(unusedHostages ? YOU_USED_HOSTAGE_MORE_LEFT : YOU_USED_HOSTAGE_NO_MORE_LEFT); - } - else if (!unusedHostages) - { - switch (localPlayer->m_iTeam) - { - case CT: - CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_CT); - break; - case TERRORIST: - CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_T); - break; - default: - break; - } - } + CreateAndAddEventToList(unusedHostages ? YOU_USED_HOSTAGE_MORE_LEFT : YOU_USED_HOSTAGE_NO_MORE_LEFT); } - } -} - -/* <214011> ../cstrike/dlls/tutor_cs_tutor.cpp:2307 */ -void CCSTutor::HandleHostageRescued(CBaseEntity *entity, CBaseEntity *other) -{ - CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - - if (localPlayer != NULL) - { - CBasePlayer *rescuer = static_cast(entity); - - if (rescuer != NULL && rescuer->IsPlayer()) + else if (!unusedHostages) { switch (localPlayer->m_iTeam) { case CT: - CreateAndAddEventToList((localPlayer == rescuer) ? YOU_RESCUED_HOSTAGE : HOSTAGE_RESCUED_CT); + CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_CT); break; case TERRORIST: - CreateAndAddEventToList(HOSTAGE_RESCUED_T); - break; - default: + CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_T); break; } } } } -/* <2140c8> ../cstrike/dlls/tutor_cs_tutor.cpp:2342 */ -void CCSTutor::HandleAllHostagesRescued(CBaseEntity *entity, CBaseEntity *other) +void CCSTutor::HandleHostageRescued(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) + if (localPlayer == NULL) + return; + + CBasePlayer *rescuer = static_cast(entity); + if (rescuer != NULL && rescuer->IsPlayer()) { switch (localPlayer->m_iTeam) { case CT: - CreateAndAddEventToList(ALL_HOSTAGES_RESCUED_CT); + CreateAndAddEventToList((localPlayer == rescuer) ? YOU_RESCUED_HOSTAGE : HOSTAGE_RESCUED_CT); break; case TERRORIST: - CreateAndAddEventToList(ALL_HOSTAGES_RESCUED_T); - break; - default: + CreateAndAddEventToList(HOSTAGE_RESCUED_T); break; } } } -/* <214161> ../cstrike/dlls/tutor_cs_tutor.cpp:2361 */ +void CCSTutor::HandleAllHostagesRescued(CBaseEntity *entity, CBaseEntity *other) +{ + CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); + + if (localPlayer == NULL) + return; + + switch (localPlayer->m_iTeam) + { + case CT: + CreateAndAddEventToList(ALL_HOSTAGES_RESCUED_CT); + break; + case TERRORIST: + CreateAndAddEventToList(ALL_HOSTAGES_RESCUED_T); + break; + } +} + void CCSTutor::HandleHostageDamaged(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) - { - CBasePlayer *attacker = static_cast(other); + if (localPlayer == NULL) + return; - if (entity != NULL && attacker != NULL && attacker->IsPlayer() && localPlayer == attacker) - { - CreateAndAddEventToList(YOU_DAMAGED_HOSTAGE); - } + CBasePlayer *attacker = static_cast(other); + if (entity != NULL && attacker != NULL && attacker->IsPlayer() && localPlayer == attacker) + { + CreateAndAddEventToList(YOU_DAMAGED_HOSTAGE); } } -/* <2157fb> ../cstrike/dlls/tutor_cs_tutor.cpp:2389 */ void CCSTutor::HandleHostageKilled(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) + if (localPlayer == NULL) + return; + + CheckForAllHostagesDead(); + + CBasePlayer *attacker = static_cast(other); + if (entity != NULL && attacker != NULL && attacker->IsPlayer()) { - CheckForAllHostagesDead(); + bool unusedHostages = CheckForAllHostagesFollowingSomeone(); - CBasePlayer *attacker = static_cast(other); - - if (entity != NULL && attacker != NULL && attacker->IsPlayer()) + if (localPlayer == attacker) { - bool unusedHostages = CheckForAllHostagesFollowingSomeone(); + CreateAndAddEventToList(YOU_KILLED_HOSTAGE); + } - if (localPlayer == attacker) + if (unusedHostages) + { + switch (localPlayer->m_iTeam) { - CreateAndAddEventToList(YOU_KILLED_HOSTAGE); - } - - if (unusedHostages) - { - switch (localPlayer->m_iTeam) - { - case CT: - CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_CT); - break; - case TERRORIST: - CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_T); - break; - default: - break; - } + case CT: + CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_CT); + break; + case TERRORIST: + CreateAndAddEventToList(ALL_HOSTAGES_FOLLOWING_T); + break; } } } } -/* <2141f5> ../cstrike/dlls/tutor_cs_tutor.cpp:2433 */ void CCSTutor::HandleRoundDraw(CBaseEntity *entity, CBaseEntity *other) { - CHalfLifeMultiplay *mp = g_pGameRules; - - if (mp->m_iTotalRoundsPlayed) + if (CSGameRules()->m_iTotalRoundsPlayed) { CreateAndAddEventToList(ROUND_DRAW); } @@ -2116,206 +1978,174 @@ void CCSTutor::HandleRoundDraw(CBaseEntity *entity, CBaseEntity *other) ResetPlayerDeathInfo(); } -/* <21429a> ../cstrike/dlls/tutor_cs_tutor.cpp:2445 */ void CCSTutor::HandleCTWin(CBaseEntity *entith, CBaseEntity *other) { CreateAndAddEventToList(CT_WIN); ResetPlayerDeathInfo(); } -/* <214335> ../cstrike/dlls/tutor_cs_tutor.cpp:2453 */ void CCSTutor::HandleTWin(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(T_WIN); ResetPlayerDeathInfo(); } -/* <2143ed> ../cstrike/dlls/tutor_cs_tutor.cpp:2461 */ void CCSTutor::HandleDeathCameraStart(CBaseEntity *entity, CBaseEntity *other) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) - { - CBasePlayer *player = static_cast(entity); + if (localPlayer == NULL) + return; - if (player != NULL && player->IsPlayer() && player == localPlayer) - { - m_messageTypeMask = (TUTORMESSAGETYPE_FRIEND_DEATH | TUTORMESSAGETYPE_ENEMY_DEATH | TUTORMESSAGETYPE_HINT | TUTORMESSAGETYPE_END_GAME); - CreateAndAddEventToList(DEATH_CAMERA_START); - } + CBasePlayer *player = static_cast(entity); + + if (player != NULL && player->IsPlayer() && player == localPlayer) + { + m_messageTypeMask = (TUTORMESSAGETYPE_FRIEND_DEATH | TUTORMESSAGETYPE_ENEMY_DEATH | TUTORMESSAGETYPE_HINT | TUTORMESSAGETYPE_END_GAME); + CreateAndAddEventToList(DEATH_CAMERA_START); } } -/* <214472> ../cstrike/dlls/tutor_cs_tutor.cpp:2487 */ void CCSTutor::HandleRadioCoverMe(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_COVER_ME, entity, other); } -/* <2144dd> ../cstrike/dlls/tutor_cs_tutor.cpp:2492 */ void CCSTutor::HandleRadioYouTakeThePoint(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_YOU_TAKE_THE_POINT, entity, other); } -/* <214548> ../cstrike/dlls/tutor_cs_tutor.cpp:2497 */ void CCSTutor::HandleRadioHoldThisPosition(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_HOLD_THIS_POSITION, entity, other); } -/* <2145b3> ../cstrike/dlls/tutor_cs_tutor.cpp:2502 */ void CCSTutor::HandleRadioRegroupTeam(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_REGROUP_TEAM, entity, other); } -/* <21461e> ../cstrike/dlls/tutor_cs_tutor.cpp:2507 */ void CCSTutor::HandleRadioFollowMe(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_FOLLOW_ME, entity, other); } -/* <214689> ../cstrike/dlls/tutor_cs_tutor.cpp:2512 */ void CCSTutor::HandleRadioTakingFire(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_TAKING_FIRE, entity, other); } -/* <2146f4> ../cstrike/dlls/tutor_cs_tutor.cpp:2517 */ void CCSTutor::HandleRadioGoGoGo(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_GO_GO_GO, entity, other); } -/* <21475f> ../cstrike/dlls/tutor_cs_tutor.cpp:2522 */ void CCSTutor::HandleRadioTeamFallBack(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_TEAM_FALL_BACK, entity, other); } -/* <2147ca> ../cstrike/dlls/tutor_cs_tutor.cpp:2527 */ void CCSTutor::HandleRadioStickTogetherTeam(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_STICK_TOGETHER_TEAM, entity, other); } -/* <214835> ../cstrike/dlls/tutor_cs_tutor.cpp:2532 */ void CCSTutor::HandleRadioGetInPositionAndWait(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_GET_IN_POSITION_AND_WAIT, entity, other); } -/* <2148a0> ../cstrike/dlls/tutor_cs_tutor.cpp:2537 */ void CCSTutor::HandleRadioStormTheFront(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_STORM_THE_FRONT, entity, other); } -/* <21490b> ../cstrike/dlls/tutor_cs_tutor.cpp:2542 */ void CCSTutor::HandleRadioReportInTeam(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_REPORT_IN_TEAM, entity, other); } -/* <214976> ../cstrike/dlls/tutor_cs_tutor.cpp:2547 */ void CCSTutor::HandleRadioAffirmative(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_AFFIRMATIVE, entity, other); } -/* <2149e1> ../cstrike/dlls/tutor_cs_tutor.cpp:2552 */ void CCSTutor::HandleRadioEnemySpotted(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_ENEMY_SPOTTED, entity, other); } -/* <214a4c> ../cstrike/dlls/tutor_cs_tutor.cpp:2557 */ void CCSTutor::HandleRadioNeedBackup(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_NEED_BACKUP, entity, other); } -/* <214ab7> ../cstrike/dlls/tutor_cs_tutor.cpp:2562 */ void CCSTutor::HandleRadioSectorClear(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_SECTOR_CLEAR, entity, other); } -/* <214b22> ../cstrike/dlls/tutor_cs_tutor.cpp:2567 */ void CCSTutor::HandleRadioInPosition(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_IN_POSITION, entity, other); } -/* <214b8d> ../cstrike/dlls/tutor_cs_tutor.cpp:2572 */ void CCSTutor::HandleRadioReportingIn(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_REPORTING_IN, entity, other); } -/* <214bf8> ../cstrike/dlls/tutor_cs_tutor.cpp:2577 */ void CCSTutor::HandleRadioGetOutOfThere(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_GET_OUT_OF_THERE, entity, other); } -/* <214c63> ../cstrike/dlls/tutor_cs_tutor.cpp:2582 */ void CCSTutor::HandleRadioNegative(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_NEGATIVE, entity, other); } -/* <214cce> ../cstrike/dlls/tutor_cs_tutor.cpp:2587 */ void CCSTutor::HandleRadioEnemyDown(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(RADIO_ENEMY_DOWN, entity, other); } -/* <214d39> ../cstrike/dlls/tutor_cs_tutor.cpp:2592 */ void CCSTutor::HandleNotBuyingAnything(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(BUY_TIME_BEGIN, entity, other); } -/* <214da4> ../cstrike/dlls/tutor_cs_tutor.cpp:2597 */ void CCSTutor::HandleNeedToBuyPrimaryWeapon(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(BUY_NEED_PRIMARY, entity, other); } -/* <214e0f> ../cstrike/dlls/tutor_cs_tutor.cpp:2602 */ void CCSTutor::HandleNeedToBuyPrimaryAmmo(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(BUY_NEED_PRIMARY_AMMO, entity, other); } -/* <214e7a> ../cstrike/dlls/tutor_cs_tutor.cpp:2607 */ void CCSTutor::HandleNeedToBuySecondaryAmmo(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(BUY_NEED_SECONDARY_AMMO, entity, other); } -/* <214ee5> ../cstrike/dlls/tutor_cs_tutor.cpp:2612 */ void CCSTutor::HandleNeedToBuyArmor(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(BUY_NEED_ARMOR, entity, other); } -/* <214f50> ../cstrike/dlls/tutor_cs_tutor.cpp:2617 */ void CCSTutor::HandleNeedToBuyDefuseKit(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(BUY_NEED_DEFUSE_KIT, entity, other); } -/* <214fbb> ../cstrike/dlls/tutor_cs_tutor.cpp:2622 */ void CCSTutor::HandleNeedToBuyGrenade(CBaseEntity *entity, CBaseEntity *other) { CreateAndAddEventToList(BUY_NEED_GRENADE, entity, other); } -/* <215036> ../cstrike/dlls/tutor_cs_tutor.cpp:2627 */ void CCSTutor::HandleCareerTaskDone(CBaseEntity *entity, CBaseEntity *other) { int numTasksRemaining = 0; @@ -2326,33 +2156,31 @@ void CCSTutor::HandleCareerTaskDone(CBaseEntity *entity, CBaseEntity *other) CreateAndAddEventToList(CAREER_TASK_DONE_ALL_DONE); } -/* <2108c4> ../cstrike/dlls/tutor_cs_tutor.cpp:2650 */ void CCSTutor::__MAKE_VHOOK(HandleShotFired)(Vector source, Vector target) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) + if (localPlayer == NULL) + return; + + float d1, d, angle, FiringLineDistanceToPlayer; + + d1 = (source - localPlayer->pev->origin).Length(); + + if (d1 > 32.0f) { - float d1, d, angle, FiringLineDistanceToPlayer; + d = (target - source).Length(); + angle = d1 / d; - d1 = (source - localPlayer->pev->origin).Length(); + FiringLineDistanceToPlayer = Q_sin(Q_acos(angle)) * d1; - if (d1 > 32.0f) + if (FiringLineDistanceToPlayer <= 3000.0f) { - d = (target - source).Length(); - angle = d1 / d; - - FiringLineDistanceToPlayer = sin(acos(angle)) * d1; - - if (FiringLineDistanceToPlayer <= 3000.0f) - { - OnEvent(EVENT_BEING_SHOT_AT, localPlayer); - } + OnEvent(EVENT_BEING_SHOT_AT, localPlayer); } } } -/* <21507d> ../cstrike/dlls/tutor_cs_tutor.cpp:2720 */ void CCSTutor::GetNumPlayersAliveOnTeams(int &numT, int &numCT) { numT = 0; @@ -2363,90 +2191,72 @@ void CCSTutor::GetNumPlayersAliveOnTeams(int &numT, int &numCT) CBasePlayer *player = static_cast(UTIL_PlayerByIndex(i)); if (player == NULL || !player->IsAlive()) - { continue; - } switch (player->m_iTeam) { case CT: - numCT++; + ++numCT; break; case TERRORIST: - numT++; + ++numT; break; } } } -/* <2150d5> ../cstrike/dlls/tutor_cs_tutor.cpp:2749 */ void CCSTutor::CheckForLooseWeaponViewable() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL) - { - bool sawFirst = false; - CBaseEntity *weapon = NULL; - TutorMessage *message = GetTutorMessageDefinition(YOU_SEE_LOOSE_WEAPON); + if (localPlayer == NULL) + return; - if (message == NULL || message->m_class != TUTORMESSAGECLASS_EXAMINE) + TutorMessage *message = GetTutorMessageDefinition(YOU_SEE_LOOSE_WEAPON); + if (message != NULL && message->m_class == TUTORMESSAGECLASS_EXAMINE) + return; + + CBaseEntity *weapon = NULL; + while ((weapon = UTIL_FindEntityByClassname(weapon, "weaponbox")) != NULL) + { + if (IsEntityInViewOfPlayer(weapon, localPlayer)) { - while ((weapon = UTIL_FindEntityByClassname(weapon, "weaponbox")) != NULL) - { - if (IsEntityInViewOfPlayer(weapon, localPlayer)) - { - if (!sawFirst) - { - sawFirst = true; - CreateAndAddEventToList(YOU_SEE_LOOSE_WEAPON); - } - } - } + CreateAndAddEventToList(YOU_SEE_LOOSE_WEAPON); + break; } } } -/* <21514d> ../cstrike/dlls/tutor_cs_tutor.cpp:2787 */ void CCSTutor::CheckForLooseDefuserViewable() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - if (localPlayer != NULL && localPlayer->m_iTeam == CT) - { - bool sawFirst = false; - CBaseEntity *defuser = NULL; - TutorMessage *message = GetTutorMessageDefinition(YOU_SEE_LOOSE_DEFUSER); + if (localPlayer == NULL || localPlayer->m_iTeam != CT) + return; - if (message == NULL || message->m_class != TUTORMESSAGECLASS_EXAMINE) + TutorMessage *message = GetTutorMessageDefinition(YOU_SEE_LOOSE_DEFUSER); + if (message != NULL && message->m_class == TUTORMESSAGECLASS_EXAMINE) + return; + + CBaseEntity *defuser = NULL; + while ((defuser = UTIL_FindEntityByClassname(defuser, "item_thighpack")) != NULL) + { + if (IsEntityInViewOfPlayer(defuser, localPlayer)) { - while ((defuser = UTIL_FindEntityByClassname(defuser, "item_thighpack")) != NULL) - { - if (IsEntityInViewOfPlayer(defuser, localPlayer)) - { - if (!sawFirst) - { - sawFirst = true; - CreateAndAddEventToList(YOU_SEE_LOOSE_DEFUSER); - } - } - } + CreateAndAddEventToList(YOU_SEE_LOOSE_DEFUSER); + break; } } } -/* <2151c1> ../cstrike/dlls/tutor_cs_tutor.cpp:2826 */ void CCSTutor::CheckForBombViewable() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); if (localPlayer == NULL) - { return; - } CBaseEntity *bomb = UTIL_FindEntityByClassname(NULL, "grenade"); - if (bomb != NULL && ((CGrenade *)bomb)->m_bIsC4 && IsEntityInViewOfPlayer(bomb, localPlayer)) { switch (localPlayer->m_iTeam) @@ -2481,7 +2291,7 @@ void CCSTutor::CheckForBombViewable() { CBasePlayer *player = static_cast(UTIL_PlayerByIndex(i)); - if (player && player->m_bHasC4) + if (player != NULL && player->m_bHasC4) { bombCarrier = player; break; @@ -2551,18 +2361,14 @@ void CCSTutor::CheckForBombViewable() } } -/* <215431> ../cstrike/dlls/tutor_cs_tutor.cpp:2959 */ void CCSTutor::CheckForBombsiteViewable() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); if (localPlayer == NULL) - { return; - } TutorMessageID mid = CheckForInBombZone(); - if (mid == TUTOR_NUM_MESSAGES) { switch (localPlayer->m_iTeam) @@ -2587,7 +2393,6 @@ void CCSTutor::CheckForBombsiteViewable() } TutorMessage *definition = GetTutorMessageDefinition(mid); - if (definition == NULL || definition->m_class != TUTORMESSAGECLASS_EXAMINE) { bool sawFirst = false; @@ -2597,25 +2402,18 @@ void CCSTutor::CheckForBombsiteViewable() { if (IsBombPlantedInBombsite(bombTarget)) { - if (!sawFirst) - { - sawFirst = true; - CreateAndAddEventToList(mid); - break; - } + sawFirst = true; + CreateAndAddEventToList(mid); + break; } } - while ((bombTarget = UTIL_FindEntityByClassname(bombTarget, "info_bomb_target")) != NULL) + if (!sawFirst) { - if (sawFirst) - break; - - if (IsBombPlantedInBombsite(bombTarget)) + while ((bombTarget = UTIL_FindEntityByClassname(bombTarget, "info_bomb_target")) != NULL) { - if (!sawFirst) + if (IsBombPlantedInBombsite(bombTarget)) { - sawFirst = true; CreateAndAddEventToList(mid); break; } @@ -2627,7 +2425,6 @@ void CCSTutor::CheckForBombsiteViewable() CreateAndAddEventToList(mid); } -/* <21534e> ../cstrike/dlls/tutor_cs_tutor.cpp:3026 */ TutorMessageID CCSTutor::CheckForInBombZone() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -2657,7 +2454,6 @@ TutorMessageID CCSTutor::CheckForInBombZone() return mid; } -/* <2154b6> ../cstrike/dlls/tutor_cs_tutor.cpp:3078 */ bool CCSTutor::IsBombPlantedInBombsite(CBaseEntity *bombTarget) { CGrenade *bomb = NULL; @@ -2673,7 +2469,6 @@ bool CCSTutor::IsBombPlantedInBombsite(CBaseEntity *bombTarget) return false; } -/* <2154f4> ../cstrike/dlls/tutor_cs_tutor.cpp:3102 */ void CCSTutor::CheckForHostageViewable() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -2682,8 +2477,6 @@ void CCSTutor::CheckForHostageViewable() return; CBaseEntity *hostageEntity = NULL; - bool sawFirst = false; - while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL) { bool validHostage = false; @@ -2695,10 +2488,8 @@ void CCSTutor::CheckForHostageViewable() validHostage = true; } - if (hostage->IsValid() && validHostage && IsEntityInViewOfPlayer(hostage, localPlayer) && !sawFirst) + if (hostage->IsValid() && validHostage && IsEntityInViewOfPlayer(hostage, localPlayer)) { - sawFirst = true; - switch (localPlayer->m_iTeam) { case CT: @@ -2726,20 +2517,18 @@ void CCSTutor::CheckForHostageViewable() break; } } + + break; } } } -/* <215646> ../cstrike/dlls/tutor_cs_tutor.cpp:3168 */ void CCSTutor::CheckForTimeRunningOut() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); - CHalfLifeMultiplay *mpRules = g_pGameRules; - if (localPlayer == NULL || mpRules->IsFreezePeriod() || mpRules->TimeRemaining() > 30.0f) - { + if (localPlayer == NULL || CSGameRules()->IsFreezePeriod() || CSGameRules()->TimeRemaining() > 30.0f) return; - } if (IsBombMap()) { @@ -2767,7 +2556,6 @@ void CCSTutor::CheckForTimeRunningOut() } } -/* <2156fd> ../cstrike/dlls/tutor_cs_tutor.cpp:3218 */ void CCSTutor::CheckForAllHostagesDead() { bool foundLiveOne = false; @@ -2788,7 +2576,6 @@ void CCSTutor::CheckForAllHostagesDead() } } -/* <21573c> ../cstrike/dlls/tutor_cs_tutor.cpp:3242 */ bool CCSTutor::CheckForAllHostagesFollowingSomeone() { bool foundUnusedOne = false; @@ -2809,16 +2596,12 @@ bool CCSTutor::CheckForAllHostagesFollowingSomeone() return foundUnusedOne ? false : true; } -/* <210b98> ../cstrike/dlls/tutor_cs_tutor.cpp:3268 */ TutorMessage *CCSTutor::__MAKE_VHOOK(GetTutorMessageDefinition)(int messageID) { if (messageID < 0 || messageID >= TUTOR_NUM_MESSAGES) - { return NULL; - } TutorMessageMapIter iter = m_messageMap.find(TutorIdentifierList[messageID]); - if (iter != m_messageMap.end()) { return (*iter).second; @@ -2827,7 +2610,6 @@ TutorMessage *CCSTutor::__MAKE_VHOOK(GetTutorMessageDefinition)(int messageID) return NULL; } -/* <215938> ../cstrike/dlls/tutor_cs_tutor.cpp:3285 */ CBaseEntity *CCSTutor::GetEntityForMessageID(int messageID, CBaseEntity *last) { CBaseEntity *ret = NULL; @@ -2849,9 +2631,7 @@ CBaseEntity *CCSTutor::GetEntityForMessageID(int messageID, CBaseEntity *last) if (localPlayer != NULL) { if (m_clientCorpseList.empty()) - { return NULL; - } ClientCorpseStruct *lastCorpse = NULL; ClientCorpseListIter iter; @@ -2865,9 +2645,7 @@ CBaseEntity *CCSTutor::GetEntityForMessageID(int messageID, CBaseEntity *last) lastCorpse = (*iter); if ((CBaseEntity *)lastCorpse == last) - { break; - } ++iter; } @@ -2877,9 +2655,7 @@ CBaseEntity *CCSTutor::GetEntityForMessageID(int messageID, CBaseEntity *last) ClientCorpseStruct *corpse = (*iter); if (corpse->m_team == localPlayer->m_iTeam) - { return (CBaseEntity *)&corpse->m_position; - } ++iter; } @@ -2918,38 +2694,45 @@ CBaseEntity *CCSTutor::GetEntityForMessageID(int messageID, CBaseEntity *last) return ret; } -/* <215a44> ../cstrike/dlls/tutor_cs_tutor.cpp:3374 */ void CCSTutor::CheckHintMessages(float time) { if (m_deadAirStartTime <= 0.0f || (time - m_deadAirStartTime <= cv_tutor_hint_interval_time.value)) - { return; - } m_lastHintShown++; - bool confusingHint = false; - - if (IsHostageMap()) + while (true) { - if (m_lastHintShown > HINT_HOSTAGE_START) + bool confusingHint = false; + if (IsHostageMap()) { - confusingHint = true; - } - } - - if (!confusingHint) - { - if (IsBombMap() && m_lastHintShown < HINT_END) - { - if (m_lastHintShown == HINT_END) + if (m_lastHintShown >= HINT_BOMB_START && m_lastHintShown <= HINT_BOMB_END) { - m_lastHintShown = HINT_1; + confusingHint = true; } } + else if (IsBombMap()) + { + if (m_lastHintShown >= HINT_HOSTAGE_START && m_lastHintShown <= HINT_HOSTAGE_END) + { + confusingHint = true; + } + } + + if (!confusingHint) + { + break; + } + + m_lastHintShown++; + + if (m_lastHintShown <= HINT_BEGIN || m_lastHintShown >= HINT_END) + { + m_lastHintShown = HINT_1; + } } - if (m_lastHintShown > HINT_END) + if (m_lastHintShown <= HINT_BEGIN || m_lastHintShown >= HINT_END) { m_lastHintShown = HINT_1; } @@ -2962,20 +2745,15 @@ void CCSTutor::CheckHintMessages(float time) } } -/* <215b23> ../cstrike/dlls/tutor_cs_tutor.cpp:3456 */ void CCSTutor::CheckInGameHintMessages(float time) { if (m_deadAirStartTime <= 0.0f || (time - m_deadAirStartTime <= cv_tutor_hint_interval_time.value)) - { return; - } m_lastInGameHintShown++; if (m_lastInGameHintShown <= INGAME_HINT_BEGIN || m_lastInGameHintShown >= INGAME_HINT_END) - { return; - } TutorMessage *message = GetTutorMessageDefinition(m_lastInGameHintShown); @@ -2985,7 +2763,6 @@ void CCSTutor::CheckInGameHintMessages(float time) } } -/* <215b61> ../cstrike/dlls/tutor_cs_tutor.cpp:3493 */ void CCSTutor::CheckForNeedToReload(bool isPassiveCheck) { CBasePlayer *localPlayer; @@ -2997,24 +2774,18 @@ void CCSTutor::CheckForNeedToReload(bool isPassiveCheck) Q_memset(&itemInfo, 0, sizeof(itemInfo)); if (localPlayer == NULL || !localPlayer->IsPlayer()) - { return; - } currentItem = localPlayer->m_pActiveItem; if (currentItem == NULL || !currentItem->IsWeapon()) - { return; - } currentWeapon = static_cast(currentItem); currentWeapon->GetItemInfo(&itemInfo); if (itemInfo.iSlot && itemInfo.iSlot != 1) - { return; - } if (localPlayer->m_rgAmmo[currentWeapon->m_iPrimaryAmmoType]) { @@ -3065,7 +2836,6 @@ void CCSTutor::CheckForNeedToReload(bool isPassiveCheck) } } -/* <215d16> ../cstrike/dlls/tutor_cs_tutor.cpp:3568 */ void CCSTutor::CheckExamineMessages(float time) { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -3158,7 +2928,6 @@ void CCSTutor::CheckExamineMessages(float time) } } -/* <215eec> ../cstrike/dlls/tutor_cs_tutor.cpp:3696 */ bool CCSTutor::CanLocalPlayerBuyStuff() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); @@ -3171,15 +2940,12 @@ bool CCSTutor::CanLocalPlayerBuyStuff() return false; } -/* <215f25> ../cstrike/dlls/tutor_cs_tutor.cpp:3714 */ void CCSTutor::CheckBuyZoneMessages() { CBasePlayer *localPlayer = UTIL_GetLocalPlayer(); if (localPlayer == NULL || m_currentlyShownMessageID == BUY_TIME_BEGIN) - { return; - } CBasePlayerWeapon *primary = static_cast(localPlayer->m_rgpPlayerItems[PRIMARY_WEAPON_SLOT]); CBasePlayerWeapon *secondary = static_cast(localPlayer->m_rgpPlayerItems[PISTOL_SLOT]); @@ -3221,21 +2987,16 @@ void CCSTutor::CheckBuyZoneMessages() TheTutor->OnEvent(EVENT_TUTOR_NOT_BUYING_ANYTHING); } -/* <216cdd> ../cstrike/dlls/tutor_cs_tutor.cpp:3767 */ bool CCSTutor::IsHostageMap() { return UTIL_FindEntityByClassname(NULL, "hostage_entity") != NULL; } -/* <216d01> ../cstrike/dlls/tutor_cs_tutor.cpp:3773 */ bool CCSTutor::IsBombMap() { - CHalfLifeMultiplay *mpRules = g_pGameRules; - - return mpRules->m_bMapHasBombTarget; + return CSGameRules()->m_bMapHasBombTarget; } -/* <216d35> ../cstrike/dlls/tutor_cs_tutor.cpp:3781 */ void CCSTutor::ResetPlayerDeathInfo() { for (int i = 0; i < ARRAYSIZE(m_playerDeathInfo); ++i) @@ -3245,13 +3006,10 @@ void CCSTutor::ResetPlayerDeathInfo() } } -/* <216d6d> ../cstrike/dlls/tutor_cs_tutor.cpp:3795 */ void CCSTutor::ConstructRecentDeathsList(TeamName team, char *buf, int buflen, TutorMessageEvent *event) { if (!buf || !buflen) - { return; - } char scratch[32]; buf[0] = '\0'; @@ -3278,7 +3036,6 @@ void CCSTutor::ConstructRecentDeathsList(TeamName team, char *buf, int buflen, T } } -/* <216dc2> ../cstrike/dlls/tutor_cs_tutor.cpp:3853 */ void CCSTutor::TransferDeathEvents(TutorMessageEvent *oldEvent, TutorMessageEvent *newEvent) { for (int i = 0; i < ARRAYSIZE(m_playerDeathInfo); ++i) diff --git a/regamedll/dlls/tutor_cs_tutor.h b/regamedll/dlls/tutor_cs_tutor.h index 620993e7..03ac2569 100644 --- a/regamedll/dlls/tutor_cs_tutor.h +++ b/regamedll/dlls/tutor_cs_tutor.h @@ -292,11 +292,11 @@ public: void ClearCurrentEvent(bool closeWindow = true, bool processDeathsForEvent = true); void DeleteEvent(TutorMessageEvent *event); bool ShouldShowMessageEvent(TutorMessageEvent *event, float time); - NOXREF bool ShouldUpdateCurrentMessage(TutorMessageID messageID); + bool ShouldUpdateCurrentMessage(TutorMessageID messageID); void ComputeDisplayTimesForMessage(); void UpdateCurrentMessage(TutorMessageEvent *event); void ConstructMessageAndDisplay(); - NOXREF void LookupHotKey(TutorMessageID mid, int paramNum, wchar_t *buf, int buflen); + void LookupHotKey(TutorMessageID mid, int paramNum, wchar_t *buf, int buflen); void CheckForWindowClose(float time); void CheckForContentUpdate(); bool HasCurrentWindowBeenActiveLongEnough(float time); @@ -316,10 +316,10 @@ public: void HandleWeaponReloaded(CBaseEntity *entity, CBaseEntity *other); void HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other); void HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other); - NOXREF void HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity *other); + void HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity *other); void HandlePlayerTookDamage(CBaseEntity *entity, CBaseEntity *other); void HandlePlayerBlindedByFlashbang(CBaseEntity *entity, CBaseEntity *other); - NOXREF void HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other); + void HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other); void HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other); void HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other); void HandleRoundStart(CBaseEntity *entity, CBaseEntity *other); @@ -400,7 +400,7 @@ public: void HandleShotFired_(Vector source, Vector target); TutorMessage *GetTutorMessageDefinition_(int messageID); -#endif // HOOK_GAMEDLL +#endif private: float m_nextViewableCheckTime; @@ -416,7 +416,7 @@ private: ClientCorpseList m_clientCorpseList; int m_messageTypeMask; bool m_haveSpawned; - PlayerDeathStruct m_playerDeathInfo[32]; + PlayerDeathStruct m_playerDeathInfo[MAX_CLIENTS]; }; void ParseMessageParameters(char *&messageData, TutorMessage *ret); diff --git a/regamedll/dlls/unisignals.h b/regamedll/dlls/unisignals.h index 4d6c3005..e05ecf95 100644 --- a/regamedll/dlls/unisignals.h +++ b/regamedll/dlls/unisignals.h @@ -32,7 +32,6 @@ #pragma once #endif -/* <48ed3f> ../cstrike/dlls/unisignals.h:36 */ class CUnifiedSignals { public: @@ -47,9 +46,9 @@ public: m_flState = m_flSignal; m_flSignal = 0; } - void Signal(int flags) { m_flSignal |= flags; } - int GetSignal() const { return m_flSignal; } - int GetState() const { return m_flState; } + void Signal(int flags) { m_flSignal |= flags; } + int GetSignal() const { return m_flSignal; } + int GetState() const { return m_flState; } private: int m_flSignal; diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index 28967fe0..e8369aba 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -131,10 +131,9 @@ float UTIL_WeaponTimeBase() return 0.0; #else return gpGlobals->time; -#endif // CLIENT_WEAPONS +#endif } -/* <1ac4be> ../cstrike/dlls/util.cpp:59 */ unsigned int U_Random() { glSeed *= 69069; @@ -142,13 +141,11 @@ unsigned int U_Random() return (glSeed & 0xFFFFFFF); } -/* <1ab992> ../cstrike/dlls/util.cpp:67 */ void U_Srand(unsigned int seed) { glSeed = seed_table[seed & 0xFF]; } -/* <1ac4f8> ../cstrike/dlls/util.cpp:78 */ int UTIL_SharedRandomLong(unsigned int seed, int low, int high) { unsigned int range = high - low + 1; @@ -163,7 +160,6 @@ int UTIL_SharedRandomLong(unsigned int seed, int low, int high) return low; } -/* <1ac5b5> ../cstrike/dlls/util.cpp:108 */ float UTIL_SharedRandomFloat(unsigned int seed, float low, float high) { unsigned int range = high - low; @@ -175,14 +171,13 @@ float UTIL_SharedRandomFloat(unsigned int seed, float low, float high) if (range) { int tensixrand = U_Random() & 0xFFFFu; - float offset = (float)tensixrand / 0x10000u; + float offset = float(tensixrand) / 0x10000u; return (low + offset * range); } return low; } -/* <1ac6a9> ../cstrike/dlls/util.cpp:136 */ NOXREF void UTIL_ParametricRocket(entvars_t *pev, Vector p_vecOrigin, Vector vecAngles, edict_t *owner) { TraceResult tr; @@ -204,7 +199,6 @@ NOXREF void UTIL_ParametricRocket(entvars_t *pev, Vector p_vecOrigin, Vector vec pev->impacttime = travelTime + gpGlobals->time; } -/* <1ac888> ../cstrike/dlls/util.cpp:160 */ void UTIL_SetGroupTrace(int groupmask, int op) { g_groupmask = groupmask; @@ -213,7 +207,6 @@ void UTIL_SetGroupTrace(int groupmask, int op) ENGINE_SETGROUPMASK(groupmask, op); } -/* <1ac8bf> ../cstrike/dlls/util.cpp:168 */ void UTIL_UnsetGroupTrace() { g_groupmask = 0; @@ -222,7 +215,6 @@ void UTIL_UnsetGroupTrace() ENGINE_SETGROUPMASK(0,0); } -/* <1ac90c> ../cstrike/dlls/util.cpp:177 */ NOXREF UTIL_GroupTrace::UTIL_GroupTrace(int groupmask, int op) { m_oldgroupmask = g_groupmask; @@ -234,7 +226,6 @@ NOXREF UTIL_GroupTrace::UTIL_GroupTrace(int groupmask, int op) ENGINE_SETGROUPMASK(groupmask, op); } -/* <1ac963> ../cstrike/dlls/util.cpp:188 */ NOXREF UTIL_GroupTrace::~UTIL_GroupTrace() { g_groupmask = m_oldgroupmask; @@ -243,23 +234,20 @@ NOXREF UTIL_GroupTrace::~UTIL_GroupTrace() ENGINE_SETGROUPMASK(g_groupmask, g_groupop); } -/* <1ac985> ../cstrike/dlls/util.cpp:345 */ NOXREF BOOL UTIL_GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) { return g_pGameRules->GetNextBestWeapon(pPlayer,pCurrentWeapon); } -/* <1ab9ab> ../cstrike/dlls/util.cpp:352 */ NOXREF float UTIL_AngleMod(float a) { if (a < 0.0f) - a = a + 360.0f * ((int)(a / 360.0f) + 1); + a = a + 360.0f * (int(a / 360.0f) + 1); else if (a >= 360.0f) - a = a - 360.0f * ((int)(a / 360.0f)); + a = a - 360.0f * int(a / 360.0f); return a; } -/* <1aca1d> ../cstrike/dlls/util.cpp:366 */ NOXREF float UTIL_AngleDiff(float destAngle, float srcAngle) { float delta = destAngle - srcAngle; @@ -277,7 +265,6 @@ NOXREF float UTIL_AngleDiff(float destAngle, float srcAngle) return delta; } -/* <1aca77> ../cstrike/dlls/util.cpp:384 */ Vector UTIL_VecToAngles(const Vector &vec) { float rgflVecOut[3]; @@ -285,7 +272,6 @@ Vector UTIL_VecToAngles(const Vector &vec) return Vector(rgflVecOut); } -/* <1acaf6> ../cstrike/dlls/util.cpp:392 */ NOXREF void UTIL_MoveToOrigin(edict_t *pent, const Vector &vecGoal, float flDist, int iMoveType) { float rgfl[3]; @@ -293,7 +279,6 @@ NOXREF void UTIL_MoveToOrigin(edict_t *pent, const Vector &vecGoal, float flDist MOVE_TO_ORIGIN(pent, rgfl, flDist, iMoveType); } -/* <1acb92> ../cstrike/dlls/util.cpp:401 */ int UTIL_EntitiesInBox(CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask) { edict_t *pEdict = INDEXENT(1); @@ -332,7 +317,6 @@ int UTIL_EntitiesInBox(CBaseEntity **pList, int listMax, const Vector &mins, con return count; } -/* <1acca2> ../cstrike/dlls/util.cpp:443 */ NOXREF int UTIL_MonstersInSphere(CBaseEntity ** pList, int listMax, const Vector ¢er, float radius) { edict_t *pEdict; @@ -391,7 +375,6 @@ NOXREF int UTIL_MonstersInSphere(CBaseEntity ** pList, int listMax, const Vector return count; } -/* <1acdcc> ../cstrike/dlls/util.cpp:505 */ CBaseEntity *UTIL_FindEntityInSphere(CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius) { edict_t *pentEntity; @@ -409,7 +392,6 @@ CBaseEntity *UTIL_FindEntityInSphere(CBaseEntity *pStartEntity, const Vector &ve return NULL; } -/* <1acec6> ../cstrike/dlls/util.cpp:535 */ CBaseEntity *UTIL_FindEntityByString_Old(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue) { edict_t *pentEntity; @@ -427,7 +409,6 @@ CBaseEntity *UTIL_FindEntityByString_Old(CBaseEntity *pStartEntity, const char * return NULL; } -/* <1acfbb> ../cstrike/dlls/util.cpp:552 */ CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue) { edict_t *pentEntity; @@ -509,19 +490,16 @@ CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKe return NULL; } -/* <1ad192> ../cstrike/dlls/util.cpp:673 */ CBaseEntity *UTIL_FindEntityByClassname(CBaseEntity *pStartEntity, const char *szName) { return UTIL_FindEntityByString(pStartEntity, "classname", szName); } -/* <1ac408> ../cstrike/dlls/util.cpp:678 */ CBaseEntity *UTIL_FindEntityByTargetname(CBaseEntity *pStartEntity, const char *szName) { return UTIL_FindEntityByString(pStartEntity, "targetname", szName); } -/* <1ad209> ../cstrike/dlls/util.cpp:684 */ CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc, float flRadius) { CBaseEntity *pSearch = NULL; @@ -544,7 +522,6 @@ CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc return pEntity; } -/* <1ad347> ../cstrike/dlls/util.cpp:711 */ CBaseEntity *EXT_FUNC UTIL_PlayerByIndex(int playerIndex) { CBaseEntity *pPlayer = NULL; @@ -558,13 +535,11 @@ CBaseEntity *EXT_FUNC UTIL_PlayerByIndex(int playerIndex) return pPlayer; } -/* <1abab0> ../cstrike/dlls/util.cpp:728 */ void UTIL_MakeVectors(const Vector &vecAngles) { MAKE_VECTORS(vecAngles); } -/* <1ad442> ../cstrike/dlls/util.cpp:734 */ void UTIL_MakeAimVectors(const Vector &vecAngles) { float rgflVec[3]; @@ -573,7 +548,6 @@ void UTIL_MakeAimVectors(const Vector &vecAngles) MAKE_VECTORS(rgflVec); } -/* <1ad4b2> ../cstrike/dlls/util.cpp:745 */ void UTIL_MakeInvVectors(const Vector &vec, globalvars_t *pgv) { MAKE_VECTORS(vec); @@ -585,7 +559,6 @@ void UTIL_MakeInvVectors(const Vector &vec, globalvars_t *pgv) SWAP(pgv->v_right.z, pgv->v_up.y); } -/* <1ad53b> ../cstrike/dlls/util.cpp:758 */ void UTIL_EmitAmbientSound(edict_t *entity, const Vector &vecOrigin, const char *samp, float vol, float attenuation, int fFlags, int pitch) { float rgfl[3]; @@ -601,7 +574,6 @@ void UTIL_EmitAmbientSound(edict_t *entity, const Vector &vecOrigin, const char EMIT_AMBIENT_SOUND(entity, rgfl, samp, vol, attenuation, fFlags, pitch); } -/* <1abaf7> ../cstrike/dlls/util.cpp:773 */ unsigned short FixedUnsigned16(float value, float scale) { int output = value * scale; @@ -614,7 +586,6 @@ unsigned short FixedUnsigned16(float value, float scale) return (unsigned short)output; } -/* <1abb9f> ../cstrike/dlls/util.cpp:786 */ short FixedSigned16(float value, float scale) { int output = value * scale; @@ -627,7 +598,6 @@ short FixedSigned16(float value, float scale) return (short)output; } -/* <1ac13b> ../cstrike/dlls/util.cpp:806 */ void UTIL_ScreenShake(const Vector ¢er, float amplitude, float frequency, float duration, float radius) { int i; @@ -668,25 +638,22 @@ void UTIL_ScreenShake(const Vector ¢er, float amplitude, float frequency, fl } } -/* <1ad88a> ../cstrike/dlls/util.cpp:852 */ NOXREF void UTIL_ScreenShakeAll(const Vector ¢er, float amplitude, float frequency, float duration) { UTIL_ScreenShake(center, amplitude, frequency, duration, 0); } -/* <1ac3a1> ../cstrike/dlls/util.cpp:858 */ void UTIL_ScreenFadeBuild(ScreenFade &fade, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags) { fade.duration = FixedUnsigned16(fadeTime, 1<<12); fade.holdTime = FixedUnsigned16(fadeHold, 1<<12); - fade.r = (int)color.x; - fade.g = (int)color.y; - fade.b = (int)color.z; + fade.r = int(color.x); + fade.g = int(color.y); + fade.b = int(color.z); fade.a = alpha; fade.fadeFlags = flags; } -/* <1abb68> ../cstrike/dlls/util.cpp:870 */ void UTIL_ScreenFadeWrite(const ScreenFade &fade, CBaseEntity *pEntity) { if (!pEntity || !pEntity->IsNetClient()) @@ -703,7 +670,6 @@ void UTIL_ScreenFadeWrite(const ScreenFade &fade, CBaseEntity *pEntity) MESSAGE_END(); } -/* <1adc11> ../cstrike/dlls/util.cpp:889 */ void UTIL_ScreenFadeAll(const Vector &color, float fadeTime, float fadeHold, int alpha, int flags) { int i; @@ -716,7 +682,6 @@ void UTIL_ScreenFadeAll(const Vector &color, float fadeTime, float fadeHold, int } } -/* <1ade39> ../cstrike/dlls/util.cpp:906 */ void UTIL_ScreenFade(CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags) { ScreenFade fade; @@ -724,7 +689,6 @@ void UTIL_ScreenFade(CBaseEntity *pEntity, const Vector &color, float fadeTime, UTIL_ScreenFadeWrite(fade, pEntity); } -/* <1adfa3> ../cstrike/dlls/util.cpp:915 */ void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage) { if (!pEntity || !pEntity->IsNetClient()) @@ -768,7 +732,6 @@ void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, cons MESSAGE_END(); } -/* <1ae1bf> ../cstrike/dlls/util.cpp:963 */ void UTIL_HudMessageAll(const hudtextparms_t &textparms, const char *pMessage) { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -779,7 +742,6 @@ void UTIL_HudMessageAll(const hudtextparms_t &textparms, const char *pMessage) } } -/* <1ae2ce> ../cstrike/dlls/util.cpp:977 */ void UTIL_ClientPrintAll(int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4) { MESSAGE_BEGIN(MSG_ALL, gmsgTextMsg); @@ -796,7 +758,6 @@ void UTIL_ClientPrintAll(int msg_dest, const char *msg_name, const char *param1, MESSAGE_END(); } -/* <1ae370> ../cstrike/dlls/util.cpp:995 */ void ClientPrint(entvars_t *client, int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4) { MESSAGE_BEGIN(MSG_ONE, gmsgTextMsg, NULL, client); @@ -813,7 +774,6 @@ void ClientPrint(entvars_t *client, int msg_dest, const char *msg_name, const ch MESSAGE_END(); } -/* <1ae423> ../cstrike/dlls/util.cpp:1013 */ NOXREF void UTIL_SayText(const char *pText, CBaseEntity *pEntity) { if (pEntity->IsNetClient()) @@ -825,7 +785,6 @@ NOXREF void UTIL_SayText(const char *pText, CBaseEntity *pEntity) } } -/* <1ae4e4> ../cstrike/dlls/util.cpp:1024 */ void UTIL_SayTextAll(const char *pText, CBaseEntity *pEntity) { MESSAGE_BEGIN(MSG_ALL, gmsgSayText); @@ -834,7 +793,6 @@ void UTIL_SayTextAll(const char *pText, CBaseEntity *pEntity) MESSAGE_END(); } -/* <1ae592> ../cstrike/dlls/util.cpp:1033 */ char *UTIL_dtos1(int d) { static char buf[8]; @@ -842,7 +800,6 @@ char *UTIL_dtos1(int d) return buf; } -/* <1ae5df> ../cstrike/dlls/util.cpp:1040 */ char *UTIL_dtos2(int d) { static char buf[8]; @@ -850,7 +807,6 @@ char *UTIL_dtos2(int d) return buf; } -/* <1ae62c> ../cstrike/dlls/util.cpp:1047 */ NOXREF char *UTIL_dtos3(int d) { static char buf[8]; @@ -858,7 +814,6 @@ NOXREF char *UTIL_dtos3(int d) return buf; } -/* <1ae679> ../cstrike/dlls/util.cpp:1054 */ NOXREF char *UTIL_dtos4(int d) { static char buf[8]; @@ -866,7 +821,6 @@ NOXREF char *UTIL_dtos4(int d) return buf; } -/* <1ae6c6> ../cstrike/dlls/util.cpp:1061 */ void UTIL_ShowMessageArgs(const char *pString, CBaseEntity *pPlayer, CUtlVector *args, bool isHint) { if (pPlayer != NULL && pPlayer->IsNetClient()) @@ -890,7 +844,6 @@ void UTIL_ShowMessageArgs(const char *pString, CBaseEntity *pPlayer, CUtlVector< } } -/* <1abc11> ../cstrike/dlls/util.cpp:1083 */ void UTIL_ShowMessage(const char *pString, CBaseEntity *pEntity, bool isHint) { if (!pEntity || !pEntity->IsNetClient()) @@ -898,11 +851,10 @@ void UTIL_ShowMessage(const char *pString, CBaseEntity *pEntity, bool isHint) MESSAGE_BEGIN(MSG_ONE, gmsgHudText, NULL, pEntity->edict()); WRITE_STRING(pString); - WRITE_BYTE((int)isHint); + WRITE_BYTE(int(isHint)); MESSAGE_END(); } -/* <1ae8ac> ../cstrike/dlls/util.cpp:1095 */ void UTIL_ShowMessageAll(const char *pString, bool isHint) { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -913,7 +865,6 @@ void UTIL_ShowMessageAll(const char *pString, bool isHint) } } -/* <1abc44> ../cstrike/dlls/util.cpp:1116 */ void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr) { TRACE_LINE(vecStart, vecEnd, (igmon == ignore_monsters), pentIgnore, ptr); @@ -925,28 +876,25 @@ void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTER TRACE_LINE(vecStart, vecEnd, (igmon == ignore_monsters) | (ignoreGlass ? 0x100 : 0), pentIgnore, ptr); } -/* <1aeb0a> ../cstrike/dlls/util.cpp:1122 */ void UTIL_TraceHull(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr) { TRACE_HULL(vecStart, vecEnd, (igmon == ignore_monsters), hullNumber, pentIgnore, ptr); } -/* <1aeb8d> ../cstrike/dlls/util.cpp:1127 */ void UTIL_TraceModel(const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr) { TRACE_MODEL(vecStart, vecEnd, hullNumber, pentModel, ptr); } -/* <1aec01> ../cstrike/dlls/util.cpp:1132 */ NOXREF TraceResult UTIL_GetGlobalTrace() { TraceResult tr; tr.flFraction = gpGlobals->trace_fraction; - tr.fInWater = (int)gpGlobals->trace_inwater; - tr.fAllSolid = (int)gpGlobals->trace_allsolid; - tr.fStartSolid = (int)gpGlobals->trace_startsolid; - tr.fInOpen = (int)gpGlobals->trace_inopen; + tr.fInWater = int(gpGlobals->trace_inwater); + tr.fAllSolid = int(gpGlobals->trace_allsolid); + tr.fStartSolid = int(gpGlobals->trace_startsolid); + tr.fInOpen = int(gpGlobals->trace_inopen); tr.vecEndPos = gpGlobals->trace_endpos; tr.flPlaneDist = gpGlobals->trace_plane_dist; tr.vecPlaneNormal = gpGlobals->trace_plane_normal; @@ -956,19 +904,16 @@ NOXREF TraceResult UTIL_GetGlobalTrace() return tr; } -/* <1aec38> ../cstrike/dlls/util.cpp:1150 */ void UTIL_SetSize(entvars_t *pev, const Vector &vecMin, const Vector &vecMax) { SET_SIZE(ENT(pev), vecMin, vecMax); } -/* <1aec8e> ../cstrike/dlls/util.cpp:1156 */ float UTIL_VecToYaw(const Vector &vec) { return VEC_TO_YAW(vec); } -/* <1aecc4> ../cstrike/dlls/util.cpp:1162 */ void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin) { edict_t *ent = ENT(pev); @@ -977,13 +922,11 @@ void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin) SET_ORIGIN(ent, vecOrigin); } -/* <1aed1f> ../cstrike/dlls/util.cpp:1169 */ NOXREF void UTIL_ParticleEffect(const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount) { - PARTICLE_EFFECT(vecOrigin, vecDirection, (float)ulColor, (float)ulCount); + PARTICLE_EFFECT(vecOrigin, vecDirection, float(ulColor), float(ulCount)); } -/* <1aed84> ../cstrike/dlls/util.cpp:1175 */ float UTIL_Approach(float target, float value, float speed) { float delta = target - value; @@ -997,7 +940,6 @@ float UTIL_Approach(float target, float value, float speed) return value; } -/* <1aedeb> ../cstrike/dlls/util.cpp:1190 */ float_precision UTIL_ApproachAngle(float target, float value, float speed) { target = UTIL_AngleMod(target); @@ -1022,7 +964,6 @@ float_precision UTIL_ApproachAngle(float target, float value, float speed) return value; } -/* <1aeec5> ../cstrike/dlls/util.cpp:1217 */ float_precision UTIL_AngleDistance(float next, float cur) { float_precision delta; @@ -1038,14 +979,12 @@ float_precision UTIL_AngleDistance(float next, float cur) return delta; } -/* <1aef1c> ../cstrike/dlls/util.cpp:1230 */ float UTIL_SplineFraction(float value, float scale) { float valueSquared = value * scale; return 3.0f * (valueSquared * valueSquared) - (valueSquared * valueSquared * valueSquared + valueSquared * valueSquared * valueSquared); } -/* <1aef78> ../cstrike/dlls/util.cpp:1240 */ char *UTIL_VarArgs(char *format, ...) { va_list argptr; @@ -1058,7 +997,6 @@ char *UTIL_VarArgs(char *format, ...) return string; } -/* <1aefea> ../cstrike/dlls/util.cpp:1252 */ NOXREF Vector UTIL_GetAimVector(edict_t *pent, float flSpeed) { Vector tmp; @@ -1066,7 +1004,6 @@ NOXREF Vector UTIL_GetAimVector(edict_t *pent, float flSpeed) return tmp; } -/* <1af041> ../cstrike/dlls/util.cpp:1259 */ int UTIL_IsMasterTriggered(string_t sMaster, CBaseEntity *pActivator) { if (sMaster) @@ -1084,7 +1021,6 @@ int UTIL_IsMasterTriggered(string_t sMaster, CBaseEntity *pActivator) return 1; } -/* <1af149> ../cstrike/dlls/util.cpp:1279 */ BOOL UTIL_ShouldShowBlood(int color) { if (color != DONT_BLEED) @@ -1104,13 +1040,11 @@ BOOL UTIL_ShouldShowBlood(int color) return FALSE; } -/* <1abd3e> ../cstrike/dlls/util.cpp:1297 */ int UTIL_PointContents(const Vector &vec) { return POINT_CONTENTS(vec); } -/* <1af1a3> ../cstrike/dlls/util.cpp:1302 */ void UTIL_BloodStream(const Vector &origin, const Vector &direction, int color, int amount) { if (!UTIL_ShouldShowBlood(color)) @@ -1132,7 +1066,6 @@ void UTIL_BloodStream(const Vector &origin, const Vector &direction, int color, MESSAGE_END(); } -/* <1af25d> ../cstrike/dlls/util.cpp:1324 */ void UTIL_BloodDrips(const Vector &origin, const Vector &direction, int color, int amount) { if (!UTIL_ShouldShowBlood(color)) @@ -1162,7 +1095,6 @@ void UTIL_BloodDrips(const Vector &origin, const Vector &direction, int color, i MESSAGE_END(); } -/* <1af310> ../cstrike/dlls/util.cpp:1356 */ Vector UTIL_RandomBloodVector() { Vector direction; @@ -1172,7 +1104,6 @@ Vector UTIL_RandomBloodVector() return direction; } -/* <1af471> ../cstrike/dlls/util.cpp:1368 */ void UTIL_BloodDecalTrace(TraceResult *pTrace, int bloodColor) { if (UTIL_ShouldShowBlood(bloodColor)) @@ -1184,7 +1115,6 @@ void UTIL_BloodDecalTrace(TraceResult *pTrace, int bloodColor) } } -/* <1af349> ../cstrike/dlls/util.cpp:1380 */ void UTIL_DecalTrace(TraceResult *pTrace, int decalNumber) { short entityIndex; @@ -1239,7 +1169,6 @@ void UTIL_DecalTrace(TraceResult *pTrace, int decalNumber) MESSAGE_END(); } -/* <1af4c8> ../cstrike/dlls/util.cpp:1447 */ void UTIL_PlayerDecalTrace(TraceResult *pTrace, int playernum, int decalNumber, BOOL bIsCustom) { int index; @@ -1263,13 +1192,12 @@ void UTIL_PlayerDecalTrace(TraceResult *pTrace, int playernum, int decalNumber, WRITE_COORD(pTrace->vecEndPos.x); WRITE_COORD(pTrace->vecEndPos.y); WRITE_COORD(pTrace->vecEndPos.z); - WRITE_SHORT((int)ENTINDEX(pTrace->pHit)); + WRITE_SHORT(int(ENTINDEX(pTrace->pHit))); WRITE_BYTE(index); MESSAGE_END(); } } -/* <1af583> ../cstrike/dlls/util.cpp:1477 */ void UTIL_GunshotDecalTrace(TraceResult *pTrace, int decalNumber, bool ClientOnly, entvars_t *pShooter) { if (decalNumber < 0) @@ -1288,12 +1216,11 @@ void UTIL_GunshotDecalTrace(TraceResult *pTrace, int decalNumber, bool ClientOnl WRITE_COORD(pTrace->vecEndPos.x); WRITE_COORD(pTrace->vecEndPos.y); WRITE_COORD(pTrace->vecEndPos.z); - WRITE_SHORT((int)ENTINDEX(pTrace->pHit)); + WRITE_SHORT(int(ENTINDEX(pTrace->pHit))); WRITE_BYTE(index); MESSAGE_END(); } -/* <1af67d> ../cstrike/dlls/util.cpp:1515 */ void UTIL_Sparks(const Vector &position) { MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, position); @@ -1304,7 +1231,6 @@ void UTIL_Sparks(const Vector &position) MESSAGE_END(); } -/* <1af6dc> ../cstrike/dlls/util.cpp:1526 */ void UTIL_Ricochet(const Vector &position, float scale) { MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, position); @@ -1312,11 +1238,10 @@ void UTIL_Ricochet(const Vector &position, float scale) WRITE_COORD(position.x); WRITE_COORD(position.y); WRITE_COORD(position.z); - WRITE_BYTE((int)(scale * 10.0f)); + WRITE_BYTE(int(scale * 10.0f)); MESSAGE_END(); } -/* <1af74a> ../cstrike/dlls/util.cpp:1538 */ BOOL UTIL_TeamsMatch(const char *pTeamName1, const char *pTeamName2) { if (!g_pGameRules->IsTeamplay()) @@ -1331,7 +1256,6 @@ BOOL UTIL_TeamsMatch(const char *pTeamName1, const char *pTeamName2) return FALSE; } -/* <1af78a> ../cstrike/dlls/util.cpp:1555 */ void UTIL_StringToVector(float *pVector, const char *pString) { char *pstr; @@ -1362,7 +1286,6 @@ void UTIL_StringToVector(float *pVector, const char *pString) pVector[j] = 0; } -/* <1af85f> ../cstrike/dlls/util.cpp:1586 */ void UTIL_StringToIntArray(int *pVector, int count, const char *pString) { char *pstr; @@ -1393,7 +1316,6 @@ void UTIL_StringToIntArray(int *pVector, int count, const char *pString) pVector[j] = 0; } -/* <1af90d> ../cstrike/dlls/util.cpp:1612 */ Vector UTIL_ClampVectorToBox(const Vector &input, const Vector &clampSize) { Vector sourceVector = input; @@ -1418,7 +1340,6 @@ Vector UTIL_ClampVectorToBox(const Vector &input, const Vector &clampSize) return sourceVector.Normalize(); } -/* <1afa45> ../cstrike/dlls/util.cpp:1641 */ float UTIL_WaterLevel(const Vector &position, float minz, float maxz) { Vector midUp; @@ -1448,7 +1369,6 @@ float UTIL_WaterLevel(const Vector &position, float minz, float maxz) return midUp.z; } -/* <1afb44> ../cstrike/dlls/util.cpp:1674 */ void UTIL_Bubbles(Vector mins, Vector maxs, int count) { Vector mid = (mins + maxs) * 0.5f; @@ -1469,7 +1389,6 @@ void UTIL_Bubbles(Vector mins, Vector maxs, int count) MESSAGE_END(); } -/* <1afc62> ../cstrike/dlls/util.cpp:1696 */ void UTIL_BubbleTrail(Vector from, Vector to, int count) { float flHeight = UTIL_WaterLevel(from, from.z, from.z + 256.0f) - from.z; @@ -1501,7 +1420,6 @@ void UTIL_BubbleTrail(Vector from, Vector to, int count) MESSAGE_END(); } -/* <1afcfe> ../cstrike/dlls/util.cpp:1731 */ void UTIL_Remove(CBaseEntity *pEntity) { if (pEntity != NULL) @@ -1512,7 +1430,6 @@ void UTIL_Remove(CBaseEntity *pEntity) } } -/* <1afd2c> ../cstrike/dlls/util.cpp:1745 */ NOXREF BOOL UTIL_IsValidEntity(edict_t *pent) { if (!pent || pent->free || (pent->v.flags & FL_KILLME)) @@ -1521,7 +1438,6 @@ NOXREF BOOL UTIL_IsValidEntity(edict_t *pent) return TRUE; } -/* <1afd5c> ../cstrike/dlls/util.cpp:1753 */ void UTIL_PrecacheOther(const char *szClassname) { edict_t *pent = CREATE_NAMED_ENTITY(MAKE_STRING(szClassname)); @@ -1532,7 +1448,7 @@ void UTIL_PrecacheOther(const char *szClassname) } CBaseEntity *pEntity = CBaseEntity::Instance(VARS(pent)); - if (pEntity) + if (pEntity != NULL) { pEntity->Precache(); } @@ -1540,7 +1456,6 @@ void UTIL_PrecacheOther(const char *szClassname) REMOVE_ENTITY(pent); } -/* <1afe5f> ../cstrike/dlls/util.cpp:1774 */ void UTIL_LogPrintf(char *fmt, ...) { va_list argptr; @@ -1553,7 +1468,6 @@ void UTIL_LogPrintf(char *fmt, ...) ALERT(at_logged, "%s", string); } -/* <1afebd> ../cstrike/dlls/util.cpp:1791 */ NOXREF float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir) { Vector2D vec2LOS = (vecCheck - vecSrc).Make2D(); @@ -1561,7 +1475,6 @@ NOXREF float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const return DotProduct(vec2LOS, (vecDir.Make2D())); } -/* <1affcc> ../cstrike/dlls/util.cpp:1805 */ void UTIL_StripToken(const char *pKey, char *pDest) { int i = 0; @@ -1573,25 +1486,21 @@ void UTIL_StripToken(const char *pKey, char *pDest) pDest[i] = '\0'; } -/* <1b003a> ../cstrike/dlls/util.cpp:1847 */ CSaveRestoreBuffer::CSaveRestoreBuffer() { m_pdata = NULL; } -/* <1b0084> ../cstrike/dlls/util.cpp:1853 */ CSaveRestoreBuffer::CSaveRestoreBuffer(SAVERESTOREDATA *pdata) { m_pdata = pdata; } -/* <1b00d4> ../cstrike/dlls/util.cpp:1859 */ CSaveRestoreBuffer::~CSaveRestoreBuffer() { ; } -/* <1b0186> ../cstrike/dlls/util.cpp:1863 */ int CSaveRestoreBuffer::EntityIndex(CBaseEntity *pEntity) { if (!pEntity) @@ -1600,7 +1509,6 @@ int CSaveRestoreBuffer::EntityIndex(CBaseEntity *pEntity) return EntityIndex(pEntity->pev); } -/* <1b0214> ../cstrike/dlls/util.cpp:1871 */ int CSaveRestoreBuffer::EntityIndex(entvars_t *pevLookup) { if (!pevLookup) @@ -1609,13 +1517,11 @@ int CSaveRestoreBuffer::EntityIndex(entvars_t *pevLookup) return EntityIndex(ENT(pevLookup)); } -/* <1b02a7> ../cstrike/dlls/util.cpp:1878 */ int CSaveRestoreBuffer::EntityIndex(EOFFSET eoLookup) { return EntityIndex(ENT(eoLookup)); } -/* <1b032f> ../cstrike/dlls/util.cpp:1884 */ int CSaveRestoreBuffer::EntityIndex(edict_t *pentLookup) { if (!m_pdata || !pentLookup) @@ -1631,7 +1537,6 @@ int CSaveRestoreBuffer::EntityIndex(edict_t *pentLookup) return -1; } -/* <1b03b7> ../cstrike/dlls/util.cpp:1902 */ edict_t *CSaveRestoreBuffer::EntityFromIndex(int entityIndex) { if (!m_pdata || entityIndex < 0) @@ -1647,7 +1552,6 @@ edict_t *CSaveRestoreBuffer::EntityFromIndex(int entityIndex) return NULL; } -/* <1b03fb> ../cstrike/dlls/util.cpp:1920 */ int CSaveRestoreBuffer::EntityFlagsSet(int entityIndex, int flags) { if (!m_pdata || entityIndex < 0) @@ -1660,7 +1564,6 @@ int CSaveRestoreBuffer::EntityFlagsSet(int entityIndex, int flags) return m_pdata->pTable[ entityIndex ].flags; } -/* <1b0445> ../cstrike/dlls/util.cpp:1933 */ void CSaveRestoreBuffer::BufferRewind(int size) { if (!m_pdata) @@ -1674,7 +1577,6 @@ void CSaveRestoreBuffer::BufferRewind(int size) } #ifndef _WIN32 -/* <1abdfb> ../cstrike/dlls/util.cpp:1950 */ extern "C" { inline unsigned _rotr(unsigned val, int shift) @@ -1697,7 +1599,6 @@ extern "C" } #endif // _WIN32 -/* <1b04b5> ../cstrike/dlls/util.cpp:1971 */ unsigned int CSaveRestoreBuffer::HashString(const char *pszToken) { unsigned int hash = 0; @@ -1707,7 +1608,6 @@ unsigned int CSaveRestoreBuffer::HashString(const char *pszToken) return hash; } -/* <1b0531> ../cstrike/dlls/util.cpp:1981 */ unsigned short CSaveRestoreBuffer::TokenHash(const char *pszToken) { unsigned short hash = (unsigned short)(HashString(pszToken) % (unsigned)m_pdata->tokenCount); @@ -1728,31 +1628,26 @@ unsigned short CSaveRestoreBuffer::TokenHash(const char *pszToken) return 0; } -/* <1b06a5> ../cstrike/dlls/util.cpp:2020 */ void CSave::WriteData(const char *pname, int size, const char *pdata) { BufferField(pname, size, pdata); } -/* <1b0860> ../cstrike/dlls/util.cpp:2026 */ NOXREF void CSave::WriteShort(const char *pname, const short *data, int count) { BufferField(pname, sizeof(short) * count, (const char *)data); } -/* <1b0a7b> ../cstrike/dlls/util.cpp:2032 */ void CSave::WriteInt(const char *pname, const int *data, int count) { BufferField(pname, sizeof(int) * count, (const char *)data); } -/* <1b0c77> ../cstrike/dlls/util.cpp:2038 */ void CSave::WriteFloat(const char *pname, const float *data, int count) { BufferField(pname, sizeof(float) * count, (const char *)data); } -/* <1b0ea5> ../cstrike/dlls/util.cpp:2044 */ void CSave::WriteTime(const char *pname, const float *data, int count) { int i; @@ -1770,13 +1665,11 @@ void CSave::WriteTime(const char *pname, const float *data, int count) } } -/* <1b1053> ../cstrike/dlls/util.cpp:2065 */ NOXREF void CSave::WriteString(const char *pname, const char *pdata) { BufferField(pname, Q_strlen(pdata) + 1, pdata); } -/* <1b121f> ../cstrike/dlls/util.cpp:2076 */ void CSave::WriteString(const char *pname, const int *stringId, int count) { int i; @@ -1793,20 +1686,17 @@ void CSave::WriteString(const char *pname, const int *stringId, int count) } } -/* <1b1480> ../cstrike/dlls/util.cpp:2099 */ void CSave::WriteVector(const char *pname, const Vector &value) { WriteVector(pname, &value.x, 1); } -/* <1b1630> ../cstrike/dlls/util.cpp:2105 */ void CSave::WriteVector(const char *pname, const float *value, int count) { BufferHeader(pname, sizeof(float) * 3 * count); BufferData((const char *)value, sizeof(float) * 3 * count); } -/* <1b17b9> ../cstrike/dlls/util.cpp:2113 */ NOXREF void CSave::WritePositionVector(const char *pname, const Vector &value) { if (m_pdata && m_pdata->fUseLandmark) @@ -1817,7 +1707,6 @@ NOXREF void CSave::WritePositionVector(const char *pname, const Vector &value) WriteVector(pname, value); } -/* <1b1bde> ../cstrike/dlls/util.cpp:2126 */ void CSave::WritePositionVector(const char *pname, const float *value, int count) { BufferHeader(pname, sizeof(float) * 3 * count); @@ -1833,7 +1722,6 @@ void CSave::WritePositionVector(const char *pname, const float *value, int count } } -/* <1b2ca4> ../cstrike/dlls/util.cpp:2145 */ void CSave::WriteFunction(const char *pname, void **data, int count) { const char *functionName = NAME_FOR_FUNCTION((uint32)*data); @@ -1844,7 +1732,6 @@ void CSave::WriteFunction(const char *pname, void **data, int count) ALERT(at_error, "Invalid function pointer in entity!"); } -/* <1b2e7a> ../cstrike/dlls/util.cpp:2157 */ void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd) { for (int i = 0; i < ARRAYSIZE(gEntvarsDescription); ++i) @@ -1887,13 +1774,11 @@ void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd) } } -/* <1b2f7f> ../cstrike/dlls/util.cpp:2207 */ int CSave::WriteEntVars(const char *pname, entvars_t *pev) { return WriteFields(pname, pev, gEntvarsDescription, ARRAYSIZE(gEntvarsDescription)); } -/* <1b2fc9> ../cstrike/dlls/util.cpp:2214 */ int CSave::WriteFields(const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) { int i; @@ -1999,7 +1884,6 @@ int CSave::WriteFields(const char *pname, void *pBaseData, TYPEDESCRIPTION *pFie return 1; } -/* <1b3e49> ../cstrike/dlls/util.cpp:2324 */ NOXREF void CSave::BufferString(char *pdata, int len) { char c = 0; @@ -2007,7 +1891,6 @@ NOXREF void CSave::BufferString(char *pdata, int len) BufferData(&c, 1); } -/* <1b3f5d> ../cstrike/dlls/util.cpp:2333 */ int CSave::DataEmpty(const char *pdata, int size) { for (int i = 0; i < size; ++i) @@ -2019,14 +1902,12 @@ int CSave::DataEmpty(const char *pdata, int size) return 1; } -/* <1b3f9f> ../cstrike/dlls/util.cpp:2344 */ void CSave::BufferField(const char *pname, int size, const char *pdata) { BufferHeader(pname, size); BufferData(pdata, size); } -/* <1b4128> ../cstrike/dlls/util.cpp:2351 */ void CSave::BufferHeader(const char *pname, int size) { short hashvalue = TokenHash(pname); @@ -2037,7 +1918,6 @@ void CSave::BufferHeader(const char *pname, int size) BufferData((const char *)&hashvalue, sizeof(short)); } -/* <1b421f> ../cstrike/dlls/util.cpp:2361 */ void CSave::BufferData(const char *pdata, int size) { if (!m_pdata) @@ -2055,7 +1935,6 @@ void CSave::BufferData(const char *pdata, int size) m_pdata->size += size; } -/* <1b427f> ../cstrike/dlls/util.cpp:2386 */ int CRestore::ReadField(void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount, int startField, int size, char *pName, void *pData) { float time = 0.0f; @@ -2226,13 +2105,11 @@ int CRestore::ReadField(void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCoun return -1; } -/* <1b4a80> ../cstrike/dlls/util.cpp:2547 */ int CRestore::ReadEntVars(const char *pname, entvars_t *pev) { return ReadFields(pname, pev, gEntvarsDescription, ARRAYSIZE(gEntvarsDescription)); } -/* <1b4884> ../cstrike/dlls/util.cpp:2553 */ int CRestore::ReadFields(const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) { unsigned short i = ReadShort(); @@ -2263,7 +2140,6 @@ int CRestore::ReadFields(const char *pname, void *pBaseData, TYPEDESCRIPTION *pF return 1; } -/* <1b46b1> ../cstrike/dlls/util.cpp:2595 */ void CRestore::BufferReadHeader(HEADER *pheader) { pheader->size = ReadShort(); @@ -2273,7 +2149,6 @@ void CRestore::BufferReadHeader(HEADER *pheader) BufferSkipBytes(pheader->size); } -/* <1b4654> ../cstrike/dlls/util.cpp:2605 */ short CRestore::ReadShort() { short tmp = 0; @@ -2281,7 +2156,6 @@ short CRestore::ReadShort() return tmp; } -/* <1b45f5> ../cstrike/dlls/util.cpp:2614 */ int CRestore::ReadInt() { int tmp = 0; @@ -2289,7 +2163,6 @@ int CRestore::ReadInt() return tmp; } -/* <1b4f84> ../cstrike/dlls/util.cpp:2623 */ NOXREF int CRestore::ReadNamedInt(const char *pName) { HEADER header; @@ -2297,7 +2170,6 @@ NOXREF int CRestore::ReadNamedInt(const char *pName) return ((int *)header.pData)[0]; } -/* <1b4776> ../cstrike/dlls/util.cpp:2631 */ NOXREF char *CRestore::ReadNamedString(const char *pName) { HEADER header; @@ -2305,7 +2177,6 @@ NOXREF char *CRestore::ReadNamedString(const char *pName) return (char *)header.pData; } -/* <1b453a> ../cstrike/dlls/util.cpp:2644 */ char *CRestore::BufferPointer() { if (!m_pdata) @@ -2314,7 +2185,6 @@ char *CRestore::BufferPointer() return m_pdata->pCurrentData; } -/* <1b455c> ../cstrike/dlls/util.cpp:2652 */ void CRestore::BufferReadBytes(char *pOutput, int size) { if (!m_pdata || Empty()) @@ -2334,13 +2204,11 @@ void CRestore::BufferReadBytes(char *pOutput, int size) m_pdata->size += size; } -/* <1b5092> ../cstrike/dlls/util.cpp:2673 */ void CRestore::BufferSkipBytes(int bytes) { BufferReadBytes(NULL, bytes); } -/* <1b50bc> ../cstrike/dlls/util.cpp:2678 */ NOXREF int CRestore::BufferSkipZString() { if (!m_pdata) @@ -2358,7 +2226,6 @@ NOXREF int CRestore::BufferSkipZString() return len; } -/* <1b5144> ../cstrike/dlls/util.cpp:2700 */ NOXREF int CRestore::BufferCheckZString(const char *string) { if (!m_pdata) @@ -2369,14 +2236,13 @@ NOXREF int CRestore::BufferCheckZString(const char *string) if (len <= maxLen) { - if (!strncmp(string, m_pdata->pCurrentData, len)) + if (!Q_strncmp(string, m_pdata->pCurrentData, len)) return 1; } return 0; } -/* <1b51a7> ../cstrike/dlls/util.cpp:2715 */ char UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd) { char chTextureType; @@ -2415,7 +2281,6 @@ char UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd) return chTextureType; } -/* <1b5330> ../cstrike/dlls/util.cpp:2767 */ NOXREF int GetPlayerTeam(int index) { CBasePlayer *pPlayer = static_cast(UTIL_PlayerByIndex(index)); @@ -2427,7 +2292,6 @@ NOXREF int GetPlayerTeam(int index) return 0; } -/* <1b5412> ../cstrike/dlls/util.cpp:2775 */ bool UTIL_IsGame(const char *gameName) { #ifndef CSTRIKE @@ -2437,12 +2301,11 @@ bool UTIL_IsGame(const char *gameName) GET_GAME_DIR(gameDir); return (Q_stricmp(gameDir, gameName) == 0); } -#endif // CSTRIKE +#endif return false; } -/* <1b5470> ../cstrike/dlls/util.cpp:2802 */ float_precision UTIL_GetPlayerGaitYaw(int playerIndex) { CBasePlayer *pPlayer = static_cast(UTIL_PlayerByIndex(playerIndex)); @@ -2465,8 +2328,58 @@ int UTIL_ReadFlags(const char *c) flags |= (1 << (*c - 'a')); } - *c++; + c++; } return flags; } + +// Determine whether bots can be used or not +bool UTIL_AreBotsAllowed() +{ + if (g_bIsCzeroGame) + { + // If they pass in -nobots, don't allow bots. This is for people who host servers, to + // allow them to disallow bots to enforce CPU limits. + int nobots = ENG_CHECK_PARM("-nobots", NULL); + if (nobots) + { + return false; + } + + return true; + } + + // allow the using of bots for CS 1.6 + int bots = ENG_CHECK_PARM("-bots", NULL); + if (bots) + { + return true; + } + + return false; +} + +bool UTIL_AreHostagesImprov() +{ + if (g_bIsCzeroGame) + { + return true; + } + + // someday in CS 1.6 + // ... + + return false; +} + +void MAKE_STRING_CLASS(const char *str, entvars_t *pev) +{ + if (!FStringNull(pev->classname)) + { + RemoveEntityHashValue(pev, STRING(pev->classname), CLASSNAME); + } + + pev->classname = MAKE_STRING(str); + AddEntityHashValue(pev, STRING(pev->classname), CLASSNAME); +} diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index 71d6b468..d3a4c7c2 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -32,7 +32,10 @@ #pragma once #endif +#include "shake.h" #include "activity.h" +#include "enginecallback.h" +#include "utlvector.h" #define _LOG_TRACE\ static int iNumPassed = 0;\ @@ -60,7 +63,7 @@ #define FILE_GLOBAL #define DLL_GLOBAL -#endif // HOOK_GAMEDLL +#endif #define eoNullEntity 0 // Testing the three types of "entity" for nullity #define iStringNull 0 // Testing strings for nullity @@ -153,7 +156,7 @@ extern globalvars_t *gpGlobals; #define __MAKE_VHOOK(fname)\ fname -#endif // HOOK_GAMEDLL +#endif #define LINK_ENTITY_TO_CLASS(mapClassName, DLLClassName)\ C_DLLEXPORT void EXT_FUNC mapClassName(entvars_t *pev);\ @@ -234,49 +237,36 @@ private: int m_oldgroupop; }; -/* <5da42> ../cstrike/dlls/util.h:67 */ -inline void MAKE_STRING_CLASS(const char *str, entvars_t *pev) -{ - pev->classname = (string_t)MAKE_STRING(str); -} - -/* ../cstrike/dlls/util.h:80 */ inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "classname", pszName); } -/* <2468f> ../cstrike/dlls/util.h:85 */ inline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "targetname", pszName); } -/* <4299> ../cstrike/dlls/util.h:157 */ inline edict_t *ENT(const entvars_t *pev) { return pev->pContainingEntity; } -/* <431e6> ../cstrike/dlls/util.h:159 */ inline edict_t *ENT(EOFFSET eoffset) { return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset); } -/* <244a7> ../cstrike/dlls/util.h:162 */ inline EOFFSET OFFSET(const edict_t *pent) { return (*g_engfuncs.pfnEntOffsetOfPEntity)(pent); } -/* <543b7> ../cstrike/dlls/util.h:165 */ inline EOFFSET OFFSET(const entvars_t *pev) { return OFFSET(ENT(pev)); } -/* <4631> ../cstrike/dlls/util.h:180 */ inline entvars_t *VARS(edict_t *pent) { if (!pent) @@ -285,74 +275,62 @@ inline entvars_t *VARS(edict_t *pent) return &pent->v; } -/* <483c6> ../cstrike/dlls/util.h:184 */ inline entvars_t *VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); } -/* <2ee03> ../cstrike/dlls/util.h:189 */ inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); } -/* <14e46e> ../cstrike/dlls/util.h:190 */ inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); } -/* <15a45d> ../cstrike/dlls/util.h:193 */ inline void MESSAGE_BEGIN(int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent) { MESSAGE_BEGIN(msg_dest, msg_type, pOrigin, ENT(ent)); } -/* <244c4> ../cstrike/dlls/util.h:197 */ inline BOOL FNullEnt(EOFFSET eoffset) { return (eoffset == 0); } -/* <213e7> ../cstrike/dlls/util.h:198 */ inline BOOL FNullEnt(entvars_t *pev) { return (pev == NULL || FNullEnt(OFFSET(pev))); } -/* <432b5> ../cstrike/dlls/util.h:199 */ inline BOOL FNullEnt(const edict_t *pent) { return (pent == NULL || FNullEnt(OFFSET(pent))); } -/* <1c1cb> ../cstrike/dlls/util.h:203 */ inline BOOL FStringNull(int iString) { return (iString == iStringNull); } -/* <42e8> ../cstrike/dlls/util.h:246 */ inline BOOL FStrEq(const char *sz1, const char *sz2) { return (Q_strcmp(sz1, sz2) == 0); } -/* <245ce> ../cstrike/dlls/util.h:250 */ inline BOOL FClassnameIs(entvars_t *pev, const char *szClassname) { return FStrEq(STRING(pev->classname), szClassname); } -/* <249a6> ../cstrike/dlls/util.h:265 */ inline BOOL FClassnameIs(edict_t *pent, const char *szClassname) { - //TODO: check is null? + // TODO: check is null? return FStrEq(STRING(VARS(pent)->classname), szClassname); } -/* <8c49f> ../cstrike/dlls/util.h:282 */ inline void UTIL_MakeVectorsPrivate(Vector vecAngles, float *p_vForward, float *p_vRight, float *p_vUp) { g_engfuncs.pfnAngleVectors(vecAngles, p_vForward, p_vRight, p_vUp); @@ -360,39 +338,41 @@ inline void UTIL_MakeVectorsPrivate(Vector vecAngles, float *p_vForward, float * extern void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch); -/* <4310> ../cstrike/dlls/util.h:570 */ inline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation) { EMIT_SOUND_DYN(entity, channel, sample, volume, attenuation, 0, PITCH_NORM); } -/* <6862b> ../cstrike/dlls/util.h:575 */ inline void STOP_SOUND(edict_t *entity, int channel, const char *sample) { EMIT_SOUND_DYN(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM); } +class CBaseEntity; +class CBasePlayer; +class CBasePlayerItem; + float UTIL_WeaponTimeBase(); unsigned int U_Random(); void U_Srand(unsigned int seed); int UTIL_SharedRandomLong(unsigned int seed, int low, int high); float UTIL_SharedRandomFloat(unsigned int seed, float low, float high); -NOXREF void UTIL_ParametricRocket(entvars_t *pev, Vector vecOrigin, Vector vecAngles, edict_t *owner); +void UTIL_ParametricRocket(entvars_t *pev, Vector vecOrigin, Vector vecAngles, edict_t *owner); void UTIL_SetGroupTrace(int groupmask, int op); void UTIL_UnsetGroupTrace(); -NOXREF BOOL UTIL_GetNextBestWeapon(class CBasePlayer *pPlayer, class CBasePlayerItem *pCurrentWeapon); -NOXREF float UTIL_AngleMod(float a); -NOXREF float UTIL_AngleDiff(float destAngle, float srcAngle); +BOOL UTIL_GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon); +float UTIL_AngleMod(float a); +float UTIL_AngleDiff(float destAngle, float srcAngle); Vector UTIL_VecToAngles(const Vector &vec); -NOXREF void UTIL_MoveToOrigin(edict_t *pent, const Vector &vecGoal, float flDist, int iMoveType); +void UTIL_MoveToOrigin(edict_t *pent, const Vector &vecGoal, float flDist, int iMoveType); int UTIL_EntitiesInBox(CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask); -NOXREF int UTIL_MonstersInSphere(CBaseEntity **pList, int listMax, const Vector ¢er, float radius); +int UTIL_MonstersInSphere(CBaseEntity **pList, int listMax, const Vector ¢er, float radius); CBaseEntity *UTIL_FindEntityInSphere(CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius); CBaseEntity *UTIL_FindEntityByString_Old(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue); CBaseEntity *UTIL_FindEntityByString(CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue); CBaseEntity *UTIL_FindEntityByClassname(CBaseEntity *pStartEntity, const char *szName); CBaseEntity *UTIL_FindEntityByTargetname(CBaseEntity *pStartEntity, const char *szName); -NOXREF CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc, float flRadius); +CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc, float flRadius); CBaseEntity *UTIL_PlayerByIndex(int playerIndex); void UTIL_MakeVectors(const Vector &vecAngles); void UTIL_MakeAimVectors(const Vector &vecAngles); @@ -401,7 +381,7 @@ void UTIL_EmitAmbientSound(edict_t *entity, const Vector &vecOrigin, const char unsigned short FixedUnsigned16(float value, float scale); short FixedSigned16(float value, float scale); void UTIL_ScreenShake(const Vector ¢er, float amplitude, float frequency, float duration, float radius); -NOXREF void UTIL_ScreenShakeAll(const Vector ¢er, float amplitude, float frequency, float duration); +void UTIL_ScreenShakeAll(const Vector ¢er, float amplitude, float frequency, float duration); void UTIL_ScreenFadeBuild(ScreenFade &fade, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags); void UTIL_ScreenFadeWrite(const ScreenFade &fade, CBaseEntity *pEntity); void UTIL_ScreenFadeAll(const Vector &color, float fadeTime, float fadeHold, int alpha, int flags); @@ -410,12 +390,12 @@ void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, cons void UTIL_HudMessageAll(const hudtextparms_t &textparms, const char *pMessage); void UTIL_ClientPrintAll(int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL); void ClientPrint(entvars_t *client, int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL); -NOXREF void UTIL_SayText(const char *pText, CBaseEntity *pEntity); +void UTIL_SayText(const char *pText, CBaseEntity *pEntity); void UTIL_SayTextAll(const char *pText, CBaseEntity *pEntity); char *UTIL_dtos1(int d); char *UTIL_dtos2(int d); -NOXREF char *UTIL_dtos3(int d); -NOXREF char *UTIL_dtos4(int d); +char *UTIL_dtos3(int d); +char *UTIL_dtos4(int d); void UTIL_ShowMessageArgs(const char *pString, CBaseEntity *pPlayer, CUtlVector *args, bool isHint = false); void UTIL_ShowMessage(const char *pString, CBaseEntity *pEntity, bool isHint = false); void UTIL_ShowMessageAll(const char *pString, bool isHint = false); @@ -423,17 +403,17 @@ void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTER void UTIL_TraceLine(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr); void UTIL_TraceHull(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr); void UTIL_TraceModel(const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr); -NOXREF TraceResult UTIL_GetGlobalTrace(); +TraceResult UTIL_GetGlobalTrace(); void UTIL_SetSize(entvars_t *pev, const Vector &vecMin, const Vector &vecMax); float UTIL_VecToYaw(const Vector &vec); void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin); -NOXREF void UTIL_ParticleEffect(const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount); +void UTIL_ParticleEffect(const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount); float UTIL_Approach(float target, float value, float speed); float_precision UTIL_ApproachAngle(float target, float value, float speed); float_precision UTIL_AngleDistance(float next, float cur); float UTIL_SplineFraction(float value, float scale); char *UTIL_VarArgs(char *format, ...); -NOXREF Vector UTIL_GetAimVector(edict_t *pent, float flSpeed); +Vector UTIL_GetAimVector(edict_t *pent, float flSpeed); int UTIL_IsMasterTriggered(string_t sMaster, CBaseEntity *pActivator); BOOL UTIL_ShouldShowBlood(int color); int UTIL_PointContents(const Vector &vec); @@ -454,17 +434,20 @@ float UTIL_WaterLevel(const Vector &position, float minz, float maxz); void UTIL_Bubbles(Vector mins, Vector maxs, int count); void UTIL_BubbleTrail(Vector from, Vector to, int count); void UTIL_Remove(CBaseEntity *pEntity); -NOXREF BOOL UTIL_IsValidEntity(edict_t *pent); +BOOL UTIL_IsValidEntity(edict_t *pent); void UTIL_PrecacheOther(const char *szClassname); void UTIL_LogPrintf(char *fmt, ...); -NOXREF float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir); +float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir); void UTIL_StripToken(const char *pKey, char *pDest); void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd); char UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd); -NOXREF int GetPlayerTeam(int index); +int GetPlayerTeam(int index); bool UTIL_IsGame(const char *gameName); float_precision UTIL_GetPlayerGaitYaw(int playerIndex); int UTIL_ReadFlags(const char *c); +bool UTIL_AreBotsAllowed(); +bool UTIL_AreHostagesImprov(); +void MAKE_STRING_CLASS(const char *str, entvars_t *pev); extern int g_groupmask; extern int g_groupop; diff --git a/regamedll/dlls/vector.h b/regamedll/dlls/vector.h index 65921659..3b24df99 100644 --- a/regamedll/dlls/vector.h +++ b/regamedll/dlls/vector.h @@ -32,7 +32,6 @@ #pragma once #endif -/* <5d3ffa> ../cstrike/dlls/vector.h:26 */ class Vector2D { public: @@ -54,15 +53,15 @@ public: #ifdef PLAY_GAMEDLL Vector2D operator*(float_precision fl) const { - return Vector2D((vec_t)(x * fl), (vec_t)(y * fl)); + return Vector2D(vec_t(x * fl), vec_t(y * fl)); } Vector2D operator/(float_precision fl) const { - return Vector2D((vec_t)(x / fl), (vec_t)(y / fl)); + return Vector2D(vec_t(x / fl), vec_t(y / fl)); } Vector2D operator/=(float_precision fl) const { - return Vector2D((vec_t)(x / fl), (vec_t)(y / fl)); + return Vector2D(vec_t(x / fl), vec_t(y / fl)); } #else Vector2D operator*(float fl) const @@ -80,7 +79,7 @@ public: #endif // PLAY_GAMEDLL float_precision Length() const { - return sqrt((float_precision)(x * x + y * y)); + return Q_sqrt(float_precision(x * x + y * y)); } float LengthSquared() const { @@ -103,7 +102,7 @@ public: flLen = 1 / flLen; #ifdef PLAY_GAMEDLL - return Vector2D((vec_t)(x * flLen), (vec_t)(y * flLen)); + return Vector2D(vec_t(x * flLen), vec_t(y * flLen)); #else return Vector2D(x * flLen, y * flLen); #endif // PLAY_GAMEDLL @@ -121,8 +120,8 @@ public: float_precision flLen = Length(); if (flLen > 0.0) { - x = (vec_t)(1 / flLen * x); - y = (vec_t)(1 / flLen * y); + x = vec_t(1 / flLen * x); + y = vec_t(1 / flLen * y); } else { @@ -148,7 +147,6 @@ inline Vector2D operator*(float fl, const Vector2D &v) return v * fl; } -/* <5e2e91> ../cstrike/dlls/vector.h:104 */ class Vector { public: @@ -195,15 +193,15 @@ public: #ifdef PLAY_GAMEDLL Vector operator*(float_precision fl) const { - return Vector((vec_t)(x * fl), (vec_t)(y * fl), (vec_t)(z * fl)); + return Vector(vec_t(x * fl), vec_t(y * fl), vec_t(z * fl)); } Vector operator/(float_precision fl) const { - return Vector((vec_t)(x / fl), (vec_t)(y / fl), (vec_t)(z / fl)); + return Vector(vec_t(x / fl), vec_t(y / fl), vec_t(z / fl)); } Vector operator/=(float_precision fl) const { - return Vector((vec_t)(x / fl), (vec_t)(y / fl), (vec_t)(z / fl)); + return Vector(vec_t(x / fl), vec_t(y / fl), vec_t(z / fl)); } #else Vector operator*(float fl) const @@ -227,13 +225,11 @@ public: } float_precision Length() const { - float_precision x1 = (float_precision)x; - float_precision y1 = (float_precision)y; - float_precision z1 = (float_precision)z; + float_precision x1 = float_precision(x); + float_precision y1 = float_precision(y); + float_precision z1 = float_precision(z); - return sqrt(x1 * x1 + y1 * y1 + z1 * z1); - - //return sqrt((float_precision)(x * x + y * y + z * z)); + return Q_sqrt(x1 * x1 + y1 * y1 + z1 * z1); } float_precision LengthSquared() const { @@ -264,7 +260,7 @@ public: if (flLen == 0) return Vector(0, 0, 1); - vec_t fTemp = (vec_t)(1 / flLen); + vec_t fTemp = vec_t(1 / flLen); return Vector(x * fTemp, y * fTemp, z * fTemp); } #endif // PLAY_GAMEDLL @@ -279,7 +275,7 @@ public: return Vector(0, 0, 1); flLen = 1 / flLen; - return Vector((vec_t)(x * flLen), (vec_t)(y * flLen), (vec_t)(z * flLen)); + return Vector(vec_t(x * flLen), vec_t(y * flLen), vec_t(z * flLen)); #endif // PLAY_GAMEDLL } Vector2D Make2D() const @@ -291,7 +287,7 @@ public: } float_precision Length2D() const { - return sqrt((float_precision)(x * x + y * y)); + return Q_sqrt(float_precision(x * x + y * y)); } bool IsLengthLessThan(float length) const { @@ -308,9 +304,9 @@ public: if (flLen > 0) { - x = (vec_t)(1 / flLen * x); - y = (vec_t)(1 / flLen * y); - z = (vec_t)(1 / flLen * z); + x = vec_t(1 / flLen * x); + y = vec_t(1 / flLen * y); + z = vec_t(1 / flLen * z); } else { @@ -328,9 +324,9 @@ public: if (flLen > 0) { - x = (vec_t)(1 / flLen * x); - y = (vec_t)(1 / flLen * y); - z = (vec_t)(1 / flLen * z); + x = vec_t(1 / flLen * x); + y = vec_t(1 / flLen * y); + z = vec_t(1 / flLen * z); } else { @@ -368,13 +364,11 @@ public: } }; -/* <1c0d1> ../cstrike/dlls/vector.h:184 */ inline Vector operator*(float fl, const Vector &v) { return v * fl; } -/* <5d9a4> ../cstrike/dlls/vector.h:185 */ inline float_precision DotProduct(const Vector &a, const Vector &b) { return (a.x * b.x + a.y * b.y + a.z * b.z); @@ -385,7 +379,6 @@ inline float_precision DotProduct2D(const Vector &a, const Vector &b) return (a.x * b.x + a.y * b.y); } -/* <1ba548> ../cstrike/dlls/vector.h:186 */ inline Vector CrossProduct(const Vector &a, const Vector &b) { return Vector(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); @@ -411,7 +404,7 @@ inline LenType LengthSubtract(Vector vecStart, Vector vecDest) Y floatY = (vecDest.y - vecStart.y); Z floatZ = (vecDest.z - vecStart.z); - return sqrt((float_precision)(floatX * floatX + floatY * floatY + floatZ * floatZ)); + return Q_sqrt(float_precision(floatX * floatX + floatY * floatY + floatZ * floatZ)); } template< @@ -430,7 +423,7 @@ inline Vector NormalizeSubtract(Vector vecStart, Vector vecDest) Y floatY = (vecDest.y - vecStart.y); Z floatZ = (vecDest.z - vecStart.z); - LenType flLen = sqrt((float_precision)(floatX * floatX + floatY * floatY + floatZ * floatZ)); + LenType flLen = Q_sqrt(float_precision(floatX * floatX + floatY * floatY + floatZ * floatZ)); if (flLen == 0.0) { @@ -440,9 +433,9 @@ inline Vector NormalizeSubtract(Vector vecStart, Vector vecDest) { flLen = 1.0 / flLen; - dir.x = (vec_t)(floatX * flLen); - dir.y = (vec_t)(floatY * flLen); - dir.z = (vec_t)(floatZ * flLen); + dir.x = vec_t(floatX * flLen); + dir.y = vec_t(floatY * flLen); + dir.z = vec_t(floatZ * flLen); } #else dir = (vecDest - vecStart).Normalize(); @@ -474,7 +467,29 @@ inline Vector NormalizeMulScalar(Vector2D vec, float scalar) floatY = vec.y * flLen; } - return Vector((vec_t)(floatX * scalar), (vec_t)(floatY * scalar), 0); + return Vector(vec_t(floatX * scalar), vec_t(floatY * scalar), 0); +} +template +inline Vector NormalizeMulScalar(Vector vec, float scalar) +{ + LenType flLen; + X floatX = vec.x; + Y floatY = vec.y; + + flLen = (LenType)vec.Length(); + + if (flLen <= 0.0) + { + floatX = 1; + floatY = 0; + } + else + { + floatX = floatX * LenCast(1 / flLen); + floatY = floatY * LenCast(1 / flLen); + } + + return Vector(vec_t(floatX * scalar), vec_t(floatY * scalar), 0); } #endif // PLAY_GAMEDLL diff --git a/regamedll/dlls/vehicle.cpp b/regamedll/dlls/vehicle.cpp index 9fa7491c..680c14a5 100644 --- a/regamedll/dlls/vehicle.cpp +++ b/regamedll/dlls/vehicle.cpp @@ -21,9 +21,8 @@ TYPEDESCRIPTION CFuncVehicle::m_SaveData[] = DEFINE_FIELD(CFuncVehicle, m_oldSpeed, FIELD_FLOAT), }; -#endif // HOOK_GAMEDLL +#endif -/* <1ba031> ../cstrike/dlls/vehicle.cpp:9 */ float_precision Fix2(float angle) { while (angle < 0) @@ -35,7 +34,6 @@ float_precision Fix2(float angle) return angle; } -/* <1bc835> ../cstrike/dlls/vehicle.cpp:20 */ void FixupAngles2(Vector &v) { v.x = Fix2(v.x); @@ -43,13 +41,9 @@ void FixupAngles2(Vector &v) v.z = Fix2(v.z); } -/* <1bb2f1> ../cstrike/dlls/vehicle.cpp:54 */ IMPLEMENT_SAVERESTORE(CFuncVehicle, CBaseEntity); - -/* <1bbf8f> ../cstrike/dlls/vehicle.cpp:55 */ LINK_ENTITY_TO_CLASS(func_vehicle, CFuncVehicle); -/* <1bb408> ../cstrike/dlls/vehicle.cpp:57 */ void CFuncVehicle::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "length")) @@ -79,8 +73,9 @@ void CFuncVehicle::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } else if (FStrEq(pkvd->szKeyName, "volume")) { - m_flVolume = (float)Q_atoi(pkvd->szValue); - m_flVolume *= 0.1; + // rounding values to integer + m_flVolume = Q_atoi(pkvd->szValue); + m_flVolume *= 0.1f; pkvd->fHandled = TRUE; } @@ -105,7 +100,6 @@ void CFuncVehicle::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <1bc059> ../cstrike/dlls/vehicle.cpp:109 */ void CFuncVehicle::NextThink(float thinkTime, BOOL alwaysThink) { if (alwaysThink) @@ -116,7 +110,6 @@ void CFuncVehicle::NextThink(float thinkTime, BOOL alwaysThink) pev->nextthink = thinkTime; } -/* <1bb9d0> ../cstrike/dlls/vehicle.cpp:120 */ void CFuncVehicle::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { entvars_t *pevOther = pOther->pev; @@ -127,8 +120,6 @@ void CFuncVehicle::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) return; } - std::vector da; - pevOther->velocity = (pevOther->origin - pev->origin).Normalize() * pev->dmg; pevOther->velocity.z += 300; pev->velocity = pev->velocity * 0.85; @@ -149,7 +140,7 @@ void CFuncVehicle::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) float maxy = Q_max(vBackLeft.y, vBackRight.y); float minz = pev->origin.z; - float maxz = pev->origin.z + (2 * abs((int)(pev->mins.z - pev->maxs.z))); + float maxz = pev->origin.z + (2 * Q_abs(int(pev->mins.z - pev->maxs.z))); if (pOther->pev->origin.x < minx || pOther->pev->origin.x > maxx @@ -162,7 +153,6 @@ void CFuncVehicle::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) } } -/* <1bcf96> ../cstrike/dlls/vehicle.cpp:179 */ void CFuncVehicle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { float delta = value; @@ -204,7 +194,7 @@ void CFuncVehicle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall if (delta > 0) { - flSpeedRatio = (float)(pev->speed / m_speed); + flSpeedRatio = float(pev->speed / m_speed); if (pev->speed < 0) flSpeedRatio = m_acceleration * 0.0005 + flSpeedRatio + VEHICLE_SPEED0_ACCELERATION; else if (pev->speed < 10) flSpeedRatio = m_acceleration * 0.0006 + flSpeedRatio + VEHICLE_SPEED1_ACCELERATION; @@ -225,14 +215,14 @@ void CFuncVehicle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall { flSpeedRatio = pev->speed / m_speed; - // TODO: fix float for test demo - if (flSpeedRatio > 0) flSpeedRatio = (float)flSpeedRatio - 0.0125; - else if (flSpeedRatio <= 0 && flSpeedRatio > -0.05) flSpeedRatio = (float)flSpeedRatio - 0.0075; - else if (flSpeedRatio <= 0.05 && flSpeedRatio > -0.1) flSpeedRatio = (float)flSpeedRatio - 0.01; - else if (flSpeedRatio <= 0.15 && flSpeedRatio > -0.15) flSpeedRatio = (float)flSpeedRatio - 0.0125; - else if (flSpeedRatio <= 0.15 && flSpeedRatio > -0.22) flSpeedRatio = (float)flSpeedRatio - 0.01375; - else if (flSpeedRatio <= 0.22 && flSpeedRatio > -0.3) flSpeedRatio = (float)flSpeedRatio - 0.0175; - else if (flSpeedRatio <= 0.3) flSpeedRatio = (float)flSpeedRatio - 0.0125; + // TODO: fix test demo + if (flSpeedRatio > 0) flSpeedRatio = float(flSpeedRatio) - 0.0125; + else if (flSpeedRatio <= 0 && flSpeedRatio > -0.05) flSpeedRatio = float(flSpeedRatio) - 0.0075; + else if (flSpeedRatio <= 0.05 && flSpeedRatio > -0.1) flSpeedRatio = float(flSpeedRatio) - 0.01; + else if (flSpeedRatio <= 0.15 && flSpeedRatio > -0.15) flSpeedRatio = float(flSpeedRatio) - 0.0125; + else if (flSpeedRatio <= 0.15 && flSpeedRatio > -0.22) flSpeedRatio = float(flSpeedRatio) - 0.01375; + else if (flSpeedRatio <= 0.22 && flSpeedRatio > -0.3) flSpeedRatio = float(flSpeedRatio) - 0.0175; + else if (flSpeedRatio <= 0.3) flSpeedRatio = float(flSpeedRatio) - 0.0125; } if (flSpeedRatio > 1) @@ -246,7 +236,7 @@ void CFuncVehicle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall pev->speed = flSpeedRatio * m_speed; Next(); - m_flAcceleratorDecay = gpGlobals->time + 0.25; + m_flAcceleratorDecay = gpGlobals->time + 0.25f; } else if (m_flCanTurnNow < gpGlobals->time) @@ -254,7 +244,7 @@ void CFuncVehicle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall if (delta == 20) { m_iTurnAngle++; - m_flSteeringWheelDecay = gpGlobals->time + 0.075; + m_flSteeringWheelDecay = gpGlobals->time + 0.075f; if (m_iTurnAngle > 8) { @@ -264,7 +254,7 @@ void CFuncVehicle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall else if (delta == 30) { m_iTurnAngle--; - m_flSteeringWheelDecay = gpGlobals->time + 0.075; + m_flSteeringWheelDecay = gpGlobals->time + 0.075f; if (m_iTurnAngle < -8) { @@ -272,11 +262,10 @@ void CFuncVehicle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCall } } - m_flCanTurnNow = gpGlobals->time + 0.05; + m_flCanTurnNow = gpGlobals->time + 0.05f; } } -/* <1bc0bd> ../cstrike/dlls/vehicle.cpp:303 */ void CFuncVehicle::StopSound() { if (m_soundPlaying && pev->noise) @@ -290,13 +279,12 @@ void CFuncVehicle::StopSound() m_soundPlaying = 0; } -/* <1bb33d> ../cstrike/dlls/vehicle.cpp:324 */ void CFuncVehicle::UpdateSound() { if (!pev->noise) return; - float flpitch = VEHICLE_STARTPITCH + (abs((int)pev->speed) * (VEHICLE_MAXPITCH - VEHICLE_STARTPITCH) / VEHICLE_MAXSPEED); + float flpitch = VEHICLE_STARTPITCH + (Q_abs(int(pev->speed)) * (VEHICLE_MAXPITCH - VEHICLE_STARTPITCH) / VEHICLE_MAXSPEED); if (flpitch > 200) flpitch = 200; @@ -308,7 +296,7 @@ void CFuncVehicle::UpdateSound() EMIT_SOUND_DYN(ENT(pev), CHAN_ITEM, "plats/vehicle_brake1.wav", m_flVolume, ATTN_NORM, 0, 100); } - EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noise), m_flVolume, ATTN_NORM, 0, (int)flpitch); + EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noise), m_flVolume, ATTN_NORM, 0, int(flpitch)); m_soundPlaying = 1; } else @@ -322,7 +310,6 @@ void CFuncVehicle::UpdateSound() } } -/* <1bc12b> ../cstrike/dlls/vehicle.cpp:368 */ void CFuncVehicle::CheckTurning() { float_precision maxspeed; @@ -364,7 +351,7 @@ void CFuncVehicle::CheckTurning() if (pev->speed > 0) { - int iCountTurn = abs(m_iTurnAngle); + int iCountTurn = Q_abs(m_iTurnAngle); if (iCountTurn > 4) { @@ -403,7 +390,6 @@ void CFuncVehicle::CheckTurning() } } -/* <1bc358> ../cstrike/dlls/vehicle.cpp:466 */ void CFuncVehicle::CollisionDetection() { TraceResult tr; @@ -427,7 +413,7 @@ void CFuncVehicle::CollisionDetection() } } - if (DotProduct(gpGlobals->v_forward, tr.vecPlaneNormal * -1.0) < 0.7 && tr.vecPlaneNormal.z < 0.1) + if (DotProduct(gpGlobals->v_forward, tr.vecPlaneNormal * -1.0f) < 0.7f && tr.vecPlaneNormal.z < 0.1f) { m_vSurfaceNormal = tr.vecPlaneNormal; m_vSurfaceNormal.z = 0; @@ -445,14 +431,14 @@ void CFuncVehicle::CollisionDetection() } else { - if (DotProduct(gpGlobals->v_forward, tr.vecPlaneNormal * -1.0) < 0.7 && tr.vecPlaneNormal.z < 0.1) + if (DotProduct(gpGlobals->v_forward, tr.vecPlaneNormal * -1.0f) < 0.7f && tr.vecPlaneNormal.z < 0.1f) { m_vSurfaceNormal = tr.vecPlaneNormal; m_vSurfaceNormal.z = 0; pev->speed *= 0.99; } - else if (tr.vecPlaneNormal[2] < 0.65 || tr.fStartSolid) + else if (tr.vecPlaneNormal[2] < 0.65f || tr.fStartSolid) { pev->speed *= -1.0; } @@ -489,7 +475,7 @@ void CFuncVehicle::CollisionDetection() } } - if (DotProduct(gpGlobals->v_forward, tr.vecPlaneNormal * -1.0) > -0.7 && tr.vecPlaneNormal.z < 0.1) + if (DotProduct(gpGlobals->v_forward, tr.vecPlaneNormal * -1.0f) > -0.7f && tr.vecPlaneNormal.z < 0.1f) { m_vSurfaceNormal = tr.vecPlaneNormal; m_vSurfaceNormal.z = 0; @@ -507,7 +493,6 @@ void CFuncVehicle::CollisionDetection() } } -/* <1bc7aa> ../cstrike/dlls/vehicle.cpp:588 */ void CFuncVehicle::TerrainFollowing() { TraceResult tr; @@ -523,11 +508,10 @@ void CFuncVehicle::TerrainFollowing() } } -/* <1bc856> ../cstrike/dlls/vehicle.cpp:609 */ void CFuncVehicle::Next() { Vector vGravityVector, forward, right, up; - float time = 0.1; + float time = 0.1f; vGravityVector = g_vecZero; UTIL_MakeVectors(pev->angles); @@ -548,7 +532,7 @@ void CFuncVehicle::Next() if (m_flSteeringWheelDecay < gpGlobals->time) { - m_flSteeringWheelDecay = gpGlobals->time + 0.1; + m_flSteeringWheelDecay = gpGlobals->time + 0.1f; if (m_iTurnAngle < 0) m_iTurnAngle++; @@ -559,7 +543,7 @@ void CFuncVehicle::Next() if (m_flAcceleratorDecay < gpGlobals->time) { - m_flAcceleratorDecay = gpGlobals->time + 0.1; + m_flAcceleratorDecay = gpGlobals->time + 0.1f; if (pev->speed < 0) { @@ -628,8 +612,8 @@ void CFuncVehicle::Next() else if (vy < -10) vy = -10; - pev->avelocity.y = (int)(vy * 10); - pev->avelocity.x = (int)(vx * 10); + pev->avelocity.y = int(vy * 10); + pev->avelocity.x = int(vx * 10); m_flLaunchTime = -1; m_flLastNormalZ = m_vSurfaceNormal.z; @@ -662,7 +646,7 @@ void CFuncVehicle::Next() if (m_flUpdateSound < gpGlobals->time) { UpdateSound(); - m_flUpdateSound = gpGlobals->time + 1.0; + m_flUpdateSound = gpGlobals->time + 1.0f; } if (m_vSurfaceNormal != g_vecZero) @@ -678,7 +662,6 @@ void CFuncVehicle::Next() NextThink(pev->ltime + time, TRUE); } -/* <1bd087> ../cstrike/dlls/vehicle.cpp:764 */ void CFuncVehicle::DeadEnd() { CPathTrack *pTrack = m_ppath; @@ -732,7 +715,6 @@ void CFuncVehicle::DeadEnd() ALERT(at_aiconsole, "\n"); } -/* <1bd0d4> ../cstrike/dlls/vehicle.cpp:810 */ void CFuncVehicle::SetControls(entvars_t *pevControls) { Vector offset = pevControls->origin - pev->oldorigin; @@ -740,7 +722,6 @@ void CFuncVehicle::SetControls(entvars_t *pevControls) m_controlMaxs = pevControls->maxs + offset; } -/* <1bb1b2> ../cstrike/dlls/vehicle.cpp:819 */ BOOL CFuncVehicle::__MAKE_VHOOK(OnControls)(entvars_t *pevTest) { Vector offset = pevTest->origin - pev->origin; @@ -759,7 +740,6 @@ BOOL CFuncVehicle::__MAKE_VHOOK(OnControls)(entvars_t *pevTest) && local.x <= m_controlMaxs.x && local.y <= m_controlMaxs.y && local.z <= m_controlMaxs.z); } -/* <1bb676> ../cstrike/dlls/vehicle.cpp:841 */ void CFuncVehicle::Find() { m_ppath = CPathTrack::Instance(FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->target))); @@ -799,7 +779,6 @@ void CFuncVehicle::Find() UpdateSound(); } -/* <1bb840> ../cstrike/dlls/vehicle.cpp:878 */ void CFuncVehicle::NearestPath() { CBaseEntity *pTrack = NULL; @@ -847,14 +826,12 @@ void CFuncVehicle::NearestPath() } } -/* <1bb00a> ../cstrike/dlls/vehicle.cpp:926 */ void CFuncVehicle::__MAKE_VHOOK(OverrideReset)() { NextThink(pev->ltime + 0.1, FALSE); SetThink(&CFuncVehicle::NearestPath); } -/* <1bd198> ../cstrike/dlls/vehicle.cpp:933 */ CFuncVehicle *CFuncVehicle::Instance(edict_t *pent) { if (FClassnameIs(pent, "func_vehicle")) @@ -865,13 +842,11 @@ CFuncVehicle *CFuncVehicle::Instance(edict_t *pent) return NULL; } -/* <1bb055> ../cstrike/dlls/vehicle.cpp:951 */ int CFuncVehicle::__MAKE_VHOOK(Classify)() { return CLASS_VEHICLE; } -/* <1bb0ef> ../cstrike/dlls/vehicle.cpp:956 */ void CFuncVehicle::__MAKE_VHOOK(Spawn)() { if (pev->speed == 0) @@ -888,7 +863,7 @@ void CFuncVehicle::__MAKE_VHOOK(Spawn)() pev->velocity = g_vecZero; pev->avelocity = g_vecZero; - pev->impulse = (int)m_speed; + pev->impulse = int(m_speed); m_acceleration = 5; m_dir = 1; @@ -921,7 +896,6 @@ void CFuncVehicle::__MAKE_VHOOK(Spawn)() Precache(); } -/* <1bb13e> ../cstrike/dlls/vehicle.cpp:1005 */ void CFuncVehicle::__MAKE_VHOOK(Restart)() { ALERT(at_console, "M_speed = %f\n", m_speed); @@ -930,7 +904,7 @@ void CFuncVehicle::__MAKE_VHOOK(Restart)() pev->velocity = g_vecZero; pev->avelocity = g_vecZero; - pev->impulse = (int)m_speed; + pev->impulse = int(m_speed); m_flTurnStartTime = -1; m_flUpdateSound = -1; m_dir = 1; @@ -948,7 +922,6 @@ void CFuncVehicle::__MAKE_VHOOK(Restart)() SetThink(&CFuncVehicle::Find); } -/* <1bb07b> ../cstrike/dlls/vehicle.cpp:1032 */ void CFuncVehicle::__MAKE_VHOOK(Precache)() { if (m_flVolume == 0.0f) @@ -970,10 +943,8 @@ void CFuncVehicle::__MAKE_VHOOK(Precache)() m_usAdjustPitch = PRECACHE_EVENT(1, "events/vehicle.sc"); } -/* <1bd23c> ../cstrike/dlls/vehicle.cpp:1064 */ LINK_ENTITY_TO_CLASS(func_vehiclecontrols, CFuncVehicleControls); -/* <1bbd36> ../cstrike/dlls/vehicle.cpp:1067 */ void CFuncVehicleControls::Find() { edict_t *pTarget = NULL; @@ -996,7 +967,6 @@ void CFuncVehicleControls::Find() UTIL_Remove(this); } -/* <1bb0c8> ../cstrike/dlls/vehicle.cpp:1088 */ void CFuncVehicleControls::__MAKE_VHOOK(Spawn)() { pev->solid = SOLID_NOT; diff --git a/regamedll/dlls/vehicle.h b/regamedll/dlls/vehicle.h index 8efc2c3b..da15a2de 100644 --- a/regamedll/dlls/vehicle.h +++ b/regamedll/dlls/vehicle.h @@ -51,7 +51,6 @@ #define VEHICLE_MAXPITCH 200 #define VEHICLE_MAXSPEED 1500 -/* <1ba646> ../cstrike/dlls/vehicle.cpp:1057 */ class CFuncVehicleControls: public CBaseEntity { public: @@ -62,7 +61,7 @@ public: void Spawn_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT Find(); diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index a585c5c4..c5e1e899 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -5,8 +5,8 @@ */ #ifndef HOOK_GAMEDLL -ItemInfo CBasePlayerItem::ItemInfoArray[32]; -AmmoInfo CBasePlayerItem::AmmoInfoArray[32]; +ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS]; +AmmoInfo CBasePlayerItem::AmmoInfoArray[MAX_AMMO_SLOTS]; TYPEDESCRIPTION CBasePlayerItem::m_SaveData[] = { @@ -36,7 +36,7 @@ TYPEDESCRIPTION CWeaponBox::m_SaveData[] = const char *g_pModelNameLaser = "sprites/laserbeam.spr"; -#endif // HOOK_GAMEDLL +#endif short g_sModelIndexLaser; // holds the index for the laser beam short g_sModelIndexLaserDot; // holds the index for the laser beam dot @@ -63,8 +63,6 @@ MULTIDAMAGE gMultiDamage; // MaxAmmoCarry - pass in a name and this function will tell // you the maximum amount of that type of ammunition that a // player can carry. - -/* <1d018e> ../cstrike/dlls/weapons.cpp:82 */ int MaxAmmoCarry(int iszName) { for (int i = 0; i < MAX_WEAPONS; ++i) @@ -87,8 +85,6 @@ int MaxAmmoCarry(int iszName) } // ClearMultiDamage - resets the global multi damage accumulator - -/* <1d2a29> ../cstrike/dlls/weapons.cpp:110 */ void ClearMultiDamage() { gMultiDamage.pEntity = NULL; @@ -97,8 +93,6 @@ void ClearMultiDamage() } // ApplyMultiDamage - inflicts contents of global multi damage register on gMultiDamage.pEntity - -/* <1d2a41> ../cstrike/dlls/weapons.cpp:124 */ void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker) { //Vector vecSpot1;//where blood comes from @@ -112,7 +106,6 @@ void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker) } -/* <1d2ad3> ../cstrike/dlls/weapons.cpp:140 */ void AddMultiDamage(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) { if (!pEntity) @@ -131,13 +124,11 @@ void AddMultiDamage(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamag gMultiDamage.amount += flDamage; } -/* <1d2b6f> ../cstrike/dlls/weapons.cpp:162 */ void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage) { - UTIL_BloodDrips(vecSpot, g_vecAttackDir, bloodColor, (int)flDamage); + UTIL_BloodDrips(vecSpot, g_vecAttackDir, bloodColor, int(flDamage)); } -/* <1d2bbb> ../cstrike/dlls/weapons.cpp:168 */ NOXREF int DamageDecal(CBaseEntity *pEntity, int bitsDamageType) { if (pEntity) @@ -148,15 +139,12 @@ NOXREF int DamageDecal(CBaseEntity *pEntity, int bitsDamageType) return RANDOM_LONG(DECAL_GUNSHOT4, DECAL_GUNSHOT5); } -/* <1d2bfa> ../cstrike/dlls/weapons.cpp:176 */ void DecalGunshot(TraceResult *pTrace, int iBulletType, bool ClientOnly, entvars_t *pShooter, bool bHitMetal) { ; } // EjectBrass - tosses a brass shell from passed origin at passed velocity - -/* <1d07b3> ../cstrike/dlls/weapons.cpp:184 */ void EjectBrass(const Vector &vecOrigin, const Vector &vecLeft, const Vector &vecVelocity, float rotation, int model, int soundtype, int entityIndex) { //CBaseEntity *ent = UTIL_PlayerByIndex(entityIndex); // unused @@ -194,7 +182,6 @@ void EjectBrass(const Vector &vecOrigin, const Vector &vecLeft, const Vector &ve MESSAGE_END(); } -/* <1d2cfd> ../cstrike/dlls/weapons.cpp:220 */ NOXREF void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype, entvars_t *pev) { MESSAGE_BEGIN(MSG_ONE, SVC_TEMPENTITY, NULL, pev); @@ -213,8 +200,6 @@ NOXREF void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, floa } // Precaches the ammo and queues the ammo info for sending to clients - -/* <1d020f> ../cstrike/dlls/weapons.cpp:242 */ void AddAmmoNameToAmmoRegistry(const char *szAmmoname) { // make sure it's not already in the registry @@ -245,8 +230,6 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname) } // Precaches the weapon and queues the weapon info for sending to clients - -/* <1d2e01> ../cstrike/dlls/weapons.cpp:265 */ void UTIL_PrecacheOtherWeapon(const char *szClassname) { edict_t *pent = CREATE_NAMED_ENTITY(MAKE_STRING(szClassname)); @@ -284,7 +267,6 @@ void UTIL_PrecacheOtherWeapon(const char *szClassname) REMOVE_ENTITY(pent); } -/* <1d2fc9> ../cstrike/dlls/weapons.cpp:304 */ NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname) { edict_t *pent = CREATE_NAMED_ENTITY(MAKE_STRING(szClassname)); @@ -303,7 +285,6 @@ NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname) Q_memset(&II, 0, sizeof(II)); pEntity->Precache(); - if (((CBasePlayerItem *)pEntity)->GetItemInfo(&II)) { IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ II.iId ] = II; @@ -324,12 +305,10 @@ NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname) } // called by worldspawn - -/* <1d3191> ../cstrike/dlls/weapons.cpp:345 */ void W_Precache() { - Q_memset(IMPL_CLASS(CBasePlayerItem, ItemInfoArray), 0, ARRAYSIZE(IMPL_CLASS(CBasePlayerItem, ItemInfoArray))); - Q_memset(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray), 0, ARRAYSIZE(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray))); + Q_memset(IMPL_CLASS(CBasePlayerItem, ItemInfoArray), 0, sizeof(IMPL_CLASS(CBasePlayerItem, ItemInfoArray))); + Q_memset(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray), 0, sizeof(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray))); giAmmoIndex = 0; // custom items... @@ -446,13 +425,9 @@ void W_Precache() PRECACHE_SOUND("weapons/generic_reload.wav"); } -/* <1d20a8> ../cstrike/dlls/weapons.cpp:458 */ IMPLEMENT_SAVERESTORE(CBasePlayerItem, CBaseAnimating); - -/* <1d27b2> ../cstrike/dlls/weapons.cpp:472 */ IMPLEMENT_SAVERESTORE(CBasePlayerWeapon, CBasePlayerItem); -/* <1d1730> ../cstrike/dlls/weapons.cpp:475 */ void CBasePlayerItem::__MAKE_VHOOK(SetObjectCollisionBox)() { pev->absmin = pev->origin + Vector(-24, -24, 0); @@ -460,8 +435,6 @@ void CBasePlayerItem::__MAKE_VHOOK(SetObjectCollisionBox)() } // Sets up movetype, size, solidtype for a new weapon. - -/* <1d31ab> ../cstrike/dlls/weapons.cpp:485 */ void CBasePlayerItem::FallInit() { pev->movetype = MOVETYPE_TOSS; @@ -483,8 +456,6 @@ void CBasePlayerItem::FallInit() // that the object is grounded, we change its solid type // to trigger and set it in a large box that helps the // player get it. - -/* <1d32bc> ../cstrike/dlls/weapons.cpp:506 */ void CBasePlayerItem::FallThink() { pev->nextthink = gpGlobals->time + 0.1f; @@ -508,8 +479,6 @@ void CBasePlayerItem::FallThink() } // Materialize - make a CBasePlayerItem visible and tangible - -/* <1d3252> ../cstrike/dlls/weapons.cpp:531 */ void CBasePlayerItem::Materialize() { if (pev->effects & EF_NODRAW) @@ -546,8 +515,6 @@ void CBasePlayerItem::Materialize() // AttemptToMaterialize - the item is trying to rematerialize, // should it do so now or wait longer? - -/* <1d327b> ../cstrike/dlls/weapons.cpp:567 */ void CBasePlayerItem::AttemptToMaterialize() { float time = g_pGameRules->FlWeaponTryRespawn(this); @@ -563,8 +530,6 @@ void CBasePlayerItem::AttemptToMaterialize() // CheckRespawn - a player is taking this weapon, should // it respawn? - -/* <1d3348> ../cstrike/dlls/weapons.cpp:584 */ void CBasePlayerItem::CheckRespawn() { switch (g_pGameRules->WeaponShouldRespawn(this)) @@ -578,8 +543,6 @@ void CBasePlayerItem::CheckRespawn() // Respawn - this item is already in the world, but it is // invisible and intangible. Make it visible and tangible. - -/* <1d1e09> ../cstrike/dlls/weapons.cpp:616 */ CBaseEntity *CBasePlayerItem::__MAKE_VHOOK(Respawn)() { // make a copy of this weapon that is invisible and inaccessible to players (no touch function). The weapon spawn/respawn code @@ -611,8 +574,6 @@ CBaseEntity *CBasePlayerItem::__MAKE_VHOOK(Respawn)() // whats going on here is that if the player drops this weapon, they shouldn't take it back themselves // for a little while. But if they throw it at someone else, the other player should get it immediately. - -/* <1d26f0> ../cstrike/dlls/weapons.cpp:642 */ void CBasePlayerItem::DefaultTouch(CBaseEntity *pOther) { // if it's not a player, ignore @@ -654,7 +615,6 @@ void CBasePlayerItem::DefaultTouch(CBaseEntity *pOther) SUB_UseTargets(pOther, USE_TOGGLE, 0); } -/* <1d3371> ../cstrike/dlls/weapons.cpp:678 */ void CBasePlayerWeapon::SetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -670,7 +630,6 @@ void CBasePlayerWeapon::SetPlayerShieldAnim() } } -/* <1d339a> ../cstrike/dlls/weapons.cpp:689 */ void CBasePlayerWeapon::ResetPlayerShieldAnim() { if (m_pPlayer->HasShield()) @@ -682,7 +641,6 @@ void CBasePlayerWeapon::ResetPlayerShieldAnim() } } -/* <1d33c3> ../cstrike/dlls/weapons.cpp:699 */ void CBasePlayerWeapon::EjectBrassLate() { int soundType; @@ -700,7 +658,6 @@ void CBasePlayerWeapon::EjectBrassLate() vecShellVelocity, pev->angles.y, m_iShellId, soundType, m_pPlayer->entindex()); } -/* <1d372a> ../cstrike/dlls/weapons.cpp:717 */ bool CBasePlayerWeapon::ShieldSecondaryFire(int iUpAnim, int iDownAnim) { if (!m_pPlayer->HasShield()) @@ -733,7 +690,6 @@ bool CBasePlayerWeapon::ShieldSecondaryFire(int iUpAnim, int iDownAnim) return true; } -/* <1d3773> ../cstrike/dlls/weapons.cpp:752 */ void CBasePlayerWeapon::KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change) { float_precision flKickUp; @@ -778,14 +734,10 @@ void CBasePlayerWeapon::KickBack(float up_base, float lateral_base, float up_mod } } -/* <1d242e> ../cstrike/dlls/weapons.cpp:792 */ void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bIsGlock) { float nexttime = 0.1f; - - m_iClip--; - - if (m_iClip < 0) + if (--m_iClip < 0) { m_iClip = 0; shotsFired = 3; @@ -803,7 +755,7 @@ void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bI flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif if (bIsGlock) { @@ -811,7 +763,7 @@ void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bI --m_pPlayer->ammo_9mm; PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireGlock18, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 10000), (int)(m_pPlayer->pev->punchangle.y * 10000), m_iClip == 0, FALSE); + int(m_pPlayer->pev->punchangle.x * 10000), int(m_pPlayer->pev->punchangle.y * 10000), m_iClip == 0, FALSE); } else { @@ -820,15 +772,13 @@ void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bI --m_pPlayer->ammo_556nato; PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFamas, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 10000000), (int)(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 10000000), int(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE); } m_pPlayer->pev->effects |= EF_MUZZLEFLASH; m_pPlayer->SetAnimation(PLAYER_ATTACK1); - shotsFired++; - - if (shotsFired != 3) + if (++shotsFired != 3) { shootTime = gpGlobals->time + nexttime; } @@ -836,14 +786,13 @@ void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bI shootTime = 0; } -/* <1d389e> ../cstrike/dlls/weapons.cpp:876 */ BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted) { #ifdef CLIENT_WEAPONS if (!isPredicted) #else if (1) -#endif // CLIENT_WEAPONS +#endif { return (attack_time <= curtime) ? TRUE : FALSE; } @@ -853,7 +802,6 @@ BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted) } } -/* <1d38f0> ../cstrike/dlls/weapons.cpp:890 */ bool CBasePlayerWeapon::HasSecondaryAttack() { if (m_pPlayer->HasShield()) @@ -885,7 +833,6 @@ bool CBasePlayerWeapon::HasSecondaryAttack() return true; } -/* <1d3919> ../cstrike/dlls/weapons.cpp:915 */ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)() { int usableButtons = m_pPlayer->pev->button; @@ -1033,7 +980,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)() // weapon isn't useable, switch. if (!(iFlags() & ITEM_FLAG_NOAUTOSWITCHEMPTY) && g_pGameRules->GetNextBestWeapon(m_pPlayer, this)) { - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3f; return; } #endif @@ -1065,7 +1012,6 @@ void CBasePlayerWeapon::__MAKE_VHOOK(ItemPostFrame)() } } -/* <1d3aac> ../cstrike/dlls/weapons.cpp:1069 */ void CBasePlayerItem::DestroyItem() { if (m_pPlayer != NULL) @@ -1077,7 +1023,6 @@ void CBasePlayerItem::DestroyItem() Kill(); } -/* <1d17d4> ../cstrike/dlls/weapons.cpp:1081 */ int CBasePlayerItem::__MAKE_VHOOK(AddToPlayer)(CBasePlayer *pPlayer) { m_pPlayer = pPlayer; @@ -1089,7 +1034,6 @@ int CBasePlayerItem::__MAKE_VHOOK(AddToPlayer)(CBasePlayer *pPlayer) return TRUE; } -/* <1d183d> ../cstrike/dlls/weapons.cpp:1092 */ void CBasePlayerItem::__MAKE_VHOOK(Drop)() { SetTouch(NULL); @@ -1097,7 +1041,6 @@ void CBasePlayerItem::__MAKE_VHOOK(Drop)() pev->nextthink = gpGlobals->time + 0.1f; } -/* <1d1866> ../cstrike/dlls/weapons.cpp:1099 */ void CBasePlayerItem::__MAKE_VHOOK(Kill)() { SetTouch(NULL); @@ -1105,14 +1048,12 @@ void CBasePlayerItem::__MAKE_VHOOK(Kill)() pev->nextthink = gpGlobals->time + 0.1f; } -/* <1d188f> ../cstrike/dlls/weapons.cpp:1106 */ void CBasePlayerItem::__MAKE_VHOOK(Holster)(int skiplocal) { m_pPlayer->pev->viewmodel = 0; m_pPlayer->pev->weaponmodel = 0; } -/* <1d18c7> ../cstrike/dlls/weapons.cpp:1112 */ void CBasePlayerItem::__MAKE_VHOOK(AttachToPlayer)(CBasePlayer *pPlayer) { pev->movetype = MOVETYPE_FOLLOW; @@ -1124,14 +1065,12 @@ void CBasePlayerItem::__MAKE_VHOOK(AttachToPlayer)(CBasePlayer *pPlayer) pev->modelindex = 0; pev->model = 0; pev->owner = pPlayer->edict(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; SetTouch(NULL); } // CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal - -/* <1d1e4a> ../cstrike/dlls/weapons.cpp:1126 */ int CBasePlayerWeapon::__MAKE_VHOOK(AddDuplicate)(CBasePlayerItem *pOriginal) { if (m_iDefaultAmmo) @@ -1145,7 +1084,6 @@ int CBasePlayerWeapon::__MAKE_VHOOK(AddDuplicate)(CBasePlayerItem *pOriginal) } } -/* <1d237f> ../cstrike/dlls/weapons.cpp:1140 */ int CBasePlayerWeapon::__MAKE_VHOOK(AddToPlayer)(CBasePlayer *pPlayer) { m_pPlayer = pPlayer; @@ -1165,10 +1103,9 @@ int CBasePlayerWeapon::__MAKE_VHOOK(AddToPlayer)(CBasePlayer *pPlayer) return FALSE; } -/* <1d24a3> ../cstrike/dlls/weapons.cpp:1164 */ int CBasePlayerWeapon::__MAKE_VHOOK(UpdateClientData)(CBasePlayer *pPlayer) { - BOOL bSend = FALSE; + bool bSend = false; int state = 0; if (pPlayer->m_pActiveItem == this) @@ -1180,16 +1117,16 @@ int CBasePlayerWeapon::__MAKE_VHOOK(UpdateClientData)(CBasePlayer *pPlayer) } if (!pPlayer->m_fWeapon) - bSend = TRUE; + bSend = true; if (this == pPlayer->m_pActiveItem || this == pPlayer->m_pClientActiveItem) { if (pPlayer->m_pActiveItem != pPlayer->m_pClientActiveItem) - bSend = TRUE; + bSend = true; } if (m_iClip != m_iClientClip || state != m_iClientWeaponState || pPlayer->m_iFOV != pPlayer->m_iClientFOV) - bSend = TRUE; + bSend = true; if (bSend) { @@ -1212,7 +1149,6 @@ int CBasePlayerWeapon::__MAKE_VHOOK(UpdateClientData)(CBasePlayer *pPlayer) return 1; } -/* <1d22c7> ../cstrike/dlls/weapons.cpp:1218 */ void CBasePlayerWeapon::__MAKE_VHOOK(SendWeaponAnim)(int iAnim, int skiplocal) { m_pPlayer->pev->weaponanim = iAnim; @@ -1220,7 +1156,7 @@ void CBasePlayerWeapon::__MAKE_VHOOK(SendWeaponAnim)(int iAnim, int skiplocal) #ifdef CLIENT_WEAPONS if (skiplocal && ENGINE_CANSKIP(m_pPlayer->edict())) return; -#endif // CLIENT_WEAPONS +#endif MESSAGE_BEGIN(MSG_ONE, SVC_WEAPONANIM, NULL, m_pPlayer->pev); WRITE_BYTE(iAnim); // sequence number @@ -1228,7 +1164,6 @@ void CBasePlayerWeapon::__MAKE_VHOOK(SendWeaponAnim)(int iAnim, int skiplocal) MESSAGE_END(); } -/* <1d3ad5> ../cstrike/dlls/weapons.cpp:1231 */ BOOL CBasePlayerWeapon::AddPrimaryAmmo(int iCount, char *szName, int iMaxClip, int iMaxCarry) { int iIdAmmo; @@ -1265,12 +1200,9 @@ BOOL CBasePlayerWeapon::AddPrimaryAmmo(int iCount, char *szName, int iMaxClip, i return iIdAmmo > 0 ? TRUE : FALSE; } -/* <1d3cd7> ../cstrike/dlls/weapons.cpp:1267 */ BOOL CBasePlayerWeapon::AddSecondaryAmmo(int iCount, char *szName, int iMax) { - int iIdAmmo; - - iIdAmmo = m_pPlayer->GiveAmmo(iCount, szName, iMax); + int iIdAmmo = m_pPlayer->GiveAmmo(iCount, szName, iMax); if (iIdAmmo > 0) { @@ -1285,8 +1217,6 @@ BOOL CBasePlayerWeapon::AddSecondaryAmmo(int iCount, char *szName, int iMax) // weapon is useable by the player in its current state. // (does it have ammo loaded? do I have any ammo for the // weapon?, etc) - -/* <1d19ba> ../cstrike/dlls/weapons.cpp:1287 */ BOOL CBasePlayerWeapon::__MAKE_VHOOK(IsUseable)() { if (m_iClip <= 0) @@ -1301,13 +1231,11 @@ BOOL CBasePlayerWeapon::__MAKE_VHOOK(IsUseable)() return TRUE; } -/* <1d19f4> ../cstrike/dlls/weapons.cpp:1301 */ BOOL CBasePlayerWeapon::__MAKE_VHOOK(CanDeploy)() { return TRUE; } -/* <1d3d7a> ../cstrike/dlls/weapons.cpp:1306 */ BOOL CBasePlayerWeapon::DefaultDeploy(char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal) { if (!CanDeploy()) @@ -1333,10 +1261,8 @@ BOOL CBasePlayerWeapon::DefaultDeploy(char *szViewModel, char *szWeaponModel, in return TRUE; } -/* <1d3df3> ../cstrike/dlls/weapons.cpp:1333 */ void CBasePlayerWeapon::ReloadSound() { - Vector newVector; Vector origin; CBaseEntity *pPlayer = NULL; float distance; @@ -1351,13 +1277,12 @@ void CBasePlayerWeapon::ReloadSound() if (pPlayer == m_pPlayer) continue; - newVector = origin - pPlayer->pev->origin; - distance = newVector.Length(); + distance = (origin - pPlayer->pev->origin).Length(); - if (distance <= 512.0f) + if (distance <= DISTANCE_RELOAD_SOUND) { MESSAGE_BEGIN(MSG_ONE, gmsgReloadSound, NULL, pPlayer->pev); - WRITE_BYTE((int)((1.0f - (distance / 512.0f)) * 255.0f)); + WRITE_BYTE(int((1.0f - (distance / DISTANCE_RELOAD_SOUND)) * 255.0f)); if (!Q_strcmp(STRING(pev->classname), "weapon_m3") || !Q_strcmp(STRING(pev->classname), "weapon_xm1014")) WRITE_BYTE(0); else @@ -1367,7 +1292,6 @@ void CBasePlayerWeapon::ReloadSound() } } -/* <1d3f0c> ../cstrike/dlls/weapons.cpp:1366 */ int CBasePlayerWeapon::DefaultReload(int iClipSize, int iAnim, float fDelay) { if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) @@ -1391,7 +1315,6 @@ int CBasePlayerWeapon::DefaultReload(int iClipSize, int iAnim, float fDelay) return TRUE; } -/* <1d2607> ../cstrike/dlls/weapons.cpp:1389 */ BOOL CBasePlayerWeapon::__MAKE_VHOOK(PlayEmptySound)() { if (m_iPlayEmptySound) @@ -1415,25 +1338,21 @@ BOOL CBasePlayerWeapon::__MAKE_VHOOK(PlayEmptySound)() return FALSE; } -/* <1d1a1c> ../cstrike/dlls/weapons.cpp:1414 */ void CBasePlayerWeapon::__MAKE_VHOOK(ResetEmptySound)() { m_iPlayEmptySound = 1; } -/* <1d1a44> ../cstrike/dlls/weapons.cpp:1421 */ int CBasePlayerWeapon::__MAKE_VHOOK(PrimaryAmmoIndex)() { return m_iPrimaryAmmoType; } -/* <1d1a6c> ../cstrike/dlls/weapons.cpp:1428 */ int CBasePlayerWeapon::__MAKE_VHOOK(SecondaryAmmoIndex)() { return -1; } -/* <1d1a94> ../cstrike/dlls/weapons.cpp:1433 */ void CBasePlayerWeapon::__MAKE_VHOOK(Holster)(int skiplocal) { // cancel any reload in progress. @@ -1442,7 +1361,6 @@ void CBasePlayerWeapon::__MAKE_VHOOK(Holster)(int skiplocal) m_pPlayer->pev->weaponmodel = 0; } -/* <1d20fb> ../cstrike/dlls/weapons.cpp:1440 */ void CBasePlayerAmmo::__MAKE_VHOOK(Spawn)() { pev->movetype = MOVETYPE_TOSS; @@ -1459,7 +1377,6 @@ void CBasePlayerAmmo::__MAKE_VHOOK(Spawn)() } } -/* <1d1d10> ../cstrike/dlls/weapons.cpp:1458 */ CBaseEntity *CBasePlayerAmmo::__MAKE_VHOOK(Respawn)() { pev->effects |= EF_NODRAW; @@ -1474,7 +1391,6 @@ CBaseEntity *CBasePlayerAmmo::__MAKE_VHOOK(Respawn)() return this; } -/* <1d1de0> ../cstrike/dlls/weapons.cpp:1471 */ void CBasePlayerAmmo::Materialize() { if (pev->effects & EF_NODRAW) @@ -1492,7 +1408,6 @@ void CBasePlayerAmmo::Materialize() SetTouch(&CBasePlayerAmmo::DefaultTouch); } -/* <1d1e94> ../cstrike/dlls/weapons.cpp:1488 */ void CBasePlayerAmmo::DefaultTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -1526,8 +1441,6 @@ void CBasePlayerAmmo::DefaultTouch(CBaseEntity *pOther) // the first time. If it is spawned by the world, m_iDefaultAmmo will have a default ammo amount in it. // if this is a weapon dropped by a dying player, has 0 m_iDefaultAmmo, which means only the ammo in // the weapon clip comes along. - -/* <1d3bc3> ../cstrike/dlls/weapons.cpp:1525 */ int CBasePlayerWeapon::__MAKE_VHOOK(ExtractAmmo)(CBasePlayerWeapon *pWeapon) { int iReturn = 0; @@ -1549,8 +1462,6 @@ int CBasePlayerWeapon::__MAKE_VHOOK(ExtractAmmo)(CBasePlayerWeapon *pWeapon) } // called by the new item's class with the existing item as parameter - -/* <1d1acc> ../cstrike/dlls/weapons.cpp:1548 */ int CBasePlayerWeapon::__MAKE_VHOOK(ExtractClipAmmo)(CBasePlayerWeapon *pWeapon) { int iAmmo; @@ -1568,8 +1479,6 @@ int CBasePlayerWeapon::__MAKE_VHOOK(ExtractClipAmmo)(CBasePlayerWeapon *pWeapon) } // RetireWeapon - no more ammo for this gun, put it away. - -/* <1d1b2e> ../cstrike/dlls/weapons.cpp:1567 */ void CBasePlayerWeapon::__MAKE_VHOOK(RetireWeapon)() { // first, no viewmodel at all. @@ -1580,8 +1489,6 @@ void CBasePlayerWeapon::__MAKE_VHOOK(RetireWeapon)() } // GetNextAttackDelay - An accurate way of calcualting the next attack time. - -/* <1d3f76> ../cstrike/dlls/weapons.cpp:1580 */ float CBasePlayerWeapon::GetNextAttackDelay(float delay) { if (m_flLastFireTime == 0.0f || m_flNextPrimaryAttack == -1.0f) @@ -1610,7 +1517,7 @@ float CBasePlayerWeapon::GetNextAttackDelay(float delay) float flNextAttack = UTIL_WeaponTimeBase() + delay - flCreep; #else float flNextAttack = UTIL_WeaponTimeBase() + delay; -#endif // REGAMEDLL_BUILD_6153 +#endif // save the last fire time m_flLastFireTime = gpGlobals->time; @@ -1622,19 +1529,14 @@ float CBasePlayerWeapon::GetNextAttackDelay(float delay) return flNextAttack; } -/* <1d3fe8> ../cstrike/dlls/weapons.cpp:1614 */ LINK_ENTITY_TO_CLASS(weaponbox, CWeaponBox); - -/* <1d2002> ../cstrike/dlls/weapons.cpp:1624 */ IMPLEMENT_SAVERESTORE(CWeaponBox, CBaseEntity); -/* <1d1b57> ../cstrike/dlls/weapons.cpp:1629 */ void CWeaponBox::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/w_weaponbox.mdl"); } -/* <1d2978> ../cstrike/dlls/weapons.cpp:1636 */ void CWeaponBox::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (m_cAmmoTypes >= MAX_AMMO_SLOTS) @@ -1650,7 +1552,6 @@ void CWeaponBox::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) pkvd->fHandled = TRUE; } -/* <1d48ba> ../cstrike/dlls/weapons.cpp:1652 */ void CWeaponBox::BombThink() { if (!m_bIsBomb) @@ -1678,10 +1579,9 @@ void CWeaponBox::BombThink() } } - pev->nextthink = gpGlobals->time + 1; + pev->nextthink = gpGlobals->time + 1.0f; } -/* <1d1ce7> ../cstrike/dlls/weapons.cpp:1687 */ void CWeaponBox::__MAKE_VHOOK(Spawn)() { Precache(); @@ -1697,8 +1597,6 @@ void CWeaponBox::__MAKE_VHOOK(Spawn)() // CWeaponBox - Kill - the think function that removes the // box from the world. - -/* <1d40c4> ../cstrike/dlls/weapons.cpp:1704 */ void CWeaponBox::Kill() { CBasePlayerItem *pWeapon; @@ -1723,8 +1621,6 @@ void CWeaponBox::Kill() // CWeaponBox - Touch: try to add my contents to the toucher // if the toucher is a player. - -/* <1d0640> ../cstrike/dlls/weapons.cpp:1732 */ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (!(pev->flags & FL_ONGROUND)) @@ -1769,10 +1665,8 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) // have at least one weapon in this slot while (pItem != NULL) { - CCSBotManager *ctrl = TheCSBots(); - if ((pPlayer->HasShield() && pItem->m_iId == WEAPON_ELITE) - || (pPlayer->IsBot() && (ctrl != NULL && !ctrl->IsWeaponUseable(pItem)))) + || (pPlayer->IsBot() && (TheCSBots() != NULL && !TheCSBots()->IsWeaponUseable(pItem)))) { return; } @@ -1811,7 +1705,7 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) CBaseEntity *pEntity = NULL; - while (pEntity = UTIL_FindEntityByClassname(pEntity, "player")) + while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL) { if (FNullEnt(pEntity->edict())) break; @@ -1836,10 +1730,9 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) } } - CCSBotManager *csBots = TheCSBots(); - if (csBots != NULL) + if (TheCSBots() != NULL) { - csBots->SetLooseBomb(NULL); + TheCSBots()->SetLooseBomb(NULL); } if (TheBots != NULL) @@ -1854,9 +1747,9 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) } else if (i == GRENADE_SLOT) { - if (m_rgpPlayerItems[i]->IsWeapon() && m_rgpPlayerItems[i]) + CBasePlayerWeapon *pGrenade = static_cast(m_rgpPlayerItems[i]); + if (pGrenade != NULL && pGrenade->IsWeapon()) { - CBasePlayerWeapon *pGrenade = static_cast(m_rgpPlayerItems[i]); int playerGrenades = pPlayer->m_rgAmmo[pGrenade->m_iPrimaryAmmoType]; int maxGrenades = 0; const char *grenadeName = NULL; @@ -1944,8 +1837,6 @@ void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) } // CWeaponBox - PackWeapon: Add this weapon to the box - -/* <1d4148> ../cstrike/dlls/weapons.cpp:1981 */ BOOL CWeaponBox::PackWeapon(CBasePlayerItem *pWeapon) { // is one of these weapons already packed in this box? @@ -1998,7 +1889,6 @@ BOOL CWeaponBox::PackWeapon(CBasePlayerItem *pWeapon) return TRUE; } -/* <1d4224> ../cstrike/dlls/weapons.cpp:2036 */ int CWeaponBox::PackAmmo(int iszName, int iCount) { if (!iszName) @@ -2019,11 +1909,9 @@ int CWeaponBox::PackAmmo(int iszName, int iCount) return FALSE; } -/* <1d426b> ../cstrike/dlls/weapons.cpp:2061 */ int CWeaponBox::GiveAmmo(int iCount, char *szName, int iMax, int *pIndex) { int i; - for (i = 1; i < MAX_AMMO_SLOTS && !FStringNull(m_rgiszAmmo[i]); ++i) { if (!Q_stricmp(szName, STRING(m_rgiszAmmo[i]))) @@ -2059,8 +1947,6 @@ int CWeaponBox::GiveAmmo(int iCount, char *szName, int iMax, int *pIndex) // CWeaponBox::HasWeapon - is a weapon of this type already // packed in this box? - -/* <1d42d5> ../cstrike/dlls/weapons.cpp:2100 */ BOOL CWeaponBox::HasWeapon(CBasePlayerItem *pCheckItem) { CBasePlayerItem *pItem = m_rgpPlayerItems[pCheckItem->iItemSlot()]; @@ -2079,8 +1965,6 @@ BOOL CWeaponBox::HasWeapon(CBasePlayerItem *pCheckItem) } // CWeaponBox::IsEmpty - is there anything in this box? - -/* <1d4354> ../cstrike/dlls/weapons.cpp:2119 */ BOOL CWeaponBox::IsEmpty() { int i; @@ -2105,14 +1989,12 @@ BOOL CWeaponBox::IsEmpty() return TRUE; } -/* <1d1b7f> ../cstrike/dlls/weapons.cpp:2145 */ void CWeaponBox::__MAKE_VHOOK(SetObjectCollisionBox)() { pev->absmin = pev->origin + Vector(-16, -16, 0); pev->absmax = pev->origin + Vector(16, 16, 16); } -/* <1d1d39> ../cstrike/dlls/weapons.cpp:2167 */ void CArmoury::__MAKE_VHOOK(Spawn)() { Precache(); @@ -2156,52 +2038,49 @@ void CArmoury::__MAKE_VHOOK(Spawn)() m_iInitialCount = m_iCount; } -/* <1d1bfb> ../cstrike/dlls/weapons.cpp:2207 */ void CArmoury::__MAKE_VHOOK(Restart)() { - CHalfLifeMultiplay *mp = g_pGameRules; - if (m_iItem == ARMOURY_FLASHBANG || m_iItem == ARMOURY_HEGRENADE) { if (!m_bAlreadyCounted) { m_bAlreadyCounted = true; - mp->m_iTotalGrenadeCount += m_iInitialCount; + CSGameRules()->m_iTotalGrenadeCount += m_iInitialCount; m_iCount = m_iInitialCount; pev->effects &= ~EF_NODRAW; return; } - float flRatio = (float_precision)(m_iInitialCount / mp->m_iTotalGrenadeCount) * (float_precision)mp->m_iNumTerrorist * 1.75; - m_iCount = (int)flRatio; + float flRatio = float_precision(m_iInitialCount / CSGameRules()->m_iTotalGrenadeCount) * float_precision(CSGameRules()->m_iNumTerrorist) * 1.75; + m_iCount = int(flRatio); } else if (m_iItem == ARMOURY_KEVLAR || m_iItem == ARMOURY_ASSAULT) { if (!m_bAlreadyCounted) { m_bAlreadyCounted = true; - mp->m_iTotalArmourCount += m_iInitialCount; + CSGameRules()->m_iTotalArmourCount += m_iInitialCount; m_iCount = m_iInitialCount; pev->effects &= ~EF_NODRAW; return; } - float flRatio = (float_precision)(m_iInitialCount / mp->m_iTotalArmourCount) * (float_precision)mp->m_iNumTerrorist; - m_iCount = (int)flRatio; + float flRatio = float_precision(m_iInitialCount / CSGameRules()->m_iTotalArmourCount) * float_precision(CSGameRules()->m_iNumTerrorist); + m_iCount = int(flRatio); } else { if (!m_bAlreadyCounted) { m_bAlreadyCounted = true; - mp->m_iTotalGunCount += m_iInitialCount; + CSGameRules()->m_iTotalGunCount += m_iInitialCount; m_iCount = m_iInitialCount; pev->effects &= ~EF_NODRAW; return; } - float flRatio = (float_precision)(m_iInitialCount / mp->m_iTotalGunCount) * (float_precision)mp->m_iNumTerrorist * 0.85; - m_iCount = (int)flRatio; + float flRatio = float_precision(m_iInitialCount / CSGameRules()->m_iTotalGunCount) * float_precision(CSGameRules()->m_iNumTerrorist) * 0.85; + m_iCount = int(flRatio); } if (m_iCount < 1) @@ -2212,7 +2091,6 @@ void CArmoury::__MAKE_VHOOK(Restart)() pev->effects &= ~EF_NODRAW; } -/* <1d1ee9> ../cstrike/dlls/weapons.cpp:2268 */ void CArmoury::__MAKE_VHOOK(Precache)() { switch (m_iItem) @@ -2240,7 +2118,6 @@ void CArmoury::__MAKE_VHOOK(Precache)() } } -/* <1d1f2f> ../cstrike/dlls/weapons.cpp:2294 */ void CArmoury::ArmouryTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -2376,7 +2253,6 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther) } } -/* <1d21bd> ../cstrike/dlls/weapons.cpp:2352 */ void CArmoury::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "item")) @@ -2393,5 +2269,4 @@ void CArmoury::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) CBaseEntity::KeyValue(pkvd); } -/* <1d4392> ../cstrike/dlls/weapons.cpp:2368 */ LINK_ENTITY_TO_CLASS(armoury_entity, CArmoury); diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 1f0e39f2..df1e83d7 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -33,11 +33,13 @@ #endif #include "weapontype.h" +#include "wpn_shared.h" class CBasePlayer; #define MAX_WEAPONS 32 #define MAX_NORMAL_BATTERY 100.0f +#define DISTANCE_RELOAD_SOUND 512.0f #define ITEM_FLAG_SELECTONEMPTY 1 #define ITEM_FLAG_NOAUTORELOAD 2 @@ -123,7 +125,6 @@ struct MULTIDAMAGE int type; }; -/* <1d04c6> ../cstrike/dlls/weapons.cpp:2156 */ class CArmoury: public CBaseEntity { public: @@ -139,7 +140,7 @@ public: void Restart_(); void KeyValue_(KeyValueData *pkvd); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT ArmouryTouch(CBaseEntity *pOther); @@ -151,7 +152,6 @@ public: bool m_bAlreadyCounted; }; -/* <14ed46> ../cstrike/dlls/weapons.h:56 */ class CGrenade: public CBaseMonster { public: @@ -173,7 +173,7 @@ public: void Use_(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void BounceSound_(); -#endif // HOOK_GAMEDLL +#endif public: enum SATCHELCODE @@ -184,16 +184,16 @@ public: public: static CGrenade *ShootTimed(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time); static CGrenade *ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent); - NOXREF static CGrenade *ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity); + static CGrenade *ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity); static CGrenade *ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent); static CGrenade *ShootSatchelCharge(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity); - NOXREF static void UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code); + static void UseSatchelCharges(entvars_t *pevOwner, SATCHELCODE code); public: void Explode(Vector vecSrc, Vector vecAim); void Explode(TraceResult *pTrace, int bitsDamageType); void Explode2(TraceResult *pTrace, int bitsDamageType); void Explode3(TraceResult *pTrace, int bitsDamageType); - NOXREF void SG_Explode(TraceResult *pTrace, int bitsDamageType); + void SG_Explode(TraceResult *pTrace, int bitsDamageType); void EXPORT Smoke(); void EXPORT Smoke2(); @@ -245,7 +245,6 @@ public: BOOL m_fRegisteredSound; }; -/* <2c9f2c> ../cstrike/dlls/weapons.h:238 */ class CBasePlayerItem: public CBaseAnimating { public: @@ -287,7 +286,7 @@ public: void Kill_(); void AttachToPlayer_(CBasePlayer *pPlayer); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT DestroyItem(); @@ -300,27 +299,26 @@ public: void CheckRespawn(); public: - inline int iItemPosition() const { return IMPL(ItemInfoArray)[ m_iId ].iPosition; } - inline const char *pszAmmo1() const { return IMPL(ItemInfoArray)[ m_iId ].pszAmmo1; } - inline int iMaxAmmo1() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo1; } - inline const char *pszAmmo2() const { return IMPL(ItemInfoArray)[ m_iId ].pszAmmo2; } - inline int iMaxAmmo2() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo2; } - inline const char *pszName() const { return IMPL(ItemInfoArray)[ m_iId ].pszName; } - inline int iMaxClip() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxClip; } - inline int iWeight() const { return IMPL(ItemInfoArray)[ m_iId ].iWeight; } - inline int iFlags() const { return IMPL(ItemInfoArray)[ m_iId ].iFlags; } + inline int iItemPosition() const { return IMPL(ItemInfoArray)[ m_iId ].iPosition; } + inline const char *pszAmmo1() const { return IMPL(ItemInfoArray)[ m_iId ].pszAmmo1; } + inline int iMaxAmmo1() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo1; } + inline const char *pszAmmo2() const { return IMPL(ItemInfoArray)[ m_iId ].pszAmmo2; } + inline int iMaxAmmo2() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo2; } + inline const char *pszName() const { return IMPL(ItemInfoArray)[ m_iId ].pszName; } + inline int iMaxClip() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxClip; } + inline int iWeight() const { return IMPL(ItemInfoArray)[ m_iId ].iWeight; } + inline int iFlags() const { return IMPL(ItemInfoArray)[ m_iId ].iFlags; } public: static TYPEDESCRIPTION IMPL(m_SaveData)[3]; - static ItemInfo IMPL(ItemInfoArray)[32]; - static AmmoInfo IMPL(AmmoInfoArray)[32]; + static ItemInfo IMPL(ItemInfoArray)[MAX_WEAPONS]; + static AmmoInfo IMPL(AmmoInfoArray)[MAX_AMMO_SLOTS]; CBasePlayer *m_pPlayer; CBasePlayerItem *m_pNext; int m_iId; }; -/* <2c9f52> ../cstrike/dlls/weapons.h:307 */ class CBasePlayerWeapon: public CBasePlayerItem { public: @@ -376,7 +374,7 @@ public: BOOL IsUseable_(); void RetireWeapon_(); -#endif // HOOK_GAMEDLL +#endif public: BOOL AddPrimaryAmmo(int iCount, char *szName, int iMaxClip, int iMaxCarry); @@ -386,8 +384,8 @@ public: void FireRemaining(int &shotsFired, float &shootTime, BOOL isGlock18); void KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change); void EjectBrassLate(); - NOXREF void MakeBeam(); - NOXREF void BeamUpdate(); + void MakeBeam(); + void BeamUpdate(); void ReloadSound(); float GetNextAttackDelay(float delay); float GetNextAttackDelay2(float delay); @@ -437,7 +435,6 @@ public: float m_flLastFireTime; }; -/* <9716> ../cstrike/dlls/weapons.h:429 */ class CBasePlayerAmmo: public CBaseEntity { public: @@ -450,14 +447,13 @@ public: void Spawn_(); CBaseEntity *Respawn_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT DefaultTouch(CBaseEntity *pOther); void EXPORT Materialize(); }; -/* <1d03c1> ../cstrike/dlls/weapons.h:508 */ class CWeaponBox: public CBaseEntity { public: @@ -479,7 +475,7 @@ public: void SetObjectCollisionBox_(); void Touch_(CBaseEntity *pOther); -#endif // HOOK_GAMEDLL +#endif public: BOOL IsEmpty(); @@ -502,7 +498,6 @@ public: bool m_bIsBomb; }; -/* <2ba15a> ../cstrike/dlls/weapons.h:573 */ class CUSP: public CBasePlayerWeapon { public: @@ -510,8 +505,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return PISTOL_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return PISTOL_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -524,7 +519,7 @@ public: return FALSE; #endif } - virtual BOOL IsPistol() { return TRUE; } + virtual BOOL IsPistol() { return TRUE; } #ifdef HOOK_GAMEDLL @@ -537,12 +532,12 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void USPFire(float flSpread, float flCycleTime, BOOL fUseSemi); - NOXREF void MakeBeam(); - NOXREF void BeamUpdate(); + void MakeBeam(); + void BeamUpdate(); int m_iShell; @@ -550,7 +545,6 @@ private: unsigned short m_usFireUSP; }; -/* <28adc9> ../cstrike/dlls/weapons.h:599 */ class CMP5N: public CBasePlayerWeapon { public: @@ -558,8 +552,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return MP5N_MAX_SPEED; } - int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return MP5N_MAX_SPEED; } + int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -582,7 +576,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -594,7 +588,6 @@ private: unsigned short m_usFireMP5N; }; -/* <2a553c> ../cstrike/dlls/weapons.h:624 */ class CSG552: public CBasePlayerWeapon { public: @@ -603,7 +596,7 @@ public: virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -629,7 +622,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -641,7 +634,6 @@ private: unsigned short m_usFireSG552; }; -/* <234730> ../cstrike/dlls/weapons.h:648 */ class CAK47: public CBasePlayerWeapon { public: @@ -649,8 +641,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return AK47_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return AK47_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -675,7 +667,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -687,7 +679,6 @@ private: unsigned short m_usFireAK47; }; -/* <239b82> ../cstrike/dlls/weapons.h:672 */ class CAUG: public CBasePlayerWeapon { public: @@ -695,8 +686,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return AUG_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return AUG_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -721,7 +712,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -733,7 +724,6 @@ private: unsigned short m_usFireAug; }; -/* <23ef02> ../cstrike/dlls/weapons.h:697 */ class CAWP: public CBasePlayerWeapon { public: @@ -742,7 +732,7 @@ public: virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -768,7 +758,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -779,7 +769,6 @@ private: unsigned short m_usFireAWP; }; -/* <245949> ../cstrike/dlls/weapons.h:721 */ class CC4: public CBasePlayerWeapon { public: @@ -791,7 +780,7 @@ public: virtual BOOL Deploy(); virtual void Holster(int skiplocal); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return C4_SLOT; } + virtual int iItemSlot() { return C4_SLOT; } virtual void PrimaryAttack(); virtual void WeaponIdle(); virtual BOOL UseDecrement() @@ -816,7 +805,7 @@ public: void PrimaryAttack_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: bool m_bStartedArming; @@ -827,7 +816,6 @@ private: bool m_bHasShield; }; -/* <24afee> ../cstrike/dlls/weapons.h:750 */ class CDEAGLE: public CBasePlayerWeapon { public: @@ -835,8 +823,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return PISTOL_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return PISTOL_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -849,7 +837,7 @@ public: return FALSE; #endif } - virtual BOOL IsPistol() { return TRUE; } + virtual BOOL IsPistol() { return TRUE; } #ifdef HOOK_GAMEDLL @@ -862,7 +850,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi); @@ -873,7 +861,6 @@ private: unsigned short m_usFireDeagle; }; -/* <25ab17> ../cstrike/dlls/weapons.h:778 */ class CFlashbang: public CBasePlayerWeapon { public: @@ -881,11 +868,11 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL CanDeploy(); - virtual BOOL CanDrop() { return FALSE; } + virtual BOOL CanDrop() { return FALSE; } virtual BOOL Deploy(); virtual void Holster(int skiplocal); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return GRENADE_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return GRENADE_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void WeaponIdle(); @@ -904,7 +891,7 @@ public: #else // TODO: why the object flashbang is IsPistol? return TRUE; - #endif // REGAMEDLL_FIXES + #endif } #ifdef HOOK_GAMEDLL @@ -919,7 +906,7 @@ public: void SecondaryAttack_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: bool ShieldSecondaryFire(int iUpAnim, int iDownAnim); @@ -927,7 +914,6 @@ public: void ResetPlayerShieldAnim(); }; -/* <26006d> ../cstrike/dlls/weapons.h:803 */ class CG3SG1: public CBasePlayerWeapon { public: @@ -936,7 +922,7 @@ public: virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -962,7 +948,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -973,7 +959,6 @@ private: unsigned short m_usFireG3SG1; }; -/* <2655b2> ../cstrike/dlls/weapons.h:828 */ class CGLOCK18: public CBasePlayerWeapon { public: @@ -981,8 +966,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return PISTOL_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return PISTOL_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -995,7 +980,7 @@ public: return FALSE; #endif } - virtual BOOL IsPistol() { return TRUE; } + virtual BOOL IsPistol() { return TRUE; } #ifdef HOOK_GAMEDLL @@ -1008,7 +993,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst); @@ -1018,7 +1003,6 @@ public: bool m_bBurstFire; }; -/* <26a48a> ../cstrike/dlls/weapons.h:852 */ class CHEGrenade: public CBasePlayerWeapon { public: @@ -1026,11 +1010,11 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL CanDeploy(); - virtual BOOL CanDrop() { return FALSE; } + virtual BOOL CanDrop() { return FALSE; } virtual BOOL Deploy(); virtual void Holster(int skiplocal); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return GRENADE_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return GRENADE_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void WeaponIdle(); @@ -1055,7 +1039,7 @@ public: void SecondaryAttack_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: bool ShieldSecondaryFire(int iUpAnim, int iDownAnim); @@ -1066,18 +1050,17 @@ public: unsigned short m_usCreateExplosion; }; -/* <26f804> ../cstrike/dlls/weapons.h:878 */ class CKnife: public CBasePlayerWeapon { public: virtual void Spawn(); virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); - virtual BOOL CanDrop() { return FALSE; } + virtual BOOL CanDrop() { return FALSE; } virtual BOOL Deploy(); virtual void Holster(int skiplocal); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return KNIFE_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return KNIFE_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual BOOL UseDecrement() @@ -1101,13 +1084,13 @@ public: void SecondaryAttack_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void EXPORT SwingAgain(); void EXPORT Smack(); - NOXREF void WeaponAnimation(int iAnimation); + void WeaponAnimation(int iAnimation); int Stab(int fFirst); int Swing(int fFirst); @@ -1121,7 +1104,6 @@ public: unsigned short m_usKnife; }; -/* <275d5a> ../cstrike/dlls/weapons.h:910 */ class CM249: public CBasePlayerWeapon { public: @@ -1129,8 +1111,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return M249_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return M249_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1153,7 +1135,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1165,7 +1147,6 @@ private: unsigned short m_usFireM249; }; -/* <27b175> ../cstrike/dlls/weapons.h:934 */ class CM3: public CBasePlayerWeapon { public: @@ -1173,8 +1154,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return M3_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return M3_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1197,7 +1178,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: int m_iShell; @@ -1207,7 +1188,6 @@ private: unsigned short m_usFireM3; }; -/* <280488> ../cstrike/dlls/weapons.h:961 */ class CM4A1: public CBasePlayerWeapon { public: @@ -1216,7 +1196,7 @@ public: virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -1242,7 +1222,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1254,7 +1234,6 @@ private: unsigned short m_usFireM4A1; }; -/* <285993> ../cstrike/dlls/weapons.h:987 */ class CMAC10: public CBasePlayerWeapon { public: @@ -1262,8 +1241,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return MAC10_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return MAC10_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1286,7 +1265,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1298,7 +1277,6 @@ private: unsigned short m_usFireMAC10; }; -/* <2902c1> ../cstrike/dlls/weapons.h:1011 */ class CP228: public CBasePlayerWeapon { public: @@ -1306,8 +1284,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return PISTOL_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return PISTOL_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -1320,7 +1298,7 @@ public: return FALSE; #endif } - virtual BOOL IsPistol() { return TRUE; } + virtual BOOL IsPistol() { return TRUE; } #ifdef HOOK_GAMEDLL @@ -1333,12 +1311,12 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi); - NOXREF void MakeBeam(); - NOXREF void BeamUpdate(); + void MakeBeam(); + void BeamUpdate(); public: int m_iShell; @@ -1347,7 +1325,6 @@ private: unsigned short m_usFireP228; }; -/* <295740> ../cstrike/dlls/weapons.h:1039 */ class CP90: public CBasePlayerWeapon { public: @@ -1356,7 +1333,7 @@ public: virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1380,7 +1357,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1392,7 +1369,6 @@ private: unsigned short m_usFireP90; }; -/* <29abe0> ../cstrike/dlls/weapons.h:1063 */ class CSCOUT: public CBasePlayerWeapon { public: @@ -1401,7 +1377,7 @@ public: virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -1427,7 +1403,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1437,7 +1413,6 @@ private: unsigned short m_usFireScout; }; -/* <2aa3d5> ../cstrike/dlls/weapons.h:1089 */ class CSmokeGrenade: public CBasePlayerWeapon { public: @@ -1445,11 +1420,11 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL CanDeploy(); - virtual BOOL CanDrop() { return FALSE; } + virtual BOOL CanDrop() { return FALSE; } virtual BOOL Deploy(); virtual void Holster(int skiplocal); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return GRENADE_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return GRENADE_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void WeaponIdle(); @@ -1474,7 +1449,7 @@ public: void SecondaryAttack_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: bool ShieldSecondaryFire(int iUpAnim, int iDownAnim); @@ -1485,7 +1460,6 @@ public: unsigned short m_usCreateSmoke; }; -/* <2af8c3> ../cstrike/dlls/weapons.h:1116 */ class CTMP: public CBasePlayerWeapon { public: @@ -1493,8 +1467,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return TMP_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return TMP_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1517,7 +1491,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1530,7 +1504,6 @@ private: unsigned short m_usFireTMP; }; -/* <2c9fce> ../cstrike/dlls/weapons.h:1141 */ class CXM1014: public CBasePlayerWeapon { public: @@ -1538,8 +1511,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return XM1014_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return XM1014_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1562,7 +1535,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: int m_iShell; @@ -1572,7 +1545,6 @@ private: unsigned short m_usFireXM1014; }; -/* <2503f9> ../cstrike/dlls/weapons.h:1167 */ class CELITE: public CBasePlayerWeapon { public: @@ -1580,8 +1552,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return ELITE_MAX_SPEED; } - virtual int iItemSlot() { return PISTOL_SLOT; } + virtual float GetMaxSpeed() { return ELITE_MAX_SPEED; } + virtual int iItemSlot() { return PISTOL_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1593,7 +1565,7 @@ public: return FALSE; #endif } - virtual BOOL IsPistol() { return TRUE; } + virtual BOOL IsPistol() { return TRUE; } #ifdef HOOK_GAMEDLL @@ -1605,7 +1577,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi); @@ -1616,7 +1588,6 @@ public: unsigned short m_usFireELITE_RIGHT; }; -/* <255b29> ../cstrike/dlls/weapons.h:1192 */ class CFiveSeven: public CBasePlayerWeapon { public: @@ -1624,8 +1595,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return m_fMaxSpeed; } - virtual int iItemSlot() { return PISTOL_SLOT; } + virtual float GetMaxSpeed() { return m_fMaxSpeed; } + virtual int iItemSlot() { return PISTOL_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -1638,7 +1609,7 @@ public: return FALSE; #endif } - virtual BOOL IsPistol() { return TRUE; } + virtual BOOL IsPistol() { return TRUE; } #ifdef HOOK_GAMEDLL @@ -1651,12 +1622,12 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi); - NOXREF void MakeBeam(); - NOXREF void BeamUpdate(); + void MakeBeam(); + void BeamUpdate(); public: int m_iShell; @@ -1665,7 +1636,6 @@ private: unsigned short m_usFireFiveSeven; }; -/* <2b4cf9> ../cstrike/dlls/weapons.h:1219 */ class CUMP45: public CBasePlayerWeapon { public: @@ -1673,8 +1643,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return UMP45_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return UMP45_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void Reload(); virtual void WeaponIdle(); @@ -1697,7 +1667,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1710,7 +1680,6 @@ private: unsigned short m_usFireUMP45; }; -/* <2a00b3> ../cstrike/dlls/weapons.h:1244 */ class CSG550: public CBasePlayerWeapon { public: @@ -1719,7 +1688,7 @@ public: virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); virtual float GetMaxSpeed(); - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -1745,7 +1714,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1757,7 +1726,6 @@ private: unsigned short m_usFireSG550; }; -/* <2c4bb9> ../cstrike/dlls/weapons.h:1269 */ class CGalil: public CBasePlayerWeapon { public: @@ -1765,8 +1733,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return GALIL_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return GALIL_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -1791,7 +1759,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim); @@ -1804,7 +1772,6 @@ private: unsigned short m_usFireGalil; }; -/* <2bf676> ../cstrike/dlls/weapons.h:1293 */ class CFamas: public CBasePlayerWeapon { public: @@ -1812,8 +1779,8 @@ public: virtual void Precache(); virtual int GetItemInfo(ItemInfo *p); virtual BOOL Deploy(); - virtual float GetMaxSpeed() { return FAMAS_MAX_SPEED; } - virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } + virtual float GetMaxSpeed() { return FAMAS_MAX_SPEED; } + virtual int iItemSlot() { return PRIMARY_WEAPON_SLOT; } virtual void PrimaryAttack(); virtual void SecondaryAttack(); virtual void Reload(); @@ -1838,7 +1805,7 @@ public: void Reload_(); void WeaponIdle_(); -#endif // HOOK_GAMEDLL +#endif public: void FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL bFireBurst); @@ -1877,13 +1844,13 @@ void ClearMultiDamage(); void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker); void AddMultiDamage(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage); -NOXREF int DamageDecal(CBaseEntity *pEntity, int bitsDamageType); +int DamageDecal(CBaseEntity *pEntity, int bitsDamageType); void DecalGunshot(TraceResult *pTrace, int iBulletType, bool ClientOnly, entvars_t *pShooter, bool bHitMetal); void EjectBrass(const Vector &vecOrigin, const Vector &vecLeft, const Vector &vecVelocity, float rotation, int model, int soundtype, int entityIndex); -NOXREF void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype, entvars_t *pev); +void EjectBrass2(const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype, entvars_t *pev); void AddAmmoNameToAmmoRegistry(const char *szAmmoname); void UTIL_PrecacheOtherWeapon(const char *szClassname); -NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname); +void UTIL_PrecacheOtherWeapon2(const char *szClassname); void W_Precache(); BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted); diff --git a/regamedll/dlls/weapontype.cpp b/regamedll/dlls/weapontype.cpp index 6783c7e7..029bbfeb 100644 --- a/regamedll/dlls/weapontype.cpp +++ b/regamedll/dlls/weapontype.cpp @@ -218,8 +218,6 @@ WeaponInfoStruct weaponInfo[] = #endif // HOOK_GAMEDLL // Given an alias, return the associated weapon ID - -/* <22cd2a> ../cstrike/dlls/weapontype.cpp:208 */ WeaponIdType AliasToWeaponID(const char *alias) { if (alias != NULL) @@ -234,7 +232,6 @@ WeaponIdType AliasToWeaponID(const char *alias) return WEAPON_NONE; } -/* <22cd70> ../cstrike/dlls/weapontype.cpp:224 */ const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id) { if (alias) @@ -254,8 +251,6 @@ const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id) } // Given a weapon ID, return its alias - -/* <22cd03> ../cstrike/dlls/weapontype.cpp:246 */ const char *WeaponIDToAlias(int id) { for (int i = 0; weaponAliasInfo[i].alias != NULL; ++i) @@ -267,7 +262,6 @@ const char *WeaponIDToAlias(int id) return NULL; } -/* <22cdfe> ../cstrike/dlls/weapontype.cpp:259 */ WeaponClassType AliasToWeaponClass(const char *alias) { if (alias != NULL) @@ -282,15 +276,12 @@ WeaponClassType AliasToWeaponClass(const char *alias) return WEAPONCLASS_NONE; } -/* <22ce5a> ../cstrike/dlls/weapontype.cpp:276 */ WeaponClassType WeaponIDToWeaponClass(int id) { return AliasToWeaponClass(WeaponIDToAlias(id)); } // Return true if given weapon ID is a primary weapon - -/* <22cee3> ../cstrike/dlls/weapontype.cpp:285 */ bool IsPrimaryWeapon(int id) { switch (id) @@ -323,8 +314,6 @@ bool IsPrimaryWeapon(int id) } // Return true if given weapon ID is a secondary weapon - -/* <22cf19> ../cstrike/dlls/weapontype.cpp:318 */ bool IsSecondaryWeapon(int id) { switch (id) @@ -343,7 +332,6 @@ bool IsSecondaryWeapon(int id) return false; } -/* <22cf48> ../cstrike/dlls/weapontype.cpp:426 */ WeaponInfoStruct *GetWeaponInfo(int weaponID) { for (int i = 0; weaponInfo[i].id != 0; ++i) @@ -355,7 +343,6 @@ WeaponInfoStruct *GetWeaponInfo(int weaponID) return NULL; } -/* <22cf97> ../cstrike/dlls/weapontype.cpp:443 */ bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions) { if (useAssasinationRestrictions) diff --git a/regamedll/dlls/world.cpp b/regamedll/dlls/world.cpp index 710a47ac..3b3e4717 100644 --- a/regamedll/dlls/world.cpp +++ b/regamedll/dlls/world.cpp @@ -69,7 +69,6 @@ TYPEDESCRIPTION gGlobalEntitySaveData[] = #endif // HOOK_GAMEDLL -/* <1d9f84> ../cstrike/dlls/world.cpp:111 */ class CDecal: public CBaseEntity { public: @@ -81,10 +80,8 @@ public: void EXPORT TriggerDecal(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); }; -/* <1db42b> ../cstrike/dlls/world.cpp:120 */ LINK_ENTITY_TO_CLASS(infodecal, CDecal); -/* <1db00a> ../cstrike/dlls/world.cpp:123 */ void CDecal::Spawn() { if (pev->skin < 0 || (gpGlobals->deathmatch != 0.0f && (pev->spawnflags & SF_DECAL_NOTINDEATHMATCH))) @@ -108,7 +105,6 @@ void CDecal::Spawn() } } -/* <1dad69> ../cstrike/dlls/world.cpp:145 */ void CDecal::TriggerDecal(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // this is set up as a USE function for infodecals that have targetnames, so that the @@ -123,12 +119,12 @@ void CDecal::TriggerDecal(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP WRITE_COORD(pev->origin.x); WRITE_COORD(pev->origin.y); WRITE_COORD(pev->origin.z); - WRITE_SHORT((int)pev->skin); + WRITE_SHORT(int(pev->skin)); entityIndex = (short)ENTINDEX(trace.pHit); WRITE_SHORT(entityIndex); if (entityIndex) { - WRITE_SHORT((int)VARS(trace.pHit)->modelindex); + WRITE_SHORT(int(VARS(trace.pHit)->modelindex)); } MESSAGE_END(); @@ -136,7 +132,6 @@ void CDecal::TriggerDecal(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP pev->nextthink = gpGlobals->time + 0.1f; } -/* <1daee2> ../cstrike/dlls/world.cpp:171 */ void CDecal::StaticDecal() { TraceResult trace; @@ -155,7 +150,6 @@ void CDecal::StaticDecal() SUB_Remove(); } -/* <1db068> ../cstrike/dlls/world.cpp:190 */ void CDecal::KeyValue(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "texture")) @@ -173,18 +167,14 @@ void CDecal::KeyValue(KeyValueData *pkvd) } // Body queue class here.... It's really just CBaseEntity - -/* <1d9fd1> ../cstrike/dlls/world.cpp:207 */ class CCorpse: public CBaseEntity { public: virtual int ObjectCaps() { return FCAP_DONT_SAVE; } }; -/* <1db4f5> ../cstrike/dlls/world.cpp:212 */ LINK_ENTITY_TO_CLASS(bodyque, CCorpse); -/* <1da107> ../cstrike/dlls/world.cpp:214 */ static void InitBodyQue() { g_pBodyQueueHead = NULL; @@ -192,8 +182,6 @@ static void InitBodyQue() // make a body que entry for the given ent so the ent can be respawned elsewhere // GLOBALS ASSUMED SET: g_eoBodyQueueHeadstion - -/* <1db5bf> ../cstrike/dlls/world.cpp:242 */ void CopyToBodyQue(entvars_t *pev) { #if 0 @@ -226,26 +214,22 @@ void CopyToBodyQue(entvars_t *pev) #endif } -/* <1db5e9> ../cstrike/dlls/world.cpp:275 */ void ClearBodyQue() { ; } -/* <1db601> ../cstrike/dlls/world.cpp:294 */ CGlobalState::CGlobalState() { Reset(); } -/* <1db63b> ../cstrike/dlls/world.cpp:299 */ void CGlobalState::Reset() { m_pList = NULL; m_listCount = 0; } -/* <1db69e> ../cstrike/dlls/world.cpp:305 */ globalentity_t *CGlobalState::Find(string_t globalname) { if (!globalname) @@ -266,8 +250,6 @@ globalentity_t *CGlobalState::Find(string_t globalname) } // This is available all the time now on impulse 104, remove later - -/* <1db703> ../cstrike/dlls/world.cpp:329 */ void CGlobalState::DumpGlobals() { static char *estates[] = { "Off", "On", "Dead" }; @@ -283,12 +265,11 @@ void CGlobalState::DumpGlobals() } } -/* <1db76a> ../cstrike/dlls/world.cpp:345 */ void CGlobalState::EntityAdd(string_t globalname, string_t mapName, GLOBALESTATE state) { assert(!Find(globalname)); - globalentity_t *pNewEntity = (globalentity_t *)calloc(sizeof(globalentity_t), 1); + globalentity_t *pNewEntity = (globalentity_t *)Q_calloc(sizeof(globalentity_t), 1); assert(pNewEntity != NULL); pNewEntity->pNext = m_pList; @@ -300,18 +281,16 @@ void CGlobalState::EntityAdd(string_t globalname, string_t mapName, GLOBALESTATE m_listCount++; } -/* <1db7b3> ../cstrike/dlls/world.cpp:360 */ void CGlobalState::EntitySetState(string_t globalname, GLOBALESTATE state) { globalentity_t *pEnt = Find(globalname); - if (pEnt) + if (pEnt != NULL) { pEnt->state = state; } } -/* <1db873> ../cstrike/dlls/world.cpp:369 */ const globalentity_t *CGlobalState::EntityFromTable(string_t globalname) { globalentity_t *pEnt = Find(globalname); @@ -319,7 +298,6 @@ const globalentity_t *CGlobalState::EntityFromTable(string_t globalname) return pEnt; } -/* <1db91c> ../cstrike/dlls/world.cpp:377 */ GLOBALESTATE CGlobalState::EntityGetState(string_t globalname) { globalentity_t *pEnt = Find(globalname); @@ -332,7 +310,6 @@ GLOBALESTATE CGlobalState::EntityGetState(string_t globalname) return GLOBAL_OFF; } -/* <1db9c5> ../cstrike/dlls/world.cpp:402 */ int CGlobalState::Save(CSave &save) { int i; @@ -357,7 +334,6 @@ int CGlobalState::Save(CSave &save) return 1; } -/* <1dba07> ../cstrike/dlls/world.cpp:422 */ int CGlobalState::Restore(CRestore &restore) { int i, listCount; @@ -389,7 +365,6 @@ int CGlobalState::Restore(CRestore &restore) return 1; } -/* <1dbaf2> ../cstrike/dlls/world.cpp:444 */ void CGlobalState::EntityUpdate(string_t globalname, string_t mapname) { globalentity_t *pEnt = Find(globalname); @@ -400,7 +375,6 @@ void CGlobalState::EntityUpdate(string_t globalname, string_t mapname) } } -/* <1dbbae> ../cstrike/dlls/world.cpp:453 */ void CGlobalState::ClearStates() { globalentity_t *pFree = m_pList; @@ -409,28 +383,25 @@ void CGlobalState::ClearStates() { globalentity_t *pNext = pFree->pNext; - free(pFree); + Q_free(pFree); pFree = pNext; } Reset(); } -/* <1dbc13> ../cstrike/dlls/world.cpp:466 */ void EXT_FUNC SaveGlobalState(SAVERESTOREDATA *pSaveData) { CSave saveHelper(pSaveData); gGlobalState.Save(saveHelper); } -/* <1dbcde> ../cstrike/dlls/world.cpp:473 */ void EXT_FUNC RestoreGlobalState(SAVERESTOREDATA *pSaveData) { CRestore restoreHelper(pSaveData); gGlobalState.Restore(restoreHelper); } -/* <1dbe72> ../cstrike/dlls/world.cpp:480 */ void EXT_FUNC ResetGlobalState() { gGlobalState.ClearStates(); @@ -439,10 +410,8 @@ void EXT_FUNC ResetGlobalState() gInitHUD = TRUE; } -/* <1dbeff> ../cstrike/dlls/world.cpp:493 */ LINK_ENTITY_TO_CLASS(worldspawn, CWorld); -/* <1dad1d> ../cstrike/dlls/world.cpp:502 */ void CWorld::__MAKE_VHOOK(Spawn)() { EmptyEntityHashTable(); @@ -461,8 +430,8 @@ void CWorld::__MAKE_VHOOK(Spawn)() Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2); #ifdef REGAMEDLL_FIXES - g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = 0; -#endif // REGAMEDLL_FIXES + g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = '\0'; +#endif PRECACHE_GENERIC(UTIL_VarArgs("maps/%s.txt", STRING(gpGlobals->mapname))); FREE_FILE(pFile); @@ -475,8 +444,8 @@ void CWorld::__MAKE_VHOOK(Spawn)() { Q_strncpy(g_szMapBriefingText, pFile, ARRAYSIZE(g_szMapBriefingText) - 2); #ifdef REGAMEDLL_FIXES - g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = 0; -#endif // REGAMEDLL_FIXES + g_szMapBriefingText[ ARRAYSIZE(g_szMapBriefingText) - 2 ] = '\0'; +#endif PRECACHE_GENERIC(UTIL_VarArgs("maps/default.txt")); } @@ -485,7 +454,6 @@ void CWorld::__MAKE_VHOOK(Spawn)() } } -/* <1dac06> ../cstrike/dlls/world.cpp:542 */ void CWorld::__MAKE_VHOOK(Precache)() { g_pLastSpawn = NULL; @@ -500,24 +468,27 @@ void CWorld::__MAKE_VHOOK(Precache)() CVAR_SET_STRING("room_type", "0"); // Set up game rules - if (g_pGameRules) + if (g_pGameRules != NULL) { delete g_pGameRules; } - g_pGameRules = (CHalfLifeMultiplay *)InstallGameRules(); + g_pGameRules = InstallGameRules(); // UNDONE why is there so much Spawn code in the Precache function? I'll just keep it here // LATER - do we want a sound ent in deathmatch? (sjb) //pSoundEnt = CBaseEntity::Create("soundent", g_vecZero, g_vecZero, edict()); pSoundEnt = GetClassPtr((CSoundEnt *)NULL); - pSoundEnt->Spawn(); - if (!pSoundEnt) + if (pSoundEnt == NULL) { ALERT(at_console, "**COULD NOT CREATE SOUNDENT**\n"); } + else + { + pSoundEnt->Spawn(); + } InitBodyQue(); @@ -550,7 +521,7 @@ void CWorld::__MAKE_VHOOK(Precache)() PRECACHE_SOUND("common/bodydrop3.wav"); PRECACHE_SOUND("common/bodydrop4.wav"); - g_Language = (int)CVAR_GET_FLOAT("sv_language"); + g_Language = int(CVAR_GET_FLOAT("sv_language")); if (g_Language == LANGUAGE_GERMAN) { PRECACHE_MODEL("models/germangibs.mdl"); @@ -681,7 +652,6 @@ void CWorld::__MAKE_VHOOK(Precache)() gDisplayTitle = FALSE; } -/* <1db153> ../cstrike/dlls/world.cpp:731 */ void CWorld::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "skyname")) @@ -696,7 +666,7 @@ void CWorld::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } else if (FStrEq(pkvd->szKeyName, "WaveHeight")) { - pev->scale = Q_atof(pkvd->szValue) * 0.125; + pev->scale = Q_atof(pkvd->szValue) * 0.125f; CVAR_SET_FLOAT("sv_wateramp", pev->scale); pkvd->fHandled = TRUE; } @@ -722,7 +692,7 @@ void CWorld::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) else if (FStrEq(pkvd->szKeyName, "newunit")) { if (Q_atoi(pkvd->szValue)) - CVAR_SET_FLOAT("sv_newunit", 1.0); + CVAR_SET_FLOAT("sv_newunit", 1.0f); pkvd->fHandled = TRUE; } diff --git a/regamedll/dlls/wpn_shared/wpn_ak47.cpp b/regamedll/dlls/wpn_shared/wpn_ak47.cpp index dd46e8c8..93fdae7a 100644 --- a/regamedll/dlls/wpn_shared/wpn_ak47.cpp +++ b/regamedll/dlls/wpn_shared/wpn_ak47.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <23556d> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_ak47, CAK47); -/* <235327> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:52 */ void CAK47::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CAK47::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <235280> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:66 */ void CAK47::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_ak47.mdl"); @@ -34,7 +31,6 @@ void CAK47::__MAKE_VHOOK(Precache)() m_usFireAK47 = PRECACHE_EVENT(1, "events/ak47.sc"); } -/* <2352a7> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:82 */ int CAK47::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -52,7 +48,6 @@ int CAK47::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <235300> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:99 */ BOOL CAK47::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.2f; @@ -62,13 +57,11 @@ BOOL CAK47::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_ak47.mdl", "models/p_ak47.mdl", AK47_DRAW, "ak47", UseDecrement() != FALSE); } -/* <2352da> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:108 */ void CAK47::__MAKE_VHOOK(SecondaryAttack)() { ; } -/* <235523> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:112 */ void CAK47::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -85,7 +78,6 @@ void CAK47::__MAKE_VHOOK(PrimaryAttack)() } } -/* <235637> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:123 */ void CAK47::AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -131,10 +123,10 @@ void CAK47::AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAK47, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; @@ -166,14 +158,13 @@ void CAK47::AK47Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <2353d8> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:204 */ void CAK47::__MAKE_VHOOK(Reload)() { #ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_762nato <= 0) return; -#endif // REGAMEDLL_FIXES +#endif if (DefaultReload(AK47_MAX_CLIP, AK47_RELOAD, AK47_RELOAD_TIME)) { @@ -185,7 +176,6 @@ void CAK47::__MAKE_VHOOK(Reload)() } } -/* <23539d> ../cstrike/dlls/wpn_shared/wpn_ak47.cpp:219 */ void CAK47::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_aug.cpp b/regamedll/dlls/wpn_shared/wpn_aug.cpp index bd45dcb4..eda5b874 100644 --- a/regamedll/dlls/wpn_shared/wpn_aug.cpp +++ b/regamedll/dlls/wpn_shared/wpn_aug.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <23a81f> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_aug, CAUG); -/* <23a711> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:52 */ void CAUG::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CAUG::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <23a66a> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:66 */ void CAUG::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_aug.mdl"); @@ -35,7 +32,6 @@ void CAUG::__MAKE_VHOOK(Precache)() m_usFireAug = PRECACHE_EVENT(1, "events/aug.sc"); } -/* <23a691> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:83 */ int CAUG::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -53,7 +49,6 @@ int CAUG::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <23a6ea> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:100 */ BOOL CAUG::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.2f; @@ -63,7 +58,6 @@ BOOL CAUG::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_aug.mdl", "models/p_aug.mdl", AUG_DRAW, "carbine", UseDecrement() != FALSE); } -/* <23a6c4> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:109 */ void CAUG::__MAKE_VHOOK(SecondaryAttack)() { if (m_pPlayer->m_iFOV == DEFAULT_FOV) @@ -74,7 +68,6 @@ void CAUG::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f; } -/* <23aa31> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:130 */ void CAUG::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -95,7 +88,6 @@ void CAUG::__MAKE_VHOOK(PrimaryAttack)() } } -/* <23a8e9> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:143 */ void CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -144,10 +136,10 @@ void CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAug, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -176,7 +168,6 @@ void CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <23a7c2> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:225 */ void CAUG::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_556nato <= 0) @@ -197,7 +188,6 @@ void CAUG::__MAKE_VHOOK(Reload)() } } -/* <23a787> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:245 */ void CAUG::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_awp.cpp b/regamedll/dlls/wpn_shared/wpn_awp.cpp index cd05652b..47e6f3d2 100644 --- a/regamedll/dlls/wpn_shared/wpn_awp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_awp.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <23fdac> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_awp, CAWP); -/* <23fb10> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:52 */ void CAWP::__MAKE_VHOOK(Spawn)() { Precache(); @@ -15,7 +13,6 @@ void CAWP::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <23fa2c> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:64 */ void CAWP::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_awp.mdl"); @@ -35,7 +32,6 @@ void CAWP::__MAKE_VHOOK(Precache)() m_usFireAWP = PRECACHE_EVENT(1, "events/awp.sc"); } -/* <23fa53> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:83 */ int CAWP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -53,7 +49,6 @@ int CAWP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <23fc19> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:100 */ BOOL CAWP::__MAKE_VHOOK(Deploy)() { if (DefaultDeploy("models/v_awp.mdl", "models/p_awp.mdl", AWP_DRAW, "rifle", UseDecrement() != FALSE)) @@ -68,7 +63,6 @@ BOOL CAWP::__MAKE_VHOOK(Deploy)() return FALSE; } -/* <23faac> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:113 */ void CAWP::__MAKE_VHOOK(SecondaryAttack)() { switch (m_pPlayer->m_iFOV) @@ -89,7 +83,6 @@ void CAWP::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3; } -/* <23fd53> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:143 */ void CAWP::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -114,7 +107,6 @@ void CAWP::__MAKE_VHOOK(PrimaryAttack)() } } -/* <23fe76> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:157 */ void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -170,10 +162,10 @@ void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAWP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -186,7 +178,6 @@ void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) m_pPlayer->pev->punchangle.x -= 2.0f; } -/* <23fbc1> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:239 */ void CAWP::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_338mag <= 0) @@ -206,7 +197,6 @@ void CAWP::__MAKE_VHOOK(Reload)() } } -/* <23fb86> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:265 */ void CAWP::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -219,7 +209,6 @@ void CAWP::__MAKE_VHOOK(WeaponIdle)() } } -/* <23fa86> ../cstrike/dlls/wpn_shared/wpn_awp.cpp:283 */ float CAWP::__MAKE_VHOOK(GetMaxSpeed)() { if (m_pPlayer->m_iFOV == DEFAULT_FOV) diff --git a/regamedll/dlls/wpn_shared/wpn_c4.cpp b/regamedll/dlls/wpn_shared/wpn_c4.cpp index a42acc25..3b276d75 100644 --- a/regamedll/dlls/wpn_shared/wpn_c4.cpp +++ b/regamedll/dlls/wpn_shared/wpn_c4.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <246a03> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:48 */ LINK_ENTITY_TO_CLASS(weapon_c4, CC4); -/* <2469b9> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:50 */ void CC4::__MAKE_VHOOK(Spawn)() { SET_MODEL(edict(), "models/w_backpack.mdl"); @@ -31,7 +29,6 @@ void CC4::__MAKE_VHOOK(Spawn)() pev->nextthink = UTIL_WeaponTimeBase() + 0.1f; } -/* <246418> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:80 */ void CC4::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_c4.mdl"); @@ -40,7 +37,6 @@ void CC4::__MAKE_VHOOK(Precache)() PRECACHE_SOUND("weapons/c4_click.wav"); } -/* <24643f> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:88 */ int CC4::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -58,7 +54,6 @@ int CC4::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2466d5> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:105 */ BOOL CC4::__MAKE_VHOOK(Deploy)() { pev->body = 0; @@ -75,10 +70,9 @@ BOOL CC4::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_c4.mdl", "models/p_c4.mdl", C4_DRAW, "c4", UseDecrement() != FALSE); } -/* <2466fc> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:123 */ void CC4::__MAKE_VHOOK(Holster)(int skiplocal) { - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; m_bStartedArming = false; // stop arming sequence if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) @@ -94,19 +88,14 @@ void CC4::__MAKE_VHOOK(Holster)(int skiplocal) } } -/* <2464e8> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:152 */ void CC4::__MAKE_VHOOK(PrimaryAttack)() { - BOOL PlaceBomb; - if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) - { return; - } int inBombZone = (m_pPlayer->m_signals.GetState() & SIGNAL_BOMB) == SIGNAL_BOMB; int onGround = (m_pPlayer->pev->flags & FL_ONGROUND) == FL_ONGROUND; - PlaceBomb = (onGround && inBombZone); + bool bPlaceBomb = (onGround && inBombZone); if (!m_bStartedArming) { @@ -139,7 +128,7 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)() } else { - if (PlaceBomb) + if (bPlaceBomb) { CBaseEntity *pEntity = NULL; CBasePlayer *pTempPlayer = NULL; @@ -154,9 +143,9 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)() Broadcast("BOMBPL"); m_pPlayer->m_bHasC4 = false; - if (pev->speed != 0 && g_pGameRules != NULL) + if (pev->speed != 0 && CSGameRules() != NULL) { - g_pGameRules->m_iC4Timer = (int)pev->speed; + CSGameRules()->m_iC4Timer = int(pev->speed); } CGrenade *pBomb = CGrenade::ShootSatchelCharge(m_pPlayer->pev, m_pPlayer->pev->origin, Vector(0, 0, 0)); @@ -182,7 +171,7 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)() TheBots->OnEvent(EVENT_BOMB_PLANTED, m_pPlayer, pBomb); } - if (TheCareerTasks != NULL && g_pGameRules->IsCareer() && !m_pPlayer->IsBot()) + if (TheCareerTasks != NULL && CSGameRules()->IsCareer() && !m_pPlayer->IsBot()) { TheCareerTasks->HandleEvent(EVENT_BOMB_PLANTED, m_pPlayer); } @@ -205,9 +194,8 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)() // No more c4! m_pPlayer->SetBombIcon(FALSE); - --m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]; - if (!m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) + if (--m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) { RetireWeapon(); return; @@ -216,7 +204,7 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)() } else { - if (m_fArmedTime - 0.75 <= gpGlobals->time && !m_bBombPlacedAnimation) + if (m_fArmedTime - 0.75f <= gpGlobals->time && !m_bBombPlacedAnimation) { // call the c4 Placement animation m_bBombPlacedAnimation = true; @@ -256,7 +244,6 @@ void CC4::__MAKE_VHOOK(PrimaryAttack)() m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT(10, 15); } -/* <2464c1> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:358 */ void CC4::__MAKE_VHOOK(WeaponIdle)() { if (m_bStartedArming) @@ -290,7 +277,6 @@ void CC4::__MAKE_VHOOK(WeaponIdle)() } } -/* <2468b7> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:399 */ void CC4::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "detonatedelay")) @@ -314,7 +300,6 @@ void CC4::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) } } -/* <24674f> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:419 */ void CC4::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (m_pPlayer != NULL) @@ -329,9 +314,9 @@ void CC4::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T edict_t *m_pentOldCurBombTarget = pPlayer->m_pentCurBombTarget; pPlayer->m_pentCurBombTarget = NULL; - if (pev->speed != 0 && g_pGameRules) + if (pev->speed != 0 && CSGameRules() != NULL) { - g_pGameRules->m_iC4Timer = (int)pev->speed; + CSGameRules()->m_iC4Timer = int(pev->speed); } EMIT_SOUND(edict(), CHAN_WEAPON, "weapons/c4_plant.wav", VOL_NORM, ATTN_NORM); @@ -354,7 +339,6 @@ void CC4::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T } } -/* <2463cc> ../cstrike/dlls/weapons.h:732 */ float CC4::__MAKE_VHOOK(GetMaxSpeed)() { return C4_MAX_SPEED; diff --git a/regamedll/dlls/wpn_shared/wpn_deagle.cpp b/regamedll/dlls/wpn_shared/wpn_deagle.cpp index ba0fe4ea..48f5310e 100644 --- a/regamedll/dlls/wpn_shared/wpn_deagle.cpp +++ b/regamedll/dlls/wpn_shared/wpn_deagle.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <24be52> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:49 */ LINK_ENTITY_TO_CLASS(weapon_deagle, CDEAGLE); -/* <24bbe5> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:51 */ void CDEAGLE::__MAKE_VHOOK(Spawn)() { Precache(); @@ -19,7 +17,6 @@ void CDEAGLE::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <24bb64> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:68 */ void CDEAGLE::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_deagle.mdl"); @@ -36,7 +33,6 @@ void CDEAGLE::__MAKE_VHOOK(Precache)() m_usFireDeagle = PRECACHE_EVENT(1, "events/deagle.sc"); } -/* <24bb8b> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:86 */ int CDEAGLE::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -54,7 +50,6 @@ int CDEAGLE::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <24bccf> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:103 */ BOOL CDEAGLE::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.9f; @@ -68,7 +63,6 @@ BOOL CDEAGLE::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_deagle.mdl", "models/p_deagle.mdl", DEAGLE_DRAW, "onehanded", UseDecrement() != FALSE); } -/* <24be08> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:119 */ void CDEAGLE::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -89,13 +83,11 @@ void CDEAGLE::__MAKE_VHOOK(PrimaryAttack)() } } -/* <24bbbe> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:131 */ void CDEAGLE::__MAKE_VHOOK(SecondaryAttack)() { ShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN); } -/* <24bf1c> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:137 */ void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi) { Vector vecAiming, vecSrc, vecDir; @@ -159,10 +151,10 @@ void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireDeagle, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -176,7 +168,6 @@ void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi) ResetPlayerShieldAnim(); } -/* <24bc95> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:231 */ void CDEAGLE::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_50ae <= 0) @@ -189,7 +180,6 @@ void CDEAGLE::__MAKE_VHOOK(Reload)() } } -/* <24bc5b> ../cstrike/dlls/wpn_shared/wpn_deagle.cpp:243 */ void CDEAGLE::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_elite.cpp b/regamedll/dlls/wpn_shared/wpn_elite.cpp index ba9ff2fb..30540160 100644 --- a/regamedll/dlls/wpn_shared/wpn_elite.cpp +++ b/regamedll/dlls/wpn_shared/wpn_elite.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <25137f> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:52 */ LINK_ENTITY_TO_CLASS(weapon_elite, CELITE); -/* <251034> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:54 */ void CELITE::__MAKE_VHOOK(Spawn)() { Precache(); @@ -17,7 +15,6 @@ void CELITE::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <250fb3> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:67 */ void CELITE::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_elite.mdl"); @@ -37,7 +34,6 @@ void CELITE::__MAKE_VHOOK(Precache)() m_usFireELITE_RIGHT = PRECACHE_EVENT(1, "events/elite_right.sc"); } -/* <250fda> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:86 */ int CELITE::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -55,7 +51,6 @@ int CELITE::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <25100d> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:103 */ BOOL CELITE::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.88f; @@ -68,7 +63,6 @@ BOOL CELITE::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_elite.mdl", "models/p_elite.mdl", ELITE_DRAW, "dualpistols", UseDecrement() != FALSE); } -/* <251335> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:114 */ void CELITE::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -89,7 +83,6 @@ void CELITE::__MAKE_VHOOK(PrimaryAttack)() } } -/* <251449> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:126 */ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) { float flTimeDiff; @@ -102,7 +95,7 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) flCycleTime -= 0.078f; #else flCycleTime -= 0.125f; -#endif // REGAMEDLL_FIXES +#endif if (++m_iShotsFired > 1) { @@ -160,7 +153,7 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif if (m_iWeaponState & WPNSTATE_ELITE_LEFT) { @@ -171,7 +164,7 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) 8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed); PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireELITE_LEFT, 0, (float *)&g_vecZero, (float *)&g_vecZero, flTimeDiff, vecDir.x, - (int)(vecDir.y * 100), m_iClip, FALSE, FALSE); + int(vecDir.y * 100), m_iClip, FALSE, FALSE); } else { @@ -182,7 +175,7 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) 8192, BULLET_PLAYER_9MM, 1, ELITE_DAMAGE, ELITE_RANGE_MODIFER, m_pPlayer->pev, true, m_pPlayer->random_seed); PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireELITE_RIGHT, 0, (float *)&g_vecZero, (float *)&g_vecZero, flTimeDiff, vecDir.x, - (int)(vecDir.y * 100), m_iClip, FALSE, FALSE); + int(vecDir.y * 100), m_iClip, FALSE, FALSE); } if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) @@ -194,7 +187,6 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) m_pPlayer->pev->punchangle.x -= 2.0f; } -/* <2510f8> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:239 */ void CELITE::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_9mm <= 0) @@ -207,7 +199,6 @@ void CELITE::__MAKE_VHOOK(Reload)() } } -/* <24fed7> ../cstrike/dlls/wpn_shared/wpn_elite.cpp:251 */ void CELITE::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_famas.cpp b/regamedll/dlls/wpn_shared/wpn_famas.cpp index 71eacd23..4e98f487 100644 --- a/regamedll/dlls/wpn_shared/wpn_famas.cpp +++ b/regamedll/dlls/wpn_shared/wpn_famas.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2c0549> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_famas, CFamas); -/* <2c0284> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:52 */ void CFamas::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CFamas::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2c01dc> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:66 */ void CFamas::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_famas.mdl"); @@ -37,7 +34,6 @@ void CFamas::__MAKE_VHOOK(Precache)() m_usFireFamas = PRECACHE_EVENT(1, "events/famas.sc"); } -/* <2c0203> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:85 */ int CFamas::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -55,7 +51,6 @@ int CFamas::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2c025d> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:102 */ BOOL CFamas::__MAKE_VHOOK(Deploy)() { m_iShotsFired = 0; @@ -68,7 +63,6 @@ BOOL CFamas::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_famas.mdl", "models/p_famas.mdl", FAMAS_DRAW, "carbine", UseDecrement() != FALSE); } -/* <2c0236> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:114 */ void CFamas::__MAKE_VHOOK(SecondaryAttack)() { if (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE) @@ -85,7 +79,6 @@ void CFamas::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f; } -/* <2c04fe> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:129 */ void CFamas::__MAKE_VHOOK(PrimaryAttack)() { if (m_pPlayer->pev->waterlevel == 3) @@ -111,12 +104,10 @@ void CFamas::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2c0613> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:152 */ void CFamas::FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL bFireBurst) { Vector vecAiming, vecSrc, vecDir; int flag; - //int mask; if (bFireBurst) { @@ -171,10 +162,10 @@ void CFamas::FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFamas, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 10000000), (int)(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 10000000), int(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -210,7 +201,6 @@ void CFamas::FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL } } -/* <2c0336> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:262 */ void CFamas::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_556nato <= 0) @@ -231,7 +221,6 @@ void CFamas::__MAKE_VHOOK(Reload)() } } -/* <2c02fa> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:284 */ void CFamas::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp b/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp index 1d4a1410..f8ca05e4 100644 --- a/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp +++ b/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <25698d> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:49 */ LINK_ENTITY_TO_CLASS(weapon_fiveseven, CFiveSeven); -/* <256720> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:51 */ void CFiveSeven::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CFiveSeven::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <25669f> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:66 */ void CFiveSeven::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_fiveseven.mdl"); @@ -35,7 +32,6 @@ void CFiveSeven::__MAKE_VHOOK(Precache)() m_usFireFiveSeven = PRECACHE_EVENT(1, "events/fiveseven.sc"); } -/* <2566c6> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:84 */ int CFiveSeven::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -53,7 +49,6 @@ int CFiveSeven::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <25680a> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:101 */ BOOL CFiveSeven::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.92f; @@ -67,7 +62,6 @@ BOOL CFiveSeven::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_fiveseven.mdl", "models/p_fiveseven.mdl", FIVESEVEN_DRAW, "onehanded", UseDecrement() != FALSE); } -/* <256943> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:117 */ void CFiveSeven::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -88,13 +82,11 @@ void CFiveSeven::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2566f9> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:129 */ void CFiveSeven::__MAKE_VHOOK(SecondaryAttack)() { ShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN); } -/* <256a57> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:134 */ void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi) { Vector vecAiming, vecSrc, vecDir; @@ -158,10 +150,10 @@ void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFiveSeven, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -175,7 +167,6 @@ void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi) ResetPlayerShieldAnim(); } -/* <2567d0> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:225 */ void CFiveSeven::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_57mm <= 0) @@ -188,7 +179,6 @@ void CFiveSeven::__MAKE_VHOOK(Reload)() } } -/* <256796> ../cstrike/dlls/wpn_shared/wpn_fiveseven.cpp:238 */ void CFiveSeven::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp index fd4626e4..2137a8fd 100644 --- a/regamedll/dlls/wpn_shared/wpn_flashbang.cpp +++ b/regamedll/dlls/wpn_shared/wpn_flashbang.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <25ba9b> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:37 */ LINK_ENTITY_TO_CLASS(weapon_flashbang, CFlashbang); -/* <25b72f> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:39 */ void CFlashbang::__MAKE_VHOOK(Spawn)() { Precache(); @@ -22,7 +20,6 @@ void CFlashbang::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <25b67a> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:58 */ void CFlashbang::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_flashbang.mdl"); @@ -33,7 +30,6 @@ void CFlashbang::__MAKE_VHOOK(Precache)() PRECACHE_SOUND("weapons/pinpull.wav"); } -/* <25b6a1> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:69 */ int CFlashbang::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -51,7 +47,6 @@ int CFlashbang::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <25b7df> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:87 */ BOOL CFlashbang::__MAKE_VHOOK(Deploy)() { m_flReleaseThrow = -1.0f; @@ -66,7 +61,6 @@ BOOL CFlashbang::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_flashbang.mdl", "models/p_flashbang.mdl", FLASHBANG_DRAW, "grenade", UseDecrement() != FALSE); } -/* <25b6fa> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:102 */ void CFlashbang::__MAKE_VHOOK(Holster)(int skiplocal) { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; @@ -81,7 +75,6 @@ void CFlashbang::__MAKE_VHOOK(Holster)(int skiplocal) m_flReleaseThrow = -1.0f; } -/* <25b7a5> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:118 */ void CFlashbang::__MAKE_VHOOK(PrimaryAttack)() { if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN) @@ -99,7 +92,6 @@ void CFlashbang::__MAKE_VHOOK(PrimaryAttack)() } } -/* <25bb65> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:133 */ bool CFlashbang::ShieldSecondaryFire(int iUpAnim, int iDownAnim) { if (!m_pPlayer->HasShield() || m_flStartThrow > 0) @@ -138,13 +130,11 @@ bool CFlashbang::ShieldSecondaryFire(int iUpAnim, int iDownAnim) return true; } -/* <25b81a> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:171 */ void CFlashbang::__MAKE_VHOOK(SecondaryAttack)() { ShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE); } -/* <25bb97> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:176 */ void CFlashbang::SetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -156,7 +146,6 @@ void CFlashbang::SetPlayerShieldAnim() Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren"); } -/* <25bbb9> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:187 */ void CFlashbang::ResetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -168,7 +157,6 @@ void CFlashbang::ResetPlayerShieldAnim() } } -/* <25a8bd> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:198 */ void CFlashbang::__MAKE_VHOOK(WeaponIdle)() { if (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f) @@ -257,7 +245,7 @@ void CFlashbang::__MAKE_VHOOK(WeaponIdle)() #else // TODO: This is a bug? iAnim = *(int *)&flRand; - #endif // REGAMEDLL_FIXES + #endif m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0f / 30.0f; } @@ -266,7 +254,6 @@ void CFlashbang::__MAKE_VHOOK(WeaponIdle)() } } -/* <25b6d4> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:315 */ BOOL CFlashbang::__MAKE_VHOOK(CanDeploy)() { return m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0; diff --git a/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp b/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp index 663a7c78..b6cb7dc1 100644 --- a/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp +++ b/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <260ef4> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:48 */ LINK_ENTITY_TO_CLASS(weapon_g3sg1, CG3SG1); -/* <260ca2> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:50 */ void CG3SG1::__MAKE_VHOOK(Spawn)() { Precache(); @@ -17,7 +15,6 @@ void CG3SG1::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <260b97> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:63 */ void CG3SG1::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_g3sg1.mdl"); @@ -33,7 +30,6 @@ void CG3SG1::__MAKE_VHOOK(Precache)() m_usFireG3SG1 = PRECACHE_EVENT(1, "events/g3sg1.sc"); } -/* <260bbe> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:79 */ int CG3SG1::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -51,14 +47,12 @@ int CG3SG1::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <260c7b> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:96 */ BOOL CG3SG1::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.2f; return DefaultDeploy("models/v_g3sg1.mdl", "models/p_g3sg1.mdl", G3SG1_DRAW, "mp5", UseDecrement() != FALSE); } -/* <260c17> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:102 */ void CG3SG1::__MAKE_VHOOK(SecondaryAttack)() { switch (m_pPlayer->m_iFOV) @@ -69,7 +63,7 @@ void CG3SG1::__MAKE_VHOOK(SecondaryAttack)() default: #else case 15: -#endif // REGAMEDLL_FIXES +#endif m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break; } @@ -84,7 +78,6 @@ void CG3SG1::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f; } -/* <260eaa> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:133 */ void CG3SG1::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -105,7 +98,6 @@ void CG3SG1::__MAKE_VHOOK(PrimaryAttack)() } } -/* <260dab> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:145 */ void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -166,10 +158,10 @@ void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireG3SG1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -184,7 +176,6 @@ void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) m_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75); } -/* <260d53> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:234 */ void CG3SG1::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_762nato <= 0) @@ -203,7 +194,6 @@ void CG3SG1::__MAKE_VHOOK(Reload)() } } -/* <260d18> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:260 */ void CG3SG1::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -219,7 +209,6 @@ void CG3SG1::__MAKE_VHOOK(WeaponIdle)() } } -/* <260bf1> ../cstrike/dlls/wpn_shared/wpn_g3sg1.cpp:277 */ float CG3SG1::__MAKE_VHOOK(GetMaxSpeed)() { return (m_pPlayer->m_iFOV == DEFAULT_FOV) ? G3SG1_MAX_SPEED : G3SG1_MAX_SPEED_ZOOM; diff --git a/regamedll/dlls/wpn_shared/wpn_galil.cpp b/regamedll/dlls/wpn_shared/wpn_galil.cpp index 019378ff..4743c7dc 100644 --- a/regamedll/dlls/wpn_shared/wpn_galil.cpp +++ b/regamedll/dlls/wpn_shared/wpn_galil.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2c5a1c> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_galil, CGalil); -/* <2c57b0> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:52 */ void CGalil::__MAKE_VHOOK(Spawn)() { Precache(); @@ -16,7 +14,6 @@ void CGalil::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2c5709> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:65 */ void CGalil::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_galil.mdl"); @@ -32,7 +29,6 @@ void CGalil::__MAKE_VHOOK(Precache)() m_usFireGalil = PRECACHE_EVENT(1, "events/galil.sc"); } -/* <2c5730> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:81 */ int CGalil::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -50,7 +46,6 @@ int CGalil::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2c5789> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:98 */ BOOL CGalil::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.2f; @@ -60,13 +55,11 @@ BOOL CGalil::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_galil.mdl", "models/p_galil.mdl", GALIL_DRAW, "ak47", UseDecrement() != FALSE); } -/* <2c5763> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:107 */ void CGalil::__MAKE_VHOOK(SecondaryAttack)() { ; } -/* <2c59d2> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:111 */ void CGalil::__MAKE_VHOOK(PrimaryAttack)() { if (m_pPlayer->pev->waterlevel == 3) @@ -90,7 +83,6 @@ void CGalil::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2c5ae6> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:129 */ void CGalil::GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -136,10 +128,10 @@ void CGalil::GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireGalil, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 10000000), (int)(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 10000000), int(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; @@ -171,14 +163,13 @@ void CGalil::GalilFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <2c5861> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:210 */ void CGalil::__MAKE_VHOOK(Reload)() { #ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_556nato <= 0) return; -#endif // REGAMEDLL_FIXES +#endif if (DefaultReload(GALIL_MAX_CLIP, GALIL_RELOAD, GALIL_RELOAD_TIME)) { @@ -190,7 +181,6 @@ void CGalil::__MAKE_VHOOK(Reload)() } } -/* <2c5826> ../cstrike/dlls/wpn_shared/wpn_galil.cpp:232 */ void CGalil::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_glock18.cpp b/regamedll/dlls/wpn_shared/wpn_glock18.cpp index 7f671703..09ec0b1b 100644 --- a/regamedll/dlls/wpn_shared/wpn_glock18.cpp +++ b/regamedll/dlls/wpn_shared/wpn_glock18.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2662bb> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:68 */ LINK_ENTITY_TO_CLASS(weapon_glock18, CGLOCK18); -/* <26611a> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:70 */ void CGLOCK18::__MAKE_VHOOK(Spawn)() { Precache(); @@ -22,7 +20,6 @@ void CGLOCK18::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2660c0> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:88 */ void CGLOCK18::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_glock18.mdl"); @@ -43,7 +40,6 @@ void CGLOCK18::__MAKE_VHOOK(Precache)() m_usFireGlock18 = PRECACHE_EVENT(1, "events/glock18.sc"); } -/* <2660e7> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:112 */ int CGLOCK18::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -61,7 +57,6 @@ int CGLOCK18::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <266281> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:129 */ BOOL CGLOCK18::__MAKE_VHOOK(Deploy)() { m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN; @@ -87,7 +82,6 @@ BOOL CGLOCK18::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_glock18.mdl", "models/p_glock18.mdl", GLOCK18_DRAW2, "onehanded", UseDecrement() != FALSE); } -/* <266246> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:156 */ void CGLOCK18::__MAKE_VHOOK(SecondaryAttack)() { if (ShieldSecondaryFire(GLOCK18_SHIELD_UP, GLOCK18_SHIELD_DOWN)) @@ -109,7 +103,6 @@ void CGLOCK18::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f; } -/* <2664c3> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:175 */ void CGLOCK18::__MAKE_VHOOK(PrimaryAttack)() { if (m_iWeaponState & WPNSTATE_GLOCK18_BURST_MODE) @@ -152,7 +145,6 @@ void CGLOCK18::__MAKE_VHOOK(PrimaryAttack)() } } -/* <266385> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:201 */ void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst) { Vector vecAiming, vecSrc, vecDir; @@ -226,10 +218,10 @@ void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireGlock18, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -251,7 +243,6 @@ void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst) ResetPlayerShieldAnim(); } -/* <2661e8> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:307 */ void CGLOCK18::__MAKE_VHOOK(Reload)() { int iResult; @@ -272,7 +263,6 @@ void CGLOCK18::__MAKE_VHOOK(Reload)() } } -/* <266190> ../cstrike/dlls/wpn_shared/wpn_glock18.cpp:329 */ void CGLOCK18::__MAKE_VHOOK(WeaponIdle)() { int iAnim; diff --git a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp index 0c24b926..f7f463f1 100644 --- a/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_hegrenade.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <26b3cd> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:38 */ LINK_ENTITY_TO_CLASS(weapon_hegrenade, CHEGrenade); -/* <26b07c> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:40 */ void CHEGrenade::__MAKE_VHOOK(Spawn)() { Precache(); @@ -22,7 +20,6 @@ void CHEGrenade::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <26afc7> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:59 */ void CHEGrenade::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_hegrenade.mdl"); @@ -36,7 +33,6 @@ void CHEGrenade::__MAKE_VHOOK(Precache)() m_usCreateExplosion = PRECACHE_EVENT(1, "events/createexplo.sc"); } -/* <26afee> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:74 */ int CHEGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -54,7 +50,6 @@ int CHEGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <26b12c> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:92 */ BOOL CHEGrenade::__MAKE_VHOOK(Deploy)() { m_flReleaseThrow = -1.0f; @@ -69,7 +64,6 @@ BOOL CHEGrenade::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_hegrenade.mdl", "models/p_hegrenade.mdl", HEGRENADE_DRAW, "grenade", UseDecrement() != FALSE); } -/* <26b047> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:107 */ void CHEGrenade::__MAKE_VHOOK(Holster)(int skiplocal) { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; @@ -84,7 +78,6 @@ void CHEGrenade::__MAKE_VHOOK(Holster)(int skiplocal) m_flReleaseThrow = -1.0f; } -/* <26b0f2> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:123 */ void CHEGrenade::__MAKE_VHOOK(PrimaryAttack)() { if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN) @@ -102,7 +95,6 @@ void CHEGrenade::__MAKE_VHOOK(PrimaryAttack)() } } -/* <26b497> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:138 */ bool CHEGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim) { if (!m_pPlayer->HasShield() || m_flStartThrow > 0) @@ -139,13 +131,11 @@ bool CHEGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim) return true; } -/* <26b167> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:176 */ void CHEGrenade::__MAKE_VHOOK(SecondaryAttack)() { ShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE); } -/* <26b4c9> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:181 */ void CHEGrenade::SetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -157,7 +147,6 @@ void CHEGrenade::SetPlayerShieldAnim() Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren"); } -/* <26b4eb> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:192 */ void CHEGrenade::ResetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -169,7 +158,6 @@ void CHEGrenade::ResetPlayerShieldAnim() } } -/* <26a24e> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:202 */ void CHEGrenade::__MAKE_VHOOK(WeaponIdle)() { if (m_flReleaseThrow == 0 && m_flStartThrow != 0.0f) @@ -261,7 +249,6 @@ void CHEGrenade::__MAKE_VHOOK(WeaponIdle)() } } -/* <26b021> ../cstrike/dlls/wpn_shared/wpn_hegrenade.cpp:303 */ BOOL CHEGrenade::__MAKE_VHOOK(CanDeploy)() { return m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0; diff --git a/regamedll/dlls/wpn_shared/wpn_knife.cpp b/regamedll/dlls/wpn_shared/wpn_knife.cpp index a38ceb54..ec757755 100644 --- a/regamedll/dlls/wpn_shared/wpn_knife.cpp +++ b/regamedll/dlls/wpn_shared/wpn_knife.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <270ca6> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:28 */ LINK_ENTITY_TO_CLASS(weapon_knife, CKnife); -/* <270586> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:53 */ void CKnife::__MAKE_VHOOK(Spawn)() { Precache(); @@ -17,7 +15,6 @@ void CKnife::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2704d2> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:66 */ void CKnife::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_knife.mdl"); @@ -37,7 +34,6 @@ void CKnife::__MAKE_VHOOK(Precache)() m_usKnife = PRECACHE_EVENT(1, "events/knife.sc"); } -/* <2704f9> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:85 */ int CKnife::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -58,7 +54,6 @@ int CKnife::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2707c0> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:102 */ BOOL CKnife::__MAKE_VHOOK(Deploy)() { EMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, "weapons/knife_deploy1.wav", 0.3, 2.4); @@ -77,13 +72,11 @@ BOOL CKnife::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_knife.mdl", "models/p_knife.mdl", KNIFE_DRAW, "knife", UseDecrement() != FALSE); } -/* <27052b> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:119 */ void CKnife::__MAKE_VHOOK(Holster)(int skiplocal) { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; } -/* <270d70> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:124 */ NOXREF void CKnife::WeaponAnimation(int iAnimation) { int flag; @@ -92,7 +85,7 @@ NOXREF void CKnife::WeaponAnimation(int iAnimation) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usKnife, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, @@ -101,7 +94,6 @@ NOXREF void CKnife::WeaponAnimation(int iAnimation) iAnimation, 2, 3, 4); } -/* <26f852> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:140 */ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity) { int i, j, k; @@ -149,13 +141,11 @@ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, fl } } -/* <2714ba> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:185 */ void CKnife::__MAKE_VHOOK(PrimaryAttack)() { Swing(TRUE); } -/* <270f18> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:190 */ void CKnife::SetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -171,7 +161,6 @@ void CKnife::SetPlayerShieldAnim() } } -/* <270f53> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:201 */ void CKnife::ResetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -183,7 +172,6 @@ void CKnife::ResetPlayerShieldAnim() } } -/* <270f75> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:211 */ bool CKnife::ShieldSecondaryFire(int iUpAnim, int iDownAnim) { if (!m_pPlayer->HasShield()) @@ -223,7 +211,6 @@ bool CKnife::ShieldSecondaryFire(int iUpAnim, int iDownAnim) return true; } -/* <270826> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:245 */ void CKnife::__MAKE_VHOOK(SecondaryAttack)() { if (!ShieldSecondaryFire(KNIFE_SHIELD_UP, KNIFE_SHIELD_DOWN)) @@ -233,19 +220,16 @@ void CKnife::__MAKE_VHOOK(SecondaryAttack)() } } -/* <27055f> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:254 */ void CKnife::Smack() { DecalGunshot(&m_trHit, BULLET_PLAYER_CROWBAR, false, m_pPlayer->pev, false); } -/* <271493> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:260 */ void CKnife::SwingAgain() { Swing(FALSE); } -/* <2705fc> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:265 */ void CKnife::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -263,7 +247,6 @@ void CKnife::__MAKE_VHOOK(WeaponIdle)() SendWeaponAnim(KNIFE_IDLE, UseDecrement() != FALSE); } -/* <270fa7> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:283 */ int CKnife::Swing(int fFirst) { int fDidHit = FALSE; @@ -377,7 +360,9 @@ int CKnife::Swing(int fFirst) ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); - if (pEntity != NULL) +#ifndef REGAMEDLL_FIXES + if (pEntity != NULL) // -V595 +#endif { if (pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE) { @@ -422,7 +407,7 @@ int CKnife::Swing(int fFirst) SetThink(&CKnife::Smack); pev->nextthink = UTIL_WeaponTimeBase() + 0.2f; - m_pPlayer->m_iWeaponVolume = (int)(flVol * KNIFE_WALLHIT_VOLUME); + m_pPlayer->m_iWeaponVolume = int(flVol * KNIFE_WALLHIT_VOLUME); ResetPlayerShieldAnim(); } @@ -436,7 +421,6 @@ int CKnife::Swing(int fFirst) return fDidHit; } -/* <2714e1> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:468 */ int CKnife::Stab(int fFirst) { int fDidHit = FALSE; @@ -510,7 +494,7 @@ int CKnife::Stab(int fFirst) float flDamage = 65.0f; - if (pEntity && pEntity->IsPlayer()) + if (pEntity != NULL && pEntity->IsPlayer()) { Vector2D vec2LOS; float flDot; @@ -536,7 +520,9 @@ int CKnife::Stab(int fFirst) pEntity->TraceAttack(m_pPlayer->pev, flDamage, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET)); ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); - if (pEntity != NULL) +#ifndef REGAMEDLL_FIXES + if (pEntity != NULL) // -V595 +#endif { if (pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE) { @@ -570,7 +556,7 @@ int CKnife::Stab(int fFirst) { // delay the decal a bit m_trHit = tr; - m_pPlayer->m_iWeaponVolume = (int)(flVol * KNIFE_WALLHIT_VOLUME); + m_pPlayer->m_iWeaponVolume = int(flVol * KNIFE_WALLHIT_VOLUME); SetThink(&CKnife::Smack); pev->nextthink = UTIL_WeaponTimeBase() + 0.2f; diff --git a/regamedll/dlls/wpn_shared/wpn_m249.cpp b/regamedll/dlls/wpn_shared/wpn_m249.cpp index f930b4b6..3ae242ee 100644 --- a/regamedll/dlls/wpn_shared/wpn_m249.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m249.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <276bbd> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:49 */ LINK_ENTITY_TO_CLASS(weapon_m249, CM249); -/* <276951> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:51 */ void CM249::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CM249::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2768d0> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:65 */ void CM249::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_m249.mdl"); @@ -36,7 +33,6 @@ void CM249::__MAKE_VHOOK(Precache)() m_usFireM249 = PRECACHE_EVENT(1, "events/m249.sc"); } -/* <2768f7> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:84 */ int CM249::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -54,7 +50,6 @@ int CM249::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <27692a> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:101 */ BOOL CM249::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.2f; @@ -64,7 +59,6 @@ BOOL CM249::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_m249.mdl", "models/p_m249.mdl", M249_DRAW, "m249", UseDecrement() != FALSE); } -/* <276b73> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:111 */ void CM249::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -81,7 +75,6 @@ void CM249::__MAKE_VHOOK(PrimaryAttack)() } } -/* <276c87> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:121 */ void CM249::M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -130,10 +123,10 @@ void CM249::M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM249, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -162,14 +155,13 @@ void CM249::M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <276a02> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:201 */ void CM249::__MAKE_VHOOK(Reload)() { #ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_556natobox <= 0) return; -#endif // REGAMEDLL_FIXES +#endif if (DefaultReload(M249_MAX_CLIP, M249_RELOAD, M249_RELOAD_TIME)) { @@ -181,7 +173,6 @@ void CM249::__MAKE_VHOOK(Reload)() } } -/* <2769c7> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:222 */ void CM249::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_m3.cpp b/regamedll/dlls/wpn_shared/wpn_m3.cpp index 2c089d4b..bfc61091 100644 --- a/regamedll/dlls/wpn_shared/wpn_m3.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m3.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <27bf59> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:52 */ LINK_ENTITY_TO_CLASS(weapon_m3, CM3); -/* <27be6d> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:54 */ void CM3::__MAKE_VHOOK(Spawn)() { Precache(); @@ -16,7 +14,6 @@ void CM3::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <27bc83> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:66 */ void CM3::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_m3.mdl"); @@ -33,7 +30,6 @@ void CM3::__MAKE_VHOOK(Precache)() m_usFireM3 = PRECACHE_EVENT(1, "events/m3.sc"); } -/* <27bcaa> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:84 */ int CM3::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -51,13 +47,11 @@ int CM3::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <27be46> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:103 */ BOOL CM3::__MAKE_VHOOK(Deploy)() { return DefaultDeploy("models/v_m3.mdl", "models/p_m3.mdl", M3_DRAW, "shotgun", UseDecrement() != FALSE); } -/* <27bcdd> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:109 */ void CM3::__MAKE_VHOOK(PrimaryAttack)() { Vector vecAiming, vecSrc, vecDir; @@ -108,7 +102,7 @@ void CM3::__MAKE_VHOOK(PrimaryAttack)() flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM3, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0, 0, 0, 0, FALSE, FALSE); @@ -139,7 +133,6 @@ void CM3::__MAKE_VHOOK(PrimaryAttack)() m_pPlayer->m_flEjectBrass = gpGlobals->time + 0.45f; } -/* <27bf1e> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:182 */ void CM3::__MAKE_VHOOK(Reload)() { if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == M3_MAX_CLIP) @@ -156,10 +149,8 @@ void CM3::__MAKE_VHOOK(Reload)() SendWeaponAnim(M3_START_RELOAD, UseDecrement() != FALSE); m_fInSpecialReload = 1; - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55f; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.55f; + m_flNextSecondaryAttack = m_flTimeWeaponIdle = m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55f; m_flNextPrimaryAttack = GetNextAttackDelay(0.55); - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.55f; } else if (m_fInSpecialReload == 1) { @@ -170,8 +161,7 @@ void CM3::__MAKE_VHOOK(Reload)() m_fInSpecialReload = 2; SendWeaponAnim(M3_RELOAD, UseDecrement()); - m_flNextReload = UTIL_WeaponTimeBase() + 0.45f; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.45f; + m_flTimeWeaponIdle = m_flNextReload = UTIL_WeaponTimeBase() + 0.45f; } else { @@ -182,7 +172,6 @@ void CM3::__MAKE_VHOOK(Reload)() } } -/* <27bee3> ../cstrike/dlls/wpn_shared/wpn_m3.cpp:228 */ void CM3::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_m4a1.cpp b/regamedll/dlls/wpn_shared/wpn_m4a1.cpp index d92e17ec..c0fe7010 100644 --- a/regamedll/dlls/wpn_shared/wpn_m4a1.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m4a1.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <281342> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:60 */ LINK_ENTITY_TO_CLASS(weapon_m4a1, CM4A1); -/* <281059> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:62 */ void CM4A1::__MAKE_VHOOK(Spawn)() { Precache(); @@ -19,7 +17,6 @@ void CM4A1::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <280fb2> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:77 */ void CM4A1::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_m4a1.mdl"); @@ -39,7 +36,6 @@ void CM4A1::__MAKE_VHOOK(Precache)() m_usFireM4A1 = PRECACHE_EVENT(1, "events/m4a1.sc"); } -/* <280fd9> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:97 */ int CM4A1::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -57,7 +53,6 @@ int CM4A1::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <281169> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:114 */ BOOL CM4A1::__MAKE_VHOOK(Deploy)() { m_bDelayFire = true; @@ -72,7 +67,6 @@ BOOL CM4A1::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_m4a1.mdl", "models/p_m4a1.mdl", M4A1_UNSIL_DRAW, "rifle", UseDecrement() != FALSE); } -/* <281032> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:127 */ void CM4A1::__MAKE_VHOOK(SecondaryAttack)() { if (m_iWeaponState & WPNSTATE_M4A1_SILENCED) @@ -88,12 +82,10 @@ void CM4A1::__MAKE_VHOOK(SecondaryAttack)() Q_strcpy(m_pPlayer->m_szAnimExtention, "rifle"); } - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.0; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0; + m_flTimeWeaponIdle = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.0f; m_flNextPrimaryAttack = GetNextAttackDelay(2.0); } -/* <2812fd> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:149 */ void CM4A1::__MAKE_VHOOK(PrimaryAttack)() { if (m_iWeaponState & WPNSTATE_M4A1_SILENCED) @@ -128,7 +120,6 @@ void CM4A1::__MAKE_VHOOK(PrimaryAttack)() } } -/* <28140c> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:173 */ void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -186,14 +177,14 @@ void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif #ifndef REGAMEDLL_FIXES --m_pPlayer->ammo_556nato; -#endif // REGAMEDLL_FIXES +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM4A1, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), (m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), (m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -222,7 +213,6 @@ void CM4A1::M4A1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <28110b> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:257 */ void CM4A1::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_556nato <= 0) @@ -238,7 +228,6 @@ void CM4A1::__MAKE_VHOOK(Reload)() } } -/* <2810cf> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:279 */ void CM4A1::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -253,7 +242,6 @@ void CM4A1::__MAKE_VHOOK(WeaponIdle)() SendWeaponAnim((m_iWeaponState & WPNSTATE_M4A1_SILENCED) == WPNSTATE_M4A1_SILENCED ? M4A1_IDLE : M4A1_UNSIL_IDLE, UseDecrement() != FALSE); } -/* <28100c> ../cstrike/dlls/wpn_shared/wpn_m4a1.cpp:296 */ float CM4A1::__MAKE_VHOOK(GetMaxSpeed)() { return M4A1_MAX_SPEED; diff --git a/regamedll/dlls/wpn_shared/wpn_mac10.cpp b/regamedll/dlls/wpn_shared/wpn_mac10.cpp index 9f2d1db2..8f671ee1 100644 --- a/regamedll/dlls/wpn_shared/wpn_mac10.cpp +++ b/regamedll/dlls/wpn_shared/wpn_mac10.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2867c0> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_mac10, CMAC10); -/* <28658a> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:52 */ void CMAC10::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CMAC10::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <286509> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:66 */ void CMAC10::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_mac10.mdl"); @@ -33,7 +30,6 @@ void CMAC10::__MAKE_VHOOK(Precache)() m_usFireMAC10 = PRECACHE_EVENT(1, "events/mac10.sc"); } -/* <286530> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:82 */ int CMAC10::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -51,7 +47,6 @@ int CMAC10::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <286563> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:99 */ BOOL CMAC10::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.15f; @@ -61,7 +56,6 @@ BOOL CMAC10::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_mac10.mdl", "models/p_mac10.mdl", MAC10_DRAW, "onehanded", UseDecrement() != FALSE); } -/* <286786> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:108 */ void CMAC10::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -74,7 +68,6 @@ void CMAC10::__MAKE_VHOOK(PrimaryAttack)() } } -/* <28688a> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:116 */ void CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -123,10 +116,10 @@ void CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMAC10, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -155,7 +148,6 @@ void CMAC10::MAC10Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <28663b> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:199 */ void CMAC10::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_45acp <= 0) @@ -170,7 +162,6 @@ void CMAC10::__MAKE_VHOOK(Reload)() } } -/* <286600> ../cstrike/dlls/wpn_shared/wpn_mac10.cpp:213 */ void CMAC10::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp b/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp index 65602703..a46b559f 100644 --- a/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp +++ b/regamedll/dlls/wpn_shared/wpn_mp5navy.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <28bbf6> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_mp5navy, CMP5N); -/* <28b9c0> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:52 */ void CMP5N::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CMP5N::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <28b93f> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:66 */ void CMP5N::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_mp5.mdl"); @@ -34,7 +31,6 @@ void CMP5N::__MAKE_VHOOK(Precache)() m_usFireMP5N = PRECACHE_EVENT(1, "events/mp5n.sc"); } -/* <28b966> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:83 */ int CMP5N::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -52,7 +48,6 @@ int CMP5N::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <28b999> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:100 */ BOOL CMP5N::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.0f; @@ -62,7 +57,6 @@ BOOL CMP5N::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_mp5.mdl", "models/p_mp5.mdl", MP5N_DRAW, "mp5", UseDecrement() != FALSE); } -/* <28bbbc> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:109 */ void CMP5N::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -75,7 +69,6 @@ void CMP5N::__MAKE_VHOOK(PrimaryAttack)() } } -/* <28bcc0> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:117 */ void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -121,10 +114,10 @@ void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireMP5N, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; @@ -156,7 +149,6 @@ void CMP5N::MP5NFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <28ba71> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:201 */ void CMP5N::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_9mm <= 0) @@ -171,7 +163,6 @@ void CMP5N::__MAKE_VHOOK(Reload)() } } -/* <28ba36> ../cstrike/dlls/wpn_shared/wpn_mp5navy.cpp:215 */ void CMP5N::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_p228.cpp b/regamedll/dlls/wpn_shared/wpn_p228.cpp index 46cbe7e0..f89b2ab3 100644 --- a/regamedll/dlls/wpn_shared/wpn_p228.cpp +++ b/regamedll/dlls/wpn_shared/wpn_p228.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <291149> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:63 */ LINK_ENTITY_TO_CLASS(weapon_p228, CP228); -/* <290eb8> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:65 */ void CP228::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CP228::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <290e37> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:80 */ void CP228::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_p228.mdl"); @@ -35,7 +32,6 @@ void CP228::__MAKE_VHOOK(Precache)() m_usFireP228 = PRECACHE_EVENT(1, "events/p228.sc"); } -/* <290e5e> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:98 */ int CP228::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -53,7 +49,6 @@ int CP228::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <290fc6> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:115 */ BOOL CP228::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.9f; @@ -67,7 +62,6 @@ BOOL CP228::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_p228.mdl", "models/p_p228.mdl", P228_DRAW, "onehanded", UseDecrement() != FALSE); } -/* <2910ff> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:130 */ void CP228::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -88,13 +82,11 @@ void CP228::__MAKE_VHOOK(PrimaryAttack)() } } -/* <290e91> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:142 */ void CP228::__MAKE_VHOOK(SecondaryAttack)() { ShieldSecondaryFire(SHIELDGUN_UP, SHIELDGUN_DOWN); } -/* <291213> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:147 */ void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi) { Vector vecAiming, vecSrc, vecDir; @@ -158,10 +150,10 @@ void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireP228, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), m_iClip == 0, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -175,7 +167,6 @@ void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi) ResetPlayerShieldAnim(); } -/* <290f69> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:241 */ void CP228::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_357sig <= 0) @@ -188,7 +179,6 @@ void CP228::__MAKE_VHOOK(Reload)() } } -/* <290f2e> ../cstrike/dlls/wpn_shared/wpn_p228.cpp:261 */ void CP228::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_p90.cpp b/regamedll/dlls/wpn_shared/wpn_p90.cpp index a006d489..a3945ac4 100644 --- a/regamedll/dlls/wpn_shared/wpn_p90.cpp +++ b/regamedll/dlls/wpn_shared/wpn_p90.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <29657d> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:49 */ LINK_ENTITY_TO_CLASS(weapon_p90, CP90); -/* <296337> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:51 */ void CP90::__MAKE_VHOOK(Spawn)() { Precache(); @@ -19,7 +17,6 @@ void CP90::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2962b6> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:66 */ void CP90::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_p90.mdl"); @@ -35,7 +32,6 @@ void CP90::__MAKE_VHOOK(Precache)() m_usFireP90 = PRECACHE_EVENT(1, "events/p90.sc"); } -/* <2962dd> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:83 */ int CP90::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -53,7 +49,6 @@ int CP90::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <296310> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:100 */ BOOL CP90::__MAKE_VHOOK(Deploy)() { m_iShotsFired = 0; @@ -65,7 +60,6 @@ BOOL CP90::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_p90.mdl", "models/p_p90.mdl", P90_DRAW, "carbine", UseDecrement() != FALSE); } -/* <296533> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:110 */ void CP90::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -82,7 +76,6 @@ void CP90::__MAKE_VHOOK(PrimaryAttack)() } } -/* <296647> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:120 */ void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -130,10 +123,10 @@ void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireP90, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), 5, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -162,7 +155,6 @@ void CP90::P90Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <2963e8> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:202 */ void CP90::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_57mm <= 0) @@ -177,7 +169,6 @@ void CP90::__MAKE_VHOOK(Reload)() } } -/* <2963ad> ../cstrike/dlls/wpn_shared/wpn_p90.cpp:216 */ void CP90::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -192,7 +183,6 @@ void CP90::__MAKE_VHOOK(WeaponIdle)() SendWeaponAnim(P90_IDLE1, UseDecrement() != FALSE); } -/* <29626a> ../cstrike/dlls/weapons.h:1052 */ float CP90::__MAKE_VHOOK(GetMaxSpeed)() { return P90_MAX_SPEED; diff --git a/regamedll/dlls/wpn_shared/wpn_scout.cpp b/regamedll/dlls/wpn_shared/wpn_scout.cpp index c019cf71..422bbf9e 100644 --- a/regamedll/dlls/wpn_shared/wpn_scout.cpp +++ b/regamedll/dlls/wpn_shared/wpn_scout.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <29ba7b> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:48 */ LINK_ENTITY_TO_CLASS(weapon_scout, CSCOUT); -/* <29b7ee> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:50 */ void CSCOUT::__MAKE_VHOOK(Spawn)() { Precache(); @@ -16,7 +14,6 @@ void CSCOUT::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <29b70a> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:62 */ void CSCOUT::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_scout.mdl"); @@ -32,7 +29,6 @@ void CSCOUT::__MAKE_VHOOK(Precache)() m_usFireScout = PRECACHE_EVENT(1, "events/scout.sc"); } -/* <29b731> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:79 */ int CSCOUT::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -50,7 +46,6 @@ int CSCOUT::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <29b8f7> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:96 */ BOOL CSCOUT::__MAKE_VHOOK(Deploy)() { if (DefaultDeploy("models/v_scout.mdl", "models/p_scout.mdl", SCOUT_DRAW, "rifle", UseDecrement() != FALSE)) @@ -64,7 +59,6 @@ BOOL CSCOUT::__MAKE_VHOOK(Deploy)() return FALSE; } -/* <29b78a> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:109 */ void CSCOUT::__MAKE_VHOOK(SecondaryAttack)() { switch (m_pPlayer->m_iFOV) @@ -75,7 +69,7 @@ void CSCOUT::__MAKE_VHOOK(SecondaryAttack)() default: #else case 15: -#endif // REGAMEDLL_FIXES +#endif m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break; } @@ -89,7 +83,6 @@ void CSCOUT::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3; } -/* <29ba31> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:140 */ void CSCOUT::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -110,7 +103,6 @@ void CSCOUT::__MAKE_VHOOK(PrimaryAttack)() } } -/* <29bb45> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:154 */ void CSCOUT::SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -163,10 +155,10 @@ void CSCOUT::SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireScout, 0, (float *)&g_vecZero, (float *)&m_pPlayer->pev->angles, (vecDir.x * 1000), (vecDir.y * 1000), - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), FALSE, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -179,14 +171,13 @@ void CSCOUT::SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) m_pPlayer->pev->punchangle.x -= 2.0f; } -/* <29b89e> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:232 */ void CSCOUT::__MAKE_VHOOK(Reload)() { #ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_762nato <= 0) return; -#endif // REGAMEDLL_FIXES +#endif if (DefaultReload(SCOUT_MAX_CLIP, SCOUT_RELOAD, SCOUT_RELOAD_TIME)) { @@ -200,7 +191,6 @@ void CSCOUT::__MAKE_VHOOK(Reload)() } } -/* <29b864> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:250 */ void CSCOUT::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -218,7 +208,6 @@ void CSCOUT::__MAKE_VHOOK(WeaponIdle)() } } -/* <29b764> ../cstrike/dlls/wpn_shared/wpn_scout.cpp:267 */ float CSCOUT::__MAKE_VHOOK(GetMaxSpeed)() { return (m_pPlayer->m_iFOV == DEFAULT_FOV) ? SCOUT_MAX_SPEED : SCOUT_MAX_SPEED_ZOOM; diff --git a/regamedll/dlls/wpn_shared/wpn_sg550.cpp b/regamedll/dlls/wpn_shared/wpn_sg550.cpp index d1cf6bad..5548c51e 100644 --- a/regamedll/dlls/wpn_shared/wpn_sg550.cpp +++ b/regamedll/dlls/wpn_shared/wpn_sg550.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2a0f39> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:48 */ LINK_ENTITY_TO_CLASS(weapon_sg550, CSG550); -/* <2a0ce8> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:50 */ void CSG550::__MAKE_VHOOK(Spawn)() { Precache(); @@ -17,7 +15,6 @@ void CSG550::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2a0bdd> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:63 */ void CSG550::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_sg550.mdl"); @@ -33,7 +30,6 @@ void CSG550::__MAKE_VHOOK(Precache)() m_usFireSG550 = PRECACHE_EVENT(1, "events/sg550.sc"); } -/* <2a0c04> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:79 */ int CSG550::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -51,13 +47,11 @@ int CSG550::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2a0cc1> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:96 */ BOOL CSG550::__MAKE_VHOOK(Deploy)() { return DefaultDeploy("models/v_sg550.mdl", "models/p_sg550.mdl", SG550_DRAW, "rifle", UseDecrement() != FALSE); } -/* <2a0c5d> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:101 */ void CSG550::__MAKE_VHOOK(SecondaryAttack)() { switch (m_pPlayer->m_iFOV) @@ -68,7 +62,7 @@ void CSG550::__MAKE_VHOOK(SecondaryAttack)() default: #else case 15: -#endif // REGAMEDLL_FIXES +#endif m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90; break; } @@ -83,7 +77,6 @@ void CSG550::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3; } -/* <2a0eef> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:132 */ void CSG550::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -104,7 +97,6 @@ void CSG550::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2a1003> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:144 */ void CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -161,10 +153,10 @@ void CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireSG550, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.x * 100), 5, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.x * 100), 5, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -179,7 +171,6 @@ void CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) m_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75); } -/* <2a0d98> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:227 */ void CSG550::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_556nato <= 0) @@ -197,7 +188,6 @@ void CSG550::__MAKE_VHOOK(Reload)() } } -/* <2a0d5e> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:248 */ void CSG550::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -215,7 +205,6 @@ void CSG550::__MAKE_VHOOK(WeaponIdle)() } } -/* <2a0c37> ../cstrike/dlls/wpn_shared/wpn_sg550.cpp:265 */ float CSG550::__MAKE_VHOOK(GetMaxSpeed)() { return (m_pPlayer->m_iFOV == DEFAULT_FOV) ? SG550_MAX_SPEED : SG550_MAX_SPEED_ZOOM; diff --git a/regamedll/dlls/wpn_shared/wpn_sg552.cpp b/regamedll/dlls/wpn_shared/wpn_sg552.cpp index de0d1268..20620e5e 100644 --- a/regamedll/dlls/wpn_shared/wpn_sg552.cpp +++ b/regamedll/dlls/wpn_shared/wpn_sg552.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2a61d9> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_sg552, CSG552); -/* <2a60cb> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:52 */ void CSG552::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CSG552::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2a5ffe> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:66 */ void CSG552::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_sg552.mdl"); @@ -34,7 +31,6 @@ void CSG552::__MAKE_VHOOK(Precache)() m_usFireSG552 = PRECACHE_EVENT(1, "events/sg552.sc"); } -/* <2a6025> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:83 */ int CSG552::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -52,7 +48,6 @@ int CSG552::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2a60a4> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:100 */ BOOL CSG552::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.2f; @@ -62,7 +57,6 @@ BOOL CSG552::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_sg552.mdl", "models/p_sg552.mdl", SG552_DRAW, "mp5", UseDecrement() != FALSE); } -/* <2a6058> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:109 */ void CSG552::__MAKE_VHOOK(SecondaryAttack)() { if (m_pPlayer->m_iFOV == DEFAULT_FOV) @@ -73,7 +67,6 @@ void CSG552::__MAKE_VHOOK(SecondaryAttack)() m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f; } -/* <2a63eb> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:130 */ void CSG552::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -94,7 +87,6 @@ void CSG552::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2a62a3> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:143 */ void CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -143,10 +135,10 @@ void CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireSG552, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), 5, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -175,7 +167,6 @@ void CSG552::SG552Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <2a617c> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:225 */ void CSG552::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_556nato <= 0) @@ -195,7 +186,6 @@ void CSG552::__MAKE_VHOOK(Reload)() } } -/* <2a6141> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:244 */ void CSG552::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); @@ -210,7 +200,6 @@ void CSG552::__MAKE_VHOOK(WeaponIdle)() SendWeaponAnim(SG552_IDLE1, UseDecrement() != FALSE); } -/* <2a607e> ../cstrike/dlls/wpn_shared/wpn_sg552.cpp:259 */ float CSG552::__MAKE_VHOOK(GetMaxSpeed)() { if (m_pPlayer->m_iFOV == DEFAULT_FOV) diff --git a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp index 9b2170ea..6eb07c76 100644 --- a/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp +++ b/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2ab333> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:38 */ LINK_ENTITY_TO_CLASS(weapon_smokegrenade, CSmokeGrenade); -/* <2aafc7> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:40 */ void CSmokeGrenade::__MAKE_VHOOK(Spawn)() { Precache(); @@ -22,7 +20,6 @@ void CSmokeGrenade::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2aaf12> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:59 */ void CSmokeGrenade::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_smokegrenade.mdl"); @@ -34,7 +31,6 @@ void CSmokeGrenade::__MAKE_VHOOK(Precache)() m_usCreateSmoke = PRECACHE_EVENT(1, "events/createsmoke.sc"); } -/* <2aaf39> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:71 */ int CSmokeGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -52,7 +48,6 @@ int CSmokeGrenade::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2ab077> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:89 */ BOOL CSmokeGrenade::__MAKE_VHOOK(Deploy)() { m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN; @@ -68,7 +63,6 @@ BOOL CSmokeGrenade::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_smokegrenade.mdl", "models/p_smokegrenade.mdl", SMOKEGRENADE_DRAW, "grenade", UseDecrement() != FALSE); } -/* <2aaf92> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:104 */ void CSmokeGrenade::__MAKE_VHOOK(Holster)(int skiplocal) { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; @@ -85,7 +79,6 @@ void CSmokeGrenade::__MAKE_VHOOK(Holster)(int skiplocal) m_flReleaseThrow = -1; } -/* <2ab03d> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:120 */ void CSmokeGrenade::__MAKE_VHOOK(PrimaryAttack)() { if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN) @@ -101,7 +94,6 @@ void CSmokeGrenade::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2ab3fd> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:135 */ bool CSmokeGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim) { if (!m_pPlayer->HasShield() || m_flStartThrow > 0) @@ -140,13 +132,11 @@ bool CSmokeGrenade::ShieldSecondaryFire(int iUpAnim, int iDownAnim) return true; } -/* <2ab0b2> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:173 */ void CSmokeGrenade::__MAKE_VHOOK(SecondaryAttack)() { ShieldSecondaryFire(SHIELDGUN_DRAW, SHIELDGUN_DRAWN_IDLE); } -/* <2ab42f> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:178 */ void CSmokeGrenade::SetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -158,7 +148,6 @@ void CSmokeGrenade::SetPlayerShieldAnim() Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren"); } -/* <2ab451> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:189 */ void CSmokeGrenade::ResetPlayerShieldAnim() { if (!m_pPlayer->HasShield()) @@ -170,7 +159,6 @@ void CSmokeGrenade::ResetPlayerShieldAnim() } } -/* <2aa17b> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:199 */ void CSmokeGrenade::__MAKE_VHOOK(WeaponIdle)() { if (m_flReleaseThrow == 0) @@ -275,7 +263,6 @@ void CSmokeGrenade::__MAKE_VHOOK(WeaponIdle)() } } -/* <2aaf6c> ../cstrike/dlls/wpn_shared/wpn_smokegrenade.cpp:310 */ BOOL CSmokeGrenade::__MAKE_VHOOK(CanDeploy)() { return m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] != 0; diff --git a/regamedll/dlls/wpn_shared/wpn_tmp.cpp b/regamedll/dlls/wpn_shared/wpn_tmp.cpp index 408a779c..d297fc07 100644 --- a/regamedll/dlls/wpn_shared/wpn_tmp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_tmp.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2b06f0> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_tmp, CTMP); -/* <2b04ba> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:52 */ void CTMP::__MAKE_VHOOK(Spawn)() { Precache(); @@ -19,7 +17,6 @@ void CTMP::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2b0439> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:67 */ void CTMP::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_tmp.mdl"); @@ -32,7 +29,6 @@ void CTMP::__MAKE_VHOOK(Precache)() m_usFireTMP = PRECACHE_EVENT(1, "events/tmp.sc"); } -/* <2b0460> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:81 */ int CTMP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -50,7 +46,6 @@ int CTMP::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2b0493> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:98 */ BOOL CTMP::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.2f; @@ -61,7 +56,6 @@ BOOL CTMP::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_tmp.mdl", "models/p_tmp.mdl", TMP_DRAW, "onehanded", UseDecrement() != FALSE); } -/* <2b06b6> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:108 */ void CTMP::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -74,7 +68,6 @@ void CTMP::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2b07ba> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:116 */ void CTMP::TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -121,10 +114,10 @@ void CTMP::TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireTMP, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), 5, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), 5, FALSE); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); @@ -153,14 +146,13 @@ void CTMP::TMPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <2b056b> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:197 */ void CTMP::__MAKE_VHOOK(Reload)() { #ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo if (m_pPlayer->ammo_9mm <= 0) return; -#endif // REGAMEDLL_FIXES +#endif if (DefaultReload(TMP_MAX_CLIP, TMP_RELOAD, TMP_RELOAD_TIME)) { @@ -171,7 +163,6 @@ void CTMP::__MAKE_VHOOK(Reload)() } } -/* <2b0530> ../cstrike/dlls/wpn_shared/wpn_tmp.cpp:211 */ void CTMP::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_ump45.cpp b/regamedll/dlls/wpn_shared/wpn_ump45.cpp index f7a2685b..51fec742 100644 --- a/regamedll/dlls/wpn_shared/wpn_ump45.cpp +++ b/regamedll/dlls/wpn_shared/wpn_ump45.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2b5b26> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:50 */ LINK_ENTITY_TO_CLASS(weapon_ump45, CUMP45); -/* <2b58f0> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:52 */ void CUMP45::__MAKE_VHOOK(Spawn)() { Precache(); @@ -18,7 +16,6 @@ void CUMP45::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2b586f> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:66 */ void CUMP45::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_ump45.mdl"); @@ -33,7 +30,6 @@ void CUMP45::__MAKE_VHOOK(Precache)() m_usFireUMP45 = PRECACHE_EVENT(1, "events/ump45.sc"); } -/* <2b5896> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:82 */ int CUMP45::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -41,7 +37,7 @@ int CUMP45::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) p->pszAmmo1 = "45acp"; #else p->pszAmmo1 = "45ACP"; -#endif // REGAMEDLL_FIXES +#endif p->iMaxAmmo1 = MAX_AMMO_45ACP; p->pszAmmo2 = NULL; p->iMaxAmmo2 = -1; @@ -55,7 +51,6 @@ int CUMP45::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2b58c9> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:99 */ BOOL CUMP45::__MAKE_VHOOK(Deploy)() { m_flAccuracy = 0.0f; @@ -65,7 +60,6 @@ BOOL CUMP45::__MAKE_VHOOK(Deploy)() return DefaultDeploy("models/v_ump45.mdl", "models/p_ump45.mdl", UMP45_DRAW, "carbine", UseDecrement() != FALSE); } -/* <2b5aec> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:108 */ void CUMP45::__MAKE_VHOOK(PrimaryAttack)() { if (!(m_pPlayer->pev->flags & FL_ONGROUND)) @@ -78,7 +72,6 @@ void CUMP45::__MAKE_VHOOK(PrimaryAttack)() } } -/* <2b5bf0> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:116 */ void CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { Vector vecAiming, vecSrc, vecDir; @@ -124,10 +117,10 @@ void CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireUMP45, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + int(m_pPlayer->pev->punchangle.x * 100), int(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; @@ -159,7 +152,6 @@ void CUMP45::UMP45Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } } -/* <2b59a1> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:200 */ void CUMP45::__MAKE_VHOOK(Reload)() { if (m_pPlayer->ammo_45acp <= 0) @@ -174,7 +166,6 @@ void CUMP45::__MAKE_VHOOK(Reload)() } } -/* <2b5966> ../cstrike/dlls/wpn_shared/wpn_ump45.cpp:214 */ void CUMP45::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/dlls/wpn_shared/wpn_usp.cpp b/regamedll/dlls/wpn_shared/wpn_usp.cpp index e9df1590..c35d2958 100644 --- a/regamedll/dlls/wpn_shared/wpn_usp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_usp.cpp @@ -104,8 +104,7 @@ void CUSP::__MAKE_VHOOK(SecondaryAttack)() Q_strcpy(m_pPlayer->m_szAnimExtention, "onehanded"); } - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f; - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0f; + m_flNextSecondaryAttack = m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f; m_flNextPrimaryAttack = GetNextAttackDelay(3.0); } @@ -292,4 +291,4 @@ void CUSP::__MAKE_VHOOK(WeaponIdle)() m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f; SendWeaponAnim(iAnim, UseDecrement()); } -} +} \ No newline at end of file diff --git a/regamedll/dlls/wpn_shared/wpn_xm1014.cpp b/regamedll/dlls/wpn_shared/wpn_xm1014.cpp index 0079865e..6b1d2c92 100644 --- a/regamedll/dlls/wpn_shared/wpn_xm1014.cpp +++ b/regamedll/dlls/wpn_shared/wpn_xm1014.cpp @@ -1,9 +1,7 @@ #include "precompiled.h" -/* <2cadb2> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:51 */ LINK_ENTITY_TO_CLASS(weapon_xm1014, CXM1014); -/* <2cacc6> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:53 */ void CXM1014::__MAKE_VHOOK(Spawn)() { Precache(); @@ -17,7 +15,6 @@ void CXM1014::__MAKE_VHOOK(Spawn)() FallInit(); } -/* <2caadc> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:65 */ void CXM1014::__MAKE_VHOOK(Precache)() { PRECACHE_MODEL("models/v_xm1014.mdl"); @@ -32,7 +29,6 @@ void CXM1014::__MAKE_VHOOK(Precache)() m_usFireXM1014 = PRECACHE_EVENT(1, "events/xm1014.sc"); } -/* <2cab03> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:81 */ int CXM1014::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { p->pszName = STRING(pev->classname); @@ -50,13 +46,11 @@ int CXM1014::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) return 1; } -/* <2cac9f> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:100 */ BOOL CXM1014::__MAKE_VHOOK(Deploy)() { return DefaultDeploy("models/v_xm1014.mdl", "models/p_xm1014.mdl", XM1014_DRAW, "m249", UseDecrement() != FALSE); } -/* <2cab36> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:106 */ void CXM1014::__MAKE_VHOOK(PrimaryAttack)() { Vector vecAiming, vecSrc, vecDir; @@ -107,10 +101,10 @@ void CXM1014::__MAKE_VHOOK(PrimaryAttack)() flag = FEV_NOTHOST; #else flag = 0; -#endif // CLIENT_WEAPONS +#endif PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireXM1014, 0, (float *)&g_vecZero, (float *)&g_vecZero, m_vVecAiming.x, m_vVecAiming.y, 7, - (int)(m_vVecAiming.x * 100), m_iClip == 0, FALSE); + int(m_vVecAiming.x * 100), m_iClip == 0, FALSE); if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) { @@ -137,7 +131,6 @@ void CXM1014::__MAKE_VHOOK(PrimaryAttack)() m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 7, 10); } -/* <2cad77> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:182 */ void CXM1014::__MAKE_VHOOK(Reload)() { if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == XM1014_MAX_CLIP) @@ -154,10 +147,8 @@ void CXM1014::__MAKE_VHOOK(Reload)() SendWeaponAnim(XM1014_START_RELOAD, UseDecrement() != FALSE); m_fInSpecialReload = 1; - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55f; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.55f; + m_flNextSecondaryAttack = m_flTimeWeaponIdle = m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.55f; m_flNextPrimaryAttack = GetNextAttackDelay(0.55); - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.55f; } else if (m_fInSpecialReload == 1) { @@ -174,8 +165,7 @@ void CXM1014::__MAKE_VHOOK(Reload)() SendWeaponAnim(XM1014_RELOAD, UseDecrement()); - m_flNextReload = UTIL_WeaponTimeBase() + 0.3f; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.3f; + m_flTimeWeaponIdle = m_flNextReload = UTIL_WeaponTimeBase() + 0.3f; } else { @@ -186,7 +176,6 @@ void CXM1014::__MAKE_VHOOK(Reload)() } } -/* <2cad3c> ../cstrike/dlls/wpn_shared/wpn_xm1014.cpp:231 */ void CXM1014::__MAKE_VHOOK(WeaponIdle)() { ResetEmptySound(); diff --git a/regamedll/engine/common.h b/regamedll/engine/common.h index 851fcaad..8254c3f1 100644 --- a/regamedll/engine/common.h +++ b/regamedll/engine/common.h @@ -82,6 +82,15 @@ typedef struct incomingtransfer_s #define printf2 _printf2 #define chatf _print_chat +#define Q_isspace isspace +#define Q_isalnum isalnum +#define Q_isalpha isalpha + +#define Q_malloc malloc +#define Q_calloc calloc +#define Q_alloca alloca +#define Q_free free + #define Q_close _close #define Q_write _write #define Q_memset memset @@ -97,6 +106,7 @@ typedef struct incomingtransfer_s #define Q_strncmp strncmp //#define Q_strcasecmp _stricmp // Use Q_stricmp //#define Q_strncasecmp _strnicmp // Use Q_strnicmp +#define Q_sscanf sscanf #define Q_strdup _strdup #define Q_stricmp _stricmp #define Q_strnicmp _strnicmp @@ -108,10 +118,25 @@ typedef struct incomingtransfer_s #define Q_snprintf _snprintf #define Q_atoi atoi #define Q_atof atof +#define Q_toupper toupper #define Q_memmove memmove //#define Q_strtoull strtoull //#define Q_FileNameCmp FileNameCmp #define Q_vsnprintf _vsnprintf #define Q_vsnwprintf _vsnwprintf +#define Q_abs abs +#define Q_fabs fabs +#define Q_tan tan +#define Q_atan atan +#define Q_atan2 atan2 +#define Q_acos acos +#define Q_cos cos +#define Q_sin sin +#define Q_sqrt sqrt +#define Q_pow pow +#define Q_fmod fmod +#define Q_fopen fopen +#define Q_fprintf fprintf +#define Q_fclose fclose #endif // COMMON_H diff --git a/regamedll/engine/unicode_strtools.cpp b/regamedll/engine/unicode_strtools.cpp index 02f4b792..294b6cc6 100644 --- a/regamedll/engine/unicode_strtools.cpp +++ b/regamedll/engine/unicode_strtools.cpp @@ -28,7 +28,6 @@ #include "precompiled.h" -/* ../engine/unicode_strtools.cpp:23 */ //----------------------------------------------------------------------------- // Purpose: determine if a uchar32 represents a valid Unicode code point //----------------------------------------------------------------------------- @@ -39,7 +38,6 @@ bool Q_IsValidUChar32(uchar32 uVal) return (uVal < 0x110000u) && ((uVal - 0x00D800u) > 0x7FFu) && ((uVal & 0xFFFFu) < 0xFFFEu) && ((uVal - 0x00FDD0u) > 0x1Fu); } -/* ../engine/unicode_strtools.cpp:50 */ int Q_UTF32ToUChar32(const uchar32 *pUTF32, uchar32 &uVal, bool &bErr) { if (Q_IsValidUChar32(pUTF32[0])) @@ -70,13 +68,11 @@ int Q_UTF32ToUChar32(const uchar32 *pUTF32, uchar32 &uVal, bool &bErr) } } -/* ../engine/unicode_strtools.cpp:57 */ int Q_UChar32ToUTF32Len(uchar32 uVal) { return (uVal > 0xFFFF) ? 2 : 1; } -/* ../engine/unicode_strtools.cpp:62 */ int Q_UChar32ToUTF32(uchar32 uVal, uchar32 *pUTF32) { if (uVal <= 0xFFFF) @@ -92,7 +88,6 @@ int Q_UChar32ToUTF32(uchar32 uVal, uchar32 *pUTF32) } } -/* ../engine/unicode_strtools.cpp:70 */ template< typename T_IN, typename T_OUT, @@ -103,12 +98,13 @@ template< > int Q_UnicodeConvertT(const T_IN *pIn, T_OUT *pOut, int nOutBytes, EStringConvertErrorPolicy ePolicy) { + if (nOutBytes == 0) + return 0; + int nOut = 0; if (pOut) { - int nMaxOut = nOutBytes / sizeof(T_OUT) - 1; - if (nMaxOut <= 0) - return 0; + int nMaxOut = nOutBytes / sizeof(T_OUT) - 1; // print symbols count while (*pIn) { @@ -155,17 +151,17 @@ int Q_UnicodeConvertT(const T_IN *pIn, T_OUT *pOut, int nOutBytes, EStringConver #ifndef REGAMEDLL_FIXES pOut[0] = 0; //FIXME: pOut is always null there //TODO: V522 Dereferencing of the null pointer 'pOut' might take place. -#endif // REGAMEDLL_FIXES +#endif return 0; } } } } + return (nOut + 1) * sizeof(T_OUT); } -/* ../engine/unicode_strtools.cpp:137 */ int Q_UChar32ToUTF8Len(uchar32 uVal) { if (uVal <= 0x7F) @@ -177,13 +173,11 @@ int Q_UChar32ToUTF8Len(uchar32 uVal) return 2; } -/* ../engine/unicode_strtools.cpp:152 */ int Q_UChar32ToUTF16Len(uchar32 uVal) { return (uVal > 0xFFFF) ? 2 : 1; } -/* ../engine/unicode_strtools.cpp:163 */ int Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out) { if (uVal <= 0xFFFF) @@ -199,7 +193,6 @@ int Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out) } } -/* ../engine/unicode_strtools.cpp:180 */ int Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out) { if (uVal <= 0x7F) @@ -230,7 +223,6 @@ int Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out) } } -/* ../engine/unicode_strtools.cpp:209 */ int Q_UTF16ToUChar32(const uchar16 *pUTF16, uchar32 &uValueOut, bool &bErrorOut) { if (Q_IsValidUChar32(pUTF16[0])) @@ -261,43 +253,36 @@ int Q_UTF16ToUChar32(const uchar16 *pUTF16, uchar32 &uValueOut, bool &bErrorOut) } } -/* ../engine/unicode_strtools.cpp:246 */ int Q_UTF8ToUTF16(const char *pUTF8, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy) { return Q_UnicodeConvertT(pUTF8, pUTF16, cubDestSizeInBytes, ePolicy); } -/* ../engine/unicode_strtools.cpp:254 */ int Q_UTF8ToUTF32(const char *pUTF8, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy) { return Q_UnicodeConvertT(pUTF8, pUTF32, cubDestSizeInBytes, ePolicy); } -/* ../engine/unicode_strtools.cpp:262 */ int Q_UTF16ToUTF8(const uchar16 *pUTF16, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy) { return Q_UnicodeConvertT(pUTF16, pUTF8, cubDestSizeInBytes, ePolicy); } -/* ../engine/unicode_strtools.cpp:270 */ NOXREF int Q_UTF16ToUTF32(const uchar16 *pUTF16, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy) { return Q_UnicodeConvertT(pUTF16, pUTF32, cubDestSizeInBytes, ePolicy); } -/* ../engine/unicode_strtools.cpp:278 */ int Q_UTF32ToUTF8(const uchar32 *pUTF32, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy) { return Q_UnicodeConvertT(pUTF32, pUTF8, cubDestSizeInBytes, ePolicy); } -/* ../engine/unicode_strtools.cpp:286 */ NOXREF int Q_UTF32ToUTF16(const uchar32 *pUTF32, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy) { return Q_UnicodeConvertT(pUTF32, pUTF16, cubDestSizeInBytes, ePolicy); } -/* ../engine/unicode_strtools.cpp:346 */ // Decode one character from a UTF-8 encoded string. Treats 6-byte CESU-8 sequences // as a single character, as if they were a correctly-encoded 4-byte UTF-8 sequence. int Q_UTF8ToUChar32(const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut) @@ -371,7 +356,6 @@ decodeFinishedMaybeCESU8: goto decodeFinished; } -/* ../engine/unicode_strtools.cpp:423 */ //----------------------------------------------------------------------------- // Purpose: Returns false if UTF-8 string contains invalid sequences. //----------------------------------------------------------------------------- @@ -391,7 +375,6 @@ qboolean Q_UnicodeValidate(const char *pUTF8) return true; } -/* ../engine/unicode_strtools.cpp:442 */ NOXREF int Q_UnicodeLength(const char *pUTF8) { int nChars = 0; @@ -409,7 +392,6 @@ NOXREF int Q_UnicodeLength(const char *pUTF8) return nChars; } -/* ../engine/unicode_strtools.cpp:459 */ NOXREF char *Q_UnicodeAdvance(char *pUTF8, int nChars) { uchar32 uVal = 0; @@ -424,7 +406,6 @@ NOXREF char *Q_UnicodeAdvance(char *pUTF8, int nChars) return pUTF8; } -/* ../engine/unicode_strtools.cpp:479 */ //----------------------------------------------------------------------------- // Purpose: returns true if a wide character is a "mean" space; that is, // if it is technically a space or punctuation, but causes disruptive @@ -470,7 +451,6 @@ bool Q_IsMeanSpaceW(uchar32 wch) return bIsMean; } -/* ../engine/unicode_strtools.cpp:566 */ bool Q_IsDeprecatedW(uchar16 wch) { bool bIsDeprecated = false; @@ -495,7 +475,6 @@ bool Q_IsDeprecatedW(uchar16 wch) return bIsDeprecated; } -/* ../engine/unicode_strtools.cpp:600 */ //----------------------------------------------------------------------------- // Purpose: strips trailing whitespace; returns pointer inside string just past // any leading whitespace. @@ -532,7 +511,6 @@ static uchar16 *StripWhitespaceWorker(uchar16 *pwch, int cchLength, bool *pbStri return pwch; } -/* ../engine/unicode_strtools.cpp:653 */ uchar16 *StripUnprintableWorker(uchar16 *pwch, bool *pbStrippedAny) { uchar16 *pwchSource = pwch; @@ -555,14 +533,15 @@ uchar16 *StripUnprintableWorker(uchar16 *pwch, bool *pbStrippedAny) return pwch; } -/* ../engine/unicode_strtools.cpp:691 */ qboolean Q_StripUnprintableAndSpace(char *pch) { bool bStrippedAny; bool bStrippedWhitespace; + int cch = Q_strlen(pch); int cubDest = (cch + 1) * sizeof(uchar16); - uchar16 *pwch_alloced = (uchar16 *)malloc(cubDest); + + uchar16 *pwch_alloced = (uchar16 *)Q_alloca(cubDest); bStrippedAny = false; bStrippedWhitespace = false; @@ -576,11 +555,9 @@ qboolean Q_StripUnprintableAndSpace(char *pch) Q_UTF16ToUTF8(pwch, pch, cch, STRINGCONVERT_ASSERT_REPLACE); } - free(pwch_alloced); return bStrippedAny; } -/* ../engine/unicode_strtools.cpp:717 */ NOXREF qboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut) { bool bError = false; @@ -588,7 +565,6 @@ NOXREF qboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut) return bError; } -/* ../engine/unicode_strtools.cpp:724 */ NOXREF int Q_UnicodeRepair(char *pUTF8) { return Q_UnicodeConvertT(pUTF8, pUTF8, 65535, STRINGCONVERT_SKIP); diff --git a/regamedll/engine/unicode_strtools.h b/regamedll/engine/unicode_strtools.h index ee213dab..82f234a0 100644 --- a/regamedll/engine/unicode_strtools.h +++ b/regamedll/engine/unicode_strtools.h @@ -71,18 +71,18 @@ int Q_UTF16ToUChar32(const uchar16 *pUTF16, uchar32 &uValueOut, bool &bErrorOut) int Q_UTF8ToUTF16(const char *pUTF8, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); int Q_UTF8ToUTF32(const char *pUTF8, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); int Q_UTF16ToUTF8(const uchar16 *pUTF16, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -NOXREF int Q_UTF16ToUTF32(const uchar16 *pUTF16, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +int Q_UTF16ToUTF32(const uchar16 *pUTF16, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); int Q_UTF32ToUTF8(const uchar32 *pUTF32, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -NOXREF int Q_UTF32ToUTF16(const uchar32 *pUTF32, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +int Q_UTF32ToUTF16(const uchar32 *pUTF32, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); int Q_UTF8ToUChar32(const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut); qboolean Q_UnicodeValidate(const char *pUTF8); -NOXREF int Q_UnicodeLength(const char *pUTF8); -NOXREF char *Q_UnicodeAdvance(char *pUTF8, int nChars); +int Q_UnicodeLength(const char *pUTF8); +char *Q_UnicodeAdvance(char *pUTF8, int nChars); //bool Q_IsMeanSpaceW(uchar16 wch); bool Q_IsDeprecatedW(uchar16 wch); uchar16 *StripUnprintableWorker(uchar16 *pwch, bool *pbStrippedAny); qboolean Q_StripUnprintableAndSpace(char *pch); -NOXREF qboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut); -NOXREF int Q_UnicodeRepair(char *pUTF8); +qboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut); +int Q_UnicodeRepair(char *pUTF8); #endif // UNICODE_STR_TOOLS_H diff --git a/regamedll/game_shared/bitvec.h b/regamedll/game_shared/bitvec.h index 61390644..a4c79848 100644 --- a/regamedll/game_shared/bitvec.h +++ b/regamedll/game_shared/bitvec.h @@ -80,14 +80,12 @@ private: unsigned int m_DWords[ NUM_DWORDS ]; }; -/* <2d39f8> ../game_shared/bitvec.h:73 */ inline CBitVecAccessor::CBitVecAccessor(uint32 *pDWords, int iBit) { m_pDWords = pDWords; m_iBit = iBit; } -/* <2d37d7> ../game_shared/bitvec.h:80 */ inline void CBitVecAccessor::operator=(int val) { if (val) @@ -96,20 +94,17 @@ inline void CBitVecAccessor::operator=(int val) m_pDWords[m_iBit >> 5] &= ~(uint32)(1 << (m_iBit & 31)); } -/* <2d3a63> ../game_shared/bitvec.h:88 */ inline CBitVecAccessor::operator uint32() { return m_pDWords[m_iBit >> 5] & (1 << (m_iBit & 31)); } -/* <2d3ac9> ../game_shared/bitvec.h:100 */ template inline int CBitVec::GetNumBits() { return NUM_BITS; } -/* <2d39cf> ../game_shared/bitvec.h:107 */ template inline CBitVec::CBitVec() { @@ -117,7 +112,6 @@ inline CBitVec::CBitVec() m_DWords[i] = 0; } -/* <2d3ae2> ../game_shared/bitvec.h:115 */ template inline void CBitVec::Init(int val) { @@ -127,7 +121,6 @@ inline void CBitVec::Init(int val) } } -/* <2d3ba8> ../game_shared/bitvec.h:125 */ template inline CBitVec &CBitVec::operator=(CBitVec const &other) { @@ -135,7 +128,6 @@ inline CBitVec &CBitVec::operator=(CBitVec const & return *this; } -/* <2d3a41> ../game_shared/bitvec.h:133 */ template inline CBitVecAccessor CBitVec::operator[](int i) { @@ -143,7 +135,6 @@ inline CBitVecAccessor CBitVec::operator[](int i) return CBitVecAccessor(m_DWords, i); } -/* <2d3b11> ../game_shared/bitvec.h:141 */ template inline bool CBitVec::operator==(CBitVec const &other) { @@ -156,14 +147,12 @@ inline bool CBitVec::operator==(CBitVec const &other) return true; } -/* <2d3b7f> ../game_shared/bitvec.h:152 */ template inline bool CBitVec::operator!=(CBitVec const &other) { return !(*this == other); } -/* <2d3bd1> ../game_shared/bitvec.h:165 */ template inline uint32 CBitVec::GetDWord(int i) { @@ -171,7 +160,6 @@ inline uint32 CBitVec::GetDWord(int i) return m_DWords[i]; } -/* <2d3a7d> ../game_shared/bitvec.h:173 */ template inline void CBitVec::SetDWord(int i, uint32 val) { diff --git a/regamedll/game_shared/bot/bot.cpp b/regamedll/game_shared/bot/bot.cpp index 7cc3c686..52573055 100644 --- a/regamedll/game_shared/bot/bot.cpp +++ b/regamedll/game_shared/bot/bot.cpp @@ -15,9 +15,8 @@ float g_flBotFullThinkInterval = 1.0 / 10.0; const char *BotArgs[4] = { NULL }; bool UseBotArgs = false; -#endif // HOOK_GAMEDLL +#endif -/* <48fed0> ../game_shared/bot/bot.cpp:28 */ CBot::CBot() { // the profile will be attached after this instance is constructed @@ -35,15 +34,12 @@ CBot::CBot() } // Prepare bot for action - -/* <48f6ef> ../game_shared/bot/bot.cpp:50 */ bool CBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile) { m_profile = profile; return true; } -/* <48fbbd> ../game_shared/bot/bot.cpp:57 */ void CBot::__MAKE_VHOOK(Spawn)() { // Let CBasePlayer set some things up @@ -73,14 +69,12 @@ void CBot::__MAKE_VHOOK(Spawn)() SpawnBot(); } -/* <48fa37> ../game_shared/bot/bot.cpp:88 */ Vector CBot::__MAKE_VHOOK(GetAutoaimVector)(float flDelta) { UTIL_MakeVectors(pev->v_angle + pev->punchangle); return gpGlobals->v_forward; } -/* <48ffa8> ../game_shared/bot/bot.cpp:97 */ void CBot::BotThink() { if (gpGlobals->time >= m_flNextBotThink) @@ -100,7 +94,6 @@ void CBot::BotThink() } } -/* <48f723> ../game_shared/bot/bot.cpp:119 */ void CBot::__MAKE_VHOOK(MoveForward)() { m_forwardSpeed = GetMoveSpeed(); @@ -110,7 +103,6 @@ void CBot::__MAKE_VHOOK(MoveForward)() m_buttonFlags &= ~IN_BACK; } -/* <48f761> ../game_shared/bot/bot.cpp:130 */ void CBot::__MAKE_VHOOK(MoveBackward)() { m_forwardSpeed = -GetMoveSpeed(); @@ -120,7 +112,6 @@ void CBot::__MAKE_VHOOK(MoveBackward)() m_buttonFlags &= ~IN_FORWARD; } -/* <48f79f> ../game_shared/bot/bot.cpp:140 */ void CBot::__MAKE_VHOOK(StrafeLeft)() { m_strafeSpeed = -GetMoveSpeed(); @@ -130,7 +121,6 @@ void CBot::__MAKE_VHOOK(StrafeLeft)() m_buttonFlags &= ~IN_MOVERIGHT; } -/* <48f7dd> ../game_shared/bot/bot.cpp:150 */ void CBot::__MAKE_VHOOK(StrafeRight)() { m_strafeSpeed = GetMoveSpeed(); @@ -140,7 +130,6 @@ void CBot::__MAKE_VHOOK(StrafeRight)() m_buttonFlags &= ~IN_MOVELEFT; } -/* <48fe00> ../game_shared/bot/bot.cpp:160 */ bool CBot::__MAKE_VHOOK(Jump)(bool mustJump) { if (IsJumping() || IsCrouching()) @@ -165,16 +154,12 @@ bool CBot::__MAKE_VHOOK(Jump)(bool mustJump) } // Zero any MoveForward(), Jump(), etc - -/* <48f81b> ../game_shared/bot/bot.cpp:187 */ void CBot::__MAKE_VHOOK(ClearMovement)() { ResetCommand(); } // Returns true if we are in the midst of a jump - -/* <48ffe7> ../game_shared/bot/bot.cpp:196 */ bool CBot::IsJumping() { // if long time after last jump, we can't be jumping @@ -192,37 +177,31 @@ bool CBot::IsJumping() return true; } -/* <48f859> ../game_shared/bot/bot.cpp:214 */ void CBot::__MAKE_VHOOK(Crouch)() { m_isCrouching = true; } -/* <48f87f> ../game_shared/bot/bot.cpp:220 */ void CBot::__MAKE_VHOOK(StandUp)() { m_isCrouching = false; } -/* <48f8a5> ../game_shared/bot/bot.cpp:227 */ void CBot::__MAKE_VHOOK(UseEnvironment)() { m_buttonFlags |= IN_USE; } -/* <48f8cb> ../game_shared/bot/bot.cpp:234 */ void CBot::__MAKE_VHOOK(PrimaryAttack)() { m_buttonFlags |= IN_ATTACK; } -/* <48f8f1> ../game_shared/bot/bot.cpp:240 */ void CBot::__MAKE_VHOOK(ClearPrimaryAttack)() { m_buttonFlags &= ~IN_ATTACK; } -/* <48f917> ../game_shared/bot/bot.cpp:246 */ void CBot::__MAKE_VHOOK(TogglePrimaryAttack)() { if (m_buttonFlags & IN_ATTACK) @@ -231,21 +210,17 @@ void CBot::__MAKE_VHOOK(TogglePrimaryAttack)() m_buttonFlags |= IN_ATTACK; } -/* <48f93d> ../game_shared/bot/bot.cpp:260 */ void CBot::__MAKE_VHOOK(SecondaryAttack)() { m_buttonFlags |= IN_ATTACK2; } -/* <48f963> ../game_shared/bot/bot.cpp:266 */ void CBot::__MAKE_VHOOK(Reload)() { m_buttonFlags |= IN_RELOAD; } // Returns ratio of ammo left to max ammo (1 = full clip, 0 = empty) - -/* <490008> ../game_shared/bot/bot.cpp:275 */ float CBot::GetActiveWeaponAmmoRatio() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -257,12 +232,10 @@ float CBot::GetActiveWeaponAmmoRatio() const if (weapon->m_iClip < 0) return 1.0f; - return (float)weapon->m_iClip / (float)weapon->iMaxClip(); + return float(weapon->m_iClip) / float(weapon->iMaxClip()); } // Return true if active weapon has an empty clip - -/* <490058> ../game_shared/bot/bot.cpp:293 */ bool CBot::IsActiveWeaponClipEmpty() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -274,27 +247,23 @@ bool CBot::IsActiveWeaponClipEmpty() const } // Return true if active weapon has no ammo at all - -/* <490096> ../game_shared/bot/bot.cpp:307 */ bool CBot::IsActiveWeaponOutOfAmmo() const { - CBasePlayerWeapon *gun = GetActiveWeapon(); + CBasePlayerWeapon *weapon = GetActiveWeapon(); - if (gun == NULL) + if (weapon == NULL) return true; - if (gun->m_iClip < 0) + if (weapon->m_iClip < 0) return false; - if (gun->m_iClip == 0 && m_rgAmmo[ gun->m_iPrimaryAmmoType ] <= 0) + if (weapon->m_iClip == 0 && m_rgAmmo[ weapon->m_iPrimaryAmmoType ] <= 0) return true; return false; } // Return true if looking thru weapon's scope - -/* <4900d4> ../game_shared/bot/bot.cpp:327 */ bool CBot::IsUsingScope() const { // if our field of view is less than 90, we're looking thru a scope (maybe only true for CS...) @@ -304,7 +273,6 @@ bool CBot::IsUsingScope() const return false; } -/* <48f989> ../game_shared/bot/bot.cpp:338 */ void CBot::__MAKE_VHOOK(ExecuteCommand)() { byte adjustedMSec; @@ -328,7 +296,6 @@ void CBot::__MAKE_VHOOK(ExecuteCommand)() PLAYER_RUN_MOVE(edict(), pev->v_angle, m_forwardSpeed, m_strafeSpeed, m_verticalSpeed, m_buttonFlags, 0, adjustedMSec); } -/* <4900fa> ../game_shared/bot/bot.cpp:362 */ void CBot::ResetCommand() { m_forwardSpeed = 0.0f; @@ -337,25 +304,22 @@ void CBot::ResetCommand() m_buttonFlags = 0; } -/* <49011b> ../game_shared/bot/bot.cpp:372 */ byte CBot::ThrottledMsec() const { int iNewMsec; // Estimate Msec to use for this command based on time passed from the previous command - iNewMsec = (int)((gpGlobals->time - m_flPreviousCommandTime) * 1000); + iNewMsec = int((gpGlobals->time - m_flPreviousCommandTime) * 1000); // Doh, bots are going to be slower than they should if this happens. // Upgrade that CPU or use less bots! if (iNewMsec > 255) iNewMsec = 255; - return (byte)iNewMsec; + return byte(iNewMsec); } // Do a "client command" - useful for invoking menu choices, etc. - -/* <49016e> ../game_shared/bot/bot.cpp:389 */ void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3) { BotArgs[0] = cmd; @@ -369,8 +333,6 @@ void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, co } // Returns TRUE if given entity is our enemy - -/* <4901ac> ../game_shared/bot/bot.cpp:410 */ bool CBot::IsEnemy(CBaseEntity *ent) const { // only Players (real and AI) can be enemies @@ -392,12 +354,9 @@ bool CBot::IsEnemy(CBaseEntity *ent) const } // Return number of enemies left alive - -/* <49021a> ../game_shared/bot/bot.cpp:434 */ int CBot::GetEnemiesRemaining() const { int count = 0; - for (int i = 1; i <= gpGlobals->maxClients; ++i) { CBaseEntity *player = UTIL_PlayerByIndex(i); @@ -417,19 +376,16 @@ int CBot::GetEnemiesRemaining() const if (!player->IsAlive()) continue; - count++; + ++count; } return count; } // Return number of friends left alive - -/* <490338> ../game_shared/bot/bot.cpp:467 */ int CBot::GetFriendsRemaining() const { int count = 0; - for (int i = 1; i <= gpGlobals->maxClients; ++i) { CBaseEntity *player = UTIL_PlayerByIndex(i); @@ -452,13 +408,12 @@ int CBot::GetFriendsRemaining() const if (player == static_cast(const_cast(this))) continue; - count++; + ++count; } return count; } -/* <490489> ../game_shared/bot/bot.cpp:503 */ bool CBot::IsLocalPlayerWatchingMe() const { // avoid crash during spawn @@ -471,21 +426,20 @@ bool CBot::IsLocalPlayerWatchingMe() const if (player == NULL) return false; - if ((player->pev->flags & FL_SPECTATOR || player->m_iTeam == SPECTATOR) && player->pev->iuser2 == myIndex) + if (((player->pev->flags & FL_SPECTATOR) || player->m_iTeam == SPECTATOR) && player->pev->iuser2 == myIndex) { switch (player->pev->iuser1) { - case OBS_CHASE_LOCKED: - case OBS_CHASE_FREE: - case OBS_IN_EYE: - return true; + case OBS_CHASE_LOCKED: + case OBS_CHASE_FREE: + case OBS_IN_EYE: + return true; } } return false; } -/* <4904f2> ../game_shared/bot/bot.cpp:536 */ NOXREF void CBot::Print(char *format, ...) const { va_list varg; @@ -502,7 +456,6 @@ NOXREF void CBot::Print(char *format, ...) const SERVER_PRINT(buffer); } -/* <490561> ../game_shared/bot/bot.cpp:557 */ void CBot::PrintIfWatched(char *format, ...) const { if (!cv_bot_debug.value) @@ -533,7 +486,6 @@ void CBot::PrintIfWatched(char *format, ...) const } } -/* <49066c> ../game_shared/bot/bot.cpp:588 */ ActiveGrenade::ActiveGrenade(int weaponID, CGrenade *grenadeEntity) { m_id = weaponID; @@ -542,7 +494,6 @@ ActiveGrenade::ActiveGrenade(int weaponID, CGrenade *grenadeEntity) m_dieTimestamp = 0; } -/* <49069d> ../game_shared/bot/bot.cpp:597 */ void ActiveGrenade::OnEntityGone() { if (m_id == WEAPON_SMOKEGRENADE) @@ -555,7 +506,6 @@ void ActiveGrenade::OnEntityGone() m_entity = NULL; } -/* <4906e1> ../game_shared/bot/bot.cpp:610 */ bool ActiveGrenade::IsValid() const { if (!m_entity) @@ -563,10 +513,10 @@ bool ActiveGrenade::IsValid() const if (gpGlobals->time > m_dieTimestamp) return false; } + return true; } -/* <490710> ../game_shared/bot/bot.cpp:622 */ const Vector *ActiveGrenade::GetPosition() const { return &m_entity->pev->origin; diff --git a/regamedll/game_shared/bot/bot.h b/regamedll/game_shared/bot/bot.h index 2ec1fb0b..17937a73 100644 --- a/regamedll/game_shared/bot/bot.h +++ b/regamedll/game_shared/bot/bot.h @@ -34,7 +34,6 @@ class BotProfile; -/* <36c175> ../game_shared/bot/bot.h:36 */ template T *CreateBot(const BotProfile *profile) { @@ -177,12 +176,12 @@ public: void ExecuteCommand_(); void SetModel_(const char *modelName); -#endif // HOOK_GAMEDLL +#endif public: - unsigned int GetID() const { return m_id; } - bool IsRunning() const { return m_isRunning; } - bool IsCrouching() const { return m_isCrouching; } + unsigned int GetID() const { return m_id; } + bool IsRunning() const { return m_isRunning; } + bool IsCrouching() const { return m_isCrouching; } // push the current posture context onto the top of the stack void PushPostureContext(); @@ -227,7 +226,7 @@ public: bool IsLocalPlayerWatchingMe() const; // output message to console - NOXREF void Print(char *format,...) const; + void Print(char *format,...) const; // output message to console if we are being watched by the local player void PrintIfWatched(char *format,...) const; @@ -242,7 +241,7 @@ public: #ifndef HOOK_GAMEDLL protected: -#endif // HOOK_GAMEDLL +#endif // Do a "client command" - useful for invoking menu choices, etc. void ClientCommand(const char *cmd, const char *arg1 = NULL, const char *arg2 = NULL, const char *arg3 = NULL); @@ -295,13 +294,11 @@ private: int m_postureStackIndex; }; -/* <48f61d> ../game_shared/bot/bot.h:253 */ inline void CBot::__MAKE_VHOOK(SetModel)(const char *modelName) { SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", (char *)modelName); } -/* <48e98a> ../game_shared/bot/bot.h:259 */ inline float CBot::GetMoveSpeed() { if (m_isRunning || m_isCrouching) @@ -310,25 +307,21 @@ inline float CBot::GetMoveSpeed() return 0.4f * pev->maxspeed; } -/* <48f6a3> ../game_shared/bot/bot.h:269 */ inline void CBot::Run() { m_isRunning = true; } -/* <48f6c9> ../game_shared/bot/bot.h:275 */ inline void CBot::Walk() { m_isRunning = false; } -/* <5d3ed6> ../game_shared/bot/bot.h:281 */ inline CBasePlayerWeapon *CBot::GetActiveWeapon() const { return static_cast(m_pActiveItem); } -/* <5c4d70> ../game_shared/bot/bot.h:287 */ inline bool CBot::IsActiveWeaponReloading() const { CBasePlayerWeapon *weapon = GetActiveWeapon(); @@ -338,25 +331,26 @@ inline bool CBot::IsActiveWeaponReloading() const return (weapon->m_fInReload || weapon->m_fInSpecialReload) != 0; } -/* <3c5c5c> ../game_shared/bot/bot.h:297 */ inline bool CBot::IsActiveWeaponRecoilHigh() const { - CBasePlayerWeapon *gun = GetActiveWeapon(); - if (gun != NULL) + CBasePlayerWeapon *weapon = GetActiveWeapon(); + if (weapon != NULL) { const float highRecoil = 0.4f; - return (gun->m_flAccuracy > highRecoil) != 0; + return (weapon->m_flAccuracy > highRecoil) != 0; } + return false; } -/* <5194b2> ../game_shared/bot/bot.h:308 */ inline void CBot::PushPostureContext() { if (m_postureStackIndex == MAX_POSTURE_STACK) { - if (pev) + if (pev != NULL) + { PrintIfWatched("PushPostureContext() overflow error!\n"); + } return; } @@ -365,14 +359,14 @@ inline void CBot::PushPostureContext() ++m_postureStackIndex; } -/* <519534> ../game_shared/bot/bot.h:323 */ inline void CBot::PopPostureContext() { if (m_postureStackIndex == 0) { - if (pev) + if (pev != NULL) + { PrintIfWatched("PopPostureContext() underflow error!\n"); - + } m_isRunning = true; m_isCrouching = false; return; @@ -383,7 +377,6 @@ inline void CBot::PopPostureContext() m_isCrouching = m_postureStack[m_postureStackIndex].isCrouching; } -/* <48fae3> ../game_shared/bot/bot.h:340 */ inline bool CBot::__MAKE_VHOOK(IsPlayerFacingMe)(CBasePlayer *other) const { Vector toOther = other->pev->origin - pev->origin; @@ -396,7 +389,6 @@ inline bool CBot::__MAKE_VHOOK(IsPlayerFacingMe)(CBasePlayer *other) const return false; } -/* <48fbfc> ../game_shared/bot/bot.h:355 */ inline bool CBot::__MAKE_VHOOK(IsPlayerLookingAtMe)(CBasePlayer *other) const { Vector toOther = other->pev->origin - pev->origin; @@ -422,8 +414,6 @@ extern float g_flBotFullThinkInterval; extern const char *BotArgs[4]; extern bool UseBotArgs; -class BotProfile; - extern bool AreBotsAllowed(); #endif // BOT_H diff --git a/regamedll/game_shared/bot/bot_manager.cpp b/regamedll/game_shared/bot/bot_manager.cpp index 8c0488fa..cbd52540 100644 --- a/regamedll/game_shared/bot/bot_manager.cpp +++ b/regamedll/game_shared/bot/bot_manager.cpp @@ -114,8 +114,6 @@ const float smokeRadius = 115.0f; // for smoke grenades // Convert name to GameEventType // TODO: Find more appropriate place for this function - -/* <49f6d7> ../game_shared/bot/bot_manager.cpp:58 */ GameEventType NameToGameEvent(const char *name) { for (int i = 0; GameEventName[i] != NULL; ++i) @@ -127,23 +125,18 @@ GameEventType NameToGameEvent(const char *name) return EVENT_INVALID; } -/* <49f733> ../game_shared/bot/bot_manager.cpp:69 */ CBotManager::CBotManager() { InitBotTrig(); } // Invoked when the round is restarting - -/* <49f586> ../game_shared/bot/bot_manager.cpp:78 */ void CBotManager::__MAKE_VHOOK(RestartRound)() { DestroyAllGrenades(); } // Invoked at the start of each frame - -/* <49a21c> ../game_shared/bot/bot_manager.cpp:85 */ void CBotManager::__MAKE_VHOOK(StartFrame)() { // debug smoke grenade visualization @@ -154,7 +147,7 @@ void CBotManager::__MAKE_VHOOK(StartFrame)() ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); while (iter != m_activeGrenadeList.end()) { - ActiveGrenade *ag = *iter; + ActiveGrenade *ag = (*iter); // lazy validation if (!ag->IsValid()) @@ -214,8 +207,6 @@ void CBotManager::__MAKE_VHOOK(StartFrame)() } // Return the filename for this map's "nav map" file - -/* <49f7a6> ../game_shared/bot/bot_manager.cpp:205 */ const char *CBotManager::GetNavMapFilename() const { static char filename[256]; @@ -226,8 +217,6 @@ const char *CBotManager::GetNavMapFilename() const // Invoked when given player does given event (some events have NULL player). // Events are propogated to all bots. // TODO: This has become the game-wide event dispatcher. We should restructure this. - -/* <49f17b> ../game_shared/bot/bot_manager.cpp:219 */ void CBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) { // propogate event to all bots @@ -267,8 +256,6 @@ void CBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity } // Add an active grenade to the bot's awareness - -/* <49f7ff> ../game_shared/bot/bot_manager.cpp:257 */ void CBotManager::AddGrenade(int type, CGrenade *grenade) { ActiveGrenade *ag = new ActiveGrenade(type, grenade); @@ -277,13 +264,11 @@ void CBotManager::AddGrenade(int type, CGrenade *grenade) } // The grenade entity in the world is going away - -/* <49f95a> ../game_shared/bot/bot_manager.cpp:267 */ void CBotManager::RemoveGrenade(CGrenade *grenade) { for (ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); iter != m_activeGrenadeList.end(); ++iter) { - ActiveGrenade *ag = *iter; + ActiveGrenade *ag = (*iter); if (ag->IsEntity(grenade)) { @@ -294,14 +279,12 @@ void CBotManager::RemoveGrenade(CGrenade *grenade) } // Destroy any invalid active grenades - -/* <49f9fc> ../game_shared/bot/bot_manager.cpp:285 */ NOXREF void CBotManager::ValidateActiveGrenades() { ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); while (iter != m_activeGrenadeList.end()) { - ActiveGrenade *ag = *iter; + ActiveGrenade *ag = (*iter); if (!ag->IsValid()) { @@ -313,24 +296,21 @@ NOXREF void CBotManager::ValidateActiveGrenades() } } -/* <49faf3> ../game_shared/bot/bot_manager.cpp:305 */ void CBotManager::DestroyAllGrenades() { for (ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); iter != m_activeGrenadeList.end(); iter++) - delete *iter; + delete (*iter); m_activeGrenadeList.clear(); } // Return true if position is inside a smoke cloud - -/* <49fc24> ../game_shared/bot/bot_manager.cpp:317 */ bool CBotManager::IsInsideSmokeCloud(const Vector *pos) { ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); while (iter != m_activeGrenadeList.end()) { - ActiveGrenade *ag = *iter; + ActiveGrenade *ag = (*iter); // lazy validation if (!ag->IsValid()) @@ -358,8 +338,6 @@ bool CBotManager::IsInsideSmokeCloud(const Vector *pos) // Determine the length of the line of sight covered by each smoke cloud, // and sum them (overlap is additive for obstruction). // If the overlap exceeds the threshold, the bot can't see through. - -/* <49fd8b> ../game_shared/bot/bot_manager.cpp:355 */ bool CBotManager::IsLineBlockedBySmoke(const Vector *from, const Vector *to) { const float smokeRadiusSq = smokeRadius * smokeRadius; @@ -374,7 +352,7 @@ bool CBotManager::IsLineBlockedBySmoke(const Vector *from, const Vector *to) ActiveGrenadeList::iterator iter = m_activeGrenadeList.begin(); while (iter != m_activeGrenadeList.end()) { - ActiveGrenade *ag = *iter; + ActiveGrenade *ag = (*iter); // lazy validation if (!ag->IsValid()) @@ -428,7 +406,7 @@ bool CBotManager::IsLineBlockedBySmoke(const Vector *from, const Vector *to) { // 'from' is inside the cloud, 'to' is outside // compute half of total smoked length as if ray crosses entire cloud chord - float halfSmokedLength = sqrt(smokeRadiusSq - lengthSq); + float halfSmokedLength = Q_sqrt(smokeRadiusSq - lengthSq); if (alongDist > 0.0f) { @@ -446,7 +424,7 @@ bool CBotManager::IsLineBlockedBySmoke(const Vector *from, const Vector *to) { // 'from' is outside the cloud, 'to' is inside // compute half of total smoked length as if ray crosses entire cloud chord - float halfSmokedLength = sqrt(smokeRadiusSq - lengthSq); + float halfSmokedLength = Q_sqrt(smokeRadiusSq - lengthSq); Vector v = *to - *smokeOrigin; if (DotProduct(v, sightDir) > 0.0f) @@ -465,7 +443,7 @@ bool CBotManager::IsLineBlockedBySmoke(const Vector *from, const Vector *to) // 'from' and 'to' lie outside of the cloud - the line of sight completely crosses it // determine the length of the chord that crosses the cloud - float smokedLength = 2.0f * sqrt(smokeRadiusSq - lengthSq); + float smokedLength = 2.0f * Q_sqrt(smokeRadiusSq - lengthSq); totalSmokedLength += smokedLength; } } diff --git a/regamedll/game_shared/bot/bot_manager.h b/regamedll/game_shared/bot/bot_manager.h index 9f59828c..b982253b 100644 --- a/regamedll/game_shared/bot/bot_manager.h +++ b/regamedll/game_shared/bot/bot_manager.h @@ -48,9 +48,9 @@ public: void OnEntityGone(); bool IsValid() const; - bool IsEntity(CGrenade *grenade) const { return (grenade == m_entity) ? true : false; } - int GetID() const { return m_id; } - const Vector *GetDetonationPosition() const { return &m_detonationPosition; } + bool IsEntity(CGrenade *grenade) const { return (grenade == m_entity) ? true : false; } + int GetID() const { return m_id; } + const Vector *GetDetonationPosition() const { return &m_detonationPosition; } const Vector *GetPosition() const; @@ -90,7 +90,7 @@ public: void AddGrenade(int type, CGrenade *grenade); // add an active grenade to the bot's awareness void RemoveGrenade(CGrenade *grenade); // the grenade entity in the world is going away - NOXREF void ValidateActiveGrenades(); // destroy any invalid active grenades + void ValidateActiveGrenades(); // destroy any invalid active grenades void DestroyAllGrenades(); bool IsLineBlockedBySmoke(const Vector *from, const Vector *to); // return true if line intersects smoke volume @@ -102,7 +102,7 @@ public: void StartFrame_(); void OnEvent_(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); -#endif // HOOK_GAMEDLL +#endif private: // the list of active grenades the bots are aware of diff --git a/regamedll/game_shared/bot/bot_profile.cpp b/regamedll/game_shared/bot/bot_profile.cpp index fd773b9a..ca5eb2ef 100644 --- a/regamedll/game_shared/bot/bot_profile.cpp +++ b/regamedll/game_shared/bot/bot_profile.cpp @@ -9,11 +9,9 @@ BotProfileManager *TheBotProfiles = NULL; char *BotDifficultyName[] = { "EASY", "NORMAL", "HARD", "EXPERT", NULL }; -#endif // HOOK_GAMEDLL +#endif // Generates a filename-decorated skin name - -/* <4a693f> ../game_shared/bot/bot_profile.cpp:52 */ const char *GetDecoratedSkinName(const char *name, const char *filename) { const int BufLen = MAX_PATH + 64; @@ -22,7 +20,6 @@ const char *GetDecoratedSkinName(const char *name, const char *filename) return buf; } -/* <4a7a99> ../game_shared/bot/bot_profile.cpp:65 */ const char *BotProfile::GetWeaponPreferenceAsString(int i) const { if (i < 0 || i >= m_weaponPreferenceCount) @@ -32,8 +29,6 @@ const char *BotProfile::GetWeaponPreferenceAsString(int i) const } // Return true if this profile has a primary weapon preference - -/* <4a7acd> ../game_shared/bot/bot_profile.cpp:78 */ bool BotProfile::HasPrimaryPreference() const { for (int i = 0; i < m_weaponPreferenceCount; ++i) @@ -52,8 +47,6 @@ bool BotProfile::HasPrimaryPreference() const } // Return true if this profile has a pistol weapon preference - -/* <4a7b22> ../game_shared/bot/bot_profile.cpp:99 */ bool BotProfile::HasPistolPreference() const { for (int i = 0; i < m_weaponPreferenceCount; ++i) @@ -66,14 +59,11 @@ bool BotProfile::HasPistolPreference() const } // Return true if this profile is valid for the specified team - -/* <4a7b5e> ../game_shared/bot/bot_profile.cpp:112 */ bool BotProfile::IsValidForTeam(BotProfileTeamType team) const { return (team == BOT_TEAM_ANY || m_teams == BOT_TEAM_ANY || team == m_teams); } -/* <4a7bb2> ../game_shared/bot/bot_profile.cpp:122 */ BotProfileManager::BotProfileManager() { m_nextSkin = 0; @@ -86,8 +76,6 @@ BotProfileManager::BotProfileManager() } // Load the bot profile database - -/* <4a8acb> ../game_shared/bot/bot_profile.cpp:137 */ void BotProfileManager::Init(const char *filename, unsigned int *checksum) { int dataLength; @@ -154,7 +142,7 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) } token = SharedGetToken(); - if (Q_stricmp("Model", token)) + if (Q_stricmp(token, "Model") != 0) { CONSOLE_ECHO("Error parsing %s - expected 'Model'\n", filename); FREE_FILE(dataPointer); @@ -171,7 +159,7 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) } token = SharedGetToken(); - if (Q_strcmp("=", token)) + if (Q_strcmp(token, "=") != 0) { CONSOLE_ECHO("Error parsing %s - expected '='\n", filename); FREE_FILE(dataPointer); @@ -213,7 +201,7 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) } token = SharedGetToken(); - if (Q_strcmp("End", token)) + if (Q_strcmp(token, "End") != 0) { CONSOLE_ECHO("Error parsing %s - expected 'End'\n", filename); FREE_FILE(dataPointer); @@ -254,7 +242,7 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) { if (!Q_stricmp((*iter)->GetName(), token)) { - inherit = *iter; + inherit = (*iter); break; } } @@ -331,7 +319,7 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) } token = SharedGetToken(); - if (Q_strcmp("=", token)) + if (Q_strcmp(token, "=") != 0) { CONSOLE_ECHO("Error parsing %s - expected '='\n", filename); FREE_FILE(dataPointer); @@ -413,7 +401,7 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) // subtract off latency due to "think" update rate. // In GameUI, we don't really care. profile->m_reactionTime -= g_flBotFullThinkInterval; -#endif // GAMEUI_EXPORTS +#endif } else if (!Q_stricmp("AttackDelay", attributeName)) @@ -484,27 +472,26 @@ void BotProfileManager::Init(const char *filename, unsigned int *checksum) // free the templates for (BotProfileList::iterator iter = templateList.begin(); iter != templateList.end(); ++iter) - delete *iter; + delete (*iter); + + templateList.clear(); } -/* <4a7dfd> ../game_shared/bot/bot_profile.cpp:532 */ BotProfileManager::~BotProfileManager() { Reset(); for (VoiceBankList::iterator it = m_voiceBanks.begin(); it != m_voiceBanks.end(); ++it) - delete[] *it; + delete[] (*it); m_voiceBanks.clear(); } // Free all bot profiles - -/* <4a7c76> ../game_shared/bot/bot_profile.cpp:548 */ void BotProfileManager::Reset() { for (BotProfileList::iterator iter = m_profileList.begin(); iter != m_profileList.end(); ++iter) - delete *iter; + delete (*iter); m_profileList.clear(); @@ -529,8 +516,6 @@ void BotProfileManager::Reset() } // Returns custom skin name at a particular index - -/* <4a7fdf> ../game_shared/bot/bot_profile.cpp:579 */ const char *BotProfileManager::GetCustomSkin(int index) { if (index < FirstCustomSkin || index > LastCustomSkin) @@ -542,8 +527,6 @@ const char *BotProfileManager::GetCustomSkin(int index) } // Returns custom skin filename at a particular index - -/* <4a8019> ../game_shared/bot/bot_profile.cpp:593 */ const char *BotProfileManager::GetCustomSkinFname(int index) { if (index < FirstCustomSkin || index > LastCustomSkin) @@ -555,8 +538,6 @@ const char *BotProfileManager::GetCustomSkinFname(int index) } // Returns custom skin modelname at a particular index - -/* <4a8053> ../game_shared/bot/bot_profile.cpp:607 */ const char *BotProfileManager::GetCustomSkinModelname(int index) { if (index < FirstCustomSkin || index > LastCustomSkin) @@ -568,12 +549,10 @@ const char *BotProfileManager::GetCustomSkinModelname(int index) } // Looks up a custom skin index by filename-decorated name (will decorate the name if filename is given) - -/* <4a80db> ../game_shared/bot/bot_profile.cpp:621 */ int BotProfileManager::GetCustomSkinIndex(const char *name, const char *filename) { const char *skinName = name; - if (filename) + if (filename != NULL) { skinName = GetDecoratedSkinName(name, filename); } @@ -593,8 +572,6 @@ int BotProfileManager::GetCustomSkinIndex(const char *name, const char *filename } // return index of the (custom) bot phrase db, inserting it if needed - -/* <4a8916> ../game_shared/bot/bot_profile.cpp:647 */ int BotProfileManager::FindVoiceBankIndex(const char *filename) { int index = 0; @@ -611,8 +588,6 @@ int BotProfileManager::FindVoiceBankIndex(const char *filename) } // Return random unused profile that matches the given difficulty level - -/* <4a8177> ../game_shared/bot/bot_profile.cpp:669 */ const BotProfile *BotProfileManager::GetRandomProfile(BotDifficultyType difficulty, BotProfileTeamType team) const { #ifdef RANDOM_LONG diff --git a/regamedll/game_shared/bot/bot_profile.h b/regamedll/game_shared/bot/bot_profile.h index 899e0feb..9270a3bf 100644 --- a/regamedll/game_shared/bot/bot_profile.h +++ b/regamedll/game_shared/bot/bot_profile.h @@ -62,7 +62,6 @@ enum BotProfileTeamType BOT_TEAM_ANY }; -/* <4a79de> ../game_shared/bot/bot_profile.h:46 */ class BotProfile { public: @@ -128,13 +127,11 @@ private: int m_voiceBank; }; -/* <4a666f> ../game_shared/bot/bot_profile.h:115 */ inline bool BotProfile::IsDifficulty(BotDifficultyType diff) const { return (m_difficultyFlags & (1 << diff)) ? true : false; } -/* <4a7a20> ../game_shared/bot/bot_profile.h:123 */ inline void BotProfile::Inherit(const BotProfile *parent, const BotProfile *baseline) { if (parent->m_aggression != baseline->m_aggression) @@ -180,7 +177,6 @@ inline void BotProfile::Inherit(const BotProfile *parent, const BotProfile *base typedef std::STD_LIST BotProfileList; -/* <36a051> ../game_shared/bot/bot_profile.h:180 */ class BotProfileManager { public: @@ -195,7 +191,7 @@ public: for (BotProfileList::const_iterator iter = m_profileList.begin(); iter != m_profileList.end(); ++iter) { if (!Q_stricmp(name, (*iter)->GetName()) && (*iter)->IsValidForTeam(team)) - return *iter; + return (*iter); } return NULL; diff --git a/regamedll/game_shared/bot/bot_util.cpp b/regamedll/game_shared/bot/bot_util.cpp index 23d7d2d0..e29b5d58 100644 --- a/regamedll/game_shared/bot/bot_util.cpp +++ b/regamedll/game_shared/bot/bot_util.cpp @@ -8,9 +8,8 @@ short s_iBeamSprite = 0; float cosTable[ COS_TABLE_SIZE ]; -#endif // HOOK_GAMEDLL +#endif -/* <4ad1c6> ../game_shared/bot/bot_util.cpp:26 */ bool UTIL_IsNameTaken(const char *name, bool ignoreHumans) { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -26,7 +25,7 @@ bool UTIL_IsNameTaken(const char *name, bool ignoreHumans) if (FStrEq(STRING(player->pev->netname), "")) continue; - if (player->IsPlayer() && (((CBasePlayer *)player)->IsBot() == TRUE)) + if (player->IsPlayer() && ((CBasePlayer *)player)->IsBot()) { // bots can have prefixes so we need to check the name // against the profile name instead. @@ -49,7 +48,6 @@ bool UTIL_IsNameTaken(const char *name, bool ignoreHumans) return false; } -/* <4ad2da> ../game_shared/bot/bot_util.cpp:66 */ int UTIL_ClientsInGame() { int iCount = 0; @@ -72,7 +70,6 @@ int UTIL_ClientsInGame() return iCount; } -/* <4ad385> ../game_shared/bot/bot_util.cpp:93 */ int UTIL_ActivePlayersInGame() { int iCount = 0; @@ -104,7 +101,6 @@ int UTIL_ActivePlayersInGame() return iCount; } -/* <4ad43f> ../game_shared/bot/bot_util.cpp:128 */ int UTIL_HumansInGame(bool ignoreSpectators) { int iCount = 0; @@ -139,7 +135,6 @@ int UTIL_HumansInGame(bool ignoreSpectators) return iCount; } -/* <4ad507> ../game_shared/bot/bot_util.cpp:174 */ int UTIL_HumansOnTeam(int teamID, bool isAlive) { int iCount = 0; @@ -173,7 +168,6 @@ int UTIL_HumansOnTeam(int teamID, bool isAlive) return iCount; } -/* <4ad5db> ../game_shared/bot/bot_util.cpp:210 */ int UTIL_BotsInGame() { int iCount = 0; @@ -200,7 +194,6 @@ int UTIL_BotsInGame() return iCount; } -/* <4ad686> ../game_shared/bot/bot_util.cpp:240 */ bool UTIL_KickBotFromTeam(TeamName kickTeam) { int i; @@ -260,7 +253,6 @@ bool UTIL_KickBotFromTeam(TeamName kickTeam) return false; } -/* <4ad7ad> ../game_shared/bot/bot_util.cpp:305 */ bool UTIL_IsTeamAllBots(int team) { int botCount = 0; @@ -286,14 +278,12 @@ bool UTIL_IsTeamAllBots(int team) ++botCount; } - return (botCount) ? true : false; + return botCount ? true : false; } // Return the closest active player to the given position. // If 'distance' is non-NULL, the distance to the closest player is returned in it. - -/* <4ad86a> ../game_shared/bot/bot_util.cpp:343 */ -/*extern*/ CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *distance) +extern CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, float *distance) { CBasePlayer *closePlayer = NULL; float closeDistSq = 1.0e12f; // 999999999999.9f @@ -317,16 +307,14 @@ bool UTIL_IsTeamAllBots(int team) } if (distance) - *distance = sqrt(closeDistSq); + *distance = Q_sqrt(closeDistSq); return closePlayer; } // Return the closest active player on the given team to the given position. // If 'distance' is non-NULL, the distance to the closest player is returned in it. - -/* <4ad86a> ../game_shared/bot/bot_util.cpp:343 */ -/*extern*/ CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, int team, float *distance) +extern CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, int team, float *distance) { CBasePlayer *closePlayer = NULL; float closeDistSq = 1.0e12f; // 999999999999.9f @@ -353,18 +341,16 @@ bool UTIL_IsTeamAllBots(int team) } if (distance) - *distance = sqrt(closeDistSq); + *distance = Q_sqrt(closeDistSq); return closePlayer; } -/* <4ad0de> ../game_shared/bot/bot_util.cpp:411 */ const char *UTIL_GetBotPrefix() { return cv_bot_prefix.string; } -/* <4adb11> ../game_shared/bot/bot_util.cpp:418 */ void UTIL_ConstructBotNetName(char *name, int nameLength, const BotProfile *profile) { if (profile == NULL) @@ -383,7 +369,6 @@ void UTIL_ConstructBotNetName(char *name, int nameLength, const BotProfile *prof Q_snprintf(name, nameLength, "%s %s", UTIL_GetBotPrefix(), profile->GetName()); } -/* <4adb6c> ../game_shared/bot/bot_util.cpp:440 */ bool UTIL_IsVisibleToTeam(const Vector &spot, int team, float maxRange) { for (int i = 1; i <= gpGlobals->maxClients; ++i) @@ -418,7 +403,6 @@ bool UTIL_IsVisibleToTeam(const Vector &spot, int team, float maxRange) return false; } -/* <4adc8e> ../game_shared/bot/bot_util.cpp:479 */ CBasePlayer *UTIL_GetLocalPlayer() { if (!IS_DEDICATED_SERVER()) @@ -427,7 +411,6 @@ CBasePlayer *UTIL_GetLocalPlayer() return NULL; } -/* <4adcab> ../game_shared/bot/bot_util.cpp:491 */ NOXREF Vector UTIL_ComputeOrigin(entvars_t *pevVars) { if (pevVars->origin.x == 0.0f && pevVars->origin.y == 0.0f && pevVars->origin.z == 0.0f) @@ -446,7 +429,6 @@ NOXREF Vector UTIL_ComputeOrigin(edict_t *pentEdict) return UTIL_ComputeOrigin(VARS(pentEdict)); } -/* <4adf8a> ../game_shared/bot/bot_util.cpp:513 */ NOXREF void UTIL_DrawBeamFromEnt(int iIndex, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue) { MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecEnd); @@ -469,7 +451,6 @@ NOXREF void UTIL_DrawBeamFromEnt(int iIndex, Vector vecEnd, int iLifetime, byte MESSAGE_END(); } -/* <4ae02e> ../game_shared/bot/bot_util.cpp:537 */ void UTIL_DrawBeamPoints(Vector vecStart, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue) { MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecStart); @@ -494,7 +475,6 @@ void UTIL_DrawBeamPoints(Vector vecStart, Vector vecEnd, int iLifetime, byte bRe MESSAGE_END(); } -/* <4ae0d3> ../game_shared/bot/bot_util.cpp:563 */ void CONSOLE_ECHO(char *pszMsg, ...) { va_list argptr; @@ -507,7 +487,6 @@ void CONSOLE_ECHO(char *pszMsg, ...) SERVER_PRINT(szStr); } -/* <4ae13e> ../game_shared/bot/bot_util.cpp:577 */ void CONSOLE_ECHO_LOGGED(char *pszMsg, ...) { va_list argptr; @@ -521,7 +500,6 @@ void CONSOLE_ECHO_LOGGED(char *pszMsg, ...) UTIL_LogPrintf(szStr); } -/* <4ae198> ../game_shared/bot/bot_util.cpp:592 */ void BotPrecache() { s_iBeamSprite = PRECACHE_MODEL("sprites/smoke.spr"); @@ -540,17 +518,15 @@ void BotPrecache() PRECACHE_SOUND("events/task_complete.wav"); } -/* <4ae1b1> ../game_shared/bot/bot_util.cpp:666 */ void InitBotTrig() { for (int i = 0; i < COS_TABLE_SIZE; ++i) { - float_precision angle = 2.0f * M_PI * (float)i / (float)(COS_TABLE_SIZE - 1); - cosTable[i] = cos(angle); + float_precision angle = 2.0f * M_PI * float(i) / float(COS_TABLE_SIZE - 1); + cosTable[i] = Q_cos(angle); } } -/* <4ae1fd> ../game_shared/bot/bot_util.cpp:675 */ float BotCOS(float angle) { angle = NormalizeAnglePositive(angle); @@ -558,7 +534,6 @@ float BotCOS(float angle) return cosTable[ i ]; } -/* <4ae261> ../game_shared/bot/bot_util.cpp:682 */ float BotSIN(float angle) { angle = NormalizeAnglePositive(angle - 90); @@ -567,8 +542,6 @@ float BotSIN(float angle) } // Determine if this event is audible, and if so, return its audible range and priority - -/* <4ae2c5> ../game_shared/bot/bot_util.cpp:694 */ bool IsGameEventAudible(GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile) { CBasePlayer *player = static_cast(entity); @@ -697,7 +670,6 @@ bool IsGameEventAudible(GameEventType event, CBaseEntity *entity, CBaseEntity *o return false; } -/* <4ae3c1> ../game_shared/bot/bot_util.cpp:838 */ void HintMessageToAllPlayers(const char *message) { hudtextparms_t textParms; diff --git a/regamedll/game_shared/bot/bot_util.h b/regamedll/game_shared/bot/bot_util.h index d529f9a8..61df2765 100644 --- a/regamedll/game_shared/bot/bot_util.h +++ b/regamedll/game_shared/bot/bot_util.h @@ -49,41 +49,37 @@ enum PriorityType }; // Simple class for tracking intervals of game time - -/* <504550> ../game_shared/bot/bot_util.h:131 */ class IntervalTimer { public: - IntervalTimer() { m_timestamp = -1.0f; } - void Reset() { m_timestamp = gpGlobals->time; } - void Start() { m_timestamp = gpGlobals->time; } - void Invalidate() { m_timestamp = -1.0f; } + IntervalTimer() { m_timestamp = -1.0f; } + void Reset() { m_timestamp = gpGlobals->time; } + void Start() { m_timestamp = gpGlobals->time; } + void Invalidate() { m_timestamp = -1.0f; } bool HasStarted() const { return (m_timestamp > 0.0f); } // if not started, elapsed time is very large - float GetElapsedTime() const { return (HasStarted()) ? (gpGlobals->time - m_timestamp) : 99999.9f; } - bool IsLessThen(float duration) const { return (gpGlobals->time - m_timestamp < duration) ? true : false; } - bool IsGreaterThen(float duration) const { return (gpGlobals->time - m_timestamp > duration) ? true : false; } + float GetElapsedTime() const { return (HasStarted()) ? (gpGlobals->time - m_timestamp) : 99999.9f; } + bool IsLessThen(float duration) const { return (gpGlobals->time - m_timestamp < duration) ? true : false; } + bool IsGreaterThen(float duration) const { return (gpGlobals->time - m_timestamp > duration) ? true : false; } private: float m_timestamp; }; // Simple class for counting down a short interval of time - -/* <46f878> ../game_shared/bot/bot_util.h:183 */ class CountdownTimer { public: - CountdownTimer() { m_timestamp = -1.0f; m_duration = 0.0f; } - void Reset() { m_timestamp = gpGlobals->time + m_duration; } + CountdownTimer() { m_timestamp = -1.0f; m_duration = 0.0f; } + void Reset() { m_timestamp = gpGlobals->time + m_duration; } - void Start(float duration) { m_timestamp = gpGlobals->time + duration; m_duration = duration; } - bool HasStarted() const { return (m_timestamp > 0.0f); } + void Start(float duration) { m_timestamp = gpGlobals->time + duration; m_duration = duration; } + bool HasStarted() const { return (m_timestamp > 0.0f); } - void Invalidate() { m_timestamp = -1.0f; } - bool IsElapsed() const { return (gpGlobals->time > m_timestamp); } + void Invalidate() { m_timestamp = -1.0f; } + bool IsElapsed() const { return (gpGlobals->time > m_timestamp); } private: float m_duration; @@ -91,8 +87,6 @@ private: }; // Return true if the given entity is valid - -/* <14ed68> ../game_shared/bot/bot_util.h:224 */ inline bool IsEntityValid(CBaseEntity *entity) { if (entity == NULL) @@ -113,8 +107,6 @@ inline bool IsEntityValid(CBaseEntity *entity) // Given two line segments: startA to endA, and startB to endB, return true if they intesect // and put the intersection point in "result". // Note that this computes the intersection of the 2D (x,y) projection of the line segments. - -/* <4c0851> ../game_shared/bot/bot_util.h:247 */ inline bool IsIntersecting2D(const Vector &startA, const Vector &endA, const Vector &startB, const Vector &endB, Vector *result = NULL) { float denom = (endA.x - startA.x) * (endB.y - startB.y) - (endA.y - startA.y) * (endB.x - startB.x); @@ -147,7 +139,7 @@ inline bool IsIntersecting2D(const Vector &startA, const Vector &endA, const Vec } // compute intesection point - if (result) + if (result != NULL) { *result = startA + s * (endA - startA); } @@ -157,8 +149,6 @@ inline bool IsIntersecting2D(const Vector &startA, const Vector &endA, const Vec // Iterate over all active players in the game, invoking functor on each. // If functor returns false, stop iteration and return false. - -/* <4700e1> ../game_shared/bot/bot_util.h:294 */ template bool ForEachPlayer(Functor &func) { @@ -179,8 +169,6 @@ bool ForEachPlayer(Functor &func) } // For zombie game - -/* ../game_shared/bot/bot_util.h:317 */ inline bool IsZombieGame() { #ifdef TERRORSTRIKE @@ -238,10 +226,10 @@ const char *UTIL_GetBotPrefix(); void UTIL_ConstructBotNetName(char *name, int nameLength, const BotProfile *profile); bool UTIL_IsVisibleToTeam(const Vector &spot, int team, float maxRange = -1.0f); CBasePlayer *UTIL_GetLocalPlayer(); -NOXREF Vector UTIL_ComputeOrigin(entvars_t *pevVars); -NOXREF Vector UTIL_ComputeOrigin(CBaseEntity *pEntity); -NOXREF Vector UTIL_ComputeOrigin(edict_t *pentEdict); -NOXREF void UTIL_DrawBeamFromEnt(int iIndex, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue); +Vector UTIL_ComputeOrigin(entvars_t *pevVars); +Vector UTIL_ComputeOrigin(CBaseEntity *pEntity); +Vector UTIL_ComputeOrigin(edict_t *pentEdict); +void UTIL_DrawBeamFromEnt(int iIndex, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue); void UTIL_DrawBeamPoints(Vector vecStart, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue); // Echos text to the console, and prints it on the client's screen. This is NOT tied to the developer cvar. diff --git a/regamedll/game_shared/bot/improv.h b/regamedll/game_shared/bot/improv.h index b36ec028..69ab5840 100644 --- a/regamedll/game_shared/bot/improv.h +++ b/regamedll/game_shared/bot/improv.h @@ -36,8 +36,6 @@ class CBaseEntity; class CNavLadder; // Improv-specific events - -/* <46f4d9> ../game_shared/bot/improv.h:17 */ class IImprovEvent { public: diff --git a/regamedll/game_shared/bot/nav.h b/regamedll/game_shared/bot/nav.h index d23be68f..19ff1bd4 100644 --- a/regamedll/game_shared/bot/nav.h +++ b/regamedll/game_shared/bot/nav.h @@ -133,16 +133,15 @@ const float HalfHumanWidth = 16.0f; const float HalfHumanHeight = 36.0f; const float HumanHeight = 72.0f; -/* <4f7910> ../game_shared/bot/nav.h:104 */ struct Extent { Vector lo; Vector hi; - float SizeX() const { return hi.x - lo.x; } - float SizeY() const { return hi.y - lo.y;} - float SizeZ() const { return hi.z - lo.z; } - float Area() const { return SizeX() * SizeY(); } + float SizeX() const { return hi.x - lo.x; } + float SizeY() const { return hi.y - lo.y; } + float SizeZ() const { return hi.z - lo.z; } + float Area() const { return SizeX() * SizeY(); } // return true if 'pos' is inside of this extent bool Contains(const Vector *pos) const @@ -159,7 +158,6 @@ struct Ray Vector to; }; -/* <34358b> ../game_shared/bot/nav.h:134 */ inline NavDirType OppositeDirection(NavDirType dir) { switch (dir) @@ -177,7 +175,6 @@ inline NavDirType OppositeDirection(NavDirType dir) return NORTH; } -/* <4c3042> ../game_shared/bot/nav.h:148 */ inline NavDirType DirectionLeft(NavDirType dir) { switch (dir) @@ -195,7 +192,6 @@ inline NavDirType DirectionLeft(NavDirType dir) return NORTH; } -/* <4c3061> ../game_shared/bot/nav.h:162 */ inline NavDirType DirectionRight(NavDirType dir) { switch (dir) @@ -213,7 +209,6 @@ inline NavDirType DirectionRight(NavDirType dir) return NORTH; } -/* <3433a4> ../game_shared/bot/nav.h:176 */ inline void AddDirectionVector(Vector *v, NavDirType dir, float amount) { switch (dir) @@ -233,7 +228,6 @@ inline void AddDirectionVector(Vector *v, NavDirType dir, float amount) } } -/* <38c828> ../game_shared/bot/nav.h:188 */ inline float DirectionToAngle(NavDirType dir) { switch (dir) @@ -251,7 +245,6 @@ inline float DirectionToAngle(NavDirType dir) return 0.0f; } -/* <3d8335> ../game_shared/bot/nav.h:202 */ inline NavDirType AngleToDirection(float_precision angle) { while (angle < 0.0f) @@ -272,7 +265,6 @@ inline NavDirType AngleToDirection(float_precision angle) return NORTH; } -/* <38ccf5> ../game_shared/bot/nav.h:223 */ inline void DirectionToVector2D(NavDirType dir, Vector2D *v) { switch (dir) @@ -296,7 +288,6 @@ inline void DirectionToVector2D(NavDirType dir, Vector2D *v) } } -/* <3433d1> ../game_shared/bot/nav.h:235 */ inline void SnapToGrid(Vector *pos) { int cx = pos->x / GenerationStepSize; @@ -305,7 +296,6 @@ inline void SnapToGrid(Vector *pos) pos->y = cy * GenerationStepSize; } -/* <3433d1> ../game_shared/bot/nav.h:235 */ inline void SnapToGrid(float *value) { int c = *value / GenerationStepSize; @@ -319,7 +309,6 @@ inline float SnapToGrid(float value) return c * GenerationStepSize; } -/* <14ea2f> ../game_shared/bot/nav.h:251 */ inline float_precision NormalizeAngle(float_precision angle) { while (angle < -180.0f) @@ -331,7 +320,6 @@ inline float_precision NormalizeAngle(float_precision angle) return angle; } -/* <4ad17f> ../game_shared/bot/nav.h:263 */ inline float NormalizeAnglePositive(float angle) { while (angle < 0.0f) @@ -343,7 +331,6 @@ inline float NormalizeAnglePositive(float angle) return angle; } -/* <38c40b> ../game_shared/bot/nav.h:275 */ inline float AngleDifference(float a, float b) { float angleDiff = a - b; @@ -357,27 +344,24 @@ inline float AngleDifference(float a, float b) return angleDiff; } -/* <38cac9> ../game_shared/bot/nav.h:288 */ inline bool AnglesAreEqual(float a, float b, float tolerance = 5.0f) { - if (abs(int64(AngleDifference(a, b))) < tolerance) + if (Q_abs(int64(AngleDifference(a, b))) < tolerance) return true; return false; } -/* <3d8457> ../game_shared/bot/nav.h:297 */ inline bool VectorsAreEqual(const Vector *a, const Vector *b, float tolerance = 0.1f) { - if (abs(a->x - b->x) < tolerance && - abs(a->y - b->y) < tolerance && - abs(a->z - b->z) < tolerance) + if (Q_abs(a->x - b->x) < tolerance + && Q_abs(a->y - b->y) < tolerance + && Q_abs(a->z - b->z) < tolerance) return true; return false; } -/* <3436f6> ../game_shared/bot/nav.h:313 */ inline bool IsEntityWalkable(entvars_t *entity, unsigned int flags) { // if we hit a door, assume its walkable because it will open when we touch it @@ -392,8 +376,6 @@ inline bool IsEntityWalkable(entvars_t *entity, unsigned int flags) } // Check LOS, ignoring any entities that we can walk through - -/* <38d33d> ../game_shared/bot/nav.h:330 */ inline bool IsWalkableTraceLineClear(Vector &from, Vector &to, unsigned int flags = 0) { TraceResult result; diff --git a/regamedll/game_shared/bot/nav_area.cpp b/regamedll/game_shared/bot/nav_area.cpp index 7eb67df9..a6dc6931 100644 --- a/regamedll/game_shared/bot/nav_area.cpp +++ b/regamedll/game_shared/bot/nav_area.cpp @@ -64,7 +64,6 @@ int BlockedIDCount = 0; #endif // HOOK_GAMEDLL -/* <4c31b5> ../game_shared/bot/nav_area.cpp:63 */ NOXREF void buildGoodSizedList() { const float minSize = 200.0f; @@ -72,7 +71,7 @@ NOXREF void buildGoodSizedList() NavAreaList::iterator iter; for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); iter++) { - CNavArea *area = *iter; + CNavArea *area = (*iter); // skip the small areas const Extent *extent = area->GetExtent(); @@ -83,7 +82,6 @@ NOXREF void buildGoodSizedList() } } -/* <4c5551> ../game_shared/bot/nav_area.cpp:87 */ void DestroyHidingSpots() { // remove all hiding spot references from the nav areas @@ -97,14 +95,12 @@ void DestroyHidingSpots() // free all the HidingSpots for (HidingSpotList::iterator iter = TheHidingSpotList.begin(); iter != TheHidingSpotList.end(); iter++) - delete *iter; + delete (*iter); TheHidingSpotList.clear(); } // For use when loading from a file - -/* <4c578e> ../game_shared/bot/nav_area.cpp:109 */ HidingSpot::HidingSpot() { m_pos = Vector(0, 0, 0); @@ -115,8 +111,6 @@ HidingSpot::HidingSpot() } // For use when generating - assigns unique ID - -/* <4c588a> ../game_shared/bot/nav_area.cpp:121 */ HidingSpot::HidingSpot(const Vector *pos, unsigned char flags) { m_pos = *pos; @@ -126,7 +120,6 @@ HidingSpot::HidingSpot(const Vector *pos, unsigned char flags) TheHidingSpotList.push_back(this); } -/* <4c5994> ../game_shared/bot/nav_area.cpp:130 */ void HidingSpot::Save(int fd, unsigned int version) const { Q_write(fd, &m_id, sizeof(unsigned int)); @@ -134,7 +127,6 @@ void HidingSpot::Save(int fd, unsigned int version) const Q_write(fd, &m_flags, sizeof(unsigned char)); } -/* <4c59dc> ../game_shared/bot/nav_area.cpp:137 */ void HidingSpot::Load(SteamFile *file, unsigned int version) { file->Read(&m_id, sizeof(unsigned int)); @@ -147,13 +139,11 @@ void HidingSpot::Load(SteamFile *file, unsigned int version) } // Given a HidingSpot ID, return the associated HidingSpot - -/* <4c5bb0> ../game_shared/bot/nav_area.cpp:151 */ HidingSpot *GetHidingSpotByID(unsigned int id) { for (HidingSpotList::iterator iter = TheHidingSpotList.begin(); iter != TheHidingSpotList.end(); ++iter) { - HidingSpot *spot = *iter; + HidingSpot *spot = (*iter); if (spot->GetID() == id) return spot; @@ -163,8 +153,6 @@ HidingSpot *GetHidingSpotByID(unsigned int id) } // To keep constructors consistent - -/* <4c5c30> ../game_shared/bot/nav_area.cpp:169 */ void CNavArea::Initialize() { m_marker = 0; @@ -190,16 +178,12 @@ void CNavArea::Initialize() } // Constructor used during normal runtime - -/* <4c5c82> ../game_shared/bot/nav_area.cpp:198 */ CNavArea::CNavArea() { Initialize(); } // Assumes Z is flat - -/* <4c5ed7> ../game_shared/bot/nav_area.cpp:207 */ CNavArea::CNavArea(const Vector *corner, const Vector *otherCorner) { Initialize(); @@ -238,8 +222,6 @@ CNavArea::CNavArea(const Vector *corner, const Vector *otherCorner) } // Constructor used during generation phase - -/* <4c610d> ../game_shared/bot/nav_area.cpp:248 */ CNavArea::CNavArea(const Vector *nwCorner, const Vector *neCorner, const Vector *seCorner, const Vector *swCorner) { Initialize(); @@ -255,7 +237,6 @@ CNavArea::CNavArea(const Vector *nwCorner, const Vector *neCorner, const Vector m_swZ = swCorner->z; } -/* <4c63a4> ../game_shared/bot/nav_area.cpp:268 */ CNavArea::CNavArea(CNavNode *nwNode, class CNavNode *neNode, class CNavNode *seNode, class CNavNode *swNode) { Initialize(); @@ -280,8 +261,6 @@ CNavArea::CNavArea(CNavNode *nwNode, class CNavNode *neNode, class CNavNode *seN } // Destructor - -/* <4d58d7> ../game_shared/bot/nav_area.cpp:295 */ CNavArea::~CNavArea() { // if we are resetting the system, don't bother cleaning up - all areas are being destroyed @@ -292,7 +271,7 @@ CNavArea::~CNavArea() NavAreaList::iterator iter; for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); if (area == this) continue; @@ -316,8 +295,6 @@ CNavArea::~CNavArea() // This is invoked when an area is going away. // Remove any references we have to it. - -/* <4c67f0> ../game_shared/bot/nav_area.cpp:333 */ void CNavArea::OnDestroyNotify(CNavArea *dead) { NavConnect con; @@ -329,8 +306,6 @@ void CNavArea::OnDestroyNotify(CNavArea *dead) } // Connect this area to given area in given direction - -/* <4c6b75> ../game_shared/bot/nav_area.cpp:347 */ void CNavArea::ConnectTo(CNavArea *area, NavDirType dir) { // check if already connected @@ -349,8 +324,6 @@ void CNavArea::ConnectTo(CNavArea *area, NavDirType dir) } // Disconnect this area from given area - -/* <4c6cd3> ../game_shared/bot/nav_area.cpp:366 */ void CNavArea::Disconnect(CNavArea *area) { NavConnect connect; @@ -362,8 +335,6 @@ void CNavArea::Disconnect(CNavArea *area) // Recompute internal data once nodes have been adjusted during merge // Destroy adjArea. - -/* <4d8fa5> ../game_shared/bot/nav_area.cpp:380 */ void CNavArea::FinishMerge(CNavArea *adjArea) { // update extent @@ -389,8 +360,6 @@ void CNavArea::FinishMerge(CNavArea *adjArea) } // For merging with "adjArea" - pick up all of "adjArea"s connections - -/* <4c6e85> ../game_shared/bot/nav_area.cpp:408 */ void CNavArea::MergeAdjacentConnections(CNavArea *adjArea) { // merge adjacency links - we gain all the connections that adjArea had @@ -400,7 +369,7 @@ void CNavArea::MergeAdjacentConnections(CNavArea *adjArea) { for (iter = adjArea->m_connect[ dir ].begin(); iter != adjArea->m_connect[ dir ].end(); ++iter) { - NavConnect connect = *iter; + NavConnect connect = (*iter); if (connect.area != adjArea && connect.area != this) ConnectTo(connect.area, (NavDirType)dir); @@ -435,7 +404,7 @@ void CNavArea::MergeAdjacentConnections(CNavArea *adjArea) bool connected = false; for (iter = area->m_connect[ dir ].begin(); iter != area->m_connect[ dir ].end(); ++iter) { - NavConnect connect = *iter; + NavConnect connect = (*iter); if (connect.area == adjArea) { @@ -465,8 +434,6 @@ void CNavArea::MergeAdjacentConnections(CNavArea *adjArea) // Assign internal nodes to the given area // NOTE: "internal" nodes do not include the east or south border nodes - -/* <4c760a> ../game_shared/bot/nav_area.cpp:486 */ void CNavArea::AssignNodes(CNavArea *area) { CNavNode *horizLast = m_node[ NORTH_EAST ]; @@ -485,8 +452,6 @@ void CNavArea::AssignNodes(CNavArea *area) // Split this area into two areas at the given edge. // Preserve all adjacency connections. // NOTE: This does not update node connections, only areas. - -/* <4d690e> ../game_shared/bot/nav_area.cpp:507 */ bool CNavArea::SplitEdit(bool splitAlongX, float splitEdge, CNavArea **outAlpha, CNavArea **outBeta) { CNavArea *alpha = NULL; @@ -592,8 +557,6 @@ bool CNavArea::SplitEdit(bool splitAlongX, float splitEdge, CNavArea **outAlpha, // Return true if given area is connected in given direction // if dir == NUM_DIRECTIONS, check all directions (direction is unknown) // TODO: Formalize "asymmetric" flag on connections - -/* <4c7708> ../game_shared/bot/nav_area.cpp:615 */ bool CNavArea::IsConnected(const CNavArea *area, NavDirType dir) const { // we are connected to ourself @@ -647,8 +610,6 @@ bool CNavArea::IsConnected(const CNavArea *area, NavDirType dir) const // Compute change in height from this area to given area // TODO: This is approximate for now - -/* <4c89fd> ../game_shared/bot/nav_area.cpp:674 */ float CNavArea::ComputeHeightChange(const CNavArea *area) { float ourZ = GetZ(GetCenter()); @@ -659,8 +620,6 @@ float CNavArea::ComputeHeightChange(const CNavArea *area) // Given the portion of the original area, update its internal data // The "ignoreEdge" direction defines the side of the original area that the new area does not include - -/* <4c9e37> ../game_shared/bot/nav_area.cpp:687 */ void CNavArea::FinishSplitEdit(CNavArea *newArea, NavDirType ignoreEdge) { newArea->m_center.x = (newArea->m_extent.lo.x + newArea->m_extent.hi.x) / 2.0f; @@ -716,8 +675,6 @@ void CNavArea::FinishSplitEdit(CNavArea *newArea, NavDirType ignoreEdge) } // Create a new area between this area and given area - -/* <4c8b85> ../game_shared/bot/nav_area.cpp:745 */ bool CNavArea::SpliceEdit(CNavArea *other) { CNavArea *newArea = NULL; @@ -881,8 +838,6 @@ bool CNavArea::SpliceEdit(CNavArea *other) } // Merge this area and given adjacent area - -/* <4d72dd> ../game_shared/bot/nav_area.cpp:911 */ bool CNavArea::MergeEdit(CNavArea *adj) { // can only merge if attributes of both areas match @@ -932,22 +887,18 @@ bool CNavArea::MergeEdit(CNavArea *adj) return true; } -/* <4c78a9> ../game_shared/bot/nav_area.cpp:964 */ void ApproachAreaAnalysisPrep() { // collect "good-sized" areas for computing approach areas buildGoodSizedList(); } -/* <4c7a37> ../game_shared/bot/nav_area.cpp:971 */ void CleanupApproachAreaAnalysisPrep() { goodSizedAreaList.clear(); } // Destroy ladder representations - -/* <4c7b18> ../game_shared/bot/nav_area.cpp:980 */ void DestroyLadders() { while (!TheNavLadderList.empty()) @@ -959,8 +910,6 @@ void DestroyLadders() } // Free navigation map data - -/* <4d6733> ../game_shared/bot/nav_area.cpp:994 */ void DestroyNavigationMap() { IMPL_CLASS(CNavArea, m_isReset) = true; @@ -997,19 +946,16 @@ void DestroyNavigationMap() // Strip the "analyzed" data out of all navigation areas -/* <4c7c70> ../game_shared/bot/nav_area.cpp:1031 */ void StripNavigationAreas() { for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); area->Strip(); } } // Remove "analyzed" data from nav area - -/* <4c7e9a> ../game_shared/bot/nav_area.cpp:1046 */ void CNavArea::Strip() { m_approachCount = 0; @@ -1017,13 +963,11 @@ void CNavArea::Strip() } // Start at given position and find first area in given direction - -/* <4d1b9c> ../game_shared/bot/nav_area.cpp:1057 */ inline CNavArea *FindFirstAreaInDirection(const Vector *start, NavDirType dir, float range, float beneathLimit, CBaseEntity *traceIgnore = NULL, Vector *closePos = NULL) { CNavArea *area = NULL; Vector pos = *start; - int end = (int)((range / GenerationStepSize) + 0.5f); + int end = int((range / GenerationStepSize) + 0.5f); for (int i = 1; i <= end; ++i) { @@ -1059,8 +1003,6 @@ inline CNavArea *FindFirstAreaInDirection(const Vector *start, NavDirType dir, f } // Determine if we can "jump down" from given point - -/* <4c3de4> ../game_shared/bot/nav_area.cpp:1102 */ inline bool testJumpDown(const Vector *fromPos, const Vector *toPos) { float dz = fromPos->z - toPos->z; @@ -1096,7 +1038,6 @@ inline bool testJumpDown(const Vector *fromPos, const Vector *toPos) return true; } -/* <4d1b44> ../game_shared/bot/nav_area.cpp:1138 */ inline CNavArea *findJumpDownArea(const Vector *fromPos, NavDirType dir) { Vector start(fromPos->x, fromPos->y, fromPos->z + HalfHumanHeight); @@ -1112,15 +1053,13 @@ inline CNavArea *findJumpDownArea(const Vector *fromPos, NavDirType dir) } // Define connections between adjacent generated areas - -/* <4d1c46> ../game_shared/bot/nav_area.cpp:1157 */ void ConnectGeneratedAreas() { CONSOLE_ECHO(" Connecting navigation areas...\n"); for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); // scan along edge nodes, stepping one node over into the next area // for now, only use bi-directional connections @@ -1131,14 +1070,14 @@ void ConnectGeneratedAreas() { CNavNode *adj = node->GetConnectedNode(NORTH); - if (adj && adj->GetArea() && adj->GetConnectedNode(SOUTH) == node) + if (adj != NULL && adj->GetArea() && adj->GetConnectedNode(SOUTH) == node) { area->ConnectTo(adj->GetArea(), NORTH); } else { CNavArea *downArea = findJumpDownArea(node->GetPosition(), NORTH); - if (downArea && downArea != area) + if (downArea != NULL && downArea != area) area->ConnectTo(downArea, NORTH); } } @@ -1148,14 +1087,14 @@ void ConnectGeneratedAreas() { CNavNode *adj = node->GetConnectedNode(WEST); - if (adj && adj->GetArea() && adj->GetConnectedNode(EAST) == node) + if (adj != NULL && adj->GetArea() && adj->GetConnectedNode(EAST) == node) { area->ConnectTo(adj->GetArea(), WEST); } else { CNavArea *downArea = findJumpDownArea(node->GetPosition(), WEST); - if (downArea && downArea != area) + if (downArea != NULL && downArea != area) area->ConnectTo(downArea, WEST); } } @@ -1165,22 +1104,22 @@ void ConnectGeneratedAreas() // TODO: This allows one-node-wide areas - do we want this? node = area->m_node[ SOUTH_WEST ]; node = node->GetConnectedNode(NORTH); - if (node) + if (node != NULL) { CNavNode *end = area->m_node[ SOUTH_EAST ]->GetConnectedNode(NORTH); // TODO: Figure out why cs_backalley gets a NULL node in here... - for (; node && node != end; node = node->GetConnectedNode(EAST)) + for (; node != NULL && node != end; node = node->GetConnectedNode(EAST)) { CNavNode *adj = node->GetConnectedNode(SOUTH); - if (adj && adj->GetArea() && adj->GetConnectedNode(NORTH) == node) + if (adj != NULL && adj->GetArea() && adj->GetConnectedNode(NORTH) == node) { area->ConnectTo(adj->GetArea(), SOUTH); } else { CNavArea *downArea = findJumpDownArea(node->GetPosition(), SOUTH); - if (downArea && downArea != area) + if (downArea != NULL && downArea != area) area->ConnectTo(downArea, SOUTH); } } @@ -1189,21 +1128,21 @@ void ConnectGeneratedAreas() // east edge - this edge's nodes are actually part of adjacent areas node = area->m_node[ NORTH_EAST ]; node = node->GetConnectedNode(WEST); - if (node) + if (node != NULL) { CNavNode *end = area->m_node[ SOUTH_EAST ]->GetConnectedNode(WEST); - for (; node && node != end; node = node->GetConnectedNode(SOUTH)) + for (; node != NULL && node != end; node = node->GetConnectedNode(SOUTH)) { CNavNode *adj = node->GetConnectedNode(EAST); - if (adj && adj->GetArea() && adj->GetConnectedNode(WEST) == node) + if (adj != NULL && adj->GetArea() && adj->GetConnectedNode(WEST) == node) { area->ConnectTo(adj->GetArea(), EAST); } else { CNavArea *downArea = findJumpDownArea(node->GetPosition(), EAST); - if (downArea && downArea != area) + if (downArea != NULL && downArea != area) area->ConnectTo(downArea, EAST); } } @@ -1213,8 +1152,6 @@ void ConnectGeneratedAreas() // Merge areas together to make larger ones (must remain rectangular - convex). // Areas can only be merged if their attributes match. - -/* <4d922b> ../game_shared/bot/nav_area.cpp:1259 */ void MergeGeneratedAreas() { CONSOLE_ECHO(" Merging navigation areas...\n"); @@ -1227,7 +1164,7 @@ void MergeGeneratedAreas() for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); // north edge NavConnectList::iterator citer; @@ -1347,8 +1284,6 @@ void MergeGeneratedAreas() // Return true if area is more or less square. // This is used when merging to prevent long, thin, areas being created. - -/* <4c342b> ../game_shared/bot/nav_area.cpp:1394 */ inline bool IsAreaRoughlySquare(const class CNavArea *area) { float aspect = area->GetSizeX() / area->GetSizeY(); @@ -1362,8 +1297,6 @@ inline bool IsAreaRoughlySquare(const class CNavArea *area) } // Recursively chop area in half along X until child areas are roughly square - -/* <4d70f4> ../game_shared/bot/nav_area.cpp:1410 */ void SplitX(CNavArea *area) { if (IsAreaRoughlySquare(area)) @@ -1376,7 +1309,7 @@ void SplitX(CNavArea *area) SnapToGrid(&split); const float epsilon = 0.1f; - if (abs(split - area->GetExtent()->lo.x) < epsilon || abs(split - area->GetExtent()->hi.x) < epsilon) + if (Q_abs(split - area->GetExtent()->lo.x) < epsilon || Q_abs(split - area->GetExtent()->hi.x) < epsilon) { // too small to subdivide return; @@ -1391,7 +1324,6 @@ void SplitX(CNavArea *area) } } -/* <4d6fe1> ../game_shared/bot/nav_area.cpp:1442 */ void SplitY(CNavArea *area) { if (IsAreaRoughlySquare(area)) @@ -1404,8 +1336,8 @@ void SplitY(CNavArea *area) SnapToGrid(&split); const float epsilon = 0.1f; - if (abs(split - area->GetExtent()->lo.y) < epsilon || - abs(split - area->GetExtent()->hi.y) < epsilon) + if (Q_abs(split - area->GetExtent()->lo.y) < epsilon + || Q_abs(split - area->GetExtent()->hi.y) < epsilon) { // too small to subdivide return; @@ -1421,15 +1353,13 @@ void SplitY(CNavArea *area) } // Split any long, thin, areas into roughly square chunks. - -/* <4d7207> ../game_shared/bot/nav_area.cpp:1474 */ void SquareUpAreas() { NavAreaList::iterator iter = TheNavAreaList.begin(); while (iter != TheNavAreaList.end()) { - CNavArea *area = *iter; + CNavArea *area = (*iter); ++iter; if (!IsAreaRoughlySquare(area)) @@ -1449,8 +1379,6 @@ void SquareUpAreas() // All of the nodes within the test area must have the same attributes. // All of the nodes must be approximately co-planar w.r.t the NW node's normal, with the // exception of 1x1 areas which can be any angle. - -/* <4c8066> ../game_shared/bot/nav_area.cpp:1503 */ bool TestArea(CNavNode *node, int width, int height) { Vector normal = *node->GetNormal(); @@ -1484,7 +1412,7 @@ bool TestArea(CNavNode *node, int width, int height) // nodes must lie on/near the plane if (width > 1 || height > 1) { - float dist = abs(DotProduct(*horizNode->GetPosition(), normal) + d); + float dist = Q_abs(DotProduct(*horizNode->GetPosition(), normal) + d); if (dist > offPlaneTolerance) return false; } @@ -1497,7 +1425,7 @@ bool TestArea(CNavNode *node, int width, int height) // nodes must lie on/near the plane if (width > 1 || height > 1) { - float dist = abs(DotProduct(*vertNode->GetPosition(), normal) + d); + float dist = Q_abs(DotProduct(*vertNode->GetPosition(), normal) + d); if (dist > offPlaneTolerance) return false; } @@ -1515,7 +1443,7 @@ bool TestArea(CNavNode *node, int width, int height) return false; // nodes must lie on/near the plane - float dist = abs(DotProduct(*horizNode->GetPosition(), normal) + d); + float dist = Q_abs(DotProduct(*horizNode->GetPosition(), normal) + d); if (dist > offPlaneTolerance) return false; } @@ -1527,8 +1455,6 @@ bool TestArea(CNavNode *node, int width, int height) // Create a nav area, and mark all nodes it overlaps as "covered" // NOTE: Nodes on the east and south edges are not included. // Returns number of nodes covered by this area, or -1 for error; - -/* <4c82ea> ../game_shared/bot/nav_area.cpp:1582 */ int BuildArea(CNavNode *node, int width, int height) { //CONSOLE_ECHO("BuildArea(#%d, %d, %d)\n", node->GetID(), width, height); @@ -1562,8 +1488,8 @@ int BuildArea(CNavNode *node, int width, int height) } swNode = vertNode; - horizNode = vertNode; + for (int x = 0; x < width; ++x) { horizNode = horizNode->GetConnectedNode(EAST); @@ -1582,14 +1508,12 @@ int BuildArea(CNavNode *node, int width, int height) // since all internal nodes have the same attributes, set this area's attributes area->SetAttributes(node->GetAttributes()); - //fprintf(fp, "f %d %d %d %d\n", nwNode->m_id, neNode->m_id, seNode->m_id, swNode->m_id); + //Q_fprintf(fp, "f %d %d %d %d\n", nwNode->m_id, neNode->m_id, seNode->m_id, swNode->m_id); return coveredNodes; } // For each ladder in the map, create a navigation representation of it. - -/* <4d3581> ../game_shared/bot/nav_area.cpp:1645 */ void BuildLadders() { // remove any left-over ladders @@ -1712,7 +1636,6 @@ void BuildLadders() // Find adjacent navigation areas at the top of the ladder // get approximate postion of player on ladder - center = ladder->m_top + Vector(0, 0, GenerationStepSize); AddDirectionVector(¢er, ladder->m_dir, HalfHumanWidth); @@ -1800,13 +1723,11 @@ void BuildLadders() // Mark all areas that require a jump to get through them. // This currently relies on jump areas having extreme slope. - -/* <4c85c3> ../game_shared/bot/nav_area.cpp:1864 */ void MarkJumpAreas() { for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); Vector u, v; // compute our unit surface normal @@ -1830,11 +1751,9 @@ void MarkJumpAreas() // generate CNavAreas - rectangular areas of "walkable" space. These areas // are connected to each other, allowing the AI to know how to move from // area to area. - +// // This is a "greedy" algorithm that attempts to cover the walkable area // with the fewest, largest, rectangles. - -/* <4d943a> ../game_shared/bot/nav_area.cpp:1899 */ void GenerateNavigationAreaMesh() { // haven't yet seen a map use larger than 30... @@ -1881,7 +1800,7 @@ void GenerateNavigationAreaMesh() NavAreaList::iterator iter; for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); const Extent *areaExtent = area->GetExtent(); if (areaExtent->lo.x < extent.lo.x) @@ -1907,8 +1826,6 @@ void GenerateNavigationAreaMesh() } // Return true if 'pos' is within 2D extents of area. - -/* <4c86fa> ../game_shared/bot/nav_area.cpp:1975 */ bool CNavArea::IsOverlapping(const Vector *pos) const { if (pos->x >= m_extent.lo.x && pos->x <= m_extent.hi.x && @@ -1919,8 +1836,6 @@ bool CNavArea::IsOverlapping(const Vector *pos) const } // Return true if 'area' overlaps our 2D extents - -/* <4c8726> ../game_shared/bot/nav_area.cpp:1988 */ bool CNavArea::IsOverlapping(const CNavArea *area) const { if (area->m_extent.lo.x < m_extent.hi.x && area->m_extent.hi.x > m_extent.lo.x && @@ -1931,8 +1846,6 @@ bool CNavArea::IsOverlapping(const CNavArea *area) const } // Return true if 'area' overlaps our X extent - -/* <4c8761> ../game_shared/bot/nav_area.cpp:2001 */ bool CNavArea::IsOverlappingX(const CNavArea *area) const { if (area->m_extent.lo.x < m_extent.hi.x && area->m_extent.hi.x > m_extent.lo.x) @@ -1942,8 +1855,6 @@ bool CNavArea::IsOverlappingX(const CNavArea *area) const } // Return true if 'area' overlaps our Y extent - -/* <4c878d> ../game_shared/bot/nav_area.cpp:2013 */ bool CNavArea::IsOverlappingY(const CNavArea *area) const { if (area->m_extent.lo.y < m_extent.hi.y && area->m_extent.hi.y > m_extent.lo.y) @@ -1953,8 +1864,6 @@ bool CNavArea::IsOverlappingY(const CNavArea *area) const } // Return true if given point is on or above this area, but no others - -/* <4c8a66> ../game_shared/bot/nav_area.cpp:2025 */ bool CNavArea::Contains(const Vector *pos) const { // check 2D overlap @@ -1970,7 +1879,7 @@ bool CNavArea::Contains(const Vector *pos) const for (NavAreaList::const_iterator iter = m_overlapList.begin(); iter != m_overlapList.end(); ++iter) { - const CNavArea *area = *iter; + const CNavArea *area = (*iter); // skip self if (area == this) @@ -1998,8 +1907,6 @@ bool CNavArea::Contains(const Vector *pos) const } // Return true if this area and given area are approximately co-planar - -/* <4c87b9> ../game_shared/bot/nav_area.cpp:2071 */ bool CNavArea::IsCoplanar(const CNavArea *area) const { Vector u, v; @@ -2039,8 +1946,6 @@ bool CNavArea::IsCoplanar(const CNavArea *area) const // Return Z of area at (x,y) of 'pos' // Trilinear interpolation of Z values at quad edges. // NOTE: pos->z is not used. - -/* <4c8963> ../game_shared/bot/nav_area.cpp:2114 */ float CNavArea::GetZ(const Vector *pos) const { float dx = m_extent.hi.x - m_extent.lo.x; @@ -2070,7 +1975,6 @@ float CNavArea::GetZ(const Vector *pos) const return northZ + v * (southZ - northZ); } -/* <4caa36> ../game_shared/bot/nav_area.cpp:2143 */ float CNavArea::GetZ(float x, float y) const { Vector pos(x, y, 0.0f); @@ -2078,9 +1982,7 @@ float CNavArea::GetZ(float x, float y) const } // Return closest point to 'pos' on 'area'. -//Returned point is in 'close'. - -/* <4caab9> ../game_shared/bot/nav_area.cpp:2155 */ +// Returned point is in 'close'. void CNavArea::GetClosestPointOnArea(const Vector *pos, Vector *close) const { const Extent *extent = GetExtent(); @@ -2146,8 +2048,6 @@ void CNavArea::GetClosestPointOnArea(const Vector *pos, Vector *close) const } // Return shortest distance squared between point and this area - -/* <4cab19> ../game_shared/bot/nav_area.cpp:2224 */ float CNavArea::GetDistanceSquaredToPoint(const Vector *pos) const { const Extent *extent = GetExtent(); @@ -2219,7 +2119,6 @@ float CNavArea::GetDistanceSquaredToPoint(const Vector *pos) const } } -/* <4cacac> ../game_shared/bot/nav_area.cpp:2298 */ CNavArea *CNavArea::GetRandomAdjacentArea(NavDirType dir) const { int count = m_connect[ dir ].size(); @@ -2241,8 +2140,6 @@ CNavArea *CNavArea::GetRandomAdjacentArea(NavDirType dir) const // Compute "portal" between to adjacent areas. // Return center of portal opening, and half-width defining sides of portal from center. // NOTE: center->z is unset. - -/* <4cadd2> ../game_shared/bot/nav_area.cpp:2322 */ void CNavArea::ComputePortal(const CNavArea *to, NavDirType dir, Vector *center, float *halfWidth) const { if (dir == NORTH || dir == SOUTH) @@ -2296,8 +2193,6 @@ void CNavArea::ComputePortal(const CNavArea *to, NavDirType dir, Vector *center, } // Compute closest point within the "portal" between to adjacent areas. - -/* <4cb0d7> ../game_shared/bot/nav_area.cpp:2378 */ void CNavArea::ComputeClosestPointInPortal(const CNavArea *to, NavDirType dir, const Vector *fromPos, Vector *closePos) const { const float margin = GenerationStepSize / 2.0f; @@ -2372,13 +2267,11 @@ void CNavArea::ComputeClosestPointInPortal(const CNavArea *to, NavDirType dir, c } // Return true if there are no bi-directional links on the given side - -/* <4cae93> ../game_shared/bot/nav_area.cpp:2455 */ bool CNavArea::IsEdge(NavDirType dir) const { for (NavConnectList::const_iterator it = m_connect[ dir ].begin(); it != m_connect[ dir ].end(); ++it) { - const NavConnect connect = *it; + const NavConnect connect = (*it); if (connect.area->IsConnected(this, OppositeDirection(dir))) return false; @@ -2388,8 +2281,6 @@ bool CNavArea::IsEdge(NavDirType dir) const } // Return direction from this area to the given point - -/* <4cb1f5> ../game_shared/bot/nav_area.cpp:2473 */ NavDirType CNavArea::ComputeDirection(Vector *point) const { if (point->x >= m_extent.lo.x && point->x <= m_extent.hi.x) @@ -2410,7 +2301,7 @@ NavDirType CNavArea::ComputeDirection(Vector *point) const // find closest direction Vector to = *point - m_center; - if (abs(to.x) > abs(to.y)) + if (Q_abs(to.x) > Q_abs(to.y)) { if (to.x > 0.0f) return EAST; @@ -2427,8 +2318,6 @@ NavDirType CNavArea::ComputeDirection(Vector *point) const } // Draw area for debugging - -/* <4cb26d> ../game_shared/bot/nav_area.cpp:2513 */ void CNavArea::Draw(byte red, byte green, byte blue, int duration) { Vector nw, ne, sw, se; @@ -2470,7 +2359,6 @@ void CNavArea::Draw(byte red, byte green, byte blue, int duration) UTIL_DrawBeamPoints(nw, se, duration, red, green, blue); UTIL_DrawBeamPoints(ne, sw, duration, red, green, blue); } - if (GetAttributes() & NAV_PRECISE) { float size = 8.0f; @@ -2482,7 +2370,6 @@ void CNavArea::Draw(byte red, byte green, byte blue, int duration) Vector right(m_center.x + size, m_center.y, m_center.z + cv_bot_nav_zdraw.value); UTIL_DrawBeamPoints(left, right, duration, red, green, blue); } - if (GetAttributes() & NAV_NO_JUMP) { float size = 8.0f; @@ -2498,8 +2385,6 @@ void CNavArea::Draw(byte red, byte green, byte blue, int duration) } // Draw selected corner for debugging - -/* <4cb855> ../game_shared/bot/nav_area.cpp:2585 */ void CNavArea::DrawMarkedCorner(NavCornerType corner, byte red, byte green, byte blue, int duration) { Vector nw, ne, sw, se; @@ -2546,8 +2431,6 @@ void CNavArea::DrawMarkedCorner(NavCornerType corner, byte red, byte green, byte } // Add to open list in decreasing value order - -/* <4cbb32> ../game_shared/bot/nav_area.cpp:2634 */ void CNavArea::AddToOpenList() { // mark as being on open list for quick check @@ -2596,8 +2479,6 @@ void CNavArea::AddToOpenList() // A smaller value has been found, update this area on the open list // TODO: "bubbling" does unnecessary work, since the order of all other nodes will be unchanged - only this node is altered - -/* <4cbd73> ../game_shared/bot/nav_area.cpp:2685 */ void CNavArea::UpdateOnOpenList() { // since value can only decrease, bubble this area up from current spot @@ -2614,17 +2495,16 @@ void CNavArea::UpdateOnOpenList() other->m_prevOpen = this; other->m_nextOpen = after; - if (before) + if (before != NULL) before->m_nextOpen = this; else IMPL(m_openList) = this; - if (after) + if (after != NULL) after->m_prevOpen = other; } } -/* <4cbdbc> ../game_shared/bot/nav_area.cpp:2713 */ void CNavArea::RemoveFromOpenList() { if (m_prevOpen) @@ -2640,8 +2520,6 @@ void CNavArea::RemoveFromOpenList() } // Clears the open and closed lists for a new search - -/* <4cbddf> ../game_shared/bot/nav_area.cpp:2731 */ void CNavArea::ClearSearchLists() { CNavArea::MakeNewMarker(); @@ -2650,8 +2528,6 @@ void CNavArea::ClearSearchLists() // Return the coordinates of the area's corner. // NOTE: Do not retain the returned pointer - it is temporary. - -/* <4cbe06> ../game_shared/bot/nav_area.cpp:2744 */ const Vector *CNavArea::GetCorner(NavCornerType corner) const { static Vector pos; @@ -2681,15 +2557,13 @@ const Vector *CNavArea::GetCorner(NavCornerType corner) const } // Returns true if an existing hiding spot is too close to given position - -/* <4cbe86> ../game_shared/bot/nav_area.cpp:2776 */ bool CNavArea::IsHidingSpotCollision(const Vector *pos) const { const float collisionRange = 30.0f; for (HidingSpotList::const_iterator iter = m_hidingSpotList.begin(); iter != m_hidingSpotList.end(); ++iter) { - const HidingSpot *spot = *iter; + const HidingSpot *spot = (*iter); if ((*spot->GetPosition() - *pos).IsLengthLessThan(collisionRange)) return true; @@ -2698,7 +2572,6 @@ bool CNavArea::IsHidingSpotCollision(const Vector *pos) const return false; } -/* <4c3aa2> ../game_shared/bot/nav_area.cpp:2792 */ bool IsHidingSpotInCover(const Vector *spot) { int coverCount = 0; @@ -2720,7 +2593,7 @@ bool IsHidingSpotInCover(const Vector *spot) for (float angle = 0.0f; angle < 2.0f * M_PI; angle += inc) { - to = from + Vector(coverRange * cos(angle), coverRange * sin(angle), HalfHumanHeight); + to = from + Vector(coverRange * Q_cos(angle), coverRange * Q_sin(angle), HalfHumanHeight); UTIL_TraceLine(from, to, ignore_monsters, NULL, &result); @@ -2738,8 +2611,6 @@ bool IsHidingSpotInCover(const Vector *spot) } // Analyze local area neighborhood to find "hiding spots" for this area - -/* <4cc054> ../game_shared/bot/nav_area.cpp:2834 */ void CNavArea::ComputeHidingSpots() { struct @@ -2767,7 +2638,7 @@ void CNavArea::ComputeHidingSpots() for (NavConnectList::iterator iter = m_connect[d].begin(); iter != m_connect[d].end(); ++iter) { - NavConnect connect = *iter; + NavConnect connect = (*iter); // if connection is only one-way, it's a "jump down" connection (ie: a discontinuity that may mean cover) // ignore it @@ -2841,21 +2712,18 @@ void CNavArea::ComputeHidingSpots() m_hidingSpotList.push_back(new HidingSpot(&pos, (IsHidingSpotInCover(&pos)) ? HidingSpot::IN_COVER : 0)); } - if (cornerCount[ NORTH_EAST ] == 2) { Vector pos = *GetCorner(NORTH_EAST) + Vector(-offset, offset, 0.0f); if (!IsHidingSpotCollision(&pos)) m_hidingSpotList.push_back(new HidingSpot(&pos, (IsHidingSpotInCover(&pos)) ? HidingSpot::IN_COVER : 0)); } - if (cornerCount[ SOUTH_WEST ] == 2) { Vector pos = *GetCorner(SOUTH_WEST) + Vector(offset, -offset, 0.0f); if (!IsHidingSpotCollision(&pos)) m_hidingSpotList.push_back(new HidingSpot(&pos, (IsHidingSpotInCover(&pos)) ? HidingSpot::IN_COVER : 0)); } - if (cornerCount[ SOUTH_EAST ] == 2) { Vector pos = *GetCorner(SOUTH_EAST) + Vector(-offset, -offset, 0.0f); @@ -2865,8 +2733,6 @@ void CNavArea::ComputeHidingSpots() } // Determine how much walkable area we can see from the spot, and how far away we can see. - -/* <4cccaf> ../game_shared/bot/nav_area.cpp:2963 */ void ClassifySniperSpot(HidingSpot *spot) { // assume we are crouching @@ -2881,7 +2747,7 @@ void ClassifySniperSpot(HidingSpot *spot) for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); const Extent *extent = area->GetExtent(); @@ -2950,8 +2816,6 @@ void ClassifySniperSpot(HidingSpot *spot) } // Analyze local area neighborhood to find "sniper spots" for this area - -/* <4ccf19> ../game_shared/bot/nav_area.cpp:3049 */ void CNavArea::ComputeSniperSpots() { if (cv_bot_quicksave.value > 0.0f) @@ -2959,18 +2823,15 @@ void CNavArea::ComputeSniperSpots() for (HidingSpotList::iterator iter = m_hidingSpotList.begin(); iter != m_hidingSpotList.end(); ++iter) { - HidingSpot *spot = *iter; - + HidingSpot *spot = (*iter); ClassifySniperSpot(spot); } } // Given the areas we are moving between, return the spots we will encounter - -/* <4ccfbd> ../game_shared/bot/nav_area.cpp:3066 */ SpotEncounter *CNavArea::GetSpotEncounter(const CNavArea *from, const CNavArea *to) { - if (from && to) + if (from != NULL && to != NULL) { SpotEncounter *e; @@ -2987,8 +2848,6 @@ SpotEncounter *CNavArea::GetSpotEncounter(const CNavArea *from, const CNavArea * } // Add spot encounter data when moving from area to area - -/* <4cd0a5> ../game_shared/bot/nav_area.cpp:3088 */ void CNavArea::AddSpotEncounters(const class CNavArea *from, NavDirType fromDir, const CNavArea *to, NavDirType toDir) { SpotEncounter e; @@ -3039,7 +2898,7 @@ void CNavArea::AddSpotEncounters(const class CNavArea *from, NavDirType fromDir, // check each hiding spot for visibility for (HidingSpotList::iterator iter = TheHidingSpotList.begin(); iter != TheHidingSpotList.end(); ++iter) { - spot = *iter; + spot = (*iter); // only look at spots with cover (others are out in the open and easily seen) if (!spot->HasGoodCover()) @@ -3090,8 +2949,6 @@ void CNavArea::AddSpotEncounters(const class CNavArea *from, NavDirType fromDir, // Compute "spot encounter" data. This is an ordered list of spots to look at // for each possible path thru a nav area. - -/* <4cd99c> ../game_shared/bot/nav_area.cpp:3192 */ void CNavArea::ComputeSpotEncounters() { m_spotEncounterList.clear(); @@ -3125,8 +2982,6 @@ void CNavArea::ComputeSpotEncounters() } // Decay the danger values - -/* <4cdca9> ../game_shared/bot/nav_area.cpp:3228 */ void CNavArea::DecayDanger() { // one kill == 1.0, which we will forget about in two minutes @@ -3147,8 +3002,6 @@ void CNavArea::DecayDanger() } // Increase the danger of this area for the given team - -/* <4cdd46> ../game_shared/bot/nav_area.cpp:3251 */ void CNavArea::IncreaseDanger(int teamID, float amount) { // before we add the new value, decay what's there @@ -3159,8 +3012,6 @@ void CNavArea::IncreaseDanger(int teamID, float amount) } // Return the danger of this area (decays over time) - -/* <4cddc7> ../game_shared/bot/nav_area.cpp:3264 */ float CNavArea::GetDanger(int teamID) { DecayDanger(); @@ -3168,8 +3019,6 @@ float CNavArea::GetDanger(int teamID) } // Increase the danger of nav areas containing and near the given position - -/* <4cde4b> ../game_shared/bot/nav_area.cpp:3274 */ void IncreaseDangerNearby(int teamID, float amount, class CNavArea *startArea, const Vector *pos, float maxRadius) { if (startArea == NULL) @@ -3214,13 +3063,11 @@ void IncreaseDangerNearby(int teamID, float amount, class CNavArea *startArea, c } // Show danger levels for debugging - -/* <4ce2c4> ../game_shared/bot/nav_area.cpp:3321 */ void DrawDanger() { for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); Vector center = *area->GetCenter(); Vector top; @@ -3247,8 +3094,6 @@ void DrawDanger() } // If a player is at the given spot, return true - -/* <4ce523> ../game_shared/bot/nav_area.cpp:3356 */ bool IsSpotOccupied(CBaseEntity *me, const Vector *pos) { const float closeRange = 75.0f; @@ -3259,7 +3104,7 @@ bool IsSpotOccupied(CBaseEntity *me, const Vector *pos) if (player != me) { - if (player && range < closeRange) + if (player != NULL && range < closeRange) return true; } @@ -3274,7 +3119,6 @@ bool IsSpotOccupied(CBaseEntity *me, const Vector *pos) return false; } -/* <4c118b> ../game_shared/bot/nav_area.cpp:3385 */ class CollectHidingSpotsFunctor { public: @@ -3301,11 +3145,11 @@ public: for (HidingSpotList::const_iterator iter = list->begin(); iter != list->end() && m_count < MAX_SPOTS; ++iter) { - const HidingSpot *spot = *iter; + const HidingSpot *spot = (*iter); if (m_useCrouchAreas == false) { CNavArea *area = TheNavAreaGrid.GetNavArea(spot->GetPosition()); - if (area && (area->GetAttributes() & NAV_CROUCH)) + if (area != NULL && (area->GetAttributes() & NAV_CROUCH)) continue; } @@ -3364,8 +3208,6 @@ public: // Do a breadth-first search to find a nearby hiding spot and return it. // Don't pick a hiding spot that a Player is currently occupying. // TODO: Clean up this mess - -/* <4d1806> ../game_shared/bot/nav_area.cpp:3477 */ const Vector *FindNearbyHidingSpot(CBaseEntity *me, const Vector *pos, CNavArea *startArea, float maxRange, bool isSniper, bool useNearest) { if (startArea == NULL) @@ -3379,7 +3221,7 @@ const Vector *FindNearbyHidingSpot(CBaseEntity *me, const Vector *pos, CNavArea if (collector.m_count) { - int which = RANDOM_LONG(0, collector.m_count-1); + int which = RANDOM_LONG(0, collector.m_count - 1); return collector.m_hidingSpot[ which ]; } else @@ -3390,7 +3232,7 @@ const Vector *FindNearbyHidingSpot(CBaseEntity *me, const Vector *pos, CNavArea if (collector.m_count) { - int which = RANDOM_LONG(0, collector.m_count-1); + int which = RANDOM_LONG(0, collector.m_count - 1); return collector.m_hidingSpot[ which ]; } @@ -3431,8 +3273,6 @@ const Vector *FindNearbyHidingSpot(CBaseEntity *me, const Vector *pos, CNavArea // Return true if moving from "start" to "finish" will cross a player's line of fire // The path from "start" to "finish" is assumed to be a straight line // "start" and "finish" are assumed to be points on the ground - -/* <4c3feb> ../game_shared/bot/nav_area.cpp:3591 */ bool IsCrossingLineOfFire(const Vector &start, const Vector &finish, CBaseEntity *ignore, int ignoreTeam) { for (int p = 1; p <= gpGlobals->maxClients; ++p) @@ -3480,8 +3320,6 @@ bool IsCrossingLineOfFire(const Vector &start, const Vector &finish, CBaseEntity } // Select a random hiding spot among the nav areas that are tagged with the given place - -/* <4d031a> ../game_shared/bot/nav_area.cpp:3544 */ const Vector *FindRandomHidingSpot(CBaseEntity *me, Place place, bool isSniper) { // collect set of nearby hiding spots @@ -3492,7 +3330,7 @@ const Vector *FindRandomHidingSpot(CBaseEntity *me, Place place, bool isSniper) if (collector.m_count) { - int which = RANDOM_LONG(0, collector.m_count-1); + int which = RANDOM_LONG(0, collector.m_count - 1); return collector.m_hidingSpot[ which ]; } else @@ -3503,7 +3341,7 @@ const Vector *FindRandomHidingSpot(CBaseEntity *me, Place place, bool isSniper) if (collector.m_count) { - int which = RANDOM_LONG(0, collector.m_count-1); + int which = RANDOM_LONG(0, collector.m_count - 1); return collector.m_hidingSpot[ which ]; } @@ -3519,14 +3357,13 @@ const Vector *FindRandomHidingSpot(CBaseEntity *me, Place place, bool isSniper) return NULL; // select a hiding spot at random - int which = RANDOM_LONG(0, collector.m_count-1); + int which = RANDOM_LONG(0, collector.m_count - 1); return collector.m_hidingSpot[ which ]; } // Select a nearby retreat spot. // Don't pick a hiding spot that a Player is currently occupying. // If "avoidTeam" is nonzero, avoid getting close to members of that team. - const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavArea *startArea, float maxRange, int avoidTeam, bool useCrouchAreas) { if (startArea == NULL) @@ -3581,8 +3418,6 @@ const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavAr // Return number of players with given teamID in this area (teamID == 0 means any/all) // TODO: Keep pointers to contained Players to make this a zero-time query - -/* <4ce934> ../game_shared/bot/nav_area.cpp:3707 */ int CNavArea::GetPlayerCount(int teamID, CBasePlayer *ignore) const { int count = 0; @@ -3611,13 +3446,11 @@ int CNavArea::GetPlayerCount(int teamID, CBasePlayer *ignore) const return count; } -/* <4cea33> ../game_shared/bot/nav_area.cpp:3749 */ CNavArea *GetMarkedArea() { return markedArea; } -/* <4c2a8c> ../game_shared/bot/nav_area.cpp:3757 */ void EditNavAreasReset() { markedArea = NULL; @@ -3629,14 +3462,12 @@ void EditNavAreasReset() lastDrawTimestamp = 0.0f; } -/* <4cea61> ../game_shared/bot/nav_area.cpp:3767 */ void DrawHidingSpots(const class CNavArea *area) { const HidingSpotList *list = area->GetHidingSpotList(); for (HidingSpotList::const_iterator iter = list->begin(); iter != list->end(); ++iter) { - const HidingSpot *spot = *iter; - + const HidingSpot *spot = (*iter); int r, g, b; if (spot->IsIdealSniperSpot()) @@ -3661,15 +3492,12 @@ void DrawHidingSpots(const class CNavArea *area) } // Draw ourselves and adjacent areas - -/* <4cebe7> ../game_shared/bot/nav_area.cpp:3802 */ void CNavArea::DrawConnectedAreas() { CBasePlayer *player = UTIL_GetLocalPlayer(); if (player == NULL) return; - CCSBotManager *ctrl = TheCSBots(); const float maxRange = 500.0f; // draw self @@ -3677,7 +3505,7 @@ void CNavArea::DrawConnectedAreas() { if (GetPlace() == 0) Draw(50, 0, 0, 3); - else if (GetPlace() != ctrl->GetNavPlace()) + else if (GetPlace() != TheCSBots()->GetNavPlace()) Draw(0, 0, 200, 3); else Draw(0, 255, 0, 3); @@ -3722,7 +3550,7 @@ void CNavArea::DrawConnectedAreas() { if (adj->GetPlace() == 0) adj->Draw(50, 0, 0, 3); - else if (adj->GetPlace() != ctrl->GetNavPlace()) + else if (adj->GetPlace() != TheCSBots()->GetNavPlace()) adj->Draw(0, 0, 200, 3); else adj->Draw(0, 255, 0, 3); @@ -3760,22 +3588,22 @@ void CNavArea::DrawConnectedAreas() switch (dir) { - case NORTH: - from = hookPos + Vector(0.0f, size, 0.0f); - to = hookPos + Vector(0.0f, -size, 0.0f); - break; - case SOUTH: - from = hookPos + Vector(0.0f, -size, 0.0f); - to = hookPos + Vector(0.0f, size, 0.0f); - break; - case EAST: - from = hookPos + Vector(-size, 0.0f, 0.0f); - to = hookPos + Vector(+size, 0.0f, 0.0f); - break; - case WEST: - from = hookPos + Vector(size, 0.0f, 0.0f); - to = hookPos + Vector(-size, 0.0f, 0.0f); - break; + case NORTH: + from = hookPos + Vector(0.0f, size, 0.0f); + to = hookPos + Vector(0.0f, -size, 0.0f); + break; + case SOUTH: + from = hookPos + Vector(0.0f, -size, 0.0f); + to = hookPos + Vector(0.0f, size, 0.0f); + break; + case EAST: + from = hookPos + Vector(-size, 0.0f, 0.0f); + to = hookPos + Vector(+size, 0.0f, 0.0f); + break; + case WEST: + from = hookPos + Vector(size, 0.0f, 0.0f); + to = hookPos + Vector(-size, 0.0f, 0.0f); + break; } from.z = GetZ(&from) + cv_bot_nav_zdraw.value; @@ -3794,8 +3622,6 @@ void CNavArea::DrawConnectedAreas() } // Raise/lower a corner - -/* <4cf2ee> ../game_shared/bot/nav_area.cpp:3937 */ void CNavArea::RaiseCorner(NavCornerType corner, int amount) { if (corner == NUM_CORNERS) @@ -3830,8 +3656,6 @@ void CNavArea::RaiseCorner(NavCornerType corner, int amount) } // Flood fills all areas with current place - -/* <4c3570> ../game_shared/bot/nav_area.cpp:3976 */ class PlaceFloodFillFunctor { public: @@ -3841,12 +3665,10 @@ public: } bool operator()(CNavArea *area) { - CCSBotManager *ctrl = TheCSBots(); - if (area->GetPlace() != m_initialPlace) return false; - area->SetPlace(ctrl->GetNavPlace()); + area->SetPlace(TheCSBots()->GetNavPlace()); return true; } @@ -3856,11 +3678,8 @@ private: }; // Draw navigation areas and edit them - -/* <4d76ef> ../game_shared/bot/nav_area.cpp:4002 */ void EditNavAreas(NavEditCmdType cmd) { - CCSBotManager *ctrl = TheCSBots(); CBasePlayer *player = UTIL_GetLocalPlayer(); if (player == NULL) return; @@ -3888,11 +3707,11 @@ void EditNavAreas(NavEditCmdType cmd) // show ladder connections for (NavLadderList::iterator iter = TheNavLadderList.begin(); iter != TheNavLadderList.end(); ++iter) { - CNavLadder *ladder = *iter; + CNavLadder *ladder = (*iter); float dx = player->pev->origin.x - ladder->m_bottom.x; float dy = player->pev->origin.y - ladder->m_bottom.y; - if (dx*dx + dy*dy > maxRange*maxRange) + if (dx * dx + dy * dy > maxRange*maxRange) continue; UTIL_DrawBeamPoints(ladder->m_top, ladder->m_bottom, beamTime, 255, 0, 255); @@ -3922,7 +3741,7 @@ void EditNavAreas(NavEditCmdType cmd) } // draw approach points for marked area - if (cv_bot_traceview.value == 3 && markedArea) + if (cv_bot_traceview.value == 3 && markedArea != NULL) { Vector ap; float halfWidth; @@ -4044,9 +3863,9 @@ void EditNavAreas(NavEditCmdType cmd) // do "place painting" if (isPlacePainting) { - if (area->GetPlace() != ctrl->GetNavPlace()) + if (area->GetPlace() != TheCSBots()->GetNavPlace()) { - area->SetPlace(ctrl->GetNavPlace()); + area->SetPlace(TheCSBots()->GetNavPlace()); EMIT_SOUND_DYN(ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/lightswitch2.wav", 1, ATTN_NORM, 0, 100); } } @@ -4076,13 +3895,13 @@ void EditNavAreas(NavEditCmdType cmd) EMIT_SOUND_DYN(ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/lightswitch2.wav", 1, ATTN_NORM, 0, 100); // paint the initial area - area->SetPlace(ctrl->GetNavPlace()); + area->SetPlace(TheCSBots()->GetNavPlace()); } break; } case EDIT_PLACE_PICK: EMIT_SOUND_DYN(ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/blip1.wav", 1, ATTN_NORM, 0, 100); - ctrl->SetNavPlace(area->GetPlace()); + TheCSBots()->SetNavPlace(area->GetPlace()); break; case EDIT_PLACE_FLOODFILL: PlaceFloodFillFunctor pff(area); @@ -4093,7 +3912,7 @@ void EditNavAreas(NavEditCmdType cmd) else // normal editing mode { // draw the "marked" area - if (markedArea && doDraw) + if (markedArea != NULL && doDraw) { markedArea->Draw(0, 255, 255, beamTime); if (markedCorner != NUM_CORNERS) @@ -4121,7 +3940,7 @@ void EditNavAreas(NavEditCmdType cmd) if ((yaw < 45.0f || yaw > 315.0f) || (yaw > 135.0f && yaw < 225.0f)) { - splitEdge = GenerationStepSize * (int)(result.vecEndPos.y/GenerationStepSize); + splitEdge = GenerationStepSize * int(result.vecEndPos.y / GenerationStepSize); from.x = extent->lo.x; from.y = splitEdge; @@ -4135,7 +3954,7 @@ void EditNavAreas(NavEditCmdType cmd) } else { - splitEdge = GenerationStepSize * (int)(result.vecEndPos.x/GenerationStepSize); + splitEdge = GenerationStepSize * int(result.vecEndPos.x / GenerationStepSize); from.x = splitEdge; from.y = extent->lo.y; @@ -4155,7 +3974,6 @@ void EditNavAreas(NavEditCmdType cmd) if (doDraw && (cv_bot_traceview.value != 11 || markedArea == NULL)) area->DrawConnectedAreas(); - // do area-dependant edit commands, if any switch (cmd) { @@ -4237,7 +4055,7 @@ void EditNavAreas(NavEditCmdType cmd) markedArea = NULL; for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); if (area->GetPlace() == 0) { markedArea = area; @@ -4261,7 +4079,7 @@ void EditNavAreas(NavEditCmdType cmd) int totalUnnamedAreas = 0; for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); if (area->GetPlace() == 0) { ++totalUnnamedAreas; @@ -4458,7 +4276,6 @@ void EditNavAreas(NavEditCmdType cmd) isCreatingNavArea = false; } -/* <4c3b30> ../game_shared/bot/nav_area.cpp:4635 */ bool GetGroundHeight(const Vector *pos, float *height, Vector *normal) { Vector to; @@ -4475,7 +4292,7 @@ bool GetGroundHeight(const Vector *pos, float *height, Vector *normal) const float maxOffset = 100.0f; const float inc = 10.0f; - #define MAX_GROUND_LAYERS 16 + const int MAX_GROUND_LAYERS = 16; struct GroundLayerInfo { @@ -4539,8 +4356,6 @@ bool GetGroundHeight(const Vector *pos, float *height, Vector *normal) // Return the "simple" ground height below this point in "height". // This function is much faster, but less tolerant. Make sure the give position is "well behaved". // Return false if position is invalid (outside of map, in a solid area, etc). - -/* <4cf4d2> ../game_shared/bot/nav_area.cpp:4724 */ bool GetSimpleGroundHeight(const Vector *pos, float *height, Vector *normal) { Vector to; @@ -4566,8 +4381,6 @@ bool GetSimpleGroundHeight(const Vector *pos, float *height, Vector *normal) } // Shortest path cost, paying attention to "blocked" areas - -/* <4c0912> ../game_shared/bot/nav_area.cpp:4757 */ class ApproachAreaCost { public: @@ -4601,8 +4414,6 @@ public: // Can we see this area? // For now, if we can see any corner, we can see the area // TODO: Need to check LOS to more than the corners for large and/or long areas - -/* <4c4182> ../game_shared/bot/nav_area.cpp:4791 */ inline bool IsAreaVisible(const Vector *pos, const CNavArea *area) { Vector corner; @@ -4627,8 +4438,6 @@ inline bool IsAreaVisible(const Vector *pos, const CNavArea *area) // Determine the set of "approach areas". // An approach area is an area representing a place where players // move into/out of our local neighborhood of areas. - -/* <4cf54c> ../game_shared/bot/nav_area.cpp:4817 */ void CNavArea::ComputeApproachAreas() { m_approachCount = 0; @@ -4658,7 +4467,7 @@ void CNavArea::ComputeApproachAreas() NavAreaList::iterator iter; for (iter = goodSizedAreaList.begin(); iter != goodSizedAreaList.end(); ++iter) { - CNavArea *farArea = *iter; + CNavArea *farArea = (*iter); BlockedIDCount = 0; @@ -4750,14 +4559,12 @@ void CNavArea::ComputeApproachAreas() } } -/* <4cf961> ../game_shared/bot/nav_area.cpp:4947 */ CNavAreaGrid::CNavAreaGrid() : m_cellSize(300.0f) { m_grid = NULL; Reset(); } -/* <4c4a70> ../game_shared/bot/nav_area.cpp:4953 */ CNavAreaGrid::~CNavAreaGrid() { delete[] m_grid; @@ -4765,14 +4572,14 @@ CNavAreaGrid::~CNavAreaGrid() } // Clear the grid - -/* <4cf837> ../game_shared/bot/nav_area.cpp:4962 */ void CNavAreaGrid::Reset() { - if (m_grid) + if (m_grid != NULL) + { delete[] m_grid; + m_grid = NULL; + } - m_grid = NULL; m_gridSizeX = 0; m_gridSizeY = 0; @@ -4787,8 +4594,6 @@ void CNavAreaGrid::Reset() } // Allocate the grid and define its extents - -/* <4cf984> ../game_shared/bot/nav_area.cpp:4983 */ void CNavAreaGrid::Initialize(float minX, float maxX, float minY, float maxY) { if (m_grid) @@ -4797,15 +4602,13 @@ void CNavAreaGrid::Initialize(float minX, float maxX, float minY, float maxY) m_minX = minX; m_minY = minY; - m_gridSizeX = (int)((maxX - minX) / m_cellSize + 1); - m_gridSizeY = (int)((maxY - minY) / m_cellSize + 1); + m_gridSizeX = int((maxX - minX) / m_cellSize + 1); + m_gridSizeY = int((maxY - minY) / m_cellSize + 1); m_grid = new NavAreaList[ m_gridSizeX * m_gridSizeY ]; } // Add an area to the grid - -/* <4cfa20> ../game_shared/bot/nav_area.cpp:5000 */ void CNavAreaGrid::AddNavArea(CNavArea *area) { // add to grid @@ -4819,7 +4622,7 @@ void CNavAreaGrid::AddNavArea(CNavArea *area) for (int y = loY; y <= hiY; ++y) { for (int x = loX; x <= hiX; ++x) - m_grid[ x + y*m_gridSizeX ].push_back(const_cast(area)); + m_grid[ x + y * m_gridSizeX ].push_back(const_cast(area)); } // add to hash table @@ -4845,8 +4648,6 @@ void CNavAreaGrid::AddNavArea(CNavArea *area) } // Remove an area from the grid - -/* <4cfc86> ../game_shared/bot/nav_area.cpp:5039 */ void CNavAreaGrid::RemoveNavArea(CNavArea *area) { // add to grid @@ -4890,8 +4691,6 @@ void CNavAreaGrid::RemoveNavArea(CNavArea *area) } // Given a position, return the nav area that IsOverlapping and is *immediately* beneath it - -/* <4cff5e> ../game_shared/bot/nav_area.cpp:5080 */ CNavArea *CNavAreaGrid::GetNavArea(const Vector *pos, float beneathLimit) const { if (m_grid == NULL) @@ -4909,7 +4708,7 @@ CNavArea *CNavAreaGrid::GetNavArea(const Vector *pos, float beneathLimit) const for (NavAreaList::iterator iter = list->begin(); iter != list->end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); // check if position is within 2D boundaries of this area if (area->IsOverlapping(&testPos)) @@ -4940,8 +4739,6 @@ CNavArea *CNavAreaGrid::GetNavArea(const Vector *pos, float beneathLimit) const // Given a position in the world, return the nav area that is closest // and at the same height, or beneath it. // Used to find initial area if we start off of the mesh. - -/* <4d33b4> ../game_shared/bot/nav_area.cpp:5133 */ CNavArea *CNavAreaGrid::GetNearestNavArea(const Vector *pos, bool anyZ) const { if (m_grid == NULL) @@ -4970,7 +4767,7 @@ CNavArea *CNavAreaGrid::GetNearestNavArea(const Vector *pos, bool anyZ) const // find closest nav area for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); Vector areaPos; area->GetClosestPointOnArea(&source, &areaPos); @@ -4997,8 +4794,6 @@ CNavArea *CNavAreaGrid::GetNearestNavArea(const Vector *pos, bool anyZ) const } // Given an ID, return the associated area - -/* <4d4778> ../game_shared/bot/nav_area.cpp:5191 */ CNavArea *CNavAreaGrid::GetNavAreaByID(unsigned int id) const { if (id == 0) @@ -5014,8 +4809,6 @@ CNavArea *CNavAreaGrid::GetNavAreaByID(unsigned int id) const } // Return radio chatter place for given coordinate - -/* <4d4802> ../game_shared/bot/nav_area.cpp:5209 */ Place CNavAreaGrid::GetPlace(const Vector *pos) const { CNavArea *area = GetNearestNavArea(pos, true); diff --git a/regamedll/game_shared/bot/nav_area.h b/regamedll/game_shared/bot/nav_area.h index 87d7614d..bb1e2997 100644 --- a/regamedll/game_shared/bot/nav_area.h +++ b/regamedll/game_shared/bot/nav_area.h @@ -77,7 +77,6 @@ enum RouteType SAFEST_ROUTE, }; -/* <4c1845> ../game_shared/bot/nav_area.h:35 */ union NavConnect { unsigned int id; @@ -95,7 +94,6 @@ enum LadderDirectionType NUM_LADDER_DIRECTIONS }; -/* <4c2fda> ../game_shared/bot/nav_area.h:63 */ class CNavLadder { public: @@ -124,8 +122,7 @@ public: bool m_isDangling; - /* <4c2dc0> ../game_shared/bot/nav_area.h:88 */ - void OnDestroyNotify(CNavArea *dead) + void OnDestroyNotify(CNavArea *dead) { if (dead == m_topForwardArea) m_topForwardArea = NULL; @@ -179,7 +176,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif friend void DestroyHidingSpots(); Vector m_pos; @@ -193,7 +190,6 @@ private: typedef std::STD_LIST HidingSpotList; -/* <4ec0bd> ../game_shared/bot/nav_area.h:164 */ struct SpotOrder { float t; @@ -206,7 +202,6 @@ struct SpotOrder typedef std::STD_LIST SpotOrderList; -/* <4c3a51> ../game_shared/bot/nav_area.h:179 */ struct SpotEncounter { NavConnect from; @@ -221,7 +216,6 @@ typedef std::STD_LIST SpotEncounterList; typedef std::STD_LIST NavAreaList; // A CNavArea is a rectangular region defining a walkable area in the map - class CNavArea { public: @@ -241,11 +235,11 @@ public: void Load(SteamFile *file, unsigned int version); NavErrorType PostLoad(); - unsigned int GetID() const { return m_id; } - void SetAttributes(unsigned char bits) { m_attributeFlags = bits; } - unsigned char GetAttributes() const { return m_attributeFlags; } - void SetPlace(Place place) { m_place = place; } // set place descriptor - Place GetPlace() const { return m_place; } // get place descriptor + unsigned int GetID() const { return m_id; } + void SetAttributes(unsigned char bits) { m_attributeFlags = bits; } + unsigned char GetAttributes() const { return m_attributeFlags; } + void SetPlace(Place place) { m_place = place; } // set place descriptor + Place GetPlace() const { return m_place; } // get place descriptor bool IsOverlapping(const Vector *pos) const; // return true if 'pos' is within 2D extents of area bool IsOverlapping(const CNavArea *area) const; // return true if 'area' overlaps our 2D extents @@ -260,7 +254,7 @@ public: float GetDistanceSquaredToPoint(const Vector *pos) const; // return shortest distance between point and this area bool IsDegenerate() const; // return true if this area is badly formed bool IsEdge(NavDirType dir) const; // return true if there are no bi-directional links on the given side - int GetAdjacentCount(NavDirType dir) const { return m_connect[dir].size(); } // return number of connected areas in given direction + int GetAdjacentCount(NavDirType dir) const { return m_connect[dir].size(); } // return number of connected areas in given direction CNavArea *GetAdjacentArea(NavDirType dir, int i) const; // return the i'th adjacent area in the given direction CNavArea *GetRandomAdjacentArea(NavDirType dir) const; const NavConnectList *GetAdjacentList(NavDirType dir) const { return &m_connect[dir]; } @@ -336,11 +330,11 @@ public: static void ClearSearchLists(); // clears the open and closed lists for a new search - void SetTotalCost(float value) { m_totalCost = value; } - float GetTotalCost() const { return m_totalCost; } + void SetTotalCost(float value) { m_totalCost = value; } + float GetTotalCost() const { return m_totalCost; } - void SetCostSoFar(float value) { m_costSoFar = value; } - float GetCostSoFar() const { return m_costSoFar; } + void SetCostSoFar(float value) { m_costSoFar = value; } + float GetCostSoFar() const { return m_costSoFar; } // editing void Draw(byte red, byte green, byte blue, int duration = 50); // draw area for debugging & editing @@ -357,7 +351,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif friend void ConnectGeneratedAreas(); friend void MergeGeneratedAreas(); friend void MarkJumpAreas(); @@ -439,13 +433,11 @@ private: extern NavAreaList TheNavAreaList; -/* <4c1534> ../game_shared/bot/nav_area.h:417 */ inline bool CNavArea::IsDegenerate() const { return (m_extent.lo.x >= m_extent.hi.x || m_extent.lo.y >= m_extent.hi.y); } -/* <568e1d> ../game_shared/bot/nav_area.h:422 */ inline CNavArea *CNavArea::GetAdjacentArea(NavDirType dir, int i) const { NavConnectList::const_iterator iter; @@ -459,19 +451,16 @@ inline CNavArea *CNavArea::GetAdjacentArea(NavDirType dir, int i) const return NULL; } -/* <5a01dc> ../game_shared/bot/nav_area.h:435 */ inline bool CNavArea::IsOpen() const { return (m_openMarker == IMPL(m_masterMarker)) ? true : false; } -/* <5a0a62> ../game_shared/bot/nav_area.h:440 */ inline bool CNavArea::IsOpenListEmpty() { return (IMPL(m_openList) != NULL) ? false : true; } -/* <5a1483> ../game_shared/bot/nav_area.h:445 */ inline CNavArea *CNavArea::PopOpenList() { if (IMPL(m_openList)) @@ -486,7 +475,6 @@ inline CNavArea *CNavArea::PopOpenList() return NULL; } -/* <5a0a2a> ../game_shared/bot/nav_area.h:460 */ inline bool CNavArea::IsClosed() const { if (IsMarked() && !IsOpen()) @@ -495,13 +483,11 @@ inline bool CNavArea::IsClosed() const return false; } -/* <5a0a46> ../game_shared/bot/nav_area.h:468 */ inline void CNavArea::AddToClosedList() { Mark(); } -/* <5a01f8> ../game_shared/bot/nav_area.h:473 */ inline void CNavArea::RemoveFromClosedList() { // since "closed" is defined as visited (marked) and not on open list, do nothing @@ -510,8 +496,6 @@ inline void CNavArea::RemoveFromClosedList() // The CNavAreaGrid is used to efficiently access navigation areas by world position // Each cell of the grid contains a list of areas that overlap it // Given a world position, the corresponding grid cell is ( x/cellsize, y/cellsize ) - -/* <4cf943> ../game_shared/bot/nav_area.cpp:4947 */ class CNavAreaGrid { public: @@ -617,12 +601,10 @@ public: // If 'goalArea' is NULL, will compute a path as close as possible to 'goalPos'. // If 'goalPos' is NULL, will use the center of 'goalArea' as the goal position. // Returns true if a path exists. - -/* <4c3e99> ../game_shared/bot/nav_area.h:679 */ template bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, CostFunctor &costFunc, CNavArea **closestArea = NULL) { - if (closestArea) + if (closestArea != NULL) *closestArea = NULL; if (startArea == NULL) @@ -642,7 +624,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa { goalArea->SetParent(NULL); - if (closestArea) + if (closestArea != NULL) *closestArea = goalArea; return true; @@ -666,7 +648,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa startArea->AddToOpenList(); // keep track of the area we visit that is closest to the goal - if (closestArea) + if (closestArea != NULL) *closestArea = startArea; float closestAreaDist = startArea->GetTotalCost(); @@ -680,7 +662,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa // check if we have found the goal area if (area == goalArea) { - if (closestArea) + if (closestArea != NULL) *closestArea = goalArea; return true; @@ -821,7 +803,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa float_precision newCostRemaining = (*newArea->GetCenter() - actualGoalPos).Length(); // track closest area to goal in case path fails - if (closestArea && newCostRemaining < closestAreaDist) + if (closestArea != NULL && newCostRemaining < closestAreaDist) { *closestArea = newArea; closestAreaDist = newCostRemaining; @@ -852,8 +834,6 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa } // Compute distance between two areas. Return -1 if can't reach 'endArea' from 'startArea'. - -/* <3fcb64> ../game_shared/bot/nav_area.h:914 */ template float_precision NavAreaTravelDistance(CNavArea *startArea, CNavArea *endArea, CostFunctor &costFunc) { @@ -881,7 +861,6 @@ float_precision NavAreaTravelDistance(CNavArea *startArea, CNavArea *endArea, Co } // Compute distance from area to position. Return -1 if can't reach position. - template float NavAreaTravelDistance(const Vector *startPos, CNavArea *startArea, const Vector *goalPos, CostFunctor &costFunc) { @@ -921,10 +900,8 @@ float NavAreaTravelDistance(const Vector *startPos, CNavArea *startArea, const V // If 'maxRange' is 0 or less, no range check is done (all areas will be examined). // NOTE: Returns all areas that overlap range, even partially // TODO: Use ladder connections - +// // helper function - -/* <2e7572> ../game_shared/bot/nav_area.h:990 */ inline void AddAreaToOpenList(CNavArea *area, CNavArea *parent, const Vector *startPos, float maxRange) { if (area == NULL) @@ -961,7 +938,6 @@ inline void AddAreaToOpenList(CNavArea *area, CNavArea *parent, const Vector *st } } -/* <56903e> ../game_shared/bot/nav_area.h:1028 */ template void SearchSurroundingAreas(CNavArea *startArea, const Vector *startPos, Functor &func, float maxRange = -1.0f) { @@ -1036,15 +1012,13 @@ void SearchSurroundingAreas(CNavArea *startArea, const Vector *startPos, Functor // Apply the functor to all navigation areas // If functor returns false, stop processing and return false. - -/* <4c4137> ../game_shared/bot/nav_area.h:1109 */ template bool ForAllAreas(Functor &func) { NavAreaList::iterator iter; for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); if (func(area) == false) return false; } @@ -1054,7 +1028,7 @@ bool ForAllAreas(Functor &func) // Fuctor that returns lowest cost for farthest away areas // For use with FindMinimumCostArea() -NOXREF class FarAwayFunctor +class FarAwayFunctor { public: float operator()(CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder) @@ -1068,8 +1042,6 @@ public: // Fuctor that returns lowest cost for farthest away areas // For use with FindMinimumCostArea() - -/* <5497fa> ../game_shared/bot/nav_area.h:1143 */ class FarAwayFromPositionFunctor { public: @@ -1085,8 +1057,6 @@ private: }; // Pick a low-cost area of "decent" size - -/* <549838> ../game_shared/bot/nav_area.h:1162 */ template CNavArea *FindMinimumCostArea(CNavArea *startArea, CostFunctor &costFunc) { @@ -1105,7 +1075,7 @@ CNavArea *FindMinimumCostArea(CNavArea *startArea, CostFunctor &costFunc) NavAreaList::iterator iter; for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); // skip the small areas const Extent *extent = area->GetExtent(); @@ -1155,7 +1125,7 @@ CNavArea *FindMinimumCostArea(CNavArea *startArea, CostFunctor &costFunc) break; } - return *iter; + return (*iter); } } diff --git a/regamedll/game_shared/bot/nav_file.cpp b/regamedll/game_shared/bot/nav_file.cpp index 7a18dd35..6b7849e7 100644 --- a/regamedll/game_shared/bot/nav_file.cpp +++ b/regamedll/game_shared/bot/nav_file.cpp @@ -23,20 +23,17 @@ PlaceDirectory placeDirectory; -/* <4edbfc> ../game_shared/bot/nav_file.cpp:60 */ void PlaceDirectory::Reset() { m_directory.clear(); } -/* <4edbaf> ../game_shared/bot/nav_file.cpp:66 */ bool PlaceDirectory::IsKnown(Place place) const { std::vector::const_iterator it = std::find(m_directory.begin(), m_directory.end(), place); return (it != m_directory.end()); } -/* <4ec844> ../game_shared/bot/nav_file.cpp:74 */ PlaceDirectory::EntryType PlaceDirectory::GetEntry(Place place) const { if (place == UNDEFINED_PLACE) @@ -53,7 +50,6 @@ PlaceDirectory::EntryType PlaceDirectory::GetEntry(Place place) const return 1 + (it - m_directory.begin()); } -/* <4ee200> ../game_shared/bot/nav_file.cpp:91 */ void PlaceDirectory::AddPlace(Place place) { if (place == UNDEFINED_PLACE) @@ -67,7 +63,6 @@ void PlaceDirectory::AddPlace(Place place) m_directory.push_back(place); } -/* <4edf61> ../game_shared/bot/nav_file.cpp:105 */ Place PlaceDirectory::EntryToPlace(EntryType entry) const { if (entry == 0) @@ -84,7 +79,6 @@ Place PlaceDirectory::EntryToPlace(EntryType entry) const return m_directory[ i ]; } -/* <4edc2e> ../game_shared/bot/nav_file.cpp:122 */ void PlaceDirectory::Save(int fd) { // store number of entries in directory @@ -104,7 +98,6 @@ void PlaceDirectory::Save(int fd) } } -/* <4edfaa> ../game_shared/bot/nav_file.cpp:142 */ void PlaceDirectory::Load(SteamFile *file) { // read number of entries @@ -125,7 +118,6 @@ void PlaceDirectory::Load(SteamFile *file) } } -/* <4ee54b> ../game_shared/bot/nav_file.cpp:173 */ char *GetBspFilename(const char *navFilename) { static char bspFilename[256]; @@ -142,24 +134,22 @@ char *GetBspFilename(const char *navFilename) return bspFilename; } -/* <4ee5c1> ../game_shared/bot/nav_file.cpp:191 */ void CNavArea::Save(FILE *fp) const { - fprintf(fp, "v %f %f %f\n", m_extent.lo.x, m_extent.lo.y, m_extent.lo.z); - fprintf(fp, "v %f %f %f\n", m_extent.hi.x, m_extent.lo.y, m_neZ); - fprintf(fp, "v %f %f %f\n", m_extent.hi.x, m_extent.hi.y, m_extent.hi.z); - fprintf(fp, "v %f %f %f\n", m_extent.lo.x, m_extent.hi.y, m_swZ); + Q_fprintf(fp, "v %f %f %f\n", m_extent.lo.x, m_extent.lo.y, m_extent.lo.z); + Q_fprintf(fp, "v %f %f %f\n", m_extent.hi.x, m_extent.lo.y, m_neZ); + Q_fprintf(fp, "v %f %f %f\n", m_extent.hi.x, m_extent.hi.y, m_extent.hi.z); + Q_fprintf(fp, "v %f %f %f\n", m_extent.lo.x, m_extent.hi.y, m_swZ); static int base = 1; - fprintf(fp, "\n\ng %04dArea%s%s%s%s\n", m_id, + Q_fprintf(fp, "\n\ng %04dArea%s%s%s%s\n", m_id, (GetAttributes() & NAV_CROUCH) ? "CROUCH" : "", (GetAttributes() & NAV_JUMP) ? "JUMP" : "", (GetAttributes() & NAV_PRECISE) ? "PRECISE" : "", (GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP" : ""); - fprintf(fp, "f %d %d %d %d\n\n", base, base + 1, base + 2, base + 3); + Q_fprintf(fp, "f %d %d %d %d\n\n", base, base + 1, base + 2, base + 3); base += 4; } -/* <4f09b8> ../game_shared/bot/nav_file.cpp:212 */ void CNavArea::Save(int fd, unsigned int version) { // save ID @@ -186,7 +176,7 @@ void CNavArea::Save(int fd, unsigned int version) NavConnectList::const_iterator iter; for (iter = m_connect[d].begin(); iter != m_connect[d].end(); ++iter) { - NavConnect connect = *iter; + NavConnect connect = (*iter); Q_write(fd, &connect.area->m_id, sizeof(unsigned int)); } } @@ -209,8 +199,7 @@ void CNavArea::Save(int fd, unsigned int version) unsigned int saveCount = 0; for (HidingSpotList::iterator iter = m_hidingSpotList.begin(); iter != m_hidingSpotList.end(); ++iter) { - HidingSpot *spot = *iter; - + HidingSpot *spot = (*iter); spot->Save(fd, version); // overflow check @@ -321,7 +310,6 @@ void CNavArea::Save(int fd, unsigned int version) Q_write(fd, &entry, sizeof(entry)); } -/* <4ee669> ../game_shared/bot/nav_file.cpp:379 */ void CNavArea::Load(SteamFile *file, unsigned int version) { // load ID @@ -471,7 +459,7 @@ void CNavArea::Load(SteamFile *file, unsigned int version) unsigned char t; file->Read(&t, sizeof(unsigned char)); - order.t = (float)t / 255.0f; + order.t = float(t) / 255.0f; encounter.spotList.push_back(order); } @@ -490,7 +478,6 @@ void CNavArea::Load(SteamFile *file, unsigned int version) SetPlace(placeDirectory.EntryToPlace(entry)); } -/* <4f029e> ../game_shared/bot/nav_file.cpp:562 */ NavErrorType CNavArea::PostLoad() { NavErrorType error = NAV_OK; @@ -601,8 +588,6 @@ NavErrorType CNavArea::PostLoad() } // Changes all '/' characters into '\' characters, in place. - -/* <4edbe0> ../game_shared/bot/nav_file.cpp:680 */ inline void COM_FixSlashes(char *pname) { #ifdef _WIN32 @@ -623,8 +608,6 @@ inline void COM_FixSlashes(char *pname) } // Store AI navigation data to a file - -/* <4f3e47> ../game_shared/bot/nav_file.cpp:702 */ bool SaveNavigationMap(const char *filename) { if (filename == NULL) @@ -673,7 +656,7 @@ bool SaveNavigationMap(const char *filename) NavAreaList::iterator it; for (it = TheNavAreaList.begin(); it != TheNavAreaList.end(); ++it) { - CNavArea *area = *it; + CNavArea *area = (*it); Place place = area->GetPlace(); if (place) @@ -692,40 +675,36 @@ bool SaveNavigationMap(const char *filename) // store each area for (it = TheNavAreaList.begin(); it != TheNavAreaList.end(); ++it) { - CNavArea *area = *it; + CNavArea *area = (*it); area->Save(fd, version); } Q_close(fd); -#ifdef _WIN32 +/*#if defined(_WIN32) && !defined(REGAMEDLL_FIXES) // output a simple Wavefront file to visualize the generated areas in 3DSMax - FILE *fp = fopen("c:\\tmp\\nav.obj", "w"); + FILE *fp = Q_fopen("c:\\tmp\\nav.obj", "w"); if (fp) { for (NavAreaList::iterator iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) - { (*iter)->Save(fp); - } - fclose(fp); + Q_fclose(fp); } -#endif // _WIN32 +#endif // _WIN32 && !REGAMEDLL_FIXES*/ return true; } // Load place map // This is legacy code - Places are stored directly in the nav file now - -/* <4f169d> ../game_shared/bot/nav_file.cpp:811 */ void LoadLocationFile(const char *filename) { char locFilename[256]; Q_strcpy(locFilename, filename); char *dot = Q_strchr(locFilename, '.'); - if (dot) + if (dot != NULL) { Q_strcpy(dot, ".loc"); @@ -733,7 +712,7 @@ void LoadLocationFile(const char *filename) char *locDataFile = (char *)LOAD_FILE_FOR_ME(const_cast(locFilename), &locDataLength); char *locData = locDataFile; - if (locData) + if (locData != NULL) { CONSOLE_ECHO("Loading legacy 'location file' '%s'\n", locFilename); @@ -768,7 +747,7 @@ void LoadLocationFile(const char *filename) CNavArea *area = TheNavAreaGrid.GetNavAreaByID(areaID); unsigned int place = (locDirIndex > 0) ? directory[locDirIndex - 1] : UNDEFINED_PLACE; - if (area) + if (area != NULL) area->SetPlace(place); } } @@ -779,8 +758,6 @@ void LoadLocationFile(const char *filename) } // Performs a lightweight sanity-check of the specified map's nav mesh - -/* <4f05c5> ../game_shared/bot/nav_file.cpp:876 */ void SanityCheckNavigationMap(const char *mapName) { if (!mapName) @@ -850,7 +827,6 @@ void SanityCheckNavigationMap(const char *mapName) CONSOLE_ECHO("navigation file %s passes the sanity check.\n", navFilename); } -/* <4f19c7> ../game_shared/bot/nav_file.cpp:947 */ NavErrorType LoadNavigationMap() { // since the navigation map is destroyed on map change, @@ -969,7 +945,7 @@ NavErrorType LoadNavigationMap() // allow areas to connect to each other, etc for (iter = TheNavAreaList.begin(); iter != TheNavAreaList.end(); ++iter) { - CNavArea *area = *iter; + CNavArea *area = (*iter); area->PostLoad(); } @@ -981,6 +957,5 @@ NavErrorType LoadNavigationMap() // Set up all the ladders BuildLadders(); - return NAV_OK; } diff --git a/regamedll/game_shared/bot/nav_file.h b/regamedll/game_shared/bot/nav_file.h index 1830e902..f8105ced 100644 --- a/regamedll/game_shared/bot/nav_file.h +++ b/regamedll/game_shared/bot/nav_file.h @@ -41,8 +41,6 @@ // place name strings. Each nav area then contains an index // into that directory, or zero if no place has been assigned to // that area. - -/* <4ecb57> ../game_shared/bot/nav_file.cpp:54 */ class PlaceDirectory { public: @@ -60,6 +58,9 @@ private: std::vector m_directory; }; +extern char *MP_COM_GetToken(); +extern char *MP_COM_Parse(char *data); + char *GetBspFilename(const char *navFilename); bool SaveNavigationMap(const char *filename); void LoadLocationFile(const char *filename); diff --git a/regamedll/game_shared/bot/nav_node.cpp b/regamedll/game_shared/bot/nav_node.cpp index 51ecba4e..accb75af 100644 --- a/regamedll/game_shared/bot/nav_node.cpp +++ b/regamedll/game_shared/bot/nav_node.cpp @@ -10,11 +10,10 @@ NavDirType Opposite[ NUM_DIRECTIONS ] = { SOUTH, WEST, NORTH, EAST }; CNavNode *CNavNode::m_list = NULL; unsigned int CNavNode::m_listLength = 0; -#endif // HOOK_GAMEDLL +#endif -//NOXREF Extent NodeMapExtent; +//Extent NodeMapExtent; -/* <4f79dc> ../game_shared/bot/nav_node.cpp:23 */ CNavNode::CNavNode(const Vector *pos, const Vector *normal, CNavNode *parent) { m_pos = *pos; @@ -40,8 +39,6 @@ CNavNode::CNavNode(const Vector *pos, const Vector *normal, CNavNode *parent) } // Create a connection FROM this node TO the given node, in the given direction - -/* <4f7a31> ../game_shared/bot/nav_node.cpp:54 */ void CNavNode::ConnectTo(CNavNode *node, NavDirType dir) { m_to[ dir ] = node; @@ -49,8 +46,6 @@ void CNavNode::ConnectTo(CNavNode *node, NavDirType dir) // Return node at given position // TODO: Need a hash table to make this lookup fast - -/* <4f7a75> ../game_shared/bot/nav_node.cpp:64 */ const CNavNode *CNavNode::GetNode(const Vector *pos) { const float tolerance = 0.45f * GenerationStepSize; @@ -70,8 +65,6 @@ const CNavNode *CNavNode::GetNode(const Vector *pos) // Return true if this node is bidirectionally linked to // another node in the given direction - -/* <4f7af2> ../game_shared/bot/nav_node.cpp:86 */ BOOL CNavNode::IsBiLinked(NavDirType dir) const { if (m_to[ dir ] && m_to[ dir ]->m_to[ Opposite[dir] ] == this) @@ -82,8 +75,6 @@ BOOL CNavNode::IsBiLinked(NavDirType dir) const // Return true if this node is the NW corner of a quad of nodes // that are all bidirectionally linked - -/* <4f7b1c> ../game_shared/bot/nav_node.cpp:100 */ BOOL CNavNode::IsClosedCell() const { if (IsBiLinked( SOUTH ) && IsBiLinked( EAST ) && m_to[ EAST ]->IsBiLinked( SOUTH ) && m_to[ SOUTH ]->IsBiLinked( EAST ) diff --git a/regamedll/game_shared/bot/nav_node.h b/regamedll/game_shared/bot/nav_node.h index f0dcf129..de6bb510 100644 --- a/regamedll/game_shared/bot/nav_node.h +++ b/regamedll/game_shared/bot/nav_node.h @@ -71,7 +71,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif friend void DestroyNavigationMap(); Vector m_pos; // position of this node in the world @@ -93,31 +93,26 @@ private: CNavArea *m_area; // the area this node is contained within }; -/* <4c0577> ../game_shared/bot/nav_node.h:74 */ inline CNavNode *CNavNode::GetConnectedNode(NavDirType dir) const { return m_to[ dir ]; } -/* <4c05ba> ../game_shared/bot/nav_node.h:79 */ inline const Vector *CNavNode::GetPosition() const { return &m_pos; } -/* <3434df> ../game_shared/bot/nav_node.h:84 */ inline CNavNode *CNavNode::GetParent() const { return m_parent; } -/* <3434fe> ../game_shared/bot/nav_node.h:89 */ inline void CNavNode::MarkAsVisited(NavDirType dir) { m_visited |= (1 << dir); } -/* <343523> ../game_shared/bot/nav_node.h:94 */ inline BOOL CNavNode::HasVisited(NavDirType dir) { if (m_visited & (1 << dir)) @@ -126,13 +121,11 @@ inline BOOL CNavNode::HasVisited(NavDirType dir) return false; } -/* <4bfdb6> ../game_shared/bot/nav_node.h:102 */ inline void CNavNode::AssignArea(CNavArea *area) { m_area = area; } -/* <4bfdde> ../game_shared/bot/nav_node.h:107 */ inline CNavArea *CNavNode::GetArea() const { return m_area; diff --git a/regamedll/game_shared/bot/nav_path.cpp b/regamedll/game_shared/bot/nav_path.cpp index c3990a18..2dc02560 100644 --- a/regamedll/game_shared/bot/nav_path.cpp +++ b/regamedll/game_shared/bot/nav_path.cpp @@ -1,8 +1,6 @@ #include "precompiled.h" // Determine actual path positions - -/* <505025> ../game_shared/bot/nav_path.cpp:24 */ bool CNavPath::ComputePathPositions() { if (m_segmentCount == 0) @@ -76,7 +74,7 @@ bool CNavPath::ComputePathPositions() NavLadderList::const_iterator iter; for (iter = list->begin(); iter != list->end(); ++iter) { - CNavLadder *ladder = *iter; + CNavLadder *ladder = (*iter); // can't use "behind" area when ascending... if (ladder->m_topForwardArea == to->area || ladder->m_topLeftArea == to->area || ladder->m_topRightArea == to->area) @@ -102,7 +100,7 @@ bool CNavPath::ComputePathPositions() NavLadderList::const_iterator iter; for (iter = list->begin(); iter != list->end(); ++iter) { - CNavLadder *ladder = *iter; + CNavLadder *ladder = (*iter); if (ladder->m_bottomArea == to->area) { @@ -124,8 +122,6 @@ bool CNavPath::ComputePathPositions() } // Return true if position is at the end of the path - -/* <50525f> ../game_shared/bot/nav_path.cpp:148 */ bool CNavPath::IsAtEnd(const Vector &pos) const { if (!IsValid()) @@ -136,8 +132,6 @@ bool CNavPath::IsAtEnd(const Vector &pos) const } // Return length of path from start to finish - -/* <5052f6> ../game_shared/bot/nav_path.cpp:161 */ float CNavPath::GetLength() const { float length = 0.0f; @@ -151,8 +145,6 @@ float CNavPath::GetLength() const // Return point a given distance along the path - if distance is out of path bounds, point is clamped to start/end // TODO: Be careful of returning "positions" along one-way drops, ladders, etc. - -/* <50537f> ../game_shared/bot/nav_path.cpp:177 */ NOXREF bool CNavPath::GetPointAlongPath(float distAlong, Vector *pointOnPath) const { if (!IsValid() || pointOnPath == NULL) @@ -191,8 +183,6 @@ NOXREF bool CNavPath::GetPointAlongPath(float distAlong, Vector *pointOnPath) co } // Return the node index closest to the given distance along the path without going over - returns (-1) if error - -/* <5054da> ../game_shared/bot/nav_path.cpp:218 */ int CNavPath::GetSegmentIndexAlongPath(float distAlong) const { if (!IsValid()) @@ -220,8 +210,6 @@ int CNavPath::GetSegmentIndexAlongPath(float distAlong) const // Compute closest point on path to given point // NOTE: This does not do line-of-sight tests, so closest point may be thru the floor, etc - -/* <50557e> ../game_shared/bot/nav_path.cpp:250 */ NOXREF bool CNavPath::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const { if (!IsValid() || close == NULL) @@ -274,8 +262,6 @@ NOXREF bool CNavPath::FindClosestPointOnPath(const Vector *worldPos, int startIn } // Build trivial path when start and goal are in the same nav area - -/* <5057df> ../game_shared/bot/nav_path.cpp:305 */ bool CNavPath::BuildTrivialPath(const Vector *start, const Vector *goal) { m_segmentCount = 0; @@ -308,8 +294,6 @@ bool CNavPath::BuildTrivialPath(const Vector *start, const Vector *goal) } // Draw the path for debugging - -/* <505853> ../game_shared/bot/nav_path.cpp:340 */ void CNavPath::Draw() { if (!IsValid()) @@ -323,8 +307,6 @@ void CNavPath::Draw() // Check line of sight from 'anchor' node on path to subsequent nodes until // we find a node that can't been seen from 'anchor' - -/* <505931> ../game_shared/bot/nav_path.cpp:357 */ int CNavPath::FindNextOccludedNode(int anchor_) { int lastVisible = anchor_; @@ -361,8 +343,6 @@ int CNavPath::FindNextOccludedNode(int anchor_) } // Smooth out path, removing redundant nodes - -/* <505c26> ../game_shared/bot/nav_path.cpp:396 */ void CNavPath::Optimize() { // DONT USE THIS: Optimizing the path results in cutting thru obstacles @@ -395,7 +375,6 @@ void CNavPath::Optimize() #endif } -/* <505c6d> ../game_shared/bot/nav_path.cpp:436 */ CNavPathFollower::CNavPathFollower() { m_improv = NULL; @@ -407,7 +386,6 @@ CNavPathFollower::CNavPathFollower() m_isDebug = false; } -/* <505cce> ../game_shared/bot/nav_path.cpp:447 */ void CNavPathFollower::Reset() { m_segmentIndex = 1; @@ -417,8 +395,6 @@ void CNavPathFollower::Reset() } // Move improv along path - -/* <507c31> ../game_shared/bot/nav_path.cpp:459 */ void CNavPathFollower::Update(float deltaT, bool avoidObstacles) { if (m_path == NULL || m_path->IsValid() == false) @@ -493,7 +469,7 @@ void CNavPathFollower::Update(float deltaT, bool avoidObstacles) { // because hostage crouching is not really supported by the engine, // if we are standing in a crouch area, we must crouch to avoid collisions - if (m_improv->GetLastKnownArea() && (m_improv->GetLastKnownArea()->GetAttributes() & NAV_CROUCH) && !(m_improv->GetLastKnownArea()->GetAttributes() & NAV_JUMP)) + if (m_improv->GetLastKnownArea() != NULL && (m_improv->GetLastKnownArea()->GetAttributes() & NAV_CROUCH) && !(m_improv->GetLastKnownArea()->GetAttributes() & NAV_JUMP)) { m_improv->Crouch(); } @@ -532,7 +508,8 @@ void CNavPathFollower::Update(float deltaT, bool avoidObstacles) // no crouch areas coming up m_improv->StandUp(); } - } // end crouching logic + } + // end crouching logic if (m_isDebug) { @@ -606,8 +583,6 @@ void CNavPathFollower::Update(float deltaT, bool avoidObstacles) // Return the closest point to our current position on our current path // If "local" is true, only check the portion of the path surrounding m_pathIndex - -/* <505d18> ../game_shared/bot/nav_path.cpp:662 */ int CNavPathFollower::FindOurPositionOnPath(Vector *close, bool local) const { Vector along, toFeet; @@ -692,8 +667,6 @@ int CNavPathFollower::FindOurPositionOnPath(Vector *close, bool local) const // Compute a point a fixed distance ahead along our path // Returns path index just after point - -/* <506248> ../game_shared/bot/nav_path.cpp:750 */ int CNavPathFollower::FindPathPoint(float aheadRange, Vector *point, int *prevIndex) { // find path index just past aheadRange @@ -768,8 +741,7 @@ int CNavPathFollower::FindPathPoint(float aheadRange, Vector *point, int *prevIn } // we need the point just *ahead* of us - ++startIndex; - if (startIndex >= m_path->GetSegmentCount()) + if (++startIndex >= m_path->GetSegmentCount()) startIndex = m_path->GetSegmentCount() - 1; // if we hit a ladder or jump area, must stop @@ -936,8 +908,6 @@ int CNavPathFollower::FindPathPoint(float aheadRange, Vector *point, int *prevIn // Do reflex avoidance movements if our "feelers" are touched // TODO: Parameterize feeler spacing - -/* <507004> ../game_shared/bot/nav_path.cpp:1000 */ void CNavPathFollower::FeelerReflexAdjustment(Vector *goalPosition, float height) { // if we are in a "precise" area, do not do feeler adjustments @@ -954,10 +924,10 @@ void CNavPathFollower::FeelerReflexAdjustment(Vector *goalPosition, float height float_precision flLen = dir.Length(); if (flLen > 0) - dir = dir * (float)(1 / flLen); + dir = dir * float(1 / flLen); else dir = Vector(0, 0, 0); -#endif // PLAY_GAMEDLL +#endif Vector lat(-dir.y, dir.x, 0.0f); @@ -1036,8 +1006,6 @@ void CNavPathFollower::FeelerReflexAdjustment(Vector *goalPosition, float height } // Reset the stuck-checker - -/* <507a31> ../game_shared/bot/nav_path.cpp:1098 */ CStuckMonitor::CStuckMonitor() { m_isStuck = false; @@ -1046,8 +1014,6 @@ CStuckMonitor::CStuckMonitor() } // Reset the stuck-checker - -/* <507a73> ../game_shared/bot/nav_path.cpp:1108 */ void CStuckMonitor::Reset() { m_isStuck = false; @@ -1056,8 +1022,6 @@ void CStuckMonitor::Reset() } // Test if the improv has become stuck - -/* <507a96> ../game_shared/bot/nav_path.cpp:1119 */ void CStuckMonitor::Update(CImprov *improv) { if (m_isStuck) diff --git a/regamedll/game_shared/bot/nav_path.h b/regamedll/game_shared/bot/nav_path.h index 77b9c91b..54d8e0c2 100644 --- a/regamedll/game_shared/bot/nav_path.h +++ b/regamedll/game_shared/bot/nav_path.h @@ -35,7 +35,6 @@ // STL uses exceptions, but we are not compiling with them - ignore warning #pragma warning(disable : 4530) -/* <46efa3> ../game_shared/bot/nav_path.h:22 */ class CNavPath { public: @@ -55,7 +54,7 @@ public: bool IsAtEnd(const Vector &pos) const; // return true if position is at the end of the path float GetLength() const; // return length of path from start to finish - NOXREF bool GetPointAlongPath(float distAlong, Vector *pointOnPath) const; // return point a given distance along the path - if distance is out of path bounds, point is clamped to start/end + bool GetPointAlongPath(float distAlong, Vector *pointOnPath) const; // return point a given distance along the path - if distance is out of path bounds, point is clamped to start/end // return the node index closest to the given distance along the path without going over - returns (-1) if error int GetSegmentIndexAlongPath(float distAlong) const; @@ -67,7 +66,7 @@ public: void Draw(); // compute closest point on path to given point - NOXREF bool FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const; + bool FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const; void Optimize(); @@ -152,7 +151,7 @@ public: } #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif enum { MAX_PATH_SEGMENTS = 256 }; PathSegment m_path[ MAX_PATH_SEGMENTS ]; int m_segmentCount; @@ -209,7 +208,7 @@ public: #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL +#endif int FindOurPositionOnPath(Vector *close, bool local) const; // return the closest point to our current position on current path int FindPathPoint(float aheadRange, Vector *point, int *prevIndex); // compute a point a fixed distance ahead along our path. diff --git a/regamedll/game_shared/bot/simple_state_machine.h b/regamedll/game_shared/bot/simple_state_machine.h index 9f621914..7f6a1be0 100644 --- a/regamedll/game_shared/bot/simple_state_machine.h +++ b/regamedll/game_shared/bot/simple_state_machine.h @@ -33,8 +33,6 @@ #endif // Encapsulation of a finite-state-machine state - -/* <5c4388> ../game_shared/bot/simple_state_machine.h:21 */ template class SimpleState { @@ -62,8 +60,6 @@ private: }; // Encapsulation of a finite state machine - -/* <5c4bab> ../game_shared/bot/simple_state_machine.h:68 */ template class SimpleStateMachine { @@ -105,7 +101,7 @@ public: m_state->OnUpdate(m_userData); } -/*protected:*/ +protected: S *m_state; // current behavior state IntervalTimer m_stateTimer; // how long have we been in the current state T m_userData; diff --git a/regamedll/game_shared/perf_counter.h b/regamedll/game_shared/perf_counter.h index e8ff2a36..138a00a9 100644 --- a/regamedll/game_shared/perf_counter.h +++ b/regamedll/game_shared/perf_counter.h @@ -70,7 +70,6 @@ private: double m_flLastCurrentTime; }; -/* <2ebfc> ../game_shared/perf_counter.h:61 */ inline CPerformanceCounter::CPerformanceCounter() : m_iLowShift(0), m_flPerfCounterFreq(0), @@ -80,7 +79,6 @@ inline CPerformanceCounter::CPerformanceCounter() : InitializePerformanceCounter(); } -/* <2ebdd> ../game_shared/perf_counter.h:69 */ inline void CPerformanceCounter::InitializePerformanceCounter() { #ifdef _WIN32 @@ -108,7 +106,6 @@ inline void CPerformanceCounter::InitializePerformanceCounter() #endif // _WIN32 } -/* <2ec16> ../game_shared/perf_counter.h:97 */ inline double CPerformanceCounter::GetCurTime() { #ifdef _WIN32 @@ -155,9 +152,7 @@ inline double CPerformanceCounter::GetCurTime() if (m_flCurrentTime == m_flLastCurrentTime) { - sametimecount++; - - if (sametimecount > 100000) + if (++sametimecount > 100000) { m_flCurrentTime += 1.0; sametimecount = 0; diff --git a/regamedll/game_shared/shared_util.cpp b/regamedll/game_shared/shared_util.cpp index 183dd6e8..922359e6 100644 --- a/regamedll/game_shared/shared_util.cpp +++ b/regamedll/game_shared/shared_util.cpp @@ -5,12 +5,11 @@ */ #ifndef HOOK_GAMEDLL -char s_shared_token[ COM_TOKEN_LEN ]; +char s_shared_token[ 1500 ]; char s_shared_quote = '\"'; -#endif // HOOK_GAMEDLL +#endif -/* <2d4a66> ../game_shared/shared_util.cpp:50 */ NOXREF wchar_t *SharedWVarArgs(wchar_t *format, ...) { va_list argptr; @@ -28,7 +27,6 @@ NOXREF wchar_t *SharedWVarArgs(wchar_t *format, ...) return string[curstring]; } -/* <2d4b0a> ../game_shared/shared_util.cpp:68 */ char *SharedVarArgs(char *format, ...) { va_list argptr; @@ -47,7 +45,6 @@ char *SharedVarArgs(char *format, ...) return string[ curstring ]; } -/* <2d4ba1> ../game_shared/shared_util.cpp:90 */ char *BufPrintf(char *buf, int &len, const char *fmt, ...) { va_list argptr; @@ -64,7 +61,6 @@ char *BufPrintf(char *buf, int &len, const char *fmt, ...) return NULL; } -/* <2d4c0d> ../game_shared/shared_util.cpp:106 */ wchar_t *BufWPrintf(wchar_t *buf, int &len, const wchar_t *fmt, ...) { if (len <= 0) @@ -80,7 +76,6 @@ wchar_t *BufWPrintf(wchar_t *buf, int &len, const wchar_t *fmt, ...) return buf + wcslen(buf); } -/* <2d4c7e> ../game_shared/shared_util.cpp:122 */ NOXREF const wchar_t *NumAsWString(int val) { const int BufLen = 16; @@ -95,7 +90,6 @@ NOXREF const wchar_t *NumAsWString(int val) return string[curstring]; } -/* <2d4d11> ../game_shared/shared_util.cpp:137 */ const char *NumAsString(int val) { const int BufLen = 16; @@ -113,24 +107,18 @@ const char *NumAsString(int val) } // Returns the token parsed by SharedParse() - -/* <2d4da4> ../game_shared/shared_util.cpp:155 */ char *SharedGetToken() { return s_shared_token; } // Returns the token parsed by SharedParse() - -/* <2d4dbf> ../game_shared/shared_util.cpp:164 */ NOXREF void SharedSetQuoteChar(char c) { s_shared_quote = c; } // Parse a token out of a string - -/* <2d4de7> ../game_shared/shared_util.cpp:173 */ const char *SharedParse(const char *data) { int c; @@ -203,15 +191,14 @@ skipwhite: if (c == '{' || c == '}'|| c == ')'|| c == '(' || c == '\'' || c == ',') break; - } while (c > 32); + } + while (c > 32); s_shared_token[len] = '\0'; return data; } // Returns true if additional data is waiting to be processed on this line - -/* <2d4e40> ../game_shared/shared_util.cpp:247 */ NOXREF bool SharedTokenWaiting(const char *buffer) { const char *p; @@ -219,7 +206,7 @@ NOXREF bool SharedTokenWaiting(const char *buffer) p = buffer; while (*p && *p!='\n') { - if (!isspace(*p) || isalnum(*p)) + if (!Q_isspace(*p) || Q_isalnum(*p)) return true; p++; diff --git a/regamedll/game_shared/shared_util.h b/regamedll/game_shared/shared_util.h index f3b548e6..e6567724 100644 --- a/regamedll/game_shared/shared_util.h +++ b/regamedll/game_shared/shared_util.h @@ -32,25 +32,25 @@ #pragma once #endif +#include "common.h" + #ifndef _WIN32 #include #include #endif // _WIN32 -NOXREF wchar_t *SharedWVarArgs(wchar_t *format, ...); +wchar_t *SharedWVarArgs(wchar_t *format, ...); char *SharedVarArgs(char *format, ...); char *BufPrintf(char *buf, int &len, const char *fmt, ...); -NOXREF wchar_t *BufWPrintf(wchar_t *buf, int &len, const wchar_t *fmt, ...); -NOXREF const wchar_t *NumAsWString(int val); +wchar_t *BufWPrintf(wchar_t *buf, int &len, const wchar_t *fmt, ...); +const wchar_t *NumAsWString(int val); const char *NumAsString(int val); char *SharedGetToken(); -NOXREF void SharedSetQuoteChar(char c); +void SharedSetQuoteChar(char c); const char *SharedParse(const char *data); -NOXREF bool SharedTokenWaiting(const char *buffer); +bool SharedTokenWaiting(const char *buffer); // Simple utility function to allocate memory and duplicate a string - -/* ../game_shared/shared_util.h:46 */ inline char *CloneString(const char *str) { if (!str) @@ -66,7 +66,6 @@ inline char *CloneString(const char *str) } // Simple utility function to allocate memory and duplicate a wide string - inline wchar_t *CloneWString(const wchar_t *str) { if (!str) diff --git a/regamedll/game_shared/simple_checksum.h b/regamedll/game_shared/simple_checksum.h index d637461e..236e7653 100644 --- a/regamedll/game_shared/simple_checksum.h +++ b/regamedll/game_shared/simple_checksum.h @@ -34,8 +34,6 @@ // Compute a simple checksum for the given data. // Each byte in the data is multiplied by its position to track re-ordering changes - -/* <4a799e> ../game_shared/simple_checksum.h:12 */ inline unsigned int ComputeSimpleChecksum(const unsigned char *dataPointer, int dataLength) { unsigned int checksum = 0; @@ -44,6 +42,7 @@ inline unsigned int ComputeSimpleChecksum(const unsigned char *dataPointer, int checksum += (*dataPointer) * i; ++dataPointer; } + return checksum; } diff --git a/regamedll/game_shared/steam_util.h b/regamedll/game_shared/steam_util.h index e0969fd6..a7c1b985 100644 --- a/regamedll/game_shared/steam_util.h +++ b/regamedll/game_shared/steam_util.h @@ -49,7 +49,6 @@ private: int m_bytesLeft; }; -/* <4eb7b4> ../game_shared/steam_util.h:29 */ inline SteamFile::SteamFile(const char *filename) { m_fileData = (byte *)LOAD_FILE_FOR_ME(const_cast(filename), &m_fileDataLength); @@ -57,14 +56,12 @@ inline SteamFile::SteamFile(const char *filename) m_bytesLeft = m_fileDataLength; } -/* <4eb65d> ../game_shared/steam_util.h:36 */ inline SteamFile::~SteamFile() { if (m_fileData) FREE_FILE(m_fileData); } -/* <4bfdfa> ../game_shared/steam_util.h:42 */ inline bool SteamFile::Read(void *data, int length) { if (length > m_bytesLeft || m_cursor == NULL || m_bytesLeft <= 0) diff --git a/regamedll/game_shared/voice_gamemgr.cpp b/regamedll/game_shared/voice_gamemgr.cpp index 5a1df504..b79396df 100644 --- a/regamedll/game_shared/voice_gamemgr.cpp +++ b/regamedll/game_shared/voice_gamemgr.cpp @@ -8,7 +8,7 @@ cvar_t voice_serverdebug = { "voice_serverdebug", "0", 0, 0.0f, NULL }; cvar_t sv_alltalk = { "sv_alltalk", "0", FCVAR_SERVER, 0.0f, NULL }; -#endif // HOOK_GAMEDLL +#endif CPlayerBitVec g_PlayerModEnable; CBitVec< VOICE_MAX_PLAYERS > g_BanMasks[ VOICE_MAX_PLAYERS ]; @@ -16,7 +16,6 @@ CBitVec< VOICE_MAX_PLAYERS > g_SentGameRulesMasks[ VOICE_MAX_PLAYERS ]; CBitVec< VOICE_MAX_PLAYERS > g_SentBanMasks[ VOICE_MAX_PLAYERS ]; CPlayerBitVec g_bWantModEnable; -/* <2d3c38> ../game_shared/voice_gamemgr.cpp:68 */ void VoiceServerDebug(const char *pFmt, ...) { char msg[4096]; @@ -32,20 +31,17 @@ void VoiceServerDebug(const char *pFmt, ...) ALERT(at_console, "%s", msg); } -/* <2d3cd1> ../game_shared/voice_gamemgr.cpp:89 */ CVoiceGameMgr::CVoiceGameMgr() { m_UpdateInterval = 0; m_nMaxPlayers = 0; } -/* <2d3c98> ../game_shared/voice_gamemgr.cpp:96 */ CVoiceGameMgr::~CVoiceGameMgr() { ; } -/* <2d3d0b> ../game_shared/voice_gamemgr.cpp:101 */ bool CVoiceGameMgr::Init(IVoiceGameMgrHelper *pHelper, int maxClients) { m_pHelper = pHelper; @@ -66,13 +62,11 @@ bool CVoiceGameMgr::Init(IVoiceGameMgrHelper *pHelper, int maxClients) return true; } -/* <2d3d4e> ../game_shared/voice_gamemgr.cpp:123 */ void CVoiceGameMgr::SetHelper(IVoiceGameMgrHelper *pHelper) { m_pHelper = pHelper; } -/* <2d4486> ../game_shared/voice_gamemgr.cpp:129 */ void CVoiceGameMgr::Update(double frametime) { // Only update periodically. @@ -82,7 +76,6 @@ void CVoiceGameMgr::Update(double frametime) UpdateMasks(); } -/* <2d3d82> ../game_shared/voice_gamemgr.cpp:140 */ void CVoiceGameMgr::ClientConnected(edict_t *pEdict) { int index = ENTINDEX(pEdict) - 1; @@ -95,8 +88,6 @@ void CVoiceGameMgr::ClientConnected(edict_t *pEdict) // Called to determine if the Receiver has muted (blocked) the Sender // Returns true if the receiver has blocked the sender - -/* <2d3ec5> ../game_shared/voice_gamemgr.cpp:152 */ bool CVoiceGameMgr::PlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer *pSender) { int iReceiverIndex, iSenderIndex; @@ -113,7 +104,6 @@ bool CVoiceGameMgr::PlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer * return (g_BanMasks[ iReceiverIndex ][ iSenderIndex ] != 0); } -/* <2d401a> ../game_shared/voice_gamemgr.cpp:169 */ bool CVoiceGameMgr::ClientCommand(CBasePlayer *pPlayer, const char *cmd) { int playerClientIndex = pPlayer->entindex() - 1; @@ -129,7 +119,7 @@ bool CVoiceGameMgr::ClientCommand(CBasePlayer *pPlayer, const char *cmd) for (int i = 1; i < CMD_ARGC(); ++i) { uint32 mask = 0; - sscanf(CMD_ARGV(i), "%x", &mask); + Q_sscanf(CMD_ARGV(i), "%x", &mask); if (i <= VOICE_MAX_PLAYERS_DW) { @@ -157,7 +147,6 @@ bool CVoiceGameMgr::ClientCommand(CBasePlayer *pPlayer, const char *cmd) return false; } -/* <2d416b> ../game_shared/voice_gamemgr.cpp:215 */ void CVoiceGameMgr::UpdateMasks() { m_UpdateInterval = 0; @@ -171,11 +160,11 @@ void CVoiceGameMgr::UpdateMasks() if (!pEnt #ifndef REGAMEDLL_FIXES || !pEnt->IsPlayer() -#endif // REGAMEDLL_FIXES +#endif ) continue; - CBasePlayer *pPlayer = (CBasePlayer *)pEnt; + CBasePlayer *pPlayer = static_cast(pEnt); CPlayerBitVec gameRulesMask; // Request the state of their "VModEnable" cvar. diff --git a/regamedll/game_shared/voice_gamemgr.h b/regamedll/game_shared/voice_gamemgr.h index a414e5e4..b6d15de3 100644 --- a/regamedll/game_shared/voice_gamemgr.h +++ b/regamedll/game_shared/voice_gamemgr.h @@ -36,14 +36,20 @@ #include "voice_common.h" -/* <111716> ../game_shared/voice_gamemgr.h:23 */ +class CGameRules; +class CBasePlayer; + class IVoiceGameMgrHelper { public: virtual ~IVoiceGameMgrHelper() {} + + // Called each frame to determine which players are allowed to hear each other. This overrides + // whatever squelch settings players have. virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pTalker) = 0; }; - + +// CVoiceGameMgr manages which clients can hear which other clients. class CVoiceGameMgr { public: @@ -52,15 +58,28 @@ public: bool Init(IVoiceGameMgrHelper *pHelper, int maxClients); void SetHelper(IVoiceGameMgrHelper *pHelper); + + // Updates which players can hear which other players. + // If gameplay mode is DM, then only players within the PVS can hear each other. + // If gameplay mode is teamplay, then only players on the same team can hear each other. + // Player masks are always applied. void Update(double frametime); + + // Called when a new client connects (unsquelches its entity for everyone). void ClientConnected(edict_t *pEdict); + + // Called on ClientCommand. Checks for the squelch and unsquelch commands. + // Returns true if it handled the command. bool ClientCommand(CBasePlayer *pPlayer, const char *cmd); + + // Called to determine if the Receiver has muted (blocked) the Sender + // Returns true if the receiver has blocked the sender bool PlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer *pSender); #ifndef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL - +#endif + // Force it to update the client masks. void UpdateMasks(); private: @@ -68,7 +87,7 @@ private: int m_msgRequestState; IVoiceGameMgrHelper *m_pHelper; int m_nMaxPlayers; - double m_UpdateInterval; + double m_UpdateInterval; // How long since the last update. }; void VoiceServerDebug(const char *pFmt, ...); diff --git a/regamedll/hookers/6153_hooker.cpp b/regamedll/hookers/6153_hooker.cpp index 98ab30a6..224a6120 100644 --- a/regamedll/hookers/6153_hooker.cpp +++ b/regamedll/hookers/6153_hooker.cpp @@ -108,8 +108,6 @@ extern const size_t g_BaseOffset = 0x00000000; //#define Data_References_Region //#define Function_References_Region -extern void BotPhraseManager__OnRoundRestart(int pthis); - FunctionHook g_FunctionHooks[] = { @@ -147,43 +145,43 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DAFB50, "PM_DrawBBox", (size_t)&PM_DrawBBox }, // NOXREF //{ 0x01DAFF20, "PM_ViewEntity", (size_t)&PM_ViewEntity }, // NOXREF //pm_shared - //{ 0x01DB0AB0, "PM_SwapTextures", (size_t)&PM_SwapTextures }, // NOXREF + //{ 0x01DB0AB0, "PM_SwapTextures", (size_t)&PM_SwapTextures }, // NOXREF //{ 0x01DB0B30, "PM_IsThereGrassTexture", (size_t)&PM_IsThereGrassTexture }, // NOXREF - //{ 0x01DB0B60, "PM_SortTextures", (size_t)&PM_SortTextures }, // NOXREF + //{ 0x01DB0B60, "PM_SortTextures", (size_t)&PM_SortTextures }, // NOXREF { 0x01DB0C80, "PM_InitTextureTypes", (size_t)&PM_InitTextureTypes }, //{ 0x0, "PM_FindTextureType", (size_t)&PM_FindTextureType }, { 0x01DB1080, "PM_PlayStepSound", (size_t)&PM_PlayStepSound }, //{ 0x01DB17E0, "PM_MapTextureTypeStepType", (size_t)&PM_MapTextureTypeStepType }, // NOXREF { 0x01DB1860, "PM_CatagorizeTextureType", (size_t)&PM_CatagorizeTextureType }, { 0x01DB19B0, "PM_UpdateStepSound", (size_t)&PM_UpdateStepSound }, - //{ 0x01DB1CB0, "PM_AddToTouched", (size_t)&PM_AddToTouched }, // NOXREF + //{ 0x01DB1CB0, "PM_AddToTouched", (size_t)&PM_AddToTouched }, // NOXREF { 0x01DB1D50, "PM_CheckVelocity", (size_t)&PM_CheckVelocity }, { 0x01DB1E40, "PM_ClipVelocity", (size_t)&PM_ClipVelocity }, //{ 0x01DB1EF0, "PM_AddCorrectGravity", (size_t)&PM_AddCorrectGravity }, // NOXREF //{ 0x01DB1F70, "PM_FixupGravityVelocity", (size_t)&PM_FixupGravityVelocity }, // NOXREF { 0x01DB1FD0, "PM_FlyMove", (size_t)&PM_FlyMove }, - //{ 0x01DB24E0, "PM_Accelerate", (size_t)&PM_Accelerate }, // NOXREF + //{ 0x01DB24E0, "PM_Accelerate", (size_t)&PM_Accelerate }, // NOXREF { 0x01DB2580, "PM_WalkMove", (size_t)&PM_WalkMove }, { 0x01DB2B50, "PM_Friction", (size_t)&PM_Friction }, { 0x01DB2CF0, "PM_AirAccelerate", (size_t)&PM_AirAccelerate }, { 0x01DB2DB0, "PM_WaterMove", (size_t)&PM_WaterMove }, { 0x01DB30C0, "PM_AirMove", (size_t)&PM_AirMove }, - //{ 0x01DB3200, "PM_InWater", (size_t)&PM_InWater }, // NOXREF + //{ 0x01DB3200, "PM_InWater", (size_t)&PM_InWater }, // NOXREF { 0x01DB3220, "PM_CheckWater", (size_t)&PM_CheckWater }, { 0x01DB33E0, "PM_CatagorizePosition", (size_t)&PM_CatagorizePosition }, - //{ 0x01DB3590, "PM_GetRandomStuckOffsets", (size_t)&PM_GetRandomStuckOffsets }, // NOXREF + //{ 0x01DB3590, "PM_GetRandomStuckOffsets", (size_t)&PM_GetRandomStuckOffsets },// NOXREF //{ 0x01DB35E0, "PM_ResetStuckOffsets", (size_t)&PM_ResetStuckOffsets }, // NOXREF { 0x01DB3600, "PM_CheckStuck", (size_t)&PM_CheckStuck }, { 0x01DB3970, "PM_SpectatorMove", (size_t)&PM_SpectatorMove }, - //{ 0x01DB3C70, "PM_SplineFraction", (size_t)&PM_SplineFraction }, // NOXREF - //{ 0x01DB3C90, "PM_SimpleSpline", (size_t)&PM_SimpleSpline }, // NOXREF + //{ 0x01DB3C70, "PM_SplineFraction", (size_t)&PM_SplineFraction }, // NOXREF + //{ 0x01DB3C90, "PM_SimpleSpline", (size_t)&PM_SimpleSpline }, // NOXREF //{ 0x01DB3CB0, "PM_FixPlayerCrouchStuck", (size_t)&PM_FixPlayerCrouchStuck }, // NOXREF { 0x01DB3D50, "PM_Duck", (size_t)&PM_Duck }, { 0x01DB4110, "PM_LadderMove", (size_t)&PM_LadderMove }, { 0x01DB44D0, "PM_Ladder", (size_t)&PM_Ladder }, - //{ 0x01DB45A0, "PM_WaterJump", (size_t)&PM_WaterJump }, // NOXREF - //{ 0x01DB4660, "PM_AddGravity", (size_t)&PM_AddGravity }, // NOXREF - //{ 0x01DB46C0, "PM_PushEntity", (size_t)&PM_PushEntity }, // NOXREF + //{ 0x01DB45A0, "PM_WaterJump", (size_t)&PM_WaterJump }, // NOXREF + //{ 0x01DB4660, "PM_AddGravity", (size_t)&PM_AddGravity }, // NOXREF + //{ 0x01DB46C0, "PM_PushEntity", (size_t)&PM_PushEntity }, // NOXREF { 0x01DB4820, "PM_Physics_Toss", (size_t)&PM_Physics_Toss }, { 0x01DB4DE0, "PM_NoClip", (size_t)&PM_NoClip }, //{ 0x01DB4E90, "PM_PreventMegaBunnyJumping", (size_t)&PM_PreventMegaBunnyJumping }, // NOXREF @@ -216,7 +214,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DB06A0, "_VectorSubtract", (size_t)&_VectorSubtract }, // NOXREF //{ 0x01DB06D0, "_VectorAdd", (size_t)&_VectorAdd }, // NOXREF //{ 0x01DB0700, "_VectorCopy", (size_t)&_VectorCopy }, // NOXREF - //{ 0x01DB0720, "CrossProduct", (size_t)&_CrossProduct }, // NOXREF + //{ 0x01DB0720, "CrossProduct", (size_t)&CrossProduct }, // NOXREF { 0x01DB0760, "Length", (size_t)&Length }, //{ 0x01DB0780, "Distance", (size_t)&Distance }, // NOXREF { 0x01DB07D0, "VectorNormalize", (size_t)&VectorNormalize }, @@ -444,7 +442,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D63AC0, "_ZN11CBaseEntity12ShouldToggleE8USE_TYPEi", mfunc_ptr_cast(&CBaseEntity::ShouldToggle) }, { 0x01D71BC0, "_ZN11CBaseEntity11FireBulletsEj6VectorS0_S0_fiiiP9entvars_s", mfunc_ptr_cast(&CBaseEntity::FireBullets) }, { 0x01D72480, "_ZN11CBaseEntity12FireBullets3E6VectorS0_ffiiifP9entvars_sbi", mfunc_ptr_cast(&CBaseEntity::FireBullets3) }, - { 0x01DBB190, "_ZN11CBaseEntity14SUB_UseTargetsEPS_8USE_TYPEf", mfunc_ptr_cast(&CBaseEntity::SUB_UseTargets) }, + { 0x01DBB190, "_ZN11CBaseEntity14SUB_UseTargetsEPS_8USE_TYPEf", mfunc_ptr_cast(&CBaseEntity::SUB_UseTargets) }, { 0x01DBB260, "_Z11FireTargetsPKcP11CBaseEntityS2_8USE_TYPEf", (size_t)&FireTargets }, { 0x01D638C0, "_ZN11CBaseEntity10IntersectsEPS_", mfunc_ptr_cast(&CBaseEntity::Intersects) }, //{ 0x01D63950, "_ZN11CBaseEntity11MakeDormantEv", mfunc_ptr_cast(&CBaseEntity::MakeDormant) }, // NOXREF @@ -589,7 +587,7 @@ FunctionHook g_FunctionHooks[] = #endif // BaseMonster_Region #ifndef Player_Region - + //CBasePlayer //virtual func { 0x01DA5200, "_ZN11CBasePlayer5SpawnEv", mfunc_ptr_cast(&CBasePlayer::Spawn_) }, @@ -1738,7 +1736,8 @@ FunctionHook g_FunctionHooks[] = { 0x01D867A0, "_ZN10CHealthKit5SpawnEv", mfunc_ptr_cast(&CHealthKit::Spawn_) }, { 0x01D867D0, "_ZN10CHealthKit8PrecacheEv", mfunc_ptr_cast(&CHealthKit::Precache_) }, { 0x01D867F0, "_ZN10CHealthKit7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CHealthKit::MyTouch_) }, - + //linked objects + { 0x01D86750, "item_healthkit", (size_t)&item_healthkit }, //CWallHealth //virtual func { 0x01D86A30, "_ZN11CWallHealth5SpawnEv", mfunc_ptr_cast(&CWallHealth::Spawn_) }, @@ -1751,6 +1750,8 @@ FunctionHook g_FunctionHooks[] = //non-virtual func { 0x01D86D90, "_ZN11CWallHealth3OffEv", mfunc_ptr_cast(&CWallHealth::Off) }, { 0x01D86D30, "_ZN11CWallHealth8RechargeEv", mfunc_ptr_cast(&CWallHealth::Recharge) }, + //linked objects + { 0x01D86920, "func_healthcharger", (size_t)&func_healthcharger }, #endif // Healkit_Region @@ -1768,6 +1769,10 @@ FunctionHook g_FunctionHooks[] = //virtual func { 0x01D88BB0, "_ZN9CEnvLight5SpawnEv", mfunc_ptr_cast(&CEnvLight::Spawn_) }, { 0x01D88A20, "_ZN9CEnvLight8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CEnvLight::KeyValue_) }, + //linked objects + { 0x01D88620, "light", (size_t)&light }, + { 0x01D88980, "light_spot", (size_t)&light_spot }, + { 0x01D889D0, "light_environment", (size_t)&light_environment }, #endif // Lights_Region @@ -1887,7 +1892,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D86FC0, "_ZN17CHintMessageQueue5ResetEv", mfunc_ptr_cast(&CHintMessageQueue::Reset) }, { 0x01D87050, "_ZN17CHintMessageQueue6UpdateER11CBaseEntity", mfunc_ptr_cast(&CHintMessageQueue::Update) }, { 0x01D87120, "_ZN17CHintMessageQueue10AddMessageEPKcfbP10CUtlVectorIS1_E", mfunc_ptr_cast(&CHintMessageQueue::AddMessage) }, - //{ 0x0, "_ZN17CHintMessageQueue7IsEmptyEv", mfunc_ptr_cast(&CHintMessageQueue::IsEmpty) }, + //{ 0x0, "_ZN17CHintMessageQueue7IsEmptyEv", mfunc_ptr_cast(&CHintMessageQueue::IsEmpty) }, // NOXREF #endif // HintMessage_Region @@ -1905,46 +1910,64 @@ FunctionHook g_FunctionHooks[] = //virtual func { 0x01D874A0, "_ZN10CWorldItem5SpawnEv", mfunc_ptr_cast(&CWorldItem::Spawn_) }, { 0x01D87450, "_ZN10CWorldItem8KeyValueEP14KeyValueData_s", mfunc_ptr_cast(&CWorldItem::KeyValue_) }, + //linked objects + { 0x01D87400, "world_items", (size_t)&world_items }, //CItemSuit //virtual func { 0x01D877F0, "_ZN9CItemSuit5SpawnEv", mfunc_ptr_cast(&CItemSuit::Spawn_) }, { 0x01D878B0, "_ZN9CItemSuit8PrecacheEv", mfunc_ptr_cast(&CItemSuit::Precache_) }, { 0x01D878D0, "_ZN9CItemSuit7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemSuit::MyTouch_) }, + //linked objects + { 0x01D877A0, "item_suit", (size_t)&item_suit }, //CItemBattery //virtual func { 0x01D87990, "_ZN12CItemBattery5SpawnEv", mfunc_ptr_cast(&CItemBattery::Spawn_) }, { 0x01D87A50, "_ZN12CItemBattery8PrecacheEv", mfunc_ptr_cast(&CItemBattery::Precache_) }, { 0x01D87A70, "_ZN12CItemBattery7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemBattery::MyTouch_) }, + //linked objects + { 0x01D87940, "item_battery", (size_t)&item_battery }, //CItemAntidote //virtual func { 0x01D87C10, "_ZN13CItemAntidote5SpawnEv", mfunc_ptr_cast(&CItemAntidote::Spawn_) }, { 0x01D87CD0, "_ZN13CItemAntidote8PrecacheEv", mfunc_ptr_cast(&CItemAntidote::Precache_) }, { 0x01D87CE0, "_ZN13CItemAntidote7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemAntidote::MyTouch_) }, + //linked objects + { 0x01D87BC0, "item_antidote", (size_t)&item_antidote }, //CItemSecurity //virtual func { 0x01D87D60, "_ZN13CItemSecurity5SpawnEv", mfunc_ptr_cast(&CItemSecurity::Spawn_) }, { 0x01D87E20, "_ZN13CItemSecurity8PrecacheEv", mfunc_ptr_cast(&CItemSecurity::Precache_) }, { 0x01D87E30, "_ZN13CItemSecurity7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemSecurity::MyTouch_) }, + //linked objects + { 0x01D87D10, "item_security", (size_t)&item_security }, //CItemLongJump //virtual func { 0x01D87EA0, "_ZN13CItemLongJump5SpawnEv", mfunc_ptr_cast(&CItemLongJump::Spawn_) }, { 0x01D87F60, "_ZN13CItemLongJump8PrecacheEv", mfunc_ptr_cast(&CItemLongJump::Precache_) }, { 0x01D87F70, "_ZN13CItemLongJump7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemLongJump::MyTouch_) }, + //linked objects + { 0x01D87E50, "item_longjump", (size_t)&item_longjump }, //CItemKevlar //virtual func { 0x01D88070, "_ZN11CItemKevlar5SpawnEv", mfunc_ptr_cast(&CItemKevlar::Spawn_) }, { 0x01D88130, "_ZN11CItemKevlar8PrecacheEv", mfunc_ptr_cast(&CItemKevlar::Precache_) }, { 0x01D88140, "_ZN11CItemKevlar7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemKevlar::MyTouch_) }, + //linked objects + { 0x01D88020, "item_kevlar", (size_t)&item_kevlar }, //CItemAssaultSuit //virtual func { 0x01D88270, "_ZN16CItemAssaultSuit5SpawnEv", mfunc_ptr_cast(&CItemAssaultSuit::Spawn_) }, { 0x01D88330, "_ZN16CItemAssaultSuit8PrecacheEv", mfunc_ptr_cast(&CItemAssaultSuit::Precache_) }, { 0x01D88340, "_ZN16CItemAssaultSuit7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemAssaultSuit::MyTouch_) }, + //linked objects + { 0x01D88220, "item_assaultsuit", (size_t)&item_assaultsuit }, //CItemThighPack //virtual func { 0x01D88460, "_ZN14CItemThighPack5SpawnEv", mfunc_ptr_cast(&CItemThighPack::Spawn_) }, { 0x01D88520, "_ZN14CItemThighPack8PrecacheEv", mfunc_ptr_cast(&CItemThighPack::Precache_) }, { 0x01D88530, "_ZN14CItemThighPack7MyTouchEP11CBasePlayer", mfunc_ptr_cast(&CItemThighPack::MyTouch_) }, + //linked objects + { 0x01D88410, "item_thighpack", (size_t)&item_thighpack }, #endif // Items_Region @@ -2351,6 +2374,7 @@ FunctionHook g_FunctionHooks[] = #ifdef _WIN32 //{ 0x01D67920, "", mfunc_ptr_cast(&VARS) }, + //{ 0x01D78600, "", (size_t)&MAKE_STRING_CLASS }, #endif // _WIN32 //{ 0x01DC2670, "_Z8U_Randomv", (size_t)&U_Random }, // NOXREF @@ -2539,7 +2563,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D8EDA0, "_ZN10CGameRules14IsFreezePeriodEv", mfunc_ptr_cast(&CGameRules::IsFreezePeriod_) }, // DEFAULT //{ 0x01D8EDB0, "_ZN10CGameRules16ServerDeactivateEv", mfunc_ptr_cast(&CGameRules::ServerDeactivate_) }, // PURE //{ 0x01D8EDC0, "_ZN10CGameRules18CheckMapConditionsEv", mfunc_ptr_cast(&CGameRules::CheckMapConditions_) }, // PURE - + #endif // GameRules_Region #ifndef Singleplay_GameRules_Region @@ -2714,7 +2738,7 @@ FunctionHook g_FunctionHooks[] = #endif // Multiplay_GameRules_Region #ifndef Training_Gamerules_Region - + //CHalfLifeTraining //virtual func //{ 0x01DBBE50, "_ZN17CHalfLifeTrainingC2Ev", mfunc_ptr_cast(&CHalfLifeTraining::CHalfLifeTraining) } @@ -2763,7 +2787,7 @@ FunctionHook g_FunctionHooks[] = { 0x01DDCCD0, "_ZN11CCareerTask5ResetEv", mfunc_ptr_cast(&CCareerTask::Reset_) }, //{ 0x01DDDDE0, "_ZNK11CCareerTask26IsTaskCompletableThisRoundEv", mfunc_ptr_cast(&CCareerTask::IsTaskCompletableThisRound_) }, // DEFAULT //non-virtual func - //{ 0x01DDCB80, "_ZN11CCareerTask7NewTaskEPKc13GameEventTypeS1_ibbib", mfunc_ptr_cast(&CCareerTask::NewTask) }, + { 0x01DDCB80, "_ZN11CCareerTask7NewTaskEPKc13GameEventTypeS1_ibbib", mfunc_ptr_cast(&CCareerTask::NewTask) }, { 0x01DDCDB0, "_ZN11CCareerTask12OnWeaponKillEiibbP11CBasePlayerS1_", mfunc_ptr_cast(&CCareerTask::OnWeaponKill) }, { 0x01DDD000, "_ZN11CCareerTask14OnWeaponInjuryEiibP11CBasePlayer", mfunc_ptr_cast(&CCareerTask::OnWeaponInjury) }, //{ 0x0, "_ZN11CCareerTask10IsCompleteEv", mfunc_ptr_cast(&CCareerTask::IsComplete) }, @@ -2832,9 +2856,6 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN15CBasePlayerItem11GetItemInfoEP8ItemInfo", mfunc_ptr_cast(&CBasePlayerItem::GetItemInfo_) }, //{ 0x0, "_ZN15CBasePlayerItem9CanDeployEv", mfunc_ptr_cast(&CBasePlayerItem::CanDeploy_) }, //{ 0x01D01FF0, "_ZN15CBasePlayerItem7CanDropEv", mfunc_ptr_cast(&CBasePlayerItem::CanDrop_) }, - //0x01DCF160 - CBasePlayerItem::??? - //0x01D861D0 - CBasePlayerItem::??? - //{ 0x0, "_ZN15CBasePlayerItem6DeployEv", mfunc_ptr_cast(&CBasePlayerItem::Deploy) }, //{ 0x0, "_ZN15CBasePlayerItem8IsWeaponEv", mfunc_ptr_cast(&CBasePlayerItem::IsWeapon) }, //{ 0x01D02000, "_ZN15CBasePlayerItem10CanHolsterEv", mfunc_ptr_cast(&CBasePlayerItem::CanHolster) }, @@ -3543,6 +3564,8 @@ FunctionHook g_FunctionHooks[] = { 0x01D823B0, "_ZN8CGrenade11DetonateUseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CGrenade::DetonateUse) }, { 0x01D82EE0, "_ZN8CGrenade11TumbleThinkEv", mfunc_ptr_cast(&CGrenade::TumbleThink) }, { 0x01D83030, "_ZN8CGrenade14SG_TumbleThinkEv", mfunc_ptr_cast(&CGrenade::SG_TumbleThink) }, + //linked objects + { 0x01D80CF0, "grenade", (size_t)&grenade }, #endif // GGrenade_Region @@ -3675,7 +3698,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D346C0, "_ZN11CBotManager13RemoveGrenadeEP8CGrenade", mfunc_ptr_cast(&CBotManager::RemoveGrenade) }, //{ 0x01D346F0, "_ZN11CBotManager22ValidateActiveGrenadesEv", mfunc_ptr_cast(&CBotManager::ValidateActiveGrenades) }, // NOXREF //{ 0x01D34740, "_ZN11CBotManager18DestroyAllGrenadesEv", mfunc_ptr_cast(&CBotManager::DestroyAllGrenades) }, // NOXREF - { 0x01D347A0, "_ZN11CBotManager18IsInsideSmokeCloudEPK6Vector", mfunc_ptr_cast(&CBotManager::IsInsideSmokeCloud) }, // FIXME!! + { 0x01D347A0, "_ZN11CBotManager18IsInsideSmokeCloudEPK6Vector", mfunc_ptr_cast(&CBotManager::IsInsideSmokeCloud) }, { 0x01D34850, "_ZN11CBotManager20IsLineBlockedBySmokeEPK6VectorS2_", mfunc_ptr_cast(&CBotManager::IsLineBlockedBySmoke) }, //non-class func { 0x01D34120, "_Z15NameToGameEventPKc", (size_t)&NameToGameEvent }, @@ -3744,13 +3767,13 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK13CCSBotManager11IsRoundOverEv", mfunc_ptr_cast(&CCSBotManager::IsRoundOver) }, //{ 0x0, "_ZNK13CCSBotManager11GetNavPlaceEv", mfunc_ptr_cast(&CCSBotManager::GetNavPlace) }, //{ 0x0, "_ZN13CCSBotManager11SetNavPlaceEj", mfunc_ptr_cast(&CCSBotManager::SetNavPlace) }, - //{ 0x01D24D10, "_ZN13CCSBotManager15MonitorBotCVarsEv", mfunc_ptr_cast(&CCSBotManager::MonitorBotCVars) }, + //{ 0x01D24D10, "_ZN13CCSBotManager15MonitorBotCVarsEv", mfunc_ptr_cast(&CCSBotManager::MonitorBotCVars) }, // NOXREF { 0x01D24AE0, "_ZN13CCSBotManager16MaintainBotQuotaEv", mfunc_ptr_cast(&CCSBotManager::MaintainBotQuota) }, //{ 0x0, "_ZN13CCSBotManager16GetRandomBotNameENS_9SkillTypeE", mfunc_ptr_cast(&CCSBotManager::GetRandomBotName) }, - //{ 0x01D25270, "_ZN13CCSBotManager6AddBotEPK10BotProfile18BotProfileTeamType", mfunc_ptr_cast(&CCSBotManager::AddBot) }, // HOOK: FIX ME + { 0x01D25270, "_ZN13CCSBotManager6AddBotEPK10BotProfile18BotProfileTeamType", mfunc_ptr_cast(&CCSBotManager::AddBot) }, { 0x01D248B0, "_ZN13CCSBotManager13BotAddCommandE18BotProfileTeamTypeb", mfunc_ptr_cast(&CCSBotManager::BotAddCommand) }, //{ 0x01D238A0, "_Z16PrintAllEntitiesv", (size_t)&PrintAllEntities }, // NOXREF - //{ 0x01D23020, "_Z12UTIL_DrawBoxP6Extentiiii", (size_t)&UTIL_DrawBox }, + { 0x01D23020, "_Z12UTIL_DrawBoxP6Extentiiii", (size_t)&UTIL_DrawBox }, //CCSBot //{ 0x01D208C0, "_ZN6CCSBotC2Ev", mfunc_ptr_cast(&CCSBot::CCSBot) }, //virtual func @@ -3762,10 +3785,10 @@ FunctionHook g_FunctionHooks[] = { 0x01D20A60, "_ZN6CCSBot10InitializeEPK10BotProfile", mfunc_ptr_cast(&CCSBot::Initialize_) }, { 0x01D20E40, "_ZN6CCSBot8SpawnBotEv", mfunc_ptr_cast(&CCSBot::SpawnBot_) }, { 0x01D2D370, "_ZN6CCSBot6UpkeepEv", mfunc_ptr_cast(&CCSBot::Upkeep_) }, - //{ 0x01D2D9B0, "_ZN6CCSBot6UpdateEv", mfunc_ptr_cast(&CCSBot::Update_) }, // using refs HOOK: FIX ME + //@{ 0x01D2D9B0, "_ZN6CCSBot6UpdateEv", mfunc_ptr_cast(&CCSBot::Update_) }, // using refs HOOK: FIX ME { 0x01D17370, "_ZN6CCSBot4WalkEv", mfunc_ptr_cast(&CCSBot::Walk_) }, { 0x01D173A0, "_ZN6CCSBot4JumpEb", mfunc_ptr_cast(&CCSBot::Jump_) }, - //{ 0x01D1F990, "_ZN6CCSBot7OnEventE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CCSBot::OnEvent_) }, + { 0x01D1F990, "_ZN6CCSBot7OnEventE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CCSBot::OnEvent_) }, { 0x01D2F490, "_ZNK6CCSBot9IsVisibleEPK6Vectorb", mfunc_ptr_cast(&CCSBot::IsVisible_) }, { 0x01D2F5C0, "_ZNK6CCSBot9IsVisibleEP11CBasePlayerbPh", mfunc_ptr_cast(&CCSBot::IsVisible_) }, { 0x01D21390, "_ZNK6CCSBot18IsEnemyPartVisibleEN4CBot15VisiblePartTypeE", mfunc_ptr_cast(&CCSBot::IsEnemyPartVisible_) }, @@ -3788,11 +3811,11 @@ FunctionHook g_FunctionHooks[] = { 0x01D2C830, "_ZN6CCSBot9TryToHideEP8CNavAreaffbb", mfunc_ptr_cast(&CCSBot::TryToHide) }, { 0x01D2CA10, "_ZN6CCSBot12TryToRetreatEv", mfunc_ptr_cast(&CCSBot::TryToRetreat) }, { 0x01D2CEA0, "_ZNK6CCSBot8IsHidingEv", mfunc_ptr_cast(&CCSBot::IsHiding) }, - //{ 0x01D2CEC0, "_ZNK6CCSBot14IsAtHidingSpotEv", mfunc_ptr_cast(&CCSBot::IsAtHidingSpot) }, + { 0x01D2CEC0, "_ZNK6CCSBot14IsAtHidingSpotEv", mfunc_ptr_cast(&CCSBot::IsAtHidingSpot) }, { 0x01D2CA90, "_ZN6CCSBot4HuntEv", mfunc_ptr_cast(&CCSBot::Hunt) }, { 0x01D2CEE0, "_ZNK6CCSBot9IsHuntingEv", mfunc_ptr_cast(&CCSBot::IsHunting) }, { 0x01D2CB60, "_ZN6CCSBot6AttackEP11CBasePlayer", mfunc_ptr_cast(&CCSBot::Attack) }, - //{ 0x01D30B70, "_ZN6CCSBot17FireWeaponAtEnemyEv", mfunc_ptr_cast(&CCSBot::FireWeaponAtEnemy) }, + { 0x01D30B70, "_ZN6CCSBot17FireWeaponAtEnemyEv", mfunc_ptr_cast(&CCSBot::FireWeaponAtEnemy) }, { 0x01D2CD80, "_ZN6CCSBot13StopAttackingEv", mfunc_ptr_cast(&CCSBot::StopAttacking) }, { 0x01D2CE50, "_ZNK6CCSBot11IsAttackingEv", mfunc_ptr_cast(&CCSBot::IsAttacking) }, { 0x01D2CF40, "_ZN6CCSBot6MoveToEPK6Vector9RouteType", mfunc_ptr_cast(&CCSBot::MoveTo) }, @@ -3912,7 +3935,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D29260, "_ZNK6CCSBot16IsFriendInTheWayEPK6Vector", mfunc_ptr_cast(&CCSBot::IsFriendInTheWay) }, { 0x01D29500, "_ZN6CCSBot22FeelerReflexAdjustmentEP6Vector", mfunc_ptr_cast(&CCSBot::FeelerReflexAdjustment) }, //{ 0x0, "_ZN6CCSBot13SetLookAnglesEff", mfunc_ptr_cast(&CCSBot::SetLookAngles) }, - //2@@{ 0x01D2EDD0, "_ZN6CCSBot16UpdateLookAnglesEv", mfunc_ptr_cast(&CCSBot::UpdateLookAngles) }, // Using REFS + //2@@{ 0x01D2EDD0, "_ZN6CCSBot16UpdateLookAnglesEv", mfunc_ptr_cast(&CCSBot::UpdateLookAngles) }, // Using REFS FIXME { 0x01D2F9C0, "_ZN6CCSBot16UpdateLookAroundEb", mfunc_ptr_cast(&CCSBot::UpdateLookAround) }, { 0x01D2F910, "_ZN6CCSBot17InhibitLookAroundEf", mfunc_ptr_cast(&CCSBot::InhibitLookAround) }, //{ 0x0, "_ZN6CCSBot15SetForwardAngleEf", mfunc_ptr_cast(&CCSBot::SetForwardAngle) }, // NOXREF @@ -3965,7 +3988,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D2BD80, "_ZN6CCSBot8SetStateEP8BotState", mfunc_ptr_cast(&CCSBot::SetState) }, { 0x01D26080, "_ZN6CCSBot19MoveTowardsPositionEPK6Vector", mfunc_ptr_cast(&CCSBot::MoveTowardsPosition) }, //{ 0x01D26510, "_ZN6CCSBot20MoveAwayFromPositionEPK6Vector", mfunc_ptr_cast(&CCSBot::MoveAwayFromPosition) }, // NOXREF - //{ 0x01D26650, "_ZN6CCSBot22StrafeAwayFromPositionEPK6Vector", mfunc_ptr_cast(&CCSBot::StrafeAwayFromPosition) }, + { 0x01D26650, "_ZN6CCSBot22StrafeAwayFromPositionEPK6Vector", mfunc_ptr_cast(&CCSBot::StrafeAwayFromPosition) }, { 0x01D25C50, "_ZN6CCSBot10StuckCheckEv", mfunc_ptr_cast(&CCSBot::StuckCheck) }, { 0x01D2A6F0, "_ZN6CCSBot16BuildTrivialPathEPK6Vector", mfunc_ptr_cast(&CCSBot::BuildTrivialPath) }, { 0x01D26BA0, "_ZN6CCSBot20ComputePathPositionsEv", mfunc_ptr_cast(&CCSBot::ComputePathPositions) }, @@ -4046,7 +4069,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK11CSGameState12GetBombStateEv", mfunc_ptr_cast(&CSGameState::GetBombState) }, // NOXREF //{ 0x0, "_ZNK11CSGameState17GetNearestHostageEv", mfunc_ptr_cast(&CSGameState::GetNearestHostage) }, // NOXREF { 0x01D32BE0, "_ZN11CSGameState21InitializeHostageInfoEv", mfunc_ptr_cast(&CSGameState::InitializeHostageInfo) }, - //{ 0x01D15EA0, "_Z16NavAreaBuildPathI8PathCostEbP8CNavAreaS2_PK6VectorRT_PS2_", (size_t)&NavAreaBuildPath__PathCost__wrapper }, + { 0x01D15EA0, "_Z16NavAreaBuildPathI8PathCostEbP8CNavAreaS2_PK6VectorRT_PS2_", (size_t)&NavAreaBuildPath__PathCost__wrapper }, #ifdef _WIN32 { 0x01D15A30, "", (size_t)&NavAreaTravelDistance__PathCost__wrapper }, #endif // _WIN32 @@ -4064,20 +4087,20 @@ FunctionHook g_FunctionHooks[] = //BotState //virtual func //{ 0x0, "_ZN8BotState7OnEnterEP6CCSBot", mfunc_ptr_cast(&BotState::OnEnter_) }, // PURE - //{ 0x0, "_ZN8BotState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&BotState::OnUpdate_) }, // PURE + //{ 0x0, "_ZN8BotState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&BotState::OnUpdate_) }, // PURE //{ 0x01D212B0, "_ZN8BotState6OnExitEP6CCSBot", mfunc_ptr_cast(&BotState::OnExit_) }, // PURE - //{ 0x0, "_ZNK8BotState7GetNameEv", mfunc_ptr_cast(&BotState::GetName) }, // NOXREF + //{ 0x0, "_ZNK8BotState7GetNameEv", mfunc_ptr_cast(&BotState::GetName) }, // NOXREF //IdleState //virtual func { 0x01D142A0, "_ZN9IdleState7OnEnterEP6CCSBot", mfunc_ptr_cast(&IdleState::OnEnter_) }, { 0x01D14320, "_ZN9IdleState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&IdleState::OnUpdate_) }, - //{ 0x01D212C0, "_ZNK9IdleState7GetNameEv", mfunc_ptr_cast(&IdleState::GetName_) }, + //{ 0x01D212C0, "_ZNK9IdleState7GetNameEv", mfunc_ptr_cast(&IdleState::GetName_) }, // DEFAULT //HuntState //virtual func { 0x01D13E20, "_ZN9HuntState7OnEnterEP6CCSBot", mfunc_ptr_cast(&HuntState::OnEnter_) }, { 0x01D13EA0, "_ZN9HuntState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&HuntState::OnUpdate_) }, //{ 0x01D14290, "_ZN9HuntState6OnExitEP6CCSBot", mfunc_ptr_cast(&HuntState::OnExit_) }, // PURE - //{ 0x01D212D0, "_ZNK9HuntState7GetNameEv", mfunc_ptr_cast(&HuntState::GetName_) }, + //{ 0x01D212D0, "_ZNK9HuntState7GetNameEv", mfunc_ptr_cast(&HuntState::GetName_) }, // DEFAULT //non-virtual func //{ 0x0, "_ZN9HuntState13ClearHuntAreaEv", mfunc_ptr_cast(&HuntState::ClearHuntArea) }, // NOXREF //AttackState @@ -4085,7 +4108,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D10960, "_ZN11AttackState7OnEnterEP6CCSBot", mfunc_ptr_cast(&AttackState::OnEnter_) }, { 0x01D10CF0, "_ZN11AttackState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&AttackState::OnUpdate_) }, { 0x01D11860, "_ZN11AttackState6OnExitEP6CCSBot", mfunc_ptr_cast(&AttackState::OnExit_) }, - //{ 0x01D212E0, "_ZNK11AttackState7GetNameEv", mfunc_ptr_cast(&AttackState::GetName_) }, + //{ 0x01D212E0, "_ZNK11AttackState7GetNameEv", mfunc_ptr_cast(&AttackState::GetName_) }, // DEFAULT //non-virtual func //{ 0x0, "_ZN11AttackState16SetCrouchAndHoldEb", mfunc_ptr_cast(&AttackState::SetCrouchAndHold) }, // NOXREF //{ 0x01D10CC0, "_ZN11AttackState13StopAttackingEP6CCSBot", mfunc_ptr_cast(&AttackState::StopAttacking) }, // NOXREF @@ -4094,7 +4117,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D165C0, "_ZN21InvestigateNoiseState7OnEnterEP6CCSBot", mfunc_ptr_cast(&InvestigateNoiseState::OnEnter_) }, { 0x01D166B0, "_ZN21InvestigateNoiseState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&InvestigateNoiseState::OnUpdate_) }, { 0x01D16920, "_ZN21InvestigateNoiseState6OnExitEP6CCSBot", mfunc_ptr_cast(&InvestigateNoiseState::OnExit_) }, - //{ 0x01D212F0, "_ZNK21InvestigateNoiseState7GetNameEv", mfunc_ptr_cast(&InvestigateNoiseState::GetName_) }, + //{ 0x01D212F0, "_ZNK21InvestigateNoiseState7GetNameEv", mfunc_ptr_cast(&InvestigateNoiseState::GetName_) }, // DEFAULT //non-virtual func //{ 0x01D164D0, "_ZN21InvestigateNoiseState18AttendCurrentNoiseEP6CCSBot", mfunc_ptr_cast(&InvestigateNoiseState::AttendCurrentNoise) }, // NOXREF //BuyState @@ -4106,7 +4129,7 @@ FunctionHook g_FunctionHooks[] = //MoveToState //virtual func { 0x01D16930, "_ZN11MoveToState7OnEnterEP6CCSBot", mfunc_ptr_cast(&MoveToState::OnEnter_) }, - //{ 0x01D169C0, "_ZN11MoveToState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&MoveToState::OnUpdate_) }, // HOOK: FIX ME + { 0x01D169C0, "_ZN11MoveToState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&MoveToState::OnUpdate_) }, { 0x01D16FE0, "_ZN11MoveToState6OnExitEP6CCSBot", mfunc_ptr_cast(&MoveToState::OnExit_) }, //{ 0x01D21310, "_ZNK11MoveToState7GetNameEv", mfunc_ptr_cast(&MoveToState::GetName_) }, // DEFAULT //non-virtual func @@ -4128,7 +4151,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D12200, "_ZN15DefuseBombState7OnEnterEP6CCSBot", mfunc_ptr_cast(&DefuseBombState::OnEnter_) }, { 0x01D12270, "_ZN15DefuseBombState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&DefuseBombState::OnUpdate_) }, { 0x01D12340, "_ZN15DefuseBombState6OnExitEP6CCSBot", mfunc_ptr_cast(&DefuseBombState::OnExit_) }, - //{ 0x01D21340, "_ZNK15DefuseBombState7GetNameEv", mfunc_ptr_cast(&DefuseBombState::GetName_) }, // DEFAULT + //{ 0x01D21340, "_ZNK15DefuseBombState7GetNameEv", mfunc_ptr_cast(&DefuseBombState::GetName_) }, // DEFAULT //HideState //virtual func { 0x01D13250, "_ZN9HideState7OnEnterEP6CCSBot", mfunc_ptr_cast(&HideState::OnEnter_) }, @@ -4157,13 +4180,13 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D21370, "_ZNK11FollowState7GetNameEv", mfunc_ptr_cast(&FollowState::GetName_) }, // DEFAULT //non-virtual func //{ 0x0, "_ZN11FollowState9SetLeaderEP11CBasePlayer", mfunc_ptr_cast(&FollowState::SetLeader) }, // NOXREF - //{ 0x01D126E0, "_ZN11FollowState24ComputeLeaderMotionStateEf", mfunc_ptr_cast(&FollowState::ComputeLeaderMotionState) }, + { 0x01D126E0, "_ZN11FollowState24ComputeLeaderMotionStateEf", mfunc_ptr_cast(&FollowState::ComputeLeaderMotionState) }, //UseEntityState //virtual func { 0x01D171A0, "_ZN14UseEntityState7OnEnterEP6CCSBot", mfunc_ptr_cast(&UseEntityState::OnEnter_) }, { 0x01D171B0, "_ZN14UseEntityState8OnUpdateEP6CCSBot", mfunc_ptr_cast(&UseEntityState::OnUpdate_) }, { 0x01D17280, "_ZN14UseEntityState6OnExitEP6CCSBot", mfunc_ptr_cast(&UseEntityState::OnExit_) }, - //{ 0x01D21380, "_ZNK14UseEntityState7GetNameEv", mfunc_ptr_cast(&UseEntityState::GetName_) }, + //{ 0x01D21380, "_ZNK14UseEntityState7GetNameEv", mfunc_ptr_cast(&UseEntityState::GetName_) }, // DEFAULT //non-virtual func //{ 0x0, "_ZN14UseEntityState9SetEntityEP11CBaseEntity", mfunc_ptr_cast(&UseEntityState::SetEntity) }, // NOXREF @@ -4180,19 +4203,18 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZN13ActiveGrenadeC2EiP8CGrenade", mfunc_ptr_cast(&ActiveGrenade::ActiveGrenade) }, { 0x01D34080, "_ZN13ActiveGrenade12OnEntityGoneEv", mfunc_ptr_cast(&ActiveGrenade::OnEntityGone) }, { 0x01D340A0, "_ZNK13ActiveGrenade7IsValidEv", mfunc_ptr_cast(&ActiveGrenade::IsValid) }, - //{ 0x0, "_ZNK13ActiveGrenade8IsEntityEP8CGrenade", mfunc_ptr_cast(&ActiveGrenade::IsEntity) }, // NOXREF - //{ 0x0, "_ZNK13ActiveGrenade5GetIDEv", mfunc_ptr_cast(&ActiveGrenade::GetID) }, // NOXREF + //{ 0x0, "_ZNK13ActiveGrenade8IsEntityEP8CGrenade", mfunc_ptr_cast(&ActiveGrenade::IsEntity) }, // NOXREF + //{ 0x0, "_ZNK13ActiveGrenade5GetIDEv", mfunc_ptr_cast(&ActiveGrenade::GetID) }, // NOXREF //{ 0x0, "_ZNK13ActiveGrenade21GetDetonationPositionEv", mfunc_ptr_cast(&ActiveGrenade::GetDetonationPosition) }, // NOXREF - //{ 0x01D340C0, "_ZNK13ActiveGrenade11GetPositionEv", mfunc_ptr_cast(&ActiveGrenade::GetPosition) }, - + //{ 0x01D340C0, "_ZNK13ActiveGrenade11GetPositionEv", mfunc_ptr_cast(&ActiveGrenade::GetPosition) }, // NOXREF //CBot //{ 0x01D334D0, "", mfunc_ptr_cast(&CBot::CBot) }, //virtual func - //{ 0x01D33550, "_ZN4CBot5SpawnEv", mfunc_ptr_cast(&CBot::Spawn_) }, // do not hook - //{ 0x01D340D0, "_ZN4CBot10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CBot::TakeDamage) }, - //{ 0x01D340E0, "_ZN4CBot6KilledEP9entvars_si", mfunc_ptr_cast(&CBot::Killed) }, - //{ 0x01D210C0, "_ZN4CBot5ThinkEv", mfunc_ptr_cast(&CBot::Think) }, // PURE - //{ 0x01D210B0, "_ZN4CBot5IsBotEv", mfunc_ptr_cast(&CBot::IsBot) }, + { 0x01D33550, "_ZN4CBot5SpawnEv", mfunc_ptr_cast(&CBot::Spawn_) }, + //{ 0x01D340D0, "_ZN4CBot10TakeDamageEP9entvars_sS1_fi", mfunc_ptr_cast(&CBot::TakeDamage) }, // DEFAULT + //{ 0x01D340E0, "_ZN4CBot6KilledEP9entvars_si", mfunc_ptr_cast(&CBot::Killed) }, // DEFAULT + //{ 0x01D210C0, "_ZN4CBot5ThinkEv", mfunc_ptr_cast(&CBot::Think) }, // PURE + //{ 0x01D210B0, "_ZN4CBot5IsBotEv", mfunc_ptr_cast(&CBot::IsBot) }, // DEFAULT { 0x01D33600, "_ZN4CBot16GetAutoaimVectorEf", mfunc_ptr_cast(&CBot::GetAutoaimVector_) }, //{ 0x0, "_ZN4CBot16OnTouchingWeaponEP10CWeaponBox", mfunc_ptr_cast(&CBot::OnTouchingWeapon) }, { 0x01D33540, "_ZN4CBot10InitializeEPK10BotProfile", mfunc_ptr_cast(&CBot::Initialize_) }, @@ -4215,7 +4237,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D33990, "_ZN4CBot19TogglePrimaryAttackEv", mfunc_ptr_cast(&CBot::TogglePrimaryAttack_) }, { 0x01D339C0, "_ZN4CBot15SecondaryAttackEv", mfunc_ptr_cast(&CBot::SecondaryAttack_) }, { 0x01D339D0, "_ZN4CBot6ReloadEv", mfunc_ptr_cast(&CBot::Reload_) }, - //{ 0x01D34100, "_ZN4CBot7OnEventE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CBot::OnEvent) }, + //{ 0x01D34100, "_ZN4CBot7OnEventE13GameEventTypeP11CBaseEntityS2_", mfunc_ptr_cast(&CBot::OnEvent) }, // PURE //{ 0x0, "_ZNK4CBot9IsVisibleEPK6Vectorb", mfunc_ptr_cast(&CBot::IsVisible) }, //{ 0x0, "_ZNK4CBot9IsVisibleEP11CBasePlayerbPh", mfunc_ptr_cast(&CBot::IsVisible) }, //{ 0x0, "_ZNK4CBot18IsEnemyPartVisibleENS_15VisiblePartTypeE", mfunc_ptr_cast(&CBot::IsEnemyPartVisible) }, // NOXREF PURE @@ -4242,7 +4264,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D33C40, "_ZNK4CBot19GetEnemiesRemainingEv", mfunc_ptr_cast(&CBot::GetEnemiesRemaining) }, { 0x01D33D20, "_ZNK4CBot19GetFriendsRemainingEv", mfunc_ptr_cast(&CBot::GetFriendsRemaining) }, { 0x01D33E30, "_ZNK4CBot23IsLocalPlayerWatchingMeEv", mfunc_ptr_cast(&CBot::IsLocalPlayerWatchingMe) }, - //{ 0x01D33E90, "_ZNK4CBot5PrintEPcz", mfunc_ptr_cast(&CBot::Print) }, // NOXREF + //{ 0x01D33E90, "_ZNK4CBot5PrintEPcz", mfunc_ptr_cast(&CBot::Print) }, // NOXREF { 0x01D33F00, "_ZNK4CBot14PrintIfWatchedEPcz", mfunc_ptr_cast(&CBot::PrintIfWatched) }, { 0x01D33660, "_ZN4CBot8BotThinkEv", mfunc_ptr_cast(&CBot::BotThink) }, //{ 0x0, "_ZNK4CBot11IsNetClientEv", mfunc_ptr_cast(&CBot::IsNetClient) }, @@ -4297,8 +4319,8 @@ FunctionHook g_FunctionHooks[] = { 0x01D19ED0, "_ZN16BotPhraseManager10InitializeEPKci", mfunc_ptr_cast(&BotPhraseManager::Initialize) }, { 0x01D19DA0, "_ZN16BotPhraseManager14OnRoundRestartEv", mfunc_ptr_cast(&BotPhraseManager::OnRoundRestart) }, //{ 0x01D19D90, "_ZN16BotPhraseManager11OnMapChangeEv", mfunc_ptr_cast(&BotPhraseManager::OnMapChange) }, // NOXREF - //{ 0x01D1A830, "_ZNK16BotPhraseManager8NameToIDEPKc", mfunc_ptr_cast(&BotPhraseManager::NameToID) }, - //{ 0x01D1A8A0, "_ZNK16BotPhraseManager8IDToNameEj", mfunc_ptr_cast(&BotPhraseManager::IDToName) }, + { 0x01D1A830, "_ZNK16BotPhraseManager8NameToIDEPKc", mfunc_ptr_cast(&BotPhraseManager::NameToID) }, + { 0x01D1A8A0, "_ZNK16BotPhraseManager8IDToNameEj", mfunc_ptr_cast(&BotPhraseManager::IDToName) }, { 0x01D1A8F0, "_ZNK16BotPhraseManager9GetPhraseEPKc", mfunc_ptr_cast(&BotPhraseManager::GetPhrase) }, //{ 0x01D1A940, "_ZNK16BotPhraseManager8GetPlaceEPKc", mfunc_ptr_cast(&BotPhraseManager::GetPlace) }, // NOXREF { 0x01D1A990, "_ZNK16BotPhraseManager8GetPlaceEj", mfunc_ptr_cast(&BotPhraseManager::GetPlace) }, @@ -4306,7 +4328,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x0, "_ZNK16BotPhraseManager25GetPlaceStatementIntervalEj", mfunc_ptr_cast(&BotPhraseManager::GetPlaceStatementInterval) }, //{ 0x0, "_ZN16BotPhraseManager27ResetPlaceStatementIntervalEj", mfunc_ptr_cast(&BotPhraseManager::ResetPlaceStatementInterval) }, #ifdef _WIN32 - //{ 0x01D1F830, "_ZNK16BotPhraseManager14FindPlaceIndexEj", mfunc_ptr_cast(&BotPhraseManager::FindPlaceIndex) }, + { 0x01D1F830, "_ZNK16BotPhraseManager14FindPlaceIndexEj", mfunc_ptr_cast(&BotPhraseManager::FindPlaceIndex) }, #endif // _WIN32 //BotStatement @@ -4405,7 +4427,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D36C10, "_Z18UTIL_IsTeamAllBotsi", (size_t)&UTIL_IsTeamAllBots }, { 0x01D36CE0, "_Z21UTIL_GetClosestPlayerPK6VectorPf", mfunc_ptr_cast(&UTIL_GetClosestPlayer) }, { 0x01D36E30, "_Z21UTIL_GetClosestPlayerPK6VectoriPf", mfunc_ptr_cast(&UTIL_GetClosestPlayer) }, - //{ 0x01D36F90, "_Z17UTIL_GetBotPrefixv", (size_t)&UTIL_GetBotPrefix }, // NOXREF + //{ 0x01D36F90, "_Z17UTIL_GetBotPrefixv", (size_t)&UTIL_GetBotPrefix }, // NOXREF { 0x01D36FA0, "_Z24UTIL_ConstructBotNetNamePciPK10BotProfile", (size_t)&UTIL_ConstructBotNetName }, { 0x01D37000, "_Z20UTIL_IsVisibleToTeamRK6Vectorif", (size_t)&UTIL_IsVisibleToTeam }, { 0x01D37190, "_Z19UTIL_GetLocalPlayerv", (size_t)&UTIL_GetLocalPlayer }, @@ -4429,7 +4451,7 @@ FunctionHook g_FunctionHooks[] = #ifndef CS_Init_Region - //{ 0x01D206A0, "_Z17InstallBotControlv", (size_t)&InstallBotControl }, + { 0x01D206A0, "_Z17InstallBotControlv", (size_t)&InstallBotControl }, { 0x01D20730, "_Z17Bot_ServerCommandv", (size_t)&Bot_ServerCommand }, { 0x01D20760, "_Z17Bot_RegisterCvarsv", (size_t)&Bot_RegisterCvars }, @@ -4439,9 +4461,8 @@ FunctionHook g_FunctionHooks[] = //AI //{ 0x01D848B0, "_Z11FBoxVisibleP9entvars_sS0_R6Vectorf", (size_t)&FBoxVisible }, // NOXREF - //{ 0x01D84A10, "_Z12VecCheckTossP9entvars_sRK6VectorS1_f", (size_t)&VecCheckToss }, // NOXREF - //{ 0x01D84EB0, "_Z13VecCheckThrowP9entvars_sRK6VectorS1_ff", (size_t)&VecCheckThrow }, // NOXREF - + //{ 0x01D84A10, "_Z12VecCheckTossP9entvars_sRK6VectorS1_f", (size_t)&VecCheckToss }, // NOXREF + //{ 0x01D84EB0, "_Z13VecCheckThrowP9entvars_sRK6VectorS1_ff", (size_t)&VecCheckThrow }, // NOXREF //CRecharge //virtual func { 0x01D851E0, "_ZN9CRecharge5SpawnEv", mfunc_ptr_cast(&CRecharge::Spawn_) }, @@ -4452,7 +4473,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D85120, "_ZN9CRecharge10ObjectCapsEv", mfunc_ptr_cast(&CRecharge::ObjectCaps_) }, // DEFAULT { 0x01D852A0, "_ZN9CRecharge3UseEP11CBaseEntityS1_8USE_TYPEf", mfunc_ptr_cast(&CRecharge::Use_) }, //non-virtual func - //{ 0x01D850D0, "func_recharge", (size_t)&func_recharge }, + { 0x01D850D0, "func_recharge", (size_t)&func_recharge }, { 0x01D855A0, "_ZN9CRecharge3OffEv", mfunc_ptr_cast(&CRecharge::Off) }, { 0x01D85570, "_ZN9CRecharge8RechargeEv", mfunc_ptr_cast(&CRecharge::Recharge) }, //CCycler @@ -4654,7 +4675,7 @@ FunctionHook g_FunctionHooks[] = //{ 0x01DD43A0, "_ZN8CCSTutor20ApplyPersistentDecayEv", mfunc_ptr_cast(&CCSTutor::ApplyPersistentDecay) }, // NOXREF { 0x01DDA9A0, "_ZN8CCSTutor21GetEntityForMessageIDEiP11CBaseEntity", mfunc_ptr_cast(&CCSTutor::GetEntityForMessageID) }, { 0x01DDB3A0, "_ZN8CCSTutor20ResetPlayerDeathInfoEv", mfunc_ptr_cast(&CCSTutor::ResetPlayerDeathInfo) }, - { 0x01DDB3C0, "_ZN8CCSTutor25ConstructRecentDeathsListE8TeamNamePciP17TutorMessageEvent", mfunc_ptr_cast(&CCSTutor::ConstructRecentDeathsList) }, + { 0x01DDB3C0, "_ZN8CCSTutor25ConstructRecentDeathsListE8TeamNamePciP17TutorMessageEvent", mfunc_ptr_cast(&CCSTutor::ConstructRecentDeathsList) }, //TutorMessageEvent //virtual func //{ 0x01DD2A10, "_ZN17TutorMessageEventC2Eiiffi", mfunc_ptr_cast(&TutorMessageEvent::TutorMessageEvent) }, @@ -4785,12 +4806,12 @@ FunctionHook g_FunctionHooks[] = #endif // VoiceManager_Region #ifndef Vector_Region - + { 0x01D71160, "_ZN8Vector2D16NormalizeInPlaceEv", mfunc_ptr_cast(&Vector2D::NormalizeInPlace) }, { 0x01D290C0, "_ZN6Vector16NormalizeInPlaceEv", mfunc_ptr_cast(&Vector::NormalizeInPlace) }, #ifdef _WIN32 - + { 0x01D12570, "", mfunc_ptr_cast(&Vector::Length) }, { 0x01D9C290, "", mfunc_ptr_cast(&Vector::Length2D) }, { 0x01D4EA30, "", mfunc_ptr_cast(&Vector::Normalize) }, @@ -5037,11 +5058,12 @@ FunctionHook g_FunctionHooks[] = { 0x01D3A060, "_Z20DestroyNavigationMapv", (size_t)&DestroyNavigationMap }, { 0x01D3A210, "_Z20StripNavigationAreasv", (size_t)&StripNavigationAreas }, -#ifdef _WIN32 +#ifdef _WIN32 + { 0x01D13120, "_ZNK8CNavArea15GetAdjacentAreaE10NavDirTypei", mfunc_ptr_cast(&CNavArea::GetAdjacentArea) }, { 0x01D2B2A0, "_ZN8CNavArea11PopOpenListEv", mfunc_ptr_cast(&CNavArea::PopOpenList) }, { 0x01D2B2C0, "_ZNK8CNavArea8IsClosedEv", mfunc_ptr_cast(&CNavArea::IsClosed) }, - + { 0x01D224C0, "", mfunc_ptr_cast(&SnapToGrid) }, { 0x01D22460, "", (size_t)&AddDirectionVector }, { 0x01D13150, "", (size_t)&AddAreaToOpenList }, @@ -5050,7 +5072,9 @@ FunctionHook g_FunctionHooks[] = { 0x01D2B030, "", (size_t)&IsEntityWalkable }, { 0x01D2B0B0, "", (size_t)&IsWalkableTraceLineClear }, { 0x01D3A9E0, "", (size_t)&testJumpDown }, + #endif // _WIN32 + //{ 0x0, "", (size_t)&findJumpDownArea }, // NOXREF { 0x01D3A330, "_Z21ConnectGeneratedAreasv", (size_t)&ConnectGeneratedAreas }, { 0x01D3AAF0, "_Z19MergeGeneratedAreasv", (size_t)&MergeGeneratedAreas }, @@ -5062,6 +5086,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D3B3F0, "_Z12BuildLaddersv", (size_t)&BuildLadders }, { 0x01D3C1B0, "_Z13MarkJumpAreasv", (size_t)&MarkJumpAreas }, { 0x01D3C280, "_Z26GenerateNavigationAreaMeshv", (size_t)&GenerateNavigationAreaMesh }, + #endif // Nav_Region #ifndef Hostage_Region @@ -5216,7 +5241,7 @@ FunctionHook g_FunctionHooks[] = { 0x01D4A4A0, "_ZN25HostageEscapeToCoverState8OnUpdateEP14CHostageImprov", mfunc_ptr_cast(&HostageEscapeToCoverState::OnUpdate_) }, //{ 0x01D4A590, "_ZN25HostageEscapeToCoverState6OnExitEP14CHostageImprov", mfunc_ptr_cast(&HostageEscapeToCoverState::OnExit_) }, // PURE //{ 0x01D56B00, "_ZNK25HostageEscapeToCoverState7GetNameEv", mfunc_ptr_cast(&HostageEscapeToCoverState::GetName_) }, - { 0x01D4A5A0, "_ZN25HostageEscapeToCoverState15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&HostageEscapeToCoverState::OnMoveToFailure_) }, + //{ 0x01D4A5A0, "_ZN25HostageEscapeToCoverState15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE", mfunc_ptr_cast(&HostageEscapeToCoverState::OnMoveToFailure_) }, // DEFAULT //non-virtual func //{ 0x0, "_ZN25HostageEscapeToCoverState13SetRescueGoalERK6Vector", mfunc_ptr_cast(&HostageEscapeToCoverState::SetRescueGoal) }, //HostageEscapeLookAroundState @@ -5269,9 +5294,9 @@ FunctionHook g_FunctionHooks[] = //{ 0x01D49D70, "_ZN19HostageAnimateState13StartSequenceEP14CHostageImprovPKNS_7SeqInfoE", mfunc_ptr_cast(&HostageAnimateState::StartSequence) }, // NOXREF { 0x01D4A000, "_ZN19HostageAnimateState13IsDoneHoldingEv", mfunc_ptr_cast(&HostageAnimateState::IsDoneHolding) }, //CHostage - //virtual func //!!{ 0x01D4BE60, "_ZN8CHostage5SpawnEv", mfunc_ptr_cast(&CHostage::Spawn_) }, // do not use the hook together CHostage::IdleThink + { 0x01D4BE60, "_ZN8CHostage5SpawnEv", mfunc_ptr_cast(&CHostage::Spawn_) }, { 0x01D4C2C0, "_ZN8CHostage8PrecacheEv", mfunc_ptr_cast(&CHostage::Precache_) }, { 0x01D4DB00, "_ZN8CHostage10ObjectCapsEv", mfunc_ptr_cast(&CHostage::ObjectCaps_) }, //{ 0x01D50D80, "_ZN8CHostage8ClassifyEv", mfunc_ptr_cast(&CHostage::Classify_) }, @@ -5561,7 +5586,7 @@ VirtualTableRef g_TableRefs[] = { 0x01DFCADC, "CHalfLifeMultiplay", 70 }, { 0x01DFE7B4, "CHalfLifeTraining", 70 }, { 0x01DFC9D4, "CMapInfo", CBASE_VIRTUAL_COUNT }, - + { 0x01E01074, "CPreventDefuseTask", 0 }, { 0x01E01084, "CCareerTask", 0 }, @@ -5645,7 +5670,6 @@ AddressRef g_FunctionRefs[] = { 0x01D2EDD0, "_ZN6CCSBot16UpdateLookAnglesEv", (size_t)&pCCSBot__UpdateLookAngles }, { 0x01D19C70, "_ZN9BotPhrase9RandomizeEv", (size_t)&pBotPhrase__Randomize }, - { 0x01D25270, "_ZN13CCSBotManager6AddBotEPK10BotProfile18BotProfileTeamType", (size_t)&pCCSBotManager__AddBot }, { 0x01D4C450, "_ZN8CHostage9IdleThinkEv", (size_t)&pCHostage__IdleThink }, #endif // Function_References_Region @@ -5659,11 +5683,9 @@ AddressRef g_DataRefs[] = { 0x01E61BD0, "g_engfuncs", (size_t)&pg_engfuncs }, { 0x01E61E48, "gpGlobals", (size_t)&pgpGlobals }, - { 0x01E10768, "GameEventName", (size_t)&pGameEventName }, { 0x01E2A3F8, "_ZL14s_shared_token", (size_t)&ps_shared_token }, { 0x01E13218, "_ZL14s_shared_quote", (size_t)&ps_shared_quote }, - { 0x01E61BA4, "g_vecZero", (size_t)&pg_vecZero }, { 0x01E61BB4, "g_Language", (size_t)&pg_Language }, { 0x01E61BB8, "g_ulFrameCount", (size_t)&pg_ulFrameCount }, // NOXREF @@ -5692,50 +5714,40 @@ AddressRef g_DataRefs[] = { 0x01E75EB0, "g_sModelIndexTGhost", (size_t)&pg_sModelIndexTGhost }, { 0x01E76560, "g_sModelIndexC4Glow", (size_t)&pg_sModelIndexC4Glow }, { 0x01E76568, "giAmmoIndex", (size_t)&pgiAmmoIndex }, - { 0x01E75EC4, "g_sModelIndexRadio", (size_t)&pg_sModelIndexRadio }, { 0x01E75EB8, "gMultiDamage", (size_t)&pgMultiDamage }, { 0x01E29880, "_ZL13s_iBeamSprite", (size_t)&ps_iBeamSprite }, { 0x01E29480, "_ZL8cosTable", (size_t)&pcosTable }, - { 0x01E23AA8, "TutorIdentifierList", (size_t)&pTutorIdentifierList }, { 0x01E23678, "_ZL19g_TutorStateStrings", (size_t)&pg_TutorStateStrings }, - { 0x01E61E4C, "WorldGraph", (size_t)&pWorldGraph }, { 0x01E61B98, "g_pGameRules", (size_t)&pg_pGameRules }, { 0x01E62560, "g_pMPGameRules", (size_t)&pg_pMPGameRules }, { 0x01E61E70, "_ZL12mp_com_token", (size_t)&pmp_com_token }, - { 0x01E636F0, "vec3_origin", (size_t)&pvec3_origin }, { 0x01E1F420, "nanmask", (size_t)&pnanmask }, - { 0x01E0B0B0, "_ZL15weaponAliasInfo", (size_t)&pweaponAliasInfo }, { 0x01E0B1E8, "_ZL18weaponBuyAliasInfo", (size_t)&pweaponBuyAliasInfo }, { 0x01E0B3F0, "_ZL20weaponClassAliasInfo", (size_t)&pweaponClassAliasInfo }, { 0x01E0B560, "g_autoBuyInfo", (size_t)&pg_autoBuyInfo }, { 0x01E0B708, "_ZL10weaponInfo", (size_t)&pweaponInfo }, - { 0x01E6AC80, "gszallsentencenames", (size_t)&pgszallsentencenames }, { 0x01E683E0, "rgsentenceg", (size_t)&prgsentenceg }, { 0x01E75480, "fSentencesInit", (size_t)&pfSentencesInit }, { 0x01E75484, "gcallsentences", (size_t)&pgcallsentences }, { 0x01E1F5B0, "rgdpvpreset", (size_t)&prgdpvpreset }, { 0x01E75488, "fTextureTypeInit", (size_t)&pfTextureTypeInit }, - { 0x01E7548C, "gcTextures", (size_t)&pgcTextures, 2 }, { 0x01E70C80, "grgszTextureName", (size_t)&pgrgszTextureName, 2 }, { 0x01E75080, "grgchTextureType", (size_t)&pgrgchTextureType, 2 }, - - //implementation at PM_Shared + // implementation at PM_Shared { 0x01E68390, "gcTextures", (size_t)&ppm_gcTextures, 1 }, { 0x01E63B88, "grgszTextureName", (size_t)&ppm_grgszTextureName, 1 }, { 0x01E67F88, "grgchTextureType", (size_t)&ppm_grgchTextureType, 1 }, - { 0x01E68388, "pm_shared_initialized", (size_t)&ppm_shared_initialized }, { 0x01E63700, "rgv3tStuckTable", (size_t)&prgv3tStuckTable }, { 0x01E63A88, "rgStuckLast", (size_t)&prgStuckLast }, { 0x01E68394, "g_onladder", (size_t)&pg_onladder }, - { 0x01E6838C, "pmove", (size_t)&pg_ppmove }, { 0x01E76578, "g_flWeaponCheat", (size_t)&pg_flWeaponCheat }, { 0x01E62778, "gEvilImpulse101", (size_t)&pgEvilImpulse101 }, @@ -5744,7 +5756,6 @@ AddressRef g_DataRefs[] = { 0x01E75CFC, "g_groupmask", (size_t)&pg_groupmask }, { 0x01E75D00, "g_groupop", (size_t)&pg_groupop }, { 0x01E21EF8, "_ZL6gSizes", (size_t)&pgSizes }, - { 0x01E75490, "pSoundEnt", (size_t)&ppSoundEnt }, { 0x01E75CF8, "_ZL6glSeed", (size_t)&pglSeed }, { 0x01E21598, "seed_table", (size_t)&pseed_table }, @@ -5837,25 +5848,20 @@ AddressRef g_DataRefs[] = { 0x01E636D4, "gmsgBrass", (size_t)&pgmsgBrass }, { 0x01E636D8, "gmsgFog", (size_t)&pgmsgFog }, { 0x01E636DC, "gmsgShowTimer", (size_t)&pgmsgShowTimer }, - { 0x01E61B80, "g_psv_gravity", (size_t)&pg_psv_gravity }, { 0x01E61B84, "g_psv_aim", (size_t)&pg_psv_aim },//TODO: unused, used cvar_t *sv_aim { 0x01E63598, "sv_aim", (size_t)&psv_aim }, - { 0x01E61E6C, "sv_clienttrace", (size_t)&psv_clienttrace }, { 0x01E61E68, "_ZL15g_GameMgrHelper", (size_t)&pg_GameMgrHelper }, { 0x01E22624, "voice_serverdebug", (size_t)&pvoice_serverdebug }, { 0x01E22638, "sv_alltalk", (size_t)&psv_alltalk }, - { 0x01E75D20, "g_PlayerModEnable", (size_t)&pg_PlayerModEnable }, { 0x01E75D28, "g_BanMasks", (size_t)&pg_BanMasks }, { 0x01E75DA8, "g_SentGameRulesMasks", (size_t)&pg_SentGameRulesMasks }, { 0x01E75E30, "g_SentBanMasks", (size_t)&pg_SentBanMasks }, { 0x01E75E28, "g_bWantModEnable", (size_t)&pg_bWantModEnable }, - { 0x01E76580, "_ZL23s_tutorDisabledThisGame", (size_t)&ps_tutorDisabledThisGame }, { 0x01E76584, "_ZL19s_nextCvarCheckTime", (size_t)&ps_nextCvarCheckTime }, - { 0x01E11214, "BotDifficultyName", (size_t)&pBotDifficultyName }, { 0x01E61B88, "g_footsteps", (size_t)&pg_footsteps }, { 0x01E61B8C, "g_psv_accelerate", (size_t)&pg_psv_accelerate }, @@ -5940,14 +5946,12 @@ AddressRef g_DataRefs[] = { 0x01E19AFC, "sk_scientist_heal1", (size_t)&psk_scientist_heal1 }, { 0x01E19B10, "sk_scientist_heal2", (size_t)&psk_scientist_heal2 }, { 0x01E19B24, "sk_scientist_heal3", (size_t)&psk_scientist_heal3 }, - { 0x01E10738, "g_flBotCommandInterval", (size_t)&pg_flBotCommandInterval }, { 0x01E1073C, "g_flBotFullThinkInterval", (size_t)&pg_flBotFullThinkInterval }, { 0x01E61B44, "_ZL11gTankSpread", (size_t)&pgTankSpread }, { 0x01E28A20, "BotArgs", (size_t)&pBotArgs }, { 0x01E28A30, "UseBotArgs", (size_t)&pUseBotArgs }, { 0x01E1E040, "g_weaponStruct", (size_t)&pg_weaponStruct }, - { 0x01E0EFF8, "cv_bot_traceview", (size_t)&pcv_bot_traceview }, { 0x01E0F00C, "cv_bot_stop", (size_t)&pcv_bot_stop }, { 0x01E0F020, "cv_bot_show_nav", (size_t)&pcv_bot_show_nav }, @@ -5987,7 +5991,6 @@ AddressRef g_DataRefs[] = { 0x01E23448, "cv_tutor_message_minimum_display_time", (size_t)&pcv_tutor_message_minimum_display_time }, { 0x01E2345C, "cv_tutor_message_character_display_time_coefficient", (size_t)&pcv_tutor_message_character_display_time_coefficient }, { 0x01E23470, "cv_tutor_hint_interval_time", (size_t)&pcv_tutor_hint_interval_time }, - { 0x01E2A3E8, "_ZN9CLocalNav15flNextCvarCheckE", mfunc_ptr_cast(&CLocalNav::pflNextCvarCheck) }, { 0x01E2A3D8, "_ZN9CLocalNav12s_flStepSizeE", mfunc_ptr_cast(&CLocalNav::ps_flStepSize) }, { 0x01E2A3EC, "_ZN9CLocalNav15flLastThinkTimeE", mfunc_ptr_cast(&CLocalNav::pflLastThinkTime) }, @@ -6100,7 +6103,6 @@ AddressRef g_DataRefs[] = { 0x01E5D6F8, "g_skipCareerInitialSpawn", (size_t)&pg_skipCareerInitialSpawn }, { 0x01E31768, "m_usResetDecals", (size_t)&pm_usResetDecals }, { 0x01E31760, "g_iShadowSprite", (size_t)&pg_iShadowSprite }, - { 0x01E31770, "_ZL11g_PVSStatus", (size_t)&pg_PVSStatus }, { 0x01E14C90, "_ZL18entity_field_alias", (size_t)&pentity_field_alias }, { 0x01E14D68, "_ZL18player_field_alias", (size_t)&pplayer_field_alias }, @@ -6112,17 +6114,12 @@ AddressRef g_DataRefs[] = { 0x01E2A250, "_ZN8CNavNode6m_listE", mfunc_ptr_cast(&CNavNode::pm_list) }, { 0x01E2A254, "_ZN8CNavNode12m_listLengthE", mfunc_ptr_cast(&CNavNode::pm_listLength) }, { 0x01E11E88, "Opposite", (size_t)&pOpposite }, - - //{ 0x0, "_ZN8CNavArea8m_nextIDE", mfunc_ptr_cast(&CNavArea::m_nextID) }, { 0x01E11584, "_ZN8CNavArea14m_masterMarkerE", mfunc_ptr_cast(&CNavArea::pm_masterMarker) }, { 0x01E11588, "_ZN10HidingSpot8m_nextIDE", mfunc_ptr_cast(&HidingSpot::pm_nextID) }, { 0x01E2A108, "_ZN10HidingSpot14m_masterMarkerE", mfunc_ptr_cast(&HidingSpot::pm_masterMarker) }, { 0x01E11580, "_ZN8CNavArea8m_nextIDE", mfunc_ptr_cast(&CNavArea::pm_nextID) }, - //{ 0x0, "_ZN10HidingSpot14m_masterMarkerE", mfunc_ptr_cast(&HidingSpot::m_masterMarker) }, - { 0x01E2A100, "_ZN8CNavArea9m_isResetE", mfunc_ptr_cast(&CNavArea::pm_isReset) }, { 0x01E2A0FC, "_ZN8CNavArea10m_openListE", mfunc_ptr_cast(&CNavArea::pm_openList) }, - { 0x01E2A104, "lastDrawTimestamp", (size_t)&plastDrawTimestamp }, { 0x01E2A118, "_ZL13editTimestamp", (size_t)&peditTimestamp }, { 0x01E2A10C, "_ZL10markedArea", (size_t)&pmarkedArea }, @@ -6166,13 +6163,10 @@ AddressRef g_DataRefs[] = //{ 0x01E306C8, "sinom", (size_t)&psinom }, // LOCAL //{ 0x01E2F8B4, "sclp", (size_t)&psclp }, // LOCAL //{ 0x01E2F8B8, "sclq", (size_t)&psclq }, // LOCAL - { 0x01E0DF70, "primaryWeaponBuyInfoCT", (size_t)&pprimaryWeaponBuyInfoCT }, { 0x01E0E00C, "secondaryWeaponBuyInfoCT", (size_t)&psecondaryWeaponBuyInfoCT }, - { 0x01E0E030, "primaryWeaponBuyInfoT", (size_t)&pprimaryWeaponBuyInfoT }, { 0x01E0E0CC, "secondaryWeaponBuyInfoT", (size_t)&psecondaryWeaponBuyInfoT }, - { 0x01E287E8, "_ZN19BotChatterInterface16m_encourageTimerE", mfunc_ptr_cast(&BotChatterInterface::pm_encourageTimer) }, { 0x01E287E0, "_ZN19BotChatterInterface22m_radioSilenceIntervalE", mfunc_ptr_cast(&BotChatterInterface::pm_radioSilenceInterval) }, diff --git a/regamedll/hookers/RegameDLLRuntimeConfig.cpp b/regamedll/hookers/RegameDLLRuntimeConfig.cpp new file mode 100644 index 00000000..bfa2ab3d --- /dev/null +++ b/regamedll/hookers/RegameDLLRuntimeConfig.cpp @@ -0,0 +1,101 @@ +#include "precompiled.h" + +CRegameDLLRuntimeConfig g_ReGameDLLRuntimeConfig; + +CRegameDLLRuntimeConfig::CRegameDLLRuntimeConfig() +{ + bIsZero = false; +} + +void CRegameDLLRuntimeConfig::parseFromCommandLine(const char *cmdLine) +{ + char localBuf[2048]; + if (strlen(cmdLine) >= sizeof(localBuf)) + regamedll_syserror("%s: too long cmdline", __FUNCTION__); + + strcpy(localBuf, cmdLine); + char *cpos = localBuf; + + getNextToken(&cpos); // skip executable path + + const char *token = getNextToken(&cpos); + while (token != NULL) + { + if (!strcmp(token, "-game")) + { + const char *gameMod = getNextToken(&cpos); + + if (gameMod != NULL && !strcmp(gameMod, "czero")) + bIsZero = true; + } + + token = getNextToken(&cpos); + } +} + +const char *CRegameDLLRuntimeConfig::getNextToken(char* *pBuf) +{ + char *rpos = *pBuf; + if (*rpos == 0) + return NULL; + + // skip spaces at the beginning + while (*rpos != 0 && isspace(*rpos)) + rpos++; + + if (*rpos == 0) + { + *pBuf = rpos; + return NULL; + } + + const char *res = rpos; + char *wpos = rpos; + char inQuote = 0; + while (*rpos != 0) + { + char cc = *rpos; + if (inQuote) + { + if (inQuote == cc) + { + inQuote = 0; + rpos++; + } + else + { + if (rpos != wpos) + *wpos = cc; + rpos++; + wpos++; + } + } + else + { + if (isspace(cc)) + { + break; + } + else if (cc == '\'' || cc == '"') + { + inQuote = cc; + rpos++; + } + else + { + if (rpos != wpos) + *wpos = cc; + rpos++; + wpos++; + } + } + } + if (*rpos != 0) + { + rpos++; + } + + *pBuf = rpos; + *wpos = 0; + return res; +} diff --git a/regamedll/hookers/RegameDLLRuntimeConfig.h b/regamedll/hookers/RegameDLLRuntimeConfig.h new file mode 100644 index 00000000..ba4e1a16 --- /dev/null +++ b/regamedll/hookers/RegameDLLRuntimeConfig.h @@ -0,0 +1,16 @@ +#pragma once + +class CRegameDLLRuntimeConfig +{ +private: + bool bIsZero; + const char *getNextToken(char **pBuf); + +public: + CRegameDLLRuntimeConfig(); + + bool IsCzero() const { return bIsZero; } + void parseFromCommandLine(const char *cmdLine); +}; + +extern CRegameDLLRuntimeConfig g_ReGameDLLRuntimeConfig; diff --git a/regamedll/hookers/hooker.cpp b/regamedll/hookers/hooker.cpp index b9f3697b..32b94fc7 100644 --- a/regamedll/hookers/hooker.cpp +++ b/regamedll/hookers/hooker.cpp @@ -141,15 +141,13 @@ void *GetFuncRefAddrOrDefault(const char *funcName, void *def) return def; } -int nCountHook = 0; - int HookGameDLL(size_t gameAddr, size_t engAddr) { if (gameAddr == NULL || !FindModuleByAddress(gameAddr, &g_GameDLLModule) || !FindModuleByAddress(engAddr, &g_EngineModule)) { - return (FALSE); + return FALSE; } // Find all addresses @@ -177,7 +175,6 @@ int HookGameDLL(size_t gameAddr, size_t engAddr) refFunc++; } - FunctionHook *hookFunc = g_FunctionHooks; while (hookFunc->handlerFunc != NULL) { @@ -203,23 +200,14 @@ int HookGameDLL(size_t gameAddr, size_t engAddr) if (!success) { _logf(__FUNCTION__ ": failed to hook gamedll!"); - return (FALSE); + return FALSE; } -#ifdef _WIN32 - Module hlds_exe; - if (!FindModuleByName("hlds.exe", &hlds_exe) && !FindModuleByName("hl.exe", &hlds_exe)) - return (FALSE); - - TestSuite_Init(&g_EngineModule, &hlds_exe, g_FunctionRefs); - -#endif // _WIN32 - refData = g_DataRefs; while (refData->addressRef != NULL) { if (!FindDataRef(&g_GameDLLModule, refData)) - return (FALSE); + return FALSE; refData++; } @@ -227,27 +215,51 @@ int HookGameDLL(size_t gameAddr, size_t engAddr) while (refFunc->addressRef != NULL) { if (!FindDataRef(&g_GameDLLModule, refFunc)) - return (FALSE); + return FALSE; refFunc++; } // Actually hook all things - if (!g_ReGameDLLRuntimeConfig.disableAllHooks) + hookFunc = g_FunctionHooks; + while (hookFunc->handlerFunc != NULL) { - hookFunc = g_FunctionHooks; - while (hookFunc->handlerFunc != NULL) - { - if (!HookFunction(&g_GameDLLModule, hookFunc)) - return (FALSE); + if (!HookFunction(&g_GameDLLModule, hookFunc)) + return FALSE; - hookFunc++; - nCountHook++; - } + hookFunc++; } -#ifdef _WIN32 - Regamedll_Debug_Init(); -#endif // _WIN32 - - return (TRUE); + return TRUE; } + +#ifdef _WIN32 +void *_malloc_mhook_(size_t n) +{ + return malloc(n); +} + +void *_realloc_mhook_(void *memblock, size_t size) +{ + return realloc(memblock, size); +} + +void _free_mhook_(void *p) +{ + free(p); +} + +void *_calloc_mhook_(size_t n, size_t s) +{ + return calloc(n, s); +} + +void *__nh_malloc_mhook_(size_t n) +{ + return malloc(n); +} + +char *_strdup_mhook_(const char *s) +{ + return _strdup(s); +} +#endif // _WIN32 diff --git a/regamedll/hookers/hooker.h b/regamedll/hookers/hooker.h index 079ccd2f..c438e07b 100644 --- a/regamedll/hookers/hooker.h +++ b/regamedll/hookers/hooker.h @@ -13,10 +13,13 @@ extern void *GetOriginalFuncAddrOrDefault(const char *funcName, void *def); extern void *GetFuncRefAddrOrDie(const char *funcName); extern void *GetFuncRefAddrOrDefault(const char *funcName, void *def); -#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS) +#ifdef _WIN32 -extern void Regamedll_Game_Init(); -extern void _printf2(const char *fmt, ...); -extern void _print_chat(class CBasePlayer *pPlayer, const char *fmt, ...); +void *_malloc_mhook_(size_t n); +void *_realloc_mhook_(void *memblock, size_t size); +void _free_mhook_(void *p); +void *_calloc_mhook_(size_t n, size_t s); +void *__nh_malloc_mhook_(size_t n); +char *_strdup_mhook_(const char *s); -#endif // HOOK_GAMEDLL +#endif // _WIN32 diff --git a/regamedll/hookers/hooker_impl.cpp b/regamedll/hookers/hooker_impl.cpp index 56ad1dcd..a230ee5a 100644 --- a/regamedll/hookers/hooker_impl.cpp +++ b/regamedll/hookers/hooker_impl.cpp @@ -75,7 +75,7 @@ TYPEDESCRIPTION IMPL_CLASS(CBasePlayer, m_playerSaveData)[40]; TYPEDESCRIPTION gGlobalEntitySaveData[3]; // globals gamerules -CHalfLifeMultiplay *g_pGameRules; +CGameRules *g_pGameRules; char mp_com_token[ COM_TOKEN_LEN ]; cvar_t *sv_clienttrace; @@ -1989,13 +1989,13 @@ void HostageEscapeToCoverState::OnUpdate(CHostageImprov *improv) { OnUpdate_(imp void HostageEscapeToCoverState::OnExit(CHostageImprov *improv) { OnExit_(improv); } void HostageEscapeToCoverState::OnMoveToFailure(const Vector &goal, MoveToFailureType reason) { OnMoveToFailure_(goal, reason); } -void HostageEscapeToCoverState::OnMoveToFailure_(const Vector &goal, MoveToFailureType reason) +/*void HostageEscapeToCoverState::OnMoveToFailure_(const Vector &goal, MoveToFailureType reason) { // TODO: why this - 1? Hacks? // need investigation HostageEscapeState *escape = (HostageEscapeState *)*((int *)this - 1); escape->LookAround(); -} +}*/ void HostageEscapeLookAroundState::OnEnter(CHostageImprov *improv) { OnEnter_(improv); } @@ -2051,9 +2051,6 @@ bool CCSBot::Initialize(const BotProfile *profile) { return Initialize_(profile) void CCSBot::SpawnBot() { SpawnBot_(); } void CCSBot::RoundRespawn() { RoundRespawn_(); } -// cs_bot_manager -bool __declspec(naked) CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team) { __asm { jmp pCCSBotManager__AddBot } } - void CCSBotManager::ClientDisconnect(CBasePlayer *pPlayer) { ClientDisconnect_(pPlayer); } BOOL CCSBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd) { return ClientCommand_(pPlayer, pcmd); } void CCSBotManager::ServerActivate() { ServerActivate_(); } diff --git a/regamedll/hookers/hooker_impl.h b/regamedll/hookers/hooker_impl.h index b7d143ea..9f48735d 100644 --- a/regamedll/hookers/hooker_impl.h +++ b/regamedll/hookers/hooker_impl.h @@ -551,7 +551,17 @@ extern void (*pCCSBot__UpdateLookAngles)(); #define vec3_origin (*pvec3_origin) #define nanmask (*pnanmask) -// linked objects +// linked objects 196 +C_DLLEXPORT void ammo_9mm(entvars_t *pev); +C_DLLEXPORT void ammo_buckshot(entvars_t *pev); +C_DLLEXPORT void ammo_556nato(entvars_t *pev); +C_DLLEXPORT void ammo_556natobox(entvars_t *pev); +C_DLLEXPORT void ammo_762nato(entvars_t *pev); +C_DLLEXPORT void ammo_45acp(entvars_t *pev); +C_DLLEXPORT void ammo_50ae(entvars_t *pev); +C_DLLEXPORT void ammo_338magnum(entvars_t *pev); +C_DLLEXPORT void ammo_57mm(entvars_t *pev); +C_DLLEXPORT void ammo_357sig(entvars_t *pev); C_DLLEXPORT void func_wall(entvars_t *pev); C_DLLEXPORT void func_wall_toggle(entvars_t *pev); C_DLLEXPORT void func_conveyor(entvars_t *pev); @@ -559,42 +569,11 @@ C_DLLEXPORT void func_illusionary(entvars_t *pev); C_DLLEXPORT void func_monsterclip(entvars_t *pev); C_DLLEXPORT void func_rotating(entvars_t *pev); C_DLLEXPORT void func_pendulum(entvars_t *pev); -C_DLLEXPORT void env_global(entvars_t *pev); -C_DLLEXPORT void multisource(entvars_t *pev); C_DLLEXPORT void func_button(entvars_t *pev); C_DLLEXPORT void func_rot_button(entvars_t *pev); -C_DLLEXPORT void momentary_rot_button(entvars_t *pev); -C_DLLEXPORT void env_spark(entvars_t *pev); -C_DLLEXPORT void env_debris(entvars_t *pev); -C_DLLEXPORT void button_target(entvars_t *pev); -C_DLLEXPORT void ambient_generic(entvars_t *pev); -C_DLLEXPORT void env_sound(entvars_t *pev); -C_DLLEXPORT void speaker(entvars_t *pev); C_DLLEXPORT void func_door(entvars_t *pev); C_DLLEXPORT void func_water(entvars_t *pev); C_DLLEXPORT void func_door_rotating(entvars_t *pev); -C_DLLEXPORT void momentary_door(entvars_t *pev); -C_DLLEXPORT void info_target(entvars_t *pev); -C_DLLEXPORT void env_bubbles(entvars_t *pev); -C_DLLEXPORT void beam(entvars_t *pev); -C_DLLEXPORT void env_lightning(entvars_t *pev); -C_DLLEXPORT void env_beam(entvars_t *pev); -C_DLLEXPORT void env_laser(entvars_t *pev); -C_DLLEXPORT void env_glow(entvars_t *pev); -C_DLLEXPORT void env_bombglow(entvars_t *pev); -C_DLLEXPORT void env_sprite(entvars_t *pev); -C_DLLEXPORT void gibshooter(entvars_t *pev); -C_DLLEXPORT void env_shooter(entvars_t *pev); -C_DLLEXPORT void test_effect(entvars_t *pev); -C_DLLEXPORT void env_blood(entvars_t *pev); -C_DLLEXPORT void env_shake(entvars_t *pev); -C_DLLEXPORT void env_fade(entvars_t *pev); -C_DLLEXPORT void env_message(entvars_t *pev); -C_DLLEXPORT void env_funnel(entvars_t *pev); -C_DLLEXPORT void env_beverage(entvars_t *pev); -C_DLLEXPORT void item_sodacan(entvars_t *pev); -C_DLLEXPORT void spark_shower(entvars_t *pev); -C_DLLEXPORT void env_explosion(entvars_t *pev); C_DLLEXPORT void func_breakable(entvars_t *pev); C_DLLEXPORT void func_pushable(entvars_t *pev); C_DLLEXPORT void func_tank(entvars_t *pev); @@ -602,7 +581,53 @@ C_DLLEXPORT void func_tanklaser(entvars_t *pev); C_DLLEXPORT void func_tankrocket(entvars_t *pev); C_DLLEXPORT void func_tankmortar(entvars_t *pev); C_DLLEXPORT void func_tankcontrols(entvars_t *pev); -C_DLLEXPORT void info_map_parameters(entvars_t *pev); +C_DLLEXPORT void func_recharge(entvars_t *pev); +C_DLLEXPORT void func_healthcharger(entvars_t *pev); +C_DLLEXPORT void func_mortar_field(entvars_t *pev); +C_DLLEXPORT void func_plat(entvars_t *pev); +C_DLLEXPORT void func_platrot(entvars_t *pev); +C_DLLEXPORT void func_train(entvars_t *pev); +C_DLLEXPORT void func_tracktrain(entvars_t *pev); +C_DLLEXPORT void func_traincontrols(entvars_t *pev); +C_DLLEXPORT void func_trackchange(entvars_t *pev); +C_DLLEXPORT void func_trackautochange(entvars_t *pev); +C_DLLEXPORT void func_guntarget(entvars_t *pev); +C_DLLEXPORT void func_grencatch(entvars_t *pev); +C_DLLEXPORT void func_weaponcheck(entvars_t *pev); +C_DLLEXPORT void func_friction(entvars_t *pev); +C_DLLEXPORT void func_ladder(entvars_t *pev); +C_DLLEXPORT void func_buyzone(entvars_t *pev); +C_DLLEXPORT void func_bomb_target(entvars_t *pev); +C_DLLEXPORT void func_hostage_rescue(entvars_t *pev); +C_DLLEXPORT void func_escapezone(entvars_t *pev); +C_DLLEXPORT void func_vip_safetyzone(entvars_t *pev); +C_DLLEXPORT void func_snow(entvars_t *pev); +C_DLLEXPORT void func_rain(entvars_t *pev); +C_DLLEXPORT void func_vehicle(entvars_t *pev); +C_DLLEXPORT void func_vehiclecontrols(entvars_t *pev); +C_DLLEXPORT void env_sound(entvars_t *pev); +C_DLLEXPORT void env_global(entvars_t *pev); +C_DLLEXPORT void env_spark(entvars_t *pev); +C_DLLEXPORT void env_debris(entvars_t *pev); +C_DLLEXPORT void env_bubbles(entvars_t *pev); +C_DLLEXPORT void env_lightning(entvars_t *pev); +C_DLLEXPORT void env_beam(entvars_t *pev); +C_DLLEXPORT void env_laser(entvars_t *pev); +C_DLLEXPORT void env_glow(entvars_t *pev); +C_DLLEXPORT void env_bombglow(entvars_t *pev); +C_DLLEXPORT void env_sprite(entvars_t *pev); +C_DLLEXPORT void env_shooter(entvars_t *pev); +C_DLLEXPORT void env_blood(entvars_t *pev); +C_DLLEXPORT void env_shake(entvars_t *pev); +C_DLLEXPORT void env_fade(entvars_t *pev); +C_DLLEXPORT void env_message(entvars_t *pev); +C_DLLEXPORT void env_funnel(entvars_t *pev); +C_DLLEXPORT void env_beverage(entvars_t *pev); +C_DLLEXPORT void env_explosion(entvars_t *pev); +C_DLLEXPORT void env_render(entvars_t *pev); +C_DLLEXPORT void env_snow(entvars_t *pev); +C_DLLEXPORT void env_rain(entvars_t *pev); +C_DLLEXPORT void env_fog(entvars_t *pev); C_DLLEXPORT void weapon_knife(entvars_t *pev); C_DLLEXPORT void weapon_glock18(entvars_t *pev); C_DLLEXPORT void weapon_c4(entvars_t *pev); @@ -632,13 +657,25 @@ C_DLLEXPORT void weapon_mac10(entvars_t *pev); C_DLLEXPORT void weapon_ump45(entvars_t *pev); C_DLLEXPORT void weapon_mp5navy(entvars_t *pev); C_DLLEXPORT void weapon_tmp(entvars_t *pev); -C_DLLEXPORT void armoury_entity(entvars_t *pev); -C_DLLEXPORT void weaponbox(entvars_t *pev); -C_DLLEXPORT void cycler(entvars_t *pev); -C_DLLEXPORT void cycler_prdroid(entvars_t *pev); -C_DLLEXPORT void cycler_sprite(entvars_t *pev); -C_DLLEXPORT void cycler_weapon(entvars_t *pev); -C_DLLEXPORT void cycler_wreckage(entvars_t *pev); +C_DLLEXPORT void weapon_shield(entvars_t *pev); +C_DLLEXPORT void trigger(entvars_t *pev); +C_DLLEXPORT void trigger_auto(entvars_t *pev); +C_DLLEXPORT void trigger_relay(entvars_t *pev); +C_DLLEXPORT void trigger_hurt(entvars_t *pev); +C_DLLEXPORT void trigger_monsterjump(entvars_t *pev); +C_DLLEXPORT void trigger_cdaudio(entvars_t *pev); +C_DLLEXPORT void trigger_multiple(entvars_t *pev); +C_DLLEXPORT void trigger_once(entvars_t *pev); +C_DLLEXPORT void trigger_counter(entvars_t *pev); +C_DLLEXPORT void trigger_transition(entvars_t *pev); +C_DLLEXPORT void trigger_changelevel(entvars_t *pev); +C_DLLEXPORT void trigger_push(entvars_t *pev); +C_DLLEXPORT void trigger_teleport(entvars_t *pev); +C_DLLEXPORT void trigger_autosave(entvars_t *pev); +C_DLLEXPORT void trigger_endsection(entvars_t *pev); +C_DLLEXPORT void trigger_gravity(entvars_t *pev); +C_DLLEXPORT void trigger_changetarget(entvars_t *pev); +C_DLLEXPORT void trigger_camera(entvars_t *pev); C_DLLEXPORT void game_score(entvars_t *pev); C_DLLEXPORT void game_end(entvars_t *pev); C_DLLEXPORT void game_text(entvars_t *pev); @@ -650,107 +687,67 @@ C_DLLEXPORT void game_counter(entvars_t *pev); C_DLLEXPORT void game_counter_set(entvars_t *pev); C_DLLEXPORT void game_player_equip(entvars_t *pev); C_DLLEXPORT void game_player_team(entvars_t *pev); -C_DLLEXPORT void func_mortar_field(entvars_t *pev); -C_DLLEXPORT void monster_mortar(entvars_t *pev); -C_DLLEXPORT void path_corner(entvars_t *pev); -C_DLLEXPORT void func_plat(entvars_t *pev); -C_DLLEXPORT void func_platrot(entvars_t *pev); -C_DLLEXPORT void func_train(entvars_t *pev); -C_DLLEXPORT void func_tracktrain(entvars_t *pev); -C_DLLEXPORT void func_traincontrols(entvars_t *pev); -C_DLLEXPORT void func_trackchange(entvars_t *pev); -C_DLLEXPORT void func_trackautochange(entvars_t *pev); -C_DLLEXPORT void func_guntarget(entvars_t *pev); -C_DLLEXPORT void player(entvars_t *pev); -C_DLLEXPORT void weapon_shield(entvars_t *pev); -C_DLLEXPORT void info_intermission(entvars_t *pev); -C_DLLEXPORT void player_loadsaved(entvars_t *pev); -C_DLLEXPORT void player_weaponstrip(entvars_t *pev); -C_DLLEXPORT void monster_hevsuit_dead(entvars_t *pev); -C_DLLEXPORT void soundent(entvars_t *pev); C_DLLEXPORT void info_null(entvars_t *pev); +C_DLLEXPORT void info_target(entvars_t *pev); +C_DLLEXPORT void info_intermission(entvars_t *pev); +C_DLLEXPORT void info_map_parameters(entvars_t *pev); C_DLLEXPORT void info_player_deathmatch(entvars_t *pev); C_DLLEXPORT void info_player_start(entvars_t *pev); +C_DLLEXPORT void info_teleport_destination(entvars_t *pev); C_DLLEXPORT void info_vip_start(entvars_t *pev); C_DLLEXPORT void info_landmark(entvars_t *pev); C_DLLEXPORT void info_hostage_rescue(entvars_t *pev); C_DLLEXPORT void info_bomb_target(entvars_t *pev); -C_DLLEXPORT void DelayedUse(entvars_t *pev); -C_DLLEXPORT void func_grencatch(entvars_t *pev); -C_DLLEXPORT void func_weaponcheck(entvars_t *pev); +C_DLLEXPORT void item_airtank(entvars_t *pev); +C_DLLEXPORT void item_sodacan(entvars_t *pev); +C_DLLEXPORT void item_healthkit(entvars_t *pev); +C_DLLEXPORT void item_suit(entvars_t *pev); +C_DLLEXPORT void item_battery(entvars_t *pev); +C_DLLEXPORT void item_antidote(entvars_t *pev); +C_DLLEXPORT void item_security(entvars_t *pev); +C_DLLEXPORT void item_longjump(entvars_t *pev); +C_DLLEXPORT void item_kevlar(entvars_t *pev); +C_DLLEXPORT void item_assaultsuit(entvars_t *pev); +C_DLLEXPORT void item_thighpack(entvars_t *pev); +C_DLLEXPORT void light(entvars_t *pev); +C_DLLEXPORT void light_environment(entvars_t *pev); +C_DLLEXPORT void light_spot(entvars_t *pev); +C_DLLEXPORT void cycler(entvars_t *pev); +C_DLLEXPORT void cycler_prdroid(entvars_t *pev); +C_DLLEXPORT void cycler_sprite(entvars_t *pev); +C_DLLEXPORT void cycler_weapon(entvars_t *pev); +C_DLLEXPORT void cycler_wreckage(entvars_t *pev); +C_DLLEXPORT void monster_mortar(entvars_t *pev); +C_DLLEXPORT void monster_scientist(entvars_t *pev); +C_DLLEXPORT void monster_hevsuit_dead(entvars_t *pev); +C_DLLEXPORT void player(entvars_t *pev); +C_DLLEXPORT void player_loadsaved(entvars_t *pev); +C_DLLEXPORT void player_weaponstrip(entvars_t *pev); +C_DLLEXPORT void path_corner(entvars_t *pev); C_DLLEXPORT void path_track(entvars_t *pev); -C_DLLEXPORT void func_friction(entvars_t *pev); -C_DLLEXPORT void trigger_auto(entvars_t *pev); -C_DLLEXPORT void trigger_relay(entvars_t *pev); -C_DLLEXPORT void multi_manager(entvars_t *pev); -C_DLLEXPORT void env_render(entvars_t *pev); -C_DLLEXPORT void trigger(entvars_t *pev); -C_DLLEXPORT void trigger_hurt(entvars_t *pev); -C_DLLEXPORT void trigger_monsterjump(entvars_t *pev); -C_DLLEXPORT void trigger_cdaudio(entvars_t *pev); -C_DLLEXPORT void target_cdaudio(entvars_t *pev); -C_DLLEXPORT void trigger_multiple(entvars_t *pev); -C_DLLEXPORT void trigger_once(entvars_t *pev); -C_DLLEXPORT void trigger_counter(entvars_t *pev); -C_DLLEXPORT void trigger_transition(entvars_t *pev); -C_DLLEXPORT void fireanddie(entvars_t *pev); -C_DLLEXPORT void trigger_changelevel(entvars_t *pev); -C_DLLEXPORT void func_ladder(entvars_t *pev); -C_DLLEXPORT void trigger_push(entvars_t *pev); -C_DLLEXPORT void trigger_teleport(entvars_t *pev); -C_DLLEXPORT void info_teleport_destination(entvars_t *pev); -C_DLLEXPORT void func_buyzone(entvars_t *pev); -C_DLLEXPORT void func_bomb_target(entvars_t *pev); -C_DLLEXPORT void func_hostage_rescue(entvars_t *pev); -C_DLLEXPORT void func_escapezone(entvars_t *pev); -C_DLLEXPORT void func_vip_safetyzone(entvars_t *pev); -C_DLLEXPORT void trigger_autosave(entvars_t *pev); -C_DLLEXPORT void trigger_endsection(entvars_t *pev); -C_DLLEXPORT void trigger_gravity(entvars_t *pev); -C_DLLEXPORT void trigger_changetarget(entvars_t *pev); -C_DLLEXPORT void trigger_camera(entvars_t *pev); -C_DLLEXPORT void env_snow(entvars_t *pev); -C_DLLEXPORT void func_snow(entvars_t *pev); -C_DLLEXPORT void env_rain(entvars_t *pev); -C_DLLEXPORT void func_rain(entvars_t *pev); -C_DLLEXPORT void env_fog(entvars_t *pev); -C_DLLEXPORT void func_vehicle(entvars_t *pev); -C_DLLEXPORT void func_vehiclecontrols(entvars_t *pev); +C_DLLEXPORT void worldspawn(entvars_t *pev); C_DLLEXPORT void infodecal(entvars_t *pev); C_DLLEXPORT void bodyque(entvars_t *pev); -C_DLLEXPORT void worldspawn(entvars_t *pev); +C_DLLEXPORT void spark_shower(entvars_t *pev); +C_DLLEXPORT void beam(entvars_t *pev); +C_DLLEXPORT void gibshooter(entvars_t *pev); +C_DLLEXPORT void test_effect(entvars_t *pev); +C_DLLEXPORT void soundent(entvars_t *pev); +C_DLLEXPORT void ambient_generic(entvars_t *pev); +C_DLLEXPORT void target_cdaudio(entvars_t *pev); +C_DLLEXPORT void speaker(entvars_t *pev); +C_DLLEXPORT void DelayedUse(entvars_t *pev); +C_DLLEXPORT void multi_manager(entvars_t *pev); +C_DLLEXPORT void fireanddie(entvars_t *pev); +C_DLLEXPORT void multisource(entvars_t *pev); +C_DLLEXPORT void button_target(entvars_t *pev); +C_DLLEXPORT void momentary_rot_button(entvars_t *pev); +C_DLLEXPORT void momentary_door(entvars_t *pev); C_DLLEXPORT void hostage_entity(entvars_t *pev); -C_DLLEXPORT void monster_scientist(entvars_t *pev); -C_DLLEXPORT void ammo_9mm(entvars_t *pev); -C_DLLEXPORT void ammo_buckshot(entvars_t *pev); -C_DLLEXPORT void ammo_556nato(entvars_t *pev); -C_DLLEXPORT void ammo_556natobox(entvars_t *pev); -C_DLLEXPORT void ammo_762nato(entvars_t *pev); -C_DLLEXPORT void ammo_45acp(entvars_t *pev); -C_DLLEXPORT void ammo_50ae(entvars_t *pev); -C_DLLEXPORT void ammo_338magnum(entvars_t *pev); -C_DLLEXPORT void ammo_57mm(entvars_t *pev); -C_DLLEXPORT void ammo_357sig(entvars_t *pev); -C_DLLEXPORT void item_airtank(entvars_t *pev); - - - - - - - - - - -// declared functions -C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, globalvars_t *pGlobals); -bool NavAreaBuildPath__HostagePathCost__wrapper(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, HostagePathCost &costFunc, CNavArea **closestArea); -bool NavAreaBuildPath__ShortestPathCost__wrapper(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, ShortestPathCost &costFunc, CNavArea **closestArea); -bool NavAreaBuildPath__PathCost__wrapper(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, PathCost &costFunc, CNavArea **closestArea); -float_precision NavAreaTravelDistance__PathCost__wrapper(CNavArea *startArea, CNavArea *endArea, PathCost &costFunc); - -//typedef struct server_studio_api_s server_studio_api_t; -//typedef struct sv_blending_interface_s sv_blending_interface_t; +C_DLLEXPORT void armoury_entity(entvars_t *pev); +C_DLLEXPORT void weaponbox(entvars_t *pev); +C_DLLEXPORT void grenade(entvars_t *pev); +C_DLLEXPORT void world_items(entvars_t *pev); typedef int (CGraph::*FIND_NEAREST_NODE_ENTITY)(const Vector &, CBaseEntity *); typedef int (CGraph::*FIND_NEAREST_NODE_INT)(const Vector &, int); @@ -909,4 +906,87 @@ extern char pm_grgszTextureName[1024][17]; extern char pm_grgchTextureType[1024]; extern char *BotDifficultyName[5]; +// declared functions +C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, globalvars_t *pGlobals); +bool NavAreaBuildPath__HostagePathCost__wrapper(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, HostagePathCost &costFunc, CNavArea **closestArea); +bool NavAreaBuildPath__ShortestPathCost__wrapper(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, ShortestPathCost &costFunc, CNavArea **closestArea); +bool NavAreaBuildPath__PathCost__wrapper(CNavArea *startArea, CNavArea *goalArea, const Vector *goalPos, PathCost &costFunc, CNavArea **closestArea); +float_precision NavAreaTravelDistance__PathCost__wrapper(CNavArea *startArea, CNavArea *endArea, PathCost &costFunc); + +// PM +void PM_SwapTextures(int i, int j); +int PM_IsThereGrassTexture(); +void PM_SortTextures(); +void PM_InitTextureTypes(); +void PM_PlayStepSound(int step, float fvol); +int PM_MapTextureTypeStepType(char chTextureType); +void PM_CatagorizeTextureType(); +void PM_UpdateStepSound(); +qboolean PM_AddToTouched(struct pmtrace_s tr, vec_t *impactvelocity); +void PM_CheckVelocity(); +int PM_ClipVelocity(vec_t *in, vec_t *normal, vec_t *out, float overbounce); +void PM_AddCorrectGravity(); +void PM_FixupGravityVelocity(); +int PM_FlyMove(); +void PM_Accelerate(vec_t *wishdir, float_precision wishspeed, float accel); +void PM_WalkMove(); +void PM_Friction(); +void PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel); +void PM_WaterMove(); +void PM_AirMove(); +qboolean PM_InWater(); +qboolean PM_CheckWater(); +void PM_CatagorizePosition(); +int PM_GetRandomStuckOffsets(int nIndex, int server, vec_t *offset); +void PM_ResetStuckOffsets(int nIndex, int server); +int PM_CheckStuck(); +void PM_SpectatorMove(); +float PM_SplineFraction(float value, float scale); +float PM_SimpleSpline(float value); +void PM_FixPlayerCrouchStuck(int direction); +void PM_Duck(); +void PM_LadderMove(struct physent_s *pLadder); +struct physent_s *PM_Ladder(); +void PM_WaterJump(); +void PM_AddGravity(); +struct pmtrace_s PM_PushEntity(vec_t *push); +void PM_Physics_Toss(); +void PM_NoClip(); +void PM_PreventMegaBunnyJumping(); +void PM_Jump(); +void PM_CheckWaterJump(); +void PM_CheckFalling(); +void PM_PlayWaterSounds(); +float PM_CalcRoll(vec_t *angles, vec_t *velocity, float rollangle, float rollspeed); +void PM_DropPunchAngle(vec_t *punchangle); +void PM_CheckParamters(); +void PM_ReduceTimers(); +qboolean PM_ShouldDoSpectMode(); +void PM_PlayerMove(qboolean server); +void PM_CreateStuckTable(); +int PM_GetVisEntInfo(int ent); +int PM_GetPhysEntInfo(int ent); + +// Animation +C_DLLEXPORT int Server_GetBlendingInterface(int version, struct sv_blending_interface_s **ppinterface, struct engine_studio_api_s *pstudio, float *rotationmatrix, float *bonetransform); +void AngleQuaternion(vec_t *angles, vec_t *quaternion); +void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt); +void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4]); +mstudioanim_t *StudioGetAnim(struct model_s *m_pSubModel, mstudioseqdesc_t *pseqdesc); +mstudioanim_t *LookupAnimation(struct model_s *model, mstudioseqdesc_t *pseqdesc, int index); +void StudioCalcBoneAdj(float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen); +void StudioCalcBoneQuaterion(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q); +void StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos); +void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3], float s); +void StudioCalcRotations(mstudiobone_t *pbones, int *chain, int chainlength, float *adj, float pos[128][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f, float s); +void ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]); +void SV_StudioSetupBones(struct model_s *pModel, float frame, int sequence, const vec_t *angles, const vec_t *origin, const byte *pcontroller, const byte *pblending, int iBone, const edict_t *pEdict); + +// basemonster +float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity); +char *vstr(float *v); + +//cbase +/*C_DLLEXPORT*/ int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); + #endif // HOOKER_IMPL_H diff --git a/regamedll/hookers/main.cpp b/regamedll/hookers/main.cpp index 6f7df25f..9c7f5781 100644 --- a/regamedll/hookers/main.cpp +++ b/regamedll/hookers/main.cpp @@ -72,6 +72,7 @@ IBaseInterface *CreateFileSystemInterface() return g_pOriginalFileSystem; } } + return NULL; } @@ -83,20 +84,13 @@ const char *shrPathGameDLL() _getcwd(szDllFilename, MAX_PATH); #else getcwd(szDllFilename, MAX_PATH); -#endif // _WIN32 +#endif - if (g_ReGameDLLRuntimeConfig.bIsZero) + if (g_ReGameDLLRuntimeConfig.IsCzero()) Q_strcat(szDllFilename, "\\czero\\dlls\\"ORIGINAL_GAME_DLL_NAME); else Q_strcat(szDllFilename, "\\cstrike\\dlls\\"ORIGINAL_GAME_DLL_NAME); - char *buf = &szDllFilename[0]; - while (*buf != '\0') - { - if (*buf == '\\') - *buf = '/'; - buf++; - } return (const char *)szDllFilename; } @@ -105,18 +99,17 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) { +#ifdef HOOK_GAMEDLL g_ReGameDLLRuntimeConfig.parseFromCommandLine(GetCommandLineA()); -#ifdef HOOK_GAMEDLL - - g_pOriginalGameDLLModule = Sys_LoadModule( shrPathGameDLL() ); + g_pOriginalGameDLLModule = Sys_LoadModule(shrPathGameDLL()); g_pOriginalFileSystemModule = Sys_LoadModule(ORIGINAL_FILESYSTEM_DLL_NAME); size_t gameAddr = (size_t)Sys_GetProcAddress((void *)g_pOriginalGameDLLModule, GIVEFNPTRS_TO_DLL_PROCNAME); size_t engAddr = (size_t)Sys_GetProcAddress(ORIGINAL_ENGINE_DLL_NAME, CREATEINTERFACE_PROCNAME); HookGameDLL(gameAddr, engAddr); -#endif // HOOK_GAMEDLL +#endif } else if (fdwReason == DLL_PROCESS_DETACH) { @@ -133,6 +126,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) g_pOriginalGameDLLModule = NULL; } } + return TRUE; } #else // _WIN32 diff --git a/regamedll/hookers/main_mp.cpp b/regamedll/hookers/main_mp.cpp index 15fc95b0..be3f7d12 100644 --- a/regamedll/hookers/main_mp.cpp +++ b/regamedll/hookers/main_mp.cpp @@ -35,20 +35,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) { -#ifdef _WIN32 - g_ReGameDLLRuntimeConfig.parseFromCommandLine(GetCommandLineA()); - - Module hlds_exe; - if (FindModuleByName("hlds.exe", &hlds_exe)) - { - TestSuite_Init(NULL, &hlds_exe, NULL); - } -#endif // _WIN32 - } else if (fdwReason == DLL_PROCESS_DETACH) { - } return TRUE; diff --git a/regamedll/hookers/memory.cpp b/regamedll/hookers/memory.cpp index a172351f..2a7b031c 100644 --- a/regamedll/hookers/memory.cpp +++ b/regamedll/hookers/memory.cpp @@ -30,6 +30,10 @@ #ifdef _WIN32 +#ifdef _MSC_VER +#pragma comment(lib, "psapi.lib") // Process Status API +#endif // _MSC_VER + bool HIDDEN FindModuleByAddress(size_t addr, Module *module) { if (!module) @@ -53,6 +57,7 @@ bool HIDDEN FindModuleByAddress(size_t addr, Module *module) return true; } + bool HIDDEN FindModuleByName(const char *moduleName, Module *module) { if (!moduleName || !*moduleName || !module) @@ -151,6 +156,7 @@ bool HIDDEN ReloadProcessMemoryInfo() return true; } + // Finds section by the address. Section* HIDDEN FindSectionByAddress(size_t addr) { @@ -163,6 +169,7 @@ Section* HIDDEN FindSectionByAddress(size_t addr) } return section; } + // Finds section by the file name. Section* HIDDEN FindSectionByName(const char *moduleName) { @@ -178,6 +185,7 @@ Section* HIDDEN FindSectionByName(const char *moduleName) } return section; } + // Finds section by the address. Section* HIDDEN GetSectionByAddress(size_t addr) { @@ -191,6 +199,7 @@ Section* HIDDEN GetSectionByAddress(size_t addr) } return section; } + // Finds section by the file name. Section* HIDDEN GetSectionByName(const char *moduleName) { @@ -204,6 +213,7 @@ Section* HIDDEN GetSectionByName(const char *moduleName) } return section; } + // Fills module structure by info from the sections. Should be supplied with the first module section. bool HIDDEN FillModule(Section *section, Module *module) { @@ -254,6 +264,7 @@ bool HIDDEN FindModuleByAddress(size_t addr, Module *module) // Start over with the name to find module start return FindModuleByName(section->filename + 1, module); } + bool HIDDEN FindModuleByName(const char *moduleName, Module *module) { if (!moduleName || !*moduleName || !module) @@ -416,7 +427,7 @@ size_t HIDDEN FindSymbol(Module *module, const char* symbolName, int index) extern void regamedll_syserror(const char* fmt, ...); -#ifdef WIN32 +#ifdef _WIN32 void ProcessModuleData(Module *module) { int i = 0; @@ -451,12 +462,15 @@ void ProcessModuleData(Module *module) module->codeSection.end = module->codeSection.start + module->codeSection.size; module->codeSection.next = NULL; } -#else //WIN32 + +#else // _WIN32 + void ProcessModuleData(Module *module) { } -#endif + +#endif // _WIN32 #ifdef _WIN32 @@ -466,6 +480,7 @@ inline bool HIDDEN EnablePageWrite(size_t addr, size_t size) { return VirtualProtect((void *)addr, size, PAGE_EXECUTE_READWRITE, &oldPageProtection) != 0; } + inline bool HIDDEN RestorePageProtection(size_t addr, size_t size) { bool ret = VirtualProtect((void *)addr, size, oldPageProtection, &oldPageProtection) != 0; @@ -481,6 +496,7 @@ bool HIDDEN EnablePageWrite(size_t addr, size_t size) size += addr - alignedAddr; return mprotect((void *)alignedAddr, size, PROT_READ | PROT_WRITE | PROT_EXEC) == 0; } + bool HIDDEN RestorePageProtection(size_t addr, size_t size) { Section *section = GetSectionByAddress(addr); @@ -493,7 +509,6 @@ bool HIDDEN RestorePageProtection(size_t addr, size_t size) #endif // _WIN32 - // Converts HEX string containing pairs of symbols 0-9, A-F, a-f with possible space splitting into byte array size_t HIDDEN ConvertHexString(const char *srcHexString, unsigned char *outBuffer, size_t bufferSize) { @@ -526,6 +541,7 @@ size_t HIDDEN ConvertHexString(const char *srcHexString, unsigned char *outBuffe } return out - outBuffer; } + size_t HIDDEN MemoryFindForward(size_t start, size_t end, const unsigned char *pattern, const unsigned char *mask, size_t len) { // Ensure start is lower than the end @@ -578,6 +594,7 @@ size_t HIDDEN MemoryFindForward(size_t start, size_t end, const unsigned char *p return NULL; } + size_t HIDDEN MemoryFindBackward(size_t start, size_t end, const unsigned char *pattern, const unsigned char *mask, size_t len) { // Ensure start is higher than the end @@ -630,6 +647,7 @@ size_t HIDDEN MemoryFindBackward(size_t start, size_t end, const unsigned char * return NULL; } + size_t HIDDEN MemoryFindRefForwardPrefix8(size_t start, size_t end, size_t refAddress, uint8_t prefixValue, bool relative) { // Ensure start is lower than the end @@ -674,6 +692,7 @@ uint32_t HIDDEN HookDWord(size_t addr, uint32_t newDWord) RestorePageProtection(addr, sizeof(uint32_t)); return origDWord; } + // Exchanges bytes between memory address and bytes array void HIDDEN ExchangeMemoryBytes(size_t origAddr, size_t dataAddr, uint32_t size) { @@ -720,7 +739,7 @@ bool HIDDEN GetAddress(Module *module, Address *addr, size_t baseOffset) void *addr_orig; char patchByte[5]; char patchByteOriginal[5]; -#endif // HOOK_GAMEDLL +#endif bool HIDDEN HookFunction(Module *module, FunctionHook *hook) { @@ -740,7 +759,7 @@ bool HIDDEN HookFunction(Module *module, FunctionHook *hook) //int seedad = pUTIL_SharedRandomLong(seed,low,high); //memcpy(addr_orig,patchByte,5); - if (strcmp(hook->symbolName,"_ZN25HostageEscapeToCoverState15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE")==0) + if (strcmp(hook->symbolName, "_ZN25HostageEscapeToCoverState15OnMoveToFailureERK6VectorN12IImprovEvent17MoveToFailureTypeE") == 0) { addr_orig = (void *)hook->originalAddress; @@ -778,7 +797,7 @@ bool HIDDEN FindDataRef(Module *module, AddressRef *ref) return true; } -#ifdef WIN32 +#ifdef _WIN32 void FindAllCalls(Section* section, CFuncAddr** calls, uint32_t findRefsTo) { uint32_t coderef_addr = section->start; @@ -791,7 +810,7 @@ void FindAllCalls(Section* section, CFuncAddr** calls, uint32_t findRefsTo) coderef_addr = MemoryFindRefForwardPrefix8(coderef_addr + 1, section->end, findRefsTo, 0xE8, true); } } -#endif +#endif // _WIN32 template size_t vtable_size(const T &t) diff --git a/regamedll/hookers/memory.h b/regamedll/hookers/memory.h index fbe6bbf2..6d90314e 100644 --- a/regamedll/hookers/memory.h +++ b/regamedll/hookers/memory.h @@ -156,6 +156,6 @@ void HIDDEN GetAddressVtableByClassname(const char *szClassName, const int iOffs extern void *addr_orig; extern char patchByte[5]; extern char patchByteOriginal[5]; -#endif // HOOK_GAMEDLL +#endif #endif // _MEMORY_H diff --git a/regamedll/hookers/osconfig.h b/regamedll/hookers/osconfig.h index 32518f8b..f0535ae0 100644 --- a/regamedll/hookers/osconfig.h +++ b/regamedll/hookers/osconfig.h @@ -142,12 +142,6 @@ #define CDECL __cdecl #endif -#ifdef HOOK_GAMEDLL - #define WINAPI_HOOK __stdcall -#else - #define WINAPI_HOOK /**/ -#endif // HOOK_GAMEDLL - #define STDCALL __stdcall #define HIDDEN #define NOINLINE __declspec(noinline) @@ -184,10 +178,6 @@ typedef unsigned short WORD; typedef unsigned int UNINT32; -#ifdef HOOK_GAMEDLL - #define WINAPI_HOOK -#endif // HOOK_GAMEDLL - #define CDECL __attribute__ ((cdecl)) #define STDCALL __attribute__ ((stdcall)) #define HIDDEN __attribute__((visibility("hidden"))) @@ -239,7 +229,4 @@ #define EXT_FUNC /*FORCE_STACK_ALIGN*/ -extern void regamedll_log(const char *fmt, ...); -extern void __declspec(noreturn) regamedll_syserror(const char *fmt, ...); - #endif // OSCONFIG_H diff --git a/regamedll/hookers/regamedll_debug.cpp b/regamedll/hookers/regamedll_debug.cpp deleted file mode 100644 index e14410ed..00000000 --- a/regamedll/hookers/regamedll_debug.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "precompiled.h" - -std::ofstream g_ReGameDLLDebugLog; - -void Regamedll_Debug_logAlloc(size_t sz, void *ptr) -{ - g_ReGameDLLDebugLog << "malloc(" << sz << ") => " << std::hex << (size_t)ptr << "\n"; - g_ReGameDLLDebugLog.flush(); -} - -void Regamedll_Debug_logRealloc(size_t sz, void *oldPtr, void *newPtr) -{ - g_ReGameDLLDebugLog << "realloc(" << std::hex << (size_t)oldPtr << ", " << sz << ") => " << std::hex << (size_t)newPtr << "\n"; - g_ReGameDLLDebugLog.flush(); -} - -void Regamedll_Debug_logFree(void *ptr) -{ - g_ReGameDLLDebugLog << "free(" << std::hex << (size_t)ptr << ")\n"; - g_ReGameDLLDebugLog.flush(); -} - -void Regamedll_Debug_logStrDup(const char *s, void *ptr) -{ - g_ReGameDLLDebugLog << "strdup(" << std::hex << (size_t)ptr << ") => " << s << "\n"; - g_ReGameDLLDebugLog.flush(); -} - -void Regamedll_Debug_Init() -{ - //g_ReGameDLLDebugLog.exceptions(std::ios::badbit | std::ios::failbit); - //g_ReGameDLLDebugLog.open("d:\\REGAME_SERVER\\regamedll_debug.log", std::ios::out | std::ios::binary); -} - -void _print_chat(class CBasePlayer *pPlayer, const char *fmt, ...) -{ - static char Dest[4096]; - - va_list ap; - va_start(ap, fmt); - vsnprintf(Dest, sizeof(Dest), fmt, ap); - va_end(ap); - - if (Q_strlen(Dest) < sizeof(Dest) - 2) - Q_strcat(Dest, "\n"); - - else Dest[Q_strlen(Dest) - 1] = '\n'; - - UTIL_SayText(Dest, (class CBaseEntity *)pPlayer); -} - -void _print_console(struct entvars_s *pev, const char *fmt, ...) -{ - static char Dest[4096]; - - va_list ap; - va_start(ap, fmt); - vsnprintf(Dest, sizeof(Dest), fmt, ap); - va_end(ap); - - if (Q_strlen(Dest) < sizeof(Dest) - 2) - Q_strcat(Dest, "\n"); - - else Dest[Q_strlen(Dest) - 1] = '\n'; - - ClientPrint(pev, HUD_PRINTCONSOLE, Dest); -} - -void _printf2(const char *fmt, ...) -{ - /* - * check is null, test the demo started before than searches pointer to refs - */ - if (&g_engfuncs == NULL || g_engfuncs.pfnServerPrint == NULL) - return; - - static char Dest[4096]; - va_list ap; - va_start(ap, fmt); - vsnprintf(Dest, sizeof(Dest), fmt, ap); - va_end(ap); - - if (Q_strlen(Dest) < sizeof(Dest) - 2) - Q_strcat(Dest, "\n"); - - else Dest[Q_strlen(Dest) - 1] = '\n'; - - SERVER_PRINT(Dest); -} - -#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS) -extern int nCountHook; - -void Regamedll_Game_Init() -{ -#ifdef _WIN32 - if (g_ReGameDLLRuntimeConfig.disableAllHooks) - return; -#endif // _WIN32 - - printf2("[Hooker]: The total number hooks of functions is - %d", nCountHook); -} - -#endif // HOOK_GAMEDLL - diff --git a/regamedll/hookers/regamedll_debug.h b/regamedll/hookers/regamedll_debug.h deleted file mode 100644 index 33b14c9a..00000000 --- a/regamedll/hookers/regamedll_debug.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "osconfig.h" -#include "maintypes.h" -#include "memory.h" - -#ifdef _WIN32 - -extern void Regamedll_Debug_logAlloc(size_t sz, void *ptr); -extern void Regamedll_Debug_logRealloc(size_t sz, void *oldPtr, void *newPtr); -extern void Regamedll_Debug_logFree(void *ptr); -extern void Regamedll_Debug_logStrDup(const char *s, void *ptr); -extern void Regamedll_Debug_Init(); - -#endif // _WIN32 - -#if defined(HOOK_GAMEDLL) && !defined(REGAMEDLL_UNIT_TESTS) -extern void Regamedll_Game_Init(); -#endif // HOOK_GAMEDLL - -extern void _printf2(const char *fmt, ...); -extern void _print_chat(class CBasePlayer *pPlayer, const char *fmt, ...); -extern void _print_console(struct entvars_s *pev, const char *fmt, ...); diff --git a/regamedll/lib/linux32/libsteam_api.so b/regamedll/lib/linux32/libsteam_api.so deleted file mode 100644 index eb5b0f159d3f0a27ea2f0ab3ed8826217ce420fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 76032 zcmeFa3wRXO`9D4h3oH=W6(dGPjha?a)I@1Z1Z}u%h)7_$1kh4LB#A*oh+&so3G6ai z%rK6nhFEQBi!EBJsI(xWfCiFg!J;6BVGc&uJGzfn$73mf} z!!NogiK{ySrzFxv+y#iowWgaSO-+-K-$+kJu&+mwv~PfMbpYnYbenk{M`&FcxaVc1 zx&PuRo_Y{vn%8<{+)%EF9HRXkW40yfgwc~dF2IBJK;%_3Z3F1zYCLw$T*GOFDxax56SA}aXu1s8WaQSeZ zkIVX%nKxt2P(@ge3*r|)4S%QMx*OMJB1V$#Gef@_u0c2i*J50xI}Miu*A!e!aPfDu z5lH7Dd9{I*6ZiX}dA|_hwYX;Bs=>7s z*8p5M;QA4+2XOIs53X8Vy>MNPi@#yGt`T>VWH&=?gO5RY7p@``W^k{0pJj&25ca?oz;!>aS-5V)W&JLpOAqaNOUD z>*2V#_}hQ>l%yjtXwuwY>La~M!I(eFz9t3@5LdIo*r?AK)5&|{gQ%L_X6Z|set=PGhis+gwvuQqCA|C*ENqx(x)ce zANZ|t7yAzak<1a=^Euli7(h(o>A` z9*iq5zQ1Drr;+}8T)Gqbn1jxQ?U4DeO|YNC!2fw%`+ETLsEO037x}Co%U_v5-?ee{ zvwg80TR-CeIzc{VaqxLak66eEi627xhB*6}0D6YR=_eoh`3KrJeG~Z^4EwqS?eRtv zJ`em1jpKhA@>j&=F9e?TWBunR@bjAl_?85?7WLl-`>^bNO+xy&65tJ1WeCaNr_cun zKo-3lL7(+w`cD(`j{|=Hxc0Oc{H+_3B>Io@Fhb~ryk3rz*Ikgu3dmzR$`bY)CvTQN z1m&%VJ2!h%%Amzy&N8Aj75n52=ZA!miJo1xG~!RQ zkOd6gCeX7zf&V|E{yuAAC^@beD%8Dhev3FWyR6XcziV9&mU^t}o2y`cAI=;s@tgZ#E6)NhBqG%qmxI@5O~2%Hy5{dHf~;z5?a_HBP?I zCD4Bf`1=&~tu*UXL9g{A4Pz4UmnXnV0(@Np{411SiuN`DWs#pJQ2w7F4-5Wr0=UIREjSg^ZB+*HV9R>F)vl2L|V~GtxUT0smkE z{CEP)`Iq&(5;vn04~X#V_? z`O-Zlo|1|MQdLP&d1aBOOq%bhD)v@Nv&-krFDaf=1-Q7Rs!A%YteR8dDV2(5&n}ri zUz%50Qo+>1LL^qqD=eQkyT~(VUIoi3HnLUCE}CC5du}C5w1UdTq;}Dw!pf4W`SVDX zXK~?zOrliGMxqGKY@T`L^A?tn08tVGlbw6KMODRxMYHes&Zz=Vf<+^)s-(OGxuv-! zb6HwxRY{37#Zyu=cQUwho7`32U3DLm$bwWF`}^&o()`&)CRd9fO$f2D+`17VP^>82 z&MuofuUIOdT{drFg*1Qh-10dU_epc-c`H1Ux55DKE1gq14>GAJnp+}yJ#(zT^QF1> zQA$;F`FCznIpil5-Z{l{AtOSN{MG`)#A}bp4nxiQT*LSv+tWP6_rK2#q6q*xg`~zGtgw}ZY=oDiiP(YTxUnQo>MWu z1ZE69!~}5n8S0plS!l4{g|gz3e~YprPst*-lRKwQn~;@BD_T@^_nZY;H)a(UE|@!~ za5mdVp=WVr2^v)CJlCn1S>HjfQ?P_NR(h*S3Kz_&@_38NX=_ErQmJTB5CRMtrj0_; z2+;zh`{tCF8nUbS6O}OLw)sZe_EuCxrBOK9TM@JODC!wv<7|9#$$W2lTy4xf`Q#vSyW8?F){fdB_Ex@81LN5(eviAt;W)( zQ}9-*G~eh0qV?a#9;6F2rKmJcsnDfW=Vsqh#!d77v= zo9=>I7^}Q%{FE*R&^7H;{f>pljjuZf$5kAQj5Uu~Tw+6srNp(XSY)h?#NuM+5Nj2u zOBIddp2A8YbHfe9&!0C-U<}_*{b}YRQa&^Z)##sND(?PmuyhXC4FJ-Ua{JIDF6GhXM7FerV#q z^&D53x=TNeD}QGket%JZU+Kv%<#&rKzlW4#rlEStbMYKN{iIE1-1#Cu=9(sK(Az6Y zuTg%_X!-LmXMUU1Y~maIBuDF$u#W}uq;xaPFvCG+IK&Jy&2Xq04l~0MW|(7!W6Utm z49A<{R5P4mhBM7@mKm0rp~nn;X852Pt~bLCX1LJ|H<{r!Gi)-$eHR*hwVL59tP_yW zVlyl=!*VmMG((RWE;7TVW>}1JlQ7rXVuni@=3xDSAr@rTnBk*l*o1m}U{bz^AtsY8 z4D%%EAVVz7A7c2hB(*WboX>}Pk{-l*0N|cz#>W|AzS_YM^S&<_az2}e5c5VGL(CWL z48d3mL+Y4eZ>-TW#Kuw@LkIT$7{Z{_8G^11hUa6yfFTxihcLVVdwmQq#5x_p`k~E%S2G$=KeiM5S46nxeE5kw9`(TKLqgf2G5MIo1 zh$NLUybk-046(^m$q)_E!!Qf`SqyK)Ixxd;K~4;ZVI7kp7CvhkV&mpPhPOZ;46!M( zhT(UypT=;cB&}sQR+82+ybbGQ498*3iXk>`HZshYq)iMbK+g;@!QaMkk|gb5I9ZY! z7-A!*iQ)I5Uxs&KPnaPVAX^yD!a6v^BIui8G4#!_6#8aZhJ6u+b0kS;c&{WKWq2R- z&k$=e#~ES)xP#$5=$~OF^bb4fc|Y{eunPKT=z;zjVy(u>a541Ha0&F!a4Gc95PKKt z46#O-!O#c&GxS6M3|Bz^3(J_P+U{2}zua5ePL z@JG-;L)iIDhIQEcQvNbUK5En9G9`awMu#M+a$6)42{d@R>mPzY{SKt)bDzO>aFgwO z-)}@zL~JBP=%&Rl@~aet5F(b8nK$w)7`9Z#*e76;R<@0BrGU!`HxQmBV3Jz4 zhp=0~Fi5Gag>a65NqX5q!kGewK}uz9gwqA=Bdim43b=-FJ7Gz{wS+qexBrX$KS)?g z0^BCx)r9SYTLip@u#<3ufFC7{76kqUyq0h};dKIDM|cq7)dF5mIFqnXz#9k;BU~xq zjf8Uu&l2z^!g++<0^UN{O*luu+X&AfoGIWPgl7>>7jOgNGQv&)HxaHRED4yREn7sm z{R{HHkFbw$n}8|mvRc9|0&XR|ns9@FDf+TU32zecA;RkjuM=<^;SGdW3-}1(O@w^{ zrfSNz5v~;QQNj&`X9<|9D%(TYE#TvXTL|X}n5ru~NH|l#Ul491oGxGqw`DqEr+{sQ z+X+howiE6k-2PAUpF$WTH}EfDCt*9`76GRcb`ow7a2nw>!kYv=v+xa0}ra0WTtakZ>koC|~^4 zffKcF)StH_A0c0Pm(wk)#n530-eDALBvpUiJ_(g?Je2QLX`w)~P zc`j1rBZx#l!yX)yVdFePdtU!LVuohu^H6TH>tjizKn#p~8cJ4nqv|WO8eT-X z5#_+KXO))0drE^jU)~@oE&e9f`MtXezu&0Iu5Ca-Z6zp4+1(}4pin+quCGI)zp)7o zQ*rH44mh^D?6t1VzU{3LhUCf9FT)q*|B)Ql80 zKSddzVb|ob20u1cJ__XwidM34gi{CjjJ)x;HbGD zLi^+Zd7S)vkE)>@e5V%<> z*k(%85%>t0j;)T`{5Mort5(^kxu>LfGHj}=g*0d&DrA~ zJT;)^?|^<#(Kb{B^1+GTfgYo#!4dcw(_IHi0h`{~$D@%Zeu6|CudTJwDlPPSpAK32Z7<(5P?A07a7@AFE%-@srxsu@D@jEIK=A`8gm~Nd2J7=46xMd3THO+Q8$}wj{S?$@od^}O z`05s;$%TH3WYyc!&AZVsbr`R_m+4sz$DTd;ro8Ji`GfYs`?RSUSIdXn4FTDpYo%a= zeg`TCAFZ`L5bxO9t2Q52*U}94!xHu+l;A-LAEAUjR4xtmVlz83*Cv_jQwugYYNpT! zcru)#u^JlCgh3DmS9tLgXDYP%3+C~0_pnnP|uit0)ec7G>aO_*RgwBiHz2S<3tO){ z%6j2{uA_h0eh84VG{a7FgbbB}gZfnvLZCq{IOwPeGxb=|#md1(GMd>n+L9#2dqjDA z#0`!yCmk<0uqG#rq;@Q1)>959)iiiNRF0|MBNi`axjzLtqFnDyYzCRHpm6kL!q++i zSF@@PxoL=KK_>efK#I~Fx)~PctA1bdT;aP}@(ffC3_jVd+MdLWf>V@AiX@24~=v6HE6BZmZ1ikt= zh7o^H(o%0#s@uc_L%)*R*saL4ptvsh!h$1X0^jolH4FJYNdit#py}$8p2wXX! z1P&rO7&wH#kQzHRrvxPJ`8LFmE5vXRD{1w_5jF|&Z9p%exY|^a5qflyPHJx?GE=_y ze+towEW_(rg(ofhm?xD^CC~~`{}dx9RowcUNR?q?f*M5>8h!>1-GEVC=Ea7h@>YtO zxERfhPX{yipCB{!80V|r6t&uE_O|{A2QLd8StpcsQ~*p-K_KG!ByhqL5^Mqi6}%5d zF!G7A3Ev``t7z-H&Ka9Lo>g7X#;ePpW~l2i%!j*h zyc^v38$ZIhhl+`c(MoFGotK~4}vum{rt54&66IpFsk-+Lvu;FiXl2sS& z_}pG4YyZh0`#_8%X@*^$%k6Y(XED|bJ~=yE^PIlmTi;a=!F5L!@F`s*=O&Y@?Vi4CJsXPtxoU7>T(|57~tNhbXlCD1<_4bk6t&-+vg zy!3z8(l^2_#?zl`jU{5^rpAxYu8q(1b8xdUo|~I6Qe#WGeQ8&1c+uYcjgP(ewYYf? z&hH%DTyPF=_9zgL2zUL zPuq=$Q-`>AAKyd%?k{Io%5J8gjg2lnWU|S|#R+VTffK>{$GcR@f6T@+@PYAcSj|7q z8Qad$V2)$K`mEe^F|na3hEm2a>Z+6lXm)YJ(zt41N-n-!cWXuF*wq+7Oo9zP5e7PZsw{H zQ!KpMFnMeMpeK>LKnn&=>hnwuoKQuAqh>8iJmZ9Nrje@gc)~$7!Og;_28$XaO z#;8!tBA0%Mgyt?|*p%!}ENG`@=n~S@dJ-|bo{V{%!|Ta{k$U(ra$=@VNf=83&l5=z zREMT;0v*3L@DRHPE-SF>Ozlkq1v;P}fY@1FhBF0N{rjkkj7P&8p#Q^y{C`izKZD=? z@5^{BOO2ZYMP>XbtnExPUi-n>WV{Ti|EY{O!3<(D{v{yF_$5zQ8H?qm_d%e)vD*RB zEHN}t^Ha|~AB--)>=dg^#;Sy|0-|WNU;W!~!EpjH76??4=E>t6l5HW*2W`L^k1m#& zumDxrMw{Zg%9$3Ro{BfJ=Xx3}2j?d=+jiKszcKag|HPz3(>hJF9S1*sdXxI?*J!rK z;VVeK*+pO52j zeG=ICmSE$KH@=oOe$J6w92y^*644T@bHI*13sZP_W#Tiu0FI%n1Us%EWZr zhC6wv!=Am{7<%3VTFe|gE5n~LX5?v<{vz+UnYY@mjV;5O5x9x5<*05L1{-RBrJ$AJ zIGa+iFMNI#)>vDIyPXUB0V~H2td!w-sS9*9Ck4kSj;s0ml>C%zZ;PV_&Jx}-MNL*G zq-Kw^IacgO#KK;~bDfSAFEDLFnmQ6&M*GwxoGyvDxgCWAF}ecHE4z3OM{|9Q-JLYm zwGTn6aqh)w4uVkZWSiLg!N5ozJA|3@_e7>=)HGmo-t%oWH;uf)`_iG zmdoK3Ho01nQ!UsRnQY^xK90F$AAsh>5el)tbq&eEs5|*>2yxz`B)O?v4BsI^{d-s7 zr0lNFeL_RE{&i>qhE_1=k&h11w?b9^#y>ILYwUhGUO;KwvBCzi6BQ}B12y@|xX6E^ z8YMSfle6O@KN67{TJF#jxx!xLBQL3-?lXnYNPcc2*xVZAIzG ze#6s89qG)@wJ9Br{9VYTj7n>EeTZHE{3A;Kk?f$yu1>IJ=Q%xBaz4K(P0h(fp?z@} z;zOvC3gS61WBXoEe@Oov45|5cWn`LKa7dk;nzi@DC|k0lephz>5$`iJN1=J}7Qw&} zWU|Jja2+Lg3tEc4$0$G@DH1{pF?x%(ml675p!gemkn4gd*Iv8aY*S96T9~xpdK|e9 zMq7w;S(NMc>@UIfSZDSqo6_#c4;r+_bKUOgjjZEhd{@T!&i_!%e?dI>9w97|d>0(j zlVW@?PgSa0!S`6fxAI1I^%2Oz`y@_JsY&V*V^1`NxgY}4EI0*9ST=o%P47f;{>IB* z6}Bx{&3F2?)5In30LRw7NsVpuXEW=Y|ysfLCk+c z`<_0?q{{PJLYB!O!N{`wHKP`sTQ^K4s?YIye?i%|NtqXvVK$dLkVjvh1EcDMbe=X_ zk6Yh%p0Si1fgj^;C7Y)PpPqjNg!K(Cfx+e31A9GAWzXt!A$yAS2W8>8VxsJ61l5TXD!qb+u)? z4tXv_ma6`a2PEiG%|9}Hg3}=%2M)A25CP9#{rF8&g$F$js;$zgxY6CFDDE`qRCKuB zHYhWCwCQbRpbT=@9U4wZ^&S%bZ}{R$&k&yNK)LfEDxBkiDHR+HeIIU=^-pv<9+-)H zE2C*&hdd4v+I!*MChK>`2*imz{j(N}Mjm@Rl}=P2XKnOE=*q8;(J5BgvLd1Gs5)zJ z_?J<88=^a*I)CHP-^Xi(-B=mAF?8Fx910DFT*4PD>JCZ%pxd4V|S~{CD$T|RCXiCq$29coasGt}PlvwY&WIw6;c@wCr zPC?7{Z68Pn1auSCw|xjBJhL@*J#Lg&Rhh@cLF@&?D^nMat?E8}k#k{=vRiaQ-f;G- zo~Gedsa3C#{)OF#FL73FG5ZqTWm0r0D3YJvf?}c+fwS<_ICIS^cwq8~zHOgzr0$3( z5R|!@&0kO+6TNercbZ65XGD=_ zM(<{scg-@jkQ9{5qe*4ayJGWBk*DI0(!yYB6_s3vZ62N@V7r!eF>cl5XQvoukoO0i zp!yDYv6MevuZBMSjgRl<`N!%MQ`3$b?4045EYimwif1>~&7_g%EMEi^?W8sWusSIW zs_ICih7Pr$LG!k1bt3?>tDJ>i!ces}ojM_qDCeU98jzE35nOS{aVdx_0Opu%UP>+i{AO9o_>gdj(?=%gRRR z7rss_8{R<2hmjlx@9;8IfaIvbQ5hK51_0=lt_nR5unLRMN6?eff1qb-SErdh(|+_! zZx3IVy5P@@WY4tU`!{w=0puFKD7C6;wPWQ8^gmi18)DEUPTyv~?HPbfRp%|V8~svM zPoyA6tZQo1zknGSqYJov47Bo`$|CleN*)(>Q>;$On8xY1LJG3Xh8^vfw9Tw?_-2aU zQ4;_Ww5~r=78A?rtbtt28d`r(Yw)z4!}V-u_or;n6Mx6!@2MS}EL@NLpST`b zxE}dyyPmPdicI@g-8=><@I(DVA8-_#%PBV2pN21UE0okl6Vov8g3hWqrcI%4K2}YkG9wSs8W-o>znWmnW#b$qt&=2PQ<5)c#bmTRyh$b ziFl5*Pl#zkk|WT;LBnQ}p=@5t492SGb|3D8at;3S7lhB@+9%dW*?bS89LH8MUD$v! zeugrz1S()<^BUkO+c`%F%4<)_Kc4v?MSg3NrHPJ$tF^mdF~$dJ=WOf$&a~(M#{*K# z{W0ySg8{{l4^Ex-OnMpPgICc(Yq>(~Nq|kYg~p@#YogDjLO$LJ%zt$0%4fp=`Wt;1 zmPS2-DuyhldW2pm_kSKiw3E{f>Y^Uu1IXzt9^scem|TV?V~N=E2m|%kcTpS1uyhr- zN@1*xS?W2Dt6^f+Y-Nx6?0Zl&H1y~H4Ytniv%iaWa25?o+tEzw(Q;yn`4(ECzwwUW zokcO1QZZuCCfqEVTNTbBovNhWF9{{R`9CF{T}eNI7S5ui@4W~mDTb2dqu8RdtK*y} zb|raJ)ln(kMu}xtZfw~yB5&?(G~=A=_}-XCSx=iVh3l7JH~%&qa>It@f1#xR9wlPu zdl?Mf-}p;x!N52*qpx(H$gw3EZw@%{0u9vK0XNsy$B8@@$Rk&$V5)y7X9`&S&%w&Z zA-VbxqOwHPArW;@u0Dt;KKO|T9Ys{DT-}N&JUW1=RuR=ASGOQ)tB7h5QTw>`_Cpb| zPeioAb(M)bY^8WyYGn#$DmJXGeTk_FTNWD_n$;u>9MolYEl<RGq zqeN_L=t6;e(2N}-Vh@J?28&c(hs@XkBKA<|_aZjMjFm)eN@y)&t$93bM`&yxtlr<) z{*2HVHe9ecBhJgt6u4BC<&;L~>jZ8SaR1-eRLa&wO?5th22FhsO-Rtx9wXs2ntB!~ zr)ug^5u2!~6(TlKQ{^HyQB%`I>?xY!p@ek(3OI6qqYF#K7`_|p*_cw7i#{N?SXe5Q zrWuP5x#Lgdx|6)$(2Qja^8i97rr^Y)pZ=jD6ZrBCXDb1p{WzJ~qEh6@ih)s*eUM*sqMeM+6?0F(~lZZ`^#{LtE@bCJG zh|P$`{zb&rh}c2V*f&IMg^1l}#X{jWJ#!mMX`G4_y)O(y7VmCDbJW?8{kw*XEMIiV z@-H-Xf8!O*vIMu$EW+0g)ZY`y$w=nZi?b+gb05?~d$<@?&_!y9RpcS5NUOUTou1_p zE`|*#@(9Fdoq)f*L6fg%PL!hxY^wjnX5x$o4lw#g>WGap>l?5wE07Q^+~#Y)0|>XD8%`Wek0o;HcS}x(I&G{8y2K`BbR;zNO#+!x=XX-yXBpqeB;iLSGo(-_R0y~!8FT#tOs1uKK z8+r3L5lifRYdiU>qZcI{bIoe_>}f6fcBF#eqRH0XN)B*9iW1V~FQH`Io#s7BW5F7V zdLQZL;e-J60G*^lR(8IYz>2>VK<2vpK z5D`y-`2^AEg;#B3+p60AL2?9i#)lpuEq#^KGArW+-`X^lcv_Zmw#U#f>WG00!s%X-)^8 z6MJIBz|R;7`L+)gIX-Qc#f>Uw8adjS;|Y<2F|iy`8-n2V6hUSt$fUUw2``p14f-=o zB9vfr;A7Yhn_(@_Cr3qKygkb_^gp8>ZvF=j0au>~?c=~PZnaT3>fDB#TfTJQ5a3<# z2S7aO*eVL8VPwC$EKk{^?j%xna2f2rhvc<2+j^wq9V^+pmxqnvubsvr&g}_7-ohI2 zKz;$V?uDkf)`a2H+dca^y+-{@gYr~O2g?Mg>YV#&l6=m=B42~7}s8t|~(r;%u=pWJ0B7%^_k=JB2J%8f@oKgB378Q8r zt6J0)k>eDL;t<2BzYMkb8xQ}AG#xdKPLS{^3d)4|!(Fsh zu-`V~*jF2O?4ON0_P)j)dtBp={j_n%{?@n~7`uvzF=j3FaVyG?T%#_)eHU7F)h;Pu6u zk>Dio3JLx03x%2fqG7N3O2SnAZ_m=6`#;X(7^3H~=5*uU zu!4+enOnk7fdxUuErN<7QqhIpWq7clE4}9n%jYXK58KVLd%IduQg5jjAYeN{7FRX~vL9o@aJ*lQxJkOa^q3 zBH_m#j$^fW-8>_3ygM~{33EXZnp|z>Kf&?RZoEzM6;aL-jF52mA}SJtElNxj1%GEC z(XH1X1dcuc#iH**Kg-%qUpodEHvml)IXHg`h^&|VhVN=qH3AsJ1TK$=9ucJBgoQnWUJ7Q?X-z^5!H$gZE~K#(3CTd_3#*GOfj zF9=!!f(#->r+)|q8l8T%+36d#p}#L@f6w&nj_T9&_w}UZEuYzV%|T3!xh|W}ih4Dwm~EH@NCzWA zZ!iqAJ~A&qZRz%T{S8n9^LUR=!o#%PW*S^W1T~9?0+LZ6v6egmskSJ=U4OqkbPV%v zv>|f^%?_^ojYBZHGY2b<8b6Iy9>Id4=vU}Z6z^cGm3#9`IPVI4Kg;)GR`ZLm_S#(BV^*?YWdl*6mKa9B+G zz+pW(khhV8F?do%-eTP0Q4?9b1P9{L0RUDk71gDS6M1bXrVYTXXps$!t1bo6R* z1n>eI^tZ;*T1_5eAnLb*)Y!mYtE-I@;_mezMTpPBaMYwzeRY?UB~#REfu+{5dsf7( z149Uu$sf9>hcvlw9Q&2PWe4ej4aJ@|FbBovz*SR?LGdndWW8=Jeo)*4{Bby3LxJM} zqF}Vkh#2prrH!h>tZ>-A2O&Wf>+V43%*KxKFN%#0jajUoX_kpL6CE9gg2-^Xu}_Rq z3`tFvL+tuvv#%IR$d3dx3}ZCg4&|c%dknJo+Os!PYn}|Fp=~qmGrplcMnwoLEa>)D z4U2B@3tpR7!>xAZc7BV`fnu$^+&%4or%m#HGV(E{K2GwSo+c!~#J{pZT*5ltU zh@6Mh-xzlo_4LDhm;(k>!V!wzpQ~+FVmSPPHCS+ptV2cC9Y)rH?6o0wbI&26puPWO zK_+TA{FdQD(BWbXs_%wY@cuhICIM-2xKtZB5N00(Y21T1KBFySOvwQZf7;F?NEB}Q zv!_MJ1D|L_a??E({ts{Vyjkr*W8iT@txhZ#ndbc3<8j?p-3S^l8AksOQbhl*|LIra z-I{4EoOQF<1-}$s^a7PfAr^F;)LVv+oe)# zDe6mz$IRVZ(e|;xpRz!4E5?&x?Y6GPMVF{X0yEeH<%(CeYO<4@K#0%|^iMIqi@AIv zasT`oM$`FdKISsduz0zDxlVYLKn>Fq#CA3*d^^TRR0B83jrYGU53{}e@u z)hTd3v1<`g&d1WK1m{M!(B+`Fi;@2svhg=2)$_pLnJt=YY^U0E4$K8MeXDBD*&H?F zgqx1H>wiEeA}6Getqm#r-lZ`%lGHM5O)0?MHC%=I?p5&Z#Og$^3iRlt7tIArnUQHY`tSwfV}8$=(qX{9wO|Xj z6T7ivaMV125N~M@s0dlj%Re!C;CX=cPazZ~sE>ouD$V+@kfhp`{B4?gJI%v7#mEI& zJkXlIEix$;l?r$6sNrYY^~zY58E43nuE-ME1ug%Cv(#^iWw9os9QRr^U?$3?8KUna zdcPQY*%@jWq{v*uVV1|3<=w}kd@MafmLZDFg&k%oWtI)GEY6*$XMHGIfSKhcX7R?d z3_U}Z5sJ)(B-SD^%cxkEAD@A+97X0j6SMH`+PWi_W$GDf8KcMp%`87*mP3!m*gr#- zJVj17v)schzlmj8e}*hG6`6}&By1?NEQn=kI!zYuw#c+uip;ezWDyqmFE}1mC>KU% z%YZRPCSj9qJyX^E^)TF;P4rFM#q4`!IP72TD^{)`(gM~iak^SR#-mOB~}$4+m={L>Zzr$h+kMm z9Q&8(KXFO~9-c(%wVjcOSYI>ZU=5P)vEsyhbg8}w+424Z%**gT`9#fKiX80vm{XIt zlQC$nFHEOdo(Ul*Debjl?nUl$fW%W6WL>_CDgdtk5#s&~5Yo~VF=ta<0~Ili)2cV% z+$lJJk*hJEJ;74oLxH)0rEpaZMO2_V@u>v1w1+`T3~gf^+E}2KzML%DV|f>>O>tOP z2&`@bE4K^QmN=|`qN$X=Y!g_V-odGU^~IH;`JonZ;7`X&l!L_ zG`2P)IK)769YXa^&DDk=MROfNfFa8}FB%Pn5BqW&yk6Hp8IIW?c_5DXAi&Elh@6V{ z$vq`JVYQy~E=|_Wyymh2>c6f#mjsqZ_p{!656xp&^(qkKr$^*3=x6tB+_7gi?xLF} zes+pRTy)dKAKf(ZM>kFU1EYBCM~ocogp50D(?s+Cft%d^AxH`Otu_B<|4?FT{v9H5 zghD18LBP7|Q109!4P?44jz~IPyMvg(0X%t>-N} z7$fdc)TC;R!=8Q4nGA^zu>y4~&4GqxSF>bPARLh$Wd<5>oF2nYS3BRdG$P%cy&5m~ zkAl%9iSHweztN9|hDo*t^8(RqVlX>VG8Y!XS;ddw;#Nj5O|v#{qO%xa=ogAoh8v{> za|J;bVV0wQ7;LG_Z1}7|AJBzd!u~LS8G@mA;0WgD%z*)uVC7PXLadnGtt_*};Wy{n zlf+Qn3G9>`fQ=7XAQK7JG*d^sGvzXt;%D`k=Y;aEyn&+)KAke>fs7rCtDdllw4(S{e zd=xo?fq%j3eG}rQY`n)`g#D?w0B0=BBC_9fn!>MHRClF!2S+4{f+0ZJcG5_ zU^uik38HLX*^OpoE^9^Y^%+sZn^?d(t-aDivxJvHS#xfmQ?gfx><^zQdzzVjxyXLu zDcNrj*{7T-JDUe<&k@=CS=o8QR$u%MoopJj`pdDVWb8T37O}}9cB2(5MlC~h`Yo(~ z)u1uIfRA;U9z>JZ0*?mw21cNYycCc)|1?f@;+YvvarsscV^|rPjKxA?sLXHYN`$7) zWPU3>MUfu_j4rUZTE`R|`{~W2PR3gVR8{28R;rI^+t(yxS3VxLM;w1anN;xyjJR!Z=HbtvgK4B?@gYtjNEv^oNvf(4 z++J^1tXK@*jrBxq`x^v=>n%1>5MB)xDuzQ+Gr@2a6`R;X^08vDg1*bl{tTEF8?jqf zljnmgNE>MfZBd&bjYnZ~#`3IqCzsyq0PSr9@%=}EZ`j*sZ!`8`5xXxM`)3imRKyO! zj-G)V6tSfuc6>DUw<6XpVrNEUe=1^c7O^9uu>ldAA!5IX);3SX_7kxw7Ot@Q@%rm% z`FQ@rPn&n8l;Zgx#|s6{Qamf^cp*QvRLOr2GnMpO*N0-DeF$a7+QmSWMM=DX`HZ^x zIOMGK;K!#tW7#tB$Tw$8F1X^}D8O?&EAv2lYU=OUB)DQ?HVJf1d0$zZwp^IWQ!(uOh9Z}*`a{W4(*(}3 zMS}VU`umL<5@cWmc zM!W^U&^48*)(M$gt$COt&y3{^>_N`ZC&pZKntU{a#!5q_k-{L;Fr7mGG!VkT+l$gD zlP*SL9OLhS{Bl!<@xjW|l_G?2u2LGXtPm|lw4#A}?SpJZ8<$arR1%EK@{j5CkLZ7~ z;mQ`G4uG$jV3-;nejXpM2b!rM0b3?Xz&xG$zicHgx$;xtdRJ?<= z{Pwujqd{Cf!iydYj*IV#W;MJ7xg?4EO-cCXBR@83(emypQXg3g>g#CwSOt!eFv4=_ z##@GPswnG3)?THc-LZ98j?yU~UjEkMUT@30dMceY`xpIHEofJ6yz>rzLKMYMhf$>% z_(xYcYYR^1h!=~sD+lC{m%sIKuP>3$SA9}ibXYAoDt~_Y!oDY5?KwEF`bLDQ%8hbU zidoc&oY^^^6yH*3x#a1t*;a?UskYT-CFq`p=obhsvdM+lUR!`~k>V9*Exzgl5zhqq zaHZUt?zwWg1DstecRG#td4$vD&K%DGxzo)*nO;x0ySiv1@Cac z?RCh_-QQE|1%Z4S93W#LG*Ms7pfO*$B9<6CLk^*^FzhIgxVyeZ#)M$MX8>N*D1T5Xf9`aQ`7)^!^-7DA)&3kx zofkL$0IxQEFzm_Sn2&E#pgZwxFNT%dFlaiDLh|+u_tIyf%;ua*2`?F$VID48@&@wk zx(Ioi{j->%*?+eY6dA#6BPcb3dyJsO2t*Cd{`&x>H2ceqV6G8V7{NRvs5F8(2v9>A zgP4}a>+|3`{f%|_{)AG1x9Fqo(kw5q@-`e=xLz@tzrSw)FT92F1`{-5uU;1$C?E@6N z9xlXHMgNx#j2d7>k%Td?qG)7z78!iiFWlgGU@h*{2i4S9pxAdJA55MMEjYIRi1S)4 z|KKDy`V)NxoG1EOz9H@r)`vk^s2uqmTk&!_i<+cYjl`VLBqqIZnk2a)IW&~@oi@!D zN@H3+m+kz(DD?+@i0d@RnBPvFJh6;mYUN`3Vsjr9rg07TV#tGCTKn;$0)8O${ zGwB91i5cHElAbe@QoH1$vkmb{a~AkH)@Rj%jryk|G^%}D%$V^yMkVF#(0xFZt9M9v z8%eg!qUS%48jQ1>TPc2^4;t>}{g# zP<|&$D%cU?`4>uIo}hqIP=53%GBECYW*jxL264fa>+qL7VdyRVCCadbY(ak%Ws`|= zL9~>RimW^~uwpH4f-8uM>ZMRGf!d(|6|1~x-llw^Cn*%hA4=*Ck+e-e$Z_b#AwH>EFI5@>;_k%o}%_``dVUAU{=w}kH~fCW0QpO zqVy*59aX;4kVYxW0SV!&NaQsFW1BuXv80$u(KJFEgsC^^ou9|^+Z{=Y?M*WB0TQ~o z+QRd)_P*p~_1=`QgN6lCCD_F%d6!M@ynMmYFkTqhr2kHo1B&d*w6gHcB;^+(s!9Jb z!#JiOoOtU#`KQn&AV&8s!*B`j;&E-7FW#H@qxGUzykT|LuF&P(CXCO1)v@ArXwus0 z6rB-#=Lr21xJJDHoFAOPJHOt3F%vnn8k7T{J&gwpgE?gYrC^Smf$AR5U5pXX?4(I@ z!&En4Iy!RJF8y*14`#UaY#1_L^NW^`AwfXsrMgueJHFIEY{oWtm_^A8z0Okqq8_jL za0q{F9#(0?H@-x<`G#$C1VS(-|DvR406PMQ006c7Yd%MyMHqRjIx4UGIwY#@fiZIk zink(CEy|l}b?dbg^OT2#vF9552YEvVzp3;K<_@IjwY+pd6VigYDF!%*pgowIYJeF8 zoxxo0tN}TdU}i9PgaJAU4#Rsn4KR)1pkVG8f^x&K!7WN|PH^QGKz3ZsEAjdpDamZ1 zAbzH@QfS4s=h_?_7pPtP^7;M>U6N0d%|$w^^<$|IYYhF5StCL-Dt!>kMT`Igv|VCGw$$|EEz zC+tM7F;*@{HLv8$<#^0Azr~lm#Cst+YW+%LR3AwSHm?-JqzFIK-7*Tp2MzCx%x?-8 z_&UdXdt(Ii2y=(~`Z_0j`w(Q0kQ2Vi*Xj0Nspa8m4X4{3@it9@Dd|O`-b2bG8-N5G z38(lvr+6^@jt6MZ4<{=fFVTl^c!^h7ON^K_38GOi)TUl&n-=l5 z>YFFYVosnCWAi%0J-5+H!WW1~qr?65@ju`$ zV7U7>`Y^nKS{pOUj`7XQWLfg`r64XkVG3f^LuAzVdBl@Gc{2K2^u&|hcr7E?T16cC zu~uc0o2DOej3J!`dvMNsYOCk(DQlw_>4|f+9ue8K9MX{bx>|;Z$tpYK4acDt` z+i=4da!+_tYw)63y!Z=N_n<(5Ct05(cbwvBrzZhVYF zX;$htF&7rc1Fg6bvrlf+1R4Nw#96kvG_#32ehn=p*=?Re00!tGT|;bjJhu z{E6i2yxbu_4tw)qG+fh$suteo>+Eg3S8n0ezRn(wniWW1*xlFJEquMN)9$Eo1IyRh z%Mo}I<%RME)Ynn7n3*s1b@suB!bMz)BTz$(X#(o!sNrV6uhZcO%w_a!0bPK@La@Yz z-}H6%chp>pTgQq@k#fGH=1PFR&QwQW1T*jet*`SUN6n|idf**F^#DiBcSZb#j=%s> ztbisi9OmoHoWI!Dc{ORmfa58Fex+k2xeYxlu&#GJP!9v~bq;pOs~BA;pw%D*BrNRb z>zs$z{6S2is{~1F95r5KWWvLaz^{QEx>+PV;;2zX)=wRQ)wl`U zs0Y$`1W9DFt0od&+8sIyPPmm}rkFT#vpuw*DfKiH%usGRW{}YqQV^{b97NniBhGa& zl#e*KTMoG=MZ9)>A_jv-fiTbz5A&$P$dKjerz{2x;&rmEYCR1N?;+NBZb_F!aTqrX zP!3g!!ji?v@=#Jscw@AbCsB%#S^tA5kPh?+t8V2$EdNl_o)8=t-Z9{)xq;Q!>}){| zp(mjZ#$AHAiJ|WJOG&y8Y11RwEe_3wh}^-u)iw34#C{OiawN&|&{5o|Yj*Bq^eNZ6dV_itq#(t?jD4LmKM630T4wuN0WXD5KFvmoE*K0lE)EbSIC;^dg`j^_o ze<|9U_yj6Mtr4ZGB8y^VQH33JsXz@dr?N&=9l8$nkjrl&oTxsyQ`93evHgngf-Q8S zt$K>sJ_7xK7OwPlUgfCayS;s#Ydn3};sgJHv4)qf>XADl*)wQi?=SZ_0*4vZZ-mYB z%@KA-fUmI(4_1XyIkxr>eGjlfo#TaGp&~-UtW+t);edgt_7B|@P1)6Pd6qyKEdGWH zk#h295&}H!d~Sq6O9Noea+TG-XTQ7-PQ2< za^$-UFEjL_7@`_G{CRc}jurhdq{pbDyFP6`O;5C$#QudNEd9Mj>|c`aL;n((igu>d zyYW}sISYSZOb3S2{Mi%Q^8`hIhK679H_@YB%pO(bF*{WxeGeLiqfqNv)QM5(zHQB; zDq%Z>gE^cVz;;-JDyCCd=k@f#0LBsc0rVNZ2IGhTQzM%=snY_i)~&yakrdv%E%J4H ziKE@{wN@#dnsF$2*C&w({7pey((ZdDO=HGM`tL9ZQGz7M;B8S})(Idh^<$81l&%EE z<6haBhrjAhl4+Ja=9n!H11ZM?ebsvtvOk6kp5pFnx!d6sSF{s(e{^b=zt#e18_ ze5YIr&yMEx?YPVskK{5Xshc1wJUW_gmYs*PO{sJ#n*(Q*ZI$Bbu3vvYR*YDbVtXN1 z{<6O#aGXs~Xv4RSLwgCYtrdFpkDCR^7w&6F)jx~EUT&nRqsC)yQ_3;a6k(HQ;am15~vV|RDj&_oBG@Ft;-uU)Mj#i(6 zRG8gm=x#9n?XH(qg0Jo9W+IYj;PmO5{C*7#2ygJfn9{8;VJatUo_@aV6rY3!(gqR1 zlEtV{)Q0lbATH=?f=O~&3jHkt4!Wgijoa9jVHG`hJPPc>28ceOKgQ$-IN^|&25mjO zy@I*pnLq59JlQ=>|NJ<}HnVm_*Gm0ITY$p+d<9P+6I`gdP9-n|H(FpASq%(jWIg|4 zjD0mb%-wQFcaIGt+y&cuv%b#mFJ6q$F=iKr9?Uv@T4aGO@@@CMNlN`7z>#{EjQ5=I zAumRFML=>mfwyD?HTXlch)xDsO86R;C1~Gu6^uaXSDpX;-J^4Ssd_bf;qt9ptXV$zbVr zEVP2AA(JLen;uzci+o3UQ{J0AiJYXP6h00@+Ef8~t|WzNSW4}#&#H*4qXdQ=*2J_Y zPE*jHnv*BiCXJ&3t?-oo#*Pv+SMl-%yr>?-_~nCFJ=jf5N%Bt$hlVxiWUfIgLsx|R ztF{%!yhO>wyyUNQg?;hKVyria3dS3^C~y?l4Y*#Fgf?Qv8sAkgA=2ZH<(w&QF;g0- z-z+G*3zTWDqZ~=*x%HiCkScV8`3oj1E|;;+Z&f=ZR?bv$JAIn}D2MM@nb87p`R1U` zY+33~_R~1w?>Y#*<)DTf#nq&VF`d!B=-UmaUnTFHf!xWSIoeK+_|yk~&pAi!_#QKT zpC@^G`#w*Gk)#H(e!k}SVn{f3r8A6^JS&Co$Hb_=_xFZ7RC4Wxdnr|NXQ+X46pOn% zd6+C09Sdv+ZN!E(_!B%wMB>esVlp&kvfF=@6Bq6IGT=tMHVqF6wd>Du*=HvYs0i*p zdx9;v%%IAvb7Hs+) z#U70M{o|^)L#_To8{gNa&XtsXjoUCHmZI@u_Xo2~%8+L-jcRZTO0Y^v>i1v>5hq9W zd8UCzyoikS!*-qELI_ug^%&{C3B1!=^ogs9f?-~L0vfwTKAN;i{x$y=`Njes$#sHU z{pw0K*4ytsMf<)Mx50o3?Do+YimzYwo-}E) zVfRkcc>G6a(sG`sJBhZwERajugm+Ln(H{MO1r5<&Y6$0dDbtJraHIgA06~9jOef%P z(GOwC4w-(7V!{n#JuKR{Sl@d4Kih+xK8;J$1;)FG)GB-S{q~Das7vhGi|vlw=4d~T zHc%jym#= zsrkB=`hu47LwDpxEL5Hb2^fnnGR{3DqdUQ|+hpZa&GYS~;a=y`pTzgXc!LQ(_lH_Q zipDS09ak6IlrP`>+l25XZuIl`${o^xk+17H(BcHpfzksf7Jo2N^So%slyIaSiw%?P zN{`9Y@0Ge_a3I4(`ENEePh|O9v8u&3RwlWUd$gS_&-!iOzcgqQ5D_(z# zO}rV~(CzvjqEsJWHGr$u-5pyo&*yseMVcE6RFd4b93#HTS^M?Fh93_1;9|EeCpY|B zRzpmoXmrLh{$BCmr|@v{(M%5Pj8Q|vIdb!GxrT<|Y7I59@5#j|)lst{4I>yr2!^HE%1`jd7&zAR)W&n1Oq=;fS||cHW8Nm^h6?l{4x;P;i`IT(e*6 zIzHUhUUgoa{zpLn9F)e?AbisroE`EvZo5NxyRYDzwiMCX#rvkEdY&k&9A)7H0>6TIhu5ta_goBA zC#K;kDOD{SfKN+I9OwwFU}XNL;c78rybJLT2h4~S*G4{$7QP!!9|tt>UBva-1)HkA zqZVu$?zYXpL0x25syC>M@FhB=Z5r;{=%}e@-T3;%Bz(K&95u(Oh2{2c)f)sozVG5Q0wKf& zbGd1Y!y20;zJqWBMAmJjJ&Yk(H#jo1Dx6K~g%9tl_?D&jua2!_layond2E-vCru)V zgF2J6iMC1lQy8i#t}Uy^CZjctK$SKW?_1t&xFgVs8t9de=?6qhbi0u=S<7$3cEA?> zeq_Y57jkizeIjyg=;jDCBM&w;V5;_{&$IJ4IaYiNDdW_X76Hz`O?flu;>wDoRBu$g z>%)T}Q!VwpH~*?uZ|wH})pj=UQB+s|pWP%9Awop7sMxMpd@EfNv@LI?1d@2HCokCN|M}17bN0-g`@8p^d+xdC-nlb#chdgxw>}X&Z$r%0p6pZ?PH-X4 zM4W~Luf2{{wc*2yK}2~d#>b(?oI$5mFu(k=deRAUdzoNe^&ggj>=A+r?;=nQ!CG` zAc>f`J6;m#V4GPsJQg3d-~4YV{u?M;tvv14zudi@JCXKMxt&t&#Du0)gjy{+nk}OO zoqxzvr`kWj)!&Wh67PNpU)PCqKh=G?NWZjz}|YB&59dsDJ)(L)``0xLp35d3gK& z?(2{t?X+hYxrnm!#xuTHvF?R|I~mDYcAVL zk0^Oj+3g`|{B@-0n8`n_?%u;!v>Y2cw%~{Ox9SbkG4HP9+E8()EI#e$FJs4-?2qj- z3o3kt_20@aJ_J5~^_msr+X0Sp6X(e5VHHp3mbNFmjt}lg?iE`~+?`v*v~tSClHIZ2 zc2sup@o@W0z6RdkzMOBW4{>AAQF$<{D0^bb0dD=TxdH9GlSc;^P3~qbS-O(EpK(yk zY}Nsh^R>ina_hv`*p!pi&Wk{m2g*B=`#TaF*$sOy;%=zhk&Q42;pV-8_UvcYyiJi^ zX#BDb(@}93bJ4x}*j}rD+poxW!>}P8IEv)%_Tu|wcee-H-zPubL_uCxk+=#yd8j)y zpL>qMVkd^Y!;n|nmI)FjnvV-uRh93O7hHBu96V(8Uum+tOU2&T-oxpm48}6jVMM%E zLtC1@NM0kL3gVvjN)2!BVBUOf;cwrgSvpock=uTXChI==p}5GM${@PB7gMrKw{~xs z!;F?8eP8#3TrwtH`_zPMuS~ewl}5$Sk1ye6i_X~4EdEWjWap68Wk^KB9cX{G{r&Nk z2V!?0lgIBeC;lO`{i?iVS;x)Ug|E?+$G@~8`-0zg)3_ZgZqMzQN!uUjn3>09QLMRg zXY4$*;riwHS>*bG7-qGL_h()n|3Pfeu~!IN^K$-w{R64Vk7OmSWH-`K0uosE%zH++ z(wHJWEhf*3X6-m$i!!p3`%%V##~^X+pZwtO)%^720&#-FXUZ(cdPXvo ztTwD!K_9N}UNO%wr1Y!d+1)!;nxj>HrP(1}2jer-%&zU;s8all6ilAw&Bw}o{u&sU z{na(&w8XeQXW^gq_Nwf5rthVBdrH-^a0C3*fbMlfb*$Me9;I|x`_JWswe({Xxoobf za~FD(Cd&}iKDV1UzNK`v97WORsiMCkMf2CPlX+{0+TAp~I}0Iin8#z6XAL~VgP9$P z4$l{@xK*M&LpoX5EM;+Tn5-@dDpXI-+= zNrM{;onwH=cMw0EonbDjf|I)Et38N)hihS76Qv{PjssAG~!XVmAJLcRO& zX;x(P#9U@+@~W>}=4lKMsXKWY7x^!XQ{AUnN*(glUfc(_sJpvwQqP-lm^G&NV`SLd z{UBHA`I6IAS=u~)qZm-hKGVHee+sG|vvAL$?vMHY9;c_xp1q-DACD^6{Xiahe|N6Z z)Ezt9F7CMX5CRSpN2~+S zDt^^y&IW2{8?k|CbBjOL6j{tg&(fwuqlzq^I^9=YR99A6R5z_mtB5W|f}rP$QSmE0 zU!1J?Ky7L)h9Eu)YYKW3 zZ3!bhVa%9VGBRdVQj0~S3C%D!Z@f_(Q{NOB6L0i|)Yy?VU^vz(rpzs3MH0C zV`BIz)lH|jqPtPya8jEUmo8B+eS^w+0x>_zY4k^e;ZO`+6pRf{Nc|AJHYgz{X*2v0 ztu$1xRr+IEQA-TIOq-F6Kw+&Yxmc?WwP-T~39TyHsuhO2_DZhf1pv&>WZhlm`l_p=$TJnQ0eKJqvAIX>@N>8PV|z; zK%7TZd5L68S}RSKt;RhKv1qd=p7xnYsyR#|qotL8OWFdVmPAuDQXXlD&cSI-O*Vyt zG(rDqZC0Xb;sr!t%Pv!z7{u{+xN=P+-v#D#3vT4s(J)@FR!P00fAZ7Q& z*)(Ieo#5x!`lKmJi^?l*G+K$EPh`CEDzn8WdTN)&eHAozWi*%!hf;=MS^y0=@Kfd^ zjiK_7D}$&>Mj{BCD#`mP^GQbh^~j;B5x_xt{2pA0WaVj!#1sBVAmoWQ7}Xi=iN=Tz zM+5$_-5SK(QC@9bNm1pj+LD^ux}v&TUwKtsNlj_dv=ZNJE|t%$Dkv;8Fh$kXy+z~W zjQE<8%9(W~wRJOVil&$JmQR6!tDRO;Qc_i0HnZ2#a0O<5Wp#Dcy<{T*L*}aT((;nx z%97ez3hY(1!cW`2k*Ei!Twd&Hh$bUJ@4yo5J{0qW{mDq6(Zjh%W(`J%QVpk++LBDD zxCX{oL$hhu?qLFw@MEGhiKGuiW3f;mVHU&iyDXZFnYl*8%tB}i!v{lZ;|p-M=;mVW};4}AcQB;TL>f1)z-y$QM%+Rc5} zZ=g4zx1bY{Y>*}NFV0=&`PuOEpi7`D%xfj^2~ZFk164z9&=>C0^+`||dKB6V&67Qs zpbALN7eR|1B>OU54_Wc9i?b$f<{B8J^ zETlccZQ5M;{Y-?{!`Cv;-wBU$`*ads%6;OMXOoWG;05q8@D=cn;oITQ-Kgt_;A>-I zKZQPq-i*yq{|fld!J4))Mmg|D;rVQIvo5adQ{XES*fYE#sq5R|KZ75D%X_4<-~QE0 zksp2-z5xDM8})?mfOo;GmQzpoQTP+*YTBDCC!@(`^6L+8= z_)2VDwj*=13^5MAiLdh$@T)eE5B$}Qx_*TE4E{Pe%;luksoiy4&XEI=lwwV#0PY}6Fvui06zHJw9jx&`yRXizUV>nhsWS6 z;NO97g|o_>~gg>Ub|F5pMt zTi_qVyWn}x(LV5z@YC>d@DZQIuHcj4LHGjra`+1PCioWkjGfr4gyARPzlRU|9M2S9 z(Dh>Yzu=8kuOJ`% z^giUeRMX0Sjh^6_yo&zew;rHhz=!++e>D<$;EUk-2Pq%^I=lUHFWcfj*6qhG?u z!QX+;g}eWVp5XcL&G3uiJK&eY55nidwa;Uxa1T5Jp8}uo2K9x14SpAV%^~a&KK4(v z-zZJ{GrStU?J)AfcfxnT$Nd?3;EnL%muuS3;ZxuT;f?UX5%BQC@SX62H_;z_IXw3Y z?D#L}5B?MQBKQmNRq$WEg+0Mbj?%vH7vXtVYTCZPqCfZre*+I+@it=)JanA;!NVu; zw^wP}R(J*c06YQz()-}xGvWK-YvHHhhv1&8u_t&jeB=lCeYiaE*b3hd-wDt95c`K? z+UjsEuhCp9a$OhaWoO^zLJwTUY_+-5b^Reh6b;UudWZX*oboj}>$306awiAwDtftS zPti*xC>k`+2yp(Argwl1P?&&4X_j;C-@1_sbm}zc4a~iQt*^u!Uq+ys&*MEi>q^5KlB>qRl z?-4o1*zzn}lf5p>eUFmDuwR9j4KSwGn)q|ijNc9ZbqoLDrD+-Z$p0kxmO5SkoyhaM z9(Y45HhE+v_xxG(SHVBs1HaxWe;xSmgMU@<_xHd*;KZ*5KaF{(!ryXcd?)xfE&PpV z#vcWL+Z;3hubmk`jCQ+ZuBrb^d*FMtS26fb@Jjxy9{3*hO@ObNXX5|rakf_mUi!;6 z@F&0rUFdU<4R7|btU;E4Fd9wL93+irzL{qGr%RKU!#rhyuK$Dd+281y#{G+){bdSi z2HnUUKxAv_nI_AVDVzA11Zip)n)Woymd3Ex9`>{i{9E8v|M^M}d`5dn-4B3Y?lbFt zp$*@MzC3xnH-nGXn>yOo1D~Oz z&m;eo0n8a!>H60=Ps#2dXc)viV>}dGBe+k_fD@l4_ks$R;;-?F9nY8^0V?`k#8k?oVSy?)6|l z2K)2guv;_bo&=@~{PM-R{;S^bH)i17m1a;ZvWWY5X{*zuKa2Z$ZcEd8HOEiMe*{K& zlKkb>&mMX|n32CV8?>@l^T!3GpTS(|K70O_o*FXJ`<(N~&7^&3W#98G(N`CkC%~-g zMZT?2DS)!8zq#f2q|LjF4 zb2EyXZH5emO4@wZa&BIx>)$_P+WL&Nqe)vq+F#!K>FiPP+2Aj_&FJshi}9G2Z!1yr zQ$ti^B#|X9Z9DkyfM+OBhiZSWg}$fj^7?Ely*1umU>S^&$#u3)rusi==aL`GIq9@D zhOd_R5jcjbe&Qz)U))dp0^%q16TgD^f_~z+5Px|;@m<7^=qLUV@k9HGKTUjYKk*}2 zU;G6B(wBZF5r49u_yxqj-B0`q;*azbzlHeU_Yv=*eY%L>M?A|!>Gs2))tUZG+VBXN zm-@*=4C~o`@(?@yJeW=}bL=)|`Lv&9bSTXOz7G5w==EC8Q#M(7XI8zjTA=)18<^u@ z9Ep3D!|MGa~bEUcBig4nB@tk1NXU{E5hf?=b(h%d6UBsWh}wwzP8@xN+noe_WQTyJ=sU zQ!!(0tquI=$#=B9olX2wbe~>Y3!5Rs`X`ZnCu#qiXKWYR%QEdR>swZDF{AA&0bw+LLh0~dARTENYH@XY$$ z3~nCz$?N-0eY%aiFl+5m&1Lq2muE14?8TqBZ!>jZtJf*;Ly;rnK1#J~BGs;{{^#?o z=L|U2{@@xnG4JCZI3=&yCe}>B(wFqzHt-LAi#2+?zN!Vmn8r1E)$^Nu#EV=zh~JO> z^e4Z_bp+f(@)^~etqjjf8yZ+CH=mAByII#?d;3 z%Y3DU__f4eY;Pyacix`SPVRO?I_1R0?`|h;fVTLE^OS7HTxpF;X)4%5^g*zrzsvJ! zI~KcbGJTQAdK%0mFtBuf_W2Lbug3NhKZ*D&`-xvb{Ac@#UqSq^e&V+fKd_(pF51SYS!&nU{B>CkrXTchy&BBs zelSvQ0?adD-nZvtm20$Qs&7l4+rZ!QP~UAS7+qd()jkUg1eax{pYo7~w?(}M5Z~lC*MizBm?FMB13$kV< zG8PqzNj`;VzTf(pu79()ajJ@}mV32Xu&;Zy2&~wv&GqKjP~GKenMB8TkB#g3h!p62SJ8PcDQ6M5>OS(3_*KMD>?2;v*-HH7#P8!g)xOuMHhb1; zEXijtxL<;k=|>7@Oiwkj`EKHWLVU4(+`WF)fYoOi&r-|0`BAU7)a$|M>CgGWfiLZO zdDn|O^IX}}2F;XKAy{;tdkT47%QEaEPxF2k=c%%6c~yAxlbEaWsz$0o3&}B+q1byH zc?{jb`(*Y!u1m`^j|5)r7JD*n3fLz|cPHsy>LVS!Yi6q8LAQ9d=8P=VIChdea)05t zzpL@)o6GE)$T$3R{D4W?%c&B*qbd6D0&hO%Ut=`^nlaYrt4TM7bY~h1+Q5~8>u)Sj z?GJ7VxKVaFszr`;=N3P(7hEH_4m)m^;849gC8sg}2fGLCEq3f2!OjL-X4OgQ%H!dA z#4~&XXvc~VE;oEI(ONM-#b9PQF+~PO`G1eHeCGAB7doS3(gI#aOs`1p_ zfZ9{?iQVr6JDqoGxYbMBqS?=7%sxW=c;W}TZ1F~33_LS1_L5Y7Qg;5Onsy%V;w&v{C=scKF2`qX_w$snxLn7Dd?b#2Ies^ z(oU)RpdZAWqx6IKk$Ud~_c*wR>^Q5B(FTh!g>+9d#%odRh`qdvWKUCUR9edR@RLjY zH5u`1vgR-`vf4)EDg$>OxGEO`r#<|Nc5k(p%;x;M>x*G*=LJ^|uea*1E$&xywR>}N zzMrdg<$OWYzJ1mOujOj@=jL$vS$P4I1cR$daC6R+E^V)iGp-D2h2Q7O;jaH(`=zhD za`-clzx91-@O%>9lEdceubH4;u1Im=oS(R~7cI=Ey|O&#IhVHIo+^~Xn>5ebuf%hn za%r#pzhCJo;Tdv1e-ZV1%9V4(t^LN8!_D6tZZ4qBJ|l(%0Nmrs`GZS)+Z5Qso^oqP zT{*A0wGYiqR3r7QZHAOq;vN#H#2L^}eI;F_rhofFSNJ^*UyKtprfC0X((Q!Y1O-h=W;H~6bBfr<-C}CkfHERobrSnhaGz3!w2rJx8tqgy}`F0UDWwT z$?nM$*IQpC^Bs_UitG*2ORJLkpV7SWWz7kHJvTUIhTSM`t#Y%EtFjSvh%qN0NRFi+IA6$ku0CGboO~U+A zN49z9h37zm6MrStMr4*5FE}B&zZ0J&IPqhO@M97uHYi;D*(6BP3QqiJEPTeukKBCGgq@#{i`oLh&)$2q*CS~vdQrPWZ_O7 zW~~Qm`@D)$KNfDA4cEdxNkZ};BGzHyo-%Qw*VE^_w9`2*HAXsd&)IOfj5WDuK^6#Z z<+t00%LkVa&WaPbb^eMC=K<#dw_O0{;W7E|;i3kSPsX@?;7)OFD~O9nTK=h5S-9a$im5ZeiWR%XKEc5?p+&B{QIJ_UFzL*3uo2+LoUdLS;FF2W(h-}s|58Opo zCS0^mh1<+SOR!0`yzfOfQFbkQ5!;tOY0qyr54$Fv!$tG3^0UHrF8)o9EVEScVMf>} zS$vfdHcAkmWQ3)3!}l0r11LVm2pb(me2Ebjk81b~BW$#m_y!{^wJ>~u5jHxc^mQXF z9@Oa5Mp$NzM&C8UMunxH8ez2(tNNl5HUyVGXM_!}A^pn;ORHcv*s~m2YSxH;Q(>7s zYMS&5IkL<55 z%~WJ6JVLeD(ao$2b8RRij8UQikU8%aP<5E~G&BAhBTD^Be6b_Ei17E8^6UjJ`K_?U zkL3JbTUgR>bA+FCgnvVLYIC~$*9lkREM+}I@_!$`<6G(YA*f;(PW%UE{8ff(2pMzu zaz}W9E$jia#1X#D78ZGBt1|15@FR|J7vTn*zFv03zu^eKOIXGjIfmk)KP0@umfqfZ zrM#iG&Me_kgr7z~GDe9$t|5H+-Nt>4gi8oteLweqX8c0J2WGrg?X!{aNA&MPmERz3JK>Azk7Ld7D}=AL)&F(E5nK8bgsnr$cN;EVU6S&LIl`kH z;V%;|$3853zuplaaD-bO;kzV^e3rbAI^v&kg!d61YU@vbB)pZs0~0l$i@*Jl@bfl( z4PuB|jXvfOFYSG~F=P=k^j|`F8}?9c#xEe;YSULM;oaX%`?Ge!f0@Cz@FxBd!qy@B zdd?A+@6wmjK35Yb<-hHS|HKgw{Q*b(F-Q3S*urAZ7aBu4XNLZ+c7zjzC(u6fu8`FCTaNf25PrFp zKU-7j2Wh`>#Q)L}{*xp8A>k9WhrIhE`41YXL{UGY|B-}e*xK(aggYru;sig_h8KIk zgK)Li7z9KgciZA6%^pYiEy8cx^!u(OUOu{cpYqn3<(+R#aR?bQT;T|hcZ9EVgy%cL z5yB1hH*5UwApA%4VTB)d;9qcrUvq^2LD+5&A3Nd)<|)xr@?S*wdp7@3=!mb8ur0ox z@JDgpn`Iml{U;pwb&l};j_{9cVX?nGwy?C%>x38C+WTEwyx<3%gKli{Tts-c&0l_* zur*&DDzk3K-Y9A-AFYACTH;ftOs^=PI?XrM%T_e9gNm`0mFBOH#uD~OpO5{&B2l00 znIl^v+2d3~*}`X5Bo~xJJ)xO_gX9WFJGHhgKa}Gtu-ELVduO=Lpr)ZTg;wu5i1|niaxcn zrD|(#J*LIg9#i&YEVM-eEz9heQaYN&?q!AstzDmL{S7^JTHBaR1fxqM22>KMEqB-$ zED(;yGupZVDKjjMO$J$PvzOi=_F%8MxuK7Uz^;0tU1_3*s!$*lkNacGG~W%iiNbNd zntES?ZTVO}3&cXQu2!9KIT8(qeD!RgXBL)HwJbG8!#=eER>U8+%MuT;e_Ez7Ds|3^ zG&MAZf|Vk`V%k+*Otp5owaHj18zjZGW_C@=FqA-Jb2Ml#M!JPF+*`5fJ&lyjH&9!9 zGHkMW3DwNJW>}nEp{6O-g#6)Zf1=UZM~uev2SmO0tW+h_BKZ0+6S|VMqnWicUNFp3 zZGTzGhGNRJQhBQGDVE^S0~yK6s68{wuQVs|5WZvtzmyS=cEc^yGo9udt-)cLg&0xY z?5e^7>Gy5^`li;x!mn^H{nnRQ))K-z8loi*7a(rQa1pF9hm>jAT!hkBrEEUgtoHab z^jwQ^h9dFCXu>p`p5D^jJJP9dwnMXgshKq07)IWbRi*~x2{zBlaHh?nW=D5VCYpNb zfoW}-{V$!f^zdm(cI;x)L)7hP4y@AY(dl81GF9C&_VV&&RL|H`&@Mysl7^;+X!?pd zNLh|aTkJFT6*NXIr)F%;VC)mtLxWO1B^5hB8qU9k@x#~J6iXz#-wlzaH<=eq@1-ObQBos~HQFizcXS?y z(HCe9OJy%hdl|hnOs0EJYgRN?Uaj^fohB}hX+)1fNoA+D`(!sy1{&vx$zu>>z*J6r z?D&)uXQRFl!zk|87Yo(&sM3GkS;y>@~}D6HX@)Xk-9O!^I!e zCdQ@*m6Q;^hG>il5UtaPG(AK~wGsWsnq*8PgT^vrb51q=$`Dnh$m|fYW=C7fww~<5 znijc0G%QvFOJ6lRZ-((1lRl$8dKj51JKe}e+oh^dp0P7yPp3Jy(C2GyZaRbG#H%a) z+6L{W$iFvei|ZvD9~KqBv-jwoEiG|PIkuidnCdQeUmBNTK4UKBoPvzi!VUu|V1MPz zVF-P;)WzOR>vsK1yca@g8$shuJbijB8epr*#9No|UZ$HS=(} WmdCfu;nEJ-?n%v&n8BaN#s3%nvSsD~ diff --git a/regamedll/lib/steam_api.dll b/regamedll/lib/steam_api.dll deleted file mode 100644 index 536aae5cef107a198366cea0d454affebf6156b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 103920 zcmeFaeSB2awKskyIY|yMVFs8$kRT((S5PBEG+_vx023k-oFrz3h)J*_osRa3;T%9E zA@L+OC&#JU>eYLzx6-t?c=g`mt;Ja15(bkXR3rK*7HXqS?T(Xbs5AtLoaejtnVBT0 zz4!Ut=lT5p`O!M(?6X32tqra^v}b8|Nc)Oiv4T- zf`zKxZ4uTV?e=Z`eZfCmapc!id!Oyuc(eBV)b7Q#cPn??+4jBbAFepudi1`uvr{jB z^WbZLc3=80%OA7<_%GXEp8t!kn{)ny|$j zK0v69|L5}x!dgoT$1R@UCnQ}k#WGnC&LU@rnd{w%r=9+z(RkeaJxLH!%+V#DLNCfe ztXXAALXzM?0*$C$;%O!~uC)loX@W4i$|Crv_(_ZK7}AMpootZV-_SN)_Zw! zdzb$Ur?NJl+! zVgP9V8IctQN%4X3(HuTJTqs()Eze+f<+M^(y+9Bu&4I?s2|rAkRrlGejE@chJ^K1o|461(YZM0cq~nbKIMW*K{rVgI%8L52T&@byB`$4*|IARE!EP}GY> zPVFo73dyf81{VdwKg%ZZ%`bIqx7McQ-)Y~Pf*Fm9pzb89EB~oxq9mC^Ab6n93V_Mc zY9&4A8|Y&t`q;;jXBuYTlE@)K#Y+>kp_i|L|F!h_pTIAa3eFmat#+pFb@*6!E>|4E z9?~dVU07Snft~KP2lP6Jwps)WFFxkpuh_M_>0Mh2dTKkQs57t1DyM6C$a5zt)3v41 zsmP|(3JDW>x1*%>tRw#LkBQ#8j~K~4)7IQcsclkTwNuIJTH&;G6*(0Q@3R-y&+YqJF37E)ta#aA%n6S`L1`8GRd}UnJ33q-c^hQ(FOP`lbPZ z_m&fpmw)X5QZN9J1E|jeIj#XYfc;FGP*BV#(yTPy2_~pEg#$~1mRHkN=(KG38hv2$ z%e)xBJPH=ULSypF%B%jb^NZuZ;ui<;iv#@PNX)9^@AFH>|0%zWhx`?OA!z>-e)&82 ze?7l^6Z(ILU%onkas2W%1Nblb#qqWL;`lm#Q3tK%dX=@|o(#bs&`L(-$-(2?TDejX z!X;L%YJ?4+G7NnRnILkCevcHLrLUA4b|59{r=yc~uT|e6xg$z#!>$ZL-ztLO+eN)( z6wI2xo@9N87@d-TJ~(?hIJ;h={7hvI)dqyFs5QWrP!A=eWD!AUC1KgpN>1iiO3Dsi zD^2f$l8fFJV9{Z!coG#U<3^}$eTpWzS4xVg4@J-87;G^y(3b1hNm{X_m(#jO_*^UI zR}wyjBy87-`LltN1t>v(mScGoTgx4-#f}!Aqvbk>?j8A+C2u|0`wLPWXbn|)w`gl( zNaocb{|}U(>K;*U)r&w5hoH=8S?}8t-664C47_N3#ed>58-Z zHqpI9v^B3W03*jN%|PWuzrTya8S7Tyz3#@8wA48Cl95tY23{Z%6iOg`P4$N64p}Vb z%Z{X1SYhY=scOGOb_v$Q1V3Fck)IrwkMYyrfIIjJ%l0^aLh390biw}-KXC}0pR%ck zZ{R1?8sn#9C#mA!;U{45Kj0^4Yq7J%=WMyo8RI7`uV2eg$UldloSdJW;3ucR9wzyS z@e>RT&QH!5KRILkofZ_{qsu0~qlWdH_GgdYDf2O@2ZL zCOWK^kou%XT_=p*t%z1ZPiy_5y4nA)4em*mThL za3^Xv9h9?mA-X_c<8T){w$DJ-HFkHged{D$;NYUt;)AG%S)yL#pXsMG#g10F`bsfe zVt3~$&ayzrQi{R6(WxdGZUg6k&CAwM1F}ko! zuNV!Kg}rtnUmHPy*+>wiaS+Pb=7pFWFBfzzry4~<40z1mErlY~SAY^30w%_)Wcu}M z^0!#)Qh+$@@m^ivOT!@9Dq4lr-79D6HuoCq&S_yR6oj;9uQ3&d<{b@tM#~yXLp+e!JU`Rpn=Bq_42LS3_4nM(_Li!ci38`p?oWJY%xnW4>XB zyv`oI2$mGjKQCslW3G!O#i|wAV79(vZi{I zmQKJpyYSV3uLq^DE+l^-d=EBpUWo3AF7(NMMdTKM8g>KnE>J;VV|CjU<=k=4jg8wL z8{dS{)4qd`-a$P6Uys{{ahLOP0|yM4TCEe6M%|C?Lt;?gQC~S96nG}Fu*Fys^UcT8 zx>AH+M^i@kSZqx+UxDniEfCXtBtA&?4k!sy>5Ak&A>XZkE5F{VY|XE>%Vm56`Yk9i zj`$pXNKfT&i%fq?EGZ91=jcV|;Oy=#*w3J%Iaql}A99~i{yl~rcJp+MPk zTl=YD_`@Y!LY&aViArPmbJhf65Ug;`4SxNQRyD+$hJfz|QS-u%lV<{RsHobh+tc)! zZlAq21rrxdg(VpFj$qQfBktAf+4TWEvk91O3`eeVRVqr>FX$8t~t!&p1NA>@iYAB_psn zO7)VVaK%s=djc!hgdx#<=oNO%1&3yJOG=izSIN}hV4Y_$By>SaPLrxl1?hfWt|mKH ze@j^bpg=5ieYx!wEat4YqWa)?^7$bY49v3;}VbAo^~$fL4YyNWzacftW6X{9E4MS%o7 zTyj#Ykk}mfYl0mGg>IxvyS*p52lNqiF{a${hWX?DXQKZRw21eg^ELfj(Z2)zr^ov* z6SY#2Pwa%Acf*VJm7eFAJ)^&JeeNoIp_^M3!AqtWx&!(N&2wt`1($>KKOaeV&U{4c2?^hg01QM&@5_wCf@4s)=<#6rO*xQj|`%&6iQgM z`fRN9Kn--4N=ZlpBw$tu*z$$~@*`t0AJU4P@-%P&uK4GVOe4~d_lsJ z2{_O4_G0v@?jp0h>c>8XS*n;Jkx`9qsa3Ey@J}{T{3P zF01~Q?eUHlFX1KXlcLFR-tqlpe+|$oF9Tv$lB8vy0R~BI+$xFfE8MX7L60JI0t9H^tU2+oM@UD~w;*|}t1)9c8oDwcMPP+e2 zXIx&q$9>)2<6Kgs=sH|7SQ;+r)v5+rNuo|gFN}s>UZ)#%;u8~ln)Ivw8v0p5z5pi3 z)j?KY{S7}Ql(f1*GVUarFy_h&c4QK2jRK{swkE1IX*wV?N!TvctXJQES^y{(zXtFbb0a!y=Ob<>@}W`KZ}Z z$hf(PM+jezEI5EQkpAdlr-4{PCV4rAxydXm7+*&8VAoNB#~GL5-RtixbjK4Y-~C|i z#Pq}Gq#rvc{rEZQJ?EsKJSY9LbJEY8liqty`nhw`?dPO7PQ>3Ff7oY4p2t{oySZ*FnAOH&}s$QyD3!Z9{J!A8mx8ca zOEWUE?S*dW`7C#&E=fP?IvA2l1DiE#jggUu68&iNF(o}Dg#^Emv5aQ~Sh)!jYd~Z} zVrq!|G=GhQ0%XJ=2tGF*^5Qbs2ao`L2%7?I5sHEciV(tK3%D;(+SQC82}5A-qJ}^G z2ql8lxQy+?S`+4_zAi6n{1|DBfK9>^=Az!s*PqDYpfm$ZH+$d`%9b#U?*;{)Q=Ts(gE)VwdoYje(j9?GX$xY-WyE-Ctde9Id9e`gDx?vn^#mBD> zV(A%T-zNF0kisRSrNP;VZ3qcvP^Nr$Wn@T1$f4$872JphW$e2b1KXev?`Q!18WgZ#V!G*FU_aqR%j#-Ah8CF2ETU|Oyrb3LbVROo z9c=hwzH&jU&%)hZ$eM}_c~a{Q7E58%5#_H9%PfLyDQtCEP-fSShA*5GOPyhdMY+uE z85%9lj$JPp$sE-(;0i>_*nV^NLKZAx95+lXjiNLJQ8O|;(+b_{h|~7yM47>S?3Qlk z{0{LA=mjQ&yw`SnEsew0{9RCl&pqgbc!qfY`)$q8m!Jz#3_YEoo?4oR@L-wT@{3Er z2$z6OurO&e7!&=t1dJ2^YRu?mv;<;r8x9j7EcGYLLIRfn@GMsW&>klLhk0M)Cr_EP zdyL^9Apm7Qo5QiJ(X3wB^Gg!UWXe-idL->IRy*7Jh%iTgHb*NxrHQfJ|Zs)Ur5N^Ud~0@$XEni^`XTbTGdJS z=kfw#KP>W>AQuunrLpcLF}srVD+_Wx$Zd^q2iSNLVZN#cR>PeT8-kue221l1c^cL` zb_Mwvcn%h4Zi)f$Qa$~Ckh1xpaw&o^f_Xp|4vnJhGI)&aZB&Hhifp8Ky=rWo)8G+W zk!SRA`><-D8}5~{^{;B+)PyubA7Dpg>GhSCu~8I3izlWP_)aL#g4_F?@~VMHkr{(O z@buU_Wf6Z4E`uvK_%qd71-M*1$KOD~aHy^fHlH2Bvoh3>8tVin6zPvDn%ohYuz z)V*0aSyc}>x>BwJnFKAP7>~BK`04f@coGo1y*-cf$Kl8LqxWI{c;`X>IC?*S9B<)| zz9#x0|yB&-3> z+hj+L@itX`301Mf@|XH1ur_R_rYBKUP9oxmMBp7A#5g>?v2KWSxcDneG->g%7?(F4 z+aUh~!~`c1z96AQ3kp}ta9fR%vNL50qUTZTMlH2V+o{$$>xDXEsl9+VXX{A{D#&kH z4U2@VIo^P5s@RyTQG9NZNi%Gc^>o_9KwL!F4iR{)eGa&+HX#qo7fD<2a0cGXjU!qr zXwgK`re+(e>kPgWFD(+O_>UmLSaCL&zW~}6NmTmUgwjibdlHSURQ#_KiWdd%PZYyd zWV)xuU@r*<6UBCL-R)yV%Ywy;B63!hjum-=OAj6*hMF}kqQbEgsEuFX7DT#Sv7R%5}zVIKVk|*nha{!G0;n@c6IP7 zf!GG+OPT{;%UnWAn@bBy%M+tCA9rL@uk^}MDP?E>3dt3qaJ5u~v)mGHrc7UO?@SCSJQ}x+;YK6{dcclG$ZL7x3^k3W1cRt&yoW%S zODWdQ&L_mj^5Y;;U=NOfJjQ!9@iFLEV?++@(1ZO{0M9KBWclcV?bBfh85!iOF8@kt zT*LD94U#OU#jK2~fqb}v;>Cw!hLYdbgaCQrg)CSgOrkA9Xpa_Ll8Nk}(k7qQ zwlF43PbZT`&!ygJqYZ83>WEGaj?5}_mm2Sy#cgCLC5n0{6p{6mD0*%}5gA{JqQ@r` z?c_!B=3qlC8+&GXeefovSW+CnzkvF?X${rWX*sp+%b+#aw|fZ^rDc3U;w!Sxcy~A1 zhk82MhdOBMobr}DxfHf5w*sW<$P0EN$SD}_+-3tEqvn`{i_j$i=;>s%O&q8-jxsNz zfp({G6BeX|@$yt~1bhG@0ooJQMqgqs=w&x4aKCF<%OyT_cgfhsl1g&Fi&HnQyaIZD z84k-AI^+D*AzSry&Kx9PVnVkh1~Kjh_^N~1 z*ahUzB?6GX=h9dnq>;1lfm0w3ZJapp{2!*Z*ADwNDNas(S{u<56s8kVZVR{Z3FL~& z{kE;?M`%N*20ASxc~z2<`2x)?vzV#~>`K$CPs0IlY&GL+cA4(WHjZFFVdEWggPE3( z%-~Us-^d`X#-6~Ss~5-AV|n>Fe}i7I1QoDSUg!_Lg9h;8hODJ6RVUfYGl|A_ZtanO zqNU0(-kZ=Ctroiumg-#>lK0LRJWTDq$3vOEmMWYejIg^o2nWs+N`oCJY^nO(c+bz~ zK`-hVM7T2M`h-)C-3AJ>%}|Lo7`j|+a({fFy2rtdn=+Gd*dbuN)fjIX{AySQdvG$0 z^GG`k{Rm$#r0UrG=;=g5_aS*c7JrXKD=x@SNBwXtKRU6ltHX5=xs4NZ+0F2}#7H;B z5Fra208PO*Cew!m_Wt{+LL4u5@ACqkbFFi(= z1z#Zifi%2yDkcNQ8cGfJ;@vpX_6~0$e^1Y#3~aV;F{}CYtAb6lL0z9-lw2X|VdMBDA56@dZLTIA2h)$rs5% z>IAb%urby*^bE=XUmVcWsT%Rcb1}Zi1YgjYiQ^7&Yn}s|wws!aXAL4m!sO=wOX+fCJo-H14-=5MG&s9}YP<``7d@*fA4XpQO@ zp93{7_&5eL29>4&gi3+IUlrL+G;|$QN0M!ibOyqA8S0;tuoqL3)i<4bIt_|^3FKWM zQ(`{t$kT})$VJSF*WnM)b{GFiK)8uE5*#dHEIYbWs4A!?bf*v~dfQDi=VK8ZV)T0rxO>08_pF~T}}zY`Q)LeZ={cTtvuQ zW_*N0nlWw7{Wbi=7KbwVDFjNH;_CPfrp-c|ia10i)pdlY!P}R_)(QlcQD7r#4ZK9F zx`CFe)1l3{C__c0IpqnC52>qgLhk3b-^?B6SNx z)NT?Ye7Zc6K!FwrcOt=RA3;IH9AupYulZ^Dav}x$U=}u1TP%KdO)4N(VzY*+oQ4v= zkKKqem}<1$tFGaf%nabsP%jDcBx9S%UdJY`Qr#>HT}6@rzXs74^g|uW>`o3&auNl#qJvwh*v^dk74lM!JDX zS&SkZ<5Z~!g(gtNob8F&Fb*V+OKG>oejdQwjImalLm*oJaU4_}A5MgdF{+)DO4Sam zUH^i1r;b+6>8SLW6ao#Z2KK_YWfFVP9!)1YSHYOA1Zi!QID}$Ke0(r6oZ^5`SzeX! z`wE3%D2vo|o)xl?`$~Tk9xDf7m;uu(_#4C{Xt`9G70`qQ5bVRI0a-IT3V{HK$6#QN z7>BBZPMVQGNUD4#8&JY^eV_jvZb6)))xb4KriFD_kmNKlx8V6Fba~QeC_{$QZzz36 zh7ShjLE<8!Iie)JR<*;5cAIqU+%UxCO>O*%`>a(~{d=SOEu%)?25Pas^7~@8(PuU+ zg|~H+j$3XBs!>L9in!xC4}5ZlVl|WzBFNef07Ha>M^yX1gf_)>j!k+22Mtd-A})A$ z*hUj*paNY0kfXrF)#392<55F#7>b=kl-OkWHnBCtIBDmN(UPLzY%_{u2t*sZ-e8AO zhfc(|IgD*q!o_ZELwkw+Hk&tw;*ZT>UU_4kv;Z_!rnmokt;bFHSzH~SfxSRbz4fSo z0GkhyzkBT_GQy9#IyG+}Oajf@k1=Uph80TlLNb8Rkb3J$v>CyFqk?wpN$qd+hb_GnxR%)0>0P&VIFh}i`Nd*g z3SuSeQ>c8B0W+&g(iBOpvkG;fo}&nN{xBJt?i%ZM(f#?h6gHJW#F`UNnG^x)v~Sf? z*%q*d-tZXFx=3W-MoQaDDN zy)unuP#S?JCv*PE=P7Y=Z8g>cwL8NQ@gZIh(1sGC0bFEtu6GS(x<$2KBWsinqALLuSmnZE6J_ycMIwG@<0X3v0- zozHHZft8Pm?6X~#JOx^Ls1!|*7el<}UHs&VY?dO`=hH``I5+F~a^GHBA-<}9)qtO8%z34g%@{L_GzTGDU0I?yrBd>-ilX*1aJv7Yzfo~znpMAOl= zM^5J;FrFDS9z+jed{Bg=Kw=q2Gk)YLz&rX5!1~#7s%4HlG?{e1#O~*JX>q#9#j9%I z4`>~71f7IbEoK2+t)J1V`dtUz?<-mPC02PB+XI=6(PKKWa&-*QIhU&grM4$J5E%D+ z8iw6{0>eP+O=|T!s3bpQU?q+w4MMrY&#FPIN_E7L=cprR;Vc;Aq4(B8_i$nMF6C0HI-9CG^q$VsDQe%m&c4)SF>F?B=M_EK4YGqJk0JTJ z9O8?9EE4^Kyc8NzUTmxrcTCo&+V)urwW(1Ul)uEpf@*!}K$+}5qu8lIG`%HlwN`h0 z*<|HlR~ptilb1-yh?gFPFykT##--A@Xfi!Sx24F(p*x7yffIlC86raje6$72OpI>7 zyOIbNy^9ECg%nZ^`2$x+-udS1+w6`!(p+>0HJx3<8)ni(z7EOFo2NM0f&{S8Sqgv* z((23Z!1p*{vPRn=j)-w&KZMZ%Ui=zC_#N~`ggBr(jd17FAM(Tuh{fOnfZ@A1{f2C- zzBXILX8gOZj@DJ#684lc8^34(I<-^P0@eUsC#MV)Ev0Cb)9M#u?Nz7VS3gXatqb33 zNmIKm>VQQV#(ecj$({7DKsr|aoCw_z(*yhTZ47p+1)GNRonc_9?e zq>F=za)~uBBRB|bmWDlBk`#wpyd?>pSZFx|WRFONaU+@R`U<`}25kFM!^N)_si$Xe zPgXmewtbVscfGnoH7MChCwd|{{&zJCJLBsDVq?oO7i6a{0#zYTh(=t%HX-6B#tUyi z2J)&#vH$aqs2jI@*^X+vqPwsdTcLikS^iknHdJjOQ)gn`GQ`8HbX#|dznqnzd1Ynv zs)Zi_S6 zl#BDdk}``ueL({83}C~Nt%~G(t#W_Wz+2F@;5?YM5p|dT}cj3QL@aX+`oa!dP^2|68^J(Y|Yz=J7QSJY#nEL0O9#*u8zuZUB6b<_xaQL zRdy^37dsPk@DME=SQZpmdP}BM7QF&nW5N0eC;r%Ynv0b0JPerAcLtDhxB zCH1r9XtMg5IL0l?By;+1iq3Dvv`{!+K?~-M^o@M!L_W#W50OTi!7K7gsGUZ{|4WN4 zKItv9;`C2Uf6w2Y{x>lFm&K-k`q=cxp={P>!6}0&Z3!e1FCrZ;!cwu3mI~W~uUjfI znHOp?CBLd)SrA}r)?wa<=n^iN2_HUK4DJAv1^nzVO0dg`ubY#IL9lMt%#STS_#zsX zp7tkk9vRu~{2|=DAqNE&rnMv5Scs;&yXtVQy^Tsj_^8f4C$U{y7A#m)IzJ@(wOlG= zPfRFC37rQ6(RJhnf*VcQP4zWv64bN0Uu-<>#5%e2lhD~})Yyv}0eyexNQy2tlMSJN zq5gSZ=buw`F^xhd_#43SJYekgg_{*($xVK_4(5^Sg|tL z_i@-66YAbMQ z+aBASk$NL8Bg54iy#5)Fn{5LiREQG`Ypsgg>u`T4#yGZx_dDjgdZw~ znxE$HD~svC18B&XUirwYglB%8ecJ`>xv_TVpW9CFj#kB2;4HGc%GsI9Uk&<7F0( z8h->Jv~8SXq-3GZz!6ZJ{S!7C(St6--K}iMFQEMTMkAe`8ZH7CJVWM33iD>+V_9`} z#m2si`fMXQVNEz1kE<8hvBJQ;_;DFj4W{WTh?@b~%th5mG^CCsDV6NxbZo{Q&@VU$ z-2{-d&vc)%HCaI|zmdz^ z8E%{;<%->_&f|v)62cOVUeu<&i>>J&F*@Y1m6$;SffFz_mUSPdh3cKPDA}N|Gk|rv z7I}e?P|jwcejH>fVg9hsEI8}(U0`ME*xr=TCAzKF(fBnuY8Us)4GxbHj`S- zuf+A<6VWb`mvQG$w0Akx$*sWbR*Tw62FW@zL-{NP)DvQXSv94yVvkoP;=QOAtci2_>`Qd0cJcZ3T9_ z<{=Zd$R(27`dZI?Y~v<-)RCFBpK=eQ_}XD)#a6w>!BL>beS@yo;QHgib&y(GYV;A; zu}bY_5uAt3c+>5uh#oG!m8d_0j~%3$88ayZtd_18EW!k!;8P5$@$4vmZB19BQc%oB ztf~Wad^Ha>0<2*Z#}{(g+>Tm2ChwIHiu~o9+iJIw4%q>9@!}bf2ax9l-&ugrH$N+m zx1)Uk9QZyT+lHb0nF9qLV6|-9Wqy{1L|F9F$+X_H@QqONTc?AE0bt?#w%4+ZT`ixAv_1_5>&vp~**>T>!wa2H4w zI%#Ccz?fWvauGbrav}Eo*3~Wdr$~UcIX`Q)EO`n}f*7@|Jlsqj_`=OphRB&S>;Xia zRK_!4%4{K6C8G!q{Otx-nJx$iBOv`Vz@11hXCUztN)T~kWLIVeiQ?=+z%-qvbMQu5 zhFr?9ZrV0NIgc4TZJWlDMlK~x#SK=Y!zQB_z~vO^T+=b#ZSi0d2cGT+UvM8aoup9~ zdkk6ele8s&LYL$B|1o#G2w1DbKB-};Ab*RWrO|3L;Q1j9o_eFe!tCMHBspa` zO_Ki#4WRm+pQEwsV4>Dxg#_xIIGP}%M=At?9)`|=W`WkdtTCTMov#;?r*;lM$-txneV=h> zCd&b1#4&F}D?rKf(l(41KK|VVQ&V9Ju3N}TP3}_f5`~?1I(@$uBwVaprzXFiobU<3 z1u$sESJoyo)rRR@jGq=S7W9+(Y4z8ak@Gqo6W$>5~w9kIL9cD7e`Ga>QOeIAT_iA1WxXlgQxE2sa}?fl(v`3*cq&0 zFcGvCDkFrrl?2Zvjy7RbXJT*Z2(VKC3#~_n4yr`&fGNU01}XSVv;&0tB+WDocn6Sc ztQQ-QAkM#@I3Mg>4aaUDjNLwWk#%b(j?nZQGDY|6^@Z-WnbIydc?s9{N~Qjg5Ma+j zo?(-7*D-p-P-9%s?FH8YXApsJXn#QVrQz+1{=%e)?me!p2Hr>6-@rPRY#txmJ6a1L z=`^0|HAmXGoU`5vwH^$;4Bx#d;QTzbfU|R20q5pyweGN>oX`E&nV>M+PGG^RIA*l_ z*<~OA^dqc`Jv28j!oY>EsRF03b~;jf-PW`o(wkQ**_y7$3l2TquPfG5G=v6Q6RtBt z^U#i`V}}@)ud?FGzU$b^@;x|Zhx^*tp2;49{Z5L_*7R4j!TQyZ$oP;*usRd2))KA- zai5KAK`qt%bZH%qOC=ngHqDcZ*|mvg|7OC;OJw{LGK}r9%81550hT6pmqWBQ-%EYq zVu-v`?Un-3$MXZ3N*)`nGLe#R211|36E^?|)iQf!n>aE)Kl>OJXsyd<2jW#PMZ4$Y zi7XoDQ&olc63>VaLIzvAHJ;cq(|4bKDN(!{q$|^dIS!9wPrTBtUtS zy!aSkl@&f^e6q2^8op_omDm={=_fBKs2gBKSlqy5#qzvjWeH*)@F_S#E)-lsJYDA`n_Nlu zN0SYlCfoo(#x-UTfuFS_1`LXZUu1{$d5{mEJ7IjCl|%U(a8M864vL(HIGGPVpwAod zb&S4z137724r2toHHeuDFei3qYI_6T1$i}_j#QYZSODgCewyskQ_U6cGIRY~U?|x@ z3OJhxp<_S00~o@WM5fjw0HoJts=KTLwig}}Cnbv_H|TsF_&M=C z9UiqYQXbxM(tXX&)$T1LyH@B@=Z9i4LT^h?V*ioaaJMAj-b&@raI#0a5C}jZ0Ev7J z2`nV`ZDt z6VLRi7@Sb6r;VMWy9dkd&Pg-|=~dDN`O9t13_6T7!i%H~Y|RvgMIXP5$kR=|Foo*{ zTQhy0U#-s)Y|V6ohdmE^s_mp?V6grXFxbzLqjLp|^EdV=r5Z@VhAjAwhMl$FXvz@C zcv`|-ELSe#ipXj9Hc<;rp`K9lP1Iy-c~^W9u{CLc$d(fDcD__xiC1tJ?gZ@R=``?D zB~FcQLJ;~q+`&Oy)7oS)m<{uv{o66RuA-zDsS!IS=Z`EK;6oNPXJrT=kJiX$o-RdDMZTXVzfmUR@uRm#fpb;;68bu+{I>>Mr zxfTb%Si!^VMf$+lAaWKM+p_dz^nja*$Jx(#SRpOpaIp`n5i#F8xa;>u2~)i%A)rjy z^-A;#;>5b6;6%OZq@f(=D}02tJ$zMJ%m?3D}n0_GiT~x7JyW< zGWsdOPi)~{fmgLIdu;LcD=Cmz(kt0)6tkr(nIU*qC_u@|s`#K0Ym~*l!`*V3>OEFr z+eL(-t=Ygz78m{zTJcS%m7o2DD;y{LUnCfu$;fu`rt+^K#{Glf8HBDSzYm?rE&B2H zJA8udG2Ym;54@SMZn(U?LgRmtud_~ln)^NZyv8rc!-w-k`+|4fZ`V#9_BbuJ<{yC| z__qCKc>#r|n2r|}SSxiQI`iVA+r{td+Tm*20o}v_G=4!VdF^^KNaeEpd}XnEmp!?5 zQGTUk+r@fm7A^un|ID@RQ?f~QLEW0b?4VYufp3>Nqw~ys5N2Ev`;kc!XncfDR7KqB zbO5X*eI6Ou0I7!J;-M1}BV#A_UpWPpTZJdBB{dDbx^om|Q`xza4FHa^#zj zOm_i4y>~PkPu`C9R`pu~`B8sMWpN|I$jd1Jjt`^-1`2jFCYiLPk$u zJZn?*)+E*il?*3j1i@FUP%HQ_cpu*s4Yts;El6VYZg3}0aOrzDDDwn&I=`zHPz^!P zr5@Ty=;WDd0aX+b_ESKW1b!%$y_<&9MkTvR_PSH3;hT3N`i=Xqd0SKb+hTHRYw83g zO`*qCK(grfB7^-aG^3GA%@L(aPVaZkIx%Do6P}5zsR-IkWO*O#IT!cr-J%ze$2|Dp zRu9C7kMlj;tcdH7RdMP0R7^-u&P3@!bui!@lAKr0V6tQGc2jbo=@0_q1oZ!o^2Sa8KXw6$m2@vHz<~u^0PS}yXloGu#S=c`+KA8eLuPB zj9z^G>GxI0tI(s3r|FAPO3DkE1)-EZj~Z2#2=$Ho$h{Jxuf*SO+yqvbQK+82y!J%6 z_%G_|Y1^lU($|9t#oum1Syd!u6^&(TrMqWN$AV6^LqdS%WuOGI>N6K z50-oqMe2n-{Lus&+zZw=6+h^m5quI!NDs*c(l8X@po{GtNYHxFT_t5^{0ub?ha`4n zF-bUHhOXkG4n66l?a7dzeSs%jgVP<5G59uPrDL$;~UIGN)^S(U5;9RxQaOg-qs58F-X zqKf03_%l5)glbxARl>g7mhgqu`mgXYktUwf}Svo)q|N zYkm^hX3(b@0g7l(1by}*@-%41fFff=t9wVob;r7+h^xT6`%LY1ECQ zG-G>_h0mu+gDXJ};+mJq z8HRG4Er5k6H^RO^C6fg~RKA_~C1(f(B+&<#a1{9yGi_F4w+>(~0qZ~hj43t!&aWUR zcF`r^8m7YO?|}10Dxu{s&QECvvA4~GlY0+XHGCg~9qcwUlX2pW&&45>@O3lH)ATe0 z2qxEzj=J{-=s@fu>D24L2`h3AtQe%*&SpQ9EonL`Q7AFmICb%(<8X(&L zyAWR<2a&J48LS?fCU)A+V5@^HRTOhb3oYpgBjXv6ZroWN#fSy_c6!{Kj9kpIK;bgl z?b-G){#)1w8=fEVT!m{7ulclF8MbPOppR*I?832qGsC=b+i)oMnaau`%=8Z^ z?M3XMxY^b`8%?0e!xc=!t%417c^qK z$DV^er41b%Z=PMN>7K?>^s2l;yEA-PKXoDsb7Cm?ISNbJ6pjMEQO<93)BP3viyp+b zCg#q@N2BtfZ3WpGq$evc#S9#v6AT-UT|*Xpu7&b(QIj0k6%xAv_+Zt_UvHJC^KjCD z{x-f|={K{n?bYyCzs|v`nZC{s!o;ysD2-vl;q@N-1it0pK+25#aw~j~c!_~M#4G?h zFdI3hXh1vTux=VynMW_-W@IBU!&&yE;f5xR%c4x7bMdTU&nk;NGnB+WE{6)Rz&!sw zUMefy-Ex+ny+!X>T|9hsQ6`&~ygq{Xax4^=qg3x2i}g`Ip4a(tYGv1|98rKhipZtE zk;4H@YR04Uvy@&^zu$#^!Px|6RGGtGMkUoLu%F`DEnxBC(OHCK^D+F*n7M-uh3?w( z*gwXq-IJ)s{sawydkhhv5ME}68+~pfp{Lni0UBzbMeZtRTWJ{F$W9wZE`kNi+5Z9= zDXKeaW0xi%QV>?$zOe!U3a+A$1kgcBIXgsPOzj3%#Uho#K7}Ta$>Vz3wv#;S9z=p9 zWIGv<; zo{}I9_D99}4jHo4#<>EqyxC42qsPTol*KC^J=WA&482dQ69#?bFr*?|)>3 zKls=5HsAk54^K7IH-$If|ML$1`1hCac>ICpAv|<1{vL>^g-_zWoA+mdO{_IDD!X=6 z3-{9tE}n%6FFGd*6S`XSAbyREb_je3i(up)3 zNcZ4R3y|~3AF{kMOB6c%P%N*RRsojv4zvc4m+*)gkwz|&HnBCJ4}y$y5A((Imq6!m z{7k;)^H|Ap49Diz`G+vuWn6SwnI)|ww`AZTSph53`$-=RO1MOmQh`? z^IGDv^-5}MjYaKFg7CVIoWfb%vxFGF>1^9~$o9N-o&J{kktj>HR}QHIInmjTAJRw8 z*!6Dc?IH$nsN4bCIjB7rygp?Gc}cyNZG?10Q=o&jR2)5F1@N;M$$9T% zg*B)R9bkTfO{caaa1-B)7hLAKS1E;Ci)xZLFvriD&G)l%HrDkWNMOgCj zD(UV{T4hZ%g+B5&|l0+N7N1`R`!r#>aXZ=j@g7iH2$RG*4F zJhA&b4!XUi_Sq5JItdrEuzY~A;)|3zxYi%`J_kweg(QbOA!jwdqzqw$9zW>r#7#*A zSKH80_(8hq)<%|xmP@O+d;iv})s7Uk_>8f++hYimwc=#F%o8T#`}9b-T8giPzl1E6 z4o}#3rm>4(m3z1Lx8;G&`6VCQnx=xTxMb+=v^5b2>zQhY2rfyEyh1hU+~|XyN%{x* z+-Rt~?Nt%52t#&=LWpU7D^*hn6=%4Gw@7n$ZoMjole#fkXxKQfLEY#QO#JZcoDAfy z6m%O;G}J1ug_aHph9 z0m%+?4JsGtr(me)-Izp}Ovy`37Nq_PBt3)NQ?>3?vP@U1 zXOeCA(| zf4?AVDQZ~ml)q?AU3Rm)Xj!d1f7y0<7R$kM6%+A)h6G_zC<5EQXd$z53e=G$I_bqp zU^Bepk8~9lwWbDebkjsJd*Qow{YLOWapT@iCepT7I@FPJ+XFuW>EvB1bK07Q@v5>Z za#^vwQe~O=E)|D0beH}?bJ!Bt<;5p?F12oOU5h$2{=lPz2 zr}4z6DyiB49qbQBaHHozynt8KKb}?lM%6<}Q@Szafd=HNbtCu-APKn6=s&3J2Kh#n zO_jaHat_AdP6~><@zzn}RZzyK8m~D;#orn^M1N*I`Yrev-{Hk&goIUBT!>?pOI%aeurPGz_&8B8cCa{)nuvH z+Y`I1DZpIsW0@ zYmEKT4OGq1*CWs!0A8W5--aT*EHIcngsautz?@mtH$T8sl3O6@$`)C^w9c;SmRs@HOS&<{xUN{cH(q4H!wW(u?!eYjDYjiL&_@*-?rQquYyd@$Ms= zoTcw~9qargNtU$P;cLY;%81&RET^{2E-Y5Q*swmLA3b#pu?Y*`c6F5LZ{yl3$}ELz zlrK7?)CQ2m>y(ij2P#0I5L^yN!Cq~2DHgGYm;VgJl;=Z<%Cl6KE?bM`WMsFCuw)|b z)A_H61tZcvjoxXg(TDg{yNqyAR=~&V50Ij_J>R2u;*Ue)FU@N8*3J*@Q#!--_NSkI z`UN_31KCh{;Tx|KkKnuXEq2fK%Bk>ubCG-n+5>qK^42M*;%iUiU=~7cX#c{*5*%9wX2yj=&zpTgrE2f8Mb{rwtdOC zS~zoIr^gq5IGxHv&NB95gwJg2N{bpvLa4{PaQ|(yhMVb2qv+3vzNxB@+_LQ8CUkeK z9QnwF9UDj#2hgaT?YxB;eO0UiHh*Ikf@Cf7N&#Leo9K4Gm%1UFW@^LQ)VcQ7`%?&P zbQ*2RGbqbRSpd{>e<~3yn%43-f1$Cy8Z9%)*xlR@Fh2ppu7j8Icl{B{2{%opM#;V5 z8=dNz+1n>Ktera79xip_*5Vhlw_7Rc443w`*rUl^f`H?>+OGKSa}8pYpmeRlJW{$T zbUrowAvT61yZJTd)m!Ab>aN@ISrdJG5GK9^v#=CSY8(o)xu_h$aqO>WLkaOc;PxN_ zY~8v1uJhG6mOc+gN#bPota&o)XPGaPN~B8K>Y&bRqZz7>KUXJZ68!-JanZp&nWW`n zE>k;9m2$dJbqh4BHn#(NVW=+U{O%Nb1sQO1(GT9C%go;RrKe@;*)NspuK2e}aM5fWvvS8R9ENNY<^#d~!?+6RK8ug;M%ZsKk+6$) z0~rhqx24)W7_1r10(Xqsky9`PJZt~lXs|CSN=in}MuYy6jID{j;ca`q8^$IBip2bW z%Ot z{K-^)CC#?42$FJe;3*W01M?`rn7j1b4(7lW6@J!7lZ2S*g{?(&W93rYzU8)k9r&7r zx39Hf849IUZbXd~SysD8wta$7LbWRi=7G|Si9;x=+J!H`^of8_JD_(1x9*kXm=pN< zX(&}&X~lOt!rCeTx^c69)n+XRmo(Ilq&3P3{d4vnJWK=h2R$3sCeIZ;?#^w)1iqf4 zhH^mk@XGUFI16YElH|EoIgKDUHVsVxRVzn$8v?pxI?Gg5_mHZJ{vtn@_{7$H0|3Lc zCOP2u0t$c61;G(qPl7Ot0~ocW&tL-|(Corb$H)t%*974tW_Ln(>9Ytc@dri&G!;$= zJqvtHa)H0|V{0Nm#S1OK4N{|@`TXbV0^D{&!{^YD0+RbMiOn=Yx`JS3gp|ajWSU+S zEHLH7$A(@&Wvx0`t{0GG81D@iZGj2<37QS3kaQv*==VrKLKe@Ai{MJJtrz3Ny4>~- ze_Gp);z?hk?^j1s>g=2KwJY%#2d&-%$o51TFDW3UU64@DZkraS_2lZ13Bszli6Z47?8WhB)qJU7NIsX3)EgaBv*TfJrJ?8h(j>&Z_0893c zf{{Bg)S!MJQ4AT?_&f49>h}@JkeY?m47jtOhtTb#R;=e{Okt&dAB}me!nejMEaw%B zeFTqPJeHq@S8CW{He3bB9{s)pNL@~%>||aq4F`V^@x!q;X?KC|N*iQixh%RcR zO8GUT2)SF0KR+1H4pFw+&8NEC&o)qU!W`r96oxaMZOBXThdA7)L&34A})ikp!OxxP#a1* zzN+%TY%4xy#jG!)mnw;yZ0--X-k>8CH0II8ooEIFshkB@L31G=?%Z^}u?HlEFLyl- zjz9yO-bk~DJI0vh(^5Bh9+f6U=Ra%wQStsF6HU3VaSK@9I zAKSc<_zTdcw|b>eQj2%ArRvKr?^*Z-GuVGXQ+EqEGr^^rma5S%@0UU$AmV&|i-?a- zhLZ7DFY)It{McC#RQ5(CS!>y}Zr%ZckRy4YcSN3K``_$+dq7mzwfBJ;U%I zB!VG94F)yffI@g`Kv58+ii$D_h(L#Pe55|c43jdPOkz{ho3u$AYtq^_z0GaoBWX1t z7SyDvnlv$uX-I36GacJtrHYX--*4@GW*Cq>?!Djl-9Nq$-Lv=E&$ZWH`?dDkYahzL z4s|dQZ5oIWvklZavXmGi#cDb(d*Df0u>VRAJOtGv39NK>;zox>VB6h;G3WraA*o|o z&>aBG^B1gAaM@~{bG80}QG3u~vBBQe?;HhICo;2lePTZu3^!t6U(1=F(^dIZ0N856 z72HU*nz_@=-7=IHMyls6zzMb@AfAK=;KXqgO{TbIZbOOSmMZgIxj|4Hvp71wcOi7r zm~ZTyR01Auq^e6N3=nt6lh66C#8ldbT{on^q4nrGX+6SDXNqzbs*jj5BTeg(rp!oh zlA>yY3k#R3RahENJx;>=V4B6E)Rufhv%xbCvW)D7W-4xPnyMX{)P`@=o8QmQ0Mbor;BEcAfx|q$>MTnJ)ld8~mZz!kLrB^c| z)9^4Hi8=Q{7VR65tpj;Q28DX&gULmLCp!~RQj0)Z=w4IzqRG9`UohW`%h(I<#*yD^ zFD_7b!jq!z`hy*kej#89Im3L6@7;Ox9_Nl4uzZ!n%SM~ z6v^qJb0&UjWT&tH3(`8SX)qzCxO&s2w!DRiv^?>2B)}VS1|$61&h7tej>_tG-9^ z#uJkhN~=g?)pg#^TxnIXa{Ovqj7@ZW9e5!vTVm4&xLU?&Cu}Zu!sa>xXqun+1iww^ z#HL4a=#qhT?=y6gmVEF6e#J+&!P9krSIUYlqIm4Mc+A!u2N=6V8t24gO>GD8SrgXQ zt1opr9zhClrN3!H8gGna&4Dzt-9?9Oz-==u=Rtm&ZE&^}M%j*K+0vKSJ%VLO?!XLLF8{!G-S+81X}RswDk;;}qx*pkJ$&MsMmNEcjb=8N68HGrvfy z^uQQ<5yO29a?C_3y%pkPhcIa3G8(!#V?MuvhL`f}YPw_u>BPVoa&tw;&#(ct9XEA4 zno$^12%PTSq$>Ct>*oo8S#*3KK>-+l44(tRa`-@y!YCW#EkrB{S7?78(MWY4ATT=D z7MuF@Sh;%Th<%Tc6uE;u753Z7MiBzY{W{{u@(Y;7rdZZ|7V!}s^WPvodKe(td#iChueVN`Y45GaQ6unjm9>?Pqk;nu zPz0$~YZ>I@S!;Jt|JEzaQX2Zys#pfRoz;`0XXbcPP#$UPqv zqhXwlC~3SjjBSF#Jg&6~HiEqi*i*uk5D+nK7c40d;vAtL6FchGOx zNRDxshIO=*Upc5``RA| zYN++8JplPr<-82RvccrRXyG}18LGEm?CytGN1LFW6{XAg{ zZArLvm4>+g;&FLN_M@~^0K)0Cfp<5;=^V5JJfso4t!8*`BPOi&74Lz_6f}SEFbwt7 zf`mFgi^sDn#A_=!s`%BmNI4dQe3Jqvm={e;)C9Uuc9aGOFD^xRcYWYxs8x>cg_rUS zo39wLV3?&?>b*$7smoAWD$V3hJu*K^<#@*P*$pezgeB^mkP-;Y{4e&SClCox5{e}m zSNguLFhn~YPr^q$9O`wEqo5{~-A8rop%1Xm)M6(1hQVE)o6LNrncjmGItWs_!^*)_ zSkaUhc4P97JX7sV;L7W{jVC|{rv}zy<8C0W*BKs!?e}VxlJ3$fbraS;g?K?=#Xhhf zJwioEW4s5+p?(6T^!DeOU#Y?t7A?AFwhRC-a*X1l^#bp+Eoa9V2Cdx^jiKA>FQ?`wu`x zTQv4`m#7|R-?U9z3yFAs%89)hlV(|5SORgAE^ykg&G}Sg#m6WyL_fir8DrlG;nk5P-Zx9s z?>`63Oaq&w!?3&mMa&=DFR++v*v0-46jKJX@XdknkLWCuhygoF@9f`Fw%)N-D1xzU zju1}ILXM6u5bn50uUnBsIdpD6jWr&0ZhwT$9v9>P!SASZfO+hi%>YiG4DH*Uo=r8; z>Xb7G!X1qpP%3urb=nC=0x_siK~1;{x?`<`NABVoE^rFK51Hj#aX)Q8lB&=66QN~2 z5zhG@y8lK&Lor_iSlf~7T^OkbWHpOjyk>TA?!h>lN`W9wL(OQ_Lg(P#xkJ)COH~oog%fkaADm%l zr=b}&wj{VRkQy-It{zx5$FdBikOu7fz^;ZtTz`>%>j)*BNm_-sFH;|W*AIUogvPz0 zDt6FVvyglx^eMOFNCeqXB|aPw;N5+R*1H4ydMJxPt5P2-ftZ0S8dJ5)wH?1s$13`D z72vni5rf~=sEhMx0{I@LDcyOr7Qg0eXlc`H{=It(`X6o7n;?S(S@4VKJZXipwLtxh zI{dJ^_492v_-_4~LA&*7UuCy0MXUQy`wJhb6&{Mh8IM8_2-W%Mw=JO^j+OX84I~Ep zZ2U5r9Ozh4`oVF5JYO+Gm$blpkm~MrQB2oC`cYp$C>iZH@?@!>mEtCGq?RQ?w(HmgyK;hUNwei~URE*=f(|Aj zQ|G}H{CYOot|!WoEXuvI9t(q2w(AvAiS2r|w9IzBUdp#!-zw$WuCI{Cd(!(IR5ees z{YI4(XTMPk*42$I(zt#H)zx!{D<{a7R4e@(hoRp=wf02zyQtp%F8Z<^rI@G!=`^+- zrQFb>nXu&Xii49z*j=Z=>R_eeQ2?}4p%l@Dcu(MbvXoDS+3pkA?Q zB1SQVm8vi(6&JNRwuB??N2z5{liz})Wxr7`KGuZ2li0Kd%XE|{HqmCUrecNpyx8;r z{KQ8eMY#ROhMhU~8`Tg8yHO`Pz5y={3ksuavFRt+Yq`(h$LS#Wm1h_%H)e>Ahp}Pm zU=$YQ-UWB!dv?}?XF!{XgSvT#Fe3vZd(1Olp5%2AgoA3g4SWQxc1Niq;5yn_ES#jW zN_#eHM96$Gyj8X^e}#=BUPkxL`UnWJBQ;i7+sVo(bRDJgT?b?Et3HGMCL0^YruR{g zK>+k3j03=WY%ea-&;Zw>F#TtWjSglM0aB0->QD1n*`njG|wU(ZDg>;-c2j&=9HnLNt75Am_J<2^I+JWrPKw;c|h72K&(> z!7M%MRH%&KZoT0^SHiy0HzwiG^jvFK!KPf z9GJuz$?@rd;}$C{ZO%AIs8+vC4T4>O)*9oGr`AnH$850SID}ruY(#ds^!QzhZ3G*f z^g1x<*chA(X2Av8-)q`W!I5%bL%+qg&*){S>10Da8W6d&0d6OTFq$xe1_7t^4*{=- z>HzRq7X~kUNY`l54MD*}*L*l@eYj^>-zUAs>P`fxY1`S81ZW9g$pI4I&>6IvL{u5^#d|MLK75v3xM-L?LE@dJaec zH;X=iSunJ)Idof4p3-ht8^osH!%19`re_g@*d)L8c^set3cU72%>8CFXo!5wVGfuxoT@1NorIP&|fr`YC~$&tS- z%kIef*yJWwYs(X~h+tE6cFGL->rkM+sb!SydYM$2J@0Izp_xsX9z*jJG;y|^oyY9P z=`D<`?mjLa`cyo0M)^IOMCtrh(7C^~sXA9?$OS`m&LUam%_1IRnczU|!?0flo%^#d zit*la9tgXfY&pY%2BqdHAu3%aI@V*Dqvh2E)Y*A36L9cp(7g`(RXc9B%;eLHJQ9;3 zco8(M2YJR1YS#$tW^q?qo52#e^z)z?ZtS*wF>E)sN^5L4RzO_&XdZIg+R0`c>K)QF zAFYqlN)6>pj!rg5)+360CL(IRhStx#I~S^_@~ErSB&>9kZqh-8*D}Tc>q9;mp!4A8 zG-(F&**$2-pmMfSIUV?E4$bCE5%*Rs7joQI{Ay)mcj;eY=CiVKBGUASzz%W+bjXJe zwobT+Pp!X5M#V*gNMdWHGsyiK0u%=uR8a0wd}%94|C&Gs;%UVhT z6bG%96&F?N+Ijm~;o7@S=H+Bw?vtpvhC3~p>*a7@ zZ^!z!k9D5djoxq%UO~aOuTqQkKw;a*diD9sH{n35yKDQDGoMrEJuHz{XA&3~rq2IP z#rWzh1z!W}iuzqP)`ZWqiEm*3V+6t$>v9q&T|OFUBm_Pd$4RK-AVd)h$Y?uCqZbsc zU@Nbybk64s=zg|~%i(K&Pen?s9Ewer9F#Mt$<9J03TNr{eF)3gU z$I*RYJ3oy?;vrGX+k8^KPpdRrK0zh6Z9%NOSaHx`X4@K6C*QC1wuI4rg=4^$XSTK! z@QkB8TvBKd-2jpQR-?~>QlevM#a_tnr0xMj32dy_cn*c0L_8CP1i121>RJ&b-9hp= zcOW+6l7f!~#f1gxG(=$QOgRUK54tNPl6lh0Kv2K?Eri7qGy=pWIz#9_5NH(J^il}W zLx&0#s7fprIq4Rg2STh|LG*H5CF0sB@ZK&&aa)U>VNfT(JhGD{2ys8h0D(DNQqMBz zons)NVVi%4Y=i`CR^PAg5cjrblL$(RHw?n?hL+IgVBBDiY?(}inXR@GRiFlAykR7n z0qKYQ$d*uVR%CNfHVQy-P47wf(i@BNPi!|#5-y33kbi)j^d0wmnX*3pj%S_Oc$HV&niCy+P11O4o0)({1xtN!JP5X*eN(8fbcw0RrvV zl;44^eYa;M-6cRZPzluGtQ%AJEel!U!K>~^g-*$rsV-wS!*>s%$tlSn`kx)R&K8sb{PleUvq@a9P=J7{ekMNC_IKEXNX zS+q1{-bkhPBVVNJ2qsNyFwTl_HGf<8xR zZZO^X160LFUQC599r`I5R+kRD(NKKk2*skGFNlSKr&yivOTrUg*lW5My+&EQ3Or1u ztt8oq4Qp$p>*YNlRS5onvb&AB+8Xr;f&dL#It)+6JI=9(G5$pa{b>kpm9K>gJ3NJY zk$Hgab{-DURH3qZt#k2O9K_qN8$<`OzG`Ahm7S~X70Cvi=SA+mPWf;DJ1$P`tVn%S z5L)FCo!J$3czSlGB8-3Urti8`3|aiUiN05-f=|Z39rV38)#dwsh`#5iKIZ#=n7(JG zKJNQ&q3_A52ZOcrNGNzlrM^VpxLI2PKyZbkqQ>AoSL)nZ0ksUMAk+{-7<%nWMlTx2 z_y|)~3SKk`$l)1aP-!V%lpzi@@ZnQkMRy!YyNd6{*TRxl7k`xYYple;!tInsI@+ZX z*Us!OKopM!w{$@yWA)Glq{w}Vco}!B0C!?He{+NEKF~>GH`CHNwwKXNPhwVgBHr(i z!;URM&K{%V3K&ZrBS)hvMu+9uA^*nA^m*8|d6rM)J&G`>x`1I7RYx16Ew{skx#;_m0^texhmA`s{? z0&ySxc$Ry&tWw@o%PO4 zbmm`BMm`OPj(sNQU)V8T$-e-EDkZC&nWGKftP7s^)%iciaxBz$gfdpkV~Tf6MWJ_j zS1ERE&=e1~RrH`EvSe52{vSA~V^6)j{u_{f2fIUO@J@o-S3Qy-4oDwTi-kHFwD5cHViNT7<8qxKBUPx;y5as%`{ zMd6K^_hcgmZ)5WENck2vy_B`nypGi;QjbyJdeH~W0tSrdeWYM;1bfb4&i6qTjHgtO zV_hvr<1w1c9GFoWFn0nN&mGF;_GW2@*2(tk!8;+l ztdpbm#bG5|*3K;FNdBQdf^?cZ?NzJ*Fpdq3sA#WSASk*!>3!UtA-R9&!|1kU?FE{) zFIQ$vWPC*oRv{(MI7QWZCKP>jW4VCA0C@01tiq?_i$-zGHB8kQ8-n>3gY7SHvWP~* zEfA$mIjie1_ir|sd&P&IMQ`1G-G=eRI??xX>6nsY`^TdFBhlQydW{_7?oEXpVJBE0 zkcq+*leqASDcpM3mFK-NPb8d%fI{ah6lizrtq>*G=}tm^HuDtJK*qSz5WENW34HD; z!jBE+Ihd(uvE&ZJO|IsgpqA`lWZRq*j9cXPPL}!W{>-rl^2cSdg1{dnMJWK`NB&rQ zcpU7I2tYh|h|p$#DDt=yfJDJW!suc807DPVC76paO6H>%otckagss9>VPArM33fN^ zZrDArdtmp%?uFe4yU&G}cJZg{*7f?Z;iXFF!W6+&!O+4OyRbb}<3KmBz2-xEy+Dir z9lp4Df}qc}J-JV7gP4If82Q#vcR$hCKY>FsbLFJGHn=WP;CZE^;%AO=O= z(*?I4j_EKh*}AD`n{#ybe=zKQ!m#(tfUF5NEzUq&{UaE!P%=CR#M~1Q4>dpywKn?) zUaF*)6(6GgLqH1TZ37I=1Qg7ZFwepqfO!$79R|3b2wYEu9Su7gb``2%K*ap~o*!sb3!*O&0`CWwRfib)u&^FmRU?89^*f(k$&<>~@;&8t~ZO29fu2^dS zi+DK0Ir0Vi9eaR&Cp|~MbDpK&)Ti-V`N-Il%o_O{W=(pMSs{Cw6}yL7GaiBU^kX5d zu)uBK{}QwH`;Wke{`dVS=$ome!mb%^QVz9`0{6d!S*SDQ0Deb6fm3J53vkhbh7BHE zf7L!(_;KA;TvOEkUPOWrOw?%X2yq#iDUGVi#jMO#M%hy-f&eLuAhjD)WN8)UJxC!` z08azs4F;^`q*Agf_jjN42S@*(m>0Y*+e9~KcSj&uupJ{OEJ?o&wy3|CGuBJyw^%<1-AbRdIfG}cTkngUl~;J)u3+?jx}(24wD)IO@*SS zSRk>rLV-{LM$m0~f&nwv(nw`lWb#sj9Kuu$v==V@HOcmPA~XjwiF7_-aAxS88zYx5 zEm%G9)UEA)Yf-DT%pWtQB2oOPKa&EM^_qcL=kcLU$RI22r=uV1<)1wND z#lv3@O*~hEYXi}AZ47Gy=yWq*w~hcNb?-tGYWV&3);ROqR$SR+7ts97EI3$xXqH|q z_^X)i%6){S0{bNcT8*{PtgK!rtn_QAbh792C{mRmKxgdT7$dl1#v*jd8RQ26aSAD5 zA#}fOo{|>RrcSwb23Nhbb#b7MOO4d%VZOw3yOVMJ(aLI0uas!fX;n6$6jMvUc0%kC zqzN@$iRV^ayKK&iY!ubsLU_d|3{}=H{(>GCz6=IhP&O7V{aste6l061>F`{O#V_{s z_u5lmBBm87Vyxebi5-6DxUQ>EUse#YqotG-+8Gpy>ibnRk(O?}WdmjIJK2hWB!f^I z_Lc^vvZq4K4)Vzrz2nLyekfV%lLu=(g) zy$qQ~A0V{WRJ-7zU{|>U6~GhO_=1K*&!5$kgZ#I0e@Kj-)<}ET$f;I~G{EYEe@Z6B@gF^LN4-p|m zk{;ES1Is2XUR$@8nwcJ`#-((Y83N_9A5C$kup2~*2z^TSlu=%Jj`o5YX*R_Phl+P! z=t_k=rm&{RV<@comq%AvbJaW6NGJ<)P7F;@*RE<#0L0U8~GZ?rks4&35byd!_rzCixw1>Z;Cr^rhO)@T&3=2O83VUQI z*1@=1SU3R1N;sXwsvU#|T%dx?*8&cq8sm@7mYBehfnx}&Hz#Ou1b-a02Fqd3A2{wJ z8QSO~Ru^D4Kt%C(iXN)6aS=2+6PxyL`~=N|l_P1pVtTIzR9YrT~Wa#Pw!wRGJ`0sCL0-Dl|;2TcmPca{h-8txKI*g@3?>o$h8_ei&(uWPiX=^s3K6M<*{Rn z55<_szvmBx0hZt+s0a(PkMhQIINSO|fy}NDT{l!6fFIzMx8=B}qk}OuYE9I4`K5oU z+!e{{;SADLswty)AE(PPQ1f3R+ry}7Cd2ue!#mKUtMf^3TM5F?rLV3-X=CZf)Dl1XV8<< zY7H=38jjA+X@t&cXpU^**i8G;}EIf6Pwl|w)wIYnZ!U7n+os^COM5$&oGp* z#3ar*osg1c6d#_7InL=w!)J?w>O&`D8$iD;5z0ZTWn!!CdN>^!I40st3DtGlx8nZ7 z*p`CX&C7e5^Z#XEn*?p^B&P3qKs?q~pguR19}vt_TvTTKYr1@#pQM>jiVr_e{UzAt z$b>%*d8Xb&b;o$RGC%c4KwW92nPC#5VN?#w6tW8p zPU$W@X;9!~;p(;N;~62i9Jz>O&NntrYZ;S~ z?tF$C&GujdVi=E)ppa}I}SRukx+vM0G*34`}0H$fSp55BulWbCg3x~!(()R z(!Igqw*&s$f(}xv){I

5NubwR9ap2Pq5wTj@0FI(8o=kAAAzk^gMXs%b(QQZt%+ z2GuNwYW4t&$@@C%Kwp; zW^GNpT3lSU9D5p-H|L%+6s!RNHdVuGtZmqe2%y8W0I*QXrNmo3NNDlS zPV#kpoFFiq+Mg%t#VAO9VsQR;Hirmut^FvABh9D@S)I(fpd6)s{5}7Q?-Mwk2_6Wa zQ#|zwK1)5be4`Bw=4m+oU}R`Zx{aL(#;8AL=_dje>M!85o7hP;U&(osK@<&s@hk5<0Xi~rHDyqZu zV`-YywFkut)jBSF2|mB)R`s3l`tk7roK&A-G^-!@0UaBVX7#UAwsf<{Ms<1s{#u>J zsE_!wqPpxGT$fwaP5xl@o##=9KYp$@_)tA|deR$(s^wn+bqK{0X;z`CLI{i$-A}{} ziPcAhMp~#0H1}M@$_nQqgV z(bKC&(oa&mnN`%45tK?dOty$n{h`=SqK>44#3K)@Ph=d(WRO0Q-sZCF9a*13pGY_< z5$Wy7y6#sZ5=DAM@QCA5Itqja5gb^khsS{~PMAsGO(JYZWn3I_~;V_vT6j1?EtU zC{YouavWs>cO*1cU)B;{hD=yHk{gwiN(b4xvz{EdSHY(!1}wT5!&&#)_s;(9?D>dO za?iCZN;egT7@0A~Yai*(T1S}?Z;Qbynh|&Nh{f>;m{1fGmG~Z92Dl=x{Sgvee-xC{ zc#Pp)DrYqSWQ$2?6jzoTY3*3kzXAs~c=8oj;U=gPp5&`I0XE;*5iRb(f{8Y+SGF6> zOx3M*ihB9q(EFp+cVKBdz;u#dLF~nd%~q2oLw0#Bc?q~v8-!8hC7$@Z{=}ZD-JfEh z+O=gdG})Tp6q`bk3GR7{j?b`ANiK_&=Couc#00mV>21#HhhRo-jlNVGp9{@x$FH3s zoh|l1_dA#4&FV-}g8Lx%mB*`#cu5JYB#?ukei!Rs&s^pBS-iAigam{RuUUdh)x|{e z5WOqw#%arBwf{R*F=92Sp)4_$`)rV*6&Zg9hBoBR$*8R8%p4VGKVfthjhe2Ax;OCF zU#`+FJ=n4k%j9s$%9M!Ldh?C89sNRcgd(CJXc}faGDn4kO9hJ9k~b=rB4@G43z`jz zn8s63R7}tUqQ-{fwkbuOMp18LQKNiO5e>^2iZ(4AtA~7*W`F`E%sV^OJJ!UyyV$gq zRyz4Al=(Jqf)lg5_{|FP3k%Bcab^|qYza!aO>FuFK2o5uvRQ{E4`f~-f`Cm;PpT{(i+YWEI z^m2!8q!QMW?`_Tt4e`X9%ev)I7Vs?E$%`{Ew9|(eOVC2hTaWk|0EjjN4`qYwJY$tG zUiUPrBvjeA1Oa%=(OKOw%Vtrc+x(Gu#j30}Fkq<@1R4Uj42y zDBL>g0r5~on(gIoFd+p=Z5bmTIxQY^(kIRWN2>e5;^L~1Jm5N=l=Zsvo-{?gnmG$q zip^*)niT?#)Z0h2j8VkqqEWFKb||IxeND@VKkvEa+WDvO3QGaiER5F-yTql(?5`(P)Dgflo_VKH7iN|KozXai)ZZPfWa6Wk>yznG8SS6xEp~X{HkK4{| z&e zQAu1S)I^6%zr^;S(y1d#=_N`b$8|Vjm9UP?&}reGyNPnbcw`47oqj^_kFf6s>2UuM zJQKk0BcR)efX1UwOQZBxLy3S!1$#zRDgw$vG&Bl^H233>a^dL5YRcRJl~m6>?jJdy zhtrwhu0b4o?I+_bT{+Z%o?#v1E9bmJHDtjQq=>S|r4hLtX06iw59BK-HjS zP?i?$Zhtg&FZS18z6?4-V=|VO6I#>oPC!427oxPkz~)22ttWP2)a47MT*{WS`uXi__J*8#fJhgNMQ1v(wny3* zMjATPnO1+#Xng2h=}`!R7mb)oy1`zK2VsIVj;Q@o0;aL6Sw77|; zXqb1Fy(NusmYwg&@*1Hlc+2Q^Z zB0BSXJQDyLWHBjQ0oh){kdBZvsKs2~10CEoMw0!x59V%|NiascnkGM=yu61=I9~Eh z?##MGlYnO|9E1W-Bpg%|NagZa7fn3$CsREKo zMX7YfMV`@_MeoN6o+3DqK=3>O2P@$IQ~^`8G&@xQMv(NlbeH=6W4;=;!o_PCkEJ)s z5MXhIq(}laxo{9jfCj4GZE!g{p~`He4Wr?;vs3es??xQ`?tCC4 z2?XlES)B$~ zrx1+{)d_Gaf_p899ET@LY7FK`oDRs{+AU~Vb!DBwczOxqhZt2!La__EHDI_pg7mFZ zPh#+nN0S9fvAZo;S9^D{e&5jibCPUScjK2m_vN+# z>t4Cb_hf;b`K5W#^M)HJ7nY2@XLVKnxjGYGodPzjg6CQO-a)?C|K35q7t%Rh-nnW! zWVDn}1xH0wpi@qXVhZKxv5itpueMV`&3VE4o5C3%IXK2j+nn!}cV2D7 zLgL4u9v~=Ks)r&vo2@m3rvQ zLK>(H98qjME==u|Lq_C7t?~#wq?2Ww+6j56Oo(m-3DRAuLK>_)@DJSlz zbI-}pXc&a2Sn`cW==lUj1mW-t_UK91q1JcBrWZisiFo$Kn+86x=y(R7m@?S7FtrUi z3Te=L1&f?E>FeNSI<~Pms<~5qxDHM<)8_fWoL8 zSU6em_7juQeG9&7f=fz(ipyZSVA6^>F1=pDJi6e)Q~+WoZ+eW7tfQxX5Y=;qA(;HP zuo);=s=WP+K(SRXFgYr#Vl2-?o_l9#3}c>>2_!;RZ^Z% zQWK0g?US^Y7Mt3^z+>p2&+7RT9^&~f&_a;c=vHDK*NJoPR94%cf5K|Z7_g)zOxJ7v zVAuN?DL~fjd@S&c2gf5ZErxsZ`)wcYN`Tzt@G)rNYix5HTR#l5{drgTY1@v^gl2<$ zI~&X=P%7$9IC={_cG24mra=SAPBxHi_4iueP*Ov$zGLL>0h+wK;08B{MkTLU@_J2FRVyty zp2yI^L{V`LEJvHK;l&~xD2!3xb81bbW+S@N;VH%BhHC>m3@nE9r{o;Aul`HPI37^XiEw{{jQ^tW>ucxT(L!>=d8F892Iee;8xr{6- z%?(CtBz|w%5?ZNii1N&Wdz>{MztLM_;d7g3ig0@tvAL|+Tvlu@D>j!G z+c$i%eU*?Jtu((O-(HDZ3?opU=y(?-7l=K2_!(;udh97Umjb#W)4=W`eayu$NdJb` zs2^ioz~Jep4kK-}iGg{ly@b(8xB9*Hp!gj<_FeQy_&`e1p@BIG6P3UjzM3w3w*vIz zaNPjj!c_H#5Bo_X5`$f!;(A6Bo;8{jLyWp*AnJ!$HdDsL$Lb~ZqCD=s*lYr;;-R(- zoKj5EOQ{T6+^h>tJjH!V2PFe0Rzk|IMTdJ!^o-3&))=jo5fEuPm4RfqYny#Fa~`rX z`6})i*D?-;;NtETDBopdb6h;!nq7%kutt*z=ra^kbTpt}dA`Mw%nIG>Q|7PSgk}DS zZUB}8&NY`ubIE}>cTS7P5-RN+1K)MXxJ2SWp%QZ}C z*85zU3k<2WK;AM&?ZvF6oWLSuVkdZeAauObn7s-^3%o{j3M7w;m$9)grUiCSG6?Gh z&?7Z&mejN0C&TQ8V-+YrpwGGESXOkoVz%nySt)f*fi9J-0z}cI8mu`75W0 zxBz!;P((L_pM!@@)*Xd~$z>*4Us&h~h3 zE@IJ-ewp|?^?N(~qTIOFL8E?tw^~Z;ZaEI3O_Y;w42{comCSE zU%GUFRv4i$Dwr5Z1rrCTz(iCK#i+nIKm`+t3P1wr)}CEEQ+9j1iT^k|ux5<53SiwOdJkP#NQ=pjP+Qj;#m~6s1&*2Y1TYuN2;03HmWJi zj#6hcJ6fGiHWp&+)1*#fc8off*>UPfW=~f`n4O@0wt}*qt^SMI6V<;nJ4yX3vs2Xf zVcSonc{iu2=a^TfdYaj}>Tzc0sjo1*K>a1Ni`1VodxiQ#X0KAe%j~u4e)pP2JEkKtq>pP{d(SO9H1)km50JUQ*md4Zf;nX`+Wo0#(=IoC0#N=~ef0p}%h z<}v46EwKrITOffXU^H= z+{&Cu`$DG*Gq5jO7NzOdx%q3?!oDAeV`buO01>}rlPP#~?PGZg#p)`504Es zdg!pCQ=HU~aHyCbE7-8H=If2hJ-T)ncwR@>JheO1xHyeVyd=*bj2q=6 z?8k$|pXpRC{{j6XCrsef4&?aXy-#ugnzlagK8dXl zGWo;YC)s<0-Cfv&V7gBdMfP*>I|I`L4xcr5m59P zs@eaR`y^DD;+>A)*)W+fE6B&!HvjGWBunY=0edSWzjo*TE(U;NTr9Q9uEstH<=5es z97=1!O?17zO^-dyvUyAUtVT%UQc2}|pPtIre1OT#r}&&U?qFpZu! zT85NYy7`Lr6WV&6Y8MX)*uBTMdHy*tR4~_98-En&hQz=Vi91|u;JNI|#_U5Q58Glb zU8+fiVucCrW(h9W_o@FphZ*Yk*tB%Yqt&TfY5U1UO*@r$Jd3bWrKeZeMfb4J-`1v{`F^A@&Pc;)QaMeT=9`fCi?qvb;*e~>znD)FbAIfCLbFs|%fX}A>0ZoQujg6M0= z1qjnXJW^@nWnspnSD+&C{*$u9XucwkHs9Dh5)fc78tjb5M&=v*LkEH6-I(CKyEcze zXQOm}7V`u6flY^-1kp5YzO#&WAKl3-qD1z@ZY8$bFM|s!U{}9+E;uP7vX3Y!ELIZ{ z6KoCDEmIvKwTo3PoQl9%7kqkUXFNzX&3t2vNj-+}nmblI6V$sNusVu7zLpa(SgH#$SE1j zuSrLpL7ta6#oBux6deT!F<%jz8p*yPK8*8iFIA;#DXWSbyI_7bmX-qnkSIi6U zaNsLCpQD#I7SX=!5gojd9SKs=B-b~i{=Ta;Wd`#H(m&}T`5@WQ)Vl5C1HtlN*i{9* z>9p!YfP!^?wm~LE)Pj5}%^B()MUX0?(g<*^!rN3{N_^!8>+k2NlREepy$eywSFWX8io7efviNxrFdQ= zIsr?sKt0t%bcMlu2O3amegU*$zaF$R7E;UGO^N5gs}`R)z6?#dw76yj>uAJ8bF?Bh z-7`0uSrV%$X*F(IC^kyZI&CHOBR&AQu?+XBzx}#zj0gmV~4W5iXl z;1S)l;b^i(&qxm%A-)R;829(}r7pZ=91l&9qONVisfe~xcMZ0Ce%~;kFYOXbln(aj zu;^$5YLv6~4|lcwEljd_LS5g32VN$w4~1Ebmxt?%@$zu}YI=D%3}y+uc9pjBJYD3P8RN2u`k~6m3jWhR z`oO819Cn0``>;-ch*}@rXvjCXr6Sa*Or|BOk<;M+qHruFeBC$wHWGxel$B31y4 z&V14uuC$fz#qqd4rhNtp0yqSZTkA%65w9fiJ=~=Lqs;(OKCoofkFG*0AxmY4pU&lw zaPmr}^eh?;Tc;7GoSb?Z?M;uWrPJmA9me?X37?A19l*dY1LhF+<|2Cspb%FV$L6A6 z0ARYih@}ghVjDN2(lnz`hQI%p*UNCijzTlhe&l=VBpML4 z%R|<5Vt4I)?o-aJ?y1KifkLf!m-^RDR9DJg{X3k#TaeCBz&cg#!QEl8=_-0Fih}%u zN|{y+DvC~Kz;-8#wHmQYiq!%tm`X6Jc27p8~P9Z-)pz^t1>($UB z)QD827-sNXdk0;=)3bX_e1XV?EIy+lT^m8@q9YZ|;<}>vou_afTlYpwIz&xN#6#Qk z5H;n`-JI>+eS?GuqypGzSLuG(;Dt%k$cB`_WU?^>q}mqhZA!Q+Z&pmpXxpE6+fD~H zkM`U-*!LmZ>0pm)E7$Mxj2sBD-EMQx%|-MPDx$2NS|CWb~Y4vCEf-j@pl za!FRC-5Xm3i*HPhYwkchz9V>%}D1io(MdK7@(2l zSs>?Sa=1IO76sP+|KEQK1IHnb@)FG3B$k4|E(}`#fYIYS8s=`8)A(Kny9#DA%p)*I z;P)e#Ot|;LP6IPG0mcXx?Hw>PVdlduf+>cngLxR{X_x~rM_}H7`6G-9a}`E_?(k@s z=`blUMKJ4N8en$9JPh+V%)i6D4$}qG17lbeB-{pbKTHA4I+zDxz60|^m=|D3H+2fpYb{z-f%(bR1L0Z#k6T-9 zsgvf;zS)oYSl8harqxm|Sr*ozK9%L`Ekf=C8Os0y?5xr?8F}f2g;|AbmMvLQ#QZXr z4}>jWwk&IL(VFFjS(G66fxLWwSl*J1^t?6s=^42T7iVd8&S0=)QUwd^E2S;vR?Dj5 z^4iUoRSZ?D($`DXn=J*_`t_E^M!c?E-q286F4wKEGR4ZsconPAOv_fw@ad`Sg>{V* z5M59%RdKwmK_=A|Go`H(Z;$kbhJ_V^5Zkya7DZ@nRA`a%tLv&Ol7*S`OeT0r z)pZ+8%*VvMVry$F!oMg@M)~@xVbYjZf;2!#2LsJu>C-bmoBLyK>0D6cTBx0W|nnX1a`Drzm(aKcAXR(gJJQBlE~g^P=_ zmSv}BWUVRAT2{Dl$>M~Bd$sVwjAdC_iwkp?6cr8^ZI&;eWm)-4in0oemMlxp$r>i+ ztOQ>7#TIExy>%lXV+dd{q!$znn>i4~!inYzi_(XMVAd?2Z+^M7zAC?*GA^`O(VKu^ zssr_*fUtywWbT)3MPI3COqi9(zn3>!tO>K`GQ2m&t|x+FX*nGy%tBuDx3X{zHE(wM z!n`sQi-6BH3+t+-xVuc1<<+&83bRSBD_>V@!GHoXSdZ>zDmPi>x;ko&YNFY?^%hfo zB~L!xRBuH%MXWV7vL4TR4)xfX;a{!10XQ0&a~Utp57Af7XItZ%JP>YveT5A8d3AU- z$}8r9n6>^u{U;OshpG*nurf=m7$bcF=uR2+n>JxEBAneE&L}f$>v~IrR9#=Uu&%Pc zq*|)FU#_mLK!>G~l5lmuM!Ei6w>3(ZO;l*O;0s&BGWW&c01XZUEHn;e3PaMspQWXc zp<$n2nZbDviuc8pLK%7W^+cW~xnZDFR{KWcMpLD=ep4U?P!|=l>#gf4%{pH%-UQs! z*ab?`#_&d83$Z?}4P-aRXGk!mVt8foh|+Q}@c`c#>1fCmXyE-y^j%kP!brO?(^Oe6 z*Hz36&qCu_tR`*zhTB9_8m|z;F(dK@Su#;rB{~VO=fHSv!Zat9qiU!s#aUl(wOZCo zS~1mirfv1IRm-)$7E>fhn$uMV5`xZnpJ!d3`%~SxXQ5OsVKC6fi2?rv3>`uj)&qO6 zPGD<=lmYkl0Qc)~Kf92}SzfoXu6|3M$>Jkk;H?YceF$HNK^CM-T^>{|2&DWqaFqkr zfM5#w_ISdz@6Rg8LY*K9)xsvhBA8&T_*V~OVo^p4j0}V#Ax~H$6yjfC93EOIEEEKgyA(s76SgFcWbW zvRZPeH^H}&eN)VhfQ`d0pY0O7M7=4MRQF&K$*C>5s_{yUH|lfjga90(IL zS?dx(`P%zle|y&<2Wn>v;t{qspspsA(15h-S*yhBEhYuzn-iE6|#Snbo zDaD27)+k&!&FY)F!3@mT%f1y0; zNz_OGE9K4cm)8KAi?mEC*@>`s4MO zHH3}`8p?^r0Y0|SI7Kuw+*lu&&j9@pd^hK_30S64j%r@T@L$fxE-2m|AFCEBH);f6*HnoAq-O>P>+X?CKS zj$?*q4?eo{G(=qkxFC8U-bvLR>1G3LBWz+tAGtlYN5eiaCEZMmnia5dfml!{r<*6h-U@pn>^RuCzy|5Ubn_J0CfFv}M<%A5Z-;&I zwsiAW*au*5gZ&8X2VpnBCTYwn*uaOER;BT>P5{9Bjfbt?1~lLi;xzHOkli(a2RHkk2;lpTI)y zVgC0pKT2BwU;0be>`XvIV;!v%Y3)mYivcIC3j_U@uraRQAFB}Iv_1`tm5vstenj&Q z{Vjr<)^9#HjdS#u&f1yQV+147!+MM!*lQu2D1<1VWSeKua+i1N=%*eg$%% z^{Fpq5n=^?=L4^_YWC$@i15MRR5rmx&ACgQw+pgSS;r-r#Rxug@cZ z&m}hkFz~uq9^iMeh6KN>nzdoMbvx>zK2!T#~I7V2j)zJPcF;s^*Af`WDWkkBy0i13KWk)uT8 z=v&4_jU9Ju^!VE*Oq?`%is|+{rpClhyEE>tyW^+Nn0XKQNQtxO%)Kuud7e2Xb^e01 z^!qb1v$At?7cK%rb@7sdrC@X|FD_Y8`n8p-%2uygTfT06g{5*sRdvnA+D&!!4PUo5 zO7i9{Tem&9v>#=`XHMuC3)xy0IRLqdS}(>q3RlV52@OD=UQl z<|LpmQe;z7!HO`0a9=_~NdfN5n@ltn2!^#)Yw?FcykRT;42U6w2?hf!1OCw``wPM4 zaER`*KU_y`)obqW1h`#r`{F+u;C?K?y(hr^tpNAq0q$=HxalnxU!Dg8+_cB0ISlzR zjW#Cmp&Du};K40fS3?|yJldYuTkk};DWkT$vC))U4ctF?R^5(WAVL^qX7rZ~Y=w5`E1B$Ks1#vXVA>%rOp8>hmw0i;=Rr?7TYd0qJi zaEUhqFmM6a*Eehuc*9WvhkPZ)kWx=-T>Cb=4;DWNRC%H&DC#av-{?vus&e1~_=z zZmyIVyEm}q{KX88gEn7QRJ4$Ao0Ti9l`ABZ)q(+v_+ALR2|NC5ga91+@I7p$1L6&f zzJTyRcn9NmbG22H%WF*))r|uv!fDtrbT}LkK3W|X0IIv6-iJ$#@J8Uh+{#f-9KnH% zG`h4@mgCfIP+u89l|O&hWW%NB7#x)AT97|$1cGl+pVc}m`Ag{E^_3ik%|sh$v(4*R z>yzhNjS|ScIu-9$!AyfmNl6vv&rcO%;l2lE224E6-7wp?BhEC~lm=!eOdQ7U>9CQ6 ztu&DwYg6!NVW8_%m@)ru0ZFjRg_{h1;_-1e3loI;2JNsC-$bXkBYi5&?f6bXM)R?J z)##bgGQ5Q~Yj9{$TfLzU^V^y=RvHbeam)mFgJhjM8@8o69L#o@ zBADqg0?fs`fg_lwVH#jEVd7v2e^Ib|@v_uKm=iDuV6cJE_6a4`brtnnh+$3)Z1~fu z7@s)lkjA=+1(cxO5Jm^x+9_^*gWSOU_&3i+$j8Yp=C}Lnx0VRYv09{^&Cop!y-7iD zRS+%wzx-#y&S~(!IPf+2zrp^)f8}C@_eKAjgq!~jj=x(N_(v~?e3gHJIXol`{0jzO z;j8@fr8oV*-1J)AZ*JGB|JxK0wA=qL=qvvDT9E9Af(HHt2Yt1FzVtWO{y*#UWj%mO zio!o%iS#w#HVR*{!dkSU@xNMa2Vxn80XKIAVV5Qdw%rfen;Z{+v)S3AJmPxvu|3~< z{M&n<_|CsQ`P6s6_w+O0|G~5Sez^a+=YRC$13&rc&tCZXzyIRJ|M=yvUOIT_@R65a z`Sov(9(%R5?Rfi%-*$AKJaziD*MIlM@6Vh)_vTxFc>A66@BZ<<3-ABwgRT$%{FjS= z{pe%W{Ws60zyITt?#utY((|vY*LtsidZX_%C?@*vZfHM$!}^srwExrf|DP`Zzm5Md zV<>!nIAbXMPuD-xW_#GS+XjY(?qS=*580wZLcpR!BqZ1hY|Y?4#NC-xP+|i= z0!)j7f@X9ZQ=F~YhExLB7FAVM21D4^hK4N-4TJa<8Q|6}hFK0yRt)0OUoN-)OTTn` z%?4gB@jsRoW)_wuey8gD|6G#$!)M(u&-urxx2Z#0=B-*sVl9oe zqDfS5&6euA#Cv&+RgKp5T7>e3>Q&3IW5p_Yz-MMd1?2Yv|0367Z98vZ?L@r%r}2FN z=7i=?aoE6uFfaZneHsjxc^uI4^ObW1-zQ*v4#|(=4VPbFTFQ@TBC!3*uNi530?MFz>OuFBFuriI=`Rr0z%&#VgZ`4D zrJ-+vClB8%V0?I_IK$yFFde0R=K(?ZFc0S`*f_U>!C3G+K{yiunP`~FkwL<0n4K`q zFrW8lgp4qSok95o%LUlIFyu%5hHPJbBH^};=J9>~CNQiM@;_;mK>K^wgnRJ#qfejh z3nPfgM9oh(-vN0bDmw;l@|z7Cmj93ZD1BE1k4xXRL*n=%`{D|bJP!kG@*4x2${|{N z@(a>Z91OEU?-#@&SQ51SleGLZU{f6y!=~_J&2E5Ac@hjJTv&j0(;tP=UmR$RY)Vfy z;rrbjj_x;b|9JV}@H0d5{|3%4DPAh<92j4{0^yjt0dn^+X%tcW3#t0@{t%Ns&>v>Q zO|+2-+m{E~K6>$$`_d5jQmZ+9KSz0oV0`fc>lw2VXRt7opD#QR{-X$M)51T%IW5KO z0USi*!u%4aECZfIBeW$<1lz*I_9B zaP^4Zl4hO=6Byn)1Yd_A92`Ehy-(~K96pquf4rNAQyGnL``{Rw&+V?k`2@BHr44(0 zaQM)2-hE9pP}`<_9fvt9}P}F6whn_@x|eP6|h#z^7TSN z_z~{$7@_zoFTn33_zCcP1oxYKe|p?gN*g`!?ei!5|KFwh-*cBLD_G;?rdL#egOBt0 zR2_-)=T)!60q3@?t?A(X5B32ocY`h;XDQY9Z<8!V5W}yqWK@+~g>^yfE)!2FjG>(Q zt$=JuZ!d;yHS!ue;G4^CmB8=eAjBlue|Y3o*CE<_0cwzYd;KvYl^FrtnDFrl3$bWis*2q+=~0xGTn5Qd-#NHC%TV!|x0X$`2DQBg61 zYh1-Fii*k_am_2b=4JJr>X{*}-n;+(_x|s`_dEL0-Bs1qRp*>Kb*igQwKKd8c7fSA zt?pjzwwMm)B3)uaEB%6!jlE;F(S~I#GvM><39ydbRXa2>+)tdbfoJxU!g81|KB1SJ zua}!AMd}=)a3f!BxcJCk+OgOObk!$O8#h*5JtI;l2!){sLIM=v?Aj09I}G=?l=wwx zqoUl#XhRYcp!|OBZk~qBcNqHyN5*R_d>UYNl+-sNs&6!m@Io;oL@D&X+$}B+oXD^X zM(*0+SaC5Ac1ApR78maPin*ax{Vw235ebtfelRaAt|VuSJ+&}?{8RW(BDE7?t$cKX zzc{xn`a7A3ehG+ESSWh3UqYy!$e48{&kURd8Td)+9~G}F0(KIe!%ez1MFr@pVzto; zbR`!1g^}n(1~X;DwV^$uL*m4FR;YDl{<=p(?(v8}RcimV>bz(Y2WAwQ4B*XxByiIa$?vzRD!QZ z8~2PCB`RDS=K~D~hzScB{Izl5YXLB<8hKz+D6RhKF>&32Rxq7y zD0Q4zLLZa?7J<&4U0{)i66Njf)*GGIfxCgTk)dKMgV`A@SZwK4nvbqs#rMY=m>AT7 ze@umrz;2*?zmy!?U@SH#A8;*1Q$^tAB-Rudkbz3z9~m-SPopDZIdyWYuL}t7Sdj*z zlaGHSXqb4BI&g*wRkapK)FqMczFM8gPD4DXBIC=%+;x7FsLt6{u0e@`tn`<3k4lV> zK>2q|3=0EiF&IS}`@-4`6a*s-y`Lnya>g8uJzaVSgSQ}>A%>?%>Uf2&5bq!)43z*S z_K6YQa$r2CYlGmOg1k5TV}2-wTXd**nC=N4C=Y$rkuJcnxmBJCS;EiY-@4BW&Beeb zBzjEu1fSyG63iXKeL7=U4g=#~{ZXcb_cfps?*N==7_)*8T@b($hnwN(B%rYvq_>3k zX)q6*31P8-I{*yA(ZusSG_l+b?g7XE^IRYvjyVvX1Lqe3uq+X~1IIGJVSrB$NDpB$ zKrEck1Nd}@YXA=C$#8Unye~o?cL0`fE(73zOt>xs90pv3avTPfLD@^=CD;k5V-esU z-~+(YTY@!r0g3?60Of%CeiBRu=m=l{ zu7E&55@0R>jcAPEEszv5!Avn&VFjy~>R@$Y{A+>L!|KBfMFXrMW(9Ketc>KI{tfv?Wvx+2f2aiY(4l^F1~j1#^8!n|O;A2Q$4}=rSdkuL41R_N=fRxF9wE9->mFYvK<7TGr+!WP`f5kSBxwC$-6Ap~#FG1gC8v#!kBCXo-&08s zbXJ8ARj6M{Ta?B{XA|i13p6xs(bPoS6?BIU0`z$YR;zA!pw5|JC*PIz2L1YP`k{Bn z0Hnb!o9W&IbrGEV!Fv8cV0BE06Rd%9a;g?rvCjVsaiV~rmfj5}eQMk%w5y19>Q`~v zJ3P+GsjoJ{XO~MkPVjA5at;G=$Hl=0|*6p0yqE)Gf*0( zF`QSWO;k*HWJsVE4T1C&s7|{mZFG1-MD+w!?~h4L2#g5}j0=tq*BUaY8jqIe1xAAH z3k8;?>dJtQx|wx-iNNlu`7?q5#K*7wP&~r7-!}^URSF<^sVbXDFVt-R=)E!edHv#) zx1;GHu$(J@NFEyj46E((@mV2>C{&9XqD2c?cpZLKH7`rEpb z)$4S}lvQ`i(V5f4WbwEW(jQrSW35aV{inYvpL9V^`s41unBG~Reh;L-u%>iPGwi{d zM{5RtJ^zWT#XI^y2h``rkQ*{A@W!wk zAPX=LkOYVV1OR*h?f@r%3V;LJ17v_E084-w00X?Y1AhlV5ugB&4?yX2;Ftwi2uKFR z0tNxx0ZsrFpdFyR9o!E*?Nrj<{41kO=n5RjGgZR_M!x{$&gRxSwJ{Uvcx;tSF z=NH0J>~!=;|I?*MBN$l22S9z(MmRpol!)WIQe6V946bvaFE?CgW=XL3aGT*;3Vv8F zu;-O4jEelkwa_pN51v_p@E5I)_J@(2H|#eND5in_TY;-ogwiL+7$#(}esE79{6(Hz zXdf_i2TJLMb%%5GJ1Bht_5tie3uu4^KnS7^1~V7BA1bD<7Wx1}wDOwLp98j1_Z2 zJ6XYm>=(jhFi+wF<3}0Hjo|Q438~POR|CikJrnIK5eG+8>#9mWU-q zdxfFBAjVdCGNL>xi*C0xRL3|-h5lCV+Jt;W(X(~Cj-cJv(9RS!OQ3r`s&f~y=IAd0 zXK44CKn(3Vg?2fLg7Ts|ApQly zwSk`1&(R(w;3W#rucWad59B}S^u_!-i1g=RG>>FSx9=O;Sp@M4Q6EVc+GPpt_~t66 zB}6_TE*N-F5AO9AYYn>q>-lexMZ;b&u%4kxxzS!rkw8nsekwW{s?LK-3Hoa?gh~gy zKLf2`FISP0Ra*kgEsNU2A7YW5=%`wiN42Fn()ULHXYJL{P7TL@)L#3EZ4pU=VL!h= zmy-NSd;L4)+(T@qhG+ikvWkR20dIpU<-TTX0sRLvsWOn)%DE9vuKF+SLJ-vDa1n5uxUDq%%FTTHQh_}c4TsXR-*M}Am-T7E@-M;@a{Qmj&xDn==b}hQ-HMyFPnnpr9p_|ZC=qpSR<_U|1!@_ByRQMo(IAdiJ z*h>JH<34yQJ`JCRAH+}LFYy^f7O{iaPn;mii6*2y=}Pt@`;yUQ8u>lBiabhQBX5zV z(li7pQa957ZW13*dnVH;^03MR2pZHQaXY z0C$4B!QJ7?xDVVXt}buQH|6d5t~|{<^B%l6AHaw4WBEz^RDKqp!7t%6`Stu^{xo02 zU+3@f5Bb;pAH0#qOk<-VG_1x|6$s3g_>oWOwD>tj^;KCG+~vnNw_II5#9;VVPde%1+&1daT#uhcfz~l zeR22#51xjn_!fLOegVG;^7;mENVFxo5$=R9F@Q)XBxD1S1B&z|hmcw_h8#<# zkh94pAPpPH?c{#)6nT&QNYPOV5y3!+*001-csI0PRliNH+gS) zKlvbem^@0JAWxOAlJACg^hExfJXNtwu|bieIG{MMxU9ILc&2y-vSFrdt|XMc$|1@) z}j@;y~93ZKd>#-UDdqW z7yRH-)w{t#`B6uhFF!X5O)NX2NyT*Vf}J5d50m6TGYT&moyEC&9!QFT!%K_|GVyg@4r zQE64vROO%t8Z&Je2Zmu>7+ zqfS&$RHv(tsn4p5)izv9t|J%Djo?zamE0@tEVSikd@aoo%~Z`X%{geB^#mtqk-(f} z-FWUgUXIryIuc`vqeKyrOa4fnA!|eHX+gE6=F6AJhbR(3jxnXF5?3ZFla%wJ{P&a= zDmy59xN5O#lj@r4qY7he7&-GD6UA7mIrTvGIQ13vAL>?6mLM*cTgGkS_Hl=}3*24q z7tW3E!w=Fp32wqR;i-TGHw}togvWuT90cAL5%-9vz}XHYO=`&gWH6Zk@^b;Cr!h5+ z%A%fAgFs%&=yJNgytSN@yUIP~A@U?B>uUK1kweGjPvzDMI|ZYdq9{_>Dr1$DDp+-0 z^&3!_XHwNO)RQ@T-jyE)y6!q?In+6ZLK$ikpNS0WDrH2srE4hyRUuHr;i?!_ylS*+ zyedz1PUXwQGfB)^CWqP09AjQF9~fiShV2ac*@+Edhe5kt4DEJ3yPy3TTF^-KeDy%C z2>8&1$8ykE3;ZkT+VnB*5?2SbabG?N$}k@EZ+D@;5GZJcVM44>BHTm#ISfl0K}TZH zpC{nSVw>KLAHaRccrqDU^+Iwvxsfa+uai&7GV%@RygH(k_keycgE~iDqOMc7s0Y*& z>OD1p9!f_5#jHSswF3>t$UQ*D1LQ;H5%M_s7?ALpAm2ZLRj^IIU;bKNPtjh{5&A5p zDqZzNWy{cD2Ox>`WPF&h%qr#}bDSvviM+@ZfzB#n?l2vpkD^%>%dufo8Y3``mBbd+5ugd^5f^&+)7It-PH^01G2lGf|VKN!O?Z zUho!12r0re0lTPsk6 z3Dg#9KXnvjz?$}<6X{fXGiZrYx((3kqHK#75zKXFDdr~gocYW&VB4~Cwg)?aWr6x>>Y3^c^%5v=ruvln1y~H$TocZg zlX301_FQKU=f-i#K=4 zYGj&rn)aIGLLv0)P(HBuW8tqE?h3t71A->H6MYCRIhnMh2x=3xo9aj_=n-@}y`4TU z=MRLHwm=K z4lbWN%>Be6pB{I3o<9*l3?hPvC?b|vPGo}3xDhyMsLyy&t>P*oTN4bI};ZF^sLa8V!fl|>N z?L@oM?t-V_Blrse!XP0?2nF351#LJ%7y~v>GFUy+g;`+hE)yhtd9c7F$~;YY$Vp-gx!ycf#BE|y>cq7IPaX1F5@?S!d^*_F^S~}xf-lE2 z@hp5Jo(&d4F1`=X#}DJj@dDhPfbaOSW^5Weon68%XEWK2>|ypewBl!M87ozrfp2|# zwF>mRr`kvD50(LH&GSH-vcLk}r_Ki}p+x;mU8cr3DQCu6f>fzEj`QSvIDakx+V&Vx zww6Py&f+$5Ia~o(%$0D@z&^!zDQ^zaM)NA(o%iH@z&4EqIYa$dF@FbibUAMc(&no1 z(F8zSPtq(0s~}smPg9~P2W!(@uoi5=;>3X$p}>IzJ@sb+%{KzQb<{2Z8ox(!>Lfwk zAJzn@7XTDmBGRE4e-E#oq=YRYBXGhWlN;V-?Fct|S zqhKU5oy-DFTtGe|%|Kpo%7==j=21D+MHq3I)0SXw_|SvsG4v98AJ~-d(QA+(2@*Nb z?NZ=sd*EIW@S_ZW4J9ZS%V0*B6P8et_F(r$5YwR)8;N$bibd3i?|7@-^*jgwF4WYn z$T*5b%z<+?H3Kbj(us5B z+$;Dw2sj!FV~r^2;S+$jNfp{-9%$|*pr_6FCZIo5{2)Gpj{<%s@MHKSKABJBr^ATj zFpL)pG-ovzVbo9ze7vJ6)re9Li*eAKRULh*%KevR9wq$t`$mCp6!=DgZxr}Ofo~M} zMuBe>_(p;MzbH`F9O`RigyE^pZ<*HaIMsdXI}1rIqs-Li7a-`2kwik&#cP|IbgE}; z)XW6KBTVabGL=XrsY)Y>H1j(c2T@f*>f?6C;6o}~(=yo>rt#4~Z~zlWWjF zymgg4rPgyV{kS;y%#^Sr^?v_db+q3TB5Y)%%+$sic&hO#Jk@AgrZH?SX=FKe&AKTc z3T?VsUEim9yJz-u+@hky5)&w!pIB7mzEV>wqrQGbW8B6RF6vm->!*#2^n*R2JIlbs zzYEa`?|>qVt=bqOWXMlj298}Lz^xs=o(dn{j08VRnTs>tvatn0!UPim!)Ew>hc4mc z2k;->hcVybL#scu1>RiuP;0-j;5we54S}8e<6^7|vR+yGg>M_Z zy^j$vT(UOhKAv(1H;1~lu#!kVOO0S<28FI#Nju{m@%EYaneC>wiAYF@WxI9_iHqt2 zA2yAI9qFUHgv5;Knh+oF7!uqC!tqAvCOedcIbO%q3}ns3q?WN6P8-f85@~zf9&cy3 z#wAmm=<|&UiI1(8F)gFBXY{lWdZ>L8zpdo5>fE9J3u3A=0p!g%RRVjoE!pg_cg$|H-KXM4?7e-s z-jen5QOUwFW>&}-(FH!<3? z;kDN!C;2|AXMA<|xDzH#o)u(wORCj*18){qf<6CZVT<@zaZ56GG`KqV#hfSEuNU<( zzc~9g;p;tQ`-BZ1iNAQA@3g8zr-v5?uQHw(?J&OW)}bB3wl8?p`TW7gP(#96-0?j7;3xBEQzl%=n-b>Q zbnvQ-r>O@*R$fjD{#?-fdfR|W_}Z}5jQx-W$G9^}^5dJevrDeztbJ^!=zA^YBQ(+D z07rcj?Qy8-_qS*Jc6WJqbA-DEkyV3ac*@Kw&E-31!UnfO95Ayo?++VfXyc+~F2S){ z!WwUgf@@jTbxn*L8VsARL`7*0?5bmB>K_q2Izdb58(Uo~Yh8fMMH`n883tR9h>fk4 z$WLhJjr7r|sevoCu9557HV!QrUWZk*ZFET)+V;Oip`=RMRHX`P&8d?5pnxTHjF3ca zI=wUN>^a%?IumAOPfIMz^?G^xNc}_M!3Wod+TO_faGKhZhR+C?IP2!{pA{?XA1Zt{ z=GEx+6JxkT8QU!mM7)k#c>18P;}&=R&7LcR1DhMI`q*`N%dB^6m#uGBV03qqr|6QC+@enC7jH?J?&uNxM4&WdPtgN6Y?Q#lfja;hr- zks<*#?lJtslYpbHw#1CFOFJz(l$tHMYU_C}Cp{qgwpoX@Lkdo3SUr^bTD<7t&=phV zl%C4)T2|C%sLeY;+1fjnNPam}HEq|UM~ksf7y2&pYIkXqgV(ridxM>S>v;a*sp~_2 z&g(QqvwOwv>v#Kq{xSEbiEl2LuPj^qsncb(Z}a9Vhj)Spo+`Zz?Kn^0j+@*lTxmby zQJzQZfOBVut37Iz7*9D}r5*pHzEsmFc>}%uTD@ZcEA2tCT0g_4US`qC-I><;I zSI7)0b=@^|f!)!kr4th(V&Y(joKRUJd^sj2I%+K8hP$A9jjcGtE&8wAP%@vyp;7Qv z7@xSv5wKZ8b;Tfa*5#Ej7Im+3)Wzcpf&kGlr~yiWD+z@`4g9aF>_1aK+uNC$br>gK z8DzfsVK22;Nm4%NW}DaP&ZiDWANrfE4V_}+@aE;#0%FGCHjg@PUf*rk-1qzY?%lDs z*RD@JTUVk3A)C>wb6&5pd$rwmL3on~uT7;d z=It-VN`Gc|H~nmM;5GN_otaOSGoQV_mi_8&8NdDK#Q9Xy7Pd}j652IwopIgzQ+7w+ zlXI^~dzQ`)=`o#)oP6d}kAs~idjItOwt6dy3SAC|$KSU$oA^Lj6~B+Fb78PRPg|7! ztKTC#8@>A3iKlGG>!Zdj+A}7&F({Ji_5`%{5e6$nVlEBF16L2u9EcBqbyR&D)dsl> z*LDq$3Y!*m@L zFNUFe=xPnPVDm9a_&VHuR^5i^Ck3)Sei){p#8F+ERQFjxoQ5hozcy#nN3|U zIgc}m^a$_{Iz2IUSY4ydc8!_cHzz$z({}tm{ovGFLsA+|cCyM489Y?fpWl{I| zgNM!Ro8EohAjWd{_vH_}nUFWnujn(R{hpOmE)RUMZi1Ur+?>7jhSxLwoszqc+_%DE z=5cMH#ne&DUB|use$d;&FnyBczo&^1G3Zq{k0~nu$$^EBI={+paCPJJkYRYLi2$n2 z!C;)HtJ4Yb4r#D_#~8CaNv?z7}G1JXpb_ zM~|+~=(yNm8R$TmMCyWf*6B67Kj}5J-IWZD4bV7+gi%T57=(h?e+)73!k8W|p$0H0BU52fqAG)95m z>>U{r7ZV>7mLT(kKcj==v@&r&F46RojUo;C8SC={`{p0pJsaNlO7#tl-r=x`Gc})m zz22iX+UcE!20ZF8A!Kr6`}|cF`OoRvu9KD@BJu~j2VQs_ImO|5`Wm;pmXdi}4#p&u zVfpDBXC5j}`a=^XOBrGFQ)E(pI`ugGMK{g(jE@aNT25L})@s=y`5^4=d^Xp{Q0;23O+pOe&L@+SOpn#D`FhNG2TrG{SQ6bJ0bKmW(UP zK_=y4bpvBsH)yK6Wa@i2Nv+1lXsBjTX-1Mpw*N?0Ma#X0J!FiJG~5p3G%X(T7sqL8 z!(F)17itq68C<=kRH=!+^bK(FwXUFlbd{Z_C-` zbpGX4Matxi;tf0PTmCj=YD#ZDFS0!9x!;O$OMBNj)cIik-d&ypUhHw7)O6k3Wj~%g zaI_yA@kW{=YdRn@WVADt^R9OsN_ZZCT9Q|ZEySNlp%V)hHu}Wwemlph{c*qMw};Z7TNb|lE~EXF2cC_+CJy`~ zD`V-T+vi?nCBArJ^R~ys_f6x9yU@+n=Wg(vcree~obUe1XGUTaBRqW+2_6t=zj=yS9_iOVDopn6;jQf7c)_xm9 z>tCNW|9IY6^9NhUWwx1gyNAldF{*IV$Yx2;VmIw5^DeD#?)TAV$ftxQJ=;x5vA3OX z-6O{{WLDm4y6A-4Ba12a@x~W7%?ce+GIGH$ZYDuC1Nt!K0oKDm6=gjiI~+cH5cg2o z#Z5=>yQGAA0iP0^hY071q#x!sU$pWkzfoxe zmv5c_G5dMOfx!i>{f?&kg=}wV;WMp4bKc)~QF`a){DNj?%S^hQ%vk3>|1yzkya(PB z>@<={@RU>kLk(sl%N{ic0+mx7nNE1qig|_F#)NqlQ$dQit&EZq@SZrjW!mS~O%s0} zvc1ij1qCfPo{5;at7?}BulJ;>5=;|#KoLZQ9QXYACaB|6$7Hh;ja#mhZ@Dsh;r2J{ z9$*Kb*R4IwdR9;eA|(IDv_Qq}i@`g)eK-Gy#*wXLZ{pYZCdfZK4Z{43n&scm)@&{D z>KC29?vE8)8@Jp?zdqH;bWp9{V+z}KJuv?FE4y~t=A?`t z(DrV$(aQteg0+uk*J*adEXA(H_{rF{Q+qFWHl0&2qL_{Nw9K!T{L;&99WHM8(B3Aa zV@52@7PRPTcfFp;Rqc#YRfOPD%lod`o{=^^4;0^Mc$3P~7!!3XE^0||+lq_YCPaPRln=ZZCU7|kQ$96iV3b9dZhzzz zv>mjwyUqFN+|IX$+w7?+11ZUNeM;h*jAPz~e7aWu*g>7Ph zy}=>xA6~sYt(~*ojWdI`*Irac_p|d{xcGv@d&Tn;D*yU3mULL^mg*E``$PJ}haXCIMV)TwGWV=* HUh}^IMEwD^ diff --git a/regamedll/lib/steam_api.lib b/regamedll/lib/steam_api.lib deleted file mode 100644 index 2d77e960e80078c3a5bd4109e3f5e422eb3b87fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15118 zcmcgzJ#1XZ5gt-eEHjctOZ1<9kAI>lQ51jfj+7z@5>K&3n4%dTsWb*oC*GrY5P3)3 zJ;t_RAb<-aMQXuC>^3e8!<7rUapB4^5CJieRzO_1P^rp=o!Q;@c6aveF7Np!FQxfpGGu}Po#m51mzwB zFzUzlG8(=sXyjY$C(>v!qA&4@bOv=f-Nq-<;0F=);S=e6cSIpR89fy=_5%Q?8a|OO zKg99+PSC^=07m23PDU58Z=62CC(`&Af+l`OJ*3I^1x;@NFq(QMDE~H&9nv(82cwA( z1x@~h`bbj`7*#6sx0c>oUa8#pL%Fm(zqIn!a-|&x)vZc(yAGAg;_AXeQU(4Zb%e&s z&DF&>D>tsMT!%`T6~DeTUnvLSO6$E+HC)>$RW~>9R@d&gvC8_^c4apuUPo!O9yCHy zB4%;n$u>qi~WZN{97LDqj^GF1^KCy;Z$mZ`>mggl}q=gVvve7Ohk( zAjJY7TVD>VAysExh`3zq`t~+e5DYF`48nJstwa-bHrHDYwwhs34x6p&y@2$_kZ|qt zS}O<|?Tx0{K}u=X!T9rSUcvHCqhU_6P0W=msBJf8Ln7PeEWj|RP?ZVp)!Sjvijl||^KuCV zS$4J2N(hY=XH${om$lN%L3?MDu0In!R*~gt<+0e?f>?>yQHdKc-@p-AudW5J?=;q^ z{Wx_*4bq6%gqL<&Ez^l8Gb0+Z4_E>JKHq4E=(m=t;YMN#tU3}|H(!G(Uv*7Ws32V)F8i|5RAa$`-bFH9yf4f>MwW{rno7F~b z({QuQ2%LJdra!gnVQ{P7sNdMx+DMSP3>M~TU5xm`ZuauK|ErdtuwTGb+)0G96Y70@9&D6*kMhPfuL`% z);8%1M%mU&oZrm4mgN7WElg)1=rehc179sl>MUQgg>R#_wY&J5xj* zqywn)eIDRle16t1Vz+057?WKFcrpy|BgQz7&H`-W^9nvcy@W9i(nkXTk8@Zrmbr_1 z-y&vl6yQsw#~3r-M*0Bj=|k#1kKrlOQ=}ip0BT4NvHtI{ZAT`sUX1gGE&_al^aXzZ z8F}wd0&GkJJevY|8{78;zki7QpOF6mc_H@s6r6@5a1>6$2%LdFcnw~G9J~y}Fa*DW zemDlN!T=1yLD&yxVHD267@UXaU>qi38YW>1F2ZHVLjisdS6~K;a0zCi7oLY6I0P@i zVR#XK3%`Q{Z~~6QOV9<~|98v_un$bn;X0E@zHl(ywAi*R`NC=Fd|`h2X-Z19Et6HE zyoS;+&goJRpA^{|B4gyr zK9`AVd6db&k_ej|JZvW$eM=?Ex~HZB%kWYK!&}p+UHP@BIf|i0#)_$hq>8!w4$X%` z70|n>xD}ss*W*~DHtSN+s!iqd&APP(rB!LHD@|gV4ozyzg*KX6UL%?bjUx_m7`5@% zC5C&~v;!|@PZMa~g?-geP5La+F_uvvuUI+s)ltd2Ei0KRrn}bfO zSlqO!B%QS(u)A!pl65d}TH~I0!*3&e)`84~VeHT~9pZ1vQJYAj_2eoTxp=3TdKRae zaxt2Ubov@kxh2wM#r8yUo-j)HPF6Hu(3Tt`)f}}wSgTbYDzVbFI^52JDs>o32=_p< zB3eZW=U~VZ*%3|doNi6WI@gK0(KZq?(;8oHFxt>MCeqk!v;rift??5Zk1oSKhcrst zgmksU<${`SRzhw_S{diIM06~E(3wQ>+|sn;JD%~{<|c-PyWIm8CMKgB!8<(*UHjls z`>%gI+=Y=HMo9SS8m|R+ckT_9#VbGwzx*wJiJsS>cW%61tA^DfjIG3{4Chjee1=)`}sG51J~A?Tie*);~)PWe)%N^ zWM$ZgHLx4vZeIi7P2Pw(yn_sBU(Crf9b|yiDJTx(53oPcht&=kSgKDq+{Tx^zt-y^ zo$kP5rV7!;agJF`H@BFtuxX;nc8jU0e(-Oa#b9JEKFnhN5x+!FW-+YZ|A8fRGP@@c z+Idx)dfaC9aT6=;-w5CvH_uALY>fCYgJdgB|7a@>vmfHa^!^pUM9)1Q-%iF9Gfci) z=Cq@lzZAJIv_{~|bfJs+FgA6}iz)ZacVkjLq_%w@S{Fg%=lG0h1^L?z+BZy&q19mD z%JGf7JWW_SNgC0?`u3sjv!hx%n-;Yg?T;YRurMQT(a}>(YZmt59THgiPVdTL-pWn6aZ{lAY(GmCqpOdIFQ)ri-4@ zK1lkU$hKxh_So1V6WP3h&Wc^Ik2PLQVE$j9Y3y|}36T-q=SL1x^fNh1Nt5?L2wwWK}!x*-79i!KVo%f|GtrvTj03w zaT=6@k+)9l%CYOR5bK1*Qfa!ZtF++o2ZM-r(t^kHwxm6j7IcbYkE z!PF9z8IcQ)v*QqsaL$4(QrHxfymewl9?X6Vrp+~_#`Jim0Sl%~xf7uD*5o_E4BBvg zfpzL#&WAqaMYjal>Cru2dDwwYZXdFaeVqO>A~O6r5&r%r_KeC~vCK`GB{=XGP!yWH zWwh`S8?q(LPm5WM|Ix417jO8&z%PTZ~RZBZY-a44IqQgqqo>h=Y>W+c+FunpN vSag6pL3XSN=EsW)IZm7!zj(@q?Te6SG;ICKIvb*Ix17a%ZN+&NPI3PW{%$4i diff --git a/regamedll/msvc/ReGameDLL.vcxproj b/regamedll/msvc/ReGameDLL.vcxproj index d2348f36..5ce82d5f 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj +++ b/regamedll/msvc/ReGameDLL.vcxproj @@ -789,9 +789,12 @@ true true true - true - true - true + + + + + + true @@ -801,10 +804,14 @@ true true true - - + true + + + true + true + true + true - @@ -836,7 +843,6 @@ - Create @@ -858,38 +864,11 @@ Create precompiled.h - + + - - true - true - true - - - - - true - true - true - - - - - true - true - true - - - - - true - true - true - - - true true @@ -1080,12 +1059,11 @@ - - + @@ -1133,18 +1111,15 @@ + - - + + - - - - @@ -1367,7 +1342,7 @@ true - psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -1403,7 +1378,7 @@ true - psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -1439,7 +1414,7 @@ true - psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) mp.def @@ -1481,7 +1456,7 @@ true - psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) mp.def @@ -1511,7 +1486,7 @@ Level3 Full true - REGAMEDLL_SELF;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + REGAMEDLL_SELF;PLAY_GAMEDLL;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreaded @@ -1526,7 +1501,7 @@ true - psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) mp.def @@ -1565,7 +1540,7 @@ true - psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) mp.def @@ -1600,7 +1575,7 @@ true - psapi.lib;ws2_32.lib;$(ProjectDir)../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -1608,7 +1583,8 @@ $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - copy /Y $(ProjectDir)..\lib\steam_api.dll $(OutDir) + + Automatic deployment script @@ -1640,7 +1616,7 @@ true true true - psapi.lib;ws2_32.lib;../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -1680,7 +1656,7 @@ true true true - psapi.lib;ws2_32.lib;../lib/steam_api.lib;%(AdditionalDependencies) + %(AdditionalDependencies) diff --git a/regamedll/msvc/ReGameDLL.vcxproj.filters b/regamedll/msvc/ReGameDLL.vcxproj.filters index 1295749c..da0546da 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj.filters +++ b/regamedll/msvc/ReGameDLL.vcxproj.filters @@ -28,9 +28,6 @@ {d74cb79e-afd5-4215-af0e-029e38925be0} - - {f1a6df08-3b16-4524-b67e-21f6f4e16fa1} - {10ba586f-5f90-4a4b-940c-287810a7e9bc} @@ -105,9 +102,6 @@ dlls - - regamedll - dlls @@ -282,24 +276,6 @@ dlls - - regamedll - - - testsuite - - - testsuite - - - testsuite - - - testsuite - - - hookers - hookers @@ -498,9 +474,6 @@ dlls - - regamedll - dlls @@ -576,6 +549,18 @@ hookers + + hookers + + + regamedll + + + regamedll + + + regamedll + @@ -680,9 +665,6 @@ dlls - - regamedll - dlls @@ -740,27 +722,9 @@ dlls\bot - - regamedll - - - testsuite - - - testsuite - - - testsuite - - - testsuite - dlls - - hookers - pm_shared @@ -923,9 +887,6 @@ engine - - regamedll - public @@ -989,9 +950,6 @@ dlls - - regamedll - dlls @@ -1148,6 +1106,21 @@ hookers + + hookers + + + regamedll + + + regamedll + + + regamedll + + + regamedll + diff --git a/regamedll/pm_shared/pm_debug.cpp b/regamedll/pm_shared/pm_debug.cpp index 782587e3..96e07b84 100644 --- a/regamedll/pm_shared/pm_debug.cpp +++ b/regamedll/pm_shared/pm_debug.cpp @@ -3,7 +3,7 @@ #undef vec3_t // Expand debugging BBOX particle hulls by this many units. -#define BOX_GAP 0.0f +const float BOX_GAP = 0.0f; int PM_boxpnt[6][4] = { @@ -15,7 +15,6 @@ int PM_boxpnt[6][4] = { 7, 6, 4, 5 }, // -Z }; -/* <2d0110> ../cstrike/pm_shared/pm_debug.c:43 */ void PM_ShowClipBox() { #ifdef _DEBUG @@ -49,7 +48,6 @@ void PM_ShowClipBox() #endif // _DEBUG } -/* <2d0012> ../cstrike/pm_shared/pm_debug.c:82 */ void PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert) { float linestep = 2.0f; @@ -75,7 +73,6 @@ void PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float ver } } -/* <2d0197> ../cstrike/pm_shared/pm_debug.c:114 */ void PM_DrawRectangle(vec3_t tl, vec3_t bl, vec3_t tr, vec3_t br, int pcolor, float life) { PM_ParticleLine(tl, bl, pcolor, life, 0); @@ -84,7 +81,6 @@ void PM_DrawRectangle(vec3_t tl, vec3_t bl, vec3_t tr, vec3_t br, int pcolor, fl PM_ParticleLine(tr, tl, pcolor, life, 0); } -/* <2cff57> ../cstrike/pm_shared/pm_debug.c:128 */ void PM_DrawPhysEntBBox(int num, int pcolor, float life) { physent_t *pe; @@ -167,7 +163,6 @@ void PM_DrawPhysEntBBox(int num, int pcolor, float life) } } -/* <2d030c> ../cstrike/pm_shared/pm_debug.c:218 */ void PM_DrawBBox(vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life) { int j; @@ -200,8 +195,6 @@ void PM_DrawBBox(vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life // Shows a particle trail from player to entity in crosshair. // Shows particles at that entities bbox // Tries to shoot a ray out by about 128 units. - -/* <2d03e9> ../cstrike/pm_shared/pm_debug.c:260 */ void PM_ViewEntity() { vec3_t forward, right, up; @@ -241,7 +234,9 @@ void PM_ViewEntity() } // Draw the hull or bbox. +#ifndef REGAMEDLL_FIXES if (trace.ent > 0) +#endif { PM_DrawPhysEntBBox(trace.ent, pcolor, 0.3f); } diff --git a/regamedll/pm_shared/pm_defs.h b/regamedll/pm_shared/pm_defs.h index 4ecbf003..73a1e0e3 100644 --- a/regamedll/pm_shared/pm_defs.h +++ b/regamedll/pm_shared/pm_defs.h @@ -32,6 +32,15 @@ #pragma once #endif +#include "pm_info.h" +#include "pmtrace.h" + +#ifndef USERCMD_H +#include "usercmd.h" +#endif + +#include "const.h" + #define MAX_PHYSENTS 600 // Must have room for all entities in the world. #define MAX_MOVEENTS 64 #define MAX_CLIP_PLANES 5 @@ -45,15 +54,6 @@ #define PM_TRACELINE_PHYSENTSONLY 0 #define PM_TRACELINE_ANYVISIBLE 1 -#include "pm_info.h" -#include "pmtrace.h" - -#ifndef USERCMD_H -#include "usercmd.h" -#endif - -#include "const.h" - typedef struct physent_s { char name[32]; // Name of model, or "player" or "world". diff --git a/regamedll/pm_shared/pm_math.cpp b/regamedll/pm_shared/pm_math.cpp index f677336e..429ff9e8 100644 --- a/regamedll/pm_shared/pm_math.cpp +++ b/regamedll/pm_shared/pm_math.cpp @@ -5,19 +5,17 @@ */ #ifndef HOOK_GAMEDLL -vec3_t vec3_origin = {0, 0, 0}; -int nanmask = 255<<23; +vec3_t vec3_origin = { 0, 0, 0 }; +int nanmask = 255 << 23; -#endif // HOOK_GAMEDLL +#endif -/* <2ce436> ../cstrike/pm_shared/pm_math.c:35 */ float anglemod(float a) { - a = (360.0 / 65536) * ((int)(a *(65536 / 360.0)) & 65535); + a = (360.0 / 65536) * (int(a *(65536 / 360.0)) & 65535); return a; } -/* <2ce461> ../cstrike/pm_shared/pm_math.c:41 */ void AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up) { float sr, sp, sy, cr, cp; @@ -25,17 +23,17 @@ void AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up) float_precision cy; float_precision angle; - angle = (float_precision)(angles[YAW] * (M_PI * 2 / 360)); - sy = sin(angle); - cy = cos(angle); + angle = float_precision(angles[YAW] * (M_PI * 2 / 360)); + sy = Q_sin(angle); + cy = Q_cos(angle); - angle = (float_precision)(angles[PITCH] * (M_PI * 2 / 360)); - sp = sin(angle); - cp = cos(angle); + angle = float_precision(angles[PITCH] * (M_PI * 2 / 360)); + sp = Q_sin(angle); + cp = Q_cos(angle); - angle = (float_precision)(angles[ROLL] * (M_PI * 2 / 360)); - sr = sin(angle); - cr = cos(angle); + angle = float_precision(angles[ROLL] * (M_PI * 2 / 360)); + sr = Q_sin(angle); + cr = Q_cos(angle); if (forward) { @@ -57,21 +55,20 @@ void AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up) } } -/* <2ce521> ../cstrike/pm_shared/pm_math.c:76 */ void AngleVectorsTranspose(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up) { float angle; float sr, sp, sy, cr, cp, cy; angle = angles[YAW] * (M_PI * 2 / 360); - sy = sin(angle); - cy = cos(angle); + sy = Q_sin(angle); + cy = Q_cos(angle); angle = angles[PITCH] * (M_PI * 2 / 360); - sp = sin(angle); - cp = cos(angle); + sp = Q_sin(angle); + cp = Q_cos(angle); angle = angles[ROLL] * (M_PI * 2 / 360); - sr = sin(angle); - cr = cos(angle); + sr = Q_sin(angle); + cr = Q_cos(angle); if (forward) { @@ -93,23 +90,22 @@ void AngleVectorsTranspose(const vec_t *angles, vec_t *forward, vec_t *right, ve } } -/* <2ce5d0> ../cstrike/pm_shared/pm_math.c:112 */ void AngleMatrix(const vec_t *angles, float (*matrix)[4]) { float_precision angle; float_precision sr, sp, sy, cr, cp, cy; - angle = (float_precision)(angles[ROLL] * (M_PI * 2 / 360)); - sy = sin(angle); - cy = cos(angle); + angle = float_precision(angles[ROLL] * (M_PI * 2 / 360)); + sy = Q_sin(angle); + cy = Q_cos(angle); - angle = (float_precision)(angles[YAW] * (M_PI * 2 / 360)); - sp = sin(angle); - cp = cos(angle); + angle = float_precision(angles[YAW] * (M_PI * 2 / 360)); + sp = Q_sin(angle); + cp = Q_cos(angle); - angle = (float_precision)(angles[PITCH] * (M_PI * 2 / 360)); - sr = sin(angle); - cr = cos(angle); + angle = float_precision(angles[PITCH] * (M_PI * 2 / 360)); + sr = Q_sin(angle); + cr = Q_cos(angle); matrix[0][0] = cr * cp; matrix[1][0] = cr * sp; @@ -128,21 +124,20 @@ void AngleMatrix(const vec_t *angles, float (*matrix)[4]) matrix[2][3] = 0.0f; } -/* <2ce67b> ../cstrike/pm_shared/pm_math.c:142 */ void AngleIMatrix(const vec_t *angles, float (*matrix)[4]) { float angle; float sr, sp, sy, cr, cp, cy; angle = angles[YAW] * (M_PI * 2 / 360); - sy = sin(angle); - cy = cos(angle); + sy = Q_sin(angle); + cy = Q_cos(angle); angle = angles[PITCH] * (M_PI * 2 / 360); - sp = sin(angle); - cp = cos(angle); + sp = Q_sin(angle); + cp = Q_cos(angle); angle = angles[ROLL] * (M_PI * 2 / 360); - sr = sin(angle); - cr = cos(angle); + sr = Q_sin(angle); + cr = Q_cos(angle); // matrix = (YAW * PITCH) * ROLL matrix[0][0] = cp * cy; @@ -159,7 +154,6 @@ void AngleIMatrix(const vec_t *angles, float (*matrix)[4]) matrix[2][3] = 0.0; } -/* <2ce710> ../cstrike/pm_shared/pm_math.c:172 */ void NormalizeAngles(float *angles) { int i; @@ -180,8 +174,6 @@ void NormalizeAngles(float *angles) // Interpolate Euler angles. // FIXME: Use Quaternions to avoid discontinuities // Frac is 0.0 to 1.0 (i.e., should probably be clamped, but doesn't have to be) - -/* <2ce75f> ../cstrike/pm_shared/pm_math.c:198 */ void InterpolateAngles(float *start, float *end, float *output, float frac) { int i; @@ -212,7 +204,6 @@ void InterpolateAngles(float *start, float *end, float *output, float frac) NormalizeAngles(output); } -/* <2ce893> ../cstrike/pm_shared/pm_math.c:235 */ float AngleBetweenVectors(const vec_t *v1, const vec_t *v2) { float angle; @@ -222,25 +213,22 @@ float AngleBetweenVectors(const vec_t *v1, const vec_t *v2) if (!l1 || !l2) return 0.0f; - angle = acos(DotProduct(v1, v2)) / (l1 * l2); + angle = Q_acos(DotProduct(v1, v2)) / (l1 * l2); angle = (angle * 180.0f) / M_PI; return angle; } -/* <2ce953> ../cstrike/pm_shared/pm_math.c:251 */ void VectorTransform(const vec_t *in1, float (*in2)[4], vec_t *out) { - out[0] = _DotProduct(in1, in2[0]) + in2[0][3]; - out[1] = _DotProduct(in1, in2[1]) + in2[1][3]; - out[2] = _DotProduct(in1, in2[2]) + in2[2][3]; + out[0] = DotProduct(in1, in2[0]) + in2[0][3]; + out[1] = DotProduct(in1, in2[1]) + in2[1][3]; + out[2] = DotProduct(in1, in2[2]) + in2[2][3]; } -/* <2ce996> ../cstrike/pm_shared/pm_math.c:259 */ int VectorCompare(const vec_t *v1, const vec_t *v2) { - int i; - for (i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { if (v1[i] != v2[i]) return 0; @@ -249,7 +237,6 @@ int VectorCompare(const vec_t *v1, const vec_t *v2) return 1; } -/* <2ce9de> ../cstrike/pm_shared/pm_math.c:270 */ void VectorMA(const vec_t *veca, float scale, const vec_t *vecb, vec_t *vecc) { vecc[0] = veca[0] + scale * vecb[0]; @@ -257,13 +244,11 @@ void VectorMA(const vec_t *veca, float scale, const vec_t *vecb, vec_t *vecc) vecc[2] = veca[2] + scale * vecb[2]; } -/* <2cea34> ../cstrike/pm_shared/pm_math.c:278 */ float_precision _DotProduct(const vec_t *v1, const vec_t *v2) { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } -/* <2cea6e> ../cstrike/pm_shared/pm_math.c:283 */ void _VectorSubtract(vec_t *veca, vec_t *vecb, vec_t *out) { out[0] = veca[0] - vecb[0]; @@ -271,7 +256,6 @@ void _VectorSubtract(vec_t *veca, vec_t *vecb, vec_t *out) out[2] = veca[2] - vecb[2]; } -/* <2ceab5> ../cstrike/pm_shared/pm_math.c:290 */ void _VectorAdd(vec_t *veca, vec_t *vecb, vec_t *out) { out[0] = veca[0] + vecb[0]; @@ -279,7 +263,6 @@ void _VectorAdd(vec_t *veca, vec_t *vecb, vec_t *out) out[2] = veca[2] + vecb[2]; } -/* <2ceafc> ../cstrike/pm_shared/pm_math.c:297 */ void _VectorCopy(vec_t *in, vec_t *out) { out[0] = in[0]; @@ -287,27 +270,23 @@ void _VectorCopy(vec_t *in, vec_t *out) out[2] = in[2]; } -/* <2ceb8d> ../cstrike/pm_shared/pm_math.c:307 */ -void _CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross) +void CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross) { cross[0] = v1[1] * v2[2] - v1[2] * v2[1]; cross[1] = v1[2] * v2[0] - v1[0] * v2[2]; cross[2] = v1[0] * v2[1] - v1[1] * v2[0]; } -/* <2ce85f> ../cstrike/pm_shared/pm_math.c:313 */ float_precision Length(const vec_t *v) { - int i; float_precision length = 0.0f; - for (i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) length += v[i] * v[i]; - return sqrt(length); + return Q_sqrt(length); } -/* <2cebc2> ../cstrike/pm_shared/pm_math.c:325 */ float Distance(const vec_t *v1, const vec_t *v2) { vec_t d[3]; @@ -315,13 +294,12 @@ float Distance(const vec_t *v1, const vec_t *v2) return Length(d); } -/* <2cec3c> ../cstrike/pm_shared/pm_math.c:332 */ float_precision VectorNormalize(vec_t *v) { float_precision length; float_precision ilength; - length = sqrt((float_precision)(v[0] * v[0] + v[1] * v[1] + v[2] * v[2])); + length = Q_sqrt(float_precision(v[0] * v[0] + v[1] * v[1] + v[2] * v[2])); if (length) { @@ -335,7 +313,6 @@ float_precision VectorNormalize(vec_t *v) return length; } -/* <2ceca2> ../cstrike/pm_shared/pm_math.c:351 */ void VectorInverse(vec_t *v) { v[0] = -v[0]; @@ -343,7 +320,6 @@ void VectorInverse(vec_t *v) v[2] = -v[2]; } -/* <2cecc9> ../cstrike/pm_shared/pm_math.c:358 */ void VectorScale(const vec_t *in, vec_t scale, vec_t *out) { out[0] = scale * in[0]; @@ -351,7 +327,6 @@ void VectorScale(const vec_t *in, vec_t scale, vec_t *out) out[2] = scale * in[2]; } -/* <2ced0f> ../cstrike/pm_shared/pm_math.c:366 */ int Q_log2(int val) { int answer = 0; @@ -361,7 +336,6 @@ int Q_log2(int val) return answer; } -/* <2ced4d> ../cstrike/pm_shared/pm_math.c:374 */ void VectorMatrix(vec_t *forward, vec_t *right, vec_t *up) { vec_t tmp[3]; @@ -382,13 +356,12 @@ void VectorMatrix(vec_t *forward, vec_t *right, vec_t *up) tmp[1] = 0; tmp[2] = 1.0f; - _CrossProduct(forward, tmp, right); + CrossProduct(forward, tmp, right); VectorNormalize(right); - _CrossProduct(right, forward, up); + CrossProduct(right, forward, up); VectorNormalize(up); } -/* <2cee68> ../cstrike/pm_shared/pm_math.c:398 */ void VectorAngles(const vec_t *forward, vec_t *angles) { float tmp, yaw, pitch; @@ -403,12 +376,12 @@ void VectorAngles(const vec_t *forward, vec_t *angles) } else { - yaw = (atan2(forward[1], forward[0]) * 180 / M_PI); + yaw = (Q_atan2(forward[1], forward[0]) * 180 / M_PI); if (yaw < 0) yaw += 360; - tmp = sqrt (forward[0] * forward[0] + forward[1] * forward[1]); - pitch = (atan2(forward[2], tmp) * 180 / M_PI); + tmp = Q_sqrt(forward[0] * forward[0] + forward[1] * forward[1]); + pitch = (Q_atan2(forward[2], tmp) * 180 / M_PI); if (pitch < 0) pitch += 360; } diff --git a/regamedll/pm_shared/pm_math.h b/regamedll/pm_shared/pm_math.h index 894aa59c..2abace06 100644 --- a/regamedll/pm_shared/pm_math.h +++ b/regamedll/pm_shared/pm_math.h @@ -57,7 +57,7 @@ float_precision _DotProduct(const vec_t *v1, const vec_t *v2); void _VectorSubtract(vec_t *veca, vec_t *vecb, vec_t *out); void _VectorAdd(vec_t *veca, vec_t *vecb, vec_t *out); void _VectorCopy(vec_t *in, vec_t *out); -void _CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross); +void CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross); float_precision Length(const vec_t *v); float Distance(const vec_t *v1, const vec_t *v2); diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index 1af9d5c8..cdb56cf9 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -17,9 +17,8 @@ char pm_grgchTextureType[1024]; playermove_t *pmove = NULL; int g_onladder = 0; -#endif // HOOK_GAMEDLL +#endif -/* <2cc613> ../cstrike/pm_shared/pm_shared.c:165 */ void PM_SwapTextures(int i, int j) { char chTemp; @@ -35,12 +34,9 @@ void PM_SwapTextures(int i, int j) pm_grgchTextureType[j] = chTemp; } -/* <2cc691> ../cstrike/pm_shared/pm_shared.c:180 */ NOXREF int PM_IsThereGrassTexture() { - int i; - - for (i = 0; i < pm_gcTextures; ++i) + for (int i = 0; i < pm_gcTextures; ++i) { if (pm_grgchTextureType[i] == CHAR_TEX_GRASS) return 1; @@ -49,7 +45,6 @@ NOXREF int PM_IsThereGrassTexture() return 0; } -/* <2cc6bb> ../cstrike/pm_shared/pm_shared.c:193 */ void PM_SortTextures() { // Bubble sort, yuck, but this only occurs at startup and it's only 512 elements... @@ -68,7 +63,6 @@ void PM_SortTextures() } } -/* <2cc720> ../cstrike/pm_shared/pm_shared.c:213 */ void PM_InitTextureTypes() { char buffer[512]; @@ -98,21 +92,21 @@ void PM_InitTextureTypes() { // skip whitespace i = 0; - while (buffer[i] && isspace(buffer[i])) + while (buffer[i] && Q_isspace(buffer[i])) ++i; if (!buffer[i]) continue; // skip comment lines - if (buffer[i] == '/' || !isalpha(buffer[i])) + if (buffer[i] == '/' || !Q_isalpha(buffer[i])) continue; // get texture type - pm_grgchTextureType[pm_gcTextures] = toupper(buffer[i++]); + pm_grgchTextureType[pm_gcTextures] = Q_toupper(buffer[i++]); // skip whitespace - while (buffer[i] && isspace(buffer[i])) + while (buffer[i] && Q_isspace(buffer[i])) ++i; if (!buffer[i]) @@ -120,7 +114,7 @@ void PM_InitTextureTypes() // get sentence name j = i; - while (buffer[j] && !isspace(buffer[j])) + while (buffer[j] && !Q_isspace(buffer[j])) j++; if (!buffer[j]) @@ -140,7 +134,6 @@ void PM_InitTextureTypes() bTextureTypeInit = true; } -/* <2cc7c5> ../cstrike/pm_shared/pm_shared.c:283 */ char EXT_FUNC PM_FindTextureType(char *name) { int left, right, pivot; @@ -149,7 +142,7 @@ char EXT_FUNC PM_FindTextureType(char *name) assert(pm_shared_initialized); left = 0; - right = gcTextures - 1; + right = pm_gcTextures - 1; while (left <= right) { @@ -174,7 +167,6 @@ char EXT_FUNC PM_FindTextureType(char *name) return CHAR_TEX_CONCRETE; } -/* <2cc416> ../cstrike/pm_shared/pm_shared.c:315 */ void PM_PlayStepSound(int step, float fvol) { static int iSkipStep = 0; @@ -328,7 +320,6 @@ void PM_PlayStepSound(int step, float fvol) } } -/* <2cc462> ../cstrike/pm_shared/pm_shared.c:489 */ int PM_MapTextureTypeStepType(char chTextureType) { switch (chTextureType) @@ -345,7 +336,6 @@ int PM_MapTextureTypeStepType(char chTextureType) } } -/* <2cc8af> ../cstrike/pm_shared/pm_shared.c:512 */ void PM_CatagorizeTextureType() { vec3_t start, end; @@ -380,7 +370,6 @@ void PM_CatagorizeTextureType() pmove->chtexturetype = PM_FindTextureType(pmove->sztexturename); } -/* <2cc93c> ../cstrike/pm_shared/pm_shared.c:546 */ void PM_UpdateStepSound() { float fvol; @@ -509,8 +498,6 @@ void PM_UpdateStepSound() } // Add's the trace result to touch list, if contact is not already in list. - -/* <2cca3d> ../cstrike/pm_shared/pm_shared.c:679 */ qboolean PM_AddToTouched(pmtrace_t tr, vec_t *impactvelocity) { int i; @@ -537,7 +524,6 @@ qboolean PM_AddToTouched(pmtrace_t tr, vec_t *impactvelocity) return true; } -/* <2cca88> ../cstrike/pm_shared/pm_shared.c:707 */ void PM_CheckVelocity() { int i; @@ -576,8 +562,6 @@ void PM_CheckVelocity() // returns the blocked flags: // 0x01 == floor // 0x02 == step / wall - -/* <2ccbe9> ../cstrike/pm_shared/pm_shared.c:752 */ int PM_ClipVelocity(vec_t *in, vec_t *normal, vec_t *out, float overbounce) { float change; @@ -622,7 +606,6 @@ int PM_ClipVelocity(vec_t *in, vec_t *normal, vec_t *out, float overbounce) return blocked; } -/* <2ccc93> ../cstrike/pm_shared/pm_shared.c:784 */ void PM_AddCorrectGravity() { float_precision ent_gravity; @@ -645,7 +628,6 @@ void PM_AddCorrectGravity() PM_CheckVelocity(); } -/* <2cc482> ../cstrike/pm_shared/pm_shared.c:806 */ void PM_FixupGravityVelocity() { float_precision ent_gravity; @@ -663,7 +645,6 @@ void PM_FixupGravityVelocity() PM_CheckVelocity(); } -/* <2ccd08> ../cstrike/pm_shared/pm_shared.c:831 */ int PM_FlyMove() { int bumpcount, numbumps; @@ -821,7 +802,7 @@ int PM_FlyMove() break; } - _CrossProduct(planes[0], planes[1], dir); + CrossProduct(planes[0], planes[1], dir); d = DotProduct(dir, pmove->velocity); VectorScale(dir, d, pmove->velocity); } @@ -842,7 +823,6 @@ int PM_FlyMove() return blocked; } -/* <2cce2e> ../cstrike/pm_shared/pm_shared.c:1027 */ void PM_Accelerate(vec_t *wishdir, float_precision wishspeed, float accel) { int i; @@ -884,8 +864,6 @@ void PM_Accelerate(vec_t *wishdir, float_precision wishspeed, float accel) } // Only used by players. Moves along the ground when player is a MOVETYPE_WALK. - -/* <2cceaf> ../cstrike/pm_shared/pm_shared.c:1071 */ void PM_WalkMove() { int clip; @@ -1074,8 +1052,6 @@ usedown: } // Handles both ground friction and water friction - -/* <2ccffb> ../cstrike/pm_shared/pm_shared.c:1249 */ void PM_Friction() { float *vel; @@ -1091,7 +1067,7 @@ void PM_Friction() vel = pmove->velocity; // Calculate speed - speed = sqrt((float_precision)(vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2])); + speed = Q_sqrt(float_precision(vel[0] * vel[0] + vel[1] * vel[1] + vel[2] * vel[2])); // If too slow, return if (speed < 0.1f) @@ -1153,13 +1129,12 @@ void PM_Friction() // Adjust velocity according to proportion. newvel[0] = vel[0] * newspeed; - newvel[1] = vel[1] * (float)newspeed; - newvel[2] = vel[2] * (float)newspeed; + newvel[1] = vel[1] * float(newspeed); + newvel[2] = vel[2] * float(newspeed); VectorCopy(newvel, pmove->velocity); } -/* <2cd0ba> ../cstrike/pm_shared/pm_shared.c:1326 */ void PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel) { int i; @@ -1200,7 +1175,6 @@ void PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel) } } -/* <2cd14b> ../cstrike/pm_shared/pm_shared.c:1368 */ void PM_WaterMove() { int i; @@ -1265,17 +1239,17 @@ void PM_WaterMove() newspeed = 0; // water acceleration - if ((float)wishspeed < 0.1f) + if (float(wishspeed) < 0.1f) { return; } - addspeed = (float)wishspeed - newspeed; + addspeed = float(wishspeed) - newspeed; if (addspeed > 0.0f) { VectorNormalize(wishvel); - accelspeed = pmove->movevars->accelerate * pmove->friction * pmove->frametime * (float)wishspeed; + accelspeed = pmove->movevars->accelerate * pmove->friction * pmove->frametime * float(wishspeed); if (accelspeed > addspeed) { @@ -1308,7 +1282,6 @@ void PM_WaterMove() PM_FlyMove(); } -/* <2cd220> ../cstrike/pm_shared/pm_shared.c:1464 */ void PM_AirMove() { int i; @@ -1357,15 +1330,12 @@ void PM_AirMove() PM_FlyMove(); } -/* <2cc586> ../cstrike/pm_shared/pm_shared.c:1510 */ qboolean PM_InWater() { - return (pmove->waterlevel > 1); + return (pmove->waterlevel > 1) ? TRUE : FALSE; } // Sets pmove->waterlevel and pmove->watertype values. - -/* <2cd2a7> ../cstrike/pm_shared/pm_shared.c:1522 */ qboolean PM_CheckWater() { vec3_t point; @@ -1423,7 +1393,7 @@ qboolean PM_CheckWater() if ((truecont <= CONTENTS_CURRENT_0) && (truecont >= CONTENTS_CURRENT_DOWN)) { // The deeper we are, the stronger the current. - static vec_t current_table[][3] = + static vec3_t current_table[] = { {1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1} @@ -1433,10 +1403,9 @@ qboolean PM_CheckWater() } } - return pmove->waterlevel > 1; + return (pmove->waterlevel > 1) ? TRUE : FALSE; } -/* <2cd33a> ../cstrike/pm_shared/pm_shared.c:1593 */ void PM_CatagorizePosition() { vec3_t point; @@ -1504,8 +1473,6 @@ void PM_CatagorizePosition() // When a player is stuck, it's costly to try and unstick them // Grab a test offset for the player based on a passed in index - -/* <2cc4c5> ../cstrike/pm_shared/pm_shared.c:1654 */ int PM_GetRandomStuckOffsets(int nIndex, int server, vec_t *offset) { // Last time we did a full @@ -1517,7 +1484,6 @@ int PM_GetRandomStuckOffsets(int nIndex, int server, vec_t *offset) return (idx % 54); } -/* <2cc49d> ../cstrike/pm_shared/pm_shared.c:1665 */ void PM_ResetStuckOffsets(int nIndex, int server) { rgStuckLast[nIndex][server] = 0; @@ -1526,8 +1492,6 @@ void PM_ResetStuckOffsets(int nIndex, int server) // If pmove->origin is in a solid position, // try nudging slightly on all axis to // allow for the cut precision of the net coordinates - -/* <2cd3cf> ../cstrike/pm_shared/pm_shared.c:1681 */ int PM_CheckStuck() { vec3_t base; @@ -1647,7 +1611,6 @@ int PM_CheckStuck() return 1; } -/* <2cd61f> ../cstrike/pm_shared/pm_shared.c:1807 */ void PM_SpectatorMove() { float_precision speed, drop, friction; @@ -1691,7 +1654,7 @@ void PM_SpectatorMove() } else { - VectorCopy(vec3_origin, pmove->velocity) + VectorCopy(vec3_origin, pmove->velocity); } // accelerate @@ -1770,8 +1733,6 @@ void PM_SpectatorMove() // Use for ease-in, ease-out style interpolation (accel/decel) // Used by ducking code. - -/* <2cc509> ../cstrike/pm_shared/pm_shared.c:1941 */ float PM_SplineFraction(float value, float scale) { float_precision valueSquared; @@ -1783,7 +1744,6 @@ float PM_SplineFraction(float value, float scale) return 3 * valueSquared - 2 * valueSquared * value; } -/* <2cd757> ../cstrike/pm_shared/pm_shared.c:1952 */ NOXREF float PM_SimpleSpline(float value) { float valueSquared; @@ -1793,7 +1753,6 @@ NOXREF float PM_SimpleSpline(float value) return 3 * valueSquared - 2 * valueSquared * value; } -/* <2cc595> ../cstrike/pm_shared/pm_shared.c:1959 */ void PM_FixPlayerCrouchStuck(int direction) { int hitent; @@ -1824,7 +1783,6 @@ void PM_FixPlayerCrouchStuck(int direction) VectorCopy(test, pmove->origin); } -/* <2cd7cd> ../cstrike/pm_shared/pm_shared.c:1983 */ void PM_Duck() { float_precision duckFraction; @@ -1946,7 +1904,6 @@ void PM_Duck() } } -/* <2cd8c2> ../cstrike/pm_shared/pm_shared.c:2332 */ void PM_LadderMove(physent_t *pLadder) { vec3_t ladderCenter; @@ -2031,7 +1988,7 @@ void PM_LadderMove(physent_t *pLadder) VectorClear(tmp); tmp[2] = 1; - _CrossProduct(tmp, trace.plane.normal, perp); + CrossProduct(tmp, trace.plane.normal, perp); VectorNormalize(perp); // decompose velocity into ladder plane @@ -2047,7 +2004,7 @@ void PM_LadderMove(physent_t *pLadder) // NOTE: It IS possible to face up and move down or face down and move up // because the velocity is a sum of the directional velocity and the converted // velocity through the face of the ladder -- by design. - _CrossProduct(trace.plane.normal, perp, tmp); + CrossProduct(trace.plane.normal, perp, tmp); VectorMA(lateral, -normal, tmp, pmove->velocity); // On ground moving away from the ladder @@ -2064,7 +2021,6 @@ void PM_LadderMove(physent_t *pLadder) } } -/* <2cda06> ../cstrike/pm_shared/pm_shared.c:2457 */ physent_t *PM_Ladder() { int i; @@ -2098,7 +2054,6 @@ physent_t *PM_Ladder() return NULL; } -/* <2cda77> ../cstrike/pm_shared/pm_shared.c:2491 */ void PM_WaterJump() { if (pmove->waterjumptime > 10000) @@ -2123,7 +2078,6 @@ void PM_WaterJump() pmove->velocity[1] = pmove->movedir[1]; } -/* <2cda8d> ../cstrike/pm_shared/pm_shared.c:2519 */ void PM_AddGravity() { float ent_gravity; @@ -2141,8 +2095,6 @@ void PM_AddGravity() } // Does not change the entities velocity at all - -/* <2cdac6> ../cstrike/pm_shared/pm_shared.c:2541 */ pmtrace_t PM_PushEntity(vec_t *push) { pmtrace_t trace; @@ -2163,7 +2115,6 @@ pmtrace_t PM_PushEntity(vec_t *push) return trace; } -/* <2cdb13> ../cstrike/pm_shared/pm_shared.c:2569 */ void PM_Physics_Toss() { pmtrace_t trace; @@ -2262,14 +2213,13 @@ void PM_Physics_Toss() trace = PM_PushEntity(move); } - VectorSubtract(pmove->velocity, base, pmove->velocity) + VectorSubtract(pmove->velocity, base, pmove->velocity); } // check for in water PM_CheckWater(); } -/* <2cdba2> ../cstrike/pm_shared/pm_shared.c:2674 */ void PM_NoClip() { int i; @@ -2294,16 +2244,14 @@ void PM_NoClip() VectorMA(pmove->origin, pmove->frametime, wishvel, pmove->origin); // Zero out the velocity so that we don't accumulate a huge downward velocity from - // gravity, etc. + // gravity, etc. VectorClear(pmove->velocity); } // Purpose: Corrects bunny jumping (where player initiates a bunny jump before other -// movement logic runs, thus making onground == -1 thus making PM_Friction get skipped and -// running PM_AirMove, which doesn't crop velocity to maxspeed like the ground / other -// movement logic does. - -/* <2ccab0> ../cstrike/pm_shared/pm_shared.c:2711 */ +// movement logic runs, thus making onground == -1 thus making PM_Friction get skipped and +// running PM_AirMove, which doesn't crop velocity to maxspeed like the ground / other +// movement logic does. void PM_PreventMegaBunnyJumping() { // Current player speed @@ -2331,7 +2279,6 @@ void PM_PreventMegaBunnyJumping() VectorScale(pmove->velocity, fraction, pmove->velocity); } -/* <2cc541> ../cstrike/pm_shared/pm_shared.c:2741 */ void PM_Jump() { if (pmove->dead) @@ -2445,18 +2392,18 @@ void PM_Jump() pmove->velocity[i] = pmove->forward[i] * PLAYER_LONGJUMP_SPEED * 1.6f; } - pmove->velocity[2] = sqrt(2 * 800 * 56.0f); + pmove->velocity[2] = Q_sqrt(2 * 800 * 56.0f); } else { - pmove->velocity[2] = sqrt(2 * 800 * 45.0f); + pmove->velocity[2] = Q_sqrt(2 * 800 * 45.0f); } } else -#endif // REGAMEDLL_ADD +#endif { // NOTE: don't do it in .f (float) - pmove->velocity[2] = sqrt(2.0 * 800.0f * 45.0f); + pmove->velocity[2] = Q_sqrt(2.0 * 800.0f * 45.0f); } if (pmove->fuser2 > 0.0f) @@ -2476,7 +2423,6 @@ void PM_Jump() pmove->oldbuttons |= IN_JUMP; } -/* <2cdc4b> ../cstrike/pm_shared/pm_shared.c:2869 */ void PM_CheckWaterJump() { vec3_t vecStart, vecEnd; @@ -2529,7 +2475,7 @@ void PM_CheckWaterJump() tr = pmove->PM_PlayerTrace(vecStart, vecEnd, PM_NORMAL, -1); // Facing a near vertical wall? - if (tr.fraction < 1.0 && fabs((float_precision)(tr.plane.normal[2])) < 0.1f) + if (tr.fraction < 1.0f && Q_fabs(float_precision(tr.plane.normal[2])) < 0.1f) { vecStart[2] += pmove->_player_maxs[savehull][2] - WJ_HEIGHT; @@ -2552,7 +2498,6 @@ void PM_CheckWaterJump() pmove->usehull = savehull; } -/* <2cdcd3> ../cstrike/pm_shared/pm_shared.c:2933 */ void PM_CheckFalling() { if (pmove->onground != -1 && !pmove->dead && pmove->flFallVelocity >= PM_PLAYER_FALL_PUNCH_THRESHHOLD) @@ -2601,7 +2546,6 @@ void PM_CheckFalling() } } -/* <2cdd60> ../cstrike/pm_shared/pm_shared.c:2988 */ void PM_PlayWaterSounds() { // Did we enter or leave water? @@ -2625,7 +2569,6 @@ void PM_PlayWaterSounds() } } -/* <2cdd76> ../cstrike/pm_shared/pm_shared.c:3018 */ float PM_CalcRoll(vec_t *angles, vec_t *velocity, float rollangle, float rollspeed) { float sign; @@ -2639,7 +2582,7 @@ float PM_CalcRoll(vec_t *angles, vec_t *velocity, float rollangle, float rollspe sign = side < 0 ? -1 : 1; - side = fabs(side); + side = Q_fabs(side); value = rollangle; @@ -2655,7 +2598,6 @@ float PM_CalcRoll(vec_t *angles, vec_t *velocity, float rollangle, float rollspe return side * sign; } -/* <2cde69> ../cstrike/pm_shared/pm_shared.c:3053 */ void PM_DropPunchAngle(vec_t *punchangle) { float_precision len; @@ -2666,27 +2608,26 @@ void PM_DropPunchAngle(vec_t *punchangle) len = Q_max(len, 0.0); #else len = Q_max(len, 0.0f); -#endif // PLAY_GAMEDLL +#endif VectorScale(punchangle, len, punchangle); } -/* <2cdeb8> ../cstrike/pm_shared/pm_shared.c:3069 */ void PM_CheckParamters() { float spd; float_precision maxspeed; vec3_t v_angle; - spd = sqrt((float_precision)(pmove->cmd.sidemove * pmove->cmd.sidemove + pmove->cmd.forwardmove * pmove->cmd.forwardmove + pmove->cmd.upmove * pmove->cmd.upmove)); + spd = Q_sqrt(float_precision(pmove->cmd.sidemove * pmove->cmd.sidemove + pmove->cmd.forwardmove * pmove->cmd.forwardmove + pmove->cmd.upmove * pmove->cmd.upmove)); maxspeed = pmove->clientmaxspeed; if (maxspeed != 0.0f) { - pmove->maxspeed = Q_min(maxspeed, (float_precision)pmove->maxspeed); + pmove->maxspeed = Q_min(maxspeed, float_precision(pmove->maxspeed)); } - if (spd != 0.0f && spd > (float_precision)pmove->maxspeed) + if (spd != 0.0f && spd > float_precision(pmove->maxspeed)) { float_precision fRatio = pmove->maxspeed / spd; @@ -2733,7 +2674,6 @@ void PM_CheckParamters() } } -/* <2cdfc3> ../cstrike/pm_shared/pm_shared.c:3136 */ void PM_ReduceTimers() { if (pmove->flTimeStepSound > 0) @@ -2777,7 +2717,6 @@ void PM_ReduceTimers() } } -/* <2cc577> ../cstrike/pm_shared/pm_shared.c:3203 */ qboolean PM_ShouldDoSpectMode() { return (pmove->iuser3 <= 0 || pmove->deadflag == DEAD_DEAD); @@ -2786,8 +2725,6 @@ qboolean PM_ShouldDoSpectMode() // Returns with origin, angles, and velocity modified in place. // Numtouch and touchindex[] will be set if any of the physents // were contacted during the move. - -/* <2cdfe9> ../cstrike/pm_shared/pm_shared.c:3225 */ void PM_PlayerMove(qboolean server) { physent_t *pLadder = NULL; @@ -3039,7 +2976,6 @@ void PM_PlayerMove(qboolean server) } } -/* <2ce101> ../cstrike/pm_shared/pm_shared.c:3479 */ void PM_CreateStuckTable() { float x, y, z; @@ -3175,8 +3111,6 @@ void PM_CreateStuckTable() // the engine. The same PM_Move routine is built into the game .dll and the client .dll and is // invoked by each side as appropriate. There should be no distinction, internally, between server // and client. This will ensure that prediction behaves appropriately. - -/* <2ce182> ../cstrike/pm_shared/pm_shared.c:3596 */ void EXT_FUNC PM_Move(struct playermove_s *ppmove, int server) { assert(pm_shared_initialized); @@ -3196,7 +3130,6 @@ void EXT_FUNC PM_Move(struct playermove_s *ppmove, int server) } } -/* <2ce1c1> ../cstrike/pm_shared/pm_shared.c:3620 */ NOXREF int PM_GetVisEntInfo(int ent) { if (ent >= 0 && ent <= pmove->numvisent) @@ -3207,7 +3140,6 @@ NOXREF int PM_GetVisEntInfo(int ent) return -1; } -/* <2ce1ee> ../cstrike/pm_shared/pm_shared.c:3629 */ NOXREF int PM_GetPhysEntInfo(int ent) { if (ent >= 0 && ent <= pmove->numphysent) @@ -3218,7 +3150,6 @@ NOXREF int PM_GetPhysEntInfo(int ent) return -1; } -/* <2ce21b> ../cstrike/pm_shared/pm_shared.c:3638 */ void EXT_FUNC PM_Init(struct playermove_s *ppmove) { assert(!pm_shared_initialized); diff --git a/regamedll/pm_shared/pm_shared.h b/regamedll/pm_shared/pm_shared.h index 407278de..5d741eed 100644 --- a/regamedll/pm_shared/pm_shared.h +++ b/regamedll/pm_shared/pm_shared.h @@ -32,8 +32,6 @@ #pragma once #endif -#define MAX_CLIENTS 32 - #define PM_DEAD_VIEWHEIGHT -8 #define OBS_NONE 0 @@ -79,62 +77,10 @@ // Only allow bunny jumping up to 1.2x server / player maxspeed setting #define BUNNYJUMP_MAX_SPEED_FACTOR 1.2f -void PM_SwapTextures(int i, int j); -NOXREF int PM_IsThereGrassTexture(); -void PM_SortTextures(); -void PM_InitTextureTypes(); -char PM_FindTextureType(char *name); -void PM_PlayStepSound(int step, float fvol); -int PM_MapTextureTypeStepType(char chTextureType); -void PM_CatagorizeTextureType(); -void PM_UpdateStepSound(); -qboolean PM_AddToTouched(pmtrace_t tr, vec_t *impactvelocity); -void PM_CheckVelocity(); -int PM_ClipVelocity(vec_t *in, vec_t *normal, vec_t *out, float overbounce); -void PM_AddCorrectGravity(); -void PM_FixupGravityVelocity(); -int PM_FlyMove(); -void PM_Accelerate(vec_t *wishdir, float_precision wishspeed, float accel); -void PM_WalkMove(); -void PM_Friction(); -void PM_AirAccelerate(vec_t *wishdir, float wishspeed, float accel); -void PM_WaterMove(); -void PM_AirMove(); -qboolean PM_InWater(); -qboolean PM_CheckWater(); -void PM_CatagorizePosition(); -int PM_GetRandomStuckOffsets(int nIndex, int server, vec_t *offset); -void PM_ResetStuckOffsets(int nIndex, int server); -int PM_CheckStuck(); -void PM_SpectatorMove(); -float PM_SplineFraction(float value, float scale); -NOXREF float PM_SimpleSpline(float value); -void PM_FixPlayerCrouchStuck(int direction); -void PM_Duck(); -void PM_LadderMove(physent_t *pLadder); -physent_t *PM_Ladder(); -void PM_WaterJump(); -void PM_AddGravity(); -pmtrace_t PM_PushEntity(vec_t *push); -void PM_Physics_Toss(); -void PM_NoClip(); -void PM_PreventMegaBunnyJumping(); -void PM_Jump(); -void PM_CheckWaterJump(); -void PM_CheckFalling(); -void PM_PlayWaterSounds(); -float PM_CalcRoll(vec_t *angles, vec_t *velocity, float rollangle, float rollspeed); -void PM_DropPunchAngle(vec_t *punchangle); -void PM_CheckParamters(); -void PM_ReduceTimers(); -qboolean PM_ShouldDoSpectMode(); -void PM_PlayerMove(qboolean server); -void PM_CreateStuckTable(); -void PM_Move(struct playermove_s *ppmove, int server); -NOXREF int PM_GetVisEntInfo(int ent); -NOXREF int PM_GetPhysEntInfo(int ent); void PM_Init(struct playermove_s *ppmove); +void PM_Move(struct playermove_s *ppmove, int server); +char PM_FindTextureType(char *name); -extern playermove_t *pmove; +extern struct playermove_s *pmove; #endif // PM_SHARED_H diff --git a/regamedll/public/MemPool.cpp b/regamedll/public/MemPool.cpp index 269c607c..f7aedfcd 100644 --- a/regamedll/public/MemPool.cpp +++ b/regamedll/public/MemPool.cpp @@ -1,6 +1,5 @@ #include "precompiled.h" -/* <3fea40> ../public/MemPool.cpp:35 */ CMemoryPool::CMemoryPool(int blockSize, int numElements) { _blocksPerBlob = numElements; @@ -14,14 +13,12 @@ CMemoryPool::CMemoryPool(int blockSize, int numElements) _blocksAllocated = 0; } -/* <3fe967> ../public/MemPool.cpp:52 */ CMemoryPool::~CMemoryPool() { for (int i = 0; i < _numBlobs; ++i) free(_memBlob[i]); } -/* <3fe99c> ../public/MemPool.cpp:109 */ void CMemoryPool::AddNewBlob() { int sizeMultiplier = pow(2.0, _numBlobs); @@ -61,7 +58,6 @@ void CMemoryPool::AddNewBlob() } -/* <3fea72> ../public/MemPool.cpp:157 */ void *CMemoryPool::Alloc(unsigned int amount) { void *returnBlock; @@ -84,7 +80,6 @@ void *CMemoryPool::Alloc(unsigned int amount) return returnBlock; } -/* <3feabe> ../public/MemPool.cpp:193 */ void CMemoryPool::Free(void *memblock) { if (!memblock) diff --git a/regamedll/public/engine_launcher_api.h b/regamedll/public/engine_launcher_api.h deleted file mode 100644 index 1a2acadf..00000000 --- a/regamedll/public/engine_launcher_api.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#ifndef ENGINE_LAUNCHER_API_H -#define ENGINE_LAUNCHER_API_H -#ifdef _WIN32 -#pragma once -#endif - -#include "maintypes.h" -#include "interface.h" - - -/* <8f7fd> ../public/engine_launcher_api.h:17 */ -class IEngineAPI : public IBaseInterface -{ -public: - - virtual int Run(void *instance, char *basedir, char *cmdline, char *postRestartCmdLineArgs, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory) = 0; -}; - -#endif // ENGINE_LAUNCHER_API_H diff --git a/regamedll/public/idedicatedexports.h b/regamedll/public/idedicatedexports.h deleted file mode 100644 index 20d5e595..00000000 --- a/regamedll/public/idedicatedexports.h +++ /dev/null @@ -1,24 +0,0 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef IDEDICATEDEXPORTS_H -#define IDEDICATEDEXPORTS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "interface.h" - -class IDedicatedExports -{ -public: - virtual void Sys_Printf( char *text ) = 0; -}; - -#define VENGINE_DEDICATEDEXPORTS_API_VERSION "VENGINE_DEDICATEDEXPORTS_API_VERSION001" - -#endif // IDEDICATEDEXPORTS_H diff --git a/regamedll/public/keydefs.h b/regamedll/public/keydefs.h deleted file mode 100644 index d644d3b8..00000000 --- a/regamedll/public/keydefs.h +++ /dev/null @@ -1,124 +0,0 @@ -// keydefs.h -#ifndef KEYDEFS_H -#define KEYDEFS_H -#ifdef _WIN32 -#pragma once -#endif - -// -// these are the key numbers that should be passed to Key_Event -// -#define K_TAB 9 -#define K_ENTER 13 -#define K_ESCAPE 27 -#define K_SPACE 32 - -// normal keys should be passed as lowercased ascii - -#define K_BACKSPACE 127 -#define K_UPARROW 128 -#define K_DOWNARROW 129 -#define K_LEFTARROW 130 -#define K_RIGHTARROW 131 - -#define K_ALT 132 -#define K_CTRL 133 -#define K_SHIFT 134 -#define K_F1 135 -#define K_F2 136 -#define K_F3 137 -#define K_F4 138 -#define K_F5 139 -#define K_F6 140 -#define K_F7 141 -#define K_F8 142 -#define K_F9 143 -#define K_F10 144 -#define K_F11 145 -#define K_F12 146 -#define K_INS 147 -#define K_DEL 148 -#define K_PGDN 149 -#define K_PGUP 150 -#define K_HOME 151 -#define K_END 152 - -#define K_KP_HOME 160 -#define K_KP_UPARROW 161 -#define K_KP_PGUP 162 -#define K_KP_LEFTARROW 163 -#define K_KP_5 164 -#define K_KP_RIGHTARROW 165 -#define K_KP_END 166 -#define K_KP_DOWNARROW 167 -#define K_KP_PGDN 168 -#define K_KP_ENTER 169 -#define K_KP_INS 170 -#define K_KP_DEL 171 -#define K_KP_SLASH 172 -#define K_KP_MINUS 173 -#define K_KP_PLUS 174 -#define K_CAPSLOCK 175 -#define K_KP_MUL 176 -#define K_WIN 177 - - -// -// joystick buttons -// -#define K_JOY1 203 -#define K_JOY2 204 -#define K_JOY3 205 -#define K_JOY4 206 - -// -// aux keys are for multi-buttoned joysticks to generate so they can use -// the normal binding process -// -#define K_AUX1 207 -#define K_AUX2 208 -#define K_AUX3 209 -#define K_AUX4 210 -#define K_AUX5 211 -#define K_AUX6 212 -#define K_AUX7 213 -#define K_AUX8 214 -#define K_AUX9 215 -#define K_AUX10 216 -#define K_AUX11 217 -#define K_AUX12 218 -#define K_AUX13 219 -#define K_AUX14 220 -#define K_AUX15 221 -#define K_AUX16 222 -#define K_AUX17 223 -#define K_AUX18 224 -#define K_AUX19 225 -#define K_AUX20 226 -#define K_AUX21 227 -#define K_AUX22 228 -#define K_AUX23 229 -#define K_AUX24 230 -#define K_AUX25 231 -#define K_AUX26 232 -#define K_AUX27 233 -#define K_AUX28 234 -#define K_AUX29 235 -#define K_AUX30 236 -#define K_AUX31 237 -#define K_AUX32 238 -#define K_MWHEELDOWN 239 -#define K_MWHEELUP 240 - -#define K_PAUSE 255 - -// -// mouse buttons generate virtual keys -// -#define K_MOUSE1 241 -#define K_MOUSE2 242 -#define K_MOUSE3 243 -#define K_MOUSE4 244 -#define K_MOUSE5 245 - -#endif // KEYDEFS_H \ No newline at end of file diff --git a/regamedll/public/particleman.h b/regamedll/public/particleman.h deleted file mode 100644 index ab65b13b..00000000 --- a/regamedll/public/particleman.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef PARTICLEMAN_H -#define PARTICLEMAN_H - -#include "interface.h" -#include "pman_triangleffect.h" - -#define PARTICLEMAN_INTERFACE "create_particleman" - -#ifdef _WIN32 -#define PARTICLEMAN_DLLNAME "cl_dlls/particleman.dll" -#elif defined(OSX) -#define PARTICLEMAN_DLLNAME "cl_dlls/particleman.dylib" -#elif defined(LINUX) -#define PARTICLEMAN_DLLNAME "cl_dlls/particleman.so" -#else -#error -#endif - -class CBaseParticle; - -class IParticleMan : public IBaseInterface -{ - -protected: - virtual ~IParticleMan() {} - -public: - - virtual void SetUp( cl_enginefunc_t *pEnginefuncs ) = 0; - virtual void Update ( void ) = 0; - virtual void SetVariables ( float flGravity, Vector vViewAngles ) = 0; - virtual void ResetParticles ( void ) = 0; - virtual void ApplyForce ( Vector vOrigin, Vector vDirection, float flRadius, float flStrength, float flDuration ) = 0; - virtual void AddCustomParticleClassSize ( unsigned long lSize ) = 0; - - //Use this if you want to create a new particle without any overloaded functions, Think, Touch, etc. - //Just call this function, set the particle's behavior and let it rip. - virtual CBaseParticle *CreateParticle( Vector org, Vector normal, model_s * sprite, float size, float brightness, const char *classname ) = 0; - - //Use this to take a block from the mempool for custom particles ( used in new ). - virtual char *RequestNewMemBlock( int iSize ) = 0; - - //These ones are used along a custom Create for new particles you want to override their behavior. - //You can call these whenever you want, but they are mainly used by CBaseParticle. - virtual void CoreInitializeSprite ( CCoreTriangleEffect *pParticle, Vector org, Vector normal, model_s *sprite, float size, float brightness ) = 0; //Only use this for TrianglePlanes - virtual void CoreThink( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreDraw( CCoreTriangleEffect *pParticle ) = 0; - virtual void CoreAnimate( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreAnimateAndDie( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreExpand ( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreContract ( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreFade ( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreSpin ( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreCalculateVelocity( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreCheckCollision( CCoreTriangleEffect *pParticle, float time ) = 0; - virtual void CoreTouch ( CCoreTriangleEffect *pParticle, Vector pos, Vector normal, int index ) = 0; - virtual void CoreDie ( CCoreTriangleEffect *pParticle ) = 0; - virtual void CoreForce ( CCoreTriangleEffect *pParticle ) = 0; - virtual bool CoreCheckVisibility ( CCoreTriangleEffect *pParticle ) = 0; - virtual void SetRender( int iRender ) = 0; -}; - -extern IParticleMan *g_pParticleMan; - -class CBaseParticle : public CCoreTriangleEffect -{ -public: - virtual void Think( float time ){ g_pParticleMan->CoreThink( this, time ); } - virtual void Draw( void ) { g_pParticleMan->CoreDraw( this ); } - virtual void Animate( float time ) { g_pParticleMan->CoreAnimate( this, time ); } - virtual void AnimateAndDie( float time ) { g_pParticleMan->CoreAnimateAndDie( this, time ); } - virtual void Expand( float time ) { g_pParticleMan->CoreExpand( this, time ); } - virtual void Contract( float time ) { g_pParticleMan->CoreContract( this, time ); } - virtual void Fade( float time ) { g_pParticleMan->CoreFade( this, time ); } - virtual void Spin( float time ) { g_pParticleMan->CoreSpin( this, time ); } - virtual void CalculateVelocity( float time ) { g_pParticleMan->CoreCalculateVelocity( this, time ); } - virtual void CheckCollision( float time ) { g_pParticleMan->CoreCheckCollision( this, time ); } - virtual void Touch(Vector pos, Vector normal, int index) { g_pParticleMan->CoreTouch( this, pos, normal, index ); } - virtual void Die ( void ) { g_pParticleMan->CoreDie( this ); } - virtual void Force ( void ) { g_pParticleMan->CoreForce( this ); } - virtual bool CheckVisibility ( void ) { return g_pParticleMan->CoreCheckVisibility( this ); } - - virtual void InitializeSprite( Vector org, Vector normal, model_s *sprite, float size, float brightness ) - { - g_pParticleMan->CoreInitializeSprite ( this, org, normal, sprite, size, brightness ); - } - - void * operator new( size_t size ) //this asks for a new block of memory from the MiniMem class - { - return( g_pParticleMan->RequestNewMemBlock( size ) ); - } -#ifdef POSIX - void * operator new( size_t size, const std::nothrow_t&) throw() //this asks for a new block of memory from the MiniMem class - { - return( g_pParticleMan->RequestNewMemBlock( size ) ); - } -#endif -}; - - -#endif //PARTICLEMAN_H diff --git a/regamedll/public/pman_particlemem.h b/regamedll/public/pman_particlemem.h deleted file mode 100644 index 05f79bc7..00000000 --- a/regamedll/public/pman_particlemem.h +++ /dev/null @@ -1,197 +0,0 @@ -#ifndef PARTICLEMEM_H__ -#define PARTICLEMEM_H__ - -#ifdef _WIN32 -#pragma once -#endif - -#include - -class CCoreTriangleEffect; - -#define TRIANGLE_FPS 30 - -typedef struct visibleparticles_s -{ - CCoreTriangleEffect *pVisibleParticle; -} visibleparticles_t; - -//--------------------------------------------------------------------------- -// Memory block record. -class MemoryBlock -{ -private: - char *m_pData; - //bool m_bBlockIsInUse; -public: - MemoryBlock(long lBlockSize) - : next(NULL), prev(NULL) - //m_bBlockIsInUse(false) // Initialize block to 'free' state. - { - // Allocate memory here. - m_pData = new char[lBlockSize]; - } - - virtual ~MemoryBlock() - { - // Free memory. - delete[] m_pData; - } - - inline char *Memory(void) { return m_pData; } - - MemoryBlock * next; - MemoryBlock * prev; -}; - -class MemList -{ -public: - MemList() : m_pHead(NULL) {} - - ~MemList() { Reset(); } - - void Push(MemoryBlock * newItem) - { - if(!m_pHead) - { - m_pHead = newItem; - newItem->next = NULL; - newItem->prev = NULL; - return; - } - - MemoryBlock * temp = m_pHead; - m_pHead = newItem; - m_pHead->next = temp; - m_pHead->prev = NULL; - - temp->prev = m_pHead; - } - - - MemoryBlock * Front( void ) - { - return(m_pHead); - } - - MemoryBlock * Pop( void ) - { - if(!m_pHead) - return(NULL); - - MemoryBlock * temp = m_pHead; - - m_pHead = m_pHead->next; - - if(m_pHead) - m_pHead->prev = NULL; - - temp->next = NULL; - temp->prev = NULL; - - return(temp); - } - - void Delete( MemoryBlock * pItem) - { - - if(m_pHead == pItem) - { - MemoryBlock * temp = m_pHead; - - m_pHead = m_pHead->next; - if(m_pHead) - m_pHead->prev = NULL; - - temp->next = NULL; - temp->prev = NULL; - return; - } - - MemoryBlock * prev = pItem->prev; - MemoryBlock * next = pItem->next; - - if(prev) - prev->next = next; - - if(next) - next->prev = prev; - - pItem->next = NULL; - pItem->prev = NULL; - } - - void Reset( void ) - { - while(m_pHead) - Delete(m_pHead); - } - -private: - MemoryBlock * m_pHead; -}; - - -// Some helpful typedefs. -typedef std::vector VectorOfMemoryBlocks; -typedef VectorOfMemoryBlocks::iterator MemoryBlockIterator; - -// Mini memory manager - singleton. -class CMiniMem -{ -private: - // Main memory pool. Array is fine, but vectors are - // easier. :) - static VectorOfMemoryBlocks m_vecMemoryPool; - // Size of memory blocks in pool. - static long m_lMemoryBlockSize; - static long m_lMaxBlocks; - static long m_lMemoryPoolSize; - static CMiniMem *_instance; - - int m_iTotalParticles; - int m_iParticlesDrawn; - -protected: - // private constructor and destructor. - CMiniMem(long lMemoryPoolSize, long lMaxBlockSize); - virtual ~CMiniMem(); - - // ------------ Memory pool manager calls. - // Find a free block and mark it as "in use". Return NULL - // if no free blocks found. - char *AllocateFreeBlock(void); -public: - - // Return a pointer to usable block of memory. - char *newBlock(void); - - // Mark a target memory item as no longer "in use". - void deleteBlock(MemoryBlock *p); - - // Return the remaining capacity of the memory pool as a percent. - long PercentUsed(void); - - void ProcessAll( void ); //Processes all - - void Reset( void ); //clears memory, setting all particles to not used. - - static int ApplyForce( Vector vOrigin, Vector vDirection, float flRadius, float flStrength ); - - static CMiniMem *Instance(void); - static long MaxBlockSize(void); - - bool CheckSize( int iSize ); - - int GetTotalParticles( void ) { return m_iTotalParticles; } - int GetDrawnParticles( void ) { return m_iParticlesDrawn; } - void IncreaseParticlesDrawn( void ){ m_iParticlesDrawn++; } - - void Shutdown( void ); - - visibleparticles_t *m_pVisibleParticles; -}; - - -#endif//PARTICLEMEM_H__ \ No newline at end of file diff --git a/regamedll/public/pman_triangleffect.h b/regamedll/public/pman_triangleffect.h deleted file mode 100644 index 7ab40da1..00000000 --- a/regamedll/public/pman_triangleffect.h +++ /dev/null @@ -1,209 +0,0 @@ -#ifndef TRIANGLEEFFECT_H__ -#define TRIANGLEEFFECT_H__ - -#ifdef _WIN32 -#pragma once -#endif - -#define TRI_COLLIDEWORLD 0x00000020 -#define TRI_COLLIDEALL 0x00001000 // will collide with world and slideboxes -#define TRI_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything -#define TRI_SPIRAL 0x00008000 -#define TRI_ANIMATEDIE 0x00016000 //animate once and then die -#define TRI_WATERTRACE 0x00032000 - - -#define CULL_FRUSTUM_POINT ( 1 << 0 ) -#define CULL_FRUSTUM_SPHERE ( 1 << 1 ) -#define CULL_FRUSTUM_PLANE ( 1 << 2 ) -#define CULL_PVS ( 1 << 3 ) - -#define LIGHT_NONE ( 1 << 4 ) -#define LIGHT_COLOR ( 1 << 5 ) -#define LIGHT_INTENSITY ( 1 << 6 ) - -#define RENDER_FACEPLAYER ( 1 << 7 ) // m_vAngles == Player view angles -#define RENDER_FACEPLAYER_ROTATEZ ( 1 << 8 ) //Just like above but m_vAngles.z is untouched so the sprite can rotate. - - -#include "pman_particlemem.h" - -//pure virtual baseclass -class CCoreTriangleEffect -{ -private: - int m_iRenderFlags; - float m_flNextPVSCheck; - bool m_bInPVS; - - int m_iCollisionFlags; - float m_flPlayerDistance; //Used for sorting the particles, DO NOT TOUCH. - -public: - - void * operator new(size_t size) - { - // Requested size should match size of class. - if ( size != sizeof( CCoreTriangleEffect ) ) -#ifdef _WIN32 - throw "Error in requested size of new particle class instance."; -#else - return NULL; -#endif - - return((CCoreTriangleEffect *) CMiniMem::Instance()->newBlock()); - - }//this asks for a new block of memory from the MiniMen class - - virtual void Think( float time ) = 0; - virtual bool CheckVisibility ( void ) = 0; - virtual void Draw( void ) = 0; - virtual void Animate( float time ) = 0; - virtual void AnimateAndDie( float time ) = 0; - virtual void Expand( float time ) = 0; - virtual void Contract( float time ) = 0; - virtual void Fade( float time ) = 0; - virtual void Spin( float time ) = 0; - virtual void CalculateVelocity( float time ) = 0; - virtual void CheckCollision( float time ) = 0; - virtual void Touch(Vector pos, Vector normal, int index) = 0; - virtual void Die ( void ) = 0; - virtual void InitializeSprite( Vector org, Vector normal, model_s * sprite, float size, float brightness ) = 0; - virtual void Force ( void ) = 0; - - float m_flSize; //scale of object - float m_flScaleSpeed; //speed at which object expands - float m_flContractSpeed; //speed at which object expands - - float m_flStretchX; - float m_flStretchY; - - float m_flBrightness; //transparency of object - float m_flFadeSpeed; //speed at which object fades - - float m_flTimeCreated; //time object was instanced - float m_flDieTime; //time to remove an object - - float m_flGravity; //how effected by gravity is this object - float m_flAfterDampGrav; - float m_flDampingVelocity; - float m_flDampingTime; - - int m_iFramerate; - int m_iNumFrames; - int m_iFrame; - int m_iRendermode; - - Vector m_vOrigin; //object's position - Vector m_vAngles; //normal angles of object - - Vector m_vAVelocity; - - Vector m_vVelocity; - - Vector m_vLowLeft; - Vector m_vLowRight; - Vector m_vTopLeft; - - Vector m_vColor; - float m_flMass; - - model_s * m_pTexture; - - float m_flBounceFactor; - - char m_szClassname[32]; - - bool m_bInWater; - bool m_bAffectedByForce; - - int m_iAfterDampFlags; - - void SetLightFlag ( int iFlag ) - { - m_iRenderFlags &= ~( LIGHT_NONE | LIGHT_INTENSITY | LIGHT_COLOR ); - m_iRenderFlags |= iFlag; - } - - void SetCullFlag( int iFlag ) - { - m_iRenderFlags &= ~( CULL_PVS | CULL_FRUSTUM_POINT | CULL_FRUSTUM_PLANE | CULL_FRUSTUM_SPHERE ); - m_iRenderFlags |= iFlag; - } - - int GetRenderFlags( void ) - { - return m_iRenderFlags; - } - - bool GetParticlePVS ( void ) - { - return m_bInPVS; - } - - void SetParticlePVS ( bool bPVSStat ) - { - m_bInPVS = bPVSStat; - } - - float GetNextPVSCheck( void ) - { - return m_flNextPVSCheck; - } - - void SetNextPVSCheck( float flTime ) - { - m_flNextPVSCheck = flTime; - } - - void SetCollisionFlags ( int iFlag ) - { - m_iCollisionFlags |= iFlag; - } - - void ClearCollisionFlags ( int iFlag ) - { - m_iCollisionFlags &= ~iFlag; - } - - int GetCollisionFlags ( void ) - { - return m_iCollisionFlags; - } - - void SetRenderFlag( int iFlag ) - { - m_iRenderFlags |= iFlag; - } - - float GetPlayerDistance ( void ) { return m_flPlayerDistance; } - void SetPlayerDistance ( float flDistance ) { m_flPlayerDistance = flDistance; } - -protected: - float m_flOriginalSize; - Vector m_vOriginalAngles; - float m_flOriginalBrightness; - Vector m_vPrevOrigin; - - float m_flNextCollisionTime; - -protected: - static bool CheckSize(int size) - { - // This check will help prevent a class frome being defined later, - // that is larger than the max size MemoryPool is expecting, - // from being successfully allocated. - if (size > (unsigned long) CMiniMem::Instance()->MaxBlockSize()) - { -#ifdef _WIN32 - throw "New particle class is larger than memory pool max size, update lMaxParticleClassSize() function."; -#endif - return(false); - } - - return(true); - } -}; - - -#endif//TRIANGLEEFFECT_H__ diff --git a/regamedll/public/steam/isteamapps.h b/regamedll/public/steam/isteamapps.h deleted file mode 100644 index 4b985194..00000000 --- a/regamedll/public/steam/isteamapps.h +++ /dev/null @@ -1,127 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to app data in Steam -// -//============================================================================= - -#ifndef ISTEAMAPPS_H -#define ISTEAMAPPS_H -#ifdef _WIN32 -#pragma once -#endif - -const int k_cubAppProofOfPurchaseKeyMax = 64; // max bytes of a legacy cd key we support - - -//----------------------------------------------------------------------------- -// Purpose: interface to app data -//----------------------------------------------------------------------------- -class ISteamApps -{ -public: - virtual bool BIsSubscribed() = 0; - virtual bool BIsLowViolence() = 0; - virtual bool BIsCybercafe() = 0; - virtual bool BIsVACBanned() = 0; - virtual const char *GetCurrentGameLanguage() = 0; - virtual const char *GetAvailableGameLanguages() = 0; - - // only use this member if you need to check ownership of another game related to yours, a demo for example - virtual bool BIsSubscribedApp( AppId_t appID ) = 0; - - // Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed - virtual bool BIsDlcInstalled( AppId_t appID ) = 0; - - // returns the Unix time of the purchase of the app - virtual uint32 GetEarliestPurchaseUnixTime( AppId_t nAppID ) = 0; - - // Checks if the user is subscribed to the current app through a free weekend - // This function will return false for users who have a retail or other type of license - // Before using, please ask your Valve technical contact how to package and secure your free weekened - virtual bool BIsSubscribedFromFreeWeekend() = 0; - - // Returns the number of DLC pieces for the running app - virtual int GetDLCCount() = 0; - - // Returns metadata for DLC by index, of range [0, GetDLCCount()] - virtual bool BGetDLCDataByIndex( int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize ) = 0; - - // Install/Uninstall control for optional DLC - virtual void InstallDLC( AppId_t nAppID ) = 0; - virtual void UninstallDLC( AppId_t nAppID ) = 0; - - // Request cd-key for yourself or owned DLC. If you are interested in this - // data then make sure you provide us with a list of valid keys to be distributed - // to users when they purchase the game, before the game ships. - // You'll receive an AppProofOfPurchaseKeyResponse_t callback when - // the key is available (which may be immediately). - virtual void RequestAppProofOfPurchaseKey( AppId_t nAppID ) = 0; - - virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch - virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing - virtual uint32 GetInstalledDepots( DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order - - // returns current app install folder for AppID, returns folder name length - virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0; - -#ifdef _PS3 - // Result returned in a RegisterActivationCodeResponse_t callresult - virtual SteamAPICall_t RegisterActivationCode( const char *pchActivationCode ) = 0; -#endif -}; - -#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION005" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif -//----------------------------------------------------------------------------- -// Purpose: posted after the user gains ownership of DLC & that DLC is installed -//----------------------------------------------------------------------------- -struct DlcInstalled_t -{ - enum { k_iCallback = k_iSteamAppsCallbacks + 5 }; - AppId_t m_nAppID; // AppID of the DLC -}; - - -//----------------------------------------------------------------------------- -// Purpose: possible results when registering an activation code -//----------------------------------------------------------------------------- -enum ERegisterActivationCodeResult -{ - k_ERegisterActivationCodeResultOK = 0, - k_ERegisterActivationCodeResultFail = 1, - k_ERegisterActivationCodeResultAlreadyRegistered = 2, - k_ERegisterActivationCodeResultTimeout = 3, - k_ERegisterActivationCodeAlreadyOwned = 4, -}; - - -//----------------------------------------------------------------------------- -// Purpose: response to RegisterActivationCode() -//----------------------------------------------------------------------------- -struct RegisterActivationCodeResponse_t -{ - enum { k_iCallback = k_iSteamAppsCallbacks + 8 }; - ERegisterActivationCodeResult m_eResult; - uint32 m_unPackageRegistered; // package that was registered. Only set on success -}; - -//----------------------------------------------------------------------------- -// Purpose: response to RegisterActivationCode() -//----------------------------------------------------------------------------- -struct AppProofOfPurchaseKeyResponse_t -{ - enum { k_iCallback = k_iSteamAppsCallbacks + 13 }; - EResult m_eResult; - uint32 m_nAppID; - char m_rgchKey[ k_cubAppProofOfPurchaseKeyMax ]; -}; -#pragma pack( pop ) -#endif // ISTEAMAPPS_H diff --git a/regamedll/public/steam/isteambilling.h b/regamedll/public/steam/isteambilling.h deleted file mode 100644 index 503846c4..00000000 --- a/regamedll/public/steam/isteambilling.h +++ /dev/null @@ -1,108 +0,0 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= -// -// Purpose: interface to Billings data in Steam -// -//============================================================================= - -#ifndef ISTEAMBILLING_H -#define ISTEAMBILLING_H -#ifdef _WIN32 -#pragma once -#endif - -//----------------------------------------------------------------------------- -// Purpose: interface to billing -//----------------------------------------------------------------------------- -class ISteamBilling -{ -public: - // Sets the billing address in the ISteamBilling object for use by other ISteamBilling functions (not stored on server) - virtual bool SetBillingAddress( const char *pchName, - const char *pchAddress1, - const char *pchAddress2, - const char *pchCity, - const char *pchPostcode, - const char *pchState, - const char *pchCountry, - const char *pchPhone ) = 0; - // Gets any previous set billing address in the ISteamBilling object (not stored on server) - virtual bool GetBillingAddress( char *pchName, - char *pchAddress1, - char *pchAddress2, - char *pchCity, - char *pchPostcode, - char *pchState, - char *pchCountry, - char *pchPhone ) = 0; - // Sets the billing address in the ISteamBilling object for use by other ISteamBilling functions (not stored on server) - virtual bool SetShippingAddress( const char *pchName, - const char *pchAddress1, - const char *pchAddress2, - const char *pchCity, - const char *pchPostcode, - const char *pchState, - const char *pchCountry, - const char *pchPhone ) = 0; - // Gets any previous set billing address in the ISteamBilling object (not stored on server) - virtual bool GetShippingAddress( char *pchName, - char *pchAddress1, - char *pchAddress2, - char *pchCity, - char *pchPostcode, - char *pchState, - char *pchCountry, - char *pchPhone ) = 0; - // Ask the server for the final price of package: requires that ISteamBilling billing & shipping address are set (can be same) - virtual bool GetFinalPrice( int32 nPackageID ) = 0; - - // Sets the credit card info in the ISteamBilling object for use by other ISteamBilling functions (may eventually also be stored on server) - virtual bool SetCardInfo( int32 eCreditCardType, - const char *pchCardNumber, - const char *pchCardHolderName, - const char *pchCardExpYear, - const char *pchCardExpMonth, - const char *pchCardCVV2 ) = 0; - // Gets any credit card info in the ISteamBilling object (not stored on server) - virtual bool GetCardInfo( int32 *eCreditCardType, - char *pchCardNumber, - char *pchCardHolderName, - char *pchCardExpYear, - char *pchCardExpMonth, - char *pchCardCVV2 ) = 0; - - // Ask the server to purchase a package: requires that ISteamBilling cardinfo, billing & shipping address are set - virtual bool Purchase( int32 nPackageID, - int32 nExpectedCostCents, - uint64 gidCardID, // if non-NIL, use a server stored card - bool bStoreCardInfo ) = 0; // Should this cardinfo also be stored on the server -}; - - -#define STEAMBILLING_INTERFACE_VERSION "SteamBilling001" - - -enum { k_iSteamBillingCallbacks = 400 }; - -//----------------------------------------------------------------------------- -// Purpose: called when this client has received a finalprice message from a Billing -//----------------------------------------------------------------------------- -struct FinalPriceMsg_t -{ - enum { k_iCallback = k_iSteamBillingCallbacks + 1 }; - - uint32 m_bSuccess; - uint32 m_nBaseCost; - uint32 m_nTotalDiscount; - uint32 m_nTax; - uint32 m_nShippingCost; -}; - -struct PurchaseMsg_t -{ - enum { k_iCallback = k_iSteamBillingCallbacks + 2 }; - - uint32 m_bSuccess; - int32 m_EPurchaseResultDetail; // Detailed result information -}; - -#endif // ISTEAMBILLING_H diff --git a/regamedll/public/steam/isteamclient.h b/regamedll/public/steam/isteamclient.h deleted file mode 100644 index 952b1eba..00000000 --- a/regamedll/public/steam/isteamclient.h +++ /dev/null @@ -1,349 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: Main interface for loading and accessing Steamworks API's from the -// Steam client. -// For most uses, this code is wrapped inside of SteamAPI_Init() -//============================================================================= - -#ifndef ISTEAMCLIENT_H -#define ISTEAMCLIENT_H -#ifdef _WIN32 -#pragma once -#endif - -#include "steamtypes.h" -#include "steamclientpublic.h" - -// Define compile time assert macros to let us validate the structure sizes. -#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1]; - -#if defined(__linux__) || defined(__APPLE__) -// The 32-bit version of gcc has the alignment requirement for uint64 and double set to -// 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned. -// The 64-bit version of gcc has the alignment requirement for these types set to -// 8 meaning that unless we use #pragma pack(4) our structures will get bigger. -// The 64-bit structure packing has to match the 32-bit structure packing for each platform. -#define VALVE_CALLBACK_PACK_SMALL -#else -#define VALVE_CALLBACK_PACK_LARGE -#endif - -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error ??? -#endif - -typedef struct -{ - uint32 m_u32; - uint64 m_u64; - uint16 m_u16; - double m_d; -} ValvePackingSentinel_t; - -#pragma pack( pop ) - - -#if defined(VALVE_CALLBACK_PACK_SMALL) -VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 24 ) -#elif defined(VALVE_CALLBACK_PACK_LARGE) -VALVE_COMPILE_TIME_ASSERT( sizeof(ValvePackingSentinel_t) == 32 ) -#else -#error ??? -#endif - - -// handle to a communication pipe to the Steam client -typedef int32 HSteamPipe; -// handle to single instance of a steam user -typedef int32 HSteamUser; -// function prototype -#if defined( POSIX ) -#define __cdecl -#endif -extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *); - -#if defined( __SNC__ ) - #pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor -#endif - -// interface predec -class ISteamUser; -class ISteamGameServer; -class ISteamFriends; -class ISteamUtils; -class ISteamMatchmaking; -class ISteamContentServer; -class ISteamMatchmakingServers; -class ISteamUserStats; -class ISteamApps; -class ISteamNetworking; -class ISteamRemoteStorage; -class ISteamScreenshots; -class ISteamGameServerStats; -class ISteamPS3OverlayRender; -class ISteamHTTP; -class ISteamUnifiedMessages; - -//----------------------------------------------------------------------------- -// Purpose: Interface to creating a new steam instance, or to -// connect to an existing steam instance, whether it's in a -// different process or is local. -// -// For most scenarios this is all handled automatically via SteamAPI_Init(). -// You'll only need to use these interfaces if you have a more complex versioning scheme, -// where you want to get different versions of the same interface in different dll's in your project. -//----------------------------------------------------------------------------- -class ISteamClient -{ -public: - // Creates a communication pipe to the Steam client - virtual HSteamPipe CreateSteamPipe() = 0; - - // Releases a previously created communications pipe - virtual bool BReleaseSteamPipe( HSteamPipe hSteamPipe ) = 0; - - // connects to an existing global user, failing if none exists - // used by the game to coordinate with the steamUI - virtual HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe ) = 0; - - // used by game servers, create a steam user that won't be shared with anyone else - virtual HSteamUser CreateLocalUser( HSteamPipe *phSteamPipe, EAccountType eAccountType ) = 0; - - // removes an allocated user - virtual void ReleaseUser( HSteamPipe hSteamPipe, HSteamUser hUser ) = 0; - - // retrieves the ISteamUser interface associated with the handle - virtual ISteamUser *GetISteamUser( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // retrieves the ISteamGameServer interface associated with the handle - virtual ISteamGameServer *GetISteamGameServer( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // set the local IP and Port to bind to - // this must be set before CreateLocalUser() - virtual void SetLocalIPBinding( uint32 unIP, uint16 usPort ) = 0; - - // returns the ISteamFriends interface - virtual ISteamFriends *GetISteamFriends( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamUtils interface - virtual ISteamUtils *GetISteamUtils( HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamMatchmaking interface - virtual ISteamMatchmaking *GetISteamMatchmaking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamMatchmakingServers interface - virtual ISteamMatchmakingServers *GetISteamMatchmakingServers( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the a generic interface - virtual void *GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamUserStats interface - virtual ISteamUserStats *GetISteamUserStats( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns the ISteamGameServerStats interface - virtual ISteamGameServerStats *GetISteamGameServerStats( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // returns apps interface - virtual ISteamApps *GetISteamApps( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // networking - virtual ISteamNetworking *GetISteamNetworking( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // remote storage - virtual ISteamRemoteStorage *GetISteamRemoteStorage( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // user screenshots - virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - - // this needs to be called every frame to process matchmaking results - // redundant if you're already calling SteamAPI_RunCallbacks() - virtual void RunFrame() = 0; - - // returns the number of IPC calls made since the last time this function was called - // Used for perf debugging so you can understand how many IPC calls your game makes per frame - // Every IPC call is at minimum a thread context switch if not a process one so you want to rate - // control how often you do them. - virtual uint32 GetIPCCallCount() = 0; - - // API warning handling - // 'int' is the severity; 0 for msg, 1 for warning - // 'const char *' is the text of the message - // callbacks will occur directly after the API function is called that generated the warning or message - virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0; - - // Trigger global shutdown for the DLL - virtual bool BShutdownIfAllPipesClosed() = 0; - -#ifdef _PS3 - virtual ISteamPS3OverlayRender *GetISteamPS3OverlayRender() = 0; -#endif - - // Expose HTTP interface - virtual ISteamHTTP *GetISteamHTTP( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - - // Exposes the ISteamUnifiedMessages interface - virtual ISteamUnifiedMessages *GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; - -}; - -#define STEAMCLIENT_INTERFACE_VERSION "SteamClient012" - -//----------------------------------------------------------------------------- -// Purpose: Base values for callback identifiers, each callback must -// have a unique ID. -//----------------------------------------------------------------------------- -enum { k_iSteamUserCallbacks = 100 }; -enum { k_iSteamGameServerCallbacks = 200 }; -enum { k_iSteamFriendsCallbacks = 300 }; -enum { k_iSteamBillingCallbacks = 400 }; -enum { k_iSteamMatchmakingCallbacks = 500 }; -enum { k_iSteamContentServerCallbacks = 600 }; -enum { k_iSteamUtilsCallbacks = 700 }; -enum { k_iClientFriendsCallbacks = 800 }; -enum { k_iClientUserCallbacks = 900 }; -enum { k_iSteamAppsCallbacks = 1000 }; -enum { k_iSteamUserStatsCallbacks = 1100 }; -enum { k_iSteamNetworkingCallbacks = 1200 }; -enum { k_iClientRemoteStorageCallbacks = 1300 }; -enum { k_iSteamUserItemsCallbacks = 1400 }; -enum { k_iSteamGameServerItemsCallbacks = 1500 }; -enum { k_iClientUtilsCallbacks = 1600 }; -enum { k_iSteamGameCoordinatorCallbacks = 1700 }; -enum { k_iSteamGameServerStatsCallbacks = 1800 }; -enum { k_iSteam2AsyncCallbacks = 1900 }; -enum { k_iSteamGameStatsCallbacks = 2000 }; -enum { k_iClientHTTPCallbacks = 2100 }; -enum { k_iClientScreenshotsCallbacks = 2200 }; -enum { k_iSteamScreenshotsCallbacks = 2300 }; -enum { k_iClientAudioCallbacks = 2400 }; -enum { k_iClientUnifiedMessagesCallbacks = 2500 }; -enum { k_iSteamStreamLauncherCallbacks = 2600 }; -enum { k_iClientControllerCallbacks = 2700 }; -enum { k_iSteamControllerCallbacks = 2800 }; -enum { k_iClientParentalSettingsCallbacks = 2900 }; -enum { k_iClientDeviceAuthCallbacks = 3000 }; -enum { k_iClientNetworkDeviceManagerCallbacks = 3100 }; - - -//----------------------------------------------------------------------------- -// The CALLBACK macros are for client side callback logging enabled with -// log_callback -// Do not change any of these. -//----------------------------------------------------------------------------- - -class CSteamCallback -{ -public: - virtual const char *GetCallbackName() const = 0; - virtual uint32 GetCallbackID() const = 0; - virtual uint8 *GetFixedData() const = 0; - virtual uint32 GetFixedSize() const = 0; - virtual uint32 GetNumMemberVariables() const = 0; - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const = 0; -}; - -#define DEFINE_CALLBACK( callbackname, callbackid ) \ -struct callbackname##_t { \ - enum { k_iCallback = callbackid }; \ - static callbackname##_t *GetNullPointer() { return 0; } - -#define CALLBACK_MEMBER( varidx, vartype, varname ) \ - public: vartype varname ; \ - static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \ - varOffset = (unsigned int)(size_t)&GetNullPointer()->varname; \ - varSize = sizeof( vartype ); \ - varCount = 1; \ - *pszName = #varname; *pszType = #vartype; } - -#define CALLBACK_ARRAY( varidx, vartype, varname, varcount ) \ - public: vartype varname [ varcount ]; \ - static void GetMemberVar_##varidx( unsigned int &varOffset, unsigned int &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \ - varOffset = (unsigned int)(size_t)&GetNullPointer()->varname[0]; \ - varSize = sizeof( vartype ); \ - varCount = varcount; \ - *pszName = #varname; *pszType = #vartype; } - - -#define END_CALLBACK_INTERNAL_BEGIN( callbackname, numvars ) }; \ -class C##callbackname : public CSteamCallback { \ -public: callbackname##_t m_Data; \ - C##callbackname () { memset( &m_Data, 0, sizeof(m_Data) ); } \ - virtual const char *GetCallbackName() const { return #callbackname; } \ - virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \ - virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \ - virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \ - virtual uint32 GetNumMemberVariables() const { return numvars; } \ - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { \ - switch ( index ) { default : return false; - - -#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : m_Data.GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true; - -#define END_CALLBACK_INTERNAL_END() }; }; }; - -#define END_DEFINE_CALLBACK_0( callbackname ) }; \ -class C##callbackname : public CSteamCallback { \ -public: callbackname##_t m_Data; \ - virtual const char *GetCallbackName() const { return #callbackname; } \ - virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \ - virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \ - virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \ - virtual uint32 GetNumMemberVariables() const { return 0; } \ - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { return false; } \ - }; \ - - -#define END_DEFINE_CALLBACK_1( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 1 ) \ - END_CALLBACK_INTERNAL_SWITCH( 0 ) \ - END_CALLBACK_INTERNAL_END() - -#define END_DEFINE_CALLBACK_2( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 2 ) \ - END_CALLBACK_INTERNAL_SWITCH( 0 ) \ - END_CALLBACK_INTERNAL_SWITCH( 1 ) \ - END_CALLBACK_INTERNAL_END() - -#define END_DEFINE_CALLBACK_3( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 3 ) \ - END_CALLBACK_INTERNAL_SWITCH( 0 ) \ - END_CALLBACK_INTERNAL_SWITCH( 1 ) \ - END_CALLBACK_INTERNAL_SWITCH( 2 ) \ - END_CALLBACK_INTERNAL_END() - -#define END_DEFINE_CALLBACK_4( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 4 ) \ - END_CALLBACK_INTERNAL_SWITCH( 0 ) \ - END_CALLBACK_INTERNAL_SWITCH( 1 ) \ - END_CALLBACK_INTERNAL_SWITCH( 2 ) \ - END_CALLBACK_INTERNAL_SWITCH( 3 ) \ - END_CALLBACK_INTERNAL_END() - - -#define END_DEFINE_CALLBACK_6( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 6 ) \ - END_CALLBACK_INTERNAL_SWITCH( 0 ) \ - END_CALLBACK_INTERNAL_SWITCH( 1 ) \ - END_CALLBACK_INTERNAL_SWITCH( 2 ) \ - END_CALLBACK_INTERNAL_SWITCH( 3 ) \ - END_CALLBACK_INTERNAL_SWITCH( 4 ) \ - END_CALLBACK_INTERNAL_SWITCH( 5 ) \ - END_CALLBACK_INTERNAL_END() - -#define END_DEFINE_CALLBACK_7( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 7 ) \ - END_CALLBACK_INTERNAL_SWITCH( 0 ) \ - END_CALLBACK_INTERNAL_SWITCH( 1 ) \ - END_CALLBACK_INTERNAL_SWITCH( 2 ) \ - END_CALLBACK_INTERNAL_SWITCH( 3 ) \ - END_CALLBACK_INTERNAL_SWITCH( 4 ) \ - END_CALLBACK_INTERNAL_SWITCH( 5 ) \ - END_CALLBACK_INTERNAL_SWITCH( 6 ) \ - END_CALLBACK_INTERNAL_END() - -#endif // ISTEAMCLIENT_H diff --git a/regamedll/public/steam/isteamcontroller.h b/regamedll/public/steam/isteamcontroller.h deleted file mode 100644 index 6c2e1173..00000000 --- a/regamedll/public/steam/isteamcontroller.h +++ /dev/null @@ -1,62 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to valve controller -// -//============================================================================= - -#ifndef ISTEAMCONTROLLER_H -#define ISTEAMCONTROLLER_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - - -#pragma pack( pop ) - -//----------------------------------------------------------------------------- -// Purpose: Functions for accessing stats, achievements, and leaderboard information -//----------------------------------------------------------------------------- -class ISteamController -{ -public: - -}; - -#define STEAMCONTROLLER_INTERFACE_VERSION "STEAMCONTROLLER_INTERFACE_VERSION" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -/* -struct ControllerCallback_t -{ - enum { k_iCallback = k_iSteamControllerCallbacks + 1 }; - -}; -*/ - - -#pragma pack( pop ) - - -#endif // ISTEAMCONTROLLER_H diff --git a/regamedll/public/steam/isteamfriends.h b/regamedll/public/steam/isteamfriends.h deleted file mode 100644 index 6e8ad0c5..00000000 --- a/regamedll/public/steam/isteamfriends.h +++ /dev/null @@ -1,606 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to both friends list data and general information about users -// -//============================================================================= - -#ifndef ISTEAMFRIENDS_H -#define ISTEAMFRIENDS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" -#include "steamclientpublic.h" - - -//----------------------------------------------------------------------------- -// Purpose: set of relationships to other users -//----------------------------------------------------------------------------- -enum EFriendRelationship -{ - k_EFriendRelationshipNone = 0, - k_EFriendRelationshipBlocked = 1, - k_EFriendRelationshipRequestRecipient = 2, - k_EFriendRelationshipFriend = 3, - k_EFriendRelationshipRequestInitiator = 4, - k_EFriendRelationshipIgnored = 5, - k_EFriendRelationshipIgnoredFriend = 6, - k_EFriendRelationshipSuggested = 7, - - // keep this updated - k_EFriendRelationshipMax = 8, -}; - -// maximum length of friend group name (not including terminating nul!) -const int k_cchMaxFriendsGroupName = 64; - -// maximum number of groups a single user is allowed -const int k_cFriendsGroupLimit = 100; - -const int k_cEnumerateFollowersMax = 50; - - -//----------------------------------------------------------------------------- -// Purpose: list of states a friend can be in -//----------------------------------------------------------------------------- -enum EPersonaState -{ - k_EPersonaStateOffline = 0, // friend is not currently logged on - k_EPersonaStateOnline = 1, // friend is logged on - k_EPersonaStateBusy = 2, // user is on, but busy - k_EPersonaStateAway = 3, // auto-away feature - k_EPersonaStateSnooze = 4, // auto-away for a long time - k_EPersonaStateLookingToTrade = 5, // Online, trading - k_EPersonaStateLookingToPlay = 6, // Online, wanting to play - k_EPersonaStateMax, -}; - - -//----------------------------------------------------------------------------- -// Purpose: flags for enumerating friends list, or quickly checking a the relationship between users -//----------------------------------------------------------------------------- -enum EFriendFlags -{ - k_EFriendFlagNone = 0x00, - k_EFriendFlagBlocked = 0x01, - k_EFriendFlagFriendshipRequested = 0x02, - k_EFriendFlagImmediate = 0x04, // "regular" friend - k_EFriendFlagClanMember = 0x08, - k_EFriendFlagOnGameServer = 0x10, - // k_EFriendFlagHasPlayedWith = 0x20, // not currently used - // k_EFriendFlagFriendOfFriend = 0x40, // not currently used - k_EFriendFlagRequestingFriendship = 0x80, - k_EFriendFlagRequestingInfo = 0x100, - k_EFriendFlagIgnored = 0x200, - k_EFriendFlagIgnoredFriend = 0x400, - k_EFriendFlagSuggested = 0x800, - k_EFriendFlagAll = 0xFFFF, -}; - - -// friend game played information -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif -struct FriendGameInfo_t -{ - CGameID m_gameID; - uint32 m_unGameIP; - uint16 m_usGamePort; - uint16 m_usQueryPort; - CSteamID m_steamIDLobby; -}; -#pragma pack( pop ) - -// maximum number of characters in a user's name. Two flavors; one for UTF-8 and one for UTF-16. -// The UTF-8 version has to be very generous to accomodate characters that get large when encoded -// in UTF-8. -enum -{ - k_cchPersonaNameMax = 128, - k_cwchPersonaNameMax = 32, -}; - -//----------------------------------------------------------------------------- -// Purpose: user restriction flags -//----------------------------------------------------------------------------- -enum EUserRestriction -{ - k_nUserRestrictionNone = 0, // no known chat/content restriction - k_nUserRestrictionUnknown = 1, // we don't know yet (user offline) - k_nUserRestrictionAnyChat = 2, // user is not allowed to (or can't) send/recv any chat - k_nUserRestrictionVoiceChat = 4, // user is not allowed to (or can't) send/recv voice chat - k_nUserRestrictionGroupChat = 8, // user is not allowed to (or can't) send/recv group chat - k_nUserRestrictionRating = 16, // user is too young according to rating in current region - k_nUserRestrictionGameInvites = 32, // user cannot send or recv game invites (e.g. mobile) - k_nUserRestrictionTrading = 64, // user cannot participate in trading (console, mobile) -}; - -//----------------------------------------------------------------------------- -// Purpose: information about user sessions -//----------------------------------------------------------------------------- -struct FriendSessionStateInfo_t -{ - uint32 m_uiOnlineSessionInstances; - uint8 m_uiPublishedToFriendsSessionInstance; -}; - - - -// size limit on chat room or member metadata -const uint32 k_cubChatMetadataMax = 8192; - -// size limits on Rich Presence data -enum { k_cchMaxRichPresenceKeys = 20 }; -enum { k_cchMaxRichPresenceKeyLength = 64 }; -enum { k_cchMaxRichPresenceValueLength = 256 }; - -// These values are passed as parameters to the store -enum EOverlayToStoreFlag -{ - k_EOverlayToStoreFlag_None = 0, - k_EOverlayToStoreFlag_AddToCart = 1, - k_EOverlayToStoreFlag_AddToCartAndShow = 2, -}; - -//----------------------------------------------------------------------------- -// Purpose: interface to accessing information about individual users, -// that can be a friend, in a group, on a game server or in a lobby with the local user -//----------------------------------------------------------------------------- -class ISteamFriends -{ -public: - // returns the local players name - guaranteed to not be NULL. - // this is the same name as on the users community profile page - // this is stored in UTF-8 format - // like all the other interface functions that return a char *, it's important that this pointer is not saved - // off; it will eventually be free'd or re-allocated - virtual const char *GetPersonaName() = 0; - - // Sets the player name, stores it on the server and publishes the changes to all friends who are online. - // Changes take place locally immediately, and a PersonaStateChange_t is posted, presuming success. - // - // The final results are available through the return value SteamAPICall_t, using SetPersonaNameResponse_t. - // - // If the name change fails to happen on the server, then an additional global PersonaStateChange_t will be posted - // to change the name back, in addition to the SetPersonaNameResponse_t callback. - virtual SteamAPICall_t SetPersonaName( const char *pchPersonaName ) = 0; - - // gets the status of the current user - virtual EPersonaState GetPersonaState() = 0; - - // friend iteration - // takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria - // then GetFriendByIndex() can then be used to return the id's of each of those users - virtual int GetFriendCount( int iFriendFlags ) = 0; - - // returns the steamID of a user - // iFriend is a index of range [0, GetFriendCount()) - // iFriendsFlags must be the same value as used in GetFriendCount() - // the returned CSteamID can then be used by all the functions below to access details about the user - virtual CSteamID GetFriendByIndex( int iFriend, int iFriendFlags ) = 0; - - // returns a relationship to a user - virtual EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend ) = 0; - - // returns the current status of the specified user - // this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user - virtual EPersonaState GetFriendPersonaState( CSteamID steamIDFriend ) = 0; - - // returns the name another user - guaranteed to not be NULL. - // same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user - // note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously - // - virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0; - - // returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details - virtual bool GetFriendGamePlayed( CSteamID steamIDFriend, FriendGameInfo_t *pFriendGameInfo ) = 0; - // accesses old friends names - returns an empty string when their are no more items in the history - virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0; - - // returns true if the specified user meets any of the criteria specified in iFriendFlags - // iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values - virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0; - - // clan (group) iteration and access functions - virtual int GetClanCount() = 0; - virtual CSteamID GetClanByIndex( int iClan ) = 0; - virtual const char *GetClanName( CSteamID steamIDClan ) = 0; - virtual const char *GetClanTag( CSteamID steamIDClan ) = 0; - // returns the most recent information we have about what's happening in a clan - virtual bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting ) = 0; - // for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest - virtual SteamAPICall_t DownloadClanActivityCounts( CSteamID *psteamIDClans, int cClansToRequest ) = 0; - - // iterators for getting users in a chat room, lobby, game server or clan - // note that large clans that cannot be iterated by the local user - // note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby - // steamIDSource can be the steamID of a group, game server, lobby or chat room - virtual int GetFriendCountFromSource( CSteamID steamIDSource ) = 0; - virtual CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend ) = 0; - - // returns true if the local user can see that steamIDUser is a member or in steamIDSource - virtual bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource ) = 0; - - // User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI) - virtual void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking ) = 0; - - // activates the game overlay, with an optional dialog to open - // valid options are "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements" - virtual void ActivateGameOverlay( const char *pchDialog ) = 0; - - // activates game overlay to a specific place - // valid options are - // "steamid" - opens the overlay web browser to the specified user or groups profile - // "chat" - opens a chat window to the specified user, or joins the group chat - // "jointrade" - opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API - // "stats" - opens the overlay web browser to the specified user's stats - // "achievements" - opens the overlay web browser to the specified user's achievements - // "friendadd" - opens the overlay in minimal mode prompting the user to add the target user as a friend - // "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend - // "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite - // "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite - virtual void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID ) = 0; - - // activates game overlay web browser directly to the specified URL - // full address with protocol type is required, e.g. http://www.steamgames.com/ - virtual void ActivateGameOverlayToWebPage( const char *pchURL ) = 0; - - // activates game overlay to store page for app - virtual void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag ) = 0; - - // Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is - // in game - virtual void SetPlayedWith( CSteamID steamIDUserPlayedWith ) = 0; - - // activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby. - virtual void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby ) = 0; - - // gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set - virtual int GetSmallFriendAvatar( CSteamID steamIDFriend ) = 0; - - // gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set - virtual int GetMediumFriendAvatar( CSteamID steamIDFriend ) = 0; - - // gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set - // returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again - virtual int GetLargeFriendAvatar( CSteamID steamIDFriend ) = 0; - - // requests information about a user - persona name & avatar - // if bRequireNameOnly is set, then the avatar of a user isn't downloaded - // - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them - // if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved - // if returns false, it means that we already have all the details about that user, and functions can be called immediately - virtual bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly ) = 0; - - // requests information about a clan officer list - // when complete, data is returned in ClanOfficerListResponse_t call result - // this makes available the calls below - // you can only ask about clans that a user is a member of - // note that this won't download avatars automatically; if you get an officer, - // and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar - virtual SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan ) = 0; - - // iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed - - // returns the steamID of the clan owner - virtual CSteamID GetClanOwner( CSteamID steamIDClan ) = 0; - // returns the number of officers in a clan (including the owner) - virtual int GetClanOfficerCount( CSteamID steamIDClan ) = 0; - // returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount) - virtual CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer ) = 0; - // if current user is chat restricted, he can't send or receive any text/voice chat messages. - // the user can't see custom avatars. But the user can be online and send/recv game invites. - // a chat restricted user can't add friends or join any groups. - virtual uint32 GetUserRestrictions() = 0; - - // Rich Presence data is automatically shared between friends who are in the same game - // Each user has a set of Key/Value pairs - // Up to 20 different keys can be set - // There are two magic keys: - // "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list - // "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game - // GetFriendRichPresence() returns an empty string "" if no value is set - // SetRichPresence() to a NULL or an empty string deletes the key - // You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount() - // and GetFriendRichPresenceKeyByIndex() (typically only used for debugging) - virtual bool SetRichPresence( const char *pchKey, const char *pchValue ) = 0; - virtual void ClearRichPresence() = 0; - virtual const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey ) = 0; - virtual int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend ) = 0; - virtual const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey ) = 0; - // Requests rich presence for a specific user. - virtual void RequestFriendRichPresence( CSteamID steamIDFriend ) = 0; - - // rich invite support - // if the target accepts the invite, the pchConnectString gets added to the command-line for launching the game - // if the game is already running, a GameRichPresenceJoinRequested_t callback is posted containing the connect string - // invites can only be sent to friends - virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0; - - // recently-played-with friends iteration - // this iterates the entire list of users recently played with, across games - // GetFriendCoplayTime() returns as a unix time - virtual int GetCoplayFriendCount() = 0; - virtual CSteamID GetCoplayFriend( int iCoplayFriend ) = 0; - virtual int GetFriendCoplayTime( CSteamID steamIDFriend ) = 0; - virtual AppId_t GetFriendCoplayGame( CSteamID steamIDFriend ) = 0; - - // chat interface for games - // this allows in-game access to group (clan) chats from in the game - // the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay - // use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat - virtual SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan ) = 0; - virtual bool LeaveClanChatRoom( CSteamID steamIDClan ) = 0; - virtual int GetClanChatMemberCount( CSteamID steamIDClan ) = 0; - virtual CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) = 0; - virtual bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) = 0; - virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *, CSteamID * ) = 0; - virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0; - - // interact with the Steam (game overlay / desktop) - virtual bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat ) = 0; - virtual bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0; - virtual bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat ) = 0; - - // peer-to-peer chat interception - // this is so you can show P2P chats inline in the game - virtual bool SetListenForFriendsMessages( bool bInterceptEnabled ) = 0; - virtual bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend ) = 0; - virtual int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0; - - // following apis - virtual SteamAPICall_t GetFollowerCount( CSteamID steamID ) = 0; - virtual SteamAPICall_t IsFollowing( CSteamID steamID ) = 0; - virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0; -}; - -#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends013" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: called when a friends' status changes -//----------------------------------------------------------------------------- -struct PersonaStateChange_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 4 }; - - uint64 m_ulSteamID; // steamID of the friend who changed - int m_nChangeFlags; // what's changed -}; - - -// used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user -// these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend -enum EPersonaChange -{ - k_EPersonaChangeName = 0x0001, - k_EPersonaChangeStatus = 0x0002, - k_EPersonaChangeComeOnline = 0x0004, - k_EPersonaChangeGoneOffline = 0x0008, - k_EPersonaChangeGamePlayed = 0x0010, - k_EPersonaChangeGameServer = 0x0020, - k_EPersonaChangeAvatar = 0x0040, - k_EPersonaChangeJoinedSource= 0x0080, - k_EPersonaChangeLeftSource = 0x0100, - k_EPersonaChangeRelationshipChanged = 0x0200, - k_EPersonaChangeNameFirstSet = 0x0400, - k_EPersonaChangeFacebookInfo = 0x0800, - k_EPersonaChangeNickname = 0x1000, - k_EPersonaChangeSteamLevel = 0x2000, -}; - - -//----------------------------------------------------------------------------- -// Purpose: posted when game overlay activates or deactivates -// the game can use this to be pause or resume single player games -//----------------------------------------------------------------------------- -struct GameOverlayActivated_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 31 }; - uint8 m_bActive; // true if it's just been activated, false otherwise -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the user tries to join a different game server from their friends list -// game client should attempt to connect to specified server when this is received -//----------------------------------------------------------------------------- -struct GameServerChangeRequested_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 32 }; - char m_rgchServer[64]; // server address ("127.0.0.1:27015", "tf2.valvesoftware.com") - char m_rgchPassword[64]; // server password, if any -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the user tries to join a lobby from their friends list -// game client should attempt to connect to specified lobby when this is received -//----------------------------------------------------------------------------- -struct GameLobbyJoinRequested_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 33 }; - CSteamID m_steamIDLobby; - - // The friend they did the join via (will be invalid if not directly via a friend) - // - // On PS3, the friend will be invalid if this was triggered by a PSN invite via the XMB, but - // the account type will be console user so you can tell at least that this was from a PSN friend - // rather than a Steam friend. - CSteamID m_steamIDFriend; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when an avatar is loaded in from a previous GetLargeFriendAvatar() call -// if the image wasn't already available -//----------------------------------------------------------------------------- -struct AvatarImageLoaded_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 34 }; - CSteamID m_steamID; // steamid the avatar has been loaded for - int m_iImage; // the image index of the now loaded image - int m_iWide; // width of the loaded image - int m_iTall; // height of the loaded image -}; - - -//----------------------------------------------------------------------------- -// Purpose: marks the return of a request officer list call -//----------------------------------------------------------------------------- -struct ClanOfficerListResponse_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 35 }; - CSteamID m_steamIDClan; - int m_cOfficers; - uint8 m_bSuccess; -}; - - -//----------------------------------------------------------------------------- -// Purpose: callback indicating updated data about friends rich presence information -//----------------------------------------------------------------------------- -struct FriendRichPresenceUpdate_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 36 }; - CSteamID m_steamIDFriend; // friend who's rich presence has changed - AppId_t m_nAppID; // the appID of the game (should always be the current game) -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the user tries to join a game from their friends list -// rich presence will have been set with the "connect" key which is set here -//----------------------------------------------------------------------------- -struct GameRichPresenceJoinRequested_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 37 }; - CSteamID m_steamIDFriend; // the friend they did the join via (will be invalid if not directly via a friend) - char m_rgchConnect[k_cchMaxRichPresenceValueLength]; -}; - - -//----------------------------------------------------------------------------- -// Purpose: a chat message has been received for a clan chat the game has joined -//----------------------------------------------------------------------------- -struct GameConnectedClanChatMsg_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 38 }; - CSteamID m_steamIDClanChat; - CSteamID m_steamIDUser; - int m_iMessageID; -}; - - -//----------------------------------------------------------------------------- -// Purpose: a user has joined a clan chat -//----------------------------------------------------------------------------- -struct GameConnectedChatJoin_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 39 }; - CSteamID m_steamIDClanChat; - CSteamID m_steamIDUser; -}; - - -//----------------------------------------------------------------------------- -// Purpose: a user has left the chat we're in -//----------------------------------------------------------------------------- -struct GameConnectedChatLeave_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 40 }; - CSteamID m_steamIDClanChat; - CSteamID m_steamIDUser; - bool m_bKicked; // true if admin kicked - bool m_bDropped; // true if Steam connection dropped -}; - - -//----------------------------------------------------------------------------- -// Purpose: a DownloadClanActivityCounts() call has finished -//----------------------------------------------------------------------------- -struct DownloadClanActivityCountsResult_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 41 }; - bool m_bSuccess; -}; - - -//----------------------------------------------------------------------------- -// Purpose: a JoinClanChatRoom() call has finished -//----------------------------------------------------------------------------- -struct JoinClanChatRoomCompletionResult_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 42 }; - CSteamID m_steamIDClanChat; - EChatRoomEnterResponse m_eChatRoomEnterResponse; -}; - -//----------------------------------------------------------------------------- -// Purpose: a chat message has been received from a user -//----------------------------------------------------------------------------- -struct GameConnectedFriendChatMsg_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 43 }; - CSteamID m_steamIDUser; - int m_iMessageID; -}; - - -struct FriendsGetFollowerCount_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 44 }; - EResult m_eResult; - CSteamID m_steamID; - int m_nCount; -}; - - -struct FriendsIsFollowing_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 45 }; - EResult m_eResult; - CSteamID m_steamID; - bool m_bIsFollowing; -}; - - -struct FriendsEnumerateFollowingList_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 46 }; - EResult m_eResult; - CSteamID m_rgSteamID[ k_cEnumerateFollowersMax ]; - int32 m_nResultsReturned; - int32 m_nTotalResultCount; -}; - -//----------------------------------------------------------------------------- -// Purpose: reports the result of an attempt to change the user's persona name -//----------------------------------------------------------------------------- -struct SetPersonaNameResponse_t -{ - enum { k_iCallback = k_iSteamFriendsCallbacks + 47 }; - - bool m_bSuccess; // true if name change succeeded completely. - bool m_bLocalSuccess; // true if name change was retained locally. (We might not have been able to communicate with Steam) - EResult m_result; // detailed result code -}; - - -#pragma pack( pop ) - -#endif // ISTEAMFRIENDS_H diff --git a/regamedll/public/steam/isteamgameserver.h b/regamedll/public/steam/isteamgameserver.h deleted file mode 100644 index 6ae3cd6f..00000000 --- a/regamedll/public/steam/isteamgameserver.h +++ /dev/null @@ -1,391 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to steam for game servers -// -//============================================================================= - -#ifndef ISTEAMGAMESERVER_H -#define ISTEAMGAMESERVER_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -#define MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE ((uint16)-1) - -//----------------------------------------------------------------------------- -// Purpose: Functions for authenticating users via Steam to play on a game server -//----------------------------------------------------------------------------- -class ISteamGameServer -{ -public: - -// -// Basic server data. These properties, if set, must be set before before calling LogOn. They -// may not be changed after logged in. -// - - /// This is called by SteamGameServer_Init, and you will usually not need to call it directly - virtual bool InitGameServer( uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString ) = 0; - - /// Game product identifier. This is currently used by the master server for version checking purposes. - /// It's a required field, but will eventually will go away, and the AppID will be used for this purpose. - virtual void SetProduct( const char *pszProduct ) = 0; - - /// Description of the game. This is a required field and is displayed in the steam server browser....for now. - /// This is a required field, but it will go away eventually, as the data should be determined from the AppID. - virtual void SetGameDescription( const char *pszGameDescription ) = 0; - - /// If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning - /// this application is the original game, not a mod. - /// - /// @see k_cbMaxGameServerGameDir - virtual void SetModDir( const char *pszModDir ) = 0; - - /// Is this is a dedicated server? The default value is false. - virtual void SetDedicatedServer( bool bDedicated ) = 0; - -// -// Login -// - - /// Begin process to login to a persistent game server account - /// - /// You need to register for callbacks to determine the result of this operation. - /// @see SteamServersConnected_t - /// @see SteamServerConnectFailure_t - /// @see SteamServersDisconnected_t - virtual void LogOn( - const char *pszAccountName, - const char *pszPassword - ) = 0; - - /// Login to a generic, anonymous account. - /// - /// Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init, - /// but this is no longer the case. - virtual void LogOnAnonymous() = 0; - - /// Begin process of logging game server out of steam - virtual void LogOff() = 0; - - // status functions - virtual bool BLoggedOn() = 0; - virtual bool BSecure() = 0; - virtual CSteamID GetSteamID() = 0; - - /// Returns true if the master server has requested a restart. - /// Only returns true once per request. - virtual bool WasRestartRequested() = 0; - -// -// Server state. These properties may be changed at any time. -// - - /// Max player count that will be reported to server browser and client queries - virtual void SetMaxPlayerCount( int cPlayersMax ) = 0; - - /// Number of bots. Default value is zero - virtual void SetBotPlayerCount( int cBotplayers ) = 0; - - /// Set the name of server as it will appear in the server browser - /// - /// @see k_cbMaxGameServerName - virtual void SetServerName( const char *pszServerName ) = 0; - - /// Set name of map to report in the server browser - /// - /// @see k_cbMaxGameServerName - virtual void SetMapName( const char *pszMapName ) = 0; - - /// Let people know if your server will require a password - virtual void SetPasswordProtected( bool bPasswordProtected ) = 0; - - /// Spectator server. The default value is zero, meaning the service - /// is not used. - virtual void SetSpectatorPort( uint16 unSpectatorPort ) = 0; - - /// Name of the spectator server. (Only used if spectator port is nonzero.) - /// - /// @see k_cbMaxGameServerMapName - virtual void SetSpectatorServerName( const char *pszSpectatorServerName ) = 0; - - /// Call this to clear the whole list of key/values that are sent in rules queries. - virtual void ClearAllKeyValues() = 0; - - /// Call this to add/update a key/value pair. - virtual void SetKeyValue( const char *pKey, const char *pValue ) = 0; - - /// Sets a string defining the "gametags" for this server, this is optional, but if it is set - /// it allows users to filter in the matchmaking/server-browser interfaces based on the value - /// - /// @see k_cbMaxGameServerTags - virtual void SetGameTags( const char *pchGameTags ) = 0; - - /// Sets a string defining the "gamedata" for this server, this is optional, but if it is set - /// it allows users to filter in the matchmaking/server-browser interfaces based on the value - /// don't set this unless it actually changes, its only uploaded to the master once (when - /// acknowledged) - /// - /// @see k_cbMaxGameServerGameData - virtual void SetGameData( const char *pchGameData) = 0; - - /// Region identifier. This is an optional field, the default value is empty, meaning the "world" region - virtual void SetRegion( const char *pszRegion ) = 0; - -// -// Player list management / authentication -// - - // Handles receiving a new connection from a Steam user. This call will ask the Steam - // servers to validate the users identity, app ownership, and VAC status. If the Steam servers - // are off-line, then it will validate the cached ticket itself which will validate app ownership - // and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection() - // and must then be sent up to the game server for authentication. - // - // Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL - // If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication - // for the user has succeeded or failed (the steamid in the callback will match the one returned by this call) - virtual bool SendUserConnectAndAuthenticate( uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser ) = 0; - - // Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation. - // - // Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect() - // when this user leaves the server just like you would for a real user. - virtual CSteamID CreateUnauthenticatedUserConnection() = 0; - - // Should be called whenever a user leaves our game server, this lets Steam internally - // track which users are currently on which servers for the purposes of preventing a single - // account being logged into multiple servers, showing who is currently on a server, etc. - virtual void SendUserDisconnect( CSteamID steamIDUser ) = 0; - - // Update the data to be displayed in the server browser and matchmaking interfaces for a user - // currently connected to the server. For regular users you must call this after you receive a - // GSUserValidationSuccess callback. - // - // Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player) - virtual bool BUpdateUserData( CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore ) = 0; - - // New auth system APIs - do not mix with the old auth system APIs. - // ---------------------------------------------------------------- - - // Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ). - // pcbTicket retrieves the length of the actual ticket. - virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; - - // Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused - // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse ) - virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0; - - // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity - virtual void EndAuthSession( CSteamID steamID ) = 0; - - // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to - virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0; - - // After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function - // to determine if the user owns downloadable content specified by the provided AppID. - virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0; - - // Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t - // returns false if we're not connected to the steam servers and thus cannot ask - virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0; - -// -// Query steam for server data -// - - // Ask for the gameplay stats for the server. Results returned in a callback - virtual void GetGameplayStats( ) = 0; - - // Gets the reputation score for the game server. This API also checks if the server or some - // other server on the same IP is banned from the Steam master servers. - virtual SteamAPICall_t GetServerReputation( ) = 0; - - // Returns the public IP of the server according to Steam, useful when the server is - // behind NAT and you want to advertise its IP in a lobby for other clients to directly - // connect to - virtual uint32 GetPublicIP() = 0; - -// These are in GameSocketShare mode, where instead of ISteamGameServer creating its own -// socket to talk to the master server on, it lets the game use its socket to forward messages -// back and forth. This prevents us from requiring server ops to open up yet another port -// in their firewalls. -// -// the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001 - - // These are used when you've elected to multiplex the game server's UDP socket - // rather than having the master server updater use its own sockets. - // - // Source games use this to simplify the job of the server admins, so they - // don't have to open up more ports on their firewalls. - - // Call this when a packet that starts with 0xFFFFFFFF comes in. That means - // it's for us. - virtual bool HandleIncomingPacket( const void *pData, int cbData, uint32 srcIP, uint16 srcPort ) = 0; - - // AFTER calling HandleIncomingPacket for any packets that came in that frame, call this. - // This gets a packet that the master server updater needs to send out on UDP. - // It returns the length of the packet it wants to send, or 0 if there are no more packets to send. - // Call this each frame until it returns 0. - virtual int GetNextOutgoingPacket( void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort ) = 0; - -// -// Control heartbeats / advertisement with master server -// - - // Call this as often as you like to tell the master server updater whether or not - // you want it to be active (default: off). - virtual void EnableHeartbeats( bool bActive ) = 0; - - // You usually don't need to modify this. - // Pass -1 to use the default value for iHeartbeatInterval. - // Some mods change this. - virtual void SetHeartbeatInterval( int iHeartbeatInterval ) = 0; - - // Force a heartbeat to steam at the next opportunity - virtual void ForceHeartbeat() = 0; - - // associate this game server with this clan for the purposes of computing player compat - virtual SteamAPICall_t AssociateWithClan( CSteamID steamIDClan ) = 0; - - // ask if any of the current players dont want to play with this new player - or vice versa - virtual SteamAPICall_t ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer ) = 0; - -}; - -#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer011" - -// game server flags -const uint32 k_unServerFlagNone = 0x00; -const uint32 k_unServerFlagActive = 0x01; // server has users playing -const uint32 k_unServerFlagSecure = 0x02; // server wants to be secure -const uint32 k_unServerFlagDedicated = 0x04; // server is dedicated -const uint32 k_unServerFlagLinux = 0x08; // linux build -const uint32 k_unServerFlagPassworded = 0x10; // password protected -const uint32 k_unServerFlagPrivate = 0x20; // server shouldn't list on master server and - // won't enforce authentication of users that connect to the server. - // Useful when you run a server where the clients may not - // be connected to the internet but you want them to play (i.e LANs) - - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - - -// client has been approved to connect to this game server -struct GSClientApprove_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 1 }; - CSteamID m_SteamID; -}; - - -// client has been denied to connection to this game server -struct GSClientDeny_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 2 }; - CSteamID m_SteamID; - EDenyReason m_eDenyReason; - char m_rgchOptionalText[128]; -}; - - -// request the game server should kick the user -struct GSClientKick_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 3 }; - CSteamID m_SteamID; - EDenyReason m_eDenyReason; -}; - -// NOTE: callback values 4 and 5 are skipped because they are used for old deprecated callbacks, -// do not reuse them here. - - -// client achievement info -struct GSClientAchievementStatus_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 6 }; - uint64 m_SteamID; - char m_pchAchievement[128]; - bool m_bUnlocked; -}; - -// received when the game server requests to be displayed as secure (VAC protected) -// m_bSecure is true if the game server should display itself as secure to users, false otherwise -struct GSPolicyResponse_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 15 }; - uint8 m_bSecure; -}; - -// GS gameplay stats info -struct GSGameplayStats_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 7 }; - EResult m_eResult; // Result of the call - int32 m_nRank; // Overall rank of the server (0-based) - uint32 m_unTotalConnects; // Total number of clients who have ever connected to the server - uint32 m_unTotalMinutesPlayed; // Total number of minutes ever played on the server -}; - -// send as a reply to RequestUserGroupStatus() -struct GSClientGroupStatus_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 8 }; - CSteamID m_SteamIDUser; - CSteamID m_SteamIDGroup; - bool m_bMember; - bool m_bOfficer; -}; - -// Sent as a reply to GetServerReputation() -struct GSReputation_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 9 }; - EResult m_eResult; // Result of the call; - uint32 m_unReputationScore; // The reputation score for the game server - bool m_bBanned; // True if the server is banned from the Steam - // master servers - - // The following members are only filled out if m_bBanned is true. They will all - // be set to zero otherwise. Master server bans are by IP so it is possible to be - // banned even when the score is good high if there is a bad server on another port. - // This information can be used to determine which server is bad. - - uint32 m_unBannedIP; // The IP of the banned server - uint16 m_usBannedPort; // The port of the banned server - uint64 m_ulBannedGameID; // The game ID the banned server is serving - uint32 m_unBanExpires; // Time the ban expires, expressed in the Unix epoch (seconds since 1/1/1970) -}; - -// Sent as a reply to AssociateWithClan() -struct AssociateWithClanResult_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 10 }; - EResult m_eResult; // Result of the call; -}; - -// Sent as a reply to ComputeNewPlayerCompatibility() -struct ComputeNewPlayerCompatibilityResult_t -{ - enum { k_iCallback = k_iSteamGameServerCallbacks + 11 }; - EResult m_eResult; // Result of the call; - int m_cPlayersThatDontLikeCandidate; - int m_cPlayersThatCandidateDoesntLike; - int m_cClanPlayersThatDontLikeCandidate; - CSteamID m_SteamIDCandidate; -}; - - -#pragma pack( pop ) - -#endif // ISTEAMGAMESERVER_H diff --git a/regamedll/public/steam/isteamgameserverstats.h b/regamedll/public/steam/isteamgameserverstats.h deleted file mode 100644 index 78c299a2..00000000 --- a/regamedll/public/steam/isteamgameserverstats.h +++ /dev/null @@ -1,99 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface for game servers to steam stats and achievements -// -//============================================================================= - -#ifndef ISTEAMGAMESERVERSTATS_H -#define ISTEAMGAMESERVERSTATS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -//----------------------------------------------------------------------------- -// Purpose: Functions for authenticating users via Steam to play on a game server -//----------------------------------------------------------------------------- -class ISteamGameServerStats -{ -public: - // downloads stats for the user - // returns a GSStatsReceived_t callback when completed - // if the user has no stats, GSStatsReceived_t.m_eResult will be set to k_EResultFail - // these stats will only be auto-updated for clients playing on the server. For other - // users you'll need to call RequestUserStats() again to refresh any data - virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0; - - // requests stat information for a user, usable after a successful call to RequestUserStats() - virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0; - virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0; - virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0; - - // Set / update stats and achievements. - // Note: These updates will work only on stats game servers are allowed to edit and only for - // game servers that have been declared as officially controlled by the game creators. - // Set the IP range of your official servers on the Steamworks page - virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, int32 nData ) = 0; - virtual bool SetUserStat( CSteamID steamIDUser, const char *pchName, float fData ) = 0; - virtual bool UpdateUserAvgRateStat( CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength ) = 0; - - virtual bool SetUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0; - virtual bool ClearUserAchievement( CSteamID steamIDUser, const char *pchName ) = 0; - - // Store the current data on the server, will get a GSStatsStored_t callback when set. - // - // If the callback has a result of k_EResultInvalidParam, one or more stats - // uploaded has been rejected, either because they broke constraints - // or were out of date. In this case the server sends back updated values. - // The stats should be re-iterated to keep in sync. - virtual SteamAPICall_t StoreUserStats( CSteamID steamIDUser ) = 0; -}; - -#define STEAMGAMESERVERSTATS_INTERFACE_VERSION "SteamGameServerStats001" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: called when the latests stats and achievements have been received -// from the server -//----------------------------------------------------------------------------- -struct GSStatsReceived_t -{ - enum { k_iCallback = k_iSteamGameServerStatsCallbacks }; - EResult m_eResult; // Success / error fetching the stats - CSteamID m_steamIDUser; // The user for whom the stats are retrieved for -}; - - -//----------------------------------------------------------------------------- -// Purpose: result of a request to store the user stats for a game -//----------------------------------------------------------------------------- -struct GSStatsStored_t -{ - enum { k_iCallback = k_iSteamGameServerStatsCallbacks + 1 }; - EResult m_eResult; // success / error - CSteamID m_steamIDUser; // The user for whom the stats were stored -}; - -//----------------------------------------------------------------------------- -// Purpose: Callback indicating that a user's stats have been unloaded. -// Call RequestUserStats again to access stats for this user -//----------------------------------------------------------------------------- -struct GSStatsUnloaded_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 }; - CSteamID m_steamIDUser; // User whose stats have been unloaded -}; - -#pragma pack( pop ) - - -#endif // ISTEAMGAMESERVERSTATS_H diff --git a/regamedll/public/steam/isteamhttp.h b/regamedll/public/steam/isteamhttp.h deleted file mode 100644 index f81475ec..00000000 --- a/regamedll/public/steam/isteamhttp.h +++ /dev/null @@ -1,176 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to http client -// -//============================================================================= - -#ifndef ISTEAMHTTP_H -#define ISTEAMHTTP_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" -#include "steamhttpenums.h" - -// Handle to a HTTP Request handle -typedef uint32 HTTPRequestHandle; -#define INVALID_HTTPREQUEST_HANDLE 0 - -//----------------------------------------------------------------------------- -// Purpose: interface to http client -//----------------------------------------------------------------------------- -class ISteamHTTP -{ -public: - - // Initializes a new HTTP request, returning a handle to use in further operations on it. Requires - // the method (GET or POST) and the absolute URL for the request. Only http requests (ie, not https) are - // currently supported, so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/ - // or such. - virtual HTTPRequestHandle CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL ) = 0; - - // Set a context value for the request, which will be returned in the HTTPRequestCompleted_t callback after - // sending the request. This is just so the caller can easily keep track of which callbacks go with which request data. - virtual bool SetHTTPRequestContextValue( HTTPRequestHandle hRequest, uint64 ulContextValue ) = 0; - - // Set a timeout in seconds for the HTTP request, must be called prior to sending the request. Default - // timeout is 60 seconds if you don't call this. Returns false if the handle is invalid, or the request - // has already been sent. - virtual bool SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest, uint32 unTimeoutSeconds ) = 0; - - // Set a request header value for the request, must be called prior to sending the request. Will - // return false if the handle is invalid or the request is already sent. - virtual bool SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, const char *pchHeaderValue ) = 0; - - // Set a GET or POST parameter value on the request, which is set will depend on the EHTTPMethod specified - // when creating the request. Must be called prior to sending the request. Will return false if the - // handle is invalid or the request is already sent. - virtual bool SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, const char *pchParamName, const char *pchParamValue ) = 0; - - // Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on - // asynchronous response via callback. - // - // Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control - // header and only do a local cache lookup rather than sending any actual remote request. - virtual bool SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0; - - // Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on - // asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and - // HTTPRequestDataReceived_t callbacks while streaming. - virtual bool SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle ) = 0; - - // Defers a request you have sent, the actual HTTP client code may have many requests queued, and this will move - // the specified request to the tail of the queue. Returns false on invalid handle, or if the request is not yet sent. - virtual bool DeferHTTPRequest( HTTPRequestHandle hRequest ) = 0; - - // Prioritizes a request you have sent, the actual HTTP client code may have many requests queued, and this will move - // the specified request to the head of the queue. Returns false on invalid handle, or if the request is not yet sent. - virtual bool PrioritizeHTTPRequest( HTTPRequestHandle hRequest ) = 0; - - // Checks if a response header is present in a HTTP response given a handle from HTTPRequestCompleted_t, also - // returns the size of the header value if present so the caller and allocate a correctly sized buffer for - // GetHTTPResponseHeaderValue. - virtual bool GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest, const char *pchHeaderName, uint32 *unResponseHeaderSize ) = 0; - - // Gets header values from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the - // header is not present or if your buffer is too small to contain it's value. You should first call - // BGetHTTPResponseHeaderSize to check for the presence of the header and to find out the size buffer needed. - virtual bool GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest, const char *pchHeaderName, uint8 *pHeaderValueBuffer, uint32 unBufferSize ) = 0; - - // Gets the size of the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the - // handle is invalid. - virtual bool GetHTTPResponseBodySize( HTTPRequestHandle hRequest, uint32 *unBodySize ) = 0; - - // Gets the body data from a HTTP response given a handle from HTTPRequestCompleted_t, will return false if the - // handle is invalid or is to a streaming response, or if the provided buffer is not the correct size. Use BGetHTTPResponseBodySize first to find out - // the correct buffer size to use. - virtual bool GetHTTPResponseBodyData( HTTPRequestHandle hRequest, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0; - - // Gets the body data from a streaming HTTP response given a handle from HTTPRequestDataReceived_t. Will return false if the - // handle is invalid or is to a non-streaming response (meaning it wasn't sent with SendHTTPRequestAndStreamResponse), or if the buffer size and offset - // do not match the size and offset sent in HTTPRequestDataReceived_t. - virtual bool GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest, uint32 cOffset, uint8 *pBodyDataBuffer, uint32 unBufferSize ) = 0; - - // Releases an HTTP response handle, should always be called to free resources after receiving a HTTPRequestCompleted_t - // callback and finishing using the response. - virtual bool ReleaseHTTPRequest( HTTPRequestHandle hRequest ) = 0; - - // Gets progress on downloading the body for the request. This will be zero unless a response header has already been - // received which included a content-length field. For responses that contain no content-length it will report - // zero for the duration of the request as the size is unknown until the connection closes. - virtual bool GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *pflPercentOut ) = 0; - - // Sets the body for an HTTP Post request. Will fail and return false on a GET request, and will fail if POST params - // have already been set for the request. Setting this raw body makes it the only contents for the post, the pchContentType - // parameter will set the content-type header for the request so the server may know how to interpret the body. - virtual bool SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen ) = 0; -}; - -#define STEAMHTTP_INTERFACE_VERSION "STEAMHTTP_INTERFACE_VERSION002" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -struct HTTPRequestCompleted_t -{ - enum { k_iCallback = k_iClientHTTPCallbacks + 1 }; - - // Handle value for the request that has completed. - HTTPRequestHandle m_hRequest; - - // Context value that the user defined on the request that this callback is associated with, 0 if - // no context value was set. - uint64 m_ulContextValue; - - // This will be true if we actually got any sort of response from the server (even an error). - // It will be false if we failed due to an internal error or client side network failure. - bool m_bRequestSuccessful; - - // Will be the HTTP status code value returned by the server, k_EHTTPStatusCode200OK is the normal - // OK response, if you get something else you probably need to treat it as a failure. - EHTTPStatusCode m_eStatusCode; -}; - - -struct HTTPRequestHeadersReceived_t -{ - enum { k_iCallback = k_iClientHTTPCallbacks + 2 }; - - // Handle value for the request that has received headers. - HTTPRequestHandle m_hRequest; - - // Context value that the user defined on the request that this callback is associated with, 0 if - // no context value was set. - uint64 m_ulContextValue; -}; - -struct HTTPRequestDataReceived_t -{ - enum { k_iCallback = k_iClientHTTPCallbacks + 3 }; - - // Handle value for the request that has received data. - HTTPRequestHandle m_hRequest; - - // Context value that the user defined on the request that this callback is associated with, 0 if - // no context value was set. - uint64 m_ulContextValue; - - - // Offset to provide to GetHTTPStreamingResponseBodyData to get this chunk of data - uint32 m_cOffset; - - // Size to provide to GetHTTPStreamingResponseBodyData to get this chunk of data - uint32 m_cBytesReceived; -}; - - -#pragma pack( pop ) - -#endif // ISTEAMHTTP_H \ No newline at end of file diff --git a/regamedll/public/steam/isteammatchmaking.h b/regamedll/public/steam/isteammatchmaking.h deleted file mode 100644 index 829c5091..00000000 --- a/regamedll/public/steam/isteammatchmaking.h +++ /dev/null @@ -1,731 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to steam managing game server/client match making -// -//============================================================================= - -#ifndef ISTEAMMATCHMAKING -#define ISTEAMMATCHMAKING -#ifdef _WIN32 -#pragma once -#endif - -#include "steamtypes.h" -#include "steamclientpublic.h" -#include "matchmakingtypes.h" -#include "isteamclient.h" -#include "isteamfriends.h" - -// lobby type description -enum ELobbyType -{ - k_ELobbyTypePrivate = 0, // only way to join the lobby is to invite to someone else - k_ELobbyTypeFriendsOnly = 1, // shows for friends or invitees, but not in lobby list - k_ELobbyTypePublic = 2, // visible for friends and in lobby list - k_ELobbyTypeInvisible = 3, // returned by search, but not visible to other friends - // useful if you want a user in two lobbies, for example matching groups together - // a user can be in only one regular lobby, and up to two invisible lobbies -}; - -// lobby search filter tools -enum ELobbyComparison -{ - k_ELobbyComparisonEqualToOrLessThan = -2, - k_ELobbyComparisonLessThan = -1, - k_ELobbyComparisonEqual = 0, - k_ELobbyComparisonGreaterThan = 1, - k_ELobbyComparisonEqualToOrGreaterThan = 2, - k_ELobbyComparisonNotEqual = 3, -}; - -// lobby search distance. Lobby results are sorted from closest to farthest. -enum ELobbyDistanceFilter -{ - k_ELobbyDistanceFilterClose, // only lobbies in the same immediate region will be returned - k_ELobbyDistanceFilterDefault, // only lobbies in the same region or near by regions - k_ELobbyDistanceFilterFar, // for games that don't have many latency requirements, will return lobbies about half-way around the globe - k_ELobbyDistanceFilterWorldwide, // no filtering, will match lobbies as far as India to NY (not recommended, expect multiple seconds of latency between the clients) -}; - -// maximum number of characters a lobby metadata key can be -#define k_nMaxLobbyKeyLength 255 - -//----------------------------------------------------------------------------- -// Purpose: Functions for match making services for clients to get to favorites -// and to operate on game lobbies. -//----------------------------------------------------------------------------- -class ISteamMatchmaking -{ -public: - // game server favorites storage - // saves basic details about a multiplayer game server locally - - // returns the number of favorites servers the user has stored - virtual int GetFavoriteGameCount() = 0; - - // returns the details of the game server - // iGame is of range [0,GetFavoriteGameCount()) - // *pnIP, *pnConnPort are filled in the with IP:port of the game server - // *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections - // *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added - virtual bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0; - - // adds the game server to the local list; updates the time played of the server if it already exists in the list - virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) =0; - - // removes the game server from the local storage; returns true if one was removed - virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0; - - /////// - // Game lobby functions - - // Get a list of relevant lobbies - // this is an asynchronous request - // results will be returned by LobbyMatchList_t callback & call result, with the number of lobbies found - // this will never return lobbies that are full - // to add more filter, the filter calls below need to be call before each and every RequestLobbyList() call - // use the CCallResult<> object in steam_api.h to match the SteamAPICall_t call result to a function in an object, e.g. - /* - class CMyLobbyListManager - { - CCallResult m_CallResultLobbyMatchList; - void FindLobbies() - { - // SteamMatchmaking()->AddRequestLobbyListFilter*() functions would be called here, before RequestLobbyList() - SteamAPICall_t hSteamAPICall = SteamMatchmaking()->RequestLobbyList(); - m_CallResultLobbyMatchList.Set( hSteamAPICall, this, &CMyLobbyListManager::OnLobbyMatchList ); - } - - void OnLobbyMatchList( LobbyMatchList_t *pLobbyMatchList, bool bIOFailure ) - { - // lobby list has be retrieved from Steam back-end, use results - } - } - */ - // - virtual SteamAPICall_t RequestLobbyList() = 0; - // filters for lobbies - // this needs to be called before RequestLobbyList() to take effect - // these are cleared on each call to RequestLobbyList() - virtual void AddRequestLobbyListStringFilter( const char *pchKeyToMatch, const char *pchValueToMatch, ELobbyComparison eComparisonType ) = 0; - // numerical comparison - virtual void AddRequestLobbyListNumericalFilter( const char *pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType ) = 0; - // returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence - virtual void AddRequestLobbyListNearValueFilter( const char *pchKeyToMatch, int nValueToBeCloseTo ) = 0; - // returns only lobbies with the specified number of slots available - virtual void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable ) = 0; - // sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed) - virtual void AddRequestLobbyListDistanceFilter( ELobbyDistanceFilter eLobbyDistanceFilter ) = 0; - // sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client - virtual void AddRequestLobbyListResultCountFilter( int cMaxResults ) = 0; - - virtual void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby ) = 0; - - // returns the CSteamID of a lobby, as retrieved by a RequestLobbyList call - // should only be called after a LobbyMatchList_t callback is received - // iLobby is of the range [0, LobbyMatchList_t::m_nLobbiesMatching) - // the returned CSteamID::IsValid() will be false if iLobby is out of range - virtual CSteamID GetLobbyByIndex( int iLobby ) = 0; - - // Create a lobby on the Steam servers. - // If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID - // of the lobby will need to be communicated via game channels or via InviteUserToLobby() - // this is an asynchronous request - // results will be returned by LobbyCreated_t callback and call result; lobby is joined & ready to use at this point - // a LobbyEnter_t callback will also be received (since the local user is joining their own lobby) - virtual SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers ) = 0; - - // Joins an existing lobby - // this is an asynchronous request - // results will be returned by LobbyEnter_t callback & call result, check m_EChatRoomEnterResponse to see if was successful - // lobby metadata is available to use immediately on this call completing - virtual SteamAPICall_t JoinLobby( CSteamID steamIDLobby ) = 0; - - // Leave a lobby; this will take effect immediately on the client side - // other users in the lobby will be notified by a LobbyChatUpdate_t callback - virtual void LeaveLobby( CSteamID steamIDLobby ) = 0; - - // Invite another user to the lobby - // the target user will receive a LobbyInvite_t callback - // will return true if the invite is successfully sent, whether or not the target responds - // returns false if the local user is not connected to the Steam servers - // if the other user clicks the join link, a GameLobbyJoinRequested_t will be posted if the user is in-game, - // or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id> - virtual bool InviteUserToLobby( CSteamID steamIDLobby, CSteamID steamIDInvitee ) = 0; - - // Lobby iteration, for viewing details of users in a lobby - // only accessible if the lobby user is a member of the specified lobby - // persona information for other lobby members (name, avatar, etc.) will be asynchronously received - // and accessible via ISteamFriends interface - - // returns the number of users in the specified lobby - virtual int GetNumLobbyMembers( CSteamID steamIDLobby ) = 0; - // returns the CSteamID of a user in the lobby - // iMember is of range [0,GetNumLobbyMembers()) - // note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby - virtual CSteamID GetLobbyMemberByIndex( CSteamID steamIDLobby, int iMember ) = 0; - - // Get data associated with this lobby - // takes a simple key, and returns the string associated with it - // "" will be returned if no value is set, or if steamIDLobby is invalid - virtual const char *GetLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0; - // Sets a key/value pair in the lobby metadata - // each user in the lobby will be broadcast this new value, and any new users joining will receive any existing data - // this can be used to set lobby names, map, etc. - // to reset a key, just set it to "" - // other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback - virtual bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0; - - // returns the number of metadata keys set on the specified lobby - virtual int GetLobbyDataCount( CSteamID steamIDLobby ) = 0; - - // returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount()) - virtual bool GetLobbyDataByIndex( CSteamID steamIDLobby, int iLobbyData, char *pchKey, int cchKeyBufferSize, char *pchValue, int cchValueBufferSize ) = 0; - - // removes a metadata key from the lobby - virtual bool DeleteLobbyData( CSteamID steamIDLobby, const char *pchKey ) = 0; - - // Gets per-user metadata for someone in this lobby - virtual const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, const char *pchKey ) = 0; - // Sets per-user metadata (for the local user implicitly) - virtual void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ) = 0; - - // Broadcasts a chat message to the all the users in the lobby - // users in the lobby (including the local user) will receive a LobbyChatMsg_t callback - // returns true if the message is successfully sent - // pvMsgBody can be binary or text data, up to 4k - // if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator - virtual bool SendLobbyChatMsg( CSteamID steamIDLobby, const void *pvMsgBody, int cubMsgBody ) = 0; - // Get a chat message as specified in a LobbyChatMsg_t callback - // iChatID is the LobbyChatMsg_t::m_iChatID value in the callback - // *pSteamIDUser is filled in with the CSteamID of the member - // *pvData is filled in with the message itself - // return value is the number of bytes written into the buffer - virtual int GetLobbyChatEntry( CSteamID steamIDLobby, int iChatID, CSteamID *pSteamIDUser, void *pvData, int cubData, EChatEntryType *peChatEntryType ) = 0; - - // Refreshes metadata for a lobby you're not necessarily in right now - // you never do this for lobbies you're a member of, only if your - // this will send down all the metadata associated with a lobby - // this is an asynchronous call - // returns false if the local user is not connected to the Steam servers - // results will be returned by a LobbyDataUpdate_t callback - // if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false - virtual bool RequestLobbyData( CSteamID steamIDLobby ) = 0; - - // sets the game server associated with the lobby - // usually at this point, the users will join the specified game server - // either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect - virtual void SetLobbyGameServer( CSteamID steamIDLobby, uint32 unGameServerIP, uint16 unGameServerPort, CSteamID steamIDGameServer ) = 0; - // returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist - virtual bool GetLobbyGameServer( CSteamID steamIDLobby, uint32 *punGameServerIP, uint16 *punGameServerPort, CSteamID *psteamIDGameServer ) = 0; - - // set the limit on the # of users who can join the lobby - virtual bool SetLobbyMemberLimit( CSteamID steamIDLobby, int cMaxMembers ) = 0; - // returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined - virtual int GetLobbyMemberLimit( CSteamID steamIDLobby ) = 0; - - // updates which type of lobby it is - // only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls - virtual bool SetLobbyType( CSteamID steamIDLobby, ELobbyType eLobbyType ) = 0; - - // sets whether or not a lobby is joinable - defaults to true for a new lobby - // if set to false, no user can join, even if they are a friend or have been invited - virtual bool SetLobbyJoinable( CSteamID steamIDLobby, bool bLobbyJoinable ) = 0; - - // returns the current lobby owner - // you must be a member of the lobby to access this - // there always one lobby owner - if the current owner leaves, another user will become the owner - // it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner - virtual CSteamID GetLobbyOwner( CSteamID steamIDLobby ) = 0; - - // changes who the lobby owner is - // you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby - // after completion, the local user will no longer be the owner - virtual bool SetLobbyOwner( CSteamID steamIDLobby, CSteamID steamIDNewOwner ) = 0; - - // link two lobbies for the purposes of checking player compatibility - // you must be the lobby owner of both lobbies - virtual bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent ) = 0; - -#ifdef _PS3 - // changes who the lobby owner is - // you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby - // after completion, the local user will no longer be the owner - virtual void CheckForPSNGameBootInvite( unsigned int iGameBootAttributes ) = 0; -#endif -}; -#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking009" - - -//----------------------------------------------------------------------------- -// Callback interfaces for server list functions (see ISteamMatchmakingServers below) -// -// The idea here is that your game code implements objects that implement these -// interfaces to receive callback notifications after calling asynchronous functions -// inside the ISteamMatchmakingServers() interface below. -// -// This is different than normal Steam callback handling due to the potentially -// large size of server lists. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Typedef for handle type you will receive when requesting server list. -//----------------------------------------------------------------------------- -typedef void* HServerListRequest; - -//----------------------------------------------------------------------------- -// Purpose: Callback interface for receiving responses after a server list refresh -// or an individual server update. -// -// Since you get these callbacks after requesting full list refreshes you will -// usually implement this interface inside an object like CServerBrowser. If that -// object is getting destructed you should use ISteamMatchMakingServers()->CancelQuery() -// to cancel any in-progress queries so you don't get a callback into the destructed -// object and crash. -//----------------------------------------------------------------------------- -class ISteamMatchmakingServerListResponse -{ -public: - // Server has responded ok with updated data - virtual void ServerResponded( HServerListRequest hRequest, int iServer ) = 0; - - // Server has failed to respond - virtual void ServerFailedToRespond( HServerListRequest hRequest, int iServer ) = 0; - - // A list refresh you had initiated is now 100% completed - virtual void RefreshComplete( HServerListRequest hRequest, EMatchMakingServerResponse response ) = 0; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Callback interface for receiving responses after pinging an individual server -// -// These callbacks all occur in response to querying an individual server -// via the ISteamMatchmakingServers()->PingServer() call below. If you are -// destructing an object that implements this interface then you should call -// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query -// which is in progress. Failure to cancel in progress queries when destructing -// a callback handler may result in a crash when a callback later occurs. -//----------------------------------------------------------------------------- -class ISteamMatchmakingPingResponse -{ -public: - // Server has responded successfully and has updated data - virtual void ServerResponded( gameserveritem_t &server ) = 0; - - // Server failed to respond to the ping request - virtual void ServerFailedToRespond() = 0; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Callback interface for receiving responses after requesting details on -// who is playing on a particular server. -// -// These callbacks all occur in response to querying an individual server -// via the ISteamMatchmakingServers()->PlayerDetails() call below. If you are -// destructing an object that implements this interface then you should call -// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query -// which is in progress. Failure to cancel in progress queries when destructing -// a callback handler may result in a crash when a callback later occurs. -//----------------------------------------------------------------------------- -class ISteamMatchmakingPlayersResponse -{ -public: - // Got data on a new player on the server -- you'll get this callback once per player - // on the server which you have requested player data on. - virtual void AddPlayerToList( const char *pchName, int nScore, float flTimePlayed ) = 0; - - // The server failed to respond to the request for player details - virtual void PlayersFailedToRespond() = 0; - - // The server has finished responding to the player details request - // (ie, you won't get anymore AddPlayerToList callbacks) - virtual void PlayersRefreshComplete() = 0; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Callback interface for receiving responses after requesting rules -// details on a particular server. -// -// These callbacks all occur in response to querying an individual server -// via the ISteamMatchmakingServers()->ServerRules() call below. If you are -// destructing an object that implements this interface then you should call -// ISteamMatchmakingServers()->CancelServerQuery() passing in the handle to the query -// which is in progress. Failure to cancel in progress queries when destructing -// a callback handler may result in a crash when a callback later occurs. -//----------------------------------------------------------------------------- -class ISteamMatchmakingRulesResponse -{ -public: - // Got data on a rule on the server -- you'll get one of these per rule defined on - // the server you are querying - virtual void RulesResponded( const char *pchRule, const char *pchValue ) = 0; - - // The server failed to respond to the request for rule details - virtual void RulesFailedToRespond() = 0; - - // The server has finished responding to the rule details request - // (ie, you won't get anymore RulesResponded callbacks) - virtual void RulesRefreshComplete() = 0; -}; - - -//----------------------------------------------------------------------------- -// Typedef for handle type you will receive when querying details on an individual server. -//----------------------------------------------------------------------------- -typedef int HServerQuery; -const int HSERVERQUERY_INVALID = 0xffffffff; - -//----------------------------------------------------------------------------- -// Purpose: Functions for match making services for clients to get to game lists and details -//----------------------------------------------------------------------------- -class ISteamMatchmakingServers -{ -public: - // Request a new list of servers of a particular type. These calls each correspond to one of the EMatchMakingType values. - // Each call allocates a new asynchronous request object. - // Request object must be released by calling ReleaseRequest( hServerListRequest ) - virtual HServerListRequest RequestInternetServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual HServerListRequest RequestLANServerList( AppId_t iApp, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual HServerListRequest RequestFriendsServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual HServerListRequest RequestFavoritesServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual HServerListRequest RequestHistoryServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - virtual HServerListRequest RequestSpectatorServerList( AppId_t iApp, MatchMakingKeyValuePair_t **ppchFilters, uint32 nFilters, ISteamMatchmakingServerListResponse *pRequestServersResponse ) = 0; - - // Releases the asynchronous request object and cancels any pending query on it if there's a pending query in progress. - // RefreshComplete callback is not posted when request is released. - virtual void ReleaseRequest( HServerListRequest hServerListRequest ) = 0; - - /* the filter operation codes that go in the key part of MatchMakingKeyValuePair_t should be one of these: - - "map" - - Server passes the filter if the server is playing the specified map. - "gamedataand" - - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains all of the - specified strings. The value field is a comma-delimited list of strings to match. - "gamedataor" - - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) contains at least one of the - specified strings. The value field is a comma-delimited list of strings to match. - "gamedatanor" - - Server passes the filter if the server's game data (ISteamGameServer::SetGameData) does not contain any - of the specified strings. The value field is a comma-delimited list of strings to check. - "gametagsand" - - Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) contains all - of the specified strings. The value field is a comma-delimited list of strings to check. - "gametagsnor" - - Server passes the filter if the server's game tags (ISteamGameServer::SetGameTags) does not contain any - of the specified strings. The value field is a comma-delimited list of strings to check. - "and" (x1 && x2 && ... && xn) - "or" (x1 || x2 || ... || xn) - "nand" !(x1 && x2 && ... && xn) - "nor" !(x1 || x2 || ... || xn) - - Performs Boolean operation on the following filters. The operand to this filter specifies - the "size" of the Boolean inputs to the operation, in Key/value pairs. (The keyvalue - pairs must immediately follow, i.e. this is a prefix logical operator notation.) - In the simplest case where Boolean expressions are not nested, this is simply - the number of operands. - - For example, to match servers on a particular map or with a particular tag, would would - use these filters. - - ( server.map == "cp_dustbowl" || server.gametags.contains("payload") ) - "or", "2" - "map", "cp_dustbowl" - "gametagsand", "payload" - - If logical inputs are nested, then the operand specifies the size of the entire - "length" of its operands, not the number of immediate children. - - ( server.map == "cp_dustbowl" || ( server.gametags.contains("payload") && !server.gametags.contains("payloadrace") ) ) - "or", "4" - "map", "cp_dustbowl" - "and", "2" - "gametagsand", "payload" - "gametagsnor", "payloadrace" - - Unary NOT can be achieved using either "nand" or "nor" with a single operand. - - "addr" - - Server passes the filter if the server's query address matches the specified IP or IP:port. - "gameaddr" - - Server passes the filter if the server's game address matches the specified IP or IP:port. - - The following filter operations ignore the "value" part of MatchMakingKeyValuePair_t - - "dedicated" - - Server passes the filter if it passed true to SetDedicatedServer. - "secure" - - Server passes the filter if the server is VAC-enabled. - "notfull" - - Server passes the filter if the player count is less than the reported max player count. - "hasplayers" - - Server passes the filter if the player count is greater than zero. - "noplayers" - - Server passes the filter if it doesn't have any players. - "linux" - - Server passes the filter if it's a linux server - */ - - // Get details on a given server in the list, you can get the valid range of index - // values by calling GetServerCount(). You will also receive index values in - // ISteamMatchmakingServerListResponse::ServerResponded() callbacks - virtual gameserveritem_t *GetServerDetails( HServerListRequest hRequest, int iServer ) = 0; - - // Cancel an request which is operation on the given list type. You should call this to cancel - // any in-progress requests before destructing a callback object that may have been passed - // to one of the above list request calls. Not doing so may result in a crash when a callback - // occurs on the destructed object. - // Canceling a query does not release the allocated request handle. - // The request handle must be released using ReleaseRequest( hRequest ) - virtual void CancelQuery( HServerListRequest hRequest ) = 0; - - // Ping every server in your list again but don't update the list of servers - // Query callback installed when the server list was requested will be used - // again to post notifications and RefreshComplete, so the callback must remain - // valid until another RefreshComplete is called on it or the request - // is released with ReleaseRequest( hRequest ) - virtual void RefreshQuery( HServerListRequest hRequest ) = 0; - - // Returns true if the list is currently refreshing its server list - virtual bool IsRefreshing( HServerListRequest hRequest ) = 0; - - // How many servers in the given list, GetServerDetails above takes 0... GetServerCount() - 1 - virtual int GetServerCount( HServerListRequest hRequest ) = 0; - - // Refresh a single server inside of a query (rather than all the servers ) - virtual void RefreshServer( HServerListRequest hRequest, int iServer ) = 0; - - - //----------------------------------------------------------------------------- - // Queries to individual servers directly via IP/Port - //----------------------------------------------------------------------------- - - // Request updated ping time and other details from a single server - virtual HServerQuery PingServer( uint32 unIP, uint16 usPort, ISteamMatchmakingPingResponse *pRequestServersResponse ) = 0; - - // Request the list of players currently playing on a server - virtual HServerQuery PlayerDetails( uint32 unIP, uint16 usPort, ISteamMatchmakingPlayersResponse *pRequestServersResponse ) = 0; - - // Request the list of rules that the server is running (See ISteamGameServer::SetKeyValue() to set the rules server side) - virtual HServerQuery ServerRules( uint32 unIP, uint16 usPort, ISteamMatchmakingRulesResponse *pRequestServersResponse ) = 0; - - // Cancel an outstanding Ping/Players/Rules query from above. You should call this to cancel - // any in-progress requests before destructing a callback object that may have been passed - // to one of the above calls to avoid crashing when callbacks occur. - virtual void CancelServerQuery( HServerQuery hServerQuery ) = 0; -}; -#define STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION "SteamMatchMakingServers002" - -// game server flags -const uint32 k_unFavoriteFlagNone = 0x00; -const uint32 k_unFavoriteFlagFavorite = 0x01; // this game favorite entry is for the favorites list -const uint32 k_unFavoriteFlagHistory = 0x02; // this game favorite entry is for the history list - - -//----------------------------------------------------------------------------- -// Purpose: Used in ChatInfo messages - fields specific to a chat member - must fit in a uint32 -//----------------------------------------------------------------------------- -enum EChatMemberStateChange -{ - // Specific to joining / leaving the chatroom - k_EChatMemberStateChangeEntered = 0x0001, // This user has joined or is joining the chat room - k_EChatMemberStateChangeLeft = 0x0002, // This user has left or is leaving the chat room - k_EChatMemberStateChangeDisconnected = 0x0004, // User disconnected without leaving the chat first - k_EChatMemberStateChangeKicked = 0x0008, // User kicked - k_EChatMemberStateChangeBanned = 0x0010, // User kicked and banned -}; - -// returns true of the flags indicate that a user has been removed from the chat -#define BChatMemberStateChangeRemoved( rgfChatMemberStateChangeFlags ) ( rgfChatMemberStateChangeFlags & ( k_EChatMemberStateChangeDisconnected | k_EChatMemberStateChangeLeft | k_EChatMemberStateChangeKicked | k_EChatMemberStateChangeBanned ) ) - - -//----------------------------------------------------------------------------- -// Callbacks for ISteamMatchmaking (which go through the regular Steam callback registration system) -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: a server was added/removed from the favorites list, you should refresh now -//----------------------------------------------------------------------------- -struct FavoritesListChanged_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 2 }; - uint32 m_nIP; // an IP of 0 means reload the whole list, any other value means just one server - uint32 m_nQueryPort; - uint32 m_nConnPort; - uint32 m_nAppID; - uint32 m_nFlags; - bool m_bAdd; // true if this is adding the entry, otherwise it is a remove -}; - - -//----------------------------------------------------------------------------- -// Purpose: Someone has invited you to join a Lobby -// normally you don't need to do anything with this, since -// the Steam UI will also display a ' has invited you to the lobby, join?' dialog -// -// if the user outside a game chooses to join, your game will be launched with the parameter "+connect_lobby <64-bit lobby id>", -// or with the callback GameLobbyJoinRequested_t if they're already in-game -//----------------------------------------------------------------------------- -struct LobbyInvite_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 3 }; - - uint64 m_ulSteamIDUser; // Steam ID of the person making the invite - uint64 m_ulSteamIDLobby; // Steam ID of the Lobby - uint64 m_ulGameID; // GameID of the Lobby -}; - - -//----------------------------------------------------------------------------- -// Purpose: Sent on entering a lobby, or on failing to enter -// m_EChatRoomEnterResponse will be set to k_EChatRoomEnterResponseSuccess on success, -// or a higher value on failure (see enum EChatRoomEnterResponse) -//----------------------------------------------------------------------------- -struct LobbyEnter_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 4 }; - - uint64 m_ulSteamIDLobby; // SteamID of the Lobby you have entered - uint32 m_rgfChatPermissions; // Permissions of the current user - bool m_bLocked; // If true, then only invited users may join - uint32 m_EChatRoomEnterResponse; // EChatRoomEnterResponse -}; - - -//----------------------------------------------------------------------------- -// Purpose: The lobby metadata has changed -// if m_ulSteamIDMember is the steamID of a lobby member, use GetLobbyMemberData() to access per-user details -// if m_ulSteamIDMember == m_ulSteamIDLobby, use GetLobbyData() to access lobby metadata -//----------------------------------------------------------------------------- -struct LobbyDataUpdate_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 5 }; - - uint64 m_ulSteamIDLobby; // steamID of the Lobby - uint64 m_ulSteamIDMember; // steamID of the member whose data changed, or the room itself - uint8 m_bSuccess; // true if we lobby data was successfully changed; - // will only be false if RequestLobbyData() was called on a lobby that no longer exists -}; - - -//----------------------------------------------------------------------------- -// Purpose: The lobby chat room state has changed -// this is usually sent when a user has joined or left the lobby -//----------------------------------------------------------------------------- -struct LobbyChatUpdate_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 6 }; - - uint64 m_ulSteamIDLobby; // Lobby ID - uint64 m_ulSteamIDUserChanged; // user who's status in the lobby just changed - can be recipient - uint64 m_ulSteamIDMakingChange; // Chat member who made the change (different from SteamIDUserChange if kicking, muting, etc.) - // for example, if one user kicks another from the lobby, this will be set to the id of the user who initiated the kick - uint32 m_rgfChatMemberStateChange; // bitfield of EChatMemberStateChange values -}; - - -//----------------------------------------------------------------------------- -// Purpose: A chat message for this lobby has been sent -// use GetLobbyChatEntry( m_iChatID ) to retrieve the contents of this message -//----------------------------------------------------------------------------- -struct LobbyChatMsg_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 7 }; - - uint64 m_ulSteamIDLobby; // the lobby id this is in - uint64 m_ulSteamIDUser; // steamID of the user who has sent this message - uint8 m_eChatEntryType; // type of message - uint32 m_iChatID; // index of the chat entry to lookup -}; - - -//----------------------------------------------------------------------------- -// Purpose: A game created a game for all the members of the lobby to join, -// as triggered by a SetLobbyGameServer() -// it's up to the individual clients to take action on this; the usual -// game behavior is to leave the lobby and connect to the specified game server -//----------------------------------------------------------------------------- -struct LobbyGameCreated_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 9 }; - - uint64 m_ulSteamIDLobby; // the lobby we were in - uint64 m_ulSteamIDGameServer; // the new game server that has been created or found for the lobby members - uint32 m_unIP; // IP & Port of the game server (if any) - uint16 m_usPort; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Number of matching lobbies found -// iterate the returned lobbies with GetLobbyByIndex(), from values 0 to m_nLobbiesMatching-1 -//----------------------------------------------------------------------------- -struct LobbyMatchList_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 10 }; - uint32 m_nLobbiesMatching; // Number of lobbies that matched search criteria and we have SteamIDs for -}; - - -//----------------------------------------------------------------------------- -// Purpose: posted if a user is forcefully removed from a lobby -// can occur if a user loses connection to Steam -//----------------------------------------------------------------------------- -struct LobbyKicked_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 12 }; - uint64 m_ulSteamIDLobby; // Lobby - uint64 m_ulSteamIDAdmin; // User who kicked you - possibly the ID of the lobby itself - uint8 m_bKickedDueToDisconnect; // true if you were kicked from the lobby due to the user losing connection to Steam (currently always true) -}; - - -//----------------------------------------------------------------------------- -// Purpose: Result of our request to create a Lobby -// m_eResult == k_EResultOK on success -// at this point, the lobby has been joined and is ready for use -// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby) -//----------------------------------------------------------------------------- -struct LobbyCreated_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 13 }; - - EResult m_eResult; // k_EResultOK - the lobby was successfully created - // k_EResultNoConnection - your Steam client doesn't have a connection to the back-end - // k_EResultTimeout - you the message to the Steam servers, but it didn't respond - // k_EResultFail - the server responded, but with an unknown internal error - // k_EResultAccessDenied - your game isn't set to allow lobbies, or your client does haven't rights to play the game - // k_EResultLimitExceeded - your game client has created too many lobbies - - uint64 m_ulSteamIDLobby; // chat room, zero if failed -}; - -// used by now obsolete RequestFriendsLobbiesResponse_t -// enum { k_iCallback = k_iSteamMatchmakingCallbacks + 14 }; - - -//----------------------------------------------------------------------------- -// Purpose: Result of CheckForPSNGameBootInvite -// m_eResult == k_EResultOK on success -// at this point, the local user may not have finishing joining this lobby; -// game code should wait until the subsequent LobbyEnter_t callback is received -//----------------------------------------------------------------------------- -struct PSNGameBootInviteResult_t -{ - enum { k_iCallback = k_iSteamMatchmakingCallbacks + 15 }; - - bool m_bGameBootInviteExists; - CSteamID m_steamIDLobby; // Should be valid if m_bGameBootInviteExists == true -}; -#pragma pack( pop ) - - -#endif // ISTEAMMATCHMAKING diff --git a/regamedll/public/steam/isteamnetworking.h b/regamedll/public/steam/isteamnetworking.h deleted file mode 100644 index 15f430c5..00000000 --- a/regamedll/public/steam/isteamnetworking.h +++ /dev/null @@ -1,306 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to steam managing network connections between game clients & servers -// -//============================================================================= - -#ifndef ISTEAMNETWORKING -#define ISTEAMNETWORKING -#ifdef _WIN32 -#pragma once -#endif - -#include "steamtypes.h" -#include "steamclientpublic.h" - - -// list of possible errors returned by SendP2PPacket() API -// these will be posted in the P2PSessionConnectFail_t callback -enum EP2PSessionError -{ - k_EP2PSessionErrorNone = 0, - k_EP2PSessionErrorNotRunningApp = 1, // target is not running the same game - k_EP2PSessionErrorNoRightsToApp = 2, // local user doesn't own the app that is running - k_EP2PSessionErrorDestinationNotLoggedIn = 3, // target user isn't connected to Steam - k_EP2PSessionErrorTimeout = 4, // target isn't responding, perhaps not calling AcceptP2PSessionWithUser() - // corporate firewalls can also block this (NAT traversal is not firewall traversal) - // make sure that UDP ports 3478, 4379, and 4380 are open in an outbound direction - k_EP2PSessionErrorMax = 5 -}; - -// SendP2PPacket() send types -// Typically k_EP2PSendUnreliable is what you want for UDP-like packets, k_EP2PSendReliable for TCP-like packets -enum EP2PSend -{ - // Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare). - // The sending API does have some knowledge of the underlying connection, so if there is no NAT-traversal accomplished or - // there is a recognized adjustment happening on the connection, the packet will be batched until the connection is open again. - k_EP2PSendUnreliable = 0, - - // As above, but if the underlying p2p connection isn't yet established the packet will just be thrown away. Using this on the first - // packet sent to a remote host almost guarantees the packet will be dropped. - // This is only really useful for kinds of data that should never buffer up, i.e. voice payload packets - k_EP2PSendUnreliableNoDelay = 1, - - // Reliable message send. Can send up to 1MB of data in a single message. - // Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for efficient sends of large chunks of data. - k_EP2PSendReliable = 2, - - // As above, but applies the Nagle algorithm to the send - sends will accumulate - // until the current MTU size (typically ~1200 bytes, but can change) or ~200ms has passed (Nagle algorithm). - // Useful if you want to send a set of smaller messages but have the coalesced into a single packet - // Since the reliable stream is all ordered, you can do several small message sends with k_EP2PSendReliableWithBuffering and then - // do a normal k_EP2PSendReliable to force all the buffered data to be sent. - k_EP2PSendReliableWithBuffering = 3, - -}; - - -// connection state to a specified user, returned by GetP2PSessionState() -// this is under-the-hood info about what's going on with a SendP2PPacket(), shouldn't be needed except for debuggin -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif -struct P2PSessionState_t -{ - uint8 m_bConnectionActive; // true if we've got an active open connection - uint8 m_bConnecting; // true if we're currently trying to establish a connection - uint8 m_eP2PSessionError; // last error recorded (see enum above) - uint8 m_bUsingRelay; // true if it's going through a relay server (TURN) - int32 m_nBytesQueuedForSend; - int32 m_nPacketsQueuedForSend; - uint32 m_nRemoteIP; // potential IP:Port of remote host. Could be TURN server. - uint16 m_nRemotePort; // Only exists for compatibility with older authentication api's -}; -#pragma pack( pop ) - - -// handle to a socket -typedef uint32 SNetSocket_t; // CreateP2PConnectionSocket() -typedef uint32 SNetListenSocket_t; // CreateListenSocket() - -// connection progress indicators, used by CreateP2PConnectionSocket() -enum ESNetSocketState -{ - k_ESNetSocketStateInvalid = 0, - - // communication is valid - k_ESNetSocketStateConnected = 1, - - // states while establishing a connection - k_ESNetSocketStateInitiated = 10, // the connection state machine has started - - // p2p connections - k_ESNetSocketStateLocalCandidatesFound = 11, // we've found our local IP info - k_ESNetSocketStateReceivedRemoteCandidates = 12,// we've received information from the remote machine, via the Steam back-end, about their IP info - - // direct connections - k_ESNetSocketStateChallengeHandshake = 15, // we've received a challenge packet from the server - - // failure states - k_ESNetSocketStateDisconnecting = 21, // the API shut it down, and we're in the process of telling the other end - k_ESNetSocketStateLocalDisconnect = 22, // the API shut it down, and we've completed shutdown - k_ESNetSocketStateTimeoutDuringConnect = 23, // we timed out while trying to creating the connection - k_ESNetSocketStateRemoteEndDisconnected = 24, // the remote end has disconnected from us - k_ESNetSocketStateConnectionBroken = 25, // connection has been broken; either the other end has disappeared or our local network connection has broke - -}; - -// describes how the socket is currently connected -enum ESNetSocketConnectionType -{ - k_ESNetSocketConnectionTypeNotConnected = 0, - k_ESNetSocketConnectionTypeUDP = 1, - k_ESNetSocketConnectionTypeUDPRelay = 2, -}; - - -//----------------------------------------------------------------------------- -// Purpose: Functions for making connections and sending data between clients, -// traversing NAT's where possible -//----------------------------------------------------------------------------- -class ISteamNetworking -{ -public: - //////////////////////////////////////////////////////////////////////////////////////////// - // Session-less connection functions - // automatically establishes NAT-traversing or Relay server connections - - // Sends a P2P packet to the specified user - // UDP-like, unreliable and a max packet size of 1200 bytes - // the first packet send may be delayed as the NAT-traversal code runs - // if we can't get through to the user, an error will be posted via the callback P2PSessionConnectFail_t - // see EP2PSend enum above for the descriptions of the different ways of sending packets - // - // nChannel is a routing number you can use to help route message to different systems - you'll have to call ReadP2PPacket() - // with the same channel number in order to retrieve the data on the other end - // using different channels to talk to the same user will still use the same underlying p2p connection, saving on resources - virtual bool SendP2PPacket( CSteamID steamIDRemote, const void *pubData, uint32 cubData, EP2PSend eP2PSendType, int nChannel = 0 ) = 0; - - // returns true if any data is available for read, and the amount of data that will need to be read - virtual bool IsP2PPacketAvailable( uint32 *pcubMsgSize, int nChannel = 0 ) = 0; - - // reads in a packet that has been sent from another user via SendP2PPacket() - // returns the size of the message and the steamID of the user who sent it in the last two parameters - // if the buffer passed in is too small, the message will be truncated - // this call is not blocking, and will return false if no data is available - virtual bool ReadP2PPacket( void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, CSteamID *psteamIDRemote, int nChannel = 0 ) = 0; - - // AcceptP2PSessionWithUser() should only be called in response to a P2PSessionRequest_t callback - // P2PSessionRequest_t will be posted if another user tries to send you a packet that you haven't talked to yet - // if you don't want to talk to the user, just ignore the request - // if the user continues to send you packets, another P2PSessionRequest_t will be posted periodically - // this may be called multiple times for a single user - // (if you've called SendP2PPacket() on the other user, this implicitly accepts the session request) - virtual bool AcceptP2PSessionWithUser( CSteamID steamIDRemote ) = 0; - - // call CloseP2PSessionWithUser() when you're done talking to a user, will free up resources under-the-hood - // if the remote user tries to send data to you again, another P2PSessionRequest_t callback will be posted - virtual bool CloseP2PSessionWithUser( CSteamID steamIDRemote ) = 0; - - // call CloseP2PChannelWithUser() when you're done talking to a user on a specific channel. Once all channels - // open channels to a user have been closed, the open session to the user will be closed and new data from this - // user will trigger a P2PSessionRequest_t callback - virtual bool CloseP2PChannelWithUser( CSteamID steamIDRemote, int nChannel ) = 0; - - // fills out P2PSessionState_t structure with details about the underlying connection to the user - // should only needed for debugging purposes - // returns false if no connection exists to the specified user - virtual bool GetP2PSessionState( CSteamID steamIDRemote, P2PSessionState_t *pConnectionState ) = 0; - - // Allow P2P connections to fall back to being relayed through the Steam servers if a direct connection - // or NAT-traversal cannot be established. Only applies to connections created after setting this value, - // or to existing connections that need to automatically reconnect after this value is set. - // - // P2P packet relay is allowed by default - virtual bool AllowP2PPacketRelay( bool bAllow ) = 0; - - - //////////////////////////////////////////////////////////////////////////////////////////// - // LISTEN / CONNECT style interface functions - // - // This is an older set of functions designed around the Berkeley TCP sockets model - // it's preferential that you use the above P2P functions, they're more robust - // and these older functions will be removed eventually - // - //////////////////////////////////////////////////////////////////////////////////////////// - - - // creates a socket and listens others to connect - // will trigger a SocketStatusCallback_t callback on another client connecting - // nVirtualP2PPort is the unique ID that the client will connect to, in case you have multiple ports - // this can usually just be 0 unless you want multiple sets of connections - // unIP is the local IP address to bind to - // pass in 0 if you just want the default local IP - // unPort is the port to use - // pass in 0 if you don't want users to be able to connect via IP/Port, but expect to be always peer-to-peer connections only - virtual SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort, uint32 nIP, uint16 nPort, bool bAllowUseOfPacketRelay ) = 0; - - // creates a socket and begin connection to a remote destination - // can connect via a known steamID (client or game server), or directly to an IP - // on success will trigger a SocketStatusCallback_t callback - // on failure or timeout will trigger a SocketStatusCallback_t callback with a failure code in m_eSNetSocketState - virtual SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay ) = 0; - virtual SNetSocket_t CreateConnectionSocket( uint32 nIP, uint16 nPort, int nTimeoutSec ) = 0; - - // disconnects the connection to the socket, if any, and invalidates the handle - // any unread data on the socket will be thrown away - // if bNotifyRemoteEnd is set, socket will not be completely destroyed until the remote end acknowledges the disconnect - virtual bool DestroySocket( SNetSocket_t hSocket, bool bNotifyRemoteEnd ) = 0; - // destroying a listen socket will automatically kill all the regular sockets generated from it - virtual bool DestroyListenSocket( SNetListenSocket_t hSocket, bool bNotifyRemoteEnd ) = 0; - - // sending data - // must be a handle to a connected socket - // data is all sent via UDP, and thus send sizes are limited to 1200 bytes; after this, many routers will start dropping packets - // use the reliable flag with caution; although the resend rate is pretty aggressive, - // it can still cause stalls in receiving data (like TCP) - virtual bool SendDataOnSocket( SNetSocket_t hSocket, void *pubData, uint32 cubData, bool bReliable ) = 0; - - // receiving data - // returns false if there is no data remaining - // fills out *pcubMsgSize with the size of the next message, in bytes - virtual bool IsDataAvailableOnSocket( SNetSocket_t hSocket, uint32 *pcubMsgSize ) = 0; - - // fills in pubDest with the contents of the message - // messages are always complete, of the same size as was sent (i.e. packetized, not streaming) - // if *pcubMsgSize < cubDest, only partial data is written - // returns false if no data is available - virtual bool RetrieveDataFromSocket( SNetSocket_t hSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize ) = 0; - - // checks for data from any socket that has been connected off this listen socket - // returns false if there is no data remaining - // fills out *pcubMsgSize with the size of the next message, in bytes - // fills out *phSocket with the socket that data is available on - virtual bool IsDataAvailable( SNetListenSocket_t hListenSocket, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0; - - // retrieves data from any socket that has been connected off this listen socket - // fills in pubDest with the contents of the message - // messages are always complete, of the same size as was sent (i.e. packetized, not streaming) - // if *pcubMsgSize < cubDest, only partial data is written - // returns false if no data is available - // fills out *phSocket with the socket that data is available on - virtual bool RetrieveData( SNetListenSocket_t hListenSocket, void *pubDest, uint32 cubDest, uint32 *pcubMsgSize, SNetSocket_t *phSocket ) = 0; - - // returns information about the specified socket, filling out the contents of the pointers - virtual bool GetSocketInfo( SNetSocket_t hSocket, CSteamID *pSteamIDRemote, int *peSocketStatus, uint32 *punIPRemote, uint16 *punPortRemote ) = 0; - - // returns which local port the listen socket is bound to - // *pnIP and *pnPort will be 0 if the socket is set to listen for P2P connections only - virtual bool GetListenSocketInfo( SNetListenSocket_t hListenSocket, uint32 *pnIP, uint16 *pnPort ) = 0; - - // returns true to describe how the socket ended up connecting - virtual ESNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket ) = 0; - - // max packet size, in bytes - virtual int GetMaxPacketSize( SNetSocket_t hSocket ) = 0; -}; -#define STEAMNETWORKING_INTERFACE_VERSION "SteamNetworking005" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -// callback notification - a user wants to talk to us over the P2P channel via the SendP2PPacket() API -// in response, a call to AcceptP2PPacketsFromUser() needs to be made, if you want to talk with them -struct P2PSessionRequest_t -{ - enum { k_iCallback = k_iSteamNetworkingCallbacks + 2 }; - CSteamID m_steamIDRemote; // user who wants to talk to us -}; - - -// callback notification - packets can't get through to the specified user via the SendP2PPacket() API -// all packets queued packets unsent at this point will be dropped -// further attempts to send will retry making the connection (but will be dropped if we fail again) -struct P2PSessionConnectFail_t -{ - enum { k_iCallback = k_iSteamNetworkingCallbacks + 3 }; - CSteamID m_steamIDRemote; // user we were sending packets to - uint8 m_eP2PSessionError; // EP2PSessionError indicating why we're having trouble -}; - - -// callback notification - status of a socket has changed -// used as part of the CreateListenSocket() / CreateP2PConnectionSocket() -struct SocketStatusCallback_t -{ - enum { k_iCallback = k_iSteamNetworkingCallbacks + 1 }; - SNetSocket_t m_hSocket; // the socket used to send/receive data to the remote host - SNetListenSocket_t m_hListenSocket; // this is the server socket that we were listening on; NULL if this was an outgoing connection - CSteamID m_steamIDRemote; // remote steamID we have connected to, if it has one - int m_eSNetSocketState; // socket state, ESNetSocketState -}; - -#pragma pack( pop ) - -#endif // ISTEAMNETWORKING diff --git a/regamedll/public/steam/isteamremotestorage.h b/regamedll/public/steam/isteamremotestorage.h deleted file mode 100644 index d282556a..00000000 --- a/regamedll/public/steam/isteamremotestorage.h +++ /dev/null @@ -1,610 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: public interface to user remote file storage in Steam -// -//============================================================================= - -#ifndef ISTEAMREMOTESTORAGE_H -#define ISTEAMREMOTESTORAGE_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - - -//----------------------------------------------------------------------------- -// Purpose: Defines the largest allowed file size. Cloud files cannot be written -// in a single chunk over 100MB (and cannot be over 200MB total.) -//----------------------------------------------------------------------------- -const uint32 k_unMaxCloudFileChunkSize = 100 * 1024 * 1024; - - -//----------------------------------------------------------------------------- -// Purpose: Structure that contains an array of const char * strings and the number of those strings -//----------------------------------------------------------------------------- -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif -struct SteamParamStringArray_t -{ - const char ** m_ppStrings; - int32 m_nNumStrings; -}; -#pragma pack( pop ) - -// A handle to a piece of user generated content -typedef uint64 UGCHandle_t; -typedef uint64 PublishedFileUpdateHandle_t; -typedef uint64 PublishedFileId_t; -const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull; -const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull; - -// Handle for writing to Steam Cloud -typedef uint64 UGCFileWriteStreamHandle_t; -const UGCFileWriteStreamHandle_t k_UGCFileStreamHandleInvalid = 0xffffffffffffffffull; - -const uint32 k_cchPublishedDocumentTitleMax = 128 + 1; -const uint32 k_cchPublishedDocumentDescriptionMax = 8000; -const uint32 k_cchPublishedDocumentChangeDescriptionMax = 8000; -const uint32 k_unEnumeratePublishedFilesMaxResults = 50; -const uint32 k_cchTagListMax = 1024 + 1; -const uint32 k_cchFilenameMax = 260; -const uint32 k_cchPublishedFileURLMax = 256; - -// Ways to handle a synchronization conflict -enum EResolveConflict -{ - k_EResolveConflictKeepClient = 1, // The local version of each file will be used to overwrite the server version - k_EResolveConflictKeepServer = 2, // The server version of each file will be used to overwrite the local version -}; - -enum ERemoteStoragePlatform -{ - k_ERemoteStoragePlatformNone = 0, - k_ERemoteStoragePlatformWindows = (1 << 0), - k_ERemoteStoragePlatformOSX = (1 << 1), - k_ERemoteStoragePlatformPS3 = (1 << 2), - k_ERemoteStoragePlatformLinux = (1 << 3), - k_ERemoteStoragePlatformReserved2 = (1 << 4), - - k_ERemoteStoragePlatformAll = 0xffffffff -}; - -enum ERemoteStoragePublishedFileVisibility -{ - k_ERemoteStoragePublishedFileVisibilityPublic = 0, - k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1, - k_ERemoteStoragePublishedFileVisibilityPrivate = 2, -}; - - -enum EWorkshopFileType -{ - k_EWorkshopFileTypeFirst = 0, - - k_EWorkshopFileTypeCommunity = 0, - k_EWorkshopFileTypeMicrotransaction = 1, - k_EWorkshopFileTypeCollection = 2, - k_EWorkshopFileTypeArt = 3, - k_EWorkshopFileTypeVideo = 4, - k_EWorkshopFileTypeScreenshot = 5, - k_EWorkshopFileTypeGame = 6, - k_EWorkshopFileTypeSoftware = 7, - k_EWorkshopFileTypeConcept = 8, - k_EWorkshopFileTypeWebGuide = 9, - k_EWorkshopFileTypeIntegratedGuide = 10, - k_EWorkshopFileTypeMerch = 11, - - // Update k_EWorkshopFileTypeMax if you add values - k_EWorkshopFileTypeMax = 12 - -}; - -enum EWorkshopVote -{ - k_EWorkshopVoteUnvoted = 0, - k_EWorkshopVoteFor = 1, - k_EWorkshopVoteAgainst = 2, -}; - -enum EWorkshopFileAction -{ - k_EWorkshopFileActionPlayed = 0, - k_EWorkshopFileActionCompleted = 1, -}; - -enum EWorkshopEnumerationType -{ - k_EWorkshopEnumerationTypeRankedByVote = 0, - k_EWorkshopEnumerationTypeRecent = 1, - k_EWorkshopEnumerationTypeTrending = 2, - k_EWorkshopEnumerationTypeFavoritesOfFriends = 3, - k_EWorkshopEnumerationTypeVotedByFriends = 4, - k_EWorkshopEnumerationTypeContentByFriends = 5, - k_EWorkshopEnumerationTypeRecentFromFollowedUsers = 6, -}; - -enum EWorkshopVideoProvider -{ - k_EWorkshopVideoProviderNone = 0, - k_EWorkshopVideoProviderYoutube = 1 -}; - -//----------------------------------------------------------------------------- -// Purpose: Functions for accessing, reading and writing files stored remotely -// and cached locally -//----------------------------------------------------------------------------- -class ISteamRemoteStorage -{ - public: - // NOTE - // - // Filenames are case-insensitive, and will be converted to lowercase automatically. - // So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then - // iterate the files, the filename returned will be "foo.bar". - // - - // file operations - virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0; - virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0; - virtual bool FileForget( const char *pchFile ) = 0; - virtual bool FileDelete( const char *pchFile ) = 0; - virtual SteamAPICall_t FileShare( const char *pchFile ) = 0; - virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0; - - // file operations that cause network IO - virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0; - virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0; - virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0; - virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0; - - // file information - virtual bool FileExists( const char *pchFile ) = 0; - virtual bool FilePersisted( const char *pchFile ) = 0; - virtual int32 GetFileSize( const char *pchFile ) = 0; - virtual int64 GetFileTimestamp( const char *pchFile ) = 0; - virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0; - - // iteration - virtual int32 GetFileCount() = 0; - virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0; - - // configuration management - virtual bool GetQuota( int32 *pnTotalBytes, int32 *puAvailableBytes ) = 0; - virtual bool IsCloudEnabledForAccount() = 0; - virtual bool IsCloudEnabledForApp() = 0; - virtual void SetCloudEnabledForApp( bool bEnabled ) = 0; - - // user generated content - - // Downloads a UGC file. A priority value of 0 will download the file immediately, - // otherwise it will wait to download the file until all downloads with a lower priority - // value are completed. Downloads with equal priority will occur simultaneously. - virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0; - - // Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false - // or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage - virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0; - - // Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result - virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, char **ppchName, int32 *pnFileSizeInBytes, CSteamID *pSteamIDOwner ) = 0; - - // After download, gets the content of the file. - // Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file. - // Larger files can be read in chunks to reduce memory usage (since both sides of the IPC client and the game itself must allocate - // enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail - // unless UGCDownload is called again. - // For especially large files (anything over 100MB) it is a requirement that the file is read in chunks. - virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset ) = 0; - - // Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead() - virtual int32 GetCachedUGCCount() = 0; - virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0; - - // The following functions are only necessary on the Playstation 3. On PC & Mac, the Steam client will handle these operations for you - // On Playstation 3, the game controls which files are stored in the cloud, via FilePersist, FileFetch, and FileForget. - -#if defined(_PS3) || defined(_SERVER) - // Connect to Steam and get a list of files in the Cloud - results in a RemoteStorageAppSyncStatusCheck_t callback - virtual void GetFileListFromServer() = 0; - // Indicate this file should be downloaded in the next sync - virtual bool FileFetch( const char *pchFile ) = 0; - // Indicate this file should be persisted in the next sync - virtual bool FilePersist( const char *pchFile ) = 0; - // Pull any requested files down from the Cloud - results in a RemoteStorageAppSyncedClient_t callback - virtual bool SynchronizeToClient() = 0; - // Upload any requested files to the Cloud - results in a RemoteStorageAppSyncedServer_t callback - virtual bool SynchronizeToServer() = 0; - // Reset any fetch/persist/etc requests - virtual bool ResetFileRequestState() = 0; -#endif - - // publishing UGC - virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0; - virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0; - virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0; - virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0; - virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0; - virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0; - virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; - virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0; - virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0; - // Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0, - // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh, - // a value of -1 will use cached data if it exists, no matter how old it is. - virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0; - virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; - // enumerate the files that the current user published with this app - virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0; - virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; - virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0; - virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; - virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0; - virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0; - virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0; - virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0; - virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0; - virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0; - virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0; - virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0; - // this method enumerates the public view of workshop files - virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0; - - virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0; -}; - -#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION011" - - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: sent when the local file cache is fully synced with the server for an app -// That means that an application can be started and has all latest files -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncedClient_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 1 }; - AppId_t m_nAppID; - EResult m_eResult; - int m_unNumDownloads; -}; - -//----------------------------------------------------------------------------- -// Purpose: sent when the server is fully synced with the local file cache for an app -// That means that we can shutdown Steam and our data is stored on the server -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncedServer_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 2 }; - AppId_t m_nAppID; - EResult m_eResult; - int m_unNumUploads; -}; - -//----------------------------------------------------------------------------- -// Purpose: Status of up and downloads during a sync session -// -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncProgress_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 3 }; - char m_rgchCurrentFile[k_cchFilenameMax]; // Current file being transferred - AppId_t m_nAppID; // App this info relates to - uint32 m_uBytesTransferredThisChunk; // Bytes transferred this chunk - double m_dAppPercentComplete; // Percent complete that this app's transfers are - bool m_bUploading; // if false, downloading -}; - -// -// IMPORTANT! k_iClientRemoteStorageCallbacks + 4 is used, see iclientremotestorage.h -// - - -//----------------------------------------------------------------------------- -// Purpose: Sent after we've determined the list of files that are out of sync -// with the server. -//----------------------------------------------------------------------------- -struct RemoteStorageAppSyncStatusCheck_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 5 }; - AppId_t m_nAppID; - EResult m_eResult; -}; - -//----------------------------------------------------------------------------- -// Purpose: Sent after a conflict resolution attempt. -//----------------------------------------------------------------------------- -struct RemoteStorageConflictResolution_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 6 }; - AppId_t m_nAppID; - EResult m_eResult; -}; - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to FileShare() -//----------------------------------------------------------------------------- -struct RemoteStorageFileShareResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 }; - EResult m_eResult; // The result of the operation - UGCHandle_t m_hFile; // The handle that can be shared with users and features -}; - - -// k_iClientRemoteStorageCallbacks + 8 is deprecated! Do not reuse - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to PublishFile() -//----------------------------------------------------------------------------- -struct RemoteStoragePublishFileResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 9 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; - bool m_bUserNeedsToAcceptWorkshopLegalAgreement; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to DeletePublishedFile() -//----------------------------------------------------------------------------- -struct RemoteStorageDeletePublishedFileResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 11 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to EnumerateUserPublishedFiles() -//----------------------------------------------------------------------------- -struct RemoteStorageEnumerateUserPublishedFilesResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 12 }; - EResult m_eResult; // The result of the operation. - int32 m_nResultsReturned; - int32 m_nTotalResultCount; - PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to SubscribePublishedFile() -//----------------------------------------------------------------------------- -struct RemoteStorageSubscribePublishedFileResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 13 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to EnumerateSubscribePublishedFiles() -//----------------------------------------------------------------------------- -struct RemoteStorageEnumerateUserSubscribedFilesResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 14 }; - EResult m_eResult; // The result of the operation. - int32 m_nResultsReturned; - int32 m_nTotalResultCount; - PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; - uint32 m_rgRTimeSubscribed[ k_unEnumeratePublishedFilesMaxResults ]; -}; - -#if defined(VALVE_CALLBACK_PACK_SMALL) - VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 ); -#elif defined(VALVE_CALLBACK_PACK_LARGE) - VALVE_COMPILE_TIME_ASSERT( sizeof( RemoteStorageEnumerateUserSubscribedFilesResult_t ) == (1 + 1 + 1 + 50 + 100) * 4 + 4 ); -#else -#warning You must first include isteamclient.h -#endif - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to UnsubscribePublishedFile() -//----------------------------------------------------------------------------- -struct RemoteStorageUnsubscribePublishedFileResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 15 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to CommitPublishedFileUpdate() -//----------------------------------------------------------------------------- -struct RemoteStorageUpdatePublishedFileResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 16 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; - bool m_bUserNeedsToAcceptWorkshopLegalAgreement; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to UGCDownload() -//----------------------------------------------------------------------------- -struct RemoteStorageDownloadUGCResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 17 }; - EResult m_eResult; // The result of the operation. - UGCHandle_t m_hFile; // The handle to the file that was attempted to be downloaded. - AppId_t m_nAppID; // ID of the app that created this file. - int32 m_nSizeInBytes; // The size of the file that was downloaded, in bytes. - char m_pchFileName[k_cchFilenameMax]; // The name of the file that was downloaded. - uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to GetPublishedFileDetails() -//----------------------------------------------------------------------------- -struct RemoteStorageGetPublishedFileDetailsResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 18 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; - AppId_t m_nCreatorAppID; // ID of the app that created this file. - AppId_t m_nConsumerAppID; // ID of the app that will consume this file. - char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document - char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document - UGCHandle_t m_hFile; // The handle of the primary file - UGCHandle_t m_hPreviewFile; // The handle of the preview file - uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. - uint32 m_rtimeCreated; // time when the published file was created - uint32 m_rtimeUpdated; // time when the published file was last updated - ERemoteStoragePublishedFileVisibility m_eVisibility; - bool m_bBanned; - char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file - bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer - char m_pchFileName[k_cchFilenameMax]; // The name of the primary file - int32 m_nFileSize; // Size of the primary file - int32 m_nPreviewFileSize; // Size of the preview file - char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) - EWorkshopFileType m_eFileType; // Type of the file -}; - - -struct RemoteStorageEnumerateWorkshopFilesResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 19 }; - EResult m_eResult; - int32 m_nResultsReturned; - int32 m_nTotalResultCount; - PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; - float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ]; -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of GetPublishedItemVoteDetails -//----------------------------------------------------------------------------- -struct RemoteStorageGetPublishedItemVoteDetailsResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 20 }; - EResult m_eResult; - PublishedFileId_t m_unPublishedFileId; - int32 m_nVotesFor; - int32 m_nVotesAgainst; - int32 m_nReports; - float m_fScore; -}; - - -//----------------------------------------------------------------------------- -// Purpose: User subscribed to a file for the app (from within the app or on the web) -//----------------------------------------------------------------------------- -struct RemoteStoragePublishedFileSubscribed_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 21 }; - PublishedFileId_t m_nPublishedFileId; // The published file id - AppId_t m_nAppID; // ID of the app that will consume this file. -}; - -//----------------------------------------------------------------------------- -// Purpose: User unsubscribed from a file for the app (from within the app or on the web) -//----------------------------------------------------------------------------- -struct RemoteStoragePublishedFileUnsubscribed_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 22 }; - PublishedFileId_t m_nPublishedFileId; // The published file id - AppId_t m_nAppID; // ID of the app that will consume this file. -}; - - -//----------------------------------------------------------------------------- -// Purpose: Published file that a user owns was deleted (from within the app or the web) -//----------------------------------------------------------------------------- -struct RemoteStoragePublishedFileDeleted_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 23 }; - PublishedFileId_t m_nPublishedFileId; // The published file id - AppId_t m_nAppID; // ID of the app that will consume this file. -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to UpdateUserPublishedItemVote() -//----------------------------------------------------------------------------- -struct RemoteStorageUpdateUserPublishedItemVoteResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 24 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; // The published file id -}; - - -//----------------------------------------------------------------------------- -// Purpose: The result of a call to GetUserPublishedItemVoteDetails() -//----------------------------------------------------------------------------- -struct RemoteStorageUserVoteDetails_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 25 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; // The published file id - EWorkshopVote m_eVote; // what the user voted -}; - -struct RemoteStorageEnumerateUserSharedWorkshopFilesResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 26 }; - EResult m_eResult; // The result of the operation. - int32 m_nResultsReturned; - int32 m_nTotalResultCount; - PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; -}; - -struct RemoteStorageSetUserPublishedFileActionResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 27 }; - EResult m_eResult; // The result of the operation. - PublishedFileId_t m_nPublishedFileId; // The published file id - EWorkshopFileAction m_eAction; // the action that was attempted -}; - -struct RemoteStorageEnumeratePublishedFilesByUserActionResult_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 28 }; - EResult m_eResult; // The result of the operation. - EWorkshopFileAction m_eAction; // the action that was filtered on - int32 m_nResultsReturned; - int32 m_nTotalResultCount; - PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; - uint32 m_rgRTimeUpdated[ k_unEnumeratePublishedFilesMaxResults ]; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Called periodically while a PublishWorkshopFile is in progress -//----------------------------------------------------------------------------- -struct RemoteStoragePublishFileProgress_t -{ - enum { k_iCallback = k_iClientRemoteStorageCallbacks + 29 }; - double m_dPercentFile; - bool m_bPreview; -}; - - - -#pragma pack( pop ) - - -#endif // ISTEAMREMOTESTORAGE_H diff --git a/regamedll/public/steam/isteamscreenshots.h b/regamedll/public/steam/isteamscreenshots.h deleted file mode 100644 index f77acc27..00000000 --- a/regamedll/public/steam/isteamscreenshots.h +++ /dev/null @@ -1,96 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: public interface to user remote file storage in Steam -// -//============================================================================= - -#ifndef ISTEAMSCREENSHOTS_H -#define ISTEAMSCREENSHOTS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -const uint32 k_nScreenshotMaxTaggedUsers = 32; -const uint32 k_nScreenshotMaxTaggedPublishedFiles = 32; -const int k_cubUFSTagTypeMax = 255; -const int k_cubUFSTagValueMax = 255; - -// Required with of a thumbnail provided to AddScreenshotToLibrary. If you do not provide a thumbnail -// one will be generated. -const int k_ScreenshotThumbWidth = 200; - -// Handle is valid for the lifetime of your process and no longer -typedef uint32 ScreenshotHandle; -#define INVALID_SCREENSHOT_HANDLE 0 - -//----------------------------------------------------------------------------- -// Purpose: Functions for adding screenshots to the user's screenshot library -//----------------------------------------------------------------------------- -class ISteamScreenshots -{ -public: - // Writes a screenshot to the user's screenshot library given the raw image data, which must be in RGB format. - // The return value is a handle that is valid for the duration of the game process and can be used to apply tags. - virtual ScreenshotHandle WriteScreenshot( void *pubRGB, uint32 cubRGB, int nWidth, int nHeight ) = 0; - - // Adds a screenshot to the user's screenshot library from disk. If a thumbnail is provided, it must be 200 pixels wide and the same aspect ratio - // as the screenshot, otherwise a thumbnail will be generated if the user uploads the screenshot. The screenshots must be in either JPEG or TGA format. - // The return value is a handle that is valid for the duration of the game process and can be used to apply tags. - // JPEG, TGA, and PNG formats are supported. - virtual ScreenshotHandle AddScreenshotToLibrary( const char *pchFilename, const char *pchThumbnailFilename, int nWidth, int nHeight ) = 0; - - // Causes the Steam overlay to take a screenshot. If screenshots are being hooked by the game then a ScreenshotRequested_t callback is sent back to the game instead. - virtual void TriggerScreenshot() = 0; - - // Toggles whether the overlay handles screenshots when the user presses the screenshot hotkey, or the game handles them. If the game is hooking screenshots, - // then the ScreenshotRequested_t callback will be sent if the user presses the hotkey, and the game is expected to call WriteScreenshot or AddScreenshotToLibrary - // in response. - virtual void HookScreenshots( bool bHook ) = 0; - - // Sets metadata about a screenshot's location (for example, the name of the map) - virtual bool SetLocation( ScreenshotHandle hScreenshot, const char *pchLocation ) = 0; - - // Tags a user as being visible in the screenshot - virtual bool TagUser( ScreenshotHandle hScreenshot, CSteamID steamID ) = 0; - - // Tags a published file as being visible in the screenshot - virtual bool TagPublishedFile( ScreenshotHandle hScreenshot, PublishedFileId_t unPublishedFileID ) = 0; -}; - -#define STEAMSCREENSHOTS_INTERFACE_VERSION "STEAMSCREENSHOTS_INTERFACE_VERSION002" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif -//----------------------------------------------------------------------------- -// Purpose: Screenshot successfully written or otherwise added to the library -// and can now be tagged -//----------------------------------------------------------------------------- -struct ScreenshotReady_t -{ - enum { k_iCallback = k_iSteamScreenshotsCallbacks + 1 }; - ScreenshotHandle m_hLocal; - EResult m_eResult; -}; - -//----------------------------------------------------------------------------- -// Purpose: Screenshot has been requested by the user. Only sent if -// HookScreenshots() has been called, in which case Steam will not take -// the screenshot itself. -//----------------------------------------------------------------------------- -struct ScreenshotRequested_t -{ - enum { k_iCallback = k_iSteamScreenshotsCallbacks + 2 }; -}; - -#pragma pack( pop ) - - -#endif // ISTEAMSCREENSHOTS_H diff --git a/regamedll/public/steam/isteamunifiedmessages.h b/regamedll/public/steam/isteamunifiedmessages.h deleted file mode 100644 index 8e87dc9a..00000000 --- a/regamedll/public/steam/isteamunifiedmessages.h +++ /dev/null @@ -1,63 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: Interface to unified messages client -// -// You should not need to use this interface except if your product is using a language other than C++. -// Contact your Steam Tech contact for more details. -// -//============================================================================= - -#ifndef ISTEAMUNIFIEDMESSAGES_H -#define ISTEAMUNIFIEDMESSAGES_H -#ifdef _WIN32 -#pragma once -#endif - -typedef uint64 ClientUnifiedMessageHandle; - -class ISteamUnifiedMessages -{ -public: - static const ClientUnifiedMessageHandle k_InvalidUnifiedMessageHandle = 0; - - // Sends a service method (in binary serialized form) using the Steam Client. - // Returns a unified message handle (k_InvalidUnifiedMessageHandle if could not send the message). - virtual ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void *pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext ) = 0; - - // Gets the size of the response and the EResult. Returns false if the response is not ready yet. - virtual bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult ) = 0; - - // Gets a response in binary serialized form (and optionally release the corresponding allocated memory). - virtual bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease ) = 0; - - // Releases the message and its corresponding allocated memory. - virtual bool ReleaseMethod( ClientUnifiedMessageHandle hHandle ) = 0; - - // Sends a service notification (in binary serialized form) using the Steam Client. - // Returns true if the notification was sent successfully. - virtual bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize ) = 0; -}; - -#define STEAMUNIFIEDMESSAGES_INTERFACE_VERSION "STEAMUNIFIEDMESSAGES_INTERFACE_VERSION001" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -struct SteamUnifiedMessagesSendMethodResult_t -{ - enum { k_iCallback = k_iClientUnifiedMessagesCallbacks + 1 }; - ClientUnifiedMessageHandle m_hHandle; // The handle returned by SendMethod(). - uint64 m_unContext; // Context provided when calling SendMethod(). - EResult m_eResult; // The result of the method call. - uint32 m_unResponseSize; // The size of the response. -}; - -#pragma pack( pop ) - -#endif // ISTEAMUNIFIEDMESSAGES_H diff --git a/regamedll/public/steam/isteamuser.h b/regamedll/public/steam/isteamuser.h deleted file mode 100644 index 7e046166..00000000 --- a/regamedll/public/steam/isteamuser.h +++ /dev/null @@ -1,339 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to user account information in Steam -// -//============================================================================= - -#ifndef ISTEAMUSER_H -#define ISTEAMUSER_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - -// structure that contains client callback data -// see callbacks documentation for more details -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif -struct CallbackMsg_t -{ - HSteamUser m_hSteamUser; - int m_iCallback; - uint8 *m_pubParam; - int m_cubParam; -}; -#pragma pack( pop ) - -// reference to a steam call, to filter results by -typedef int32 HSteamCall; - -//----------------------------------------------------------------------------- -// Purpose: Functions for accessing and manipulating a steam account -// associated with one client instance -//----------------------------------------------------------------------------- -class ISteamUser -{ -public: - // returns the HSteamUser this interface represents - // this is only used internally by the API, and by a few select interfaces that support multi-user - virtual HSteamUser GetHSteamUser() = 0; - - // returns true if the Steam client current has a live connection to the Steam servers. - // If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy. - // The Steam client will automatically be trying to recreate the connection as often as possible. - virtual bool BLoggedOn() = 0; - - // returns the CSteamID of the account currently logged into the Steam client - // a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API - virtual CSteamID GetSteamID() = 0; - - // Multiplayer Authentication functions - - // InitiateGameConnection() starts the state machine for authenticating the game client with the game server - // It is the client portion of a three-way handshake between the client, the game server, and the steam servers - // - // Parameters: - // void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token. - // int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes. - // CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client - // CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( ) - // uint32 unIPServer, uint16 usPortServer - the IP address of the game server - // bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running) - // - // return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed - // The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process. - virtual int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) = 0; - - // notify of disconnect - // needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call - virtual void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) = 0; - - // Legacy functions - - // used by only a few games to track usage events - virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0; - - // get the local storage folder for current Steam account to write application data, e.g. save games, configs etc. - // this will usually be something like "C:\Progam Files\Steam\userdata\\\local" - virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0; - - // Starts voice recording. Once started, use GetVoice() to get the data - virtual void StartVoiceRecording( ) = 0; - - // Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for - // a little bit after this function is called. GetVoice() should continue to be called until it returns - // k_eVoiceResultNotRecording - virtual void StopVoiceRecording( ) = 0; - - // Determine the amount of captured audio data that is available in bytes. - // This provides both the compressed and uncompressed data. Please note that the uncompressed - // data is not the raw feed from the microphone: data may only be available if audible - // levels of speech are detected. - // nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case) - // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate - virtual EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate) = 0; - - // Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to - // DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format. - // Please note that the uncompressed data is not the raw feed from the microphone: data may only be available if audible - // levels of speech are detected, and may have passed through denoising filters, etc. - // This function should be called as often as possible once recording has started; once per frame at least. - // nBytesWritten is set to the number of bytes written to pDestBuffer. - // nUncompressedBytesWritten is set to the number of bytes written to pUncompressedDestBuffer. - // You must grab both compressed and uncompressed here at the same time, if you want both. - // Matching data that is not read during this call will be thrown away. - // GetAvailableVoice() can be used to determine how much data is actually available. - // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate - virtual EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 *nUncompressBytesWritten, uint32 nUncompressedVoiceDesiredSampleRate ) = 0; - - // Decompresses a chunk of compressed data produced by GetVoice(). - // nBytesWritten is set to the number of bytes written to pDestBuffer unless the return value is k_EVoiceResultBufferTooSmall. - // In that case, nBytesWritten is set to the size of the buffer required to decompress the given - // data. The suggested buffer size for the destination buffer is 22 kilobytes. - // The output format of the data is 16-bit signed at the requested samples per second. - // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nDesiredSampleRate - virtual EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate ) = 0; - - // This returns the frequency of the voice data as it's stored internally; calling DecompressVoice() with this size will yield the best results - virtual uint32 GetVoiceOptimalSampleRate() = 0; - - // Retrieve ticket to be sent to the entity who wishes to authenticate you. - // pcbTicket retrieves the length of the actual ticket. - virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; - - // Authenticate ticket from entity steamID to be sure it is valid and isnt reused - // Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse ) - virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0; - - // Stop tracking started by BeginAuthSession - called when no longer playing game with this entity - virtual void EndAuthSession( CSteamID steamID ) = 0; - - // Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to - virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0; - - // After receiving a user's authentication data, and passing it to BeginAuthSession, use this function - // to determine if the user owns downloadable content specified by the provided AppID. - virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0; - - // returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam - // (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT. - virtual bool BIsBehindNAT() = 0; - - // set data to be replicated to friends so that they can join your game - // CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client - // uint32 unIPServer, uint16 usPortServer - the IP address of the game server - virtual void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer ) = 0; - - // Requests a ticket encrypted with an app specific shared key - // pDataToInclude, cbDataToInclude will be encrypted into the ticket - // ( This is asynchronous, you must wait for the ticket to be completed by the server ) - virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0; - - // retrieve a finished ticket - virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; - -#ifdef _PS3 - // Initiates PS3 Logon request using just PSN ticket. - // - // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to - // prompt the user for network setup/PSN logon before initiating the Steam side of the logon. - // - // Listen for SteamServersConnected_t or SteamServerConnectFailure_t for status. SteamServerConnectFailure_t - // may return with EResult k_EResultExternalAccountUnlinked if the PSN account is unknown to Steam. You should - // then call LogOnAndLinkSteamAccountToPSN() after prompting the user for credentials to establish a link. - // Future calls to LogOn() after the one time link call should succeed as long as the user is connected to PSN. - virtual void LogOn( bool bInteractive ) = 0; - - // Initiates a request to logon with a specific steam username/password and create a PSN account link at - // the same time. Should call this only if LogOn() has failed and indicated the PSN account is unlinked. - // - // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to - // prompt the user for network setup/PSN logon before initiating the Steam side of the logon. pchUserName - // should be the users Steam username, and pchPassword should be the users Steam password. - // - // Listen for SteamServersConnected_t or SteamServerConnectFailure_t for status. SteamServerConnectFailure_t - // may return with EResult k_EResultOtherAccountAlreadyLinked if already linked to another account. - virtual void LogOnAndLinkSteamAccountToPSN( bool bInteractive, const char *pchUserName, const char *pchPassword ) = 0; - - // Final logon option for PS3, this logs into an existing account if already linked, but if not already linked - // creates a new account using the info in the PSN ticket to generate a unique account name. The new account is - // then linked to the PSN ticket. This is the faster option for new users who don't have an existing Steam account - // to get into multiplayer. - // - // PARAMS: bInteractive - If set tells Steam to go ahead and show the PS3 NetStart dialog if needed to - // prompt the user for network setup/PSN logon before initiating the Steam side of the logon. - virtual void LogOnAndCreateNewSteamAccountIfNeeded( bool bInteractive ) = 0; - - // Returns a special SteamID that represents the user's PSN information. Can be used to query the user's PSN avatar, - // online name, etc. through the standard Steamworks interfaces. - virtual CSteamID GetConsoleSteamID() = 0; -#endif - -}; - -#define STEAMUSER_INTERFACE_VERSION "SteamUser016" - - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: called when a connections to the Steam back-end has been established -// this means the Steam client now has a working connection to the Steam servers -// usually this will have occurred before the game has launched, and should -// only be seen if the user has dropped connection due to a networking issue -// or a Steam server update -//----------------------------------------------------------------------------- -struct SteamServersConnected_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 1 }; -}; - -//----------------------------------------------------------------------------- -// Purpose: called when a connection attempt has failed -// this will occur periodically if the Steam client is not connected, -// and has failed in it's retry to establish a connection -//----------------------------------------------------------------------------- -struct SteamServerConnectFailure_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 2 }; - EResult m_eResult; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called if the client has lost connection to the Steam servers -// real-time services will be disabled until a matching SteamServersConnected_t has been posted -//----------------------------------------------------------------------------- -struct SteamServersDisconnected_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 3 }; - EResult m_eResult; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Sent by the Steam server to the client telling it to disconnect from the specified game server, -// which it may be in the process of or already connected to. -// The game client should immediately disconnect upon receiving this message. -// This can usually occur if the user doesn't have rights to play on the game server. -//----------------------------------------------------------------------------- -struct ClientGameServerDeny_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 13 }; - - uint32 m_uAppID; - uint32 m_unGameServerIP; - uint16 m_usGameServerPort; - uint16 m_bSecure; - uint32 m_uReason; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when the callback system for this client is in an error state (and has flushed pending callbacks) -// When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect. -// This usually occurs in the rare event the Steam client has some kind of fatal error. -//----------------------------------------------------------------------------- -struct IPCFailure_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 17 }; - enum EFailureType - { - k_EFailureFlushedCallbackQueue, - k_EFailurePipeFail, - }; - uint8 m_eFailureType; -}; - - -//----------------------------------------------------------------------------- -// callback for BeginAuthSession -//----------------------------------------------------------------------------- -struct ValidateAuthTicketResponse_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 43 }; - CSteamID m_SteamID; - EAuthSessionResponse m_eAuthSessionResponse; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when a user has responded to a microtransaction authorization request -//----------------------------------------------------------------------------- -struct MicroTxnAuthorizationResponse_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 52 }; - - uint32 m_unAppID; // AppID for this microtransaction - uint64 m_ulOrderID; // OrderID provided for the microtransaction - uint8 m_bAuthorized; // if user authorized transaction -}; - - -//----------------------------------------------------------------------------- -// Purpose: Result from RequestEncryptedAppTicket -//----------------------------------------------------------------------------- -struct EncryptedAppTicketResponse_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 54 }; - - EResult m_eResult; -}; - -//----------------------------------------------------------------------------- -// callback for GetAuthSessionTicket -//----------------------------------------------------------------------------- -struct GetAuthSessionTicketResponse_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 63 }; - HAuthTicket m_hAuthTicket; - EResult m_eResult; -}; - - -//----------------------------------------------------------------------------- -// Purpose: sent to your game in response to a steam://gamewebcallback/ command -//----------------------------------------------------------------------------- -struct GameWebCallback_t -{ - enum { k_iCallback = k_iSteamUserCallbacks + 64 }; - char m_szURL[256]; -}; - - -#pragma pack( pop ) - -#endif // ISTEAMUSER_H diff --git a/regamedll/public/steam/isteamuserstats.h b/regamedll/public/steam/isteamuserstats.h deleted file mode 100644 index 897c0866..00000000 --- a/regamedll/public/steam/isteamuserstats.h +++ /dev/null @@ -1,463 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to stats, achievements, and leaderboards -// -//============================================================================= - -#ifndef ISTEAMUSERSTATS_H -#define ISTEAMUSERSTATS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" -#include "isteamremotestorage.h" - -// size limit on stat or achievement name (UTF-8 encoded) -enum { k_cchStatNameMax = 128 }; - -// maximum number of bytes for a leaderboard name (UTF-8 encoded) -enum { k_cchLeaderboardNameMax = 128 }; - -// maximum number of details int32's storable for a single leaderboard entry -enum { k_cLeaderboardDetailsMax = 64 }; - -// handle to a single leaderboard -typedef uint64 SteamLeaderboard_t; - -// handle to a set of downloaded entries in a leaderboard -typedef uint64 SteamLeaderboardEntries_t; - -// type of data request, when downloading leaderboard entries -enum ELeaderboardDataRequest -{ - k_ELeaderboardDataRequestGlobal = 0, - k_ELeaderboardDataRequestGlobalAroundUser = 1, - k_ELeaderboardDataRequestFriends = 2, - k_ELeaderboardDataRequestUsers = 3 -}; - -// the sort order of a leaderboard -enum ELeaderboardSortMethod -{ - k_ELeaderboardSortMethodNone = 0, - k_ELeaderboardSortMethodAscending = 1, // top-score is lowest number - k_ELeaderboardSortMethodDescending = 2, // top-score is highest number -}; - -// the display type (used by the Steam Community web site) for a leaderboard -enum ELeaderboardDisplayType -{ - k_ELeaderboardDisplayTypeNone = 0, - k_ELeaderboardDisplayTypeNumeric = 1, // simple numerical score - k_ELeaderboardDisplayTypeTimeSeconds = 2, // the score represents a time, in seconds - k_ELeaderboardDisplayTypeTimeMilliSeconds = 3, // the score represents a time, in milliseconds -}; - -enum ELeaderboardUploadScoreMethod -{ - k_ELeaderboardUploadScoreMethodNone = 0, - k_ELeaderboardUploadScoreMethodKeepBest = 1, // Leaderboard will keep user's best score - k_ELeaderboardUploadScoreMethodForceUpdate = 2, // Leaderboard will always replace score with specified -}; - -// a single entry in a leaderboard, as returned by GetDownloadedLeaderboardEntry() -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -struct LeaderboardEntry_t -{ - CSteamID m_steamIDUser; // user with the entry - use SteamFriends()->GetFriendPersonaName() & SteamFriends()->GetFriendAvatar() to get more info - int32 m_nGlobalRank; // [1..N], where N is the number of users with an entry in the leaderboard - int32 m_nScore; // score as set in the leaderboard - int32 m_cDetails; // number of int32 details available for this entry - UGCHandle_t m_hUGC; // handle for UGC attached to the entry -}; - -#pragma pack( pop ) - - -//----------------------------------------------------------------------------- -// Purpose: Functions for accessing stats, achievements, and leaderboard information -//----------------------------------------------------------------------------- -class ISteamUserStats -{ -public: - // Ask the server to send down this user's data and achievements for this game - virtual bool RequestCurrentStats() = 0; - - // Data accessors - virtual bool GetStat( const char *pchName, int32 *pData ) = 0; - virtual bool GetStat( const char *pchName, float *pData ) = 0; - - // Set / update data - virtual bool SetStat( const char *pchName, int32 nData ) = 0; - virtual bool SetStat( const char *pchName, float fData ) = 0; - virtual bool UpdateAvgRateStat( const char *pchName, float flCountThisSession, double dSessionLength ) = 0; - - // Achievement flag accessors - virtual bool GetAchievement( const char *pchName, bool *pbAchieved ) = 0; - virtual bool SetAchievement( const char *pchName ) = 0; - virtual bool ClearAchievement( const char *pchName ) = 0; - - // Get the achievement status, and the time it was unlocked if unlocked. - // If the return value is true, but the unlock time is zero, that means it was unlocked before Steam - // began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970. - virtual bool GetAchievementAndUnlockTime( const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0; - - // Store the current data on the server, will get a callback when set - // And one callback for every new achievement - // - // If the callback has a result of k_EResultInvalidParam, one or more stats - // uploaded has been rejected, either because they broke constraints - // or were out of date. In this case the server sends back updated values. - // The stats should be re-iterated to keep in sync. - virtual bool StoreStats() = 0; - - // Achievement / GroupAchievement metadata - - // Gets the icon of the achievement, which is a handle to be used in ISteamUtils::GetImageRGBA(), or 0 if none set. - // A return value of 0 may indicate we are still fetching data, and you can wait for the UserAchievementIconFetched_t callback - // which will notify you when the bits are ready. If the callback still returns zero, then there is no image set for the - // specified achievement. - virtual int GetAchievementIcon( const char *pchName ) = 0; - - // Get general attributes for an achievement. Accepts the following keys: - // - "name" and "desc" for retrieving the localized achievement name and description (returned in UTF8) - // - "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden) - virtual const char *GetAchievementDisplayAttribute( const char *pchName, const char *pchKey ) = 0; - - // Achievement progress - triggers an AchievementProgress callback, that is all. - // Calling this w/ N out of N progress will NOT set the achievement, the game must still do that. - virtual bool IndicateAchievementProgress( const char *pchName, uint32 nCurProgress, uint32 nMaxProgress ) = 0; - - // Used for iterating achievements. In general games should not need these functions because they should have a - // list of existing achievements compiled into them - virtual uint32 GetNumAchievements() = 0; - // Get achievement name iAchievement in [0,GetNumAchievements) - virtual const char *GetAchievementName( uint32 iAchievement ) = 0; - - // Friends stats & achievements - - // downloads stats for the user - // returns a UserStatsReceived_t received when completed - // if the other user has no stats, UserStatsReceived_t.m_eResult will be set to k_EResultFail - // these stats won't be auto-updated; you'll need to call RequestUserStats() again to refresh any data - virtual SteamAPICall_t RequestUserStats( CSteamID steamIDUser ) = 0; - - // requests stat information for a user, usable after a successful call to RequestUserStats() - virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, int32 *pData ) = 0; - virtual bool GetUserStat( CSteamID steamIDUser, const char *pchName, float *pData ) = 0; - virtual bool GetUserAchievement( CSteamID steamIDUser, const char *pchName, bool *pbAchieved ) = 0; - // See notes for GetAchievementAndUnlockTime above - virtual bool GetUserAchievementAndUnlockTime( CSteamID steamIDUser, const char *pchName, bool *pbAchieved, uint32 *punUnlockTime ) = 0; - - // Reset stats - virtual bool ResetAllStats( bool bAchievementsToo ) = 0; - - // Leaderboard functions - - // asks the Steam back-end for a leaderboard by name, and will create it if it's not yet - // This call is asynchronous, with the result returned in LeaderboardFindResult_t - virtual SteamAPICall_t FindOrCreateLeaderboard( const char *pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType ) = 0; - - // as above, but won't create the leaderboard if it's not found - // This call is asynchronous, with the result returned in LeaderboardFindResult_t - virtual SteamAPICall_t FindLeaderboard( const char *pchLeaderboardName ) = 0; - - // returns the name of a leaderboard - virtual const char *GetLeaderboardName( SteamLeaderboard_t hSteamLeaderboard ) = 0; - - // returns the total number of entries in a leaderboard, as of the last request - virtual int GetLeaderboardEntryCount( SteamLeaderboard_t hSteamLeaderboard ) = 0; - - // returns the sort method of the leaderboard - virtual ELeaderboardSortMethod GetLeaderboardSortMethod( SteamLeaderboard_t hSteamLeaderboard ) = 0; - - // returns the display type of the leaderboard - virtual ELeaderboardDisplayType GetLeaderboardDisplayType( SteamLeaderboard_t hSteamLeaderboard ) = 0; - - // Asks the Steam back-end for a set of rows in the leaderboard. - // This call is asynchronous, with the result returned in LeaderboardScoresDownloaded_t - // LeaderboardScoresDownloaded_t will contain a handle to pull the results from GetDownloadedLeaderboardEntries() (below) - // You can ask for more entries than exist, and it will return as many as do exist. - // k_ELeaderboardDataRequestGlobal requests rows in the leaderboard from the full table, with nRangeStart & nRangeEnd in the range [1, TotalEntries] - // k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate - // e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after - // k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user - virtual SteamAPICall_t DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd ) = 0; - // as above, but downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers - // if a user doesn't have a leaderboard entry, they won't be included in the result - // a max of 100 users can be downloaded at a time, with only one outstanding call at a time - virtual SteamAPICall_t DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, CSteamID *prgUsers, int cUsers ) = 0; - - // Returns data about a single leaderboard entry - // use a for loop from 0 to LeaderboardScoresDownloaded_t::m_cEntryCount to get all the downloaded entries - // e.g. - // void OnLeaderboardScoresDownloaded( LeaderboardScoresDownloaded_t *pLeaderboardScoresDownloaded ) - // { - // for ( int index = 0; index < pLeaderboardScoresDownloaded->m_cEntryCount; index++ ) - // { - // LeaderboardEntry_t leaderboardEntry; - // int32 details[3]; // we know this is how many we've stored previously - // GetDownloadedLeaderboardEntry( pLeaderboardScoresDownloaded->m_hSteamLeaderboardEntries, index, &leaderboardEntry, details, 3 ); - // assert( leaderboardEntry.m_cDetails == 3 ); - // ... - // } - // once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid - virtual bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, LeaderboardEntry_t *pLeaderboardEntry, int32 *pDetails, int cDetailsMax ) = 0; - - // Uploads a user score to the Steam back-end. - // This call is asynchronous, with the result returned in LeaderboardScoreUploaded_t - // Details are extra game-defined information regarding how the user got that score - // pScoreDetails points to an array of int32's, cScoreDetailsCount is the number of int32's in the list - virtual SteamAPICall_t UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int32 nScore, const int32 *pScoreDetails, int cScoreDetailsCount ) = 0; - - // Attaches a piece of user generated content the user's entry on a leaderboard. - // hContent is a handle to a piece of user generated content that was shared using ISteamUserRemoteStorage::FileShare(). - // This call is asynchronous, with the result returned in LeaderboardUGCSet_t. - virtual SteamAPICall_t AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC ) = 0; - - // Retrieves the number of players currently playing your game (online + offline) - // This call is asynchronous, with the result returned in NumberOfCurrentPlayers_t - virtual SteamAPICall_t GetNumberOfCurrentPlayers() = 0; - - // Requests that Steam fetch data on the percentage of players who have received each achievement - // for the game globally. - // This call is asynchronous, with the result returned in GlobalAchievementPercentagesReady_t. - virtual SteamAPICall_t RequestGlobalAchievementPercentages() = 0; - - // Get the info on the most achieved achievement for the game, returns an iterator index you can use to fetch - // the next most achieved afterwards. Will return -1 if there is no data on achievement - // percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback). - virtual int GetMostAchievedAchievementInfo( char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0; - - // Get the info on the next most achieved achievement for the game. Call this after GetMostAchievedAchievementInfo or another - // GetNextMostAchievedAchievementInfo call passing the iterator from the previous call. Returns -1 after the last - // achievement has been iterated. - virtual int GetNextMostAchievedAchievementInfo( int iIteratorPrevious, char *pchName, uint32 unNameBufLen, float *pflPercent, bool *pbAchieved ) = 0; - - // Returns the percentage of users who have achieved the specified achievement. - virtual bool GetAchievementAchievedPercent( const char *pchName, float *pflPercent ) = 0; - - // Requests global stats data, which is available for stats marked as "aggregated". - // This call is asynchronous, with the results returned in GlobalStatsReceived_t. - // nHistoryDays specifies how many days of day-by-day history to retrieve in addition - // to the overall totals. The limit is 60. - virtual SteamAPICall_t RequestGlobalStats( int nHistoryDays ) = 0; - - // Gets the lifetime totals for an aggregated stat - virtual bool GetGlobalStat( const char *pchStatName, int64 *pData ) = 0; - virtual bool GetGlobalStat( const char *pchStatName, double *pData ) = 0; - - // Gets history for an aggregated stat. pData will be filled with daily values, starting with today. - // So when called, pData[0] will be today, pData[1] will be yesterday, and pData[2] will be two days ago, - // etc. cubData is the size in bytes of the pubData buffer. Returns the number of - // elements actually set. - virtual int32 GetGlobalStatHistory( const char *pchStatName, int64 *pData, uint32 cubData ) = 0; - virtual int32 GetGlobalStatHistory( const char *pchStatName, double *pData, uint32 cubData ) = 0; - -#ifdef _PS3 - // Call to kick off installation of the PS3 trophies. This call is asynchronous, and the results will be returned in a PS3TrophiesInstalled_t - // callback. - virtual bool InstallPS3Trophies() = 0; - - // Returns the amount of space required at boot to install trophies. This value can be used when comparing the amount of space needed - // by the game to the available space value passed to the game at boot. The value is set during InstallPS3Trophies(). - virtual uint64 GetTrophySpaceRequiredBeforeInstall() = 0; - - // On PS3, user stats & achievement progress through Steam must be stored with the user's saved game data. - // At startup, before calling RequestCurrentStats(), you must pass the user's stats data to Steam via this method. - // If you do not have any user data, call this function with pvData = NULL and cubData = 0 - virtual bool SetUserStatsData( const void *pvData, uint32 cubData ) = 0; - - // Call to get the user's current stats data. You should retrieve this data after receiving successful UserStatsReceived_t & UserStatsStored_t - // callbacks, and store the data with the user's save game data. You can call this method with pvData = NULL and cubData = 0 to get the required - // buffer size. - virtual bool GetUserStatsData( void *pvData, uint32 cubData, uint32 *pcubWritten ) = 0; -#endif -}; - -#define STEAMUSERSTATS_INTERFACE_VERSION "STEAMUSERSTATS_INTERFACE_VERSION011" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: called when the latests stats and achievements have been received -// from the server -//----------------------------------------------------------------------------- -struct UserStatsReceived_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 1 }; - uint64 m_nGameID; // Game these stats are for - EResult m_eResult; // Success / error fetching the stats - CSteamID m_steamIDUser; // The user for whom the stats are retrieved for -}; - - -//----------------------------------------------------------------------------- -// Purpose: result of a request to store the user stats for a game -//----------------------------------------------------------------------------- -struct UserStatsStored_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 2 }; - uint64 m_nGameID; // Game these stats are for - EResult m_eResult; // success / error -}; - - -//----------------------------------------------------------------------------- -// Purpose: result of a request to store the achievements for a game, or an -// "indicate progress" call. If both m_nCurProgress and m_nMaxProgress -// are zero, that means the achievement has been fully unlocked. -//----------------------------------------------------------------------------- -struct UserAchievementStored_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 3 }; - - uint64 m_nGameID; // Game this is for - bool m_bGroupAchievement; // if this is a "group" achievement - char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement - uint32 m_nCurProgress; // current progress towards the achievement - uint32 m_nMaxProgress; // "out of" this many -}; - - -//----------------------------------------------------------------------------- -// Purpose: call result for finding a leaderboard, returned as a result of FindOrCreateLeaderboard() or FindLeaderboard() -// use CCallResult<> to map this async result to a member function -//----------------------------------------------------------------------------- -struct LeaderboardFindResult_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 4 }; - SteamLeaderboard_t m_hSteamLeaderboard; // handle to the leaderboard serarched for, 0 if no leaderboard found - uint8 m_bLeaderboardFound; // 0 if no leaderboard found -}; - - -//----------------------------------------------------------------------------- -// Purpose: call result indicating scores for a leaderboard have been downloaded and are ready to be retrieved, returned as a result of DownloadLeaderboardEntries() -// use CCallResult<> to map this async result to a member function -//----------------------------------------------------------------------------- -struct LeaderboardScoresDownloaded_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 5 }; - SteamLeaderboard_t m_hSteamLeaderboard; - SteamLeaderboardEntries_t m_hSteamLeaderboardEntries; // the handle to pass into GetDownloadedLeaderboardEntries() - int m_cEntryCount; // the number of entries downloaded -}; - - -//----------------------------------------------------------------------------- -// Purpose: call result indicating scores has been uploaded, returned as a result of UploadLeaderboardScore() -// use CCallResult<> to map this async result to a member function -//----------------------------------------------------------------------------- -struct LeaderboardScoreUploaded_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 6 }; - uint8 m_bSuccess; // 1 if the call was successful - SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was - int32 m_nScore; // the score that was attempted to set - uint8 m_bScoreChanged; // true if the score in the leaderboard change, false if the existing score was better - int m_nGlobalRankNew; // the new global rank of the user in this leaderboard - int m_nGlobalRankPrevious; // the previous global rank of the user in this leaderboard; 0 if the user had no existing entry in the leaderboard -}; - -struct NumberOfCurrentPlayers_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 7 }; - uint8 m_bSuccess; // 1 if the call was successful - int32 m_cPlayers; // Number of players currently playing -}; - - - -//----------------------------------------------------------------------------- -// Purpose: Callback indicating that a user's stats have been unloaded. -// Call RequestUserStats again to access stats for this user -//----------------------------------------------------------------------------- -struct UserStatsUnloaded_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 8 }; - CSteamID m_steamIDUser; // User whose stats have been unloaded -}; - - - -//----------------------------------------------------------------------------- -// Purpose: Callback indicating that an achievement icon has been fetched -//----------------------------------------------------------------------------- -struct UserAchievementIconFetched_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 9 }; - - CGameID m_nGameID; // Game this is for - char m_rgchAchievementName[k_cchStatNameMax]; // name of the achievement - bool m_bAchieved; // Is the icon for the achieved or not achieved version? - int m_nIconHandle; // Handle to the image, which can be used in SteamUtils()->GetImageRGBA(), 0 means no image is set for the achievement -}; - - -//----------------------------------------------------------------------------- -// Purpose: Callback indicating that global achievement percentages are fetched -//----------------------------------------------------------------------------- -struct GlobalAchievementPercentagesReady_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 10 }; - - uint64 m_nGameID; // Game this is for - EResult m_eResult; // Result of the operation -}; - - -//----------------------------------------------------------------------------- -// Purpose: call result indicating UGC has been uploaded, returned as a result of SetLeaderboardUGC() -//----------------------------------------------------------------------------- -struct LeaderboardUGCSet_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 11 }; - EResult m_eResult; // The result of the operation - SteamLeaderboard_t m_hSteamLeaderboard; // the leaderboard handle that was -}; - - -//----------------------------------------------------------------------------- -// Purpose: callback indicating that PS3 trophies have been installed -//----------------------------------------------------------------------------- -struct PS3TrophiesInstalled_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 }; - uint64 m_nGameID; // Game these stats are for - EResult m_eResult; // The result of the operation - uint64 m_ulRequiredDiskSpace; // If m_eResult is k_EResultDiskFull, will contain the amount of space needed to install trophies - -}; - - -//----------------------------------------------------------------------------- -// Purpose: callback indicating global stats have been received. -// Returned as a result of RequestGlobalStats() -//----------------------------------------------------------------------------- -struct GlobalStatsReceived_t -{ - enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 }; - uint64 m_nGameID; // Game global stats were requested for - EResult m_eResult; // The result of the request -}; - -#pragma pack( pop ) - - -#endif // ISTEAMUSER_H diff --git a/regamedll/public/steam/isteamutils.h b/regamedll/public/steam/isteamutils.h deleted file mode 100644 index d0bf2c62..00000000 --- a/regamedll/public/steam/isteamutils.h +++ /dev/null @@ -1,304 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: interface to utility functions in Steam -// -//============================================================================= - -#ifndef ISTEAMUTILS_H -#define ISTEAMUTILS_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" - - -// Steam API call failure results -enum ESteamAPICallFailure -{ - k_ESteamAPICallFailureNone = -1, // no failure - k_ESteamAPICallFailureSteamGone = 0, // the local Steam process has gone away - k_ESteamAPICallFailureNetworkFailure = 1, // the network connection to Steam has been broken, or was already broken - // SteamServersDisconnected_t callback will be sent around the same time - // SteamServersConnected_t will be sent when the client is able to talk to the Steam servers again - k_ESteamAPICallFailureInvalidHandle = 2, // the SteamAPICall_t handle passed in no longer exists - k_ESteamAPICallFailureMismatchedCallback = 3,// GetAPICallResult() was called with the wrong callback type for this API call -}; - - -// Input modes for the Big Picture gamepad text entry -enum EGamepadTextInputMode -{ - k_EGamepadTextInputModeNormal = 0, - k_EGamepadTextInputModePassword = 1 -}; - - -// Controls number of allowed lines for the Big Picture gamepad text entry -enum EGamepadTextInputLineMode -{ - k_EGamepadTextInputLineModeSingleLine = 0, - k_EGamepadTextInputLineModeMultipleLines = 1 -}; - - -// function prototype for warning message hook -#if defined( POSIX ) -#define __cdecl -#endif -extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *); - -//----------------------------------------------------------------------------- -// Purpose: interface to user independent utility functions -//----------------------------------------------------------------------------- -class ISteamUtils -{ -public: - // return the number of seconds since the user - virtual uint32 GetSecondsSinceAppActive() = 0; - virtual uint32 GetSecondsSinceComputerActive() = 0; - - // the universe this client is connecting to - virtual EUniverse GetConnectedUniverse() = 0; - - // Steam server time - in PST, number of seconds since January 1, 1970 (i.e unix time) - virtual uint32 GetServerRealTime() = 0; - - // returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database) - // e.g "US" or "UK". - virtual const char *GetIPCountry() = 0; - - // returns true if the image exists, and valid sizes were filled out - virtual bool GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight ) = 0; - - // returns true if the image exists, and the buffer was successfully filled out - // results are returned in RGBA format - // the destination buffer size should be 4 * height * width * sizeof(char) - virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0; - - // returns the IP of the reporting server for valve - currently only used in Source engine games - virtual bool GetCSERIPPort( uint32 *unIP, uint16 *usPort ) = 0; - - // return the amount of battery power left in the current system in % [0..100], 255 for being on AC power - virtual uint8 GetCurrentBatteryPower() = 0; - - // returns the appID of the current process - virtual uint32 GetAppID() = 0; - - // Sets the position where the overlay instance for the currently calling game should show notifications. - // This position is per-game and if this function is called from outside of a game context it will do nothing. - virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0; - - // API asynchronous call results - // can be used directly, but more commonly used via the callback dispatch API (see steam_api.h) - virtual bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed ) = 0; - virtual ESteamAPICallFailure GetAPICallFailureReason( SteamAPICall_t hSteamAPICall ) = 0; - virtual bool GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) = 0; - - // this needs to be called every frame to process matchmaking results - // redundant if you're already calling SteamAPI_RunCallbacks() - virtual void RunFrame() = 0; - - // returns the number of IPC calls made since the last time this function was called - // Used for perf debugging so you can understand how many IPC calls your game makes per frame - // Every IPC call is at minimum a thread context switch if not a process one so you want to rate - // control how often you do them. - virtual uint32 GetIPCCallCount() = 0; - - // API warning handling - // 'int' is the severity; 0 for msg, 1 for warning - // 'const char *' is the text of the message - // callbacks will occur directly after the API function is called that generated the warning or message - virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0; - - // Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to - // start & hook the game process, so this function will initially return false while the overlay is loading. - virtual bool IsOverlayEnabled() = 0; - - // Normally this call is unneeded if your game has a constantly running frame loop that calls the - // D3D Present API, or OGL SwapBuffers API every frame. - // - // However, if you have a game that only refreshes the screen on an event driven basis then that can break - // the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also - // need to Present() to the screen any time an even needing a notification happens or when the overlay is - // brought up over the game by a user. You can use this API to ask the overlay if it currently need a present - // in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you - // refresh the screen with Present or SwapBuffers to allow the overlay to do it's work. - virtual bool BOverlayNeedsPresent() = 0; - -#ifndef _PS3 - // Asynchronous call to check if an executable file has been signed using the public key set on the signing tab - // of the partner site, for example to refuse to load modified executable files. - // The result is returned in CheckFileSignature_t. - // k_ECheckFileSignatureNoSignaturesFoundForThisApp - This app has not been configured on the signing tab of the partner site to enable this function. - // k_ECheckFileSignatureNoSignaturesFoundForThisFile - This file is not listed on the signing tab for the partner site. - // k_ECheckFileSignatureFileNotFound - The file does not exist on disk. - // k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match. - // k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid. - virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0; -#endif - -#ifdef _PS3 - virtual void PostPS3SysutilCallback( uint64_t status, uint64_t param, void* userdata ) = 0; - virtual bool BIsReadyToShutdown() = 0; - virtual bool BIsPSNOnline() = 0; - - // Call this with localized strings for the language the game is running in, otherwise default english - // strings will be used by Steam. - virtual void SetPSNGameBootInviteStrings( const char *pchSubject, const char *pchBody ) = 0; -#endif - - // Activates the Big Picture text input dialog which only supports gamepad input - virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax ) = 0; - - // Returns previously entered text & length - virtual uint32 GetEnteredGamepadTextLength() = 0; - virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0; - - // returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases - virtual const char *GetSteamUILanguage() = 0; -}; - -#define STEAMUTILS_INTERFACE_VERSION "SteamUtils006" - - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: The country of the user changed -//----------------------------------------------------------------------------- -struct IPCountry_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 1 }; -}; - - -//----------------------------------------------------------------------------- -// Purpose: Fired when running on a laptop and less than 10 minutes of battery is left, fires then every minute -//----------------------------------------------------------------------------- -struct LowBatteryPower_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 2 }; - uint8 m_nMinutesBatteryLeft; -}; - - -//----------------------------------------------------------------------------- -// Purpose: called when a SteamAsyncCall_t has completed (or failed) -//----------------------------------------------------------------------------- -struct SteamAPICallCompleted_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 3 }; - SteamAPICall_t m_hAsyncCall; -}; - - -//----------------------------------------------------------------------------- -// called when Steam wants to shutdown -//----------------------------------------------------------------------------- -struct SteamShutdown_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 4 }; -}; - -//----------------------------------------------------------------------------- -// results for CheckFileSignature -//----------------------------------------------------------------------------- -enum ECheckFileSignature -{ - k_ECheckFileSignatureInvalidSignature = 0, - k_ECheckFileSignatureValidSignature = 1, - k_ECheckFileSignatureFileNotFound = 2, - k_ECheckFileSignatureNoSignaturesFoundForThisApp = 3, - k_ECheckFileSignatureNoSignaturesFoundForThisFile = 4, -}; - -//----------------------------------------------------------------------------- -// callback for CheckFileSignature -//----------------------------------------------------------------------------- -struct CheckFileSignature_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 5 }; - ECheckFileSignature m_eCheckFileSignature; -}; - -#ifdef _PS3 -//----------------------------------------------------------------------------- -// callback for NetCtlNetStartDialog finishing on PS3 -//----------------------------------------------------------------------------- -struct NetStartDialogFinished_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 6 }; -}; - -//----------------------------------------------------------------------------- -// callback for NetCtlNetStartDialog unloaded on PS3 -//----------------------------------------------------------------------------- -struct NetStartDialogUnloaded_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 7 }; -}; - -//----------------------------------------------------------------------------- -// callback for system menu closing on PS3 - should trigger resyncronizing friends list, etc. -//----------------------------------------------------------------------------- -struct PS3SystemMenuClosed_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 8 }; -}; - -//----------------------------------------------------------------------------- -// callback for NP message being selected by user on PS3 - should trigger handling of message if it's a lobby invite, etc. -//----------------------------------------------------------------------------- -struct PS3NPMessageSelected_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 9 }; - uint32 dataid; -}; - -//----------------------------------------------------------------------------- -// callback for when the PS3 keyboard dialog closes -//----------------------------------------------------------------------------- -struct PS3KeyboardDialogFinished_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 10 }; -}; - -// k_iSteamUtilsCallbacks + 11 is taken - -//----------------------------------------------------------------------------- -// callback for PSN status changing on PS3 -//----------------------------------------------------------------------------- -struct PS3PSNStatusChange_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 12 }; - bool m_bPSNOnline; -}; - -#endif - -// k_iSteamUtilsCallbacks + 13 is taken - - -//----------------------------------------------------------------------------- -// Big Picture gamepad text input has been closed -//----------------------------------------------------------------------------- -struct GamepadTextInputDismissed_t -{ - enum { k_iCallback = k_iSteamUtilsCallbacks + 14 }; - bool m_bSubmitted; // true if user entered & accepted text (Call ISteamUtils::GetEnteredGamepadTextInput() for text), false if canceled input - uint32 m_unSubmittedText; -}; - -// k_iSteamUtilsCallbacks + 15 is taken - -#pragma pack( pop ) - -#endif // ISTEAMUTILS_H diff --git a/regamedll/public/steam/matchmakingtypes.h b/regamedll/public/steam/matchmakingtypes.h deleted file mode 100644 index bb069251..00000000 --- a/regamedll/public/steam/matchmakingtypes.h +++ /dev/null @@ -1,249 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef MATCHMAKINGTYPES_H -#define MATCHMAKINGTYPES_H - -#ifdef _WIN32 -#pragma once -#endif - -#ifdef POSIX -#ifndef _snprintf -#define _snprintf snprintf -#endif -#endif - -#include -#include - -#include "common.h" //Q_snprinf - -// -// Max size (in bytes of UTF-8 data, not in characters) of server fields, including null terminator. -// WARNING: These cannot be changed easily, without breaking clients using old interfaces. -// -const int k_cbMaxGameServerGameDir = 32; -const int k_cbMaxGameServerMapName = 32; -const int k_cbMaxGameServerGameDescription = 64; -const int k_cbMaxGameServerName = 64; -const int k_cbMaxGameServerTags = 128; -const int k_cbMaxGameServerGameData = 2048; - -struct MatchMakingKeyValuePair_t -{ - MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; } - MatchMakingKeyValuePair_t( const char *pchKey, const char *pchValue ) - { - strncpy( m_szKey, pchKey, sizeof(m_szKey) ); // this is a public header, use basic c library string funcs only! - m_szKey[ sizeof( m_szKey ) - 1 ] = '\0'; - strncpy( m_szValue, pchValue, sizeof(m_szValue) ); - m_szValue[ sizeof( m_szValue ) - 1 ] = '\0'; - } - char m_szKey[ 256 ]; - char m_szValue[ 256 ]; -}; - - -enum EMatchMakingServerResponse -{ - eServerResponded = 0, - eServerFailedToRespond, - eNoServersListedOnMasterServer // for the Internet query type, returned in response callback if no servers of this type match -}; - -// servernetadr_t is all the addressing info the serverbrowser needs to know about a game server, -// namely: its IP, its connection port, and its query port. -class servernetadr_t -{ -public: - - void Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort ); - -// Uncompatible feature commented -//#ifdef NETADR_H -// netadr_t GetIPAndQueryPort(); -//#endif - - // Access the query port. - uint16 GetQueryPort() const; - void SetQueryPort( uint16 usPort ); - - // Access the connection port. - uint16 GetConnectionPort() const; - void SetConnectionPort( uint16 usPort ); - - // Access the IP - uint32 GetIP() const; - void SetIP( uint32 ); - - // This gets the 'a.b.c.d:port' string with the connection port (instead of the query port). - const char *GetConnectionAddressString() const; - const char *GetQueryAddressString() const; - - // Comparison operators and functions. - bool operator<(const servernetadr_t &netadr) const; - void operator=( const servernetadr_t &that ) - { - m_usConnectionPort = that.m_usConnectionPort; - m_usQueryPort = that.m_usQueryPort; - m_unIP = that.m_unIP; - } - - -private: - const char *ToString( uint32 unIP, uint16 usPort ) const; - uint16 m_usConnectionPort; // (in HOST byte order) - uint16 m_usQueryPort; - uint32 m_unIP; -}; - - -inline void servernetadr_t::Init( unsigned int ip, uint16 usQueryPort, uint16 usConnectionPort ) -{ - m_unIP = ip; - m_usQueryPort = usQueryPort; - m_usConnectionPort = usConnectionPort; -} - -// Uncompatible feature commented -//#ifdef NETADR_H -//inline netadr_t servernetadr_t::GetIPAndQueryPort() -//{ -// return netadr_t( m_unIP, m_usQueryPort ); -//} -//#endif - -inline uint16 servernetadr_t::GetQueryPort() const -{ - return m_usQueryPort; -} - -inline void servernetadr_t::SetQueryPort( uint16 usPort ) -{ - m_usQueryPort = usPort; -} - -inline uint16 servernetadr_t::GetConnectionPort() const -{ - return m_usConnectionPort; -} - -inline void servernetadr_t::SetConnectionPort( uint16 usPort ) -{ - m_usConnectionPort = usPort; -} - -inline uint32 servernetadr_t::GetIP() const -{ - return m_unIP; -} - -inline void servernetadr_t::SetIP( uint32 unIP ) -{ - m_unIP = unIP; -} - -inline const char *servernetadr_t::ToString( uint32 unIP, uint16 usPort ) const -{ - static char s[4][64]; - static int nBuf = 0; - unsigned char *ipByte = (unsigned char *)&unIP; -#ifdef VALVE_BIG_ENDIAN - Q_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[0]), (int)(ipByte[1]), (int)(ipByte[2]), (int)(ipByte[3]), usPort ); -#else - Q_snprintf (s[nBuf], sizeof( s[nBuf] ), "%u.%u.%u.%u:%i", (int)(ipByte[3]), (int)(ipByte[2]), (int)(ipByte[1]), (int)(ipByte[0]), usPort ); -#endif - const char *pchRet = s[nBuf]; - ++nBuf; - nBuf %= ( (sizeof(s)/sizeof(s[0])) ); - return pchRet; -} - -inline const char* servernetadr_t::GetConnectionAddressString() const -{ - return ToString( m_unIP, m_usConnectionPort ); -} - -inline const char* servernetadr_t::GetQueryAddressString() const -{ - return ToString( m_unIP, m_usQueryPort ); -} - -inline bool servernetadr_t::operator<(const servernetadr_t &netadr) const -{ - return ( m_unIP < netadr.m_unIP ) || ( m_unIP == netadr.m_unIP && m_usQueryPort < netadr.m_usQueryPort ); -} - -//----------------------------------------------------------------------------- -// Purpose: Data describing a single server -//----------------------------------------------------------------------------- -class gameserveritem_t -{ -public: - gameserveritem_t(); - - const char* GetName() const; - void SetName( const char *pName ); - -public: - servernetadr_t m_NetAdr; ///< IP/Query Port/Connection Port for this server - int m_nPing; ///< current ping time in milliseconds - bool m_bHadSuccessfulResponse; ///< server has responded successfully in the past - bool m_bDoNotRefresh; ///< server is marked as not responding and should no longer be refreshed - char m_szGameDir[k_cbMaxGameServerGameDir]; ///< current game directory - char m_szMap[k_cbMaxGameServerMapName]; ///< current map - char m_szGameDescription[k_cbMaxGameServerGameDescription]; ///< game description - uint32 m_nAppID; ///< Steam App ID of this server - int m_nPlayers; ///< total number of players currently on the server. INCLUDES BOTS!! - int m_nMaxPlayers; ///< Maximum players that can join this server - int m_nBotPlayers; ///< Number of bots (i.e simulated players) on this server - bool m_bPassword; ///< true if this server needs a password to join - bool m_bSecure; ///< Is this server protected by VAC - uint32 m_ulTimeLastPlayed; ///< time (in unix time) when this server was last played on (for favorite/history servers) - int m_nServerVersion; ///< server version as reported to Steam - -private: - - /// Game server name - char m_szServerName[k_cbMaxGameServerName]; - - // For data added after SteamMatchMaking001 add it here -public: - /// the tags this server exposes - char m_szGameTags[k_cbMaxGameServerTags]; - - /// steamID of the game server - invalid if it's doesn't have one (old server, or not connected to Steam) - CSteamID m_steamID; -}; - - -inline gameserveritem_t::gameserveritem_t() -{ - m_szGameDir[0] = m_szMap[0] = m_szGameDescription[0] = m_szServerName[0] = 0; - m_bHadSuccessfulResponse = m_bDoNotRefresh = m_bPassword = m_bSecure = false; - m_nPing = m_nAppID = m_nPlayers = m_nMaxPlayers = m_nBotPlayers = m_ulTimeLastPlayed = m_nServerVersion = 0; - m_szGameTags[0] = 0; -} - -inline const char* gameserveritem_t::GetName() const -{ - // Use the IP address as the name if nothing is set yet. - if ( m_szServerName[0] == 0 ) - return m_NetAdr.GetConnectionAddressString(); - else - return m_szServerName; -} - -inline void gameserveritem_t::SetName( const char *pName ) -{ - strncpy( m_szServerName, pName, sizeof( m_szServerName ) ); - m_szServerName[ sizeof( m_szServerName ) - 1 ] = '\0'; -} - - -#endif // MATCHMAKINGTYPES_H diff --git a/regamedll/public/steam/steam_api.h b/regamedll/public/steam/steam_api.h deleted file mode 100644 index 853188bb..00000000 --- a/regamedll/public/steam/steam_api.h +++ /dev/null @@ -1,536 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -//============================================================================= - -#ifndef STEAM_API_H -#define STEAM_API_H -#ifdef _WIN32 -#pragma once -#endif - -#include "isteamclient.h" -#include "isteamuser.h" -#include "isteamfriends.h" -#include "isteamutils.h" -#include "isteammatchmaking.h" -#include "isteamuserstats.h" -#include "isteamapps.h" -#include "isteamnetworking.h" -#include "isteamremotestorage.h" -#include "isteamscreenshots.h" -#include "isteamhttp.h" -#include "isteamunifiedmessages.h" -#include "isteamcontroller.h" - -#if defined( _PS3 ) -#include "steamps3params.h" -#endif - - - -// Steam API export macro -#if defined( _WIN32 ) && !defined( _X360 ) - #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" __declspec( dllexport ) - #elif defined( STEAM_API_NODLL ) - #define S_API extern "C" - #else - #define S_API extern "C" __declspec( dllimport ) - #endif // STEAM_API_EXPORTS -#elif defined( GNUC ) - #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" __attribute__ ((visibility("default"))) - #else - #define S_API extern "C" - #endif // STEAM_API_EXPORTS -#else // !WIN32 - #if defined( STEAM_API_EXPORTS ) - #define S_API extern "C" - #else - #define S_API extern "C" - #endif // STEAM_API_EXPORTS -#endif - -class CCallbackBase; - -#include "regamedll/platform.h" - - -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// Steam API setup & shutdown -// -// These functions manage loading, initializing and shutdown of the steamclient.dll -// -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -// S_API void SteamAPI_Init(); (see below) -S_API void SteamAPI_Shutdown(); - -// checks if a local Steam client is running -S_API bool SteamAPI_IsSteamRunning(); - -// Detects if your executable was launched through the Steam client, and restarts your game through -// the client if necessary. The Steam client will be started if it is not running. -// -// Returns: true if your executable was NOT launched through the Steam client. This function will -// then start your application through the client. Your current process should exit. -// -// false if your executable was started through the Steam client or a steam_appid.txt file -// is present in your game's directory (for development). Your current process should continue. -// -// NOTE: This function should be used only if you are using CEG or not using Steam's DRM. Once applied -// to your executable, Steam's DRM will handle restarting through Steam if necessary. -S_API bool SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID ); - -// crash dump recording functions -S_API void SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ); -S_API void SteamAPI_SetMiniDumpComment( const char *pchMsg ); - -// interface pointers, configured by SteamAPI_Init() -S_API ISteamClient *SteamClient(); - - -// -// VERSION_SAFE_STEAM_API_INTERFACES is usually not necessary, but it provides safety against releasing -// new steam_api.dll's without recompiling/rereleasing modules that use it. -// -// If you use VERSION_SAFE_STEAM_API_INTERFACES, then you should call SteamAPI_InitSafe(). Also, to get the -// Steam interfaces, you must create and Init() a CSteamAPIContext (below) and use the interfaces in there. -// -// If you don't use VERSION_SAFE_STEAM_API_INTERFACES, then you can use SteamAPI_Init() and the SteamXXXX() -// functions below to get at the Steam interfaces. -// -#ifdef VERSION_SAFE_STEAM_API_INTERFACES -S_API bool SteamAPI_InitSafe(); -#else - -#if defined(_PS3) -S_API bool SteamAPI_Init( SteamPS3Params_t *pParams ); -#else -S_API bool SteamAPI_Init(); -#endif - -S_API ISteamUser *SteamUser(); -S_API ISteamFriends *SteamFriends(); -S_API ISteamUtils *SteamUtils(); -S_API ISteamMatchmaking *SteamMatchmaking(); -S_API ISteamUserStats *SteamUserStats(); -S_API ISteamApps *SteamApps(); -S_API ISteamNetworking *SteamNetworking(); -S_API ISteamMatchmakingServers *SteamMatchmakingServers(); -S_API ISteamRemoteStorage *SteamRemoteStorage(); -S_API ISteamScreenshots *SteamScreenshots(); -S_API ISteamHTTP *SteamHTTP(); -S_API ISteamUnifiedMessages *SteamUnifiedMessages(); -#ifdef _PS3 -S_API ISteamPS3OverlayRender * SteamPS3OverlayRender(); -#endif -#endif // VERSION_SAFE_STEAM_API_INTERFACES - -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steam callback helper functions -// -// The following classes/macros are used to be able to easily multiplex callbacks -// from the Steam API into various objects in the app in a thread-safe manner -// -// These functors are triggered via the SteamAPI_RunCallbacks() function, mapping the callback -// to as many functions/objects as are registered to it -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -S_API void SteamAPI_RunCallbacks(); - - - -// functions used by the utility CCallback objects to receive callbacks -S_API void SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); -S_API void SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); -// functions used by the utility CCallResult objects to receive async call results -S_API void SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); -S_API void SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); - - -//----------------------------------------------------------------------------- -// Purpose: base for callbacks, -// used only by CCallback, shouldn't be used directly -//----------------------------------------------------------------------------- -class CCallbackBase -{ -public: - CCallbackBase() { m_nCallbackFlags = 0; m_iCallback = 0; } - // don't add a virtual destructor because we export this binary interface across dll's - virtual void Run( void *pvParam ) = 0; - virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) = 0; - int GetICallback() { return m_iCallback; } - virtual int GetCallbackSizeBytes() = 0; - - //Added for hooking support - uint8 GetFlags() { return m_nCallbackFlags; } - void SetFlags(uint8 flags) { m_nCallbackFlags = flags; } - void SetICallback(int cb) { m_iCallback = cb; } - -protected: - enum { k_ECallbackFlagsRegistered = 0x01, k_ECallbackFlagsGameServer = 0x02 }; - uint8 m_nCallbackFlags; - int m_iCallback; - friend class CCallbackMgr; -}; - - -//----------------------------------------------------------------------------- -// Purpose: maps a steam async call result to a class member function -// template params: T = local class, P = parameter struct -//----------------------------------------------------------------------------- -template< class T, class P > -class CCallResult : private CCallbackBase -{ -public: - typedef void (T::*func_t)( P*, bool ); - - CCallResult() - { - m_hAPICall = k_uAPICallInvalid; - m_pObj = NULL; - m_Func = NULL; - m_iCallback = P::k_iCallback; - } - - void Set( SteamAPICall_t hAPICall, T *p, func_t func ) - { - if ( m_hAPICall ) - SteamAPI_UnregisterCallResult( this, m_hAPICall ); - - m_hAPICall = hAPICall; - m_pObj = p; - m_Func = func; - - if ( hAPICall ) - SteamAPI_RegisterCallResult( this, hAPICall ); - } - - bool IsActive() const - { - return ( m_hAPICall != k_uAPICallInvalid ); - } - - void Cancel() - { - if ( m_hAPICall != k_uAPICallInvalid ) - { - SteamAPI_UnregisterCallResult( this, m_hAPICall ); - m_hAPICall = k_uAPICallInvalid; - } - - } - - ~CCallResult() - { - Cancel(); - } - - void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; } -private: - virtual void Run( void *pvParam ) - { - m_hAPICall = k_uAPICallInvalid; // caller unregisters for us - (m_pObj->*m_Func)( (P *)pvParam, false ); - } - void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) - { - if ( hSteamAPICall == m_hAPICall ) - { - m_hAPICall = k_uAPICallInvalid; // caller unregisters for us - (m_pObj->*m_Func)( (P *)pvParam, bIOFailure ); - } - } - int GetCallbackSizeBytes() - { - return sizeof( P ); - } - - SteamAPICall_t m_hAPICall; - T *m_pObj; - func_t m_Func; -}; - - - -//----------------------------------------------------------------------------- -// Purpose: maps a steam callback to a class member function -// template params: T = local class, P = parameter struct -//----------------------------------------------------------------------------- -template< class T, class P, bool bGameServer > -class CCallback : protected CCallbackBase -{ -public: - typedef void (T::*func_t)( P* ); - - // If you can't support constructing a callback with the correct parameters - // then uncomment the empty constructor below and manually call - // ::Register() for your object - // Or, just call the regular constructor with (NULL, NULL) - // CCallback() {} - - // constructor for initializing this object in owner's constructor - CCallback( T *pObj, func_t func ) : m_pObj( pObj ), m_Func( func ) - { - if ( pObj && func ) - Register( pObj, func ); - } - - ~CCallback() - { - if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) - Unregister(); - } - - // manual registration of the callback - void Register( T *pObj, func_t func ) - { - if ( !pObj || !func ) - return; - - if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) - Unregister(); - - if ( bGameServer ) - { - m_nCallbackFlags |= k_ECallbackFlagsGameServer; - } - m_pObj = pObj; - m_Func = func; - // SteamAPI_RegisterCallback sets k_ECallbackFlagsRegistered - CRegamedllPlatformHolder::get()->SteamAPI_RegisterCallback(this, P::k_iCallback); - } - - void Unregister() - { - // SteamAPI_UnregisterCallback removes k_ECallbackFlagsRegistered - CRegamedllPlatformHolder::get()->SteamAPI_UnregisterCallback(this); - } - - void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; } -protected: - virtual void Run( void *pvParam ) - { - (m_pObj->*m_Func)( (P *)pvParam ); - } - virtual void Run( void *pvParam, bool, SteamAPICall_t ) - { - (m_pObj->*m_Func)( (P *)pvParam ); - } - int GetCallbackSizeBytes() - { - return sizeof( P ); - } - - T *m_pObj; - func_t m_Func; -}; - -// Allows you to defer registration of the callback -template< class T, class P, bool bGameServer > -class CCallbackManual : public CCallback< T, P, bGameServer > -{ -public: - CCallbackManual() : CCallback< T, P, bGameServer >( NULL, NULL ) {} -}; - -// utility macro for declaring the function and callback object together -#define STEAM_CALLBACK( thisclass, func, param, var ) CCallback< thisclass, param, false > var; void func( param *pParam ) - -// same as above, but lets you defer the callback binding by calling Register later -#define STEAM_CALLBACK_MANUAL( thisclass, func, param, var ) CCallbackManual< thisclass, param, false > var; void func( param *pParam ) - - -#ifdef _WIN32 -// disable this warning; this pattern need for steam callback registration -#pragma warning( disable: 4355 ) // 'this' : used in base member initializer list -#endif - - -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steamclient.dll private wrapper functions -// -// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -// pumps out all the steam messages, calling the register callback -S_API void Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks ); - -// register the callback funcs to use to interact with the steam dll -S_API void Steam_RegisterInterfaceFuncs( void *hModule ); - -// returns the HSteamUser of the last user to dispatch a callback -S_API HSteamUser Steam_GetHSteamUserCurrent(); - -// returns the filename path of the current running Steam process, used if you need to load an explicit steam dll by name -S_API const char *SteamAPI_GetSteamInstallPath(); - -// returns the pipe we are communicating to Steam with -S_API HSteamPipe SteamAPI_GetHSteamPipe(); - -// sets whether or not Steam_RunCallbacks() should do a try {} catch (...) {} around calls to issuing callbacks -S_API void SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks ); - -// backwards compat export, passes through to SteamAPI_ variants -S_API HSteamPipe GetHSteamPipe(); -S_API HSteamUser GetHSteamUser(); - -#ifdef VERSION_SAFE_STEAM_API_INTERFACES -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// VERSION_SAFE_STEAM_API_INTERFACES uses CSteamAPIContext to provide interfaces to each module in a way that -// lets them each specify the interface versions they are compiled with. -// -// It's important that these stay inlined in the header so the calling module specifies the interface versions -// for whatever Steam API version it has. -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -S_API HSteamUser SteamAPI_GetHSteamUser(); - -class CSteamAPIContext -{ -public: - CSteamAPIContext(); - void Clear(); - - bool Init(); - - ISteamUser* SteamUser() { return m_pSteamUser; } - ISteamFriends* SteamFriends() { return m_pSteamFriends; } - ISteamUtils* SteamUtils() { return m_pSteamUtils; } - ISteamMatchmaking* SteamMatchmaking() { return m_pSteamMatchmaking; } - ISteamUserStats* SteamUserStats() { return m_pSteamUserStats; } - ISteamApps* SteamApps() { return m_pSteamApps; } - ISteamMatchmakingServers* SteamMatchmakingServers() { return m_pSteamMatchmakingServers; } - ISteamNetworking* SteamNetworking() { return m_pSteamNetworking; } - ISteamRemoteStorage* SteamRemoteStorage() { return m_pSteamRemoteStorage; } - ISteamScreenshots* SteamScreenshots() { return m_pSteamScreenshots; } - ISteamHTTP* SteamHTTP() { return m_pSteamHTTP; } - ISteamUnifiedMessages* SteamUnifiedMessages() { return m_pSteamUnifiedMessages; } -#ifdef _PS3 - ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; } -#endif - -private: - ISteamUser *m_pSteamUser; - ISteamFriends *m_pSteamFriends; - ISteamUtils *m_pSteamUtils; - ISteamMatchmaking *m_pSteamMatchmaking; - ISteamUserStats *m_pSteamUserStats; - ISteamApps *m_pSteamApps; - ISteamMatchmakingServers *m_pSteamMatchmakingServers; - ISteamNetworking *m_pSteamNetworking; - ISteamRemoteStorage *m_pSteamRemoteStorage; - ISteamScreenshots *m_pSteamScreenshots; - ISteamHTTP *m_pSteamHTTP; - ISteamUnifiedMessages*m_pSteamUnifiedMessages; - ISteamController *m_pController; -#ifdef _PS3 - ISteamPS3OverlayRender *m_pSteamPS3OverlayRender; -#endif -}; - -inline CSteamAPIContext::CSteamAPIContext() -{ - Clear(); -} - -inline void CSteamAPIContext::Clear() -{ - m_pSteamUser = NULL; - m_pSteamFriends = NULL; - m_pSteamUtils = NULL; - m_pSteamMatchmaking = NULL; - m_pSteamUserStats = NULL; - m_pSteamApps = NULL; - m_pSteamMatchmakingServers = NULL; - m_pSteamNetworking = NULL; - m_pSteamRemoteStorage = NULL; - m_pSteamHTTP = NULL; - m_pSteamScreenshots = NULL; - m_pSteamUnifiedMessages = NULL; -#ifdef _PS3 - m_pSteamPS3OverlayRender = NULL; -#endif -} - -// This function must be inlined so the module using steam_api.dll gets the version names they want. -inline bool CSteamAPIContext::Init() -{ - if ( !SteamClient() ) - return false; - - HSteamUser hSteamUser = SteamAPI_GetHSteamUser(); - HSteamPipe hSteamPipe = SteamAPI_GetHSteamPipe(); - - m_pSteamUser = SteamClient()->GetISteamUser( hSteamUser, hSteamPipe, STEAMUSER_INTERFACE_VERSION ); - if ( !m_pSteamUser ) - return false; - - m_pSteamFriends = SteamClient()->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION ); - if ( !m_pSteamFriends ) - return false; - - m_pSteamUtils = SteamClient()->GetISteamUtils( hSteamPipe, STEAMUTILS_INTERFACE_VERSION ); - if ( !m_pSteamUtils ) - return false; - - m_pSteamMatchmaking = SteamClient()->GetISteamMatchmaking( hSteamUser, hSteamPipe, STEAMMATCHMAKING_INTERFACE_VERSION ); - if ( !m_pSteamMatchmaking ) - return false; - - m_pSteamMatchmakingServers = SteamClient()->GetISteamMatchmakingServers( hSteamUser, hSteamPipe, STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION ); - if ( !m_pSteamMatchmakingServers ) - return false; - - m_pSteamUserStats = SteamClient()->GetISteamUserStats( hSteamUser, hSteamPipe, STEAMUSERSTATS_INTERFACE_VERSION ); - if ( !m_pSteamUserStats ) - return false; - - m_pSteamApps = SteamClient()->GetISteamApps( hSteamUser, hSteamPipe, STEAMAPPS_INTERFACE_VERSION ); - if ( !m_pSteamApps ) - return false; - - m_pSteamNetworking = SteamClient()->GetISteamNetworking( hSteamUser, hSteamPipe, STEAMNETWORKING_INTERFACE_VERSION ); - if ( !m_pSteamNetworking ) - return false; - - m_pSteamRemoteStorage = SteamClient()->GetISteamRemoteStorage( hSteamUser, hSteamPipe, STEAMREMOTESTORAGE_INTERFACE_VERSION ); - if ( !m_pSteamRemoteStorage ) - return false; - - m_pSteamScreenshots = SteamClient()->GetISteamScreenshots( hSteamUser, hSteamPipe, STEAMSCREENSHOTS_INTERFACE_VERSION ); - if ( !m_pSteamScreenshots ) - return false; - - m_pSteamHTTP = SteamClient()->GetISteamHTTP( hSteamUser, hSteamPipe, STEAMHTTP_INTERFACE_VERSION ); - if ( !m_pSteamHTTP ) - return false; - - m_pSteamUnifiedMessages = SteamClient()->GetISteamUnifiedMessages( hSteamUser, hSteamPipe, STEAMUNIFIEDMESSAGES_INTERFACE_VERSION ); - if ( !m_pSteamUnifiedMessages ) - return false; - -#ifdef _PS3 - m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender(); -#endif - - return true; -} - -#endif // VERSION_SAFE_STEAM_API_INTERFACES - -#if defined(USE_BREAKPAD_HANDLER) || defined(STEAM_API_EXPORTS) -// this should be called before the game initialized the steam APIs -// pchDate should be of the format "Mmm dd yyyy" (such as from the __DATE __ macro ) -// pchTime should be of the format "hh:mm:ss" (such as from the __TIME __ macro ) -// bFullMemoryDumps (Win32 only) -- writes out a uuid-full.dmp in the client/dumps folder -// pvContext-- can be NULL, will be the void * context passed into m_pfnPreMinidumpCallback -// PFNPreMinidumpCallback m_pfnPreMinidumpCallback -- optional callback which occurs just before a .dmp file is written during a crash. Applications can hook this to allow adding additional information into the .dmp comment stream. -S_API void SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback ); -S_API void SteamAPI_SetBreakpadAppID( uint32 unAppID ); -#endif - -#endif // STEAM_API_H diff --git a/regamedll/public/steam/steam_gameserver.h b/regamedll/public/steam/steam_gameserver.h deleted file mode 100644 index 47cb7848..00000000 --- a/regamedll/public/steam/steam_gameserver.h +++ /dev/null @@ -1,163 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -//============================================================================= - -#ifndef STEAM_GAMESERVER_H -#define STEAM_GAMESERVER_H -#ifdef _WIN32 -#pragma once -#endif - -#include "steam_api.h" -#include "isteamgameserver.h" -#include "isteamgameserverstats.h" - -enum EServerMode -{ - eServerModeInvalid = 0, // DO NOT USE - eServerModeNoAuthentication = 1, // Don't authenticate user logins and don't list on the server list - eServerModeAuthentication = 2, // Authenticate users, list on the server list, don't run VAC on clients that connect - eServerModeAuthenticationAndSecure = 3, // Authenticate users, list on the server list and VAC protect clients -}; - -// Initialize ISteamGameServer interface object, and set server properties which may not be changed. -// -// After calling this function, you should set any additional server parameters, and then -// call ISteamGameServer::LogOnAnonymous() or ISteamGameServer::LogOn() -// -// - usSteamPort is the local port used to communicate with the steam servers. -// - usGamePort is the port that clients will connect to for gameplay. -// - usQueryPort is the port that will manage server browser related duties and info -// pings from clients. If you pass MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE for usQueryPort, then it -// will use "GameSocketShare" mode, which means that the game is responsible for sending and receiving -// UDP packets for the master server updater. See references to GameSocketShare in isteamgameserver.h. -// - The version string is usually in the form x.x.x.x, and is used by the master server to detect when the -// server is out of date. (Only servers with the latest version will be listed.) -#ifndef _PS3 - -#ifdef VERSION_SAFE_STEAM_API_INTERFACES -S_API bool SteamGameServer_InitSafe( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); -#else -S_API bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); -#endif - -#else - -#ifdef VERSION_SAFE_STEAM_API_INTERFACES -S_API bool SteamGameServer_InitSafe( const SteamPS3Params_t *ps3Params, uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); -#else -S_API bool SteamGameServer_Init( const SteamPS3Params_t *ps3Params, uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString ); -#endif - -#endif - -#ifndef VERSION_SAFE_STEAM_API_INTERFACES -S_API ISteamGameServer *SteamGameServer(); -S_API ISteamUtils *SteamGameServerUtils(); -S_API ISteamNetworking *SteamGameServerNetworking(); -S_API ISteamGameServerStats *SteamGameServerStats(); -S_API ISteamHTTP *SteamGameServerHTTP(); -#endif - -S_API void SteamGameServer_Shutdown(); -S_API void SteamGameServer_RunCallbacks(); - -S_API bool SteamGameServer_BSecure(); -S_API uint64 SteamGameServer_GetSteamID(); - -#define STEAM_GAMESERVER_CALLBACK( thisclass, func, param, var ) CCallback< thisclass, param, true > var; void func( param *pParam ) - - -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steamclient.dll private wrapper functions -// -// The following functions are part of abstracting API access to the steamclient.dll, but should only be used in very specific cases -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -S_API HSteamPipe SteamGameServer_GetHSteamPipe(); - -#ifdef VERSION_SAFE_STEAM_API_INTERFACES -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// VERSION_SAFE_STEAM_API_INTERFACES uses CSteamAPIContext to provide interfaces to each module in a way that -// lets them each specify the interface versions they are compiled with. -// -// It's important that these stay inlined in the header so the calling module specifies the interface versions -// for whatever Steam API version it has. -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -S_API HSteamUser SteamGameServer_GetHSteamUser(); - -class CSteamGameServerAPIContext -{ -public: - CSteamGameServerAPIContext(); - void Clear(); - - bool Init(); - - ISteamGameServer *SteamGameServer() { return m_pSteamGameServer; } - ISteamUtils *SteamGameServerUtils() { return m_pSteamGameServerUtils; } - ISteamNetworking *SteamGameServerNetworking() { return m_pSteamGameServerNetworking; } - ISteamGameServerStats *SteamGameServerStats() { return m_pSteamGameServerStats; } - ISteamHTTP *SteamHTTP() { return m_pSteamHTTP; } - -private: - ISteamGameServer *m_pSteamGameServer; - ISteamUtils *m_pSteamGameServerUtils; - ISteamNetworking *m_pSteamGameServerNetworking; - ISteamGameServerStats *m_pSteamGameServerStats; - ISteamHTTP *m_pSteamHTTP; -}; - -inline CSteamGameServerAPIContext::CSteamGameServerAPIContext() -{ - Clear(); -} - -inline void CSteamGameServerAPIContext::Clear() -{ - m_pSteamGameServer = NULL; - m_pSteamGameServerUtils = NULL; - m_pSteamGameServerNetworking = NULL; - m_pSteamGameServerStats = NULL; - m_pSteamHTTP = NULL; -} - -S_API ISteamClient *g_pSteamClientGameServer; -// This function must be inlined so the module using steam_api.dll gets the version names they want. -inline bool CSteamGameServerAPIContext::Init() -{ - if ( !g_pSteamClientGameServer ) - return false; - - HSteamUser hSteamUser = SteamGameServer_GetHSteamUser(); - HSteamPipe hSteamPipe = SteamGameServer_GetHSteamPipe(); - - m_pSteamGameServer = g_pSteamClientGameServer->GetISteamGameServer( hSteamUser, hSteamPipe, STEAMGAMESERVER_INTERFACE_VERSION ); - if ( !m_pSteamGameServer ) - return false; - - m_pSteamGameServerUtils = g_pSteamClientGameServer->GetISteamUtils( hSteamPipe, STEAMUTILS_INTERFACE_VERSION ); - if ( !m_pSteamGameServerUtils ) - return false; - - m_pSteamGameServerNetworking = g_pSteamClientGameServer->GetISteamNetworking( hSteamUser, hSteamPipe, STEAMNETWORKING_INTERFACE_VERSION ); - if ( !m_pSteamGameServerNetworking ) - return false; - - m_pSteamGameServerStats = g_pSteamClientGameServer->GetISteamGameServerStats( hSteamUser, hSteamPipe, STEAMGAMESERVERSTATS_INTERFACE_VERSION ); - if ( !m_pSteamGameServerStats ) - return false; - - m_pSteamHTTP = g_pSteamClientGameServer->GetISteamHTTP( hSteamUser, hSteamPipe, STEAMHTTP_INTERFACE_VERSION ); - if ( !m_pSteamGameServerStats ) - return false; - - return true; -} - -#endif // VERSION_SAFE_STEAM_API_INTERFACES - - -#endif // STEAM_GAMESERVER_H diff --git a/regamedll/public/steam/steamclientpublic.h b/regamedll/public/steam/steamclientpublic.h deleted file mode 100644 index d9d076ae..00000000 --- a/regamedll/public/steam/steamclientpublic.h +++ /dev/null @@ -1,1086 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -//============================================================================= - -#ifndef STEAMCLIENTPUBLIC_H -#define STEAMCLIENTPUBLIC_H -#ifdef _WIN32 -#pragma once -#endif -//lint -save -e1931 -e1927 -e1924 -e613 -e726 - -// This header file defines the interface between the calling application and the code that -// knows how to communicate with the connection manager (CM) from the Steam service - -// This header file is intended to be portable; ideally this 1 header file plus a lib or dll -// is all you need to integrate the client library into some other tree. So please avoid -// including or requiring other header files if possible. This header should only describe the -// interface layer, no need to include anything about the implementation. - -#include "steamtypes.h" - - -// General result codes -enum EResult -{ - k_EResultOK = 1, // success - k_EResultFail = 2, // generic failure - k_EResultNoConnection = 3, // no/failed network connection -// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed - k_EResultInvalidPassword = 5, // password/ticket is invalid - k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere - k_EResultInvalidProtocolVer = 7, // protocol version is incorrect - k_EResultInvalidParam = 8, // a parameter is incorrect - k_EResultFileNotFound = 9, // file was not found - k_EResultBusy = 10, // called method busy - action not taken - k_EResultInvalidState = 11, // called object was in an invalid state - k_EResultInvalidName = 12, // name is invalid - k_EResultInvalidEmail = 13, // email is invalid - k_EResultDuplicateName = 14, // name is not unique - k_EResultAccessDenied = 15, // access is denied - k_EResultTimeout = 16, // operation timed out - k_EResultBanned = 17, // VAC2 banned - k_EResultAccountNotFound = 18, // account not found - k_EResultInvalidSteamID = 19, // steamID is invalid - k_EResultServiceUnavailable = 20, // The requested service is currently unavailable - k_EResultNotLoggedOn = 21, // The user is not logged on - k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party) - k_EResultEncryptionFailure = 23, // Encryption or Decryption failed - k_EResultInsufficientPrivilege = 24, // Insufficient privilege - k_EResultLimitExceeded = 25, // Too much of a good thing - k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes) - k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired - k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again - k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time - k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user - k_EResultIPNotFound = 31, // IP address not found - k_EResultPersistFailed = 32, // failed to write change to the data store - k_EResultLockingFailed = 33, // failed to acquire access lock for this operation - k_EResultLogonSessionReplaced = 34, - k_EResultConnectFailed = 35, - k_EResultHandshakeFailed = 36, - k_EResultIOFailure = 37, - k_EResultRemoteDisconnect = 38, - k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested - k_EResultBlocked = 40, // a user didn't allow it - k_EResultIgnored = 41, // target is ignoring sender - k_EResultNoMatch = 42, // nothing matching the request found - k_EResultAccountDisabled = 43, - k_EResultServiceReadOnly = 44, // this service is not accepting content changes right now - k_EResultAccountNotFeatured = 45, // account doesn't have value, so this feature isn't available - k_EResultAdministratorOK = 46, // allowed to take this action, but only because requester is admin - k_EResultContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol. - k_EResultTryAnotherCM = 48, // The current CM can't service the user making a request, user should try another. - k_EResultPasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed. - k_EResultAlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait - k_EResultSuspended = 51, // Long running operation (content download) suspended/paused - k_EResultCancelled = 52, // Operation canceled (typically by user: content download) - k_EResultDataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable - k_EResultDiskFull = 54, // Operation canceled - not enough disk space. - k_EResultRemoteCallFailed = 55, // an remote call or IPC call failed - k_EResultPasswordUnset = 56, // Password could not be verified as it's unset server side - k_EResultExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account - k_EResultPSNTicketInvalid = 58, // PSN ticket was invalid - k_EResultExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first - k_EResultRemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files - k_EResultIllegalPassword = 61, // The requested new password is not legal - k_EResultSameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer ) - k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure - k_EResultCannotUseOldPassword = 64, // The requested new password is not legal - k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid - k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent - k_EResultHardwareNotCapableOfIPT = 67, // - k_EResultIPTInitError = 68, // - k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user - k_EResultFacebookQueryError = 70, // Facebook query returned an error - k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired - k_EResultIPLoginRestrictionFailed = 72, - k_EResultAccountLockedDown = 73, - k_EResultAccountLogonDeniedVerifiedEmailRequired = 74, - k_EResultNoMatchingURL = 75, - k_EResultBadResponse = 76, // parse failure, missing field, etc. - k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password - k_EResultValueOutOfRange = 78 // the value entered is outside the acceptable range -}; - -// Error codes for use with the voice functions -enum EVoiceResult -{ - k_EVoiceResultOK = 0, - k_EVoiceResultNotInitialized = 1, - k_EVoiceResultNotRecording = 2, - k_EVoiceResultNoData = 3, - k_EVoiceResultBufferTooSmall = 4, - k_EVoiceResultDataCorrupted = 5, - k_EVoiceResultRestricted = 6, - k_EVoiceResultUnsupportedCodec = 7, - -}; - -// Result codes to GSHandleClientDeny/Kick -typedef enum -{ - k_EDenyInvalid = 0, - k_EDenyInvalidVersion = 1, - k_EDenyGeneric = 2, - k_EDenyNotLoggedOn = 3, - k_EDenyNoLicense = 4, - k_EDenyCheater = 5, - k_EDenyLoggedInElseWhere = 6, - k_EDenyUnknownText = 7, - k_EDenyIncompatibleAnticheat = 8, - k_EDenyMemoryCorruption = 9, - k_EDenyIncompatibleSoftware = 10, - k_EDenySteamConnectionLost = 11, - k_EDenySteamConnectionError = 12, - k_EDenySteamResponseTimedOut = 13, - k_EDenySteamValidationStalled = 14, - k_EDenySteamOwnerLeftGuestUser = 15, -} EDenyReason; - -// return type of GetAuthSessionTicket -typedef uint32 HAuthTicket; -const HAuthTicket k_HAuthTicketInvalid = 0; - -// results from BeginAuthSession -typedef enum -{ - k_EBeginAuthSessionResultOK = 0, // Ticket is valid for this game and this steamID. - k_EBeginAuthSessionResultInvalidTicket = 1, // Ticket is not valid. - k_EBeginAuthSessionResultDuplicateRequest = 2, // A ticket has already been submitted for this steamID - k_EBeginAuthSessionResultInvalidVersion = 3, // Ticket is from an incompatible interface version - k_EBeginAuthSessionResultGameMismatch = 4, // Ticket is not for this game - k_EBeginAuthSessionResultExpiredTicket = 5, // Ticket has expired -} EBeginAuthSessionResult; - -// Callback values for callback ValidateAuthTicketResponse_t which is a response to BeginAuthSession -typedef enum -{ - k_EAuthSessionResponseOK = 0, // Steam has verified the user is online, the ticket is valid and ticket has not been reused. - k_EAuthSessionResponseUserNotConnectedToSteam = 1, // The user in question is not connected to steam - k_EAuthSessionResponseNoLicenseOrExpired = 2, // The license has expired. - k_EAuthSessionResponseVACBanned = 3, // The user is VAC banned for this game. - k_EAuthSessionResponseLoggedInElseWhere = 4, // The user account has logged in elsewhere and the session containing the game instance has been disconnected. - k_EAuthSessionResponseVACCheckTimedOut = 5, // VAC has been unable to perform anti-cheat checks on this user - k_EAuthSessionResponseAuthTicketCanceled = 6, // The ticket has been canceled by the issuer - k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid. - k_EAuthSessionResponseAuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam. -} EAuthSessionResponse; - -// results from UserHasLicenseForApp -typedef enum -{ - k_EUserHasLicenseResultHasLicense = 0, // User has a license for specified app - k_EUserHasLicenseResultDoesNotHaveLicense = 1, // User does not have a license for the specified app - k_EUserHasLicenseResultNoAuth = 2, // User has not been authenticated -} EUserHasLicenseForAppResult; - - -// Steam universes. Each universe is a self-contained Steam instance. -enum EUniverse -{ - k_EUniverseInvalid = 0, - k_EUniversePublic = 1, - k_EUniverseBeta = 2, - k_EUniverseInternal = 3, - k_EUniverseDev = 4, - // k_EUniverseRC = 5, // no such universe anymore - k_EUniverseMax -}; - -// Steam account types -enum EAccountType -{ - k_EAccountTypeInvalid = 0, - k_EAccountTypeIndividual = 1, // single user account - k_EAccountTypeMultiseat = 2, // multiseat (e.g. cybercafe) account - k_EAccountTypeGameServer = 3, // game server account - k_EAccountTypeAnonGameServer = 4, // anonymous game server account - k_EAccountTypePending = 5, // pending - k_EAccountTypeContentServer = 6, // content server - k_EAccountTypeClan = 7, - k_EAccountTypeChat = 8, - k_EAccountTypeConsoleUser = 9, // Fake SteamID for local PSN account on PS3 or Live account on 360, etc. - k_EAccountTypeAnonUser = 10, - - // Max of 16 items in this field - k_EAccountTypeMax -}; - - - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -enum EAppReleaseState -{ - k_EAppReleaseState_Unknown = 0, // unknown, required appinfo or license info is missing - k_EAppReleaseState_Unavailable = 1, // even if user 'just' owns it, can see game at all - k_EAppReleaseState_Prerelease = 2, // can be purchased and is visible in games list, nothing else. Common appInfo section released - k_EAppReleaseState_PreloadOnly = 3, // owners can preload app, not play it. AppInfo fully released. - k_EAppReleaseState_Released = 4, // owners can download and play app. -}; - - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -enum EAppOwernshipFlags -{ - k_EAppOwernshipFlags_None = 0, // unknown - k_EAppOwernshipFlags_OwnsLicense = 1, // owns license for this game - k_EAppOwernshipFlags_FreeLicense = 2, // not paid for game - k_EAppOwernshipFlags_RegionRestricted = 4, // owns app, but not allowed to play in current region - k_EAppOwernshipFlags_LowViolence = 8, // only low violence version - k_EAppOwernshipFlags_InvalidPlatform = 16, // app not supported on current platform - k_EAppOwernshipFlags_DeviceLicense = 32, // license was granted by authorized local device -}; - - -//----------------------------------------------------------------------------- -// Purpose: designed as flags to allow filters masks -//----------------------------------------------------------------------------- -enum EAppType -{ - k_EAppType_Invalid = 0x000, // unknown / invalid - k_EAppType_Game = 0x001, // playable game, default type - k_EAppType_Application = 0x002, // software application - k_EAppType_Tool = 0x004, // SDKs, editors & dedicated servers - k_EAppType_Demo = 0x008, // game demo - k_EAppType_Media = 0x010, // media trailer - k_EAppType_DLC = 0x020, // down loadable content - k_EAppType_Guide = 0x040, // game guide, PDF etc - k_EAppType_Driver = 0x080, // hardware driver updater (ATI, Razor etc) - - k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only - k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace -}; - - -//----------------------------------------------------------------------------- -// types of user game stats fields -// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE -//----------------------------------------------------------------------------- -enum ESteamUserStatType -{ - k_ESteamUserStatTypeINVALID = 0, - k_ESteamUserStatTypeINT = 1, - k_ESteamUserStatTypeFLOAT = 2, - // Read as FLOAT, set with count / session length - k_ESteamUserStatTypeAVGRATE = 3, - k_ESteamUserStatTypeACHIEVEMENTS = 4, - k_ESteamUserStatTypeGROUPACHIEVEMENTS = 5, - - // max, for sanity checks - k_ESteamUserStatTypeMAX -}; - - -//----------------------------------------------------------------------------- -// Purpose: Chat Entry Types (previously was only friend-to-friend message types) -//----------------------------------------------------------------------------- -enum EChatEntryType -{ - k_EChatEntryTypeInvalid = 0, - k_EChatEntryTypeChatMsg = 1, // Normal text message from another user - k_EChatEntryTypeTyping = 2, // Another user is typing (not used in multi-user chat) - k_EChatEntryTypeInviteGame = 3, // Invite from other user into that users current game - k_EChatEntryTypeEmote = 4, // text emote message (deprecated, should be treated as ChatMsg) - //k_EChatEntryTypeLobbyGameStart = 5, // lobby game is starting (dead - listen for LobbyGameCreated_t callback instead) - k_EChatEntryTypeLeftConversation = 6, // user has left the conversation ( closed chat window ) - // Above are previous FriendMsgType entries, now merged into more generic chat entry types - k_EChatEntryTypeEntered = 7, // user has entered the conversation (used in multi-user chat and group chat) - k_EChatEntryTypeWasKicked = 8, // user was kicked (data: 64-bit steamid of actor performing the kick) - k_EChatEntryTypeWasBanned = 9, // user was banned (data: 64-bit steamid of actor performing the ban) - k_EChatEntryTypeDisconnected = 10, // user disconnected - k_EChatEntryTypeHistoricalChat = 11, // a chat message from user's chat history or offilne message - -}; - - -//----------------------------------------------------------------------------- -// Purpose: Chat Room Enter Responses -//----------------------------------------------------------------------------- -enum EChatRoomEnterResponse -{ - k_EChatRoomEnterResponseSuccess = 1, // Success - k_EChatRoomEnterResponseDoesntExist = 2, // Chat doesn't exist (probably closed) - k_EChatRoomEnterResponseNotAllowed = 3, // General Denied - You don't have the permissions needed to join the chat - k_EChatRoomEnterResponseFull = 4, // Chat room has reached its maximum size - k_EChatRoomEnterResponseError = 5, // Unexpected Error - k_EChatRoomEnterResponseBanned = 6, // You are banned from this chat room and may not join - k_EChatRoomEnterResponseLimited = 7, // Joining this chat is not allowed because you are a limited user (no value on account) - k_EChatRoomEnterResponseClanDisabled = 8, // Attempt to join a clan chat when the clan is locked or disabled - k_EChatRoomEnterResponseCommunityBan = 9, // Attempt to join a chat when the user has a community lock on their account - k_EChatRoomEnterResponseMemberBlockedYou = 10, // Join failed - some member in the chat has blocked you from joining - k_EChatRoomEnterResponseYouBlockedMember = 11, // Join failed - you have blocked some member already in the chat - // k_EChatRoomEnterResponseNoRankingDataLobby = 12, // No longer used - // k_EChatRoomEnterResponseNoRankingDataUser = 13, // No longer used - // k_EChatRoomEnterResponseRankOutOfRange = 14, // No longer used -}; - - -//----------------------------------------------------------------------------- -// Purpose: Status of a given depot version, these are stored in the DB, don't renumber -//----------------------------------------------------------------------------- -enum EStatusDepotVersion -{ - k_EStatusDepotVersionInvalid = 0, - k_EStatusDepotVersionDisabled = 1, // version was disabled, no manifest & content available - k_EStatusDepotVersionAvailable = 2, // manifest & content is available, but not current - k_EStatusDepotVersionCurrent = 3, // current depot version. The can be multiple, one for public and one for each beta key -}; - - -typedef void (*PFNLegacyKeyRegistration)( const char *pchCDKey, const char *pchInstallPath ); -typedef bool (*PFNLegacyKeyInstalled)(); - -const unsigned int k_unSteamAccountIDMask = 0xFFFFFFFF; -const unsigned int k_unSteamAccountInstanceMask = 0x000FFFFF; -// we allow 3 simultaneous user account instances right now, 1= desktop, 2 = console, 4 = web, 0 = all -const unsigned int k_unSteamUserDesktopInstance = 1; -const unsigned int k_unSteamUserConsoleInstance = 2; -const unsigned int k_unSteamUserWebInstance = 4; - -// Special flags for Chat accounts - they go in the top 8 bits -// of the steam ID's "instance", leaving 12 for the actual instances -enum EChatSteamIDInstanceFlags -{ - k_EChatAccountInstanceMask = 0x00000FFF, // top 8 bits are flags - - k_EChatInstanceFlagClan = ( k_unSteamAccountInstanceMask + 1 ) >> 1, // top bit - k_EChatInstanceFlagLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 2, // next one down, etc - k_EChatInstanceFlagMMSLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 3, // next one down, etc - - // Max of 8 flags -}; - - -//----------------------------------------------------------------------------- -// Purpose: Marketing message flags that change how a client should handle them -//----------------------------------------------------------------------------- -enum EMarketingMessageFlags -{ - k_EMarketingMessageFlagsNone = 0, - k_EMarketingMessageFlagsHighPriority = 1 << 0, - k_EMarketingMessageFlagsPlatformWindows = 1 << 1, - k_EMarketingMessageFlagsPlatformMac = 1 << 2, - k_EMarketingMessageFlagsPlatformLinux = 1 << 3, - - //aggregate flags - k_EMarketingMessageFlagsPlatformRestrictions = - k_EMarketingMessageFlagsPlatformWindows | - k_EMarketingMessageFlagsPlatformMac | - k_EMarketingMessageFlagsPlatformLinux, -}; - - - -//----------------------------------------------------------------------------- -// Purpose: Possible positions to tell the overlay to show notifications in -//----------------------------------------------------------------------------- -enum ENotificationPosition -{ - k_EPositionTopLeft = 0, - k_EPositionTopRight = 1, - k_EPositionBottomLeft = 2, - k_EPositionBottomRight = 3, -}; - - -#pragma pack( push, 1 ) - -#define CSTEAMID_DEFINED - -// Steam ID structure (64 bits total) -class CSteamID -{ -public: - - //----------------------------------------------------------------------------- - // Purpose: Constructor - //----------------------------------------------------------------------------- - CSteamID() - { - m_steamid.m_comp.m_unAccountID = 0; - m_steamid.m_comp.m_EAccountType = k_EAccountTypeInvalid; - m_steamid.m_comp.m_EUniverse = k_EUniverseInvalid; - m_steamid.m_comp.m_unAccountInstance = 0; - } - - - //----------------------------------------------------------------------------- - // Purpose: Constructor - // Input : unAccountID - 32-bit account ID - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - CSteamID( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType ) - { - Set( unAccountID, eUniverse, eAccountType ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Constructor - // Input : unAccountID - 32-bit account ID - // unAccountInstance - instance - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType ) - { -#if defined(_SERVER) && defined(Assert) - Assert( ! ( ( k_EAccountTypeIndividual == eAccountType ) && ( unAccountInstance > k_unSteamUserWebInstance ) ) ); // enforce that for individual accounts, instance is always 1 -#endif // _SERVER - InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Constructor - // Input : ulSteamID - 64-bit representation of a Steam ID - // Note: Will not accept a uint32 or int32 as input, as that is a probable mistake. - // See the stubbed out overloads in the private: section for more info. - //----------------------------------------------------------------------------- - CSteamID( uint64 ulSteamID ) - { - SetFromUint64( ulSteamID ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Sets parameters for steam ID - // Input : unAccountID - 32-bit account ID - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - void Set( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType ) - { - m_steamid.m_comp.m_unAccountID = unAccountID; - m_steamid.m_comp.m_EUniverse = eUniverse; - m_steamid.m_comp.m_EAccountType = eAccountType; - - if ( eAccountType == k_EAccountTypeClan ) - { - m_steamid.m_comp.m_unAccountInstance = 0; - } - else - { - // by default we pick the desktop instance - m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance; - } - } - - - //----------------------------------------------------------------------------- - // Purpose: Sets parameters for steam ID - // Input : unAccountID - 32-bit account ID - // eUniverse - Universe this account belongs to - // eAccountType - Type of account - //----------------------------------------------------------------------------- - void InstancedSet( uint32 unAccountID, uint32 unInstance, EUniverse eUniverse, EAccountType eAccountType ) - { - m_steamid.m_comp.m_unAccountID = unAccountID; - m_steamid.m_comp.m_EUniverse = eUniverse; - m_steamid.m_comp.m_EAccountType = eAccountType; - m_steamid.m_comp.m_unAccountInstance = unInstance; - } - - - //----------------------------------------------------------------------------- - // Purpose: Initializes a steam ID from its 52 bit parts and universe/type - // Input : ulIdentifier - 52 bits of goodness - //----------------------------------------------------------------------------- - void FullSet( uint64 ulIdentifier, EUniverse eUniverse, EAccountType eAccountType ) - { - m_steamid.m_comp.m_unAccountID = ( ulIdentifier & k_unSteamAccountIDMask ); // account ID is low 32 bits - m_steamid.m_comp.m_unAccountInstance = ( ( ulIdentifier >> 32 ) & k_unSteamAccountInstanceMask ); // account instance is next 20 bits - m_steamid.m_comp.m_EUniverse = eUniverse; - m_steamid.m_comp.m_EAccountType = eAccountType; - } - - - //----------------------------------------------------------------------------- - // Purpose: Initializes a steam ID from its 64-bit representation - // Input : ulSteamID - 64-bit representation of a Steam ID - //----------------------------------------------------------------------------- - void SetFromUint64( uint64 ulSteamID ) - { - m_steamid.m_unAll64Bits = ulSteamID; - } - - - //----------------------------------------------------------------------------- - // Purpose: Clear all fields, leaving an invalid ID. - //----------------------------------------------------------------------------- - void Clear() - { - m_steamid.m_comp.m_unAccountID = 0; - m_steamid.m_comp.m_EAccountType = k_EAccountTypeInvalid; - m_steamid.m_comp.m_EUniverse = k_EUniverseInvalid; - m_steamid.m_comp.m_unAccountInstance = 0; - } - - -#if defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H ) - //----------------------------------------------------------------------------- - // Purpose: Initializes a steam ID from a Steam2 ID structure - // Input: pTSteamGlobalUserID - Steam2 ID to convert - // eUniverse - universe this ID belongs to - //----------------------------------------------------------------------------- - void SetFromSteam2( TSteamGlobalUserID *pTSteamGlobalUserID, EUniverse eUniverse ) - { - m_steamid.m_comp.m_unAccountID = pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits * 2 + - pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits; - m_steamid.m_comp.m_EUniverse = eUniverse; // set the universe - m_steamid.m_comp.m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual - m_steamid.m_comp.m_unAccountInstance = k_unSteamUserDesktopInstance; // Steam2 only knew desktop instances - } - - //----------------------------------------------------------------------------- - // Purpose: Fills out a Steam2 ID structure - // Input: pTSteamGlobalUserID - Steam2 ID to write to - //----------------------------------------------------------------------------- - void ConvertToSteam2( TSteamGlobalUserID *pTSteamGlobalUserID ) const - { - // only individual accounts have any meaning in Steam 2, only they can be mapped - // Assert( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual ); - - pTSteamGlobalUserID->m_SteamInstanceID = 0; - pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits = m_steamid.m_comp.m_unAccountID % 2; - pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits = m_steamid.m_comp.m_unAccountID / 2; - } -#endif // defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H ) - - //----------------------------------------------------------------------------- - // Purpose: Converts steam ID to its 64-bit representation - // Output : 64-bit representation of a Steam ID - //----------------------------------------------------------------------------- - uint64 ConvertToUint64() const - { - return m_steamid.m_unAll64Bits; - } - - - //----------------------------------------------------------------------------- - // Purpose: Converts the static parts of a steam ID to a 64-bit representation. - // For multiseat accounts, all instances of that account will have the - // same static account key, so they can be grouped together by the static - // account key. - // Output : 64-bit static account key - //----------------------------------------------------------------------------- - uint64 GetStaticAccountKey() const - { - // note we do NOT include the account instance (which is a dynamic property) in the static account key - return (uint64) ( ( ( (uint64) m_steamid.m_comp.m_EUniverse ) << 56 ) + ((uint64) m_steamid.m_comp.m_EAccountType << 52 ) + m_steamid.m_comp.m_unAccountID ); - } - - - //----------------------------------------------------------------------------- - // Purpose: create an anonymous game server login to be filled in by the AM - //----------------------------------------------------------------------------- - void CreateBlankAnonLogon( EUniverse eUniverse ) - { - m_steamid.m_comp.m_unAccountID = 0; - m_steamid.m_comp.m_EAccountType = k_EAccountTypeAnonGameServer; - m_steamid.m_comp.m_EUniverse = eUniverse; - m_steamid.m_comp.m_unAccountInstance = 0; - } - - - //----------------------------------------------------------------------------- - // Purpose: create an anonymous game server login to be filled in by the AM - //----------------------------------------------------------------------------- - void CreateBlankAnonUserLogon( EUniverse eUniverse ) - { - m_steamid.m_comp.m_unAccountID = 0; - m_steamid.m_comp.m_EAccountType = k_EAccountTypeAnonUser; - m_steamid.m_comp.m_EUniverse = eUniverse; - m_steamid.m_comp.m_unAccountInstance = 0; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this an anonymous game server login that will be filled in? - //----------------------------------------------------------------------------- - bool BBlankAnonAccount() const - { - return m_steamid.m_comp.m_unAccountID == 0 && BAnonAccount() && m_steamid.m_comp.m_unAccountInstance == 0; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this a game server account id? (Either persistent or anonymous) - //----------------------------------------------------------------------------- - bool BGameServerAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer || m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this a persistent (not anonymous) game server account id? - //----------------------------------------------------------------------------- - bool BPersistentGameServerAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this an anonymous game server account id? - //----------------------------------------------------------------------------- - bool BAnonGameServerAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this a content server account id? - //----------------------------------------------------------------------------- - bool BContentServerAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeContentServer; - } - - - //----------------------------------------------------------------------------- - // Purpose: Is this a clan account id? - //----------------------------------------------------------------------------- - bool BClanAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeClan; - } - - - //----------------------------------------------------------------------------- - // Purpose: Is this a chat account id? - //----------------------------------------------------------------------------- - bool BChatAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeChat; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this a chat account id? - //----------------------------------------------------------------------------- - bool IsLobby() const - { - return ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeChat ) - && ( m_steamid.m_comp.m_unAccountInstance & k_EChatInstanceFlagLobby ); - } - - - //----------------------------------------------------------------------------- - // Purpose: Is this an individual user account id? - //----------------------------------------------------------------------------- - bool BIndividualAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual || m_steamid.m_comp.m_EAccountType == k_EAccountTypeConsoleUser; - } - - - //----------------------------------------------------------------------------- - // Purpose: Is this an anonymous account? - //----------------------------------------------------------------------------- - bool BAnonAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonUser || m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonGameServer; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this an anonymous user account? ( used to create an account or reset a password ) - //----------------------------------------------------------------------------- - bool BAnonUserAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeAnonUser; - } - - //----------------------------------------------------------------------------- - // Purpose: Is this a faked up Steam ID for a PSN friend account? - //----------------------------------------------------------------------------- - bool BConsoleUserAccount() const - { - return m_steamid.m_comp.m_EAccountType == k_EAccountTypeConsoleUser; - } - - // simple accessors - void SetAccountID( uint32 unAccountID ) { m_steamid.m_comp.m_unAccountID = unAccountID; } - void SetAccountInstance( uint32 unInstance ){ m_steamid.m_comp.m_unAccountInstance = unInstance; } - void ClearIndividualInstance() { if ( BIndividualAccount() ) m_steamid.m_comp.m_unAccountInstance = 0; } - bool HasNoIndividualInstance() const { return BIndividualAccount() && (m_steamid.m_comp.m_unAccountInstance==0); } - AccountID_t GetAccountID() const { return m_steamid.m_comp.m_unAccountID; } - uint32 GetUnAccountInstance() const { return m_steamid.m_comp.m_unAccountInstance; } - EAccountType GetEAccountType() const { return ( EAccountType ) m_steamid.m_comp.m_EAccountType; } - EUniverse GetEUniverse() const { return m_steamid.m_comp.m_EUniverse; } - void SetEUniverse( EUniverse eUniverse ) { m_steamid.m_comp.m_EUniverse = eUniverse; } - bool IsValid() const; - - // this set of functions is hidden, will be moved out of class - explicit CSteamID( const char *pchSteamID, EUniverse eDefaultUniverse = k_EUniverseInvalid ); - const char * Render() const; // renders this steam ID to string - static const char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string - - void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse ); - // SetFromString allows many partially-correct strings, constraining how - // we might be able to change things in the future. - // SetFromStringStrict requires the exact string forms that we support - // and is preferred when the caller knows it's safe to be strict. - // Returns whether the string parsed correctly. - bool SetFromStringStrict( const char *pchSteamID, EUniverse eDefaultUniverse ); - bool SetFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse ); - - inline bool operator==( const CSteamID &val ) const { return m_steamid.m_unAll64Bits == val.m_steamid.m_unAll64Bits; } - inline bool operator!=( const CSteamID &val ) const { return !operator==( val ); } - inline bool operator<( const CSteamID &val ) const { return m_steamid.m_unAll64Bits < val.m_steamid.m_unAll64Bits; } - inline bool operator>( const CSteamID &val ) const { return m_steamid.m_unAll64Bits > val.m_steamid.m_unAll64Bits; } - - // DEBUG function - bool BValidExternalSteamID() const; - -private: - // These are defined here to prevent accidental implicit conversion of a u32AccountID to a CSteamID. - // If you get a compiler error about an ambiguous constructor/function then it may be because you're - // passing a 32-bit int to a function that takes a CSteamID. You should explicitly create the SteamID - // using the correct Universe and account Type/Instance values. - CSteamID( uint32 ); - CSteamID( int32 ); - - // 64 bits total - union SteamID_t - { - struct SteamIDComponent_t - { -#ifdef VALVE_BIG_ENDIAN - EUniverse m_EUniverse : 8; // universe this account belongs to - unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference - unsigned int m_unAccountInstance : 20; // dynamic instance ID - uint32 m_unAccountID : 32; // unique account identifier -#else - uint32 m_unAccountID : 32; // unique account identifier - unsigned int m_unAccountInstance : 20; // dynamic instance ID - unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference - EUniverse m_EUniverse : 8; // universe this account belongs to -#endif - } m_comp; - - uint64 m_unAll64Bits; - } m_steamid; -}; - -inline bool CSteamID::IsValid() const -{ - if ( m_steamid.m_comp.m_EAccountType <= k_EAccountTypeInvalid || m_steamid.m_comp.m_EAccountType >= k_EAccountTypeMax ) - return false; - - if ( m_steamid.m_comp.m_EUniverse <= k_EUniverseInvalid || m_steamid.m_comp.m_EUniverse >= k_EUniverseMax ) - return false; - - if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeIndividual ) - { - if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance > k_unSteamUserWebInstance ) - return false; - } - - if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeClan ) - { - if ( m_steamid.m_comp.m_unAccountID == 0 || m_steamid.m_comp.m_unAccountInstance != 0 ) - return false; - } - - if ( m_steamid.m_comp.m_EAccountType == k_EAccountTypeGameServer ) - { - if ( m_steamid.m_comp.m_unAccountID == 0 ) - return false; - // Any limit on instances? We use them for local users and bots - } - return true; -} - -// generic invalid CSteamID -#define k_steamIDNil CSteamID() - -// This steamID comes from a user game connection to an out of date GS that hasnt implemented the protocol -// to provide its steamID -#define k_steamIDOutofDateGS CSteamID( 0, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) -// This steamID comes from a user game connection to an sv_lan GS -#define k_steamIDLanModeGS CSteamID( 0, 0, k_EUniversePublic, k_EAccountTypeInvalid ) -// This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized -// its steam3 component and started logging on. -#define k_steamIDNotInitYetGS CSteamID( 1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) -// This steamID can come from a user game connection to a GS that isn't using the steam authentication system but still -// wants to support the "Join Game" option in the friends list -#define k_steamIDNonSteamGS CSteamID( 2, 0, k_EUniverseInvalid, k_EAccountTypeInvalid ) - - -#ifdef STEAM -// Returns the matching chat steamID, with the default instance of 0 -// If the steamID passed in is already of type k_EAccountTypeChat it will be returned with the same instance -CSteamID ChatIDFromSteamID( const CSteamID &steamID ); -// Returns the matching clan steamID, with the default instance of 0 -// If the steamID passed in is already of type k_EAccountTypeClan it will be returned with the same instance -CSteamID ClanIDFromSteamID( const CSteamID &steamID ); -// Asserts steamID type before conversion -CSteamID ChatIDFromClanID( const CSteamID &steamIDClan ); -// Asserts steamID type before conversion -CSteamID ClanIDFromChatID( const CSteamID &steamIDChat ); - -#endif // _STEAM - - -//----------------------------------------------------------------------------- -// Purpose: encapsulates an appID/modID pair -//----------------------------------------------------------------------------- -class CGameID -{ -public: - - CGameID() - { - m_gameID.m_nType = k_EGameIDTypeApp; - m_gameID.m_nAppID = k_uAppIdInvalid; - m_gameID.m_nModID = 0; - } - - explicit CGameID( uint64 ulGameID ) - { - m_ulGameID = ulGameID; - } - - explicit CGameID( int32 nAppID ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - } - - explicit CGameID( uint32 nAppID ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - } - - CGameID( uint32 nAppID, uint32 nModID ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - m_gameID.m_nModID = nModID; - m_gameID.m_nType = k_EGameIDTypeGameMod; - } - - // Hidden functions used only by Steam - explicit CGameID( const char *pchGameID ); - const char *Render() const; // render this Game ID to string - static const char *Render( uint64 ulGameID ); // static method to render a uint64 representation of a Game ID to a string - - // must include checksum_crc.h first to get this functionality -#if defined( CHECKSUM_CRC_H ) - CGameID( uint32 nAppID, const char *pchModPath ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = nAppID; - m_gameID.m_nType = k_EGameIDTypeGameMod; - - char rgchModDir[MAX_PATH]; - Q_FileBase( pchModPath, rgchModDir, sizeof( rgchModDir ) ); - CRC32_t crc32; - CRC32_Init( &crc32 ); - CRC32_ProcessBuffer( &crc32, rgchModDir, Q_strlen( rgchModDir ) ); - CRC32_Final( &crc32 ); - - // set the high-bit on the mod-id - // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique - // replacement for appID's - m_gameID.m_nModID = crc32 | (0x80000000); - } - - CGameID( const char *pchExePath, const char *pchAppName ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = k_uAppIdInvalid; - m_gameID.m_nType = k_EGameIDTypeShortcut; - - CRC32_t crc32; - CRC32_Init( &crc32 ); - CRC32_ProcessBuffer( &crc32, pchExePath, Q_strlen( pchExePath ) ); - CRC32_ProcessBuffer( &crc32, pchAppName, Q_strlen( pchAppName ) ); - CRC32_Final( &crc32 ); - - // set the high-bit on the mod-id - // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique - // replacement for appID's - m_gameID.m_nModID = crc32 | (0x80000000); - } - -#if defined( VSTFILEID_H ) - - CGameID( VstFileID vstFileID ) - { - m_ulGameID = 0; - m_gameID.m_nAppID = k_uAppIdInvalid; - m_gameID.m_nType = k_EGameIDTypeP2P; - - CRC32_t crc32; - CRC32_Init( &crc32 ); - const char *pchFileId = vstFileID.Render(); - CRC32_ProcessBuffer( &crc32, pchFileId, Q_strlen( pchFileId ) ); - CRC32_Final( &crc32 ); - - // set the high-bit on the mod-id - // reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique - // replacement for appID's - m_gameID.m_nModID = crc32 | (0x80000000); - } - -#endif /* VSTFILEID_H */ - -#endif /* CHECKSUM_CRC_H */ - - - uint64 ToUint64() const - { - return m_ulGameID; - } - - uint64 *GetUint64Ptr() - { - return &m_ulGameID; - } - - void Set( uint64 ulGameID ) - { - m_ulGameID = ulGameID; - } - - bool IsMod() const - { - return ( m_gameID.m_nType == k_EGameIDTypeGameMod ); - } - - bool IsShortcut() const - { - return ( m_gameID.m_nType == k_EGameIDTypeShortcut ); - } - - bool IsP2PFile() const - { - return ( m_gameID.m_nType == k_EGameIDTypeP2P ); - } - - bool IsSteamApp() const - { - return ( m_gameID.m_nType == k_EGameIDTypeApp ); - } - - uint32 ModID() const - { - return m_gameID.m_nModID; - } - - uint32 AppID() const - { - return m_gameID.m_nAppID; - } - - bool operator == ( const CGameID &rhs ) const - { - return m_ulGameID == rhs.m_ulGameID; - } - - bool operator != ( const CGameID &rhs ) const - { - return !(*this == rhs); - } - - bool operator < ( const CGameID &rhs ) const - { - return ( m_ulGameID < rhs.m_ulGameID ); - } - - bool IsValid() const - { - // each type has it's own invalid fixed point: - switch( m_gameID.m_nType ) - { - case k_EGameIDTypeApp: - return m_gameID.m_nAppID != k_uAppIdInvalid; - - case k_EGameIDTypeGameMod: - return m_gameID.m_nAppID != k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000; - - case k_EGameIDTypeShortcut: - return (m_gameID.m_nModID & 0x80000000) != 0; - - case k_EGameIDTypeP2P: - return m_gameID.m_nAppID == k_uAppIdInvalid && m_gameID.m_nModID & 0x80000000; - - default: -#if defined(Assert) - Assert(false); -#endif - return false; - } - - } - - void Reset() - { - m_ulGameID = 0; - } - - - -private: - - enum EGameIDType - { - k_EGameIDTypeApp = 0, - k_EGameIDTypeGameMod = 1, - k_EGameIDTypeShortcut = 2, - k_EGameIDTypeP2P = 3, - }; - - struct GameID_t - { -#ifdef VALVE_BIG_ENDIAN - unsigned int m_nModID : 32; - unsigned int m_nType : 8; - unsigned int m_nAppID : 24; -#else - unsigned int m_nAppID : 24; - unsigned int m_nType : 8; - unsigned int m_nModID : 32; -#endif - }; - - union - { - uint64 m_ulGameID; - GameID_t m_gameID; - }; -}; - -#pragma pack( pop ) - -const int k_cchGameExtraInfoMax = 64; - - -//----------------------------------------------------------------------------- -// Constants used for query ports. -//----------------------------------------------------------------------------- - -#define QUERY_PORT_NOT_INITIALIZED 0xFFFF // We haven't asked the GS for this query port's actual value yet. -#define QUERY_PORT_ERROR 0xFFFE // We were unable to get the query port for this server. - - -//----------------------------------------------------------------------------- -// Purpose: Passed as argument to SteamAPI_UseBreakpadCrashHandler to enable optional callback -// just before minidump file is captured after a crash has occurred. (Allows app to append additional comment data to the dump, etc.) -//----------------------------------------------------------------------------- -typedef void (*PFNPreMinidumpCallback)(void *context); - -//----------------------------------------------------------------------------- -// Purpose: Used by ICrashHandler interfaces to reference particular installed crash handlers -//----------------------------------------------------------------------------- -typedef void *BREAKPAD_HANDLE; -#define BREAKPAD_INVALID_HANDLE (BREAKPAD_HANDLE)0 - -#endif // STEAMCLIENTPUBLIC_H diff --git a/regamedll/public/steam/steamhttpenums.h b/regamedll/public/steam/steamhttpenums.h deleted file mode 100644 index d43d33df..00000000 --- a/regamedll/public/steam/steamhttpenums.h +++ /dev/null @@ -1,94 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: HTTP related enums, stuff that is shared by both clients and servers, and our -// UI projects goes here. -// -//============================================================================= - -#ifndef STEAMHTTPENUMS_H -#define STEAMHTTPENUMS_H -#ifdef _WIN32 -#pragma once -#endif - -// HTTP related types - -// This enum is used in client API methods, do not re-number existing values. -enum EHTTPMethod -{ - k_EHTTPMethodInvalid = 0, - k_EHTTPMethodGET, - k_EHTTPMethodHEAD, - k_EHTTPMethodPOST, - - // The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for - // a compliant general purpose server. We'll likely add more as we find uses for them. - - // k_EHTTPMethodOPTIONS, - k_EHTTPMethodPUT, - k_EHTTPMethodDELETE, - // k_EHTTPMethodTRACE, - // k_EHTTPMethodCONNECT -}; - - -// HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions -// of each of these. -enum EHTTPStatusCode -{ - // Invalid status code (this isn't defined in HTTP, used to indicate unset in our code) - k_EHTTPStatusCodeInvalid = 0, - - // Informational codes - k_EHTTPStatusCode100Continue = 100, - k_EHTTPStatusCode101SwitchingProtocols = 101, - - // Success codes - k_EHTTPStatusCode200OK = 200, - k_EHTTPStatusCode201Created = 201, - k_EHTTPStatusCode202Accepted = 202, - k_EHTTPStatusCode203NonAuthoritative = 203, - k_EHTTPStatusCode204NoContent = 204, - k_EHTTPStatusCode205ResetContent = 205, - k_EHTTPStatusCode206PartialContent = 206, - - // Redirection codes - k_EHTTPStatusCode300MultipleChoices = 300, - k_EHTTPStatusCode301MovedPermanently = 301, - k_EHTTPStatusCode302Found = 302, - k_EHTTPStatusCode303SeeOther = 303, - k_EHTTPStatusCode304NotModified = 304, - k_EHTTPStatusCode305UseProxy = 305, - //k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1) - k_EHTTPStatusCode307TemporaryRedirect = 307, - - // Error codes - k_EHTTPStatusCode400BadRequest = 400, - k_EHTTPStatusCode401Unauthorized = 401, - k_EHTTPStatusCode402PaymentRequired = 402, // This is reserved for future HTTP specs, not really supported by clients - k_EHTTPStatusCode403Forbidden = 403, - k_EHTTPStatusCode404NotFound = 404, - k_EHTTPStatusCode405MethodNotAllowed = 405, - k_EHTTPStatusCode406NotAcceptable = 406, - k_EHTTPStatusCode407ProxyAuthRequired = 407, - k_EHTTPStatusCode408RequestTimeout = 408, - k_EHTTPStatusCode409Conflict = 409, - k_EHTTPStatusCode410Gone = 410, - k_EHTTPStatusCode411LengthRequired = 411, - k_EHTTPStatusCode412PreconditionFailed = 412, - k_EHTTPStatusCode413RequestEntityTooLarge = 413, - k_EHTTPStatusCode414RequestURITooLong = 414, - k_EHTTPStatusCode415UnsupportedMediaType = 415, - k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416, - k_EHTTPStatusCode417ExpectationFailed = 417, - - // Server error codes - k_EHTTPStatusCode500InternalServerError = 500, - k_EHTTPStatusCode501NotImplemented = 501, - k_EHTTPStatusCode502BadGateway = 502, - k_EHTTPStatusCode503ServiceUnavailable = 503, - k_EHTTPStatusCode504GatewayTimeout = 504, - k_EHTTPStatusCode505HTTPVersionNotSupported = 505, -}; - -#endif // STEAMHTTPENUMS_H \ No newline at end of file diff --git a/regamedll/public/steam/steamtypes.h b/regamedll/public/steam/steamtypes.h deleted file mode 100644 index 6b6bc265..00000000 --- a/regamedll/public/steam/steamtypes.h +++ /dev/null @@ -1,136 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -//============================================================================= - -#ifndef STEAMTYPES_H -#define STEAMTYPES_H -#ifdef _WIN32 -#pragma once -#endif - -// Steam-specific types. Defined here so this header file can be included in other code bases. -#ifndef WCHARTYPES_H -typedef unsigned char uint8; -#endif - -#if defined( __GNUC__ ) && !defined(POSIX) - #if __GNUC__ < 4 - #error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)" - #endif - #define POSIX 1 -#endif - -#if defined(__x86_64__) || defined(_WIN64) -#define X64BITS -#endif - -// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code. -#if !defined(VALVE_BIG_ENDIAN) && defined(_PS3) -#define VALVE_BIG_ENDIAN -#endif - -typedef unsigned char uint8; -typedef signed char int8; - -#if defined( _WIN32 ) - -typedef __int16 int16; -typedef unsigned __int16 uint16; -typedef __int32 int32; -typedef unsigned __int32 uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; - -#ifdef X64BITS -typedef __int64 intp; // intp is an integer that can accomodate a pointer -typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) -#else -typedef __int32 intp; -typedef unsigned __int32 uintp; -#endif - -#else // _WIN32 - -typedef short int16; -typedef unsigned short uint16; -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; -#ifdef X64BITS -typedef long long intp; -typedef unsigned long long uintp; -#else -typedef int intp; -typedef unsigned int uintp; -#endif - -#endif // else _WIN32 - -const int k_cubSaltSize = 8; -typedef uint8 Salt_t[ k_cubSaltSize ]; - -//----------------------------------------------------------------------------- -// GID (GlobalID) stuff -// This is a globally unique identifier. It's guaranteed to be unique across all -// racks and servers for as long as a given universe persists. -//----------------------------------------------------------------------------- -// NOTE: for GID parsing/rendering and other utils, see gid.h -typedef uint64 GID_t; - -const GID_t k_GIDNil = 0xffffffffffffffffull; - -// For convenience, we define a number of types that are just new names for GIDs -typedef GID_t JobID_t; // Each Job has a unique ID -typedef GID_t TxnID_t; // Each financial transaction has a unique ID - -const GID_t k_TxnIDNil = k_GIDNil; -const GID_t k_TxnIDUnknown = 0; - - -// this is baked into client messages and interfaces as an int, -// make sure we never break this. -typedef uint32 PackageId_t; -const PackageId_t k_uPackageIdFreeSub = 0x0; -const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF; - - -// this is baked into client messages and interfaces as an int, -// make sure we never break this. -typedef uint32 AppId_t; -const AppId_t k_uAppIdInvalid = 0x0; - -typedef uint64 AssetClassId_t; -const AssetClassId_t k_ulAssetClassIdInvalid = 0x0; - -typedef uint32 PhysicalItemId_t; -const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0; - - -// this is baked into client messages and interfaces as an int, -// make sure we never break this. AppIds and DepotIDs also presently -// share the same namespace, but since we'd like to change that in the future -// I've defined it seperately here. -typedef uint32 DepotId_t; -const DepotId_t k_uDepotIdInvalid = 0x0; - -// RTime32 -// We use this 32 bit time representing real world time. -// It offers 1 second resolution beginning on January 1, 1970 (Unix time) -typedef uint32 RTime32; - -typedef uint32 CellID_t; -const CellID_t k_uCellIDInvalid = 0xFFFFFFFF; - -// handle to a Steam API call -typedef uint64 SteamAPICall_t; -const SteamAPICall_t k_uAPICallInvalid = 0x0; - -typedef uint32 AccountID_t; - -typedef uint32 PartnerId_t; -const PartnerId_t k_uPartnerIdInvalid = 0; - -#endif // STEAMTYPES_H diff --git a/regamedll/public/utlbuffer.h b/regamedll/public/utlbuffer.h deleted file mode 100644 index 9ac532da..00000000 --- a/regamedll/public/utlbuffer.h +++ /dev/null @@ -1,341 +0,0 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ -// -// The copyright to the contents herein is the property of Valve, L.L.C. -// The contents may be used and/or copied only with the written permission of -// Valve, L.L.C., or in accordance with the terms and conditions stipulated in -// the agreement/contract under which the contents have been supplied. -// -// $Header: $ -// $NoKeywords: $ -// -// Serialization/unserialization buffer -//============================================================================= - -#ifndef UTLBUFFER_H -#define UTLBUFFER_H - -#include "osconfig.h" -#include "utlmemory.h" -#include - -//----------------------------------------------------------------------------- -// Command parsing.. -//----------------------------------------------------------------------------- - -class CUtlBuffer -{ -public: - enum SeekType_t - { - SEEK_HEAD = 0, - SEEK_CURRENT, - SEEK_TAIL - }; - - CUtlBuffer(int growSize = 0, int initSize = 0, bool text = false); - CUtlBuffer(void const* pBuffer, int size, bool text = false); - - // Makes sure we've got at least this much memory - void EnsureCapacity(int num); - - // Attaches the buffer to external memory.... - void SetExternalBuffer(void* pMemory, int numElements, bool text = false); - - // Read stuff out. - // Binary mode: it'll just read the bits directly in, and characters will be - // read for strings until a null character is reached. - // Text mode: it'll parse the file, turning text #s into real numbers. - // GetString will read a string until a space is reaced - char GetChar(); - unsigned char GetUnsignedChar(); - short GetShort(); - unsigned short GetUnsignedShort(); - int GetInt(); - int GetIntHex(); - unsigned int GetUnsignedInt(); - float GetFloat(); - double GetDouble(); - void GetString(char* pString, int nMaxLen = 0); - void Get(void* pMem, int size); - - // Just like scanf, but doesn't work in binary mode - int Scanf(char const* pFmt, ...); - int VaScanf(char const* pFmt, va_list list); - - // Eats white space, advances Get index - void EatWhiteSpace(); - - // Write stuff in - // Binary mode: it'll just write the bits directly in, and strings will be - // written with a null terminating character - // Text mode: it'll convert the numbers to text versions - // PutString will not write a terminating character - void PutChar(char c); - void PutUnsignedChar(unsigned char uc); - void PutShort(short s); - void PutUnsignedShort(unsigned short us); - void PutInt(int i); - void PutUnsignedInt(unsigned int u); - void PutFloat(float f); - void PutDouble(double d); - void PutString(char const* pString); - void Put(void const* pMem, int size); - - // Just like printf, writes a terminating zero in binary mode - void Printf(char const* pFmt, ...); - void VaPrintf(char const* pFmt, va_list list); - - // What am I writing (put)/reading (get)? - void* PeekPut(int offset = 0); - void const* PeekGet(int offset = 0) const; - - // Where am I writing (put)/reading (get)? - int TellPut() const; - int TellGet() const; - - // Change where I'm writing (put)/reading (get) - void SeekPut(SeekType_t type, int offset); - void SeekGet(SeekType_t type, int offset); - - // Buffer base - void const* Base() const; - void* Base(); - - // memory allocation size, does *not* reflect size written or read, - // use TellPut or TellGet for that - int Size() const; - - // Am I a text buffer? - inline bool IsText() const { return (m_Flags & TEXT_BUFFER) != 0; } - - // Am I valid? (overflow or underflow error), Once invalid it stays invalid - inline bool IsValid() const { return m_Error == 0; } - -private: - // error flags - enum - { - PUT_OVERFLOW = 0x1, - GET_OVERFLOW = 0x2, - }; - - // flags - enum - { - TEXT_BUFFER = 0x1, - }; - - // Checks if a get/put is ok - bool CheckPut(int size); - bool CheckGet(int size); - - CUtlMemory m_Memory; - int m_Get; - int m_Put; - unsigned char m_Error; - unsigned char m_Flags; -}; - - -//----------------------------------------------------------------------------- -// Where am I reading? -//----------------------------------------------------------------------------- - -inline int CUtlBuffer::TellGet() const -{ - return m_Get; -} - - -//----------------------------------------------------------------------------- -// What am I reading? -//----------------------------------------------------------------------------- -inline void const* CUtlBuffer::PeekGet(int offset) const -{ - return &m_Memory[m_Get + offset]; -} - - -//----------------------------------------------------------------------------- -// Unserialization -//----------------------------------------------------------------------------- -#define GET_TYPE( _type, _val, _fmt ) \ - if (!IsText()) \ - { \ - if (CheckGet( sizeof(_type) )) \ - { \ - _val = *(_type *)PeekGet(); \ - m_Get += sizeof(_type); \ - } \ - else \ - { \ - _val = 0; \ - } \ - } \ - else \ - { \ - _val = 0; \ - Scanf( _fmt, &_val ); \ - } - -inline char CUtlBuffer::GetChar() -{ - char c; - GET_TYPE(char, c, "%c"); - return c; -} - -inline unsigned char CUtlBuffer::GetUnsignedChar() -{ - unsigned char c; - GET_TYPE(unsigned char, c, "%u"); - return c; -} - -inline short CUtlBuffer::GetShort() -{ - short s; - GET_TYPE(short, s, "%d"); - return s; -} - -inline unsigned short CUtlBuffer::GetUnsignedShort() -{ - unsigned short s; - GET_TYPE(unsigned short, s, "%u"); - return s; -} - -inline int CUtlBuffer::GetInt() -{ - int i; - GET_TYPE(int, i, "%d"); - return i; -} - -inline int CUtlBuffer::GetIntHex() -{ - int i; - GET_TYPE(int, i, "%x"); - return i; -} - -inline unsigned int CUtlBuffer::GetUnsignedInt() -{ - unsigned int u; - GET_TYPE(unsigned int, u, "%u"); - return u; -} - -inline float CUtlBuffer::GetFloat() -{ - float f; - GET_TYPE(float, f, "%f"); - return f; -} - -inline double CUtlBuffer::GetDouble() -{ - double d; - GET_TYPE(double, d, "%f"); - return d; -} - - -//----------------------------------------------------------------------------- -// Where am I writing? -//----------------------------------------------------------------------------- -inline int CUtlBuffer::TellPut() const -{ - return m_Put; -} - - -//----------------------------------------------------------------------------- -// What am I reading? -//----------------------------------------------------------------------------- -inline void* CUtlBuffer::PeekPut(int offset) -{ - return &m_Memory[m_Put + offset]; -} - - -//----------------------------------------------------------------------------- -// Various put methods -//----------------------------------------------------------------------------- -#define PUT_TYPE( _type, _val, _fmt ) \ - if (!IsText()) \ - { \ - if (CheckPut( sizeof(_type) )) \ - { \ - *(_type *)PeekPut() = _val; \ - m_Put += sizeof(_type); \ - } \ - } \ - else \ - { \ - Printf( _fmt, _val ); \ - } - - -inline void CUtlBuffer::PutChar(char c) -{ - PUT_TYPE(char, c, "%c"); -} - -inline void CUtlBuffer::PutUnsignedChar(unsigned char c) -{ - PUT_TYPE(unsigned char, c, "%u"); -} - -inline void CUtlBuffer::PutShort(short s) -{ - PUT_TYPE(short, s, "%d"); -} - -inline void CUtlBuffer::PutUnsignedShort(unsigned short s) -{ - PUT_TYPE(unsigned short, s, "%u"); -} - -inline void CUtlBuffer::PutInt(int i) -{ - PUT_TYPE(int, i, "%d"); -} - -inline void CUtlBuffer::PutUnsignedInt(unsigned int u) -{ - PUT_TYPE(unsigned int, u, "%u"); -} - -inline void CUtlBuffer::PutFloat(float f) -{ - PUT_TYPE(float, f, "%f"); -} - -inline void CUtlBuffer::PutDouble(double d) -{ - PUT_TYPE(double, d, "%f"); -} - -//----------------------------------------------------------------------------- -// Buffer base and size -//----------------------------------------------------------------------------- - -inline void const* CUtlBuffer::Base() const -{ - return m_Memory.Base(); -} - -inline void* CUtlBuffer::Base() -{ - return m_Memory.Base(); -} - -inline int CUtlBuffer::Size() const -{ - return m_Memory.NumAllocated(); -} - - -#endif // UTLBUFFER_H diff --git a/regamedll/public/utlrbtree.h b/regamedll/public/utlrbtree.h deleted file mode 100644 index 4fc06735..00000000 --- a/regamedll/public/utlrbtree.h +++ /dev/null @@ -1,1295 +0,0 @@ -//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. =========== -// -// The copyright to the contents herein is the property of Valve, L.L.C. -// The contents may be used and/or copied only with the written permission of -// Valve, L.L.C., or in accordance with the terms and conditions stipulated in -// the agreement/contract under which the contents have been supplied. -// -// Purpose: -// -// $Header: $ -// $NoKeywords: $ -//============================================================================= - -#ifndef UTLRBTREE_H -#define UTLRBTREE_H - -//#include -#include "utlmemory.h" - -//----------------------------------------------------------------------------- -// Tool to generate a default compare function for any type that implements -// operator<, including all simple types -//----------------------------------------------------------------------------- - -template -class CDefOps -{ -public: - static bool LessFunc( const T &lhs, const T &rhs ) { return ( lhs < rhs ); } -}; - -#define DefLessFunc( type ) CDefOps::LessFunc - -//------------------------------------- - -inline bool StringLessThan( const char * const &lhs, const char * const &rhs) { return ( strcmp( lhs, rhs) < 0 ); } -inline bool CaselessStringLessThan( const char * const &lhs, const char * const &rhs ) { return ( _stricmp( lhs, rhs) < 0 ); } - -//------------------------------------- -// inline these two templates to stop multiple definitions of the same code -template <> inline bool CDefOps::LessFunc( const char * const &lhs, const char * const &rhs ) { return StringLessThan( lhs, rhs ); } -template <> inline bool CDefOps::LessFunc( char * const &lhs, char * const &rhs ) { return StringLessThan( lhs, rhs ); } - -//------------------------------------- - -template -void SetDefLessFunc( RBTREE_T &RBTree ) -{ -#ifdef _WIN32 - RBTree.SetLessFunc( DefLessFunc( RBTREE_T::KeyType_t ) ); -#elif _LINUX - RBTree.SetLessFunc( DefLessFunc( typename RBTREE_T::KeyType_t ) ); -#endif -} - -//----------------------------------------------------------------------------- -// A red-black binary search tree -//----------------------------------------------------------------------------- - -template -class CUtlRBTree -{ -public: - // Less func typedef - // Returns true if the first parameter is "less" than the second - typedef bool (*LessFunc_t)( T const &, T const & ); - - typedef T KeyType_t; - typedef T ElemType_t; - typedef I IndexType_t; - - // constructor, destructor - // Left at growSize = 0, the memory will first allocate 1 element and double in size - // at each increment. - // LessFunc_t is required, but may be set after the constructor using SetLessFunc() below - CUtlRBTree( int growSize = 0, int initSize = 0, LessFunc_t lessfunc = 0 ); - ~CUtlRBTree( ); - - // gets particular elements - T& Element( I i ); - T const &Element( I i ) const; - T& operator[]( I i ); - T const &operator[]( I i ) const; - - // Gets the root - I Root() const; - - // Num elements - unsigned int Count() const; - - // Max "size" of the vector - I MaxElement() const; - - // Gets the children - I Parent( I i ) const; - I LeftChild( I i ) const; - I RightChild( I i ) const; - - // Tests if a node is a left or right child - bool IsLeftChild( I i ) const; - bool IsRightChild( I i ) const; - - // Tests if root or leaf - bool IsRoot( I i ) const; - bool IsLeaf( I i ) const; - - // Checks if a node is valid and in the tree - bool IsValidIndex( I i ) const; - - // Checks if the tree as a whole is valid - bool IsValid() const; - - // Invalid index - static I InvalidIndex(); - - // returns the tree depth (not a very fast operation) - int Depth( I node ) const; - int Depth() const; - - // Sets the less func - void SetLessFunc( LessFunc_t func ); - - // Allocation method - I NewNode(); - - // Insert method (inserts in order) - I Insert( T const &insert ); - void Insert( const T *pArray, int nItems ); - - // Find method - I Find( T const &search ) const; - - // Remove methods - void RemoveAt( I i ); - bool Remove( T const &remove ); - void RemoveAll( ); - - // Allocation, deletion - void FreeNode( I i ); - - // Iteration - I FirstInorder() const; - I NextInorder( I i ) const; - I PrevInorder( I i ) const; - I LastInorder() const; - - I FirstPreorder() const; - I NextPreorder( I i ) const; - I PrevPreorder( I i ) const; - I LastPreorder( ) const; - - I FirstPostorder() const; - I NextPostorder( I i ) const; - - // If you change the search key, this can be used to reinsert the - // element into the tree. - void Reinsert( I elem ); - - -protected: - enum NodeColor_t - { - RED = 0, - BLACK - }; - - struct Links_t - { - I m_Left; - I m_Right; - I m_Parent; - I m_Tag; - }; - - struct Node_t : public Links_t - { - T m_Data; - }; - - // Sets the children - void SetParent( I i, I parent ); - void SetLeftChild( I i, I child ); - void SetRightChild( I i, I child ); - void LinkToParent( I i, I parent, bool isLeft ); - - // Gets at the links - Links_t const &Links( I i ) const; - Links_t &Links( I i ); - - // Checks if a link is red or black - bool IsRed( I i ) const; - bool IsBlack( I i ) const; - - // Sets/gets node color - NodeColor_t Color( I i ) const; - void SetColor( I i, NodeColor_t c ); - - // operations required to preserve tree balance - void RotateLeft(I i); - void RotateRight(I i); - void InsertRebalance(I i); - void RemoveRebalance(I i); - - // Insertion, removal - I InsertAt( I parent, bool leftchild ); - - // copy constructors not allowed - CUtlRBTree( CUtlRBTree const &tree ); - - // Inserts a node into the tree, doesn't copy the data in. - void FindInsertionPosition( T const &insert, I &parent, bool &leftchild ); - - // Remove and add back an element in the tree. - void Unlink( I elem ); - void Link( I elem ); - - // Used for sorting. - LessFunc_t m_LessFunc; - - CUtlMemory m_Elements; - I m_Root; - I m_NumElements; - I m_FirstFree; - I m_TotalElements; - - Node_t* m_pElements; - - void ResetDbgInfo() - { - m_pElements = (Node_t*)m_Elements.Base(); - } -}; - - -//----------------------------------------------------------------------------- -// constructor, destructor -//----------------------------------------------------------------------------- - -template -CUtlRBTree::CUtlRBTree( int growSize, int initSize, LessFunc_t lessfunc ) : - m_Elements( growSize, initSize ), - m_LessFunc( lessfunc ), - m_Root( InvalidIndex() ), - m_NumElements( 0 ), m_TotalElements( 0 ), - m_FirstFree( InvalidIndex() ) -{ - ResetDbgInfo(); -} - -template -CUtlRBTree::~CUtlRBTree() -{ -} - -//----------------------------------------------------------------------------- -// gets particular elements -//----------------------------------------------------------------------------- - -template -inline T &CUtlRBTree::Element( I i ) -{ - return m_Elements[i].m_Data; -} - -template -inline T const &CUtlRBTree::Element( I i ) const -{ - return m_Elements[i].m_Data; -} - -template -inline T &CUtlRBTree::operator[]( I i ) -{ - return Element(i); -} - -template -inline T const &CUtlRBTree::operator[]( I i ) const -{ - return Element(i); -} - -//----------------------------------------------------------------------------- -// -// various accessors -// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Gets the root -//----------------------------------------------------------------------------- - -template -inline I CUtlRBTree::Root() const -{ - return m_Root; -} - -//----------------------------------------------------------------------------- -// Num elements -//----------------------------------------------------------------------------- - -template -inline unsigned int CUtlRBTree::Count() const -{ - return (unsigned int)m_NumElements; -} - -//----------------------------------------------------------------------------- -// Max "size" of the vector -//----------------------------------------------------------------------------- - -template -inline I CUtlRBTree::MaxElement() const -{ - return (I)m_TotalElements; -} - - -//----------------------------------------------------------------------------- -// Gets the children -//----------------------------------------------------------------------------- - -template -inline I CUtlRBTree::Parent( I i ) const -{ - return Links(i).m_Parent; -} - -template -inline I CUtlRBTree::LeftChild( I i ) const -{ - return Links(i).m_Left; -} - -template -inline I CUtlRBTree::RightChild( I i ) const -{ - return Links(i).m_Right; -} - -//----------------------------------------------------------------------------- -// Tests if a node is a left or right child -//----------------------------------------------------------------------------- - -template -inline bool CUtlRBTree::IsLeftChild( I i ) const -{ - return LeftChild(Parent(i)) == i; -} - -template -inline bool CUtlRBTree::IsRightChild( I i ) const -{ - return RightChild(Parent(i)) == i; -} - - -//----------------------------------------------------------------------------- -// Tests if root or leaf -//----------------------------------------------------------------------------- - -template -inline bool CUtlRBTree::IsRoot( I i ) const -{ - return i == m_Root; -} - -template -inline bool CUtlRBTree::IsLeaf( I i ) const -{ - return (LeftChild(i) == InvalidIndex()) && (RightChild(i) == InvalidIndex()); -} - - -//----------------------------------------------------------------------------- -// Checks if a node is valid and in the tree -//----------------------------------------------------------------------------- - -template -inline bool CUtlRBTree::IsValidIndex( I i ) const -{ - return LeftChild(i) != i; -} - - -//----------------------------------------------------------------------------- -// Invalid index -//----------------------------------------------------------------------------- - -template -I CUtlRBTree::InvalidIndex() -{ - return (I)~0; -} - - -//----------------------------------------------------------------------------- -// returns the tree depth (not a very fast operation) -//----------------------------------------------------------------------------- - -template -inline int CUtlRBTree::Depth() const -{ - return Depth(Root()); -} - -//----------------------------------------------------------------------------- -// Sets the children -//----------------------------------------------------------------------------- - -template -inline void CUtlRBTree::SetParent( I i, I parent ) -{ - Links(i).m_Parent = parent; -} - -template -inline void CUtlRBTree::SetLeftChild( I i, I child ) -{ - Links(i).m_Left = child; -} - -template -inline void CUtlRBTree::SetRightChild( I i, I child ) -{ - Links(i).m_Right = child; -} - -//----------------------------------------------------------------------------- -// Gets at the links -//----------------------------------------------------------------------------- - -template -inline typename CUtlRBTree::Links_t const &CUtlRBTree::Links( I i ) const -{ - // Sentinel node, makes life easier - static Links_t s_Sentinel = - { - InvalidIndex(), InvalidIndex(), InvalidIndex(), CUtlRBTree::BLACK - }; - - return (i != InvalidIndex()) ? *(Links_t*)&m_Elements[i] : - *(Links_t*)&s_Sentinel; -} - -template -inline typename CUtlRBTree::Links_t &CUtlRBTree::Links( I i ) -{ - Assert(i != InvalidIndex()); - return *(Links_t *)&m_Elements[i]; -} - -//----------------------------------------------------------------------------- -// Checks if a link is red or black -//----------------------------------------------------------------------------- - -template -inline bool CUtlRBTree::IsRed( I i ) const -{ - return (Links(i).m_Tag == RED); -} - -template -inline bool CUtlRBTree::IsBlack( I i ) const -{ - return (Links(i).m_Tag == BLACK); -} - - -//----------------------------------------------------------------------------- -// Sets/gets node color -//----------------------------------------------------------------------------- - -template -inline typename CUtlRBTree::NodeColor_t CUtlRBTree::Color( I i ) const -{ - return (NodeColor_t)Links(i).m_Tag; -} - -template -inline void CUtlRBTree::SetColor( I i, typename CUtlRBTree::NodeColor_t c ) -{ - Links(i).m_Tag = (I)c; -} - -//----------------------------------------------------------------------------- -// Allocates/ deallocates nodes -//----------------------------------------------------------------------------- - -template -I CUtlRBTree::NewNode() -{ - I newElem; - - // Nothing in the free list; add. - if (m_FirstFree == InvalidIndex()) - { - if (m_Elements.NumAllocated() == m_TotalElements) - m_Elements.Grow(); - newElem = m_TotalElements++; - } - else - { - newElem = m_FirstFree; - m_FirstFree = RightChild(m_FirstFree); - } - -#ifdef _DEBUG - // reset links to invalid.... - Links_t &node = Links(newElem); - node.m_Left = node.m_Right = node.m_Parent = InvalidIndex(); -#endif - - Construct( &Element(newElem) ); - ResetDbgInfo(); - - return newElem; -} - -template -void CUtlRBTree::FreeNode( I i ) -{ - Assert( IsValidIndex(i) && (i != InvalidIndex()) ); - Destruct( &Element(i) ); - SetLeftChild( i, i ); // indicates it's in not in the tree - SetRightChild( i, m_FirstFree ); - m_FirstFree = i; -} - - -//----------------------------------------------------------------------------- -// Rotates node i to the left -//----------------------------------------------------------------------------- - -template -void CUtlRBTree::RotateLeft(I elem) -{ - I rightchild = RightChild(elem); - SetRightChild( elem, LeftChild(rightchild) ); - if (LeftChild(rightchild) != InvalidIndex()) - SetParent( LeftChild(rightchild), elem ); - - if (rightchild != InvalidIndex()) - SetParent( rightchild, Parent(elem) ); - if (!IsRoot(elem)) - { - if (IsLeftChild(elem)) - SetLeftChild( Parent(elem), rightchild ); - else - SetRightChild( Parent(elem), rightchild ); - } - else - m_Root = rightchild; - - SetLeftChild( rightchild, elem ); - if (elem != InvalidIndex()) - SetParent( elem, rightchild ); -} - - -//----------------------------------------------------------------------------- -// Rotates node i to the right -//----------------------------------------------------------------------------- - -template -void CUtlRBTree::RotateRight(I elem) -{ - I leftchild = LeftChild(elem); - SetLeftChild( elem, RightChild(leftchild) ); - if (RightChild(leftchild) != InvalidIndex()) - SetParent( RightChild(leftchild), elem ); - - if (leftchild != InvalidIndex()) - SetParent( leftchild, Parent(elem) ); - if (!IsRoot(elem)) - { - if (IsRightChild(elem)) - SetRightChild( Parent(elem), leftchild ); - else - SetLeftChild( Parent(elem), leftchild ); - } - else - m_Root = leftchild; - - SetRightChild( leftchild, elem ); - if (elem != InvalidIndex()) - SetParent( elem, leftchild ); -} - - -//----------------------------------------------------------------------------- -// Rebalances the tree after an insertion -//----------------------------------------------------------------------------- - -template -void CUtlRBTree::InsertRebalance(I elem) -{ - while ( !IsRoot(elem) && (Color(Parent(elem)) == RED) ) - { - I parent = Parent(elem); - I grandparent = Parent(parent); - - /* we have a violation */ - if (IsLeftChild(parent)) - { - I uncle = RightChild(grandparent); - if (IsRed(uncle)) - { - /* uncle is RED */ - SetColor(parent, BLACK); - SetColor(uncle, BLACK); - SetColor(grandparent, RED); - elem = grandparent; - } - else - { - /* uncle is BLACK */ - if (IsRightChild(elem)) - { - /* make x a left child, will change parent and grandparent */ - elem = parent; - RotateLeft(elem); - parent = Parent(elem); - grandparent = Parent(parent); - } - /* recolor and rotate */ - SetColor(parent, BLACK); - SetColor(grandparent, RED); - RotateRight(grandparent); - } - } - else - { - /* mirror image of above code */ - I uncle = LeftChild(grandparent); - if (IsRed(uncle)) - { - /* uncle is RED */ - SetColor(parent, BLACK); - SetColor(uncle, BLACK); - SetColor(grandparent, RED); - elem = grandparent; - } - else - { - /* uncle is BLACK */ - if (IsLeftChild(elem)) - { - /* make x a right child, will change parent and grandparent */ - elem = parent; - RotateRight(parent); - parent = Parent(elem); - grandparent = Parent(parent); - } - /* recolor and rotate */ - SetColor(parent, BLACK); - SetColor(grandparent, RED); - RotateLeft(grandparent); - } - } - } - SetColor( m_Root, BLACK ); -} - - -//----------------------------------------------------------------------------- -// Insert a node into the tree -//----------------------------------------------------------------------------- - -template -I CUtlRBTree::InsertAt( I parent, bool leftchild ) -{ - I i = NewNode(); - LinkToParent( i, parent, leftchild ); - ++m_NumElements; - return i; -} - -template -void CUtlRBTree::LinkToParent( I i, I parent, bool isLeft ) -{ - Links_t &elem = Links(i); - elem.m_Parent = parent; - elem.m_Left = elem.m_Right = InvalidIndex(); - elem.m_Tag = RED; - - /* insert node in tree */ - if (parent != InvalidIndex()) - { - if (isLeft) - Links(parent).m_Left = i; - else - Links(parent).m_Right = i; - } - else - { - m_Root = i; - } - - InsertRebalance(i); - - Assert(IsValid()); -} - -//----------------------------------------------------------------------------- -// Rebalance the tree after a deletion -//----------------------------------------------------------------------------- - -template -void CUtlRBTree::RemoveRebalance(I elem) -{ - while (elem != m_Root && IsBlack(elem)) - { - I parent = Parent(elem); - - // If elem is the left child of the parent - if (elem == LeftChild(parent)) - { - // Get our sibling - I sibling = RightChild(parent); - if (IsRed(sibling)) - { - SetColor(sibling, BLACK); - SetColor(parent, RED); - RotateLeft(parent); - - // We may have a new parent now - parent = Parent(elem); - sibling = RightChild(parent); - } - if ( (IsBlack(LeftChild(sibling))) && (IsBlack(RightChild(sibling))) ) - { - if (sibling != InvalidIndex()) - SetColor(sibling, RED); - elem = parent; - } - else - { - if (IsBlack(RightChild(sibling))) - { - SetColor(LeftChild(sibling), BLACK); - SetColor(sibling, RED); - RotateRight(sibling); - - // rotation may have changed this - parent = Parent(elem); - sibling = RightChild(parent); - } - SetColor( sibling, Color(parent) ); - SetColor( parent, BLACK ); - SetColor( RightChild(sibling), BLACK ); - RotateLeft( parent ); - elem = m_Root; - } - } - else - { - // Elem is the right child of the parent - I sibling = LeftChild(parent); - if (IsRed(sibling)) - { - SetColor(sibling, BLACK); - SetColor(parent, RED); - RotateRight(parent); - - // We may have a new parent now - parent = Parent(elem); - sibling = LeftChild(parent); - } - if ( (IsBlack(RightChild(sibling))) && (IsBlack(LeftChild(sibling))) ) - { - if (sibling != InvalidIndex()) - SetColor( sibling, RED ); - elem = parent; - } - else - { - if (IsBlack(LeftChild(sibling))) - { - SetColor( RightChild(sibling), BLACK ); - SetColor( sibling, RED ); - RotateLeft( sibling ); - - // rotation may have changed this - parent = Parent(elem); - sibling = LeftChild(parent); - } - SetColor( sibling, Color(parent) ); - SetColor( parent, BLACK ); - SetColor( LeftChild(sibling), BLACK ); - RotateRight( parent ); - elem = m_Root; - } - } - } - SetColor( elem, BLACK ); -} - -template -void CUtlRBTree::Unlink( I elem ) -{ - if ( elem != InvalidIndex() ) - { - I x, y; - - if ((LeftChild(elem) == InvalidIndex()) || - (RightChild(elem) == InvalidIndex())) - { - /* y has a NIL node as a child */ - y = elem; - } - else - { - /* find tree successor with a NIL node as a child */ - y = RightChild(elem); - while (LeftChild(y) != InvalidIndex()) - y = LeftChild(y); - } - - /* x is y's only child */ - if (LeftChild(y) != InvalidIndex()) - x = LeftChild(y); - else - x = RightChild(y); - - /* remove y from the parent chain */ - if (x != InvalidIndex()) - SetParent( x, Parent(y) ); - if (!IsRoot(y)) - { - if (IsLeftChild(y)) - SetLeftChild( Parent(y), x ); - else - SetRightChild( Parent(y), x ); - } - else - m_Root = x; - - // need to store this off now, we'll be resetting y's color - NodeColor_t ycolor = Color(y); - if (y != elem) - { - // Standard implementations copy the data around, we cannot here. - // Hook in y to link to the same stuff elem used to. - SetParent( y, Parent(elem) ); - SetRightChild( y, RightChild(elem) ); - SetLeftChild( y, LeftChild(elem) ); - - if (!IsRoot(elem)) - if (IsLeftChild(elem)) - SetLeftChild( Parent(elem), y ); - else - SetRightChild( Parent(elem), y ); - else - m_Root = y; - - if (LeftChild(y) != InvalidIndex()) - SetParent( LeftChild(y), y ); - if (RightChild(y) != InvalidIndex()) - SetParent( RightChild(y), y ); - - SetColor( y, Color(elem) ); - } - - if ((x != InvalidIndex()) && (ycolor == BLACK)) - RemoveRebalance(x); - } -} - -template -void CUtlRBTree::Link( I elem ) -{ - if ( elem != InvalidIndex() ) - { - I parent; - bool leftchild; - - FindInsertionPosition( Element( elem ), parent, leftchild ); - - LinkToParent( elem, parent, leftchild ); - } -} - -//----------------------------------------------------------------------------- -// Delete a node from the tree -//----------------------------------------------------------------------------- - -template -void CUtlRBTree::RemoveAt(I elem) -{ - if ( elem != InvalidIndex() ) - { - Unlink( elem ); - - FreeNode(elem); - --m_NumElements; - } -} - - -//----------------------------------------------------------------------------- -// remove a node in the tree -//----------------------------------------------------------------------------- - -template bool CUtlRBTree::Remove( T const &search ) -{ - I node = Find( search ); - if (node != InvalidIndex()) - { - RemoveAt(node); - return true; - } - return false; -} - - -//----------------------------------------------------------------------------- -// Removes all nodes from the tree -//----------------------------------------------------------------------------- - -template -void CUtlRBTree::RemoveAll() -{ - // Just iterate through the whole list and add to free list - // much faster than doing all of the rebalancing - // also, do it so the free list is pointing to stuff in order - // to get better cache coherence when re-adding stuff to this tree. - I prev = InvalidIndex(); - for (int i = (int)m_TotalElements; --i >= 0; ) - { - I idx = (I)i; - if (IsValidIndex(idx)) - Destruct( &Element(idx) ); - SetRightChild( idx, prev ); - SetLeftChild( idx, idx ); - prev = idx; - } - m_FirstFree = m_TotalElements ? (I)0 : InvalidIndex(); - m_Root = InvalidIndex(); - m_NumElements = 0; -} - - -//----------------------------------------------------------------------------- -// iteration -//----------------------------------------------------------------------------- - -template -I CUtlRBTree::FirstInorder() const -{ - I i = m_Root; - while (LeftChild(i) != InvalidIndex()) - i = LeftChild(i); - return i; -} - -template -I CUtlRBTree::NextInorder( I i ) const -{ - Assert(IsValidIndex(i)); - - if (RightChild(i) != InvalidIndex()) - { - i = RightChild(i); - while (LeftChild(i) != InvalidIndex()) - i = LeftChild(i); - return i; - } - - I parent = Parent(i); - while (IsRightChild(i)) - { - i = parent; - if (i == InvalidIndex()) break; - parent = Parent(i); - } - return parent; -} - -template -I CUtlRBTree::PrevInorder( I i ) const -{ - Assert(IsValidIndex(i)); - - if (LeftChild(i) != InvalidIndex()) - { - i = LeftChild(i); - while (RightChild(i) != InvalidIndex()) - i = RightChild(i); - return i; - } - - I parent = Parent(i); - while (IsLeftChild(i)) - { - i = parent; - if (i == InvalidIndex()) break; - parent = Parent(i); - } - return parent; -} - -template -I CUtlRBTree::LastInorder() const -{ - I i = m_Root; - while (RightChild(i) != InvalidIndex()) - i = RightChild(i); - return i; -} - -template -I CUtlRBTree::FirstPreorder() const -{ - return m_Root; -} - -template -I CUtlRBTree::NextPreorder( I i ) const -{ - if (LeftChild(i) != InvalidIndex()) - return LeftChild(i); - - if (RightChild(i) != InvalidIndex()) - return RightChild(i); - - I parent = Parent(i); - while( parent != InvalidIndex()) - { - if (IsLeftChild(i) && (RightChild(parent) != InvalidIndex())) - return RightChild(parent); - i = parent; - parent = Parent(parent); - } - return InvalidIndex(); -} - -template -I CUtlRBTree::PrevPreorder( I i ) const -{ - Assert(0); // not implemented yet - return InvalidIndex(); -} - -template -I CUtlRBTree::LastPreorder() const -{ - I i = m_Root; - while (1) - { - while (RightChild(i) != InvalidIndex()) - i = RightChild(i); - - if (LeftChild(i) != InvalidIndex()) - i = LeftChild(i); - else - break; - } - return i; -} - -template -I CUtlRBTree::FirstPostorder() const -{ - I i = m_Root; - while (!IsLeaf(i)) - { - if (LeftChild(i)) - i = LeftChild(i); - else - i = RightChild(i); - } - return i; -} - -template -I CUtlRBTree::NextPostorder( I i ) const -{ - I parent = Parent(i); - if (parent == InvalidIndex()) - return InvalidIndex(); - - if (IsRightChild(i)) - return parent; - - if (RightChild(parent) == InvalidIndex()) - return parent; - - i = RightChild(parent); - while (!IsLeaf(i)) - { - if (LeftChild(i)) - i = LeftChild(i); - else - i = RightChild(i); - } - return i; -} - - -template -void CUtlRBTree::Reinsert( I elem ) -{ - Unlink( elem ); - Link( elem ); -} - - -//----------------------------------------------------------------------------- -// returns the tree depth (not a very fast operation) -//----------------------------------------------------------------------------- - -template -int CUtlRBTree::Depth( I node ) const -{ - if (node == InvalidIndex()) - return 0; - - int depthright = Depth( RightChild(node) ); - int depthleft = Depth( LeftChild(node) ); - return max(depthright, depthleft) + 1; -} - - -//----------------------------------------------------------------------------- -// Makes sure the tree is valid after every operation -//----------------------------------------------------------------------------- - -template -bool CUtlRBTree::IsValid() const -{ - if ( !Count() ) - return true; - - if (( Root() >= MaxElement()) || ( Parent( Root() ) != InvalidIndex() )) - goto InvalidTree; - -#ifdef UTLTREE_PARANOID - - // First check to see that mNumEntries matches reality. - // count items on the free list - int numFree = 0; - int curr = m_FirstFree; - while (curr != InvalidIndex()) - { - ++numFree; - curr = RightChild(curr); - if ( (curr > MaxElement()) && (curr != InvalidIndex()) ) - goto InvalidTree; - } - if (MaxElement() - numFree != Count()) - goto InvalidTree; - - // iterate over all elements, looking for validity - // based on the self pointers - int numFree2 = 0; - for (curr = 0; curr < MaxElement(); ++curr) - { - if (!IsValidIndex(curr)) - ++numFree2; - else - { - int right = RightChild(curr); - int left = LeftChild(curr); - if ((right == left) && (right != InvalidIndex()) ) - goto InvalidTree; - - if (right != InvalidIndex()) - { - if (!IsValidIndex(right)) - goto InvalidTree; - if (Parent(right) != curr) - goto InvalidTree; - if (IsRed(curr) && IsRed(right)) - goto InvalidTree; - } - - if (left != InvalidIndex()) - { - if (!IsValidIndex(left)) - goto InvalidTree; - if (Parent(left) != curr) - goto InvalidTree; - if (IsRed(curr) && IsRed(left)) - goto InvalidTree; - } - } - } - if (numFree2 != numFree) - goto InvalidTree; - -#endif // UTLTREE_PARANOID - - return true; - -InvalidTree: - return false; -} - - -//----------------------------------------------------------------------------- -// Sets the less func -//----------------------------------------------------------------------------- - -template -void CUtlRBTree::SetLessFunc( typename CUtlRBTree::LessFunc_t func ) -{ - if (!m_LessFunc) - m_LessFunc = func; - else - { - // need to re-sort the tree here.... - Assert(0); - } -} - - -//----------------------------------------------------------------------------- -// inserts a node into the tree -//----------------------------------------------------------------------------- - -// Inserts a node into the tree, doesn't copy the data in. -template -void CUtlRBTree::FindInsertionPosition( T const &insert, I &parent, bool &leftchild ) -{ - Assert( m_LessFunc ); - - /* find where node belongs */ - I current = m_Root; - parent = InvalidIndex(); - leftchild = false; - while (current != InvalidIndex()) - { - parent = current; - if (m_LessFunc( insert, Element(current) )) - { - leftchild = true; current = LeftChild(current); - } - else - { - leftchild = false; current = RightChild(current); - } - } -} - -template -I CUtlRBTree::Insert( T const &insert ) -{ - // use copy constructor to copy it in - I parent; - bool leftchild; - FindInsertionPosition( insert, parent, leftchild ); - I newNode = InsertAt( parent, leftchild ); - CopyConstruct( &Element( newNode ), insert ); - return newNode; -} - - -template -void CUtlRBTree::Insert( const T *pArray, int nItems ) -{ - while ( nItems-- ) - { - Insert( *pArray++ ); - } -} - -//----------------------------------------------------------------------------- -// finds a node in the tree -//----------------------------------------------------------------------------- - -template -I CUtlRBTree::Find( T const &search ) const -{ - Assert( m_LessFunc ); - - I current = m_Root; - while (current != InvalidIndex()) - { - if (m_LessFunc( search, Element(current) )) - current = LeftChild(current); - else if (m_LessFunc( Element(current), search )) - current = RightChild(current); - else - break; - } - return current; -} - - - - - -#endif // UTLRBTREE_H diff --git a/regamedll/public/utlsymbol.cpp b/regamedll/public/utlsymbol.cpp index 27bf0196..4a9b35f6 100644 --- a/regamedll/public/utlsymbol.cpp +++ b/regamedll/public/utlsymbol.cpp @@ -7,11 +7,10 @@ LessCtx_t g_LessCtx; -#endif // HOOK_GAMEDLL +#endif CUtlSymbolTable *CUtlSymbol::s_pSymbolTable = 0; -/* <401141> ../public/utlsymbol.cpp:31 */ void CUtlSymbol::Initialize() { // necessary to allow us to create global symbols @@ -23,26 +22,22 @@ void CUtlSymbol::Initialize() } } -/* <40125f> ../public/utlsymbol.cpp:42 */ CUtlSymbolTable *CUtlSymbol::CurrTable() { Initialize(); return s_pSymbolTable; } -/* <403946> ../public/utlsymbol.cpp:53 */ CUtlSymbol::CUtlSymbol(const char *pStr) { m_Id = CurrTable()->AddString(pStr); } -/* <4013a8> ../public/utlsymbol.cpp:58 */ const char *CUtlSymbol::String() const { return CurrTable()->String(m_Id); } -/* <40154b> ../public/utlsymbol.cpp:67 */ bool CUtlSymbol::operator==(const char *pStr) const { if (m_Id == UTL_INVAL_SYMBOL) @@ -51,7 +46,6 @@ bool CUtlSymbol::operator==(const char *pStr) const return Q_strcmp(String(), pStr) == 0; } -/* <40104d> ../public/utlsymbol.cpp:91 */ bool CUtlSymbolTable::SymLess(const unsigned int &i1, const unsigned int &i2) { const char *str1 = g_LessCtx.m_pTable->String(i1); @@ -60,7 +54,6 @@ bool CUtlSymbolTable::SymLess(const unsigned int &i1, const unsigned int &i2) return Q_strcmp(str1, str2) < 0; } -/* <400f73> ../public/utlsymbol.cpp:102 */ bool CUtlSymbolTable::SymLessi(const unsigned int &i1, const unsigned int &i2) { const char *str1 = g_LessCtx.m_pTable->String(i1); @@ -69,7 +62,6 @@ bool CUtlSymbolTable::SymLessi(const unsigned int &i1, const unsigned int &i2) return Q_stricmp(str1, str2) < 0; } -/* <4016f4> ../public/utlsymbol.cpp:120 */ CUtlSymbolTable::CUtlSymbolTable(int growSize, int initSize, bool caseInsensitive) : m_Lookup(growSize, initSize, caseInsensitive ? SymLessi : SymLess), m_Strings(256) @@ -77,14 +69,12 @@ CUtlSymbolTable::CUtlSymbolTable(int growSize, int initSize, bool caseInsensitiv ; } -/* <401823> ../public/utlsymbol.cpp:125 */ CUtlSymbolTable::~CUtlSymbolTable() { // Release the stringpool string data RemoveAll(); } -/* <4019b0> ../public/utlsymbol.cpp:130 */ CUtlSymbol CUtlSymbolTable::Find(const char *pString) const { // Passing this special invalid symbol makes the comparison function @@ -95,7 +85,6 @@ CUtlSymbol CUtlSymbolTable::Find(const char *pString) const // Finds and/or creates a symbol based on the string -/* <40358d> ../public/utlsymbol.cpp:150 */ CUtlSymbol CUtlSymbolTable::AddString(const char *pString) { if (!pString) @@ -113,7 +102,6 @@ CUtlSymbol CUtlSymbolTable::AddString(const char *pString) return CUtlSymbol(idx); } -/* <401b8f> ../public/utlsymbol.cpp:173 */ const char *CUtlSymbolTable::String(CUtlSymbol id) const { if (!id.IsValid()) @@ -123,7 +111,6 @@ const char *CUtlSymbolTable::String(CUtlSymbol id) const return &m_Strings[id]; } -/* <401c10> ../public/utlsymbol.cpp:187 */ void CUtlSymbolTable::RemoveAll() { m_Lookup.RemoveAll(); diff --git a/regamedll/public/utlsymbol.h b/regamedll/public/utlsymbol.h index cf95bff6..5a85abeb 100644 --- a/regamedll/public/utlsymbol.h +++ b/regamedll/public/utlsymbol.h @@ -38,7 +38,6 @@ typedef unsigned short UtlSymId_t; #define UTL_INVAL_SYMBOL ((UtlSymId_t)~0) -/* <400608> ../public/utlsymbol.cpp:85 */ struct LessCtx_t { char const *m_pUserString; @@ -47,7 +46,6 @@ struct LessCtx_t LessCtx_t() : m_pUserString(0), m_pTable(0) {} }; -/* <400e59> ../public/utlsymbol.h:46 */ class CUtlSymbol { public: diff --git a/regamedll/regamedll/RegameDLLRuntimeConfig.cpp b/regamedll/regamedll/RegameDLLRuntimeConfig.cpp deleted file mode 100644 index 59c7cf1f..00000000 --- a/regamedll/regamedll/RegameDLLRuntimeConfig.cpp +++ /dev/null @@ -1,189 +0,0 @@ -#include "precompiled.h" - -CRegameDLLRuntimeConfig g_ReGameDLLRuntimeConfig; - -CRegameDLLRuntimeConfig::CRegameDLLRuntimeConfig() -{ - bIsZero = false; - disableAllHooks = false; - testRecordingFileName[0] = 0; - testConfigFileName[0] = 0; - testPlayerMode = TPM_DISABLE; -} - -void CRegameDLLRuntimeConfig::parseFromConfigFile() -{ -#ifdef _WIN32 - - if (strlen(testConfigFileName) <= 0) - return; - - std::string str; - std::string path( bIsZero ? "./czero/server.cfg" : "./cstrike/server.cfg" ); - std::string pattern = "exec tests/"; - - std::ifstream intput_file( path ); - std::vector< std::string > out; - - bool bFound = false; - while (std::getline(intput_file, str)) - { - if (str.find( pattern ) != -1) - { - bFound = true; - - std::ostringstream stringStream; - stringStream << pattern << testConfigFileName; - str = stringStream.str(); - } - - out.push_back( str.c_str() ); - } - - if (!bFound) - { - std::ostringstream stringStream; - stringStream << "\n" << pattern << testConfigFileName; - - out.push_back( stringStream.str() ); - } - - intput_file.close(); - - std::ofstream output_file( path ); - std::ostream_iterator< std::string > output_iterator(output_file, "\n"); - std::copy(out.begin(), out.end(), output_iterator); - - out.clear(); - output_file.close(); - -#endif // _WIN32 -} - -void CRegameDLLRuntimeConfig::parseFromCommandLine(const char *cmdLine) -{ - char localBuf[2048]; - if (strlen(cmdLine) >= sizeof(localBuf)) - regamedll_syserror("%s: too long cmdline", __FUNCTION__); - - strcpy(localBuf, cmdLine); - char *cpos = localBuf; - - getNextToken(&cpos); //skip executable path - - const char *token = getNextToken(&cpos); - while (token != NULL) - { - if (!strcmp(token, "--regamedll-test-record")) - { - const char *fname = getNextToken(&cpos); - - if (fname == NULL) - regamedll_syserror("%s: usage: --regamedll-test-record ", __FUNCTION__); - - strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); - testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; - testPlayerMode = TPM_RECORD; - } - else if (!strcmp(token, "--regamedll-test-play")) - { - const char *fname = getNextToken(&cpos); - - if (fname == NULL) - regamedll_syserror("%s: usage: --regamedll-test-play ", __FUNCTION__); - - strncpy(testRecordingFileName, fname, sizeof(testRecordingFileName)); - testRecordingFileName[sizeof(testRecordingFileName) - 1] = 0; - testPlayerMode = TPM_PLAY; - } - else if (!strcmp(token, "--regamedll-cfg-init")) - { - const char *fname = getNextToken(&cpos); - - if (fname != NULL) - { - strncpy(testConfigFileName, fname, sizeof(testConfigFileName)); - testConfigFileName[sizeof(testConfigFileName) - 1] = 0; - } - } - else if (!strcmp(token, "--regamedll-disable-all-hooks")) - { - disableAllHooks = true; - } - else if (!strcmp(token, "-game")) - { - const char *szTokenGame = getNextToken(&cpos); - - if (szTokenGame != NULL && !strcmp(szTokenGame, "czero")) - bIsZero = true; - } - - token = getNextToken(&cpos); - } - - // parse config filename for testdemo - parseFromConfigFile(); -} - -const char *CRegameDLLRuntimeConfig::getNextToken(char* *pBuf) -{ - char *rpos = *pBuf; - if (*rpos == 0) - return NULL; - - //skip spaces at the beginning - while (*rpos != 0 && isspace(*rpos)) - rpos++; - - if (*rpos == 0) { - *pBuf = rpos; - return NULL; - } - - const char *res = rpos; - char *wpos = rpos; - char inQuote = 0; - while (*rpos != 0) - { - char cc = *rpos; - if (inQuote) - { - if (inQuote == cc) - { - inQuote = 0; - rpos++; - } - else - { - if (rpos != wpos) *wpos = cc; - rpos++; wpos++; - } - } - else - { - if (isspace(cc)) - { - break; - } - else if (cc == '\'' || cc == '"') - { - inQuote = cc; - rpos++; - } - else - { - if (rpos != wpos) - *wpos = cc; - rpos++; wpos++; - } - } - } - if (*rpos != 0) - { - rpos++; - } - - *pBuf = rpos; - *wpos = 0; - return res; -} diff --git a/regamedll/regamedll/RegameDLLRuntimeConfig.h b/regamedll/regamedll/RegameDLLRuntimeConfig.h deleted file mode 100644 index 05bb9640..00000000 --- a/regamedll/regamedll/RegameDLLRuntimeConfig.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -enum TestPlayerMode -{ - TPM_DISABLE, - TPM_RECORD, - TPM_PLAY, -}; - -class CRegameDLLRuntimeConfig -{ -private: - static const char *getNextToken(char **pBuf); -public: - CRegameDLLRuntimeConfig(); - - bool bIsZero; - bool disableAllHooks; - char testRecordingFileName[260]; - char testConfigFileName[260]; - TestPlayerMode testPlayerMode; - - void parseFromConfigFile(); - void parseFromCommandLine(const char *cmdLine); -}; - -extern CRegameDLLRuntimeConfig g_ReGameDLLRuntimeConfig; diff --git a/regamedll/regamedll/dlls.h b/regamedll/regamedll/dlls.h index 973f1e12..49a0e0ed 100644 --- a/regamedll/regamedll/dlls.h +++ b/regamedll/regamedll/dlls.h @@ -26,7 +26,6 @@ * */ -#include "mathlib.h" #include "extdll.h" // declared virtual function's and globals for hooks @@ -109,6 +108,7 @@ #include "game_shared/bot/simple_state_machine.h" #include "game_shared/steam_util.h" +#include "game_shared/perf_counter.h" #include "game_shared/bot/bot_manager.h" #include "game_shared/bot/bot_constants.h" @@ -158,4 +158,9 @@ #include "spectator.h" #include "talkmonster.h" #include "animation.h" + +#include "com_model.h" +#include "studio.h" +#include "r_studioint.h" + #include "shake.h" diff --git a/regamedll/hookers/engine.h b/regamedll/regamedll/engine.h similarity index 97% rename from regamedll/hookers/engine.h rename to regamedll/regamedll/engine.h index 42c693c7..319c0a16 100644 --- a/regamedll/hookers/engine.h +++ b/regamedll/regamedll/engine.h @@ -1,31 +1,31 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "common.h" -#include "cmd.h" -#include "unicode_strtools.h" +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ + +#include "common.h" +#include "cmd.h" +#include "unicode_strtools.h" diff --git a/regamedll/regamedll/hookchains_impl.h b/regamedll/regamedll/hookchains_impl.h index 701eca33..bf3b0c6c 100644 --- a/regamedll/regamedll/hookchains_impl.h +++ b/regamedll/regamedll/hookchains_impl.h @@ -28,7 +28,7 @@ #pragma once #include "hookchains.h" -#define MAX_HOOKS_IN_CHAIN 64 +#define MAX_HOOKS_IN_CHAIN 19 // Implementation for chains in modules template diff --git a/regamedll/regamedll/mem.cpp b/regamedll/regamedll/mem.cpp deleted file mode 100644 index e6a54ea6..00000000 --- a/regamedll/regamedll/mem.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "precompiled.h" - -#ifdef _WIN32 - -void *_malloc_mhook_(size_t n) -{ - void *ptr = malloc(n); - Regamedll_Debug_logAlloc(n, ptr); - return ptr; -} - -void *_realloc_mhook_(void *memblock, size_t size) -{ - void *ptr = realloc(memblock, size); - Regamedll_Debug_logRealloc(size, memblock, ptr); - return ptr; -} - -void _free_mhook_(void *p) -{ - Regamedll_Debug_logFree(p); - free(p); -} - -void *_calloc_mhook_(size_t n, size_t s) -{ - void *ptr = calloc(n, s); - Regamedll_Debug_logAlloc(s * n, ptr); - return ptr; -} - -void *__nh_malloc_mhook_(size_t n) -{ - void *ptr = malloc(n); - Regamedll_Debug_logAlloc(n, ptr); - return ptr; -} - -char *_strdup_mhook_(const char *s) -{ - char *ptr = _strdup(s); - Regamedll_Debug_logStrDup(s, ptr); - return ptr; -} - -int __cdecl _rand_mhook_() -{ - return CRegamedllPlatformHolder::get()->rand(); -} - -#endif // _WIN32 diff --git a/regamedll/regamedll/mem.h b/regamedll/regamedll/mem.h deleted file mode 100644 index 6235542b..00000000 --- a/regamedll/regamedll/mem.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef MEM_H -#define MEM_H -#ifdef _WIN32 -#pragma once -#endif - -#ifdef _WIN32 - -void *_malloc_mhook_(size_t n); -void *_realloc_mhook_(void *memblock, size_t size); -void _free_mhook_(void *p); -void *_calloc_mhook_(size_t n, size_t s); -void *__nh_malloc_mhook_(size_t n); -char *_strdup_mhook_(const char *s); -int __cdecl _rand_mhook_(); - -#endif // _WIN32 - -#endif // MEM_H \ No newline at end of file diff --git a/regamedll/regamedll/platform.cpp b/regamedll/regamedll/platform.cpp index f9cab949..08737e90 100644 --- a/regamedll/regamedll/platform.cpp +++ b/regamedll/regamedll/platform.cpp @@ -1,7 +1,5 @@ #include "precompiled.h" -IReGameDLLPlatform *CRegamedllPlatformHolder::m_Platform; - void regamedll_log(const char *fmt, ...) { va_list argptr; @@ -44,237 +42,7 @@ void __declspec(noreturn) regamedll_syserror(const char *fmt, ...) fprintf(fl, "%s\n", string); fclose(fl); -#if defined(HOOK_GAMEDLL) && defined(_WIN32) - printf2(__FUNCTION__ ":: demo failed"); -#endif // _WIN32 - //TerminateProcess(GetCurrentProcess(), 1); *((int *)NULL) = 0; while (true); } - -IReGameDLLPlatform *CRegamedllPlatformHolder::get() -{ - if (m_Platform == NULL) - { - m_Platform = new CSimplePlatform(); - } - return m_Platform; -} - -void CRegamedllPlatformHolder::set(IReGameDLLPlatform *p) -{ - m_Platform = p; -} - -CSimplePlatform::CSimplePlatform() -{ -#ifdef _WIN32 - HMODULE wsock = LoadLibraryA("wsock32.dll"); - setsockopt_v11 = (setsockopt_proto)GetProcAddress(wsock, "setsockopt"); - if (setsockopt_v11 == NULL) - regamedll_syserror("%s: setsockopt_v11 not found", __FUNCTION__); -#endif // _WIN32 -} - -uint32_t CSimplePlatform::time(uint32_t *pTime) -{ - time_t res = ::time((time_t*)NULL); - if (pTime != NULL) *pTime = (uint32_t)res; - - return (uint32_t) res; -} - -struct tm *CSimplePlatform::localtime(uint32_t time) -{ - time_t theTime = (time_t)time; - return ::localtime(&theTime); -} - -void CSimplePlatform::srand(uint32_t seed) -{ - return ::srand(seed); -} - -int CSimplePlatform::rand() -{ - return ::rand(); -} - -#ifdef _WIN32 -void CSimplePlatform::Sleep(DWORD msec) -{ - ::Sleep(msec); -} - -BOOL CSimplePlatform::QueryPerfCounter(LARGE_INTEGER *counter) -{ - return ::QueryPerformanceCounter(counter); -} - -BOOL CSimplePlatform::QueryPerfFreq(LARGE_INTEGER *freq) -{ - return ::QueryPerformanceFrequency(freq); -} - -DWORD CSimplePlatform::GetTickCount() -{ - return ::GetTickCount(); -} - -void CSimplePlatform::GetLocalTime(LPSYSTEMTIME time) -{ - return ::GetLocalTime(time); -} - -void CSimplePlatform::GetSystemTime(LPSYSTEMTIME time) -{ - return ::GetSystemTime(time); -} - -void CSimplePlatform::GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo) -{ - ::GetTimeZoneInformation(zinfo); -} - -BOOL CSimplePlatform::GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime) -{ - return ::GetProcessTimes(hProcess, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime); -} - -void CSimplePlatform::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) -{ - ::GetSystemTimeAsFileTime(lpSystemTimeAsFileTime); -} -#endif //WIN32 - -SOCKET CSimplePlatform::socket(int af, int type, int protocol) -{ - return ::socket(af, type, protocol); -} - -int CSimplePlatform::setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen) -{ -#ifdef _WIN32 - return setsockopt_v11(s, level, optname, optval, optlen); -#else - return setsockopt(s, level, optname, optval, optlen); -#endif -} - -int CSimplePlatform::closesocket(SOCKET s) -{ -#ifdef _WIN32 - return ::closesocket(s); -#else - return ::close(s); -#endif -} - -int CSimplePlatform::recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from, socklen_t *fromlen) -{ - return ::recvfrom(s, buf, len, flags, from, fromlen); -} - -int CSimplePlatform::sendto(SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen) -{ - return ::sendto(s, buf, len, flags, to, tolen); -} - -int CSimplePlatform::bind(SOCKET s, const struct sockaddr *addr, int namelen) -{ - return ::bind(s, addr, namelen); -} - -int CSimplePlatform::getsockname(SOCKET s, struct sockaddr *name, socklen_t *namelen) -{ - return ::getsockname(s, name, namelen); -} - -struct hostent *CSimplePlatform::gethostbyname(const char *name) -{ - return ::gethostbyname(name); -} - -int CSimplePlatform::gethostname(char *name, int namelen) -{ - return ::gethostname(name, namelen); -} - -#ifdef _WIN32 - -int CSimplePlatform::ioctlsocket(SOCKET s, long cmd, u_long *argp) -{ - return ::ioctlsocket(s, cmd, argp); -} - -int CSimplePlatform::WSAGetLastError() -{ - return ::WSAGetLastError(); -} - -#endif //WIN32 - -void CSimplePlatform::SteamAPI_SetBreakpadAppID(uint32 unAppID) -{ - return ::SteamAPI_SetBreakpadAppID(unAppID); -} - -void CSimplePlatform::SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback) -{ - ::SteamAPI_UseBreakpadCrashHandler(pchVersion, pchDate, pchTime, bFullMemoryDumps, pvContext, m_pfnPreMinidumpCallback); -} - -void CSimplePlatform::SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback) -{ - ::SteamAPI_RegisterCallback(pCallback, iCallback); -} - -bool CSimplePlatform::SteamAPI_Init() -{ - //return false; - return ::SteamAPI_Init(); -} - -void CSimplePlatform::SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) -{ - return ::SteamAPI_UnregisterCallResult(pCallback, hAPICall); -} - -ISteamApps *CSimplePlatform::SteamApps() -{ - //return NULL; - return ::SteamApps(); -} - -bool CSimplePlatform::SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) -{ - //return false; - return ::SteamGameServer_Init(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString); -} - -ISteamGameServer *CSimplePlatform::SteamGameServer() -{ - //return NULL; - return ::SteamGameServer(); -} - -void CSimplePlatform::SteamGameServer_RunCallbacks() -{ - ::SteamGameServer_RunCallbacks(); -} - -void CSimplePlatform::SteamAPI_RunCallbacks() -{ - ::SteamAPI_RunCallbacks(); -} - -void CSimplePlatform::SteamGameServer_Shutdown() -{ - ::SteamGameServer_Shutdown(); -} - -void CSimplePlatform::SteamAPI_UnregisterCallback(CCallbackBase *pCallback) -{ - ::SteamAPI_UnregisterCallback(pCallback); -} diff --git a/regamedll/regamedll/platform.h b/regamedll/regamedll/platform.h index dd9775b6..b99e47d6 100644 --- a/regamedll/regamedll/platform.h +++ b/regamedll/regamedll/platform.h @@ -6,126 +6,7 @@ #define _logf regamedll_log -#include "osconfig.h" -#include "steam/steam_api.h" -#include "steam/steam_gameserver.h" - -#ifdef _WIN32 -typedef int(__stdcall *setsockopt_proto)(SOCKET s, int level, int optname, const char *optval, int optlen); -#endif - -class IReGameDLLPlatform -{ -public: - virtual uint32_t time(uint32_t *pTime) = 0; - virtual struct tm *localtime(uint32_t time) = 0; - virtual void srand(uint32_t seed) = 0; - virtual int rand() = 0; - -#ifdef _WIN32 - virtual void Sleep(DWORD msec) = 0; - virtual BOOL QueryPerfCounter(LARGE_INTEGER *counter) = 0; - virtual BOOL QueryPerfFreq(LARGE_INTEGER *freq) = 0; - virtual DWORD GetTickCount() = 0; - virtual void GetLocalTime(LPSYSTEMTIME time) = 0; - virtual void GetSystemTime(LPSYSTEMTIME time) = 0; - virtual void GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo) = 0; - virtual BOOL GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime) = 0; - virtual void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) = 0; -#endif - - virtual SOCKET socket(int af, int type, int protocol) = 0; - virtual int setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen) = 0; - virtual int closesocket(SOCKET s) = 0; - virtual int recvfrom(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, socklen_t *fromlen) = 0; - virtual int sendto(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen) = 0; - virtual int bind(SOCKET s, const struct sockaddr* addr, int namelen) = 0; - virtual int getsockname(SOCKET s, struct sockaddr* name, socklen_t* namelen) = 0; - virtual struct hostent* gethostbyname(const char *name) = 0; - virtual int gethostname(char *name, int namelen) = 0; - -#ifdef _WIN32 - virtual int ioctlsocket(SOCKET s, long cmd, u_long *argp) = 0; - virtual int WSAGetLastError() = 0; -#endif - - virtual void SteamAPI_SetBreakpadAppID(uint32 unAppID) = 0; - virtual void SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback) = 0; - virtual void SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback) = 0; - virtual bool SteamAPI_Init() = 0; - virtual void SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) = 0; - virtual ISteamApps* SteamApps() = 0; - virtual bool SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) = 0; - virtual ISteamGameServer* SteamGameServer() = 0; - virtual void SteamGameServer_RunCallbacks() = 0; - virtual void SteamAPI_RunCallbacks() = 0; - virtual void SteamGameServer_Shutdown() = 0; - virtual void SteamAPI_UnregisterCallback(CCallbackBase *pCallback) = 0; -}; - -class CSimplePlatform : public IReGameDLLPlatform -{ -private: -#ifdef _WIN32 - setsockopt_proto setsockopt_v11; -#endif - -public: - CSimplePlatform(); - - virtual uint32_t time(uint32_t *pTime); - virtual struct tm *localtime(uint32_t time); - virtual void srand(uint32_t seed); - virtual int rand(); - -#ifdef _WIN32 - virtual void Sleep(DWORD msec); - virtual BOOL QueryPerfCounter(LARGE_INTEGER *counter); - virtual BOOL QueryPerfFreq(LARGE_INTEGER *freq); - virtual DWORD GetTickCount(); - virtual void GetLocalTime(LPSYSTEMTIME time); - virtual void GetSystemTime(LPSYSTEMTIME time); - virtual void GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo); - virtual BOOL GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime); - virtual void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); -#endif - - virtual SOCKET socket(int af, int type, int protocol); - virtual int setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen); - virtual int closesocket(SOCKET s); - virtual int recvfrom(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, socklen_t *fromlen); - virtual int sendto(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen); - virtual int bind(SOCKET s, const struct sockaddr* addr, int namelen); - virtual int getsockname(SOCKET s, struct sockaddr* name, socklen_t* namelen); - virtual struct hostent* gethostbyname(const char *name); - virtual int gethostname(char *name, int namelen); - -#ifdef _WIN32 - virtual int ioctlsocket(SOCKET s, long cmd, u_long *argp); - virtual int WSAGetLastError(); -#endif - - virtual void SteamAPI_SetBreakpadAppID(uint32 unAppID); - virtual void SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback); - virtual void SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback); - virtual bool SteamAPI_Init(); - virtual void SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall); - virtual ISteamApps* SteamApps(); - virtual bool SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString); - virtual ISteamGameServer* SteamGameServer(); - virtual void SteamGameServer_RunCallbacks(); - virtual void SteamAPI_RunCallbacks(); - virtual void SteamGameServer_Shutdown(); - virtual void SteamAPI_UnregisterCallback(CCallbackBase *pCallback); -}; - -class CRegamedllPlatformHolder -{ -private: - static IReGameDLLPlatform *m_Platform; -public: - static IReGameDLLPlatform *get(); - static void set(IReGameDLLPlatform *p); -}; +extern void regamedll_log(const char *fmt, ...); +extern void __declspec(noreturn) regamedll_syserror(const char *fmt, ...); #endif // PLATFORM_GAMEDLL_H \ No newline at end of file diff --git a/regamedll/regamedll/precompiled.h b/regamedll/regamedll/precompiled.h index f0819824..0b751beb 100644 --- a/regamedll/regamedll/precompiled.h +++ b/regamedll/regamedll/precompiled.h @@ -2,20 +2,18 @@ #include "version/appversion.h" -#include "mem.h" -#include "platform.h" #include "osconfig.h" #include "sse_mathfun.h" -#include "memory.h" -#include "RegameDLLRuntimeConfig.h" -#include "regamedll_debug.h" - #include "MemPool.h" #include "engine.h" +#include "platform.h" +#include "regamedll_debug.h" #ifdef HOOK_GAMEDLL +#include "memory.h" #include "hooker.h" +#include "RegameDLLRuntimeConfig.h" // STL containers Visual Studio 6.0 #include "stl/vector" @@ -31,13 +29,8 @@ #include "interface.h" -//testsuite -#include "testsuite/testsuite.h" -#include "testsuite/funccalls.h" -#include "testsuite/recorder.h" -#include "testsuite/demoplayer.h" - #include "hookchains_impl.h" +#include "regamedll.h" #include "regamedll_interfaces.h" #include "regamedll_interfaces_impl.h" #include "regamedll_api.h" diff --git a/regamedll/regamedll/regamedll.cpp b/regamedll/regamedll/regamedll.cpp new file mode 100644 index 00000000..009b1d50 --- /dev/null +++ b/regamedll/regamedll/regamedll.cpp @@ -0,0 +1,9 @@ +#include "precompiled.h" + +void Regamedll_Game_Init() +{ + g_bIsCzeroGame = UTIL_IsGame("czero"); + g_bAllowedCSBot = UTIL_AreBotsAllowed(); // determine whether bots can be used or not + g_bHostageImprov = UTIL_AreHostagesImprov(); // determine whether hostage improv can be used or not + +} diff --git a/regamedll/regamedll/regamedll.h b/regamedll/regamedll/regamedll.h new file mode 100644 index 00000000..fa39c931 --- /dev/null +++ b/regamedll/regamedll/regamedll.h @@ -0,0 +1,3 @@ +#pragma once + +extern void Regamedll_Game_Init(); diff --git a/regamedll/regamedll/regamedll_debug.cpp b/regamedll/regamedll/regamedll_debug.cpp new file mode 100644 index 00000000..9d9c82bd --- /dev/null +++ b/regamedll/regamedll/regamedll_debug.cpp @@ -0,0 +1,57 @@ +#include "precompiled.h" + +void _print_chat(class CBasePlayer *pPlayer, const char *fmt, ...) +{ + static char Dest[4096]; + + va_list ap; + va_start(ap, fmt); + vsnprintf(Dest, sizeof(Dest), fmt, ap); + va_end(ap); + + if (Q_strlen(Dest) < sizeof(Dest) - 2) + Q_strcat(Dest, "\n"); + + else Dest[Q_strlen(Dest) - 1] = '\n'; + + UTIL_SayText(Dest, (class CBaseEntity *)pPlayer); +} + +void _print_console(struct entvars_s *pev, const char *fmt, ...) +{ + static char Dest[4096]; + + va_list ap; + va_start(ap, fmt); + vsnprintf(Dest, sizeof(Dest), fmt, ap); + va_end(ap); + + if (Q_strlen(Dest) < sizeof(Dest) - 2) + Q_strcat(Dest, "\n"); + + else Dest[Q_strlen(Dest) - 1] = '\n'; + + ClientPrint(pev, HUD_PRINTCONSOLE, Dest); +} + +void _printf2(const char *fmt, ...) +{ + /* + * check is null, test the demo started before than searches pointer to refs + */ + if (&g_engfuncs == NULL || g_engfuncs.pfnServerPrint == NULL) + return; + + static char Dest[4096]; + va_list ap; + va_start(ap, fmt); + vsnprintf(Dest, sizeof(Dest), fmt, ap); + va_end(ap); + + if (Q_strlen(Dest) < sizeof(Dest) - 2) + Q_strcat(Dest, "\n"); + + else Dest[Q_strlen(Dest) - 1] = '\n'; + + SERVER_PRINT(Dest); +} diff --git a/regamedll/regamedll/regamedll_debug.h b/regamedll/regamedll/regamedll_debug.h new file mode 100644 index 00000000..58a870ec --- /dev/null +++ b/regamedll/regamedll/regamedll_debug.h @@ -0,0 +1,7 @@ +#pragma once + +#define _logf regamedll_log + +extern void _printf2(const char *fmt, ...); +extern void _print_chat(class CBasePlayer *pPlayer, const char *fmt, ...); +extern void _print_console(struct entvars_s *pev, const char *fmt, ...); diff --git a/regamedll/testsuite/demoplayer.cpp b/regamedll/testsuite/demoplayer.cpp deleted file mode 100644 index 73a200ee..00000000 --- a/regamedll/testsuite/demoplayer.cpp +++ /dev/null @@ -1,1100 +0,0 @@ -#include "precompiled.h" - -CPlayingEngExtInterceptor::CPlayingEngExtInterceptor(const char* fname, bool strictChecks) -{ - for (int i = 0; i < TESTPLAYER_FUNCTREE_DEPTH; i++) - { - m_FuncCalls[i] = &m_FuncCallBuffer[i * TESTPLAYER_FUNCCALL_MAXSIZE]; - m_FuncCallsFree[i] = true; - } - - m_InStream.exceptions(std::ios::badbit | std::ios::failbit | std::ios::eofbit); - m_InStream.open(fname, std::ios::in | std::ios::binary); - - m_InStream.seekg(0, std::ios_base::end); - m_inStreamSize = m_InStream.tellg(); - m_InStream.seekg(0, std::ios_base::beg); - m_bLastRead = false; - - m_bStrictChecks = strictChecks; - - m_ServerSocket = INVALID_SOCKET; - m_SteamCallbacksCounter = 0; - m_SteamAppsWrapper = NULL; - m_GameServerWrapper = NULL; - m_SteamBreakpadContext = NULL; - - m_HeartBeatInterval = 10000000; - m_PrevHeartBeat = 0; - - uint32 cmdlineLen = 0; - char cmdLine[2048]; - - uint16 versionMajor = 0; - uint16 versionMinor = 0; - - m_InStream.read((char*)&versionMinor, 2).read((char*)&versionMajor, 2); - - if (versionMajor != TESTSUITE_PROTOCOL_VERSION_MAJOR) { - regamedll_syserror("%s: protocol major version mismatch; need %d, got %d", __FUNCTION__, TESTSUITE_PROTOCOL_VERSION_MAJOR, versionMajor); - } - - if (versionMinor > TESTSUITE_PROTOCOL_VERSION_MINOR) { - regamedll_syserror("%s: protocol minor version mismatch; need <= %d, got %d", __FUNCTION__, TESTSUITE_PROTOCOL_VERSION_MINOR, versionMinor); - } - - m_InStream.read((char*)&cmdlineLen, 4); - if (cmdlineLen > sizeof(cmdLine)) { - regamedll_syserror("%s: too long cmdline", __FUNCTION__); - } - - m_InStream.read(cmdLine, cmdlineLen); - printf("Playing testsuite\nrecorders's cmdline: %s\n", cmdLine); - - m_StartTick = ::GetTickCount(); - m_NumFrames = 0; -} - -void* CPlayingEngExtInterceptor::allocFuncCall() -{ - for (int i = 0; i < TESTPLAYER_FUNCTREE_DEPTH; i++) - { - if (m_FuncCallsFree[i]) - { - m_FuncCallsFree[i] = false; - return m_FuncCalls[i]; - } - } - - regamedll_syserror("%s: running out of free slots", __FUNCTION__); - return NULL; -} - -void CPlayingEngExtInterceptor::freeFuncCall(void* fcall) -{ - for (int i = 0; i < TESTPLAYER_FUNCTREE_DEPTH; i++) - { - if (m_FuncCalls[i] == fcall) - { - m_FuncCallsFree[i] = true; - return; - } - } - - regamedll_syserror("%s: invalid pointer provided: %p", __FUNCTION__, fcall); -} - -bool CPlayingEngExtInterceptor::readFuncCall() { - if (m_InStream.tellg() >= m_inStreamSize) - { - if (m_bLastRead) return false; - - m_bLastRead = true; - IEngExtCall* callFunc = new(allocFuncCall()) CEndRecordCall(); - m_CommandsQueue.push(callFunc); - return true; - } - - uint16 opc; - m_InStream.read((char*)&opc, 2); - - bool startFlag = (opc & (1 << 15)) != 0; - bool endFlag = (opc & (1 << 14)) != 0; - opc &= 0x3FFF; - - if (startFlag) - { - IEngExtCall* callFunc = IEngExtCallFactory::createByOpcode((ExtCallFuncs)opc, allocFuncCall(), TESTPLAYER_FUNCCALL_MAXSIZE); - callFunc->readPrologue(m_InStream); - m_CommandsQueue.push(callFunc); - callFunc->m_Start = true; - } - - if (endFlag) - { - IEngExtCall* callFunc = IEngExtCallFactory::createByOpcode((ExtCallFuncs)opc, allocFuncCall(), TESTPLAYER_FUNCCALL_MAXSIZE); - callFunc->readEpilogue(m_InStream); - m_CommandsQueue.push(callFunc); - callFunc->m_End = true; - } - - return true; -} - -IEngExtCall* CPlayingEngExtInterceptor::getNextCallInternal(bool peek) { - if (m_CommandsQueue.empty()) { - readFuncCall(); - } - - if (m_CommandsQueue.empty()) { - regamedll_syserror("%s: command queue is empty!", __FUNCTION__); - } - - IEngExtCall* next = m_CommandsQueue.front(); - if (!peek) { - m_CommandsQueue.pop(); - } - - return next; -} - -IEngExtCall* CPlayingEngExtInterceptor::getNextCall(bool peek, bool processCallbacks, ExtCallFuncs expectedOpcode, bool needStart, const char* callSource) { - int size = (int)m_InStream.tellg(); - int sizeLeft = m_inStreamSize - size; - maybeHeartBeat(size); - IEngExtCall* cmd = getNextCallInternal(peek); - if (peek) { - return cmd; - } - - if (cmd->getOpcode() == ECF_NONE) { - DWORD endTick = ::GetTickCount(); - FILE* fl = fopen("regamedll_demo_stats.xml", "w"); - if (fl) { - fprintf(fl, "\n"); - fprintf(fl, "\n"); - fprintf(fl, " %u\n", (endTick - m_StartTick)); - fprintf(fl, " %u\n", m_NumFrames); - fprintf(fl, "\n"); - fclose(fl); - } - TerminateProcess(GetCurrentProcess(), 777); - } - - IEngCallbackCall* callback = dynamic_cast(cmd); - if (callback != NULL && callback->m_Start) { - if (!processCallbacks) { - regamedll_syserror("%s: read a callback, but it's not allowed here", __FUNCTION__); - return NULL; - } - - while (callback != NULL && callback->m_Start) { - playCallback(callback); - cmd = getNextCallInternal(false); - callback = (IEngCallbackCall*)cmd; - } - } - - if (cmd->getOpcode() != expectedOpcode) { - regamedll_syserror("%s: bad opcode; expected %d got %d; size left: %d", __FUNCTION__, expectedOpcode, cmd->getOpcode(), sizeLeft); - } - if (needStart) { - if (!cmd->m_Start) regamedll_syserror("%s: bad fcall %d; expected start flag", __FUNCTION__, cmd->getOpcode()); - } - else { - if (!cmd->m_End) regamedll_syserror("%s: bad fcall %d; expected end flag", __FUNCTION__, cmd->getOpcode()); - } - - return cmd; -} - -void CPlayingEngExtInterceptor::playCallback(IEngCallbackCall* cb) { - switch (cb->getOpcode()) { - - case ECF_STEAM_CALLBACK_CALL_1: - playSteamCallback1((CSteamCallbackCall1*)cb); - return; - - case ECF_STEAM_CALLBACK_CALL_2: - playSteamCallback2((CSteamCallbackCall2*)cb); - return; - - default: - regamedll_syserror("%s: unknown callback", __FUNCTION__); - } -} - -void CPlayingEngExtInterceptor::playSteamCallback1(CSteamCallbackCall1* cb) { - auto itr = m_SteamCallbacks.find(cb->m_CallbackId); - if (itr == m_SteamCallbacks.end()) regamedll_syserror("%s: callback %d not found", __FUNCTION__, cb->m_CallbackId); - CCallbackBase* steamCallback = (*itr).second; - - if (steamCallback->GetFlags() != cb->m_InState.m_nCallbackFlags) regamedll_syserror("%s: PRE flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != cb->m_InState.m_iCallback) regamedll_syserror("%s: PRE flags desync", __FUNCTION__); - - steamCallback->Run(cb->m_Data); - - CSteamCallbackCall1* endCallback = (CSteamCallbackCall1*)getNextCall(false, true, cb->getOpcode(), false, __FUNCTION__); - - if (steamCallback->GetFlags() != endCallback->m_OutState.m_nCallbackFlags) regamedll_syserror("%s: POST flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != endCallback->m_OutState.m_iCallback) regamedll_syserror("%s: POST flags desync", __FUNCTION__); - freeFuncCall(cb); - freeFuncCall(endCallback); -} - -void CPlayingEngExtInterceptor::playSteamCallback2(CSteamCallbackCall2* cb) { - auto itr = m_SteamCallbacks.find(cb->m_CallbackId); - if (itr == m_SteamCallbacks.end()) regamedll_syserror("%s: callback %d not found", __FUNCTION__, cb->m_CallbackId); - CCallbackBase* steamCallback = (*itr).second; - - if (steamCallback->GetFlags() != cb->m_InState.m_nCallbackFlags) regamedll_syserror("%s: PRE flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != cb->m_InState.m_iCallback) regamedll_syserror("%s: PRE flags desync", __FUNCTION__); - - steamCallback->Run(cb->m_Data, cb->m_bIOFailure, cb->m_SteamAPICall); - - CSteamCallbackCall2* endCallback = (CSteamCallbackCall2*)getNextCall(false, true, cb->getOpcode(), false, __FUNCTION__); - - if (steamCallback->GetFlags() != endCallback->m_OutState.m_nCallbackFlags) regamedll_syserror("%s: POST flags desync", __FUNCTION__); - if (steamCallback->GetICallback() != endCallback->m_OutState.m_iCallback) regamedll_syserror("%s: POST flags desync", __FUNCTION__); - freeFuncCall(cb); - freeFuncCall(endCallback); -} - -int CPlayingEngExtInterceptor::getOrRegisterSteamCallback(CCallbackBase* cb) { - auto itr = m_SteamCallbacksReverse.find(cb); - if (itr != m_SteamCallbacksReverse.end()) { - return (*itr).second; - } - - int id = m_SteamCallbacksCounter++; - m_SteamCallbacksReverse[cb] = id; - m_SteamCallbacks[id] = cb; - - return id; -} - -void CPlayingEngExtInterceptor::maybeHeartBeat(int readPos) { - if (m_PrevHeartBeat + m_HeartBeatInterval <= readPos) { - m_PrevHeartBeat = readPos; - printf2("%s: readPos=%u\n", __FUNCTION__, readPos); - } -} - -uint32 CPlayingEngExtInterceptor::time(uint32* pTime) -{ - CStdTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_TIME, true, __FUNCTION__)); - CStdTimeCall(pTime).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CStdTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_TIME, false, __FUNCTION__)); - - uint32 res = playEndCall->m_Res; - if (pTime != NULL) *pTime = res; - - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -struct tm* CPlayingEngExtInterceptor::localtime(uint32 time) -{ - CStdLocalTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_LOCALTIME, true, __FUNCTION__)); - CStdLocalTimeCall(time).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CStdLocalTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_LOCALTIME, false, __FUNCTION__)); - - setCurrentTm(&playEndCall->m_Res); - - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return &m_CurrentTm; -} - -void CPlayingEngExtInterceptor::srand(uint32 seed) -{ - CStdSrandCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_SRAND_CALL, true, __FUNCTION__)); - CStdSrandCall(seed).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CStdSrandCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_SRAND_CALL, false, __FUNCTION__)); - - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -int CPlayingEngExtInterceptor::rand() -{ - CStdRandCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_RAND_CALL, true, __FUNCTION__)); - CStdRandCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_RAND_CALL, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -void CPlayingEngExtInterceptor::Sleep(DWORD msec) { - CSleepExtCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SLEEP, true, __FUNCTION__)); - CSleepExtCall(msec).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSleepExtCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SLEEP, false, __FUNCTION__)); - - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -BOOL CPlayingEngExtInterceptor::QueryPerfCounter(LARGE_INTEGER* counter) { - CQueryPerfCounterCall* playCall = dynamic_cast(getNextCall(false, false, ECF_QUERY_PERF_COUNTER, true, __FUNCTION__)); - CQueryPerfCounterCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_QUERY_PERF_COUNTER, false, __FUNCTION__)); - - counter->QuadPart = playEndCall->m_Counter; - BOOL res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -BOOL CPlayingEngExtInterceptor::QueryPerfFreq(LARGE_INTEGER* freq) { - CQueryPerfFreqCall* playCall = dynamic_cast(getNextCall(false, false, ECF_QUERY_PERF_FREQ, true, __FUNCTION__)); - CQueryPerfFreqCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_QUERY_PERF_FREQ, false, __FUNCTION__)); - - freq->QuadPart = playEndCall->m_Freq; - BOOL res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -DWORD CPlayingEngExtInterceptor::GetTickCount() { - CGetTickCountCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_TICK_COUNT, true, __FUNCTION__)); - CGetTickCountCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_TICK_COUNT, false, __FUNCTION__)); - - DWORD res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -void CPlayingEngExtInterceptor::GetLocalTime(LPSYSTEMTIME time) { - CGetLocalTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_LOCAL_TIME, true, __FUNCTION__)); - CGetLocalTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_LOCAL_TIME, false, __FUNCTION__)); - - memcpy(time, &playEndCall->m_Res, sizeof(SYSTEMTIME)); - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -void CPlayingEngExtInterceptor::GetSystemTime(LPSYSTEMTIME time) { - CGetSystemTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SYSTEM_TIME, true, __FUNCTION__)); - CGetSystemTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SYSTEM_TIME, false, __FUNCTION__)); - - memcpy(time, &playEndCall->m_Res, sizeof(SYSTEMTIME)); - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -void CPlayingEngExtInterceptor::GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo) { - CGetTimeZoneInfoCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_TIMEZONE_INFO, true, __FUNCTION__)); - CGetTimeZoneInfoCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_TIMEZONE_INFO, false, __FUNCTION__)); - - memcpy(zinfo, &playEndCall->m_Res, sizeof(TIME_ZONE_INFORMATION)); - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -BOOL CPlayingEngExtInterceptor::GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime) -{ - CGetProcessTimesCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_PROCESS_TIMES, true, __FUNCTION__)); - CGetProcessTimesCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_PROCESS_TIMES, false, __FUNCTION__)); - - BOOL res = playEndCall->m_Res; - memcpy(lpCreationTime, &playEndCall->m_CreationTime, sizeof(FILETIME)); - memcpy(lpExitTime, &playEndCall->m_ExitTime, sizeof(FILETIME)); - memcpy(lpKernelTime, &playEndCall->m_KernelTime, sizeof(FILETIME)); - memcpy(lpUserTime, &playEndCall->m_UserTime, sizeof(FILETIME)); - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -void CPlayingEngExtInterceptor::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) -{ - CGetSystemTimeAsFileTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SYSTEM_TIME_AS_FILE_TIME, true, __FUNCTION__)); - CGetSystemTimeAsFileTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SYSTEM_TIME_AS_FILE_TIME, false, __FUNCTION__)); - - memcpy(lpSystemTimeAsFileTime, &playEndCall->m_SystemTime, sizeof(FILETIME)); - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - - -SOCKET CPlayingEngExtInterceptor::socket(int af, int type, int protocol) { - CSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SOCKET, true, __FUNCTION__)); - CSocketCall(af, type, protocol).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SOCKET, false, __FUNCTION__)); - - SOCKET res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -int CPlayingEngExtInterceptor::ioctlsocket(SOCKET s, long cmd, u_long *argp) { - CIoCtlSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_IOCTL_SOCKET, true, __FUNCTION__)); - CIoCtlSocketCall(s, cmd, *argp).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CIoCtlSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_IOCTL_SOCKET, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - *argp = playEndCall->m_OutValue; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -int CPlayingEngExtInterceptor::setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen) { - CSetSockOptCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SET_SOCK_OPT, true, __FUNCTION__)); - CSetSockOptCall(s, level, optname, optval, optlen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSetSockOptCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SET_SOCK_OPT, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -int CPlayingEngExtInterceptor::closesocket(SOCKET s) { - CCloseSocketCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CLOSE_SOCKET, true, __FUNCTION__)); - CCloseSocketCall(s).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CCloseSocketCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CLOSE_SOCKET, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -int CPlayingEngExtInterceptor::recvfrom(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, socklen_t *fromlen) { - CRecvFromCall* playCall = dynamic_cast(getNextCall(false, false, ECF_RECVFROM, true, __FUNCTION__)); - CRecvFromCall(s, len, flags, *fromlen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CRecvFromCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_RECVFROM, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - *fromlen = playEndCall->m_FromLenOut; - if (res >= 0) { - memcpy(buf, playEndCall->m_Data, res); - memcpy(from, playEndCall->m_From, playEndCall->m_FromLenOut); - } - - freeFuncCall(playCall); freeFuncCall(playEndCall); - - if (res == -1) { - m_NumFrames++; - } - - return res; -} - -int CPlayingEngExtInterceptor::sendto(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen) { - CSendToCall* playCall = dynamic_cast(getNextCall(false, false, ECF_SENDTO, true, __FUNCTION__)); - CSendToCall(s, buf, len, flags, to, tolen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSendToCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_SENDTO, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -int CPlayingEngExtInterceptor::bind(SOCKET s, const struct sockaddr* addr, int namelen) { - CBindCall* playCall = dynamic_cast(getNextCall(false, false, ECF_BIND, true, __FUNCTION__)); - CBindCall(s, addr, namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CBindCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_BIND, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -int CPlayingEngExtInterceptor::getsockname(SOCKET s, struct sockaddr* name, socklen_t* namelen) { - CGetSockNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_SOCK_NAME, true, __FUNCTION__)); - CGetSockNameCall(s, *namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGetSockNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_SOCK_NAME, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - *namelen = playEndCall->m_AddrLenOut; - if (res >= 0) { - memcpy(name, playEndCall->m_Addr, playEndCall->m_AddrLenOut); - } - - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -int CPlayingEngExtInterceptor::WSAGetLastError() { - CWSAGetLastErrorCall* playCall = dynamic_cast(getNextCall(false, false, ECF_WSA_GET_LAST_ERROR, true, __FUNCTION__)); - CWSAGetLastErrorCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_WSA_GET_LAST_ERROR, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -struct hostent* CPlayingEngExtInterceptor::gethostbyname(const char *name) { - CGetHostByNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_HOST_BY_NAME, true, __FUNCTION__)); - CGetHostByNameCall(name).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGetHostByNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_HOST_BY_NAME, false, __FUNCTION__)); - - setCurrentHostent(&playEndCall->m_HostentData); - - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return &m_CurrentHostent; -} - -int CPlayingEngExtInterceptor::gethostname(char *name, int namelen) { - CGetHostNameCall* playCall = dynamic_cast(getNextCall(false, false, ECF_GET_HOST_NAME, true, __FUNCTION__)); - CGetHostNameCall(namelen).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGetHostNameCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_GET_HOST_NAME, false, __FUNCTION__)); - - int res = playEndCall->m_Res; - strcpy(name, playEndCall->m_Name); - - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -void CPlayingEngExtInterceptor::setCurrentHostent(hostent_data_t* data) { - memcpy(&m_CurrentHostentData, data, sizeof(m_CurrentHostentData)); - for (int i = 0; i < m_CurrentHostentData.numAliases; i++) { - m_CurrentHostentData.preparedAliases[i] = m_CurrentHostentData.aliases[i]; - m_CurrentHostentData.preparedAliases[i + 1] = NULL; - } - - for (int i = 0; i < m_CurrentHostentData.numAddrs; i++) { - m_CurrentHostentData.preparedAddrs[i] = m_CurrentHostentData.addrs[i]; - m_CurrentHostentData.preparedAddrs[i + 1] = NULL; - } - - m_CurrentHostent.h_addr_list = m_CurrentHostentData.preparedAddrs; - m_CurrentHostent.h_addrtype = m_CurrentHostentData.addrtype; - m_CurrentHostent.h_aliases = m_CurrentHostentData.preparedAliases; - m_CurrentHostent.h_length = m_CurrentHostentData.addrLen; - m_CurrentHostent.h_name = m_CurrentHostentData.hostName; -} - -void CPlayingEngExtInterceptor::setCurrentTm(struct tm* t) { - memcpy(&m_CurrentTm, t, sizeof(m_CurrentTm)); -} - -void CPlayingEngExtInterceptor::SteamAPI_SetBreakpadAppID(uint32 unAppID) { - CSteamApiSetBreakpadAppIdCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_SET_BREAKPAD_APP_ID, true, __FUNCTION__)); - CSteamApiSetBreakpadAppIdCall(unAppID).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiSetBreakpadAppIdCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_SET_BREAKPAD_APP_ID, false, __FUNCTION__)); - - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -void CPlayingEngExtInterceptor::SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback) { - //do nothing for now -} - -void CPlayingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback) { - int regamedllId = getOrRegisterSteamCallback(pCallback); - - CSteamApiRegisterCallbackCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_REGISTER_CALLBACK, true, __FUNCTION__)); - CSteamApiRegisterCallbackCall(regamedllId, iCallback, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiRegisterCallbackCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_REGISTER_CALLBACK, false, __FUNCTION__)); - - pCallback->SetFlags(playEndCall->m_OutState.m_nCallbackFlags); - pCallback->SetICallback(playEndCall->m_OutState.m_iCallback); - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -bool CPlayingEngExtInterceptor::SteamAPI_Init() { - CSteamApiInitCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_INIT, true, __FUNCTION__)); - CSteamApiInitCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_INIT, false, __FUNCTION__)); - - bool res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -void CPlayingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) { - int regamedllId = getOrRegisterSteamCallback(pCallback); - - CSteamApiUnrigestierCallResultCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_UNREGISTER_CALL_RESULT, true, __FUNCTION__)); - CSteamApiUnrigestierCallResultCall(regamedllId, hAPICall, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiUnrigestierCallResultCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_UNREGISTER_CALL_RESULT, false, __FUNCTION__)); - - pCallback->SetFlags(playEndCall->m_OutState.m_nCallbackFlags); - pCallback->SetICallback(playEndCall->m_OutState.m_iCallback); - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -ISteamApps* CPlayingEngExtInterceptor::SteamApps() { - CSteamAppsCall* playCall = (CSteamAppsCall*)getNextCall(false, false, ECF_STEAMAPPS, true, __FUNCTION__); - CSteamAppsCall* playEndCall = (CSteamAppsCall*)getNextCall(false, true, ECF_STEAMAPPS, false, __FUNCTION__); - - ISteamApps* res = NULL; - if (!playEndCall->m_ReturnNull) { - if (m_SteamAppsWrapper == NULL) m_SteamAppsWrapper = new CSteamAppsPlayingWrapper(this); - res = m_SteamAppsWrapper; - } - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -bool CPlayingEngExtInterceptor::SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) { - CSteamGameServerInitCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_INIT, true, __FUNCTION__)); - CSteamGameServerInitCall(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamGameServerInitCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_INIT, false, __FUNCTION__)); - - bool res = playEndCall->m_Res; - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -ISteamGameServer* CPlayingEngExtInterceptor::SteamGameServer() { - CSteamGameServerCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER, true, __FUNCTION__)); - CSteamGameServerCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER, false, __FUNCTION__)); - - ISteamGameServer* res = NULL; - if (!playEndCall->m_ReturnNull) { - if (m_GameServerWrapper == NULL) m_GameServerWrapper = new CSteamGameServerPlayingWrapper(this); - res = m_GameServerWrapper; - } - freeFuncCall(playCall); freeFuncCall(playEndCall); - - return res; -} - -void CPlayingEngExtInterceptor::SteamGameServer_RunCallbacks() { - CSteamGameServerRunCallbacksCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_RUN_CALLBACKS, true, __FUNCTION__)); - CSteamGameServerRunCallbacksCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_RUN_CALLBACKS, false, __FUNCTION__)); - - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -void CPlayingEngExtInterceptor::SteamAPI_RunCallbacks() { - CSteamApiRunCallbacksCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_RUN_CALLBACKS, true, __FUNCTION__)); - CSteamApiRunCallbacksCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_RUN_CALLBACKS, false, __FUNCTION__)); - - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - -void CPlayingEngExtInterceptor::SteamGameServer_Shutdown() -{ - CSteamGameServerShutdownCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAMGAMESERVER_SHUTDOWN, true, __FUNCTION__)); - CSteamGameServerShutdownCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAMGAMESERVER_SHUTDOWN, false, __FUNCTION__)); - - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - - -void CPlayingEngExtInterceptor::SteamAPI_UnregisterCallback(CCallbackBase *pCallback) { - int regamedllId = getOrRegisterSteamCallback(pCallback); - - CSteamApiUnregisterCallbackCall* playCall = dynamic_cast(getNextCall(false, false, ECF_STEAM_API_UNREGISTER_CALLBACK, true, __FUNCTION__)); - CSteamApiUnregisterCallbackCall(regamedllId, pCallback).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CSteamApiUnregisterCallbackCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_STEAM_API_UNREGISTER_CALLBACK, false, __FUNCTION__)); - - pCallback->SetFlags(playEndCall->m_OutState.m_nCallbackFlags); - pCallback->SetICallback(playEndCall->m_OutState.m_iCallback); - freeFuncCall(playCall); freeFuncCall(playEndCall); -} - - - - - -CSteamGameServerPlayingWrapper::CSteamGameServerPlayingWrapper(CPlayingEngExtInterceptor* player) { - m_Player = player; - m_bStrictChecks = player->m_bStrictChecks; -} - -bool CSteamGameServerPlayingWrapper::InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -void CSteamGameServerPlayingWrapper::SetProduct(const char *pszProduct) { - CGameServerSetProductCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_PRODUCT, true, __FUNCTION__)); - CGameServerSetProductCall(pszProduct).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetProductCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_PRODUCT, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetGameDescription(const char *pszGameDescription) { - CGameServerSetGameDescCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_GAME_DESC, true, __FUNCTION__)); - CGameServerSetGameDescCall(pszGameDescription).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetGameDescCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_GAME_DESC, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetModDir(const char *pszModDir) { - CGameServerSetModDirCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_GAME_DIR, true, __FUNCTION__)); - CGameServerSetModDirCall(pszModDir).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetModDirCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_GAME_DIR, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetDedicatedServer(bool bDedicated) { - CGameServerSetDedicatedServerCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_DEDICATED_SERVER, true, __FUNCTION__)); - CGameServerSetDedicatedServerCall(bDedicated).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetDedicatedServerCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_DEDICATED_SERVER, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::LogOn(const char *pszAccountName, const char *pszPassword) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerPlayingWrapper::LogOnAnonymous() { - CGameServerLogOnAnonymousCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_LOG_ON_ANONYMOUS, true, __FUNCTION__)); - CGameServerLogOnAnonymousCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_LOG_ON_ANONYMOUS, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::LogOff() { - CGameServerLogOffCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_LOGOFF, true, __FUNCTION__)); - CGameServerLogOffCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_LOGOFF, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -bool CSteamGameServerPlayingWrapper::BLoggedOn() { - CGameServerBLoggedOnCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BLOGGEDON, true, __FUNCTION__)); - CGameServerBLoggedOnCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BLOGGEDON, false, __FUNCTION__)); - - bool res = playEndCall->m_Res; - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -bool CSteamGameServerPlayingWrapper::BSecure() { - CGameServerBSecureCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BSECURE, true, __FUNCTION__)); - CGameServerBSecureCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BSECURE, false, __FUNCTION__)); - - bool res = playEndCall->m_Res; - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -CSteamID CSteamGameServerPlayingWrapper::GetSteamID() { - CGameServerGetSteamIdCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_GET_STEAM_ID, true, __FUNCTION__)); - CGameServerGetSteamIdCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_GET_STEAM_ID, false, __FUNCTION__)); - - CSteamID res(playEndCall->m_SteamId); - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -bool CSteamGameServerPlayingWrapper::WasRestartRequested() { - CGameServerWasRestartRequestedCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_WAS_RESTART_REQUESTED, true, __FUNCTION__)); - CGameServerWasRestartRequestedCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_WAS_RESTART_REQUESTED, false, __FUNCTION__)); - - bool res = playEndCall->m_Result; - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -void CSteamGameServerPlayingWrapper::SetMaxPlayerCount(int cPlayersMax) { - CGameServerSetMaxPlayersCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_MAX_PLAYERS_COUNT, true, __FUNCTION__)); - CGameServerSetMaxPlayersCall(cPlayersMax).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetMaxPlayersCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_MAX_PLAYERS_COUNT, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetBotPlayerCount(int cBotplayers) { - CGameServerSetBotCountCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_BOT_PLAYERS_COUNT, true, __FUNCTION__)); - CGameServerSetBotCountCall(cBotplayers).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetBotCountCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_BOT_PLAYERS_COUNT, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetServerName(const char *pszServerName) { - CGameServerSetServerNameCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_SERVER_NAME, true, __FUNCTION__)); - CGameServerSetServerNameCall(pszServerName).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetServerNameCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_SERVER_NAME, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetMapName(const char *pszMapName) { - CGameServerSetMapNameCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_MAP_NAME, true, __FUNCTION__)); - CGameServerSetMapNameCall(pszMapName).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetMapNameCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_MAP_NAME, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetPasswordProtected(bool bPasswordProtected) { - CGameServerSetPasswordProtectedCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_PASSWORD_PROTECTED, true, __FUNCTION__)); - CGameServerSetPasswordProtectedCall(bPasswordProtected).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetPasswordProtectedCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_PASSWORD_PROTECTED, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetSpectatorPort(uint16 unSpectatorPort) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerPlayingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerPlayingWrapper::ClearAllKeyValues() { - CGameServerClearAllKVsCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_CLEAR_ALL_KEY_VALUES, true, __FUNCTION__)); - CGameServerClearAllKVsCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_CLEAR_ALL_KEY_VALUES, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetKeyValue(const char *pKey, const char *pValue) { - CGameServerSetKeyValueCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_KEY_VALUE, true, __FUNCTION__)); - CGameServerSetKeyValueCall(pKey, pValue).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetKeyValueCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_KEY_VALUE, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetGameTags(const char *pchGameTags) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerPlayingWrapper::SetGameData(const char *pchGameData) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerPlayingWrapper::SetRegion(const char *pszRegion) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -bool CSteamGameServerPlayingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser) { - CGameServerSendUserConnectAndAuthenticateCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE, true, __FUNCTION__)); - CGameServerSendUserConnectAndAuthenticateCall(unIPClient, pvAuthBlob, cubAuthBlobSize).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSendUserConnectAndAuthenticateCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE, false, __FUNCTION__)); - - bool res = playEndCall->m_Res; - *pSteamIDUser = CSteamID(playEndCall->m_OutSteamId); - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -CSteamID CSteamGameServerPlayingWrapper::CreateUnauthenticatedUserConnection() { - CGameServerCreateUnauthUserConnectionCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_CREATE_UNAUTH_USER_CONNECTION, true, __FUNCTION__)); - CGameServerCreateUnauthUserConnectionCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_CREATE_UNAUTH_USER_CONNECTION, false, __FUNCTION__)); - - CSteamID res = playEndCall->m_SteamId; - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -void CSteamGameServerPlayingWrapper::SendUserDisconnect(CSteamID steamIDUser) { - CGameServerSendUserDisconnectCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SEND_USER_DISCONNECT, true, __FUNCTION__)); - CGameServerSendUserDisconnectCall(steamIDUser).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSendUserDisconnectCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SEND_USER_DISCONNECT, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -bool CSteamGameServerPlayingWrapper::BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore) { - CGameServerBUpdateUserDataCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_BUPDATE_USER_DATA, true, __FUNCTION__)); - CGameServerBUpdateUserDataCall(steamIDUser, pchPlayerName, uScore).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerBUpdateUserDataCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_BUPDATE_USER_DATA, false, __FUNCTION__)); - - bool res = playEndCall->m_Res; - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -HAuthTicket CSteamGameServerPlayingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_HAuthTicketInvalid; -} - -EBeginAuthSessionResult CSteamGameServerPlayingWrapper::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_EBeginAuthSessionResultInvalidTicket; -} - -void CSteamGameServerPlayingWrapper::EndAuthSession(CSteamID steamID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerPlayingWrapper::CancelAuthTicket(HAuthTicket hAuthTicket) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -EUserHasLicenseForAppResult CSteamGameServerPlayingWrapper::UserHasLicenseForApp(CSteamID steamID, AppId_t appID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_EUserHasLicenseResultHasLicense; -} - -bool CSteamGameServerPlayingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -void CSteamGameServerPlayingWrapper::GetGameplayStats() { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -SteamAPICall_t CSteamGameServerPlayingWrapper::GetServerReputation() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_uAPICallInvalid; -} - -uint32 CSteamGameServerPlayingWrapper::GetPublicIP() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -bool CSteamGameServerPlayingWrapper::HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort) { - CGameServerHandleIncomingPacketCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_HANDLE_INCOMING_PACKET, true, __FUNCTION__)); - CGameServerHandleIncomingPacketCall(pData, cbData, srcIP, srcPort).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerHandleIncomingPacketCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_HANDLE_INCOMING_PACKET, false, __FUNCTION__)); - - bool res = playEndCall->m_Res; - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -int CSteamGameServerPlayingWrapper::GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort) { - CGameServerGetNextOutgoingPacketCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_GET_NEXT_OUTGOING_PACKET, true, __FUNCTION__)); - CGameServerGetNextOutgoingPacketCall(cbMaxOut).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerGetNextOutgoingPacketCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_GET_NEXT_OUTGOING_PACKET, false, __FUNCTION__)); - - int res = playEndCall->m_Result; - *pNetAdr = playEndCall->m_Addr; - *pPort = playEndCall->m_Port; - memcpy(pOut, playEndCall->m_Buf, playEndCall->m_BufLen); - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); - - return res; -} - -void CSteamGameServerPlayingWrapper::EnableHeartbeats(bool bActive) { - CGameServerEnableHeartbeatsCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_ENABLE_HEARTBEATS, true, __FUNCTION__)); - CGameServerEnableHeartbeatsCall(bActive).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerEnableHeartbeatsCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_ENABLE_HEARTBEATS, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::SetHeartbeatInterval(int iHeartbeatInterval) { - CGameServerSetHeartbeatIntervalCall* playCall = dynamic_cast(m_Player->getNextCall(false, false, ECF_GS_SET_HEARTBEATS_INTERVAL, true, __FUNCTION__)); - CGameServerSetHeartbeatIntervalCall(iHeartbeatInterval).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); - CGameServerSetHeartbeatIntervalCall* playEndCall = dynamic_cast(m_Player->getNextCall(false, true, ECF_GS_SET_HEARTBEATS_INTERVAL, false, __FUNCTION__)); - - m_Player->freeFuncCall(playCall); m_Player->freeFuncCall(playEndCall); -} - -void CSteamGameServerPlayingWrapper::ForceHeartbeat() { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -SteamAPICall_t CSteamGameServerPlayingWrapper::AssociateWithClan(CSteamID steamIDClan) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_uAPICallInvalid; -} - -SteamAPICall_t CSteamGameServerPlayingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_uAPICallInvalid; -} - - - - - - - -CSteamAppsPlayingWrapper::CSteamAppsPlayingWrapper(CPlayingEngExtInterceptor* player) { - m_Player = player; - m_bStrictChecks = player->m_bStrictChecks; -} - -bool CSteamAppsPlayingWrapper::BIsSubscribed() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsPlayingWrapper::BIsLowViolence() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsPlayingWrapper::BIsCybercafe() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsPlayingWrapper::BIsVACBanned() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -const char* CSteamAppsPlayingWrapper::GetCurrentGameLanguage() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return ""; -} - -const char* CSteamAppsPlayingWrapper::GetAvailableGameLanguages() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return ""; -} - -bool CSteamAppsPlayingWrapper::BIsSubscribedApp(AppId_t appID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsPlayingWrapper::BIsDlcInstalled(AppId_t appID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -uint32 CSteamAppsPlayingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -bool CSteamAppsPlayingWrapper::BIsSubscribedFromFreeWeekend() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -int CSteamAppsPlayingWrapper::GetDLCCount() { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -bool CSteamAppsPlayingWrapper::BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -void CSteamAppsPlayingWrapper::InstallDLC(AppId_t nAppID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamAppsPlayingWrapper::UninstallDLC(AppId_t nAppID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamAppsPlayingWrapper::RequestAppProofOfPurchaseKey(AppId_t nAppID) { - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -bool CSteamAppsPlayingWrapper::GetCurrentBetaName(char *pchName, int cchNameBufferSize) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsPlayingWrapper::MarkContentCorrupt(bool bMissingFilesOnly) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -uint32 CSteamAppsPlayingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -uint32 CSteamAppsPlayingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) { - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} diff --git a/regamedll/testsuite/demoplayer.h b/regamedll/testsuite/demoplayer.h deleted file mode 100644 index 84499872..00000000 --- a/regamedll/testsuite/demoplayer.h +++ /dev/null @@ -1,209 +0,0 @@ -#pragma once -#ifdef _WIN32 - -#define TESTPLAYER_FUNCTREE_DEPTH 8 -#define TESTPLAYER_FUNCCALL_MAXSIZE 17000 - -#include "osconfig.h" -#include "funccalls.h" -#include "regamedll/platform.h" - -#include -#include - -class CPlayingEngExtInterceptor; - - -class CSteamAppsPlayingWrapper : public ISteamApps -{ -private: - CPlayingEngExtInterceptor* m_Player; - bool m_bStrictChecks; - -public: - CSteamAppsPlayingWrapper(CPlayingEngExtInterceptor* player); - - virtual bool BIsSubscribed(); - virtual bool BIsLowViolence(); - virtual bool BIsCybercafe(); - virtual bool BIsVACBanned(); - virtual const char *GetCurrentGameLanguage(); - virtual const char *GetAvailableGameLanguages(); - - virtual bool BIsSubscribedApp(AppId_t appID); - virtual bool BIsDlcInstalled(AppId_t appID); - - virtual uint32 GetEarliestPurchaseUnixTime(AppId_t nAppID); - virtual bool BIsSubscribedFromFreeWeekend(); - - virtual int GetDLCCount(); - virtual bool BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize); - - virtual void InstallDLC(AppId_t nAppID); - virtual void UninstallDLC(AppId_t nAppID); - - virtual void RequestAppProofOfPurchaseKey(AppId_t nAppID); - - virtual bool GetCurrentBetaName(char *pchName, int cchNameBufferSize); - virtual bool MarkContentCorrupt(bool bMissingFilesOnly); - virtual uint32 GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots); - - virtual uint32 GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize); -}; - -class CSteamGameServerPlayingWrapper : public ISteamGameServer -{ -private: - CPlayingEngExtInterceptor* m_Player; - bool m_bStrictChecks; - -public: - CSteamGameServerPlayingWrapper(CPlayingEngExtInterceptor* player); - - virtual bool InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString); - virtual void SetProduct(const char *pszProduct); - virtual void SetGameDescription(const char *pszGameDescription); - virtual void SetModDir(const char *pszModDir); - virtual void SetDedicatedServer(bool bDedicated); - virtual void LogOn(const char *pszAccountName, const char *pszPassword); - virtual void LogOnAnonymous(); - virtual void LogOff(); - virtual bool BLoggedOn(); - virtual bool BSecure(); - virtual CSteamID GetSteamID(); - virtual bool WasRestartRequested(); - virtual void SetMaxPlayerCount(int cPlayersMax); - virtual void SetBotPlayerCount(int cBotplayers); - virtual void SetServerName(const char *pszServerName); - virtual void SetMapName(const char *pszMapName); - virtual void SetPasswordProtected(bool bPasswordProtected); - virtual void SetSpectatorPort(uint16 unSpectatorPort); - virtual void SetSpectatorServerName(const char *pszSpectatorServerName); - virtual void ClearAllKeyValues(); - virtual void SetKeyValue(const char *pKey, const char *pValue); - virtual void SetGameTags(const char *pchGameTags); - virtual void SetGameData(const char *pchGameData); - virtual void SetRegion(const char *pszRegion); - virtual bool SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser); - virtual CSteamID CreateUnauthenticatedUserConnection(); - virtual void SendUserDisconnect(CSteamID steamIDUser); - virtual bool BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore); - virtual HAuthTicket GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket); - virtual EBeginAuthSessionResult BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID); - virtual void EndAuthSession(CSteamID steamID); - virtual void CancelAuthTicket(HAuthTicket hAuthTicket); - virtual EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID); - virtual bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup); - virtual void GetGameplayStats(); - virtual SteamAPICall_t GetServerReputation(); - virtual uint32 GetPublicIP(); - virtual bool HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort); - virtual int GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort); - virtual void EnableHeartbeats(bool bActive); - virtual void SetHeartbeatInterval(int iHeartbeatInterval); - virtual void ForceHeartbeat(); - virtual SteamAPICall_t AssociateWithClan(CSteamID steamIDClan); - virtual SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer); -}; - -class CPlayingEngExtInterceptor : public IReGameDLLPlatform { - friend class CSteamGameServerPlayingWrapper; - friend class CSteamAppsPlayingWrapper; -private: - - char m_FuncCallBuffer[TESTPLAYER_FUNCTREE_DEPTH * TESTPLAYER_FUNCCALL_MAXSIZE]; - void* m_FuncCalls[TESTPLAYER_FUNCTREE_DEPTH]; - bool m_FuncCallsFree[TESTPLAYER_FUNCTREE_DEPTH]; - - std::ifstream m_InStream; - int64 m_inStreamSize; - bool m_bLastRead; - std::queue m_CommandsQueue; - - bool m_bStrictChecks; - - SOCKET m_ServerSocket; - - int m_SteamCallbacksCounter; - std::unordered_map m_SteamCallbacks; - std::unordered_map m_SteamCallbacksReverse; - CSteamAppsPlayingWrapper* m_SteamAppsWrapper; - - CSteamGameServerPlayingWrapper* m_GameServerWrapper; - - void* m_SteamBreakpadContext; - int m_HeartBeatInterval; - int m_PrevHeartBeat; - - DWORD m_StartTick; - int m_NumFrames; - - hostent_data_t m_CurrentHostentData; - struct hostent m_CurrentHostent; - void setCurrentHostent(hostent_data_t* data); - - struct tm m_CurrentTm; - void setCurrentTm(struct tm* t); - - bool readFuncCall(); - - IEngExtCall* getNextCallInternal(bool peek); - - void playCallback(IEngCallbackCall* cb); - void playSteamCallback1(CSteamCallbackCall1* cb); - void playSteamCallback2(CSteamCallbackCall2* cb); - - int getOrRegisterSteamCallback(CCallbackBase* cb); - - void maybeHeartBeat(int readPos); - -public: - void* allocFuncCall(); - void freeFuncCall(void* fcall); - CPlayingEngExtInterceptor(const char* fname, bool strictChecks); - - IEngExtCall* getNextCall(bool peek, bool processCallbacks, ExtCallFuncs expectedOpcode, bool needStart, const char* callSource); - - virtual uint32 time(uint32* pTime); - virtual struct tm* localtime(uint32 time); - virtual void srand(uint32 seed); - virtual int rand(); - - virtual void Sleep(DWORD msec); - virtual BOOL QueryPerfCounter(LARGE_INTEGER* counter); - virtual BOOL QueryPerfFreq(LARGE_INTEGER* freq); - virtual DWORD GetTickCount(); - virtual void GetLocalTime(LPSYSTEMTIME time); - virtual void GetSystemTime(LPSYSTEMTIME time); - virtual void GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo); - virtual BOOL GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime); - virtual void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); - - - virtual SOCKET socket(int af, int type, int protocol); - virtual int ioctlsocket(SOCKET s, long cmd, u_long *argp); - virtual int setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen); - virtual int closesocket(SOCKET s); - virtual int recvfrom(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, socklen_t *fromlen); - virtual int sendto(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen); - virtual int bind(SOCKET s, const struct sockaddr* addr, int namelen); - virtual int getsockname(SOCKET s, struct sockaddr* name, socklen_t* namelen); - virtual int WSAGetLastError(); - virtual struct hostent* gethostbyname(const char *name); - virtual int gethostname(char *name, int namelen); - - virtual void SteamAPI_SetBreakpadAppID(uint32 unAppID); - virtual void SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback); - virtual void SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback); - virtual bool SteamAPI_Init(); - virtual void SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall); - virtual ISteamApps* SteamApps(); - virtual bool SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString); - virtual ISteamGameServer* SteamGameServer(); - virtual void SteamGameServer_RunCallbacks(); - virtual void SteamAPI_RunCallbacks(); - virtual void SteamGameServer_Shutdown(); - virtual void SteamAPI_UnregisterCallback(CCallbackBase *pCallback); -}; - -#endif //_WIN32 diff --git a/regamedll/testsuite/funccalls.cpp b/regamedll/testsuite/funccalls.cpp deleted file mode 100644 index 5a1cc397..00000000 --- a/regamedll/testsuite/funccalls.cpp +++ /dev/null @@ -1,3288 +0,0 @@ -#include "precompiled.h" - -void PrintSystemTime(LPSYSTEMTIME t, std::stringstream &ss) -{ - ss << "{" - << " Year: " << t->wYear - << " Month: " << t->wMonth - << " Day: " << t->wDay - << " DayOfWeek: " << t->wDayOfWeek - << " Hour: " << t->wHour - << " Month: " << t->wMonth - << " Second: " << t->wSecond - << " Millisecond: " << t->wMilliseconds - << " }"; -} - -void PrintFileTime(LPFILETIME t, std::stringstream &ss) -{ - ss << "{" - << " highDate: " << t->dwHighDateTime - << " lowDate: " << t->dwLowDateTime - << " }"; -} - -void PrintTm(struct tm* t, std::stringstream &ss) { - ss << "{" - << " tm_year: " << t->tm_year - << " tm_mon: " << t->tm_mon - << " tm_yday: " << t->tm_yday - << " tm_wday: " << t->tm_wday - << " tm_mday: " << t->tm_mday - << " tm_isdst: " << t->tm_isdst - << " tm_hour: " << t->tm_hour - << " tm_min: " << t->tm_min - << " tm_sec: " << t->tm_sec - << " }"; -} - -void PrintBinaryArray(const char* data, int dataLen, std::stringstream &ss) -{ - ss << "["; - for (int i = 0; i < dataLen; i++) - ss << " " << (unsigned int) (unsigned char)data[i]; - ss << "]"; -} - -void IEngExtCall::ensureArgsAreEqual(IEngExtCall* expect, bool strict, const char* callSource) { - if (compareInputArgs(expect, strict)) return; - - std::string expectedSignature = expect->toString(); - std::string mySignature = toString(); - regamedll_syserror("%s: call arguments mismatch; expected signature:\n%s\n\ncurrent signature:\n%s", callSource, expectedSignature.c_str(), mySignature.c_str()); -} - -bool CompareSockAddrs(void* ps1, void* ps2) { - sockaddr* sa1 = (sockaddr*)ps1; - sockaddr* sa2 = (sockaddr*)ps2; - - if (sa1->sa_family != sa2->sa_family) - return false; - - int compareSize = 0; - switch (sa1->sa_family) { - case AF_INET: - compareSize = 8; // sa_family(2) + sin_addr(4) + sin_port(2) - break; - - default: - regamedll_syserror("%s: Unknown sockaddr family %u", __FUNCTION__, sa1->sa_family); - } - - return 0 == memcmp(ps1, ps2, compareSize); -} - -/* ============================================================================ - CSleepExtCall -============================================================================ */ -CSleepExtCall::CSleepExtCall(DWORD time) -{ - m_Time = time; -} - -std::string CSleepExtCall::toString() -{ - std::stringstream ss; - ss << "Sleep(" << m_Time << ")"; - return ss.str(); -} - -bool CSleepExtCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSleepExtCall* otherSleep = dynamic_cast(other); - if (otherSleep == NULL) - return false; - - return otherSleep->m_Time == this->m_Time; -} - -void CSleepExtCall::writePrologue(std::ostream &stream) -{ - stream.write((char*)&m_Time, 4); -} - -void CSleepExtCall::readPrologue(std::istream &stream) -{ - stream.read((char*)&m_Time, 4); -} - - - -/* ============================================================================ - CQueryPerfFreqCall -============================================================================ */ -std::string CQueryPerfFreqCall::toString() -{ - LARGE_INTEGER li; - li.QuadPart = m_Freq; - - std::stringstream ss; - ss << "QueryPerformanceFrequency(freq = { LowPart: " << li.LowPart << "; HighPart: " << li.HighPart << ") => " << m_Res; - return ss.str(); -} - -bool CQueryPerfFreqCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CQueryPerfFreqCall* otherPerfFreq = dynamic_cast(other); - if (otherPerfFreq == NULL) - return false; - - return true; -} - -void CQueryPerfFreqCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Freq, 8).write((char*)&m_Res, 1); -} - -void CQueryPerfFreqCall::readEpilogue(std::istream &stream) { - m_Res = 0; - stream.read((char*)&m_Freq, 8).read((char*)&m_Res, 1); -} - - - -/* ============================================================================ - CQueryPerfCounterCall -============================================================================ */ -std::string CQueryPerfCounterCall::toString() -{ - LARGE_INTEGER li; - li.QuadPart = m_Counter; - - std::stringstream ss; - ss << "QueryPerformanceCounter(counter = { LowPart: " << li.LowPart << "; HighPart: " << li.HighPart << ") => " << m_Res; - return ss.str(); -} - -bool CQueryPerfCounterCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CQueryPerfCounterCall* otherPerfFreq = dynamic_cast(other); - if (otherPerfFreq == NULL) - return false; - - return true; -} - -void CQueryPerfCounterCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Counter, 8).write((char*)&m_Res, 1); -} - -void CQueryPerfCounterCall::readEpilogue(std::istream &stream) { - m_Res = 0; - stream.read((char*)&m_Counter, 8).read((char*)&m_Res, 1); -} - - - - -/* ============================================================================ - CGetTickCountCall -============================================================================ */ -std::string CGetTickCountCall::toString() -{ - std::stringstream ss; - ss << "GetTickCount() => " << m_Res; - return ss.str(); -} - -bool CGetTickCountCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetTickCountCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGetTickCountCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CGetTickCountCall::readEpilogue(std::istream &stream) { - m_Res = 0; - stream.read((char*)&m_Res, 4); -} - - - - -/* ============================================================================ - CGetTickCountCall -============================================================================ */ - -std::string CGetLocalTimeCall::toString() -{ - std::stringstream ss; - ss << "GetLocalTime() => "; - PrintSystemTime(&m_Res, ss); - return ss.str(); -} - -bool CGetLocalTimeCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetLocalTimeCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGetLocalTimeCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, sizeof(m_Res)); -} - -void CGetLocalTimeCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, sizeof(m_Res)); -} - - - - -/* ============================================================================ - CGetSystemTimeCall -============================================================================ */ -std::string CGetSystemTimeCall::toString() -{ - std::stringstream ss; - ss << "GetSystemTime() => "; - PrintSystemTime(&m_Res, ss); - return ss.str(); -} - -bool CGetSystemTimeCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetSystemTimeCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGetSystemTimeCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, sizeof(m_Res)); -} - -void CGetSystemTimeCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, sizeof(m_Res)); -} - - - - -/* ============================================================================ - CGetTimeZoneInfoCall -============================================================================ */ -std::string CGetTimeZoneInfoCall::toString() -{ - std::stringstream ss; - ss << "GetTimeZoneInfo() => {" - << " Bias: " << m_Res.Bias - << " StandardName: " << m_Res.StandardName - << " StandardDate: "; PrintSystemTime(&m_Res.StandardDate, ss); - - ss << " StandardBias: " << m_Res.StandardBias - << " DaylightName: " << m_Res.DaylightName - << " DaylightDate: "; PrintSystemTime(&m_Res.DaylightDate, ss); - ss << " DaylightBias: " << m_Res.DaylightBias - << " }"; - return ss.str(); -} - -bool CGetTimeZoneInfoCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetTimeZoneInfoCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGetTimeZoneInfoCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, sizeof(m_Res)); -} - -void CGetTimeZoneInfoCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, sizeof(m_Res)); -} - - - - -/* ============================================================================ - CSocketCall -============================================================================ */ -CSocketCall::CSocketCall(int af, int type, int protocol) -{ - m_Af = af; - m_Type = type; - m_Protocol = protocol; - m_Res = INVALID_SOCKET; -} - -std::string CSocketCall::toString() -{ - std::stringstream ss; - ss << "socket(af: " << m_Af << "; type: " << m_Type << "; protocol: " << m_Protocol << ") => " << m_Res; - return ss.str(); -} - -bool CSocketCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSocketCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Af != m_Af) - return false; - - if (otherCall->m_Type != m_Type) - return false; - - if (otherCall->m_Protocol != m_Protocol) - return false; - - return true; -} - -void CSocketCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Af, 4).write((char*)&m_Type, 4).write((char*)&m_Protocol, 4); -} - -void CSocketCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CSocketCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_Af, 4).read((char*)&m_Type, 4).read((char*)&m_Protocol, 4); -} - -void CSocketCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - - - -/* ============================================================================ - CIoCtlSocketCall -============================================================================ */ -CIoCtlSocketCall::CIoCtlSocketCall(SOCKET s, long cmd, u_long inValue) -{ - m_Socket = s; - m_Cmd = cmd; - m_InValue = inValue; - m_OutValue = 0; m_Res = 0; -} - -std::string CIoCtlSocketCall::toString() -{ - std::stringstream ss; - ss << "ioctlsocket(s: " << m_Socket << "; cmd: " << m_Cmd << "; val: { in: " << m_InValue << "; out: " << m_OutValue << " }) => " << m_Res; - return ss.str(); -} - -bool CIoCtlSocketCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CIoCtlSocketCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Socket != m_Socket) - return false; - - if (otherCall->m_Cmd != m_Cmd) - return false; - - if (otherCall->m_InValue != m_InValue) - return false; - - return true; -} - -void CIoCtlSocketCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_Socket, 4) - .write((char*)&m_Cmd, 4) - .write((char*)&m_InValue, 4); -} - -void CIoCtlSocketCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_OutValue, 4) - .write((char*)&m_Res, 4); -} - -void CIoCtlSocketCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_Socket, 4) - .read((char*)&m_Cmd, 4) - .read((char*)&m_InValue, 4); -} - -void CIoCtlSocketCall::readEpilogue(std::istream &stream) { - stream - .read((char*)&m_OutValue, 4) - .read((char*)&m_Res, 4); -} - - - - - -/* ============================================================================ - CSetSockOptCall -============================================================================ */ -CSetSockOptCall::CSetSockOptCall(SOCKET s, int level, int optname, const char* optval, int optlen) -{ - if (optlen > sizeof(m_OptVal)) - regamedll_syserror("CSetSockOptCall(): too large optlen (%d max %d)", optlen, sizeof(m_OptVal)); - m_Socket = s; - m_Level = level; - m_OptName = optname; - m_OptValLen = optlen; - memcpy(m_OptVal, optval, m_OptValLen); - m_Res = 0; -} - -std::string CSetSockOptCall::toString() -{ - std::stringstream ss; - ss << "setsockopt(s: " << m_Socket << "; level: " << m_Level << "; optName: " << m_OptName << "; optVal: "; - PrintBinaryArray(m_OptVal, m_OptValLen, ss); - ss << "; optLen: " << m_OptValLen << " ) => " << m_Res; - return ss.str(); -} - -bool CSetSockOptCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSetSockOptCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Socket != m_Socket) - return false; - - if (otherCall->m_Level != m_Level) - return false; - - if (otherCall->m_OptName != m_OptName) - return false; - - if (otherCall->m_OptValLen != m_OptValLen) - return false; - - if (memcmp(otherCall->m_OptVal, m_OptVal, m_OptValLen)) - return false; - - return true; -} - -void CSetSockOptCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_Socket, 4) - .write((char*)&m_Level, 4) - .write((char*)&m_OptName, 4) - .write((char*)&m_OptValLen, 4) - .write(m_OptVal, m_OptValLen); -} - -void CSetSockOptCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CSetSockOptCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_Socket, 4) - .read((char*)&m_Level, 4) - .read((char*)&m_OptName, 4) - .read((char*)&m_OptValLen, 4); - - stream.read(m_OptVal, m_OptValLen); -} - -void CSetSockOptCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - - - -/* ============================================================================ - CCloseSocketCall -============================================================================ */ -CCloseSocketCall::CCloseSocketCall(SOCKET s) -{ - m_Socket = s; - m_Res = 0; -} - -std::string CCloseSocketCall::toString() -{ - std::stringstream ss; - ss << "closesocket(s: " << m_Socket << " ) => " << m_Res; - return ss.str(); -} - -bool CCloseSocketCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CCloseSocketCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Socket != m_Socket) - return false; - - return true; -} - -void CCloseSocketCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Socket, 4); -} - -void CCloseSocketCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CCloseSocketCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_Socket, 4); -} - -void CCloseSocketCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - -/* ============================================================================ - CRecvFromCall -============================================================================ */ -CRecvFromCall::CRecvFromCall(SOCKET s, int len, int flags, int fromlen) -{ - m_Socket = s; - m_Len = len; - m_Flags = flags; - m_FromLenIn = fromlen; - m_FromLenOut = 0; m_Res = -1; -} - -std::string CRecvFromCall::toString() -{ - std::stringstream ss; - ss << "recvfrom(s: " << m_Socket << "; data: "; - PrintBinaryArray(m_Data, m_Res, ss); - ss << "; len: " << m_Len << "; flags: " << m_Flags << "; from: "; - PrintBinaryArray(m_From, m_FromLenOut, ss); - ss << "; fromlen: { in: " << m_FromLenIn << "; out: " << m_FromLenOut << " } ) => " << m_Res; - return ss.str(); -} - -bool CRecvFromCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CRecvFromCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Socket != m_Socket) - return false; - - if (otherCall->m_Len != m_Len) - return false; - - if (otherCall->m_Flags != m_Flags) - return false; - - if (otherCall->m_FromLenIn != m_FromLenIn) - return false; - - return true; -} - -void CRecvFromCall::setResult(const void* data, const void* from, int fromLen, int res) -{ - if (res > 0 && res > sizeof(m_Data)) - regamedll_syserror("%s: too large datalen (%d max %d)", __FUNCTION__, res, sizeof(m_Data)); - - if (fromLen > sizeof(m_From)) - regamedll_syserror("%s: too large fromlen (%d max %d)", __FUNCTION__, res, sizeof(m_From)); - - m_FromLenOut = fromLen; - m_Res = res; - - if (res > 0) - memcpy(m_Data, data, res); - - if (fromLen > 0) - memcpy(m_From, from, fromLen); -} - -void CRecvFromCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_Socket, 4) - .write((char*)&m_Len, 4) - .write((char*)&m_Flags, 4) - .write((char*)&m_FromLenIn, 4); -} - -void CRecvFromCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_FromLenOut, 4) - .write((char*)&m_Res, 4) - .write((char*)&m_From, (m_FromLenOut > 0 && m_Res >= 0) ? m_FromLenOut : 0) - .write((char*)&m_Data, (m_Res > 0) ? m_Res : 0); -} - -void CRecvFromCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_Socket, 4) - .read((char*)&m_Len, 4) - .read((char*)&m_Flags, 4) - .read((char*)&m_FromLenIn, 4); -} - -void CRecvFromCall::readEpilogue(std::istream &stream) { - stream - .read((char*)&m_FromLenOut, 4) - .read((char*)&m_Res, 4); - - stream.read((char*)&m_From, (m_FromLenOut > 0 && m_Res >= 0) ? m_FromLenOut : 0) - .read((char*)&m_Data, (m_Res > 0) ? m_Res : 0); -} - - - - - -/* ============================================================================ - CSendToCall -============================================================================ */ -CSendToCall::CSendToCall(SOCKET s, const void* buf, int len, int flags, const void* to, int tolen) -{ - if (len > sizeof(m_Data)) - regamedll_syserror("%s: too large datalen (%d max %d)", __FUNCTION__, len, sizeof(m_Data)); - - if (tolen > sizeof(m_To)) - regamedll_syserror("%s: too large tolen (%d max %d)", __FUNCTION__, tolen, sizeof(m_To)); - - m_Socket = s; - m_Len = len; - m_Flags = flags; - m_ToLen = tolen; - - memcpy(m_To, to, m_ToLen); - memcpy(m_Data, buf, m_Len); - m_Res = 0; -} - -std::string CSendToCall::toString() -{ - std::stringstream ss; - ss << "sendto(s: " << m_Socket << "; data: "; - PrintBinaryArray(m_Data, m_Len, ss); - ss << "; len: " << m_Len << "; flags: " << m_Flags << "; to: "; - PrintBinaryArray(m_To, m_ToLen, ss); - ss << "; tolen: " << m_ToLen << " ) => " << m_Res; - return ss.str(); -} - -bool CSendToCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSendToCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Socket != m_Socket) - return false; - - if (strict) { - if (otherCall->m_Len != m_Len) - return false; - } else { - int maxDiff; - if (m_Len < 40) { - maxDiff = 10; - } else if (m_Len < 90) { - maxDiff = 15; - } else if (m_Len < 120) { - maxDiff = 18; - } else { - maxDiff = m_Len / 8; - } - if (abs(otherCall->m_Len - m_Len) > maxDiff) - return false; - } - - if (otherCall->m_Flags != m_Flags) - return false; - - if (otherCall->m_ToLen != m_ToLen) - return false; - - if (strict) { - if (memcmp(otherCall->m_Data, m_Data, m_Len)) - return false; - } - - if (!CompareSockAddrs(otherCall->m_To, m_To)) - return false; - - return true; -} - -void CSendToCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_Socket, 4) - .write((char*)&m_Len, 4) - .write((char*)&m_Flags, 4) - .write((char*)&m_ToLen, 4) - .write((char*)&m_To, m_ToLen) - .write((char*)&m_Data, m_Len); -} - -void CSendToCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CSendToCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_Socket, 4) - .read((char*)&m_Len, 4) - .read((char*)&m_Flags, 4) - .read((char*)&m_ToLen, 4); - - stream.read((char*)&m_To, m_ToLen) - .read((char*)&m_Data, m_Len); -} - -void CSendToCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - - - - -/* ============================================================================ - CBindCall -============================================================================ */ -CBindCall::CBindCall(SOCKET s, const void* addr, int addrlen) -{ - if (addrlen > sizeof(m_Addr)) - regamedll_syserror("%s: too large tolen (%d max %d)", __FUNCTION__, addrlen, sizeof(m_Addr)); - - m_Socket = s; - m_AddrLen = addrlen; - - memcpy(m_Addr, addr, addrlen); - m_Res = 0; -} - -std::string CBindCall::toString() -{ - std::stringstream ss; - ss << "bind(s: " << m_Socket << "; addr: "; - PrintBinaryArray(m_Addr, m_AddrLen, ss); - ss << "; addrlen: " << m_AddrLen << " ) => " << m_Res; - return ss.str(); -} - -bool CBindCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CBindCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Socket != m_Socket) - return false; - - if (otherCall->m_AddrLen != m_AddrLen) - return false; - - if (!CompareSockAddrs(otherCall->m_Addr, m_Addr)) - return false; - - return true; -} - -void CBindCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_Socket, 4) - .write((char*)&m_AddrLen, 4) - .write((char*)&m_Addr, m_AddrLen); -} - -void CBindCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CBindCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_Socket, 4) - .read((char*)&m_AddrLen, 4); - - stream.read((char*)&m_Addr, m_AddrLen); -} - -void CBindCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - - - -/* ============================================================================ - CGetSockNameCall -============================================================================ */ -CGetSockNameCall::CGetSockNameCall(SOCKET s, int addrlen) -{ - m_Socket = s; - m_AddrLenIn = addrlen; - m_AddrLenOut = m_Res = 0; -} - -std::string CGetSockNameCall::toString() -{ - std::stringstream ss; - ss << "getsockname(s: " << m_Socket << "; addr: "; - PrintBinaryArray(m_Addr, m_AddrLenOut, ss); - ss << "; addrlen: { in: " << m_AddrLenIn << "; out: " << m_AddrLenOut << " } ) = > " << m_Res; - return ss.str(); -} - -void CGetSockNameCall::setResult(const void* addr, int addrlen, int res) -{ - if (addrlen > sizeof(m_Addr)) - regamedll_syserror("%s: too large tolen (%d max %d)", __FUNCTION__, addrlen, sizeof(m_Addr)); - - m_Res = res; - m_AddrLenOut = addrlen; - - memcpy(m_Addr, addr, addrlen); -} - -bool CGetSockNameCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetSockNameCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Socket != m_Socket) - return false; - - if (otherCall->m_AddrLenIn != m_AddrLenIn) - return false; - - return true; -} - -void CGetSockNameCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_Socket, 4) - .write((char*)&m_AddrLenIn, 4); -} - -void CGetSockNameCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_AddrLenOut, 4) - .write((char*)&m_Res, 4) - .write((char*)&m_Addr, m_AddrLenOut); -} - -void CGetSockNameCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_Socket, 4) - .read((char*)&m_AddrLenIn, 4); -} - -void CGetSockNameCall::readEpilogue(std::istream &stream) { - stream - .read((char*)&m_AddrLenOut, 4) - .read((char*)&m_Res, 4); - - stream.read((char*)&m_Addr, m_AddrLenOut); - -} - - - - - - -/* ============================================================================ - CWSAGetLastErrorCall -============================================================================ */ -std::string CWSAGetLastErrorCall::toString() -{ - std::stringstream ss; - ss << "WSAGetLastError() = > " << m_Res; - return ss.str(); -} - -bool CWSAGetLastErrorCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CWSAGetLastErrorCall* otherCall = (CWSAGetLastErrorCall*)other; - if (otherCall == NULL) - return false; - - return true; -} - -void CWSAGetLastErrorCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CWSAGetLastErrorCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - - - -/* ============================================================================ - CSteamCallbackCall1 -============================================================================ */ -CSteamCallbackCall1::CSteamCallbackCall1(int cbId, void* data, int dataSize, CCallbackBase* cb) -{ - if (dataSize > sizeof(m_Data)) - regamedll_syserror("%s: too large data (%d, max %d)", __FUNCTION__, dataSize, sizeof(m_Data)); - - m_CallbackId = cbId; - m_DataSize = dataSize; - memcpy(m_Data, data, dataSize); - m_InState.m_iCallback = cb->GetICallback(); - m_InState.m_nCallbackFlags = cb->GetFlags(); - m_OutState.clear(); -} - -std::string CSteamCallbackCall1::toString() -{ - std::stringstream ss; - ss << "Steam_Callback1: { callbackId: " << m_CallbackId << "; data: "; - PrintBinaryArray(m_Data, m_DataSize, ss); - ss << "; dataSize: " << m_DataSize << " }"; - return ss.str(); -} - -bool CSteamCallbackCall1::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamCallbackCall1* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_InState.m_iCallback != m_InState.m_iCallback) return false; - if (otherCall->m_InState.m_nCallbackFlags != m_InState.m_nCallbackFlags) return false; - - return true; -} - -void CSteamCallbackCall1::writePrologue(std::ostream &stream) { - stream.write((char*)&m_CallbackId, 4) - .write((char*)&m_InState, sizeof(m_InState)) - .write((char*)&m_DataSize, 4) - .write(m_Data, m_DataSize); -} - -void CSteamCallbackCall1::readPrologue(std::istream &stream) { - stream - .read((char*)&m_CallbackId, 4) - .read((char*)&m_InState, sizeof(m_InState)) - .read((char*)&m_DataSize, 4); - - stream.read(m_Data, m_DataSize); -} - -void CSteamCallbackCall1::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_OutState, sizeof(m_OutState)); -} - -void CSteamCallbackCall1::readEpilogue(std::istream &stream) { - stream.read((char*)&m_OutState, sizeof(m_OutState)); -} - - - -/* ============================================================================ - CSteamCallbackCall2 -============================================================================ */ -CSteamCallbackCall2::CSteamCallbackCall2(int cbId, void* data, int dataSize, bool ioFailure, SteamAPICall_t apiCall, CCallbackBase* cb) -{ - if (dataSize > sizeof(m_Data)) - regamedll_syserror("%s: too large data (%d, max %d)", __FUNCTION__, dataSize, sizeof(m_Data)); - - m_CallbackId = cbId; - m_DataSize = dataSize; - memcpy(m_Data, data, dataSize); - m_bIOFailure = ioFailure; - m_SteamAPICall = apiCall; - m_InState.m_iCallback = cb->GetICallback(); - m_InState.m_nCallbackFlags = cb->GetFlags(); - m_OutState.clear(); -} - -std::string CSteamCallbackCall2::toString() -{ - std::stringstream ss; - ss << "Steam_Callback1: { callbackId: " << m_CallbackId << "; data: "; - PrintBinaryArray(m_Data, m_DataSize, ss); - ss << "; dataSize: " << m_DataSize << "; ioFailure: " << m_bIOFailure << "; steamApiCall: " << m_SteamAPICall << " }"; - return ss.str(); -} - -bool CSteamCallbackCall2::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamCallbackCall2* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_InState.m_iCallback != m_InState.m_iCallback) return false; - if (otherCall->m_InState.m_nCallbackFlags != m_InState.m_nCallbackFlags) return false; - - return true; -} - -void CSteamCallbackCall2::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_CallbackId, 4) - .write((char*)&m_InState, sizeof(m_InState)) - .write((char*)&m_DataSize, 4) - .write((char*)&m_bIOFailure, 1) - .write((char*)&m_SteamAPICall, sizeof(m_SteamAPICall)) - .write(m_Data, m_DataSize); -} - -void CSteamCallbackCall2::readPrologue(std::istream &stream) { - m_bIOFailure = false; - stream - .read((char*)&m_CallbackId, 4) - .read((char*)&m_InState, sizeof(m_InState)) - .read((char*)&m_DataSize, 4) - .read((char*)&m_bIOFailure, 1) - .read((char*)&m_SteamAPICall, sizeof(m_SteamAPICall)); - - stream.read(m_Data, m_DataSize); -} - -void CSteamCallbackCall2::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_OutState, sizeof(m_OutState)); -} - -void CSteamCallbackCall2::readEpilogue(std::istream &stream) { - stream.read((char*)&m_OutState, sizeof(m_OutState)); -} - -/* ============================================================================ - CSteamApiRegisterCallbackCall -============================================================================ */ -CSteamApiRegisterCallbackCall::CSteamApiRegisterCallbackCall(int regamedllCallbackId, int steamCallbackId, CCallbackBase* cb) -{ - m_ReGameDLLCallbackId = regamedllCallbackId; - m_iSteamCallbackId = steamCallbackId; - m_InState.m_iCallback = cb->GetICallback(); - m_InState.m_nCallbackFlags = cb->GetFlags(); - m_OutState.clear(); -} - -std::string CSteamApiRegisterCallbackCall::toString() -{ - std::stringstream ss; - ss << "SteamAPI_RegisterCallback( regamedllCallbackId: " << m_ReGameDLLCallbackId << "; steamCallbackId: " << m_iSteamCallbackId << " )"; - return ss.str(); -} - -bool CSteamApiRegisterCallbackCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamApiRegisterCallbackCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_iSteamCallbackId != m_iSteamCallbackId) - return false; - - if (otherCall->m_ReGameDLLCallbackId != m_ReGameDLLCallbackId) - return false; - - if (otherCall->m_InState.m_iCallback != m_InState.m_iCallback) return false; - if (otherCall->m_InState.m_nCallbackFlags != m_InState.m_nCallbackFlags) return false; - - return true; -} - -void CSteamApiRegisterCallbackCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_InState, sizeof(m_InState)) - .write((char*)&m_ReGameDLLCallbackId, 4) - .write((char*)&m_iSteamCallbackId, 4); -} - -void CSteamApiRegisterCallbackCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_InState, sizeof(m_InState)) - .read((char*)&m_ReGameDLLCallbackId, 4) - .read((char*)&m_iSteamCallbackId, 4); -} - -void CSteamApiRegisterCallbackCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_OutState, sizeof(m_OutState)); -} - -void CSteamApiRegisterCallbackCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_OutState, sizeof(m_OutState)); -} - - - - -/* ============================================================================ - CSteamApiInitCall -============================================================================ */ - -std::string CSteamApiInitCall::toString() -{ - std::stringstream ss; - ss << "CSteamApiInitCall( ) => " << m_Res; - return ss.str(); -} - -bool CSteamApiInitCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamApiInitCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CSteamApiInitCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 1); -} - -void CSteamApiInitCall::readEpilogue(std::istream &stream) { - m_Res = false; - stream.read((char*)&m_Res, 1); -} - - - - - -/* ============================================================================ - CSteamApiUnrigestierCallResultCall -============================================================================ */ -CSteamApiUnrigestierCallResultCall::CSteamApiUnrigestierCallResultCall(int regamedllCallbackId, SteamAPICall_t steamApiCall, CCallbackBase* cb) -{ - m_ReGameDLLCallbackId = regamedllCallbackId; - m_SteamApiCall = steamApiCall; - m_InState.m_iCallback = cb->GetICallback(); - m_InState.m_nCallbackFlags = cb->GetFlags(); - m_OutState.clear(); -} - -std::string CSteamApiUnrigestierCallResultCall::toString() -{ - std::stringstream ss; - ss << "SteamAPI_UnregisterCallResult( regamedllCallbackId: " << m_ReGameDLLCallbackId << "; steamApiCall: " << m_SteamApiCall << " )"; - return ss.str(); -} - -bool CSteamApiUnrigestierCallResultCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamApiUnrigestierCallResultCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_SteamApiCall != m_SteamApiCall) - return false; - - if (otherCall->m_ReGameDLLCallbackId != m_ReGameDLLCallbackId) - return false; - - if (otherCall->m_InState.m_iCallback != m_InState.m_iCallback) return false; - if (otherCall->m_InState.m_nCallbackFlags != m_InState.m_nCallbackFlags) return false; - - return true; -} - -void CSteamApiUnrigestierCallResultCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_InState, sizeof(m_InState)) - .write((char*)&m_ReGameDLLCallbackId, 4) - .write((char*)&m_SteamApiCall, sizeof(m_SteamApiCall)); -} - -void CSteamApiUnrigestierCallResultCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_InState, sizeof(m_InState)) - .read((char*)&m_ReGameDLLCallbackId, 4) - .read((char*)&m_SteamApiCall, sizeof(m_SteamApiCall)); -} - -void CSteamApiUnrigestierCallResultCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_OutState, sizeof(m_OutState)); -} - -void CSteamApiUnrigestierCallResultCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_OutState, sizeof(m_OutState)); -} - - - -/* ============================================================================ - CSteamAppsCall -============================================================================ */ -std::string CSteamAppsCall::toString() -{ - std::stringstream ss; - ss << "SteamApps( )"; - return ss.str(); -} - -bool CSteamAppsCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamAppsCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CSteamAppsCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_ReturnNull, 1); -} - -void CSteamAppsCall::readEpilogue(std::istream &stream) { - m_ReturnNull = false; - stream.read((char*)&m_ReturnNull, 1); -} - - - - -/* ============================================================================ - CSteamAppGetCurrentGameLanguageCall -============================================================================ */ - -std::string CSteamAppGetCurrentGameLanguageCall::toString() -{ - std::stringstream ss; - ss << "SteamApps::GetCurrentGameLanguage( ) => " << m_Res; - return ss.str(); -} - -void CSteamAppGetCurrentGameLanguageCall::setResult(const char* res) -{ - if (res == NULL) - regamedll_syserror("%s: null result", __FUNCTION__); - - m_ResLen = strlen(res) + 1; - if (m_ResLen > sizeof(m_Res)) - regamedll_syserror("%s: too large result", __FUNCTION__); - - memcpy(m_Res, res, m_ResLen); -} - -bool CSteamAppGetCurrentGameLanguageCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamAppGetCurrentGameLanguageCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CSteamAppGetCurrentGameLanguageCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_ResLen, 4) - .write((char*)&m_Res, m_ResLen); -} - -void CSteamAppGetCurrentGameLanguageCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_ResLen, 4); - stream.read((char*)&m_Res, m_ResLen); -} - - - - - -/* ============================================================================ - CSteamGameServerInitCall -============================================================================ */ -CSteamGameServerInitCall::CSteamGameServerInitCall(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) -{ - if (pchVersionString == NULL) - regamedll_syserror("%s: version is null", __FUNCTION__); - - m_VersionLen = strlen(pchVersionString) + 1; - if (m_VersionLen > sizeof(m_Version)) - regamedll_syserror("%s: too long version string", __FUNCTION__); - - memcpy(m_Version, pchVersionString, m_VersionLen); - m_IP = unIP; - m_SteamPort = usSteamPort; - m_GamePort = usGamePort; - m_QueryPort = usQueryPort; - m_ServerMode = eServerMode; - m_Res = false; -} - -std::string CSteamGameServerInitCall::toString() -{ - std::stringstream ss; - ss << "SteamGameServer_Init( unIP: " << m_IP << "; usSteamPort: " << m_SteamPort - << "; usQueryPort: " << m_QueryPort << "; eServerMode: " << m_ServerMode - << "; pchVersionString: " << m_Version << " ) => " << m_Res; - return ss.str(); -} - -bool CSteamGameServerInitCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamGameServerInitCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_VersionLen != m_VersionLen) - return false; - - if (strcmp(otherCall->m_Version, m_Version)) - return false; - - if (otherCall->m_IP != m_IP) - return false; - - if (otherCall->m_SteamPort != m_SteamPort) - return false; - - if (otherCall->m_GamePort != m_GamePort) - return false; - - if (otherCall->m_QueryPort != m_QueryPort) - return false; - - if (otherCall->m_ServerMode != m_ServerMode) - return false; - - return true; -} - -void CSteamGameServerInitCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_IP, sizeof(m_IP)) - .write((char*)&m_SteamPort, sizeof(m_SteamPort)) - .write((char*)&m_GamePort, sizeof(m_GamePort)) - .write((char*)&m_QueryPort, sizeof(m_QueryPort)) - .write((char*)&m_ServerMode, sizeof(m_ServerMode)) - .write((char*)&m_VersionLen, sizeof(m_VersionLen)) - .write(m_Version, m_VersionLen); -} - -void CSteamGameServerInitCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 1); -} - -void CSteamGameServerInitCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_IP, sizeof(m_IP)) - .read((char*)&m_SteamPort, sizeof(m_SteamPort)) - .read((char*)&m_GamePort, sizeof(m_GamePort)) - .read((char*)&m_QueryPort, sizeof(m_QueryPort)) - .read((char*)&m_ServerMode, sizeof(m_ServerMode)) - .read((char*)&m_VersionLen, sizeof(m_VersionLen)); - stream.read(m_Version, m_VersionLen); -} - -void CSteamGameServerInitCall::readEpilogue(std::istream &stream) { - m_Res = false; - stream.read((char*)&m_Res, 1); -} - - - - - -/* ============================================================================ - CSteamGameServerCall -============================================================================ */ -std::string CSteamGameServerCall::toString() -{ - std::stringstream ss; - ss << "SteamGameServer( )"; - return ss.str(); -} - -bool CSteamGameServerCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamGameServerCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CSteamGameServerCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_ReturnNull, 1); -} - -void CSteamGameServerCall::readEpilogue(std::istream &stream) { - m_ReturnNull = false; - stream.read((char*)&m_ReturnNull, 1); -} - - - - - -/* ============================================================================ - CGameServerSetProductCall -============================================================================ */ -CGameServerSetProductCall::CGameServerSetProductCall(const char* product) -{ - if (product == NULL) - regamedll_syserror("%s: product is null", __FUNCTION__); - - m_ProductLen = strlen(product) + 1; - if (m_ProductLen > sizeof(m_Product)) - regamedll_syserror("%s: too long product string", __FUNCTION__); - - memcpy(m_Product, product, m_ProductLen); -} - -std::string CGameServerSetProductCall::toString() -{ - std::stringstream ss; - ss << "GS::SetProduct( product: " << m_Product << " ) "; - return ss.str(); -} - -bool CGameServerSetProductCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetProductCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_ProductLen != m_ProductLen) - return false; - - if (strcmp(otherCall->m_Product, m_Product)) - return false; - - return true; -} - -void CGameServerSetProductCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_ProductLen, sizeof(m_ProductLen)) - .write(m_Product, m_ProductLen); -} - -void CGameServerSetProductCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_ProductLen, sizeof(m_ProductLen)); - stream.read(m_Product, m_ProductLen); -} - - - - - -/* ============================================================================ - CGameServerSetModDirCall -============================================================================ */ -CGameServerSetModDirCall::CGameServerSetModDirCall(const char* dir) -{ - if (dir == NULL) - regamedll_syserror("%s: dir is null", __FUNCTION__); - - m_DirLen = strlen(dir) + 1; - if (m_DirLen > sizeof(m_Dir)) - regamedll_syserror("%s: too long dir string", __FUNCTION__); - - memcpy(m_Dir, dir, m_DirLen); -} - -std::string CGameServerSetModDirCall::toString() -{ - std::stringstream ss; - ss << "GS::SetGameDir( gamedir: " << m_Dir << " ) "; - return ss.str(); -} - -bool CGameServerSetModDirCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetModDirCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_DirLen != m_DirLen) - return false; - - if (strcmp(otherCall->m_Dir, m_Dir)) - return false; - - return true; -} - -void CGameServerSetModDirCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_DirLen, sizeof(m_DirLen)) - .write(m_Dir, m_DirLen); -} - -void CGameServerSetModDirCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_DirLen, sizeof(m_DirLen)); - stream.read(m_Dir, m_DirLen); -} - - - - - -/* ============================================================================ - CGameServerSetDedicatedServerCall -============================================================================ */ -CGameServerSetDedicatedServerCall::CGameServerSetDedicatedServerCall(bool dedicated) -{ - m_Dedicated = dedicated; -} - -std::string CGameServerSetDedicatedServerCall::toString() -{ - std::stringstream ss; - ss << "GS::SetDedicatedServer( dedicated: " << m_Dedicated << " ) "; - return ss.str(); -} - -bool CGameServerSetDedicatedServerCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetDedicatedServerCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Dedicated != m_Dedicated) - return false; - - return true; -} - -void CGameServerSetDedicatedServerCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Dedicated, 1); -} - -void CGameServerSetDedicatedServerCall::readPrologue(std::istream &stream) { - m_Dedicated = false; - stream.read((char*)&m_Dedicated, 1); -} - - - - - -/* ============================================================================ - CGameServerSetGameDescCall -============================================================================ */ -CGameServerSetGameDescCall::CGameServerSetGameDescCall(const char* desc) -{ - if (desc == NULL) - regamedll_syserror("%s: desc is null", __FUNCTION__); - - m_DescLen = strlen(desc) + 1; - if (m_DescLen > sizeof(m_Desc)) - regamedll_syserror("%s: too long dir string", __FUNCTION__); - - memcpy(m_Desc, desc, m_DescLen); -} - -std::string CGameServerSetGameDescCall::toString() -{ - std::stringstream ss; - ss << "GS::SetGameDescription( description: " << m_Desc << " ) "; - return ss.str(); -} - -bool CGameServerSetGameDescCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetGameDescCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_DescLen != m_DescLen) - return false; - - if (strcmp(otherCall->m_Desc, m_Desc)) - return false; - - return true; -} - -void CGameServerSetGameDescCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_DescLen, sizeof(m_DescLen)) - .write(m_Desc, m_DescLen); -} - -void CGameServerSetGameDescCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_DescLen, sizeof(m_DescLen)); - stream.read(m_Desc, m_DescLen); -} - - - - -/* ============================================================================ - CGameServerLogOnAnonymousCall -============================================================================ */ -std::string CGameServerLogOnAnonymousCall::toString() -{ - std::stringstream ss; - ss << "GS::LogOnAnonymous( ) "; - return ss.str(); -} - -bool CGameServerLogOnAnonymousCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerLogOnAnonymousCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - - - - - -/* ============================================================================ - CGameServerEnableHeartbeatsCall -============================================================================ */ -CGameServerEnableHeartbeatsCall::CGameServerEnableHeartbeatsCall(bool hearbeats) -{ - m_Heartbeats = hearbeats; -} - -std::string CGameServerEnableHeartbeatsCall::toString() -{ - std::stringstream ss; - ss << "GS::EnableHeartbeats( active: " << m_Heartbeats << " ) "; - return ss.str(); -} - -bool CGameServerEnableHeartbeatsCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerEnableHeartbeatsCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Heartbeats != m_Heartbeats) - return false; - - return true; -} - -void CGameServerEnableHeartbeatsCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Heartbeats, 1); -} - -void CGameServerEnableHeartbeatsCall::readPrologue(std::istream &stream) { - m_Heartbeats = false; - stream.read((char*)&m_Heartbeats, 1); -} - - - - - -/* ============================================================================ - CGameServerSetHeartbeatIntervalCall -============================================================================ */ -CGameServerSetHeartbeatIntervalCall::CGameServerSetHeartbeatIntervalCall(int interval) -{ - m_Interval = interval; -} - -std::string CGameServerSetHeartbeatIntervalCall::toString() -{ - std::stringstream ss; - ss << "GS::SetHeartbeatInterval( interval: " << m_Interval << " ) "; - return ss.str(); -} - -bool CGameServerSetHeartbeatIntervalCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetHeartbeatIntervalCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Interval != m_Interval) - return false; - - return true; -} - -void CGameServerSetHeartbeatIntervalCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Interval, 4); -} - -void CGameServerSetHeartbeatIntervalCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_Interval, 4); -} - - - - -/* ============================================================================ - CGameServerSetMaxPlayersCall -============================================================================ */ -CGameServerSetMaxPlayersCall::CGameServerSetMaxPlayersCall(int maxPlayers) -{ - m_MaxPlayers = maxPlayers; -} - -std::string CGameServerSetMaxPlayersCall::toString() -{ - std::stringstream ss; - ss << "GS::ServerSetMaxPlayersCount( count: " << m_MaxPlayers << " ) "; - return ss.str(); -} - -bool CGameServerSetMaxPlayersCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetMaxPlayersCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_MaxPlayers != m_MaxPlayers) - return false; - - return true; -} - -void CGameServerSetMaxPlayersCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_MaxPlayers, 4); -} - -void CGameServerSetMaxPlayersCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_MaxPlayers, 4); -} - - - - - -/* ============================================================================ - CGameServerSetBotCountCall -============================================================================ */ -CGameServerSetBotCountCall::CGameServerSetBotCountCall(int numBots) -{ - m_NumBots = numBots; -} - -std::string CGameServerSetBotCountCall::toString() -{ - std::stringstream ss; - ss << "GS::SetBotCount( count: " << m_NumBots << " ) "; - return ss.str(); -} - -bool CGameServerSetBotCountCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetBotCountCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_NumBots != m_NumBots) - return false; - - return true; -} - -void CGameServerSetBotCountCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_NumBots, 4); -} - -void CGameServerSetBotCountCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_NumBots, 4); -} - - - - - -/* ============================================================================ - CGameServerSetServerNameCall -============================================================================ */ -CGameServerSetServerNameCall::CGameServerSetServerNameCall(const char* serverName) -{ - if (serverName == NULL) - regamedll_syserror("%s: serverName is null", __FUNCTION__); - - m_ServerNameLen = strlen(serverName) + 1; - if (m_ServerNameLen > sizeof(m_ServerName)) - regamedll_syserror("%s: too long serverName string", __FUNCTION__); - - memcpy(m_ServerName, serverName, m_ServerNameLen); -} - -std::string CGameServerSetServerNameCall::toString() -{ - std::stringstream ss; - ss << "GS::SetServerName( serverName: " << m_ServerName << " ) "; - return ss.str(); -} - -bool CGameServerSetServerNameCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetServerNameCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_ServerNameLen != m_ServerNameLen) - return false; - - if (strcmp(otherCall->m_ServerName, m_ServerName)) - return false; - - return true; -} - -void CGameServerSetServerNameCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_ServerNameLen, sizeof(m_ServerNameLen)) - .write(m_ServerName, m_ServerNameLen); -} - -void CGameServerSetServerNameCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_ServerNameLen, sizeof(m_ServerNameLen)); - stream.read(m_ServerName, m_ServerNameLen); -} - - - - - -/* ============================================================================ - CGameServerSetMapNameCall -============================================================================ */ -CGameServerSetMapNameCall::CGameServerSetMapNameCall(const char* mapName) -{ - if (mapName == NULL) - regamedll_syserror("%s: serverName is null", __FUNCTION__); - - m_MapNameLen = strlen(mapName) + 1; - if (m_MapNameLen > sizeof(m_MapName)) - regamedll_syserror("%s: too long mapName string", __FUNCTION__); - - memcpy(m_MapName, mapName, m_MapNameLen); -} - -std::string CGameServerSetMapNameCall::toString() -{ - std::stringstream ss; - ss << "GS::SetMapName( serverName: " << m_MapName << " ) "; - return ss.str(); -} - -bool CGameServerSetMapNameCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetMapNameCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_MapNameLen != m_MapNameLen) - return false; - - if (strcmp(otherCall->m_MapName, m_MapName)) - return false; - - return true; -} - -void CGameServerSetMapNameCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_MapNameLen, sizeof(m_MapNameLen)) - .write(m_MapName, m_MapNameLen); -} - -void CGameServerSetMapNameCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_MapNameLen, sizeof(m_MapNameLen)); - stream.read(m_MapName, m_MapNameLen); -} - - - - - -/* ============================================================================ - CGameServerSetPasswordProtectedCall -============================================================================ */ -CGameServerSetPasswordProtectedCall::CGameServerSetPasswordProtectedCall(bool passwordProtected) -{ - m_PasswordProtected = passwordProtected; -} - -std::string CGameServerSetPasswordProtectedCall::toString() -{ - std::stringstream ss; - ss << "GS::SetPasswordProtected( protected: " << m_PasswordProtected << " ) "; - return ss.str(); -} - -bool CGameServerSetPasswordProtectedCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetPasswordProtectedCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_PasswordProtected != m_PasswordProtected) - return false; - - return true; -} - -void CGameServerSetPasswordProtectedCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_PasswordProtected, 1); -} - -void CGameServerSetPasswordProtectedCall::readPrologue(std::istream &stream) { - m_PasswordProtected = false; - stream.read((char*)&m_PasswordProtected, 1); -} - - - - - -/* ============================================================================ - CGameServerClearAllKVsCall -============================================================================ */ -std::string CGameServerClearAllKVsCall::toString() -{ - std::stringstream ss; - ss << "GS::ClearAllKeyValues( ) "; - return ss.str(); -} - -bool CGameServerClearAllKVsCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerClearAllKVsCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - - - - - -/* ============================================================================ - CGameServerSetKeyValueCall -============================================================================ */ -CGameServerSetKeyValueCall::CGameServerSetKeyValueCall(const char* key, const char* value) -{ - if (key == NULL) - regamedll_syserror("%s: key is null", __FUNCTION__); - - m_KeyLen = strlen(key) + 1; - if (m_KeyLen > sizeof(m_Key)) - regamedll_syserror("%s: too long key string", __FUNCTION__); - - memcpy(m_Key, key, m_KeyLen); - - if (value == NULL) - regamedll_syserror("%s: value is null", __FUNCTION__); - - m_ValueLen = strlen(value) + 1; - if (m_ValueLen > sizeof(m_Value)) - regamedll_syserror("%s: too long value string", __FUNCTION__); - - memcpy(m_Value, value, m_ValueLen); -} - -std::string CGameServerSetKeyValueCall::toString() -{ - std::stringstream ss; - ss << "GS::SetKeyValue( key: '" << m_Key << "'; value:'" << m_Value << "' ) "; - return ss.str(); -} - -bool CGameServerSetKeyValueCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSetKeyValueCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_KeyLen != m_KeyLen) - return false; - - if (otherCall->m_ValueLen != m_ValueLen) - return false; - - if (strcmp(otherCall->m_Key, m_Key)) - return false; - - if (strcmp(otherCall->m_Value, m_Value)) - return false; - - return true; -} - -void CGameServerSetKeyValueCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_ValueLen, sizeof(m_ValueLen)) - .write((char*)&m_KeyLen, sizeof(m_KeyLen)) - .write(m_Value, m_ValueLen) - .write(m_Key, m_KeyLen); -} - -void CGameServerSetKeyValueCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_ValueLen, sizeof(m_ValueLen)) - .read((char*)&m_KeyLen, sizeof(m_KeyLen)); - - stream - .read(m_Value, m_ValueLen) - .read(m_Key, m_KeyLen); -} - - - - -/* ============================================================================ - CSteamApiSetBreakpadAppIdCall -============================================================================ */ -CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32 appId) -{ - m_AppId = appId; -} - -std::string CSteamApiSetBreakpadAppIdCall::toString() -{ - std::stringstream ss; - ss << "SteamAPI_SetBreakpadAppID( count: " << m_AppId << " ) "; - return ss.str(); -} - -bool CSteamApiSetBreakpadAppIdCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamApiSetBreakpadAppIdCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_AppId != m_AppId) - return false; - - return true; -} - -void CSteamApiSetBreakpadAppIdCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_AppId, 4); -} - -void CSteamApiSetBreakpadAppIdCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_AppId, 4); -} - - - - - - -/* ============================================================================ - CGameServerWasRestartRequestedCall -============================================================================ */ -std::string CGameServerWasRestartRequestedCall::toString() -{ - std::stringstream ss; - ss << "GS::WasRestartRequested() => " << m_Result; - return ss.str(); -} - -bool CGameServerWasRestartRequestedCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerWasRestartRequestedCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGameServerWasRestartRequestedCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Result, 1); -} - -void CGameServerWasRestartRequestedCall::readPrologue(std::istream &stream) { - m_Result = false; - stream.read((char*)&m_Result, 1); -} - - - - - -/* ============================================================================ - CSteamGameServerRunCallbacksCall -============================================================================ */ -std::string CSteamGameServerRunCallbacksCall::toString() -{ - std::stringstream ss; - ss << "SteamGameServer_RunCallbacks()"; - return ss.str(); -} - -bool CSteamGameServerRunCallbacksCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamGameServerRunCallbacksCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - - - - - -/* ============================================================================ - CGameServerGetNextOutgoingPacketCall -============================================================================ */ -CGameServerGetNextOutgoingPacketCall::CGameServerGetNextOutgoingPacketCall(int maxOut) -{ - m_MaxOut = maxOut; - m_BufLen = m_Result = 0; m_Addr = 0; m_Port = 0; -} - -void CGameServerGetNextOutgoingPacketCall::setResult(void* buf, int res, uint32* pAddr, uint16* pPort) -{ - m_BufLen = res > 0 ? res : 0; - if (m_BufLen > 0) { - if (m_BufLen > sizeof(m_Buf)) - regamedll_syserror("%s: too long buffer returned", __FUNCTION__); - - memcpy(m_Buf, buf, m_BufLen); - } - m_Result = res; - - if (pAddr == NULL) - regamedll_syserror("%s: pAddr is NULL", __FUNCTION__); - - if (pPort == NULL) - regamedll_syserror("%s: pPort is NULL", __FUNCTION__); - - m_Addr = *pAddr; - m_Port = *pPort; -} - -std::string CGameServerGetNextOutgoingPacketCall::toString() -{ - std::stringstream ss; - ss << "GS::GetNextOutgoingPacket(buf: "; PrintBinaryArray(m_Buf, m_BufLen, ss); - ss << ", maxOut: " << m_MaxOut << ", addr: " << m_Addr << ", port: " << m_Port << " ) => " << m_Result; - - return ss.str(); -} - -bool CGameServerGetNextOutgoingPacketCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerGetNextOutgoingPacketCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_MaxOut != this->m_MaxOut) - return false; - - return true; -} - -void CGameServerGetNextOutgoingPacketCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_MaxOut, 4); - -} - -void CGameServerGetNextOutgoingPacketCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_Result, 4) - .write((char*)&m_Addr, 4) - .write((char*)&m_Port, 2) - .write((char*)&m_BufLen, 4) - .write(m_Buf, m_BufLen); -} - -void CGameServerGetNextOutgoingPacketCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_MaxOut, 4); - -} - -void CGameServerGetNextOutgoingPacketCall::readEpilogue(std::istream &stream) { - stream - .read((char*)&m_Result, 4) - .read((char*)&m_Addr, 4) - .read((char*)&m_Port, 2) - .read((char*)&m_BufLen, 4); - - stream.read(m_Buf, m_BufLen); -} - - - -/* ============================================================================ - CSteamApiRunCallbacksCall -============================================================================ */ -std::string CSteamApiRunCallbacksCall::toString() -{ - std::stringstream ss; - ss << "SteamAPI_RunCallbacks()"; - return ss.str(); -} - -bool CSteamApiRunCallbacksCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamApiRunCallbacksCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - - - - - -/* ============================================================================ - CGameServerGetSteamIdCall -============================================================================ */ -std::string CGameServerGetSteamIdCall::toString() -{ - std::stringstream ss; - ss << "GS::GetSteamId( ) => " << m_SteamId; - - return ss.str(); -} - -bool CGameServerGetSteamIdCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerGetSteamIdCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGameServerGetSteamIdCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_SteamId, 8); -} - -void CGameServerGetSteamIdCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_SteamId, 8); -} - - - - -/* ============================================================================ - CGameServerBSecureCall -============================================================================ */ -std::string CGameServerBSecureCall::toString() -{ - std::stringstream ss; - ss << "GS::BSecure( ) => " << m_Res; - - return ss.str(); -} - -bool CGameServerBSecureCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerBSecureCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGameServerBSecureCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 1); -} - -void CGameServerBSecureCall::readEpilogue(std::istream &stream) { - m_Res = false; - stream.read((char*)&m_Res, 1); -} - - - - -/* ============================================================================ - CGameServerHandleIncomingPacketCall -============================================================================ */ - -CGameServerHandleIncomingPacketCall::CGameServerHandleIncomingPacketCall(const void *pData, int cbData, uint32 srcIP, uint16 srcPort) -{ - m_Len = cbData; - if (m_Len > sizeof(m_Data)) - regamedll_syserror("%s: too long packet", __FUNCTION__); - - memcpy(m_Data, pData, m_Len); - m_Ip = srcIP; - m_Port = srcPort; - m_Res = false; -} - -std::string CGameServerHandleIncomingPacketCall::toString() -{ - std::stringstream ss; - ss << "GS::CGameServerHandleIncomingPacketCall(data: "; PrintBinaryArray(m_Data, m_Len, ss); - ss << ", len: " << m_Len << ", ip: " << m_Ip << ", port: " << m_Port << ") => " << m_Res; - - return ss.str(); -} - -bool CGameServerHandleIncomingPacketCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerHandleIncomingPacketCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (m_Len != otherCall->m_Len) - return false; - - if (memcmp(m_Data, otherCall->m_Data, m_Len)) - return false; - - if (m_Ip != otherCall->m_Ip || m_Port != otherCall->m_Port) - return false; - - return true; -} - -void CGameServerHandleIncomingPacketCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_Ip, 4) - .write((char*)&m_Port, 2) - .write((char*)&m_Len, 4) - .write(m_Data, m_Len); -} - -void CGameServerHandleIncomingPacketCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_Ip, 4) - .read((char*)&m_Port, 2) - .read((char*)&m_Len, 4); - - stream.read(m_Data, m_Len); -} - -void CGameServerHandleIncomingPacketCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 1); -} - -void CGameServerHandleIncomingPacketCall::readEpilogue(std::istream &stream) { - m_Res = false; - stream.read((char*)&m_Res, 1); -} - - - - - -/* ============================================================================ - CGameServerSendUserConnectAndAuthenticateCall -============================================================================ */ -CGameServerSendUserConnectAndAuthenticateCall::CGameServerSendUserConnectAndAuthenticateCall(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize) -{ - m_AuthBlobLen = cubAuthBlobSize; - if (m_AuthBlobLen > sizeof(m_AuthBlob)) - regamedll_syserror("%s: too long auth blob", __FUNCTION__); - - memcpy(m_AuthBlob, pvAuthBlob, m_AuthBlobLen); - m_IP = unIPClient; - m_OutSteamId = 0; - m_Res = false; -} - -std::string CGameServerSendUserConnectAndAuthenticateCall::toString() -{ - std::stringstream ss; - ss << "GS::CGameServerSendUserConnectAndAuthenticateCall(ip: " << m_IP << "authBlob: "; PrintBinaryArray(m_AuthBlob, m_AuthBlobLen, ss); - ss << ", authBlobLen: " << m_AuthBlobLen << ", steamId: " << m_OutSteamId << ") => " << m_Res; - - return ss.str(); -} - -bool CGameServerSendUserConnectAndAuthenticateCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSendUserConnectAndAuthenticateCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (m_AuthBlobLen != otherCall->m_AuthBlobLen) - return false; - - if (strict) { - if (memcmp(m_AuthBlob, otherCall->m_AuthBlob, m_AuthBlobLen)) - return false; - } - - if (m_IP != otherCall->m_IP) - return false; - - return true; -} - -void CGameServerSendUserConnectAndAuthenticateCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_IP, 4) - .write((char*)&m_AuthBlobLen, 4) - .write(m_AuthBlob, m_AuthBlobLen); -} - -void CGameServerSendUserConnectAndAuthenticateCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_IP, 4) - .read((char*)&m_AuthBlobLen, 4); - - stream.read(m_AuthBlob, m_AuthBlobLen); -} - -void CGameServerSendUserConnectAndAuthenticateCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_OutSteamId, 8) - .write((char*)&m_Res, 1); -} - -void CGameServerSendUserConnectAndAuthenticateCall::readEpilogue(std::istream &stream) { - m_Res = false; - stream - .read((char*)&m_OutSteamId, 8) - .read((char*)&m_Res, 1); -} - - - - - -/* ============================================================================ - CGameServerSendUserDisconnectCall -============================================================================ */ -std::string CGameServerSendUserDisconnectCall::toString() -{ - std::stringstream ss; - ss << "GS::CGameServerSendUserDisconnectCall(steamId: " << m_SteamId << ") "; - return ss.str(); -} - -bool CGameServerSendUserDisconnectCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerSendUserDisconnectCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (m_SteamId != otherCall->m_SteamId) - return false; - - return true; -} - -void CGameServerSendUserDisconnectCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_SteamId, 8); -} - -void CGameServerSendUserDisconnectCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_SteamId, 8); -} - - - - - -/* ============================================================================ - CGameServerBUpdateUserDataCall -============================================================================ */ -CGameServerBUpdateUserDataCall::CGameServerBUpdateUserDataCall(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore) -{ - m_PlayerNameLen = strlen(pchPlayerName) + 1; - if (m_PlayerNameLen > sizeof(m_PlayerName)) - regamedll_syserror("%s: too long player name", __FUNCTION__); - - memcpy(m_PlayerName, pchPlayerName, m_PlayerNameLen); - m_SteamId = steamIDUser.ConvertToUint64(); - m_Score = uScore; -} - -std::string CGameServerBUpdateUserDataCall::toString() -{ - std::stringstream ss; - ss << "GS::BUpdateUserData(steamIDUser: " << m_SteamId << "playerName: "; PrintBinaryArray(m_PlayerName, m_PlayerNameLen, ss); - ss << ", uScore: " << m_Score << " ) => " << m_Res; - - return ss.str(); -} - -bool CGameServerBUpdateUserDataCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerBUpdateUserDataCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (m_PlayerNameLen != otherCall->m_PlayerNameLen) - return false; - - if (memcmp(m_PlayerName, otherCall->m_PlayerName, m_PlayerNameLen)) - return false; - - if (m_SteamId != otherCall->m_SteamId) - return false; - - if (m_Score != otherCall->m_Score) - return false; - - return true; -} - -void CGameServerBUpdateUserDataCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_SteamId, 8) - .write((char*)&m_Score, 4) - .write((char*)&m_PlayerNameLen, 4) - .write(m_PlayerName, m_PlayerNameLen); -} - -void CGameServerBUpdateUserDataCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_SteamId, 8) - .read((char*)&m_Score, 4) - .read((char*)&m_PlayerNameLen, 4); - - stream.read(m_PlayerName, m_PlayerNameLen); -} - -void CGameServerBUpdateUserDataCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 1); -} - -void CGameServerBUpdateUserDataCall::readEpilogue(std::istream &stream) { - m_Res = false; - stream.read((char*)&m_Res, 1); -} - - - - -/* ============================================================================ - CGameServerCreateUnauthUserConnectionCall -============================================================================ */ -std::string CGameServerCreateUnauthUserConnectionCall::toString() -{ - std::stringstream ss; - ss << "GS::CreateUnauthUserConnection() => " << m_SteamId; - - return ss.str(); -} - -bool CGameServerCreateUnauthUserConnectionCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerCreateUnauthUserConnectionCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - - -void CGameServerCreateUnauthUserConnectionCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_SteamId, 8); -} - -void CGameServerCreateUnauthUserConnectionCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_SteamId, 8); -} - - - - - -/* ============================================================================ - CGetHostNameCall -============================================================================ */ -std::string CGetHostNameCall::toString() -{ - std::stringstream ss; - ss << "gethostname(name: " << m_Name << "; nameLen: " << m_NameLenIn << " ) => " << m_Res; - - return ss.str(); -} - -bool CGetHostNameCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetHostNameCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_NameLenIn != this->m_NameLenIn) - return false; - - return true; -} - -void CGetHostNameCall::setResult(char* hostName, int res) { - m_NameLenOut = strlen(hostName) + 1; - - if (m_NameLenOut > sizeof(m_Name)) - regamedll_syserror("%s: too long host name", __FUNCTION__); - - strcpy(m_Name, hostName); - m_Res = res; -} - -void CGetHostNameCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_NameLenIn, 4); -} - -void CGetHostNameCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_NameLenIn, 4); -} - -void CGetHostNameCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_NameLenOut, 4) - .write((char*)&m_Res, 4) - .write(m_Name, m_NameLenOut); -} - -void CGetHostNameCall::readEpilogue(std::istream &stream) { - stream - .read((char*)&m_NameLenOut, 4) - .read((char*)&m_Res, 4); - - stream.read(m_Name, m_NameLenOut); -} - - - - -/* ============================================================================ - CGetHostByNameCall -============================================================================ */ -CGetHostByNameCall::CGetHostByNameCall(const char* name) -{ - m_NameLen = strlen(name) + 1; - if (m_NameLen > sizeof(m_Name)) - regamedll_syserror("%s: too long name", __FUNCTION__); - - strcpy(m_Name, name); -} - -std::string CGetHostByNameCall::toString() -{ - std::stringstream ss; - ss << "gethostbyname(name: " << m_Name << " ) => <>"; - - return ss.str(); -} - -bool CGetHostByNameCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetHostByNameCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_NameLen != this->m_NameLen) - return false; - - if (strcmp(otherCall->m_Name, this->m_Name)) - return false; - - return true; -} - -void CGetHostByNameCall::setResult(const hostent* hostEnt) { - m_HostentData.hostNameLen = strlen(hostEnt->h_name) + 1; - if (m_HostentData.hostNameLen > sizeof(m_HostentData.hostName)) { - regamedll_syserror("%s: too long host name", __FUNCTION__); - } - - strcpy(m_HostentData.hostName, hostEnt->h_name); - int i = 0; - while (hostEnt->h_aliases[i]) { - if (i >= HOSTENT_DATA_MAX_ALIASES) { - regamedll_syserror("%s: too many aliases", __FUNCTION__); - } - - m_HostentData.aliasesLengths[i] = strlen(hostEnt->h_aliases[i]) + 1; - if (m_HostentData.aliasesLengths[i] > sizeof(m_HostentData.aliases[i])) { - regamedll_syserror("%s: too long alias", __FUNCTION__); - } - - strcpy(m_HostentData.aliases[i], hostEnt->h_aliases[i]); - i++; - } - m_HostentData.numAliases = i; - - m_HostentData.addrtype = hostEnt->h_addrtype; - m_HostentData.addrLen = hostEnt->h_length; - if (m_HostentData.addrLen > sizeof(m_HostentData.addrs[0])) { - regamedll_syserror("%s: too long addr", __FUNCTION__); - } - - i = 0; - while (hostEnt->h_addr_list[i]) { - if (i >= HOSTENT_DATA_MAX_ADDRS) { - regamedll_syserror("%s: too many addrs", __FUNCTION__); - } - - memcpy(m_HostentData.addrs[i], hostEnt->h_addr_list[i], m_HostentData.addrLen); - i++; - } - m_HostentData.numAddrs = i; -} - -void CGetHostByNameCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_NameLen, 4).write(m_Name, m_NameLen); -} - -void CGetHostByNameCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_NameLen, 4); - stream.read(m_Name, m_NameLen); -} - -void CGetHostByNameCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_HostentData.hostNameLen, 4) - .write((char*)&m_HostentData.numAddrs, 4) - .write((char*)&m_HostentData.numAliases, 4) - .write((char*)&m_HostentData.addrLen, 2) - .write((char*)&m_HostentData.addrtype, 2) - .write(m_HostentData.hostName, m_HostentData.hostNameLen) - .write((char*)&m_HostentData.aliasesLengths[0], 4 * m_HostentData.numAliases); - - for (int i = 0; i < m_HostentData.numAliases; i++) { - stream.write(m_HostentData.aliases[i], m_HostentData.aliasesLengths[i]); - } - - for (int i = 0; i < m_HostentData.numAddrs; i++) { - stream.write(m_HostentData.addrs[i], m_HostentData.addrLen); - } -} - -void CGetHostByNameCall::readEpilogue(std::istream &stream) { - stream - .read((char*)&m_HostentData.hostNameLen, 4) - .read((char*)&m_HostentData.numAddrs, 4) - .read((char*)&m_HostentData.numAliases, 4) - .read((char*)&m_HostentData.addrLen, 2) - .read((char*)&m_HostentData.addrtype, 2); - - stream - .read(m_HostentData.hostName, m_HostentData.hostNameLen) - .read((char*)&m_HostentData.aliasesLengths[0], 4 * m_HostentData.numAliases); - - for (int i = 0; i < m_HostentData.numAliases; i++) { - stream.read(m_HostentData.aliases[i], m_HostentData.aliasesLengths[i]); - } - - for (int i = 0; i < m_HostentData.numAddrs; i++) { - stream.read(m_HostentData.addrs[i], m_HostentData.addrLen); - } -} - - - - - -/* ============================================================================ - CGetProcessTimesCall -============================================================================ */ -std::string CGetProcessTimesCall::toString() -{ - std::stringstream ss; - - ss << "GetProcessTimes( creationTime: "; PrintFileTime(&m_CreationTime, ss); - ss << "; exitTime: "; PrintFileTime(&m_ExitTime, ss); - ss << "; kernelTime: "; PrintFileTime(&m_KernelTime, ss); - ss << "; userTime: "; PrintFileTime(&m_UserTime, ss); - ss << " ) => " << m_Res; - return ss.str(); -} - -bool CGetProcessTimesCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetProcessTimesCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGetProcessTimesCall::setResult(BOOL res, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime) -{ - m_Res = res; - memcpy(&m_CreationTime, lpCreationTime, sizeof(m_CreationTime)); - memcpy(&m_ExitTime, lpExitTime, sizeof(m_ExitTime)); - memcpy(&m_KernelTime, lpKernelTime, sizeof(m_KernelTime)); - memcpy(&m_UserTime, lpUserTime, sizeof(m_UserTime)); -} - -void CGetProcessTimesCall::writeEpilogue(std::ostream &stream) { - stream - .write((char*)&m_CreationTime, sizeof(m_CreationTime)) - .write((char*)&m_ExitTime, sizeof(m_ExitTime)) - .write((char*)&m_KernelTime, sizeof(m_KernelTime)) - .write((char*)&m_UserTime, sizeof(m_UserTime)) - .write((char*)&m_Res, 1); -} - -void CGetProcessTimesCall::readEpilogue(std::istream &stream) { - m_Res = 0; - stream - .read((char*)&m_CreationTime, sizeof(m_CreationTime)) - .read((char*)&m_ExitTime, sizeof(m_ExitTime)) - .read((char*)&m_KernelTime, sizeof(m_KernelTime)) - .read((char*)&m_UserTime, sizeof(m_UserTime)) - .read((char*)&m_Res, 1); -} - - - - -/* ============================================================================ - CGetSystemTimeAsFileTimeCall -============================================================================ */ -std::string CGetSystemTimeAsFileTimeCall::toString() -{ - std::stringstream ss; - - ss << "GetSystemTimeAsFileTime( systemTime: "; PrintFileTime(&m_SystemTime, ss); - ss << " )"; - return ss.str(); -} - -bool CGetSystemTimeAsFileTimeCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGetSystemTimeAsFileTimeCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGetSystemTimeAsFileTimeCall::setResult(LPFILETIME systemTime) -{ - memcpy(&m_SystemTime, systemTime, sizeof(m_SystemTime)); -} - -void CGetSystemTimeAsFileTimeCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_SystemTime, sizeof(m_SystemTime)); -} - -void CGetSystemTimeAsFileTimeCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_SystemTime, sizeof(m_SystemTime)); -} - - - - - -/* ============================================================================ - CStdTimeCall -============================================================================ */ -CStdTimeCall::CStdTimeCall(uint32* inTime) -{ - m_InTimeNull = (inTime == NULL); -} - -std::string CStdTimeCall::toString() -{ - std::stringstream ss; - - ss << "time( isNull: " << m_InTimeNull << ") => " << m_Res; - return ss.str(); -} - -bool CStdTimeCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CStdTimeCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_InTimeNull != this->m_InTimeNull) - return false; - - return true; -} - -void CStdTimeCall::setResult(uint32 res) -{ - m_Res = res; -} - -void CStdTimeCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_InTimeNull, 1); -} - -void CStdTimeCall::readPrologue(std::istream &stream) { - m_InTimeNull = false; - stream.read((char*)&m_InTimeNull, 1); -} - -void CStdTimeCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CStdTimeCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - - - - -/* ============================================================================ - CStdLocalTimeCall -============================================================================ */ -CStdLocalTimeCall::CStdLocalTimeCall(uint32 inTime) -{ - m_Time = inTime; -} - -std::string CStdLocalTimeCall::toString() -{ - std::stringstream ss; - - ss << "localTime( time: " << m_Time << ") => "; - PrintTm(&m_Res, ss); - return ss.str(); -} - -bool CStdLocalTimeCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CStdLocalTimeCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Time != this->m_Time) - return false; - - return true; -} - -void CStdLocalTimeCall::setResult(struct tm *res) -{ - memcpy(&m_Res, res, sizeof(m_Res)); -} - -void CStdLocalTimeCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Time, 4); -} - -void CStdLocalTimeCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_Time, 4); -} - -void CStdLocalTimeCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, sizeof(m_Res)); -} - -void CStdLocalTimeCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, sizeof(m_Res)); -} - - - - - -/* ============================================================================ - CStdSrandCall -============================================================================ */ -std::string CStdSrandCall::toString() -{ - std::stringstream ss; - - ss << "srand( seed: " << m_Seed << ") "; - return ss.str(); -} - -bool CStdSrandCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CStdSrandCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_Seed != this->m_Seed) - return false; - - return true; -} - -void CStdSrandCall::writePrologue(std::ostream &stream) { - stream.write((char*)&m_Seed, 4); -} - -void CStdSrandCall::readPrologue(std::istream &stream) { - stream.read((char*)&m_Seed, 4); -} - - - - - -/* ============================================================================ - CStdRandCall -============================================================================ */ -std::string CStdRandCall::toString() -{ - std::stringstream ss; - - ss << "rand( ) => " << m_Res; - return ss.str(); -} - -bool CStdRandCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CStdRandCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CStdRandCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 4); -} - -void CStdRandCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_Res, 4); -} - - - - - -/* ============================================================================ - CGameServerLogOffCall -============================================================================ */ -std::string CGameServerLogOffCall::toString() -{ - std::stringstream ss; - - ss << "GS:LogOff( ) "; - return ss.str(); -} - -bool CGameServerLogOffCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerLogOffCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - - - - -/* ============================================================================ - CSteamGameServerShutdownCall -============================================================================ */ -std::string CSteamGameServerShutdownCall::toString() -{ - std::stringstream ss; - - ss << "SteamGameServer_Shutdown( ) "; - return ss.str(); -} - -bool CSteamGameServerShutdownCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamGameServerShutdownCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - - - - - -/* ============================================================================ - CSteamApiUnregisterCallbackCall -============================================================================ */ -CSteamApiUnregisterCallbackCall::CSteamApiUnregisterCallbackCall(int regamedllCallbackId, CCallbackBase* cb) -{ - m_ReGameDLLCallbackId = regamedllCallbackId; - m_InState.m_iCallback = cb->GetICallback(); - m_InState.m_nCallbackFlags = cb->GetFlags(); - m_OutState.clear(); -} - -std::string CSteamApiUnregisterCallbackCall::toString() -{ - std::stringstream ss; - ss << "SteamAPI_UnregisterCallback( regamedllCallbackId: " << m_ReGameDLLCallbackId << " )"; - return ss.str(); -} - -bool CSteamApiUnregisterCallbackCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CSteamApiUnregisterCallbackCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - if (otherCall->m_ReGameDLLCallbackId != m_ReGameDLLCallbackId) - return false; - - if (otherCall->m_InState.m_iCallback != m_InState.m_iCallback) return false; - if (otherCall->m_InState.m_nCallbackFlags != m_InState.m_nCallbackFlags) return false; - - return true; -} - -void CSteamApiUnregisterCallbackCall::writePrologue(std::ostream &stream) { - stream - .write((char*)&m_InState, sizeof(m_InState)) - .write((char*)&m_ReGameDLLCallbackId, 4); -} - -void CSteamApiUnregisterCallbackCall::readPrologue(std::istream &stream) { - stream - .read((char*)&m_InState, sizeof(m_InState)) - .read((char*)&m_ReGameDLLCallbackId, 4); -} - -void CSteamApiUnregisterCallbackCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_OutState, sizeof(m_OutState)); -} - -void CSteamApiUnregisterCallbackCall::readEpilogue(std::istream &stream) { - stream.read((char*)&m_OutState, sizeof(m_OutState)); -} - - - - -/* ============================================================================ - CGameServerBLoggedOnCall -============================================================================ */ -std::string CGameServerBLoggedOnCall::toString() -{ - std::stringstream ss; - ss << "GS::BLoggedOn( ) => " << m_Res; - - return ss.str(); -} - -bool CGameServerBLoggedOnCall::compareInputArgs(IEngExtCall* other, bool strict) -{ - CGameServerBLoggedOnCall* otherCall = dynamic_cast(other); - if (otherCall == NULL) - return false; - - return true; -} - -void CGameServerBLoggedOnCall::writeEpilogue(std::ostream &stream) { - stream.write((char*)&m_Res, 1); -} - -void CGameServerBLoggedOnCall::readEpilogue(std::istream &stream) { - m_Res = false; - stream.read((char*)&m_Res, 1); -} - -/* -class CGameServerBLoggedOnCall : public IEngExtCall { -public: -bool m_Res; - -public: -CGameServerBLoggedOnCall() { m_Res = false; } - -void setResult(bool res) { m_Res = res; } -virtual bool compareInputArgs(IEngExtCall* other); -virtual std::string toString(); -virtual ExtCallFuncs getOpcode() { return ECF_GS_BLOGGEDON; } -virtual void writeEpilogue(std::ostream &stream); -virtual void readEpilogue(std::istream &stream); -}; -*/ - -#define IEngExtCallFactory_CreateFuncCall(clazz, buf, bufLen) \ - if (sizeof(clazz) > bufLen) regamedll_syserror("%s: buffer to small", __FUNCTION__); \ - return new(buf) clazz(); - -IEngExtCall* IEngExtCallFactory::createByOpcode(ExtCallFuncs opc, void* buf, int ptrSize) { - switch (opc) { - case ECF_SLEEP: IEngExtCallFactory_CreateFuncCall(CSleepExtCall, buf, ptrSize); - case ECF_QUERY_PERF_FREQ: IEngExtCallFactory_CreateFuncCall(CQueryPerfFreqCall, buf, ptrSize); - case ECF_QUERY_PERF_COUNTER: IEngExtCallFactory_CreateFuncCall(CQueryPerfCounterCall, buf, ptrSize); - case ECF_GET_TICK_COUNT: IEngExtCallFactory_CreateFuncCall(CGetTickCountCall, buf, ptrSize); - case ECF_GET_LOCAL_TIME: IEngExtCallFactory_CreateFuncCall(CGetLocalTimeCall, buf, ptrSize); - case ECF_GET_SYSTEM_TIME: IEngExtCallFactory_CreateFuncCall(CGetSystemTimeCall, buf, ptrSize); - case ECF_GET_TIMEZONE_INFO: IEngExtCallFactory_CreateFuncCall(CGetTimeZoneInfoCall, buf, ptrSize); - - case ECF_SOCKET: IEngExtCallFactory_CreateFuncCall(CSocketCall, buf, ptrSize); - case ECF_IOCTL_SOCKET: IEngExtCallFactory_CreateFuncCall(CIoCtlSocketCall, buf, ptrSize); - case ECF_SET_SOCK_OPT: IEngExtCallFactory_CreateFuncCall(CSetSockOptCall, buf, ptrSize); - case ECF_CLOSE_SOCKET: IEngExtCallFactory_CreateFuncCall(CCloseSocketCall, buf, ptrSize); - case ECF_RECVFROM: IEngExtCallFactory_CreateFuncCall(CRecvFromCall, buf, ptrSize); - case ECF_SENDTO: IEngExtCallFactory_CreateFuncCall(CSendToCall, buf, ptrSize); - case ECF_BIND: IEngExtCallFactory_CreateFuncCall(CBindCall , buf, ptrSize); - case ECF_GET_SOCK_NAME: IEngExtCallFactory_CreateFuncCall(CGetSockNameCall, buf, ptrSize); - case ECF_WSA_GET_LAST_ERROR: IEngExtCallFactory_CreateFuncCall(CWSAGetLastErrorCall, buf, ptrSize); - - case ECF_STEAM_CALLBACK_CALL_1: IEngExtCallFactory_CreateFuncCall(CSteamCallbackCall1, buf, ptrSize); - case ECF_STEAM_CALLBACK_CALL_2: IEngExtCallFactory_CreateFuncCall(CSteamCallbackCall2, buf, ptrSize); - - case ECF_STEAM_API_REGISTER_CALLBACK: IEngExtCallFactory_CreateFuncCall(CSteamApiRegisterCallbackCall, buf, ptrSize); - case ECF_STEAM_API_INIT: IEngExtCallFactory_CreateFuncCall(CSteamApiRegisterCallbackCall, buf, ptrSize); - case ECF_STEAM_API_UNREGISTER_CALL_RESULT: IEngExtCallFactory_CreateFuncCall(CSteamApiUnrigestierCallResultCall, buf, ptrSize); - case ECF_STEAMAPPS: IEngExtCallFactory_CreateFuncCall(CSteamAppsCall, buf, ptrSize); - case ECF_STEAMAPPS_GET_CURRENT_GAME_LANGUAGE: IEngExtCallFactory_CreateFuncCall(CSteamAppGetCurrentGameLanguageCall, buf, ptrSize); - - case ECF_STEAMGAMESERVER_INIT: IEngExtCallFactory_CreateFuncCall(CSteamGameServerInitCall, buf, ptrSize); - case ECF_STEAMGAMESERVER: IEngExtCallFactory_CreateFuncCall(CSteamGameServerCall, buf, ptrSize); - case ECF_GS_SET_PRODUCT: IEngExtCallFactory_CreateFuncCall(CGameServerSetProductCall, buf, ptrSize); - case ECF_GS_SET_GAME_DIR: IEngExtCallFactory_CreateFuncCall(CGameServerSetModDirCall, buf, ptrSize); - case ECF_GS_SET_DEDICATED_SERVER: IEngExtCallFactory_CreateFuncCall(CGameServerSetDedicatedServerCall, buf, ptrSize); - case ECF_GS_SET_GAME_DESC: IEngExtCallFactory_CreateFuncCall(CGameServerSetGameDescCall, buf, ptrSize); - case ECF_GS_LOG_ON_ANONYMOUS: IEngExtCallFactory_CreateFuncCall(CGameServerLogOnAnonymousCall, buf, ptrSize); - case ECF_GS_ENABLE_HEARTBEATS: IEngExtCallFactory_CreateFuncCall(CGameServerEnableHeartbeatsCall, buf, ptrSize); - case ECF_GS_SET_HEARTBEATS_INTERVAL: IEngExtCallFactory_CreateFuncCall(CGameServerSetHeartbeatIntervalCall, buf, ptrSize); - case ECF_GS_SET_MAX_PLAYERS_COUNT: IEngExtCallFactory_CreateFuncCall(CGameServerSetMaxPlayersCall, buf, ptrSize); - case ECF_GS_SET_BOT_PLAYERS_COUNT: IEngExtCallFactory_CreateFuncCall(CGameServerSetBotCountCall, buf, ptrSize); - case ECF_GS_SET_SERVER_NAME: IEngExtCallFactory_CreateFuncCall(CGameServerSetServerNameCall, buf, ptrSize); - case ECF_GS_SET_MAP_NAME: IEngExtCallFactory_CreateFuncCall(CGameServerSetMapNameCall, buf, ptrSize); - case ECF_GS_SET_PASSWORD_PROTECTED: IEngExtCallFactory_CreateFuncCall(CGameServerSetPasswordProtectedCall, buf, ptrSize); - case ECF_GS_CLEAR_ALL_KEY_VALUES: IEngExtCallFactory_CreateFuncCall(CGameServerClearAllKVsCall, buf, ptrSize); - case ECF_GS_SET_KEY_VALUE: IEngExtCallFactory_CreateFuncCall(CGameServerSetKeyValueCall, buf, ptrSize); - case ECF_STEAM_API_SET_BREAKPAD_APP_ID: IEngExtCallFactory_CreateFuncCall(CSteamApiSetBreakpadAppIdCall, buf, ptrSize); - case ECF_GS_WAS_RESTART_REQUESTED: IEngExtCallFactory_CreateFuncCall(CGameServerWasRestartRequestedCall, buf, ptrSize); - case ECF_STEAMGAMESERVER_RUN_CALLBACKS: IEngExtCallFactory_CreateFuncCall(CSteamGameServerRunCallbacksCall, buf, ptrSize); - case ECF_GS_GET_NEXT_OUTGOING_PACKET: IEngExtCallFactory_CreateFuncCall(CGameServerGetNextOutgoingPacketCall, buf, ptrSize); - case ECF_STEAM_API_RUN_CALLBACKS: IEngExtCallFactory_CreateFuncCall(CSteamApiRunCallbacksCall, buf, ptrSize); - case ECF_GS_GET_STEAM_ID: IEngExtCallFactory_CreateFuncCall(CGameServerGetSteamIdCall, buf, ptrSize); - case ECF_GS_BSECURE: IEngExtCallFactory_CreateFuncCall(CGameServerBSecureCall, buf, ptrSize); - case ECF_GS_HANDLE_INCOMING_PACKET: IEngExtCallFactory_CreateFuncCall(CGameServerHandleIncomingPacketCall, buf, ptrSize); - case ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE: IEngExtCallFactory_CreateFuncCall(CGameServerSendUserConnectAndAuthenticateCall, buf, ptrSize); - case ECF_GS_SEND_USER_DISCONNECT: IEngExtCallFactory_CreateFuncCall(CGameServerSendUserDisconnectCall, buf, ptrSize); - case ECF_GS_BUPDATE_USER_DATA: IEngExtCallFactory_CreateFuncCall(CGameServerBUpdateUserDataCall, buf, ptrSize); - case ECF_GS_CREATE_UNAUTH_USER_CONNECTION: IEngExtCallFactory_CreateFuncCall(CGameServerCreateUnauthUserConnectionCall, buf, ptrSize); - case ECF_GET_HOST_BY_NAME: IEngExtCallFactory_CreateFuncCall(CGetHostByNameCall, buf, ptrSize); - case ECF_GET_HOST_NAME: IEngExtCallFactory_CreateFuncCall(CGetHostNameCall, buf, ptrSize); - - case ECF_GET_PROCESS_TIMES: IEngExtCallFactory_CreateFuncCall(CGetProcessTimesCall, buf, ptrSize); - case ECF_GET_SYSTEM_TIME_AS_FILE_TIME: IEngExtCallFactory_CreateFuncCall(CGetSystemTimeAsFileTimeCall, buf, ptrSize); - - case ECF_CSTD_TIME: IEngExtCallFactory_CreateFuncCall(CStdTimeCall, buf, ptrSize); - case ECF_CSTD_LOCALTIME: IEngExtCallFactory_CreateFuncCall(CStdLocalTimeCall, buf, ptrSize); - case ECF_CSTD_SRAND_CALL: IEngExtCallFactory_CreateFuncCall(CStdSrandCall, buf, ptrSize); - case ECF_CSTD_RAND_CALL: IEngExtCallFactory_CreateFuncCall(CStdRandCall, buf, ptrSize); - - case ECF_GS_LOGOFF: IEngExtCallFactory_CreateFuncCall(CGameServerLogOffCall, buf, ptrSize); - - case ECF_STEAMGAMESERVER_SHUTDOWN: IEngExtCallFactory_CreateFuncCall(CSteamGameServerShutdownCall, buf, ptrSize); - - case ECF_STEAM_API_UNREGISTER_CALLBACK: IEngExtCallFactory_CreateFuncCall(CSteamApiUnregisterCallbackCall, buf, ptrSize); - - case ECF_GS_BLOGGEDON: IEngExtCallFactory_CreateFuncCall(CGameServerBLoggedOnCall, buf, ptrSize); - - - default: - regamedll_syserror("%s: unknown funccall opcode %d", __FUNCTION__, opc); - return NULL; - } -} diff --git a/regamedll/testsuite/funccalls.h b/regamedll/testsuite/funccalls.h deleted file mode 100644 index 477cc7b5..00000000 --- a/regamedll/testsuite/funccalls.h +++ /dev/null @@ -1,1272 +0,0 @@ -#pragma once -#ifdef _WIN32 - -#include "osconfig.h" - -#include "steam/steam_api.h" -#include "steam/steam_gameserver.h" - -#include -#include -#include - -#define HOSTENT_DATA_MAX_ALIASES 10 -#define HOSTENT_DATA_MAX_ADDRS 32 - -struct hostent_data_t { - char hostName[256]; - int hostNameLen; - - int numAliases; - char aliases[HOSTENT_DATA_MAX_ALIASES][256]; - int aliasesLengths[HOSTENT_DATA_MAX_ALIASES]; - - short addrtype; - short addrLen; - int numAddrs; - char addrs[HOSTENT_DATA_MAX_ADDRS][32]; - - //Used by reader only - char* preparedAddrs[HOSTENT_DATA_MAX_ADDRS + 1]; - char* preparedAliases[HOSTENT_DATA_MAX_ALIASES + 1]; - - - void clear() { - hostName[0] = 0; - hostNameLen = 0; - - numAliases = 0; - for (int i = 0; i < HOSTENT_DATA_MAX_ALIASES; i++) { - aliasesLengths[i] = 0; - aliases[i][0] = 0; - } - - addrtype = 0; - addrLen = 0; - numAddrs = 0; - } -}; - -enum ExtCallFuncs { - ECF_NONE = 0, - ECF_SLEEP = 1, - ECF_QUERY_PERF_FREQ = 2, - ECF_QUERY_PERF_COUNTER = 3, - ECF_GET_TICK_COUNT = 4, - ECF_GET_LOCAL_TIME = 5, - ECF_GET_SYSTEM_TIME = 6, - ECF_GET_TIMEZONE_INFO = 7, - - ECF_SOCKET = 8, - ECF_IOCTL_SOCKET = 9, - ECF_SET_SOCK_OPT = 10, - ECF_CLOSE_SOCKET = 11, - ECF_RECVFROM = 12, - ECF_SENDTO = 13, - ECF_BIND = 14, - ECF_GET_SOCK_NAME = 15, - ECF_WSA_GET_LAST_ERROR = 16, - - ECF_STEAM_CALLBACK_CALL_1 = 17, - ECF_STEAM_CALLBACK_CALL_2 = 18, - - ECF_STEAM_API_REGISTER_CALLBACK = 19, - ECF_STEAM_API_INIT = 20, - ECF_STEAM_API_UNREGISTER_CALL_RESULT = 21, - ECF_STEAMAPPS = 22, - ECF_STEAMAPPS_GET_CURRENT_GAME_LANGUAGE = 23, - - ECF_STEAMGAMESERVER_INIT = 24, - ECF_STEAMGAMESERVER = 25, - ECF_GS_SET_PRODUCT = 26, - ECF_GS_SET_GAME_DIR = 27, - ECF_GS_SET_DEDICATED_SERVER = 28, - ECF_GS_SET_GAME_DESC = 29, - ECF_GS_LOG_ON_ANONYMOUS = 30, - ECF_GS_ENABLE_HEARTBEATS = 31, - ECF_GS_SET_HEARTBEATS_INTERVAL = 32, - ECF_GS_SET_MAX_PLAYERS_COUNT = 33, - ECF_GS_SET_BOT_PLAYERS_COUNT = 34, - ECF_GS_SET_SERVER_NAME = 35, - ECF_GS_SET_MAP_NAME = 36, - ECF_GS_SET_PASSWORD_PROTECTED = 37, - ECF_GS_CLEAR_ALL_KEY_VALUES = 38, - ECF_GS_SET_KEY_VALUE = 39, - ECF_STEAM_API_SET_BREAKPAD_APP_ID = 40, - ECF_GS_WAS_RESTART_REQUESTED = 41, - ECF_STEAMGAMESERVER_RUN_CALLBACKS = 42, - ECF_GS_GET_NEXT_OUTGOING_PACKET = 43, - ECF_STEAM_API_RUN_CALLBACKS = 44, - ECF_GS_GET_STEAM_ID = 45, - ECF_GS_BSECURE = 46, - ECF_GS_HANDLE_INCOMING_PACKET = 47, - ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE = 48, - ECF_GS_SEND_USER_DISCONNECT = 49, - ECF_GS_BUPDATE_USER_DATA = 50, - ECF_GS_CREATE_UNAUTH_USER_CONNECTION = 51, - - ECF_GET_HOST_NAME = 52, - ECF_GET_HOST_BY_NAME = 53, - ECF_GET_PROCESS_TIMES = 54, - ECF_GET_SYSTEM_TIME_AS_FILE_TIME = 55, - - ECF_CSTD_TIME = 56, - ECF_CSTD_LOCALTIME = 57, - ECF_CSTD_SRAND_CALL = 58, - ECF_CSTD_RAND_CALL = 59, - - ECF_GS_LOGOFF = 60, - - ECF_STEAMGAMESERVER_SHUTDOWN = 61, - ECF_STEAM_API_UNREGISTER_CALLBACK = 62, - - ECF_GS_BLOGGEDON = 63, -}; - -struct CSteamCallbackState_t { - uint8 m_nCallbackFlags; - int m_iCallback; - - void clear() { - m_nCallbackFlags = 0; - m_iCallback = 0; - } -}; - -class IEngExtCall { -public: - bool m_Start; - bool m_End; - -public: - IEngExtCall() { m_Start = m_End = false; } - virtual ~IEngExtCall() { } - virtual bool compareInputArgs(IEngExtCall* other, bool strict) = 0; - virtual std::string toString() = 0; - virtual ExtCallFuncs getOpcode() = 0; - virtual void writePrologue(std::ostream &stream) { } - virtual void writeEpilogue(std::ostream &stream) { } - virtual void readPrologue(std::istream &stream) { } - virtual void readEpilogue(std::istream &stream) { } - void ensureArgsAreEqual(IEngExtCall* other, bool strict, const char* callSource); -}; - -class IEngCallbackCall : public IEngExtCall { -public: - virtual void someFuncInVTable() { } -}; - -class IEngExtCallFactory { -public: - static IEngExtCall* createByOpcode(ExtCallFuncs opc, void* ptr, int ptrSize); -}; - -//fake call; eof marker -class CEndRecordCall : public IEngExtCall { -public: - virtual bool compareInputArgs(IEngExtCall* other, bool strict) { return false; } - virtual std::string toString() { return std::string("EOF"); } - virtual ExtCallFuncs getOpcode() { return ECF_NONE; } -}; - -class CSleepExtCall : public IEngExtCall { -public: - DWORD m_Time; - -public: - CSleepExtCall() { m_Time = 0; } - CSleepExtCall(DWORD time); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_SLEEP; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CQueryPerfFreqCall : public IEngExtCall { -public: - int64 m_Freq; - BOOL m_Res; - -public: - CQueryPerfFreqCall() { m_Freq = 0; m_Res = false; } - - void SetResult(LARGE_INTEGER freq, BOOL res) { m_Freq = freq.QuadPart; m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_QUERY_PERF_FREQ; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CQueryPerfCounterCall : public IEngExtCall { -public: - int64 m_Counter; - BOOL m_Res; - -public: - CQueryPerfCounterCall() { m_Counter = 0; m_Res = 0; } - - void SetResult(LARGE_INTEGER counter, BOOL res) { m_Counter = counter.QuadPart; m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_QUERY_PERF_COUNTER; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - - -class CGetTickCountCall : public IEngExtCall { -public: - DWORD m_Res; - -public: - CGetTickCountCall() { m_Res = 0; } - - void SetResult(DWORD res) { m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_TICK_COUNT; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetLocalTimeCall : public IEngExtCall { -public: - SYSTEMTIME m_Res; - -public: - CGetLocalTimeCall() { memset(&m_Res, 0, sizeof(m_Res)); } - - void SetResult(LPSYSTEMTIME res) { m_Res = *res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_LOCAL_TIME; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetSystemTimeCall : public IEngExtCall { -public: - SYSTEMTIME m_Res; - -public: - CGetSystemTimeCall() { memset(&m_Res, 0, sizeof(m_Res)); } - - void SetResult(LPSYSTEMTIME res) { m_Res = *res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_SYSTEM_TIME; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetTimeZoneInfoCall : public IEngExtCall { -public: - TIME_ZONE_INFORMATION m_Res; - -public: - CGetTimeZoneInfoCall() { memset(&m_Res, 0, sizeof(m_Res)); } - - void SetResult(LPTIME_ZONE_INFORMATION res) { m_Res = *res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_TIMEZONE_INFO; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSocketCall : public IEngExtCall { -public: - int m_Af; - int m_Type; - int m_Protocol; - SOCKET m_Res; - -public: - CSocketCall() { m_Af = m_Type = m_Protocol = 0; m_Res = INVALID_SOCKET; } - CSocketCall(int af, int type, int protocol); - void setResult(SOCKET s) { m_Res = s; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_SOCKET; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CIoCtlSocketCall : public IEngExtCall { -public: - SOCKET m_Socket; - long m_Cmd; - u_long m_InValue; - - u_long m_OutValue; - int m_Res; - -public: - CIoCtlSocketCall() { m_Socket = INVALID_SOCKET; m_Cmd = 0; m_InValue = 0; m_OutValue = 0; m_Res = 0; } - CIoCtlSocketCall(SOCKET s, long cmd, u_long inValue); - void setResult(u_long outValue, int res) { m_Res = res; m_OutValue = outValue; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_IOCTL_SOCKET; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSetSockOptCall : public IEngExtCall { -public: - SOCKET m_Socket; - int m_Level; - int m_OptName; - char m_OptVal[32]; - int m_OptValLen; - - int m_Res; - -public: - CSetSockOptCall() { m_Socket = INVALID_SOCKET; m_Level = m_OptName = m_OptValLen = 0; m_Res = 0; } - CSetSockOptCall(SOCKET s, int level, int optname, const char* optval, int optlen); - void setResult(int res) { m_Res = res; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_SET_SOCK_OPT; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CCloseSocketCall : public IEngExtCall { -public: - SOCKET m_Socket; - int m_Res; - -public: - CCloseSocketCall() { m_Socket = INVALID_SOCKET; m_Res = 0; } - CCloseSocketCall(SOCKET s); - void setResult(int res) { m_Res = res; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_CLOSE_SOCKET; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CRecvFromCall : public IEngExtCall { -public: - SOCKET m_Socket; - int m_Len; - int m_Flags; - int m_FromLenIn; - - char m_Data[8192]; - int m_FromLenOut; - char m_From[32]; - int m_Res; - -public: - CRecvFromCall() { m_Socket = INVALID_SOCKET; m_Len = m_Flags = m_FromLenIn = 0; m_FromLenOut = 0; m_Res = -1; } - CRecvFromCall(SOCKET s, int len, int flags, int fromlen); - void setResult(const void* data, const void* from, int fromLen, int res); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_RECVFROM; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSendToCall : public IEngExtCall { -public: - SOCKET m_Socket; - char m_Data[8192]; - int m_Len; - int m_Flags; - char m_To[32]; - int m_ToLen; - - int m_Res; - -public: - CSendToCall() { m_Socket = INVALID_SOCKET, m_Len = m_Flags = m_ToLen = 0; m_Res = -1; } - CSendToCall(SOCKET s, const void* buf, int len, int flags, const void* to, int tolen); - void setResult(int res) { m_Res = res; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_SENDTO; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CBindCall : public IEngExtCall { -public: - SOCKET m_Socket; - char m_Addr[32]; - int m_AddrLen; - - int m_Res; - -public: - CBindCall() { m_Socket = INVALID_SOCKET; m_AddrLen = 0; m_Res = 0; } - CBindCall(SOCKET s, const void* addr, int addrlen); - void setResult(int res) { m_Res = res; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_BIND; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetSockNameCall : public IEngExtCall { -public: - SOCKET m_Socket; - int m_AddrLenIn; - - char m_Addr[32]; - int m_AddrLenOut; - int m_Res; - -public: - CGetSockNameCall() { m_Socket = INVALID_SOCKET; m_AddrLenIn = 0; m_AddrLenOut = m_Res = 0; } - CGetSockNameCall(SOCKET s, int addrlen); - void setResult(const void* addr, int addrlen, int res); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_SOCK_NAME; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CWSAGetLastErrorCall : public IEngExtCall { -public: - int m_Res; - -public: - CWSAGetLastErrorCall() { m_Res = 0; } - void setResult(int res) { m_Res = res; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_WSA_GET_LAST_ERROR; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamCallbackCall1 : public IEngCallbackCall { -public: - int m_CallbackId; - char m_Data[1024]; - int m_DataSize; - CSteamCallbackState_t m_InState; - CSteamCallbackState_t m_OutState; - -public: - CSteamCallbackCall1() { m_CallbackId = 0; m_DataSize = 0; m_InState.clear(), m_OutState.clear(); } - CSteamCallbackCall1(int cbId, void* data, int dataSize, CCallbackBase* cb); - - void setResult(CCallbackBase* cb) { m_OutState.m_iCallback = cb->GetICallback(); m_OutState.m_nCallbackFlags = cb->GetFlags(); } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_CALLBACK_CALL_1; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamCallbackCall2 : public IEngCallbackCall { -public: - int m_CallbackId; - char m_Data[1024]; - int m_DataSize; - bool m_bIOFailure; - SteamAPICall_t m_SteamAPICall; - CSteamCallbackState_t m_InState; - CSteamCallbackState_t m_OutState; - -public: - CSteamCallbackCall2() { m_CallbackId = m_DataSize = 0; m_bIOFailure = false; m_SteamAPICall = k_uAPICallInvalid; m_InState.clear(), m_OutState.clear(); } - CSteamCallbackCall2(int cbId, void* data, int dataSize, bool ioFailure, SteamAPICall_t apiCall, CCallbackBase* cb); - - void setResult(CCallbackBase* cb) { m_OutState.m_iCallback = cb->GetICallback(); m_OutState.m_nCallbackFlags = cb->GetFlags(); } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_CALLBACK_CALL_2; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamApiRegisterCallbackCall : public IEngExtCall { -public: - int m_ReGameDLLCallbackId; - int m_iSteamCallbackId; - CSteamCallbackState_t m_InState; - CSteamCallbackState_t m_OutState; - -public: - CSteamApiRegisterCallbackCall() { m_ReGameDLLCallbackId = 0; m_iSteamCallbackId = 0; m_InState.clear(), m_OutState.clear(); } - CSteamApiRegisterCallbackCall(int regamedllCallbackId, int steamCallbackId, CCallbackBase* cb); - - void setResult(CCallbackBase* cb) { m_OutState.m_iCallback = cb->GetICallback(); m_OutState.m_nCallbackFlags = cb->GetFlags(); } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_API_REGISTER_CALLBACK; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamApiInitCall : public IEngExtCall { -public: - bool m_Res; - -public: - CSteamApiInitCall() { m_Res = false; } - void setResult(bool res) { m_Res = res; } - - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_API_INIT; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamApiUnrigestierCallResultCall : public IEngExtCall { -public: - int m_ReGameDLLCallbackId; - SteamAPICall_t m_SteamApiCall; - CSteamCallbackState_t m_InState; - CSteamCallbackState_t m_OutState; - -public: - CSteamApiUnrigestierCallResultCall() { m_ReGameDLLCallbackId = 0; m_SteamApiCall = k_uAPICallInvalid; m_InState.clear(), m_OutState.clear(); } - CSteamApiUnrigestierCallResultCall(int regamedllCallbackId, SteamAPICall_t steamApiCall, CCallbackBase* cb); - - void setResult(CCallbackBase* cb) { m_OutState.m_iCallback = cb->GetICallback(); m_OutState.m_nCallbackFlags = cb->GetFlags(); } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_API_UNREGISTER_CALL_RESULT; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamAppsCall : public IEngExtCall { -public: - bool m_ReturnNull; - -public: - CSteamAppsCall() { m_ReturnNull = false; } - - void setReturnNull(bool retNull) { m_ReturnNull = retNull; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAMAPPS; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamAppGetCurrentGameLanguageCall : public IEngExtCall { -public: - int m_ResLen; - char m_Res[256]; - -public: - CSteamAppGetCurrentGameLanguageCall() { m_ResLen = 0; } - - void setResult(const char* res); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAMAPPS_GET_CURRENT_GAME_LANGUAGE; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamGameServerInitCall : public IEngExtCall { -public: - uint32 m_IP; - uint16 m_SteamPort; - uint16 m_GamePort; - uint16 m_QueryPort; - EServerMode m_ServerMode; - char m_Version[256]; - int m_VersionLen; - - bool m_Res; - -public: - CSteamGameServerInitCall() { m_IP = 0; m_SteamPort = m_GamePort = m_QueryPort = 0; m_ServerMode = eServerModeInvalid; m_VersionLen = 0; m_Res = false; } - CSteamGameServerInitCall(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString); - - void setResult(bool res) { m_Res = res; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAMGAMESERVER_INIT; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamGameServerCall : public IEngExtCall { -public: - bool m_ReturnNull; - -public: - CSteamGameServerCall() { m_ReturnNull = false; } - - void setReturnNull(bool retNull) { m_ReturnNull = retNull; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAMGAMESERVER; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerSetProductCall : public IEngExtCall { -public: - char m_Product[32]; - int m_ProductLen; - -public: - CGameServerSetProductCall() { m_ProductLen = 0; } - CGameServerSetProductCall(const char* product); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_PRODUCT; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetModDirCall : public IEngExtCall { -public: - char m_Dir[32]; - int m_DirLen; - -public: - CGameServerSetModDirCall() { m_DirLen = 0; } - CGameServerSetModDirCall(const char* dir); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_GAME_DIR; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetDedicatedServerCall : public IEngExtCall { -public: - bool m_Dedicated; - -public: - CGameServerSetDedicatedServerCall() { m_Dedicated = false; } - CGameServerSetDedicatedServerCall(bool dedicated); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_DEDICATED_SERVER; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetGameDescCall : public IEngExtCall { -public: - char m_Desc[128]; - int m_DescLen; - -public: - CGameServerSetGameDescCall() { m_DescLen = 0; } - CGameServerSetGameDescCall(const char* desc); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_GAME_DESC; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerLogOnAnonymousCall : public IEngExtCall { -public: - CGameServerLogOnAnonymousCall() { } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_LOG_ON_ANONYMOUS; } -}; - -class CGameServerEnableHeartbeatsCall : public IEngExtCall { -public: - bool m_Heartbeats; - -public: - CGameServerEnableHeartbeatsCall() { m_Heartbeats = false; } - CGameServerEnableHeartbeatsCall(bool hearbeats); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_ENABLE_HEARTBEATS; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetHeartbeatIntervalCall : public IEngExtCall { -public: - int m_Interval; - -public: - CGameServerSetHeartbeatIntervalCall() { m_Interval = 0; } - CGameServerSetHeartbeatIntervalCall(int interval); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_HEARTBEATS_INTERVAL; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetMaxPlayersCall : public IEngExtCall { -public: - int m_MaxPlayers; - -public: - CGameServerSetMaxPlayersCall() { m_MaxPlayers = 0; } - CGameServerSetMaxPlayersCall(int maxPlayers); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_MAX_PLAYERS_COUNT; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetBotCountCall : public IEngExtCall { -public: - int m_NumBots; - -public: - CGameServerSetBotCountCall() { m_NumBots = 0; } - CGameServerSetBotCountCall(int numBots); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_BOT_PLAYERS_COUNT; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetServerNameCall : public IEngExtCall { -public: - char m_ServerName[128]; - int m_ServerNameLen; - -public: - CGameServerSetServerNameCall() { m_ServerNameLen = 0; } - CGameServerSetServerNameCall(const char* serverName); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_SERVER_NAME; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetMapNameCall : public IEngExtCall { -public: - char m_MapName[128]; - int m_MapNameLen; - -public: - CGameServerSetMapNameCall() { m_MapNameLen = 0; } - CGameServerSetMapNameCall(const char* mapName); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_MAP_NAME; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerSetPasswordProtectedCall : public IEngExtCall { -public: - bool m_PasswordProtected; - -public: - CGameServerSetPasswordProtectedCall() { m_PasswordProtected = false; } - CGameServerSetPasswordProtectedCall(bool passwordProtected); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_PASSWORD_PROTECTED; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerClearAllKVsCall : public IEngExtCall { -public: - CGameServerClearAllKVsCall() { } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_CLEAR_ALL_KEY_VALUES; } -}; - -class CGameServerSetKeyValueCall : public IEngExtCall { -public: - char m_Key[128]; - int m_KeyLen; - char m_Value[128]; - int m_ValueLen; -public: - CGameServerSetKeyValueCall() { m_KeyLen = m_ValueLen = 0; } - CGameServerSetKeyValueCall(const char* key, const char* value); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SET_KEY_VALUE; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CSteamApiSetBreakpadAppIdCall : public IEngExtCall { -public: - uint32 m_AppId; - -public: - CSteamApiSetBreakpadAppIdCall() { m_AppId = 0; } - CSteamApiSetBreakpadAppIdCall(uint32 appId); - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_API_SET_BREAKPAD_APP_ID; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - - -class CGameServerWasRestartRequestedCall : public IEngExtCall { -public: - bool m_Result; - -public: - CGameServerWasRestartRequestedCall() { m_Result = false; } - - void setResult(bool res) { m_Result = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_WAS_RESTART_REQUESTED; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CSteamGameServerRunCallbacksCall : public IEngExtCall { -public: - CSteamGameServerRunCallbacksCall() { } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAMGAMESERVER_RUN_CALLBACKS; } -}; - -class CGameServerGetNextOutgoingPacketCall : public IEngExtCall { -public: - int m_MaxOut; - - char m_Buf[8192]; - int m_BufLen; - int m_Result; - uint32 m_Addr; - uint16 m_Port; - -public: - CGameServerGetNextOutgoingPacketCall() { m_MaxOut = 0; m_BufLen = m_Result = 0; m_Addr = 0; m_Port = 0; } - CGameServerGetNextOutgoingPacketCall(int maxOut); - - void setResult(void* buf, int res, uint32* pAddr, uint16* pPort); - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_GET_NEXT_OUTGOING_PACKET; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CSteamApiRunCallbacksCall : public IEngExtCall { -public: - CSteamApiRunCallbacksCall() { } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_API_RUN_CALLBACKS; } -}; - -class CGameServerGetSteamIdCall : public IEngExtCall { -public: - uint64 m_SteamId; - -public: - CGameServerGetSteamIdCall() { m_SteamId = 0; } - - void setResult(CSteamID &res) { m_SteamId = res.ConvertToUint64(); } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_GET_STEAM_ID; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerBSecureCall : public IEngExtCall { -public: - bool m_Res; - -public: - CGameServerBSecureCall() { m_Res = false; } - - void setResult(bool res) { m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_BSECURE; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerHandleIncomingPacketCall : public IEngExtCall { -public: - char m_Data[8192]; - int m_Len; - uint32 m_Ip; - uint16 m_Port; - bool m_Res; - -public: - CGameServerHandleIncomingPacketCall() { m_Len = 0; m_Ip = 0; m_Port = 0; m_Res = false; } - CGameServerHandleIncomingPacketCall(const void *pData, int cbData, uint32 srcIP, uint16 srcPort); - - void setResult(bool res) { m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_HANDLE_INCOMING_PACKET; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerSendUserConnectAndAuthenticateCall : public IEngExtCall { -public: - char m_AuthBlob[4096]; - int m_AuthBlobLen; - uint32 m_IP; - - uint64 m_OutSteamId; - bool m_Res; - -public: - CGameServerSendUserConnectAndAuthenticateCall() { m_IP = 0; m_AuthBlobLen = 0; m_OutSteamId = 0; m_Res = false; } - CGameServerSendUserConnectAndAuthenticateCall(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize); - - void setResult(CSteamID& steamId, bool res) { m_OutSteamId = steamId.ConvertToUint64(); m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SEND_USER_CONNECT_AND_AUTHENTICATE; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerSendUserDisconnectCall : public IEngExtCall { -public: - uint64 m_SteamId; - -public: - CGameServerSendUserDisconnectCall() { m_SteamId = 0; } - CGameServerSendUserDisconnectCall(CSteamID& steamId) { m_SteamId = steamId.ConvertToUint64(); } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_SEND_USER_DISCONNECT; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CGameServerBUpdateUserDataCall : public IEngExtCall { -public: - uint64 m_SteamId; - char m_PlayerName[64]; - int m_PlayerNameLen; - uint32 m_Score; - - bool m_Res; - -public: - CGameServerBUpdateUserDataCall() { m_SteamId = 0; m_Score = 0; m_PlayerNameLen = 0; m_Res = false; } - CGameServerBUpdateUserDataCall(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore); - - void setResult(bool res) { m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_BUPDATE_USER_DATA; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerCreateUnauthUserConnectionCall : public IEngExtCall { -public: - uint64 m_SteamId; - -public: - CGameServerCreateUnauthUserConnectionCall() { m_SteamId = 0; } - - void setResult(CSteamID &steamId) { m_SteamId = steamId.ConvertToUint64(); } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_CREATE_UNAUTH_USER_CONNECTION; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetHostNameCall : public IEngExtCall { -public: - int m_NameLenIn; - - int m_NameLenOut; - char m_Name[2048]; - int m_Res; - -public: - CGetHostNameCall() { m_NameLenIn = 0; m_NameLenOut = 0; m_Res = 0; m_Name[0] = 0; } - CGetHostNameCall(int namelen) { m_NameLenIn = namelen; m_NameLenOut = 0; m_Res = 0; m_Name[0] = 0; } - - void setResult(char* hostName, int res); - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_HOST_NAME; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetHostByNameCall : public IEngExtCall { -public: - char m_Name[256]; - int m_NameLen; - - hostent_data_t m_HostentData; - -public: - CGetHostByNameCall() { m_Name[0] = 0; m_NameLen = 0; m_HostentData.clear(); } - CGetHostByNameCall(const char* name); - - void setResult(const hostent* hostEnt); - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_HOST_BY_NAME; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetProcessTimesCall : public IEngExtCall { -public: - BOOL m_Res; - FILETIME m_CreationTime; - FILETIME m_ExitTime; - FILETIME m_KernelTime; - FILETIME m_UserTime; - -public: - CGetProcessTimesCall() { - m_Res = FALSE; - memset(&m_CreationTime, 0, sizeof(m_CreationTime)); - memset(&m_ExitTime, 0, sizeof(m_ExitTime)); - memset(&m_KernelTime, 0, sizeof(m_KernelTime)); - memset(&m_UserTime, 0, sizeof(m_UserTime)); - } - - void setResult(BOOL res, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime); - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_PROCESS_TIMES; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGetSystemTimeAsFileTimeCall : public IEngExtCall { -public: - FILETIME m_SystemTime; - -public: - CGetSystemTimeAsFileTimeCall() { memset(&m_SystemTime, 0, sizeof(m_SystemTime)); } - - void setResult(LPFILETIME systemTime); - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GET_SYSTEM_TIME_AS_FILE_TIME; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CStdTimeCall : public IEngExtCall { -public: - bool m_InTimeNull; - - uint32 m_Res; - -public: - CStdTimeCall(uint32* inTime); - CStdTimeCall() { m_InTimeNull = false; m_Res = 0; } - - void setResult(uint32 res); - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_CSTD_TIME; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CStdLocalTimeCall : public IEngExtCall { -public: - uint32 m_Time; - - struct tm m_Res; - -public: - CStdLocalTimeCall(uint32 inTime); - CStdLocalTimeCall() { m_Time = 0; memset(&m_Res, 0, sizeof(m_Res)); } - - void setResult(struct tm *res); - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_CSTD_LOCALTIME; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CStdSrandCall : public IEngExtCall { -public: - uint32 m_Seed; - -public: - CStdSrandCall() { m_Seed = 0; } - CStdSrandCall(uint32 seed) { m_Seed = seed; } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_CSTD_SRAND_CALL; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); -}; - -class CStdRandCall : public IEngExtCall { -public: - int m_Res; - -public: - CStdRandCall() { m_Res = 0; } - - void setResult(int res) { m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_CSTD_RAND_CALL; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerLogOffCall : public IEngExtCall { - -public: - CGameServerLogOffCall() { } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_LOGOFF; } - -}; - -class CSteamGameServerShutdownCall : public IEngExtCall { - -public: - CSteamGameServerShutdownCall() { } - - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAMGAMESERVER_SHUTDOWN; } - -}; - -class CSteamApiUnregisterCallbackCall : public IEngExtCall { -public: - int m_ReGameDLLCallbackId; - CSteamCallbackState_t m_InState; - CSteamCallbackState_t m_OutState; - -public: - CSteamApiUnregisterCallbackCall() { m_ReGameDLLCallbackId = 0; m_InState.clear(), m_OutState.clear(); } - CSteamApiUnregisterCallbackCall(int regamedllCallbackId, CCallbackBase* cb); - - void setResult(CCallbackBase* cb) { m_OutState.m_iCallback = cb->GetICallback(); m_OutState.m_nCallbackFlags = cb->GetFlags(); } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_STEAM_API_UNREGISTER_CALLBACK; } - virtual void writePrologue(std::ostream &stream); - virtual void readPrologue(std::istream &stream); - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -class CGameServerBLoggedOnCall : public IEngExtCall { -public: - bool m_Res; - -public: - CGameServerBLoggedOnCall() { m_Res = false; } - - void setResult(bool res) { m_Res = res; } - virtual bool compareInputArgs(IEngExtCall* other, bool strict); - virtual std::string toString(); - virtual ExtCallFuncs getOpcode() { return ECF_GS_BLOGGEDON; } - virtual void writeEpilogue(std::ostream &stream); - virtual void readEpilogue(std::istream &stream); -}; - -#endif diff --git a/regamedll/testsuite/recorder.cpp b/regamedll/testsuite/recorder.cpp deleted file mode 100644 index 7a680272..00000000 --- a/regamedll/testsuite/recorder.cpp +++ /dev/null @@ -1,996 +0,0 @@ -#include "precompiled.h" - -CRecorderFuncCall::CRecorderFuncCall(IEngExtCall* fcall) -{ - m_FuncCall = fcall; - m_StartWritten = false; - m_Next = m_Prev = NULL; -} - -CSteamCallbackRecordingWrapper::CSteamCallbackRecordingWrapper(CRecordingEngExtInterceptor* recorder, CCallbackBase* cb, int id) -{ - m_Recorder = recorder; - m_Wrapped = cb; - m_Id = id; - m_Size = cb->GetCallbackSizeBytes(); - m_iCallback = cb->GetICallback(); - this->m_nCallbackFlags = cb->GetFlags(); -} - -void CSteamCallbackRecordingWrapper::Run(void *pvParam) -{ - if (m_Wrapped->GetICallback() != this->GetICallback()) regamedll_syserror("%s: iCallback desync", __FUNCTION__); - if (m_Wrapped->GetFlags() != this->GetFlags()) regamedll_syserror("%s: flags desync", __FUNCTION__); - - CSteamCallbackCall1 fcall(m_Id, pvParam, m_Size, m_Wrapped); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->Run(pvParam); - fcall.setResult(m_Wrapped); - this->SetFlags(m_Wrapped->GetFlags()); - this->SetICallback(m_Wrapped->GetICallback()); - m_Recorder->PopFunc(&frec); -} - -void CSteamCallbackRecordingWrapper::Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall) -{ - if (m_Wrapped->GetICallback() != this->GetICallback()) regamedll_syserror("%s: iCallback desync", __FUNCTION__); - if (m_Wrapped->GetFlags() != this->GetFlags()) regamedll_syserror("%s: flags desync", __FUNCTION__); - - CSteamCallbackCall2 fcall(m_Id, pvParam, m_Size, bIOFailure, hSteamAPICall, m_Wrapped); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->Run(pvParam, bIOFailure, hSteamAPICall); - fcall.setResult(m_Wrapped); - this->SetFlags(m_Wrapped->GetFlags()); - this->SetICallback(m_Wrapped->GetICallback()); - m_Recorder->PopFunc(&frec); -} - -int CSteamCallbackRecordingWrapper::GetCallbackSizeBytes() -{ - return m_Wrapped->GetCallbackSizeBytes(); -} - - - - -CSteamAppsRecordingWrapper::CSteamAppsRecordingWrapper(ISteamApps* original, CRecordingEngExtInterceptor* recorder) -{ - m_Wrapped = original; - m_Recorder = recorder; -} - -bool CSteamAppsRecordingWrapper::BIsSubscribed() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsRecordingWrapper::BIsLowViolence() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsRecordingWrapper::BIsCybercafe() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsRecordingWrapper::BIsVACBanned() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -const char* CSteamAppsRecordingWrapper::GetCurrentGameLanguage() -{ - CSteamAppGetCurrentGameLanguageCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - const char* res = m_Wrapped->GetCurrentGameLanguage(); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -const char* CSteamAppsRecordingWrapper::GetAvailableGameLanguages() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return NULL; -} - -bool CSteamAppsRecordingWrapper::BIsSubscribedApp(AppId_t appID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsRecordingWrapper::BIsDlcInstalled(AppId_t appID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -uint32 CSteamAppsRecordingWrapper::GetEarliestPurchaseUnixTime(AppId_t nAppID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -bool CSteamAppsRecordingWrapper::BIsSubscribedFromFreeWeekend() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -int CSteamAppsRecordingWrapper::GetDLCCount() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -bool CSteamAppsRecordingWrapper::BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -void CSteamAppsRecordingWrapper::InstallDLC(AppId_t nAppID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamAppsRecordingWrapper::UninstallDLC(AppId_t nAppID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamAppsRecordingWrapper::RequestAppProofOfPurchaseKey(AppId_t nAppID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -bool CSteamAppsRecordingWrapper::GetCurrentBetaName(char *pchName, int cchNameBufferSize) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -bool CSteamAppsRecordingWrapper::MarkContentCorrupt(bool bMissingFilesOnly) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -uint32 CSteamAppsRecordingWrapper::GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -uint32 CSteamAppsRecordingWrapper::GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - - -CSteamGameServerRecordingWrapper::CSteamGameServerRecordingWrapper(ISteamGameServer* original, CRecordingEngExtInterceptor* recorder) -{ - m_Wrapped = original; - m_Recorder = recorder; -} - -bool CSteamGameServerRecordingWrapper::InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -void CSteamGameServerRecordingWrapper::SetProduct(const char *pszProduct) -{ - CGameServerSetProductCall fcall(pszProduct); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetProduct(pszProduct); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetGameDescription(const char *pszGameDescription) -{ - CGameServerSetGameDescCall fcall(pszGameDescription); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetGameDescription(pszGameDescription); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetModDir(const char *pszModDir) -{ - CGameServerSetModDirCall fcall(pszModDir); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetModDir(pszModDir); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetDedicatedServer(bool bDedicated) -{ - CGameServerSetDedicatedServerCall fcall(bDedicated); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetDedicatedServer(bDedicated); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::LogOn(const char *pszAccountName, const char *pszPassword) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerRecordingWrapper::LogOnAnonymous() -{ - CGameServerLogOnAnonymousCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->LogOnAnonymous(); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::LogOff() -{ - CGameServerLogOffCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->LogOff(); - m_Recorder->PopFunc(&frec); -} - -bool CSteamGameServerRecordingWrapper::BLoggedOn() -{ - CGameServerBLoggedOnCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - bool res = m_Wrapped->BLoggedOn(); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -bool CSteamGameServerRecordingWrapper::BSecure() -{ - CGameServerBSecureCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - bool res = m_Wrapped->BSecure(); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -CSteamID CSteamGameServerRecordingWrapper::GetSteamID() -{ - CGameServerGetSteamIdCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - CSteamID res = m_Wrapped->GetSteamID(); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -bool CSteamGameServerRecordingWrapper::WasRestartRequested() -{ - CGameServerWasRestartRequestedCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - bool res = m_Wrapped->WasRestartRequested(); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -void CSteamGameServerRecordingWrapper::SetMaxPlayerCount(int cPlayersMax) -{ - CGameServerSetMaxPlayersCall fcall(cPlayersMax); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetMaxPlayerCount(cPlayersMax); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetBotPlayerCount(int cBotplayers) -{ - CGameServerSetBotCountCall fcall(cBotplayers); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetBotPlayerCount(cBotplayers); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetServerName(const char *pszServerName) -{ - CGameServerSetServerNameCall fcall(pszServerName); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetServerName(pszServerName); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetMapName(const char *pszMapName) -{ - CGameServerSetMapNameCall fcall(pszMapName); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetMapName(pszMapName); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetPasswordProtected(bool bPasswordProtected) -{ - CGameServerSetPasswordProtectedCall fcall(bPasswordProtected); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetPasswordProtected(bPasswordProtected); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetSpectatorPort(uint16 unSpectatorPort) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerRecordingWrapper::SetSpectatorServerName(const char *pszSpectatorServerName) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerRecordingWrapper::ClearAllKeyValues() -{ - CGameServerClearAllKVsCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->ClearAllKeyValues(); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetKeyValue(const char *pKey, const char *pValue) -{ - CGameServerSetKeyValueCall fcall(pKey, pValue); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetKeyValue(pKey, pValue); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetGameTags(const char *pchGameTags) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerRecordingWrapper::SetGameData(const char *pchGameData) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerRecordingWrapper::SetRegion(const char *pszRegion) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -bool CSteamGameServerRecordingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser) -{ - CGameServerSendUserConnectAndAuthenticateCall fcall(unIPClient, pvAuthBlob, cubAuthBlobSize); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - bool res = m_Wrapped->SendUserConnectAndAuthenticate(unIPClient, pvAuthBlob, cubAuthBlobSize, pSteamIDUser); - fcall.setResult(*pSteamIDUser, res); - m_Recorder->PopFunc(&frec); - return res; -} - -CSteamID CSteamGameServerRecordingWrapper::CreateUnauthenticatedUserConnection() -{ - CGameServerCreateUnauthUserConnectionCall fcall; CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - CSteamID res = m_Wrapped->CreateUnauthenticatedUserConnection(); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -void CSteamGameServerRecordingWrapper::SendUserDisconnect(CSteamID steamIDUser) -{ - CGameServerSendUserDisconnectCall fcall(steamIDUser); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SendUserDisconnect(steamIDUser); - m_Recorder->PopFunc(&frec); -} - -bool CSteamGameServerRecordingWrapper::BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore) -{ - CGameServerBUpdateUserDataCall fcall(steamIDUser, pchPlayerName, uScore); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - bool res = m_Wrapped->BUpdateUserData(steamIDUser, pchPlayerName, uScore); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -HAuthTicket CSteamGameServerRecordingWrapper::GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_HAuthTicketInvalid; -} - -EBeginAuthSessionResult CSteamGameServerRecordingWrapper::BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_EBeginAuthSessionResultInvalidTicket; -} - -void CSteamGameServerRecordingWrapper::EndAuthSession(CSteamID steamID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void CSteamGameServerRecordingWrapper::CancelAuthTicket(HAuthTicket hAuthTicket) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -EUserHasLicenseForAppResult CSteamGameServerRecordingWrapper::UserHasLicenseForApp(CSteamID steamID, AppId_t appID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_EUserHasLicenseResultDoesNotHaveLicense; -} - -bool CSteamGameServerRecordingWrapper::RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return false; -} - -void CSteamGameServerRecordingWrapper::GetGameplayStats() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -SteamAPICall_t CSteamGameServerRecordingWrapper::GetServerReputation() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_uAPICallInvalid; -} - -uint32 CSteamGameServerRecordingWrapper::GetPublicIP() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return 0; -} - -bool CSteamGameServerRecordingWrapper::HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort) -{ - CGameServerHandleIncomingPacketCall fcall(pData, cbData, srcIP, srcPort); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - bool res = m_Wrapped->HandleIncomingPacket(pData, cbData, srcIP, srcPort); - fcall.setResult(res); - m_Recorder->PopFunc(&frec); - return res; -} - -int CSteamGameServerRecordingWrapper::GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort) -{ - CGameServerGetNextOutgoingPacketCall fcall(cbMaxOut); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - int res = m_Wrapped->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort); - fcall.setResult(pOut, res, pNetAdr, pPort); - m_Recorder->PopFunc(&frec); - return res; -} - -void CSteamGameServerRecordingWrapper::EnableHeartbeats(bool bActive) -{ - CGameServerEnableHeartbeatsCall fcall(bActive); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->EnableHeartbeats(bActive); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::SetHeartbeatInterval(int iHeartbeatInterval) -{ - CGameServerSetHeartbeatIntervalCall fcall(iHeartbeatInterval); CRecorderFuncCall frec(&fcall); - m_Recorder->PushFunc(&frec); - m_Wrapped->SetHeartbeatInterval(iHeartbeatInterval); - m_Recorder->PopFunc(&frec); -} - -void CSteamGameServerRecordingWrapper::ForceHeartbeat() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -SteamAPICall_t CSteamGameServerRecordingWrapper::AssociateWithClan(CSteamID steamIDClan) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_uAPICallInvalid; -} - -SteamAPICall_t CSteamGameServerRecordingWrapper::ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return k_uAPICallInvalid; -} - -CRecordingEngExtInterceptor::CRecordingEngExtInterceptor(const char* fname, IReGameDLLPlatform* basePlatform) -{ - m_OutStream.exceptions(std::ios::badbit | std::ios::failbit); - m_OutStream.open(fname, std::ios::out | std::ios::binary); - - m_ServerSocket = INVALID_SOCKET; - m_SteamCallbacksCounter = 0; - m_SteamAppsWrapper = NULL; - m_GameServerWrapper = NULL; - m_SteamBreakpadContext = NULL; - m_RootFunc = m_LastFunc = NULL; - m_BasePlatform = basePlatform; - - uint16 versionMajor = TESTSUITE_PROTOCOL_VERSION_MAJOR; - uint16 versionMinor = TESTSUITE_PROTOCOL_VERSION_MINOR; - m_OutStream.write((char*)&versionMinor, 2).write((char*)&versionMajor, 2); - - const char* cmdLine = GetCommandLineA(); - int cmdLineLength = strlen(cmdLine) + 1; - - m_OutStream.write((char*)&cmdLineLength, 4); - m_OutStream.write(cmdLine, cmdLineLength); -} - -void CRecordingEngExtInterceptor::writeCall(bool start, bool end, IEngExtCall* fcall) -{ - uint16 opc = fcall->getOpcode(); - if (start) - opc |= (1 << 15); - - if (end) - opc |= (1 << 14); - - m_OutStream.write((char*)&opc, 2); - if (start) - fcall->writePrologue(m_OutStream); - - if (end) - fcall->writeEpilogue(m_OutStream); - - m_OutStream.flush(); -} - -void CRecordingEngExtInterceptor::PushFunc(CRecorderFuncCall* func) -{ - CRecorderFuncCall* cc = m_LastFunc; - while (cc != NULL) { - if (!cc->m_StartWritten) { - writeCall(true, false, cc->m_FuncCall); - cc->m_StartWritten = true; - } - cc = cc->m_Prev; - } - - if (m_LastFunc != NULL) { - m_LastFunc->m_Next = func; - func->m_Next = NULL; - func->m_Prev = m_LastFunc; - m_LastFunc = func; - } - else - { - m_LastFunc = m_RootFunc = func; - func->m_Next = func->m_Prev = NULL; - } - -} - -void CRecordingEngExtInterceptor::PopFunc(CRecorderFuncCall* func) -{ - if (func != m_LastFunc) - regamedll_syserror("%s: stack corrupted", __FUNCTION__); - - writeCall(!func->m_StartWritten, true, func->m_FuncCall); - if (m_LastFunc->m_Prev == NULL) { - m_LastFunc = m_RootFunc = NULL; - } - else - { - m_LastFunc = m_LastFunc->m_Prev; - m_LastFunc->m_Next = NULL; - } -} - -uint32 CRecordingEngExtInterceptor::time(uint32* pTime) -{ - CStdTimeCall fcall(pTime); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - uint32 res = m_BasePlatform->time(pTime); - fcall.setResult(res); - PopFunc(&frec); - - return res; -} - -struct tm* CRecordingEngExtInterceptor::localtime(uint32 time) -{ - CStdLocalTimeCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - struct tm* res = m_BasePlatform->localtime(time); - fcall.setResult(res); - PopFunc(&frec); - - return res; -} - -void CRecordingEngExtInterceptor::srand(uint32 seed) -{ - CStdSrandCall fcall(seed); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->srand(seed); - PopFunc(&frec); -} - -int CRecordingEngExtInterceptor::rand() -{ - CStdRandCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->rand(); - fcall.setResult(res); - PopFunc(&frec); - - return res; -} - -void CRecordingEngExtInterceptor::Sleep(DWORD msec) -{ - CSleepExtCall fcall(msec); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->Sleep(msec); - PopFunc(&frec); -} - -BOOL CRecordingEngExtInterceptor::QueryPerfCounter(LARGE_INTEGER* counter) -{ - CQueryPerfCounterCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - BOOL res = m_BasePlatform->QueryPerfCounter(counter); - fcall.SetResult(*counter, res); - PopFunc(&frec); - return res; -} - -BOOL CRecordingEngExtInterceptor::QueryPerfFreq(LARGE_INTEGER* counter) -{ - CQueryPerfFreqCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - BOOL res = m_BasePlatform->QueryPerfFreq(counter); - fcall.SetResult(*counter, res); - PopFunc(&frec); - return res; -} - -DWORD CRecordingEngExtInterceptor::GetTickCount() -{ - CGetTickCountCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - DWORD res = m_BasePlatform->GetTickCount(); - fcall.SetResult(res); - PopFunc(&frec); - return res; -} - -void CRecordingEngExtInterceptor::GetLocalTime(LPSYSTEMTIME time) -{ - CGetLocalTimeCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->GetLocalTime(time); - fcall.SetResult(time); - PopFunc(&frec); -} - -void CRecordingEngExtInterceptor::GetSystemTime(LPSYSTEMTIME time) -{ - CGetSystemTimeCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->GetSystemTime(time); - fcall.SetResult(time); - PopFunc(&frec); -} - -void CRecordingEngExtInterceptor::GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo) -{ - CGetTimeZoneInfoCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->GetTimeZoneInfo(zinfo); - fcall.SetResult(zinfo); - PopFunc(&frec); -} - -BOOL CRecordingEngExtInterceptor::GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime) -{ - CGetProcessTimesCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - BOOL res = m_BasePlatform->GetProcessTimes(hProcess, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime); - fcall.setResult(res, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime); - PopFunc(&frec); - return res; -} - -void CRecordingEngExtInterceptor::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) -{ - CGetSystemTimeAsFileTimeCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->GetSystemTimeAsFileTime(lpSystemTimeAsFileTime); - fcall.setResult(lpSystemTimeAsFileTime); - PopFunc(&frec); -} - -SOCKET CRecordingEngExtInterceptor::socket(int af, int type, int protocol) -{ - CSocketCall fcall(af, type, protocol); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - SOCKET s = m_BasePlatform->socket(af, type, protocol); - fcall.setResult(s); - PopFunc(&frec); - return s; -} - -int CRecordingEngExtInterceptor::ioctlsocket(SOCKET s, long cmd, u_long *argp) -{ - CIoCtlSocketCall fcall(s, cmd, *argp); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->ioctlsocket(s, cmd, argp); - fcall.setResult(*argp, res); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen) -{ - CSetSockOptCall fcall(s, level, optname, optval, optlen); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->setsockopt(s, level, optname, optval, optlen); - fcall.setResult(res); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::closesocket(SOCKET s) -{ - CCloseSocketCall fcall(s); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->closesocket(s); - fcall.setResult(s); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::recvfrom(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, socklen_t *fromlen) -{ - CRecvFromCall fcall(s, len, flags, *fromlen); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->recvfrom(s, buf, len, flags, from, fromlen); - fcall.setResult(buf, from, *fromlen, res); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::sendto(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen) -{ - CSendToCall fcall(s, buf, len, flags, to, tolen); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->sendto(s, buf, len, flags, to, tolen); - fcall.setResult(res); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::bind(SOCKET s, const struct sockaddr* addr, int namelen) -{ - CBindCall fcall(s, addr, namelen); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->bind(s, addr, namelen); - fcall.setResult(res); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::getsockname(SOCKET s, struct sockaddr* name, socklen_t* namelen) -{ - CGetSockNameCall fcall(s, *namelen); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->getsockname(s, name, namelen); - fcall.setResult(name, *namelen, res); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::WSAGetLastError() -{ - CWSAGetLastErrorCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->WSAGetLastError(); - fcall.setResult(res); - PopFunc(&frec); - return res; -} - -struct hostent* CRecordingEngExtInterceptor::gethostbyname(const char *name) -{ - CGetHostByNameCall fcall(name); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - struct hostent* res = m_BasePlatform->gethostbyname(name); - fcall.setResult(res); - PopFunc(&frec); - return res; -} - -int CRecordingEngExtInterceptor::gethostname(char *name, int namelen) -{ - CGetHostNameCall fcall(namelen); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - int res = m_BasePlatform->gethostname(name, namelen); - fcall.setResult(name, res); - PopFunc(&frec); - return res; -} - - -CSteamCallbackRecordingWrapper* CRecordingEngExtInterceptor::getOrCreateCallbackWrapper(CCallbackBase *pCallback) -{ - auto itr = m_SteamCallbacks.find(pCallback); - if (itr == m_SteamCallbacks.end()) - { - CSteamCallbackRecordingWrapper* wrappee = new CSteamCallbackRecordingWrapper(this, pCallback, m_SteamCallbacksCounter++); - m_SteamCallbacks[pCallback] = wrappee; - return wrappee; - } - else - { - return (*itr).second; - } -} - -void CRecordingEngExtInterceptor::SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback) -{ - CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - - if (wrappee->GetFlags() != pCallback->GetFlags()) regamedll_syserror("%s: flags desync", __FUNCTION__); - //if (wrappee->GetICallback() != pCallback->GetICallback()) regamedll_syserror("%s: flags desync", __FUNCTION__); - - CSteamApiRegisterCallbackCall fcall(wrappee->getRegamedllCallbackId(), iCallback, wrappee); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->SteamAPI_RegisterCallback(wrappee, iCallback); - - fcall.setResult(wrappee); - pCallback->SetFlags(wrappee->GetFlags()); - pCallback->SetICallback(wrappee->GetICallback()); - - PopFunc(&frec); -} - -bool CRecordingEngExtInterceptor::SteamAPI_Init() -{ - CSteamApiInitCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - bool res = m_BasePlatform->SteamAPI_Init(); - fcall.setResult(res); - PopFunc(&frec); - return res; -} - -void CRecordingEngExtInterceptor::SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) -{ - CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - - if (wrappee->GetFlags() != pCallback->GetFlags()) regamedll_syserror("%s: flags desync", __FUNCTION__); - if (wrappee->GetICallback() != pCallback->GetICallback()) regamedll_syserror("%s: flags desync", __FUNCTION__); - - CSteamApiUnrigestierCallResultCall fcall(wrappee->getRegamedllCallbackId(), hAPICall, wrappee); CRecorderFuncCall frec(&fcall); - - PushFunc(&frec); - - m_BasePlatform->SteamAPI_UnregisterCallResult(wrappee, hAPICall); - - fcall.setResult(wrappee); - pCallback->SetFlags(wrappee->GetFlags()); - pCallback->SetICallback(wrappee->GetICallback()); - - PopFunc(&frec); -} - -ISteamApps* CRecordingEngExtInterceptor::SteamApps() -{ - CSteamAppsCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - if (m_SteamAppsWrapper == NULL) - { - ISteamApps* orig = m_BasePlatform->SteamApps(); - fcall.setReturnNull(orig == NULL); - if (orig != NULL) - m_SteamAppsWrapper = new CSteamAppsRecordingWrapper(orig, this); - } - else - { - m_BasePlatform->SteamApps(); - fcall.setReturnNull(false); - } - - PopFunc(&frec); - return m_SteamAppsWrapper; -} - -bool CRecordingEngExtInterceptor::SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) -{ - CSteamGameServerInitCall fcall(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - bool res = m_BasePlatform->SteamGameServer_Init(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString); - fcall.setResult(res); - PopFunc(&frec); - return res; -} - -ISteamGameServer* CRecordingEngExtInterceptor::SteamGameServer() -{ - CSteamGameServerCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - - if (m_GameServerWrapper == NULL) - { - ISteamGameServer* orig = m_BasePlatform->SteamGameServer(); - fcall.setReturnNull(orig == NULL); - if (orig != NULL) - m_GameServerWrapper = new CSteamGameServerRecordingWrapper(orig, this); - } - else - { - fcall.setReturnNull(false); - m_BasePlatform->SteamGameServer(); - } - - PopFunc(&frec); - return m_GameServerWrapper; -} - -void CRecordingEngExtInterceptor::SteamAPI_SetBreakpadAppID(uint32 unAppID) -{ - CSteamApiSetBreakpadAppIdCall fcall(unAppID); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->SteamAPI_SetBreakpadAppID(unAppID); - PopFunc(&frec); -} - -void CRecordingEngExtInterceptor::SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback) -{ - m_BasePlatform->SteamAPI_UseBreakpadCrashHandler(pchVersion, pchDate, pchTime, bFullMemoryDumps, pvContext, m_pfnPreMinidumpCallback); -} - -void CRecordingEngExtInterceptor::SteamGameServer_RunCallbacks() -{ - CSteamGameServerRunCallbacksCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->SteamGameServer_RunCallbacks(); - PopFunc(&frec); -} - -void CRecordingEngExtInterceptor::SteamAPI_RunCallbacks() -{ - CSteamApiRunCallbacksCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->SteamAPI_RunCallbacks(); - PopFunc(&frec); -} - -void CRecordingEngExtInterceptor::SteamGameServer_Shutdown() -{ - CSteamGameServerShutdownCall fcall; CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->SteamGameServer_Shutdown(); - m_GameServerWrapper = NULL; - PopFunc(&frec); -} - -void CRecordingEngExtInterceptor::SteamAPI_UnregisterCallback(CCallbackBase *pCallback) -{ - CSteamCallbackRecordingWrapper* wrappee = getOrCreateCallbackWrapper(pCallback); - - if (wrappee->GetFlags() != pCallback->GetFlags()) regamedll_syserror("%s: flags desync", __FUNCTION__); - if (wrappee->GetICallback() != pCallback->GetICallback()) regamedll_syserror("%s: flags desync", __FUNCTION__); - - CSteamApiUnregisterCallbackCall fcall(wrappee->getRegamedllCallbackId(), wrappee); CRecorderFuncCall frec(&fcall); - PushFunc(&frec); - m_BasePlatform->SteamAPI_UnregisterCallback(wrappee); - - fcall.setResult(wrappee); - pCallback->SetFlags(wrappee->GetFlags()); - pCallback->SetICallback(wrappee->GetICallback()); - - PopFunc(&frec); -} \ No newline at end of file diff --git a/regamedll/testsuite/recorder.h b/regamedll/testsuite/recorder.h deleted file mode 100644 index e68b3b80..00000000 --- a/regamedll/testsuite/recorder.h +++ /dev/null @@ -1,201 +0,0 @@ -#pragma once -#ifdef _WIN32 - -#include "osconfig.h" -#include "testsuite.h" -#include "funccalls.h" - -class CRecordingEngExtInterceptor; - -class CRecorderFuncCall { - friend class CRecordingEngExtInterceptor; - -private: - IEngExtCall* m_FuncCall; - bool m_StartWritten; - CRecorderFuncCall* m_Next; - CRecorderFuncCall* m_Prev; - -public: - CRecorderFuncCall(IEngExtCall* fcall); -}; - -class CSteamAppsRecordingWrapper : public ISteamApps -{ -private: - ISteamApps* m_Wrapped; - CRecordingEngExtInterceptor* m_Recorder; - -public: - CSteamAppsRecordingWrapper(ISteamApps* original, CRecordingEngExtInterceptor* recorder); - - virtual bool BIsSubscribed(); - virtual bool BIsLowViolence(); - virtual bool BIsCybercafe(); - virtual bool BIsVACBanned(); - virtual const char *GetCurrentGameLanguage(); - virtual const char *GetAvailableGameLanguages(); - - virtual bool BIsSubscribedApp(AppId_t appID); - virtual bool BIsDlcInstalled(AppId_t appID); - - virtual uint32 GetEarliestPurchaseUnixTime(AppId_t nAppID); - virtual bool BIsSubscribedFromFreeWeekend(); - - virtual int GetDLCCount(); - virtual bool BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize); - - virtual void InstallDLC(AppId_t nAppID); - virtual void UninstallDLC(AppId_t nAppID); - - virtual void RequestAppProofOfPurchaseKey(AppId_t nAppID); - - virtual bool GetCurrentBetaName(char *pchName, int cchNameBufferSize); - virtual bool MarkContentCorrupt(bool bMissingFilesOnly); - virtual uint32 GetInstalledDepots(DepotId_t *pvecDepots, uint32 cMaxDepots); - - virtual uint32 GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize); -}; - -class CSteamGameServerRecordingWrapper : public ISteamGameServer -{ -private: - ISteamGameServer* m_Wrapped; - CRecordingEngExtInterceptor* m_Recorder; - -public: - CSteamGameServerRecordingWrapper(ISteamGameServer* original, CRecordingEngExtInterceptor* recorder); - - virtual bool InitGameServer(uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char *pchVersionString); - virtual void SetProduct(const char *pszProduct); - virtual void SetGameDescription(const char *pszGameDescription); - virtual void SetModDir(const char *pszModDir); - virtual void SetDedicatedServer(bool bDedicated); - virtual void LogOn(const char *pszAccountName, const char *pszPassword); - virtual void LogOnAnonymous(); - virtual void LogOff(); - virtual bool BLoggedOn(); - virtual bool BSecure(); - virtual CSteamID GetSteamID(); - virtual bool WasRestartRequested(); - virtual void SetMaxPlayerCount(int cPlayersMax); - virtual void SetBotPlayerCount(int cBotplayers); - virtual void SetServerName(const char *pszServerName); - virtual void SetMapName(const char *pszMapName); - virtual void SetPasswordProtected(bool bPasswordProtected); - virtual void SetSpectatorPort(uint16 unSpectatorPort); - virtual void SetSpectatorServerName(const char *pszSpectatorServerName); - virtual void ClearAllKeyValues(); - virtual void SetKeyValue(const char *pKey, const char *pValue); - virtual void SetGameTags(const char *pchGameTags); - virtual void SetGameData(const char *pchGameData); - virtual void SetRegion(const char *pszRegion); - virtual bool SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser); - virtual CSteamID CreateUnauthenticatedUserConnection(); - virtual void SendUserDisconnect(CSteamID steamIDUser); - virtual bool BUpdateUserData(CSteamID steamIDUser, const char *pchPlayerName, uint32 uScore); - virtual HAuthTicket GetAuthSessionTicket(void *pTicket, int cbMaxTicket, uint32 *pcbTicket); - virtual EBeginAuthSessionResult BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID); - virtual void EndAuthSession(CSteamID steamID); - virtual void CancelAuthTicket(HAuthTicket hAuthTicket); - virtual EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID); - virtual bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup); - virtual void GetGameplayStats(); - virtual SteamAPICall_t GetServerReputation(); - virtual uint32 GetPublicIP(); - virtual bool HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort); - virtual int GetNextOutgoingPacket(void *pOut, int cbMaxOut, uint32 *pNetAdr, uint16 *pPort); - virtual void EnableHeartbeats(bool bActive); - virtual void SetHeartbeatInterval(int iHeartbeatInterval); - virtual void ForceHeartbeat(); - virtual SteamAPICall_t AssociateWithClan(CSteamID steamIDClan); - virtual SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer); -}; - -class CSteamCallbackRecordingWrapper : public CCallbackBase -{ -public: - CSteamCallbackRecordingWrapper(CRecordingEngExtInterceptor* recorder, CCallbackBase* cb, int id); - virtual void Run(void *pvParam); - virtual void Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall); - virtual int GetCallbackSizeBytes(); - - int getRegamedllCallbackId() { return m_Id; } - -protected: - CRecordingEngExtInterceptor* m_Recorder; - CCallbackBase* m_Wrapped; - int m_Id; - int m_Size; -}; - -class CRecordingEngExtInterceptor : public IReGameDLLPlatform { - friend class CSteamAppsRecordingWrapper; - friend class CSteamGameServerRecordingWrapper; - -private: - std::ofstream m_OutStream; - - SOCKET m_ServerSocket; - - int m_SteamCallbacksCounter; - std::unordered_map m_SteamCallbacks; - CSteamAppsRecordingWrapper* m_SteamAppsWrapper; - - CSteamCallbackRecordingWrapper* getOrCreateCallbackWrapper(CCallbackBase *pCallback); - - CSteamGameServerRecordingWrapper* m_GameServerWrapper; - void* m_SteamBreakpadContext; - - CRecorderFuncCall* m_RootFunc; - CRecorderFuncCall* m_LastFunc; - - void writeCall(bool start, bool end, IEngExtCall* fcall); - IReGameDLLPlatform* m_BasePlatform; - -public: - CRecordingEngExtInterceptor(const char* fname, IReGameDLLPlatform* basePlatform); - void PushFunc(CRecorderFuncCall* func); - void PopFunc(CRecorderFuncCall* func); - - virtual uint32 time(uint32* pTime); - virtual struct tm* localtime(uint32 time); - virtual void srand(uint32 seed); - virtual int rand(); - - virtual void Sleep(DWORD msec); - virtual BOOL QueryPerfCounter(LARGE_INTEGER* counter); - virtual BOOL QueryPerfFreq(LARGE_INTEGER* freq); - virtual DWORD GetTickCount(); - virtual void GetLocalTime(LPSYSTEMTIME time); - virtual void GetSystemTime(LPSYSTEMTIME time); - virtual void GetTimeZoneInfo(LPTIME_ZONE_INFORMATION zinfo); - virtual BOOL GetProcessTimes(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime); - virtual void GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); - - virtual SOCKET socket(int af, int type, int protocol); - virtual int ioctlsocket(SOCKET s, long cmd, u_long *argp); - virtual int setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen); - virtual int closesocket(SOCKET s); - virtual int recvfrom(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, socklen_t *fromlen); - virtual int sendto(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen); - virtual int bind(SOCKET s, const struct sockaddr* addr, int namelen); - virtual int getsockname(SOCKET s, struct sockaddr* name, socklen_t* namelen); - virtual int WSAGetLastError(); - virtual struct hostent* gethostbyname(const char *name); - virtual int gethostname(char *name, int namelen); - - virtual void SteamAPI_SetBreakpadAppID(uint32 unAppID); - virtual void SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback); - virtual void SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback); - virtual bool SteamAPI_Init(); - virtual void SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall); - virtual ISteamApps* SteamApps(); - virtual bool SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString); - virtual ISteamGameServer* SteamGameServer(); - virtual void SteamGameServer_RunCallbacks(); - virtual void SteamAPI_RunCallbacks(); - virtual void SteamGameServer_Shutdown(); - virtual void SteamAPI_UnregisterCallback(CCallbackBase *pCallback); -}; -#endif //_WIN32 \ No newline at end of file diff --git a/regamedll/testsuite/testsuite.cpp b/regamedll/testsuite/testsuite.cpp deleted file mode 100644 index 8217fb0a..00000000 --- a/regamedll/testsuite/testsuite.cpp +++ /dev/null @@ -1,514 +0,0 @@ -#include "precompiled.h" - - -/* ============================================================================ - external function hooks - ============================================================================*/ -uint32 __cdecl time_hooked(uint32* pTime) -{ - return CRegamedllPlatformHolder::get()->time(pTime); -} - -struct tm* __cdecl localtime_hooked(uint32* pTime) -{ - if (pTime == NULL) - regamedll_syserror("%s: pTime is NULL", __FUNCTION__); - - return CRegamedllPlatformHolder::get()->localtime(*pTime); -} - -void __cdecl srand_hooked(uint32 seed) -{ - CRegamedllPlatformHolder::get()->srand(seed); -} - -int __cdecl rand_hooked() -{ - return CRegamedllPlatformHolder::get()->rand(); -} - -void WINAPI Sleep_hooked(DWORD msec) -{ - CRegamedllPlatformHolder::get()->Sleep(msec); -} - -BOOL WINAPI QueryPerfCounter_hooked(LARGE_INTEGER* counter) -{ - return CRegamedllPlatformHolder::get()->QueryPerfCounter(counter); -} - -BOOL WINAPI QueryPerfFreq_hooked(LARGE_INTEGER* freq) -{ - return CRegamedllPlatformHolder::get()->QueryPerfFreq(freq); -} - -DWORD WINAPI GetTickCount_hooked() -{ - return CRegamedllPlatformHolder::get()->GetTickCount(); -} - -void WINAPI GetLocalTime_hooked(LPSYSTEMTIME time) -{ - CRegamedllPlatformHolder::get()->GetLocalTime(time); -} - -void WINAPI GetSystemTime_hooked(LPSYSTEMTIME time) -{ - CRegamedllPlatformHolder::get()->GetSystemTime(time); -} - -void WINAPI GetTimeZoneInfo_hooked(LPTIME_ZONE_INFORMATION tzinfo) -{ - CRegamedllPlatformHolder::get()->GetTimeZoneInfo(tzinfo); -} - -SOCKET __stdcall socket_hooked(int af, int type, int protocol) -{ - return CRegamedllPlatformHolder::get()->socket(af, type, protocol); -} - -int __stdcall ioctlsocket_hooked(SOCKET s, long cmd, u_long *argp) -{ - return CRegamedllPlatformHolder::get()->ioctlsocket(s, cmd, argp); -} - -int __stdcall setsockopt_hooked(SOCKET s, int level, int optname, const char* optval, int optlen) -{ - return CRegamedllPlatformHolder::get()->setsockopt(s, level, optname, optval, optlen); -} - -int __stdcall closesocket_hooked(SOCKET s) -{ - return CRegamedllPlatformHolder::get()->closesocket(s); -} - -int __stdcall recvfrom_hooked(SOCKET s, char* buf, int len, int flags, struct sockaddr* from, int *fromlen) -{ - return CRegamedllPlatformHolder::get()->recvfrom(s, buf, len, flags, from, fromlen); -} - -int __stdcall sendto_hooked(SOCKET s, const char* buf, int len, int flags, const struct sockaddr* to, int tolen) -{ - return CRegamedllPlatformHolder::get()->sendto(s, buf, len, flags, to, tolen); -} - -int __stdcall bind_hooked(SOCKET s, const struct sockaddr* addr, int namelen) -{ - return CRegamedllPlatformHolder::get()->bind(s, addr, namelen); -} - -int __stdcall getsockname_hooked(SOCKET s, struct sockaddr* name, int* namelen) -{ - return CRegamedllPlatformHolder::get()->getsockname(s, name, namelen); -} - -int __stdcall WSAGetLastError_hooked() -{ - return CRegamedllPlatformHolder::get()->WSAGetLastError(); -} - -struct hostent* __stdcall gethostbyname_hooked(const char *name) -{ - return CRegamedllPlatformHolder::get()->gethostbyname(name); -} - -int __stdcall gethostname_hooked(char *name, int namelen) -{ - return CRegamedllPlatformHolder::get()->gethostname(name, namelen); -} - -void __cdecl SteamAPI_SetMiniDumpComment_hooked(const char *pchMsg) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void __cdecl SteamAPI_WriteMiniDump_hooked(uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void __cdecl SteamAPI_RegisterCallback_hooked(class CCallbackBase *pCallback, int iCallback) -{ - return CRegamedllPlatformHolder::get()->SteamAPI_RegisterCallback(pCallback, iCallback); -} - -void __cdecl SteamAPI_RunCallbacks_hooked() -{ - CRegamedllPlatformHolder::get()->SteamAPI_RunCallbacks(); -} - -bool __cdecl SteamAPI_Init_hooked() -{ - return CRegamedllPlatformHolder::get()->SteamAPI_Init(); -} - -ISteamUser* __cdecl SteamUser_hooked() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return NULL; -} - -ISteamFriends* __cdecl SteamFriends_hooked() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return NULL; -} - -void __cdecl SteamGameServer_RunCallbacks_hooked() -{ - CRegamedllPlatformHolder::get()->SteamGameServer_RunCallbacks(); -} - -void __cdecl SteamAPI_Shutdown_hooked() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -void __cdecl SteamGameServer_Shutdown_hooked() -{ - CRegamedllPlatformHolder::get()->SteamGameServer_Shutdown(); -} - -bool __cdecl SteamGameServer_Init_hooked(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) -{ - return CRegamedllPlatformHolder::get()->SteamGameServer_Init(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString); -} - -void __cdecl SteamAPI_UnregisterCallback_hooked(class CCallbackBase *pCallback) -{ - CRegamedllPlatformHolder::get()->SteamAPI_UnregisterCallback(pCallback); -} - -ISteamGameServer* __cdecl SteamGameServer_hooked() -{ - return CRegamedllPlatformHolder::get()->SteamGameServer(); -} - -void __cdecl SteamAPI_SetBreakpadAppID_hooked(uint32 unAppID) -{ - CRegamedllPlatformHolder::get()->SteamAPI_SetBreakpadAppID(unAppID); -} - -void __cdecl SteamAPI_RegisterCallResult_hooked(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); -} - -ISteamHTTP* __cdecl SteamHTTP_hooked() -{ - regamedll_syserror("%s: not implemented", __FUNCTION__); - return NULL; -} - -void __cdecl SteamAPI_UnregisterCallResult_hooked(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) -{ - CRegamedllPlatformHolder::get()->SteamAPI_UnregisterCallResult(pCallback, hAPICall); -} - -ISteamApps* __cdecl SteamApps_hooked() -{ - return CRegamedllPlatformHolder::get()->SteamApps(); -} - -void __cdecl SteamAPI_UseBreakpadCrashHandler_hooked(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback) -{ - CRegamedllPlatformHolder::get()->SteamAPI_UseBreakpadCrashHandler(pchVersion, pchDate, pchTime, bFullMemoryDumps, pvContext, m_pfnPreMinidumpCallback); -} - -/* ============================================================================ - Hooks installation - ============================================================================*/ -HMODULE getModuleHandleOrDie(const char* moduleName) { - HMODULE res = GetModuleHandleA(moduleName); - if (res == NULL) { - regamedll_syserror("getModuleHandleOrDie(): module not found: '%s'", moduleName); - } - - return res; -} - -void* getProcAddressOrDie(HMODULE hModule, const char* procName) { - void* res = GetProcAddress(hModule, procName); - if (res == NULL) { - regamedll_syserror("getProcAddressOrDie(): procedure not found: '%s'", procName); - } - - return res; -} - -void InstallImportTableHook(PIMAGE_THUNK_DATA thunk, void* func) -{ - DWORD oldProtect; - VirtualProtect(thunk, 4, PAGE_READWRITE, &oldProtect); - thunk->u1.Function = (DWORD)func; -} - -void TestSuite_InstallHooks(const Module* engine) { - HMODULE hKernel32 = getModuleHandleOrDie("kernel32.dll"); - HMODULE hWinSock32 = getModuleHandleOrDie("wsock32.dll"); - HMODULE hSteamApi = getModuleHandleOrDie("steam_api.dll"); - - - void* QueryPerfCounter_addr = getProcAddressOrDie(hKernel32, "QueryPerformanceCounter"); - void* QueryPerfFreq_addr = getProcAddressOrDie(hKernel32, "QueryPerformanceFrequency"); - void* Sleep_addr = getProcAddressOrDie(hKernel32, "Sleep"); - void* GetTickCount_addr = getProcAddressOrDie(hKernel32, "GetTickCount"); - void* GetLocalTime_addr = getProcAddressOrDie(hKernel32, "GetLocalTime"); - void* GetSystemTime_addr = getProcAddressOrDie(hKernel32, "GetSystemTime"); - void* GetTimeZoneInformation_addr = getProcAddressOrDie(hKernel32, "GetTimeZoneInformation"); - - void* socket_addr = getProcAddressOrDie(hWinSock32, "socket"); - void* ioctlsocket_addr = getProcAddressOrDie(hWinSock32, "ioctlsocket"); - void* setsockopt_addr = getProcAddressOrDie(hWinSock32, "setsockopt"); - void* closesocket_addr = getProcAddressOrDie(hWinSock32, "closesocket"); - void* recvfrom_addr = getProcAddressOrDie(hWinSock32, "recvfrom"); - void* sendto_addr = getProcAddressOrDie(hWinSock32, "sendto"); - void* bind_addr = getProcAddressOrDie(hWinSock32, "bind"); - void* getsockname_addr = getProcAddressOrDie(hWinSock32, "getsockname"); - void* gethostname_addr = getProcAddressOrDie(hWinSock32, "gethostname"); - void* gethostbyname_addr = getProcAddressOrDie(hWinSock32, "gethostbyname"); - void* WSAGetLastError_addr = getProcAddressOrDie(hWinSock32, "WSAGetLastError"); - - void* SteamAPI_SetMiniDumpComment_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_SetMiniDumpComment"); - void* SteamAPI_WriteMiniDump_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_WriteMiniDump"); - void* SteamAPI_RegisterCallback_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_RegisterCallback"); - void* SteamAPI_RunCallbacks_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_RunCallbacks"); - void* SteamAPI_Init_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_Init"); - void* SteamUser_addr = getProcAddressOrDie(hSteamApi, "SteamUser"); - void* SteamFriends_addr = getProcAddressOrDie(hSteamApi, "SteamFriends"); - void* SteamGameServer_RunCallbacks_addr = getProcAddressOrDie(hSteamApi, "SteamGameServer_RunCallbacks"); - void* SteamAPI_Shutdown_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_Shutdown"); - void* SteamGameServer_Shutdown_addr = getProcAddressOrDie(hSteamApi, "SteamGameServer_Shutdown"); - void* SteamGameServer_Init_addr = getProcAddressOrDie(hSteamApi, "SteamGameServer_Init"); - void* SteamAPI_UnregisterCallback_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_UnregisterCallback"); - void* SteamGameServer_addr = getProcAddressOrDie(hSteamApi, "SteamGameServer"); - void* SteamAPI_SetBreakpadAppID_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_SetBreakpadAppID"); - void* SteamAPI_RegisterCallResult_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_RegisterCallResult"); - void* SteamHTTP_addr = getProcAddressOrDie(hSteamApi, "SteamHTTP"); - void* SteamAPI_UnregisterCallResult_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_UnregisterCallResult"); - void* SteamApps_addr = getProcAddressOrDie(hSteamApi, "SteamApps"); - void* SteamAPI_UseBreakpadCrashHandler_addr = getProcAddressOrDie(hSteamApi, "SteamAPI_UseBreakpadCrashHandler"); - - - PIMAGE_DOS_HEADER peHeader = (PIMAGE_DOS_HEADER)engine->base; - PIMAGE_NT_HEADERS ntHeader = (PIMAGE_NT_HEADERS)(engine->base + peHeader->e_lfanew); - - PIMAGE_IMPORT_DESCRIPTOR impDesc = (PIMAGE_IMPORT_DESCRIPTOR)(ntHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress + engine->base); - for (; impDesc->Name; impDesc++) - { - const char* libName = (const char*)(engine->base + impDesc->Name); - bool isKernel32 = !_stricmp("kernel32.dll", libName); - bool isWSock32 = !_stricmp("wsock32.dll", libName); - bool isSteamApi = !_stricmp("steam_api.dll", libName); - - PIMAGE_THUNK_DATA thunk = (PIMAGE_THUNK_DATA)(engine->base + impDesc->FirstThunk); - for (; thunk->u1.Function; ++thunk) - { - void* fptr = (void**)(thunk->u1.Function); - if (isKernel32) - { - if (fptr == Sleep_addr) - { - InstallImportTableHook(thunk, &Sleep_hooked); - } - else if (fptr == QueryPerfCounter_addr) - { - InstallImportTableHook(thunk, &QueryPerfCounter_hooked); - } - else if (fptr == QueryPerfFreq_addr) - { - InstallImportTableHook(thunk, &QueryPerfFreq_hooked); - } - else if (fptr == GetTickCount_addr) - { - InstallImportTableHook(thunk, &GetTickCount_hooked); - } - else if (fptr == GetLocalTime_addr) - { - InstallImportTableHook(thunk, &GetLocalTime_hooked); - } - else if (fptr == GetSystemTime_addr) - { - InstallImportTableHook(thunk, &GetSystemTime_hooked); - } - else if (fptr == GetTimeZoneInformation_addr) - { - InstallImportTableHook(thunk, &GetTimeZoneInfo_hooked); - } - } - else if (isWSock32) - { - if (fptr == socket_addr) - { - InstallImportTableHook(thunk, &socket_hooked); - } - else if (fptr == ioctlsocket_addr) { - InstallImportTableHook(thunk, &ioctlsocket_hooked); - } - else if (fptr == setsockopt_addr) { - InstallImportTableHook(thunk, &setsockopt_hooked); - } - else if (fptr == closesocket_addr) { - InstallImportTableHook(thunk, &closesocket_hooked); - } - else if (fptr == recvfrom_addr) { - InstallImportTableHook(thunk, &recvfrom_hooked); - } - else if (fptr == sendto_addr) { - InstallImportTableHook(thunk, &sendto_hooked); - } - else if (fptr == bind_addr) { - InstallImportTableHook(thunk, &bind_hooked); - } - else if (fptr == getsockname_addr) { - InstallImportTableHook(thunk, &getsockname_hooked); - } - else if (fptr == WSAGetLastError_addr) { - InstallImportTableHook(thunk, &WSAGetLastError_hooked); - } - else if (fptr == gethostbyname_addr) { - InstallImportTableHook(thunk, &gethostbyname_hooked); - } - else if (fptr == gethostname_addr) { - InstallImportTableHook(thunk, &gethostname_hooked); - } - } - else if (isSteamApi) - { - if (fptr == SteamAPI_SetMiniDumpComment_addr) - { - InstallImportTableHook(thunk, &SteamAPI_SetMiniDumpComment_hooked); - } - else if (fptr == SteamAPI_WriteMiniDump_addr) - { - InstallImportTableHook(thunk, &SteamAPI_WriteMiniDump_hooked); - } - else if (fptr == SteamAPI_RegisterCallback_addr) - { - InstallImportTableHook(thunk, &SteamAPI_RegisterCallback_hooked); - } - else if (fptr == SteamAPI_RunCallbacks_addr) - { - InstallImportTableHook(thunk, &SteamAPI_RunCallbacks_hooked); - } - else if (fptr == SteamAPI_Init_addr) - { - InstallImportTableHook(thunk, &SteamAPI_Init_hooked); - } - else if (fptr == SteamUser_addr) - { - InstallImportTableHook(thunk, &SteamUser_hooked); - } - else if (fptr == SteamFriends_addr) - { - InstallImportTableHook(thunk, &SteamFriends_hooked); - } - else if (fptr == SteamGameServer_RunCallbacks_addr) - { - InstallImportTableHook(thunk, &SteamGameServer_RunCallbacks_hooked); - } - else if (fptr == SteamAPI_Shutdown_addr) - { - InstallImportTableHook(thunk, &SteamAPI_Shutdown_hooked); - } - else if (fptr == SteamGameServer_Shutdown_addr) - { - InstallImportTableHook(thunk, &SteamGameServer_Shutdown_hooked); - } - else if (fptr == SteamGameServer_Init_addr) - { - InstallImportTableHook(thunk, &SteamGameServer_Init_hooked); - } - else if (fptr == SteamAPI_UnregisterCallback_addr) - { - InstallImportTableHook(thunk, &SteamAPI_UnregisterCallback_hooked); - } - else if (fptr == SteamGameServer_addr) - { - InstallImportTableHook(thunk, &SteamGameServer_hooked); - } - else if (fptr == SteamAPI_SetBreakpadAppID_addr) - { - InstallImportTableHook(thunk, &SteamAPI_SetBreakpadAppID_hooked); - } - else if (fptr == SteamAPI_RegisterCallResult_addr) - { - InstallImportTableHook(thunk, &SteamAPI_RegisterCallResult_hooked); - } - else if (fptr == SteamHTTP_addr) - { - InstallImportTableHook(thunk, &SteamHTTP_hooked); - } - else if (fptr == SteamAPI_UnregisterCallResult_addr) - { - InstallImportTableHook(thunk, &SteamAPI_UnregisterCallResult_hooked); - } - else if (fptr == SteamApps_addr) - { - InstallImportTableHook(thunk, &SteamApps_hooked); - } - else if (fptr == SteamAPI_UseBreakpadCrashHandler_addr) - { - InstallImportTableHook(thunk, &SteamAPI_UseBreakpadCrashHandler_hooked); - } - } - } - } -} - -void TestSuite_InstallCStdHooks(const AddressRef* funcRefs) { - const AddressRef* curFunc = funcRefs; - FunctionHook fhook; - while (curFunc->symbolName) - { - if (!strcmp("time", curFunc->symbolName)) { - fhook.originalAddress = curFunc->originalAddress; - fhook.handlerFunc = (size_t) &time_hooked; - HookFunction(NULL, &fhook); - } - else if (!strcmp("localtime", curFunc->symbolName)) { - fhook.originalAddress = curFunc->originalAddress; - fhook.handlerFunc = (size_t)&localtime_hooked; - HookFunction(NULL, &fhook); - } - else if (!strcmp("srand", curFunc->symbolName)) { - fhook.originalAddress = curFunc->originalAddress; - fhook.handlerFunc = (size_t)&srand_hooked; - HookFunction(NULL, &fhook); - } - else if (!strcmp("rand", curFunc->symbolName)) { - fhook.originalAddress = curFunc->originalAddress; - fhook.handlerFunc = (size_t)&rand_hooked; - HookFunction(NULL, &fhook); - } - curFunc++; - } -} - -void TestSuite_Init(const Module* engine, const Module* executable, const AddressRef* funcRefs) { - bool needInstallImportTableHooks = false; - - if (g_ReGameDLLRuntimeConfig.testPlayerMode == TPM_RECORD) - { - CRegamedllPlatformHolder::set(new CRecordingEngExtInterceptor(g_ReGameDLLRuntimeConfig.testRecordingFileName, CRegamedllPlatformHolder::get())); - needInstallImportTableHooks = true; - } - else if (g_ReGameDLLRuntimeConfig.testPlayerMode == TPM_PLAY) - { - CRegamedllPlatformHolder::set(new CPlayingEngExtInterceptor(g_ReGameDLLRuntimeConfig.testRecordingFileName, true)); - needInstallImportTableHooks = true; - } - - if (needInstallImportTableHooks) { - if (engine != NULL) { - TestSuite_InstallHooks(engine); - } - - TestSuite_InstallHooks(executable); - - if (funcRefs != NULL) { - TestSuite_InstallCStdHooks(funcRefs); - } - } -} - diff --git a/regamedll/testsuite/testsuite.h b/regamedll/testsuite/testsuite.h deleted file mode 100644 index 4adc5308..00000000 --- a/regamedll/testsuite/testsuite.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#ifdef _WIN32 - -#include "osconfig.h" -#include "memory.h" -#include "regamedll/platform.h" - -#include -#include -#include -#include - -#define TESTSUITE_PROTOCOL_VERSION_MINOR 5 -#define TESTSUITE_PROTOCOL_VERSION_MAJOR 0 - -void TestSuite_Init(const Module* engine, const Module* executable, const AddressRef* funcRefs); - -#endif \ No newline at end of file diff --git a/regamedll/unittests/animation_tests.cpp b/regamedll/unittests/animation_tests.cpp index d908b68e..43c00c91 100644 --- a/regamedll/unittests/animation_tests.cpp +++ b/regamedll/unittests/animation_tests.cpp @@ -5,6 +5,8 @@ #pragma push_macro("vec3_t") #undef vec3_t +extern void AngleQuaternion(vec_t *angles, vec_t *quaternion); + TEST(AngleQuaternion, AnimationFuncs, 10000) { struct testdata_t { vec3_t angles; diff --git a/regamedll/unittests/struct_offsets_tests.cpp b/regamedll/unittests/struct_offsets_tests.cpp index fba89c92..5f7ab30a 100644 --- a/regamedll/unittests/struct_offsets_tests.cpp +++ b/regamedll/unittests/struct_offsets_tests.cpp @@ -62,7 +62,7 @@ TEST(StructOffsets, ReversingChecks, 5000) REPEAT_SIZEOF_PRINT(CCareerTaskManager); REPEAT_SIZEOF_PRINT(CCareerTask); REPEAT_SIZEOF_PRINT(CPreventDefuseTask); - + REPEAT_SIZEOF_PRINT(BotStatement); // offset the members @@ -101,7 +101,7 @@ TEST(StructOffsets, ReversingChecks, 5000) //CHECK_CLASS_SIZE(CBotManager, 12u, 12); CHECK_CLASS_SIZE(CCSBot, 11404, 11424); //CHECK_CLASS_SIZE(CCSBotManager, 740, 0x2E0u);//0x2E4u | 0x2E0u - + CHECK_CLASS_SIZE(BotStatement, 0x70u, 0x70u); //CHECK_CLASS_SIZE(HostageStateMachine, 0x10, 0x10); //CHECK_CLASS_SIZE(HostageFollowState, 0x4C, 0x4C); diff --git a/settings.gradle b/settings.gradle index 2352291a..bf473856 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,3 @@ rootProject.name = 'regamedll' include 'dep/cppunitlite' -include 'dep/bzip2' include 'regamedll' diff --git a/shared.gradle b/shared.gradle index 2ca4ca2c..e9690f20 100644 --- a/shared.gradle +++ b/shared.gradle @@ -11,23 +11,34 @@ apply from: 'shared_icc.gradle' rootProject.ext.createToolchainConfig = { NativeBinarySpec bin -> BinaryKind binaryKind - if (bin instanceof NativeExecutableBinarySpec) { - binaryKind = BinaryKind.EXECUTABLE - } else if (bin instanceof SharedLibraryBinarySpec) { - binaryKind = BinaryKind.SHARED_LIBRARY - } else if (bin instanceof StaticLibraryBinarySpec) { - binaryKind = BinaryKind.STATIC_LIBRARY - } else { - throw new RuntimeException("Unknown executable kind ${bin.class.name}") + if (bin instanceof NativeExecutableBinarySpec) + { + binaryKind = BinaryKind.EXECUTABLE + } + else if (bin instanceof SharedLibraryBinarySpec) + { + binaryKind = BinaryKind.SHARED_LIBRARY + } + else if (bin instanceof StaticLibraryBinarySpec) + { + binaryKind = BinaryKind.STATIC_LIBRARY + } + else + { + throw new RuntimeException("Unknown executable kind ${bin.class.name}") } boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release' - - if (bin.toolChain instanceof VisualCpp) { - return rootProject.createMsvcConfig(releaseBuild, binaryKind) - } else if (bin.toolChain instanceof Icc) { - return rootProject.createIccConfig(releaseBuild, binaryKind) - } else { - throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") + if (bin.toolChain instanceof VisualCpp) + { + return rootProject.createMsvcConfig(releaseBuild, binaryKind) + } + else if (bin.toolChain instanceof Icc) + { + return rootProject.createIccConfig(releaseBuild, binaryKind) + } + else + { + throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") } }