From 00bc077eee43f166a93f157e81a27fbd5002f202 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 5 Apr 2016 04:21:38 +0600 Subject: [PATCH] Initial implementation --- .gitignore | 44 +- build.gradle | 53 + buildSrc/build.gradle | 23 + .../groovy/gradlecpp/VelocityUtils.groovy | 53 + .../src/main/groovy/versioning/GitInfo.groovy | 13 + .../groovy/versioning/GitVersioner.groovy | 53 + .../groovy/versioning/ReapiVersionInfo.groovy | 41 + gradle.properties | 3 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 52279 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 164 ++ gradlew.bat | 90 + msvc/reapi.sln | 22 + publish.gradle | 44 + reapi/build.gradle | 177 ++ .../extra/amxmodx/scripting/include/reapi.inc | 102 + .../amxmodx/scripting/include/reapi_const.inc | 8 + .../scripting/include/reapi_engine.inc | 35 + .../scripting/include/reapi_gamedll.inc | 54 + .../scripting/include/reapi_gamedll_const.inc | 2321 +++++++++++++++++ reapi/extra/amxmodx/scripting/reapi_test.sma | 14 + reapi/include/cssdk/common/IGameServerData.h | 15 + reapi/include/cssdk/common/Sequence.h | 201 ++ reapi/include/cssdk/common/SteamCommon.h | 703 +++++ reapi/include/cssdk/common/beamdef.h | 62 + reapi/include/cssdk/common/cl_entity.h | 115 + reapi/include/cssdk/common/com_model.h | 340 +++ reapi/include/cssdk/common/con_nprint.h | 38 + reapi/include/cssdk/common/const.h | 803 ++++++ reapi/include/cssdk/common/crc.h | 55 + reapi/include/cssdk/common/cvardef.h | 39 + reapi/include/cssdk/common/demo_api.h | 31 + reapi/include/cssdk/common/director_cmds.h | 38 + reapi/include/cssdk/common/dlight.h | 33 + reapi/include/cssdk/common/dll_state.h | 23 + reapi/include/cssdk/common/entity_state.h | 197 ++ reapi/include/cssdk/common/entity_types.h | 26 + reapi/include/cssdk/common/enums.h | 27 + reapi/include/cssdk/common/event_api.h | 51 + reapi/include/cssdk/common/event_args.h | 50 + reapi/include/cssdk/common/event_flags.h | 47 + reapi/include/cssdk/common/hltv.h | 61 + reapi/include/cssdk/common/in_buttons.h | 38 + reapi/include/cssdk/common/ivoicetweak.h | 38 + reapi/include/cssdk/common/kbutton.h | 44 + reapi/include/cssdk/common/mathlib.h | 99 + reapi/include/cssdk/common/net_api.h | 99 + reapi/include/cssdk/common/netadr.h | 40 + reapi/include/cssdk/common/nowin.h | 16 + reapi/include/cssdk/common/parsemsg.cpp | 259 ++ reapi/include/cssdk/common/parsemsg.h | 66 + reapi/include/cssdk/common/particledef.h | 57 + reapi/include/cssdk/common/pmtrace.h | 43 + reapi/include/cssdk/common/port.h | 119 + reapi/include/cssdk/common/qfont.h | 41 + reapi/include/cssdk/common/qlimits.h | 39 + reapi/include/cssdk/common/quakedef.h | 44 + reapi/include/cssdk/common/r_efx.h | 197 ++ reapi/include/cssdk/common/r_studioint.h | 151 ++ reapi/include/cssdk/common/ref_params.h | 75 + reapi/include/cssdk/common/screenfade.h | 24 + reapi/include/cssdk/common/studio_event.h | 29 + reapi/include/cssdk/common/triangleapi.h | 64 + reapi/include/cssdk/common/usercmd.h | 41 + reapi/include/cssdk/common/vmodes.h | 35 + reapi/include/cssdk/common/weaponinfo.h | 53 + reapi/include/cssdk/common/winsani_in.h | 7 + reapi/include/cssdk/common/winsani_out.h | 4 + reapi/include/cssdk/dlls/activity.h | 145 + reapi/include/cssdk/dlls/activitymap.h | 111 + reapi/include/cssdk/dlls/airtank.h | 42 + reapi/include/cssdk/dlls/ammo.h | 98 + reapi/include/cssdk/dlls/basemonster.h | 105 + reapi/include/cssdk/dlls/bmodels.h | 131 + reapi/include/cssdk/dlls/bot/cs_bot.h | 641 +++++ reapi/include/cssdk/dlls/bot/cs_bot_chatter.h | 337 +++ reapi/include/cssdk/dlls/bot/cs_bot_manager.h | 145 + reapi/include/cssdk/dlls/bot/cs_gamestate.h | 90 + reapi/include/cssdk/dlls/buttons.h | 104 + reapi/include/cssdk/dlls/cbase.h | 373 +++ reapi/include/cssdk/dlls/cdll_dll.h | 126 + reapi/include/cssdk/dlls/client.h | 97 + reapi/include/cssdk/dlls/csbot_dll.h | 50 + reapi/include/cssdk/dlls/decals.h | 83 + reapi/include/cssdk/dlls/doors.h | 92 + reapi/include/cssdk/dlls/effects.h | 407 +++ reapi/include/cssdk/dlls/enginecallback.h | 178 ++ reapi/include/cssdk/dlls/explode.h | 55 + reapi/include/cssdk/dlls/extdef.h | 80 + reapi/include/cssdk/dlls/extdll.h | 83 + reapi/include/cssdk/dlls/func_break.h | 119 + reapi/include/cssdk/dlls/func_tank.h | 159 ++ reapi/include/cssdk/dlls/gamerules.h | 501 ++++ reapi/include/cssdk/dlls/h_battery.h | 45 + reapi/include/cssdk/dlls/h_cycler.h | 104 + reapi/include/cssdk/dlls/healthkit.h | 52 + reapi/include/cssdk/dlls/hintmessage.h | 81 + reapi/include/cssdk/dlls/hookchains.h | 89 + reapi/include/cssdk/dlls/hostage/hostage.h | 232 ++ .../cssdk/dlls/hostage/hostage_improv.h | 331 +++ .../cssdk/dlls/hostage/hostage_localnav.h | 58 + .../cssdk/dlls/hostage/hostage_states.h | 203 ++ reapi/include/cssdk/dlls/items.h | 110 + reapi/include/cssdk/dlls/lights.h | 50 + reapi/include/cssdk/dlls/maprules.h | 236 ++ reapi/include/cssdk/dlls/monsterevent.h | 44 + reapi/include/cssdk/dlls/monsters.h | 113 + reapi/include/cssdk/dlls/mortar.h | 55 + reapi/include/cssdk/dlls/observer.h | 32 + reapi/include/cssdk/dlls/osconfig.h | 196 ++ reapi/include/cssdk/dlls/pathcorner.h | 39 + reapi/include/cssdk/dlls/platform.h | 651 +++++ reapi/include/cssdk/dlls/plats.h | 178 ++ reapi/include/cssdk/dlls/player.h | 558 ++++ reapi/include/cssdk/dlls/regamedll_api.h | 198 ++ reapi/include/cssdk/dlls/regamedll_const.h | 104 + .../include/cssdk/dlls/regamedll_interfaces.h | 2071 +++++++++++++++ reapi/include/cssdk/dlls/revert_saved.h | 49 + reapi/include/cssdk/dlls/skill.h | 53 + reapi/include/cssdk/dlls/sound.h | 141 + reapi/include/cssdk/dlls/spectator.h | 33 + reapi/include/cssdk/dlls/subs.h | 40 + reapi/include/cssdk/dlls/training_gamerules.h | 82 + reapi/include/cssdk/dlls/trains.h | 149 ++ reapi/include/cssdk/dlls/triggers.h | 358 +++ reapi/include/cssdk/dlls/unisignals.h | 57 + reapi/include/cssdk/dlls/util.h | 181 ++ reapi/include/cssdk/dlls/vector.h | 168 ++ reapi/include/cssdk/dlls/vehicle.h | 53 + reapi/include/cssdk/dlls/weapons.h | 891 +++++++ reapi/include/cssdk/dlls/weapontype.h | 402 +++ reapi/include/cssdk/dlls/wpn_shared.h | 598 +++++ reapi/include/cssdk/engine/FlightRecorder.h | 61 + reapi/include/cssdk/engine/Sequence.h | 201 ++ reapi/include/cssdk/engine/archtypes.h | 66 + reapi/include/cssdk/engine/bspfile.h | 169 ++ reapi/include/cssdk/engine/cmd_rehlds.h | 53 + reapi/include/cssdk/engine/common_rehlds.h | 81 + reapi/include/cssdk/engine/crc32c.cpp | 143 + reapi/include/cssdk/engine/crc32c.h | 22 + reapi/include/cssdk/engine/custom.h | 96 + reapi/include/cssdk/engine/customentity.h | 38 + reapi/include/cssdk/engine/d_local.h | 46 + reapi/include/cssdk/engine/edict.h | 36 + reapi/include/cssdk/engine/eiface.h | 536 ++++ reapi/include/cssdk/engine/hookchains_.h | 69 + reapi/include/cssdk/engine/keydefs.h | 131 + reapi/include/cssdk/engine/maintypes.h | 52 + reapi/include/cssdk/engine/model.h | 415 +++ reapi/include/cssdk/engine/modelgen.h | 144 + reapi/include/cssdk/engine/osconfig.h | 194 ++ reapi/include/cssdk/engine/progdefs.h | 224 ++ reapi/include/cssdk/engine/progs.h | 82 + reapi/include/cssdk/engine/rehlds_api.h | 286 ++ .../include/cssdk/engine/rehlds_interfaces.h | 129 + reapi/include/cssdk/engine/shake.h | 57 + reapi/include/cssdk/engine/spritegn.h | 90 + reapi/include/cssdk/engine/static_map.h | 257 ++ reapi/include/cssdk/engine/studio.h | 358 +++ reapi/include/cssdk/engine/sys_shared.cpp | 72 + reapi/include/cssdk/engine/sys_shared.h | 39 + reapi/include/cssdk/engine/userid_rehlds.h | 47 + reapi/include/cssdk/game_shared/GameEvent.h | 138 + reapi/include/cssdk/game_shared/bitvec.h | 157 ++ reapi/include/cssdk/game_shared/bot/bot.h | 163 ++ .../cssdk/game_shared/bot/bot_constants.h | 47 + .../cssdk/game_shared/bot/bot_manager.h | 70 + .../cssdk/game_shared/bot/bot_profile.h | 116 + .../include/cssdk/game_shared/bot/bot_util.h | 141 + reapi/include/cssdk/game_shared/bot/improv.h | 120 + reapi/include/cssdk/game_shared/bot/nav.h | 400 +++ .../include/cssdk/game_shared/bot/nav_area.h | 320 +++ .../include/cssdk/game_shared/bot/nav_node.h | 110 + .../include/cssdk/game_shared/bot/nav_path.h | 99 + .../game_shared/bot/simple_state_machine.h | 101 + .../include/cssdk/game_shared/perf_counter.h | 183 ++ reapi/include/cssdk/game_shared/shared_util.h | 65 + .../cssdk/game_shared/simple_checksum.h | 49 + reapi/include/cssdk/game_shared/steam_util.h | 76 + .../include/cssdk/game_shared/voice_common.h | 36 + .../include/cssdk/game_shared/voice_gamemgr.h | 56 + reapi/include/cssdk/pm_shared/pm_defs.h | 192 ++ reapi/include/cssdk/pm_shared/pm_info.h | 30 + reapi/include/cssdk/pm_shared/pm_materials.h | 45 + reapi/include/cssdk/pm_shared/pm_movevars.h | 59 + reapi/include/cssdk/pm_shared/pm_shared.h | 75 + reapi/include/cssdk/public/FileSystem.h | 189 ++ reapi/include/cssdk/public/interface.cpp | 263 ++ reapi/include/cssdk/public/interface.h | 150 ++ reapi/include/cssdk/public/utlmemory.h | 356 +++ reapi/include/cssdk/public/utlvector.h | 565 ++++ reapi/include/metamod/dllapi.h | 189 ++ reapi/include/metamod/engine_api.h | 461 ++++ reapi/include/metamod/enginecallbacks.h | 74 + reapi/include/metamod/h_export.h | 46 + reapi/include/metamod/log_meta.h | 99 + reapi/include/metamod/meta_api.h | 232 ++ reapi/include/metamod/mhook.h | 157 ++ reapi/include/metamod/mreg.h | 183 ++ reapi/include/metamod/mutil.h | 157 ++ reapi/include/metamod/osdep.h | 519 ++++ reapi/include/metamod/plinfo.h | 79 + reapi/include/metamod/sdk_util.h | 98 + reapi/include/metamod/types_meta.h | 79 + reapi/msvc/PostBuild.bat | 56 + reapi/msvc/PreBuild.bat | 168 ++ reapi/msvc/reapi.def | 5 + reapi/msvc/reapi.rc | 108 + reapi/msvc/reapi.vcxproj | 398 +++ reapi/msvc/reapi.vcxproj.filters | 717 +++++ reapi/msvc/resource.h | 14 + reapi/src/amxxmodule.cpp | 208 ++ reapi/src/amxxmodule.h | 507 ++++ reapi/src/api_config.cpp | 11 + reapi/src/api_config.h | 25 + reapi/src/dllapi.cpp | 151 ++ reapi/src/engine_api.cpp | 192 ++ reapi/src/h_export.cpp | 13 + reapi/src/hook_callback.cpp | 334 +++ reapi/src/hook_callback.h | 145 + reapi/src/hook_list.cpp | 60 + reapi/src/hook_list.h | 203 ++ reapi/src/hook_manager.cpp | 40 + reapi/src/hook_manager.h | 43 + reapi/src/main.cpp | 21 + reapi/src/member_list.cpp | 330 +++ reapi/src/member_list.h | 326 +++ reapi/src/meta_api.cpp | 62 + reapi/src/mod_regamedll_api.cpp | 58 + reapi/src/mod_regamedll_api.h | 8 + reapi/src/mod_rehlds_api.cpp | 55 + reapi/src/mod_rehlds_api.h | 8 + reapi/src/natives.cpp | 169 ++ reapi/src/natives.h | 9 + reapi/src/natives_member.cpp | 378 +++ reapi/src/precompiled.cpp | 1 + reapi/src/precompiled.h | 38 + reapi/src/reapi_const.inc | 8 + reapi/src/reapi_utils.h | 50 + reapi/src/sdk_util.cpp | 42 + reapi/version/appversion.vm | 27 + reapi/version/version.cpp | 10 + settings.gradle | 2 + shared.gradle | 33 + shared_icc.gradle | 66 + shared_msvc.gradle | 125 + 246 files changed, 37569 insertions(+), 27 deletions(-) create mode 100644 build.gradle create mode 100644 buildSrc/build.gradle create mode 100644 buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy create mode 100644 buildSrc/src/main/groovy/versioning/GitInfo.groovy create mode 100644 buildSrc/src/main/groovy/versioning/GitVersioner.groovy create mode 100644 buildSrc/src/main/groovy/versioning/ReapiVersionInfo.groovy create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 msvc/reapi.sln create mode 100644 publish.gradle create mode 100644 reapi/build.gradle create mode 100644 reapi/extra/amxmodx/scripting/include/reapi.inc create mode 100644 reapi/extra/amxmodx/scripting/include/reapi_const.inc create mode 100644 reapi/extra/amxmodx/scripting/include/reapi_engine.inc create mode 100644 reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc create mode 100644 reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc create mode 100644 reapi/extra/amxmodx/scripting/reapi_test.sma create mode 100644 reapi/include/cssdk/common/IGameServerData.h create mode 100644 reapi/include/cssdk/common/Sequence.h create mode 100644 reapi/include/cssdk/common/SteamCommon.h create mode 100644 reapi/include/cssdk/common/beamdef.h create mode 100644 reapi/include/cssdk/common/cl_entity.h create mode 100644 reapi/include/cssdk/common/com_model.h create mode 100644 reapi/include/cssdk/common/con_nprint.h create mode 100644 reapi/include/cssdk/common/const.h create mode 100644 reapi/include/cssdk/common/crc.h create mode 100644 reapi/include/cssdk/common/cvardef.h create mode 100644 reapi/include/cssdk/common/demo_api.h create mode 100644 reapi/include/cssdk/common/director_cmds.h create mode 100644 reapi/include/cssdk/common/dlight.h create mode 100644 reapi/include/cssdk/common/dll_state.h create mode 100644 reapi/include/cssdk/common/entity_state.h create mode 100644 reapi/include/cssdk/common/entity_types.h create mode 100644 reapi/include/cssdk/common/enums.h create mode 100644 reapi/include/cssdk/common/event_api.h create mode 100644 reapi/include/cssdk/common/event_args.h create mode 100644 reapi/include/cssdk/common/event_flags.h create mode 100644 reapi/include/cssdk/common/hltv.h create mode 100644 reapi/include/cssdk/common/in_buttons.h create mode 100644 reapi/include/cssdk/common/ivoicetweak.h create mode 100644 reapi/include/cssdk/common/kbutton.h create mode 100644 reapi/include/cssdk/common/mathlib.h create mode 100644 reapi/include/cssdk/common/net_api.h create mode 100644 reapi/include/cssdk/common/netadr.h create mode 100644 reapi/include/cssdk/common/nowin.h create mode 100644 reapi/include/cssdk/common/parsemsg.cpp create mode 100644 reapi/include/cssdk/common/parsemsg.h create mode 100644 reapi/include/cssdk/common/particledef.h create mode 100644 reapi/include/cssdk/common/pmtrace.h create mode 100644 reapi/include/cssdk/common/port.h create mode 100644 reapi/include/cssdk/common/qfont.h create mode 100644 reapi/include/cssdk/common/qlimits.h create mode 100644 reapi/include/cssdk/common/quakedef.h create mode 100644 reapi/include/cssdk/common/r_efx.h create mode 100644 reapi/include/cssdk/common/r_studioint.h create mode 100644 reapi/include/cssdk/common/ref_params.h create mode 100644 reapi/include/cssdk/common/screenfade.h create mode 100644 reapi/include/cssdk/common/studio_event.h create mode 100644 reapi/include/cssdk/common/triangleapi.h create mode 100644 reapi/include/cssdk/common/usercmd.h create mode 100644 reapi/include/cssdk/common/vmodes.h create mode 100644 reapi/include/cssdk/common/weaponinfo.h create mode 100644 reapi/include/cssdk/common/winsani_in.h create mode 100644 reapi/include/cssdk/common/winsani_out.h create mode 100644 reapi/include/cssdk/dlls/activity.h create mode 100644 reapi/include/cssdk/dlls/activitymap.h create mode 100644 reapi/include/cssdk/dlls/airtank.h create mode 100644 reapi/include/cssdk/dlls/ammo.h create mode 100644 reapi/include/cssdk/dlls/basemonster.h create mode 100644 reapi/include/cssdk/dlls/bmodels.h create mode 100644 reapi/include/cssdk/dlls/bot/cs_bot.h create mode 100644 reapi/include/cssdk/dlls/bot/cs_bot_chatter.h create mode 100644 reapi/include/cssdk/dlls/bot/cs_bot_manager.h create mode 100644 reapi/include/cssdk/dlls/bot/cs_gamestate.h create mode 100644 reapi/include/cssdk/dlls/buttons.h create mode 100644 reapi/include/cssdk/dlls/cbase.h create mode 100644 reapi/include/cssdk/dlls/cdll_dll.h create mode 100644 reapi/include/cssdk/dlls/client.h create mode 100644 reapi/include/cssdk/dlls/csbot_dll.h create mode 100644 reapi/include/cssdk/dlls/decals.h create mode 100644 reapi/include/cssdk/dlls/doors.h create mode 100644 reapi/include/cssdk/dlls/effects.h create mode 100644 reapi/include/cssdk/dlls/enginecallback.h create mode 100644 reapi/include/cssdk/dlls/explode.h create mode 100644 reapi/include/cssdk/dlls/extdef.h create mode 100644 reapi/include/cssdk/dlls/extdll.h create mode 100644 reapi/include/cssdk/dlls/func_break.h create mode 100644 reapi/include/cssdk/dlls/func_tank.h create mode 100644 reapi/include/cssdk/dlls/gamerules.h create mode 100644 reapi/include/cssdk/dlls/h_battery.h create mode 100644 reapi/include/cssdk/dlls/h_cycler.h create mode 100644 reapi/include/cssdk/dlls/healthkit.h create mode 100644 reapi/include/cssdk/dlls/hintmessage.h create mode 100644 reapi/include/cssdk/dlls/hookchains.h create mode 100644 reapi/include/cssdk/dlls/hostage/hostage.h create mode 100644 reapi/include/cssdk/dlls/hostage/hostage_improv.h create mode 100644 reapi/include/cssdk/dlls/hostage/hostage_localnav.h create mode 100644 reapi/include/cssdk/dlls/hostage/hostage_states.h create mode 100644 reapi/include/cssdk/dlls/items.h create mode 100644 reapi/include/cssdk/dlls/lights.h create mode 100644 reapi/include/cssdk/dlls/maprules.h create mode 100644 reapi/include/cssdk/dlls/monsterevent.h create mode 100644 reapi/include/cssdk/dlls/monsters.h create mode 100644 reapi/include/cssdk/dlls/mortar.h create mode 100644 reapi/include/cssdk/dlls/observer.h create mode 100644 reapi/include/cssdk/dlls/osconfig.h create mode 100644 reapi/include/cssdk/dlls/pathcorner.h create mode 100644 reapi/include/cssdk/dlls/platform.h create mode 100644 reapi/include/cssdk/dlls/plats.h create mode 100644 reapi/include/cssdk/dlls/player.h create mode 100644 reapi/include/cssdk/dlls/regamedll_api.h create mode 100644 reapi/include/cssdk/dlls/regamedll_const.h create mode 100644 reapi/include/cssdk/dlls/regamedll_interfaces.h create mode 100644 reapi/include/cssdk/dlls/revert_saved.h create mode 100644 reapi/include/cssdk/dlls/skill.h create mode 100644 reapi/include/cssdk/dlls/sound.h create mode 100644 reapi/include/cssdk/dlls/spectator.h create mode 100644 reapi/include/cssdk/dlls/subs.h create mode 100644 reapi/include/cssdk/dlls/training_gamerules.h create mode 100644 reapi/include/cssdk/dlls/trains.h create mode 100644 reapi/include/cssdk/dlls/triggers.h create mode 100644 reapi/include/cssdk/dlls/unisignals.h create mode 100644 reapi/include/cssdk/dlls/util.h create mode 100644 reapi/include/cssdk/dlls/vector.h create mode 100644 reapi/include/cssdk/dlls/vehicle.h create mode 100644 reapi/include/cssdk/dlls/weapons.h create mode 100644 reapi/include/cssdk/dlls/weapontype.h create mode 100644 reapi/include/cssdk/dlls/wpn_shared.h create mode 100644 reapi/include/cssdk/engine/FlightRecorder.h create mode 100644 reapi/include/cssdk/engine/Sequence.h create mode 100644 reapi/include/cssdk/engine/archtypes.h create mode 100644 reapi/include/cssdk/engine/bspfile.h create mode 100644 reapi/include/cssdk/engine/cmd_rehlds.h create mode 100644 reapi/include/cssdk/engine/common_rehlds.h create mode 100644 reapi/include/cssdk/engine/crc32c.cpp create mode 100644 reapi/include/cssdk/engine/crc32c.h create mode 100644 reapi/include/cssdk/engine/custom.h create mode 100644 reapi/include/cssdk/engine/customentity.h create mode 100644 reapi/include/cssdk/engine/d_local.h create mode 100644 reapi/include/cssdk/engine/edict.h create mode 100644 reapi/include/cssdk/engine/eiface.h create mode 100644 reapi/include/cssdk/engine/hookchains_.h create mode 100644 reapi/include/cssdk/engine/keydefs.h create mode 100644 reapi/include/cssdk/engine/maintypes.h create mode 100644 reapi/include/cssdk/engine/model.h create mode 100644 reapi/include/cssdk/engine/modelgen.h create mode 100644 reapi/include/cssdk/engine/osconfig.h create mode 100644 reapi/include/cssdk/engine/progdefs.h create mode 100644 reapi/include/cssdk/engine/progs.h create mode 100644 reapi/include/cssdk/engine/rehlds_api.h create mode 100644 reapi/include/cssdk/engine/rehlds_interfaces.h create mode 100644 reapi/include/cssdk/engine/shake.h create mode 100644 reapi/include/cssdk/engine/spritegn.h create mode 100644 reapi/include/cssdk/engine/static_map.h create mode 100644 reapi/include/cssdk/engine/studio.h create mode 100644 reapi/include/cssdk/engine/sys_shared.cpp create mode 100644 reapi/include/cssdk/engine/sys_shared.h create mode 100644 reapi/include/cssdk/engine/userid_rehlds.h create mode 100644 reapi/include/cssdk/game_shared/GameEvent.h create mode 100644 reapi/include/cssdk/game_shared/bitvec.h create mode 100644 reapi/include/cssdk/game_shared/bot/bot.h create mode 100644 reapi/include/cssdk/game_shared/bot/bot_constants.h create mode 100644 reapi/include/cssdk/game_shared/bot/bot_manager.h create mode 100644 reapi/include/cssdk/game_shared/bot/bot_profile.h create mode 100644 reapi/include/cssdk/game_shared/bot/bot_util.h create mode 100644 reapi/include/cssdk/game_shared/bot/improv.h create mode 100644 reapi/include/cssdk/game_shared/bot/nav.h create mode 100644 reapi/include/cssdk/game_shared/bot/nav_area.h create mode 100644 reapi/include/cssdk/game_shared/bot/nav_node.h create mode 100644 reapi/include/cssdk/game_shared/bot/nav_path.h create mode 100644 reapi/include/cssdk/game_shared/bot/simple_state_machine.h create mode 100644 reapi/include/cssdk/game_shared/perf_counter.h create mode 100644 reapi/include/cssdk/game_shared/shared_util.h create mode 100644 reapi/include/cssdk/game_shared/simple_checksum.h create mode 100644 reapi/include/cssdk/game_shared/steam_util.h create mode 100644 reapi/include/cssdk/game_shared/voice_common.h create mode 100644 reapi/include/cssdk/game_shared/voice_gamemgr.h create mode 100644 reapi/include/cssdk/pm_shared/pm_defs.h create mode 100644 reapi/include/cssdk/pm_shared/pm_info.h create mode 100644 reapi/include/cssdk/pm_shared/pm_materials.h create mode 100644 reapi/include/cssdk/pm_shared/pm_movevars.h create mode 100644 reapi/include/cssdk/pm_shared/pm_shared.h create mode 100644 reapi/include/cssdk/public/FileSystem.h create mode 100644 reapi/include/cssdk/public/interface.cpp create mode 100644 reapi/include/cssdk/public/interface.h create mode 100644 reapi/include/cssdk/public/utlmemory.h create mode 100644 reapi/include/cssdk/public/utlvector.h create mode 100644 reapi/include/metamod/dllapi.h create mode 100644 reapi/include/metamod/engine_api.h create mode 100644 reapi/include/metamod/enginecallbacks.h create mode 100644 reapi/include/metamod/h_export.h create mode 100644 reapi/include/metamod/log_meta.h create mode 100644 reapi/include/metamod/meta_api.h create mode 100644 reapi/include/metamod/mhook.h create mode 100644 reapi/include/metamod/mreg.h create mode 100644 reapi/include/metamod/mutil.h create mode 100644 reapi/include/metamod/osdep.h create mode 100644 reapi/include/metamod/plinfo.h create mode 100644 reapi/include/metamod/sdk_util.h create mode 100644 reapi/include/metamod/types_meta.h create mode 100644 reapi/msvc/PostBuild.bat create mode 100644 reapi/msvc/PreBuild.bat create mode 100644 reapi/msvc/reapi.def create mode 100644 reapi/msvc/reapi.rc create mode 100644 reapi/msvc/reapi.vcxproj create mode 100644 reapi/msvc/reapi.vcxproj.filters create mode 100644 reapi/msvc/resource.h create mode 100644 reapi/src/amxxmodule.cpp create mode 100644 reapi/src/amxxmodule.h create mode 100644 reapi/src/api_config.cpp create mode 100644 reapi/src/api_config.h create mode 100644 reapi/src/dllapi.cpp create mode 100644 reapi/src/engine_api.cpp create mode 100644 reapi/src/h_export.cpp create mode 100644 reapi/src/hook_callback.cpp create mode 100644 reapi/src/hook_callback.h create mode 100644 reapi/src/hook_list.cpp create mode 100644 reapi/src/hook_list.h create mode 100644 reapi/src/hook_manager.cpp create mode 100644 reapi/src/hook_manager.h create mode 100644 reapi/src/main.cpp create mode 100644 reapi/src/member_list.cpp create mode 100644 reapi/src/member_list.h create mode 100644 reapi/src/meta_api.cpp create mode 100644 reapi/src/mod_regamedll_api.cpp create mode 100644 reapi/src/mod_regamedll_api.h create mode 100644 reapi/src/mod_rehlds_api.cpp create mode 100644 reapi/src/mod_rehlds_api.h create mode 100644 reapi/src/natives.cpp create mode 100644 reapi/src/natives.h create mode 100644 reapi/src/natives_member.cpp create mode 100644 reapi/src/precompiled.cpp create mode 100644 reapi/src/precompiled.h create mode 100644 reapi/src/reapi_const.inc create mode 100644 reapi/src/reapi_utils.h create mode 100644 reapi/src/sdk_util.cpp create mode 100644 reapi/version/appversion.vm create mode 100644 reapi/version/version.cpp create mode 100644 settings.gradle create mode 100644 shared.gradle create mode 100644 shared_icc.gradle create mode 100644 shared_msvc.gradle diff --git a/.gitignore b/.gitignore index b8bd026..4785f1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,18 @@ -# Compiled Object files -*.slo -*.lo -*.o -*.obj +**/build +**/.gradle +.idea +*.iml +**/msvc/Debug* +**/msvc/Release* +**/msvc/*.sdf +**/msvc/*.opensdf +**/msvc/*.user +**/msvc/*.suo +**/msvc/*.aps +**/msvc/start*.bat +**/msvc/ipch +**/PublishPath*.txt +**/*.log -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app +publish +**/appversion.h diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..30b5077 --- /dev/null +++ b/build.gradle @@ -0,0 +1,53 @@ +import versioning.GitVersioner +import versioning.ReapiVersionInfo + +apply from: 'shared.gradle' +group = 'reapi' + +apply plugin: 'idea' + +idea { + project { + languageLevel = 'JDK_1_7' + } +} + +def gitInfo = GitVersioner.versionForDir(project.rootDir) +if (!gitInfo) { + throw new RuntimeException('Running outside git repository') +} + +ReapiVersionInfo versionInfo +if (gitInfo.tag && gitInfo.tag[0] == 'v') { + + def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/ + if (!m.find()) { + throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}") + } + + versionInfo = new ReapiVersionInfo( + majorVersion: m.group(1) as int, + minorVersion: m.group(2) as int, + maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, + countCommit: gitInfo.countCommit, + lastCommitDate: gitInfo.lastCommitDate + ) +} else { + + versionInfo = new ReapiVersionInfo( + majorVersion: project.majorVersion as int, + minorVersion: project.minorVersion as int, + specialVersion: project.specialVersion, + countCommit: gitInfo.countCommit, + lastCommitDate: gitInfo.lastCommitDate + ) +} + +project.ext.reapiVersionInfo = versionInfo +project.version = versionInfo.asVersion() + +apply from: 'publish.gradle' + +task wrapper(type: Wrapper) { + gradleVersion = '2.4' +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..0d93aa3 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'groovy' + +repositories { + //mavenLocal() + mavenCentral() + maven { + url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/' + } + maven { + url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/' + } +} + +dependencies { + compile gradleApi() + compile localGroovy() + compile 'commons-io:commons-io:2.4' + compile 'commons-lang:commons-lang:2.6' + compile 'joda-time:joda-time:2.7' + compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2' + compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r' + compile 'org.apache.velocity:velocity:1.7' +} diff --git a/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy b/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy new file mode 100644 index 0000000..9b4938f --- /dev/null +++ b/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy @@ -0,0 +1,53 @@ +package gradlecpp + +import org.apache.velocity.Template +import org.apache.velocity.VelocityContext +import org.apache.velocity.app.Velocity +import org.joda.time.format.DateTimeFormat +import versioning.ReapiVersionInfo + +class VelocityUtils { + + static { + Properties p = new Properties(); + + p.setProperty("resource.loader", "class"); + p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); + p.setProperty("class.resource.loader.path", ""); + + p.setProperty("input.encoding", "UTF-8"); + p.setProperty("output.encoding", "UTF-8"); + + Velocity.init(p); + } + static String renderTemplate(File tplFile, ReapiVersionInfo ctx) { + Template tpl = Velocity.getTemplate(tplFile.absolutePath) + if (!tpl) { + throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found") + } + + def templateCtx = [ + verInfo: ctx + ] + + def velocityContext = new VelocityContext(templateCtx) + + if (ctx.specialVersion.length() > 0) { + velocityContext.put("appFlags", 0x0L) + velocityContext.put("formatSpecialVersion", "-" + ctx.specialVersion) + } else { + + velocityContext.put("appFlags", "VS_FF_SPECIALBUILD") + velocityContext.put("formatSpecialVersion", "") + } + + velocityContext.put("current_version", ctx.asVersion()) + + velocityContext.put("_DateTimeFormat", DateTimeFormat) + + def sw = new StringWriter() + tpl.merge(velocityContext, sw) + + return sw.toString() + } +} diff --git a/buildSrc/src/main/groovy/versioning/GitInfo.groovy b/buildSrc/src/main/groovy/versioning/GitInfo.groovy new file mode 100644 index 0000000..0158421 --- /dev/null +++ b/buildSrc/src/main/groovy/versioning/GitInfo.groovy @@ -0,0 +1,13 @@ +package versioning + +import groovy.transform.CompileStatic +import groovy.transform.TypeChecked +import org.joda.time.DateTime + +@CompileStatic @TypeChecked +class GitInfo { + DateTime lastCommitDate + String branch + String tag + Integer countCommit +} diff --git a/buildSrc/src/main/groovy/versioning/GitVersioner.groovy b/buildSrc/src/main/groovy/versioning/GitVersioner.groovy new file mode 100644 index 0000000..ffe3986 --- /dev/null +++ b/buildSrc/src/main/groovy/versioning/GitVersioner.groovy @@ -0,0 +1,53 @@ +package versioning + +import groovy.transform.CompileStatic +import groovy.transform.TypeChecked +import org.eclipse.jgit.api.Git +import org.eclipse.jgit.lib.ObjectId +import org.eclipse.jgit.lib.Repository +import org.eclipse.jgit.revwalk.RevCommit +import org.eclipse.jgit.revwalk.RevWalk +import org.eclipse.jgit.storage.file.FileRepositoryBuilder +import org.joda.time.DateTime +import org.joda.time.DateTimeZone + +@CompileStatic @TypeChecked +class GitVersioner { + + static GitInfo versionForDir(String dir) { + versionForDir(new File(dir)) + } + static int getCountCommit(Repository repo) { + Iterable commits = Git.wrap(repo).log().call() + int count = 0; + commits.each { + count++; + } + + return count; + } + static GitInfo versionForDir(File dir) { + FileRepositoryBuilder builder = new FileRepositoryBuilder() + Repository repo = builder.setWorkTree(dir).findGitDir().build() + + ObjectId head = repo.resolve('HEAD') + if (!head) { + return null + } + + def commit = new RevWalk(repo).parseCommit(head) + def branch = repo.getBranch() + def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC) + + int commitCount = getCountCommit(repo); + + String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key + + return new GitInfo( + lastCommitDate: commitDate, + branch: branch, + tag: tag, + countCommit: commitCount + ) + } +} diff --git a/buildSrc/src/main/groovy/versioning/ReapiVersionInfo.groovy b/buildSrc/src/main/groovy/versioning/ReapiVersionInfo.groovy new file mode 100644 index 0000000..2b1a825 --- /dev/null +++ b/buildSrc/src/main/groovy/versioning/ReapiVersionInfo.groovy @@ -0,0 +1,41 @@ +package versioning + +import groovy.transform.CompileStatic +import groovy.transform.ToString +import groovy.transform.TypeChecked +import org.joda.time.DateTime + +@CompileStatic @TypeChecked +@ToString(includeNames = true) +class ReapiVersionInfo { + int majorVersion + int minorVersion + Integer maintenanceVersion + String specialVersion + Integer countCommit + DateTime lastCommitDate + + String format(String versionSeparator, String suffixSeparator, boolean includeSuffix) { + StringBuilder sb = new StringBuilder() + sb.append(majorVersion).append(versionSeparator).append(minorVersion) + if (maintenanceVersion != null) { + sb.append(versionSeparator).append(maintenanceVersion) + } + + if (specialVersion && includeSuffix) { + sb.append(suffixSeparator).append(specialVersion) + } + + return sb.toString() + } + String asVersion() { + if (specialVersion.length() > 0) { + sprintf("%d.%d.%d-%s", majorVersion, minorVersion, countCommit, specialVersion) + } + else + sprintf("%d.%d.%d", majorVersion, minorVersion, countCommit) + } + String asMavenVersion() { + format('.', '-', true) + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e74de4e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +majorVersion=0 +minorVersion=1 +specialVersion= diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..175c642d9d335ec83dba0b6fa44b04fc18d7768b GIT binary patch literal 52279 zcmaI7W0WRA)-GDMZR0K5wrzCTwr$(CZC96VcGcAu~J1Q|6A8f@r&pg8*zr?wBx_1KpkGKAP(Z4l}8G9rcUTCi!;xG@C5u7%|d5IPXk^9tFB*g#83RrO}WBJLFqqd8vkp70S& z`_#W4LKBG${=_m8_G#ltpYp9FH|%PyT~J56l->e2Y-8zc>tnqDWLMK+QG|rLM$u5h z(0N{p{*W2-_pgot5_Vz~?~29Pkx`K3!C4yw_;sl=+e1AHB)DKB@%fY!hRl<|35#Pv z5QfJN!MoDo`~HWPM|MJ2(f*>q;jfDS=O6!%mj9{2|D~3H%~8eE*~QdW(aHX=vRo`p zo&SzJJcV3cEKKcOER79a?4AChgi;k-dlVrgKMX+l*up`jL2c^Bs+a0LGM4s>iJ zG?QGFoUDMYA*gwsyNP|`L;X{g~|%74PFTFHiUD;py5f(4>bI zNo)`_EI6n&)fRhWTr3*9istGKKB`WKH3`Dl&$d8sxCu3WHg* z1jpHgiMB2EB8B^7{Fa0mp0`0UNXGpRvSZK6WK8hapa}0GJ^`-BV8f^Xkm>lBIu~%w zYz~l!o8Xh@yi>R@*5XHA*!BmUj=V3em=uGBT9kh{R-T;HZwV_mW^oc#O>1YZ)THEy z5Eb4krlax}&Z_fEy-Y{hngx9`A%Dl=r`knQ?V?qZ(a5&A6X%b}^HDl(@K- zhD)tSVbG*>8#)6sz_zXl{;(Po8%L!|!{`|u@)*CC8UEd(oL*@i`DKe;;ol+V`soXGmSA-PChBJ6)%+M+Q>m?<+gDmE|_(UaK z&_NNhGXz6-%2vkpdi}}f_NPDSzt0q`(ra7y@A^{uyT0iD`%ESNUxTIQZ0aOwZ)+-R zZ*T4D@Q+Eys^}=-2%&w8C;nJ{R;~fGwprHN~ZR$CgLs)|&FB7#;h35Bks?>5o0 z`K{4QW@WWF#{VS2#y6x)GalSM(K+MZ=X^3feJdc~2ckJx6{Ivh;Zd|ll_wQJ1!bTo zuKN~=B;G)@-x-tu)QjY$B(7{BHz)%w1DCAx@$w-=t-mo*XJ7iXC?r3Z=C+jY66SER z&dJ6))ljWH>nzvZHOaUgOJmw}9+NkNDdX*xXlSw2h?{5V4L)S$bkHBV_6p0-+F`a) z_L^8IkOyD{W6y;lk13JOzU8nE-MUlCE3N$4Y3 zmV?RL68>n19KVT(GdV?)lF=3&PgRBIt$qL#g zPpm_}>1PZ#UqN1>f{7IneIdc=3EU!sZxC7;YoR2fa3tyxZgBBZvqWK?mxCx60E!p# zrHlT$bSfPm6%8nKhJp~t%5SdaJETZwIR9|kmqEKLa$%=3HMf`lSde%JKQ>3efq*{# z(gT+N4pT7?V;fgzOE*(-OB+)mV`EciXE{SVLvz!ATK!aY83$BTyg#;C6qa4K#Dc_% zHb9{*ia`L3rJ%HRBMa>U_)>86_6hbMUE8tQax%U|{1>0DcW1f9%%pUhkfYcV5@W&K zhk^HlBiIaiSPTTiyY1O&efS9P1b5y=n;f+>+kuyNuJvv{yes?32qBFudjf-wTn zSb$AJvv5S|!l)C69FTBkHH^Tz2#fu&{4!8hOX4WG=UmBDu1~!bTwTaM$wQP+Q<=!i zXvFDPt#z^ztrHbf8DoQLvE1^DFx8;Z+t{nJ#Ja1Agrub_X0yBUSZ!8tR9u9fTCKv& z2-6e^(KT3CD0 z8slUZnO273%K*CQdD~d0qd(sEJlTwwGV+Oa+_Gn|;*pc>%*4r-JCh*b&BM@#6rY0* z0}W#$WGf%{nOI;ABj!^;W|sdT5re=BjZoxZyR_5U3^1p?ro=x5200&nN1wr5Z{IBW4IA|?d4l5xv_M!=R4n(5!c0^ zYJ(d}rbdc#XJ$ftTFa_B`9yEtt9W5LGHu!MoU(yNL%dMVl9sh3EHn&;+sxuvn)O;O z%%#k$^;@pqp-nM>2WEmndF<{6l^|XLX>5j{NezzoCiqlVUh1tTXa-XNqnPVPjk%a{ zEX)u9{dmUDXulq^L(?7-!zF34^u5MWQ{CZeKi#Bz9KH0!pDKPm#D{XSP5L+QH&i%A zKBrB@h0ND+&ck?7PLzuaq&GQYHZ07duZ~r{*TQ~d z@$RNQ;jdqBf}`Q%pZAF|@rmYn=~SU1WuIA&2tx;XNs1WgZ1t0sFVJF73YJzy@X_IO z3W;{6DbvpjVaEjA`FHjvktZ~YT+3Y%D6pXjkQhqq5xbs-))opgzNr1y^EZq?(lhom4HDEf(55^wlgpeZ6 zFT%(xHcEq&vtCH#E1zd(jd8!3LF`9aB2GDEOg-Xyrv&^Vqta8ph*W>tMsB0)hbqP3o7z5X zIdiYD>iN5&=!S8)hMF*dS67_0S<%IUQc7Ku_r~Y2Zno}1m!vVTY;9s!Y?er1Q!^2r zcksRt{yTXwt`F=o_)A`pApWo9MdKg7lZd^YnWed_lc9^Hz1=^_OVXy@k|0u;c`~Ow zKF4e!9o?y5VVuqdL z+(_8D>DgIO`peI61(en+5LI9rgb?p!C&xb1${`K_y6-9=jP`vAcRJoZ4> zZS#4{B3w|r9v^x9>YcA=EvwGFAKUM0eSoKW$(-eP-HJdHNP1qf2?e*S2uN!gA!iw? zW^bRZA41K*PlV~i_1pIy$Te&Tj1fWFna1L;N)Fl!wr~8_1P1E!CAO5-!PY2!Tf;3o zFZ@(R)t-t!Iy6@Jw^6sq=IAxP0(vzl@&pIjCA2xbEnkN7t@+(9(KJPBw#xMAlZpfI zy%yIu9JrL>*W#B)#{-vPFpr8vi~>7sU(1CsIB2Q>WtAcdMC!oSKfhTykBv|vb6L7^ zh0y=Vfd4UoR&K!-r{d1=q`My(PS2PFEgZMNymN{14EoNx2aQmYk0r8AVIfV>%rR~J z9Xo-!K)+8UXb3?HPH%W=8l!#(j5mv8=!VUA14mCOBK!0t&)g?+bLrVkE2Ec-By)N| zlMz3{qnTT@GWr4Kgb9F|+7XpYb=8cjPC{UvY_0=Ktb-L?s)qK*Hrr&#ZK_yNS~?U8#PTB|0Nn`s7ua1In;#1hP?$H zJ^xMoYY;AONQ0j%cnIs~?6~_Mz_U9?;Y{>~nb%G4sq5T(uJhd0?w{Z9m;qmJT0`_P z6&@lYsN$?S!xd2+Y;WX`DG=z!4~+EgsMHi{IqLUmVd^npj^cIDQnS)d^1*SHM6=c& zxJ!#y!mv97BN)1a-AO%^3_O&jx7Lh|q*BU5v>~c_)8SFwjT!D@FD=H8ds!s@iwyv`0~q%55FHw|1{P+wUma${vOMfYW}-daF0>tH6zq0K z7MQHHA(v33)kLbLJXXgrc2c5jp@FRoQxcTnm`Nn3S#4rkkLZm6=lc@uA?XndGi|D< z<(hqpr9myXo9(NJ6wSS_Jjqc5&Pri*O}p0giOeaIbLAbAz5)Z8&|oDE&M<44&F9Wz z7t>`ERr8vH(wfHc5L09;=r;o-EEA5|Nm zB*(@&3J*~6^MkZ}!scA@eqvJhEjy|>^$o63_buGh^)21=`6)WejK#l63AtP&W(F?5 z^n>)G$RJ=gZ=K`OV`}DX)FpsQP}Cc2MpZnp$-w(F8=sc4V8@AV_euITyR0=%N{(4S zO)muz(;_boi|6>sm4;Lo z(xMzo3!_twNR3xRej3b*OHiz1naWj+*67ZcU~v4mULX1Lt$sV0|13E> z;dX*Agfgu_fuS&U<8qT7tuc|F9erW-6)8Kv#nvAf1YXG_v zHu3lt_C5NH*67oK2n|qliSQBv(npeqt14oJ%yU!JOIh+FU7M@w6XU=#yZia7H0R5T zn&^9G4)W!(pd-ThH+-N-B9tM_bB<8ffr^VXN^ub$u|+TaiX2A(vN-pQeW|VZrwkrNj}2VJTW6NM51d0seqvhrm2h_zhizbMQd-;B{50N7}zW6;^Z6E4SNN zFEQTPeQ*>059Gg_%u-LrF7>~=JJ4UhkMO^nOj&#LfBAQz$)EO%ifCi~>0{LOOrs96 z8K}81Vj5xgOcY@z(8z?)W)z>bDcN;0mW61sf1>NS53)14(zF3EZrpPzt6M{Sm<M4-=v*y>K)Ls`&w0 zpkbp%KA)EW+q&gK2~>OMd4VZ|q2F zmW>qXw&bH9?2jzzM^ep7^tyz?_J1p@R&v}Adl`@;)77pOmF-& z`*{{4nC@<_sS~OJtw$=k9X#c?j+ckHC%jp@Lz34fp}j2QLD!SM2)Ag(9lFQ{D8XKo z3FSub-MTw?`2+m#keqe8j6#P50@Wv9eoPNYXw2}{17{k~?X#Mb=n$mX`oIYmu zF4B26laI`a{n%YDRv+%z>z(g_BV`!j@SO;kCuLMO3_^@%w6^28gYKp#pfk*rTG6?z zax++L#?eJ$AW?!&c zev9nbimbajO_~e%Ck4e=J|02N4tHz4f%SV4|KZt-skIiX4@+38?;zlU71?u(5&pF( zXjJvJCTPAOwS40nd1!e|dJ49Sua*wY^`2qRoNY6~wE^2H9j@pGuklKF)jhS>)S8B- zD>rw3tJF`tRaP!L4xz-Y3&Z{swyT?k@UhaXE$`l3+ab)Az zjSlWQv+P`N!-HFg08qp_ zEVNY**T8&EB@#d$a~>Gn_-JxfA=GnqUAkYyWA42IOot^I&jw9?a$UkDWOrrfW=>zD zG?h4y(%U6^sAP|7Xu5$r;@}&E_FTE&|k^Pe7w%Iw*~J z@)C^1tHK?QQRfY@p*wqMkEmcBitX5GjVRnjMS;^kNUs%P0kB7U?5f`?&wj%Rn2R@2 z`w>^ezLiGlM?P8i6zxrSn|G|g$)WYDF$I=ubtTKckjbp+iZS&$i0Hc%zvV{l9wPR< z6^q1+-%FtT59X`Y9IB!F59p(}cu1t3)AJahIh9pof<0RoIRMwg9yA37yJi#=)OPV` zG5;{u+I=zqEKs99NiI94NSE9yF|143DpAPgZ~S2>4%iynRoxm3i|UsVzlrWX*?_1# zfbWrV0?UoZY#ugSOXs)(5LCQ{qn&|#OWDD&%#us>mh6+soWPd3MjIsAryGHn@9fKw zcd5G5u_3OubO6UY&{cM!)vM**S>PjUnCS`K@^tM1_m}+WTvc@-?zZZ(#}{e-1~(dd zV1j@p6!G8g>uDZadu-_4tlm^<4o=Djkgm~Xhp5~IawqEHR~|cj@!!w?u{85LobZf4 zAu;Cd^%i%(4r4lJ_7j0C?J6Y~m!|QYDeZK)xCju%nSk6Osm$qj2BcQQvj4a>t+)Zce1$MQlPirYwKDuKTRDV^o zly!J9<%dFP6OHDu<_63hefWEad(ysJyyf7_1FnWz1Ag4W*KV^bUBFF!lIf;#!Ra@V zM!bVMXZR92px&#B@Br%+&V^|Bw%Jd*sy+l5&ItolBruS&f~w1rDPguJF03lmHw2u_ z@|g3bV5!+q6mt zmwfnzr&E#|d<14D2C9bQCCp`Jqsc_yR%#nn6oPmGR zJ>{91Q>2iD=J1CX>kAF}lFy#iXM|rxclk_cJZ`&E$oG5>SkH5j>+*jcy^|tZCGg9X z@k`XNX$E`d5XD`D;%^9ZhxjN0Z}a%$-#%)Ng{QXqpiTbyk2G&#JD(ONA`p-*F%S^Z zf8SW8?3`T;ZEXG#yvfyq_CZ_o{KJ3ERJ}rEAS4;hg^?iGK5Pq%t%GTXDrFGz6BdGZ zF|K5wI`{dihTM?S4FzS>@qmn#&tZeY^>C5G4i|+qb3Eh8Y3WHedB<*PHFC2|&cF9I z?00|W_KLJN+(Uf+j`!ovYu~5G?nCRX|2rGW#w=zKS~-Wwn=|&eaF~6n(VGnRw>1AB zZb?Hgl|p;(i2nCfqSQtAqboY>Zwg6&8Gp=@+r?eTbLbC9?7s4O0SGG5KV$`eYUcY> z7Wx}`P(1n%RhmAFGx)9_H=@$R65>Z7tC7Ec- zr!;68nNpYP(lxH(8Nsa_NeWrI*_J{qgBBiddR65tzSTte%R>?9fu7Fw(4kPqju!QN zJb9DF(c%wa(n5DQ#LIJ+{Iq4f9qlN?v(9tyg2#4TsiB=Ym#!DvBQI|$yBW7_CJOs> z?6u6aR~)Hc0T%ue9SJtPDDY`RI!D=Nxc6B*uWKgKnU*?$X`>to@J;YgTHP%NESgIMDEu!60ti%AG6G2>}Hpyso(FdFfnAYT@aq z;?jME!X4pxN!FI3-5Kh!7jDE&q-D_CZL6~q&72k(l`Tz*blYBD>&(h^5j!1*LM`Yw z@Hv#)Uck{j)+gPAs??_liQo;_kCoTy<1!s2pw1@1?XJ;Oo)UQHy;-JeLm`xyPPcMr zQg{w2mBT-aTz+E7S-FiaV$v8Be~?V8mAZDDD-+JHlgt@z<8UlmE^y@-5Vsi%qd=;? zf6Y#hN7$X;lXhXa7qi=r&A?qLD+zuCSjJknT?2WbMlkP5!4n&!VO=(uO8<5@iwTL2 zRAGEK0^(YDJR1;xQruB^IiA_yil7i$oGh{7(}O~B@qH=aLg1a+il=w>(Ul=#tLiY+ z_9Y5o1v|z$KNLsFL{;{-x|A0bWZABtm|5(|n2w;6}=9^x4NwY4-S_#fj;;rkb9RT}5TV1o-QOD--7B z75#Mbx&4UOnDUhA+9S(<+)?;vp6JN~nP|Vz%!040wKa{3{lZiB)QXHeA$f8wvrW3; z7+&SIaFs{dTq1Q=_aiuWxJ5XTl|FaTAV}U&>*H#NU1ow)hZ}TVS?L}(le=fT?oPXj z2%48S!b%?bBXK(9bPQWfH$k=8eipcFY4lT%w1$OtX@0rB;<@pYV=6&eh%`j5+PS5d zc&S7OE^GQzNTLiMb!LjPWsagcVucSOp(-c!W4Edw$7|KrSg(i7mTrnw2R3w-Un=6g z;hi2JYw)$&Cxky~-4YweLL{=D!LZ!2-I3-gzH@(xC1wikC2>ot@fcAFU) zskRf0K^nhJb`o$FDPJ;`&)I#1t+;ps4CzM+yA5R-$>yVj$_yaW`3Vs|ccg6+)JGMI zQ1u;)(45;XT=x!b321e$t91fAQj} zsPzCbX{K6F!v~V``3&_UFY@+s02nVXyIql$$IH!5ZPTbokg4V|=MXC?b$rxbD(vks zlQ@J6?&49DJsF#ZFDYr+3Wkzr41DSw2$R6H2n?kvfw>ETbrhxnE1DQ{sdt%ElH5K6 z`4H)&ODe-WwNA|7Rjt$-*+|ei-uiFh>Lxk^+?~Ev<`wtMOwldJh9^2vu^Zl;`BqlE z;h1q$9bV#KsEjBq(nKm2)J(xOQvL+s7``%zrf*iP&`&C}F0RO?8VB)X2~XjDsnqhf zoXPn6L(V*h=#I(T{nx7BU;>p7pToe^QEBu5N##K{zy3i&#rGc08OV1Lu2zPsW@-U) z3@>fQIvtBlkw+K@HN!Uyf=H!2WL#g(QvD)*^*60lfx&GUf7RpDH)Cr59DzW_e$TR> zIuz}s#1K>0njfHi=5}Lc;9 zJ4*T}+CM8F>!w(EG`@lZrrH4u?z;0Qmx3u5YfW<_aYeWMW9JD};Vc+>32ri&07Lr1A|s_Nij=xyjLqE9l;p>S&#pEsK_iIX4}!8>on? z(q>YjQHBd?-@6X~lL*Ln>w^-Oio_lC2&-z+ZU99(FdJt{hPG8Uc;;be0tG zZ-E^UOBWkOPIZ-Z4~p)>z!YtG=P;S;nv*+#oBnV{wpSC*cZ)MD18Z-E&pZvez_jq?M zS>3N?9%{tsib6E|Kxt~aR4jEMmrOasm5KA-9#=P&_xtcDI4H<~B{8`<6aM7Z?g{41 zvU|@!A7QALaN&e9idh0GSU!#l6SGAnm(Tr|>UPm=fxqlDpp92Cs?7av)s&uqc9_aa zKV@ZZrOpn=ksUglO870!1u(fi`BBi%maZ+o4iUTi142$^dn(ASsZ>XM+#b#PTDq|4 zJ^9FG7jCLZ+6w^pl$BhRJYx2J&{IggfVVVi(QJUcA<2W`vSmny_`RC2FI#Y@zc3)!Q)7rV^>w9RcB(;hXO~ruW}^p7qwT$+GR(IbEovp)*U%EugSQG!MjgH~t=qt{nKx4(S1}nBJ>EaQDlz@&mu` zmzFQqj#5xIR=j-@ZaJ}-$29&O`=THX&gRC1q zzw^=dp-I-ibhn6&{ue#%)Rw7&|I($ZhUD*`!Us-RU5L?B3B5sjCHbZD=HDo;<|4YeU1y?ISV5x{Kwo4n-?Zxa;vIdG3P792XQYJX3E^^EIlID`;K9f#MeGZ_wSo28Ue;LCEb;CTE<%ApR zu_FIh|oQms`J}M{RSbYapOd{%FlnFPM)P3#Fa}|A93pio`jV_K+Wj*Wq zY>ZZ=N@ATHa~x-uL;NYz&m_at@fNw>(~Ql{C4$)YemSJ~iyQrAZr;-Il_lLG^YYDn zaPnD(gP%&2Fli>B83wXWKTNb-k%`v9T!@Bw%72>wIO7!C+^y9WNGfsb&%>NjAsj0B{wK>R#=9D)x^*b@56I&VGP~C3!6K4ma@>wWEtBFyo)b%!!5P% z%47%DlTR-ox;yh3q^YlC8>Zuf%?myYanQC-L}$k*^=z1HCmo^_j+* z2L9jM8c_h*pV%kvFK$g*i5~xziE>X24X`tgGixn|8{inoX64<0$*SoU)&5|IS`o&B zpm}>UXzC{&tz5vcHI;IM05O5N${$f!+>rj&PCC^jbi_lRQ0|#LN3QY6xBXCjML@ zifLlRaW_Qj>bny3kNNmk61WT!!LC@DxclDE1;qbws<(g2Mh^eYIj8=up8vnpb_(0u zyEwc2t&xy3w6s%kF?4eI{}RqxI-BZ9e1lEkRVY7gn7|xB(6UG5RitqXSfN83u#ybY zxJ#lN7{o=>Driy9(&#NeaX&WF``8)6>V4#PKN&uj{TJNoOoBNcRuKP^BOd43>0aZn z_c?n8;GRH2(>F&AaRxK89tJ~oahem8t)ZTnzrjUAsW3<;>?zItp)W7qy`=DG%~Ygx zMzUgLYm`+}8v~U=$Y)6hj`+8Rk?^tSH^otjH_buHXT^6X9dXPg6lD+}m8`;FOCY?3 zcVR$|qq0oEu}m`tG@aAz&8y3{xn$oNnX1q5D~oS^L}=GP=xB)WSZZBZZ7ZpA#qzZ; zzWJMr+~t;LH(IpR*+}iG(`IUvx$=q~cB7m2Oc@Hp7XtIP27;{^Aa9vsYs)jn2L=h*6pRc$ch4985*#q_ z=e^}DHV2eO=%{t(S&iC71)%G-jY%;@)2i4Iqoy@F-c(DnHlp2LmWeMgxk0P)-4I1U zt-x8I^b1in8e8?&p%D^|^oK(fM^I8%-LCv4bAah^K@S2{cj$T zdZ@L6rLMbgNa2;4@+gBq?MCvgI!CkW3)wfd*uzONZmW$fM+5#s9-nH~81LPwK{U~Q ztHgl5D0b!Gl4Pi^Jl#25LxApz3>isp(F25T-gh&_wklOI3-(G`xFEr%Rp|>d@)i>v za}|*$X*?TLo><+v59r$2pH;-~N5MV1*wM?D=tbK3D}3&-yC4kLv*LwQD4uzR;sYE5 zp!y}*cvRx1gYZ8TJdr0eg^9+?wK;>yNdDm&cQGgXGeejHfhiJSOgI$7sN=v)@oOMO z`V)tXAsl42fD$)!l0IH1CV=!E*&TN%DLqX zgTdT`#yuP}FaAbOxz}WmcFAkQ`2*?>`LrYPcC@6^azyWfcHIuP-Vy&jc{d_54r5=~By5jN)g0Z_m^O{Od|lEN0e zAZ2=*^2*_D=UQFsm?pWLxy)yhIu@FAwo;h$;P~fu7Lo8Bf-;-)i@mS(+urkX@4oKl z=Owy}cj3F;uR9$6yB-RDR}+u~AP#jXFo&y*dguey#T5hAgB^5H+ITU-1JGck62jybj%+=u4{MuM0FAH0}7;!MK0J!51a-XIB*H&L+sm_3yyU)C6j;&p&Ye%d<= zGv1GYu{*8AhfYR*LNSIuBI!P?k@P!LrfV7{A9VfbgUdH@uwB)Lo^l2@?!~oM(-wOR zhq1K8Z~P%rk)dAFVq+MiukMy@ZFBW0IhQh=PpbNiJhu^$6bFu*^u zm3#T2W!hiiZzW?9VxQFWRh!`Lae8?(YA?vL+NXQ$eue2NHVn7cTj2hh-CyLltzl5H zWp83_+9_q7me-2L^k$`z2oH;L>$6A~<*KurJbl&`$90D~EuYzvHx?eq@>|L}%V}tl zRlnUbwj^ufZtrw%7g1?p-DGq&v0As(X0=GqYx9PSF1EZ@aS*dEMIWG6C@FWZ&!bny zQVZ#tfy38Xwm*6rI9Tqmi-qY1n~}BtRhwlxzOjk6&TEZETkM+mbDuir#GcV9tXFA( zJg`lj)E5u2jam^ zoV{qH(=IK~C25nlSr*hKtEK6?y39P(Cu++@#R}dYk!W0czM(3G>iOX`t>o_Qi?wUE zOzE;24>_ekM~!SpIOMZgFHzL-iEQ?XlGc1TmALr8`;9-k`sz-S$sAY3s}cvj#hZO( zYVeT9Qnu%~Mp%Z|*eR3cx}z`seP=+FVG0K)Jq=?NQS~>H07|HUS!J%tWc7MnwQ7t} zbX4tn*}*R?6~p3+!JqW#0s{(_w1+fJ^tA=mZ`cGH_fA_C2d71KK}MR*lxn|)0e)2B z7p>y_Vi~UK&l*m5mrrya|PJw?burF#xuen@fCa<#j0=*Q6Z)){7o zVU|)1f;DGVu_}zYv$PivnbyV?@4QkvN4oS%UMii(dK9U8Sk(V$+He`Xz` z1v)a>!JqA`^i?bR*fHDH`O!kE3NM^e4@}Fg;Z;`@p-Ad5h)w-yYrApDuiZ#*nZ;qh zL%k0Y(S4$aBN?(5q^7o1yrNc=WU2WoWyI)HyyN04bFN=L7jdh8Guu%omTyfH>(VA`BiQwXQeLIQ(bhn=ozYy zT>3exJ#aIioj3ZBw?p*x=fFX85(%EyP#Nkt{!WJ-%Ajbx<~7U36Zi$W!DI;2bsD6{ z-BNA91FVbxR#)vrXnt3I2=e{2ZpaDFAfcML&MM)^YrS1>^f|Tf`CK>tZFNSs+~-m) zV#0LlHe;)OcA91_(-YNMPcnCIzYwf(hNfWM#*WGPp1{}9FazCQyO0DRwoZruve6x=t4Q(z=7x| z@-T|6#C(Dzfsiq7Y#09L=Ekjv%7GrioWTTZ8h3u9DYKmMJDj@gp{jfRuWg<4tK5^D z+?$(`++LQgUbUN@%-Nj_5eq#`CtiWg=N>s;eS$2ZsiD{TgXW{up@rv8*z$4zA4r2% zw1b`&!|!l+;GFQ7Nhc&^4QcwA#fXk-`z69eZUBn~WT!ejE2 zBp4Y#OM=(85!|94$s?5yeW0Tr-)1S#uuZg>V$Kgc{yad>Rn!dgg7u{u^QyFoE=V7R0{j zjrLC=5_1Eblelz5iZ2#K2PsBdE73yG!BADz#%Qa|eT-uqP*2UOP(cq7mT6>KyB8+} zEU{x*-4RQtGh5UBeSAD^k9cQMCL?q-d{^Kr_h8+Joz(_fJp#ve&+pe@{MjB``A;@b z9$_P^qNUQrWmqCxyEp1JF{Rt+%r^us^Qx}AnHsm^M?9n|flBdCCh12Xzv9xcsPry| z$-~n3xgW$WU!K9pRY3#~=JH|lKreF_!3HDQL*+_0LN9&LG3cq_4k0L)+2s8l!J$V{ z3@j~}FdW7V9spL!;hS7-gz}7#-jjpd4m&^Zw#Io5DcXv4<^wbsOWM;OVvD3<6rRy0 z*W`XDu|_sR!*j3hDnFR5ccW+JmaXewvW+w*sL<`yDjpx$@?&Pp;AHc~!qlRCXz+vo zI}r`RDXDJyOGJgSfPkp~I}!cInah9D(f{$y|C#pIg!DigL;r@9-&nFzmf&xg^<`%*iKzfR@8a`72893XM|U z-RpMdyqD+Q+})LXn@(824{_$Y$MdV#^A=u#|M9LEXf-;Px^15x9rup8vqzV{Uhz&E z9UMhBK!b|&aIE^vBX+CzuaR?TCwzUo_X4+9RHA5{yc75IsE^{=Qk2?0q4|=WE3`MNa3~PoVP*fuA+zLmeeoG)k ztg09ZS1Vy6?x#3@NYEvCF`kT%ueduz?(|n3;6f)HF{UOM8&mbc%U8UY;w{`$f#I(; zV#!mz$M#u`pOea(`@9DS*H6jUPYPF<7-EnSS9rfipE#@b^N|}^E2VRvIL7tcqWAAV zA8S|j!QEB5`ytRr8QEWd0Qpv^>sN9x_7)kHe_#&dS677Ck5sYYSBedyqCKNdLD z?bXGD@OpK5dG(71>5RK9e}0IGk00fx6=mUV93wD^oh7g3se`RxOgT&t5Z}{VT;JMU zUCcLBJ}CBUclXyqdLVr^_zWra7EY{0tt|-bdlXWIh<^R-%uL)J--QT;%2 z*YF3qw$jT;dTVS5dleza@Bm&TZ4{# ziL7sp+&XiTv^aJwW1~-R4XkeYu_EGP$Si(AF=PX#onXD?$!Sb&45ZZ2LYu7Eo`91M zbkpCwq8mklfx1V{~7t;)Vxr#C2;jCM*=Rs{XZ;tyXo~B~|^({C|;6MT9yJr6{ zXG^v^5x!nbF5dp=2?0pXo3L zp}Mbk>a|wVF}TWw;4*+EA)$VAXblNC(5G8N-A#iA%=#Is1I*qfxl(Ugm#WSX>)W!aR;tADm~U(tT> zr!an1aiZlhH$^DJ5f-Og84*|cwyT_76=i1JHPFt%PrzBX&?xK?%Zx0Nl$kFVztmDx zVoq{Yjca@gg)g6JQUsN=jm&QqYQ08glVee4HJ@Z6F|s%U)1)E;XJwp*h6%UD*+spt zcdRX-L(gDt`IJqJOMX-wT3!RLE;SlKUA9O9*g$$S(WA*(vRKjLnm|tCZ zdsOS(eH4(|f7Xp8AWnNN_2e8Y(zRU9{`7unx*-t9JVu}n)#s!%Y0zK>An++#sQc>% z8n0_C5J&VjkEw<(#qrJec8AfQ9^CivPD8*G(7E(nGf*hWA&8^T%)ly!zj&EhwC3;G zxv~^dwPesQH$I*_n=Ye_dCFy!$dF8i%(~sfl&mpn@(QYCf8zkNOSv3rN?O&nMXH6p zEWgjz=J)%W601*QoriFGpmY)4#f&F7(UHNLe7li8?sk&;UOn$I1|zAUpH;=l%E?RL zVKe4m6dc>8nl2FKB3&KuyKbpl`IG*)zF_yM9}1lIoLhBy-Fc@*o@TanAa1LOy z`8M=XRO?4g9qPO4*cYG3bkqrt#wI7kXIO%FqGJiBx#wM<9Rh+c`K%iX6&@vS>=b?w z4ejHL0^5y4+0>X5<8X}z6HcMDegONrs010(A1t{?sDnjyj(-QSyu%i~v|v6!j-p31 z7@|r=YUU*?+$glj0P~8o2-S+FP+TkyO%sZtP?Ss+v!sh8%10jYx=cB;4d5= zZ+g4Bvf*>(Fi1K{Qif5U3lY}GB|A+M{=ODu$fAly=ni96dr4S>;5x1l+FL9gyX!b! z0+JnNUf+Z}Zf=NISxZnD zvo_b4HFNN;p}iP49qIkKB9}^{h4!GoQwl?B z^ps36EXRn;)Zi>7A$ZP`@!OSU@iaPac}|`qk-8lrNI^F_HF~i_I1cgk0t1L*F|^By1Lo=?eDARo{ahw@9X-3a5j!| zCo7zcvL>r}KdPVELnlRJ(0WesEIOdNi|gKq)#OZ$W!K2IxH{_#yiu2^o~zuNS*y@` zZma3)3cGq&*3H2zfd)g6P?w_QuUR}Ha>X@X0f^?knv;ou=+nghTG9t}BT>!i%9m&eMQOB)zo z5#7Q4Ey}D zqt~GCcA)2*W|RE4=cPxfda8>xud*`Rx0AKGP%zzI4z@ZxRZdPJcg%P zhNng9ha@X#a=Ai5&IJ3J1C?`UFpp6{VJDMT_59>a_{lB>?|FU`h7qBQ# zgWQcayGOZX2Xiaa?XyGvsm8_XVu zb-%V8dT*H#@A%7({G|r}i*G*y3NQPzz@;J|7IIVGc6xqY1AKOU?#Fk(Z-X~tXr2~f zyk$MG{4`m-7Df8X$8{Eh8^Pzf{*@8o=74EF-t!hJA%W$T3N>sJB&8A&5b0HPcYwus zU;x+LelqNoYZz}3PK;G+c*mj~K5m#s44orA6=P(c;OVp&qsqsBIeds$hpX7Qf=y`T zyBJcz=eZeT0scN5ZBUYl?KrXQfTUKP{2=zQ`p^5jUZLvy>*ijaFT|@0Z2#Vy+ zJ+%x>R+ACEVal$#vDMJ^R*NAm;2a%{`pgIW{9xlNRFc_iC8O}83ff0)ZskL*T*^z4 z<#e*_7mm1Q(LrdiTPEeTmFKnwb0;17E0v-65^9_&*~q(fn<3^iAr@wQ5iTrw-`!YN ziO5RwrLo{yaBlg$G6{snVAtsyePPTH+3S&a(-$8yttYt>FwJ^HGpb~MpFm?b+;k&j zn)XJonfA^d!JqU+b%4wKLX9??_RQJ1-qVjxuR-OmGgrL!y6KNq)=RzpBJi+BicNTk zid}HPid}FBi`bufi{AgZmmKS`KHm|!&}6OYwqj1XOqVLL#3O#yKm3$hU~t%)F4Y)2 zrDvBz_WUJ-|5;gI zqexKJK^De_29aok9S>d5N|3RKTs~>AMmhPG%gWS1S<3lpGQwO~Xp0+>)j72;pk_TJ z6^k54J;jxlW1$Z#>)ub(6j!y&dAu`Vxr)e!Tk7`WGURbs}IFD0(`!fgK0cB7`V zj#VbkUPUDXqegNU?Z^$T%j_zV*Ttgog@e-YoZlf?{MUr<-d>bJENkcEAJ|MK zyqV8>X2m}xYAG+_*=!`CWvpu9R^vp$*J4Y^uy7)1wTR;tk}7j<1orMI zssRPHTafI*ZwRh$$rxUAKPdz3jq`fGJPq#6Q%MiIfbE2=G0khgEK<>CM3pjs;`nhP zuceI*Dc4rY4hu$`jUdgqg2zxO37lxXG7gdI2On+fu}2@aynf^R`JFa(EZP5&JE%;1 z^v;ZoB0Y7?c~RyNLDFEbcfn1q8_78ruu&k&8dS}IQio)jOjG(xi~1~SYoVTG)5NflX%*cFMg3+C{FG#y3i&g zR-D%MNmiqahB!e@+TLw!u!f89KLFSt3>TBJK240Iza$XJ!ETZ?=vlr8{Np&DHIa2< z>lY9Z4KNT8uK!s``ESSZ$mASMjBLfMfQ|<%W4Hf{f=E-*mBj^etme!CE3P$8ZS9-7 ztzMBfzcvqaWrb0|iCe=k2z{yKl8F_%H{es`V?JdDm2Qdz2ME>qSi=`9k$l&)T;3R5 z)~CN?27vUA)^N`l)tZ6)^3dMHi50X!katy!dZd)5_o6 znXp#^KPyhw)d)WQW>jo|)sJgg`~c*a+Z{t9pII^MF)u>3>br!{zVnA$=^vA}_lbL} z&Fy4#Y-%)u@ILZY-=QH)fMBPvv7O1FvNfP(mv zdwRi(*XheBsY|N#fUEG}9V+r*4*nGT3ju>JB1?H@*=!k+j#xN~*38_54&x;xE;ikS zw8XxZz{so?{a)U8UhI@A_Ydilt+MXWp0}Z#l&3G{dLOhv7udyK6u;&M{qyBW9_Bkr zH|T$t)RIkPaIv94KxBbuNPtI3{{Jw6|5DPzG@}C0EU^8}TY6Y|;kYqSw5Srx;cc%- zV3J#x$r9bS*aqpK^_85Oc{k_)Gqx7y&}w#l)xYiA2-Hgr&~+2i+ij^94%F57bm}y8 z-!b1Ymrrv57swhjj4$y|Z##!R1*blz(`f+(0T2W3@2X}dVU1wiKeichbj=Q_9MzAU zW;|&8 zThw?Px{HpwT%#WB;r+AcsQq4EhfI5ls-ATEBB#&gBYf4jgIm%P4+X_-df{kkEq?2) z_?nz6AZ860o`@*+Y8>IR#8S5<)Noa%0$yi>%YNf$P-|U9^VmRf-RYT= z;kGVb^1_Ih2G@+%Noc>J6jTD?O2SVtZGar&h(51Lc^AE2o84F=zPqcF&Dcz*4_T~O z!{MQh%bHBLIoY#h9U6c$&O*+FnpTrtpk%+KOei z!$sF)n{{HuW?c4TbQ|`yD`|ySy!mX-#y^s7QK4t2?M=#U*30wF_`G;~hHkjnaqr`e z5G&$P&Su_i{p}S3fAR7SCC?2dVj(~z|(pSSH?&mQTd2O8gN=cGT;M9Zi zXgKz;9CUpHje?9UeOejJ7F~tZLgKL+Y{caeU)*S2ZyuXiwU=Z%_5$OD<$8=0e8(X_ zPB?S1ks6zaNp4i02S6`CK}i&x@vs8NKiq=+q6?wU{?Dg}W~Z;h7&iR;Ap|y~HCIe< zIC<_8QyerlqZL;I?9r*Sf+U|%oEkgFNNKjnitNy!_>W$?Lv;9z8y9%$o3m;z$%2UB z*l(84*h6%-(2nPtW-eUKn^X9uGWX1~Edc)VqYpI9% zwJGXDC!8@hG2JTqWSYK-iLzIH8!KRchj5s9t^q1#^6&xUzi|E#qg)Mc2h@UhYh1LunShI1uu~7Xo?n6GbVs}M7my_Y(RW<>Ec_nLRJ5E~{kq)0K zQyLm*)6}j;tzoSv`>?5l8@1Y?owgwJ+B+#%tWB+h!cps}th%sy-q4uI%&9u|;e~Mr z!?1O}r}BxrIsvY(E(!gsnng{QV{I9^1!KzqA5jc3!FAM{%Ehq1vy~^S0|IpVep5y_ zb@BZ?7PUri?)<#3;KwR-iHzJQH*<*wzXXiopVQNPI3(2+28SvQg1oiMPN~`~Hft&V zi%SebH;I;Zf^9g9A9I~YIWw&z#w3A|{q|If=Jey0ecA?zvBq=Fn63my9(kmA1mCo= z&H=336HkZk{eYb)5Dr65NN$3Io`ncq?(cQh{a=l4{r0)&1egs3&wqcp+KBP99p`fC zTATOxdqOF_%5S-Gd&(CV_1M*ZriRJAtpyCag9Y1iIz5?(HbTT%j^jwQBH(wX&;rDH zBlj7u>$-RD8NEo6gXVFguyD9e#_Q1ru}+QGHXU#9j;1YpLCA^eiCqz_M}0^=zU28j zJCvjens7;w^eZISl?aN9jFFv4FT}?$!hg2>H#fw&fBM1HjLG&hzmgP zd9H~d`B$!d19ys#7;635w3@|GHmo!1LMJBAFY-~amI@0t()_tCEDos15y$Ehe7GDCUV(2Er*9Uimn} z9jFYKAZ!&vJLrl&RB|?PytQ`A+N*4w4n@vxRV^?5k^67tA+~)NP;q*e`y&?@aA*qe z9|H0pH99aF=}|i2$Wf?>Ha)Nbeh{vCWAY(7A8y*UlC829p35K#cVQrZ^dDZ0NeGE> zM*`#oSXcu+jL_YUN!^oBuPJ1Dx>zQDAayz7ChZP~?!<$86{Vm)CBY+fJriv_L#e({ z8F5LQ^NHK@iLw=tgD@%`@|iWLxQ8{bQTc>4cR+`O&`T!N++dkICceie&p$0D$T415 z6o`U*=Jp`6Mk5_Z+z3pmf6>4`sWHoJNH=`krxy^7Pej1?geEkt_0PYQpCOs-&j$D1 zOVy&2Dr{WKlKS-Q%u(y7+#Yr(*`9V^AiP4=C)#H0HuMy7b$(7aKQ^;fWK*gk&cAsY zK@E~3%7>B&z754oI)pCc%(p~%Y$CQhIK7EKovOON!JAvS?UNG*rRUr6CUApA>`EKI zI3yN}E{_gML%`cR$5S0t~u6GD06|9ThqxuAGWf!ZI$lMXY$gj;X zAjIh9k`tkqiAh+v2FXT$-4q^J`TR#*;g2`apbU&B6oJ=Yh~8Mngn$?(?T3FayS=cok-Qf|G znOKA_ zU6_C8GQ$i}Zce*_r!wy68!cd{73Af5)+r7>U)DhVst`Ytd=OHVxdxVW_8lvl-Q^Wl zY2s>4JnGWSxjhSB#&1uQ*e$Jc=-dB|_x}0{z!(2N@NHno_xE_u#MbJ+k+T1~J#pe8 zoezkTQ3ax8nE(BDVdK9%&?c^;4t91x=$4$7y%`V~=MJPu|Cbv&O-&z&j7H-JgN>nW zkF=}XT|hi8aorNg5|M)XVJT9Lyf`v$hP`HIm;onR5-_w|%*gg*gm5o`Wk)+vDZTZ< z=yZqM=eo<~WCtJ^5by`mF_IJv`r>Sz9ceKB3;ulClZY2Lz85|OzIeFj=x;r3v&fUX z3OF6WwPW~7_^;a(qlQ`WX=@K?X-?m*^L(8l^*89s$@#0mqUD<~6P}@S*Dfm${gzb% zDWi?%t0(XDHDyz`UEWg>XJzyC&Y9nBp9R-v6k=%_HG1S600L6D@vgBfH~TF8X_uJ} zv|_Dk*7cr8><%+-!f>e=a=gXn_Q>FR=|vlc6@I#jxF>q%yOU7fH+^S9l%73rY?yYLyewKOs4H|b0+sRIH8>}bwRr10flittNvv9ReG zv6WEP3nxW|91-{;UVNrLNwfVr;MdQI4rd~a+))%j2q83(BagRR~YBYFl%MUi% zue4-BB4@kE#ImzR?9x3r+7cWZogi<*3TPgdabFE_Xj>`9zi5d^UjSsKvgu0Z>Xh?~ z-y}3hdtP9Z5-=n4(PT(1!&IC?*LR?9ua{tGO@+OnYnS{2P|3&{$Xxy}Av7#j_%Cw1_@`x?4y^lecchKzyb>C?_#o??cS2nYhR`^?P zq}R#7j8p_$^Vj(RU?r8wi$53PaJ+nUB;*lp|Bv$X9A;P%_gk#HnY+m~lthAxAge;AO>_$C)11Qwkineq6$5 z^zei{3PAx3Si26-5Qg{~qKV<2Fos3i z35D!ah?~vTsS1RxI{P)ZRxc}jw@Op?o7;wGs?+@PrR2pY4M6RF&BGzgDE!^2`NHAdp%%Gj1q{%^(KMVq3ii zjuLBHX(@z|K@f8j^I(%)3Rn?)Q`}vE6#4E`4!xCzPvDsnP|SN^8D1APBXUVwl=O2e zB!Md?Ye}qG#X>BUfm9#Cx{39(d%_&41lS%>!N&))a{Y3$lm(p=jaI}a%K8j)#0Lwj z;z_->>r^CQxWwgfoCKjHPb)>5#AG4}bby2&BhPe>Z5I{fJjQYmI*h|x>O?EV;Nurk zj-UV2p_q1c0c(6w6S3qgN|*sEZ$uKfO+4MW+X&Y9(QazMslLA5IBjrP<_eKwAg(>n zD#;FpEoR9@Zi)PYN^1muhp90nzR3C@M)UYL&-q`Yy|-4LB?&kJLVybo|NmwL{HyD$ z0tG623*h*0Gy)<^|Eq36p4z-3Do~~}?=~~CE4nK&Yzx*YQZl6`0(v@1qoA9RQQ@L? z$}h{|wB0AK(w`d!CUd^}+=50?jI{)$-p;z$iP%_kx$fjV^?O}!IqW=)&ol0Vpxw?4 zAf3QtS^sD%H2D!2PTrQuldhg^t2`bZuO1#m|8v4Hhd8}J&~RbO9$<`BB{lB7!dI`e zgR9&|&7$LEGbDhNul7b&2@$bqA$6SxzUcM{rpOc5?Bh$qhuldZYP{w|*I)~~+X2;~ z?bH{(aU%w3pUI||A0mLQsL$@h$anDS+DVgv^QPZcUh48amdb@$!cZ8tC6xsvz3B5C zhOb0N`(YNQ7!V`Bi>|>!jqiNy)au!^YVtQ*3s>+?Yx;74F{%W*z&eOteX z&ol!vBa(OFij{A{AJG9x=9%%t5+@Vr`v^Zt!18J{XwR&tHDC+8I`8CsQdz%qFMiXfUy} zEAPuU^ChSJPG&P17~(OJ77@`AhO-;Kc@PBP4Q_-voc`JXkm)4tR-#j zI(D?@L%?08uWM<+k-4UYmkMg(Q0H}9= zZeJny;AT-^)>(|U!~x(}5DA)t!^4#>9Cyp?f14G!G);Hm!X4~_0Omc)OX!(y-u%JeMwag zH4zCbyid?XzVM&@J}ow7(%vZs>-7O^ek?Qtj<28h+ckfwXX#2#*x=$LI-b0S!|fPB z<98Kv&Ejiz85fm_J}X=eiv{2e+pDkVa_$zbtDun|(CT3HwWS$iCU1DADjMF#X~}&} z;BOlFU#%jDY56%0MAk(Bi^}}3W*}L6V9l6+O+){RK>oG}1GH>B(T>smzni9LQ-Fns zfdpw(WG9-sAbyEiXeBN#4Hv?di*4OB@{oh%WZlZz0KXWO(Y*v1EO2P}G(l~82g#s_ z^e!7T7XMx?R{VVQdgb$b-7To&w=j2a$pJJ*3BH}?+~-|y_q)8!U5$R`2YeCY-AQYL z@Te~&CoVxXL6O5I){2$ByYn)zHNZ2_D_4}pLNpN>LdIU(tAvB_V15W=>emWl+@F?n z?T|b8KD6aS=BqyD?aLqQV`e+-$I>6PNWyAa{tN*OK zYY#^ zZ0U1)nqNelQyu#;PSmQvu+vZ5(LiQnYx^mRL3Y@9kJqNptIGZ5R{cLG z{Sb0}OHA+`vU?(aPIqP!MV+THyxv}OwpeITzqOq1R?+1a3vhT#x4yQDLJx_()@G(- zE!&1XePJ2dLDBL^v69d1R|m@02HSx{wMV)eEIpS%)02HSXwUim@Ji#h8ng|zSCX$2 zXwCXl_T}R*Nj(+%1&!~v_%#x)9tkHix&}JCjx`?G2XYjyk1|;q&7kBGaRZyRy%%n7 zx-Rr{wJ_88E0=!4*fi3Ntv~GynvcZ=CXk>LV1@Q}KM{Xw=XL{R_mfHOdRy-o2d6O% zc)T{I{0yOusSLq1rs98cV&$Ivy0g^bvV?go)EtEGOe&%TU!93)-fC|v*|vB-TZ3^g zk{r~q)pW#nr&^Cnpgt4n2o{EeW@E5dJ3i68yC=T{sZRW^yLata#beAZcwfCF8Fz!F0 z{3+Z^xCjy47m2_AxKqAi>G_!V6dx4trD^mh9<5JJiu}d#dmXH#yLylPJuG7lf}?Z= zJ052(rJaDZU}VLd#2c(Z%2Rbvm+sx}U43X5eAzgydJkm>x$_b1(K;xeygeSTd zpc;&}RZGqzH~Vpp!+L{Xb~Ozf1jf^OzwFKc9|v~Q>Sx76J7_%PpVs3zh#39>wf=Y~ z%%9u6Y>+JR#vE9&tx2!p??vt=6qP>(($KdXkzC8qePj0qFA#-*t z?EFOiRh%XcZeRAxqiwqcEQL)!63ufA^iNnUj8meXG~%Bg$>GR@u!gMxiY(j2IoIPM z9qDrC6lMM{gM*Gq=G`V=K8n$~6$#zzTwAnN2hg1Ll0Bda7ALSdH#KOuO&v$;=Wag( z=XP|nLWnSQ30uZkn;QCZB^RqWq0;=5-4_*ioW(p#iKvED!=B0phu#)#_x-G{3SX|h zgJm0gnv)~Y6IwzoFnM0cE(ye_jRMOp57A_bjUmf^aEFFlC~<_{SuUZKTHd1#{WxDh z(-5nHrY*Q7+Y$SfmS{P`_eGm8n&uXZBRZv1CRe1+6EE%n`T<#g*w!QJ zYtwNV!AN@qUt}F{TlMi!6&sg4p#Y@B zq8;d0M;F6GByGh*4r^&yPoSNk(%i2_i;^iS%|%OaW)9%UqxqYrzu&O>UTM@NpJx;k ztrC@w98!jdudLAWStfsGg4&|jlR8E)cmF%NU8!dvp0omn*~NtPvYGaoPhEH6n#Ro^ zJdRf#&fhP#gvCGHa0nj*=ff0A9sJFBKsC|h2j~E(J~`&M$Qruh11rJi4K}a1ITgw- z=N|zt#@395A%)2<>wFPBGUKmO!)(QLb~tfK6olp?!R5le^nd!@FzmEpI7-o5pYG)& z>kpUTKFO5w5r^E+AR}S5NDazs`=puz&^uz*n1~I=oo*p1Msqy1dc#r6;A#jfY@g>2>%SB868i$4;gU%f%UAt4XF%W zElCg6B;QPiVBFeN)y1Qx&jIFSE}Tht+j@2TlSR8~4{4?2rcg`C2x`>C_&K2orcxF7RvK+5>}B7r1-i^HW+W?$52p8u44zU!&CHK5-A z15#-qK9=po^x;ku5$I`~Kx(2gfu2S&kkLv?I(S1fkk&f9af23z#ziq;b+yAv-?w8S zbAIuIY%(Q0hx0=pUi8R`0|UI&;%Am(SFW?qZm;2mT#J^S`LXMT&+If=tZPi#~9UZRWFRuLqMw`Ji9h&)1rB;P+WtWp4H>H$=+x4m85;*xBbK}e{F!nz17|% zv+lCy%**aKxoMwp4=p%dhG99=yn)n3X~)*MUPlp5-^!uIwcC4FMcJXD+Q)Z0o)uxX z9Sx_msyArY131IabN%2oNf;$Ui{0ZN_S9SDvQI5?yzc6BZz^<#6ICuN!ANj`rP0@a z3MOK!{OI!4#Z`0LN$%JtH#EYsPjJX~Ee~W64iUDRS1-Q!0k1hD88_PY1Lm||HHFb6 zsNbQFjnD7F4UPCFy#xSqsitF9pO`BUaT5amCFJ4iK*l|cI5`a@(1;JbK!`^9>^*NH zxwU>Km)PmcEiA9(9c4EI@#UO*2tr2y%=AJ?`HIB3^*n;)j}TlU_v(@Q-pHY z160CCO6?xB^!7b>zHzK?#hLLTSyYxC51{47m2gs|S4weSuh=3zpOva2NfQq-u+Gp* z4vG7|OgcFf?inj=#HJO-Xim#@uK7!$cqZ8p-UjN#+q2co^DjDr1s-89IaTWB)D6s5 zk`$6S8Np`dSK%tH(X)T3%}2&7l>5LDVh@a?1^+iAMBU!z|0jy>Q=e7==JEXelVnCL zLQqJzVUbjmNKpGlB#|U#W$I`;Va|AX<<@Wns%^rPRcU*%UIq3?+9m4Q1{SdCnWl9-38XZgxwwe)h zVvn|gbKW@2Cm6*OeMk0~?(U%gg*yk^S_PQJWK4T!85xf{#pUkb6_=gDq-W{6%aGe+ zYRc(097vq+-NO-I;lNF%S-eBcYj1Nn+vMA9LgJ6YMreiam&^z#HpLeZB|$84^oc|A z`{g!q3;T>(tYQyMDx?m|H#OtPjy7e%-=OT+wn6naE_Ca?%-G9%-bkzG*Jcah@WrmBq#c?B)u0%HSbzkOGnoF7(W8E$RhEk^ws2zTIc@|`pvdy z#+5J#k_DUC+@3IzL%MhEX4nPUFEph#=yFt+G9c*dSe>oplN1~CCngi?I?z1Hc?2EW zE@OF9+>%h)`Hr}RL~C7fWTT-w8AV;=T#Aw5s~&DC(a)Gnj&yuMkS%VNm9KQL#7>+6W9#Vh5j=%&AeTvz`^4?{~ck#=PPbt#;qM5FB7>5Pdta5n<4Mc*#Mk**h9JJ47nrNJ@obn{jI0$ z*cSA5IE{(0gh2eu`Gilbm zpI^xdHjx@}*q5ENC~|PzNU@z*lozJFbUg;8q{0EJ+6yx6>6&4awbnVyGLgT``zT@ShR1vsYcH#|pCA5T^pxsV z$D6U)59rP>hVn5@Y8#3YWJMJH9NP!L7U&W%@Mr2bG?s}CmUAc7LG7dvL#bLDl-EdX zjg{#O9y>{msPIYV26WDy`CJteZR922mTXv5LAkP=Denbw$*#&*e1BEpwzWBr8k*~h zILxcLmJ~umx-NR;wUqp9Y+x^vLs_*NZoGnMYOnapMWFkksR<>;h^;d~*3V<4BRpiz z*>N*Mz5K0mc3r7+*e1K#v^$6{SW$B6b2vkGgu2G~wC%pT&_{9NJn^P_kH~hh6=T0x z$G{W~g11RlLOUp=59TpaQo@o3=IS6n_6>%>P;T(;SxCggMA6i@a*xz^24Ph%;g?xE z?@I9&%%jowV8xrNU@(zaxPq8V%m?OgHX^%*gp6&vFpF4*`=>S@_-@~f)dn@6bp|;} z+;?MW)FXVI_v6z&^i*bQ58S`aXz}rG>&*mnEMq9W-3Bvf{T_7G;eI9;_YA488pM z z>AoP>@fd7ps@_E&hT+v++kcE4#VhfS*xFx`mqd@zEMH`bPjqWrwN+40wm&+!bM3)$<)VJ+Ib;@78AnKH)%YES~`6)Jf5K!DH=xLr8r|2FlV0^hw z`oGm?eQTT7vT!ttem*tjI}i8HRY1AK;utL@ZA6Y(7q$x(it^>d8eZLiN^=30CtuAK z5PF`oxw%7>=O+schBjGUn}6yb)*3vyP-!I&T*WOn@$`T-P1!jzRJP<5G?b(Nh_U0jQz$=5^Qv_*E!?mvI4$oW^+ zkZY?qUjbBm%m3Yb`;S@uKld^JACh94ivC~TTmBa97I%61*6ah1SZWDsd$ez4B$h&G z!7xdD&m7X>mlNh1=9J{0CErUG!vvneUQ41qIKCjmTDcR<<@KEAPxE{HdH?u;+e7;1 zYufm8c(gnsIl?adqDpNsm)W%1#}2Xs`3YRKpE|7*`+-+v_g+CPYt(%ESUJbW>iV$M zrhhWjX#a6?LJQ!O2L)i+UTD~EQxV}L$tMe@8lTmQ5U%uML=omp7AC!V>N?*LDCwT! zP2w5$t)*H%k${`+Lf}uuKG}JwQh%b5{f_?IL|iANUnzXQc+>Z2*9*xB9g@DJ4Ca?A z?Oeo=-tCck+KjIhuJW-eS?o>YFi1Gy-1Ks|8xYD`%dGY%LOxFCR>)(ttW}n}{}68- z+9eZMz%p##@>QJ)%|O5Vk}sM8{>2R^18XWp(uhi)q>J2ph~Xk5%*293lfN4x)Rfu$ zF<|gTIw)i#)zt4Z2odd60{r~@-kGDnbB<-jJgK9&fm}rsu zVN(Xn4ny-7ld{aGV9p0a1YvV8sY1P+tW@u8RI8>{jq&Zb_g?XD#g zc~vpz$vj$ZzZdsfbqJCcSZXlgSL$`LLsR0uNdnBI*`q@k1}0Li(7(o{>rh#R+>`s= zIIUD$hC#bHDYL_HpI=9K*x^sT&z_f)Q?tc98^rj0|(=y5JZs7Q)DG_hYp=p)ZHo=LmaZH|ijvnyCy zB7g=EJNz(rvEfM}#cRxXmIeZ#@I9Y0k9&M13MX@ATWr*;S9anO3V67>ifWAoH#3p7 z5Fa~e*QR}bwEd=pk}9jdv^o|yR9XdF9Fjul%A#?bXr@^SbyefuWi5MV&Er^FodJ_A zRadJS|5GDOXOTN;qwofl*41^oJLpe4U1gdM|K$XS&BKqJRfv_Et|j}5Bq9P_&U72f zo@O@)UZZrG&EDY-uD(7~jEYwBx}zrx$;ReTy}bx|P(rA7Y`oVlcroDG?)|k5o&D`B zyeqk0UGc+oW39DI8f0r(WKfu|B)xi*;-N*aME2?l<9rP&fJf-*>i9Dtw5C(E&Ag$) zY8AY2X>FudyX~aSq}%c)p5pmq$Offa48quLB|#S11_D zmG&o(z4m!Ck=CH(jWV_-dT)q_nXl#`uzn7N-~b}I>D37*YdgCJ+B=kB`YkHQh{ToI zyV~IVjSKYGJ}0i+pH)Y!ahORxYo5AMeUJmHr;N>s=ren%!RYV7n)4K@As*raC3_jq z=n)bP!PIiJnIJD8>>6h85`&b?6?+}e_>x|LSi=gm6_weV63r9#gowO)#jKrt8HX{Z zOF7}5fiu`Q@iB&p&hkAT4fNiK3bc2En%N@`W=i5*bhjk?eC6EXZjZJmHJt47t0`H| zYiBLz*O^4!uX%O&%(>!+Ode5WV!?U8=JVSjMX%;#?cj0YZ8XT^xR%}=+p&ASC>KK3 zA(nL1qL|SZ+7_s4!cxpJ1Es)9dsyDd@g4zSOs7n`WS18mt)%XJP$cv|BPpnA8^GZIV3-$dZxM)42|bC5DR~aKfv0PNj#q&)T@eS4pRS4)NeWY}q3v-E;?GMXqaX}`gz-Oiz=|uVrthYgkg<9m_Jmk8{ zK7ZPVigG$JhyL8>9eet@bw<(gq#!w__a}lhm_K4eROBu*?#laXl<#YQ&bk{%!OmrG zcd=W|&H7Z{_fv<1KQ;n@x4fw{Q9N$4Gx2ov42wE^(}iI&zg#!>Tr>q|i)?lZJ`8Y+ zrmqRA(annzcr2ttss%GkrCN#Dr;|%^B9Uj~x8PQ=Yshr1bI;%fWh25D$iBh6B*J!G ze{v>r(JxqDzlv!6wvyw58OoEy8|T>u>qoVldBWN!%Y6e`_hh;tGg91vc$DTlK0cT4 zhXC^f-%?#82DBkq6-+j<67)t}nz{iSVYtR0hDWNnvcg`aDT3^xtfB8gD{~IHH3tDY zq}YtrAMp5c^{}s6`}Eq4&Rg(k^#Mn2;BN4aUK|=0Zz;;t!zp&EQ*j?KJhye0C3_vi zwX)3!^N8X7nf$F`vlZ1SNWNUTUx*SDkCK(aFi(_0kh;CrvJdI_KJzIP$2AkIxLBH_ zU975}yqKU6S3F2DP69wh@VmJZ3P~c#?6=--;sA^6n~FXt`mQj9__#0=2tbsr7yQb8 z&rBj!e<#b*kBzzU%3%sxM=qD9VllaZp5)oxop(vfxfFW*6io+TW@IDgxz^$he*RG@ zz|Q^kcS>CiVK+--xL)KIwQ`5vL&OO9$Eo+3Jv09>@e3WmE52jkKKG6B`Rek3%5R;z z9Ng!-hMZ{sv}k+@i75G3m)n5LxG z=JK~C{vU?PykuF$AtAJ|c?fVZUqPke;)?-r98|YMQsr3MVlu2JQQmZBy9hWi=ua6< z3WoPDf2a=8s+rft4(YCb=5p^oxR*OzGd6%cHt7ms;Ck7fG^I&WM_l5$Lv5fU!}v)^ zY1(*%%BgneHg2O3e@{*jd)u zT*4Xon%wg?c`E8EWIW1kd{{glO~kjT%Hux4->Z>4R3s66L7Sn*0WvFbkIypf zu6O3Y3}|GZI#=*vcH7F~wbXZRa5VbxV@tNJmzLUGj(I1B($rsJ5WG;KP<Vp)CZ_KcI-pS4G$(;0ipUX6+3WQ;|~tVNcdzCiwe zrF{idl}pq%(%s!49nvk`ARyAI)Sd(S!*})5i{AU)wfJb|H>)Oo#UZ4iZf`!F7AMZhM&5 z@nXBwa`_4C=jUKxa?BFD?V;NFP}0V3sj!jwXwp{&HLl9nuf|T4GKLKpKF6?FG(@wk2DP38 zL+`Fjl$ygW$H#oG-*?e7JqXIAFZM2`YnSz7nNZ?~{uHlmj9?JmhV92w->qHeN;CY{ z0M5{CC~|01B1f3(NG(G%FY{InlFJGn3dlowT~#VuO)xK#5uPhXqX-9F9gKU>J>h_H+yw9v_4 zXqIJ;Y-2-%GD_eCr%r5;GSEfSfJ|d*{JPBaS~s1ev#hG%ssG}+36q&v_}0u}D8Y1e zJzvK~FjO{Fl6D48@cxb@sxKc$e-;uWVu^iLsw7Vc9Rg9%p2}y24J&2$gEG*RmE@R}WQp>gD57}EgIGTA9wMqD7K>rnI|Nm2p{uD(1e0gu z1YaUZSLCY?U3ko!!dR-oCvffHD16zc*bc&9pT-E?Vso_farS8ozdQ0sr?bgl{<{Wx zn^TEphzbJI4GfG$@gGL(cVnR%oRi{Yl{W1uXLK|eStN+>b5f)}y(kbNug}aPiZS4f z(Eb5V60%X=eJ>IcLF7MVP0*an7iPV2SII9{7L^Q?FDgFPH7|5ua$M!O^!2I^O@uW>Zfgwj#`F5CC?8SZb}8;R z`uICpqWz6b1@6N)WBEa9>-ed5##-Ds2UD{h+KE%F7se^cJ>1*7imm>#*UyF4Be^k7 zK0F`Z_IdtngJpw7eVsHF@iR72_@wdk@bQ__aWcZ=b(YOb@aq@o!IIos9ntQZbWaWY z41+^ooS(27^^Lo`Rd=)4!7_$ypoU4?7wBGCCsuBLf$0r~y;g+vrCH@s;HwaktFmw) zOz*JWP{=sZOvSXV>OQqo?>}YJ&ae)X9dOE&t!k7A#58Rb$vf?WmA0>c3BWw9!=2u< z`^c!-4a~Vismvt@h`Tk)li+&IhqdEIQW~)&iu*c6eBUW2e4ouC;)n*NZm!2vqcXWU9LJ`!n`yrwY|=o79@m7~IK?lRZOO zFkeTrD!PjKETa1y!hBzJ>K8!=6dP&vhISQUk0&Ulp1dJjzz&D(Ft?93ee%Sl4{>Fb#QE)?8~p<4RmEe(bO=yoPF_Qbd*oP{@Iz zDT#@G-04~t1FtzPz(jvU$n)L->{gF3J5#3Ak0$4H7=^gitP@iV%jNYBhjW|ptc=$x z7A%fQN?IpxKG2v{sWlWTCtDj~X!o+x=+ZV6@$~5_;@UUO!XzzpztNZpbrk*Bv6)yA za*$5KvY>3hqFT$0YF=m(l0;8ZSipr|Bz0hJz-Ttx|4b7!4FW)gKC48uU|vNw*wu+w z2F8}Q$}ostt(q!dIIGy~g-(TpH&^Z(NyApjhug`hn$9F6L|qVEtv*^M1T9bdbO>OSii6O9+?m0%MCgaBz^7wbZ7AX< zDOKtxMasbM8qqgSEuF9xYld&uHD)Fs>?xfjVAX3%cm>mjXa_t)Du^Pk@(+=awG=wvTI}T}pRO?i11;-3|r0qQtOt!8mu0*B_T&2=`#!of?yQc%wm9l5!I5Re@e zqsC=6r{iqqZ0rM^#r!(snHnttsqWOqm{dfk$h&kkQjq@uO&0`q>yG*%jneTiB z4Eq!wz;SPTpBxT?oy|3j4 zSfFn(tS|p34kjgdYSyMbOf`;m><=GioUYe~HX)bWq2QZiTi$#&|0?Qhxy=J&L@uqD z0~6d8YXG_22laO6neXwIFo-!D!#J~aK&P>D(8u7RSObXxR!$k^GYJIf(ad$PewSsAGW%~-!_x9QuI1`FS(6S9o{z+svl}Oj%|m{t#haA8 zSPX2gI*|muL5qO1NZ~D~34`l?7fWsr03AxN3jhs0GN!fQLrQE`r5KFK5R}+r{JDk< z&tz}ViW8NAT|+(isj;a{5dx)nl6jKqLTGo0BgFb)7YhwQ5!ViGvEXC?vZcM$zlO-jh3L$|Qk z99IbP`a*rVIj-#X+Ddq!%T0I+O~LfZ15yYc(I|}y{-NZWh{FU?M!nm<5W?l0i_+~@ zYm3*Z-o_VsE#e4J!E&c!OpZ=g+&g``wbv=%tlH48SmSe6SKPPWi(l{V61-yg*0}qw ztN5KD63m5lqg6)HC+-hQYWyxE^q#);TZWmK{k)|(Xa`ZSM(Zo}Wp-AH{G?#@tpXTd zS6EB3&+KyE-?P3g++m%%?ha2p?4a`VZSwzC1$E(3XW+J zt1|VP+&9Xwri>09t}QI6PEV4X3ngHyHBArV zciRd~RRmzd*QhpZYPE*Z7b6puS}i4&5KEEMjx$qEyQ$AQ2eHsPd|XIs%B?>G)xvj9 z&sC51;U|<_T$ILFBANws$)Cf2D4oYp=tX5c^)Is0Xw-U34IhC8!y(cx3AIJrzrh|C z;!(n$KRE0V%$wIL3kIh&R%ey=G+{0)vSj#NFj6A{5#h@Qi8Y7b&Y+x#5oS5rCn>h= zw`FrLchFX#cC++^^8V<tB+icDc~hf)>F-r!aZg{fU^2Y`ibLP^b%2^ L@0Zq5qN+E_t zHM5yMLum~bz1@mt`UVG0Sn}5)=!7xdE+6?qa(g5+@SS$QsZcAWno~Immw=Yw5w%L+ zq`+S3^&BTL262ny&NI=;7J_^0NMKU50{R$NKKVP&I@+~MV0?(VcgOLcO_}OOJB-x$ zos-^0)x=k7f8j00UI;0D7iUBrmTkMscLtxFa+C)Zh+YVVR>U4HJ}OJMpQBkep6o(> zj9oXvmejx4#JYxk0y*Wm9ZNTg-qPkutO3!BaSp4&tzzt`u>B> zK!5mnFCp%^VsNp_ZVgSCl0~r6GhU%^-8<-;^25@V`;Ig0I=}pV;KY;UK5`gT&NA2A9sx>v>^bm7TjbQrGv1=N~X) zc-P}k1W=czgML=*3Q+~k!YwtMKR$flk1sNay}BtQp*T0%0JFrFlr@1Gb4zoR4;u== z9Nx>E6?)zfFdXS%687nMKa(rq!^p9;1y;ex6P&d9mHc7)evD`(ev#9Uv|pp#hdzw5 zsO`bTxdd-6_yhf*HYNtdji~MVBvm+=JpFQ!a^jJ9`wdQU-?=@n$O_nkB1_YxNqhGS zWI2rW9s8(arxU%FEY>Kdy0l6}kmtNHt-S(^mJGcenwrE%Wf3(zUg^U#REXV%$}kVe zf=en9qE}F73Cx%k($d7XhuRso0#f=&G z-!1nT5%J4SpA=T6FX!T2fz?NP%5j_$?JD2VE_M@*A96+Aq2BUJlv(I^sO*|vElEc2 zTDyQYiAR_*=L)iPq`iH{o(gHKu(N+gwu>)3%>NdnZp5T8>0HplB1=W8bbLHxJj1tX zDj@aSlPMR}7Sn4k7f4>D*i)XePA187d`D)aQCIMr)v4ANQ40d`IN8nD@~HW-Il0QutC}&*&jEp;Fa0;B~DTR2Q~e zb%~su)3YjeQb8oBvK z*m=wV>RuU`pVvQ^GvAM_7p>NCw! z&cT;DW3bb2S`R;+@4MRtN$(hv5^rP}#qfqWXv09}ERyY#SB?ii_mP|IF*dJ)S|yQw zM$nkeQl+1&ni)P-xG8m&=-ocB!0=Kb8q{c_K8&{#1y3DW;>ZxK`W5)dyrxrK6SW+q zb2LxesJ7D{h2Lsio&t#zIjFP%1s2SKIBdL7!>q*0Bs3hFF`ih`kx-IU+#*u3Eb-YL z#FGnKztLOh_+=75KA{n}7nEvwH6TIDt8OmI+ar$Gnm2^gqnCAIORHLE&z7b5H&k|d zzH)!_lk<^AT|&&#<)nTiIt`LQu5U|n%j5#r$R^Q}+AM7O^!ak0F-QX?(=CtR#pOis zGgE8D^jDa@{wEf-pRT$I?{*Qz_IWSb280{ep>$^DRgTTgDpPE zl%c9?$AJUU4~3>=krN>=C*zw4?3^4~#y89>6&q5@<$xF0$DO;X zZ3;hqIUHsz-c67Sk+>%Gf-zCx%pKl?5b_!G0ziz0c3?ipbmpi!ej+MYU>6 zgLJX77Q=WnIOc$!c*3q2bG$~EK0Ssb+QnaMeJ|?l>oE`QvD5t=_~$-lH4&bQ8u15Q zKvr_p+wOqOee%7dsO0dqAQ(9#usq^_bh`O965rT+pkb97xDn3sA52wbf&gGVfxp}! zZ2z)b703RM&vegy4c`6^Bpy}ZCpaGgxR}hWKqh%N=spoNyP!rUM^l2y5;jNClc!f& zZX`icSwTdtNCwYq3g4GU`Y_43eB!!XSmxSZvYk(FY5oTCvO5?OV;r|UVV6=;g{hDv z%o%|KQ!z$~j(KCxqoR+uaLtLm!>J1kp@O7#a}Ka*KS-%rX=ZA_Z1|SMcHkssg}r0L zuKe~zEJ@Rz1~`L6$Bjb;ASADGE6SjDZMsflvpv#9{{@tWYzT?xw!xc_9!t=k%k26s z=W11Z=R$*M6T(pZ5F82;inV>}eckAm(pkJGSc3DtjLcfjUCTD(o7x=<(0=P|$^dqp zSDLK)Hd@i}V9i*75gI99UPU>zrII3UY8dtKj6; z%bt~;(vV*>x$R8u-)HKq6 zT`%(f?A0qGo+9`S@`Yfg7(`)`f&2(2{|c0Kl;VsXDmU?)x=c?oDZtF-E=U;;sI>Vs zVj1$29J_a9Z#PbBu``dw*i55L+(gBe^Gs~~Vf58#;|iuoOwDcNG5H8jjv~WD(?`R2 z%ND_Kngb0IcCDCe(Jhi=C>U`7c3hfVqLdIjcCs|^@R8HTxSz5&kw#h}aHUzZ5^_8< zyt#~8e(~jeIMFXY3OI-Yj`T_nOV=k@GJouIE_7acn z5%2c!;4weH$CD3hv&1DCF%){ak%DUew$zGa2?04eBnSuw#sy<^xmGG^T4PqPJHY%o zFO%Wxs(9}rH4q(>rvN+i7Pg5xt)>Ch+ffy|4Gy*aj2Z{L)5+B4Ok^h7!i@UUW-3L; zH4c9FamSoO4qx^bX4jhO*QpYr9S^+(mtP|A7*M%w*0+~(J%uTp4ITh*Q(88lF=A<9b%L-p{r@c|?L3qJb7W{5MVeE5ErVaHTd^gbR zmB%%Uka;kLpT%WBl*{6MGQlpQ&{04e56^-D_P%Xh&gEIZa|8VX_4VavpHOKQu?CQfDdhm9oT z!%BRTZy3?{?Eb@MZak~3#HJs0x`dA>!kied(X-Mpi)|Q;2?dWK!_z@2dEN*I4~efJ zM2WX&CT`a0bt2ZUB>5z#KBZ(CVI&w5=m<^nKC{U5s*P+nU)a?VTdPkrHcXHy9Ag@! z(df*skHTI&;?)$z}(+gBz4*XeNB2yd! z?@*QGRpws!Fqf3c5*qL{(S1`OC?2B;{nK1-ZoGtjdyb2E6-IFpCQhzPks5@8sTw{V z_DzX$K_WO8Iv-3m*j%ozx?c#|YALs#|LpXBboHpsIn5yj^B5+a3@o-q!w4ru2tfm? z46{kK^1D*%Ns*1t6lN7RDi}H$NtY}_3+m0J`d6h%1qNIZpiMJpMz)=H0r{-tA|DY5 zLucT-_fW#{2z(XI4HJn{qIZTJh*CQCPFCxtij(X*?4;vrTVh=V%}LQu5DYj9W9_;e z%5T^4PG|Gxd#T$>E)aTW>mrv`;2cQTFy;IA;+<`Cc-|jwu6b&;YpXCg7g*t6REQ1H zeQ;z;Yd7-5a`&E(I$@{47L%KcJ$aUEF!)BjQxE4@7$q`ZUO>K^?zQ|!+N@5M3lSsc zixUwMH8F^KXkjso<$lJt(pGvLb`$srYp-Md3G3eEW1L~TF50I)&fMO4G#cm^c#MZr zMe#zhby!9%Mm(+1CDXIM5n9eA2_y=PKoNufwjRb*GQmZ77gvaoRDng2ay zV99=a#6eHB>FfE9t~=KJvXR0yMTIpI0N-4f)inx3n!{w zyHAu{*hl18fSvm;uFv7n-Ilyn$0KyIyo)kdTj{>vgusv}^3QqNiE~?zi{E>l)`CET zG9bwEkM9{e%W)s;lo(V>&1vs3h`G14Rjj94wk9v4d_XHlxSG;MxSG~w#lXX!xtlfx z0j-J#w+n9GMj;KyZ?hX$NAqTZ9Sx6Mf>z34JOng4MPOduQ955Lq=(qFAi%Q|6X*o$ zd>cd2_fIbq@@0W%SgoUe0qwmCDTe7Txcmt_WYq2qT2I@Izl&_BQSddGHw?)R8X?DL zWz*ebtdE8pZTlI`0x>=_&?sndo$Udg!oi;pk;}#XLd45N0x^+uEJH`$T4BT+J$nOx zNd*y~dS!EXWpieE3KnpVuht-SqGh`6EsZH@liCd`X|eJ&pe6Y|^_SQTlj>cK=Y!_aYWat1Lgkxk?es#6yFKGy&Y1YDZzlNvuDGI88!;Mzb2Bk;Zl?QP zasB3$`Ri$mFa?eO2`y4xLw`t`qlqp^g_TL)AB@%bvJjk!#JDpX($`X$N6r6XQl>}o zg#AR(e3cO-6(Qmd+|vJa@GJ*i(k(HS>o)b+ZJCRu<=*Z7$r}_}YWp* z4aH~1R+b95FBuaUQsPAjWsyZvc)jhCQh2c%Th)^$_i5janph1eFvjqQN4<+KLg>4b zma_?{%hWX)#e>K%ShO+uS{Ffp-O#${qd&&zrvm|&XQF~1a46k}dlNZnMNk1tAzN6I zOu><$cAn5Py);$(Ni@)lRi&mbxx$R0rsKlto!TweJu_XekOB>%i4%C#bKG`G=aNxo z-ceR(FFP3ZcD?%Ni?VDnCn6mR)J7Ng-Om07dam))9|Gcs-}xT}(k?+XY2?NF(~5sw z;<_P@wG%gfqvZ>G-`8B&u4T&FF2k%QqXqHK+o{Dijtpui0F43LXChDk)D8#X$$7mt(@LJL%t1jOo ziQ*4=jm#s2gyT-+uRyuFgEEHl)#oB#%Q}J8$0T3zefm{Tz7QcA!DRg0WDhmrN#VX- z)cso2c?{huR31;%x{l3A1b!C<6Nb8z7>cn6PS}dQBkfiM1=rK&mqd79`W9IM zZa8*^!riZ^Xz|WgqI|$Ud_>a!su$mVjTkmt-Nr=}d;iPy{qTlb-CAaw0DKAxfTvmi zQ@o469s@x~9UFtc9AJKlcTubad{>o6=B)v`T|0cl$n;o&(nYC9hh^){gGFT`Lr9un zZS$--RL81m*gBdD7e9gdx{f3x5=O@7g=CPT5vM+uB)XP9JUp0ao9noBbocfA8B+bhOgSV_!d;b+7{J{VHZsOMU2V}w5;faonWG8mI6dajc+F8N zR`Ak!Kqf%rZI7lC!2J{n5KFSfU(q%Uc27xEgL4>@yZD(kir z{WK5{ndj4k?o8|ZmX&3`_<08EU?Lb?9@IT3Ec(xDXMTveCCa0JOcgJJ#} zAs9AAhYAnRvi4%_CINy2o!K-Fq;u2VN*IIF+j;s^h5^OhoIUxx#8dU5v&MsVe658b zG)>XEY=*mmSl-=Pv&#>uX{OKd^Fl}QUgbF&f_K<-dE2Q!;}y+%X%y~nRKDFyi$W^J zZvNuf7w3SMRLp~DR8EloL);fSq_834E&!9zNBGST{s*EN-^kcVJDp+PKRJcHM#W&s zZ4tO0Sq%{^QTiA{Ikg(J%3Sg?ZIz}QG>sR&QeJeOB};@&AkJO*fPfk5rDF~y%Y^e+ z-d9i(2aqKfAK&LoLRJTIYV3{CJJ^MITYyi`v#r+(Oc8IAxxXH!Md2R6FQNWI8!eoM z3{wuV)+CC#du91|#ZL(?0gnUp+B1AGM*Ob$fAR2og*$w}&l5K>zs{G%2Tw9H zp^uGnVG;&ON>#s7krW%!8sF&xHO*Bg_bmf!a`uAUtKAkR-tB04_GBhDn4Gz~ihY7? z_U4k*?f`Vrc@+%ZpjSpat*(@3kk&0G&x=xD#cXn~$}v~nV3F62y1-~Im#F#;91bU! z`W<<~wGTP0`C?v&(pJnWCJPw7u}`8GLZeSUoGmgqVaLZ~D|@ZDkR;WkjA*6WX}SU3 z)8+aF>Zg1kREqE@=GGq2Bhn4HBKS{X?1T&emNo`r#x}Ng3ii6+<^R{}w@cYv0hrIk z!=l{Ey23~TA+~x(!dE~WTCh+684e`^HOM@MeWpf6b$n8Pde*GKGm}5_zJ0jTH!lA| z!|*2O{yl%zxUHieG(}mPb?)ndpJy>cv6FVLJ+P^(Z@2wP0CFse~1EK$P|VgMc@U|=eebLn_3&bhV7t_d(n z7VJ-I!0o`%nK7A=O0pNHSL#FUPc*2iFIKNl;0TM#7(mt@JxY$N&egDQ7@=ZwXQsmQ z&s3W&P%kwFPd+8XIou1B#ib$=Xb2p4#`G5)rqf8HFZD3ob&F zXqx3vYfbjL1bA`pC-6wiQZ&vLvOK$6uFOx9Dvba*SxpCe5paMG8ik}leEg%<7jShL zDII}6I*kL?0VK|(I9*!}u+=9JJ@K%?Gdh7zk{?zGn{^W|L+z%Wj1t1bp7l8$eISRx zVx&-YA3)~kZY@_bo?z|Jc7HXMlzt~PZjhab*+;WVYB4NI(Y=p04&UbcbugaL$RK&0 z2ZBb5R5x+8U^|jMoO8tL5@I!euOpVD5UL5;2IyX_On=Cj`5qG>=h3#S?VPv&F=*Wf zo86U0s7aefjXu80g_oN{IDY>X(xr2M*kswc$zI%z1o|goNE&^NAwcbn?D$ZOitD@# z6#N#1?};|{fmKABxA5NGj7)6JOP4uQyV4}c*M>qEDX%JWqv%exoR)aB^OdU*9cO9R zzMVoE%&bqZd_%fw>6A(7q$NGefF0)vh49U49PdR+|8Q}3=@Jg$Fh0uD4(jrJ%YZ3& z(00!<1`l4a+)ELXym9YD|?LTI^C=tnlP8E$4X-=z?)fIEYD)sSX?m=~z# zOi5XhNKX!k{lN*`V>TppabF>msR85OJ};J-uob6w$WU&v>cC88WWpMQ?O>ALV==Vr z84F=;?X9w1#uD_NUfv#2|V!- zhdK@g(qJ@DHar7eSWEZ5TJen0soQWnF_{3DYOV+$=j!rm4^>wxYFn!pZ#WE|m4Qnu z(;-|bsyg*$1)sOX07M`ZGeAT^v&A#;J74ywpnI=Bkuona@+dFvCSv6hJT!4Ct{N>v zC?2=%Fan01F`P)uvOwni+QXJVua)sk%o}|os>QYpitBtuegHIRIBTsOH<1P{*7lY` z0J!4-BSo{N_Yu(mgVxr!pO&c^b`t!E%qq9}tkR3UB{Px1jviu&E{iAM2zY&#r4C!b zXL_K15B~F(K1>Vr7)Cx&z}wjXG!`-ceoKFucE3AT|Mq$rtFUZ2_7eS0mKq(-wsk>~ z6^#R*k$umN1zUzJDIvlf27u(+Aka}CqhUKwf5U&h7DB;y1$6~nahcER`+^&fr4e1G z9J_6&%rAR-+<{tw^oZfkvop^OXPK$|c2&3C2DAK~9fb{us50&2v=HglE1`EO+S$*!OgLm= z)EF9JC1Kdc=nU7OX}wc~D$1m(C~gpz@@#_#sT*ojam=yui1OewaVn zAAcWK|Ff<14=)@0uf|^@-^pq~XFrjG=;YBg$e^!;Kq+&gR(ke|N>z09b!I0n6-+eb z35FZUGMJ&=%S7w1+o9oW!kkBvu;|js?TqW`6|N4KZibE(4O}gEZnucU{-P*DfvjVw z7^6Oc66Jyn{#MehWnS}|EHpx`30^#)-J(v`a(;ogpoGv8j1$S06GFuOBdKFynq-E( zh0f$rLxqvq%^yij3#pY9F!kSOU|W|Hs<2Hq_ApNFo86VZCD*3^7y^tr?G$xW&_2=* zajJnw8+@Xu-51@NK2~AlA<3@T%mB-~pyglPX{x|Pq4fR@pjtUN0)8wsms*UO0SgvZ zEsXO9n-ei$?F@iKA1*25Oa?DgAID_S@xn5xpae#OxpJ=29fMk?-DNgeJ$ku6vax8B z6leTpm1d*n*!F=l4*T^=To}HbCJv!H*J3$ko|KR@mce9mlQ|mJ=ZGip`-WduQ#(S` zx>jAVHl;%ueBr&-hnWI#+y{DTqG?JK-Z3XXNh5^uNQqt%F7y&drC=g|quvfr$YRH3 z;Hxt@8fiFJpKEE_6C+?q9_uGvJ4lfHe$Kw}O*N>SIJu~27@NT~yuHG1Tm##uc-D^3 z`Evzv2?uy+^W~ZNVfj(IpEulvHjgw#l|owCv$&%x)N)=zhl=G(1(+Cx@-?v3ykH|r zjOMtW;3UmJ9HyoamfMYxC@rE^v%NRVmuLkID|njO#Bb49cXc551-N#cAXFc>g!lz#c!*cms6Hu92S)vn*f%dor$7py^pzV>xhvW| z%`5Ml>$~*N$AYSek+~$j4x_adP}Yg_hiwh`u+b8G%PQ=L__b@>UI$$2vv8Fa2H-Qa z1F0GAqux9)n&KRFZFP8^byPc4ptUeH;qT8dwO%L~ea(K;HHfHJvK=rh1XF7T@+>2K zC7}zV_yZS~&`iHc%UdQdI1x%Ju%WZHJ+eNftm)^ZE`jaS0+hPgPdrV!kSUwuceFl> ztHYxaVgZ73pRc|C`%@|Jq+clxRPv(04-xS5JrMx#sQdp%5&%|}KO_Oz{9EY%C!pwH zf9*}U0H+)v@&AUs2danf1sUW}@ZqbBsG=afq^ub5r2gNl6%Fcq6aoG~4fsKS_~rMK z?ftM^{NHLag0hlgq6&)7WW*jLJX8Qqb^lX<)7|%i4DwAd9r)eS#_%`JhoAhY0bDnI zFAp_3fZrc#{3XJFtq6=+`b)*5zgPU8gyA;;BOiUhd*DwefuE<}t3O;Sy-9#CV81Z` z01yENJTNjf0RmZ2;hJJ4e;@69q!XnWar0>+Xt$)1wfj4;D_`F9q?M|?Fwwe9~dQn^x>~n=3_kYe3wN{U|Z#Zwdwzc zX8<%7{{io>{PRk{`12B$<_0e;ElusM{tS)3rZwLM1i1l@(uW=4AEnY89+;2o575A% zzh?Hfz=LIC#%2bBdU^)7wlX>vI)*<|Ej(_!Ua5Ee8(`a!fd;+5x1AL6j|3_y?2G2LVdwL1p|XmEItje?)&_Y50#)7`E9D#sE5+SOEL{a4zacsq~HpW&!zwnE#ge z?$6!Ntl?F|0%p%JCjo96`~U=AE4>eZ?fnBL@Km6kj+xn?(H2`@1a$(184FZQf4@(H z41Yuuvb3~&$h%=Bqho9VG`jxGw()ofw22b;3j^;_6;N&uITL=AO7EAfe}w)%1Vo(- z^z8pPeEMTlKiurXav-V@P=GW)Ac5CP?^(V-qW<+ze8+xh^q&Q>_9)5i59mtoamhd8 zei!RMsh`JL4u9g2zWgKJ-){Xsoj_`L|v^#ISi>`EeGRAJr?p zrGKyd!%yIs_w`5C*T?XWGlTqupVI!VZNI>NUtKc&J{liZsgHAT{6uYk{U1>OB_qe< z_CL;b@RO-i_dhWG>L~>5oz<_I4<1uJ4mJOis?6ZusQw}F{A2jXG1Gs-iy8hK{P#QY zZxPfVQ#}s8`jg7Y@;^}hCA9xbT#w^d{v-*u`41%j9?kM`j~<8n`$^Vo|8Hc!Zbv`H zd>m}*CuW-KzhQpAA%8*t^~W!}dyiQjM>YD%lI;E)%m1ML9^>dS=HrM8KQV3J{*L+I z<10Mod3?(MCy#i*Z#=&%kNi>ZM&o; \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/msvc/reapi.sln b/msvc/reapi.sln new file mode 100644 index 0000000..0febdbb --- /dev/null +++ b/msvc/reapi.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reapi", "..\reapi\msvc\reapi.vcxproj", "{74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}.Debug|Win32.ActiveCfg = Debug|Win32 + {74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}.Debug|Win32.Build.0 = Debug|Win32 + {74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}.Release|Win32.ActiveCfg = Release|Win32 + {74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/publish.gradle b/publish.gradle new file mode 100644 index 0000000..0ca227e --- /dev/null +++ b/publish.gradle @@ -0,0 +1,44 @@ +import org.doomedsociety.gradlecpp.GradleCppUtils +import org.apache.commons.io.FilenameUtils + +void _copyFileToDir(String from, String to) { + def dst = new File(project.file(to), FilenameUtils.getName(from)) + GradleCppUtils.copyFile(project.file(from), dst, false) +} + +void _copyFile(String from, String to) { + GradleCppUtils.copyFile(project.file(from), project.file(to), false) +} + +task publishPrepareFiles << { + def pubRootDir = project.file('publish/publishRoot') + if (pubRootDir.exists()) { + if (!pubRootDir.deleteDir()) { + throw new RuntimeException("Failed to delete ${pubRootDir}") + } + } + + pubRootDir.mkdirs() + + project.file('publish/publishRoot/reapi/addons/amxmodx/modules').mkdirs() + //project.file('publish/publishRoot/reapi/addons/amxmodx/scripting/include').mkdirs() + + _copyFileToDir('publish/reapi_amxx.dll', 'publish/publishRoot/reapi/addons/amxmodx/modules/') + _copyFile('publish/libreapi_amxx_i386.so', 'publish/publishRoot/reapi/addons/amxmodx/modules/reapi_amxx_i386.so') + + copy { + from 'reapi/extra' + into 'publish/publishRoot/reapi/addons' + } +} + +task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') { + baseName = "reapi_${project.version}" + destinationDir file('publish') + from 'publish/publishRoot/reapi' +} + +task doPackage { + dependsOn 'publishPackage' + +} diff --git a/reapi/build.gradle b/reapi/build.gradle new file mode 100644 index 0000000..4bbadf0 --- /dev/null +++ b/reapi/build.gradle @@ -0,0 +1,177 @@ +import org.doomedsociety.gradlecpp.GradleCppUtils +import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin +import org.doomedsociety.gradlecpp.toolchain.icc.Icc +import org.doomedsociety.gradlecpp.cfg.ToolchainConfig +import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig +import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils +import org.gradle.language.cpp.CppSourceSet +import org.gradle.language.rc.tasks.WindowsResourceCompile +import org.gradle.nativeplatform.NativeBinarySpec +import versioning.ReapiVersionInfo +import gradlecpp.VelocityUtils + +apply plugin: 'cpp' +apply plugin: 'windows-resources' +apply plugin: IccCompilerPlugin + +List getRcCompileTasks(NativeBinarySpec binary) { + def linkTask = GradleCppUtils.getLinkTask(binary) + + def res = linkTask.taskDependencies.getDependencies(linkTask).findAll { Task t -> t instanceof WindowsResourceCompile } + return res as List +} + +void postEvaluate(NativeBinarySpec b) { + if (GradleCppUtils.windows) { + getRcCompileTasks(b).each { Task t -> + t.dependsOn project.generateAppVersion + } + } else { + // attach generateAppVersion task to all 'compile source' tasks + GradleCppUtils.getCompileTasks(b).each { Task t -> + t.dependsOn project.generateAppVersion + } + } +} + +void setupToolchain(NativeBinarySpec b) { + ToolchainConfig cfg = rootProject.createToolchainConfig(b) + cfg.projectInclude(project, '', '/src', '/include', '/include/metamod', '/include/cssdk/common', '/include/cssdk/dlls', '/include/cssdk/engine', '/include/cssdk/game_shared', '/include/cssdk/pm_shared', '/include/cssdk/public') + + if (cfg instanceof MsvcToolchainConfig) { + cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( + enabled: true, + pchHeader: 'precompiled.h', + pchSourceSet: 'reapi_pch' + ) + cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-' + cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') + cfg.extraLibs 'ws2_32.lib' + } else if (cfg instanceof GccToolchainConfig) { + cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( + enabled: true, + pchSourceSet: 'reapi_pch' + ) + cfg.compilerOptions.languageStandard = 'c++0x' + cfg.defines([ + '_stricmp': 'strcasecmp', + '_strnicmp': 'strncasecmp', + '_vsnprintf': 'vsnprintf', + '_snprintf': 'snprintf' + ]) + + cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-msse2', '-fp-model fast', '-fomit-frame-pointer', '-fvisibility=hidden', '-fvisibility-inlines-hidden', '-fno-rtti', '-g0', '-s' + } + + ToolchainConfigUtils.apply(project, cfg, b) + + GradleCppUtils.onTasksCreated(project, 'postEvaluate', { + postEvaluate(b) + }) +} + +model { + buildTypes { + debug + release + } + + platforms { + x86 { + architecture "x86" + } + } + + toolChains { + visualCpp(VisualCpp) { + } + icc(Icc) { + } + } + + components { + reapi(NativeLibrarySpec) { + targetPlatform 'x86' + baseName GradleCppUtils.windows ? 'reapi_amxx' : 'reapi_amxx_i386' + + sources { + reapi_pch(CppSourceSet) { + source { + srcDirs "src" + include "precompiled.cpp" + } + + exportedHeaders { + srcDirs "include", "version" + } + } + reapi_src(CppSourceSet) { + source { + srcDirs "src", "public", "include/cssdk/public" + include "**/*.cpp" + + exclude "precompiled.cpp" + exclude "engine_api.cpp" + } + + exportedHeaders { + srcDirs "include", "version" + } + } + rc { + source { + srcDir "msvc" + include "reapi.rc" + } + exportedHeaders { + srcDirs "msvc" + } + } + } + + binaries.all { + NativeBinarySpec b -> project.setupToolchain(b) + } + } + } +} + +afterEvaluate { + project.binaries.all { + NativeBinarySpec binary -> + Tool linker = binary.linker + + if (GradleCppUtils.windows) { + linker.args "/DEF:${projectDir}\\msvc\\reapi.def" + } + } +} + +task buildRelease { + dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> + blib.buildable && blib.buildType.name == 'release' + } +} + +tasks.clean.doLast { + project.file('version/appversion.h').delete() +} + +task generateAppVersion { + + ReapiVersionInfo verInfo = (ReapiVersionInfo) rootProject.reapiVersionInfo + def tplversionFile = project.file('version/appversion.vm') + def versionFile = project.file('version/appversion.h') + + inputs.file tplversionFile + inputs.file project.file('gradle.properties') + outputs.file versionFile + + doLast { + + def versionContent = VelocityUtils.renderTemplate(tplversionFile, verInfo) + versionFile.delete() + versionFile.write(versionContent, 'utf-8') + } +} diff --git a/reapi/extra/amxmodx/scripting/include/reapi.inc b/reapi/extra/amxmodx/scripting/include/reapi.inc new file mode 100644 index 0000000..e356092 --- /dev/null +++ b/reapi/extra/amxmodx/scripting/include/reapi.inc @@ -0,0 +1,102 @@ +#if defined _reapi_included + #endinput +#endif + +#define _reapi_included + +#if AMXX_VERSION_NUM >= 175 + #pragma reqlib reapi + #if !defined AMXMODX_NOAUTOLOAD + #pragma loadlib reapi + #endif +#else + #pragma library reapi +#endif + +#include +#include // NOTE: only for ReHLDS +#include // NOTE: only for gamedll Counter-Strike (ReGameDLL_CS) + +enum +{ + RH_UNSET = 0, + RH_IGNORED, // plugin didn't take any action + RH_HANDLED, // plugin did something, but real function should still be called + RH_OVERRIDE, // call real function, but use my return value + RH_SUPERCEDE // skip real function; use my return value +}; + +// for hookchain return +enum HookChainReturn +{ + RHV_STRING = 0, // string + RHV_FLOAT, // float + RHV_INTEGER, // returns an integer or boolean + RHV_CLASSPTR // for CBaseEntity *, CBasePlayer * etc +}; + +/* + * Hook API function that are available into enum + * Look at the enum's for parameter lists. + * + * @param function The function to hook. + * @param callback The forward to call. + * @param post Whether or not to forward this in post. + * @return Returns a handle to the hook. Use EnableHookChain/DisableHookChain to toggle the forward on or off. + * + */ + +native HookChain:RegisterHookChain(any:function_id, const callback[], post = 0); + +/* + * Stops a hook from triggering. + * Use the return value from RegisterHookChain as the parameter here! + * + * @param hook The hook to stop. + * + */ + +native bool:DisableHookChain(HookChain:hook); + +/* + * Starts a hook back up. + * Use the return value from RegisterHookChain as the parameter here! + * + * @param hook The hook to re-enable. + * @return Returns if the function is successful executed true otherwise false + * + */ + +native bool:EnableHookChain(HookChain:hook); + +/* + * Sets the return value of a hookchain. + * This needs to be used in conjunction with RH_OVERRIDE or RH_SUPERCEDE. + * + * @param type To specify the type RHV_*, look at the enum HookChainReturn + * @param value The value to set the return to. + * + * native SetHookChainReturn(HookChainReturn:type, any:...); + */ + +native SetHookChainReturn(HookChainReturn:type, any:...); + +/* +* This is the callback from the module that gives major/minor versions for verifying compatibility reapi API versions +* If will be amxx plugin a failure, then you do need to upgrade to the latest version of the module reapi or do update files included for amxx plugins +* Do not modify this! +*/ +public __reapi_version_check(const majorVersion, const minorVersion) +{ + if (majorVersion != REAPI_VERISON_MAJOR) + { + set_fail_state("[ReAPI]: Api major version mismatch; expected %d, real %d", REAPI_VERISON_MAJOR, majorVersion); + return; + } + + if (minorVersion < REAPI_VERISON_MINOR) + { + set_fail_state("[ReAPI]: Api minor version mismatch; expected at least %d, real %d", REAPI_VERISON_MINOR, minorVersion); + return; + } +} diff --git a/reapi/extra/amxmodx/scripting/include/reapi_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_const.inc new file mode 100644 index 0000000..16c7a3b --- /dev/null +++ b/reapi/extra/amxmodx/scripting/include/reapi_const.inc @@ -0,0 +1,8 @@ +#if defined _reapi_const_included + #endinput +#endif +#define _reapi_const_included + +// reapi version +#define REAPI_VERISON_MAJOR 1 +#define REAPI_VERISON_MINOR 0 diff --git a/reapi/extra/amxmodx/scripting/include/reapi_engine.inc b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc new file mode 100644 index 0000000..79c0e27 --- /dev/null +++ b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc @@ -0,0 +1,35 @@ +#if defined _reapi_engine_included + #endinput +#endif + +#define _reapi_engine_included + +enum EngineFunc +{ + /** + * Description: - + * Params: (const recipients, const entity, const channel, const sample[], const volume, Float:attenuation, const fFlags, const pitch) + */ + RH_SV_StartSound = 0, + + /** + * Description: - + * Params: (const client, bool:crash, const fmt[]) + */ + RH_SV_DropClient, + + /** + * Description: - + * Params: (const runPhysics) + */ + RH_SV_ActivateServer, + + /** + * Description: - + * Params: (pcvar, const value[]) + */ + RH_Cvar_DirectSet, + + // [...] + RH_EngineFunc_End +}; diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc new file mode 100644 index 0000000..c355d2d --- /dev/null +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc @@ -0,0 +1,54 @@ +#if defined _reapi_gamedll_included + #endinput +#endif + +#define _reapi_gamedll_included + +#include + +/* +* Sets a value to an CSGameRules_Members members +* +* @param member The specified member, look at the enum's with name CSGameRules_Members +* +* @return 1 on success. +*/ +native set_member_game(CSGameRules_Members:member, any:...); + +/* +* Returns a value from an CSGameRules_Members members +* +* @param member The specified member, look at the enum's with name CSGameRules_Members +* +* @return If an integer or boolean or one byte, array or everything else is passed via 3rd argument and more, look at argument list for specified member +* +*/ +native any:get_member_game(CSGameRules_Members:member, any:...); + +/* +* Sets a value to an entity's member +* +* @param index Entity index +* @param member The specified member, look at the enum's with name *_Members +* +* @return 1 on success. +*/ +native set_member(index, any:member, any:...); + +/* +* Returns a value from an entity's member +* +* @param index Entity index +* @param member The specified member, look at the enum's with name *_Members +* +* @return If an integer or boolean or one byte, array or everything else is passed via 3rd argument and more, look at argument list for specified member +* +* An integer: new iTeam = get_member(id, m_iTeam); +* +* String array: new szName[32]; +* get_member(id, m_szNewName, charsmax(m_szNewName)); +* +* An int array: new iAmmoIndex = get_member(id, m_rgAmmo, 5); // number of the element +* +*/ +native any:get_member(index, any:member, any:...); diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc new file mode 100644 index 0000000..77cca3c --- /dev/null +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -0,0 +1,2321 @@ +#if defined _reapi_gamedll_const_included + #endinput +#endif + +#define _reapi_gamedll_const_included + +// flags for CUnifiedSignals m_signals +#define SIGNAL_BUY (1<<0) +#define SIGNAL_BOMB (1<<1) +#define SIGNAL_RESCUE (1<<2) +#define SIGNAL_ESCAPE (1<<3) +#define SIGNAL_VIPSAFETY (1<<4) + +enum GamedllFunc +{ + /** + * Description: - + * Return type: int + * Params: (const pObserver) + */ + RH_GetForceCamera = 1024, + + // [...] + RH_GameDLL_End +}; + +enum GamedllFunc_CBasePlayer +{ + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_Spawn = 2048, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_Precache, + + /** + * Description: - + * Return type: int + * Params: (const this) + */ + RH_CBasePlayer_ObjectCaps, + + + /** + * Description: - + * Return type: int + * Params: (const this) + */ + RH_CBasePlayer_Classify, + + /** + * Description: - + * Params: (const this, pevAttacker, Float:flDamage, Float:vecDir[3], tracehandle, bitsDamageType) + */ + RH_CBasePlayer_TraceAttack, + + /** + * Description: - + * Return type: int + * Params: (const this, pevInflictor, pevAttacker, Float:flDamage, bitsDamageType) + */ + RH_CBasePlayer_TakeDamage, + + /** + * Description: - + * Params: (const this, Float:flHealth, bitsDamageType) + */ + RH_CBasePlayer_TakeHealth, + + /** + * Description: - + * Params: (const this, pevAttacker, iGib) + */ + RH_CBasePlayer_Killed, + + /** + * Description: - + * Params: (const this, score, bAllowNegativeScore) + */ + RH_CBasePlayer_AddPoints, + + /** + * Description: - + * Params: (const this, score, bAllowNegativeScore) + */ + RH_CBasePlayer_AddPointsToTeam, + + /** + * Description: - + * Return type: BOOL + * Params: (const this, const pItem) + */ + RH_CBasePlayer_AddPlayerItem, + + /** + * Description: - + * Return type: BOOL + * Params: (const this, const pItem) + */ + RH_CBasePlayer_RemovePlayerItem, + + /** + * Description: - + * Return type: int + * Params: (const this, iAmount, szName[], iMax) + */ + RH_CBasePlayer_GiveAmmo, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_ResetMaxSpeed, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_Jump, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_Duck, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_PreThink, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_PostThink, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_UpdateClientData, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_ImpulseCommands, + + /** + * Description: - + * Params: (const this) + */ + RH_CBasePlayer_RoundRespawn, + + /** + * Description: - + * Params: (const this, Float:flUntilTime, Float:flHoldTime, Float:flFadeTime, iAlpha) + */ + RH_CBasePlayer_Blind, + + /** + * Description: - + * Params: (const this, iPlayerIndex, bool:bSameTeam) + */ + RH_CBasePlayer_Observer_IsValidTarget, + + // [...] + RH_CBasePlayer_End +}; + +// CSGameRules +enum CSGameRules_Members +{ + /** + * Description: - + * Member type: BOOL + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bFreezePeriod = 0, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bBombDropped, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_msgPlayerVoiceMask, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_msgRequestState, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_nMaxPlayers, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_UpdateInterval, + + /** + * Description: The global time when the round is supposed to end, if this is not 0 + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_fTeamCount, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flCheckWinConditions, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_fRoundCount, + + /** + * Description: How many seconds long this round is. + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iRoundTime, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iRoundTimeSecs, + + /** + * Description: (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is. + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iIntroRoundTime, + + /** + * Description: The global time when the intro round ends + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_fIntroRoundCount, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iAccountTerrorist, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iAccountCT, + + /** + * Description: The number of terrorists on the team (this is generated at the end of a round) + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumTerrorist, + + /** + * Description: The number of CTs on the team (this is generated at the end of a round) + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumCT, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumSpawnableTerrorist, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumSpawnableCT, + + /** + * Description: Number of Terrorist spawn points + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iSpawnPointCount_Terrorist, + + /** + * Description: Number of CT spawn points + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iSpawnPointCount_CT, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iHostagesRescued, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iHostagesTouched, + + /** + * Description: 1 == CT's won last round, 2 == Terrorists did, 3 == Draw, no winner + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iRoundWinStatus, + + /** + * Description: - + * Member type: short + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumCTWins, + + /** + * Description: - + * Member type: short + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumTerroristWins, + + /** + * Description: whether or not the bomb has been bombed + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, bool:value); + */ + m_bTargetBombed, + + /** + * Description: whether or not the bomb has been defused + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bBombDefused, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bMapHasBombTarget, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bMapHasBombZone, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bMapHasBuyZone, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bMapHasRescueZone, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bMapHasEscapeZone, + + /** + * Description: 0 = uninitialized, 1 = has VIP safety zone, 2 = DOES not have VIP safetyzone + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iMapHasVIPSafetyZone, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bMapHasCameras, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iC4Timer, + + /** + * Description: The current Terrorist who has the C4. + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iC4Guy, + + /** + * Description: the amount of money the losing team gets. This scales up as they lose more rounds in a row + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iLoserBonus, + + /** + * Description: the number of rounds the CTs have lost in a row. + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumConsecutiveCTLoses, + + /** + * Description: the number of rounds the Terrorists have lost in a row. + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumConsecutiveTerroristLoses, + + /** + * Description: For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_fMaxIdlePeriod, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iLimitTeams, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bLevelInitialized, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bRoundTerminating, + + /** + * Description: Set to TRUE to have the scores reset next time round restarts + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bCompleteReset, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flRequiredEscapeRatio, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumEscapers, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iHaveEscaped, + + /** + * Description: Who can and can't buy. + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bCTCantBuy, + + /** + * Description: Who can and can't buy. + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bTCantBuy, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flBombRadius, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iConsecutiveVIP, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iTotalGunCount, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iTotalGrenadeCount, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iTotalArmourCount, + + /** + * Description: keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2 + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iUnBalancedRounds, + + /** + * Description: keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iNumEscapeRounds, + + /** + * Description: - + * Member type: int [100] + * Get params: get_member_game(member); + * Set params: set_member_game(member, value, element); + */ + m_iMapVotes, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iLastPick, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iMaxMapTime, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iMaxRounds, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iTotalRoundsPlayed, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iMaxRoundsWon, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iStoredSpectValue, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flForceCameraValue, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flForceChaseCamValue, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flFadeToBlackValue, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_pVIP, + + /** + * Description: - + * Member type: int [5] + * Get params: get_member_game(member); + * Set params: set_member_game(member, value, element); + */ + m_pVIPQueue, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flIntermissionEndTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_flIntermissionStartTime, + + + /** + * Description: - + * Member type: BOOL + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iEndIntermissionButtonHit, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_tmNextPeriodicThink, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bFirstConnected, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bInCareerGame, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_fCareerRoundMenuTime, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iCareerMatchWins, + + /** + * Description: - + * Member type: int + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_iRoundWinDifference, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member_game(member); + * Set params: set_member_game(member, Float:value); + */ + m_fCareerMatchMenuTime, + + /** + * Description: - + * Member type: bool + * Get params: get_member_game(member); + * Set params: set_member_game(member, value); + */ + m_bSkipSpawn +}; + +// CBasePlayer +enum CBasePlayer_Members +{ + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + random_seed = 1024, + + /** + * Description: - + * Member type: unsigned short + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_usPlayerBleed, + + /** + * Description: - + * Member type: class EHANDLE + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_hObserverTarget, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flNextObserverInput, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iObserverWeapon, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iObserverC4State, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bObserverHasDefuser, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iObserverLastMode, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flFlinchTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flAnimTime, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bHighDamage, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flVelocityModifier, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iLastZoom, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bResumeZoom, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flEjectBrass, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iKevlar, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bNotKilled, + + /** + * Description: - + * Member type: enum TeamName + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iTeam, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iAccount, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bHasPrimary, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flDeathThrowTime, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iThrowDirection, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flLastTalk, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bJustConnected, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bContextHelp, + + /** + * Description: - + * Member type: enum JoinState + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iJoiningState, + + /** + * Description: - + * Member type: class CBaseEntity * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pIntroCamera, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_fIntroCamTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_fLastMovement, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bMissionBriefing, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bTeamChanged, + + /** + * Description: - + * Member type: enum ModelName + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iModelName, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iTeamKills, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iIgnoreGlobalChat, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bHasNightVision, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bNightVisionOn, + + /** + * Description: - + * Member type: class Vector [20] + * Get params: get_member(index, member, Float:output[3], element); + * Set params: set_member(index, member, Float:dest[3], element); + */ + m_vRecentPath, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flIdleCheckTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flRadioTime, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iRadioMessages, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bIgnoreRadio, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bHasC4, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bHasDefuser, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bKilledByBomb, + + /** + * Description: - + * Member type: class Vector + * Get params: get_member(index, member, Float:output[3]); + * Set params: set_member(index, member, Float:dest[3]); + */ + m_vBlastVector, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bKilledByGrenade, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_flDisplayHistory, + + /** + * Description: - + * Member type: enum _Menu + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iMenu, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iChaseTarget, + + /** + * Description: - + * Member type: class CBaseEntity * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pChaseTarget, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_fCamSwitch, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bEscaped, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bIsVIP, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_tmNextRadarUpdate, + + /** + * Description: - + * Member type: class Vector + * Get params: get_member(index, member, Float:output[3]); + * Set params: set_member(index, member, Float:dest[3]); + */ + m_vLastOrigin, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iCurrentKickVote, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flNextVoteTime, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bJustKilledTeammate, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iHostagesKilled, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iMapVote, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bCanShoot, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flLastFired, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flLastAttackedTeammate, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bHeadshotKilled, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bPunishedForTK, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bReceivesNoMoneyNextRound, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iTimeCheckAllowed, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bHasChangedName, + + /** + * Description: - + * Member type: char [32] + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_szNewName, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bIsDefusing, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_tmHandleSignals, + + /** + * Description: - + * Member type: class CUnifiedSignals + * Get params: get_member(index, member, &signal, &state); + * Set params: set_member(index, member, value); + */ + m_signals, + + /** + * Description: - + * Member type: struct edict_s * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pentCurBombTarget, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iPlayerSound, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iTargetVolume, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iWeaponVolume, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iExtraSoundTypes, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iWeaponFlash, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flStopExtraSoundTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flFlashLightTime, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iFlashBattery, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_afButtonLast, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_afButtonPressed, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_afButtonReleased, + + /** + * Description: - + * Member type: struct edict_s * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pentSndLast, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flSndRoomtype, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flSndRange, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flFallVelocity, + + /** + * Description: - + * Member type: int [4] + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_rgItems, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_fNewAmmo, + + /** + * Description: - + * Member type: unsigned int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_afPhysicsFlags, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_fNextSuicideTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flTimeStepSound, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flTimeWeaponIdle, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flSwimTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flDuckTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flWallJumpTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flSuitUpdate, + + /** + * Description: - + * Member type: int [4] + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_rgSuitPlayList, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iSuitPlayNext, + + /** + * Description: - + * Member type: int [32] + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_rgiSuitNoRepeat, + + /** + * Description: - + * Member type: float [32] + * Get params: Float:get_member(index, member, element); + * Set params: set_member(index, member, Float:value, element); + */ + m_rgflSuitNoRepeatTime, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_lastDamageAmount, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_tbdPrev, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flgeigerRange, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flgeigerDelay, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_igeigerRangePrev, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iStepLeft, + + /** + * Description: - + * Member type: char [17] + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_szTextureName, + + /** + * Description: - + * Member type: char + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_chTextureType, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_idrowndmg, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_idrownrestored, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bitsHUDDamage, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_fInitHUD, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_fGameHUDInitialized, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iTrain, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_fWeapon, + + /** + * Description: - + * Member type: class EHANDLE + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pTank, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_fDeadTime, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_fNoPlayerSound, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_fLongJump, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_tSneaking, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iUpdateTime, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iClientHealth, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iClientBattery, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iHideHUD, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iClientHideHUD, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iFOV, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iClientFOV, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iNumSpawns, + + /** + * Description: - + * Member type: class CBaseEntity * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pObserver, + + /** + * Description: - + * Member type: class CBasePlayerItem *[6] + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_rgpPlayerItems, + + /** + * Description: - + * Member type: class CBasePlayerItem * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pActiveItem, + + /** + * Description: - + * Member type: class CBasePlayerItem * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pClientActiveItem, + + /** + * Description: - + * Member type: class CBasePlayerItem * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pLastItem, + + /** + * Description: - + * Member type: int [32] + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_rgAmmo, + + /** + * Description: - + * Member type: int [32] + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_rgAmmoLast, + + /** + * Description: - + * Member type: class Vector + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_vecAutoAim, + + /** + * Description: - + * Member type: BOOL + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_fOnTarget, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iDeaths, + + /** + * Description: - + * Member type: int [4] + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_izSBarState, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flNextSBarUpdateTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flStatusBarDisappearDelay, + + /** + * Description: - + * Member type: char [128] + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_SbarString0, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_lastx, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_lasty, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_nCustomSprayFrames, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flNextDecalTime, + + /** + * Description: - + * Member type: char [16] + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_szTeamName, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_modelIndexPlayer, + + /** + * Description: - + * Member type: char [32] + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_szAnimExtention, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iGaitsequence, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flGaitframe, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flGaityaw, + + /** + * Description: - + * Member type: class Vector + * Get params: get_member(index, member, element); + * Set params: set_member(index, member, value, element); + */ + m_prevgaitorigin, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flPitch, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flYaw, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flGaitMovement, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_iAutoWepSwitch, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bVGUIMenus, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bShowHints, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bShieldDrawn, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bOwnsShield, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bWasFollowing, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flNextFollowTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flYawModifier, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_blindUntilTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_blindStartTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_blindHoldTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_blindFadeTime, + + /** + * Description: - + * Member type: int + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_blindAlpha, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_allowAutoFollowTime, + + /** + * Description: - + * Member type: char [256] + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_autoBuyString, + + /** + * Description: - + * Member type: char * + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_rebuyString, + + /** + * Description: - + * Member type: struct RebuyStruct + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_rebuyStruct, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bIsInRebuy, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_flLastUpdateTime, + + /** + * Description: - + * Member type: char [32] + * Get params: Float:get_member(index, member, const dest[], const lenght); + * Set params: set_member(index, member, const dest[]); + */ + m_lastLocation, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_progressStart, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_progressEnd, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_bObserverAutoDirector, + + /** + * Description: - + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_canSwitchObserverModes, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_heartBeatTime, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_intenseTimestamp, + + /** + * Description: - + * Member type: float + * Get params: Float:get_member(index, member); + * Set params: set_member(index, member, Float:value); + */ + m_silentTimestamp, + + /** + * Description: - + * Member type: enum MusicState + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_musicState, + + /** + * Description: - + * Member type: float [8] + * Get params: Float:get_member(index, member, element); + * Set params: set_member(index, member, Float:value, element); + */ + m_flLastCommandTime +}; diff --git a/reapi/extra/amxmodx/scripting/reapi_test.sma b/reapi/extra/amxmodx/scripting/reapi_test.sma new file mode 100644 index 0000000..7b05600 --- /dev/null +++ b/reapi/extra/amxmodx/scripting/reapi_test.sma @@ -0,0 +1,14 @@ +#include +#include + +public plugin_init() +{ + register_plugin("ReAPI Test", "1.0", "s1lent"); + RegisterHookChain(RH_CBasePlayer_GiveAmmo, "CBasePlayer_GiveAmmo"); +} + +public CBasePlayer_GiveAmmo(const this, iAmount, szName[], iMax) +{ + server_print(" -> CBasePlayer_GiveAmmo: index:(%d), amount:(%d), name:(%s), max:(%d)", this, iAmount, szName, iMax); + return RH_IGNORED; +} diff --git a/reapi/include/cssdk/common/IGameServerData.h b/reapi/include/cssdk/common/IGameServerData.h new file mode 100644 index 0000000..d431f00 --- /dev/null +++ b/reapi/include/cssdk/common/IGameServerData.h @@ -0,0 +1,15 @@ +#pragma once + +#include "maintypes.h" +#include "interface.h" + +class IGameServerData : public IBaseInterface { +public: + virtual ~IGameServerData() { }; + + virtual void WriteDataRequest(const void *buffer, int bufferSize) = 0; + + virtual int ReadDataResponse(void *data, int len) = 0; +}; + +#define GAMESERVERDATA_INTERFACE_VERSION "GameServerData001" diff --git a/reapi/include/cssdk/common/Sequence.h b/reapi/include/cssdk/common/Sequence.h new file mode 100644 index 0000000..8df553d --- /dev/null +++ b/reapi/include/cssdk/common/Sequence.h @@ -0,0 +1,201 @@ +//--------------------------------------------------------------------------- +// +// S c r i p t e d S e q u e n c e s +// +//--------------------------------------------------------------------------- +#ifndef _INCLUDE_SEQUENCE_H_ +#define _INCLUDE_SEQUENCE_H_ + + +#ifndef _DEF_BYTE_ +typedef unsigned char byte; +#endif + +//--------------------------------------------------------------------------- +// client_textmessage_t +//--------------------------------------------------------------------------- +typedef struct client_textmessage_s +{ + int effect; + byte r1, g1, b1, a1; // 2 colors for effects + byte r2, g2, b2, a2; + float x; + float y; + float fadein; + float fadeout; + float holdtime; + float fxtime; + const char *pName; + const char *pMessage; +} client_textmessage_t; + + +//-------------------------------------------------------------------------- +// sequenceDefaultBits_e +// +// Enumerated list of possible modifiers for a command. This enumeration +// is used in a bitarray controlling what modifiers are specified for a command. +//--------------------------------------------------------------------------- +enum sequenceModifierBits +{ + SEQUENCE_MODIFIER_EFFECT_BIT = (1 << 1), + SEQUENCE_MODIFIER_POSITION_BIT = (1 << 2), + SEQUENCE_MODIFIER_COLOR_BIT = (1 << 3), + SEQUENCE_MODIFIER_COLOR2_BIT = (1 << 4), + SEQUENCE_MODIFIER_FADEIN_BIT = (1 << 5), + SEQUENCE_MODIFIER_FADEOUT_BIT = (1 << 6), + SEQUENCE_MODIFIER_HOLDTIME_BIT = (1 << 7), + SEQUENCE_MODIFIER_FXTIME_BIT = (1 << 8), + SEQUENCE_MODIFIER_SPEAKER_BIT = (1 << 9), + SEQUENCE_MODIFIER_LISTENER_BIT = (1 << 10), + SEQUENCE_MODIFIER_TEXTCHANNEL_BIT = (1 << 11), +}; +typedef enum sequenceModifierBits sequenceModifierBits_e ; + + +//--------------------------------------------------------------------------- +// sequenceCommandEnum_e +// +// Enumerated sequence command types. +//--------------------------------------------------------------------------- +enum sequenceCommandEnum_ +{ + SEQUENCE_COMMAND_ERROR = -1, + SEQUENCE_COMMAND_PAUSE = 0, + SEQUENCE_COMMAND_FIRETARGETS, + SEQUENCE_COMMAND_KILLTARGETS, + SEQUENCE_COMMAND_TEXT, + SEQUENCE_COMMAND_SOUND, + SEQUENCE_COMMAND_GOSUB, + SEQUENCE_COMMAND_SENTENCE, + SEQUENCE_COMMAND_REPEAT, + SEQUENCE_COMMAND_SETDEFAULTS, + SEQUENCE_COMMAND_MODIFIER, + SEQUENCE_COMMAND_POSTMODIFIER, + SEQUENCE_COMMAND_NOOP, + + SEQUENCE_MODIFIER_EFFECT, + SEQUENCE_MODIFIER_POSITION, + SEQUENCE_MODIFIER_COLOR, + SEQUENCE_MODIFIER_COLOR2, + SEQUENCE_MODIFIER_FADEIN, + SEQUENCE_MODIFIER_FADEOUT, + SEQUENCE_MODIFIER_HOLDTIME, + SEQUENCE_MODIFIER_FXTIME, + SEQUENCE_MODIFIER_SPEAKER, + SEQUENCE_MODIFIER_LISTENER, + SEQUENCE_MODIFIER_TEXTCHANNEL, +}; +typedef enum sequenceCommandEnum_ sequenceCommandEnum_e; + + +//--------------------------------------------------------------------------- +// sequenceCommandType_e +// +// Typeerated sequence command types. +//--------------------------------------------------------------------------- +enum sequenceCommandType_ +{ + SEQUENCE_TYPE_COMMAND, + SEQUENCE_TYPE_MODIFIER, +}; +typedef enum sequenceCommandType_ sequenceCommandType_e; + + +//--------------------------------------------------------------------------- +// sequenceCommandMapping_s +// +// A mapping of a command enumerated-value to its name. +//--------------------------------------------------------------------------- +typedef struct sequenceCommandMapping_ sequenceCommandMapping_s; +struct sequenceCommandMapping_ +{ + sequenceCommandEnum_e commandEnum; + const char* commandName; + sequenceCommandType_e commandType; +}; + + +//--------------------------------------------------------------------------- +// sequenceCommandLine_s +// +// Structure representing a single command (usually 1 line) from a +// .SEQ file entry. +//--------------------------------------------------------------------------- +typedef struct sequenceCommandLine_ sequenceCommandLine_s; +struct sequenceCommandLine_ +{ + int commandType; // Specifies the type of command + client_textmessage_t clientMessage; // Text HUD message struct + char* speakerName; // Targetname of speaking entity + char* listenerName; // Targetname of entity being spoken to + char* soundFileName; // Name of sound file to play + char* sentenceName; // Name of sentences.txt to play + char* fireTargetNames; // List of targetnames to fire + char* killTargetNames; // List of targetnames to remove + float delay; // Seconds 'till next command + int repeatCount; // If nonzero, reset execution pointer to top of block (N times, -1 = infinite) + int textChannel; // Display channel on which text message is sent + int modifierBitField; // Bit field to specify what clientmessage fields are valid + sequenceCommandLine_s* nextCommandLine; // Next command (linked list) +}; + + +//--------------------------------------------------------------------------- +// sequenceEntry_s +// +// Structure representing a single command (usually 1 line) from a +// .SEQ file entry. +//--------------------------------------------------------------------------- +typedef struct sequenceEntry_ sequenceEntry_s; +struct sequenceEntry_ +{ + char* fileName; // Name of sequence file without .SEQ extension + char* entryName; // Name of entry label in file + sequenceCommandLine_s* firstCommand; // Linked list of commands in entry + sequenceEntry_s* nextEntry; // Next loaded entry + qboolean isGlobal; // Is entry retained over level transitions? +}; + + + +//--------------------------------------------------------------------------- +// sentenceEntry_s +// Structure representing a single sentence of a group from a .SEQ +// file entry. Sentences are identical to entries in sentences.txt, but +// can be unique per level and are loaded/unloaded with the level. +//--------------------------------------------------------------------------- +typedef struct sentenceEntry_ sentenceEntry_s; +struct sentenceEntry_ +{ + char* data; // sentence data (ie "We have hostiles" ) + sentenceEntry_s* nextEntry; // Next loaded entry + qboolean isGlobal; // Is entry retained over level transitions? + unsigned int index; // this entry's position in the file. +}; + +//-------------------------------------------------------------------------- +// sentenceGroupEntry_s +// Structure representing a group of sentences found in a .SEQ file. +// A sentence group is defined by all sentences with the same name, ignoring +// the number at the end of the sentence name. Groups enable a sentence +// to be picked at random across a group. +//-------------------------------------------------------------------------- +typedef struct sentenceGroupEntry_ sentenceGroupEntry_s; +struct sentenceGroupEntry_ +{ + char* groupName; // name of the group (ie CT_ALERT ) + unsigned int numSentences; // number of sentences in group + sentenceEntry_s* firstSentence; // head of linked list of sentences in group + sentenceGroupEntry_s* nextEntry; // next loaded group +}; + +//--------------------------------------------------------------------------- +// Function declarations +//--------------------------------------------------------------------------- +sequenceEntry_s* SequenceGet( const char* fileName, const char* entryName ); +void Sequence_ParseFile( const char* fileName, qboolean isGlobal ); +void Sequence_OnLevelLoad( const char* mapName ); +sentenceEntry_s* SequencePickSentence( const char *groupName, int pickMethod, int *picked ); + +#endif // _INCLUDE_SEQUENCE_H_ diff --git a/reapi/include/cssdk/common/SteamCommon.h b/reapi/include/cssdk/common/SteamCommon.h new file mode 100644 index 0000000..364889c --- /dev/null +++ b/reapi/include/cssdk/common/SteamCommon.h @@ -0,0 +1,703 @@ + +//========= Copyright Valve Corporation, All rights reserved. ============// +/* +** The copyright to the contents herein is the property of Valve Corporation. +** The contents may be used and/or copied only with the written permission of +** Valve, or in accordance with the terms and conditions stipulated in +** the agreement/contract under which the contents have been supplied. +** +******************************************************************************* +** +** Contents: +** +** Common types used in the Steam DLL interface. +** +** This file is distributed to Steam application developers. +** +** +** +*******************************************************************************/ + +#ifndef INCLUDED_STEAM_COMMON_STEAMCOMMON_H +#define INCLUDED_STEAM_COMMON_STEAMCOMMON_H + +#if defined(_MSC_VER) && (_MSC_VER > 1000) +#pragma once +#endif + + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Applications should not define STEAM_EXPORTS. */ + +#if defined ( _WIN32 ) + +#ifdef STEAM_EXPORTS +#define STEAM_API __declspec(dllexport) +#else +#define STEAM_API __declspec(dllimport) +#endif + +#define STEAM_CALL __cdecl + +#else + +#define STEAM_API /* */ +#define STEAM_CALL /* */ + +#endif + +typedef void (STEAM_CALL *KeyValueIteratorCallback_t )(const char *Key, const char *Val, void *pvParam); + + +/****************************************************************************** +** +** Exported macros and constants +** +******************************************************************************/ + +/* DEPRECATED -- these are ignored now, all API access is granted on SteamStartup */ +#define STEAM_USING_FILESYSTEM (0x00000001) +#define STEAM_USING_LOGGING (0x00000002) +#define STEAM_USING_USERID (0x00000004) +#define STEAM_USING_ACCOUNT (0x00000008) +#define STEAM_USING_ALL (0x0000000f) +/* END DEPRECATED */ + +#define STEAM_MAX_PATH (255) +#define STEAM_QUESTION_MAXLEN (255) +#define STEAM_SALT_SIZE (8) +#define STEAM_PROGRESS_PERCENT_SCALE (0x00001000) + +/* These are maximum significant string lengths, excluding nul-terminator. */ +#define STEAM_CARD_NUMBER_SIZE (17) +#define STEAM_CARD_HOLDERNAME_SIZE (100) +#define STEAM_CARD_EXPYEAR_SIZE (4) +#define STEAM_CARD_EXPMONTH_SIZE (2) +#define STEAM_CARD_CVV2_SIZE (5) +#define STEAM_BILLING_ADDRESS1_SIZE (128) +#define STEAM_BILLING_ADDRESS2_SIZE (128) +#define STEAM_BILLING_CITY_SIZE (50) +#define STEAM_BILLING_ZIP_SIZE (16) +#define STEAM_BILLING_STATE_SIZE (32) +#define STEAM_BILLING_COUNTRY_SIZE (32) +#define STEAM_BILLING_PHONE_SIZE (20) +#define STEAM_BILLING_EMAIL_ADDRESS_SIZE (100) +#define STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE (20) +#define STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE (200) +#define STEAM_EXTERNAL_ACCOUNTNAME_SIZE (100) +#define STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE (80) +#define STEAM_BILLING_CONFIRMATION_CODE_SIZE (22) +#define STEAM_BILLING_CARD_APPROVAL_CODE_SIZE (100) +#define STEAM_BILLING_TRANS_DATE_SIZE (9) // mm/dd/yy +#define STEAM_BILLING_TRANS_TIME_SIZE (9) // hh:mm:ss + +/****************************************************************************** +** +** Scalar type and enumerated type definitions. +** +******************************************************************************/ + + +typedef unsigned int SteamHandle_t; + +typedef void * SteamUserIDTicketValidationHandle_t; + +typedef unsigned int SteamCallHandle_t; + +#if defined(_MSC_VER) +typedef unsigned __int64 SteamUnsigned64_t; +#else +typedef unsigned long long SteamUnsigned64_t; +#endif + +typedef enum +{ + eSteamSeekMethodSet = 0, + eSteamSeekMethodCur = 1, + eSteamSeekMethodEnd = 2 +} ESteamSeekMethod; + +typedef enum +{ + eSteamBufferMethodFBF = 0, + eSteamBufferMethodNBF = 1 +} ESteamBufferMethod; + +typedef enum +{ + eSteamErrorNone = 0, + eSteamErrorUnknown = 1, + eSteamErrorLibraryNotInitialized = 2, + eSteamErrorLibraryAlreadyInitialized = 3, + eSteamErrorConfig = 4, + eSteamErrorContentServerConnect = 5, + eSteamErrorBadHandle = 6, + eSteamErrorHandlesExhausted = 7, + eSteamErrorBadArg = 8, + eSteamErrorNotFound = 9, + eSteamErrorRead = 10, + eSteamErrorEOF = 11, + eSteamErrorSeek = 12, + eSteamErrorCannotWriteNonUserConfigFile = 13, + eSteamErrorCacheOpen = 14, + eSteamErrorCacheRead = 15, + eSteamErrorCacheCorrupted = 16, + eSteamErrorCacheWrite = 17, + eSteamErrorCacheSession = 18, + eSteamErrorCacheInternal = 19, + eSteamErrorCacheBadApp = 20, + eSteamErrorCacheVersion = 21, + eSteamErrorCacheBadFingerPrint = 22, + + eSteamErrorNotFinishedProcessing = 23, + eSteamErrorNothingToDo = 24, + eSteamErrorCorruptEncryptedUserIDTicket = 25, + eSteamErrorSocketLibraryNotInitialized = 26, + eSteamErrorFailedToConnectToUserIDTicketValidationServer = 27, + eSteamErrorBadProtocolVersion = 28, + eSteamErrorReplayedUserIDTicketFromClient = 29, + eSteamErrorReceiveResultBufferTooSmall = 30, + eSteamErrorSendFailed = 31, + eSteamErrorReceiveFailed = 32, + eSteamErrorReplayedReplyFromUserIDTicketValidationServer = 33, + eSteamErrorBadSignatureFromUserIDTicketValidationServer = 34, + eSteamErrorValidationStalledSoAborted = 35, + eSteamErrorInvalidUserIDTicket = 36, + eSteamErrorClientLoginRateTooHigh = 37, + eSteamErrorClientWasNeverValidated = 38, + eSteamErrorInternalSendBufferTooSmall = 39, + eSteamErrorInternalReceiveBufferTooSmall = 40, + eSteamErrorUserTicketExpired = 41, + eSteamErrorCDKeyAlreadyInUseOnAnotherClient = 42, + + eSteamErrorNotLoggedIn = 101, + eSteamErrorAlreadyExists = 102, + eSteamErrorAlreadySubscribed = 103, + eSteamErrorNotSubscribed = 104, + eSteamErrorAccessDenied = 105, + eSteamErrorFailedToCreateCacheFile = 106, + eSteamErrorCallStalledSoAborted = 107, + eSteamErrorEngineNotRunning = 108, + eSteamErrorEngineConnectionLost = 109, + eSteamErrorLoginFailed = 110, + eSteamErrorAccountPending = 111, + eSteamErrorCacheWasMissingRetry = 112, + eSteamErrorLocalTimeIncorrect = 113, + eSteamErrorCacheNeedsDecryption = 114, + eSteamErrorAccountDisabled = 115, + eSteamErrorCacheNeedsRepair = 116, + eSteamErrorRebootRequired = 117, + + eSteamErrorNetwork = 200, + eSteamErrorOffline = 201 + + +} ESteamError; + + +typedef enum +{ + eNoDetailedErrorAvailable, + eStandardCerrno, + eWin32LastError, + eWinSockLastError, + eDetailedPlatformErrorCount +} EDetailedPlatformErrorType; + +typedef enum /* Filter elements returned by SteamFind{First,Next} */ +{ + eSteamFindLocalOnly, /* limit search to local filesystem */ + eSteamFindRemoteOnly, /* limit search to remote repository */ + eSteamFindAll /* do not limit search (duplicates allowed) */ +} ESteamFindFilter; + + +/****************************************************************************** +** +** Exported structure and complex type definitions. +** +******************************************************************************/ + + +typedef struct +{ + ESteamError eSteamError; + EDetailedPlatformErrorType eDetailedErrorType; + int nDetailedErrorCode; + char szDesc[STEAM_MAX_PATH]; +} TSteamError; + + + +typedef struct +{ + int bIsDir; /* If non-zero, element is a directory; if zero, element is a file */ + unsigned int uSizeOrCount; /* If element is a file, this contains size of file in bytes */ + int bIsLocal; /* If non-zero, reported item is a standalone element on local filesystem */ + char cszName[STEAM_MAX_PATH]; /* Base element name (no path) */ + long lLastAccessTime; /* Seconds since 1/1/1970 (like time_t) when element was last accessed */ + long lLastModificationTime; /* Seconds since 1/1/1970 (like time_t) when element was last modified */ + long lCreationTime; /* Seconds since 1/1/1970 (like time_t) when element was created */ +} TSteamElemInfo; + + +typedef struct +{ + unsigned int uNumSubscriptions; + unsigned int uMaxNameChars; + unsigned int uMaxApps; + +} TSteamSubscriptionStats; + + +typedef struct +{ + unsigned int uNumApps; + unsigned int uMaxNameChars; + unsigned int uMaxInstallDirNameChars; + unsigned int uMaxVersionLabelChars; + unsigned int uMaxLaunchOptions; + unsigned int uMaxLaunchOptionDescChars; + unsigned int uMaxLaunchOptionCmdLineChars; + unsigned int uMaxNumIcons; + unsigned int uMaxIconSize; + unsigned int uMaxDependencies; + +} TSteamAppStats; + +typedef struct +{ + char *szLabel; + unsigned int uMaxLabelChars; + unsigned int uVersionId; + int bIsNotAvailable; +} TSteamAppVersion; + +typedef struct +{ + char *szDesc; + unsigned int uMaxDescChars; + char *szCmdLine; + unsigned int uMaxCmdLineChars; + unsigned int uIndex; + unsigned int uIconIndex; + int bNoDesktopShortcut; + int bNoStartMenuShortcut; + int bIsLongRunningUnattended; + +} TSteamAppLaunchOption; + + +typedef struct +{ + char *szName; + unsigned int uMaxNameChars; + char *szLatestVersionLabel; + unsigned int uMaxLatestVersionLabelChars; + char *szCurrentVersionLabel; + unsigned int uMaxCurrentVersionLabelChars; + char *szInstallDirName; + unsigned int uMaxInstallDirNameChars; + unsigned int uId; + unsigned int uLatestVersionId; + unsigned int uCurrentVersionId; + unsigned int uMinCacheFileSizeMB; + unsigned int uMaxCacheFileSizeMB; + unsigned int uNumLaunchOptions; + unsigned int uNumIcons; + unsigned int uNumVersions; + unsigned int uNumDependencies; + +} TSteamApp; + +typedef enum +{ + eNoCost = 0, + eBillOnceOnly = 1, + eBillMonthly = 2, + eProofOfPrepurchaseOnly = 3, + eGuestPass = 4, + eHardwarePromo = 5, + eNumBillingTypes, +} EBillingType; + +typedef struct +{ + char *szName; + unsigned int uMaxNameChars; + unsigned int *puAppIds; + unsigned int uMaxAppIds; + unsigned int uId; + unsigned int uNumApps; + EBillingType eBillingType; + unsigned int uCostInCents; + unsigned int uNumDiscounts; + int bIsPreorder; + int bRequiresShippingAddress; + unsigned int uDomesticShippingCostInCents; + unsigned int uInternationalShippingCostInCents; + bool bIsCyberCafeSubscription; + unsigned int uGameCode; + char szGameCodeDesc[STEAM_MAX_PATH]; + bool bIsDisabled; + bool bRequiresCD; + unsigned int uTerritoryCode; + bool bIsSteam3Subscription; + +} TSteamSubscription; + +typedef struct +{ + char szName[STEAM_MAX_PATH]; + unsigned int uDiscountInCents; + unsigned int uNumQualifiers; + +} TSteamSubscriptionDiscount; + +typedef struct +{ + char szName[STEAM_MAX_PATH]; + unsigned int uRequiredSubscription; + int bIsDisqualifier; + +} TSteamDiscountQualifier; + +typedef struct TSteamProgress +{ + int bValid; /* non-zero if call provides progress info */ + unsigned int uPercentDone; /* 0 to 100 * STEAM_PROGRESS_PERCENT_SCALE if bValid */ + char szProgress[STEAM_MAX_PATH]; /* additional progress info */ +} TSteamProgress; + +typedef enum +{ + eSteamNotifyTicketsWillExpire, + eSteamNotifyAccountInfoChanged, + eSteamNotifyContentDescriptionChanged, + eSteamNotifyPleaseShutdown, + eSteamNotifyNewContentServer, + eSteamNotifySubscriptionStatusChanged, + eSteamNotifyContentServerConnectionLost, + eSteamNotifyCacheLoadingCompleted, + eSteamNotifyCacheNeedsDecryption, + eSteamNotifyCacheNeedsRepair +} ESteamNotificationCallbackEvent; + + +typedef void(*SteamNotificationCallback_t)(ESteamNotificationCallbackEvent eEvent, unsigned int nData); + + +typedef char SteamPersonalQuestion_t[ STEAM_QUESTION_MAXLEN + 1 ]; + +typedef struct +{ + unsigned char uchSalt[STEAM_SALT_SIZE]; +} SteamSalt_t; + +typedef enum +{ + eVisa = 1, + eMaster = 2, + eAmericanExpress = 3, + eDiscover = 4, + eDinnersClub = 5, + eJCB = 6 +} ESteamPaymentCardType; + +typedef struct +{ + ESteamPaymentCardType eCardType; + char szCardNumber[ STEAM_CARD_NUMBER_SIZE +1 ]; + char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1]; + char szCardExpYear[ STEAM_CARD_EXPYEAR_SIZE + 1 ]; + char szCardExpMonth[ STEAM_CARD_EXPMONTH_SIZE+ 1 ]; + char szCardCVV2[ STEAM_CARD_CVV2_SIZE + 1 ]; + char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ]; + char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ]; + char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ]; + char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ]; + char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ]; + char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ]; + char szBillingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ]; + char szBillingEmailAddress[ STEAM_BILLING_EMAIL_ADDRESS_SIZE + 1 ]; + unsigned int uExpectedCostInCents; + unsigned int uExpectedTaxInCents; + /* If the TSteamSubscription says that shipping info is required, */ + /* then the following fields must be filled out. */ + /* If szShippingName is empty, then assumes so are the rest. */ + char szShippingName[ STEAM_CARD_HOLDERNAME_SIZE + 1]; + char szShippingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ]; + char szShippingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ]; + char szShippingCity[ STEAM_BILLING_CITY_SIZE + 1 ]; + char szShippingZip[ STEAM_BILLING_ZIP_SIZE + 1 ]; + char szShippingState[ STEAM_BILLING_STATE_SIZE + 1 ]; + char szShippingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ]; + char szShippingPhone[ STEAM_BILLING_PHONE_SIZE + 1 ]; + unsigned int uExpectedShippingCostInCents; + +} TSteamPaymentCardInfo; + +typedef struct +{ + char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ]; + + /* A ProofOfPurchase token is not necessarily a nul-terminated string; it may be binary data + (perhaps encrypted). Hence we need a length and an array of bytes. */ + unsigned int uLengthOfBinaryProofOfPurchaseToken; + char cBinaryProofOfPurchaseToken[ STEAM_PROOF_OF_PURCHASE_TOKEN_SIZE + 1 ]; +} TSteamPrepurchaseInfo; + +typedef struct +{ + char szAccountName[ STEAM_EXTERNAL_ACCOUNTNAME_SIZE + 1 ]; + char szPassword[ STEAM_EXTERNAL_ACCOUNTPASSWORD_SIZE + 1 ]; +} TSteamExternalBillingInfo; + +typedef enum +{ + ePaymentCardInfo = 1, + ePrepurchasedInfo = 2, + eAccountBillingInfo = 3, + eExternalBillingInfo = 4, /* indirect billing via ISP etc (not supported yet) */ + ePaymentCardReceipt = 5, + ePrepurchaseReceipt = 6, + eEmptyReceipt = 7 +} ESteamSubscriptionBillingInfoType; + +typedef struct +{ + ESteamSubscriptionBillingInfoType eBillingInfoType; + union { + TSteamPaymentCardInfo PaymentCardInfo; + TSteamPrepurchaseInfo PrepurchaseInfo; + TSteamExternalBillingInfo ExternalBillingInfo; + char bUseAccountBillingInfo; + }; + +} TSteamSubscriptionBillingInfo; + +typedef enum +{ + /* Subscribed */ + eSteamSubscriptionOK = 0, /* Subscribed */ + eSteamSubscriptionPending = 1, /* Awaiting transaction completion */ + eSteamSubscriptionPreorder = 2, /* Is currently a pre-order */ + eSteamSubscriptionPrepurchaseTransferred = 3, /* hop to this account */ + /* Unusbscribed */ + eSteamSubscriptionPrepurchaseInvalid = 4, /* Invalid cd-key */ + eSteamSubscriptionPrepurchaseRejected = 5, /* hopped out / banned / etc */ + eSteamSubscriptionPrepurchaseRevoked = 6, /* hop away from this account */ + eSteamSubscriptionPaymentCardDeclined = 7, /* CC txn declined */ + eSteamSubscriptionCancelledByUser = 8, /* Cancelled by client */ + eSteamSubscriptionCancelledByVendor = 9, /* Cancelled by us */ + eSteamSubscriptionPaymentCardUseLimit = 10, /* Card used too many times, potential fraud */ + eSteamSubscriptionPaymentCardAlert = 11, /* Got a "pick up card" or the like from bank */ + eSteamSubscriptionFailed = 12, /* Other Error in subscription data or transaction failed/lost */ + eSteamSubscriptionPaymentCardAVSFailure = 13, /* Card failed Address Verification check */ + eSteamSubscriptionPaymentCardInsufficientFunds = 14, /* Card failed due to insufficient funds */ + eSteamSubscriptionRestrictedCountry = 15 /* The subscription is not available in the user's country */ + +} ESteamSubscriptionStatus; + +typedef struct +{ + ESteamPaymentCardType eCardType; + char szCardLastFourDigits[ 4 + 1 ]; + char szCardHolderName[ STEAM_CARD_HOLDERNAME_SIZE + 1]; + char szBillingAddress1[ STEAM_BILLING_ADDRESS1_SIZE + 1 ]; + char szBillingAddress2[ STEAM_BILLING_ADDRESS2_SIZE + 1 ]; + char szBillingCity[ STEAM_BILLING_CITY_SIZE + 1 ]; + char szBillingZip[ STEAM_BILLING_ZIP_SIZE + 1 ]; + char szBillingState[ STEAM_BILLING_STATE_SIZE + 1 ]; + char szBillingCountry[ STEAM_BILLING_COUNTRY_SIZE + 1 ]; + + // The following are only available after the subscription leaves "pending" status + char szCardApprovalCode[ STEAM_BILLING_CARD_APPROVAL_CODE_SIZE + 1]; + char szTransDate[ STEAM_BILLING_TRANS_DATE_SIZE + 1]; /* mm/dd/yy */ + char szTransTime[ STEAM_BILLING_TRANS_TIME_SIZE + 1]; /* hh:mm:ss */ + unsigned int uPriceWithoutTax; + unsigned int uTaxAmount; + unsigned int uShippingCost; + +} TSteamPaymentCardReceiptInfo; + +typedef struct +{ + char szTypeOfProofOfPurchase[ STEAM_TYPE_OF_PROOF_OF_PURCHASE_SIZE + 1 ]; +} TSteamPrepurchaseReceiptInfo; + +typedef struct +{ + ESteamSubscriptionStatus eStatus; + ESteamSubscriptionStatus ePreviousStatus; + ESteamSubscriptionBillingInfoType eReceiptInfoType; + char szConfirmationCode[ STEAM_BILLING_CONFIRMATION_CODE_SIZE + 1]; + union { + TSteamPaymentCardReceiptInfo PaymentCardReceiptInfo; + TSteamPrepurchaseReceiptInfo PrepurchaseReceiptInfo; + }; + +} TSteamSubscriptionReceipt; + +typedef enum +{ + ePhysicalBytesReceivedThisSession = 1, + eAppReadyToLaunchStatus = 2, + eAppPreloadStatus = 3, + eAppEntireDepot = 4, + eCacheBytesPresent = 5 +} ESteamAppUpdateStatsQueryType; + +typedef struct +{ + SteamUnsigned64_t uBytesTotal; + SteamUnsigned64_t uBytesPresent; +} TSteamUpdateStats; + +typedef enum +{ + eSteamUserAdministrator = 0x00000001, /* May subscribe, unsubscribe, etc */ + eSteamUserDeveloper = 0x00000002, /* Steam or App developer */ + eSteamUserCyberCafe = 0x00000004 /* CyberCafe, school, etc -- UI should ask for password */ + /* before allowing logout, unsubscribe, etc */ +} ESteamUserTypeFlags; + +typedef enum +{ + eSteamAccountStatusDefault = 0x00000000, + eSteamAccountStatusEmailVerified = 0x00000001, + /* Note: Mask value 0x2 is reserved for future use. (Some, but not all, public accounts already have this set.) */ + eSteamAccountDisabled = 0x00000004 +} ESteamAccountStatusBitFields ; + + +typedef enum +{ + eSteamBootstrapperError = -1, + eSteamBootstrapperDontCheckForUpdate = 0, + eSteamBootstrapperCheckForUpdateAndRerun = 7 + +} ESteamBootStrapperClientAppResult; + +typedef enum +{ + eSteamOnline = 0, + eSteamOffline = 1, + eSteamNoAuthMode = 2, + eSteamBillingOffline = 3 +} eSteamOfflineStatus; + +typedef struct +{ + int eOfflineNow; + int eOfflineNextSession; +} TSteamOfflineStatus; + +typedef struct +{ + unsigned int uAppId; + int bIsSystemDefined; + char szMountPath[STEAM_MAX_PATH]; +} TSteamAppDependencyInfo; + +typedef enum +{ + eSteamOpenFileRegular = 0x0, + eSteamOpenFileIgnoreLocal = 0x1, + eSteamOpenFileChecksumReads = 0x2 +} ESteamOpenFileFlags; + +typedef enum +{ + eSteamValveCDKeyValidationServer = 0, + eSteamHalfLifeMasterServer = 1, + eSteamFriendsServer = 2, + eSteamCSERServer = 3, + eSteamHalfLife2MasterServer = 4, + eSteamRDKFMasterServer = 5, + eMaxServerTypes = 6 +} ESteamServerType; + +/****************************************************************************** +** +** More exported constants +** +******************************************************************************/ + + +#ifdef __cplusplus + +const SteamHandle_t STEAM_INVALID_HANDLE = 0; +const SteamCallHandle_t STEAM_INVALID_CALL_HANDLE = 0; +const SteamUserIDTicketValidationHandle_t STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE = 0; +const unsigned int STEAM_USE_LATEST_VERSION = 0xFFFFFFFF; + +#else + +#define STEAM_INVALID_HANDLE ((SteamHandle_t)(0)) +#define STEAM_INVALID_CALL_HANDLE ((SteamCallHandle_t)(0)) +#define STEAM_INACTIVE_USERIDTICKET_VALIDATION_HANDLE ((SteamUserIDTicketValidationHandle_t)(0)) +#define STEAM_USE_LATEST_VERSION (0xFFFFFFFFu); + +#endif + + +/****************************************************************************** +** Each Steam instance (licensed Steam Service Provider) has a unique SteamInstanceID_t. +** +** Each Steam instance as its own DB of users. +** Each user in the DB has a unique SteamLocalUserID_t (a serial number, with possible +** rare gaps in the sequence). +** +******************************************************************************/ + +typedef unsigned short SteamInstanceID_t; // MUST be 16 bits + + +#if defined ( _WIN32 ) +typedef unsigned __int64 SteamLocalUserID_t; // MUST be 64 bits +#else +typedef unsigned long long SteamLocalUserID_t; // MUST be 64 bits +#endif + +/****************************************************************************** +** +** Applications need to be able to authenticate Steam users from ANY instance. +** So a SteamIDTicket contains SteamGlobalUserID, which is a unique combination of +** instance and user id. +** +** SteamLocalUserID is an unsigned 64-bit integer. +** For platforms without 64-bit int support, we provide access via a union that splits it into +** high and low unsigned 32-bit ints. Such platforms will only need to compare LocalUserIDs +** for equivalence anyway - not perform arithmetic with them. +** +********************************************************************************/ +typedef struct +{ + unsigned int Low32bits; + unsigned int High32bits; +} TSteamSplitLocalUserID; + +typedef struct +{ + SteamInstanceID_t m_SteamInstanceID; + + union + { + SteamLocalUserID_t As64bits; + TSteamSplitLocalUserID Split; + } m_SteamLocalUserID; + +} TSteamGlobalUserID; + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/reapi/include/cssdk/common/beamdef.h b/reapi/include/cssdk/common/beamdef.h new file mode 100644 index 0000000..fd77a76 --- /dev/null +++ b/reapi/include/cssdk/common/beamdef.h @@ -0,0 +1,62 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined ( BEAMDEFH ) +#define BEAMDEFH +#ifdef _WIN32 +#pragma once +#endif + +#define FBEAM_STARTENTITY 0x00000001 +#define FBEAM_ENDENTITY 0x00000002 +#define FBEAM_FADEIN 0x00000004 +#define FBEAM_FADEOUT 0x00000008 +#define FBEAM_SINENOISE 0x00000010 +#define FBEAM_SOLID 0x00000020 +#define FBEAM_SHADEIN 0x00000040 +#define FBEAM_SHADEOUT 0x00000080 +#define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet? +#define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet? +#define FBEAM_ISACTIVE 0x40000000 +#define FBEAM_FOREVER 0x80000000 + +typedef struct beam_s BEAM; +struct beam_s +{ + BEAM *next; + int type; + int flags; + vec3_t source; + vec3_t target; + vec3_t delta; + float t; // 0 .. 1 over lifetime of beam + float freq; + float die; + float width; + float amplitude; + float r, g, b; + float brightness; + float speed; + float frameRate; + float frame; + int segments; + int startEntity; + int endEntity; + int modelIndex; + int frameCount; + struct model_s *pFollowModel; + struct particle_s *particles; +}; + +#endif diff --git a/reapi/include/cssdk/common/cl_entity.h b/reapi/include/cssdk/common/cl_entity.h new file mode 100644 index 0000000..a7cd472 --- /dev/null +++ b/reapi/include/cssdk/common/cl_entity.h @@ -0,0 +1,115 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// cl_entity.h +#if !defined( CL_ENTITYH ) +#define CL_ENTITYH +#ifdef _WIN32 +#pragma once +#endif + +typedef struct efrag_s +{ + struct mleaf_s *leaf; + struct efrag_s *leafnext; + struct cl_entity_s *entity; + struct efrag_s *entnext; +} efrag_t; + +typedef struct +{ + byte mouthopen; // 0 = mouth closed, 255 = mouth agape + byte sndcount; // counter for running average + int sndavg; // running average +} mouth_t; + +typedef struct +{ + float prevanimtime; + float sequencetime; + byte prevseqblending[2]; + vec3_t prevorigin; + vec3_t prevangles; + + int prevsequence; + float prevframe; + + byte prevcontroller[4]; + byte prevblending[2]; +} latchedvars_t; + +typedef struct +{ + // Time stamp for this movement + float animtime; + + vec3_t origin; + vec3_t angles; +} position_history_t; + +typedef struct cl_entity_s cl_entity_t; + +#define HISTORY_MAX 64 // Must be power of 2 +#define HISTORY_MASK ( HISTORY_MAX - 1 ) + + +#if !defined( ENTITY_STATEH ) +#include "entity_state.h" +#endif + +#if !defined( PROGS_H ) +#include "progs.h" +#endif + +struct cl_entity_s +{ + int index; // Index into cl_entities ( should match actual slot, but not necessarily ) + + qboolean player; // True if this entity is a "player" + + entity_state_t baseline; // The original state from which to delta during an uncompressed message + entity_state_t prevstate; // The state information from the penultimate message received from the server + entity_state_t curstate; // The state information from the last message received from server + + int current_position; // Last received history update index + position_history_t ph[ HISTORY_MAX ]; // History of position and angle updates for this player + + mouth_t mouth; // For synchronizing mouth movements. + + latchedvars_t latched; // Variables used by studio model rendering routines + + // Information based on interplocation, extrapolation, prediction, or just copied from last msg received. + // + float lastmove; + + // Actual render position and angles + vec3_t origin; + vec3_t angles; + + // Attachment points + vec3_t attachment[4]; + + // Other entity local information + int trivial_accept; + + struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model + struct efrag_s *efrag; // linked list of efrags + struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split + + float syncbase; // for client-side animations -- used by obsolete alias animation system, remove? + int visframe; // last frame this entity was found in an active leaf + colorVec cvFloorColor; +}; + +#endif // !CL_ENTITYH diff --git a/reapi/include/cssdk/common/com_model.h b/reapi/include/cssdk/common/com_model.h new file mode 100644 index 0000000..d6e3d42 --- /dev/null +++ b/reapi/include/cssdk/common/com_model.h @@ -0,0 +1,340 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// com_model.h +#pragma once + +#define STUDIO_RENDER 1 +#define STUDIO_EVENTS 2 + +//#define MAX_MODEL_NAME 64 +//#define MAX_MAP_HULLS 4 +//#define MIPLEVELS 4 +//#define NUM_AMBIENTS 4 // automatic ambient sounds +//#define MAXLIGHTMAPS 4 +#define PLANE_ANYZ 5 + +#define ALIAS_Z_CLIP_PLANE 5 + +// flags in finalvert_t.flags +#define ALIAS_LEFT_CLIP 0x0001 +#define ALIAS_TOP_CLIP 0x0002 +#define ALIAS_RIGHT_CLIP 0x0004 +#define ALIAS_BOTTOM_CLIP 0x0008 +#define ALIAS_Z_CLIP 0x0010 +#define ALIAS_ONSEAM 0x0020 +#define ALIAS_XY_CLIP_MASK 0x000F + +#define ZISCALE ((float)0x8000) + +#define CACHE_SIZE 32 // used to align key data structures + +//typedef enum +//{ +// mod_brush, +// mod_sprite, +// mod_alias, +// 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; +// +//#endif + +//typedef struct +//{ +// float mins[3], maxs[3]; +// float origin[3]; +// int headnode[MAX_MAP_HULLS]; +// int visleafs; // not including the solid leaf 0 +// int firstface, numfaces; +//} dmodel_t; + +// 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; +//} mvertex_t; + +//typedef struct +//{ +// unsigned short v[2]; +// unsigned int cachededgeoffset; +//} medge_t; + +//typedef struct texture_s +//{ +// char name[16]; +// unsigned width, 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 +//} mtexinfo_t; + +//typedef struct mnode_s +//{ +// // common with leaf +// 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; +// +// // node specific +// mplane_t *plane; +// struct mnode_s *children[2]; +// +// unsigned short firstsurface; +// unsigned short numsurfaces; +//} mnode_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 +//}; + +//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 +// +// // surface generation data +// 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; +// +// // lighting info +// 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 +//{ +// int planenum; +// short children[2]; // negative numbers are contents +//} dclipnode_t; + +//typedef struct hull_s +//{ +// dclipnode_t *clipnodes; +// mplane_t *planes; +// int firstclipnode; +// int lastclipnode; +// vec3_t clip_mins; +// vec3_t clip_maxs; +//} hull_t; + +typedef struct cache_user_s +{ + void *data; +} cache_user_t; + +//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; +} alight_t; + +typedef struct auxvert_s +{ + float fv[3]; // viewspace x, y +} auxvert_t; + +#include "custom.h" + +//#define MAX_SCOREBOARDNAME 32 + +// Defined in client.h differently +//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; diff --git a/reapi/include/cssdk/common/con_nprint.h b/reapi/include/cssdk/common/con_nprint.h new file mode 100644 index 0000000..b2a1888 --- /dev/null +++ b/reapi/include/cssdk/common/con_nprint.h @@ -0,0 +1,38 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( CON_NPRINTH ) +#define CON_NPRINTH +#ifdef _WIN32 +#pragma once +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct con_nprint_s +{ + int index; // Row # + float time_to_live; // # of seconds before it dissappears + float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale ) +} con_nprint_t; + +void Con_NPrintf( int idx, const char *fmt, ... ); +void Con_NXPrintf( struct con_nprint_s *info, const char *fmt, ... ); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reapi/include/cssdk/common/const.h b/reapi/include/cssdk/common/const.h new file mode 100644 index 0000000..e8e3743 --- /dev/null +++ b/reapi/include/cssdk/common/const.h @@ -0,0 +1,803 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ + +#ifndef CONST_H +#define CONST_H +#ifdef _WIN32 +#pragma once +#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) +#define FL_CLIENT (1<<3) +#define FL_INWATER (1<<4) +#define FL_MONSTER (1<<5) +#define FL_GODMODE (1<<6) +#define FL_NOTARGET (1<<7) +#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself +#define FL_ONGROUND (1<<9) // At rest / on the ground +#define FL_PARTIALGROUND (1<<10) // not all corners are valid +#define FL_WATERJUMP (1<<11) // player jumping out of water +#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera +#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them +#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched +#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water +#define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection + +// UNDONE: Do we need these? +#define FL_IMMUNE_WATER (1<<17) +#define FL_IMMUNE_SLIME (1<<18) +#define FL_IMMUNE_LAVA (1<<19) + +#define FL_PROXY (1<<20) // This is a spectator proxy +#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path) +#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum) +#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set +#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction. +#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something) +#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc. +#define FL_CUSTOMENTITY (1<<29) // This is a custom entity +#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time +#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client + + +// Engine edict->spawnflags +#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file + + +// Goes into globalvars_t.trace_flags +#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box + + +// walkmove modes +#define WALKMOVE_NORMAL 0 // normal walkmove +#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type +#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers + +// edict->movetype values +#define MOVETYPE_NONE 0 // never moves +//#define MOVETYPE_ANGLENOCLIP 1 +//#define MOVETYPE_ANGLECLIP 2 +#define MOVETYPE_WALK 3 // Player only - moving on the ground +#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this +#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff +#define MOVETYPE_TOSS 6 // gravity/collisions +#define MOVETYPE_PUSH 7 // no clip to world, push and crush +#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity +#define MOVETYPE_FLYMISSILE 9 // extra size to monsters +#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces +#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity +#define MOVETYPE_FOLLOW 12 // track movement of aiment +#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision) + +// edict->solid values +// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves +// SOLID only effects OTHER entities colliding with this one when they move - UGH! +#define SOLID_NOT 0 // no interaction with other objects +#define SOLID_TRIGGER 1 // touch on edge, but not blocking +#define SOLID_BBOX 2 // touch on edge, block +#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground +#define SOLID_BSP 4 // bsp clip, touch on edge, block + +// edict->deadflag values +#define DEAD_NO 0 // alive +#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground +#define DEAD_DEAD 2 // dead. lying still. +#define DEAD_RESPAWNABLE 3 +#define DEAD_DISCARDBODY 4 + +#define DAMAGE_NO 0 +#define DAMAGE_YES 1 +#define DAMAGE_AIM 2 + +// entity effects +#define EF_BRIGHTFIELD 1 // swirling cloud of particles +#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0 +#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin +#define EF_DIMLIGHT 8 // player flashlight +#define EF_INVLIGHT 16 // get lighting from ceiling +#define EF_NOINTERP 32 // don't interpolate the next frame +#define EF_LIGHT 64 // rocket flare glow sprite +#define EF_NODRAW 128 // don't draw entity +#define EF_NIGHTVISION 256 // player nightvision +#define EF_SNIPERLASER 512 // sniper laser effect +#define EF_FIBERCAMERA 1024// fiber camera + + +// entity flags +#define EFLAG_SLERP 1 // do studio interpolation of this entity + +// +// temp entity events +// +#define TE_BEAMPOINTS 0 // beam effect between two points +// coord coord coord (start position) +// coord coord coord (end position) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + +#define TE_BEAMENTPOINT 1 // beam effect between point and entity +// short (start entity) +// coord coord coord (end position) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + +#define TE_GUNSHOT 2 // particle effect plus ricochet sound +// coord coord coord (position) + +#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps +// coord coord coord (position) +// short (sprite index) +// byte (scale in 0.1's) +// byte (framerate) +// byte (flags) +// +// The Explosion effect has some flags to control performance/aesthetic features: +#define TE_EXPLFLAG_NONE 0 // all flags clear makes default Half-Life explosion +#define TE_EXPLFLAG_NOADDITIVE 1 // sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite) +#define TE_EXPLFLAG_NODLIGHTS 2 // do not render dynamic lights +#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 +// coord coord coord (position) + +#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps +// coord coord coord (position) +// short (sprite index) +// byte (scale in 0.1's) +// byte (framerate) + +#define TE_TRACER 6 // tracer effect from point to point +// coord, coord, coord (start) +// coord, coord, coord (end) + +#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters +// coord, coord, coord (start) +// coord, coord, coord (end) +// byte (life in 0.1's) +// byte (width in 0.1's) +// byte (amplitude in 0.01's) +// short (sprite model index) + +#define TE_BEAMENTS 8 +// short (start entity) +// short (end entity) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + +#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite +// coord coord coord (position) + +#define TE_LAVASPLASH 10 // Quake1 lava splash +// coord coord coord (position) + +#define TE_TELEPORT 11 // Quake1 teleport splash +// coord coord coord (position) + +#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound +// coord coord coord (position) +// byte (starting color) +// byte (num colors) + +#define TE_BSPDECAL 13 // Decal from the .BSP file +// coord, coord, coord (x,y,z), decal position (center of texture in world) +// short (texture index of precached decal texture name) +// short (entity index) +// [optional - only included if previous short is non-zero (not the world)] short (index of model of above entity) + +#define TE_IMPLOSION 14 // tracers moving toward a point +// coord, coord, coord (position) +// byte (radius) +// byte (count) +// byte (life in 0.1's) + +#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions +// coord, coord, coord (start) +// coord, coord, coord (end) +// short (sprite index) +// byte (count) +// byte (life in 0.1's) +// byte (scale in 0.1's) +// byte (velocity along vector in 10's) +// byte (randomness of velocity in 10's) + +#define TE_BEAM 16 // obsolete + +#define TE_SPRITE 17 // additive sprite, plays 1 cycle +// coord, coord, coord (position) +// short (sprite index) +// byte (scale in 0.1's) +// byte (brightness) + +#define TE_BEAMSPRITE 18 // A beam with a sprite at the end +// coord, coord, coord (start position) +// coord, coord, coord (end position) +// short (beam sprite index) +// short (end sprite index) + +#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime +// coord coord coord (center position) +// coord coord coord (axis and radius) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + +#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime +// coord coord coord (center position) +// coord coord coord (axis and radius) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + +#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime +// coord coord coord (center position) +// coord coord coord (axis and radius) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + +#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving +// short (entity:attachment to follow) +// short (sprite index) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte,byte,byte (color) +// byte (brightness) + +#define TE_GLOWSPRITE 23 +// coord, coord, coord (pos) short (model index) byte (scale / 10) + +#define TE_BEAMRING 24 // connect a beam ring to two entities +// short (start entity) +// short (end entity) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + +#define TE_STREAK_SPLASH 25 // oriented shower of tracers +// coord coord coord (start position) +// coord coord coord (direction vector) +// byte (color) +// short (count) +// short (base speed) +// short (ramdon velocity) + +#define TE_BEAMHOSE 26 // obsolete + +#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect +// coord, coord, coord (pos) +// byte (radius in 10's) +// byte byte byte (color) +// byte (brightness) +// byte (life in 10's) +// byte (decay rate in 10's) + +#define TE_ELIGHT 28 // point entity light, no world effect +// short (entity:attachment to follow) +// coord coord coord (initial position) +// coord (radius) +// byte byte byte (color) +// byte (life in 0.1's) +// coord (decay rate) + +#define TE_TEXTMESSAGE 29 +// short 1.2.13 x (-1 = center) +// short 1.2.13 y (-1 = center) +// byte Effect 0 = fade in/fade out + // 1 is flickery credits + // 2 is write out (training room) + +// 4 bytes r,g,b,a color1 (text color) +// 4 bytes r,g,b,a color2 (effect color) +// ushort 8.8 fadein time +// ushort 8.8 fadeout time +// ushort 8.8 hold time +// optional ushort 8.8 fxtime (time the highlight lags behing the leading text in effect 2) +// string text message (512 chars max sz string) +#define TE_LINE 30 +// coord, coord, coord startpos +// coord, coord, coord endpos +// short life in 0.1 s +// 3 bytes r, g, b + +#define TE_BOX 31 +// coord, coord, coord boxmins +// coord, coord, coord boxmaxs +// short life in 0.1 s +// 3 bytes r, g, b + +#define TE_KILLBEAM 99 // kill all beams attached to entity +// short (entity) + +#define TE_LARGEFUNNEL 100 +// coord coord coord (funnel position) +// short (sprite index) +// short (flags) + +#define TE_BLOODSTREAM 101 // particle spray +// coord coord coord (start position) +// coord coord coord (spray vector) +// byte (color) +// byte (speed) + +#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds +// coord coord coord (start position) +// coord coord coord (end position) + +#define TE_BLOOD 103 // particle spray +// coord coord coord (start position) +// coord coord coord (spray vector) +// byte (color) +// byte (speed) + +#define TE_DECAL 104 // Decal applied to a brush entity (not the world) +// coord, coord, coord (x,y,z), decal position (center of texture in world) +// byte (texture index of precached decal texture name) +// short (entity index) + +#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards +// short (entity) +// short (sprite index) +// byte (density) + +#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits +// coord, coord, coord (position) +// coord, coord, coord (velocity) +// angle (initial yaw) +// short (model index) +// byte (bounce sound type) +// byte (life in 0.1's) + +#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set +// coord, coord, coord (origin) +// coord (velocity) +// short (model index) +// short (count) +// byte (life in 0.1's) + +#define TE_BREAKMODEL 108 // box of models or sprites +// coord, coord, coord (position) +// coord, coord, coord (size) +// coord, coord, coord (velocity) +// byte (random velocity in 10's) +// short (sprite or model index) +// byte (count) +// byte (life in 0.1 secs) +// byte (flags) + +#define TE_GUNSHOTDECAL 109 // decal and ricochet sound +// coord, coord, coord (position) +// short (entity index???) +// byte (decal???) + +#define TE_SPRITE_SPRAY 110 // spay of alpha sprites +// coord, coord, coord (position) +// coord, coord, coord (velocity) +// short (sprite index) +// byte (count) +// byte (speed) +// byte (noise) + +#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound. +// coord, coord, coord (position) +// byte (scale in 0.1's) + +#define TE_PLAYERDECAL 112 // ??? +// byte (playerindex) +// coord, coord, coord (position) +// short (entity???) +// byte (decal number???) +// [optional] short (model index???) + +#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards +// coord, coord, coord (min start position) +// coord, coord, coord (max start position) +// coord (float height) +// short (model index) +// byte (count) +// coord (speed) + +#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards +// coord, coord, coord (min start position) +// coord, coord, coord (max start position) +// coord (float height) +// short (model index) +// byte (count) +// coord (speed) + +#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent) +// coord, coord, coord (position) +// short (sprite1 index) +// short (sprite2 index) +// byte (color) +// byte (scale) + +#define TE_WORLDDECAL 116 // Decal applied to the world brush +// coord, coord, coord (x,y,z), decal position (center of texture in world) +// byte (texture index of precached decal texture name) + +#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush +// coord, coord, coord (x,y,z), decal position (center of texture in world) +// byte (texture index of precached decal texture name - 256) + +#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256 +// coord, coord, coord (x,y,z), decal position (center of texture in world) +// byte (texture index of precached decal texture name - 256) +// short (entity index) + +#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent) +// coord, coord, coord (position) +// coord, coord, coord (velocity) +// short (modelindex) +// byte (life) +// byte (owner) projectile won't collide with owner (if owner == 0, projectile will hit any client). + +#define TE_SPRAY 120 // Throws a shower of sprites or models +// coord, coord, coord (position) +// coord, coord, coord (direction) +// short (modelindex) +// byte (count) +// byte (speed) +// byte (noise) +// byte (rendermode) + +#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!) +// byte (playernum) +// short (sprite modelindex) +// byte (count) +// byte (variance) (0 = no variance in size) (10 = 10% variance in size) + +#define TE_PARTICLEBURST 122 // very similar to lavasplash. +// coord (origin) +// short (radius) +// byte (particle color) +// byte (duration * 10) (will be randomized a bit) + +#define TE_FIREFIELD 123 // makes a field of fire. +// coord (origin) +// short (radius) (fire is made in a square around origin. -radius, -radius to radius, radius) +// short (modelindex) +// byte (count) +// byte (flags) +// byte (duration (in seconds) * 10) (will be randomized a bit) +// +// 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) +// byte (entity index of player) +// coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset ) +// short (model index) +// short (life * 10 ); + +#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player. +// byte (entity index of player) + +#define TE_MULTIGUNSHOT 126 // much more compact shotgun message +// This message is used to make a client approximate a 'spray' of gunfire. +// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is +// a good candidate for MULTIGUNSHOT use. (shotguns) +// +// NOTE: This effect makes the client do traces for each bullet, these client traces ignore +// entities that have studio models.Traces are 4096 long. +// +// coord (origin) +// coord (origin) +// coord (origin) +// coord (direction) +// coord (direction) +// coord (direction) +// coord (x noise * 100) +// coord (y noise * 100) +// byte (count) +// byte (bullethole decal texture index) + +#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization. +// coord (origin) +// coord (origin) +// coord (origin) +// coord (velocity) +// coord (velocity) +// coord (velocity) +// byte ( life * 10 ) +// byte ( color ) this is an index into an array of color vectors in the engine. (0 - ) +// byte ( length * 10 ) + + + +#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 +#define CONTENTS_SOLID -2 +#define CONTENTS_WATER -3 +#define CONTENTS_SLIME -4 +#define CONTENTS_LAVA -5 +#define CONTENTS_SKY -6 +/* These additional contents constants are defined in bspfile.h +#define CONTENTS_ORIGIN -7 // removed at csg time +#define CONTENTS_CLIP -8 // changed to contents_solid +#define CONTENTS_CURRENT_0 -9 +#define CONTENTS_CURRENT_90 -10 +#define CONTENTS_CURRENT_180 -11 +#define CONTENTS_CURRENT_270 -12 +#define CONTENTS_CURRENT_UP -13 +#define CONTENTS_CURRENT_DOWN -14 + +#define CONTENTS_TRANSLUCENT -15 +*/ +#define CONTENTS_LADDER -16 + +#define CONTENT_FLYFIELD -17 +#define CONTENT_GRAVITY_FLYFIELD -18 +#define CONTENT_FOG -19 + +#define CONTENT_EMPTY -1 +#define CONTENT_SOLID -2 +#define CONTENT_WATER -3 +#define CONTENT_SLIME -4 +#define CONTENT_LAVA -5 +#define CONTENT_SKY -6 + +// channels +#define CHAN_AUTO 0 +#define CHAN_WEAPON 1 +#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. + +// attenuation values +#define ATTN_NONE 0 +#define ATTN_NORM (float)0.8 +#define ATTN_IDLE (float)2 +#define ATTN_STATIC (float)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_HIGH 120 + +// volume values +#define VOL_NORM 1.0 + +// plats +#define PLAT_LOW_TRIGGER 1 + +// 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 + +// buttons +#ifndef IN_BUTTONS_H +#include "in_buttons.h" +#endif + +// Break Model Defines + +#define BREAK_TYPEMASK 0x4F +#define BREAK_GLASS 0x01 +#define BREAK_METAL 0x02 +#define BREAK_FLESH 0x04 +#define BREAK_WOOD 0x08 + +#define BREAK_SMOKE 0x10 +#define BREAK_TRANS 0x20 +#define BREAK_CONCRETE 0x40 +#define BREAK_2 0x80 + +// Colliding temp entity sounds + +#define BOUNCE_GLASS BREAK_GLASS +#define BOUNCE_METAL BREAK_METAL +#define BOUNCE_FLESH BREAK_FLESH +#define BOUNCE_WOOD BREAK_WOOD +#define BOUNCE_SHRAP 0x10 +#define BOUNCE_SHELL 0x20 +#define BOUNCE_CONCRETE BREAK_CONCRETE +#define BOUNCE_SHOTSHELL 0x80 + +// Temp entity bounce sound types +#define TE_BOUNCE_NULL 0 +#define TE_BOUNCE_SHELL 1 +#define TE_BOUNCE_SHOTSHELL 2 + +// Rendering constants +enum +{ + kRenderNormal, // src + kRenderTransColor, // c*a+dest*(1-a) + kRenderTransTexture, // src*a+dest*(1-a) + kRenderGlow, // src*a+dest -- No Z buffer checks + kRenderTransAlpha, // src*srca+dest*(1-srca) + kRenderTransAdd, // src*a+dest +}; + +enum +{ + kRenderFxNone = 0, + kRenderFxPulseSlow, + kRenderFxPulseFast, + kRenderFxPulseSlowWide, + kRenderFxPulseFastWide, + kRenderFxFadeSlow, + kRenderFxFadeFast, + kRenderFxSolidSlow, + kRenderFxSolidFast, + kRenderFxStrobeSlow, + kRenderFxStrobeFast, + kRenderFxStrobeFaster, + kRenderFxFlickerSlow, + kRenderFxFlickerFast, + kRenderFxNoDissipation, + kRenderFxDistort, // Distort/scale/translate flicker + kRenderFxHologram, // kRenderFxDistort + distance fade + kRenderFxDeadPlayer, // kRenderAmt is the player index + kRenderFxExplode, // Scale up really big! + kRenderFxGlowShell, // Glowing Shell + kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!) + kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier +}; + + +typedef unsigned int func_t; +typedef unsigned int string_t; + +typedef unsigned char byte; +typedef unsigned short word; +#define _DEF_BYTE_ + +#undef true +#undef false + +#ifndef __cplusplus +typedef enum {false, true} qboolean; +#else +typedef int qboolean; +#endif + +typedef struct +{ + byte r, g, b; +} color24; + +typedef struct +{ + unsigned r, g, b, a; +} colorVec; + +#ifdef _WIN32 +#pragma pack(push,2) +#endif + +typedef struct +{ + unsigned short r, g, b, a; +} PackedColorVec; + +#ifdef _WIN32 +#pragma pack(pop) +#endif +typedef struct link_s +{ + struct link_s *prev, *next; +} link_t; + +typedef struct edict_s edict_t; + +typedef struct +{ + vec3_t normal; + float dist; +} plane_t; + +typedef struct +{ + qboolean allsolid; // if true, plane is not valid + qboolean startsolid; // if true, the initial point was in a solid area + qboolean inopen, inwater; + float fraction; // time completed, 1.0 = didn't hit anything + vec3_t endpos; // final position + plane_t plane; // surface normal at impact + edict_t * ent; // entity the surface is on + int hitgroup; // 0 == generic, non zero is specific body part +} trace_t; + +#endif // CONST_H diff --git a/reapi/include/cssdk/common/crc.h b/reapi/include/cssdk/common/crc.h new file mode 100644 index 0000000..44bcf35 --- /dev/null +++ b/reapi/include/cssdk/common/crc.h @@ -0,0 +1,55 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +/* crc.h */ +#pragma once + +#include "quakedef.h" + +// MD5 Hash +typedef struct +{ + unsigned int buf[4]; + unsigned int bits[2]; + unsigned char in[64]; +} MD5Context_t; + +typedef unsigned int CRC32_t; + + +#ifdef __cplusplus +extern "C" +{ +#endif + +void CRC32_Init(CRC32_t *pulCRC); +CRC32_t CRC32_Final(CRC32_t pulCRC); +void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); +void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *pBuffer, int nBuffer); +BOOL CRC_File(CRC32_t *crcvalue, char *pszFileName); + +#ifdef __cplusplus +} +#endif + +byte COM_BlockSequenceCRCByte(byte *base, int length, int sequence); +int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName); + +void MD5Init(MD5Context_t *ctx); +void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len); +void MD5Final(unsigned char digest[16], MD5Context_t *ctx); +void MD5Transform(unsigned int buf[4], const unsigned int in[16]); + +BOOL MD5_Hash_File(unsigned char digest[16], char *pszFileName, BOOL bUsefopen, BOOL bSeed, unsigned int seed[4]); +char *MD5_Print(unsigned char hash[16]); diff --git a/reapi/include/cssdk/common/cvardef.h b/reapi/include/cssdk/common/cvardef.h new file mode 100644 index 0000000..cc3a222 --- /dev/null +++ b/reapi/include/cssdk/common/cvardef.h @@ -0,0 +1,39 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ + +#ifndef CVARDEF_H +#define CVARDEF_H + +#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc +#define FCVAR_USERINFO (1<<1) // changes the client's info string +#define FCVAR_SERVER (1<<2) // notifies players when changed +#define FCVAR_EXTDLL (1<<3) // defined by external DLL +#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll +#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value +#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. +#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). +#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log +#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar + +typedef struct cvar_s +{ + const char *name; + char *string; + int flags; + float value; + struct cvar_s *next; +} cvar_t; + +#endif // CVARDEF_H diff --git a/reapi/include/cssdk/common/demo_api.h b/reapi/include/cssdk/common/demo_api.h new file mode 100644 index 0000000..8284a81 --- /dev/null +++ b/reapi/include/cssdk/common/demo_api.h @@ -0,0 +1,31 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined ( DEMO_APIH ) +#define DEMO_APIH +#ifdef _WIN32 +#pragma once +#endif + +typedef struct demo_api_s +{ + int ( *IsRecording ) ( void ); + int ( *IsPlayingback ) ( void ); + int ( *IsTimeDemo ) ( void ); + void ( *WriteBuffer ) ( int size, unsigned char *buffer ); +} demo_api_t; + +extern demo_api_t demoapi; + +#endif diff --git a/reapi/include/cssdk/common/director_cmds.h b/reapi/include/cssdk/common/director_cmds.h new file mode 100644 index 0000000..4c8fdd5 --- /dev/null +++ b/reapi/include/cssdk/common/director_cmds.h @@ -0,0 +1,38 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// director_cmds.h +// sub commands for svc_director + +#define DRC_ACTIVE 0 // tells client that he's an spectator and will get director command +#define DRC_STATUS 1 // send status infos about proxy +#define DRC_CAMERA 2 // set the actual director camera position +#define DRC_EVENT 3 // informs the dircetor about ann important game event + + +#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important) +#define DRC_FLAG_SIDE (1<<4) +#define DRC_FLAG_DRAMATIC (1<<5) + + + +// commands of the director API function CallDirectorProc(...) + +#define DRCAPI_NOP 0 // no operation +#define DRCAPI_ACTIVE 1 // de/acivates director mode in engine +#define DRCAPI_STATUS 2 // request proxy information +#define DRCAPI_SETCAM 3 // set camera n to given position and angle +#define DRCAPI_GETCAM 4 // request camera n position and angle +#define DRCAPI_DIRPLAY 5 // set director time and play with normal speed +#define DRCAPI_DIRFREEZE 6 // freeze directo at this time +#define DRCAPI_SETVIEWMODE 7 // overview or 4 cameras +#define DRCAPI_SETOVERVIEWPARAMS 8 // sets parameter for overview mode +#define DRCAPI_SETFOCUS 9 // set the camera which has the input focus +#define DRCAPI_GETTARGETS 10 // queries engine for player list +#define DRCAPI_SETVIEWPOINTS 11 // gives engine all waypoints + + diff --git a/reapi/include/cssdk/common/dlight.h b/reapi/include/cssdk/common/dlight.h new file mode 100644 index 0000000..f869c98 --- /dev/null +++ b/reapi/include/cssdk/common/dlight.h @@ -0,0 +1,33 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined ( DLIGHTH ) +#define DLIGHTH +#ifdef _WIN32 +#pragma once +#endif + +typedef struct dlight_s +{ + vec3_t origin; + float radius; + color24 color; + float die; // stop lighting after this time + float decay; // drop this each second + float minlight; // don't add when contributing less + int key; + qboolean dark; // subtracts light instead of adding +} dlight_t; + +#endif diff --git a/reapi/include/cssdk/common/dll_state.h b/reapi/include/cssdk/common/dll_state.h new file mode 100644 index 0000000..ad16296 --- /dev/null +++ b/reapi/include/cssdk/common/dll_state.h @@ -0,0 +1,23 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +//DLL State Flags + +#define DLL_INACTIVE 0 // no dll +#define DLL_ACTIVE 1 // dll is running +#define DLL_PAUSED 2 // dll is paused +#define DLL_CLOSE 3 // closing down dll +#define DLL_TRANS 4 // Level Transition + +// DLL Pause reasons + +#define DLL_NORMAL 0 // User hit Esc or something. +#define DLL_QUIT 4 // Quit now +#define DLL_RESTART 5 // Switch to launcher for linux, does a quit but returns 1 + +// DLL Substate info ( not relevant ) +#define ENG_NORMAL (1<<0) diff --git a/reapi/include/cssdk/common/entity_state.h b/reapi/include/cssdk/common/entity_state.h new file mode 100644 index 0000000..b3d364d --- /dev/null +++ b/reapi/include/cssdk/common/entity_state.h @@ -0,0 +1,197 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ + +#ifndef ENTITY_STATE_H +#define ENTITY_STATE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "const.h" + + +// For entityType below +#define ENTITY_NORMAL (1<<0) +#define ENTITY_BEAM (1<<1) + +// Entity state is used for the baseline and for delta compression of a packet of +// entities that is sent to a client. +typedef struct entity_state_s entity_state_t; + +struct entity_state_s +{ +// Fields which are filled in by routines outside of delta compression + int entityType; + // Index into cl_entities array for this entity. + int number; + float msg_time; + + // Message number last time the player/entity state was updated. + int messagenum; + + // Fields which can be transitted and reconstructed over the network stream + vec3_t origin; + vec3_t angles; + + int modelindex; + int sequence; + float frame; + int colormap; + short skin; + short solid; + int effects; + float scale; + + byte eflags; + + // Render information + int rendermode; + int renderamt; + color24 rendercolor; + int renderfx; + + int movetype; + float animtime; + float framerate; + int body; + byte controller[4]; + byte blending[4]; + vec3_t velocity; + + // Send bbox down to client for use during prediction. + vec3_t mins; + vec3_t maxs; + + int aiment; + // If owned by a player, the index of that player ( for projectiles ). + int owner; + + // Friction, for prediction. + float friction; + // Gravity multiplier + float gravity; + +// PLAYER SPECIFIC + int team; + int playerclass; + int health; + qboolean spectator; + int weaponmodel; + int gaitsequence; + // If standing on conveyor, e.g. + vec3_t basevelocity; + // Use the crouched hull, or the regular player hull. + int usehull; + // Latched buttons last time state updated. + int oldbuttons; + // -1 = in air, else pmove entity number + int onground; + int iStepLeft; + // How fast we are falling + float flFallVelocity; + + float fov; + int weaponanim; + + // Parametric movement overrides + vec3_t startpos; + vec3_t endpos; + float impacttime; + float starttime; + + // For mods + int iuser1; + int iuser2; + int iuser3; + int iuser4; + float fuser1; + float fuser2; + float fuser3; + float fuser4; + vec3_t vuser1; + vec3_t vuser2; + vec3_t vuser3; + vec3_t vuser4; +}; + +#include "pm_info.h" + +typedef struct clientdata_s +{ + vec3_t origin; + vec3_t velocity; + + int viewmodel; + vec3_t punchangle; + int flags; + int waterlevel; + int watertype; + vec3_t view_ofs; + float health; + + int bInDuck; + + int weapons; // remove? + + int flTimeStepSound; + int flDuckTime; + int flSwimTime; + int waterjumptime; + + float maxspeed; + + float fov; + int weaponanim; + + int m_iId; + int ammo_shells; + int ammo_nails; + int ammo_cells; + int ammo_rockets; + float m_flNextAttack; + + int tfstate; + + int pushmsec; + + int deadflag; + + char physinfo[ MAX_PHYSINFO_STRING ]; + + // For mods + int iuser1; + int iuser2; + int iuser3; + int iuser4; + float fuser1; + float fuser2; + float fuser3; + float fuser4; + vec3_t vuser1; + vec3_t vuser2; + vec3_t vuser3; + vec3_t vuser4; +} clientdata_t; + +#include "weaponinfo.h" + +typedef struct local_state_s +{ + entity_state_t playerstate; + clientdata_t client; + weapon_data_t weapondata[ 64 ]; +} local_state_t; + +#endif // ENTITY_STATE_H diff --git a/reapi/include/cssdk/common/entity_types.h b/reapi/include/cssdk/common/entity_types.h new file mode 100644 index 0000000..ff783df --- /dev/null +++ b/reapi/include/cssdk/common/entity_types.h @@ -0,0 +1,26 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// entity_types.h +#if !defined( ENTITY_TYPESH ) +#define ENTITY_TYPESH + +#define ET_NORMAL 0 +#define ET_PLAYER 1 +#define ET_TEMPENTITY 2 +#define ET_BEAM 3 +// BMODEL or SPRITE that was split across BSP nodes +#define ET_FRAGMENTED 4 + +#endif // !ENTITY_TYPESH diff --git a/reapi/include/cssdk/common/enums.h b/reapi/include/cssdk/common/enums.h new file mode 100644 index 0000000..14e2ce3 --- /dev/null +++ b/reapi/include/cssdk/common/enums.h @@ -0,0 +1,27 @@ +/*** + * + * Copyright (c) 2009, Valve LLC. All rights reserved. + * + * This product contains software technology licensed from Id + * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. + * All Rights Reserved. + * + * Use, distribution, and modification of this source code and/or resulting + * object code is restricted to non-commercial enhancements to products from + * Valve LLC. All other use, distribution, or modification is prohibited + * without written permission from Valve LLC. + * + ****/ + +#ifndef ENUMS_H +#define ENUMS_H + +typedef enum netsrc_s +{ + NS_CLIENT, + NS_SERVER, + NS_MULTICAST // xxxMO +} netsrc_t; + +#endif + diff --git a/reapi/include/cssdk/common/event_api.h b/reapi/include/cssdk/common/event_api.h new file mode 100644 index 0000000..722dfe2 --- /dev/null +++ b/reapi/include/cssdk/common/event_api.h @@ -0,0 +1,51 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined ( EVENT_APIH ) +#define EVENT_APIH +#ifdef _WIN32 +#pragma once +#endif + +#define EVENT_API_VERSION 1 + +typedef struct event_api_s +{ + int version; + void ( *EV_PlaySound ) ( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ); + void ( *EV_StopSound ) ( int ent, int channel, const char *sample ); + int ( *EV_FindModelIndex )( const char *pmodel ); + int ( *EV_IsLocal ) ( int playernum ); + int ( *EV_LocalPlayerDucking ) ( void ); + void ( *EV_LocalPlayerViewheight ) ( float * ); + void ( *EV_LocalPlayerBounds ) ( int hull, float *mins, float *maxs ); + int ( *EV_IndexFromTrace) ( struct pmtrace_s *pTrace ); + struct physent_s *( *EV_GetPhysent ) ( int idx ); + void ( *EV_SetUpPlayerPrediction ) ( int dopred, int bIncludeLocalClient ); + void ( *EV_PushPMStates ) ( void ); + void ( *EV_PopPMStates ) ( void ); + void ( *EV_SetSolidPlayers ) (int playernum); + void ( *EV_SetTraceHull ) ( int hull ); + void ( *EV_PlayerTrace ) ( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr ); + void ( *EV_WeaponAnimation ) ( int sequence, int body ); + unsigned short ( *EV_PrecacheEvent ) ( int type, const char* psz ); + void ( *EV_PlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); + const char *( *EV_TraceTexture ) ( int ground, float *vstart, float *vend ); + void ( *EV_StopAllSounds ) ( int entnum, int entchannel ); + void ( *EV_KillEvents ) ( int entnum, const char *eventname ); +} event_api_t; + +extern event_api_t eventapi; + +#endif diff --git a/reapi/include/cssdk/common/event_args.h b/reapi/include/cssdk/common/event_args.h new file mode 100644 index 0000000..99dd49a --- /dev/null +++ b/reapi/include/cssdk/common/event_args.h @@ -0,0 +1,50 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( EVENT_ARGSH ) +#define EVENT_ARGSH +#ifdef _WIN32 +#pragma once +#endif + +// Event was invoked with stated origin +#define FEVENT_ORIGIN ( 1<<0 ) + +// Event was invoked with stated angles +#define FEVENT_ANGLES ( 1<<1 ) + +typedef struct event_args_s +{ + int flags; + + // Transmitted + int entindex; + + float origin[3]; + float angles[3]; + float velocity[3]; + + int ducking; + + float fparam1; + float fparam2; + + int iparam1; + int iparam2; + + int bparam1; + int bparam2; +} event_args_t; + +#endif diff --git a/reapi/include/cssdk/common/event_flags.h b/reapi/include/cssdk/common/event_flags.h new file mode 100644 index 0000000..43f804f --- /dev/null +++ b/reapi/include/cssdk/common/event_flags.h @@ -0,0 +1,47 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( EVENT_FLAGSH ) +#define EVENT_FLAGSH +#ifdef _WIN32 +#pragma once +#endif + +// Skip local host for event send. +#define FEV_NOTHOST (1<<0) + +// Send the event reliably. You must specify the origin and angles and use +// PLAYBACK_EVENT_FULL for this to work correctly on the server for anything +// that depends on the event origin/angles. I.e., the origin/angles are not +// taken from the invoking edict for reliable events. +#define FEV_RELIABLE (1<<1) + +// Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC +// sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). +#define FEV_GLOBAL (1<<2) + +// If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate +// +#define FEV_UPDATE (1<<3) + +// Only send to entity specified as the invoker +#define FEV_HOSTONLY (1<<4) + +// Only send if the event was created on the server. +#define FEV_SERVER (1<<5) + +// Only issue event client side ( from shared code ) +#define FEV_CLIENT (1<<6) + +#endif diff --git a/reapi/include/cssdk/common/hltv.h b/reapi/include/cssdk/common/hltv.h new file mode 100644 index 0000000..a6ded4e --- /dev/null +++ b/reapi/include/cssdk/common/hltv.h @@ -0,0 +1,61 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// hltv.h +// all shared consts between server, clients and proxy + +#ifndef HLTV_H +#define HLTV_H + +#define TYPE_CLIENT 0 // client is a normal HL client (default) +#define TYPE_PROXY 1 // client is another proxy +#define TYPE_COMMENTATOR 3 // client is a commentator +#define TYPE_DEMO 4 // client is a demo file + +// sub commands of svc_hltv: +#define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands +#define HLTV_STATUS 1 // send status infos about proxy +#define HLTV_LISTEN 2 // tell client to listen to a multicast stream + +// director command types: +#define DRC_CMD_NONE 0 // NULL director command +#define DRC_CMD_START 1 // start director mode +#define DRC_CMD_EVENT 2 // informs about director command +#define DRC_CMD_MODE 3 // switches camera modes +#define DRC_CMD_CAMERA 4 // set fixed camera +#define DRC_CMD_TIMESCALE 5 // sets time scale +#define DRC_CMD_MESSAGE 6 // send HUD centerprint +#define DRC_CMD_SOUND 7 // plays a particular sound +#define DRC_CMD_STATUS 8 // HLTV broadcast status +#define DRC_CMD_BANNER 9 // set GUI banner +#define DRC_CMD_STUFFTEXT 10 // like the normal svc_stufftext but as director command +#define DRC_CMD_CHASE 11 // chase a certain player +#define DRC_CMD_INEYE 12 // view player through own eyes +#define DRC_CMD_MAP 13 // show overview map +#define DRC_CMD_CAMPATH 14 // define camera waypoint +#define DRC_CMD_WAYPOINTS 15 // start moving camera, inetranl message + +#define DRC_CMD_LAST 15 + + +// DRC_CMD_EVENT event flags +#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important) +#define DRC_FLAG_SIDE (1<<4) // +#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene +#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo +#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc) +#define DRC_FLAG_INTRO (1<<8) // is a introduction scene +#define DRC_FLAG_FINAL (1<<9) // is a final scene +#define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data + + +// DRC_CMD_WAYPOINT flags +#define DRC_FLAG_STARTPATH 1 // end with speed 0.0 +#define DRC_FLAG_SLOWSTART 2 // start with speed 0.0 +#define DRC_FLAG_SLOWEND 4 // end with speed 0.0 + +#endif // HLTV_H diff --git a/reapi/include/cssdk/common/in_buttons.h b/reapi/include/cssdk/common/in_buttons.h new file mode 100644 index 0000000..4196a2d --- /dev/null +++ b/reapi/include/cssdk/common/in_buttons.h @@ -0,0 +1,38 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#ifndef IN_BUTTONS_H +#define IN_BUTTONS_H +#ifdef _WIN32 +#pragma once +#endif + +#define IN_ATTACK (1 << 0) +#define IN_JUMP (1 << 1) +#define IN_DUCK (1 << 2) +#define IN_FORWARD (1 << 3) +#define IN_BACK (1 << 4) +#define IN_USE (1 << 5) +#define IN_CANCEL (1 << 6) +#define IN_LEFT (1 << 7) +#define IN_RIGHT (1 << 8) +#define IN_MOVELEFT (1 << 9) +#define IN_MOVERIGHT (1 << 10) +#define IN_ATTACK2 (1 << 11) +#define IN_RUN (1 << 12) +#define IN_RELOAD (1 << 13) +#define IN_ALT1 (1 << 14) +#define IN_SCORE (1 << 15) // Used by client.dll for when scoreboard is held down + +#endif // IN_BUTTONS_H diff --git a/reapi/include/cssdk/common/ivoicetweak.h b/reapi/include/cssdk/common/ivoicetweak.h new file mode 100644 index 0000000..da568c5 --- /dev/null +++ b/reapi/include/cssdk/common/ivoicetweak.h @@ -0,0 +1,38 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef IVOICETWEAK_H +#define IVOICETWEAK_H +#ifdef _WIN32 +#pragma once +#endif + +// These provide access to the voice controls. +typedef enum +{ + MicrophoneVolume=0, // values 0-1. + OtherSpeakerScale, // values 0-1. Scales how loud other players are. + MicBoost, // 20 db gain to voice input +} VoiceTweakControl; + + +typedef struct IVoiceTweak_s +{ + // These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back + // without sending to the server. + int (*StartVoiceTweakMode)(); // Returns 0 on error. + void (*EndVoiceTweakMode)(); + + // Get/set control values. + void (*SetControlFloat)(VoiceTweakControl iControl, float value); + float (*GetControlFloat)(VoiceTweakControl iControl); + + int (*GetSpeakingVolume)(); +} IVoiceTweak; + + +#endif // IVOICETWEAK_H diff --git a/reapi/include/cssdk/common/kbutton.h b/reapi/include/cssdk/common/kbutton.h new file mode 100644 index 0000000..a890ce5 --- /dev/null +++ b/reapi/include/cssdk/common/kbutton.h @@ -0,0 +1,44 @@ +/* +* +* 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 KBUTTON_H +#define KBUTTON_H +#ifdef _WIN32 +#pragma once +#endif + + +/* <31b2a> ../common/kbutton.h:7 */ +typedef struct kbutton_s +{ + int down[2]; + int state; +} kbutton_t; + + +#endif // KBUTTON_H diff --git a/reapi/include/cssdk/common/mathlib.h b/reapi/include/cssdk/common/mathlib.h new file mode 100644 index 0000000..bc93a60 --- /dev/null +++ b/reapi/include/cssdk/common/mathlib.h @@ -0,0 +1,99 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ + +#ifndef MATHLIB_H +#define MATHLIB_H + +/* <42b7f> ../common/mathlib.h:3 */ +typedef float vec_t; + +/* <42b91> ../common/mathlib.h:6 */ +#if !defined DID_VEC3_T_DEFINE && !defined vec3_t +#define DID_VEC3_T_DEFINE +typedef vec_t vec3_t[3]; +#endif + +/* <80013> ../common/mathlib.h:8 */ +typedef vec_t vec4_t[4]; + +/* <42bac> ../common/mathlib.h:18 */ +typedef int fixed16_t; /* size: 4 */ + +/* <42bb7> ../common/mathlib.h:60 */ +typedef union DLONG_u +{ + int i[2]; + double d; + float f; +} DLONG; + +#define M_PI 3.14159265358979323846 + +#ifdef __cplusplus +#ifdef min +#undef min +#endif + +#ifdef max +#undef max +#endif + +#ifdef clamp +#undef clamp +#endif + +template +inline T min(T a, T b) { + return (a < b) ? a : b; +} + +template +inline T max(T a, T b) { + return (a < b) ? b : a; +} + +template +inline T clamp(T a, T min, T max) { + return (a > max) ? max : (a < min) ? min : a; +} + +template +inline T bswap(T s) { + switch (sizeof(T)) { +#ifdef _WIN32 + case 2: {auto res = _byteswap_ushort(*(uint16 *)&s); return *(T *)&res;} + case 4: {auto res = _byteswap_ulong(*(uint32 *)(&s)); return *(T *)&res;} + case 8: {auto res = _byteswap_uint64(*(uint64 *)&s); return *(T *)&res;} +#else + case 2: {auto res = _bswap16(*(uint16 *)&s); return *(T *)&res;} + case 4: {auto res = _bswap(*(uint32 *)&s); return *(T *)&res;} + case 8: {auto res = _bswap64(*(uint64 *)&s); return *(T *)&res;} +#endif + default: return s; + } +} +#else // __cplusplus +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) +#endif // __cplusplus + +#endif // MATHLIB_H diff --git a/reapi/include/cssdk/common/net_api.h b/reapi/include/cssdk/common/net_api.h new file mode 100644 index 0000000..9551d18 --- /dev/null +++ b/reapi/include/cssdk/common/net_api.h @@ -0,0 +1,99 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#if !defined( NET_APIH ) +#define NET_APIH +#ifdef _WIN32 +#pragma once +#endif + +#if !defined ( NETADRH ) +#include "netadr.h" +#endif + +#define NETAPI_REQUEST_SERVERLIST ( 0 ) // Doesn't need a remote address +#define NETAPI_REQUEST_PING ( 1 ) +#define NETAPI_REQUEST_RULES ( 2 ) +#define NETAPI_REQUEST_PLAYERS ( 3 ) +#define NETAPI_REQUEST_DETAILS ( 4 ) + +// Set this flag for things like broadcast requests, etc. where the engine should not +// kill the request hook after receiving the first response +#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 ) + +typedef void ( *net_api_response_func_t ) ( struct net_response_s *response ); + +#define NET_SUCCESS ( 0 ) +#define NET_ERROR_TIMEOUT ( 1<<0 ) +#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 ) +#define NET_ERROR_UNDEFINED ( 1<<2 ) + +typedef struct net_adrlist_s +{ + struct net_adrlist_s *next; + netadr_t remote_address; +} net_adrlist_t; + +typedef struct net_response_s +{ + // NET_SUCCESS or an error code + int error; + + // Context ID + int context; + // Type + int type; + + // Server that is responding to the request + netadr_t remote_address; + + // Response RTT ping time + double ping; + // Key/Value pair string ( separated by backlash \ characters ) + // WARNING: You must copy this buffer in the callback function, because it is freed + // by the engine right after the call!!!! + // ALSO: For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's + void *response; +} net_response_t; + +typedef struct net_status_s +{ + // Connected to remote server? 1 == yes, 0 otherwise + int connected; + // Client's IP address + netadr_t local_address; + // Address of remote server + netadr_t remote_address; + // Packet Loss ( as a percentage ) + int packet_loss; + // Latency, in seconds ( multiply by 1000.0 to get milliseconds ) + double latency; + // Connection time, in seconds + double connection_time; + // Rate setting ( for incoming data ) + double rate; +} net_status_t; + +typedef struct net_api_s +{ + // APIs + void ( *InitNetworking )( void ); + void ( *Status ) ( struct net_status_s *status ); + void ( *SendRequest) ( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response ); + void ( *CancelRequest ) ( int context ); + void ( *CancelAllRequests ) ( void ); + char *( *AdrToString ) ( struct netadr_s *a ); + int ( *CompareAdr ) ( struct netadr_s *a, struct netadr_s *b ); + int ( *StringToAdr ) ( char *s, struct netadr_s *a ); + const char *( *ValueForKey ) ( const char *s, const char *key ); + void ( *RemoveKey ) ( char *s, const char *key ); + void ( *SetValueForKey ) (char *s, const char *key, const char *value, int maxsize ); +} net_api_t; + +extern net_api_t netapi; + +#endif // NET_APIH diff --git a/reapi/include/cssdk/common/netadr.h b/reapi/include/cssdk/common/netadr.h new file mode 100644 index 0000000..304073c --- /dev/null +++ b/reapi/include/cssdk/common/netadr.h @@ -0,0 +1,40 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// netadr.h +#ifndef NETADR_H +#define NETADR_H +#ifdef _WIN32 +#pragma once +#endif + +typedef enum +{ + NA_UNUSED, + NA_LOOPBACK, + NA_BROADCAST, + NA_IP, + NA_IPX, + NA_BROADCAST_IPX, +} netadrtype_t; + +typedef struct netadr_s +{ + netadrtype_t type; + unsigned char ip[4]; + unsigned char ipx[10]; + unsigned short port; +} netadr_t; + +#endif // NETADR_H diff --git a/reapi/include/cssdk/common/nowin.h b/reapi/include/cssdk/common/nowin.h new file mode 100644 index 0000000..0b1f577 --- /dev/null +++ b/reapi/include/cssdk/common/nowin.h @@ -0,0 +1,16 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef INC_NOWIN_H +#define INC_NOWIN_H +#ifndef _WIN32 + +#include +#include + +#endif //!_WIN32 +#endif //INC_NOWIN_H diff --git a/reapi/include/cssdk/common/parsemsg.cpp b/reapi/include/cssdk/common/parsemsg.cpp new file mode 100644 index 0000000..6742db2 --- /dev/null +++ b/reapi/include/cssdk/common/parsemsg.cpp @@ -0,0 +1,259 @@ +/*** +* +* Copyright (c) 1999, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// +// parsemsg.cpp +// +//-------------------------------------------------------------------------------------------------------------- +#include "parsemsg.h" +#include + +typedef unsigned char byte; +#define true 1 + +static byte *gpBuf; +static int giSize; +static int giRead; +static int giBadRead; + +int READ_OK( void ) +{ + return !giBadRead; +} + +void BEGIN_READ( void *buf, int size ) +{ + giRead = 0; + giBadRead = 0; + giSize = size; + gpBuf = (byte*)buf; +} + + +int READ_CHAR( void ) +{ + int c; + + if (giRead + 1 > giSize) + { + giBadRead = true; + return -1; + } + + c = (signed char)gpBuf[giRead]; + giRead++; + + return c; +} + +int READ_BYTE( void ) +{ + int c; + + if (giRead+1 > giSize) + { + giBadRead = true; + return -1; + } + + c = (unsigned char)gpBuf[giRead]; + giRead++; + + return c; +} + +int READ_SHORT( void ) +{ + int c; + + if (giRead+2 > giSize) + { + giBadRead = true; + return -1; + } + + c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) ); + + giRead += 2; + + return c; +} + +int READ_WORD( void ) +{ + return READ_SHORT(); +} + + +int READ_LONG( void ) +{ + int c; + + if (giRead+4 > giSize) + { + giBadRead = true; + return -1; + } + + c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24); + + giRead += 4; + + return c; +} + +float READ_FLOAT( void ) +{ + union + { + byte b[4]; + float f; + int l; + } dat; + + dat.b[0] = gpBuf[giRead]; + dat.b[1] = gpBuf[giRead+1]; + dat.b[2] = gpBuf[giRead+2]; + dat.b[3] = gpBuf[giRead+3]; + giRead += 4; + +// dat.l = LittleLong (dat.l); + + return dat.f; +} + +char* READ_STRING( void ) +{ + static char string[2048]; + int l,c; + + string[0] = 0; + + l = 0; + do + { + if ( giRead+1 > giSize ) + break; // no more characters + + c = READ_CHAR(); + if (c == -1 || c == 0) + break; + string[l] = c; + l++; + } while (l < sizeof(string)-1); + + string[l] = 0; + + return string; +} + +float READ_COORD( void ) +{ + return (float)(READ_SHORT() * (1.0/8)); +} + +float READ_ANGLE( void ) +{ + return (float)(READ_CHAR() * (360.0/256)); +} + +float READ_HIRESANGLE( void ) +{ + return (float)(READ_SHORT() * (360.0/65536)); +} + +//-------------------------------------------------------------------------------------------------------------- +BufferWriter::BufferWriter() +{ + Init( NULL, 0 ); +} + +//-------------------------------------------------------------------------------------------------------------- +BufferWriter::BufferWriter( unsigned char *buffer, int bufferLen ) +{ + Init( buffer, bufferLen ); +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::Init( unsigned char *buffer, int bufferLen ) +{ + m_overflow = false; + m_buffer = buffer; + m_remaining = bufferLen; + m_overallLength = bufferLen; +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::WriteByte( unsigned char data ) +{ + if (!m_buffer || !m_remaining) + { + m_overflow = true; + return; + } + + *m_buffer = data; + ++m_buffer; + --m_remaining; +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::WriteLong( int data ) +{ + if (!m_buffer || m_remaining < 4) + { + m_overflow = true; + return; + } + + m_buffer[0] = data&0xff; + m_buffer[1] = (data>>8)&0xff; + m_buffer[2] = (data>>16)&0xff; + m_buffer[3] = data>>24; + m_buffer += 4; + m_remaining -= 4; +} + +//-------------------------------------------------------------------------------------------------------------- +void BufferWriter::WriteString( const char *str ) +{ + if (!m_buffer || !m_remaining) + { + m_overflow = true; + return; + } + + if (!str) + str = ""; + + int len = strlen(str)+1; + if ( len > m_remaining ) + { + m_overflow = true; + str = ""; + len = 1; + } + + strcpy((char *)m_buffer, str); + m_remaining -= len; + m_buffer += len; +} + +//-------------------------------------------------------------------------------------------------------------- +int BufferWriter::GetSpaceUsed() +{ + return m_overallLength - m_remaining; +} + +//-------------------------------------------------------------------------------------------------------------- diff --git a/reapi/include/cssdk/common/parsemsg.h b/reapi/include/cssdk/common/parsemsg.h new file mode 100644 index 0000000..be7affc --- /dev/null +++ b/reapi/include/cssdk/common/parsemsg.h @@ -0,0 +1,66 @@ +/*** +* +* Copyright (c) 1999, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// +// parsemsg.h +// MDC - copying from cstrike\cl_dll so career-mode stuff can catch messages +// in this dll. (and C++ifying it) +// + +#ifndef PARSEMSG_H +#define PARSEMSG_H + +#define ASSERT( x ) +//-------------------------------------------------------------------------------------------------------------- +void BEGIN_READ( void *buf, int size ); +int READ_CHAR( void ); +int READ_BYTE( void ); +int READ_SHORT( void ); +int READ_WORD( void ); +int READ_LONG( void ); +float READ_FLOAT( void ); +char* READ_STRING( void ); +float READ_COORD( void ); +float READ_ANGLE( void ); +float READ_HIRESANGLE( void ); +int READ_OK( void ); + +//-------------------------------------------------------------------------------------------------------------- +class BufferWriter +{ +public: + BufferWriter(); + BufferWriter( unsigned char *buffer, int bufferLen ); + void Init( unsigned char *buffer, int bufferLen ); + + void WriteByte( unsigned char data ); + void WriteLong( int data ); + void WriteString( const char *str ); + + bool HasOverflowed(); + int GetSpaceUsed(); + +protected: + unsigned char *m_buffer; + int m_remaining; + bool m_overflow; + int m_overallLength; +}; + +//-------------------------------------------------------------------------------------------------------------- + +#endif // PARSEMSG_H + + + diff --git a/reapi/include/cssdk/common/particledef.h b/reapi/include/cssdk/common/particledef.h new file mode 100644 index 0000000..7e4043a --- /dev/null +++ b/reapi/include/cssdk/common/particledef.h @@ -0,0 +1,57 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( PARTICLEDEFH ) +#define PARTICLEDEFH +#ifdef _WIN32 +#pragma once +#endif + +typedef enum { + pt_static, + pt_grav, + pt_slowgrav, + pt_fire, + pt_explode, + pt_explode2, + pt_blob, + pt_blob2, + pt_vox_slowgrav, + pt_vox_grav, + pt_clientcustom // Must have callback function specified +} ptype_t; + +// !!! if this is changed, it must be changed in d_ifacea.h too !!! +typedef struct particle_s +{ +// driver-usable fields + vec3_t org; + short color; + short packedColor; +// drivers never touch the following fields + struct particle_s *next; + vec3_t vel; + float ramp; + float die; + ptype_t type; + void (*deathfunc)( struct particle_s *particle ); + + // for pt_clientcusttom, we'll call this function each frame + void (*callback)( struct particle_s *particle, float frametime ); + + // For deathfunc, etc. + unsigned char context; +} particle_t; + +#endif diff --git a/reapi/include/cssdk/common/pmtrace.h b/reapi/include/cssdk/common/pmtrace.h new file mode 100644 index 0000000..1784e9c --- /dev/null +++ b/reapi/include/cssdk/common/pmtrace.h @@ -0,0 +1,43 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( PMTRACEH ) +#define PMTRACEH +#ifdef _WIN32 +#pragma once +#endif + +typedef struct +{ + vec3_t normal; + float dist; +} pmplane_t; + +typedef struct pmtrace_s pmtrace_t; + +struct pmtrace_s +{ + qboolean allsolid; // if true, plane is not valid + qboolean startsolid; // if true, the initial point was in a solid area + qboolean inopen, inwater; // End point is in empty space or in water + float fraction; // time completed, 1.0 = didn't hit anything + vec3_t endpos; // final position + pmplane_t plane; // surface normal at impact + int ent; // entity at impact + vec3_t deltavelocity; // Change in player's velocity caused by impact. + // Only run on server. + int hitgroup; +}; + +#endif diff --git a/reapi/include/cssdk/common/port.h b/reapi/include/cssdk/common/port.h new file mode 100644 index 0000000..a0838a7 --- /dev/null +++ b/reapi/include/cssdk/common/port.h @@ -0,0 +1,119 @@ +// port.h: portability helper +// +////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "archtypes.h" // DAL + +#ifdef _WIN32 + + // Insert your headers here + #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + #define WIN32_EXTRA_LEAN + + #include "winsani_in.h" + #include + #include "winsani_out.h" + + #include + #include + #include + +#else // _WIN32 + + #include + #include + #include // exit() + #include // strncpy() + #include // tolower() + #include + #include + #include + #include + + typedef unsigned char BYTE; + + typedef int32 LONG; + //typedef uint32 ULONG; + + #ifndef ARCHTYPES_H + typedef uint32 ULONG; + #endif + + typedef void *HANDLE; + + #ifndef HMODULE + typedef void *HMODULE; + #endif + + typedef char * LPSTR; + + #define __cdecl + + + #ifdef __linux__ + typedef struct POINT_s + { + int x; + int y; + } POINT; + typedef void *HINSTANCE; + typedef void *HWND; + typedef void *HDC; + typedef void *HGLRC; + + typedef struct RECT_s + { + int left; + int right; + int top; + int bottom; + } RECT; + #endif + + + #ifdef __cplusplus + + //#undef FALSE + //#undef TRUE + + #ifdef OSX + //#else + //const bool FALSE = false; + //const bool TRUE = true; + #endif + #endif + + #ifndef NULL + #ifdef __cplusplus + #define NULL 0 + #else + #define NULL ((void *)0) + #endif + #endif + + #ifdef __cplusplus + inline int ioctlsocket( int d, int cmd, uint32 *argp ) { return ioctl( d, cmd, argp ); } + inline int closesocket( int fd ) { return close( fd ); } + inline char * GetCurrentDirectory( size_t size, char * buf ) { return getcwd( buf, size ); } + inline int WSAGetLastError() { return errno; } + + inline void DebugBreak( void ) { exit( 1 ); } + #endif + + extern char g_szEXEName[ 4096 ]; + + #define _snprintf snprintf + + #if defined(OSX) + #define SO_ARCH_SUFFIX ".dylib" + #else + #if defined ( __x86_64__ ) + #define SO_ARCH_SUFFIX "_amd64.so" + #else + #define SO_ARCH_SUFFIX ".so" + #endif + #endif +#endif + diff --git a/reapi/include/cssdk/common/qfont.h b/reapi/include/cssdk/common/qfont.h new file mode 100644 index 0000000..2fc8129 --- /dev/null +++ b/reapi/include/cssdk/common/qfont.h @@ -0,0 +1,41 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( QFONTH ) +#define QFONTH +#ifdef _WIN32 +#pragma once +#endif + +// Font stuff + +#define NUM_GLYPHS 256 +// does not exist: // #include "basetypes.h" + +typedef struct +{ + short startoffset; + short charwidth; +} charinfo; + +typedef struct qfont_s +{ + int width, height; + int rowcount; + int rowheight; + charinfo fontinfo[ NUM_GLYPHS ]; + unsigned char data[4]; +} qfont_t; + +#endif // qfont.h diff --git a/reapi/include/cssdk/common/qlimits.h b/reapi/include/cssdk/common/qlimits.h new file mode 100644 index 0000000..3fad403 --- /dev/null +++ b/reapi/include/cssdk/common/qlimits.h @@ -0,0 +1,39 @@ +//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ========== +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef QLIMITS_H +#define QLIMITS_H + +#if defined( _WIN32 ) +#pragma once +#endif + +// DATA STRUCTURE INFO + +#define MAX_NUM_ARGVS 50 + +// SYSTEM INFO +#define MAX_QPATH 64 // max length of a game pathname +#define MAX_OSPATH 260 // max length of a filesystem pathname + +#define ON_EPSILON 0.1 // point on plane side epsilon + +#define MAX_LIGHTSTYLE_INDEX_BITS 6 +#define MAX_LIGHTSTYLES (1< ../common/quakedef.h:29 */ +typedef int BOOL; /* size: 4 */ + +// user message +#define MAX_USER_MSG_DATA 192 + +/* <627f> ../common/quakedef.h:137 */ +//moved to com_model.h +//typedef struct cache_user_s +//{ +// void *data; +//} cache_user_t; + +/* <4313b> ../common/quakedef.h:162 */ +typedef int (*pfnUserMsgHook)(const char *, int, void *); diff --git a/reapi/include/cssdk/common/r_efx.h b/reapi/include/cssdk/common/r_efx.h new file mode 100644 index 0000000..4f7b806 --- /dev/null +++ b/reapi/include/cssdk/common/r_efx.h @@ -0,0 +1,197 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined ( R_EFXH ) +#define R_EFXH +#ifdef _WIN32 +#pragma once +#endif + +// particle_t +#if !defined( PARTICLEDEFH ) +#include "particledef.h" +#endif + +// BEAM +#if !defined( BEAMDEFH ) +#include "beamdef.h" +#endif + +// dlight_t +#if !defined ( DLIGHTH ) +#include "dlight.h" +#endif + +// cl_entity_t +#if !defined( CL_ENTITYH ) +#include "cl_entity.h" +#endif + +/* +// FOR REFERENCE, These are the built-in tracer colors. Note, color 4 is the one +// that uses the tracerred/tracergreen/tracerblue and traceralpha cvar settings +color24 gTracerColors[] = +{ + { 255, 255, 255 }, // White + { 255, 0, 0 }, // Red + { 0, 255, 0 }, // Green + { 0, 0, 255 }, // Blue + { 0, 0, 0 }, // Tracer default, filled in from cvars, etc. + { 255, 167, 17 }, // Yellow-orange sparks + { 255, 130, 90 }, // Yellowish streaks (garg) + { 55, 60, 144 }, // Blue egon streak + { 255, 130, 90 }, // More Yellowish streaks (garg) + { 255, 140, 90 }, // More Yellowish streaks (garg) + { 200, 130, 90 }, // More red streaks (garg) + { 255, 120, 70 }, // Darker red streaks (garg) +}; +*/ + +// Temporary entity array +#define TENTPRIORITY_LOW 0 +#define TENTPRIORITY_HIGH 1 + +// TEMPENTITY flags +#define FTENT_NONE 0x00000000 +#define FTENT_SINEWAVE 0x00000001 +#define FTENT_GRAVITY 0x00000002 +#define FTENT_ROTATE 0x00000004 +#define FTENT_SLOWGRAVITY 0x00000008 +#define FTENT_SMOKETRAIL 0x00000010 +#define FTENT_COLLIDEWORLD 0x00000020 +#define FTENT_FLICKER 0x00000040 +#define FTENT_FADEOUT 0x00000080 +#define FTENT_SPRANIMATE 0x00000100 +#define FTENT_HITSOUND 0x00000200 +#define FTENT_SPIRAL 0x00000400 +#define FTENT_SPRCYCLE 0x00000800 +#define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes +#define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw +#define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything +#define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner) +#define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed +#define FTENT_SPARKSHOWER 0x00020000 +#define FTENT_NOMODEL 0x00040000 // Doesn't have a model, never try to draw ( it just triggers other things ) +#define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things ) + +typedef struct tempent_s +{ + int flags; + float die; + float frameMax; + float x; + float y; + float z; + float fadeSpeed; + float bounceFactor; + int hitSound; + void ( *hitcallback ) ( struct tempent_s *ent, struct pmtrace_s *ptr ); + void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime ); + struct tempent_s *next; + int priority; + short clientIndex; // if attached, this is the index of the client to stick to + // if COLLIDEALL, this is the index of the client to ignore + // TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex! + + vec3_t tentOffset; // if attached, client origin + tentOffset = tent origin. + cl_entity_t entity; + + // baseline.origin - velocity + // baseline.renderamt - starting fadeout intensity + // baseline.angles - angle velocity +} TEMPENTITY; + +typedef struct efx_api_s efx_api_t; + +struct efx_api_s +{ + particle_t *( *R_AllocParticle ) ( void ( *callback ) ( struct particle_s *particle, float frametime ) ); + void ( *R_BlobExplosion ) ( float * org ); + void ( *R_Blood ) ( float * org, float * dir, int pcolor, int speed ); + void ( *R_BloodSprite ) ( float * org, int colorindex, int modelIndex, int modelIndex2, float size ); + void ( *R_BloodStream ) ( float * org, float * dir, int pcolor, int speed ); + void ( *R_BreakModel ) ( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags ); + void ( *R_Bubbles ) ( float * mins, float * maxs, float height, int modelIndex, int count, float speed ); + void ( *R_BubbleTrail ) ( float * start, float * end, float height, int modelIndex, int count, float speed ); + void ( *R_BulletImpactParticles ) ( float * pos ); + void ( *R_EntityParticles ) ( struct cl_entity_s *ent ); + void ( *R_Explosion ) ( float *pos, int model, float scale, float framerate, int flags ); + void ( *R_FizzEffect ) ( struct cl_entity_s *pent, int modelIndex, int density ); + void ( *R_FireField ) ( float * org, int radius, int modelIndex, int count, int flags, float life ); + void ( *R_FlickerParticles ) ( float * org ); + void ( *R_FunnelSprite ) ( float *org, int modelIndex, int reverse ); + void ( *R_Implosion ) ( float * end, float radius, int count, float life ); + void ( *R_LargeFunnel ) ( float * org, int reverse ); + void ( *R_LavaSplash ) ( float * org ); + void ( *R_MultiGunshot ) ( float * org, float * dir, float * noise, int count, int decalCount, int *decalIndices ); + void ( *R_MuzzleFlash ) ( float *pos1, int type ); + void ( *R_ParticleBox ) ( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life ); + void ( *R_ParticleBurst ) ( float * pos, int size, int color, float life ); + void ( *R_ParticleExplosion ) ( float * org ); + void ( *R_ParticleExplosion2 ) ( float * org, int colorStart, int colorLength ); + void ( *R_ParticleLine ) ( float * start, float *end, unsigned char r, unsigned char g, unsigned char b, float life ); + void ( *R_PlayerSprites ) ( int client, int modelIndex, int count, int size ); + void ( *R_Projectile ) ( float * origin, float * velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) ); + void ( *R_RicochetSound ) ( float * pos ); + void ( *R_RicochetSprite ) ( float *pos, struct model_s *pmodel, float duration, float scale ); + void ( *R_RocketFlare ) ( float *pos ); + void ( *R_RocketTrail ) ( float * start, float * end, int type ); + void ( *R_RunParticleEffect ) ( float * org, float * dir, int color, int count ); + void ( *R_ShowLine ) ( float * start, float * end ); + void ( *R_SparkEffect ) ( float *pos, int count, int velocityMin, int velocityMax ); + void ( *R_SparkShower ) ( float *pos ); + void ( *R_SparkStreaks ) ( float * pos, int count, int velocityMin, int velocityMax ); + void ( *R_Spray ) ( float * pos, float * dir, int modelIndex, int count, int speed, int spread, int rendermode ); + void ( *R_Sprite_Explode ) ( TEMPENTITY *pTemp, float scale, int flags ); + void ( *R_Sprite_Smoke ) ( TEMPENTITY *pTemp, float scale ); + void ( *R_Sprite_Spray ) ( float * pos, float * dir, int modelIndex, int count, int speed, int iRand ); + void ( *R_Sprite_Trail ) ( int type, float * start, float * end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed ); + void ( *R_Sprite_WallPuff ) ( TEMPENTITY *pTemp, float scale ); + void ( *R_StreakSplash ) ( float * pos, float * dir, int color, int count, float speed, int velocityMin, int velocityMax ); + void ( *R_TracerEffect ) ( float * start, float * end ); + void ( *R_UserTracerParticle ) ( float * org, float * vel, float life, int colorIndex, float length, unsigned char deathcontext, void ( *deathfunc)( struct particle_s *particle ) ); + particle_t *( *R_TracerParticles ) ( float * org, float * vel, float life ); + void ( *R_TeleportSplash ) ( float * org ); + void ( *R_TempSphereModel ) ( float *pos, float speed, float life, int count, int modelIndex ); + TEMPENTITY *( *R_TempModel ) ( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype ); + TEMPENTITY *( *R_DefaultSprite ) ( float *pos, int spriteIndex, float framerate ); + TEMPENTITY *( *R_TempSprite ) ( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags ); + int ( *Draw_DecalIndex ) ( int id ); + int ( *Draw_DecalIndexFromName ) ( char *name ); + void ( *R_DecalShoot ) ( int textureIndex, int entity, int modelIndex, float * position, int flags ); + void ( *R_AttachTentToPlayer ) ( int client, int modelIndex, float zoffset, float life ); + void ( *R_KillAttachedTents ) ( int client ); + BEAM *( *R_BeamCirclePoints ) ( int type, float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); + BEAM *( *R_BeamEntPoint ) ( int startEnt, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); + BEAM *( *R_BeamEnts ) ( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); + BEAM *( *R_BeamFollow ) ( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness ); + void ( *R_BeamKill ) ( int deadEntity ); + BEAM *( *R_BeamLightning ) ( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed ); + BEAM *( *R_BeamPoints ) ( float * start, float * end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); + BEAM *( *R_BeamRing ) ( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); + dlight_t *( *CL_AllocDlight ) ( int key ); + dlight_t *( *CL_AllocElight ) ( int key ); + TEMPENTITY *( *CL_TempEntAlloc ) ( float * org, struct model_s *model ); + TEMPENTITY *( *CL_TempEntAllocNoModel ) ( float * org ); + TEMPENTITY *( *CL_TempEntAllocHigh ) ( float * org, struct model_s *model ); + TEMPENTITY *( *CL_TentEntAllocCustom ) ( float *origin, struct model_s *model, int high, void ( *callback ) ( struct tempent_s *ent, float frametime, float currenttime ) ); + void ( *R_GetPackedColor ) ( short *packed, short color ); + short ( *R_LookupColor ) ( unsigned char r, unsigned char g, unsigned char b ); + void ( *R_DecalRemoveAll ) ( int textureIndex ); //textureIndex points to the decal index in the array, not the actual texture index. + void ( *R_FireCustomDecal ) ( int textureIndex, int entity, int modelIndex, float * position, int flags, float scale ); +}; + +extern efx_api_t efx; + +#endif diff --git a/reapi/include/cssdk/common/r_studioint.h b/reapi/include/cssdk/common/r_studioint.h new file mode 100644 index 0000000..2ddf012 --- /dev/null +++ b/reapi/include/cssdk/common/r_studioint.h @@ -0,0 +1,151 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#if !defined( R_STUDIOINT_H ) +#define R_STUDIOINT_H +#if defined( _WIN32 ) +#pragma once +#endif + +#define STUDIO_INTERFACE_VERSION 1 + +typedef struct engine_studio_api_s +{ + // Allocate number*size bytes and zero it + void *( *Mem_Calloc ) ( int number, size_t size ); + // Check to see if pointer is in the cache + void *( *Cache_Check ) ( struct cache_user_s *c ); + // Load file into cache ( can be swapped out on demand ) + void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu ); + // Retrieve model pointer for the named model + struct model_s *( *Mod_ForName ) ( const char *name, int crash_if_missing ); + // Retrieve pointer to studio model data block from a model + void *( *Mod_Extradata ) ( struct model_s *mod ); + // Retrieve indexed model from client side model precache list + struct model_s *( *GetModelByIndex ) ( int index ); + // Get entity that is set for rendering + struct cl_entity_s * ( *GetCurrentEntity ) ( void ); + // Get referenced player_info_t + struct player_info_s *( *PlayerInfo ) ( int index ); + // Get most recently received player state data from network system + struct entity_state_s *( *GetPlayerState ) ( int index ); + // Get viewentity + struct cl_entity_s * ( *GetViewEntity ) ( void ); + // Get current frame count, and last two timestampes on client + void ( *GetTimes ) ( int *framecount, double *current, double *old ); + // Get a pointer to a cvar by name + struct cvar_s *( *GetCvar ) ( const char *name ); + // Get current render origin and view vectors ( up, right and vpn ) + void ( *GetViewInfo ) ( float *origin, float *upv, float *rightv, float *vpnv ); + // Get sprite model used for applying chrome effect + struct model_s *( *GetChromeSprite ) ( void ); + // Get model counters so we can incement instrumentation + void ( *GetModelCounters ) ( int **s, int **a ); + // Get software scaling coefficients + void ( *GetAliasScale ) ( float *x, float *y ); + + // Get bone, light, alias, and rotation matrices + float ****( *StudioGetBoneTransform ) ( void ); + float ****( *StudioGetLightTransform )( void ); + float ***( *StudioGetAliasTransform ) ( void ); + float ***( *StudioGetRotationMatrix ) ( void ); + + // Set up body part, and get submodel pointers + void ( *StudioSetupModel ) ( int bodypart, void **ppbodypart, void **ppsubmodel ); + // Check if entity's bbox is in the view frustum + int ( *StudioCheckBBox ) ( void ); + // Apply lighting effects to model + void ( *StudioDynamicLight ) ( struct cl_entity_s *ent, struct alight_s *plight ); + void ( *StudioEntityLight ) ( struct alight_s *plight ); + void ( *StudioSetupLighting ) ( struct alight_s *plighting ); + + // Draw mesh vertices + void ( *StudioDrawPoints ) ( void ); + + // Draw hulls around bones + void ( *StudioDrawHulls ) ( void ); + // Draw bbox around studio models + void ( *StudioDrawAbsBBox ) ( void ); + // Draws bones + void ( *StudioDrawBones ) ( void ); + // Loads in appropriate texture for model + void ( *StudioSetupSkin ) ( void *ptexturehdr, int index ); + // Sets up for remapped colors + void ( *StudioSetRemapColors ) ( int top, int bottom ); + // Set's player model and returns model pointer + struct model_s *( *SetupPlayerModel ) ( int index ); + // Fires any events embedded in animation + void ( *StudioClientEvents ) ( void ); + // Retrieve/set forced render effects flags + int ( *GetForceFaceFlags ) ( void ); + void ( *SetForceFaceFlags ) ( int flags ); + // Tell engine the value of the studio model header + void ( *StudioSetHeader ) ( void *header ); + // Tell engine which model_t * is being renderered + void ( *SetRenderModel ) ( struct model_s *model ); + + // Final state setup and restore for rendering + void ( *SetupRenderer ) ( int rendermode ); + void ( *RestoreRenderer ) ( void ); + + // Set render origin for applying chrome effect + void ( *SetChromeOrigin ) ( void ); + + // True if using D3D/OpenGL + int ( *IsHardware ) ( void ); + + // Only called by hardware interface + void ( *GL_StudioDrawShadow ) ( void ); + void ( *GL_SetRenderMode ) ( int mode ); + + void ( *StudioSetRenderamt ) (int iRenderamt); //!!!CZERO added for rendering glass on viewmodels + void ( *StudioSetCullState ) ( int iCull ); + void ( *StudioRenderShadow ) ( int iSprite, float *p1, float *p2, float *p3, float *p4 ); +} engine_studio_api_t; + +typedef struct server_studio_api_s +{ + // Allocate number*size bytes and zero it + void *( *Mem_Calloc ) ( int number, size_t size ); + // Check to see if pointer is in the cache + void *( *Cache_Check ) ( struct cache_user_s *c ); + // Load file into cache ( can be swapped out on demand ) + void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu ); + // Retrieve pointer to studio model data block from a model + void *( *Mod_Extradata ) ( struct model_s *mod ); +} server_studio_api_t; + + +// client blending +typedef struct r_studio_interface_s +{ + int version; + int ( *StudioDrawModel ) ( int flags ); + int ( *StudioDrawPlayer ) ( int flags, struct entity_state_s *pplayer ); +} r_studio_interface_t; + +extern r_studio_interface_t *pStudioAPI; + +// server blending +#define SV_BLENDING_INTERFACE_VERSION 1 + +typedef struct sv_blending_interface_s +{ + int version; + + void ( *SV_StudioSetupBones )( struct model_s *pModel, + float frame, + int sequence, + const vec3_t angles, + const vec3_t origin, + const byte *pcontroller, + const byte *pblending, + int iBone, + const edict_t *pEdict ); +} sv_blending_interface_t; + +#endif // R_STUDIOINT_H diff --git a/reapi/include/cssdk/common/ref_params.h b/reapi/include/cssdk/common/ref_params.h new file mode 100644 index 0000000..90eb03f --- /dev/null +++ b/reapi/include/cssdk/common/ref_params.h @@ -0,0 +1,75 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( REF_PARAMSH ) +#define REF_PARAMSH + +typedef struct ref_params_s +{ + // Output + float vieworg[3]; + float viewangles[3]; + + float forward[3]; + float right[3]; + float up[3]; + + // Client frametime; + float frametime; + // Client time + float time; + + // Misc + int intermission; + int paused; + int spectator; + int onground; + int waterlevel; + + float simvel[3]; + float simorg[3]; + + float viewheight[3]; + float idealpitch; + + float cl_viewangles[3]; + + int health; + float crosshairangle[3]; + float viewsize; + + float punchangle[3]; + int maxclients; + int viewentity; + int playernum; + int max_entities; + int demoplayback; + int hardware; + + int smoothing; + + // Last issued usercmd + struct usercmd_s *cmd; + + // Movevars + struct movevars_s *movevars; + + int viewport[4]; // the viewport coordinates x ,y , width, height + + int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview + // so long in cycles until this value is 0 (multiple views) + int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions +} ref_params_t; + +#endif // !REF_PARAMSH diff --git a/reapi/include/cssdk/common/screenfade.h b/reapi/include/cssdk/common/screenfade.h new file mode 100644 index 0000000..62c0d25 --- /dev/null +++ b/reapi/include/cssdk/common/screenfade.h @@ -0,0 +1,24 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#if !defined( SCREENFADEH ) +#define SCREENFADEH +#ifdef _WIN32 +#pragma once +#endif + +typedef struct screenfade_s +{ + float fadeSpeed; // How fast to fade (tics / second) (+ fade in, - fade out) + float fadeEnd; // When the fading hits maximum + float fadeTotalEnd; // Total End Time of the fade (used for FFADE_OUT) + float fadeReset; // When to reset to not fading (for fadeout and hold) + byte fader, fadeg, fadeb, fadealpha; // Fade color + int fadeFlags; // Fading flags +} screenfade_t; + +#endif // !SCREENFADEH diff --git a/reapi/include/cssdk/common/studio_event.h b/reapi/include/cssdk/common/studio_event.h new file mode 100644 index 0000000..c79c210 --- /dev/null +++ b/reapi/include/cssdk/common/studio_event.h @@ -0,0 +1,29 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( STUDIO_EVENTH ) +#define STUDIO_EVENTH +#ifdef _WIN32 +#pragma once +#endif + +typedef struct mstudioevent_s +{ + int frame; + int event; + int type; + char options[64]; +} mstudioevent_t; + +#endif // STUDIO_EVENTH diff --git a/reapi/include/cssdk/common/triangleapi.h b/reapi/include/cssdk/common/triangleapi.h new file mode 100644 index 0000000..069a4d6 --- /dev/null +++ b/reapi/include/cssdk/common/triangleapi.h @@ -0,0 +1,64 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#if !defined( TRIANGLEAPIH ) +#define TRIANGLEAPIH +#ifdef _WIN32 +#pragma once +#endif + +typedef enum +{ + TRI_FRONT = 0, + TRI_NONE = 1, +} TRICULLSTYLE; + +#define TRI_API_VERSION 1 + +#define TRI_TRIANGLES 0 +#define TRI_TRIANGLE_FAN 1 +#define TRI_QUADS 2 +#define TRI_POLYGON 3 +#define TRI_LINES 4 +#define TRI_TRIANGLE_STRIP 5 +#define TRI_QUAD_STRIP 6 + +typedef struct triangleapi_s +{ + int version; + + void ( *RenderMode )( int mode ); + void ( *Begin )( int primitiveCode ); + void ( *End ) ( void ); + + void ( *Color4f ) ( float r, float g, float b, float a ); + void ( *Color4ub ) ( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); + void ( *TexCoord2f ) ( float u, float v ); + void ( *Vertex3fv ) ( float *worldPnt ); + void ( *Vertex3f ) ( float x, float y, float z ); + void ( *Brightness ) ( float brightness ); + void ( *CullFace ) ( TRICULLSTYLE style ); + int ( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame ); + int ( *WorldToScreen ) ( float *world, float *screen ); // Returns 1 if it's z clipped + void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); // Works just like GL_FOG, flFogColor is r/g/b. + void ( *ScreenToWorld ) ( float *screen, float *world ); + void ( *GetMatrix ) ( const int pname, float *matrix ); + int ( *BoxInPVS ) ( float *mins, float *maxs ); + void ( *LightAtPoint ) ( float *pos, float *value ); + void ( *Color4fRendermode ) ( float r, float g, float b, float a, int rendermode ); + void ( *FogParams ) ( float flDensity, int iFogSkybox ); // Used with Fog()...sets fog density and whether the fog should be applied to the skybox + +} triangleapi_t; + +#endif // !TRIANGLEAPIH diff --git a/reapi/include/cssdk/common/usercmd.h b/reapi/include/cssdk/common/usercmd.h new file mode 100644 index 0000000..7cdcfe2 --- /dev/null +++ b/reapi/include/cssdk/common/usercmd.h @@ -0,0 +1,41 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#ifndef USERCMD_H +#define USERCMD_H +#ifdef _WIN32 +#pragma once +#endif + +typedef struct usercmd_s +{ + short lerp_msec; // Interpolation time on client + byte msec; // Duration in ms of command + vec3_t viewangles; // Command view angles. + +// intended velocities + float forwardmove; // Forward velocity. + float sidemove; // Sideways velocity. + float upmove; // Upward velocity. + byte lightlevel; // Light level at spot where we are standing. + unsigned short buttons; // Attack buttons + byte impulse; // Impulse command issued. + byte weaponselect; // Current weapon id + +// Experimental player impact stuff. + int impact_index; + vec3_t impact_position; +} usercmd_t; + +#endif // USERCMD_H diff --git a/reapi/include/cssdk/common/vmodes.h b/reapi/include/cssdk/common/vmodes.h new file mode 100644 index 0000000..5d4384f --- /dev/null +++ b/reapi/include/cssdk/common/vmodes.h @@ -0,0 +1,35 @@ +/* +* +* 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. +* +*/ +#pragma once + + +/* <430ee> ../common/vmodes.h:40 */ +typedef struct rect_s +{ + int left, right, top, bottom; +} wrect_t; diff --git a/reapi/include/cssdk/common/weaponinfo.h b/reapi/include/cssdk/common/weaponinfo.h new file mode 100644 index 0000000..251a096 --- /dev/null +++ b/reapi/include/cssdk/common/weaponinfo.h @@ -0,0 +1,53 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ + +#ifndef WEAPONINFO_H +#define WEAPONINFO_H +#ifdef _WIN32 +#pragma once +#endif + +// Info about weapons player might have in his/her possession +typedef struct weapon_data_s +{ + int m_iId; + int m_iClip; + + float m_flNextPrimaryAttack; + float m_flNextSecondaryAttack; + float m_flTimeWeaponIdle; + + int m_fInReload; + int m_fInSpecialReload; + float m_flNextReload; + float m_flPumpTime; + float m_fReloadTime; + + float m_fAimedDamage; + float m_fNextAimBonus; + int m_fInZoom; + int m_iWeaponState; + + int iuser1; + int iuser2; + int iuser3; + int iuser4; + float fuser1; + float fuser2; + float fuser3; + float fuser4; +} weapon_data_t; + +#endif // WEAPONINFO_H diff --git a/reapi/include/cssdk/common/winsani_in.h b/reapi/include/cssdk/common/winsani_in.h new file mode 100644 index 0000000..d8c8527 --- /dev/null +++ b/reapi/include/cssdk/common/winsani_in.h @@ -0,0 +1,7 @@ +#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008) +#pragma push_macro("ARRAYSIZE") +#ifdef ARRAYSIZE +#undef ARRAYSIZE +#endif +#define HSPRITE WINDOWS_HSPRITE +#endif diff --git a/reapi/include/cssdk/common/winsani_out.h b/reapi/include/cssdk/common/winsani_out.h new file mode 100644 index 0000000..2726950 --- /dev/null +++ b/reapi/include/cssdk/common/winsani_out.h @@ -0,0 +1,4 @@ +#if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008) +#undef HSPRITE +#pragma pop_macro("ARRAYSIZE") +#endif diff --git a/reapi/include/cssdk/dlls/activity.h b/reapi/include/cssdk/dlls/activity.h new file mode 100644 index 0000000..a34b76a --- /dev/null +++ b/reapi/include/cssdk/dlls/activity.h @@ -0,0 +1,145 @@ +/* +* +* 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. +* +*/ +#pragma once + +typedef enum Activity_s +{ + ACT_INVALID = -1, + + ACT_RESET = 0, // Set m_Activity to this invalid value to force a reset to m_IdealActivity + ACT_IDLE, + ACT_GUARD, + ACT_WALK, + ACT_RUN, + ACT_FLY, + ACT_SWIM, + ACT_HOP, + ACT_LEAP, + ACT_FALL, + ACT_LAND, + ACT_STRAFE_LEFT, + ACT_STRAFE_RIGHT, + ACT_ROLL_LEFT, + ACT_ROLL_RIGHT, + ACT_TURN_LEFT, + ACT_TURN_RIGHT, + ACT_CROUCH, + ACT_CROUCHIDLE, + ACT_STAND, + ACT_USE, + ACT_SIGNAL1, + ACT_SIGNAL2, + ACT_SIGNAL3, + ACT_TWITCH, + ACT_COWER, + ACT_SMALL_FLINCH, + ACT_BIG_FLINCH, + ACT_RANGE_ATTACK1, + ACT_RANGE_ATTACK2, + ACT_MELEE_ATTACK1, + ACT_MELEE_ATTACK2, + ACT_RELOAD, + ACT_ARM, + ACT_DISARM, + ACT_EAT, + ACT_DIESIMPLE, + ACT_DIEBACKWARD, + ACT_DIEFORWARD, + ACT_DIEVIOLENT, + ACT_BARNACLE_HIT, + ACT_BARNACLE_PULL, + ACT_BARNACLE_CHOMP, + ACT_BARNACLE_CHEW, + ACT_SLEEP, + ACT_INSPECT_FLOOR, + ACT_INSPECT_WALL, + ACT_IDLE_ANGRY, + ACT_WALK_HURT, + ACT_RUN_HURT, + ACT_HOVER, + ACT_GLIDE, + ACT_FLY_LEFT, + ACT_FLY_RIGHT, + ACT_DETECT_SCENT, + ACT_SNIFF, + ACT_BITE, + ACT_THREAT_DISPLAY, + ACT_FEAR_DISPLAY, + ACT_EXCITED, + ACT_SPECIAL_ATTACK1, + ACT_SPECIAL_ATTACK2, + ACT_COMBAT_IDLE, + ACT_WALK_SCARED, + ACT_RUN_SCARED, + ACT_VICTORY_DANCE, + ACT_DIE_HEADSHOT, + ACT_DIE_CHESTSHOT, + ACT_DIE_GUTSHOT, + ACT_DIE_BACKSHOT, + ACT_FLINCH_HEAD, + ACT_FLINCH_CHEST, + ACT_FLINCH_STOMACH, + ACT_FLINCH_LEFTARM, + ACT_FLINCH_RIGHTARM, + ACT_FLINCH_LEFTLEG, + ACT_FLINCH_RIGHTLEG, + ACT_FLINCH, + ACT_LARGE_FLINCH, + ACT_HOLDBOMB, + ACT_IDLE_FIDGET, + ACT_IDLE_SCARED, + ACT_IDLE_SCARED_FIDGET, + ACT_FOLLOW_IDLE, + ACT_FOLLOW_IDLE_FIDGET, + ACT_FOLLOW_IDLE_SCARED, + ACT_FOLLOW_IDLE_SCARED_FIDGET, + ACT_CROUCH_IDLE, + ACT_CROUCH_IDLE_FIDGET, + ACT_CROUCH_IDLE_SCARED, + ACT_CROUCH_IDLE_SCARED_FIDGET, + ACT_CROUCH_WALK, + ACT_CROUCH_WALK_SCARED, + ACT_CROUCH_DIE, + ACT_WALK_BACK, + ACT_IDLE_SNEAKY, + ACT_IDLE_SNEAKY_FIDGET, + ACT_WALK_SNEAKY, + ACT_WAVE, + ACT_YES, + ACT_NO, + +} Activity; + +typedef struct +{ + int type; + char *name; + +} activity_map_t; + +extern activity_map_t activity_map[]; diff --git a/reapi/include/cssdk/dlls/activitymap.h b/reapi/include/cssdk/dlls/activitymap.h new file mode 100644 index 0000000..cf5ddfc --- /dev/null +++ b/reapi/include/cssdk/dlls/activitymap.h @@ -0,0 +1,111 @@ +/* +* +* 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. +* +*/ + +#define _A(a)\ + { a, #a } + +activity_map_t activity_map[] = +{ + _A(ACT_IDLE), + _A(ACT_GUARD), + _A(ACT_WALK), + _A(ACT_RUN), + _A(ACT_FLY), + _A(ACT_SWIM), + _A(ACT_HOP), + _A(ACT_LEAP), + _A(ACT_FALL), + _A(ACT_LAND), + _A(ACT_STRAFE_LEFT), + _A(ACT_STRAFE_RIGHT), + _A(ACT_ROLL_LEFT), + _A(ACT_ROLL_RIGHT), + _A(ACT_TURN_LEFT), + _A(ACT_TURN_RIGHT), + _A(ACT_CROUCH), + _A(ACT_CROUCHIDLE), + _A(ACT_STAND), + _A(ACT_USE), + _A(ACT_SIGNAL1), + _A(ACT_SIGNAL2), + _A(ACT_SIGNAL3), + _A(ACT_TWITCH), + _A(ACT_COWER), + _A(ACT_SMALL_FLINCH), + _A(ACT_BIG_FLINCH), + _A(ACT_RANGE_ATTACK1), + _A(ACT_RANGE_ATTACK2), + _A(ACT_MELEE_ATTACK1), + _A(ACT_MELEE_ATTACK2), + _A(ACT_RELOAD), + _A(ACT_ARM), + _A(ACT_DISARM), + _A(ACT_EAT), + _A(ACT_DIESIMPLE), + _A(ACT_DIEBACKWARD), + _A(ACT_DIEFORWARD), + _A(ACT_DIEVIOLENT), + _A(ACT_BARNACLE_HIT), + _A(ACT_BARNACLE_PULL), + _A(ACT_BARNACLE_CHOMP), + _A(ACT_BARNACLE_CHEW), + _A(ACT_SLEEP), + _A(ACT_INSPECT_FLOOR), + _A(ACT_INSPECT_WALL), + _A(ACT_IDLE_ANGRY), + _A(ACT_WALK_HURT), + _A(ACT_RUN_HURT), + _A(ACT_HOVER), + _A(ACT_GLIDE), + _A(ACT_FLY_LEFT), + _A(ACT_FLY_RIGHT), + _A(ACT_DETECT_SCENT), + _A(ACT_SNIFF), + _A(ACT_BITE), + _A(ACT_THREAT_DISPLAY), + _A(ACT_FEAR_DISPLAY), + _A(ACT_EXCITED), + _A(ACT_SPECIAL_ATTACK1), + _A(ACT_SPECIAL_ATTACK2), + _A(ACT_COMBAT_IDLE), + _A(ACT_WALK_SCARED), + _A(ACT_RUN_SCARED), + _A(ACT_VICTORY_DANCE), + _A(ACT_DIE_HEADSHOT), + _A(ACT_DIE_CHESTSHOT), + _A(ACT_DIE_GUTSHOT), + _A(ACT_DIE_BACKSHOT), + _A(ACT_FLINCH_HEAD), + _A(ACT_FLINCH_CHEST), + _A(ACT_FLINCH_STOMACH), + _A(ACT_FLINCH_LEFTARM), + _A(ACT_FLINCH_RIGHTARM), + _A(ACT_FLINCH_LEFTLEG), + _A(ACT_FLINCH_RIGHTLEG), + 0, NULL +}; diff --git a/reapi/include/cssdk/dlls/airtank.h b/reapi/include/cssdk/dlls/airtank.h new file mode 100644 index 0000000..3f435a8 --- /dev/null +++ b/reapi/include/cssdk/dlls/airtank.h @@ -0,0 +1,42 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CAirtank: public CGrenade { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; + + int GetState() const { return m_state; } +private: + int m_state; +}; diff --git a/reapi/include/cssdk/dlls/ammo.h b/reapi/include/cssdk/dlls/ammo.h new file mode 100644 index 0000000..4b22b9e --- /dev/null +++ b/reapi/include/cssdk/dlls/ammo.h @@ -0,0 +1,98 @@ +/* +* +* 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. +* +*/ +#pragma once + +class C9MMAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class CBuckShotAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C556NatoAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C556NatoBoxAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C762NatoAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C45ACPAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C50AEAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C338MagnumAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C57MMAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; + +class C357SIGAmmo: public CBasePlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; +}; diff --git a/reapi/include/cssdk/dlls/basemonster.h b/reapi/include/cssdk/dlls/basemonster.h new file mode 100644 index 0000000..9b4b933 --- /dev/null +++ b/reapi/include/cssdk/dlls/basemonster.h @@ -0,0 +1,105 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "activity.h" + +class EHANDLE; + +enum MONSTERSTATE +{ + MONSTERSTATE_NONE = 0, + MONSTERSTATE_IDLE, + MONSTERSTATE_COMBAT, + MONSTERSTATE_ALERT, + MONSTERSTATE_HUNT, + MONSTERSTATE_PRONE, + MONSTERSTATE_SCRIPT, + MONSTERSTATE_PLAYDEAD, + MONSTERSTATE_DEAD +}; + +class CBaseToggle; +class CBaseMonster: public CBaseToggle { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int TakeHealth(float flHealth, int bitsDamageType) = 0; + virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; + virtual BOOL IsAlive() = 0; + virtual float ChangeYaw(int speed) = 0; + virtual BOOL HasHumanGibs() = 0; + virtual BOOL HasAlienGibs() = 0; + virtual void FadeMonster() = 0; + virtual void GibMonster() = 0; + virtual Activity GetDeathActivity() = 0; + virtual void BecomeDead() = 0; + virtual BOOL ShouldFadeOnDeath() = 0; + virtual int IRelationship(CBaseEntity *pTarget) = 0; + virtual void PainSound() = 0; + virtual void ResetMaxSpeed() = 0; + virtual void ReportAIState() = 0; + virtual void MonsterInitDead() = 0; + virtual void Look(int iDistance) = 0; + virtual CBaseEntity *BestVisibleEnemy() = 0; + virtual BOOL FInViewCone(CBaseEntity *pEntity) = 0; + virtual BOOL FInViewCone(const Vector *pOrigin) = 0; +public: + 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 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 StopAnimation() { pev->framerate = 0.0f; } +public: + Activity m_Activity; // what the monster is doing (animation) + Activity m_IdealActivity; // monster should switch to this activity + int m_LastHitGroup; // the last body region that took damage + int m_bitsDamageType; // what types of damage has monster (player) taken + BYTE m_rgbTimeBasedDamage[8]; + + MONSTERSTATE m_MonsterState; // monster's current state + MONSTERSTATE m_IdealMonsterState; // monster should change to this state + int m_afConditions; + int m_afMemory; + + float m_flNextAttack; // cannot attack again until this time + EHANDLE m_hEnemy; // the entity that the monster is fighting. + EHANDLE m_hTargetEnt; // the entity that the monster is trying to reach + float m_flFieldOfView; // width of monster's field of view ( dot product ) + int m_bloodColor; // color of blood particless + Vector m_HackedGunPos; // HACK until we can query end of gun + Vector m_vecEnemyLKP; // last known position of enemy. (enemy's origin) +}; diff --git a/reapi/include/cssdk/dlls/bmodels.h b/reapi/include/cssdk/dlls/bmodels.h new file mode 100644 index 0000000..741ebc6 --- /dev/null +++ b/reapi/include/cssdk/dlls/bmodels.h @@ -0,0 +1,131 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SF_PENDULUM_SWING 2 // spawnflag that makes a pendulum a rope swing. + +#define SF_BRUSH_ACCDCC 16 // brush should accelerate and decelerate when toggled +#define SF_BRUSH_HURT 32 // rotating brush that inflicts pain based on rotation speed +#define SF_ROTATING_NOT_SOLID 64 // some special rotating objects are not solid. + +#define SF_WALL_START_OFF 0x0001 + +#define SF_CONVEYOR_VISUAL 0x0001 +#define SF_CONVEYOR_NOTSOLID 0x0002 + +#define SF_WORLD_DARK 0x0001 // Fade from black at startup +#define SF_WORLD_TITLE 0x0002 // Display game title at startup +#define SF_WORLD_FORCETEAM 0x0004 // Force teams + +#define FANPITCHMIN 30 +#define FANPITCHMAX 100 + +// This is just a solid wall if not inhibited +class CFuncWall: public CBaseEntity { +public: + virtual void Spawn() = 0; + + // Bmodels don't go across transitions + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class CFuncWallToggle: public CFuncWall { +public: + virtual void Spawn() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class CFuncConveyor: public CFuncWall { +public: + virtual void Spawn() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +// A simple entity that looks solid but lets you walk through it. +class CFuncIllusionary: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int ObjectCaps() = 0; +}; + +// Monster only clip brush +// +// This brush will be solid for any entity who has the FL_MONSTERCLIP flag set +// in pev->flags +// +// otherwise it will be invisible and not solid. This can be used to keep +// specific monsters out of certain areas +class CFuncMonsterClip: public CFuncWall { +public: + virtual void Spawn() = 0; + + // Clear out func_wall's use function + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class CFuncRotating: public CBaseEntity { +public: + // basic functions + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; +public: + + float m_flFanFriction; + float m_flAttenuation; + float m_flVolume; + float m_pitch; + int m_sounds; +}; + +class CPendulum: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; +public: + float m_accel; // Acceleration + float m_distance; + float m_time; + float m_damp; + float m_maxSpeed; + float m_dampSpeed; + + Vector m_center; + Vector m_start; +}; diff --git a/reapi/include/cssdk/dlls/bot/cs_bot.h b/reapi/include/cssdk/dlls/bot/cs_bot.h new file mode 100644 index 0000000..d15cb3a --- /dev/null +++ b/reapi/include/cssdk/dlls/bot/cs_bot.h @@ -0,0 +1,641 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "bot/cs_gamestate.h" +#include "bot/cs_bot_manager.h" +#include "bot/cs_bot_chatter.h" + +#define PRIMARY_WEAPON_BUY_COUNT 13 +#define SECONDARY_WEAPON_BUY_COUNT 3 + +#define FLAG_PROGRESS_DRAW 0x0 // draw status bar progress +#define FLAG_PROGRESS_START 0x1 // init status bar progress +#define FLAG_PROGRESS_HIDE 0x2 // hide status bar progress + +#define HI_X 0x01 +#define LO_X 0x02 +#define HI_Y 0x04 +#define LO_Y 0x08 +#define HI_Z 0x10 +#define LO_Z 0x20 + +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 primaryWeaponBuyInfoT[PRIMARY_WEAPON_BUY_COUNT]; +extern struct BuyInfo secondaryWeaponBuyInfoT[SECONDARY_WEAPON_BUY_COUNT]; + +class CCSBot; +class BotChatterInterface; + +class BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const = 0; +}; + +class IdleState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual const char *GetName() const { return "Idle"; } +}; + +class HuntState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "Hunt"; } +public: + CNavArea *m_huntArea; +}; + +class AttackState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "Attack"; } +public: + enum DodgeStateType + { + STEADY_ON, + SLIDE_LEFT, + SLIDE_RIGHT, + JUMP, + NUM_ATTACK_STATES + } m_dodgeState; + + float m_nextDodgeStateTimestamp; + CountdownTimer m_repathTimer; + float m_scopeTimestamp; + bool m_haveSeenEnemy; + bool m_isEnemyHidden; + float m_reacquireTimestamp; + float m_shieldToggleTimestamp; + bool m_shieldForceOpen; + float m_pinnedDownTimestamp; + bool m_crouchAndHold; + bool m_didAmbushCheck; + bool m_dodge; + bool m_firstDodge; + bool m_isCoward; + CountdownTimer m_retreatTimer; +}; + +class InvestigateNoiseState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "InvestigateNoise"; } +private: + void AttendCurrentNoise(CCSBot *me); + Vector m_checkNoisePosition; +}; + +class BuyState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "Buy"; } +public: + bool m_isInitialDelay; + int m_prefRetries; + int m_prefIndex; + int m_retries; + bool m_doneBuying; + bool m_buyDefuseKit; + bool m_buyGrenade; + bool m_buyShield; + bool m_buyPistol; +}; + +class MoveToState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "MoveTo"; } + + void SetGoalPosition(const Vector &pos) { m_goalPosition = pos; } + void SetRouteType(RouteType route) { m_routeType = route; } + +private: + Vector m_goalPosition; + RouteType m_routeType; + bool m_radioedPlan; + bool m_askedForCover; +}; + +class FetchBombState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual const char *GetName() const { return "FetchBomb"; } +}; + +class PlantBombState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "PlantBomb"; } +}; + +class DefuseBombState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "DefuseBomb"; } +}; + +class HideState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "Hide"; } + +public: + 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 SetDuration(float time) { m_duration = time; } + void SetHoldPosition(bool hold) { m_isHoldingPosition = hold; } + + bool IsAtSpot() const { return m_isAtSpot; } + +public: + CNavArea *m_searchFromArea; + float m_range; + + Vector m_hidingSpot; + bool m_isAtSpot; + float m_duration; + bool m_isHoldingPosition; + float m_holdPositionTime; + bool m_heardEnemy; + + float m_firstHeardEnemyTime; + int m_retry; + Vector m_leaderAnchorPos; +}; + +class EscapeFromBombState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "EscapeFromBomb"; } +}; + +class FollowState: public BotState +{ +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "Follow"; } + + void SetLeader(CBaseEntity *leader) { m_leader = leader; } + +public: + EHANDLE m_leader; + Vector m_lastLeaderPos; + bool m_isStopped; + float m_stoppedTimestamp; + + enum LeaderMotionStateType + { + INVALID, + STOPPED, + WALKING, + RUNNING + + } m_leaderMotionState; + + IntervalTimer m_leaderMotionStateTime; + + bool m_isSneaking; + float m_lastSawLeaderTime; + CountdownTimer m_repathInterval; + + IntervalTimer m_walkTime; + bool m_isAtWalkSpeed; + + float m_waitTime; + CountdownTimer m_idleTimer; +}; + +class UseEntityState: public BotState { +public: + virtual void OnEnter(CCSBot *me) {} + virtual void OnUpdate(CCSBot *me) {} + virtual void OnExit(CCSBot *me) {} + virtual const char *GetName() const { return "UseEntity"; } + + void SetEntity(CBaseEntity *entity) { m_entity = entity; } + +private: + EHANDLE m_entity; +}; + +// The Counter-strike Bot +class CCSBot: public CBot { +public: + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; // invoked when injured by something (EXTEND) - returns the amount of damage inflicted + virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; // invoked when killed (EXTEND) + virtual void RoundRespawn() = 0; + virtual void Blind(float duration, float holdTime, float fadeTime, int alpha = 255) = 0; // player blinded by a flashbang + virtual void OnTouchingWeapon(CWeaponBox *box) = 0; // invoked when in contact with a CWeaponBox + + virtual bool Initialize(const BotProfile *profile) = 0; // (EXTEND) prepare bot for action + virtual void SpawnBot() = 0; // (EXTEND) spawn the bot into the game + + virtual void Upkeep() = 0; // lightweight maintenance, invoked frequently + virtual void Update() = 0; // heavyweight algorithms, invoked less often + + virtual void Walk() = 0; + virtual bool Jump(bool mustJump = false) = 0; // returns true if jump was started + + virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0; // invoked when event occurs in the game (some events have NULL entity) + + #define CHECK_FOV true + virtual bool IsVisible(const Vector *pos, bool testFOV = false) const = 0; // return true if we can see the point + virtual bool IsVisible(CBasePlayer *player, bool testFOV = false, unsigned char *visParts = NULL) const = 0; // return true if we can see any part of the player + + virtual bool IsEnemyPartVisible(VisiblePartType part) const = 0; // if enemy is visible, return the part we see for our current enemy + +public: + const Vector &GetEyePosition() const + { + m_eyePos = pev->origin + pev->view_ofs; + return m_eyePos; + } +public: + friend class CCSBotManager; + + // TODO: Get rid of these + friend class AttackState; + friend class BuyState; + + char m_name[64]; // copied from STRING(pev->netname) for debugging + + // behavior properties + float m_combatRange; // desired distance between us and them during gunplay + mutable bool m_isRogue; // if true, the bot is a "rogue" and listens to no-one + mutable CountdownTimer m_rogueTimer; + + enum MoraleType + { + TERRIBLE = -3, + BAD = -2, + NEGATIVE = -1, + NEUTRAL = 0, + POSITIVE = 1, + GOOD = 2, + EXCELLENT = 3, + }; + + MoraleType m_morale; // our current morale, based on our win/loss history + bool m_diedLastRound; // true if we died last round + float m_safeTime; // duration at the beginning of the round where we feel "safe" + bool m_wasSafe; // true if we were in the safe time last update + NavRelativeDirType m_blindMoveDir; // which way to move when we're blind + bool m_blindFire; // if true, fire weapon while blinded + + // TODO: implement through CountdownTimer + float m_surpriseDelay; // when we were surprised + float m_surpriseTimestamp; + + bool m_isFollowing; // true if we are following someone + EHANDLE m_leader; // the ID of who we are following + float m_followTimestamp; // when we started following + float m_allowAutoFollowTime; // time when we can auto follow + + CountdownTimer m_hurryTimer; // if valid, bot is in a hurry + + // instances of each possible behavior state, to avoid dynamic memory allocation during runtime + IdleState m_idleState; + HuntState m_huntState; + AttackState m_attackState; + InvestigateNoiseState m_investigateNoiseState; + BuyState m_buyState; + MoveToState m_moveToState; + FetchBombState m_fetchBombState; + PlantBombState m_plantBombState; + DefuseBombState m_defuseBombState; + HideState m_hideState; + EscapeFromBombState m_escapeFromBombState; + FollowState m_followState; + UseEntityState m_useEntityState; + + // TODO: Allow multiple simultaneous state machines (look around, etc) + BotState *m_state; // current behavior state + float m_stateTimestamp; // time state was entered + bool m_isAttacking; // if true, special Attack state is overriding the state machine + + // high-level tasks + enum TaskType + { + SEEK_AND_DESTROY, + PLANT_BOMB, + FIND_TICKING_BOMB, + DEFUSE_BOMB, + GUARD_TICKING_BOMB, + GUARD_BOMB_DEFUSER, + GUARD_LOOSE_BOMB, + GUARD_BOMB_ZONE, + ESCAPE_FROM_BOMB, + HOLD_POSITION, + FOLLOW, + VIP_ESCAPE, + GUARD_VIP_ESCAPE_ZONE, + COLLECT_HOSTAGES, + RESCUE_HOSTAGES, + GUARD_HOSTAGES, + GUARD_HOSTAGE_RESCUE_ZONE, + MOVE_TO_LAST_KNOWN_ENEMY_POSITION, + MOVE_TO_SNIPER_SPOT, + SNIPING, + + NUM_TASKS + }; + TaskType m_task; // our current task + EHANDLE m_taskEntity; // an entity used for our task + + // navigation + Vector m_goalPosition; + EHANDLE m_goalEntity; + + CNavArea *m_currentArea; // the nav area we are standing on + CNavArea *m_lastKnownArea; // the last area we were in + EHANDLE m_avoid; // higher priority player we need to make way for + float m_avoidTimestamp; + bool m_isJumpCrouching; + bool m_isJumpCrouched; + float m_jumpCrouchTimestamp; + + // path navigation data + enum { _MAX_PATH_LENGTH = 256 }; + struct ConnectInfo + { + CNavArea *area; // the area along the path + NavTraverseType how; // how to enter this area from the previous one + 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]; + int m_pathLength; + int m_pathIndex; + float m_areaEnteredTimestamp; + + CountdownTimer m_repathTimer; // must have elapsed before bot can pathfind again + + mutable CountdownTimer m_avoidFriendTimer; // used to throttle how often we check for friends in our path + mutable bool m_isFriendInTheWay; // true if a friend is blocking our path + CountdownTimer m_politeTimer; // we'll wait for friend to move until this runs out + bool m_isWaitingBehindFriend; // true if we are waiting for a friend to move + + enum LadderNavState + { + APPROACH_ASCENDING_LADDER, // prepare to scale a ladder + APPROACH_DESCENDING_LADDER, // prepare to go down ladder + FACE_ASCENDING_LADDER, + FACE_DESCENDING_LADDER, + MOUNT_ASCENDING_LADDER, // move toward ladder until "on" it + MOUNT_DESCENDING_LADDER, // move toward ladder until "on" it + ASCEND_LADDER, // go up the ladder + DESCEND_LADDER, // go down the ladder + DISMOUNT_ASCENDING_LADDER, // get off of the ladder + DISMOUNT_DESCENDING_LADDER, // get off of the ladder + MOVE_TO_DESTINATION, // dismount ladder and move to destination area + } + m_pathLadderState; + bool m_pathLadderFaceIn; // if true, face towards ladder, otherwise face away + const CNavLadder *m_pathLadder; // the ladder we need to use to reach the next area + NavRelativeDirType m_pathLadderDismountDir; // which way to dismount + float m_pathLadderDismountTimestamp; // time when dismount started + float m_pathLadderEnd; // if ascending, z of top, if descending z of bottom + float m_pathLadderTimestamp; // time when we started using ladder - for timeout check + + CountdownTimer m_mustRunTimer; // if nonzero, bot cannot walk + + // game scenario mechanisms + CSGameState m_gameState; + + // hostages mechanism + byte m_hostageEscortCount; + float m_hostageEscortCountTimestamp; + bool m_isWaitingForHostage; + CountdownTimer m_inhibitWaitingForHostageTimer; + CountdownTimer m_waitForHostageTimer; + + // listening mechanism + Vector m_noisePosition; // position we last heard non-friendly noise + float m_noiseTimestamp; // when we heard it (can get zeroed) + CNavArea *m_noiseArea; // the nav area containing the noise + float m_noiseCheckTimestamp; + PriorityType m_noisePriority; // priority of currently heard noise + bool m_isNoiseTravelRangeChecked; + + // "looking around" mechanism + float m_lookAroundStateTimestamp; // time of next state change + float m_lookAheadAngle; // our desired forward look angle + float m_forwardAngle; // our current forward facing direction + float m_inhibitLookAroundTimestamp; // time when we can look around again + + enum LookAtSpotState + { + NOT_LOOKING_AT_SPOT, // not currently looking at a point in space + LOOK_TOWARDS_SPOT, // in the process of aiming at m_lookAtSpot + LOOK_AT_SPOT, // looking at m_lookAtSpot + NUM_LOOK_AT_SPOT_STATES + } + m_lookAtSpotState; + Vector m_lookAtSpot; // the spot we're currently looking at + PriorityType m_lookAtSpotPriority; + float m_lookAtSpotDuration; // how long we need to look at the spot + float m_lookAtSpotTimestamp; // when we actually began looking at the spot + float m_lookAtSpotAngleTolerance; // how exactly we must look at the spot + bool m_lookAtSpotClearIfClose; // if true, the look at spot is cleared if it gets close to us + const char *m_lookAtDesc; // for debugging + float m_peripheralTimestamp; + + enum { MAX_APPROACH_POINTS = 16 }; + Vector m_approachPoint[MAX_APPROACH_POINTS]; + unsigned char m_approachPointCount; + Vector m_approachPointViewPosition; // the position used when computing current approachPoint set + bool m_isWaitingToTossGrenade; // lining up throw + CountdownTimer m_tossGrenadeTimer; // timeout timer for grenade tossing + + SpotEncounter *m_spotEncounter; // the spots we will encounter as we move thru our current area + float m_spotCheckTimestamp; // when to check next encounter spot + + // TODO: Add timestamp for each possible client to hiding spots + enum { MAX_CHECKED_SPOTS = 64 }; + struct HidingSpotCheckInfo + { + HidingSpot *spot; + float timestamp; + } + m_checkedHidingSpot[MAX_CHECKED_SPOTS]; + int m_checkedHidingSpotCount; + + // view angle mechanism + float m_lookPitch; // our desired look pitch angle + float m_lookPitchVel; + float m_lookYaw; // our desired look yaw angle + float m_lookYawVel; + + // aim angle mechanism + mutable Vector m_eyePos; + Vector m_aimOffset; // current error added to victim's position to get actual aim spot + Vector m_aimOffsetGoal; // desired aim offset + float m_aimOffsetTimestamp; // time of next offset adjustment + float m_aimSpreadTimestamp; // time used to determine max spread as it begins to tighten up + Vector m_aimSpot; // the spot we are currently aiming to fire at + + // attack state data + // behavior modifiers + enum DispositionType + { + ENGAGE_AND_INVESTIGATE, // engage enemies on sight and investigate enemy noises + OPPORTUNITY_FIRE, // engage enemies on sight, but only look towards enemy noises, dont investigate + SELF_DEFENSE, // only engage if fired on, or very close to enemy + IGNORE_ENEMIES, // ignore all enemies - useful for ducking around corners, running away, etc + + NUM_DISPOSITIONS + }; + DispositionType m_disposition; // how we will react to enemies + CountdownTimer m_ignoreEnemiesTimer; // how long will we ignore enemies + mutable EHANDLE m_enemy; // our current enemy + bool m_isEnemyVisible; // result of last visibility test on enemy + unsigned char m_visibleEnemyParts; // which parts of the visible enemy do we see + Vector m_lastEnemyPosition; // last place we saw the enemy + float m_lastSawEnemyTimestamp; + float m_firstSawEnemyTimestamp; + float m_currentEnemyAcquireTimestamp; + float m_enemyDeathTimestamp; // if m_enemy is dead, this is when he died + bool m_isLastEnemyDead; // true if we killed or saw our last enemy die + int m_nearbyEnemyCount; // max number of enemies we've seen recently + unsigned int m_enemyPlace; // the location where we saw most of our enemies + + struct WatchInfo + { + float timestamp; + bool isEnemy; + } + m_watchInfo[MAX_CLIENTS]; + mutable EHANDLE m_bomber; // points to bomber if we can see him + + int m_nearbyFriendCount; // number of nearby teammates + mutable EHANDLE m_closestVisibleFriend; // the closest friend we can see + mutable EHANDLE m_closestVisibleHumanFriend; // the closest human friend we can see + + CBasePlayer *m_attacker; // last enemy that hurt us (may not be same as m_enemy) + float m_attackedTimestamp; // when we were hurt by the m_attacker + + int m_lastVictimID; // the entindex of the last victim we killed, or zero + bool m_isAimingAtEnemy; // if true, we are trying to aim at our enemy + bool m_isRapidFiring; // if true, RunUpkeep() will toggle our primary attack as fast as it can + IntervalTimer m_equipTimer; // how long have we had our current weapon equipped + float m_fireWeaponTimestamp; + + // reaction time system + enum { MAX_ENEMY_QUEUE = 20 }; + struct ReactionState + { + // NOTE: player position & orientation is not currently stored separately + EHANDLE player; + bool isReloading; + bool isProtectedByShield; + } + m_enemyQueue[MAX_ENEMY_QUEUE]; // round-robin queue for simulating reaction times + + byte m_enemyQueueIndex; + byte m_enemyQueueCount; + byte m_enemyQueueAttendIndex; // index of the timeframe we are "conscious" of + + // stuck detection + bool m_isStuck; + float m_stuckTimestamp; // time when we got stuck + Vector m_stuckSpot; // the location where we became stuck + NavRelativeDirType m_wiggleDirection; + float m_wiggleTimestamp; + float m_stuckJumpTimestamp; // time for next jump when stuck + + enum { MAX_VEL_SAMPLES = 5 }; + float m_avgVel[MAX_VEL_SAMPLES]; + int m_avgVelIndex; + int m_avgVelCount; + Vector m_lastOrigin; + + // chatter mechanism + GameEventType m_lastRadioCommand; // last radio command we recieved + + float m_lastRadioRecievedTimestamp; // time we recieved a radio message + float m_lastRadioSentTimestamp; // time when we send a radio message + EHANDLE m_radioSubject; // who issued the radio message + Vector m_radioPosition; // position referred to in radio message + float m_voiceFeedbackStartTimestamp; + float m_voiceFeedbackEndTimestamp; // new-style "voice" chatter gets voice feedback + BotChatterInterface m_chatter; + + // learn map mechanism + const CNavNode *m_navNodeList; + CNavNode *m_currentNode; + NavDirType m_generationDir; + NavAreaList::iterator m_analyzeIter; + + enum ProcessType + { + PROCESS_NORMAL, + PROCESS_LEARN, + PROCESS_ANALYZE_ALPHA, + PROCESS_ANALYZE_BETA, + PROCESS_SAVE, + } + m_processMode; + CountdownTimer m_mumbleTimer; + CountdownTimer m_booTimer; + CountdownTimer m_relocateTimer; +}; diff --git a/reapi/include/cssdk/dlls/bot/cs_bot_chatter.h b/reapi/include/cssdk/dlls/bot/cs_bot_chatter.h new file mode 100644 index 0000000..4f56b96 --- /dev/null +++ b/reapi/include/cssdk/dlls/bot/cs_bot_chatter.h @@ -0,0 +1,337 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define UNDEFINED_COUNT 0xFFFF +#define MAX_PLACES_PER_MAP 64 +#define UNDEFINED_SUBJECT (-1) +#define COUNT_MANY 4 // equal to or greater than this is "many" + +class CCSBot; +class BotChatterInterface; + +typedef unsigned int PlaceCriteria; +typedef unsigned int CountCriteria; + +// A meme is a unit information that bots use to +// transmit information to each other via the radio +class BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const = 0; // cause the given bot to act on this meme +}; + +class BotAllHostagesGoneMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +}; + +class BotHostageBeingTakenMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +}; + +class BotHelpMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +public: + Place m_place; +}; + +class BotBombsiteStatusMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +public: + enum StatusType { CLEAR, PLANTED }; + int m_zoneIndex; // the bombsite + StatusType m_status; // whether it is cleared or the bomb is there (planted) +}; + +class BotBombStatusMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme + +public: + CSGameState::BombState m_state; + Vector m_pos; +}; + +class BotFollowMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +}; + +class BotDefendHereMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +public: + Vector m_pos; +}; + +class BotWhereBombMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +}; + +class BotRequestReportMeme: public BotMeme { +public: + virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme +}; + +enum BotStatementType +{ + REPORT_VISIBLE_ENEMIES, + REPORT_ENEMY_ACTION, + REPORT_MY_CURRENT_TASK, + REPORT_MY_INTENTION, + REPORT_CRITICAL_EVENT, + REPORT_REQUEST_HELP, + REPORT_REQUEST_INFORMATION, + REPORT_ROUND_END, + REPORT_MY_PLAN, + REPORT_INFORMATION, + REPORT_EMOTE, + REPORT_ACKNOWLEDGE, // affirmative or negative + REPORT_ENEMIES_REMAINING, + REPORT_FRIENDLY_FIRE, + REPORT_KILLED_FRIEND, + //REPORT_ENEMY_LOST + + NUM_BOT_STATEMENT_TYPES, +}; + +// BotSpeakables are the smallest unit of bot chatter. +// They represent a specific wav file of a phrase, and the criteria for which it is useful +class BotSpeakable { +public: + char *m_phrase; + float m_duration; + PlaceCriteria m_place; + CountCriteria m_count; +}; + +typedef std::vector BotSpeakableVector; +typedef std::vector BotVoiceBankVector; + +// The BotPhrase class is a collection of Speakables associated with a name, ID, and criteria +class BotPhrase { +public: + 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; } +public: + friend class BotPhraseManager; + char *m_name; + Place m_id; + bool m_isPlace; // true if this is a Place phrase + GameEventType m_radioEvent; + bool m_isImportant; // mission-critical statement + + mutable BotVoiceBankVector m_voiceBank; // array of voice banks (arrays of speakables) + std::vector m_count; // number of speakables + mutable std::vector< int > m_index; // index of next speakable to return + int m_numVoiceBanks; // number of voice banks that have been initialized + + mutable PlaceCriteria m_placeCriteria; + mutable CountCriteria m_countCriteria; +}; + +typedef std::list BotPhraseList; + +// The BotPhraseManager is a singleton that provides an interface to all BotPhrase collections +class BotPhraseManager { +public: + 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; + + // set time of last statement of given type was emitted by a teammate for the given place + void ResetPlaceStatementInterval(Place place) const; + +public: + int FindPlaceIndex(Place where) const; + + // master list of all phrase collections + BotPhraseList m_list; + + // master list of all Place phrases + BotPhraseList m_placeList; + + struct PlaceTimeInfo + { + Place placeID; + IntervalTimer timer; + }; + + mutable PlaceTimeInfo m_placeStatementHistory[MAX_PLACES_PER_MAP]; + mutable int m_placeCount; +}; + +inline int BotPhraseManager::FindPlaceIndex(Place where) const +{ + for (int i = 0; i < m_placeCount; ++i) + { + if (m_placeStatementHistory[i].placeID == where) + return i; + } + + if (m_placeCount < MAX_PLACES_PER_MAP) + { + m_placeStatementHistory[++m_placeCount].placeID = where; + m_placeStatementHistory[++m_placeCount].timer.Invalidate(); + return m_placeCount - 1; + } + + return -1; +} + +inline float BotPhraseManager::GetPlaceStatementInterval(Place place) const +{ + int index = FindPlaceIndex(place); + + if (index < 0) + return 999999.9f; + + if (index >= m_placeCount) + return 999999.9f; + + return m_placeStatementHistory[index].timer.GetElapsedTime(); +} + +inline void BotPhraseManager::ResetPlaceStatementInterval(Place place) const +{ + int index = FindPlaceIndex(place); + + if (index < 0) + return; + + if (index >= m_placeCount) + return; + + m_placeStatementHistory[index].timer.Reset(); +} + +// Statements are meaningful collections of phrases +class BotStatement { +public: + BotChatterInterface *GetChatter() const { return m_chatter; } + BotStatementType GetType() const { return m_type; } // return the type of statement this is + 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 + void SetPlace(Place where) { m_place = where; } // explicitly set place + + void SetStartTime(float timestamp) { m_startTime = timestamp; } // define the earliest time this statement can be spoken + float GetStartTime() const { return m_startTime; } + 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) + +public: + friend class BotChatterInterface; + + BotChatterInterface *m_chatter; // the chatter system this statement is part of + BotStatement *m_next, *m_prev; // linked list hooks + + BotStatementType m_type; // what kind of statement this is + int m_subject; // who this subject is about + Place m_place; // explicit place - note some phrases have implicit places as well + BotMeme *m_meme; // a statement can only have a single meme for now + + float m_timestamp; // time when message was created + float m_startTime; // the earliest time this statement can be spoken + float m_expireTime; // time when this statement is no longer valid + float m_speakTimestamp; // time when message began being spoken + bool m_isSpeaking; // true if this statement is current being spoken + + float m_nextTime; // time for next phrase to begin + + enum { MAX_BOT_PHRASES = 4 }; + enum ContextType + { + CURRENT_ENEMY_COUNT, + REMAINING_ENEMY_COUNT, + SHORT_DELAY, + LONG_DELAY, + ACCUMULATE_ENEMIES_DELAY, + }; + struct + { + bool isPhrase; + union + { + const BotPhrase *phrase; + ContextType context; + }; + + } + m_statement[MAX_BOT_PHRASES]; + + enum { MAX_BOT_CONDITIONS = 4 }; + enum ConditionType + { + IS_IN_COMBAT, + RADIO_SILENCE, + ENEMIES_REMAINING, + NUM_CONDITIONS, + }; + + 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 + int m_count; +}; + +// This class defines the interface to the bot radio chatter system +class BotChatterInterface { +public: + CCSBot *GetOwner() const { return m_me; } + int GetPitch() const { return m_pitch; } + bool SeesAtLeastOneEnemy() const { return m_seeAtLeastOneEnemy; } +public: + BotStatement *m_statementList; // list of all active/pending messages for this bot + void ReportEnemies(); // track nearby enemy count and generate enemy activity statements + bool ShouldSpeak() const; // return true if we speaking makes sense now + CCSBot *m_me; // the bot this chatter is for + bool m_seeAtLeastOneEnemy; + float m_timeWhenSawFirstEnemy; + bool m_reportedEnemies; + bool m_requestedBombLocation; // true if we already asked where the bomb has been planted + int m_pitch; + IntervalTimer m_needBackupInterval; + IntervalTimer m_spottedBomberInterval; + IntervalTimer m_scaredInterval; + IntervalTimer m_planInterval; + CountdownTimer m_spottedLooseBombTimer; + CountdownTimer m_heardNoiseTimer; + CountdownTimer m_escortingHostageTimer; +}; + +extern BotPhraseManager *TheBotPhrases; diff --git a/reapi/include/cssdk/dlls/bot/cs_bot_manager.h b/reapi/include/cssdk/dlls/bot/cs_bot_manager.h new file mode 100644 index 0000000..38f3d60 --- /dev/null +++ b/reapi/include/cssdk/dlls/bot/cs_bot_manager.h @@ -0,0 +1,145 @@ +/* +* +* 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. +* +*/ +#pragma once + +extern CBotManager *TheBots; + +// The manager for Counter-Strike specific bots +class CCSBotManager: public CBotManager { +public: + virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0; + virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; + + virtual void ServerActivate() = 0; + virtual void ServerDeactivate() = 0; + + virtual void ServerCommand(const char *pcmd) = 0; + virtual void AddServerCommand(const char *cmd) = 0; + virtual void AddServerCommands() = 0; + + virtual void RestartRound() = 0; // (EXTEND) invoked when a new round begins + virtual void StartFrame() = 0; // (EXTEND) called each frame + + virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0; + virtual unsigned int GetPlayerPriority(CBasePlayer *player) const = 0; // return priority of player (0 = max pri) + virtual bool IsImportantPlayer(CBasePlayer *player) const = 0; // return true if player is important to scenario (VIP, bomb carrier, etc) + +public: + // the supported game scenarios + enum GameScenarioType + { + SCENARIO_DEATHMATCH, + SCENARIO_DEFUSE_BOMB, + SCENARIO_RESCUE_HOSTAGES, + SCENARIO_ESCORT_VIP + }; + GameScenarioType GetScenario() const { return m_gameScenario; } + + // "zones" + // depending on the game mode, these are bomb zones, rescue zones, etc. + enum { MAX_ZONES = 4 }; // max # of zones in a map + enum { MAX_ZONE_NAV_AREAS = 16 }; // max # of nav areas in a zone + struct Zone + { + CBaseEntity *m_entity; // the map entity + CNavArea *m_area[MAX_ZONE_NAV_AREAS]; // nav areas that overlap this zone + int m_areaCount; + Vector m_center; + bool m_isLegacy; // if true, use pev->origin and 256 unit radius as zone + int m_index; + Extent m_extent; + }; + + const Zone *GetZone(int i) const { return &m_zone[i]; } + int GetZoneCount() const { return m_zoneCount; } + + // pick a zone at random and return it + const Zone *GetRandomZone() const + { + if (!m_zoneCount) + return NULL; + + 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 + 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 + + 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 + + bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round + 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; } + +public: + GameScenarioType m_gameScenario; // what kind of game are we playing + + Zone m_zone[MAX_ZONES]; + int m_zoneCount; + + bool m_isBombPlanted; // true if bomb has been planted + float m_bombPlantTimestamp; // time bomb was planted + float m_earliestBombPlantTimestamp; // don't allow planting until after this time has elapsed + CBasePlayer *m_bombDefuser; // the player currently defusing a bomb + EHANDLE m_looseBomb; // will be non-NULL if bomb is loose on the ground + CNavArea *m_looseBombArea; // area that bomb is is/near + + bool m_isRoundOver; // true if the round has ended + float m_radioMsgTimestamp[24][2]; + + float m_lastSeenEnemyTimestamp; + float m_roundStartTimestamp; // the time when the current round began + + bool m_isDefenseRushing; // whether defensive team is rushing this round or not + + unsigned int m_navPlace; + CountdownTimer m_respawnTimer; + bool m_isRespawnStarted; + bool m_canRespawn; + bool m_bServerActive; +}; + +inline int OtherTeam(int team) +{ + return (team == TERRORIST) ? CT : TERRORIST; +} + +inline CCSBotManager *TheCSBots() +{ + return reinterpret_cast(TheBots); +} diff --git a/reapi/include/cssdk/dlls/bot/cs_gamestate.h b/reapi/include/cssdk/dlls/bot/cs_gamestate.h new file mode 100644 index 0000000..769575f --- /dev/null +++ b/reapi/include/cssdk/dlls/bot/cs_gamestate.h @@ -0,0 +1,90 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CCSBot; + +// This class represents the game state as known by a particular bot +class CSGameState { +public: + // bomb defuse scenario + enum BombState + { + MOVING, // being carried by a Terrorist + LOOSE, // loose on the ground somewhere + PLANTED, // planted and ticking + DEFUSED, // the bomb has been defused + 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); } + +public: + CCSBot *m_owner; // who owns this gamestate + bool m_isRoundOver; // true if round is over, but no yet reset + + // bomb defuse scenario + BombState GetBombState() { return m_bombState; } + BombState m_bombState; // what we think the bomb is doing + + IntervalTimer m_lastSawBomber; + Vector m_bomberPos; + + IntervalTimer m_lastSawLooseBomb; + Vector m_looseBombPos; + + bool m_isBombsiteClear[4]; // corresponds to zone indices in CCSBotManager + int m_bombsiteSearchOrder[4]; // randomized order of bombsites to search + int m_bombsiteCount; + int m_bombsiteSearchIndex; // the next step in the search + + int m_plantedBombsite; // zone index of the bombsite where the planted bomb is + + bool m_isPlantedBombPosKnown; // if true, we know the exact location of the bomb + Vector m_plantedBombPos; + + // hostage rescue scenario + struct HostageInfo + { + CHostage *hostage; + Vector knownPos; + bool isValid; + bool isAlive; + bool isFree; // not being escorted by a CT + } + m_hostage[MAX_HOSTAGES]; + int m_hostageCount; // number of hostages left in map + CountdownTimer m_validateInterval; + + bool m_allHostagesRescued; // if true, so every hostages been is rescued + bool m_haveSomeHostagesBeenTaken; // true if a hostage has been moved by a CT (and we've seen it) +}; diff --git a/reapi/include/cssdk/dlls/buttons.h b/reapi/include/cssdk/dlls/buttons.h new file mode 100644 index 0000000..27ac5b8 --- /dev/null +++ b/reapi/include/cssdk/dlls/buttons.h @@ -0,0 +1,104 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SF_BUTTON_DONTMOVE 1 +#define SF_ROTBUTTON_NOTSOLID 1 +#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated +#define SF_BUTTON_SPARK_IF_OFF 64 // button sparks in OFF state +#define SF_BUTTON_TOUCH_ONLY 256 // button only fires as a result of USE key. + +#define SF_GLOBAL_SET 1 // Set global state to initial state on spawn + +#define SF_MULTI_INIT 1 + +// Make this button behave like a door (HACKHACK) +// This will disable use and make the button solid +// rotating buttons were made SOLID_NOT by default since their were some +// collision problems with them... +#define SF_MOMENTARY_DOOR 0x0001 + +#define SF_SPARK_TOOGLE 32 +#define SF_SPARK_IF_OFF 64 + +#define SF_BTARGET_USE 0x0001 +#define SF_BTARGET_ON 0x0002 + +class CEnvGlobal: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + string_t m_globalstate; + int m_triggermode; + int m_initialstate; +}; + +class CRotButton: public CBaseButton { +public: + virtual void Spawn() = 0; +}; + +class CMomentaryRotButton: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int m_lastUsed; + int m_direction; + float m_returnSpeed; + Vector m_start; + Vector m_end; + int m_sounds; +}; + +class CEnvSpark: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +public: + float m_flDelay; +}; + +class CButtonTarget: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; diff --git a/reapi/include/cssdk/dlls/cbase.h b/reapi/include/cssdk/dlls/cbase.h new file mode 100644 index 0000000..e5614fb --- /dev/null +++ b/reapi/include/cssdk/dlls/cbase.h @@ -0,0 +1,373 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "util.h" +#include "monsterevent.h" + +class CSave; +class CRestore; +class CBasePlayer; +class CBaseEntity; +class CBaseMonster; +class CBasePlayerItem; +class CSquadMonster; + +class CBaseEntity { +public: + // Constructor. Set engine to use C/C++ callback functions + // pointers to engine data + entvars_t *pev; // Don't need to save/restore this pointer, the engine resets it + + // path corners + CBaseEntity *m_pGoalEnt; // path corner we are heading towards + CBaseEntity *m_pLink; // used for temporary link-list operations. + + // initialization functions + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Activate() = 0; + + // Setup the object->object collision box (pev->mins / pev->maxs is the object->world collision box) + virtual void SetObjectCollisionBox() = 0; + + // Classify - returns the type of group (i.e, "houndeye", or "human military" so that monsters with different classnames + // still realize that they are teammates. (overridden for monsters that form groups) + virtual int Classify() = 0; + virtual void DeathNotice(entvars_t *pevChild) = 0; + + virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int TakeHealth(float flHealth, int bitsDamageType) = 0; + virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; + virtual void TraceBleed(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0; + virtual BOOL IsTriggered(CBaseEntity *pActivator) = 0; + virtual CBaseMonster *MyMonsterPointer() = 0; + virtual CSquadMonster *MySquadMonsterPointer() = 0; + virtual int GetToggleState() = 0; + virtual void AddPoints(int score, BOOL bAllowNegativeScore) = 0; + virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0; + virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0; + virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0; + virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0; + virtual float GetDelay() = 0; + virtual int IsMoving() = 0; + virtual void OverrideReset() = 0; + virtual int DamageDecal(int bitsDamageType) = 0; + + // This is ONLY used by the node graph to test movement through a door + virtual void SetToggleState(int state) = 0; + virtual void StartSneaking() = 0; + virtual void StopSneaking() = 0; + virtual BOOL OnControls(entvars_t *onpev) = 0; + virtual BOOL IsSneaking() = 0; + virtual BOOL IsAlive() = 0; + virtual BOOL IsBSPModel() = 0; + virtual BOOL ReflectGauss() = 0; + virtual BOOL HasTarget(string_t targetname) = 0; + virtual BOOL IsInWorld() = 0; + virtual BOOL IsPlayer() = 0; + virtual BOOL IsNetClient() = 0; + virtual const char *TeamID() = 0; + + virtual CBaseEntity *GetNextTarget() = 0; + + // fundamental callbacks + void (CBaseEntity::*m_pfnThink)(); + void (CBaseEntity::*m_pfnTouch)(CBaseEntity *pOther); + void (CBaseEntity::*m_pfnUse)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); + void (CBaseEntity::*m_pfnBlocked)(CBaseEntity *pOther); + + virtual void Think() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType = USE_OFF, float value = 0.0f) = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; + + virtual CBaseEntity *Respawn() = 0; + virtual void UpdateOwner() = 0; + virtual BOOL FBecomeProne() = 0; + + virtual Vector Center() = 0; // center point of entity + virtual Vector EyePosition() = 0; // position of eyes + virtual Vector EarPosition() = 0; // position of ears + virtual Vector BodyTarget(const Vector &posSrc) = 0; // position to shoot at + + virtual int Illumination() = 0; + virtual BOOL FVisible(CBaseEntity *pEntity) = 0; + virtual BOOL FVisible(const Vector &vecOrigin) = 0; +public: + static CBaseEntity *Instance(edict_t *pent) { return (CBaseEntity *)GET_PRIVATE(pent ? pent : ENT(0)); } + static CBaseEntity *Instance(entvars_t *pev) { return Instance(ENT(pev)); } + static CBaseEntity *Instance(int offset) { return Instance(ENT(offset)); } + + edict_t *edict() { return ENT(pev); } + EOFFSET eoffset() { return OFFSET(pev); } + int entindex() { return ENTINDEX(edict()); } +public: + // We use this variables to store each ammo count. + int *current_ammo; + float currentammo; + int maxammo_buckshot; + int ammo_buckshot; + int maxammo_9mm; + int ammo_9mm; + int maxammo_556nato; + int ammo_556nato; + int maxammo_556natobox; + int ammo_556natobox; + int maxammo_762nato; + int ammo_762nato; + int maxammo_45acp; + int ammo_45acp; + int maxammo_50ae; + int ammo_50ae; + int maxammo_338mag; + int ammo_338mag; + int maxammo_57mm; + int ammo_57mm; + int maxammo_357sig; + int ammo_357sig; + + // Special stuff for grenades and knife. + float m_flStartThrow; + float m_flReleaseThrow; + int m_iSwing; + + // client has left the game + bool has_disconnected; +}; + +class CPointEntity: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; +}; + + +// generic Delay entity +class CBaseDelay: public CBaseEntity { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +public: + float m_flDelay; + int m_iszKillTarget; +}; + +class CBaseAnimating: public CBaseDelay { +public: + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void HandleAnimEvent(MonsterEvent_t *pEvent) = 0; +public: + // animation needs + float m_flFrameRate; // computed FPS for current sequence + float m_flGroundSpeed; // computed linear movement rate for current sequence + float m_flLastEventCheck; // last time the event list was checked + BOOL m_fSequenceFinished; // flag set when StudioAdvanceFrame moves across a frame boundry + BOOL m_fSequenceLoops; // true if the sequence loops +}; + +// EHANDLE. Safe way to point to CBaseEntities who may die between frames +class EHANDLE { +public: + edict_t *Get(); + edict_t *Set(edict_t *pent); + + operator int(); + operator CBaseEntity*(); + operator CBasePlayer*(); + + CBaseEntity *operator=(CBaseEntity *pEntity); + CBaseEntity *operator->(); + +private: + edict_t *m_pent; + int m_serialnumber; +}; + +// generic Toggle entity. +class CBaseToggle: public CBaseAnimating { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int GetToggleState() = 0; + virtual float GetDelay() = 0; +public: + TOGGLE_STATE m_toggle_state; + float m_flActivateFinished; // like attack_finished, but for doors + float m_flMoveDistance; // how far a door should slide or rotate + float m_flWait; + float m_flLip; + float m_flTWidth; // for plats + float m_flTLength; // for plats + + Vector m_vecPosition1; + Vector m_vecPosition2; + Vector m_vecAngle1; + Vector m_vecAngle2; + + int m_cTriggersLeft; // trigger_counter only, # of activations remaining + float m_flHeight; + EHANDLE m_hActivator; + void (CBaseToggle::*m_pfnCallWhenMoveDone)(); + Vector m_vecFinalDest; + Vector m_vecFinalAngle; + + int m_bitsDamageInflict; // DMG_ damage type that the door or tigger does + + string_t m_sMaster; // If this button has a master switch, this is the targetname. + // A master switch must be of the multisource type. If all + // of the switches in the multisource have been triggered, then + // the button will be allowed to operate. Otherwise, it will be + // deactivated. +}; + +#include "basemonster.h" +#include "weapons.h" +#include "player.h" + +// Generic Button +class CBaseButton: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; // Buttons that don't take damage can be IMPULSE used +public: + BOOL m_fStayPushed; // button stays pushed in until touched again? + BOOL m_fRotating; // a rotating button? default is a sliding button. + + string_t m_strChangeTarget; // if this field is not null, this is an index into the engine string array. + // when this button is touched, it's target entity's TARGET field will be set + // to the button's ChangeTarget. This allows you to make a func_train switch paths, etc. + + locksound_t m_ls; // door lock sounds + + BYTE m_bLockedSound; // ordinals from entity selection + BYTE m_bLockedSentence; + BYTE m_bUnlockedSound; + BYTE m_bUnlockedSentence; + int m_sounds; +}; + +// MultiSouce + +#define MAX_MULTI_TARGETS 16 // maximum number of targets a single multi_manager entity may be assigned. +#define MS_MAX_TARGETS 32 + +class CMultiSource: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual BOOL IsTriggered(CBaseEntity *pActivator) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + EHANDLE m_rgEntities[MS_MAX_TARGETS]; + int m_rgTriggered[MS_MAX_TARGETS]; + + int m_iTotal; + string_t m_globalstate; +}; + +// This spawns first when each level begins. +class CWorld: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +}; + +// Inlines +inline edict_t *EHANDLE::Get() +{ + if (!m_pent || m_pent->serialnumber != m_serialnumber) + return NULL; + + return m_pent; +} + +inline edict_t *EHANDLE::Set(edict_t *pent) +{ + m_pent = pent; + if (pent) + m_serialnumber = pent->serialnumber; + + return pent; +} + +inline EHANDLE::operator int() +{ + return Get() != NULL; +} + +inline EHANDLE::operator CBaseEntity *() +{ + return (CBaseEntity *)GET_PRIVATE(Get()); +} + +inline EHANDLE::operator CBasePlayer *() +{ + return static_cast(GET_PRIVATE(Get())); +} + +inline CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity) +{ + if (pEntity != NULL) + { + m_pent = ENT(pEntity->pev); + if (m_pent) + m_serialnumber = m_pent->serialnumber; + } + else + { + m_pent = NULL; + m_serialnumber = 0; + } + + return pEntity; +} + +inline CBaseEntity *EHANDLE::operator->() +{ + return (CBaseEntity *)GET_PRIVATE(Get()); +} diff --git a/reapi/include/cssdk/dlls/cdll_dll.h b/reapi/include/cssdk/dlls/cdll_dll.h new file mode 100644 index 0000000..e69f6fc --- /dev/null +++ b/reapi/include/cssdk/dlls/cdll_dll.h @@ -0,0 +1,126 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define MAX_WEAPON_SLOTS 5 // hud item selection slots +#define MAX_ITEM_TYPES 6 // hud item selection slots + +#define MAX_ITEMS 4 // hard coded item types + +#define DEFAULT_FOV 90 // the default field of view + +#define HIDEHUD_WEAPONS (1<<0) +#define HIDEHUD_FLASHLIGHT (1<<1) +#define HIDEHUD_ALL (1<<2) +#define HIDEHUD_HEALTH (1<<3) +#define HIDEHUD_TIMER (1<<4) +#define HIDEHUD_MONEY (1<<5) +#define HIDEHUD_CROSSHAIR (1<<6) + +#define STATUSICON_HIDE 0 +#define STATUSICON_SHOW 1 +#define STATUSICON_FLASH 2 + +#define HUD_PRINTNOTIFY 1 +#define HUD_PRINTCONSOLE 2 +#define HUD_PRINTTALK 3 +#define HUD_PRINTCENTER 4 +#define HUD_PRINTRADIO 5 + +#define STATUS_NIGHTVISION_ON 1 +#define STATUS_NIGHTVISION_OFF 0 + +#define ITEM_STATUS_NIGHTVISION (1<<0) +#define ITEM_STATUS_DEFUSER (1<<1) + +#define SCORE_STATUS_DEAD (1<<0) +#define SCORE_STATUS_BOMB (1<<1) +#define SCORE_STATUS_VIP (1<<2) + +#define SIGNAL_BUY (1<<0) +#define SIGNAL_BOMB (1<<1) +#define SIGNAL_RESCUE (1<<2) +#define SIGNAL_ESCAPE (1<<3) +#define SIGNAL_VIPSAFETY (1<<4) + +#define DATA_IUSER3_CANSHOOT (1<<0) +#define DATA_IUSER3_FREEZETIMEOVER (1<<1) +#define DATA_IUSER3_INBOMBZONE (1<<2) +#define DATA_IUSER3_HOLDINGSHIELD (1<<3) + +#define MENU_KEY_1 (1<<0) +#define MENU_KEY_2 (1<<1) +#define MENU_KEY_3 (1<<2) +#define MENU_KEY_4 (1<<3) +#define MENU_KEY_5 (1<<4) +#define MENU_KEY_6 (1<<5) +#define MENU_KEY_7 (1<<6) +#define MENU_KEY_8 (1<<7) +#define MENU_KEY_9 (1<<8) +#define MENU_KEY_0 (1<<9) + +#define MAX_AMMO_TYPES 32 // ??? +#define MAX_AMMO_SLOTS 32 // not really slots + +#define HUD_PRINTNOTIFY 1 +#define HUD_PRINTCONSOLE 2 +#define HUD_PRINTTALK 3 +#define HUD_PRINTCENTER 4 + +#define WEAPON_SUIT 31 +#define WEAPON_ALLWEAPONS (~(1 << WEAPON_SUIT)) + +// custom enum +enum VGUIMenu +{ + VGUI_Menu_Team = 2, + VGUI_Menu_MapBriefing = 4, + + VGUI_Menu_Class_T = 26, + VGUI_Menu_Class_CT, + VGUI_Menu_Buy, + VGUI_Menu_Buy_Pistol, + VGUI_Menu_Buy_ShotGun, + VGUI_Menu_Buy_Rifle, + VGUI_Menu_Buy_SubMachineGun, + VGUI_Menu_Buy_MachineGun, + VGUI_Menu_Buy_Item, +}; + +// custom enum +enum VGUIMenuSlot +{ + VGUI_MenuSlot_Buy_Pistol = 1, + VGUI_MenuSlot_Buy_ShotGun, + VGUI_MenuSlot_Buy_SubMachineGun, + VGUI_MenuSlot_Buy_Rifle, + VGUI_MenuSlot_Buy_MachineGun, + VGUI_MenuSlot_Buy_PrimAmmo, + VGUI_MenuSlot_Buy_SecAmmo, + VGUI_MenuSlot_Buy_Item, +}; diff --git a/reapi/include/cssdk/dlls/client.h b/reapi/include/cssdk/dlls/client.h new file mode 100644 index 0000000..f7f8a55 --- /dev/null +++ b/reapi/include/cssdk/dlls/client.h @@ -0,0 +1,97 @@ +/* +* +* 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. +* +*/ +#pragma once + +// custom enum +enum ChooseTeamMenuSlot +{ + MENU_SLOT_TEAM_UNDEFINED = -1, + + MENU_SLOT_TEAM_TERRORIST = 1, + MENU_SLOT_TEAM_CT, + MENU_SLOT_TEAM_VIP, + + MENU_SLOT_TEAM_RANDOM = 5, + MENU_SLOT_TEAM_SPECT +}; + +// custom enum +enum BuyItemMenuSlot +{ + MENU_SLOT_ITEM_VEST = 1, + MENU_SLOT_ITEM_VESTHELM, + MENU_SLOT_ITEM_FLASHGREN, + MENU_SLOT_ITEM_HEGREN, + MENU_SLOT_ITEM_SMOKEGREN, + MENU_SLOT_ITEM_NVG, + MENU_SLOT_ITEM_DEFUSEKIT, + MENU_SLOT_ITEM_SHIELD, +}; + +#define CS_NUM_SKIN 4 +#define CZ_NUM_SKIN 5 + +#define FIELD_ORIGIN0 0 +#define FIELD_ORIGIN1 1 +#define FIELD_ORIGIN2 2 + +#define FIELD_ANGLES0 3 +#define FIELD_ANGLES1 4 +#define FIELD_ANGLES2 5 + +#define CUSTOMFIELD_ORIGIN0 0 +#define CUSTOMFIELD_ORIGIN1 1 +#define CUSTOMFIELD_ORIGIN2 2 + +#define CUSTOMFIELD_ANGLES0 3 +#define CUSTOMFIELD_ANGLES1 4 +#define CUSTOMFIELD_ANGLES2 5 + +#define CUSTOMFIELD_SKIN 6 +#define CUSTOMFIELD_SEQUENCE 7 +#define CUSTOMFIELD_ANIMTIME 8 + +typedef struct +{ + float m_fTimeEnteredPVS; + +} ENTITYPVSSTATUS; + +struct PLAYERPVSSTATUS +{ + ENTITYPVSSTATUS m_Status[1380]; + int headnode; + int num_leafs; + short int leafnums[ MAX_ENT_LEAFS ]; +}; + +struct entity_field_alias_t +{ + char name[32]; + int field; +}; diff --git a/reapi/include/cssdk/dlls/csbot_dll.h b/reapi/include/cssdk/dlls/csbot_dll.h new file mode 100644 index 0000000..f96b728 --- /dev/null +++ b/reapi/include/cssdk/dlls/csbot_dll.h @@ -0,0 +1,50 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "../game_shared/GameEvent.h" +#include "../game_shared/bot/bot_util.h" +#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" +#include "../game_shared/bot/bot.h" +#include "../game_shared/shared_util.h" +#include "../game_shared/bot/bot_profile.h" + +#include "../game_shared/bot/improv.h" +#include "../game_shared/bot/nav.h" +#include "../game_shared/bot/nav_node.h" +#include "../game_shared/bot/nav_area.h" +#include "../game_shared/bot/nav_path.h" + +#include "../dlls/hostage/hostage.h" +#include "../dlls/hostage/hostage_localnav.h" + +#include "../dlls/bot/cs_bot.h" diff --git a/reapi/include/cssdk/dlls/decals.h b/reapi/include/cssdk/dlls/decals.h new file mode 100644 index 0000000..6f37432 --- /dev/null +++ b/reapi/include/cssdk/dlls/decals.h @@ -0,0 +1,83 @@ +/* +* +* 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. +* +*/ +#pragma once + +enum decal_e +{ + DECAL_GUNSHOT1 = 0, + DECAL_GUNSHOT2, + DECAL_GUNSHOT3, + DECAL_GUNSHOT4, + DECAL_GUNSHOT5, + DECAL_LAMBDA1, + DECAL_LAMBDA2, + DECAL_LAMBDA3, + DECAL_LAMBDA4, + DECAL_LAMBDA5, + DECAL_LAMBDA6, + DECAL_SCORCH1, + DECAL_SCORCH2, + DECAL_BLOOD1, + DECAL_BLOOD2, + DECAL_BLOOD3, + DECAL_BLOOD4, + DECAL_BLOOD5, + DECAL_BLOOD6, + DECAL_YBLOOD1, + DECAL_YBLOOD2, + DECAL_YBLOOD3, + DECAL_YBLOOD4, + DECAL_YBLOOD5, + DECAL_YBLOOD6, + DECAL_GLASSBREAK1, + DECAL_GLASSBREAK2, + DECAL_GLASSBREAK3, + DECAL_BIGSHOT1, + DECAL_BIGSHOT2, + DECAL_BIGSHOT3, + DECAL_BIGSHOT4, + DECAL_BIGSHOT5, + DECAL_SPIT1, + DECAL_SPIT2, + DECAL_BPROOF1, // Bulletproof glass decal + DECAL_GARGSTOMP1, // Gargantua stomp crack + DECAL_SMALLSCORCH1, // Small scorch mark + DECAL_SMALLSCORCH2, // Small scorch mark + DECAL_SMALLSCORCH3, // Small scorch mark + DECAL_MOMMABIRTH, // Big momma birth splatter + DECAL_MOMMASPLAT, +}; + +typedef struct +{ + char *name; + int index; + +} DLL_DECALLIST; + +extern DLL_DECALLIST gDecals[42]; diff --git a/reapi/include/cssdk/dlls/doors.h b/reapi/include/cssdk/dlls/doors.h new file mode 100644 index 0000000..a4f6d68 --- /dev/null +++ b/reapi/include/cssdk/dlls/doors.h @@ -0,0 +1,92 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define DOOR_SENTENCEWAIT 6 +#define DOOR_SOUNDWAIT 3 +#define BUTTON_SOUNDWAIT 0.5 + +#define SF_DOOR_ROTATE_Y 0 +#define SF_DOOR_START_OPEN 1 +#define SF_DOOR_ROTATE_BACKWARDS 2 +#define SF_DOOR_PASSABLE 8 +#define SF_DOOR_ONEWAY 16 +#define SF_DOOR_NO_AUTO_RETURN 32 +#define SF_DOOR_ROTATE_Z 64 +#define SF_DOOR_ROTATE_X 128 +#define SF_DOOR_USE_ONLY 256 // door must be opened by player's use button. +#define SF_DOOR_NOMONSTERS 512 // Monster can't open +#define SF_DOOR_SILENT 0x80000000 + +class CBaseDoor: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void SetToggleState(int state) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; +public: + BYTE m_bHealthValue; // some doors are medi-kit doors, they give players health + + BYTE m_bMoveSnd; // sound a door makes while moving + BYTE m_bStopSnd; // sound a door makes when it stops + + locksound_t m_ls; // door lock sounds + + BYTE m_bLockedSound; // ordinals from entity selection + BYTE m_bLockedSentence; + BYTE m_bUnlockedSound; + BYTE m_bUnlockedSentence; + + float m_lastBlockedTimestamp; +}; + +class CRotDoor: public CBaseDoor { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual void SetToggleState(int state) = 0; +}; + +class CMomentaryDoor: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + BYTE m_bMoveSnd; // sound a door makes while moving +}; diff --git a/reapi/include/cssdk/dlls/effects.h b/reapi/include/cssdk/dlls/effects.h new file mode 100644 index 0000000..5df1335 --- /dev/null +++ b/reapi/include/cssdk/dlls/effects.h @@ -0,0 +1,407 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SF_BEAM_STARTON 0x0001 +#define SF_BEAM_TOGGLE 0x0002 +#define SF_BEAM_RANDOM 0x0004 +#define SF_BEAM_RING 0x0008 +#define SF_BEAM_SPARKSTART 0x0010 +#define SF_BEAM_SPARKEND 0x0020 +#define SF_BEAM_DECALS 0x0040 +#define SF_BEAM_SHADEIN 0x0080 +#define SF_BEAM_SHADEOUT 0x0100 +#define SF_BEAM_TEMPORARY 0x8000 + +#define SF_GIBSHOOTER_REPEATABLE 1 +#define SF_FUNNEL_REVERSE 1 + +#define SF_BUBBLES_STARTOFF 0x0001 + +#define SF_BLOOD_RANDOM 0x0001 +#define SF_BLOOD_STREAM 0x0002 +#define SF_BLOOD_PLAYER 0x0004 +#define SF_BLOOD_DECAL 0x0008 + +#define SF_SHAKE_EVERYONE 0x0001 +#define SF_SHAKE_DISRUPT 0x0002 +#define SF_SHAKE_INAIR 0x0004 + +#define SF_FADE_IN 0x0001 +#define SF_FADE_MODULATE 0x0002 +#define SF_FADE_ONLYONE 0x0004 + +#define SF_SPRITE_STARTON 0x0001 +#define SF_SPRITE_ONCE 0x0002 +#define SF_SPRITE_TEMPORARY 0x8000 + +#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out +#define SF_MESSAGE_ALL 0x0002 // Send to all clients + +class CSprite: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + +public: + void SetAttachment(edict_t *pEntity, int attachment) + { + if (pEntity != NULL) + { + pev->skin = ENTINDEX(pEntity); + pev->body = attachment; + pev->aiment = pEntity; + pev->movetype = MOVETYPE_FOLLOW; + } + } + + float Frames() const { return m_maxFrame; } + void SetTransparency(int rendermode, int r, int g, int b, int a, int fx) + { + pev->rendermode = rendermode; + pev->rendercolor.x = r; + pev->rendercolor.y = g; + pev->rendercolor.z = b; + pev->renderamt = a; + 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 AnimateAndDie(float framerate) + { + SetThink(&CSprite::AnimateUntilDead); + pev->framerate = framerate; + pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate); + pev->nextthink = gpGlobals->time; + } +private: + float m_lastTime; + float m_maxFrame; +}; + +class CBeam: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int ObjectCaps() = 0; + virtual Vector Center() = 0; +public: + 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; } + + 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; } + + void LiveForTime(float time) + { + SetThink(&CBeam::SUB_Remove); + pev->nextthink = gpGlobals->time + time; + } + void BeamDamageInstant(TraceResult *ptr, float damage) + { + pev->dmg = damage; + pev->dmgtime = gpGlobals->time - 1; + BeamDamage(ptr); + } +}; + +class CLaser: public CBeam { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + CSprite *m_pSprite; + int m_iszSpriteName; + Vector m_firePosition; +}; + +class CBubbling: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int m_density; + int m_frequency; + int m_bubbleModel; + int m_state; +}; + +class CLightning: public CBeam { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; +public: + inline BOOL ServerSide() const + { + if (!m_life && !(pev->spawnflags & SF_BEAM_RING)) + return TRUE; + + return FALSE; + } +public: + int m_active; + int m_iszStartEntity; + int m_iszEndEntity; + float m_life; + int m_boltWidth; + int m_noiseAmplitude; + int m_brightness; + int m_speed; + float m_restrike; + int m_spriteTexture; + int m_iszSpriteName; + int m_frameStart; + float m_radius; +}; + +class CGlow: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Think() = 0; +public: + float m_lastTime; + float m_maxFrame; +}; + +class CBombGlow: public CSprite { +public: + virtual void Spawn() = 0; + virtual void Think() = 0; +public: + float m_lastTime; + float m_tmBeepPeriod; + bool m_bSetModel; +}; + +class CGibShooter: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual CGib *CreateGib() = 0; +public: + int m_iGibs; + int m_iGibCapacity; + int m_iGibMaterial; + int m_iGibModelIndex; + + float m_flGibVelocity; + float m_flVariance; + float m_flGibLife; +}; + +class CEnvShooter: public CGibShooter { +public: + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual CGib *CreateGib() = 0; +}; + +#define MAX_BEAM 24 + +class CTestEffect: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int m_iLoop; + int m_iBeam; + + CBeam *m_pBeam[MAX_BEAM]; + + float m_flBeamTime[MAX_BEAM]; + float m_flStartTime; +}; + +class CBlood: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + +public: + 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; } +}; + +class CShake: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +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; } + + 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; } +}; + +class CFade: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +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; } +}; + +class CMessage: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class CEnvFunnel: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int m_iSprite; +}; + +class CEnvBeverage: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class CItemSoda: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; +}; + +// Inlines +inline void CBeam::SetStartEntity(int entityIndex) +{ + pev->sequence = (entityIndex & 0x0FFF) | ((pev->sequence & 0xF000) << 12); + pev->owner = INDEXENT(entityIndex); +} + +inline void CBeam::SetEndEntity(int entityIndex) +{ + pev->skin = (entityIndex & 0x0FFF) | ((pev->skin & 0xF000) << 12); + pev->aiment = INDEXENT(entityIndex); +} + +inline const Vector &CBeam::GetStartPos() +{ + if (GetType() == BEAM_ENTS) + { + edict_t *pent = INDEXENT(GetStartEntity()); + return pent->v.origin; + } + + return pev->origin; +} + +inline const Vector &CBeam::GetEndPos() +{ + int type = GetType(); + if (type == BEAM_POINTS || type == BEAM_HOSE) + { + return pev->angles; + } + + edict_t *pent = INDEXENT(GetEndEntity()); + if (pent != NULL) + { + return pent->v.origin; + } + + return pev->angles; +} diff --git a/reapi/include/cssdk/dlls/enginecallback.h b/reapi/include/cssdk/dlls/enginecallback.h new file mode 100644 index 0000000..dbe3e71 --- /dev/null +++ b/reapi/include/cssdk/dlls/enginecallback.h @@ -0,0 +1,178 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "event_flags.h" + +// Must be provided by user of this code +extern enginefuncs_t g_engfuncs; + +// The actual engine callbacks +#define GETPLAYERUSERID (*g_engfuncs.pfnGetPlayerUserId) +#define PRECACHE_MODEL (*g_engfuncs.pfnPrecacheModel) +#define PRECACHE_SOUND (*g_engfuncs.pfnPrecacheSound) +#define PRECACHE_GENERIC (*g_engfuncs.pfnPrecacheGeneric) +#define SET_MODEL (*g_engfuncs.pfnSetModel) +#define MODEL_INDEX (*g_engfuncs.pfnModelIndex) +#define MODEL_FRAMES (*g_engfuncs.pfnModelFrames) +#define SET_SIZE (*g_engfuncs.pfnSetSize) +#define CHANGE_LEVEL (*g_engfuncs.pfnChangeLevel) +#define GET_SPAWN_PARMS (*g_engfuncs.pfnGetSpawnParms) +#define SAVE_SPAWN_PARMS (*g_engfuncs.pfnSaveSpawnParms) +#define VEC_TO_YAW (*g_engfuncs.pfnVecToYaw) +#define VEC_TO_ANGLES (*g_engfuncs.pfnVecToAngles) +#define MOVE_TO_ORIGIN (*g_engfuncs.pfnMoveToOrigin) +#define oldCHANGE_YAW (*g_engfuncs.pfnChangeYaw) +#define CHANGE_PITCH (*g_engfuncs.pfnChangePitch) +#define MAKE_VECTORS (*g_engfuncs.pfnMakeVectors) +#define CREATE_ENTITY (*g_engfuncs.pfnCreateEntity) +#define REMOVE_ENTITY (*g_engfuncs.pfnRemoveEntity) +#define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity) +#define MAKE_STATIC (*g_engfuncs.pfnMakeStatic) +#define ENT_IS_ON_FLOOR (*g_engfuncs.pfnEntIsOnFloor) +#define DROP_TO_FLOOR (*g_engfuncs.pfnDropToFloor) +#define WALK_MOVE (*g_engfuncs.pfnWalkMove) +#define SET_ORIGIN (*g_engfuncs.pfnSetOrigin) +#define EMIT_SOUND_DYN2 (*g_engfuncs.pfnEmitSound) +#define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg) +#define TRACE_LINE (*g_engfuncs.pfnTraceLine) +#define TRACE_TOSS (*g_engfuncs.pfnTraceToss) +#define TRACE_MONSTER_HULL (*g_engfuncs.pfnTraceMonsterHull) +#define TRACE_HULL (*g_engfuncs.pfnTraceHull) +#define TRACE_MODEL (*g_engfuncs.pfnTraceModel) +#define GET_AIM_VECTOR (*g_engfuncs.pfnGetAimVector) +#define SERVER_COMMAND (*g_engfuncs.pfnServerCommand) +#define SERVER_EXECUTE (*g_engfuncs.pfnServerExecute) +#define CLIENT_COMMAND (*g_engfuncs.pfnClientCommand) +#define PARTICLE_EFFECT (*g_engfuncs.pfnParticleEffect) +#define LIGHT_STYLE (*g_engfuncs.pfnLightStyle) +#define DECAL_INDEX (*g_engfuncs.pfnDecalIndex) +#define POINT_CONTENTS (*g_engfuncs.pfnPointContents) +#define CRC32_INIT (*g_engfuncs.pfnCRC32_Init) +#define CRC32_PROCESS_BUFFER (*g_engfuncs.pfnCRC32_ProcessBuffer) +#define CRC32_PROCESS_BYTE (*g_engfuncs.pfnCRC32_ProcessByte) +#define CRC32_FINAL (*g_engfuncs.pfnCRC32_Final) +#define RANDOM_LONG (*g_engfuncs.pfnRandomLong) +#define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat) +#define ADD_SERVER_COMMAND (*g_engfuncs.pfnAddServerCommand) +#define SET_CLIENT_LISTENING (*g_engfuncs.pfnVoice_SetClientListening) +#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId) +#define GET_FILE_SIZE (*g_engfuncs.pfnGetFileSize) +#define GET_APPROX_WAVE_PLAY_LEN (*g_engfuncs.pfnGetApproxWavePlayLen) +#define IS_CAREER_MATCH (*g_engfuncs.pfnIsCareerMatch) +#define GET_LOCALIZED_STRING_LENGTH (*g_engfuncs.pfnGetLocalizedStringLength) +#define REGISTER_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnRegisterTutorMessageShown) +#define GET_TIMES_TUTOR_MESSAGE_SHOWN (*g_engfuncs.pfnGetTimesTutorMessageShown) +#define ENG_CHECK_PARM (*g_engfuncs.pfnEngCheckParm) + +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); } + +inline void *GET_PRIVATE(edict_t *pent) +{ + if (pent) + return pent->pvPrivateData; + return NULL; +} + +#define MESSAGE_END (*g_engfuncs.pfnMessageEnd) +#define WRITE_BYTE (*g_engfuncs.pfnWriteByte) +#define WRITE_CHAR (*g_engfuncs.pfnWriteChar) +#define WRITE_SHORT (*g_engfuncs.pfnWriteShort) +#define WRITE_LONG (*g_engfuncs.pfnWriteLong) +#define WRITE_ANGLE (*g_engfuncs.pfnWriteAngle) +#define WRITE_COORD (*g_engfuncs.pfnWriteCoord) +#define WRITE_STRING (*g_engfuncs.pfnWriteString) +#define WRITE_ENTITY (*g_engfuncs.pfnWriteEntity) +#define CVAR_REGISTER (*g_engfuncs.pfnCVarRegister) +#define CVAR_GET_FLOAT (*g_engfuncs.pfnCVarGetFloat) +#define CVAR_GET_STRING (*g_engfuncs.pfnCVarGetString) +#define CVAR_SET_FLOAT (*g_engfuncs.pfnCVarSetFloat) +#define CVAR_SET_STRING (*g_engfuncs.pfnCVarSetString) +#define CVAR_GET_POINTER (*g_engfuncs.pfnCVarGetPointer) +#define ALERT (*g_engfuncs.pfnAlertMessage) +#define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf) +#define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData) +#define FREE_PRIVATE (*g_engfuncs.pfnFreeEntPrivateData) +//#define STRING (*g_engfuncs.pfnSzFromIndex) +#define ALLOC_STRING (*g_engfuncs.pfnAllocString) +#define FIND_ENTITY_BY_STRING (*g_engfuncs.pfnFindEntityByString) +#define GETENTITYILLUM (*g_engfuncs.pfnGetEntityIllum) +#define FIND_ENTITY_IN_SPHERE (*g_engfuncs.pfnFindEntityInSphere) +#define FIND_CLIENT_IN_PVS (*g_engfuncs.pfnFindClientInPVS) +#define FIND_ENTITY_IN_PVS (*g_engfuncs.pfnEntitiesInPVS) +#define EMIT_AMBIENT_SOUND (*g_engfuncs.pfnEmitAmbientSound) +#define GET_MODEL_PTR (*g_engfuncs.pfnGetModelPtr) +#define REG_USER_MSG (*g_engfuncs.pfnRegUserMsg) +#define GET_BONE_POSITION (*g_engfuncs.pfnGetBonePosition) +#define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName) +#define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction) +#define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture) +#define CLIENT_PRINTF (*g_engfuncs.pfnClientPrintf) +#define SERVER_PRINT (*g_engfuncs.pfnServerPrint) +#define CMD_ARGS (*g_engfuncs.pfnCmd_Args) +#define CMD_ARGC (*g_engfuncs.pfnCmd_Argc) +#define CMD_ARGV (*g_engfuncs.pfnCmd_Argv) +#define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment) +#define SET_VIEW (*g_engfuncs.pfnSetView) +#define SET_CROSSHAIRANGLE (*g_engfuncs.pfnCrosshairAngle) +#define LOAD_FILE_FOR_ME (*g_engfuncs.pfnLoadFileForMe) +#define FREE_FILE (*g_engfuncs.pfnFreeFile) +#define END_SECTION (*g_engfuncs.pfnEndSection) +#define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime) +#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir) +#define SET_CLIENT_MAXSPEED (*g_engfuncs.pfnSetClientMaxspeed) +#define CREATE_FAKE_CLIENT (*g_engfuncs.pfnCreateFakeClient) +#define PLAYER_RUN_MOVE (*g_engfuncs.pfnRunPlayerMove) +#define NUMBER_OF_ENTITIES (*g_engfuncs.pfnNumberOfEntities) +#define GET_INFO_BUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) +#define GET_KEY_VALUE (*g_engfuncs.pfnInfoKeyValue) +#define SET_KEY_VALUE (*g_engfuncs.pfnSetKeyValue) +#define SET_CLIENT_KEY_VALUE (*g_engfuncs.pfnSetClientKeyValue) +#define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid) +#define STATIC_DECAL (*g_engfuncs.pfnStaticDecal) +#define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer) +#define PRECACHE_EVENT (*g_engfuncs.pfnPrecacheEvent) +#define PLAYBACK_EVENT_FULL (*g_engfuncs.pfnPlaybackEvent) +#define ENGINE_SET_PVS (*g_engfuncs.pfnSetFatPVS) +#define ENGINE_SET_PAS (*g_engfuncs.pfnSetFatPAS) +#define ENGINE_CHECK_VISIBILITY (*g_engfuncs.pfnCheckVisibility) +#define DELTA_SET (*g_engfuncs.pfnDeltaSetField) +#define DELTA_UNSET (*g_engfuncs.pfnDeltaUnsetField) +#define DELTA_ADDENCODER (*g_engfuncs.pfnDeltaAddEncoder) +#define ENGINE_CURRENT_PLAYER (*g_engfuncs.pfnGetCurrentPlayer) +#define ENGINE_CANSKIP (*g_engfuncs.pfnCanSkipPlayer) +#define DELTA_FINDFIELD (*g_engfuncs.pfnDeltaFindField) +#define DELTA_SETBYINDEX (*g_engfuncs.pfnDeltaSetFieldByIndex) +#define DELTA_UNSETBYINDEX (*g_engfuncs.pfnDeltaUnsetFieldByIndex) +#define REMOVE_KEY_VALUE (*g_engfuncs.pfnInfo_RemoveKey) +#define SET_PHYSICS_KEY_VALUE (*g_engfuncs.pfnSetPhysicsKeyValue) +#define ENGINE_GETPHYSINFO (*g_engfuncs.pfnGetPhysicsInfoString) +#define ENGINE_SETGROUPMASK (*g_engfuncs.pfnSetGroupMask) +#define ENGINE_INSTANCE_BASELINE (*g_engfuncs.pfnCreateInstancedBaseline) +#define ENGINE_FORCE_UNMODIFIED (*g_engfuncs.pfnForceUnmodified) +#define PLAYER_CNX_STATS (*g_engfuncs.pfnGetPlayerStats) diff --git a/reapi/include/cssdk/dlls/explode.h b/reapi/include/cssdk/dlls/explode.h new file mode 100644 index 0000000..1a2f7a0 --- /dev/null +++ b/reapi/include/cssdk/dlls/explode.h @@ -0,0 +1,55 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SF_ENVEXPLOSION_NODAMAGE (1<<0) // when set, ENV_EXPLOSION will not actually inflict damage +#define SF_ENVEXPLOSION_REPEATABLE (1<<1) // can this entity be refired? +#define SF_ENVEXPLOSION_NOFIREBALL (1<<2) // don't draw the fireball +#define SF_ENVEXPLOSION_NOSMOKE (1<<3) // don't draw the smoke +#define SF_ENVEXPLOSION_NODECAL (1<<4) // don't make a scorch mark +#define SF_ENVEXPLOSION_NOSPARKS (1<<5) // don't make a scorch mark + +class CShower: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +}; + +class CEnvExplosion: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int m_iMagnitude; + int m_spriteScale; +}; diff --git a/reapi/include/cssdk/dlls/extdef.h b/reapi/include/cssdk/dlls/extdef.h new file mode 100644 index 0000000..355ef8d --- /dev/null +++ b/reapi/include/cssdk/dlls/extdef.h @@ -0,0 +1,80 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "regamedll_const.h" + +enum hash_types_e { CLASSNAME }; + +// Things that toggle (buttons/triggers/doors) need this +enum TOGGLE_STATE { TS_AT_TOP, TS_AT_BOTTOM, TS_GOING_UP, TS_GOING_DOWN }; + +typedef struct hash_item_s +{ + entvars_t *pev; + struct hash_item_s *next; + struct hash_item_s *lastHash; + int pevIndex; + +} hash_item_t; + +typedef struct locksounds +{ + string_t sLockedSound; + string_t sLockedSentence; + string_t sUnlockedSound; + string_t sUnlockedSentence; + int iLockedSentence; + int iUnlockedSentence; + float flwaitSound; + float flwaitSentence; + BYTE bEOFLocked; + BYTE bEOFUnlocked; + +} locksound_t; + +typedef struct hudtextparms_s +{ + float x; + float y; + int effect; + byte r1,g1,b1,a1; + byte r2,g2,b2,a2; + float fadeinTime; + float fadeoutTime; + float holdTime; + float fxTime; + int channel; + +} hudtextparms_t; + +enum USE_TYPE { USE_OFF, USE_ON, USE_SET, USE_TOGGLE }; +enum TRAIN_CODE { TRAIN_SAFE, TRAIN_BLOCKING, TRAIN_FOLLOWING }; +enum IGNORE_MONSTERS { ignore_monsters = 1, dont_ignore_monsters = 0, missile = 2 }; +enum IGNORE_GLASS { ignore_glass = 1, dont_ignore_glass = 0 }; +enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 }; diff --git a/reapi/include/cssdk/dlls/extdll.h b/reapi/include/cssdk/dlls/extdll.h new file mode 100644 index 0000000..2378065 --- /dev/null +++ b/reapi/include/cssdk/dlls/extdll.h @@ -0,0 +1,83 @@ +/* +* +* 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. +* +*/ +#pragma once + +#pragma warning(disable:4244) // int or float down-conversion +#pragma warning(disable:4305) // int or float data truncation +#pragma warning(disable:4201) // nameless struct/union +#pragma warning(disable:4514) // unreferenced inline function removed +#pragma warning(disable:4100) // unreferenced formal parameter + +#include "archtypes.h" +#include "maintypes.h" + +#ifdef _WIN32 + + #define WIN32_LEAN_AND_MEAN + #define NOWINRES + #define NOSERVICE + #define NOMCX + #define NOIME + #include "winsani_in.h" + #include "windows.h" + #include "winsani_out.h" + #undef PlaySound +#else + + #include + #include + #include + +#endif // _WIN32 + +// Misc C-runtime library headers +#include "stdio.h" +#include "stdlib.h" +#include "math.h" + +// Header file containing definition of globalvars_t and entvars_t +typedef int EOFFSET; // More explicit than "int" +typedef unsigned int func_t; +typedef unsigned int string_t; // from engine's pr_comp.h; +typedef float vec_t; // needed before including progdefs.h + +// Vector class +#include "vector.h" +//#include "vector.h" +// Defining it as a (bogus) struct helps enforce type-checking +#define vec3_t Vector +// Shared engine/DLL constants + +#include "const.h" +#include "edict.h" + +// Shared header describing protocol between engine and DLLs +#include "eiface.h" +// Shared header between the client DLL and the game DLLs +#include "cdll_dll.h" +#include "extdef.h" diff --git a/reapi/include/cssdk/dlls/func_break.h b/reapi/include/cssdk/dlls/func_break.h new file mode 100644 index 0000000..296c04e --- /dev/null +++ b/reapi/include/cssdk/dlls/func_break.h @@ -0,0 +1,119 @@ +/* +* +* 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. +* +*/ +#pragma once + +// this many shards spawned when breakable objects break; +#define NUM_SHARDS 6 + +// func breakable +#define SF_BREAK_TRIGGER_ONLY 1 // may only be broken by trigger +#define SF_BREAK_TOUCH 2 // can be 'crashed through' by running player (plate glass) +#define SF_BREAK_PRESSURE 4 // can be broken by a player standing on it +#define SF_BREAK_CROWBAR 256 // instant break if hit with crowbar + +// func_pushable (it's also func_breakable, so don't collide with those flags) +#define SF_PUSH_BREAKABLE 128 + +typedef enum +{ + expRandom = 0, + expDirected, + +} Explosions; + +typedef enum +{ + matGlass = 0, + matWood, + matMetal, + matFlesh, + matCinderBlock, + matCeilingTile, + matComputer, + matUnbreakableGlass, + matRocks, + matNone, + matLastMaterial, + +} Materials; + +class CBreakable: public CBaseDelay { +public: + // basic functions + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + + // To spark when hit + virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0; + + // breakables use an overridden takedamage + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + + virtual int DamageDecal(int bitsDamageType) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + +public: + BOOL Explodable() const { return ExplosionMagnitude() > 0; } + int ExplosionMagnitude() const { return pev->impulse; } + void ExplosionSetMagnitude(int magnitude) { pev->impulse = magnitude; } + +public: + Materials m_Material; + Explosions m_Explosion; + int m_idShard; + float m_angle; + int m_iszGibModel; + int m_iszSpawnObject; + float m_flHealth; +}; + +class CPushable: public CBreakable { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0 + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Touch(CBaseEntity *pOther) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + +public: + float MaxSpeed() const { return m_maxSpeed; } + +public: + int m_lastSound; + float m_maxSpeed; + float m_soundTime; +}; \ No newline at end of file diff --git a/reapi/include/cssdk/dlls/func_tank.h b/reapi/include/cssdk/dlls/func_tank.h new file mode 100644 index 0000000..6ae26fa --- /dev/null +++ b/reapi/include/cssdk/dlls/func_tank.h @@ -0,0 +1,159 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SF_TANK_ACTIVE 0x0001 +#define SF_TANK_PLAYER 0x0002 +#define SF_TANK_HUMANS 0x0004 +#define SF_TANK_ALIENS 0x0008 +#define SF_TANK_LINEOFSIGHT 0x0010 +#define SF_TANK_CANCONTROL 0x0020 +#define SF_TANK_SOUNDON 0x8000 + +enum TANKBULLET +{ + TANK_BULLET_NONE = 0, // Custom damage + TANK_BULLET_9MM, // env_laser (duration is 0.5 rate of fire) + TANK_BULLET_MP5, // rockets + TANK_BULLET_12MM, // explosion? +}; + +class CFuncTank: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + + // Bmodels don't go across transitions + virtual int ObjectCaps() = 0; + virtual BOOL OnControls(entvars_t *pevTest) = 0; + virtual void Think() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0; + virtual Vector UpdateTargetPosition(CBaseEntity *pTarget) = 0; +public: + BOOL IsActive() const { return (pev->spawnflags & SF_TANK_ACTIVE) == SF_TANK_ACTIVE; } + void TankActivate() + { + pev->spawnflags |= SF_TANK_ACTIVE; + pev->nextthink = pev->ltime + 0.1f; + m_fireLast = 0.0f; + } + void TankDeactivate() + { + pev->spawnflags &= ~SF_TANK_ACTIVE; + m_fireLast = 0.0f; + StopRotSound(); + } + + BOOL CanFire() const { return (gpGlobals->time - m_lastSightTime) < m_persist; } + Vector BarrelPosition() + { + Vector forward, right, up; + UTIL_MakeVectorsPrivate(pev->angles, forward, right, up); + return pev->origin + (forward * m_barrelPos.x) + (right * m_barrelPos.y) + (up * m_barrelPos.z); + } +protected: + CBasePlayer *m_pController; + float m_flNextAttack; + Vector m_vecControllerUsePos; + + float m_yawCenter; // "Center" yaw + float m_yawRate; // Max turn rate to track targets + float m_yawRange; // Range of turning motion (one-sided: 30 is +/- 30 degress from center) + // Zero is full rotation + + float m_yawTolerance; // Tolerance angle + + float m_pitchCenter; // "Center" pitch + float m_pitchRate; // Max turn rate on pitch + float m_pitchRange; // Range of pitch motion as above + float m_pitchTolerance; // Tolerance angle + + float m_fireLast; // Last time I fired + float m_fireRate; // How many rounds/second + float m_lastSightTime; // Last time I saw target + float m_persist; // Persistence of firing (how long do I shoot when I can't see) + float m_minRange; // Minimum range to aim/track + float m_maxRange; // Max range to aim/track + + Vector m_barrelPos; // Length of the freakin barrel + float m_spriteScale; // Scale of any sprites we shoot + int m_iszSpriteSmoke; + int m_iszSpriteFlash; + TANKBULLET m_bulletType; // Bullet type + int m_iBulletDamage; // 0 means use Bullet type's default damage + + Vector m_sightOrigin; // Last sight of target + int m_spread; // firing spread + int m_iszMaster; // Master entity (game_team_master or multisource) +}; + +class CFuncTankGun: public CFuncTank { +public: + virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0; +}; + +class CFuncTankLaser: public CFuncTank { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; + virtual void Think() = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0; +private: + CLaser *m_pLaser; + float m_laserTime; +}; + +class CFuncTankRocket: public CFuncTank { +public: + virtual void Precache() = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0; +}; + +class CFuncTankMortar: public CFuncTank { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker) = 0; +}; + +class CFuncTankControls: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + CFuncTank *m_pTank; +}; diff --git a/reapi/include/cssdk/dlls/gamerules.h b/reapi/include/cssdk/dlls/gamerules.h new file mode 100644 index 0000000..114641c --- /dev/null +++ b/reapi/include/cssdk/dlls/gamerules.h @@ -0,0 +1,501 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "voice_gamemgr.h" + +#define COM_TOKEN_LEN 1500 + +#define MAX_RULE_BUFFER 1024 +#define MAX_VOTE_MAPS 100 +#define MAX_VIP_QUEUES 5 + +#define MAX_BOMB_RADIUS 2048 + +#define MAP_VIP_SAFETYZONE_UNINITIALIZED 0 // uninitialized +#define MAP_HAVE_VIP_SAFETYZONE_YES 1 // has VIP safety zone +#define MAP_HAVE_VIP_SAFETYZONE_NO 2 // does not have VIP safetyzone + +#define MAP_HAS_CAMERAS_INIT 2 // initial +#define MAP_HAS_CAMERAS_YES 1 // on map have of camera's + +#define ITEM_RESPAWN_TIME 30 +#define WEAPON_RESPAWN_TIME 20 +#define AMMO_RESPAWN_TIME 20 + +// longest the intermission can last, in seconds +#define MAX_INTERMISSION_TIME 120 + +// when we are within this close to running out of entities, items +// marked with the ITEM_FLAG_LIMITINWORLD will delay their respawn +#define ENTITY_INTOLERANCE 100 + +#define MAX_MOTD_CHUNK 60 +#define MAX_MOTD_LENGTH 1536 // (MAX_MOTD_CHUNK * 4) + +// custom enum +#define WINNER_NONE 0 +#define WINNER_DRAW 1 + +enum +{ + WINSTATUS_CTS = 1, + WINSTATUS_TERRORISTS, + WINSTATUS_DRAW, +}; + +// custom enum +// used for EndRoundMessage() logged messages +enum ScenarionEventEndRound +{ + ROUND_TARGET_BOMB = 1, + ROUND_VIP_ESCAPED, + ROUND_VIP_ASSASSINATED, + ROUND_TERRORISTS_ESCAPED, + ROUND_CTS_PREVENT_ESCAPE, + ROUND_ESCAPING_TERRORISTS_NEUTRALIZED, + ROUND_BOMB_DEFUSED, + ROUND_CTS_WIN, + ROUND_TERRORISTS_WIN, + ROUND_END_DRAW, + ROUND_ALL_HOSTAGES_RESCUED, + ROUND_TARGET_SAVED, + ROUND_HOSTAGE_NOT_RESCUED, + ROUND_TERRORISTS_NOT_ESCAPED, + ROUND_VIP_NOT_ESCAPED, + ROUND_GAME_COMMENCE, +}; + +// custom enum +enum RewardAccount +{ + REWARD_TARGET_BOMB = 3500, + REWARD_VIP_ESCAPED = 3500, + REWARD_VIP_ASSASSINATED = 3250, + REWARD_TERRORISTS_ESCAPED = 3150, + REWARD_CTS_PREVENT_ESCAPE = 3500, + REWARD_ESCAPING_TERRORISTS_NEUTRALIZED = 3250, + REWARD_BOMB_DEFUSED = 3250, + REWARD_BOMB_PLANTED = 800, + REWARD_BOMB_EXPLODED = 3250, + REWARD_CTS_WIN = 3000, + REWARD_TERRORISTS_WIN = 3000, + REWARD_ALL_HOSTAGES_RESCUED = 2500, + + // the end round was by the expiration time + REWARD_TARGET_BOMB_SAVED = 3250, + REWARD_HOSTAGE_NOT_RESCUED = 3250, + REWARD_VIP_NOT_ESCAPED = 3250, + + // loser bonus + REWARD_LOSER_BONUS_DEFAULT = 1400, + REWARD_LOSER_BONUS_MIN = 1500, + REWARD_LOSER_BONUS_MAX = 3000, + REWARD_LOSER_BONUS_ADD = 500, + + REWARD_RESCUED_HOSTAGE = 750, + REWARD_KILLED_ENEMY = 300, + REWARD_KILLED_VIP = 2500, + REWARD_VIP_HAVE_SELF_RESCUED = 2500, + + REWARD_TAKEN_HOSTAGE = 1000 + +}; + +// custom enum +enum PaybackForBadThing +{ + PAYBACK_FOR_KILLED_TEAMMATES = -3300, +}; + +// custom enum +enum InfoMapBuyParam +{ + BUYING_EVERYONE = 0, + BUYING_ONLY_CTS, + BUYING_ONLY_TERRORISTS, + BUYING_NO_ONE, +}; + +enum +{ + GR_NONE = 0, + GR_WEAPON_RESPAWN_YES, + GR_WEAPON_RESPAWN_NO, + GR_AMMO_RESPAWN_YES, + GR_AMMO_RESPAWN_NO, + GR_ITEM_RESPAWN_YES, + GR_ITEM_RESPAWN_NO, + GR_PLR_DROP_GUN_ALL, + GR_PLR_DROP_GUN_ACTIVE, + GR_PLR_DROP_GUN_NO, + GR_PLR_DROP_AMMO_ALL, + GR_PLR_DROP_AMMO_ACTIVE, + GR_PLR_DROP_AMMO_NO, +}; + +// custom enum +enum +{ + SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0), + SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1), + SCENARIO_BLOCK_VIP_ESCAPRE = (1 << 2), + SCENARIO_BLOCK_PRISON_ESCAPRE = (1 << 3), + SCENARIO_BLOCK_BOMB = (1 << 4), + SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5), + SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6), +}; + +enum +{ + GR_NOTTEAMMATE = 0, + GR_TEAMMATE, + GR_ENEMY, + GR_ALLY, + GR_NEUTRAL, +}; + +class CItem; + +class CGameRules { +public: + virtual void RefreshSkillData() = 0; + virtual void Think() = 0; + virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0; + virtual BOOL FAllowFlashlight() = 0; + virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; + virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0; + virtual BOOL IsMultiplayer() = 0; + virtual BOOL IsDeathmatch() = 0; + virtual BOOL IsTeamplay() = 0; + virtual BOOL IsCoOp() = 0; + + // this is the game name that gets seen in the server browser + virtual const char *GetGameDescription() = 0; + virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) = 0; + virtual void InitHUD(CBasePlayer *pl) = 0; + virtual void ClientDisconnected(edict_t *pClient) = 0; + virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0; + virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0; + virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0; + virtual BOOL ShouldAutoAim(CBasePlayer *pPlayer, edict_t *target) = 0; + virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0; + virtual void PlayerThink(CBasePlayer *pPlayer) = 0; + virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0; + virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0; + virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0; + virtual BOOL AllowAutoTargetCrosshair() = 0; + virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0; + virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; + virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0; + virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0; + virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; + virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor) = 0; + virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem) = 0; + virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; + virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0; + virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0; + virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0; + virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0; + virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0; + virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0; + virtual int ItemShouldRespawn(CItem *pItem) = 0; + virtual float FlItemRespawnTime(CItem *pItem) = 0; + virtual Vector VecItemRespawnSpot(CItem *pItem) = 0; + virtual BOOL CanHaveAmmo(CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry) = 0; + virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0; + virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0; + virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0; + virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0; + virtual float FlHealthChargerRechargeTime() = 0; + virtual float FlHEVChargerRechargeTime() = 0; + virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0; + virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0; + virtual const char *GetTeamID(CBaseEntity *pEntity) = 0; + virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0; + virtual int GetTeamIndex(const char *pTeamName) = 0; + virtual const char *GetIndexedTeamName(int teamIndex) = 0; + virtual BOOL IsValidTeam(const char *pTeamName) = 0; + virtual void ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib) = 0; + virtual const char *SetDefaultPlayerTeam(CBasePlayer *pPlayer) = 0; + virtual BOOL PlayTextureSounds() = 0; + virtual BOOL FAllowMonsters() = 0; + virtual void EndMultiplayerGame() = 0; + + // Stuff that is shared between client and server. + virtual BOOL IsFreezePeriod() = 0; + virtual void ServerDeactivate() = 0; + virtual void CheckMapConditions() = 0; +public: + BOOL m_bFreezePeriod; + BOOL m_bBombDropped; +}; + +class CHalfLifeRules: public CGameRules { +public: + virtual void Think() = 0; + virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0; + virtual BOOL FAllowFlashlight() = 0; + virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; + virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0; + virtual BOOL IsMultiplayer() = 0; + virtual BOOL IsDeathmatch() = 0; + virtual BOOL IsCoOp() = 0; + virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0; + virtual void InitHUD(CBasePlayer *pl) = 0; + virtual void ClientDisconnected(edict_t *pClient) = 0; + virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0; + virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0; + virtual void PlayerThink(CBasePlayer *pPlayer) = 0; + virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0; + virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0; + virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0; + virtual BOOL AllowAutoTargetCrosshair() = 0; + virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0; + virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; + virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; + virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; + virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0; + virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0; + virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0; + virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0; + virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0; + virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0; + virtual int ItemShouldRespawn(CItem *pItem) = 0; + virtual float FlItemRespawnTime(CItem *pItem) = 0; + virtual Vector VecItemRespawnSpot(CItem *pItem) = 0; + virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0; + virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0; + virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0; + virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0; + virtual float FlHealthChargerRechargeTime() = 0; + virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0; + virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0; + virtual const char *GetTeamID(CBaseEntity *pEntity) = 0; + virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0; + virtual BOOL FAllowMonsters() = 0; +}; + +class CHalfLifeMultiplay: public CGameRules { +public: + virtual void RefreshSkillData() = 0; + virtual void Think() = 0; + virtual BOOL IsAllowedToSpawn(CBaseEntity *pEntity) = 0; + virtual BOOL FAllowFlashlight() = 0; + virtual BOOL FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; + virtual BOOL GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) = 0; + virtual BOOL IsMultiplayer() = 0; + virtual BOOL IsDeathmatch() = 0; + virtual BOOL IsCoOp() = 0; + virtual BOOL ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) = 0; + virtual void InitHUD(CBasePlayer *pl) = 0; + virtual void ClientDisconnected(edict_t *pClient) = 0; + virtual void UpdateGameMode(CBasePlayer *pPlayer) = 0; + virtual float FlPlayerFallDamage(CBasePlayer *pPlayer) = 0; + virtual BOOL FPlayerCanTakeDamage(CBasePlayer *pPlayer, CBaseEntity *pAttacker) = 0; + virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0; + virtual void PlayerThink(CBasePlayer *pPlayer) = 0; + virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0; + virtual float FlPlayerSpawnTime(CBasePlayer *pPlayer) = 0; + virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0; + virtual BOOL AllowAutoTargetCrosshair() = 0; + virtual BOOL ClientCommand_DeadOrAlive(CBasePlayer *pPlayer, const char *pcmd) = 0; + virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; + virtual void ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer) = 0; + virtual int IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) = 0; + virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; + + // Death notices + virtual void DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; + virtual BOOL CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; + virtual void PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) = 0; + virtual int WeaponShouldRespawn(CBasePlayerItem *pWeapon) = 0; + virtual float FlWeaponRespawnTime(CBasePlayerItem *pWeapon) = 0; + virtual float FlWeaponTryRespawn(CBasePlayerItem *pWeapon) = 0; + virtual Vector VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) = 0; + virtual BOOL CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) = 0; + virtual void PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) = 0; + virtual int ItemShouldRespawn(CItem *pItem) = 0; + virtual float FlItemRespawnTime(CItem *pItem) = 0; + virtual Vector VecItemRespawnSpot(CItem *pItem) = 0; + virtual void PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) = 0; + virtual int AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) = 0; + virtual float FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) = 0; + virtual Vector VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) = 0; + virtual float FlHealthChargerRechargeTime() = 0; + virtual float FlHEVChargerRechargeTime() = 0; + virtual int DeadPlayerWeapons(CBasePlayer *pPlayer) = 0; + virtual int DeadPlayerAmmo(CBasePlayer *pPlayer) = 0; + virtual const char *GetTeamID(CBaseEntity *pEntity) = 0; + virtual int PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) = 0; + virtual BOOL PlayTextureSounds() = 0; + virtual BOOL FAllowMonsters() = 0; + virtual void EndMultiplayerGame() = 0; + virtual void ServerDeactivate() = 0; + virtual void CheckMapConditions() = 0; + + // Recreate all the map entities from the map data (preserving their indices), + // then remove everything else except the players. + // Also get rid of all world decals. + virtual void CleanUpMap() = 0; + + virtual void RestartRound() = 0; + + // check if the scenario has been won/lost + virtual void CheckWinConditions() = 0; + virtual void RemoveGuns() = 0; + virtual void GiveC4() = 0; + virtual void ChangeLevel() = 0; + virtual void GoToIntermission() = 0; +public: + bool ShouldSkipSpawn() const { return m_bSkipSpawn; } + void MarkSpawnSkipped() { m_bSkipSpawn = false; } + float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; } + bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); } +public: + CVoiceGameMgr m_VoiceGameMgr; + float m_fTeamCount; // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0 + float m_flCheckWinConditions; + float m_fRoundCount; + int m_iRoundTime; // (From mp_roundtime) - How many seconds long this round is. + int m_iRoundTimeSecs; + int m_iIntroRoundTime; // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is. + float m_fIntroRoundCount; // The global time when the intro round ends and the real one starts + // wrote the original "m_flRoundTime" comment for this variable). + int m_iAccountTerrorist; + int m_iAccountCT; + int m_iNumTerrorist; // The number of terrorists on the team (this is generated at the end of a round) + int m_iNumCT; // The number of CTs on the team (this is generated at the end of a round) + int m_iNumSpawnableTerrorist; + int m_iNumSpawnableCT; + int m_iSpawnPointCount_Terrorist; // Number of Terrorist spawn points + int m_iSpawnPointCount_CT; // Number of CT spawn points + int m_iHostagesRescued; + int m_iHostagesTouched; + int m_iRoundWinStatus; // 1 == CT's won last round, 2 == Terrorists did, 3 == Draw, no winner + + short m_iNumCTWins; + short m_iNumTerroristWins; + + bool m_bTargetBombed; // whether or not the bomb has been bombed + bool m_bBombDefused; // whether or not the bomb has been defused + + bool m_bMapHasBombTarget; + bool m_bMapHasBombZone; + bool m_bMapHasBuyZone; + bool m_bMapHasRescueZone; + bool m_bMapHasEscapeZone; + + int m_iMapHasVIPSafetyZone; // 0 = uninitialized; 1 = has VIP safety zone; 2 = DOES not have VIP safetyzone + int m_bMapHasCameras; + int m_iC4Timer; + int m_iC4Guy; // The current Terrorist who has the C4. + int m_iLoserBonus; // the amount of money the losing team gets. This scales up as they lose more rounds in a row + int m_iNumConsecutiveCTLoses; // the number of rounds the CTs have lost in a row. + int m_iNumConsecutiveTerroristLoses; // the number of rounds the Terrorists have lost in a row. + + float m_fMaxIdlePeriod; // For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked + + int m_iLimitTeams; + bool m_bLevelInitialized; + bool m_bRoundTerminating; + bool m_bCompleteReset; // Set to TRUE to have the scores reset next time round restarts + float m_flRequiredEscapeRatio; + int m_iNumEscapers; + int m_iHaveEscaped; + bool m_bCTCantBuy; + bool m_bTCantBuy; // Who can and can't buy. + float m_flBombRadius; + int m_iConsecutiveVIP; + int m_iTotalGunCount; + int m_iTotalGrenadeCount; + 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_iLastPick; + int m_iMaxMapTime; + int m_iMaxRounds; + int m_iTotalRoundsPlayed; + int m_iMaxRoundsWon; + int m_iStoredSpectValue; + float m_flForceCameraValue; + float m_flForceChaseCamValue; + float m_flFadeToBlackValue; + CBasePlayer *m_pVIP; + CBasePlayer *VIPQueue[MAX_VIP_QUEUES]; + float m_flIntermissionEndTime; + float m_flIntermissionStartTime; + BOOL m_iEndIntermissionButtonHit; + float m_tmNextPeriodicThink; + bool m_bFirstConnected; + bool m_bInCareerGame; + float m_fCareerRoundMenuTime; + int m_iCareerMatchWins; + int m_iRoundWinDifference; + float m_fCareerMatchMenuTime; + bool m_bSkipSpawn; +}; + +typedef struct mapcycle_item_s +{ + struct mapcycle_item_s *next; + char mapname[32]; + int minplayers; + int maxplayers; + char rulebuffer[MAX_RULE_BUFFER]; + +} mapcycle_item_t; + +typedef struct mapcycle_s +{ + struct mapcycle_item_s *items; + struct mapcycle_item_s *next_item; + +} mapcycle_t; + +class CMapInfo: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +public: + int m_iBuyingStatus; + float m_flBombRadius; +}; + +class CCStrikeGameMgrHelper: public IVoiceGameMgrHelper { +public: + virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pSender) = 0; +}; + +extern CGameRules *g_pGameRules; + +inline CHalfLifeMultiplay *CSGameRules() +{ + return reinterpret_cast(g_pGameRules); +} diff --git a/reapi/include/cssdk/dlls/h_battery.h b/reapi/include/cssdk/dlls/h_battery.h new file mode 100644 index 0000000..e523dd6 --- /dev/null +++ b/reapi/include/cssdk/dlls/h_battery.h @@ -0,0 +1,45 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CRecharge: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + float m_flNextCharge; + int m_iReactivate; + int m_iJuice; + int m_iOn; + float m_flSoundTime; +}; diff --git a/reapi/include/cssdk/dlls/h_cycler.h b/reapi/include/cssdk/dlls/h_cycler.h new file mode 100644 index 0000000..4989620 --- /dev/null +++ b/reapi/include/cssdk/dlls/h_cycler.h @@ -0,0 +1,104 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CCycler: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + + // Don't treat as a live target + virtual BOOL IsAlive() = 0; + virtual void Think() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int m_animate; +}; + +// we should get rid of all the other cyclers and replace them with this. +class CGenericCycler: public CCycler { +public: + virtual void Spawn() = 0; +}; + +// Probe droid imported for tech demo compatibility +class CCyclerProbe: public CCycler { +public: + virtual void Spawn() = 0; +}; + +class CCyclerSprite: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Think() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + inline int ShouldAnimate() { return (m_animate && m_maxFrame > 1.0f); } +public: + int m_animate; + float m_lastTime; + float m_maxFrame; + int m_renderfx; + int m_rendermode; + float m_renderamt; + vec3_t m_rendercolor; +}; + +class CWeaponCycler: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual void Holster(int skiplocal = 0) = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; +public: + int m_iszModel; + int m_iModel; +}; + +// Flaming Wreakage +class CWreckage: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Think() = 0; +public: + int m_flStartTime; +}; diff --git a/reapi/include/cssdk/dlls/healthkit.h b/reapi/include/cssdk/dlls/healthkit.h new file mode 100644 index 0000000..eb4e63d --- /dev/null +++ b/reapi/include/cssdk/dlls/healthkit.h @@ -0,0 +1,52 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CHealthKit: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CWallHealth: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + float m_flNextCharge; + int m_iReactivate; + int m_iJuice; + int m_iOn; + float m_flSoundTime; +}; diff --git a/reapi/include/cssdk/dlls/hintmessage.h b/reapi/include/cssdk/dlls/hintmessage.h new file mode 100644 index 0000000..ce63fde --- /dev/null +++ b/reapi/include/cssdk/dlls/hintmessage.h @@ -0,0 +1,81 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "utlvector.h" + +#define DHF_ROUND_STARTED (1<<1) +#define DHF_HOSTAGE_SEEN_FAR (1<<2) +#define DHF_HOSTAGE_SEEN_NEAR (1<<3) +#define DHF_HOSTAGE_USED (1<<4) +#define DHF_HOSTAGE_INJURED (1<<5) +#define DHF_HOSTAGE_KILLED (1<<6) +#define DHF_FRIEND_SEEN (1<<7) +#define DHF_ENEMY_SEEN (1<<8) +#define DHF_FRIEND_INJURED (1<<9) +#define DHF_FRIEND_KILLED (1<<10) +#define DHF_ENEMY_KILLED (1<<11) +#define DHF_BOMB_RETRIEVED (1<<12) +#define DHF_AMMO_EXHAUSTED (1<<15) +#define DHF_IN_TARGET_ZONE (1<<16) +#define DHF_IN_RESCUE_ZONE (1<<17) +#define DHF_IN_ESCAPE_ZONE (1<<18) +#define DHF_IN_VIPSAFETY_ZONE (1<<19) +#define DHF_NIGHTVISION (1<<20) +#define DHF_HOSTAGE_CTMOVE (1<<21) +#define DHF_SPEC_DUCK (1<<22) + +#define DHM_ROUND_CLEAR (DHF_ROUND_STARTED | DHF_HOSTAGE_KILLED | DHF_FRIEND_KILLED | DHF_BOMB_RETRIEVED) +#define DHM_CONNECT_CLEAR (DHF_HOSTAGE_SEEN_FAR | DHF_HOSTAGE_SEEN_NEAR | DHF_HOSTAGE_USED | DHF_HOSTAGE_INJURED | DHF_FRIEND_SEEN | DHF_ENEMY_SEEN | DHF_FRIEND_INJURED | DHF_ENEMY_KILLED | DHF_AMMO_EXHAUSTED | DHF_IN_TARGET_ZONE | DHF_IN_RESCUE_ZONE | DHF_IN_ESCAPE_ZONE | DHF_IN_VIPSAFETY_ZONE | DHF_HOSTAGE_CTMOVE | DHF_SPEC_DUCK) + +class CHintMessage { +public: + CHintMessage(const char *hintString, bool isHint, CUtlVector *args, float duration); + ~CHintMessage(); +public: + float GetDuration() const { return m_duration; } + void Send(CBaseEntity *client); + +private: + const char *m_hintString; + bool m_isHint; + CUtlVector m_args; + float m_duration; +}; + +class CHintMessageQueue { +public: + void Reset(); + void Update(CBaseEntity *client); + bool AddMessage(const char *message, float duration, bool isHint, CUtlVector *args); + bool IsEmpty() const { return m_messages.Count() == 0; } + +private: + float m_tmMessageEnd; + CUtlVector m_messages; +}; diff --git a/reapi/include/cssdk/dlls/hookchains.h b/reapi/include/cssdk/dlls/hookchains.h new file mode 100644 index 0000000..f2993e8 --- /dev/null +++ b/reapi/include/cssdk/dlls/hookchains.h @@ -0,0 +1,89 @@ +/* +* +* 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. +* +*/ +#pragma once + +template +class IHookChain { +protected: + virtual ~IHookChain() {} + +public: + virtual t_ret callNext(t_args... args) = 0; + virtual t_ret callOriginal(t_args... args) = 0; +}; + +template +class IVoidHookChain +{ +protected: + virtual ~IVoidHookChain() {} + +public: + virtual void callNext(t_args... args) = 0; + virtual void callOriginal(t_args... args) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IHookChainRegistry { +public: + typedef t_ret(*hookfunc_t)(IHookChain*, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IHookChainRegistryClass { +public: + typedef t_ret(*hookfunc_t)(IHookChain*, t_class *, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IVoidHookChainRegistry { +public: + typedef void(*hookfunc_t)(IVoidHookChain*, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IVoidHookChainRegistryClass { +public: + typedef void(*hookfunc_t)(IVoidHookChain*, t_class *, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; diff --git a/reapi/include/cssdk/dlls/hostage/hostage.h b/reapi/include/cssdk/dlls/hostage/hostage.h new file mode 100644 index 0000000..50af276 --- /dev/null +++ b/reapi/include/cssdk/dlls/hostage/hostage.h @@ -0,0 +1,232 @@ +/* +* +* 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. +* +*/ +#pragma once + +// Improved the hostages from CZero +#include "hostage/hostage_improv.h" + +#define MAX_NODES 100 +#define MAX_HOSTAGES 12 +#define MAX_HOSTAGES_NAV 20 + +#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; +class CHostageImprov; +class CHostageManager; + +enum HostageChatterType +{ + HOSTAGE_CHATTER_START_FOLLOW = 0, + HOSTAGE_CHATTER_STOP_FOLLOW, + HOSTAGE_CHATTER_INTIMIDATED, + HOSTAGE_CHATTER_PAIN, + HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, + HOSTAGE_CHATTER_SCARED_OF_MURDER, + HOSTAGE_CHATTER_LOOK_OUT, + HOSTAGE_CHATTER_PLEASE_RESCUE_ME, + HOSTAGE_CHATTER_SEE_RESCUE_ZONE, + HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, + HOSTAGE_CHATTER_CTS_WIN , + HOSTAGE_CHATTER_TERRORISTS_WIN, + HOSTAGE_CHATTER_RESCUED, + HOSTAGE_CHATTER_WARN_NEARBY, + HOSTAGE_CHATTER_WARN_SPOTTED, + HOSTAGE_CHATTER_CALL_TO_RESCUER, + HOSTAGE_CHATTER_RETREAT, + HOSTAGE_CHATTER_COUGH, + HOSTAGE_CHATTER_BLINDED, + HOSTAGE_CHATTER_SAW_HE_GRENADE, + HOSTAGE_CHATTER_DEATH_CRY, + NUM_HOSTAGE_CHATTER_TYPES, +}; + +extern CHostageManager *g_pHostages; +extern int g_iHostageNumber; + +// A Counter-Strike Hostage Simple +class CHostage: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int ObjectCaps() = 0; // make hostage "useable" + virtual int Classify() = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int BloodColor() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int GetActivity() { return m_Activity; } + + // queries + bool IsFollowingSomeone() { return IsFollowing(); } + CBaseEntity *GetLeader() // return our leader, or NULL + { + if (m_improv != NULL) + { + return m_improv->GetFollowLeader(); + } + + return m_hTargetEnt; + } + bool IsFollowing(const CBaseEntity *entity = NULL) + { + if (m_improv != NULL) + { + return m_improv->IsFollowing(); + } + + if (entity == NULL && m_hTargetEnt == NULL || (entity != NULL && m_hTargetEnt != entity)) + return false; + + if (m_State != FOLLOW) + return false; + + return true; + } + bool IsValid() { return (pev->takedamage == DAMAGE_YES); } + bool IsDead() { return (pev->deadflag == DEAD_DEAD); } + bool IsAtHome() { return (pev->origin - m_vStart).IsLengthGreaterThan(20) != true; } + const Vector *GetHomePosition() { return &m_vStart; } +public: + int m_Activity; + BOOL m_bTouched; + BOOL m_bRescueMe; + float m_flFlinchTime; + float m_flNextChange; + float m_flMarkPosition; + int m_iModel; + int m_iSkin; + float m_flNextRadarTime; + enum state { FOLLOW, STAND, DUCK, SCARED, IDLE, FOLLOWPATH } + m_State; + Vector m_vStart; + Vector m_vStartAngles; + Vector m_vPathToFollow[20]; + int m_iWaypoint; + CBasePlayer *m_target; + CLocalNav *m_LocalNav; + int nTargetNode; + Vector vecNodes[MAX_NODES]; + EHANDLE m_hStoppedTargetEnt; + float m_flNextFullThink; + float m_flPathCheckInterval; + float m_flLastPathCheck; + int m_nPathNodes; + BOOL m_fHasPath; + float m_flPathAcquired; + Vector m_vOldPos; + int m_iHostageIndex; + BOOL m_bStuck; + float m_flStuckTime; + CHostageImprov *m_improv; + + enum ModelType { REGULAR_GUY, OLD_GUY, BLACK_GUY, GOOFY_GUY } + m_whichModel; +}; + +class SimpleChatter { +public: + struct SoundFile + { + char *filename; + float duration; + }; + + struct ChatterSet + { + SoundFile file[32]; + int count; + int index; + bool needsShuffle; + }; +private: + ChatterSet m_chatter[21]; +}; + +class CHostageManager { +public: + SimpleChatter *GetChatter() + { + return &m_chatter; + } + // Iterate over all active hostages in the game, invoking functor on each. + // If functor returns false, stop iteration and return false. + template + inline bool ForEachHostage(Functor &func) const + { + for (int i = 0; i < m_hostageCount; i++) + { + CHostage *hostage = m_hostage[i]; + + if (hostage == NULL || hostage->pev->deadflag == DEAD_DEAD) + continue; + + if (func(hostage) == false) + return false; + } + + return true; + } + inline CHostage *GetClosestHostage(const Vector &pos, float *resultRange = NULL) + { + float range; + float closeRange = 1e8f; + CHostage *close = NULL; + + for (int i = 0; i < m_hostageCount; i++) + { + range = (m_hostage[i]->pev->origin - pos).Length(); + + if (range < closeRange) + { + closeRange = range; + close = m_hostage[i]; + } + } + + if (resultRange) + *resultRange = closeRange; + + return close; + } + +private: + CHostage *m_hostage[MAX_HOSTAGES]; + int m_hostageCount; + SimpleChatter m_chatter; +}; diff --git a/reapi/include/cssdk/dlls/hostage/hostage_improv.h b/reapi/include/cssdk/dlls/hostage/hostage_improv.h new file mode 100644 index 0000000..9ec69a7 --- /dev/null +++ b/reapi/include/cssdk/dlls/hostage/hostage_improv.h @@ -0,0 +1,331 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "hostage/hostage.h" +#include "hostage/hostage_states.h" + +class CHostage; +enum HostageChatterType; + +// A Counter-Strike Hostage improved +class CHostageImprov: public CImprov { +public: + // invoked when an improv reaches its MoveTo goal + virtual void OnMoveToSuccess(const Vector &goal) = 0; + + // invoked when an improv fails to reach a MoveTo goal + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) = 0; + virtual void OnInjury(float amount) = 0; + virtual bool IsAlive() const = 0; + virtual void MoveTo(const Vector &goal) = 0; + virtual void LookAt(const Vector &target) = 0; + virtual void ClearLookAt() = 0; + virtual void FaceTo(const Vector &goal) = 0; + virtual void ClearFaceTo() = 0; + virtual bool IsAtMoveGoal(float error = 20.0f) const = 0; + virtual bool HasLookAt() const = 0; + virtual bool HasFaceTo() const = 0; + virtual bool IsAtFaceGoal() const = 0; + virtual bool IsFriendInTheWay(const Vector &goalPos) const = 0; + virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const = 0; + virtual void MoveForward() = 0; + virtual void MoveBackward() = 0; + virtual void StrafeLeft() = 0; + virtual void StrafeRight() = 0; + + #define HOSTAGE_MUST_JUMP true + virtual bool Jump() = 0; + + virtual void Crouch() = 0; + virtual void StandUp() = 0; + virtual void TrackPath(const Vector &pathGoal, float deltaT) = 0; // move along path by following "pathGoal" + virtual void StartLadder(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0; + virtual bool TraverseLadder(const CNavLadder *ladder, NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0; + virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0; + virtual void Run() = 0; + virtual void Walk() = 0; + virtual void Stop() = 0; + virtual float GetMoveAngle() const = 0; + virtual float GetFaceAngle() const = 0; + virtual const Vector &GetFeet() const = 0; + virtual const Vector &GetCentroid() const = 0; + virtual const Vector &GetEyes() const = 0; + virtual bool IsRunning() const = 0; + virtual bool IsWalking() const = 0; + virtual bool IsStopped() const = 0; + virtual bool IsCrouching() const = 0; + virtual bool IsJumping() const = 0; + virtual bool IsUsingLadder() const = 0; + virtual bool IsOnGround() const = 0; + virtual bool IsMoving() const = 0; + virtual bool CanRun() const = 0; + virtual bool CanCrouch() const = 0; + virtual bool CanJump() const = 0; + virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if hostage can see position + virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0; + virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; + virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0; + virtual CNavArea *GetLastKnownArea() const = 0; + virtual void OnUpdate(float deltaT) = 0; + virtual void OnUpkeep(float deltaT) = 0; + virtual void OnReset() = 0; + virtual void OnGameEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0; + virtual void OnTouch(CBaseEntity *other) = 0; // in contact with "other" +public: + enum MoveType { Stopped, Walking, Running }; + enum ScareType { NERVOUS, SCARED, TERRIFIED }; + + const Vector &GetKnownGoodPosition() const { return m_knownGoodPos; } + void ApplyForce(Vector force) { m_vel.x += force.x; m_vel.y += force.y; } // apply a force to the hostage + const Vector GetActualVelocity() const { return m_actualVel; } + void SetMoveLimit(MoveType limit) { m_moveLimit = limit; } + MoveType GetMoveLimit() const { return m_moveLimit; } + CNavPath *GetPath() { return &m_path; } + + // hostage states + // stand idle + void Idle() { m_behavior.SetState(&m_idleState); } + bool IsIdle() const { return m_behavior.IsState(&m_idleState); } + + // begin following "leader" + void Follow(CBasePlayer *leader) { m_followState.SetLeader(leader); m_behavior.SetState(&m_followState); } + bool IsFollowing(const CBaseEntity *leader = NULL) const { return m_behavior.IsState(&m_followState); } + + // Escape + void Escape() { m_behavior.SetState(&m_escapeState); } + bool IsEscaping() const { return m_behavior.IsState(&m_escapeState); } + + // Retreat + void Retreat() { m_behavior.SetState(&m_retreatState); } + bool IsRetreating() const { return m_behavior.IsState(&m_retreatState); } + + CBaseEntity *GetFollowLeader() const { return m_followState.GetLeader(); } + ScareType GetScareIntensity() const { return m_scareIntensity; } + bool IsIgnoringTerrorists() const { return m_ignoreTerroristTimer.IsElapsed(); } + float GetAggression() const { return m_aggression; } + bool IsTalking() const { return m_talkingTimer.IsElapsed(); } + CHostage *GetEntity() const { return m_hostage; } + void SetMoveAngle(float angle) { m_moveAngle = angle; } +public: + CountdownTimer m_coughTimer; + CountdownTimer m_grenadeTimer; +private: + CHostage *m_hostage; + CNavArea *m_lastKnownArea; // last area we were in + mutable Vector m_centroid; + mutable Vector m_eye; + HostageStateMachine m_behavior; + HostageIdleState m_idleState; + HostageEscapeState m_escapeState; + HostageRetreatState m_retreatState; + HostageFollowState m_followState; + HostageAnimateState m_animateState; + bool m_didFidget; + float m_aggression; + IntervalTimer m_lastSawCT; + IntervalTimer m_lastSawT; + CountdownTimer m_checkNearbyTerroristTimer; + bool m_isTerroristNearby; + CountdownTimer m_nearbyTerroristTimer; + CountdownTimer m_scaredTimer; + ScareType m_scareIntensity; + CountdownTimer m_ignoreTerroristTimer; + CountdownTimer m_blinkTimer; + char m_blinkCounter; + IntervalTimer m_lastInjuryTimer; + IntervalTimer m_lastNoiseTimer; + mutable CountdownTimer m_avoidFriendTimer; + mutable bool m_isFriendInTheWay; + CountdownTimer m_chatterTimer; + bool m_isDelayedChatterPending; + CountdownTimer m_delayedChatterTimer; + HostageChatterType m_delayedChatterType; + bool m_delayedChatterMustSpeak; + CountdownTimer m_talkingTimer; + unsigned int m_moveFlags; + Vector2D m_vel; + Vector m_actualVel; + Vector m_moveGoal; + Vector m_knownGoodPos; + bool m_hasKnownGoodPos; + Vector m_priorKnownGoodPos; + bool m_hasPriorKnownGoodPos; + CountdownTimer m_priorKnownGoodPosTimer; + IntervalTimer m_collisionTimer; + Vector m_viewGoal; + bool m_isLookingAt; + Vector m_faceGoal; + bool m_isFacingTo; + CNavPath m_path; // current path to follow + CNavPathFollower m_follower; + Vector m_lastPosition; + MoveType m_moveType; + MoveType m_moveLimit; + bool m_isCrouching; // true if hostage is crouching + CountdownTimer m_minCrouchTimer; + float m_moveAngle; + NavRelativeDirType m_wiggleDirection; + + CountdownTimer m_wiggleTimer; // for wiggling + CountdownTimer m_wiggleJumpTimer; + CountdownTimer m_inhibitObstacleAvoidance; + CountdownTimer m_jumpTimer; // if zero, we can jump + + bool m_hasJumped; + bool m_hasJumpedIntoAir; + Vector m_jumpTarget; + CountdownTimer m_clearPathTimer; + bool m_traversingLadder; + EHANDLE m_visiblePlayer[MAX_CLIENTS]; + int m_visiblePlayerCount; + CountdownTimer m_visionTimer; +}; + +class CheckWayFunctor { +public: + CheckWayFunctor(const CHostageImprov *me, const Vector &goalPos) + { + m_me = me; + m_goalPos = goalPos; + m_blocker = NULL; + } + bool operator()(CHostage *them) + { + if (((CBaseMonster *)them)->IsAlive() && m_me->IsFriendInTheWay((CBaseEntity *)them, m_goalPos)) + { + m_blocker = them; + return false; + } + + return true; + } + + const CHostageImprov *m_me; + Vector m_goalPos; + CHostage *m_blocker; +}; + +// 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. +class HostagePathCost { +public: + float operator()(CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder) + { + if (fromArea == NULL) + { + // first area in path, no cost + return 0.0f; + } + else + { + // compute distance travelled along path so far + float dist; + + if (ladder != NULL) + { + const float ladderCost = 10.0f; + return ladder->m_length * ladderCost + fromArea->GetCostSoFar(); + } + else + { + dist = (*area->GetCenter() - *fromArea->GetCenter()).Length(); + } + + float cost = dist + fromArea->GetCostSoFar(); + + // if this is a "crouch" area, add penalty + if (area->GetAttributes() & NAV_CROUCH) + { + const float crouchPenalty = 10.0f; + cost += crouchPenalty * dist; + } + + // if this is a "jump" area, add penalty + if (area->GetAttributes() & NAV_JUMP) + { + const float jumpPenalty = 10.0f; + cost += jumpPenalty * dist; + } + + return cost; + } + } +}; + +class KeepPersonalSpace { +public: + KeepPersonalSpace(CHostageImprov *improv) + { + m_improv = improv; + m_velDir = improv->GetActualVelocity(); + m_speed = m_velDir.NormalizeInPlace(); + } + bool operator()(CBaseEntity *entity) + { + const float space = 1.0f; + Vector to; + float range; + + if (entity == reinterpret_cast(m_improv->GetEntity())) + return true; + + if (entity->IsPlayer() && !entity->IsAlive()) + return true; + + to = entity->pev->origin - m_improv->GetCentroid(); + range = to.NormalizeInPlace(); + + CBasePlayer *player = static_cast(entity); + + const float spring = 50.0f; + const float damper = 1.0f; + + if (range >= spring) + return true; + + const float cosTolerance = 0.8f; + if (entity->IsPlayer() && player->m_iTeam == CT && !m_improv->IsFollowing() && m_improv->IsPlayerLookingAtMe(player, cosTolerance)) + return true; + + const float minSpace = (spring - range); + float ds = -minSpace; + + m_improv->ApplyForce(to * ds); + + const float force = 0.1f; + m_improv->ApplyForce(m_speed * -force * m_velDir); + + return true; + } + +private: + CHostageImprov *m_improv; + Vector m_velDir; + float m_speed; +}; diff --git a/reapi/include/cssdk/dlls/hostage/hostage_localnav.h b/reapi/include/cssdk/dlls/hostage/hostage_localnav.h new file mode 100644 index 0000000..5a40e6f --- /dev/null +++ b/reapi/include/cssdk/dlls/hostage/hostage_localnav.h @@ -0,0 +1,58 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define NODE_INVALID_EMPTY -1 + +#define PATH_TRAVERSABLE_EMPTY 0 +#define PATH_TRAVERSABLE_SLOPE 1 +#define PATH_TRAVERSABLE_STEP 2 +#define PATH_TRAVERSABLE_STEPJUMPABLE 3 + +typedef int node_index_t; + +typedef struct localnode_s +{ + Vector vecLoc; + int offsetX; + int offsetY; + byte bDepth; + BOOL fSearched; + node_index_t nindexParent; + +} localnode_t; + +class CLocalNav { +private: + CHostage *m_pOwner; + edict_t *m_pTargetEnt; + BOOL m_fTargetEntHit; + localnode_t *m_nodeArr; + node_index_t m_nindexAvailableNode; + Vector m_vecStartingLoc; +}; diff --git a/reapi/include/cssdk/dlls/hostage/hostage_states.h b/reapi/include/cssdk/dlls/hostage/hostage_states.h new file mode 100644 index 0000000..9ac99cf --- /dev/null +++ b/reapi/include/cssdk/dlls/hostage/hostage_states.h @@ -0,0 +1,203 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CHostageImprov; + +class HostageState: public SimpleState, public IImprovEvent { +public: + virtual ~HostageState() {} + virtual void UpdateStationaryAnimation(CHostageImprov *improv) {} +}; + +class HostageStateMachine: public SimpleStateMachine, public IImprovEvent { +public: + virtual void OnMoveToSuccess(const Vector &goal) {} + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {} + virtual void OnInjury(float amount) {} +}; + +class HostageIdleState: public HostageState { +public: + virtual ~HostageIdleState() {} + virtual void OnEnter(CHostageImprov *improv) {} + virtual void OnUpdate(CHostageImprov *improv) {} + virtual void OnExit(CHostageImprov *improv) {} + virtual const char *GetName() const { return "Idle"; } + virtual void UpdateStationaryAnimation(CHostageImprov *improv) {} + virtual void OnMoveToSuccess(const Vector &goal) {} + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {} + virtual void OnInjury(float amount = -1.0f) {} +private: + CountdownTimer m_waveTimer; + CountdownTimer m_fleeTimer; + CountdownTimer m_disagreeTimer; + CountdownTimer m_escapeTimer; + CountdownTimer m_askTimer; + IntervalTimer m_intimidatedTimer; + CountdownTimer m_pleadTimer; + + enum + { + NotMoving = 0, + Moving, + MoveDone, + MoveFailed, + } m_moveState; + + bool m_mustFlee; +}; + +class HostageEscapeToCoverState: public HostageState { +public: + virtual ~HostageEscapeToCoverState() {} + virtual void OnEnter(CHostageImprov *improv) {} + virtual void OnUpdate(CHostageImprov *improv) {} + virtual void OnExit(CHostageImprov *improv) {} + virtual const char *GetName() const { return "Escape:ToCover"; } + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {} +public: + void SetRescueGoal(const Vector &rescueGoal) { m_rescueGoal = rescueGoal; } + +private: + Vector m_rescueGoal; + Vector m_spot; + bool m_canEscape; +}; + +class HostageEscapeLookAroundState: public HostageState { +public: + virtual ~HostageEscapeLookAroundState() {} + virtual void OnEnter(CHostageImprov *improv) {} + virtual void OnUpdate(CHostageImprov *improv) {} + virtual void OnExit(CHostageImprov *improv) {} + virtual const char *GetName() const { return "Escape:LookAround"; } + +private: + CountdownTimer m_timer; +}; + +class HostageEscapeState: public HostageState { +public: + virtual ~HostageEscapeState() {} + virtual void OnEnter(CHostageImprov *improv) {} + virtual void OnUpdate(CHostageImprov *improv) {} + virtual void OnExit(CHostageImprov *improv) {} + virtual const char *GetName() const { return "Escape"; } + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {} +public: + void ToCover() { m_behavior.SetState(&m_toCoverState); } + void LookAround() { m_behavior.SetState(&m_lookAroundState); } +private: + HostageEscapeToCoverState m_toCoverState; + HostageEscapeLookAroundState m_lookAroundState; + HostageStateMachine m_behavior; + bool m_canEscape; + CountdownTimer m_runTimer; +}; + +class HostageRetreatState: public HostageState { +public: + virtual ~HostageRetreatState() {} + virtual void OnEnter(CHostageImprov *improv) {} + virtual void OnUpdate(CHostageImprov *improv) {} + virtual void OnExit(CHostageImprov *improv) {} + virtual const char *GetName() const { return "Retreat"; } +}; + +class HostageFollowState: public HostageState { +public: + virtual ~HostageFollowState() {} + virtual void OnEnter(CHostageImprov *improv) {} + virtual void OnUpdate(CHostageImprov *improv) {} + virtual void OnExit(CHostageImprov *improv) {} + virtual const char *GetName() const { return "Follow"; } + virtual void UpdateStationaryAnimation(CHostageImprov *improv) {} +public: + void SetLeader(CBaseEntity *leader) { m_leader = leader; } + CBaseEntity *GetLeader() const { return m_leader; } +private: + mutable EHANDLE m_leader; + Vector m_lastLeaderPos; + bool m_isWaiting; + float m_stopRange; + CountdownTimer m_makeWayTimer; + CountdownTimer m_impatientTimer; + CountdownTimer m_repathTimer; + bool m_isWaitingForFriend; + CountdownTimer m_waitForFriendTimer; +}; + +class HostageAnimateState: public HostageState { +public: + virtual ~HostageAnimateState() {} + virtual void OnEnter(CHostageImprov *improv) {} + virtual void OnUpdate(CHostageImprov *improv) {} + virtual void OnExit(CHostageImprov *improv) {} + virtual const char *GetName() const { return "Animate"; } +public: + struct SeqInfo + { + int seqID; + float holdTime; + float rate; + }; + + enum PerformanceType + { + None = 0, + Walk, + Run, + Jump, + Fall, + Crouch, + CrouchWalk, + Calm, + Anxious, + Afraid, + Sitting, + GettingUp, + Waving, + LookingAround, + Disagreeing, + Flinching, + }; + + bool IsBusy() const { return (m_sequenceCount > 0); } + int GetCurrentSequenceID() { return m_currentSequence; } + PerformanceType GetPerformance() const { return m_performance; } + void SetPerformance(PerformanceType performance) { m_performance = performance; } +private: + enum { MAX_SEQUENCES = 8 }; + struct SeqInfo m_sequence[MAX_SEQUENCES]; + int m_sequenceCount; + int m_currentSequence; + enum PerformanceType m_performance; + bool m_isHolding; + CountdownTimer m_holdTimer; +}; diff --git a/reapi/include/cssdk/dlls/items.h b/reapi/include/cssdk/dlls/items.h new file mode 100644 index 0000000..1c4dd14 --- /dev/null +++ b/reapi/include/cssdk/dlls/items.h @@ -0,0 +1,110 @@ +/* +* +* 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. +* +*/ +#pragma once + +// constant items +#define ITEM_HEALTHKIT 1 +#define ITEM_ANTIDOTE 2 +#define ITEM_SECURITY 3 +#define ITEM_BATTERY 4 +#define ITEM_SUIT 5 + +class CItem: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual CBaseEntity *Respawn() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; + +public: + void EXPORT ItemTouch(CBaseEntity *pOther) = 0; + void EXPORT Materialize() = 0; +}; + +class CWorldItem: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +public: + int m_iType; +}; + +class CItemSuit: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CItemBattery: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CItemAntidote: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CItemSecurity: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CItemLongJump: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CItemKevlar: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CItemAssaultSuit: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; + +class CItemThighPack: public CItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; +}; diff --git a/reapi/include/cssdk/dlls/lights.h b/reapi/include/cssdk/dlls/lights.h new file mode 100644 index 0000000..df0fb68 --- /dev/null +++ b/reapi/include/cssdk/dlls/lights.h @@ -0,0 +1,50 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SF_LIGHT_START_OFF 1 + +class CLight: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +private: + int m_iStyle; + int m_iszPattern; + BOOL m_iStartedOff; +}; + +class CEnvLight: public CLight { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +}; diff --git a/reapi/include/cssdk/dlls/maprules.h b/reapi/include/cssdk/dlls/maprules.h new file mode 100644 index 0000000..dde173e --- /dev/null +++ b/reapi/include/cssdk/dlls/maprules.h @@ -0,0 +1,236 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define MAX_EQUIP 32 +#define SF_SCORE_NEGATIVE 0x0001 +#define SF_SCORE_TEAM 0x0002 + +#define SF_ENVTEXT_ALLPLAYERS 0x0001 + +#define SF_TEAMMASTER_FIREONCE 0x0001 +#define SF_TEAMMASTER_ANYTEAM 0x0002 + +#define SF_TEAMSET_FIREONCE 0x0001 +#define SF_TEAMSET_CLEARTEAM 0x0002 + +#define SF_PKILL_FIREONCE 0x0001 + +#define SF_GAMECOUNT_FIREONCE 0x0001 +#define SF_GAMECOUNT_RESET 0x0002 + +#define SF_GAMECOUNTSET_FIREONCE 0x0001 + +#define SF_PLAYEREQUIP_USEONLY 0x0001 + +#define SF_PTEAM_FIREONCE 0x0001 +#define SF_PTEAM_KILL 0x0002 +#define SF_PTEAM_GIB 0x0004 + +class CRuleEntity: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +public: + void SetMaster(int iszMaster) { m_iszMaster = iszMaster; } + +private: + string_t m_iszMaster; +}; + +// CRulePointEntity -- base class for all rule "point" entities (not brushes) +class CRulePointEntity: public CRuleEntity { +public: + virtual void Spawn() = 0; +}; + +// 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 +class CRuleBrushEntity: public CRuleEntity { +public: + virtual void Spawn() = 0; +}; + +// CGameScore / game_score -- award points to player / team +// Points +/- total +// Flag: Allow negative scores SF_SCORE_NEGATIVE +// Flag: Award points to team in teamplay SF_SCORE_TEAM +class CGameScore: public CRulePointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + int Points() const { return int(pev->frags); } + BOOL AllowNegativeScore() { return pev->spawnflags & SF_SCORE_NEGATIVE; } + BOOL AwardToTeam() const { return pev->spawnflags & SF_SCORE_TEAM; } + void SetPoints(int points) { pev->frags = points; } +}; + +// CGameEnd / game_end -- Ends the game in MP +class CGameEnd: public CRulePointEntity { +public: + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +// CGameText / game_text -- NON-Localized HUD Message (use env_message to display a titles.txt message) +// Flag: All players SF_ENVTEXT_ALLPLAYERS +class CGameText: public CRulePointEntity { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + +public: + BOOL MessageToAll() const { return (pev->spawnflags & SF_ENVTEXT_ALLPLAYERS) == SF_ENVTEXT_ALLPLAYERS; } + void MessageSet(const char *pMessage) { pev->message = ALLOC_STRING(pMessage); } + const char *MessageGet() const { return STRING(pev->message); } + +private: + hudtextparms_t m_textParms; +}; + +// 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) +class CGameTeamMaster: public CRulePointEntity { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int ObjectCaps() = 0; + virtual BOOL IsTriggered(CBaseEntity *pActivator) = 0; + virtual const char *TeamID() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + BOOL RemoveOnFire() const { return (pev->spawnflags & SF_TEAMMASTER_FIREONCE) == SF_TEAMMASTER_FIREONCE; } + BOOL AnyTeam() const { return (pev->spawnflags & SF_TEAMMASTER_ANYTEAM) == SF_TEAMMASTER_ANYTEAM; } + +public: + int m_teamIndex; + USE_TYPE triggerType; +}; + +// 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 +class CGameTeamSet: public CRulePointEntity { +public: + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + BOOL RemoveOnFire() const { return (pev->spawnflags & SF_TEAMSET_FIREONCE) == SF_TEAMSET_FIREONCE; } + BOOL ShouldClearTeam() const { return (pev->spawnflags & SF_TEAMSET_CLEARTEAM) == SF_TEAMSET_CLEARTEAM; } +}; + +// CGamePlayerZone / game_player_zone -- players in the zone fire my target when I'm fired +// Needs master? +class CGamePlayerZone: public CRuleBrushEntity { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +private: + string_t m_iszInTarget; + string_t m_iszOutTarget; + string_t m_iszInCount; + string_t m_iszOutCount; +}; + +// CGamePlayerHurt / game_player_hurt -- Damages the player who fires it +// Flag: Fire once +class CGamePlayerHurt: public CRulePointEntity { +public: + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + BOOL RemoveOnFire() const { return (pev->spawnflags & SF_PKILL_FIREONCE) == SF_PKILL_FIREONCE; } +}; + +// CGameCounter / game_counter -- Counts events and fires target +// Flag: Fire once +// Flag: Reset on Fire +class CGameCounter: public CRulePointEntity { +public: + virtual void Spawn() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +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; } + + 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; } + void SetInitialValue(int value) { pev->dmg = value; } +}; + +// CGameCounterSet / game_counter_set -- Sets the counter's value +// Flag: Fire once +class CGameCounterSet: public CRulePointEntity { +public: + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + BOOL RemoveOnFire() const { return (pev->spawnflags & SF_GAMECOUNTSET_FIREONCE) == SF_GAMECOUNTSET_FIREONCE; } +}; + +// CGamePlayerEquip / game_playerequip -- Sets the default player equipment +// Flag: USE Only +class CGamePlayerEquip: public CRulePointEntity { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Touch(CBaseEntity *pOther) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + BOOL UseOnly() const { return (pev->spawnflags & SF_PLAYEREQUIP_USEONLY) == SF_PLAYEREQUIP_USEONLY; } +public: + string_t m_weaponNames[ MAX_EQUIP ]; + int m_weaponCount[ MAX_EQUIP ]; +}; + +// CGamePlayerTeam / game_player_team -- Changes the team of the player who fired it +// Flag: Fire once +// Flag: Kill Player +// Flag: Gib Player +class CGamePlayerTeam: public CRulePointEntity { +public: + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +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; } +}; diff --git a/reapi/include/cssdk/dlls/monsterevent.h b/reapi/include/cssdk/dlls/monsterevent.h new file mode 100644 index 0000000..d3f3205 --- /dev/null +++ b/reapi/include/cssdk/dlls/monsterevent.h @@ -0,0 +1,44 @@ +/* +* +* 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. +* +*/ +#pragma once + +typedef struct MonsterEvent_s +{ + int event; + char *options; + +} MonsterEvent_t; + +#define EVENT_SPECIFIC 0 +#define EVENT_SCRIPTED 1000 +#define EVENT_SHARED 2000 +#define EVENT_CLIENT 5000 + +#define MONSTER_EVENT_BODYDROP_LIGHT 2001 +#define MONSTER_EVENT_BODYDROP_HEAVY 2002 +#define MONSTER_EVENT_SWISHSOUND 2010 diff --git a/reapi/include/cssdk/dlls/monsters.h b/reapi/include/cssdk/dlls/monsters.h new file mode 100644 index 0000000..842e058 --- /dev/null +++ b/reapi/include/cssdk/dlls/monsters.h @@ -0,0 +1,113 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define LOCALMOVE_INVALID 0 // move is not possible +#define LOCALMOVE_INVALID_DONT_TRIANGULATE 1 // move is not possible, don't try to triangulate +#define LOCALMOVE_VALID 2 // move is possible + +#define SF_MONSTER_WAIT_TILL_SEEN 1 // spawnflag that makes monsters wait until player can see them before attacking. +#define SF_MONSTER_GAG 2 // no idle noises from this monster +#define SF_MONSTER_HITMONSTERCLIP 4 +#define SF_MONSTER_PRISONER 16 // monster won't attack anyone, no one will attacke him. + +#define SF_MONSTER_WAIT_FOR_SCRIPT 128 //spawnflag that makes monsters wait to check for attacking until the script is done or they've been attacked +#define SF_MONSTER_PREDISASTER 256 //this is a predisaster scientist or barney. Influences how they speak. +#define SF_MONSTER_FADECORPSE 512 // Fade out corpse after death +#define SF_MONSTER_FALL_TO_GROUND 0x80000000 + +#define SF_MONSTER_TURRET_AUTOACTIVATE 32 +#define SF_MONSTER_TURRET_STARTINACTIVE 64 +#define SF_MONSTER_WAIT_UNTIL_PROVOKED 64 // don't attack the player unless provoked + +#define MOVE_START_TURN_DIST 64 // when this far away from moveGoal, start turning to face next goal +#define MOVE_STUCK_DIST 32 // if a monster can't step this far, it is stuck. + +#define MOVE_NORMAL 0 // normal move in the direction monster is facing +#define MOVE_STRAFE 1 // moves in direction specified, no matter which way monster is facing + +#define R_AL -2 // (ALLY) pals. Good alternative to R_NO when applicable. +#define R_FR -1 // (FEAR)will run +#define R_NO 0 // (NO RELATIONSHIP) disregard +#define R_DL 1 // (DISLIKE) will attack +#define R_HT 2 // (HATE)will attack this character instead of any visible DISLIKEd characters +#define R_NM 3 // (NEMESIS) A monster Will ALWAYS attack its nemsis, no matter what + +#define MEMORY_CLEAR 0 +#define bits_MEMORY_PROVOKED (1 << 0) // right now only used for houndeyes. +#define bits_MEMORY_INCOVER (1 << 1) // monster knows it is in a covered position. +#define bits_MEMORY_SUSPICIOUS (1 << 2) // Ally is suspicious of the player, and will move to provoked more easily +#define bits_MEMORY_PATH_FINISHED (1 << 3) // Finished monster path (just used by big momma for now) +#define bits_MEMORY_ON_PATH (1 << 4) // Moving on a path +#define bits_MEMORY_MOVE_FAILED (1 << 5) // Movement has already failed +#define bits_MEMORY_FLINCHED (1 << 6) // Has already flinched +#define bits_MEMORY_KILLED (1 << 7) // HACKHACK -- remember that I've already called my Killed() +#define bits_MEMORY_CUSTOM4 (1 << 28) // Monster-specific memory +#define bits_MEMORY_CUSTOM3 (1 << 29) // Monster-specific memory +#define bits_MEMORY_CUSTOM2 (1 << 30) // Monster-specific memory +#define bits_MEMORY_CUSTOM1 (1 << 31) // Monster-specific memory + +enum +{ + AITRIGGER_NONE = 0, + AITRIGGER_SEEPLAYER_ANGRY_AT_PLAYER, + AITRIGGER_TAKEDAMAGE, + AITRIGGER_HALFHEALTH, + AITRIGGER_DEATH, + AITRIGGER_SQUADMEMBERDIE, + AITRIGGER_SQUADLEADERDIE, + AITRIGGER_HEARWORLD, + AITRIGGER_HEARPLAYER, + AITRIGGER_HEARCOMBAT, + AITRIGGER_SEEPLAYER_UNCONDITIONAL, + AITRIGGER_SEEPLAYER_NOT_IN_COMBAT, +}; + +enum HitBoxGroup +{ + HITGROUP_GENERIC = 0, + HITGROUP_HEAD, + HITGROUP_CHEST, + HITGROUP_STOMACH, + HITGROUP_LEFTARM, + HITGROUP_RIGHTARM, + HITGROUP_LEFTLEG, + HITGROUP_RIGHTLEG, + HITGROUP_SHIELD, + NUM_HITGROUPS, +}; + +class CGib: public CBaseEntity { +public: + virtual int ObjectCaps() = 0; +public: + int m_bloodColor; + int m_cBloodDecals; + int m_material; + float m_lifeTime; +}; diff --git a/reapi/include/cssdk/dlls/mortar.h b/reapi/include/cssdk/dlls/mortar.h new file mode 100644 index 0000000..e74636c --- /dev/null +++ b/reapi/include/cssdk/dlls/mortar.h @@ -0,0 +1,55 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CFuncMortarField: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + + // Bmodels don't go across transitions + virtual int ObjectCaps() = 0; +public: + int m_iszXController; + int m_iszYController; + float m_flSpread; + float m_flDelay; + int m_iCount; + int m_fControl; +}; + +class CMortar: public CGrenade { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; +public: + int m_spriteTexture; +}; diff --git a/reapi/include/cssdk/dlls/observer.h b/reapi/include/cssdk/dlls/observer.h new file mode 100644 index 0000000..67585a5 --- /dev/null +++ b/reapi/include/cssdk/dlls/observer.h @@ -0,0 +1,32 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define CAMERA_MODE_SPEC_ANYONE 0 +#define CAMERA_MODE_SPEC_ONLY_TEAM 1 +#define CAMERA_MODE_SPEC_ONLY_FRIST_PERSON 2 diff --git a/reapi/include/cssdk/dlls/osconfig.h b/reapi/include/cssdk/dlls/osconfig.h new file mode 100644 index 0000000..bb71e7b --- /dev/null +++ b/reapi/include/cssdk/dlls/osconfig.h @@ -0,0 +1,196 @@ +/* +* +* 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. +* +*/ +#pragma once + +#ifdef _WIN32 // WINDOWS + #pragma warning(disable : 4005) +#endif // _WIN32 + +// disable must return a value +#pragma warning(disable : 4716) + +#ifndef _WIN32 + +// disable missing return statement at end of non-void function +#pragma warning(disable : 1011) + +// disable offsetof applied to non-POD (Plain Old Data) types is nonstandard +#pragma warning(disable : 1875) + +#endif // _WIN32 + +#include +#include +#include +#include +#include +#include +#include +//#include +#include + +#ifdef _WIN32 // WINDOWS + #include + //#include + //#include // for support IPX + #define PSAPI_VERSION 1 + #include + #include + #include + //#include + #include + #include +#else // _WIN32 + //#include + #include + //#include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + //#include + //#include + #include + + // Deail with stupid macro in kernel.h + #undef __FUNCTION__ +#endif // _WIN32 + +#include +//#include +//#include +#include + +#ifdef _WIN32 // WINDOWS +#ifndef _STDINT + typedef unsigned __int64 uint64_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int8 uint8_t; + + typedef __int64 int64_t; + typedef __int32 int32_t; + typedef __int16 int16_t; + typedef __int8 int8_t; + + typedef wchar_t uchar16; + typedef unsigned int uchar32; +#endif +#else // _WIN32 + typedef unsigned long long uint64_t; + typedef unsigned int uint32_t; + typedef unsigned short uint16_t; + typedef unsigned char uint8_t; + + #ifndef __int8_t_defined + typedef long long int64_t; + typedef int int32_t; + typedef short int16_t; + typedef char int8_t; + #endif + + typedef unsigned char byte; + typedef unsigned short uchar16; + typedef wchar_t uchar32; +#endif // _WIN32 + +#ifdef _WIN32 // WINDOWS + #define _CRT_SECURE_NO_WARNINGS + #define WIN32_LEAN_AND_MEAN + + #ifndef CDECL + #define CDECL __cdecl + #endif + + #define STDCALL __stdcall + #define HIDDEN + #define NOINLINE __declspec(noinline) + #define ALIGN16 __declspec(align(16)) + #define FORCE_STACK_ALIGN + + // Attributes to specify an "exported" function, visible from outside the + // DLL. + #undef DLLEXPORT + #define DLLEXPORT __declspec(dllexport) + // WINAPI should be provided in the windows compiler headers. + // It's usually defined to something like "__stdcall". + +#else // _WIN32 + #ifndef PAGESIZE + #define PAGESIZE 4096 + #endif + #define ALIGN(addr) (size_t)((size_t)addr & ~(PAGESIZE-1)) + #define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0])) + + #define _MAX_FNAME NAME_MAX + #define MAX_PATH 260 + + typedef void *HWND; + + typedef unsigned long DWORD; + typedef unsigned short WORD; + typedef unsigned int UNINT32; + + #define CDECL __attribute__ ((cdecl)) + #define STDCALL __attribute__ ((stdcall)) + #define HIDDEN __attribute__((visibility("hidden"))) + #define NOINLINE __attribute__((noinline)) + #define ALIGN16 __attribute__((aligned(16))) + #define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer)) + + #undef DLLEXPORT + #define DLLEXPORT __attribute__((visibility("default"))) + #define WINAPI /* */ + + #ifndef FALSE + #define FALSE 0 + #endif + #ifndef TRUE + #define TRUE 1 + #endif +#endif // _WIN32 + +// Simplified macro for declaring/defining exported DLL functions. They +// need to be 'extern "C"' so that the C++ compiler enforces parameter +// type-matching, rather than considering routines with mis-matched +// arguments/types to be overloaded functions... +// +// AFAIK, this is os-independent, but it's included here in osdep.h where +// DLLEXPORT is defined, for convenience. +#define C_DLLEXPORT extern "C" DLLEXPORT + +#define EXT_FUNC /*FORCE_STACK_ALIGN*/ diff --git a/reapi/include/cssdk/dlls/pathcorner.h b/reapi/include/cssdk/dlls/pathcorner.h new file mode 100644 index 0000000..5be28a3 --- /dev/null +++ b/reapi/include/cssdk/dlls/pathcorner.h @@ -0,0 +1,39 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CPathCorner: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual float GetDelay() = 0; +private: + float m_flWait; +}; diff --git a/reapi/include/cssdk/dlls/platform.h b/reapi/include/cssdk/dlls/platform.h new file mode 100644 index 0000000..fd9a304 --- /dev/null +++ b/reapi/include/cssdk/dlls/platform.h @@ -0,0 +1,651 @@ +//=========== (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. +// +// $Header: $ +// $NoKeywords: $ +// +// Extremely low-level platform-specific stuff +//============================================================================= + + +#ifndef PLATFORM_H +#define PLATFORM_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "osconfig.h" + +// need this for _alloca +#include + +// need this for memset +#include + +// for when we care about how many bits we use +typedef signed char int8; +typedef signed short int16; + +#ifdef _WIN32 +#ifdef _MSC_VER +typedef signed __int64 int64; +#endif +#elif defined __linux__ +typedef long long int64; +#endif + +typedef unsigned char uint8; +typedef unsigned short uint16; +#ifdef _WIN32 +#ifdef _MSC_VER +typedef unsigned __int64 uint64; +#endif +#elif defined __linux__ +typedef unsigned long long uint64; +#endif + + +typedef float float32; +typedef double float64; + +// for when we don't care about how many bits we use +typedef unsigned int uint; + +// This can be used to ensure the size of pointers to members when declaring +// a pointer type for a class that has only been forward declared +#ifdef _MSC_VER +#define SINGLE_INHERITANCE __single_inheritance +#define MULTIPLE_INHERITANCE __multiple_inheritance +#else +#define SINGLE_INHERITANCE +#define MULTIPLE_INHERITANCE +#endif + +/* +FIXME: Enable this when we no longer fear change =) + +// need these for the limits +#include +#include + +// Maximum and minimum representable values +#define INT8_MAX SCHAR_MAX +#define INT16_MAX SHRT_MAX +#define INT32_MAX LONG_MAX +#define INT64_MAX (((int64)~0) >> 1) + +#define INT8_MIN SCHAR_MIN +#define INT16_MIN SHRT_MIN +#define INT32_MIN LONG_MIN +#define INT64_MIN (((int64)1) << 63) + +#define UINT8_MAX ((uint8)~0) +#define UINT16_MAX ((uint16)~0) +#define UINT32_MAX ((uint32_t)~0) +#define UINT64_MAX ((uint64)~0) + +#define UINT8_MIN 0 +#define UINT16_MIN 0 +#define UINT32_MIN 0 +#define UINT64_MIN 0 + +#ifndef UINT_MIN +#define UINT_MIN UINT32_MIN +#endif + +#define FLOAT32_MAX FLT_MAX +#define FLOAT64_MAX DBL_MAX + +#define FLOAT32_MIN FLT_MIN +#define FLOAT64_MIN DBL_MIN +*/ + +// portability / compiler settings +#if defined(_WIN32) && !defined(WINDED) + +#if defined(_M_IX86) +#define __i386__ 1 +#endif + +#elif __linux__ +typedef void * HINSTANCE; +#define _MAX_PATH PATH_MAX +#endif // defined(_WIN32) && !defined(WINDED) + + +// Defines MAX_PATH +#ifndef MAX_PATH +#define MAX_PATH 260 +#endif + +// Used to step into the debugger +#define DebuggerBreak() __asm { int 3 } + +// C functions for external declarations that call the appropriate C++ methods +#ifndef EXPORT +#ifdef _WIN32 +#define EXPORT _declspec( dllexport ) +#else +#define EXPORT /* */ +#endif +#endif + +#if defined __i386__ && !defined __linux__ +#define id386 1 +#else +#define id386 0 +#endif // __i386__ + +#ifdef _WIN32 +// Used for dll exporting and importing +#define DLL_EXPORT extern "C" __declspec( dllexport ) +#define DLL_IMPORT extern "C" __declspec( dllimport ) + +// Can't use extern "C" when DLL exporting a class +#define DLL_CLASS_EXPORT __declspec( dllexport ) +#define DLL_CLASS_IMPORT __declspec( dllimport ) + +// Can't use extern "C" when DLL exporting a global +#define DLL_GLOBAL_EXPORT extern __declspec( dllexport ) +#define DLL_GLOBAL_IMPORT extern __declspec( dllimport ) +#elif defined __linux__ + +// Used for dll exporting and importing +#define DLL_EXPORT extern "C" +#define DLL_IMPORT extern "C" + +// Can't use extern "C" when DLL exporting a class +#define DLL_CLASS_EXPORT +#define DLL_CLASS_IMPORT + +// Can't use extern "C" when DLL exporting a global +#define DLL_GLOBAL_EXPORT extern +#define DLL_GLOBAL_IMPORT extern + +#else +#error "Unsupported Platform." +#endif + +// Used for standard calling conventions +#ifdef _WIN32 +#define FASTCALL __fastcall +#define FORCEINLINE __forceinline +#else +#define FASTCALL +#define FORCEINLINE inline +#endif + +// Force a function call site -not- to inlined. (useful for profiling) +#define DONT_INLINE(a) (((int)(a)+1)?(a):(a)) + +// Pass hints to the compiler to prevent it from generating unnessecary / stupid code +// in certain situations. Several compilers other than MSVC also have an equivilent +// construct. +// +// Essentially the 'Hint' is that the condition specified is assumed to be true at +// that point in the compilation. If '0' is passed, then the compiler assumes that +// any subsequent code in the same 'basic block' is unreachable, and thus usually +// removed. +#ifdef _MSC_VER +#define HINT(THE_HINT) __assume((THE_HINT)) +#else +#define HINT(THE_HINT) 0 +#endif + +// Marks the codepath from here until the next branch entry point as unreachable, +// and asserts if any attempt is made to execute it. +#define UNREACHABLE() { Assert(0); HINT(0); } + +// In cases where no default is present or appropriate, this causes MSVC to generate +// as little code as possible, and throw an assertion in debug. +#define NO_DEFAULT default: UNREACHABLE(); + +#ifdef _WIN32 +// Alloca defined for this platform +#define stackalloc( _size ) _alloca( _size ) +#define stackfree( _p ) 0 +#elif __linux__ +// Alloca defined for this platform +#define stackalloc( _size ) alloca( _size ) +#define stackfree( _p ) 0 +#endif + +#ifdef _WIN32 +// Remove warnings from warning level 4. +#pragma warning(disable : 4514) // warning C4514: 'acosl' : unreferenced inline function has been removed +#pragma warning(disable : 4100) // warning C4100: 'hwnd' : unreferenced formal parameter +#pragma warning(disable : 4127) // warning C4127: conditional expression is constant +#pragma warning(disable : 4512) // warning C4512: 'InFileRIFF' : assignment operator could not be generated +#pragma warning(disable : 4611) // warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable +#pragma warning(disable : 4706) // warning C4706: assignment within conditional expression +#pragma warning(disable : 4710) // warning C4710: function 'x' not inlined +#pragma warning(disable : 4702) // warning C4702: unreachable code +#pragma warning(disable : 4505) // unreferenced local function has been removed +#pragma warning(disable : 4239) // nonstandard extension used : 'argument' ( conversion from class Vector to class Vector& ) +#pragma warning(disable : 4097) // typedef-name 'BaseClass' used as synonym for class-name 'CFlexCycler::CBaseFlex' +#pragma warning(disable : 4324) // Padding was added at the end of a structure +#pragma warning(disable : 4244) // type conversion warning. +#pragma warning(disable : 4305) // truncation from 'const double ' to 'float ' +#pragma warning(disable : 4786) // Disable warnings about long symbol names + +#if _MSC_VER >= 1300 +#pragma warning(disable : 4511) // Disable warnings about private copy constructors +#endif +#endif +//----------------------------------------------------------------------------- +// Purpose: Standard functions for handling endian-ness +//----------------------------------------------------------------------------- + +//------------------------------------- +// Basic swaps +//------------------------------------- + +template +inline T WordSwapC(T w) +{ + uint16 temp; + + temp = ((*((uint16 *)&w) & 0xff00) >> 8); + temp |= ((*((uint16 *)&w) & 0x00ff) << 8); + + return *((T*)&temp); +} + +template +inline T DWordSwapC(T dw) +{ + uint32_t temp; + + temp = *((uint32_t *)&dw) >> 24; + temp |= ((*((uint32_t *)&dw) & 0x00FF0000) >> 8); + temp |= ((*((uint32_t *)&dw) & 0x0000FF00) << 8); + temp |= ((*((uint32_t *)&dw) & 0x000000FF) << 24); + + return *((T*)&temp); +} + +//------------------------------------- +// Fast swaps +//------------------------------------- + +#ifdef _MSC_VER + +#define WordSwap WordSwapAsm +#define DWordSwap DWordSwapAsm + +#pragma warning(push) +#pragma warning (disable:4035) // no return value + +template +inline T WordSwapAsm(T w) +{ + __asm + { + mov ax, w + xchg al, ah + } +} + +template +inline T DWordSwapAsm(T dw) +{ + __asm + { + mov eax, dw + bswap eax + } +} + +#pragma warning(pop) + +// The assembly implementation is not compatible with floats +template <> +inline float DWordSwapAsm(float f) +{ + return DWordSwapC(f); +} + +#else + +#define WordSwap WordSwapC +#define DWordSwap DWordSwapC + +#endif + +//------------------------------------- +// The typically used methods. +//------------------------------------- + +#if defined(__i386__) +#define VALVE_LITTLE_ENDIAN 1 +#endif + +#ifdef _SGI_SOURCE +#define VALVE_BIG_ENDIAN 1 +#endif + +#if defined(VALVE_LITTLE_ENDIAN) + +#define Valve_BigShort( val ) WordSwap( val ) +#define Valve_BigWord( val ) WordSwap( val ) +#define Valve_BigLong( val ) DWordSwap( val ) +#define Valve_BigDWord( val ) DWordSwap( val ) +#define Valve_BigFloat( val ) DWordSwap( val ) +#define Valve_LittleShort( val ) ( val ) +#define Valve_LittleWord( val ) ( val ) +#define Valve_LittleLong( val ) ( val ) +#define Valve_LittleDWord( val ) ( val ) +#define Valve_LittleFloat( val ) ( val ) + +#elif defined(BIG_ENDIAN) + +#define Valve_BigShort( val ) ( val ) +#define Valve_BigWord( val ) ( val ) +#define Valve_BigLong( val ) ( val ) +#define Valve_BigDWord( val ) ( val ) +#define Valve_BigFloat( val ) ( val ) +#define Valve_LittleShort( val ) WordSwap( val ) +#define Valve_LittleWord( val ) WordSwap( val ) +#define Valve_LittleLong( val ) DWordSwap( val ) +#define Valve_LittleDWord( val ) DWordSwap( val ) +#define Valve_LittleFloat( val ) DWordSwap( val ) + +#else + +// @Note (toml 05-02-02): this technique expects the compiler to +// optimize the expression and eliminate the other path. On any new +// platform/compiler this should be tested. +inline short BigShort(short val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; } +inline uint16 BigWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; } +inline long BigLong(long val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } +inline uint32_t BigDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } +inline float BigFloat(float val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } +inline short LittleShort(short val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); } +inline uint16 LittleWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); } +inline long LittleLong(long val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } +inline uint32_t LittleDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } +inline float LittleFloat(float val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } + +#endif + + + +#ifdef TIER0_DLL_EXPORT +#define PLATFORM_INTERFACE DLL_EXPORT +#define PLATFORM_OVERLOAD DLL_GLOBAL_EXPORT +#else +#define PLATFORM_INTERFACE DLL_IMPORT +#define PLATFORM_OVERLOAD DLL_GLOBAL_IMPORT +#endif + +/* +PLATFORM_INTERFACE double Plat_FloatTime(); // Returns time in seconds since the module was loaded. +PLATFORM_INTERFACE unsigned long Plat_MSTime(); // Time in milliseconds. + +// b/w compatibility +#define Sys_FloatTime Plat_FloatTime +*/ + +// Processor Information: +struct CPUInformation +{ + int m_Size; // Size of this structure, for forward compatability. + + bool m_bRDTSC : 1, // Is RDTSC supported? + m_bCMOV : 1, // Is CMOV supported? + m_bFCMOV : 1, // Is FCMOV supported? + m_bSSE : 1, // Is SSE supported? + m_bSSE2 : 1, // Is SSE2 Supported? + m_b3DNow : 1, // Is 3DNow! Supported? + m_bMMX : 1, // Is MMX supported? + m_bHT : 1; // Is HyperThreading supported? + + unsigned char m_nLogicalProcessors, // Number op logical processors. + m_nPhysicalProcessors; // Number of physical processors + + int64 m_Speed; // In cycles per second. + + char* m_szProcessorID; // Processor vendor Identification. +}; + +PLATFORM_INTERFACE const CPUInformation& GetCPUInformation(); + + +//----------------------------------------------------------------------------- +// Thread related functions +//----------------------------------------------------------------------------- +// Registers the current thread with Tier0's thread management system. +// This should be called on every thread created in the game. +PLATFORM_INTERFACE unsigned long Plat_RegisterThread(const char *pName = "Source Thread"); + +// Registers the current thread as the primary thread. +PLATFORM_INTERFACE unsigned long Plat_RegisterPrimaryThread(); + +// VC-specific. Sets the thread's name so it has a friendly name in the debugger. +// This should generally only be handled by Plat_RegisterThread and Plat_RegisterPrimaryThread +PLATFORM_INTERFACE void Plat_SetThreadName(unsigned long dwThreadID, const char *pName); + +// These would be private if it were possible to export private variables from a .DLL. +// They need to be variables because they are checked by inline functions at performance +// critical places. +PLATFORM_INTERFACE unsigned long Plat_PrimaryThreadID; + +// Returns the ID of the currently executing thread. +PLATFORM_INTERFACE unsigned long Plat_GetCurrentThreadID(); + +// Returns the ID of the primary thread. +inline unsigned long Plat_GetPrimaryThreadID() +{ + return Plat_PrimaryThreadID; +} + +// Returns true if the current thread is the primary thread. +inline bool Plat_IsPrimaryThread() +{ + //return true; + return (Plat_GetPrimaryThreadID() == Plat_GetCurrentThreadID()); +} + +//----------------------------------------------------------------------------- +// Security related functions +//----------------------------------------------------------------------------- +// Ensure that the hardware key's drivers have been installed. +PLATFORM_INTERFACE bool Plat_VerifyHardwareKeyDriver(); + +// Ok, so this isn't a very secure way to verify the hardware key for now. It +// is primarially depending on the fact that all the binaries have been wrapped +// with the secure wrapper provided by the hardware keys vendor. +PLATFORM_INTERFACE bool Plat_VerifyHardwareKey(); + +// The same as above, but notifies user with a message box when the key isn't in +// and gives him an opportunity to correct the situation. +PLATFORM_INTERFACE bool Plat_VerifyHardwareKeyPrompt(); + +// Can be called in real time, doesn't perform the verify every frame. Mainly just +// here to allow the game to drop out quickly when the key is removed, rather than +// allowing the wrapper to pop up it's own blocking dialog, which the engine doesn't +// like much. +PLATFORM_INTERFACE bool Plat_FastVerifyHardwareKey(); + + + +//----------------------------------------------------------------------------- +// Include additional dependant header components. +//----------------------------------------------------------------------------- +//#include "tier0/fasttimer.h" + + +//----------------------------------------------------------------------------- +// Just logs file and line to simple.log +//----------------------------------------------------------------------------- +void* Plat_SimpleLog(const char* file, int line); + +//#define Plat_dynamic_cast Plat_SimpleLog(__FILE__,__LINE__),dynamic_cast + +//----------------------------------------------------------------------------- +// Methods to invoke the constructor, copy constructor, and destructor +//----------------------------------------------------------------------------- + +template +inline void Construct(T* pMemory) +{ + new(pMemory)T; +} + +template +inline void CopyConstruct(T* pMemory, T const& src) +{ + new(pMemory)T(src); +} + +template +inline void Destruct(T* pMemory) +{ + pMemory->~T(); + +#ifdef _DEBUG + memset(pMemory, 0xDD, sizeof(T)); +#endif +} + + +// +// GET_OUTER() +// +// A platform-independent way for a contained class to get a pointer to its +// owner. If you know a class is exclusively used in the context of some +// "outer" class, this is a much more space efficient way to get at the outer +// class than having the inner class store a pointer to it. +// +// class COuter +// { +// class CInner // Note: this does not need to be a nested class to work +// { +// void PrintAddressOfOuter() +// { +// printf( "Outer is at 0x%x\n", GET_OUTER( COuter, m_Inner ) ); +// } +// }; +// +// CInner m_Inner; +// friend class CInner; +// }; + +#define GET_OUTER( OuterType, OuterMember ) \ + ( ( OuterType * ) ( (char *)this - offsetof( OuterType, OuterMember ) ) ) + + +/* TEMPLATE_FUNCTION_TABLE() + +(Note added to platform.h so platforms that correctly support templated +functions can handle portions as templated functions rather than wrapped +functions) + +Helps automate the process of creating an array of function +templates that are all specialized by a single integer. +This sort of thing is often useful in optimization work. + +For example, using TEMPLATE_FUNCTION_TABLE, this: + +TEMPLATE_FUNCTION_TABLE(int, Function, ( int blah, int blah ), 10) +{ +return argument * argument; +} + +is equivilent to the following: + +(NOTE: the function has to be wrapped in a class due to code +generation bugs involved with directly specializing a function +based on a constant.) + +template +class FunctionWrapper +{ +public: +int Function( int blah, int blah ) +{ +return argument*argument; +} +} + +typedef int (*FunctionType)( int blah, int blah ); + +class FunctionName +{ +public: +enum { count = 10 }; +FunctionType functions[10]; +}; + +FunctionType FunctionName::functions[] = +{ +FunctionWrapper<0>::Function, +FunctionWrapper<1>::Function, +FunctionWrapper<2>::Function, +FunctionWrapper<3>::Function, +FunctionWrapper<4>::Function, +FunctionWrapper<5>::Function, +FunctionWrapper<6>::Function, +FunctionWrapper<7>::Function, +FunctionWrapper<8>::Function, +FunctionWrapper<9>::Function +}; +*/ + +bool vtune(bool resume); + + +#define TEMPLATE_FUNCTION_TABLE(RETURN_TYPE, NAME, ARGS, COUNT) \ + \ +typedef RETURN_TYPE (FASTCALL *__Type_##NAME) ARGS; \ + \ +template \ +struct __Function_##NAME \ +{ \ + static RETURN_TYPE FASTCALL Run ARGS; \ +}; \ + \ +template \ +struct __MetaLooper_##NAME : __MetaLooper_##NAME \ +{ \ + __Type_##NAME func; \ + inline __MetaLooper_##NAME() { func = __Function_##NAME::Run; } \ +}; \ + \ +template<> \ +struct __MetaLooper_##NAME<0> \ +{ \ + __Type_##NAME func; \ + inline __MetaLooper_##NAME() { func = __Function_##NAME<0>::Run; } \ +}; \ + \ +class NAME \ +{ \ +private: \ + static const __MetaLooper_##NAME m; \ +public: \ + enum { count = COUNT }; \ + static const __Type_##NAME* functions; \ +}; \ +const __MetaLooper_##NAME NAME::m; \ +const __Type_##NAME* NAME::functions = (__Type_##NAME*)&m; \ +template \ +RETURN_TYPE FASTCALL __Function_##NAME::Run ARGS + + +#define LOOP_INTERCHANGE(BOOLEAN, CODE)\ + if( (BOOLEAN) )\ + {\ + CODE;\ + } else\ + {\ + CODE;\ + } + + +#endif /* PLATFORM_H */ \ No newline at end of file diff --git a/reapi/include/cssdk/dlls/plats.h b/reapi/include/cssdk/dlls/plats.h new file mode 100644 index 0000000..d9acf7c --- /dev/null +++ b/reapi/include/cssdk/dlls/plats.h @@ -0,0 +1,178 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SF_PLAT_TOGGLE 0x0001 + +#define TRAIN_STARTPITCH 60 +#define TRAIN_MAXPITCH 200 +#define TRAIN_MAXSPEED 1000 + +#define SF_TRACK_ACTIVATETRAIN 0x00000001 +#define SF_TRACK_RELINK 0x00000002 +#define SF_TRACK_ROTMOVE 0x00000004 +#define SF_TRACK_STARTBOTTOM 0x00000008 +#define SF_TRACK_DONT_MOVE 0x00000010 + +#define FGUNTARGET_START_ON 0x0001 + +class CBasePlatTrain: public CBaseToggle { +public: + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + + // This is done to fix spawn flag collisions between this class and a derived class + virtual BOOL IsTogglePlat() = 0; +public: + BYTE m_bMoveSnd; + BYTE m_bStopSnd; + float m_volume; +}; + +class CFuncPlat: public CBasePlatTrain { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; + virtual void GoUp() = 0; + virtual void GoDown() = 0; + virtual void HitTop() = 0; + virtual void HitBottom() = 0; +}; + +class CPlatTrigger: public CBaseEntity { +public: + virtual int ObjectCaps() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +public: + CFuncPlat *m_pPlatform; +}; + +class CFuncPlatRot: public CFuncPlat { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void GoUp() = 0; + virtual void GoDown() = 0; + virtual void HitTop() = 0; + virtual void HitBottom() = 0; +public: + Vector m_end; + Vector m_start; +}; + +class CFuncTrain: public CBasePlatTrain { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; + virtual void OverrideReset() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; +public: + Vector m_vStartPosition; + entvars_t *m_pevFirstTarget; + entvars_t *m_pevCurrentTarget; + int m_sounds; + BOOL m_activated; +}; + +class CFuncTrainControls: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; +}; + +class CFuncTrackChange: public CFuncPlatRot { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void OverrideReset() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual BOOL IsTogglePlat() = 0; + virtual void GoUp() = 0; + virtual void GoDown() = 0; + virtual void HitTop() = 0; + virtual void HitBottom() = 0; + virtual void UpdateAutoTargets(int toggleState) = 0; + +public: + void DisableUse() { m_use = 0; } + void EnableUse() { m_use = 1; } + + int UseEnabled() const { return m_use; } + +public: + static TYPEDESCRIPTION IMPL(m_SaveData)[9]; + + CPathTrack *m_trackTop; + CPathTrack *m_trackBottom; + CFuncTrackTrain *m_train; + + int m_trackTopName; + int m_trackBottomName; + int m_trainName; + + TRAIN_CODE m_code; + int m_targetState; + int m_use; +}; + +class CFuncTrackAuto: public CFuncTrackChange { +public: + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void UpdateAutoTargets(int toggleState) = 0; +}; + +class CGunTarget: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Activate() = 0; + virtual int Classify() = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int BloodColor() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual Vector BodyTarget(const Vector &posSrc) = 0; +private: + BOOL m_on; +}; diff --git a/reapi/include/cssdk/dlls/player.h b/reapi/include/cssdk/dlls/player.h new file mode 100644 index 0000000..dd19b9c --- /dev/null +++ b/reapi/include/cssdk/dlls/player.h @@ -0,0 +1,558 @@ +/* +* +* 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. +* +*/ +#pragma once + +//#include "weapons.h" + +#include "pm_materials.h" +#include "hintmessage.h" +#include "unisignals.h" + +#define MIN_BUY_TIME 15 // the minimum threshold values for cvar mp_buytime 15 sec's + +#define MAX_BUFFER_MENU 175 +#define MAX_BUFFER_MENU_BRIEFING 50 + +#define MAX_PLAYER_NAME_LENGTH 32 +#define MAX_AUTOBUY_LENGTH 256 +#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 + +#define PLAYER_FATAL_FALL_SPEED 1100.0f +#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 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) +#define PLAYER_MIN_BOUNCE_SPEED 350.0f + +// won't punch player's screen/make scrape noise unless player falling at least this fast. +#define PLAYER_FALL_PUNCH_THRESHHOLD 250.0f + +// Money blinks few of times on the freeze period +// NOTE: It works for CZ +#define MONEY_BLINK_AMOUNT 30 + +#define PFLAG_ONLADDER (1<<0) +#define PFLAG_ONSWING (1<<0) +#define PFLAG_ONTRAIN (1<<1) +#define PFLAG_ONBARNACLE (1<<2) +#define PFLAG_DUCKING (1<<3) +#define PFLAG_USING (1<<4) +#define PFLAG_OBSERVER (1<<5) + +#define TRAIN_OFF 0x00 +#define TRAIN_NEUTRAL 0x01 +#define TRAIN_SLOW 0x02 +#define TRAIN_MEDIUM 0x03 +#define TRAIN_FAST 0x04 +#define TRAIN_BACK 0x05 + +#define TRAIN_ACTIVE 0x80 +#define TRAIN_NEW 0xc0 + +#define SIGNAL_BUY (1<<0) +#define SIGNAL_BOMB (1<<1) +#define SIGNAL_RESCUE (1<<2) +#define SIGNAL_ESCAPE (1<<3) +#define SIGNAL_VIPSAFETY (1<<4) + +#define IGNOREMSG_NONE 0 +#define IGNOREMSG_ENEMY 1 +#define IGNOREMSG_TEAM 2 + +// max of 4 suit sentences queued up at any time +#define CSUITPLAYLIST 4 + +#define SUIT_GROUP TRUE +#define SUIT_SENTENCE FALSE + +#define SUIT_REPEAT_OK 0 +#define SUIT_NEXT_IN_30SEC 30 +#define SUIT_NEXT_IN_1MIN 60 +#define SUIT_NEXT_IN_5MIN 300 +#define SUIT_NEXT_IN_10MIN 600 +#define SUIT_NEXT_IN_30MIN 1800 +#define SUIT_NEXT_IN_1HOUR 3600 + +#define TEAM_NAME_LENGTH 16 + +#define MAX_ID_RANGE 2048.0f +#define MAX_SPECTATOR_ID_RANGE 8192.0f +#define SBAR_STRING_SIZE 128 + +#define SBAR_TARGETTYPE_TEAMMATE 1 +#define SBAR_TARGETTYPE_ENEMY 2 +#define SBAR_TARGETTYPE_HOSTAGE 3 + +#define CHAT_INTERVAL 1.0f +#define CSUITNOREPEAT 32 + +#define AUTOAIM_2DEGREES 0.0348994967025 +#define AUTOAIM_5DEGREES 0.08715574274766 +#define AUTOAIM_8DEGREES 0.1391731009601 +#define AUTOAIM_10DEGREES 0.1736481776669 + +#define SOUND_FLASHLIGHT_ON "items/flashlight1.wav" +#define SOUND_FLASHLIGHT_OFF "items/flashlight1.wav" + +typedef enum +{ + PLAYER_IDLE, + PLAYER_WALK, + PLAYER_JUMP, + PLAYER_SUPERJUMP, + PLAYER_DIE, + PLAYER_ATTACK1, + PLAYER_ATTACK2, + PLAYER_FLINCH, + PLAYER_LARGE_FLINCH, + PLAYER_RELOAD, + PLAYER_HOLDBOMB + +} PLAYER_ANIM; + +typedef enum +{ + Menu_OFF, + Menu_ChooseTeam, + Menu_IGChooseTeam, + Menu_ChooseAppearance, + Menu_Buy, + Menu_BuyPistol, + Menu_BuyRifle, + Menu_BuyMachineGun, + Menu_BuyShotgun, + Menu_BuySubMachineGun, + Menu_BuyItem, + Menu_Radio1, + Menu_Radio2, + Menu_Radio3, + Menu_ClientBuy + +} _Menu; + +typedef enum +{ + UNASSIGNED, + TERRORIST, + CT, + SPECTATOR, + +} TeamName; + +typedef enum +{ + MODEL_UNASSIGNED, + MODEL_URBAN, + MODEL_TERROR, + MODEL_LEET, + MODEL_ARCTIC, + MODEL_GSG9, + MODEL_GIGN, + MODEL_SAS, + MODEL_GUERILLA, + MODEL_VIP, + MODEL_MILITIA, + MODEL_SPETSNAZ + +} ModelName; + +typedef enum +{ + JOINED, + SHOWLTEXT, + READINGLTEXT, + SHOWTEAMSELECT, + PICKINGTEAM, + GETINTOGAME + +} JoinState; + +typedef enum +{ + CMD_SAY = 0, + CMD_SAYTEAM, + CMD_FULLUPDATE, + CMD_VOTE, + CMD_VOTEMAP, + CMD_LISTMAPS, + CMD_LISTPLAYERS, + CMD_NIGHTVISION, + COMMANDS_TO_TRACK, + +} TrackCommands; + +typedef struct +{ + int m_primaryWeapon; + int m_primaryAmmo; + int m_secondaryWeapon; + int m_secondaryAmmo; + int m_heGrenade; + int m_flashbang; + int m_smokeGrenade; + int m_defuser; + int m_nightVision; + int m_armor; + +} RebuyStruct; + +typedef enum +{ + THROW_NONE, + THROW_FORWARD, + THROW_BACKWARD, + THROW_HITVEL, + THROW_BOMB, + THROW_GRENADE, + THROW_HITVEL_MINUS_AIRVEL + +} ThrowDirection; + +enum sbar_data +{ + SBAR_ID_TARGETTYPE = 1, + SBAR_ID_TARGETNAME, + SBAR_ID_TARGETHEALTH, + SBAR_END +}; + +typedef enum +{ + SILENT, + CALM, + INTENSE + +} MusicState; + +class CStripWeapons: public CPointEntity { +public: + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class CInfoIntermission: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void Think() = 0; +}; + +class CDeadHEV: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Classify() = 0; +public: + int m_iPose; + static char *m_szPoses[4]; +}; + +class CSprayCan: public CBaseEntity { +public: + virtual void Think() = 0; + virtual int ObjectCaps() = 0; +}; + +class CBloodSplat: public CBaseEntity { +public: +}; + +class CBasePlayer: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int Classify() = 0; + virtual void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) = 0; + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int TakeHealth(float flHealth, int bitsDamageType) = 0; + virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; + virtual void AddPoints(int score, BOOL bAllowNegativeScore) = 0; + virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0; + virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0; + virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0; + virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0; + virtual void StartSneaking() = 0; + virtual void StopSneaking() = 0; + virtual BOOL IsSneaking() = 0; + virtual BOOL IsAlive() = 0; + virtual BOOL IsPlayer() = 0; + virtual BOOL IsNetClient() = 0; + virtual const char *TeamID() = 0; + virtual BOOL FBecomeProne() = 0; + virtual Vector BodyTarget(const Vector &posSrc) = 0; + virtual int Illumination() = 0; + virtual BOOL ShouldFadeOnDeath() = 0; + virtual void ResetMaxSpeed() = 0; + virtual void Jump() = 0; + virtual void Duck() = 0; + virtual void PreThink() = 0; + virtual void PostThink() = 0; + virtual Vector GetGunPosition() = 0; + virtual BOOL IsBot() = 0; + virtual void UpdateClientData() = 0; + virtual void ImpulseCommands() = 0; + virtual void RoundRespawn() = 0; + virtual Vector GetAutoaimVector(float flDelta) = 0; + virtual void Blind(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha) = 0; + virtual void OnTouchingWeapon(CWeaponBox *pWeapon) = 0; +public: + int IsObserver() { return pev->iuser1; } + void SetWeaponAnimType(const char *szExtention) { strcpy(m_szAnimExtention, szExtention); } + bool IsProtectedByShield() { return m_bOwnsShield && m_bShieldDrawn; } + bool IsReloading() + { + CBasePlayerWeapon *weapon = static_cast(m_pActiveItem); + + if (weapon != NULL && weapon->m_fInReload) + return true; + + return false; + } + bool IsBlind() const { return (m_blindUntilTime > gpGlobals->time); } + bool IsAutoFollowAllowed() const { return (gpGlobals->time > m_allowAutoFollowTime); } + void InhibitAutoFollow(float duration) { m_allowAutoFollowTime = gpGlobals->time + duration; } + void AllowAutoFollow() { m_allowAutoFollowTime = 0; } + void SetObserverAutoDirector(bool val) { m_bObserverAutoDirector = val; } + bool CanSwitchObserverModes() const { return m_canSwitchObserverModes; } +public: + enum { MaxLocationLen = 32 }; + + int random_seed; + unsigned short m_usPlayerBleed; + EHANDLE m_hObserverTarget; + float m_flNextObserverInput; + int m_iObserverWeapon; + int m_iObserverC4State; + bool m_bObserverHasDefuser; + int m_iObserverLastMode; + float m_flFlinchTime; + float m_flAnimTime; + bool m_bHighDamage; + float m_flVelocityModifier; + int m_iLastZoom; + bool m_bResumeZoom; + float m_flEjectBrass; + int m_iKevlar; + bool m_bNotKilled; + TeamName m_iTeam; + int m_iAccount; + bool m_bHasPrimary; + float m_flDeathThrowTime; + int m_iThrowDirection; + float m_flLastTalk; + bool m_bJustConnected; + bool m_bContextHelp; + JoinState m_iJoiningState; + CBaseEntity *m_pIntroCamera; + float m_fIntroCamTime; + float m_fLastMovement; + bool m_bMissionBriefing; + bool m_bTeamChanged; + ModelName m_iModelName; + int m_iTeamKills; + int m_iIgnoreGlobalChat; + bool m_bHasNightVision; + bool m_bNightVisionOn; + Vector m_vRecentPath[MAX_RECENT_PATH]; + float m_flIdleCheckTime; + float m_flRadioTime; + int m_iRadioMessages; + bool m_bIgnoreRadio; + bool m_bHasC4; + bool m_bHasDefuser; + bool m_bKilledByBomb; + Vector m_vBlastVector; + bool m_bKilledByGrenade; + CHintMessageQueue m_hintMessageQueue; + int m_flDisplayHistory; + _Menu m_iMenu; + int m_iChaseTarget; + CBaseEntity *m_pChaseTarget; + float m_fCamSwitch; + bool m_bEscaped; + bool m_bIsVIP; + float m_tmNextRadarUpdate; + Vector m_vLastOrigin; + int m_iCurrentKickVote; + float m_flNextVoteTime; + bool m_bJustKilledTeammate; + int m_iHostagesKilled; + int m_iMapVote; + bool m_bCanShoot; + float m_flLastFired; + float m_flLastAttackedTeammate; + bool m_bHeadshotKilled; + bool m_bPunishedForTK; + bool m_bReceivesNoMoneyNextRound; + int m_iTimeCheckAllowed; + bool m_bHasChangedName; + char m_szNewName[MAX_PLAYER_NAME_LENGTH]; + bool m_bIsDefusing; + float m_tmHandleSignals; + CUnifiedSignals m_signals; + edict_t *m_pentCurBombTarget; + int m_iPlayerSound; + int m_iTargetVolume; + int m_iWeaponVolume; + int m_iExtraSoundTypes; + int m_iWeaponFlash; + float m_flStopExtraSoundTime; + float m_flFlashLightTime; + int m_iFlashBattery; + int m_afButtonLast; + int m_afButtonPressed; + int m_afButtonReleased; + edict_t *m_pentSndLast; + float m_flSndRoomtype; + float m_flSndRange; + float m_flFallVelocity; + int m_rgItems[MAX_ITEMS]; + int m_fNewAmmo; + unsigned int m_afPhysicsFlags; + float m_fNextSuicideTime; + float m_flTimeStepSound; + float m_flTimeWeaponIdle; + float m_flSwimTime; + float m_flDuckTime; + float m_flWallJumpTime; + float m_flSuitUpdate; + int m_rgSuitPlayList[CSUITPLAYLIST]; + int m_iSuitPlayNext; + 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_chTextureType; + int m_idrowndmg; + int m_idrownrestored; + int m_bitsHUDDamage; + BOOL m_fInitHUD; + BOOL m_fGameHUDInitialized; + int m_iTrain; + BOOL m_fWeapon; + EHANDLE m_pTank; + float m_fDeadTime; + BOOL m_fNoPlayerSound; + BOOL m_fLongJump; + float m_tSneaking; + int m_iUpdateTime; + int m_iClientHealth; + int m_iClientBattery; + int m_iHideHUD; + int m_iClientHideHUD; + int m_iFOV; + int m_iClientFOV; + int m_iNumSpawns; + CBaseEntity *m_pObserver; + 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]; + 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]; + int m_lastx; + int m_lasty; + int m_nCustomSprayFrames; + float m_flNextDecalTime; + char m_szTeamName[TEAM_NAME_LENGTH]; + int m_modelIndexPlayer; + char m_szAnimExtention[32]; + int m_iGaitsequence; + float m_flGaitframe; + float m_flGaityaw; + Vector m_prevgaitorigin; + float m_flPitch; + float m_flYaw; + float m_flGaitMovement; + int m_iAutoWepSwitch; + bool m_bVGUIMenus; + bool m_bShowHints; + bool m_bShieldDrawn; + bool m_bOwnsShield; + bool m_bWasFollowing; + float m_flNextFollowTime; + float m_flYawModifier; + float m_blindUntilTime; + float m_blindStartTime; + float m_blindHoldTime; + float m_blindFadeTime; + int m_blindAlpha; + float m_allowAutoFollowTime; + char m_autoBuyString[MAX_AUTOBUY_LENGTH]; + char *m_rebuyString; + RebuyStruct m_rebuyStruct; + bool m_bIsInRebuy; + float m_flLastUpdateTime; + char m_lastLocation[MaxLocationLen]; + float m_progressStart; + float m_progressEnd; + bool m_bObserverAutoDirector; + bool m_canSwitchObserverModes; + float m_heartBeatTime; + float m_intenseTimestamp; + float m_silentTimestamp; + MusicState m_musicState; + float m_flLastCommandTime[COMMANDS_TO_TRACK]; +}; + +class CWShield: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +public: + void SetCantBePickedUpByUser(CBaseEntity *pEntity, float time) { m_hEntToIgnoreTouchesFrom = pEntity; m_flTimeToIgnoreTouches = gpGlobals->time + time; } +public: + EHANDLE m_hEntToIgnoreTouchesFrom; + float m_flTimeToIgnoreTouches; +}; diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h new file mode 100644 index 0000000..19ec58d --- /dev/null +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -0,0 +1,198 @@ +/* +* +* 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. +* +*/ +#pragma once +#include "archtypes.h" +#include "regamedll_interfaces.h" +#include "hookchains.h" +#include "interface.h" + +#define REGAMEDLL_API_VERSION_MAJOR 1 +#define REGAMEDLL_API_VERSION_MINOR 0 + +// CBasePlayer::Spawn hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_Spawn; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Spawn; + +// CBasePlayer::Precache hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_Precache; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Precache; + +// CBasePlayer::ObjectCaps hook +typedef IHookChain IReGameHook_CBasePlayer_ObjectCaps; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ObjectCaps; + +// CBasePlayer::Classify hook +typedef IHookChain IReGameHook_CBasePlayer_Classify; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Classify; + +// CBasePlayer::TraceAttack hook +typedef IVoidHookChain IReGameHook_CBasePlayer_TraceAttack; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TraceAttack; + +// CBasePlayer::TakeDamage hook +typedef IHookChain IReGameHook_CBasePlayer_TakeDamage; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TakeDamage; + +// CBasePlayer::TakeHealth hook +typedef IHookChain IReGameHook_CBasePlayer_TakeHealth; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TakeHealth; + +// CBasePlayer::Killed hook +typedef IVoidHookChain IReGameHook_CBasePlayer_Killed; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Killed; + +// CBasePlayer::AddPoints hook +typedef IVoidHookChain IReGameHook_CBasePlayer_AddPoints; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPoints; + +// CBasePlayer::AddPointsToTeam hook +typedef IVoidHookChain IReGameHook_CBasePlayer_AddPointsToTeam; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPointsToTeam; + +// CBasePlayer::AddPlayerItem hook +typedef IHookChain IReGameHook_CBasePlayer_AddPlayerItem; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPlayerItem; + +// CBasePlayer::RemovePlayerItem hook +typedef IHookChain IReGameHook_CBasePlayer_RemovePlayerItem; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemovePlayerItem; + +// CBasePlayer::GiveAmmo hook +typedef IHookChain IReGameHook_CBasePlayer_GiveAmmo; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveAmmo; + +// CBasePlayer::ResetMaxSpeed hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_ResetMaxSpeed; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ResetMaxSpeed; + +// CBasePlayer::Jump hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_Jump; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Jump; + +// CBasePlayer::Duck hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_Duck; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Duck; + +// CBasePlayer::PreThink hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_PreThink; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PreThink; + +// CBasePlayer::PostThink hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_PostThink; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PostThink; + +// CBasePlayer::UpdateClientData hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_UpdateClientData; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_UpdateClientData; + +// CBasePlayer::ImpulseCommands hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_ImpulseCommands; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ImpulseCommands; + +// CBasePlayer::RoundRespawn hook +typedef IVoidHookChain<> IReGameHook_CBasePlayer_RoundRespawn; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RoundRespawn; + +// CBasePlayer::Blind hook +typedef IVoidHookChain IReGameHook_CBasePlayer_Blind; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Blind; + + + + + + + + +// Observer_IsValidTarget hook +typedef IHookChain IReGameHook_CBasePlayer_Observer_IsValidTarget; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget; + +// GetForceCamera hook +typedef IHookChain IReGameHook_GetForceCamera; +typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; + +class IReGameHookchains { +public: + virtual ~IReGameHookchains() {} + // CBasePlayer virtual + virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn() = 0; + virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache() = 0; + virtual IReGameHookRegistry_CBasePlayer_ObjectCaps* CBasePlayer_ObjectCaps() = 0; + virtual IReGameHookRegistry_CBasePlayer_Classify* CBasePlayer_Classify() = 0; + virtual IReGameHookRegistry_CBasePlayer_TraceAttack* CBasePlayer_TraceAttack() = 0; + virtual IReGameHookRegistry_CBasePlayer_TakeDamage* CBasePlayer_TakeDamage() = 0; + virtual IReGameHookRegistry_CBasePlayer_TakeHealth* CBasePlayer_TakeHealth() = 0; + virtual IReGameHookRegistry_CBasePlayer_Killed* CBasePlayer_Killed() = 0; + virtual IReGameHookRegistry_CBasePlayer_AddPoints* CBasePlayer_AddPoints() = 0; + virtual IReGameHookRegistry_CBasePlayer_AddPointsToTeam* CBasePlayer_AddPointsToTeam() = 0; + virtual IReGameHookRegistry_CBasePlayer_AddPlayerItem* CBasePlayer_AddPlayerItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_RemovePlayerItem* CBasePlayer_RemovePlayerItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_GiveAmmo* CBasePlayer_GiveAmmo() = 0; + virtual IReGameHookRegistry_CBasePlayer_ResetMaxSpeed* CBasePlayer_ResetMaxSpeed() = 0; + virtual IReGameHookRegistry_CBasePlayer_Jump* CBasePlayer_Jump() = 0; + virtual IReGameHookRegistry_CBasePlayer_Duck* CBasePlayer_Duck() = 0; + virtual IReGameHookRegistry_CBasePlayer_PreThink* CBasePlayer_PreThink() = 0; + virtual IReGameHookRegistry_CBasePlayer_PostThink* CBasePlayer_PostThink() = 0; + virtual IReGameHookRegistry_CBasePlayer_UpdateClientData* CBasePlayer_UpdateClientData() = 0; + virtual IReGameHookRegistry_CBasePlayer_ImpulseCommands* CBasePlayer_ImpulseCommands() = 0; + virtual IReGameHookRegistry_CBasePlayer_RoundRespawn* CBasePlayer_RoundRespawn() = 0; + virtual IReGameHookRegistry_CBasePlayer_Blind* CBasePlayer_Blind() = 0; + + + + + + + virtual IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget* CBasePlayer_Observer_IsValidTarget() = 0; + virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0; + +}; + +struct ReGameFuncs_t { + class CBaseEntity *(*UTIL_PlayerByIndex)(int playerIndex); + class ICSPlayer *(*CBASE_TO_CSPLAYER)(class CBaseEntity *pEntity); + class ICSEntity *(*CBASE_TO_CSENTITY)(CBaseEntity *pEntity); + class ICSPlayer *(*INDEX_TO_CSPLAYER)(int iPlayerIndex); + class ICSEntity *(*INDEX_TO_CSENTITY)(int iEntityIndex); + struct edict_s *(*CREATE_NAMED_ENTITY2)(string_t iClass); +}; + +class IReGameApi { +public: + virtual ~IReGameApi() { } + + virtual int GetMajorVersion() = 0; + virtual int GetMinorVersion() = 0; + virtual const ReGameFuncs_t* GetFuncs() = 0; + virtual IReGameHookchains* GetHookchains() = 0; + virtual IReGameData* GetGameData() = 0; + +}; + +#define VRE_GAMEDLL_API_VERSION "VRE_GAMEDLL_API_VERSION001" diff --git a/reapi/include/cssdk/dlls/regamedll_const.h b/reapi/include/cssdk/dlls/regamedll_const.h new file mode 100644 index 0000000..36d038b --- /dev/null +++ b/reapi/include/cssdk/dlls/regamedll_const.h @@ -0,0 +1,104 @@ +/* +* +* 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. +* +*/ +#pragma once + +// These are caps bits to indicate what an object's capabilities (currently used for save/restore and level transitions) +#define FCAP_CUSTOMSAVE 0x00000001 +#define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions +#define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore +#define FCAP_DONT_SAVE 0x80000000 // Don't save this +#define FCAP_IMPULSE_USE 0x00000008 // can be used by the player +#define FCAP_CONTINUOUS_USE 0x00000010 // can be used by the player +#define FCAP_ONOFF_USE 0x00000020 // can be used by the player +#define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains) +#define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource) + +// UNDONE: This will ignore transition volumes (trigger_transition), but not the PVS!!! +#define FCAP_FORCE_TRANSITION 0x00000080 // ALWAYS goes across transitions + +// for Classify +#define CLASS_NONE 0 +#define CLASS_MACHINE 1 +#define CLASS_PLAYER 2 +#define CLASS_HUMAN_PASSIVE 3 +#define CLASS_HUMAN_MILITARY 4 +#define CLASS_ALIEN_MILITARY 5 +#define CLASS_ALIEN_PASSIVE 6 +#define CLASS_ALIEN_MONSTER 7 +#define CLASS_ALIEN_PREY 8 +#define CLASS_ALIEN_PREDATOR 9 +#define CLASS_INSECT 10 +#define CLASS_PLAYER_ALLY 11 +#define CLASS_PLAYER_BIOWEAPON 12 // hornets and snarks.launched by players +#define CLASS_ALIEN_BIOWEAPON 13 // hornets and snarks.launched by the alien menace +#define CLASS_VEHICLE 14 +#define CLASS_BARNACLE 99 // special because no one pays attention to it, and it eats a wide cross-section of creatures. + +#define SF_NORESPAWN (1 << 30) // set this bit on guns and stuff that should never respawn. + +#define DMG_GENERIC 0 // generic damage was done +#define DMG_CRUSH (1<<0) // crushed by falling or moving object +#define DMG_BULLET (1<<1) // shot +#define DMG_SLASH (1<<2) // cut, clawed, stabbed +#define DMG_BURN (1<<3) // heat burned +#define DMG_FREEZE (1<<4) // frozen +#define DMG_FALL (1<<5) // fell too far +#define DMG_BLAST (1<<6) // explosive blast damage +#define DMG_CLUB (1<<7) // crowbar, punch, headbutt +#define DMG_SHOCK (1<<8) // electric shock +#define DMG_SONIC (1<<9) // sound pulse shockwave +#define DMG_ENERGYBEAM (1<<10) // laser or other high energy beam +#define DMG_NEVERGIB (1<<12) // with this bit OR'd in, no damage type will be able to gib victims upon death +#define DMG_ALWAYSGIB (1<<13) // with this bit OR'd in, any damage type can be made to gib victims upon death +#define DMG_DROWN (1<<14) // Drowning + +// time-based damage +#define DMG_TIMEBASED (~(0x3FFF)) // mask for time-based damage + +#define DMG_PARALYZE (1<<15) // slows affected creature down +#define DMG_NERVEGAS (1<<16) // nerve toxins, very bad +#define DMG_POISON (1<<17) // blood poisioning +#define DMG_RADIATION (1<<18) // radiation exposure +#define DMG_DROWNRECOVER (1<<19) // drowning recovery +#define DMG_ACID (1<<20) // toxic chemicals or acid burns +#define DMG_SLOWBURN (1<<21) // in an oven +#define DMG_SLOWFREEZE (1<<22) // in a subzero freezer +#define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar) +#define DMG_EXPLOSION (1<<24) + +// these are the damage types that are allowed to gib corpses +#define DMG_GIB_CORPSE (DMG_CRUSH | DMG_FALL | DMG_BLAST | DMG_SONIC | DMG_CLUB) + +// these are the damage types that have client hud art +#define DMG_SHOWNHUD (DMG_POISON | DMG_ACID | DMG_FREEZE | DMG_SLOWFREEZE | DMG_DROWN | DMG_BURN | DMG_SLOWBURN | DMG_NERVEGAS | DMG_RADIATION | DMG_SHOCK) + +// when calling KILLED(), a value that governs gib behavior is expected to be +// one of these three values +#define GIB_NORMAL 0 // gib if entity was overkilled +#define GIB_NEVER 1 // never gib, no matter how much death damage is done ( freezing, etc ) +#define GIB_ALWAYS 2 // always gib ( Houndeye Shock, Barnacle Bite ) diff --git a/reapi/include/cssdk/dlls/regamedll_interfaces.h b/reapi/include/cssdk/dlls/regamedll_interfaces.h new file mode 100644 index 0000000..f3a5c08 --- /dev/null +++ b/reapi/include/cssdk/dlls/regamedll_interfaces.h @@ -0,0 +1,2071 @@ +/* +* +* 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. +* +*/ + +#pragma once + +class CSave; +class Vector; +class CRestore; + +class CCSEntity; +class CCSPlayer; +class CCSMonster; +class BotProfile; +class CCSWeaponBox; +class CCSPlayerItem; +class CCSPlayerWeapon; +class CCSquadMonster; + +class ICSMonster; +class ICSquadMonster; + +enum VisiblePartTypeBot:uint8 +{ + NONE = 0x00, + CHEST = 0x01, + HEAD = 0x02, + LEFT_SIDE = 0x04, + RIGHT_SIDE = 0x08, + FEET = 0x10 +}; + +class ICSEntity { +public: + virtual ~ICSEntity() = 0; + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Activate() = 0; + virtual void SetObjectCollisionBox() = 0; + virtual int Classify() = 0; + virtual void DeathNotice(struct entvars_s *pevChild) = 0; + virtual void TraceAttack(struct entvars_s *pevAttacker, float flDamage, Vector vecDir, struct TraceResult *ptr, int bitsDamageType) = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int TakeHealth(float flHealth, int bitsDamageType) = 0; + virtual void Killed(struct entvars_s *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; + virtual void TraceBleed(float flDamage, Vector vecDir, struct TraceResult *ptr, int bitsDamageType) = 0; + virtual bool IsTriggered(CCSEntity *pActivator) = 0; + virtual ICSMonster *MyMonsterPointer() = 0; + virtual ICSquadMonster *MySquadMonsterPointer() = 0; + virtual int GetToggleState() = 0; + virtual void AddPoints(int score, bool bAllowNegativeScore) = 0; + virtual void AddPointsToTeam(int score, bool bAllowNegativeScore) = 0; + virtual bool AddPlayerItem(CCSPlayerItem *pItem) = 0; + virtual bool RemovePlayerItem(CCSPlayerItem *pItem) = 0; + virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0; + virtual float GetDelay() = 0; + virtual int IsMoving() = 0; + virtual void OverrideReset() = 0; + virtual int DamageDecal(int bitsDamageType) = 0; + virtual void SetToggleState(int state) = 0; + virtual void StartSneaking() = 0; + virtual void StopSneaking() = 0; + virtual bool OnControls(struct entvars_s *onpev) = 0; + virtual bool IsSneaking() = 0; + virtual bool IsAlive() = 0; + virtual bool IsBSPModel() = 0; + virtual bool ReflectGauss() = 0; + virtual bool HasTarget(string_t targetname) = 0; + virtual bool IsInWorld() = 0; + virtual bool IsPlayer() = 0; + virtual bool IsNetClient() = 0; + virtual const char *TeamID() = 0; + virtual ICSEntity *GetNextTarget() = 0; + virtual void Think() = 0; + virtual void Touch(CCSEntity *pOther) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType = USE_OFF, float value = 0.0f) = 0; + virtual void Blocked(CCSEntity *pOther) = 0; + virtual ICSEntity *Respawn() = 0; + virtual void UpdateOwner() = 0; + virtual bool FBecomeProne() = 0; + virtual Vector Center() = 0; + virtual Vector EyePosition() = 0; + virtual Vector EarPosition() = 0; + virtual Vector BodyTarget(const Vector &posSrc) = 0; + virtual int Illumination() = 0; + virtual bool FVisible(CCSEntity *pEntity) = 0; + virtual bool FVisible(const Vector &vecOrigin) = 0; +public: + virtual struct entvars_s *GetEntVars() const = 0; + virtual class CBaseEntity *GetEntity() const = 0; +}; + +class ICSDelay: public virtual ICSEntity { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +}; + +class ICSAnimating: public virtual ICSDelay { +public: + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void HandleAnimEvent(struct MonsterEvent_s *pEvent) = 0; +}; + +class ICSPlayerItem: public virtual ICSAnimating { +public: + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void SetObjectCollisionBox() = 0; + virtual ICSEntity *Respawn() = 0; + virtual int AddToPlayer(CCSPlayer *pPlayer) = 0; + virtual int AddDuplicate(CCSPlayerItem *pItem) = 0; + virtual int GetItemInfo(struct ItemInfo *p) = 0; + virtual bool CanDeploy() = 0; + virtual bool CanDrop() = 0; + virtual bool Deploy() = 0; + virtual bool IsWeapon() = 0; + virtual bool CanHolster() = 0; + virtual void Holster(int skiplocal = 0) = 0; + virtual void UpdateItemInfo() = 0; + virtual void ItemPreFrame() = 0; + virtual void ItemPostFrame() = 0; + virtual void Drop() = 0; + virtual void Kill() = 0; + virtual void AttachToPlayer(CCSPlayer *pPlayer) = 0; + virtual int PrimaryAmmoIndex() = 0; + virtual int SecondaryAmmoIndex() = 0; + virtual int UpdateClientData(CCSPlayer *pPlayer) = 0; + virtual ICSPlayerItem *GetWeaponPtr() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; +}; + +class ICSPlayerWeapon: public virtual ICSPlayerItem { +public: + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int AddToPlayer(CCSPlayer *pPlayer) = 0; + virtual int AddDuplicate(CCSPlayerItem *pItem) = 0; + virtual bool CanDeploy() = 0; + virtual bool IsWeapon() = 0; + virtual void Holster(int skiplocal = 0) = 0; + virtual void UpdateItemInfo() = 0; + virtual void ItemPostFrame() = 0; + virtual int PrimaryAmmoIndex() = 0; + virtual int SecondaryAmmoIndex() = 0; + virtual int UpdateClientData(CCSPlayer *pPlayer) = 0; + virtual ICSPlayerItem *GetWeaponPtr() = 0; + virtual int ExtractAmmo(CCSPlayerWeapon *pWeapon) = 0; + virtual int ExtractClipAmmo(CCSPlayerWeapon *pWeapon) = 0; + virtual int AddWeapon() = 0; + virtual bool PlayEmptySound() = 0; + virtual void ResetEmptySound() = 0; + virtual void SendWeaponAnim(int iAnim, int skiplocal = 0) = 0; + virtual bool IsUseable() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual void RetireWeapon() = 0; + virtual bool ShouldWeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSToggle: public virtual ICSAnimating { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int GetToggleState() = 0; + virtual float GetDelay() = 0; +}; + +class ICSMonster: public virtual ICSToggle { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void TraceAttack(struct entvars_s *pevAttacker, float flDamage, Vector vecDir, struct TraceResult *ptr, int bitsDamageType) = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int TakeHealth(float flHealth, int bitsDamageType) = 0; + virtual void Killed(struct entvars_s *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; + virtual bool IsAlive() = 0; + virtual float ChangeYaw(int speed) = 0; + virtual bool HasHumanGibs() = 0; + virtual bool HasAlienGibs() = 0; + virtual void FadeMonster() = 0; + virtual void GibMonster() = 0; + virtual enum Activity_s GetDeathActivity() = 0; + virtual void BecomeDead() = 0; + virtual bool ShouldFadeOnDeath() = 0; + virtual int IRelationship(CCSEntity *pTarget) = 0; + virtual void PainSound() = 0; + virtual void ResetMaxSpeed() = 0; + virtual void ReportAIState() = 0; + virtual void MonsterInitDead() = 0; + virtual void Look(int iDistance) = 0; + virtual ICSEntity *BestVisibleEnemy() = 0; + virtual bool FInViewCone(CCSEntity *pEntity) = 0; + virtual bool FInViewCone(const Vector *pOrigin) = 0; +}; + +class ICSWeaponBox: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void SetObjectCollisionBox() = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSArmoury: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSPlayer: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int Classify() = 0; + virtual void TraceAttack(struct entvars_s *pevAttacker, float flDamage, Vector vecDir, struct TraceResult *ptr, int bitsDamageType) = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int TakeHealth(float flHealth, int bitsDamageType) = 0; + virtual void Killed(struct entvars_s *pevAttacker, int iGib) = 0; + virtual void AddPoints(int score, bool bAllowNegativeScore) = 0; + virtual void AddPointsToTeam(int score, bool bAllowNegativeScore) = 0; + virtual bool AddPlayerItem(CCSPlayerItem *pItem) = 0; + virtual bool RemovePlayerItem(CCSPlayerItem *pItem) = 0; + virtual int GiveAmmo(int iAmount, char *szName, int iMax) = 0; + virtual void StartSneaking() = 0; + virtual void StopSneaking() = 0; + virtual bool IsSneaking() = 0; + virtual bool IsAlive() = 0; + virtual bool IsPlayer() = 0; + virtual bool IsNetClient() = 0; + virtual const char *TeamID() = 0; + virtual bool FBecomeProne() = 0; + virtual Vector BodyTarget(const Vector &posSrc) = 0; + virtual int Illumination() = 0; + virtual bool ShouldFadeOnDeath() = 0; + virtual void ResetMaxSpeed() = 0; + virtual void Jump() = 0; + virtual void Duck() = 0; + virtual void PreThink() = 0; + virtual void PostThink() = 0; + virtual Vector GetGunPosition() = 0; + virtual bool IsBot() = 0; + virtual void UpdateClientData() = 0; + virtual void ImpulseCommands() = 0; + virtual void RoundRespawn() = 0; + virtual Vector GetAutoaimVector(float flDelta) = 0; + virtual void Blind(float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha) = 0; + virtual void OnTouchingWeapon(CCSWeaponBox *pWeapon) = 0; +public: + virtual bool IsConnected() const = 0; +}; + +class IAPI_Bot: public virtual ICSPlayer { +public: + virtual void Spawn() = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Killed(struct entvars_s *pevAttacker, int iGib) = 0; + virtual void Think() = 0; + virtual bool IsBot() = 0; + virtual Vector GetAutoaimVector(float flDelta) = 0; + virtual void OnTouchingWeapon(CCSWeaponBox *box) = 0; + virtual bool Initialize(const BotProfile *profile) = 0; + virtual void SpawnBot() = 0; + virtual void Upkeep() = 0; + virtual void Update() = 0; + virtual void Run() = 0; + virtual void Walk() = 0; + virtual void Crouch() = 0; + virtual void StandUp() = 0; + virtual void MoveForward() = 0; + virtual void MoveBackward() = 0; + virtual void StrafeLeft() = 0; + virtual void StrafeRight() = 0; + virtual bool Jump(bool mustJump = false) = 0; + virtual void ClearMovement() = 0; + virtual void UseEnvironment() = 0; + virtual void PrimaryAttack() = 0; + virtual void ClearPrimaryAttack() = 0; + virtual void TogglePrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void OnEvent(enum GameEventType event, CCSEntity *entity = NULL, CCSEntity *other = NULL) = 0; + virtual bool IsVisible(const Vector *pos, bool testFOV = false) const = 0; + virtual bool IsVisible(CCSPlayer *player, bool testFOV = false, unsigned char *visParts = NULL) const = 0; + virtual bool IsEnemyPartVisible(VisiblePartTypeBot part) const = 0; + virtual bool IsPlayerFacingMe(CCSPlayer *other) const = 0; + virtual bool IsPlayerLookingAtMe(CCSPlayer *other) const = 0; + virtual void ExecuteCommand() = 0; + virtual void SetModel(const char *modelName) = 0; +}; + +class IAPI_CSBot: public virtual IAPI_Bot { +public: + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Killed(struct entvars_s *pevAttacker, int iGib) = 0; + virtual void RoundRespawn() = 0; + virtual void Blind(float duration, float holdTime, float fadeTime, int alpha = 255) = 0; + virtual void OnTouchingWeapon(CCSWeaponBox *box) = 0; + virtual bool Initialize(const BotProfile *profile) = 0; + virtual void SpawnBot() = 0; + virtual void Upkeep() = 0; + virtual void Update() = 0; + virtual void Walk() = 0; + virtual bool Jump(bool mustJump = false) = 0; + virtual void OnEvent(enum GameEventType event, CCSEntity *entity = NULL, CCSEntity *other = NULL) = 0; + virtual bool IsVisible(const Vector *pos, bool testFOV = false) const = 0; + virtual bool IsVisible(CCSPlayer *player, bool testFOV = false, unsigned char *visParts = NULL) const = 0; + virtual bool IsEnemyPartVisible(VisiblePartTypeBot part) const = 0; +}; + +class ICSShield: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSDeadHEV: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Classify() = 0; +}; + +class ICSSprayCan: public virtual ICSEntity { +public: + virtual void Think() = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSBloodSplat: public virtual ICSEntity { +public: +}; + +class ICSWorld: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSDecal: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSCorpse: public virtual ICSEntity { +public: + virtual int ObjectCaps() = 0; +}; + +class ICSGrenade: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Killed(struct entvars_s *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void BounceSound() = 0; +}; + +class ICSAirtank: public virtual ICSGrenade { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Killed(struct entvars_s *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; +}; + +class ICSPlayerAmmo: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; + virtual ICSEntity *Respawn() = 0; +}; + +class ICS9MMAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICSBuckShotAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS556NatoAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS556NatoBoxAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS762NatoAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS45ACPAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS50AEAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS338MagnumAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS57MMAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICS357SIGAmmo: public virtual ICSPlayerAmmo { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool AddAmmo(CCSEntity *pOther) = 0; +}; + +class ICSFuncWall: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFuncWallToggle: public virtual ICSFuncWall { +public: + virtual void Spawn() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFuncConveyor: public virtual ICSFuncWall { +public: + virtual void Spawn() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFuncIllusionary: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSFuncMonsterClip: public virtual ICSFuncWall { +public: + virtual void Spawn() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFuncRotating: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Blocked(CCSEntity *pOther) = 0; +}; + +class ICSPendulum: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Touch(CCSEntity *pOther) = 0; + virtual void Blocked(CCSEntity *pOther) = 0; +}; + +class ICSPointEntity: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSStripWeapons: public virtual ICSPointEntity { +public: + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSInfoIntermission: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void Think() = 0; +}; + +class ICSRevertSaved: public virtual ICSPointEntity { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSEnvGlobal: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSMultiSource: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual bool IsTriggered(CCSEntity *pActivator) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSButton: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSRotButton: public virtual ICSButton { +public: + virtual void Spawn() = 0; +}; + +class ICSMomentaryRotButton: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSEnvSpark: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +}; + +class ICSButtonTarget: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSDoor: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void SetToggleState(int state) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CCSEntity *pOther) = 0; +}; + +class ICSRotDoor: public virtual ICSDoor { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual void SetToggleState(int state) = 0; +}; + +class ICSMomentaryDoor: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGib: public virtual ICSEntity { +public: + virtual int ObjectCaps() = 0; +}; + +class ICSBubbling: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSBeam: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int ObjectCaps() = 0; + virtual Vector Center() = 0; +}; + +class ICSLightning: public virtual ICSBeam { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; +}; + +class ICSLaser: public virtual ICSBeam { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGlow: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Think() = 0; +}; + +class ICSSprite: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSBombGlow: public virtual ICSSprite { +public: + virtual void Spawn() = 0; + virtual void Think() = 0; +}; + +class ICSGibShooter: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual ICSGib *CreateGib() = 0; +}; + +class ICSEnvShooter: public virtual ICSGibShooter { +public: + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual ICSGib *CreateGib() = 0; +}; + + +class ICSTestEffect: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSBlood: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSShake: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFade: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + + +class ICSMessage: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSEnvFunnel: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSEnvBeverage: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSItemSoda: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; +}; + +class ICSShower: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSEnvExplosion: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSBreakable: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void TraceAttack(struct entvars_s *pevAttacker, float flDamage, Vector vecDir, struct TraceResult *ptr, int bitsDamageType) = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int DamageDecal(int bitsDamageType) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSPushable: public virtual ICSBreakable { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Touch(CCSEntity *pOther) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFuncTank: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual bool OnControls(struct entvars_s *pevTest) = 0; + virtual void Think() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, struct entvars_s *pevAttacker) = 0; + virtual Vector UpdateTargetPosition(CCSEntity *pTarget) = 0; +}; + +class ICSFuncTankGun: public virtual ICSFuncTank { +public: + virtual void Fire(const Vector &barrelEnd, const Vector &forward, struct entvars_s *pevAttacker) = 0; +}; + +class ICSFuncTankLaser: public virtual ICSFuncTank { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; + virtual void Think() = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, struct entvars_s *pevAttacker) = 0; +}; + +class ICSFuncTankRocket: public virtual ICSFuncTank { +public: + virtual void Precache() = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, struct entvars_s *pevAttacker) = 0; +}; + +class ICSFuncTankMortar: public virtual ICSFuncTank { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Fire(const Vector &barrelEnd, const Vector &forward, struct entvars_s *pevAttacker) = 0; +}; + +class ICSFuncTankControls: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSRecharge: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSCycler: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual bool IsAlive() = 0; + virtual void Think() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGenericCycler: public virtual ICSCycler { +public: + virtual void Spawn() = 0; +}; + +class ICSCyclerProbe: public virtual ICSCycler { +public: + virtual void Spawn() = 0; +}; + +class ICSCyclerSprite: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual void Think() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSWeaponCycler: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual int GetItemInfo(struct ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual void Holster(int skiplocal = 0) = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; +}; + +class ICSWreckage: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Think() = 0; +}; + +class ICSWorldItem: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSItem: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual ICSEntity *Respawn() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSHealthKit: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSWallHealth: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSItemSuit: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSItemBattery: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSItemAntidote: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSItemSecurity: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSItemLongJump: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSItemKevlar: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSItemAssaultSuit: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSItemThighPack: public virtual ICSItem { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual bool MyTouch(CCSPlayer *pPlayer) = 0; +}; + +class ICSGrenCatch: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSFuncWeaponCheck: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSHostage: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int ObjectCaps() = 0; + virtual int Classify() = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int BloodColor() = 0; + virtual void Touch(CCSEntity *pOther) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSLight: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSEnvLight: public virtual ICSLight { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSRuleEntity: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +}; + +class ICSRulePointEntity: public virtual ICSRuleEntity { +public: + virtual void Spawn() = 0; +}; + +class ICSRuleBrushEntity: public virtual ICSRuleEntity { +public: + virtual void Spawn() = 0; +}; + +class ICSGameScore: public virtual ICSRulePointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGameEnd: public virtual ICSRulePointEntity { +public: + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGameText: public virtual ICSRulePointEntity { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGameTeamMaster: public virtual ICSRulePointEntity { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int ObjectCaps() = 0; + virtual bool IsTriggered(CCSEntity *pActivator) = 0; + virtual const char *TeamID() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGameTeamSet: public virtual ICSRulePointEntity { +public: + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGamePlayerZone: public virtual ICSRuleBrushEntity { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGamePlayerHurt: public virtual ICSRulePointEntity { +public: + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGameCounter: public virtual ICSRulePointEntity { +public: + virtual void Spawn() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGameCounterSet: public virtual ICSRulePointEntity { +public: + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGamePlayerEquip: public virtual ICSRulePointEntity { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Touch(CCSEntity *pOther) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSGamePlayerTeam: public virtual ICSRulePointEntity { +public: + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFuncMortarField: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSMortar: public virtual ICSGrenade { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; +}; + +class ICSMapInfo: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSPathCorner: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual float GetDelay() = 0; +}; + +class ICSPathTrack: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSFuncTrackTrain: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void OverrideReset() = 0; + virtual bool OnControls(struct entvars_s *pev) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CCSEntity *pOther) = 0; +}; + +class ICSFuncVehicleControls: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSFuncVehicle: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int Classify() = 0; + virtual void OverrideReset() = 0; + virtual bool OnControls(struct entvars_s *pev) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CCSEntity *pOther) = 0; +}; + +class ICSPlatTrain: public virtual ICSToggle { +public: + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual bool IsTogglePlat() = 0; +}; + +class ICSFuncPlat: public virtual ICSPlatTrain { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Blocked(CCSEntity *pOther) = 0; + virtual void GoUp() = 0; + virtual void GoDown() = 0; + virtual void HitTop() = 0; + virtual void HitBottom() = 0; +}; + +class ICSPlatTrigger: public virtual ICSEntity { +public: + virtual int ObjectCaps() = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSFuncPlatRot: public virtual ICSFuncPlat { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void GoUp() = 0; + virtual void GoDown() = 0; + virtual void HitTop() = 0; + virtual void HitBottom() = 0; +}; + +class ICSFuncTrain: public virtual ICSPlatTrain { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; + virtual void OverrideReset() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CCSEntity *pOther) = 0; +}; + +class ICSFuncTrainControls: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSFuncTrackChange: public virtual ICSFuncPlatRot { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void OverrideReset() = 0; + virtual void Touch(CCSEntity *pOther) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual bool IsTogglePlat() = 0; + virtual void GoUp() = 0; + virtual void GoDown() = 0; + virtual void HitTop() = 0; + virtual void HitBottom() = 0; + virtual void UpdateAutoTargets(int toggleState) = 0; +}; + +class ICSFuncTrackAuto: public virtual ICSFuncTrackChange { +public: + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void UpdateAutoTargets(int toggleState) = 0; +}; + +class ICSGunTarget: public virtual ICSMonster { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Activate() = 0; + virtual int Classify() = 0; + virtual int TakeDamage(struct entvars_s *pevInflictor, struct entvars_s *pevAttacker, float flDamage, int bitsDamageType) = 0; + virtual int BloodColor() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual Vector BodyTarget(const Vector &posSrc) = 0; +}; + +class ICSAmbientGeneric: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSEnvSound: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Think() = 0; +}; + +class ICSSpeaker: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSSoundEnt: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; +}; + +class ICSUSP: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSMP5N: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSSG552: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSAK47: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSAUG: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSAWP: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSC4: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSDEAGLE: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; + virtual bool IsPistol() = 0; +}; + +class ICSFlashbang: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool CanDeploy() = 0; + virtual bool CanDrop() = 0; + virtual bool Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; + virtual bool IsPistol() = 0; +}; + +class ICSG3SG1: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSGLOCK18: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSHEGrenade: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool CanDeploy() = 0; + virtual bool CanDrop() = 0; + virtual bool Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSKnife: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool CanDrop() = 0; + virtual bool Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSM249: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSM3: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSM4A1: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSMAC10: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSP228: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; + virtual bool IsPistol() = 0; +}; + +class ICSP90: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSSCOUT: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSSmokeGrenade: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool CanDeploy() = 0; + virtual bool CanDrop() = 0; + virtual bool Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSTMP: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSXM1014: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSELITE: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSFiveSeven: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSUMP45: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSSG550: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSGalil: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSFamas: public virtual ICSPlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual bool Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual bool UseDecrement() = 0; +}; + +class ICSNullEntity: public virtual ICSEntity { +public: + virtual void Spawn() = 0; +}; + +class ICSDMStart: public virtual ICSPointEntity { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual bool IsTriggered(CCSEntity *pEntity) = 0; +}; + +class ICSFrictionModifier: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSAutoTrigger: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; +}; + +class ICSTriggerRelay: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSMultiManager: public virtual ICSToggle { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual bool HasTarget(string_t targetname) = 0; +}; + +class ICSRenderFxManager: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSTrigger: public virtual ICSToggle { +public: + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int ObjectCaps() = 0; +}; + +class ICSTriggerHurt: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSTriggerMonsterJump: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; + virtual void Think() = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSTriggerCDAudio: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; + virtual void Touch(CCSEntity *pOther) = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSTargetCDAudio: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Think() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSTriggerMultiple: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSTriggerOnce: public virtual ICSTriggerMultiple { +public: + virtual void Spawn() = 0; +}; + +class ICSTriggerCounter: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSTriggerVolume: public virtual ICSPointEntity { +public: + virtual void Spawn() = 0; +}; + +class ICSFireAndDie: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; +}; + +class ICSChangeLevel: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +}; + +class ICSLadder: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSTriggerPush: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual void Touch(CCSEntity *pOther) = 0; +}; + +class ICSTriggerTeleport: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSBuyZone: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSBombTarget: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSHostageRescue: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSEscapeZone: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSVIP_SafetyZone: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSTriggerSave: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSTriggerEndSection: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class ICSTriggerGravity: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSTriggerChangeTarget: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSTriggerCamera: public virtual ICSDelay { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CCSEntity *pActivator, CCSEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class ICSWeather: public virtual ICSTrigger { +public: + virtual void Spawn() = 0; +}; + +class ICSClientFog: public virtual ICSEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(struct KeyValueData_s *pkvd) = 0; +}; + +class IReGameData { +public: + virtual ~IReGameData() {} + + virtual class CGameRules** GetGameRules() = 0; +}; diff --git a/reapi/include/cssdk/dlls/revert_saved.h b/reapi/include/cssdk/dlls/revert_saved.h new file mode 100644 index 0000000..f8bb4ee --- /dev/null +++ b/reapi/include/cssdk/dlls/revert_saved.h @@ -0,0 +1,49 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CRevertSaved: public CPointEntity { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +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; } + + 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: + float m_messageTime; + float m_loadTime; +}; diff --git a/reapi/include/cssdk/dlls/skill.h b/reapi/include/cssdk/dlls/skill.h new file mode 100644 index 0000000..95e2084 --- /dev/null +++ b/reapi/include/cssdk/dlls/skill.h @@ -0,0 +1,53 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define SKILL_EASY 1 +#define SKILL_MEDIUM 2 +#define SKILL_HARD 3 + +struct skilldata_t +{ + int iSkillLevel; + float plrDmg9MM; + float plrDmg357; + float plrDmgMP5; + float plrDmgM203Grenade; + float plrDmgBuckshot; + float plrDmgCrossbowClient; + float plrDmgRPG; + float monDmg9MM; + float monDmgMP5; + float monDmg12MM; + float suitchargerCapacity; + float batteryCapacity; + float healthchargerCapacity; + float healthkitCapacity; +}; + +extern skilldata_t gSkillData; diff --git a/reapi/include/cssdk/dlls/sound.h b/reapi/include/cssdk/dlls/sound.h new file mode 100644 index 0000000..c4e636c --- /dev/null +++ b/reapi/include/cssdk/dlls/sound.h @@ -0,0 +1,141 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define CSENTENCEG_MAX 200 // max number of sentence groups +#define CSENTENCE_LRU_MAX 32 // max number of elements per sentence group +#define CDPVPRESETMAX 27 + +// spawnflags +#define AMBIENT_SOUND_STATIC 0 // medium radius attenuation +#define AMBIENT_SOUND_EVERYWHERE 1 +#define AMBIENT_SOUND_SMALLRADIUS 2 +#define AMBIENT_SOUND_MEDIUMRADIUS 4 +#define AMBIENT_SOUND_LARGERADIUS 8 +#define AMBIENT_SOUND_START_SILENT 16 +#define AMBIENT_SOUND_NOT_LOOPING 32 + +#define ANNOUNCE_MINUTES_MIN 0.25 +#define ANNOUNCE_MINUTES_MAX 2.25 + +#define SPEAKER_START_SILENT 1 // wait for trigger 'on' to start announcements + +#define LFO_SQUARE 1 // square +#define LFO_TRIANGLE 2 // triangle +#define LFO_RANDOM 3 // random + +// group of related sentences +struct sentenceg +{ + char szgroupname[16]; + int count; + unsigned char rgblru[ CSENTENCE_LRU_MAX ]; +}; + +// runtime pitch shift and volume fadein/out structure + +// NOTE: IF YOU CHANGE THIS STRUCT YOU MUST CHANGE THE SAVE/RESTORE VERSION NUMBER +// SEE BELOW (in the typedescription for the class) +typedef struct dynpitchvol +{ + // NOTE: do not change the order of these parameters + // NOTE: unless you also change order of rgdpvpreset array elements! + int preset; + + int pitchrun; // pitch shift % when sound is running 0 - 255 + int pitchstart; // pitch shift % when sound stops or starts 0 - 255 + int spinup; // spinup time 0 - 100 + int spindown; // spindown time 0 - 100 + + int volrun; // volume change % when sound is running 0 - 10 + int volstart; // volume change % when sound stops or starts 0 - 10 + int fadein; // volume fade in time 0 - 100 + int fadeout; // volume fade out time 0 - 100 + + // Low Frequency Oscillator + int lfotype; // 0) off 1) square 2) triangle 3) random + int lforate; // 0 - 1000, how fast lfo osciallates + + int lfomodpitch; // 0-100 mod of current pitch. 0 is off. + int lfomodvol; // 0-100 mod of current volume. 0 is off. + + int cspinup; // each trigger hit increments counter and spinup pitch + + int cspincount; + int pitch; + int spinupsav; + int spindownsav; + int pitchfrac; + int vol; + int fadeinsav; + int fadeoutsav; + int volfrac; + int lfofrac; + int lfomult; + +} dynpitchvol_t; + +class CAmbientGeneric: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +public: + float m_flAttenuation; // attenuation value + dynpitchvol_t m_dpv; + BOOL m_fActive; // only TRUE when the entity is playing a looping sound + BOOL m_fLooping; // TRUE when the sound played will loop +}; + +class CEnvSound: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Think() = 0; +public: + float m_flRadius; + float m_flRoomtype; +}; + +class CSpeaker: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +public: + int m_preset; // preset number +}; diff --git a/reapi/include/cssdk/dlls/spectator.h b/reapi/include/cssdk/dlls/spectator.h new file mode 100644 index 0000000..d42e05a --- /dev/null +++ b/reapi/include/cssdk/dlls/spectator.h @@ -0,0 +1,33 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CBaseSpectator: public CBaseEntity { +public: + virtual void Spawn(); +}; diff --git a/reapi/include/cssdk/dlls/subs.h b/reapi/include/cssdk/dlls/subs.h new file mode 100644 index 0000000..8cae347 --- /dev/null +++ b/reapi/include/cssdk/dlls/subs.h @@ -0,0 +1,40 @@ +/* +* +* 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. +* +*/ + +#pragma once + +class CNullEntity: public CBaseEntity { +public: + virtual void Spawn() = 0; +}; + +class CBaseDMStart: public CPointEntity { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual BOOL IsTriggered(CBaseEntity *pEntity) = 0; +}; diff --git a/reapi/include/cssdk/dlls/training_gamerules.h b/reapi/include/cssdk/dlls/training_gamerules.h new file mode 100644 index 0000000..df5cbac --- /dev/null +++ b/reapi/include/cssdk/dlls/training_gamerules.h @@ -0,0 +1,82 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CHalfLifeTraining: public CHalfLifeMultiplay { +public: + virtual BOOL IsMultiplayer() = 0; + virtual BOOL IsDeathmatch() = 0; + virtual void InitHUD(CBasePlayer *pl) = 0; + virtual void PlayerSpawn(CBasePlayer *pPlayer) = 0; + virtual void PlayerThink(CBasePlayer *pPlayer) = 0; + virtual BOOL FPlayerCanRespawn(CBasePlayer *pPlayer) = 0; + virtual edict_t *GetPlayerSpawnSpot(CBasePlayer *pPlayer) = 0; + virtual void PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) = 0; + virtual int ItemShouldRespawn(CItem *pItem) = 0; + virtual void CheckMapConditions() = 0; + virtual void CheckWinConditions() = 0; +public: + float FillAccountTime; + float ServerRestartTime; + BOOL fInBuyArea; + BOOL fVisitedBuyArea; + bool fVGUIMenus; +}; + +class CBaseGrenCatch: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +public: + int m_NeedGrenadeType; + string_t sTriggerOnGrenade; + string_t sDisableOnGrenade; + bool m_fSmokeTouching; + bool m_fFlashTouched; +}; + +class CFuncWeaponCheck: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +private: + string_t sTriggerWithItems; + string_t sTriggerNoItems; + string_t sMaster; + unsigned int sItemName[32]; + int iItemCount; + int iAnyWeapon; +}; diff --git a/reapi/include/cssdk/dlls/trains.h b/reapi/include/cssdk/dlls/trains.h new file mode 100644 index 0000000..10927b6 --- /dev/null +++ b/reapi/include/cssdk/dlls/trains.h @@ -0,0 +1,149 @@ +/* +* +* 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. +* +*/ +#pragma once + +// Tracktrain spawn flags +#define SF_TRACKTRAIN_NOPITCH 0x0001 +#define SF_TRACKTRAIN_NOCONTROL 0x0002 +#define SF_TRACKTRAIN_FORWARDONLY 0x0004 +#define SF_TRACKTRAIN_PASSABLE 0x0008 + +// Spawnflag for CPathTrack +#define SF_PATH_DISABLED 0x00000001 +#define SF_PATH_FIREONCE 0x00000002 +#define SF_PATH_ALTREVERSE 0x00000004 +#define SF_PATH_DISABLE_TRAIN 0x00000008 +#define SF_PATH_ALTERNATE 0x00008000 + +// Spawnflags of CPathCorner +#define SF_CORNER_WAITFORTRIG 0x001 +#define SF_CORNER_TELEPORT 0x002 +#define SF_CORNER_FIREONCE 0x004 + +class CPathTrack: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData* pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void Activate() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + float m_length; + string_t m_altName; + CPathTrack *m_pnext; + CPathTrack *m_pprevious; + CPathTrack *m_paltpath; +}; + +class CFuncTrackTrain: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData* pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void OverrideReset() = 0; + virtual BOOL OnControls(entvars_t *pev) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; +public: + CPathTrack *m_ppath; + float m_length; + float m_height; + float m_speed; + float m_dir; + float m_startSpeed; + Vector m_controlMins; + Vector m_controlMaxs; + int m_soundPlaying; + int m_sounds; + float m_flVolume; + float m_flBank; + float m_oldSpeed; + float m_fTurnAngle; + float m_flSteeringWheelDecay; + float m_flAcceleratorDecay; + +private: + unsigned short m_usAdjustPitch; +}; + +class CFuncVehicle: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual int Classify() = 0; + virtual void OverrideReset() = 0; + virtual BOOL OnControls(entvars_t *pev) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void Blocked(CBaseEntity *pOther) = 0; +public: + CPathTrack *m_ppath; + float m_length; + float m_width; + float m_height; + float m_speed; + float m_dir; + float m_startSpeed; + Vector m_controlMins; + Vector m_controlMaxs; + int m_soundPlaying; + int m_sounds; + int m_acceleration; + float m_flVolume; + float m_flBank; + float m_oldSpeed; + int m_iTurnAngle; + float m_flSteeringWheelDecay; + float m_flAcceleratorDecay; + float m_flTurnStartTime; + float m_flLaunchTime; + float m_flLastNormalZ; + float m_flCanTurnNow; + float m_flUpdateSound; + Vector m_vFrontLeft; + Vector m_vFront; + Vector m_vFrontRight; + Vector m_vBackLeft; + Vector m_vBack; + Vector m_vBackRight; + Vector m_vSurfaceNormal; + Vector m_vVehicleDirection; + CBaseEntity *m_pDriver; + +private: + unsigned short m_usAdjustPitch; +}; diff --git a/reapi/include/cssdk/dlls/triggers.h b/reapi/include/cssdk/dlls/triggers.h new file mode 100644 index 0000000..3e87253 --- /dev/null +++ b/reapi/include/cssdk/dlls/triggers.h @@ -0,0 +1,358 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define GRENADETYPE_SMOKE 1 +#define GRENADETYPE_FLASH 2 + +#define MAX_ITEM_COUNTS 32 +#define MAX_ENTITY 512 // We can only ever move 512 entities across a transition + +// triggers +#define SF_TRIGGER_ALLOWMONSTERS 1 // monsters allowed to fire this trigger +#define SF_TRIGGER_NOCLIENTS 2 // players not allowed to fire this trigger +#define SF_TRIGGER_PUSHABLES 4 // only pushables can fire this trigger + +#define SF_TRIGGER_PUSH_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF +#define SF_TRIGGER_HURT_TARGETONCE 1 // Only fire hurt target once +#define SF_TRIGGER_HURT_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF +#define SF_TRIGGER_HURT_NO_CLIENTS 8 // spawnflag that makes trigger_push spawn turned OFF +#define SF_TRIGGER_HURT_CLIENTONLYFIRE 16 // trigger hurt will only fire its target if it is hurting a client +#define SF_TRIGGER_HURT_CLIENTONLYTOUCH 32 // only clients may touch this trigger. + +#define SF_AUTO_FIREONCE 0x0001 +#define SF_RELAY_FIREONCE 0x0001 +#define SF_ENDSECTION_USEONLY 0x0001 + +#define SF_MULTIMAN_CLONE 0x80000000 +#define SF_MULTIMAN_THREAD 0x00000001 + +#define SF_CHANGELEVEL_USEONLY 0x0002 +#define SF_CAMERA_PLAYER_POSITION 1 +#define SF_CAMERA_PLAYER_TARGET 2 +#define SF_CAMERA_PLAYER_TAKECONTROL 4 + +// Flags to indicate masking off various render parameters that are normally copied to the targets +#define SF_RENDER_MASKFX (1 << 0) +#define SF_RENDER_MASKAMT (1 << 1) +#define SF_RENDER_MASKMODE (1 << 2) +#define SF_RENDER_MASKCOLOR (1 << 3) + +class CFrictionModifier: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; +public: + float m_frictionFraction; +}; + +// 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 +class CAutoTrigger: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Think() = 0; +public: + int m_globalstate; + USE_TYPE triggerType; +}; + +class CTriggerRelay: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + USE_TYPE triggerType; +}; + +// The Multimanager Entity - when fired, will fire up to 16 targets +// at specified times. +// FLAG: THREAD (create clones when triggered) +// FLAG: CLONE (this is a clone for a threaded execution) +class CMultiManager: public CBaseToggle { +public: + virtual void Spawn() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual BOOL HasTarget(string_t targetname) = 0; +public: + int m_cTargets; + int m_index; + float m_startTime; + int m_iTargetName[MAX_MULTI_TARGETS]; + float m_flTargetDelay[MAX_MULTI_TARGETS]; +}; + +// Render parameters trigger +// +// This entity will copy its render parameters (renderfx, rendermode, rendercolor, renderamt) +// to its targets when triggered. +class CRenderFxManager: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +class CBaseTrigger: public CBaseToggle { +public: + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int ObjectCaps() = 0; +}; + +// 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' +class CTriggerHurt: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CTriggerMonsterJump: public CBaseTrigger { +public: + virtual void Spawn() = 0; + virtual void Think() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +}; + +// trigger_cdaudio - starts/stops cd audio tracks +class CTriggerCDAudio: public CBaseTrigger { +public: + virtual void Spawn() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +// This plays a CD track when fired or when the player enters it's radius +class CTargetCDAudio: public CPointEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Think() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +}; + +// QUAKED trigger_multiple (.5 .5 .5) ? notouch +// Variable sized repeatable trigger. Must be targeted at one or more entities. +// If "health" is set, the trigger must be killed to activate each time. +// If "delay" is set, the trigger waits some time after activating before firing. +// "wait" : Seconds between triggerings. (.2 default) +// If notouch is set, the trigger is only fired by other entities, not by touching. +// NOTOUCH has been obsoleted by trigger_relay! +// sounds +// 1) secret +// 2) beep beep +// 3) large switch +// 4) +// NEW +// if a trigger has a NETNAME, that NETNAME will become the TARGET of the triggered object. +class CTriggerMultiple: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +// QUAKED trigger_once (.5 .5 .5) ? notouch +// Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching +// "targetname". If "health" is set, the trigger must be killed to activate. +// If notouch is set, the trigger is only fired by other entities, not by touching. +// if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired. +// if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0. +// sounds +// 1) secret +// 2) beep beep +// 3) large switch +// 4) +class CTriggerOnce: public CTriggerMultiple { +public: + virtual void Spawn() = 0; +}; + +// QUAKED trigger_counter (.5 .5 .5) ? nomessage +// Acts as an intermediary for an action that takes multiple inputs. +// 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. +class CTriggerCounter: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +// Derive from point entity so this doesn't move across levels +class CTriggerVolume: public CPointEntity { +public: + virtual void Spawn() = 0; +}; + +// Fires a target after level transition and then dies +class CFireAndDie: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int ObjectCaps() = 0; // Always go across transitions + virtual void Think() = 0; +}; + +// 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. +class CChangeLevel: public CBaseTrigger { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; +public: + 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; +}; + +class CLadder: public CBaseTrigger { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +}; + +class CTriggerPush: public CBaseTrigger { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +}; + +class CTriggerTeleport: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CBuyZone: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CBombTarget: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CHostageRescue: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CEscapeZone: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CVIP_SafetyZone: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CTriggerSave: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CTriggerEndSection: public CBaseTrigger { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +}; + +class CTriggerGravity: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +// this is a really bad idea. +class CTriggerChangeTarget: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +private: + int m_iszNewTarget; +}; + +class CTriggerCamera: public CBaseDelay { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; +public: + EHANDLE m_hPlayer; + EHANDLE m_hTarget; + CBaseEntity *m_pentPath; + int m_sPath; + float m_flWait; + float m_flReturnTime; + float m_flStopTime; + float m_moveDistance; + float m_targetSpeed; + float m_initialSpeed; + float m_acceleration; + float m_deceleration; + int m_state; +}; + +class CWeather: public CBaseTrigger { +public: + virtual void Spawn() = 0; +}; + +class CClientFog: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +public: + int m_iStartDist; + int m_iEndDist; + float m_fDensity; +}; diff --git a/reapi/include/cssdk/dlls/unisignals.h b/reapi/include/cssdk/dlls/unisignals.h new file mode 100644 index 0000000..054bdc5 --- /dev/null +++ b/reapi/include/cssdk/dlls/unisignals.h @@ -0,0 +1,57 @@ +/* +* +* 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 UNISIGNALS_H +#define UNISIGNALS_H +#ifdef _WIN32 +#pragma once +#endif + +class CUnifiedSignals +{ +public: + CUnifiedSignals() + { + m_flSignal = 0; + m_flState = 0; + } +public: + void Update() + { + 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; } +public: + int m_flSignal; + int m_flState; +}; + +#endif // UNISIGNALS_H diff --git a/reapi/include/cssdk/dlls/util.h b/reapi/include/cssdk/dlls/util.h new file mode 100644 index 0000000..c032d32 --- /dev/null +++ b/reapi/include/cssdk/dlls/util.h @@ -0,0 +1,181 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "enginecallback.h" + +#define eoNullEntity 0 // Testing the three types of "entity" for nullity +#define iStringNull 0 // Testing strings for nullity + +#define cchMapNameMost 32 + +#define CBSENTENCENAME_MAX 16 +#define CVOXFILESENTENCEMAX 1536 // max number of sentences in game. NOTE: this must match CVOXFILESENTENCEMAX in engine\sound.h + +#define GROUP_OP_AND 0 +#define GROUP_OP_NAND 1 + +extern globalvars_t *gpGlobals; + +// Use this instead of ALLOC_STRING on constant strings +#define STRING(offset) ((const char *)(gpGlobals->pStringBase + (unsigned int)(offset))) +#define MAKE_STRING(str) ((uint64_t)(str) - (uint64_t)(STRING(0))) + +// Dot products for view cone checking +#define VIEW_FIELD_FULL -1.0 // +-180 degrees +#define VIEW_FIELD_WIDE -0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks +#define VIEW_FIELD_NARROW 0.7 // +-45 degrees, more narrow check used to set up ranged attacks +#define VIEW_FIELD_ULTRA_NARROW 0.9 // +-25 degrees, more narrow check used to set up ranged attacks + +#define SND_SPAWNING (1<<8) // duplicated in protocol.h we're spawing, used in some cases for ambients +#define SND_STOP (1<<5) // duplicated in protocol.h stop sound +#define SND_CHANGE_VOL (1<<6) // duplicated in protocol.h change sound vol +#define SND_CHANGE_PITCH (1<<7) // duplicated in protocol.h change sound pitch + +#define DONT_BLEED -1 +#define BLOOD_COLOR_RED (byte)247 +#define BLOOD_COLOR_YELLOW (byte)195 +#define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW + +#define GERMAN_GIB_COUNT 4 +#define HUMAN_GIB_COUNT 6 +#define ALIEN_GIB_COUNT 4 + +#define LANGUAGE_ENGLISH 0 +#define LANGUAGE_GERMAN 1 +#define LANGUAGE_FRENCH 2 +#define LANGUAGE_BRITISH 3 + +#define SVC_TEMPENTITY 23 +#define SVC_INTERMISSION 30 +#define SVC_CDTRACK 32 +#define SVC_WEAPONANIM 35 +#define SVC_ROOMTYPE 37 +#define SVC_DIRECTOR 51 + +#define SF_TRIG_PUSH_ONCE 1 + +// func_rotating +#define SF_BRUSH_ROTATE_Y_AXIS 0 +#define SF_BRUSH_ROTATE_INSTANT 1 +#define SF_BRUSH_ROTATE_BACKWARDS 2 +#define SF_BRUSH_ROTATE_Z_AXIS 4 +#define SF_BRUSH_ROTATE_X_AXIS 8 +#define SF_PENDULUM_AUTO_RETURN 16 +#define SF_PENDULUM_PASSABLE 32 + +#define SF_BRUSH_ROTATE_SMALLRADIUS 128 +#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256 +#define SF_BRUSH_ROTATE_LARGERADIUS 512 + +#define SPAWNFLAG_NOMESSAGE 1 +#define SPAWNFLAG_NOTOUCH 1 +#define SPAWNFLAG_DROIDONLY 4 + +#define VEC_HULL_MIN_Z Vector(0, 0, -36) +#define VEC_DUCK_HULL_MIN_Z Vector(0, 0, -18) + +#define VEC_HULL_MIN Vector(-16, -16, -36) +#define VEC_HULL_MAX Vector(16, 16, 36) + +#define VEC_VIEW Vector(0, 0, 17) + +#define VEC_DUCK_HULL_MIN Vector(-16, -16, -18) +#define VEC_DUCK_HULL_MAX Vector(16, 16, 32) +#define VEC_DUCK_VIEW Vector(0, 0, 12) + +#define PRECACHE_SOUND_ARRAY(a) \ + { for (int i = 0; i < ARRAYSIZE(a); ++i) PRECACHE_SOUND((char *)a[i]); } + +// Inlines +inline edict_t *FIND_ENTITY_BY_CLASSNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "classname", pszName); } +inline edict_t *FIND_ENTITY_BY_TARGETNAME(edict_t *entStart, const char *pszName) { return FIND_ENTITY_BY_STRING(entStart, "targetname", pszName); } + +inline edict_t *ENT(const entvars_t *pev) { return pev->pContainingEntity; } +inline edict_t *ENT(EOFFSET eoffset) { return (*g_engfuncs.pfnPEntityOfEntOffset)(eoffset); } +inline EOFFSET OFFSET(const edict_t *pent) { return (*g_engfuncs.pfnEntOffsetOfPEntity)(pent); } +inline EOFFSET OFFSET(const entvars_t *pev) { return OFFSET(ENT(pev)); } + +inline entvars_t *VARS(edict_t *pent) +{ + if (!pent) + return NULL; + + return &pent->v; +} + +inline entvars_t *VARS(EOFFSET eoffset) { return VARS(ENT(eoffset)); } +inline int ENTINDEX(const edict_t *pEdict) { return (*g_engfuncs.pfnIndexOfEdict)(pEdict); } +inline int ENTINDEX(const entvars_t *pev) { return (*g_engfuncs.pfnIndexOfEdict)(ENT(pev)); } +inline edict_t *INDEXENT(int iEdictNum) { return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); } +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)); } +inline BOOL FNullEnt(EOFFSET eoffset) { return (eoffset == 0); } +inline BOOL FNullEnt(entvars_t *pev) { return (pev == NULL || FNullEnt(OFFSET(pev))); } +inline BOOL FNullEnt(const edict_t *pent) { return (pent == NULL || FNullEnt(OFFSET(pent))); } +inline BOOL FStringNull(int iString) { return (iString == iStringNull); } +inline BOOL FStrEq(const char *sz1, const char *sz2) { return (strcmp(sz1, sz2) == 0); } +inline BOOL FClassnameIs(entvars_t *pev, const char *szClassname) { return FStrEq(STRING(pev->classname), szClassname); } +inline BOOL FClassnameIs(edict_t *pent, const char *szClassname) { return FStrEq(STRING(VARS(pent)->classname), szClassname); } + +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); } + +// NOTE: use EMIT_SOUND_DYN to set the pitch of a sound. Pitch of 100 +// is no pitch shift. Pitch > 100 up to 255 is a higher pitch, pitch < 100 +// down to 1 is a lower pitch. 150 to 70 is the realistic range. +// EMIT_SOUND_DYN with pitch != 100 should be used sparingly, as it's not quite as +// fast as EMIT_SOUND (the pitchshift mixer is not native coded). +inline void EMIT_SOUND(edict_t *entity, int channel, const char *sample, float volume, float attenuation) +{ + EMIT_SOUND_DYN2(entity, channel, sample, volume, attenuation, 0, PITCH_NORM); +} + +inline void STOP_SOUND(edict_t *entity, int channel, const char *sample) +{ + EMIT_SOUND_DYN2(entity, channel, sample, 0, 0, SND_STOP, PITCH_NORM); +} + +inline void UTIL_SetSize(entvars_t *pev, const Vector &vecMin, const Vector &vecMax) +{ + SET_SIZE(ENT(pev), vecMin, vecMax); +} + +inline void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin) +{ + edict_t *ent = ENT(pev); + + if (ent != NULL) + SET_ORIGIN(ent, vecOrigin); +} + +inline 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); +} + +extern char *UTIL_VarArgs(char *format, ...); +extern void UTIL_LogPrintf(const char *fmt, ...); diff --git a/reapi/include/cssdk/dlls/vector.h b/reapi/include/cssdk/dlls/vector.h new file mode 100644 index 0000000..57f6b6d --- /dev/null +++ b/reapi/include/cssdk/dlls/vector.h @@ -0,0 +1,168 @@ +/* +* +* 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. +* +*/ +#pragma once + +// 2DVector - used for many pathfinding and many other +// operations that are treated as planar rather than 3d. +class Vector2D { +public: + inline Vector2D() : x(0.0), y(0.0) {} + inline Vector2D(float X, float Y) : x(0.0), y(0.0) { x = X; y = Y; } + inline Vector2D operator+(const Vector2D &v) const { return Vector2D(x + v.x, y + v.y); } + inline Vector2D operator-(const Vector2D &v) const { return Vector2D(x - v.x, y - v.y); } + inline Vector2D operator*(float fl) const { return Vector2D(x * fl, y * fl); } + inline Vector2D operator/(float fl) const { return Vector2D(x / fl, y / fl); } + inline Vector2D operator/=(float fl) const { return Vector2D(x / fl, y / fl); } + inline float Length() const { return sqrt(x * x + y * y); } + inline float LengthSquared() const { return (x * x + y * y); } + + operator float*() { return &x; } + operator const float*() const { return &x; } + + inline Vector2D Normalize() const + { + float flLen = Length(); + if (flLen == 0) + return Vector2D(0, 0); + + flLen = 1 / flLen; + return Vector2D(x * flLen, y * flLen); + } + + inline bool IsLengthLessThan(float length) const { return (LengthSquared() < length * length); } + inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); } + inline float NormalizeInPlace() + { + float flLen = Length(); + if (flLen == 0) + { + x = 1; y = 0; + } + else + { + flLen = 1 / flLen; + x *= flLen; y *= flLen; + } + + return flLen; + } + inline bool IsZero(float tolerance = 0.01f) const + { + return (x > -tolerance && x < tolerance && + y > -tolerance && y < tolerance); + } + + // Members + vec_t x, y; +}; + +inline float DotProduct(const Vector2D &a, const Vector2D &b) { return (a.x * b.x + a.y * b.y); } +inline Vector2D operator*(float fl, const Vector2D &v) { return v * fl; } + +// 3D Vector +// same data-layout as engine's vec3_t, which is a vec_t[3] +class Vector { +public: + // Construction/destruction + inline Vector() : x(0.0), y(0.0), z(0.0) {} + inline Vector(float X, float Y, float Z) : x(0.0), y(0.0), z(0.0) { x = X; y = Y; z = Z; } + + inline Vector(const Vector &v) : x(0.0), y(0.0), z(0.0) { x = v.x; y = v.y; z = v.z; } + inline Vector(const float rgfl[3]) : x(0.0), y(0.0), z(0.0) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; } + + // Operators + inline Vector operator-() const { return Vector(-x, -y, -z); } + inline int operator==(const Vector &v) const { return x == v.x && y == v.y && z == v.z; } + inline int operator!=(const Vector &v) const { return !(*this == v); } + inline Vector operator+(const Vector &v) const { return Vector(x + v.x, y + v.y, z + v.z); } + inline Vector operator-(const Vector &v) const { return Vector(x - v.x, y - v.y, z - v.z); } + inline Vector operator*(float fl) const { return Vector(x * fl, y * fl, z * fl); } + inline Vector operator/(float fl) const { return Vector(x / fl, y / fl, z / fl); } + inline Vector operator/=(float fl) const{ return Vector(x / fl, y / fl, z / fl); } + + // Methods + inline void CopyToArray(float *rgfl) const { rgfl[0] = x; rgfl[1] = y; rgfl[2] = z; } + inline float Length() const { return sqrt(x * x + y * y + z * z); } + inline float LengthSquared() const { return (x * x + y * y + z * z); } + + operator float*() { return &x; } // Vectors will now automatically convert to float * when needed + operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed + + inline Vector Normalize() + { + float flLen = Length(); + if (flLen == 0) + return Vector(0, 0, 1); + + flLen = 1 / flLen; + return Vector(x * flLen, y * flLen, z * flLen); + } + inline Vector2D Make2D() const { return Vector2D(x, y); } + inline float Length2D() const { return sqrt(x * x + y * y); } + + inline bool IsLengthLessThan(float length) const { return (LengthSquared() < length * length); } + inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); } + + inline float NormalizeInPlace() + { + float flLen = Length(); + if (flLen == 0) + { + x = 0; y = 0; z = 1; + } + else + { + flLen = 1 / flLen; + x *= flLen; y *= flLen; z *= flLen; + } + + return flLen; + } + inline bool IsZero(float tolerance = 0.01f) const + { + return (x > -tolerance && x < tolerance && + y > -tolerance && y < tolerance && + z > -tolerance && z < tolerance); + } + + // Members + vec_t x, y, z; +}; + +inline Vector operator*(float fl, const Vector &v) { return v * fl; } +inline float DotProduct(const Vector &a, const Vector &b) { return (a.x * b.x + a.y * b.y + a.z * b.z); } +inline float DotProduct2D(const Vector &a, const Vector &b) { return (a.x * b.x + a.y * b.y); } +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); } + +template +inline void SWAP(T &first, T &second) +{ + T temp = first; + first = second; + second = temp; +} diff --git a/reapi/include/cssdk/dlls/vehicle.h b/reapi/include/cssdk/dlls/vehicle.h new file mode 100644 index 0000000..8b7a0d0 --- /dev/null +++ b/reapi/include/cssdk/dlls/vehicle.h @@ -0,0 +1,53 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define VEHICLE_SPEED0_ACCELERATION 0.005000000000000000 +#define VEHICLE_SPEED1_ACCELERATION 0.002142857142857143 +#define VEHICLE_SPEED2_ACCELERATION 0.003333333333333334 +#define VEHICLE_SPEED3_ACCELERATION 0.004166666666666667 +#define VEHICLE_SPEED4_ACCELERATION 0.004000000000000000 +#define VEHICLE_SPEED5_ACCELERATION 0.003800000000000000 +#define VEHICLE_SPEED6_ACCELERATION 0.004500000000000000 +#define VEHICLE_SPEED7_ACCELERATION 0.004250000000000000 +#define VEHICLE_SPEED8_ACCELERATION 0.002666666666666667 +#define VEHICLE_SPEED9_ACCELERATION 0.002285714285714286 +#define VEHICLE_SPEED10_ACCELERATION 0.001875000000000000 +#define VEHICLE_SPEED11_ACCELERATION 0.001444444444444444 +#define VEHICLE_SPEED12_ACCELERATION 0.001200000000000000 +#define VEHICLE_SPEED13_ACCELERATION 0.000916666666666666 + +#define VEHICLE_STARTPITCH 60 +#define VEHICLE_MAXPITCH 200 +#define VEHICLE_MAXSPEED 1500 + +class CFuncVehicleControls: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual int ObjectCaps() = 0; +}; diff --git a/reapi/include/cssdk/dlls/weapons.h b/reapi/include/cssdk/dlls/weapons.h new file mode 100644 index 0000000..0859569 --- /dev/null +++ b/reapi/include/cssdk/dlls/weapons.h @@ -0,0 +1,891 @@ +/* +* +* 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. +* +*/ + +#pragma once + +#include "weapontype.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 +#define ITEM_FLAG_NOAUTOSWITCHEMPTY 4 +#define ITEM_FLAG_LIMITINWORLD 8 +#define ITEM_FLAG_EXHAUSTIBLE 16 // A player can totally exhaust their ammo supply and lose this weapon + +#define WEAPON_IS_ONTARGET 0x40 + +#define ARMOR_TYPE_EMPTY 0 +#define ARMOR_TYPE_KEVLAR 1 // Armor +#define ARMOR_TYPE_HELMET 2 // Armor and helmet + +// the maximum amount of ammo each weapon's clip can hold +#define WEAPON_NOCLIP -1 + +#define LOUD_GUN_VOLUME 1000 +#define NORMAL_GUN_VOLUME 600 +#define QUIET_GUN_VOLUME 200 + +#define BRIGHT_GUN_FLASH 512 +#define NORMAL_GUN_FLASH 256 +#define DIM_GUN_FLASH 128 + +#define BIG_EXPLOSION_VOLUME 2048 +#define NORMAL_EXPLOSION_VOLUME 1024 +#define SMALL_EXPLOSION_VOLUME 512 + +#define WEAPON_ACTIVITY_VOLUME 64 + +// spawn flags +#define SF_DETONATE 0x0001 // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges + +// custom enum +enum ArmouryItemPack +{ + ARMOURY_MP5NAVY, + ARMOURY_TMP, + ARMOURY_P90, + ARMOURY_MAC10, + ARMOURY_AK47, + ARMOURY_SG552, + ARMOURY_M4A1, + ARMOURY_AUG, + ARMOURY_SCOUT, + ARMOURY_G3SG1, + ARMOURY_AWP, + ARMOURY_M3, + ARMOURY_XM1014, + ARMOURY_M249, + ARMOURY_FLASHBANG, + ARMOURY_HEGRENADE, + ARMOURY_KEVLAR, + ARMOURY_ASSAULT, + ARMOURY_SMOKEGRENADE, +}; + +struct ItemInfo +{ + int iSlot; + int iPosition; + const char *pszAmmo1; + int iMaxAmmo1; + const char *pszAmmo2; + int iMaxAmmo2; + const char *pszName; + int iMaxClip; + int iId; + int iFlags; + int iWeight; +}; + +struct AmmoInfo +{ + const char *pszName; + int iId; +}; + +struct MULTIDAMAGE +{ + CBaseEntity *pEntity; + float amount; + int type; +}; + +class CArmoury: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void Restart() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; +public: + int m_iItem; + int m_iCount; + int m_iInitialCount; + bool m_bAlreadyCounted; +}; + +// Smoke Grenade / HE grenade / Flashbang grenade / C4 +class CGrenade: public CBaseMonster { +public: + virtual void Spawn() = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual int ObjectCaps() = 0; + virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; + virtual int BloodColor() = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual void BounceSound() = 0; +public: + bool m_bStartDefuse; + bool m_bIsC4; + EHANDLE m_pBombDefuser; + float m_flDefuseCountDown; + float m_flC4Blow; + float m_flNextFreqInterval; + float m_flNextBeep; + float m_flNextFreq; + char *m_sBeepName; + float m_fAttenu; + float m_flNextBlink; + float m_fNextDefuse; + bool m_bJustBlew; + int m_iTeam; + int m_iCurWave; + edict_t *m_pentCurBombTarget; + int m_SGSmoke; + int m_angle; + unsigned short m_usEvent; + bool m_bLightSmoke; + bool m_bDetonated; + Vector m_vSmokeDetonate; + int m_iBounceCount; + BOOL m_fRegisteredSound; // whether or not this grenade has issued its DANGER sound to the world sound list yet. +}; + +// Items that the player has in their inventory that they can use +class CBasePlayerItem: public CBaseAnimating { +public: + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void SetObjectCollisionBox() = 0; + virtual CBaseEntity *Respawn() = 0; + virtual int AddToPlayer(CBasePlayer *pPlayer) = 0; // return TRUE if the item you want the item added to the player inventory + virtual int AddDuplicate(CBasePlayerItem *pItem) = 0; // return TRUE if you want your duplicate removed from world + virtual int GetItemInfo(ItemInfo *p) = 0; // returns 0 if struct not filled out + virtual BOOL CanDeploy() = 0; + virtual BOOL CanDrop() = 0; // returns is deploy was successful + virtual BOOL Deploy() = 0; + virtual BOOL IsWeapon() = 0; + virtual BOOL CanHolster() = 0; // can this weapon be put away right now? + virtual void Holster(int skiplocal = 0) = 0; + virtual void UpdateItemInfo() = 0; + virtual void ItemPreFrame() = 0; // called each frame by the player PreThink + virtual void ItemPostFrame() = 0; // called each frame by the player PostThink + virtual void Drop() = 0; + virtual void Kill() = 0; + virtual void AttachToPlayer(CBasePlayer *pPlayer) = 0; + virtual int PrimaryAmmoIndex() = 0; + virtual int SecondaryAmmoIndex() = 0; + virtual int UpdateClientData(CBasePlayer *pPlayer) = 0; + virtual CBasePlayerItem *GetWeaponPtr() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; // return 0 to MAX_ITEMS_SLOTS, used in hud +public: + CBasePlayer *m_pPlayer; + CBasePlayerItem *m_pNext; + int m_iId; // WEAPON_??? +}; + +// inventory items that +class CBasePlayerWeapon: public CBasePlayerItem { +public: + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + + // generic weapon versions of CBasePlayerItem calls + virtual int AddToPlayer(CBasePlayer *pPlayer) = 0; + virtual int AddDuplicate(CBasePlayerItem *pItem) = 0; + virtual BOOL CanDeploy() = 0; + virtual BOOL IsWeapon() = 0; + virtual void Holster(int skiplocal = 0) = 0; + virtual void UpdateItemInfo() = 0; + virtual void ItemPostFrame() = 0; + virtual int PrimaryAmmoIndex() = 0; + virtual int SecondaryAmmoIndex() = 0; + virtual int UpdateClientData(CBasePlayer *pPlayer) = 0; + virtual CBasePlayerItem *GetWeaponPtr() = 0; + virtual int ExtractAmmo(CBasePlayerWeapon *pWeapon) = 0; + virtual int ExtractClipAmmo(CBasePlayerWeapon *pWeapon) = 0; + virtual int AddWeapon() = 0; + virtual BOOL PlayEmptySound() = 0; + virtual void ResetEmptySound() = 0; + virtual void SendWeaponAnim(int iAnim, int skiplocal = 0) = 0; + virtual BOOL IsUseable() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual void RetireWeapon() = 0; + virtual BOOL ShouldWeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + BOOL IsPistol() { return (m_iId == WEAPON_USP || m_iId == WEAPON_GLOCK18 || m_iId == WEAPON_P228 || m_iId == WEAPON_DEAGLE || m_iId == WEAPON_ELITE || m_iId == WEAPON_FIVESEVEN); } + + int m_iPlayEmptySound; + int m_fFireOnEmpty; + float m_flNextPrimaryAttack; // soonest time ItemPostFrame will call PrimaryAttack + float m_flNextSecondaryAttack; // soonest time ItemPostFrame will call SecondaryAttack + float m_flTimeWeaponIdle; // soonest time ItemPostFrame will call WeaponIdle + int m_iPrimaryAmmoType; // "primary" ammo index into players m_rgAmmo[] + int m_iSecondaryAmmoType; // "secondary" ammo index into players m_rgAmmo[] + int m_iClip; // number of shots left in the primary weapon clip, -1 it not used + int m_iClientClip; // the last version of m_iClip sent to hud dll + int m_iClientWeaponState; // the last version of the weapon state sent to hud dll (is current weapon, is on target) + int m_fInReload; // Are we in the middle of a reload; + int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns + int m_iDefaultAmmo; // how much ammo you get when you pick up this weapon as placed by a level designer. + int m_iShellId; + float m_fMaxSpeed; + bool m_bDelayFire; + int m_iDirection; + bool m_bSecondarySilencerOn; + float m_flAccuracy; + float m_flLastFire; + int m_iShotsFired; + Vector m_vVecAiming; + string_t model_name; + float m_flGlock18Shoot; // time to shoot the remaining bullets of the glock18 burst fire + int m_iGlock18ShotsFired; // used to keep track of the shots fired during the Glock18 burst fire mode. + float m_flFamasShoot; + int m_iFamasShotsFired; + float m_fBurstSpread; + int m_iWeaponState; + float m_flNextReload; + float m_flDecreaseShotsFired; + unsigned short m_usFireGlock18; + unsigned short m_usFireFamas; + + // hle time creep vars + float m_flPrevPrimaryAttack; + float m_flLastFireTime; +}; + +class CBasePlayerAmmo: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual BOOL AddAmmo(CBaseEntity *pOther) = 0; + virtual CBaseEntity *Respawn() = 0; +}; + +class CWeaponBox: public CBaseEntity { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual int Save(CSave &save) = 0; + virtual int Restore(CRestore &restore) = 0; + virtual void SetObjectCollisionBox() = 0; + virtual void Touch(CBaseEntity *pOther) = 0; +public: + CBasePlayerItem *m_rgpPlayerItems[MAX_ITEM_TYPES]; + int m_rgiszAmmo[MAX_AMMO_SLOTS]; + int m_rgAmmo[MAX_AMMO_SLOTS]; + int m_cAmmoTypes; + bool m_bIsBomb; +}; + +class CUSP: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; + virtual BOOL IsPistol() = 0; + +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireUSP; } +private: + unsigned short m_usFireUSP; +}; + +class CMP5N: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireMP5N; } +private: + unsigned short m_usFireMP5N; +}; + +class CSG552: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireSG552; } +private: + unsigned short m_usFireSG552; +}; + +class CAK47: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireAK47; } +private: + unsigned short m_usFireAK47; +}; + +class CAUG: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireAug; } +private: + unsigned short m_usFireAug; +}; + +class CAWP: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireAWP; } +private: + unsigned short m_usFireAWP; +}; + +class CC4: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual void KeyValue(KeyValueData *pkvd) = 0; + virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + bool m_bStartedArming; + bool m_bBombPlacedAnimation; + float m_fArmedTime; + bool HasShield() const { return m_bHasShield; } +private: + bool m_bHasShield; +}; + +class CDEAGLE: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; + virtual BOOL IsPistol() = 0; +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireDeagle; } +private: + unsigned short m_usFireDeagle; +}; + +class CFlashbang: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL CanDeploy() = 0; + virtual BOOL CanDrop() = 0; + virtual BOOL Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; + virtual BOOL IsPistol() = 0; +}; + +class CG3SG1: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireG3SG1; } +private: + unsigned short m_usFireG3SG1; +}; + +class CGLOCK18: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; + virtual BOOL IsPistol() = 0; +public: + int m_iShell; + bool m_bBurstFire; +}; + +class CHEGrenade: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL CanDeploy() = 0; + virtual BOOL CanDrop() = 0; + virtual BOOL Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + unsigned short m_usCreateExplosion; +}; + +class CKnife: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL CanDrop() = 0; + virtual BOOL Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual BOOL UseDecrement() = 0; + virtual void WeaponIdle() = 0; +public: + TraceResult m_trHit; + unsigned short m_usKnife; +}; + +class CM249: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireM249; } +private: + unsigned short m_usFireM249; +}; + +class CM3: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + float m_flPumpTime; + unsigned short GetEventID() const { return m_usFireM3; } +private: + unsigned short m_usFireM3; +}; + +class CM4A1: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireM4A1; } +private: + unsigned short m_usFireM4A1; +}; + +class CMAC10: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireMAC10; } +private: + unsigned short m_usFireMAC10; +}; + +class CP228: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; + virtual BOOL IsPistol() = 0; +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireP228; } +private: + unsigned short m_usFireP228; +}; + +class CP90: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireP90; } +private: + unsigned short m_usFireP90; +}; + +class CSCOUT: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireScout; } +private: + unsigned short m_usFireScout; +}; + +class CSmokeGrenade: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL CanDeploy() = 0; + virtual BOOL CanDrop() = 0; + virtual BOOL Deploy() = 0; + virtual void Holster(int skiplocal) = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + unsigned short m_usCreateSmoke; +}; + +class CTMP: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireTMP; } +private: + unsigned short m_usFireTMP; +}; + +class CXM1014: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + float m_flPumpTime; + unsigned short GetEventID() const { return m_usFireXM1014; } +private: + unsigned short m_usFireXM1014; +}; + +class CELITE: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; + virtual BOOL IsPistol() = 0; +public: + int m_iShell; + unsigned short GetEventID_Left() const { return m_usFireELITE_LEFT; } + unsigned short GetEventID_Right() const { return m_usFireELITE_RIGHT; } +private: + unsigned short m_usFireELITE_LEFT; + unsigned short m_usFireELITE_RIGHT; +}; + +class CFiveSeven: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; + virtual BOOL IsPistol() = 0; +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireFiveSeven; } +private: + unsigned short m_usFireFiveSeven; +}; + +class CUMP45: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireUMP45; } +private: + unsigned short m_usFireUMP45; +}; + +class CSG550: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + unsigned short GetEventID() const { return m_usFireSG550; } +private: + unsigned short m_usFireSG550; +}; + +class CGalil: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; + unsigned short GetEventID() const { return m_usFireGalil; } +private: + unsigned short m_usFireGalil; +}; + +class CFamas: public CBasePlayerWeapon { +public: + virtual void Spawn() = 0; + virtual void Precache() = 0; + virtual int GetItemInfo(ItemInfo *p) = 0; + virtual BOOL Deploy() = 0; + virtual float GetMaxSpeed() = 0; + virtual int iItemSlot() = 0; + virtual void PrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + virtual void WeaponIdle() = 0; + virtual BOOL UseDecrement() = 0; +public: + int m_iShell; + int iShellOn; +}; diff --git a/reapi/include/cssdk/dlls/weapontype.h b/reapi/include/cssdk/dlls/weapontype.h new file mode 100644 index 0000000..c185b3e --- /dev/null +++ b/reapi/include/cssdk/dlls/weapontype.h @@ -0,0 +1,402 @@ +/* +* +* 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. +* +*/ +#pragma once + +enum WeaponIdType +{ + WEAPON_NONE, + WEAPON_P228, + WEAPON_GLOCK, + WEAPON_SCOUT, + WEAPON_HEGRENADE, + WEAPON_XM1014, + WEAPON_C4, + WEAPON_MAC10, + WEAPON_AUG, + WEAPON_SMOKEGRENADE, + WEAPON_ELITE, + WEAPON_FIVESEVEN, + WEAPON_UMP45, + WEAPON_SG550, + WEAPON_GALIL, + WEAPON_FAMAS, + WEAPON_USP, + WEAPON_GLOCK18, + WEAPON_AWP, + WEAPON_MP5N, + WEAPON_M249, + WEAPON_M3, + WEAPON_M4A1, + WEAPON_TMP, + WEAPON_G3SG1, + WEAPON_FLASHBANG, + WEAPON_DEAGLE, + WEAPON_SG552, + WEAPON_AK47, + WEAPON_KNIFE, + WEAPON_P90, + WEAPON_SHIELDGUN = 99 +}; + +enum AutoBuyClassType +{ + AUTOBUYCLASS_NONE = 0, + AUTOBUYCLASS_PRIMARY = (1 << 0), + AUTOBUYCLASS_SECONDARY = (1 << 1), + AUTOBUYCLASS_AMMO = (1 << 2), + AUTOBUYCLASS_ARMOR = (1 << 3), + AUTOBUYCLASS_DEFUSER = (1 << 4), + AUTOBUYCLASS_PISTOL = (1 << 5), + AUTOBUYCLASS_SMG = (1 << 6), + AUTOBUYCLASS_RIFLE = (1 << 7), + AUTOBUYCLASS_SNIPERRIFLE = (1 << 8), + AUTOBUYCLASS_SHOTGUN = (1 << 9), + AUTOBUYCLASS_MACHINEGUN = (1 << 10), + AUTOBUYCLASS_GRENADE = (1 << 11), + AUTOBUYCLASS_NIGHTVISION = (1 << 12), + AUTOBUYCLASS_SHIELD = (1 << 13), +}; + +enum AmmoCostType +{ + AMMO_338MAG_PRICE = 125, + AMMO_357SIG_PRICE = 50, + AMMO_45ACP_PRICE = 25, + AMMO_50AE_PRICE = 40, + AMMO_556MM_PRICE = 60, + AMMO_57MM_PRICE = 50, + AMMO_762MM_PRICE = 80, + AMMO_9MM_PRICE = 20, + AMMO_BUCKSHOT_PRICE = 65, +}; + +enum WeaponCostType +{ + AK47_PRICE = 2500, + AWP_PRICE = 4750, + DEAGLE_PRICE = 650, + G3SG1_PRICE = 5000, + SG550_PRICE = 4200, + GLOCK18_PRICE = 400, + M249_PRICE = 5750, + M3_PRICE = 1700, + M4A1_PRICE = 3100, + AUG_PRICE = 3500, + MP5NAVY_PRICE = 1500, + P228_PRICE = 600, + P90_PRICE = 2350, + UMP45_PRICE = 1700, + MAC10_PRICE = 1400, + SCOUT_PRICE = 2750, + SG552_PRICE = 3500, + TMP_PRICE = 1250, + USP_PRICE = 500, + ELITE_PRICE = 800, + FIVESEVEN_PRICE = 750, + XM1014_PRICE = 3000, + GALIL_PRICE = 2000, + FAMAS_PRICE = 2250, + SHIELDGUN_PRICE = 2200, +}; + +enum WeaponState +{ + WPNSTATE_USP_SILENCED = (1 << 0), + WPNSTATE_GLOCK18_BURST_MODE = (1 << 1), + WPNSTATE_M4A1_SILENCED = (1 << 2), + WPNSTATE_ELITE_LEFT = (1 << 3), + WPNSTATE_FAMAS_BURST_MODE = (1 << 4), + WPNSTATE_SHIELD_DRAWN = (1 << 5), +}; + +// custom enum +// the default amount of ammo that comes with each gun when it spawns +enum ClipGiveDefault +{ + P228_DEFAULT_GIVE = 13, + GLOCK18_DEFAULT_GIVE = 20, + SCOUT_DEFAULT_GIVE = 10, + HEGRENADE_DEFAULT_GIVE = 1, + XM1014_DEFAULT_GIVE = 7, + C4_DEFAULT_GIVE = 1, + MAC10_DEFAULT_GIVE = 30, + AUG_DEFAULT_GIVE = 30, + SMOKEGRENADE_DEFAULT_GIVE = 1, + ELITE_DEFAULT_GIVE = 30, + FIVESEVEN_DEFAULT_GIVE = 20, + UMP45_DEFAULT_GIVE = 25, + SG550_DEFAULT_GIVE = 30, + GALIL_DEFAULT_GIVE = 35, + FAMAS_DEFAULT_GIVE = 25, + USP_DEFAULT_GIVE = 12, + AWP_DEFAULT_GIVE = 10, + MP5NAVY_DEFAULT_GIVE = 30, + M249_DEFAULT_GIVE = 100, + M3_DEFAULT_GIVE = 8, + M4A1_DEFAULT_GIVE = 30, + TMP_DEFAULT_GIVE = 30, + G3SG1_DEFAULT_GIVE = 20, + FLASHBANG_DEFAULT_GIVE = 1, + DEAGLE_DEFAULT_GIVE = 7, + SG552_DEFAULT_GIVE = 30, + AK47_DEFAULT_GIVE = 30, + /*KNIFE_DEFAULT_GIVE = 1,*/ + P90_DEFAULT_GIVE = 50, +}; + +enum ClipSizeType +{ + P228_MAX_CLIP = 13, + GLOCK18_MAX_CLIP = 20, + SCOUT_MAX_CLIP = 10, + XM1014_MAX_CLIP = 7, + MAC10_MAX_CLIP = 30, + AUG_MAX_CLIP = 30, + ELITE_MAX_CLIP = 30, + FIVESEVEN_MAX_CLIP = 20, + UMP45_MAX_CLIP = 25, + SG550_MAX_CLIP = 30, + GALIL_MAX_CLIP = 35, + FAMAS_MAX_CLIP = 25, + USP_MAX_CLIP = 12, + AWP_MAX_CLIP = 10, + MP5N_MAX_CLIP = 30, + M249_MAX_CLIP = 100, + M3_MAX_CLIP = 8, + M4A1_MAX_CLIP = 30, + TMP_MAX_CLIP = 30, + G3SG1_MAX_CLIP = 20, + DEAGLE_MAX_CLIP = 7, + SG552_MAX_CLIP = 30, + AK47_MAX_CLIP = 30, + P90_MAX_CLIP = 50, +}; + +enum WeightWeapon +{ + P228_WEIGHT = 5, + GLOCK18_WEIGHT = 5, + SCOUT_WEIGHT = 30, + HEGRENADE_WEIGHT = 2, + XM1014_WEIGHT = 20, + C4_WEIGHT = 3, + MAC10_WEIGHT = 25, + AUG_WEIGHT = 25, + SMOKEGRENADE_WEIGHT = 1, + ELITE_WEIGHT = 5, + FIVESEVEN_WEIGHT = 5, + UMP45_WEIGHT = 25, + SG550_WEIGHT = 20, + GALIL_WEIGHT = 25, + FAMAS_WEIGHT = 75, + USP_WEIGHT = 5, + AWP_WEIGHT = 30, + MP5NAVY_WEIGHT = 25, + M249_WEIGHT = 25, + M3_WEIGHT = 20, + M4A1_WEIGHT = 25, + TMP_WEIGHT = 25, + G3SG1_WEIGHT = 20, + FLASHBANG_WEIGHT = 1, + DEAGLE_WEIGHT = 7, + SG552_WEIGHT = 25, + AK47_WEIGHT = 25, + P90_WEIGHT = 26, + KNIFE_WEIGHT = 0, +}; + +enum MaxAmmoType +{ + MAX_AMMO_BUCKSHOT = 32, + MAX_AMMO_9MM = 120, + MAX_AMMO_556NATO = 90, + MAX_AMMO_556NATOBOX = 200, + MAX_AMMO_762NATO = 90, + MAX_AMMO_45ACP = 100, + MAX_AMMO_50AE = 35, + MAX_AMMO_338MAGNUM = 30, + MAX_AMMO_57MM = 100, + MAX_AMMO_357SIG = 52, + + // custom + MAX_AMMO_SMOKEGRENADE = 1, + MAX_AMMO_HEGRENADE = 1, + MAX_AMMO_FLASHBANG = 2, +}; + +enum AmmoType +{ + AMMO_BUCKSHOT, + AMMO_9MM, + AMMO_556NATO, + AMMO_556NATOBOX, + AMMO_762NATO, + AMMO_45ACP, + AMMO_50AE, + AMMO_338MAGNUM, + AMMO_57MM, + AMMO_357SIG, + AMMO_MAX_TYPES, +}; + +enum WeaponClassType +{ + WEAPONCLASS_NONE, + WEAPONCLASS_KNIFE, + WEAPONCLASS_PISTOL, + WEAPONCLASS_GRENADE, + WEAPONCLASS_SUBMACHINEGUN, + WEAPONCLASS_SHOTGUN, + WEAPONCLASS_MACHINEGUN, + WEAPONCLASS_RIFLE, + WEAPONCLASS_SNIPERRIFLE, + WEAPONCLASS_MAX, +}; + +enum AmmoBuyAmount +{ + AMMO_338MAG_BUY = 10, + AMMO_357SIG_BUY = 13, + AMMO_45ACP_BUY = 12, + AMMO_50AE_BUY = 7, + AMMO_556NATO_BUY = 30, + AMMO_556NATOBOX_BUY = 30, + AMMO_57MM_BUY = 50, + AMMO_762NATO_BUY = 30, + AMMO_9MM_BUY = 30, + AMMO_BUCKSHOT_BUY = 8, +}; + +enum ItemCostType +{ + ASSAULTSUIT_PRICE = 1000, + FLASHBANG_PRICE = 200, + HEGRENADE_PRICE = 300, + SMOKEGRENADE_PRICE = 300, + KEVLAR_PRICE = 650, + HELMET_PRICE = 350, + NVG_PRICE = 1250, + DEFUSEKIT_PRICE = 200, +}; + +enum shieldgun_e +{ + SHIELDGUN_IDLE, + SHIELDGUN_SHOOT1, + SHIELDGUN_SHOOT2, + SHIELDGUN_SHOOT_EMPTY, + SHIELDGUN_RELOAD, + SHIELDGUN_DRAW, + SHIELDGUN_DRAWN_IDLE, + SHIELDGUN_UP, + SHIELDGUN_DOWN, +}; + +// custom +enum shieldgren_e +{ + SHIELDREN_IDLE = 4, + SHIELDREN_UP, + SHIELDREN_DOWN +}; + +enum InventorySlotType +{ + PRIMARY_WEAPON_SLOT = 1, + PISTOL_SLOT, + KNIFE_SLOT, + GRENADE_SLOT, + C4_SLOT, +}; + +enum Bullet +{ + BULLET_NONE, + BULLET_PLAYER_9MM, + BULLET_PLAYER_MP5, + BULLET_PLAYER_357, + BULLET_PLAYER_BUCKSHOT, + BULLET_PLAYER_CROWBAR, + BULLET_MONSTER_9MM, + BULLET_MONSTER_MP5, + BULLET_MONSTER_12MM, + BULLET_PLAYER_45ACP, + BULLET_PLAYER_338MAG, + BULLET_PLAYER_762MM, + BULLET_PLAYER_556MM, + BULLET_PLAYER_50AE, + BULLET_PLAYER_57MM, + BULLET_PLAYER_357SIG, +}; + +struct WeaponStruct +{ + int m_type; + int m_price; + int m_side; + int m_slot; + int m_ammoPrice; +}; + +struct AutoBuyInfoStruct +{ + AutoBuyClassType m_class; + char *m_command; + char *m_classname; +}; + +struct WeaponAliasInfo +{ + char *alias; + WeaponIdType id; +}; + +struct WeaponBuyAliasInfo +{ + char *alias; + WeaponIdType id; + char *failName; +}; + +struct WeaponClassAliasInfo +{ + char *alias; + WeaponClassType id; +}; + +struct WeaponInfoStruct +{ + int id; + int cost; + int clipCost; + int buyClipSize; + int gunClipSize; + int maxRounds; + int ammoType; + char *entityName; +}; diff --git a/reapi/include/cssdk/dlls/wpn_shared.h b/reapi/include/cssdk/dlls/wpn_shared.h new file mode 100644 index 0000000..1ed2eea --- /dev/null +++ b/reapi/include/cssdk/dlls/wpn_shared.h @@ -0,0 +1,598 @@ +#pragma once + +//AK47 +#define AK47_MAX_SPEED 221 +#define AK47_DAMAGE 36 +#define AK47_RANGE_MODIFER 0.98 +#define AK47_RELOAD_TIME 2.45 + +enum ak47_e +{ + AK47_IDLE1, + AK47_RELOAD, + AK47_DRAW, + AK47_SHOOT1, + AK47_SHOOT2, + AK47_SHOOT3 +}; + + + +//AUG +#define AUG_MAX_SPEED 240 +#define AUG_DAMAGE 32 +#define AUG_RANGE_MODIFER 0.96 +#define AUG_RELOAD_TIME 3.3 + +enum aug_e +{ + AUG_IDLE1, + AUG_RELOAD, + AUG_DRAW, + AUG_SHOOT1, + AUG_SHOOT2, + AUG_SHOOT3 +}; + + + +//AWP +#define AWP_MAX_SPEED 210 +#define AWP_MAX_SPEED_ZOOM 150 +#define AWP_DAMAGE 115 +#define AWP_RANGE_MODIFER 0.99 +#define AWP_RELOAD_TIME 2.5 + +enum awp_e +{ + AWP_IDLE, + AWP_SHOOT, + AWP_SHOOT2, + AWP_SHOOT3, + AWP_RELOAD, + AWP_DRAW, +}; + + + +//C4 +#define C4_MAX_AMMO 1 +#define C4_MAX_SPEED 250.0 +#define C4_ARMING_ON_TIME 3.0 + +enum c4_e +{ + C4_IDLE1, + C4_DRAW, + C4_DROP, + C4_ARM +}; + + + +//Deagle +#define DEAGLE_MAX_SPEED 250 +#define DEAGLE_DAMAGE 54 +#define DEAGLE_RANGE_MODIFER 0.81 +#define DEAGLE_RELOAD_TIME 2.2 + +enum deagle_e +{ + DEAGLE_IDLE1, + DEAGLE_SHOOT1, + DEAGLE_SHOOT2, + DEAGLE_SHOOT_EMPTY, + DEAGLE_RELOAD, + DEAGLE_DRAW +}; + + + +//Elites +#define ELITE_MAX_SPEED 250 +#define ELITE_RELOAD_TIME 4.5 +#define ELITE_DAMAGE 36 +#define ELITE_RANGE_MODIFER 0.75 + +enum elite_e +{ + ELITE_IDLE, + ELITE_IDLE_LEFTEMPTY, + ELITE_SHOOTLEFT1, + ELITE_SHOOTLEFT2, + ELITE_SHOOTLEFT3, + ELITE_SHOOTLEFT4, + ELITE_SHOOTLEFT5, + ELITE_SHOOTLEFTLAST, + ELITE_SHOOTRIGHT1, + ELITE_SHOOTRIGHT2, + ELITE_SHOOTRIGHT3, + ELITE_SHOOTRIGHT4, + ELITE_SHOOTRIGHT5, + ELITE_SHOOTRIGHTLAST, + ELITE_RELOAD, + ELITE_DRAW +}; + + + +//Famas +#define FAMAS_MAX_SPEED 240 +#define FAMAS_RELOAD_TIME 3.3 +#define FAMAS_DAMAGE 30 +#define FAMAS_DAMAGE_BURST 34 +#define FAMAS_RANGE_MODIFER 0.96 + +enum famas_e +{ + FAMAS_IDLE1, + FAMAS_RELOAD, + FAMAS_DRAW, + FAMAS_SHOOT1, + FAMAS_SHOOT2, + FAMAS_SHOOT3 +}; + + + +//Fiveseven +#define FIVESEVEN_MAX_SPEED 250 +#define FIVESEVEN_DAMAGE 20 +#define FIVESEVEN_RANGE_MODIFER 0.885 +#define FIVESEVEN_RELOAD_TIME 2.7 + +enum fiveseven_e +{ + FIVESEVEN_IDLE, + FIVESEVEN_SHOOT1, + FIVESEVEN_SHOOT2, + FIVESEVEN_SHOOT_EMPTY, + FIVESEVEN_RELOAD, + FIVESEVEN_DRAW +}; + + + +//Flashbang +#define FLASHBANG_MAX_SPEED 250 +#define FLASHBANG_MAX_SPEED_SHIELD 180 + +enum flashbang_e +{ + FLASHBANG_IDLE, + FLASHBANG_PULLPIN, + FLASHBANG_THROW, + FLASHBANG_DRAW +}; + + + +//g3sg1 +#define G3SG1_MAX_SPEED 210 +#define G3SG1_MAX_SPEED_ZOOM 150 +#define G3SG1_DAMAGE 80 +#define G3SG1_RANGE_MODIFER 0.98 +#define G3SG1_RELOAD_TIME 3.5 + +enum g3sg1_e +{ + G3SG1_IDLE, + G3SG1_SHOOT, + G3SG1_SHOOT2, + G3SG1_RELOAD, + G3SG1_DRAW +}; + + + +//galil +#define GALIL_MAX_SPEED 240 +#define GALIL_DAMAGE 30 +#define GALIL_RANGE_MODIFER 0.98 +#define GALIL_RELOAD_TIME 2.45 + +enum galil_e +{ + GALIL_IDLE1, + GALIL_RELOAD, + GALIL_DRAW, + GALIL_SHOOT1, + GALIL_SHOOT2, + GALIL_SHOOT3 +}; + + + +//glock18 +#define GLOCK18_MAX_SPEED 250 +#define GLOCK18_DAMAGE 25 +#define GLOCK18_RANGE_MODIFER 0.75 +#define GLOCK18_RELOAD_TIME 2.2 + +enum glock18_e +{ + GLOCK18_IDLE1, + GLOCK18_IDLE2, + GLOCK18_IDLE3, + GLOCK18_SHOOT, + GLOCK18_SHOOT2, + GLOCK18_SHOOT3, + GLOCK18_SHOOT_EMPTY, + GLOCK18_RELOAD, + GLOCK18_DRAW, + GLOCK18_HOLSTER, + GLOCK18_ADD_SILENCER, + GLOCK18_DRAW2, + GLOCK18_RELOAD2 +}; + +enum glock18_shield_e +{ + GLOCK18_SHIELD_IDLE1, + GLOCK18_SHIELD_SHOOT, + GLOCK18_SHIELD_SHOOT2, + GLOCK18_SHIELD_SHOOT_EMPTY, + GLOCK18_SHIELD_RELOAD, + GLOCK18_SHIELD_DRAW, + GLOCK18_SHIELD_IDLE, + GLOCK18_SHIELD_UP, + GLOCK18_SHIELD_DOWN +}; + + + +//hegrenade +#define HEGRENADE_MAX_SPEED 250 +#define HEGRENADE_MAX_SPEED_SHIELD 180 + +enum hegrenade_e +{ + HEGRENADE_IDLE, + HEGRENADE_PULLPIN, + HEGRENADE_THROW, + HEGRENADE_DRAW +}; + + + +//knife +#define KNIFE_BODYHIT_VOLUME 128 +#define KNIFE_WALLHIT_VOLUME 512 +#define KNIFE_MAX_SPEED 250 +#define KNIFE_MAX_SPEED_SHIELD 180 + +enum knife_e +{ + KNIFE_IDLE, + KNIFE_ATTACK1HIT, + KNIFE_ATTACK2HIT, + KNIFE_DRAW, + KNIFE_STABHIT, + KNIFE_STABMISS, + KNIFE_MIDATTACK1HIT, + KNIFE_MIDATTACK2HIT +}; + +enum knife_shield_e +{ + KNIFE_SHIELD_IDLE, + KNIFE_SHIELD_SLASH, + KNIFE_SHIELD_ATTACKHIT, + KNIFE_SHIELD_DRAW, + KNIFE_SHIELD_UPIDLE, + KNIFE_SHIELD_UP, + KNIFE_SHIELD_DOWN +}; + + + +//m3 +#define M3_MAX_SPEED 230 +#define M3_CONE_VECTOR Vector(0.0675, 0.0675, 0.0) // special shotgun spreads + +enum m3_e +{ + M3_IDLE, + M3_FIRE1, + M3_FIRE2, + M3_RELOAD, + M3_PUMP, + M3_START_RELOAD, + M3_DRAW, + M3_HOLSTER +}; + + + +//m4a1 +#define M4A1_MAX_SPEED 230 +#define M4A1_DAMAGE 32 +#define M4A1_DAMAGE_SIL 33 +#define M4A1_RANGE_MODIFER 0.97 +#define M4A1_RANGE_MODIFER_SIL 0.95 +#define M4A1_RELOAD_TIME 3.05 + +enum m4a1_e +{ + M4A1_IDLE, + M4A1_SHOOT1, + M4A1_SHOOT2, + M4A1_SHOOT3, + M4A1_RELOAD, + M4A1_DRAW, + M4A1_ATTACH_SILENCER, + M4A1_UNSIL_IDLE, + M4A1_UNSIL_SHOOT1, + M4A1_UNSIL_SHOOT2, + M4A1_UNSIL_SHOOT3, + M4A1_UNSIL_RELOAD, + M4A1_UNSIL_DRAW, + M4A1_DETACH_SILENCER +}; + + + +//m249 +#define M249_MAX_SPEED 220 +#define M249_DAMAGE 32 +#define M249_RANGE_MODIFER 0.97 +#define M249_RELOAD_TIME 4.7 + +enum m249_e +{ + M249_IDLE1, + M249_SHOOT1, + M249_SHOOT2, + M249_RELOAD, + M249_DRAW +}; + + + +//mac10 +#define MAC10_MAX_SPEED 250 +#define MAC10_DAMAGE 29 +#define MAC10_RANGE_MODIFER 0.82 +#define MAC10_RELOAD_TIME 3.15 + +enum mac10_e +{ + MAC10_IDLE1, + MAC10_RELOAD, + MAC10_DRAW, + MAC10_SHOOT1, + MAC10_SHOOT2, + MAC10_SHOOT3 +}; + + + +//mp5navy +#define MP5N_MAX_SPEED 250 +#define MP5N_DAMAGE 26 +#define MP5N_RANGE_MODIFER 0.84 +#define MP5N_RELOAD_TIME 2.63 + +enum mp5n_e +{ + MP5N_IDLE1, + MP5N_RELOAD, + MP5N_DRAW, + MP5N_SHOOT1, + MP5N_SHOOT2, + MP5N_SHOOT3 +}; + + + +//p90 +#define P90_MAX_SPEED 245 +#define P90_DAMAGE 21 +#define P90_RANGE_MODIFER 0.885 +#define P90_RELOAD_TIME 3.4 + +enum p90_e +{ + P90_IDLE1, + P90_RELOAD, + P90_DRAW, + P90_SHOOT1, + P90_SHOOT2, + P90_SHOOT3 +}; + + + +//p228 +#define P228_MAX_SPEED 250 +#define P228_DAMAGE 32 +#define P228_RANGE_MODIFER 0.8 +#define P228_RELOAD_TIME 2.7 + +enum p228_e +{ + P228_IDLE, + P228_SHOOT1, + P228_SHOOT2, + P228_SHOOT3, + P228_SHOOT_EMPTY, + P228_RELOAD, + P228_DRAW +}; + +enum p228_shield_e +{ + P228_SHIELD_IDLE, + P228_SHIELD_SHOOT1, + P228_SHIELD_SHOOT2, + P228_SHIELD_SHOOT_EMPTY, + P228_SHIELD_RELOAD, + P228_SHIELD_DRAW, + P228_SHIELD_IDLE_UP, + P228_SHIELD_UP, + P228_SHIELD_DOWN +}; + + + +//scout +#define SCOUT_MAX_SPEED 260 +#define SCOUT_MAX_SPEED_ZOOM 220 +#define SCOUT_DAMAGE 75 +#define SCOUT_RANGE_MODIFER 0.98 +#define SCOUT_RELOAD_TIME 2 + +enum scout_e +{ + SCOUT_IDLE, + SCOUT_SHOOT, + SCOUT_SHOOT2, + SCOUT_RELOAD, + SCOUT_DRAW +}; + + + +//sg550 +#define SG550_MAX_SPEED 210 +#define SG550_MAX_SPEED_ZOOM 150 +#define SG550_DAMAGE 70 +#define SG550_RANGE_MODIFER 0.98 +#define SG550_RELOAD_TIME 3.35 + +enum sg550_e +{ + SG550_IDLE, + SG550_SHOOT, + SG550_SHOOT2, + SG550_RELOAD, + SG550_DRAW +}; + + + +//sg552 +#define SG552_MAX_SPEED 235 +#define SG552_MAX_SPEED_ZOOM 200 +#define SG552_DAMAGE 33 +#define SG552_RANGE_MODIFER 0.955 +#define SG552_RELOAD_TIME 3 + +enum sg552_e +{ + SG552_IDLE1, + SG552_RELOAD, + SG552_DRAW, + SG552_SHOOT1, + SG552_SHOOT2, + SG552_SHOOT3 +}; + + + +//smokegrenade +#define SMOKEGRENADE_MAX_SPEED 250 +#define SMOKEGRENADE_MAX_SPEED_SHIELD 180 + +enum smokegrenade_e +{ + SMOKEGRENADE_IDLE, + SMOKEGRENADE_PINPULL, + SMOKEGRENADE_THROW, + SMOKEGRENADE_DRAW +}; + + + +//tmp +#define TMP_MAX_SPEED 250 +#define TMP_DAMAGE 20 +#define TMP_RANGE_MODIFER 0.85 +#define TMP_RELOAD_TIME 2.12 + +enum tmp_e +{ + TMP_IDLE1, + TMP_RELOAD, + TMP_DRAW, + TMP_SHOOT1, + TMP_SHOOT2, + TMP_SHOOT3 +}; + + + +//ump45 +#define UMP45_MAX_SPEED 250 +#define UMP45_DAMAGE 30 +#define UMP45_RANGE_MODIFER 0.82 +#define UMP45_RELOAD_TIME 3.5 + +enum ump45_e +{ + UMP45_IDLE1, + UMP45_RELOAD, + UMP45_DRAW, + UMP45_SHOOT1, + UMP45_SHOOT2, + UMP45_SHOOT3 +}; + + + +//tmp +#define USP_MAX_SPEED 250 +#define USP_DAMAGE 34 +#define USP_DAMAGE_SIL 30 +#define USP_RANGE_MODIFER 0.79 +#define USP_RELOAD_TIME 2.7 + +enum usp_e +{ + USP_IDLE, + USP_SHOOT1, + USP_SHOOT2, + USP_SHOOT3, + USP_SHOOT_EMPTY, + USP_RELOAD, + USP_DRAW, + USP_ATTACH_SILENCER, + USP_UNSIL_IDLE, + USP_UNSIL_SHOOT1, + USP_UNSIL_SHOOT2, + USP_UNSIL_SHOOT3, + USP_UNSIL_SHOOT_EMPTY, + USP_UNSIL_RELOAD, + USP_UNSIL_DRAW, + USP_DETACH_SILENCER +}; + +enum usp_shield_e +{ + USP_SHIELD_IDLE, + USP_SHIELD_SHOOT1, + USP_SHIELD_SHOOT2, + USP_SHIELD_SHOOT_EMPTY, + USP_SHIELD_RELOAD, + USP_SHIELD_DRAW, + USP_SHIELD_UP_IDLE, + USP_SHIELD_UP, + USP_SHIELD_DOWN +}; + + + +//xm1014 +#define XM1014_MAX_SPEED 240 +#define XM1014_CONE_VECTOR Vector(0.0725, 0.0725, 0.0) // special shotgun spreads + +enum xm1014_e +{ + XM1014_IDLE, + XM1014_FIRE1, + XM1014_FIRE2, + XM1014_RELOAD, + XM1014_PUMP, + XM1014_START_RELOAD, + XM1014_DRAW +}; diff --git a/reapi/include/cssdk/engine/FlightRecorder.h b/reapi/include/cssdk/engine/FlightRecorder.h new file mode 100644 index 0000000..66a6477 --- /dev/null +++ b/reapi/include/cssdk/engine/FlightRecorder.h @@ -0,0 +1,61 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "archtypes.h" + +class IRehldsFlightRecorder +{ +public: + virtual ~IRehldsFlightRecorder() { } + + virtual uint16 RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) = 0; + + virtual void StartMessage(uint16 msg, bool entrance) = 0; + virtual void EndMessage(uint16 msg, bool entrance) = 0; + + virtual void WriteInt8(int8 v) = 0; + virtual void WriteUInt8(uint8 v) = 0; + + virtual void WriteInt16(int16 v) = 0; + virtual void WriteUInt16(uint16 v) = 0; + + virtual void WriteInt32(int32 v) = 0; + virtual void WriteUInt32(uint32 v) = 0; + + virtual void WriteInt64(int64 v) = 0; + virtual void WriteUInt64(uint64 v) = 0; + + virtual void WriteFloat(float v) = 0; + virtual void WriteDouble(double v) = 0; + + virtual void WriteString(const char* s) = 0; + + virtual void WriteBuffer(const void* data ,unsigned int len) = 0; + +}; diff --git a/reapi/include/cssdk/engine/Sequence.h b/reapi/include/cssdk/engine/Sequence.h new file mode 100644 index 0000000..6253018 --- /dev/null +++ b/reapi/include/cssdk/engine/Sequence.h @@ -0,0 +1,201 @@ +//--------------------------------------------------------------------------- +// +// S c r i p t e d S e q u e n c e s +// +//--------------------------------------------------------------------------- +#ifndef _INCLUDE_SEQUENCE_H_ +#define _INCLUDE_SEQUENCE_H_ + + +#ifndef _DEF_BYTE_ +typedef unsigned char byte; +#endif + +//--------------------------------------------------------------------------- +// client_textmessage_t +//--------------------------------------------------------------------------- +typedef struct client_textmessage_s +{ + int effect; + byte r1, g1, b1, a1; // 2 colors for effects + byte r2, g2, b2, a2; + float x; + float y; + float fadein; + float fadeout; + float holdtime; + float fxtime; + const char *pName; + const char *pMessage; +} client_textmessage_t; + + +//-------------------------------------------------------------------------- +// sequenceDefaultBits_e +// +// Enumerated list of possible modifiers for a command. This enumeration +// is used in a bitarray controlling what modifiers are specified for a command. +//--------------------------------------------------------------------------- +enum sequenceModifierBits +{ + SEQUENCE_MODIFIER_EFFECT_BIT = (1 << 1), + SEQUENCE_MODIFIER_POSITION_BIT = (1 << 2), + SEQUENCE_MODIFIER_COLOR_BIT = (1 << 3), + SEQUENCE_MODIFIER_COLOR2_BIT = (1 << 4), + SEQUENCE_MODIFIER_FADEIN_BIT = (1 << 5), + SEQUENCE_MODIFIER_FADEOUT_BIT = (1 << 6), + SEQUENCE_MODIFIER_HOLDTIME_BIT = (1 << 7), + SEQUENCE_MODIFIER_FXTIME_BIT = (1 << 8), + SEQUENCE_MODIFIER_SPEAKER_BIT = (1 << 9), + SEQUENCE_MODIFIER_LISTENER_BIT = (1 << 10), + SEQUENCE_MODIFIER_TEXTCHANNEL_BIT = (1 << 11), +}; +typedef enum sequenceModifierBits sequenceModifierBits_e ; + + +//--------------------------------------------------------------------------- +// sequenceCommandEnum_e +// +// Enumerated sequence command types. +//--------------------------------------------------------------------------- +enum sequenceCommandEnum_ +{ + SEQUENCE_COMMAND_ERROR = -1, + SEQUENCE_COMMAND_PAUSE = 0, + SEQUENCE_COMMAND_FIRETARGETS, + SEQUENCE_COMMAND_KILLTARGETS, + SEQUENCE_COMMAND_TEXT, + SEQUENCE_COMMAND_SOUND, + SEQUENCE_COMMAND_GOSUB, + SEQUENCE_COMMAND_SENTENCE, + SEQUENCE_COMMAND_REPEAT, + SEQUENCE_COMMAND_SETDEFAULTS, + SEQUENCE_COMMAND_MODIFIER, + SEQUENCE_COMMAND_POSTMODIFIER, + SEQUENCE_COMMAND_NOOP, + + SEQUENCE_MODIFIER_EFFECT, + SEQUENCE_MODIFIER_POSITION, + SEQUENCE_MODIFIER_COLOR, + SEQUENCE_MODIFIER_COLOR2, + SEQUENCE_MODIFIER_FADEIN, + SEQUENCE_MODIFIER_FADEOUT, + SEQUENCE_MODIFIER_HOLDTIME, + SEQUENCE_MODIFIER_FXTIME, + SEQUENCE_MODIFIER_SPEAKER, + SEQUENCE_MODIFIER_LISTENER, + SEQUENCE_MODIFIER_TEXTCHANNEL, +}; +typedef enum sequenceCommandEnum_ sequenceCommandEnum_e; + + +//--------------------------------------------------------------------------- +// sequenceCommandType_e +// +// Typeerated sequence command types. +//--------------------------------------------------------------------------- +enum sequenceCommandType_ +{ + SEQUENCE_TYPE_COMMAND, + SEQUENCE_TYPE_MODIFIER, +}; +typedef enum sequenceCommandType_ sequenceCommandType_e; + + +//--------------------------------------------------------------------------- +// sequenceCommandMapping_s +// +// A mapping of a command enumerated-value to its name. +//--------------------------------------------------------------------------- +typedef struct sequenceCommandMapping_ sequenceCommandMapping_s; +struct sequenceCommandMapping_ +{ + sequenceCommandEnum_e commandEnum; + const char* commandName; + sequenceCommandType_e commandType; +}; + + +//--------------------------------------------------------------------------- +// sequenceCommandLine_s +// +// Structure representing a single command (usually 1 line) from a +// .SEQ file entry. +//--------------------------------------------------------------------------- +typedef struct sequenceCommandLine_ sequenceCommandLine_s; +struct sequenceCommandLine_ +{ + int commandType; // Specifies the type of command + client_textmessage_t clientMessage; // Text HUD message struct + char* speakerName; // Targetname of speaking entity + char* listenerName; // Targetname of entity being spoken to + char* soundFileName; // Name of sound file to play + char* sentenceName; // Name of sentences.txt to play + char* fireTargetNames; // List of targetnames to fire + char* killTargetNames; // List of targetnames to remove + float delay; // Seconds 'till next command + int repeatCount; // If nonzero, reset execution pointer to top of block (N times, -1 = infinite) + int textChannel; // Display channel on which text message is sent + int modifierBitField; // Bit field to specify what clientmessage fields are valid + sequenceCommandLine_s* nextCommandLine; // Next command (linked list) +}; + + +//--------------------------------------------------------------------------- +// sequenceEntry_s +// +// Structure representing a single command (usually 1 line) from a +// .SEQ file entry. +//--------------------------------------------------------------------------- +typedef struct sequenceEntry_ sequenceEntry_s; +struct sequenceEntry_ +{ + char* fileName; // Name of sequence file without .SEQ extension + char* entryName; // Name of entry label in file + sequenceCommandLine_s* firstCommand; // Linked list of commands in entry + sequenceEntry_s* nextEntry; // Next loaded entry + qboolean isGlobal; // Is entry retained over level transitions? +}; + + + +//--------------------------------------------------------------------------- +// sentenceEntry_s +// Structure representing a single sentence of a group from a .SEQ +// file entry. Sentences are identical to entries in sentences.txt, but +// can be unique per level and are loaded/unloaded with the level. +//--------------------------------------------------------------------------- +typedef struct sentenceEntry_ sentenceEntry_s; +struct sentenceEntry_ +{ + char* data; // sentence data (ie "We have hostiles" ) + sentenceEntry_s* nextEntry; // Next loaded entry + qboolean isGlobal; // Is entry retained over level transitions? + unsigned int index; // this entry's position in the file. +}; + +//-------------------------------------------------------------------------- +// sentenceGroupEntry_s +// Structure representing a group of sentences found in a .SEQ file. +// A sentence group is defined by all sentences with the same name, ignoring +// the number at the end of the sentence name. Groups enable a sentence +// to be picked at random across a group. +//-------------------------------------------------------------------------- +typedef struct sentenceGroupEntry_ sentenceGroupEntry_s; +struct sentenceGroupEntry_ +{ + char* groupName; // name of the group (ie CT_ALERT ) + unsigned int numSentences; // number of sentences in group + sentenceEntry_s* firstSentence; // head of linked list of sentences in group + sentenceGroupEntry_s* nextEntry; // next loaded group +}; + +//--------------------------------------------------------------------------- +// Function declarations +//--------------------------------------------------------------------------- +sequenceEntry_s* SequenceGet( const char* fileName, const char* entryName ); +void Sequence_ParseFile( const char* fileName, qboolean isGlobal ); +void Sequence_OnLevelLoad( const char* mapName ); +sentenceEntry_s* SequencePickSentence( const char *groupName, int pickMethod, int *picked ); + +#endif /* _INCLUDE_SEQUENCE_H_ */ diff --git a/reapi/include/cssdk/engine/archtypes.h b/reapi/include/cssdk/engine/archtypes.h new file mode 100644 index 0000000..e528a6d --- /dev/null +++ b/reapi/include/cssdk/engine/archtypes.h @@ -0,0 +1,66 @@ +/* +* +* 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 ARCHTYPES_H +#define ARCHTYPES_H + +#ifdef __x86_64__ +#define X64BITS +#endif + +#if defined( _WIN32 ) && (! defined( __MINGW32__ )) + +typedef __int8 int8; +typedef unsigned __int8 uint8; +typedef __int16 int16; +typedef unsigned __int16 uint16; +typedef __int32 int32; +typedef unsigned __int32 uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; +typedef __int32 intp; // intp is an integer that can accomodate a pointer +typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) + +#else /* _WIN32 */ +typedef char int8; +typedef unsigned char uint8; +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 */ + +#endif /* ARCHTYPES_H */ diff --git a/reapi/include/cssdk/engine/bspfile.h b/reapi/include/cssdk/engine/bspfile.h new file mode 100644 index 0000000..fd3ae92 --- /dev/null +++ b/reapi/include/cssdk/engine/bspfile.h @@ -0,0 +1,169 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define BSPVERSION 30 +#define MAX_MAP_HULLS 4 + +#define CONTENTS_ORIGIN -7 // removed at csg time +#define CONTENTS_CLIP -8 // changed to contents_solid +#define CONTENTS_CURRENT_0 -9 +#define CONTENTS_CURRENT_90 -10 +#define CONTENTS_CURRENT_180 -11 +#define CONTENTS_CURRENT_270 -12 +#define CONTENTS_CURRENT_UP -13 +#define CONTENTS_CURRENT_DOWN -14 + +#define CONTENTS_TRANSLUCENT -15 + +#define LUMP_ENTITIES 0 +#define LUMP_PLANES 1 +#define LUMP_TEXTURES 2 +#define LUMP_VERTEXES 3 +#define LUMP_VISIBILITY 4 +#define LUMP_NODES 5 +#define LUMP_TEXINFO 6 +#define LUMP_FACES 7 +#define LUMP_LIGHTING 8 +#define LUMP_CLIPNODES 9 +#define LUMP_LEAFS 10 +#define LUMP_MARKSURFACES 11 +#define LUMP_EDGES 12 +#define LUMP_SURFEDGES 13 +#define LUMP_MODELS 14 + +#define HEADER_LUMPS 15 + +/* ../engine/bspfile.h:41 */ +typedef struct lump_s +{ + int fileofs; + int filelen; +} lump_t; + +/* ../engine/bspfile.h:64 */ +typedef struct dmodel_s +{ + float mins[3], maxs[3]; + float origin[3]; + int headnode[MAX_MAP_HULLS]; + int visleafs; // not including the solid leaf 0 + int firstface, numfaces; +} dmodel_t; + +/* ../engine/bspfile.h:73 */ +typedef struct dheader_s +{ + int version; + lump_t lumps[15]; +} dheader_t; + +/* <485b2> ../engine/bspfile.h:79 */ +typedef struct dmiptexlump_s +{ + int _nummiptex; + int dataofs[4]; +} dmiptexlump_t; + +/* <1ce18> ../engine/bspfile.h:86 */ +typedef struct miptex_s +{ + char name[16]; + unsigned width; + unsigned height; + unsigned offsets[4]; +} miptex_t; + +/* <48652> ../engine/bspfile.h:94 */ +typedef struct dvertex_s +{ + float point[3]; +} dvertex_t; + +/* <48674> ../engine/bspfile.h:110 */ +typedef struct dplane_s +{ + float normal[3]; + float dist; + int type; +} dplane_t; + +/* <486b2> ../engine/bspfile.h:132 */ +typedef struct dnode_s +{ + int planenum; + short children[2]; + short mins[3]; + short maxs[3]; + unsigned short firstface; + unsigned short numfaces; +} dnode_t; + +/* ../engine/bspfile.h:142 */ +typedef struct dclipnode_s +{ + int planenum; + short children[2]; // negative numbers are contents +} dclipnode_t; + +/* <4876a> ../engine/bspfile.h:149 */ +typedef struct texinfo_s +{ + float vecs[2][4]; + int _miptex; + int flags; +} texinfo_t; + +/* <487c2> ../engine/bspfile.h:159 */ +typedef struct dedge_s +{ + unsigned short v[2]; +} dedge_t; + +/* <487f2> ../engine/bspfile.h:165 */ +typedef struct dface_s +{ + short planenum; + short side; + int firstedge; + short numedges; + short texinfo; + byte styles[4]; + int lightofs; +} dface_t; + +typedef struct dleaf_s +{ + int contents; + int visofs; + short mins[3]; + short maxs[3]; + unsigned short firstmarksurface; + unsigned short nummarksurfaces; + byte ambient_level[4]; +} dleaf_t; diff --git a/reapi/include/cssdk/engine/cmd_rehlds.h b/reapi/include/cssdk/engine/cmd_rehlds.h new file mode 100644 index 0000000..fe3b701 --- /dev/null +++ b/reapi/include/cssdk/engine/cmd_rehlds.h @@ -0,0 +1,53 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "archtypes.h" + +/* <8f1> ../engine/cmd.h:65 */ +typedef void(*xcommand_t)(void); + +/* <904> ../engine/cmd.h:71 */ +typedef struct cmd_function_s +{ + struct cmd_function_s *next; + char *name; + xcommand_t function; + int flags; +} cmd_function_t; + +/* <95a> ../engine/cmd.h:80 */ +typedef enum cmd_source_s +{ + src_client = 0, // came in over a net connection as a clc_stringcmd. host_client will be valid during this state. + src_command = 1, // from the command buffer. +} cmd_source_t; + +#define FCMD_HUD_COMMAND BIT(0) +#define FCMD_GAME_COMMAND BIT(1) +#define FCMD_WRAPPER_COMMAND BIT(2) diff --git a/reapi/include/cssdk/engine/common_rehlds.h b/reapi/include/cssdk/engine/common_rehlds.h new file mode 100644 index 0000000..c7c4ed7 --- /dev/null +++ b/reapi/include/cssdk/engine/common_rehlds.h @@ -0,0 +1,81 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "const.h" +#include "qlimits.h" + +#ifdef REHLDS_FIXES +#define COM_TOKEN_LEN 2048 +#else +#define COM_TOKEN_LEN 1024 +#endif + +// Don't allow overflow +#define SIZEBUF_CHECK_OVERFLOW 0 +#define SIZEBUF_ALLOW_OVERFLOW BIT(0) +#define SIZEBUF_OVERFLOWED BIT(1) + +#define MAX_NUM_ARGVS 50 +#define NUM_SAFE_ARGVS 7 + +#define COM_COPY_CHUNK_SIZE 1024 +#define COM_MAX_CMD_LINE 256 + +/* <6ae> ../common/common.h:82 */ +typedef struct sizebuf_s +{ + const char *buffername; + uint16 flags; + byte *data; + int maxsize; + int cursize; +} sizebuf_t; + +/* <270aa> ../common/common.h:297 */ +typedef struct downloadtime_s +{ + qboolean bUsed; + float fTime; + int nBytesRemaining; +} downloadtime_t; + +/* <19fa2> ../common/common.h:303 */ +typedef struct incomingtransfer_s +{ + qboolean doneregistering; + int percent; + qboolean downloadrequested; + downloadtime_t rgStats[8]; + int nCurStat; + int nTotalSize; + int nTotalToTransfer; + int nRemainingToTransfer; + float fLastStatusUpdate; + qboolean custom; +} incomingtransfer_t; diff --git a/reapi/include/cssdk/engine/crc32c.cpp b/reapi/include/cssdk/engine/crc32c.cpp new file mode 100644 index 0000000..1220c50 --- /dev/null +++ b/reapi/include/cssdk/engine/crc32c.cpp @@ -0,0 +1,143 @@ +/* +Copyright (C) 2010 by Ronnie Sahlberg +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. +You should have received a copy of the GNU Lesser General Public License +along with this program; if not, see . +*/ + +#include "crc32c.h" +#include "sys_shared.h" +#include "immintrin.h" + +/*****************************************************************/ +/* */ +/* CRC LOOKUP TABLE */ +/* ================ */ +/* The following CRC lookup table was generated automagically */ +/* by the Rocksoft^tm Model CRC Algorithm Table Generation */ +/* Program V1.0 using the following model parameters: */ +/* */ +/* Width : 4 bytes. */ +/* Poly : 0x1EDC6F41L */ +/* Reverse : TRUE. */ +/* */ +/* For more information on the Rocksoft^tm Model CRC Algorithm, */ +/* see the document titled "A Painless Guide to CRC Error */ +/* Detection Algorithms" by Ross Williams */ +/* (ross@guest.adelaide.edu.au.). This document is likely to be */ +/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ +/* */ +/*****************************************************************/ + +static uint32 crctable[256] = { + 0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, + 0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, + 0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL, + 0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L, + 0x105EC76FL, 0xE235446CL, 0xF165B798L, 0x030E349BL, + 0xD7C45070L, 0x25AFD373L, 0x36FF2087L, 0xC494A384L, + 0x9A879FA0L, 0x68EC1CA3L, 0x7BBCEF57L, 0x89D76C54L, + 0x5D1D08BFL, 0xAF768BBCL, 0xBC267848L, 0x4E4DFB4BL, + 0x20BD8EDEL, 0xD2D60DDDL, 0xC186FE29L, 0x33ED7D2AL, + 0xE72719C1L, 0x154C9AC2L, 0x061C6936L, 0xF477EA35L, + 0xAA64D611L, 0x580F5512L, 0x4B5FA6E6L, 0xB93425E5L, + 0x6DFE410EL, 0x9F95C20DL, 0x8CC531F9L, 0x7EAEB2FAL, + 0x30E349B1L, 0xC288CAB2L, 0xD1D83946L, 0x23B3BA45L, + 0xF779DEAEL, 0x05125DADL, 0x1642AE59L, 0xE4292D5AL, + 0xBA3A117EL, 0x4851927DL, 0x5B016189L, 0xA96AE28AL, + 0x7DA08661L, 0x8FCB0562L, 0x9C9BF696L, 0x6EF07595L, + 0x417B1DBCL, 0xB3109EBFL, 0xA0406D4BL, 0x522BEE48L, + 0x86E18AA3L, 0x748A09A0L, 0x67DAFA54L, 0x95B17957L, + 0xCBA24573L, 0x39C9C670L, 0x2A993584L, 0xD8F2B687L, + 0x0C38D26CL, 0xFE53516FL, 0xED03A29BL, 0x1F682198L, + 0x5125DAD3L, 0xA34E59D0L, 0xB01EAA24L, 0x42752927L, + 0x96BF4DCCL, 0x64D4CECFL, 0x77843D3BL, 0x85EFBE38L, + 0xDBFC821CL, 0x2997011FL, 0x3AC7F2EBL, 0xC8AC71E8L, + 0x1C661503L, 0xEE0D9600L, 0xFD5D65F4L, 0x0F36E6F7L, + 0x61C69362L, 0x93AD1061L, 0x80FDE395L, 0x72966096L, + 0xA65C047DL, 0x5437877EL, 0x4767748AL, 0xB50CF789L, + 0xEB1FCBADL, 0x197448AEL, 0x0A24BB5AL, 0xF84F3859L, + 0x2C855CB2L, 0xDEEEDFB1L, 0xCDBE2C45L, 0x3FD5AF46L, + 0x7198540DL, 0x83F3D70EL, 0x90A324FAL, 0x62C8A7F9L, + 0xB602C312L, 0x44694011L, 0x5739B3E5L, 0xA55230E6L, + 0xFB410CC2L, 0x092A8FC1L, 0x1A7A7C35L, 0xE811FF36L, + 0x3CDB9BDDL, 0xCEB018DEL, 0xDDE0EB2AL, 0x2F8B6829L, + 0x82F63B78L, 0x709DB87BL, 0x63CD4B8FL, 0x91A6C88CL, + 0x456CAC67L, 0xB7072F64L, 0xA457DC90L, 0x563C5F93L, + 0x082F63B7L, 0xFA44E0B4L, 0xE9141340L, 0x1B7F9043L, + 0xCFB5F4A8L, 0x3DDE77ABL, 0x2E8E845FL, 0xDCE5075CL, + 0x92A8FC17L, 0x60C37F14L, 0x73938CE0L, 0x81F80FE3L, + 0x55326B08L, 0xA759E80BL, 0xB4091BFFL, 0x466298FCL, + 0x1871A4D8L, 0xEA1A27DBL, 0xF94AD42FL, 0x0B21572CL, + 0xDFEB33C7L, 0x2D80B0C4L, 0x3ED04330L, 0xCCBBC033L, + 0xA24BB5A6L, 0x502036A5L, 0x4370C551L, 0xB11B4652L, + 0x65D122B9L, 0x97BAA1BAL, 0x84EA524EL, 0x7681D14DL, + 0x2892ED69L, 0xDAF96E6AL, 0xC9A99D9EL, 0x3BC21E9DL, + 0xEF087A76L, 0x1D63F975L, 0x0E330A81L, 0xFC588982L, + 0xB21572C9L, 0x407EF1CAL, 0x532E023EL, 0xA145813DL, + 0x758FE5D6L, 0x87E466D5L, 0x94B49521L, 0x66DF1622L, + 0x38CC2A06L, 0xCAA7A905L, 0xD9F75AF1L, 0x2B9CD9F2L, + 0xFF56BD19L, 0x0D3D3E1AL, 0x1E6DCDEEL, 0xEC064EEDL, + 0xC38D26C4L, 0x31E6A5C7L, 0x22B65633L, 0xD0DDD530L, + 0x0417B1DBL, 0xF67C32D8L, 0xE52CC12CL, 0x1747422FL, + 0x49547E0BL, 0xBB3FFD08L, 0xA86F0EFCL, 0x5A048DFFL, + 0x8ECEE914L, 0x7CA56A17L, 0x6FF599E3L, 0x9D9E1AE0L, + 0xD3D3E1ABL, 0x21B862A8L, 0x32E8915CL, 0xC083125FL, + 0x144976B4L, 0xE622F5B7L, 0xF5720643L, 0x07198540L, + 0x590AB964L, 0xAB613A67L, 0xB831C993L, 0x4A5A4A90L, + 0x9E902E7BL, 0x6CFBAD78L, 0x7FAB5E8CL, 0x8DC0DD8FL, + 0xE330A81AL, 0x115B2B19L, 0x020BD8EDL, 0xF0605BEEL, + 0x24AA3F05L, 0xD6C1BC06L, 0xC5914FF2L, 0x37FACCF1L, + 0x69E9F0D5L, 0x9B8273D6L, 0x88D28022L, 0x7AB90321L, + 0xAE7367CAL, 0x5C18E4C9L, 0x4F48173DL, 0xBD23943EL, + 0xF36E6F75L, 0x0105EC76L, 0x12551F82L, 0xE03E9C81L, + 0x34F4F86AL, 0xC69F7B69L, 0xD5CF889DL, 0x27A40B9EL, + 0x79B737BAL, 0x8BDCB4B9L, 0x988C474DL, 0x6AE7C44EL, + 0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L +}; + +uint32 crc32c_t8_nosse(uint32 iCRC, uint8 u8) { + return (iCRC >> 8) ^ crctable[(iCRC ^ u8) & 0xFF]; +} + +uint32 crc32c_t_nosse(uint32 iCRC, const uint8 *buf, int len) { + uint32 crc = iCRC; + while (len-- > 0) { + crc = (crc >> 8) ^ crctable[(crc ^ (*buf++)) & 0xFF]; + } + return crc; +} + +uint32 crc32c_t8_sse(uint32 iCRC, uint8 u8) { + return _mm_crc32_u8(iCRC, u8); +} + +uint32 crc32c_t_sse(uint32 iCRC, const uint8 *buf, unsigned int len) { + uint32 crc32cval = iCRC; + unsigned int i = 0; + + for (; i < (len >> 2); i += 4) { + crc32cval = _mm_crc32_u32(crc32cval, *(uint32*)&buf[i]); + } + + for (; i < len; i++) { + crc32cval = _mm_crc32_u8(crc32cval, buf[i]); + } + + return crc32cval; +} + +uint32 crc32c_t(uint32 iCRC, const uint8 *buf, unsigned int len) { + return cpuinfo.sse4_2 ? crc32c_t_sse(iCRC, buf, len) : crc32c_t_nosse(iCRC, buf, len); +} + +uint32 crc32c(const uint8 *buf, int len) { + return crc32c_t(0xffffffff, buf, len); +} diff --git a/reapi/include/cssdk/engine/crc32c.h b/reapi/include/cssdk/engine/crc32c.h new file mode 100644 index 0000000..892919b --- /dev/null +++ b/reapi/include/cssdk/engine/crc32c.h @@ -0,0 +1,22 @@ +/* +Copyright (C) 2010 by Ronnie Sahlberg +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. +You should have received a copy of the GNU Lesser General Public License +along with this program; if not, see . +*/ +#pragma once +#include "archtypes.h" + +extern uint32 crc32c_t8_nosse(uint32 iCRC, uint8 u8); +extern uint32 crc32c_t8_sse(uint32 iCRC, uint8 u8); +extern uint32 crc32c_t_nosse(uint32 iCRC, const uint8 *buf, int len); +extern uint32 crc32c_t_sse(uint32 iCRC, const uint8 *buf, unsigned int len); +extern uint32 crc32c_t(uint32 iCRC, const uint8 *buf, unsigned int len); +extern uint32 crc32c(const uint8 *buf, int len); diff --git a/reapi/include/cssdk/engine/custom.h b/reapi/include/cssdk/engine/custom.h new file mode 100644 index 0000000..5a5156e --- /dev/null +++ b/reapi/include/cssdk/engine/custom.h @@ -0,0 +1,96 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +// Customization.h +#pragma once + +#include "const.h" + +#define MAX_QPATH 64 // Must match value in quakedefs.h +#define MAX_RESOURCE_LIST 1280 + +///////////////// +// Customization +// passed to pfnPlayerCustomization +// For automatic downloading. +typedef enum +{ + t_sound = 0, + t_skin, + t_model, + t_decal, + t_generic, + t_eventscript, + t_world, // Fake type for world, is really t_model + rt_unk, + + rt_max +} resourcetype_t; + + +typedef struct +{ + int size; +} _resourceinfo_t; + +typedef struct resourceinfo_s +{ + _resourceinfo_t info[ rt_max ]; +} resourceinfo_t; + +#define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file. +#define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok? +#define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization + // or is it a server startup resource. +#define RES_REQUESTED (1<<3) // Already requested a download of this one +#define RES_PRECACHED (1<<4) // Already precached +#define RES_ALWAYS (1<<5) // download always even if available on client +#define RES_UNK_6 (1<<6) // TODO: what is it? +#define RES_CHECKFILE (1<<7) // check file on client + +#include "crc.h" + +typedef struct resource_s +{ + char szFileName[MAX_QPATH]; // File name to download/precache. + resourcetype_t type; // t_sound, t_skin, t_model, t_decal. + int nIndex; // For t_decals + int nDownloadSize; // Size in Bytes if this must be downloaded. + unsigned char ucFlags; + +// For handling client to client resource propagation + unsigned char rgucMD5_hash[16]; // To determine if we already have it. + unsigned char playernum; // Which player index this resource is associated with, if it's a custom resource. + + unsigned char rguc_reserved[ 32 ]; // For future expansion + struct resource_s *pNext; // Next in chain. + struct resource_s *pPrev; +} resource_t; + +typedef struct customization_s +{ + qboolean bInUse; // Is this customization in use; + resource_t resource; // The resource_t for this customization + qboolean bTranslated; // Has the raw data been translated into a useable format? + // (e.g., raw decal .wad make into texture_t *) + int nUserData1; // Customization specific data + int nUserData2; // Customization specific data + void *pInfo; // Buffer that holds the data structure that references the data (e.g., the cachewad_t) + void *pBuffer; // Buffer that holds the data for the customization (the raw .wad data) + struct customization_s *pNext; // Next in chain +} customization_t; + +#define FCUST_FROMHPAK ( 1<<0 ) +#define FCUST_WIPEDATA ( 1<<1 ) +#define FCUST_IGNOREINIT ( 1<<2 ) diff --git a/reapi/include/cssdk/engine/customentity.h b/reapi/include/cssdk/engine/customentity.h new file mode 100644 index 0000000..0895bee --- /dev/null +++ b/reapi/include/cssdk/engine/customentity.h @@ -0,0 +1,38 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#ifndef CUSTOMENTITY_H +#define CUSTOMENTITY_H + +// Custom Entities + +// Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12) +#define BEAMENT_ENTITY(x) ((x)&0xFFF) +#define BEAMENT_ATTACHMENT(x) (((x)>>12)&0xF) + +// Beam types, encoded as a byte +enum +{ + BEAM_POINTS = 0, + BEAM_ENTPOINT, + BEAM_ENTS, + BEAM_HOSE, +}; + +#define BEAM_FSINE 0x10 +#define BEAM_FSOLID 0x20 +#define BEAM_FSHADEIN 0x40 +#define BEAM_FSHADEOUT 0x80 + +#endif //CUSTOMENTITY_H diff --git a/reapi/include/cssdk/engine/d_local.h b/reapi/include/cssdk/engine/d_local.h new file mode 100644 index 0000000..8bf396d --- /dev/null +++ b/reapi/include/cssdk/engine/d_local.h @@ -0,0 +1,46 @@ +/* +* +* 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. +* +*/ + +#pragma once + + + +/* <82286> ../engine/d_local.h:20 */ +typedef struct surfcache_s +{ + struct surfcache_s *next; + struct surfcache_s **owner; + int lightadj[4]; + int dlight; + int size; + unsigned width; + unsigned height; + float mipscale; + struct texture_s *texture; + unsigned char data[4]; +} surfcache_t; diff --git a/reapi/include/cssdk/engine/edict.h b/reapi/include/cssdk/engine/edict.h new file mode 100644 index 0000000..9a38993 --- /dev/null +++ b/reapi/include/cssdk/engine/edict.h @@ -0,0 +1,36 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#if !defined EDICT_H +#define EDICT_H +#ifdef _WIN32 +#pragma once +#endif +#define MAX_ENT_LEAFS 48 + +#include "progdefs.h" + +struct edict_s +{ + qboolean free; + int serialnumber; + link_t area; // linked to a division node or leaf + + int headnode; // -1 to use normal leaf check + int num_leafs; + short leafnums[MAX_ENT_LEAFS]; + + float freetime; // sv.time when the object was freed + + void* pvPrivateData; // Alloced and freed by engine, used by DLLs + + entvars_t v; // C exported fields from progs + + // other fields from progs come immediately after +}; + +#endif diff --git a/reapi/include/cssdk/engine/eiface.h b/reapi/include/cssdk/engine/eiface.h new file mode 100644 index 0000000..641a4b9 --- /dev/null +++ b/reapi/include/cssdk/engine/eiface.h @@ -0,0 +1,536 @@ +/*** +* +* Copyright (c) 1999, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#pragma once + +#include "archtypes.h" // DAL + +#ifdef HLDEMO_BUILD +#define INTERFACE_VERSION 001 +#else // !HLDEMO_BUILD, i.e., regular version of HL +#define INTERFACE_VERSION 140 +#endif // !HLDEMO_BUILD + +#include +#include "custom.h" +#include "cvardef.h" +#include "Sequence.h" +// +// Defines entity interface between engine and DLLs. +// This header file included by engine files and DLL files. +// +// Before including this header, DLLs must: +// include progdefs.h +// This is conveniently done for them in extdll.h +// + +/* +#ifdef _WIN32 +#define DLLEXPORT __stdcall +#else +#define DLLEXPORT __attribute__ ((visibility("default"))) +#endif +*/ + +enum ALERT_TYPE +{ + at_notice, + at_console, // same as at_notice, but forces a ConPrintf, not a message box + at_aiconsole, // same as at_console, but only shown if developer level is 2! + at_warning, + at_error, + at_logged // Server print to console ( only in multiplayer games ). +}; + +// 4-22-98 JOHN: added for use in pfnClientPrintf +enum PRINT_TYPE +{ + print_console, + print_center, + print_chat, +}; + +// For integrity checking of content on clients +enum FORCE_TYPE +{ + force_exactfile, // File on client must exactly match server's file + force_model_samebounds, // For model files only, the geometry must fit in the same bbox + force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox + force_model_specifybounds_if_avail, // For Steam model files only, the geometry must fit in the specified bbox (if the file is available) +}; + +// Returned by TraceLine +struct TraceResult +{ + int fAllSolid; // if true, plane is not valid + int fStartSolid; // if true, the initial point was in a solid area + int fInOpen; + int fInWater; + float flFraction; // time completed, 1.0 = didn't hit anything + vec3_t vecEndPos; // final position + float flPlaneDist; + vec3_t vecPlaneNormal; // surface normal at impact + edict_t *pHit; // entity the surface is on + int iHitgroup; // 0 == generic, non zero is specific body part +}; + +// CD audio status +typedef struct +{ + int fPlaying;// is sound playing right now? + int fWasPlaying;// if not, CD is paused if WasPlaying is true. + int fInitialized; + int fEnabled; + int fPlayLooping; + float cdvolume; + //BYTE remap[100]; + int fCDRom; + int fPlayTrack; +} CDStatus; + +#include "../common/crc.h" + + +// Engine hands this to DLLs for functionality callbacks +typedef struct enginefuncs_s +{ + int (*pfnPrecacheModel) (const char* s); + int (*pfnPrecacheSound) (const char* s); + void (*pfnSetModel) (edict_t *e, const char *m); + int (*pfnModelIndex) (const char *m); + int (*pfnModelFrames) (int modelIndex); + void (*pfnSetSize) (edict_t *e, const float *rgflMin, const float *rgflMax); + void (*pfnChangeLevel) (const char* s1, const char* s2); + void (*pfnGetSpawnParms) (edict_t *ent); + void (*pfnSaveSpawnParms) (edict_t *ent); + float (*pfnVecToYaw) (const float *rgflVector); + void (*pfnVecToAngles) (const float *rgflVectorIn, float *rgflVectorOut); + void (*pfnMoveToOrigin) (edict_t *ent, const float *pflGoal, float dist, int iMoveType); + void (*pfnChangeYaw) (edict_t* ent); + void (*pfnChangePitch) (edict_t* ent); + edict_t* (*pfnFindEntityByString) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); + int (*pfnGetEntityIllum) (edict_t* pEnt); + edict_t* (*pfnFindEntityInSphere) (edict_t *pEdictStartSearchAfter, const float *org, float rad); + edict_t* (*pfnFindClientInPVS) (edict_t *pEdict); + edict_t* (*pfnEntitiesInPVS) (edict_t *pplayer); + void (*pfnMakeVectors) (const float *rgflVector); + void (*pfnAngleVectors) (const float *rgflVector, float *forward, float *right, float *up); + edict_t* (*pfnCreateEntity) (void); + void (*pfnRemoveEntity) (edict_t* e); + edict_t* (*pfnCreateNamedEntity) (int className); + void (*pfnMakeStatic) (edict_t *ent); + int (*pfnEntIsOnFloor) (edict_t *e); + int (*pfnDropToFloor) (edict_t* e); + int (*pfnWalkMove) (edict_t *ent, float yaw, float dist, int iMode); + void (*pfnSetOrigin) (edict_t *e, const float *rgflOrigin); + void (*pfnEmitSound) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); + void (*pfnEmitAmbientSound) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); + void (*pfnTraceLine) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); + void (*pfnTraceToss) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr); + int (*pfnTraceMonsterHull) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); + void (*pfnTraceHull) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); + void (*pfnTraceModel) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); + const char *(*pfnTraceTexture) (edict_t *pTextureEntity, const float *v1, const float *v2 ); + void (*pfnTraceSphere) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); + void (*pfnGetAimVector) (edict_t* ent, float speed, float *rgflReturn); + void (*pfnServerCommand) (char* str); + void (*pfnServerExecute) (void); + void (*pfnClientCommand) (edict_t* pEdict, char* szFmt, ...); + void (*pfnParticleEffect) (const float *org, const float *dir, float color, float count); + void (*pfnLightStyle) (int style, char* val); + int (*pfnDecalIndex) (const char *name); + int (*pfnPointContents) (const float *rgflVector); + void (*pfnMessageBegin) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); + void (*pfnMessageEnd) (void); + void (*pfnWriteByte) (int iValue); + void (*pfnWriteChar) (int iValue); + void (*pfnWriteShort) (int iValue); + void (*pfnWriteLong) (int iValue); + void (*pfnWriteAngle) (float flValue); + void (*pfnWriteCoord) (float flValue); + void (*pfnWriteString) (const char *sz); + void (*pfnWriteEntity) (int iValue); + void (*pfnCVarRegister) (cvar_t *pCvar); + float (*pfnCVarGetFloat) (const char *szVarName); + const char* (*pfnCVarGetString) (const char *szVarName); + void (*pfnCVarSetFloat) (const char *szVarName, float flValue); + void (*pfnCVarSetString) (const char *szVarName, const char *szValue); + void (*pfnAlertMessage) (ALERT_TYPE atype, const char *szFmt, ...); + void (*pfnEngineFprintf) (void *pfile, const char *szFmt, ...); + void* (*pfnPvAllocEntPrivateData) (edict_t *pEdict, int32 cb); + void* (*pfnPvEntPrivateData) (edict_t *pEdict); + void (*pfnFreeEntPrivateData) (edict_t *pEdict); + const char* (*pfnSzFromIndex) (int iString); + int (*pfnAllocString) (const char *szValue); + struct entvars_s* (*pfnGetVarsOfEnt) (edict_t *pEdict); + edict_t* (*pfnPEntityOfEntOffset) (int iEntOffset); + int (*pfnEntOffsetOfPEntity) (const edict_t *pEdict); + int (*pfnIndexOfEdict) (const edict_t *pEdict); + edict_t* (*pfnPEntityOfEntIndex) (int iEntIndex); + edict_t* (*pfnFindEntityByVars) (struct entvars_s* pvars); + void* (*pfnGetModelPtr) (edict_t* pEdict); + int (*pfnRegUserMsg) (const char *pszName, int iSize); + void (*pfnAnimationAutomove) (const edict_t* pEdict, float flTime); + void (*pfnGetBonePosition) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); + uint32 (*pfnFunctionFromName) ( const char *pName ); + const char *(*pfnNameForFunction) ( uint32 function ); + void (*pfnClientPrintf) ( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients + void (*pfnServerPrint) ( const char *szMsg ); + const char *(*pfnCmd_Args) ( void ); // these 3 added + const char *(*pfnCmd_Argv) ( int argc ); // so game DLL can easily + int (*pfnCmd_Argc) ( void ); // access client 'cmd' strings + void (*pfnGetAttachment) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); + void (*pfnCRC32_Init) (CRC32_t *pulCRC); + void (*pfnCRC32_ProcessBuffer) (CRC32_t *pulCRC, void *p, int len); + void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, unsigned char ch); + CRC32_t (*pfnCRC32_Final) (CRC32_t pulCRC); + int32 (*pfnRandomLong) (int32 lLow, int32 lHigh); + float (*pfnRandomFloat) (float flLow, float flHigh); + void (*pfnSetView) (const edict_t *pClient, const edict_t *pViewent ); + float (*pfnTime) ( void ); + void (*pfnCrosshairAngle) (const edict_t *pClient, float pitch, float yaw); + byte * (*pfnLoadFileForMe) (char *filename, int *pLength); + void (*pfnFreeFile) (void *buffer); + void (*pfnEndSection) (const char *pszSectionName); // trigger_endsection + int (*pfnCompareFileTime) (char *filename1, char *filename2, int *iCompare); + void (*pfnGetGameDir) (char *szGetGameDir); + void (*pfnCvar_RegisterVariable) (cvar_t *variable); + void (*pfnFadeClientVolume) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); + void (*pfnSetClientMaxspeed) (edict_t *pEdict, float fNewMaxspeed); + edict_t * (*pfnCreateFakeClient) (const char *netname); // returns NULL if fake client can't be created + void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); + int (*pfnNumberOfEntities) (void); + char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo + char* (*pfnInfoKeyValue) (char *infobuffer, const char *key); + void (*pfnSetKeyValue) (char *infobuffer, const char *key, const char *value); + void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, const char *key, const char *value); + int (*pfnIsMapValid) (char *filename); + void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); + int (*pfnPrecacheGeneric) (char* s); + int (*pfnGetPlayerUserId) (edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients + void (*pfnBuildSoundMsg) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); + int (*pfnIsDedicatedServer) (void);// is this a dedicated server? + cvar_t *(*pfnCVarGetPointer) (const char *szVarName); + unsigned int (*pfnGetPlayerWONId) (edict_t *e); // returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients + + // YWB 8/1/99 TFF Physics additions + void (*pfnInfo_RemoveKey) ( char *s, const char *key ); + const char *(*pfnGetPhysicsKeyValue) ( const edict_t *pClient, const char *key ); + void (*pfnSetPhysicsKeyValue) ( const edict_t *pClient, const char *key, const char *value ); + const char *(*pfnGetPhysicsInfoString) ( const edict_t *pClient ); + unsigned short (*pfnPrecacheEvent) ( int type, const char*psz ); + void (*pfnPlaybackEvent) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); + + unsigned char *(*pfnSetFatPVS) ( float *org ); + unsigned char *(*pfnSetFatPAS) ( float *org ); + + int (*pfnCheckVisibility ) ( edict_t *entity, unsigned char *pset ); + + void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname ); + void (*pfnDeltaUnsetField) ( struct delta_s *pFields, const char *fieldname ); + void (*pfnDeltaAddEncoder) ( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); + int (*pfnGetCurrentPlayer) ( void ); + int (*pfnCanSkipPlayer) ( const edict_t *player ); + int (*pfnDeltaFindField) ( struct delta_s *pFields, const char *fieldname ); + void (*pfnDeltaSetFieldByIndex) ( struct delta_s *pFields, int fieldNumber ); + void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber ); + + void (*pfnSetGroupMask) ( int mask, int op ); + + int (*pfnCreateInstancedBaseline) ( int classname, struct entity_state_s *baseline ); + void (*pfnCvar_DirectSet) ( struct cvar_s *var, const char *value ); + + // Forces the client and server to be running with the same version of the specified file + // ( e.g., a player model ). + // Calling this has no effect in single player + void (*pfnForceUnmodified) ( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); + + void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss ); + + void (*pfnAddServerCommand) ( char *cmd_name, void (*function) (void) ); + + // For voice communications, set which clients hear eachother. + // NOTE: these functions take player entity indices (starting at 1). + qboolean (*pfnVoice_GetClientListening)(int iReceiver, int iSender); + qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen); + + const char *(*pfnGetPlayerAuthId) ( edict_t *e ); + + // PSV: Added for CZ training map +// const char *(*pfnKeyNameForBinding) ( const char* pBinding ); + + sequenceEntry_s* (*pfnSequenceGet) ( const char* fileName, const char* entryName ); + sentenceEntry_s* (*pfnSequencePickSentence) ( const char* groupName, int pickMethod, int *picked ); + + // LH: Give access to filesize via filesystem + int (*pfnGetFileSize) ( char *filename ); + + unsigned int (*pfnGetApproxWavePlayLen) (const char *filepath); + // MDC: Added for CZ career-mode + int (*pfnIsCareerMatch) ( void ); + + // BGC: return the number of characters of the localized string referenced by using "label" + int (*pfnGetLocalizedStringLength) (const char *label); + + // BGC: added to facilitate persistent storage of tutor message decay values for + // different career game profiles. Also needs to persist regardless of mp.dll being + // destroyed and recreated. + void (*pfnRegisterTutorMessageShown) (int mid); + int (*pfnGetTimesTutorMessageShown) (int mid); + void (*pfnProcessTutorMessageDecayBuffer) (int *buffer, int bufferLength); + void (*pfnConstructTutorMessageDecayBuffer) (int *buffer, int bufferLength); + void (*pfnResetTutorMessageDecayData) ( void ); + + // Added 2005/08/11 (no SDK update): + void(*pfnQueryClientCvarValue) (const edict_t *player, const char *cvarName); + + // Added 2005/11/21 (no SDK update): + void(*pfnQueryClientCvarValue2) (const edict_t *player, const char *cvarName, int requestID); + + // Added 2009/06/19 (no SDK update): + // int(*pfnEngCheckParm) (const char *pchCmdLineToken, char **ppnext); // s1lent: comment out this, for compatibility with older versions metamod +} enginefuncs_t; + + +// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 + +// Passed to pfnKeyValue +typedef struct KeyValueData_s +{ + char *szClassName; // in: entity classname + char *szKeyName; // in: name of key + char *szValue; // in: value of key + qboolean fHandled; // out: DLL sets to true if key-value pair was understood +} KeyValueData; + + +typedef struct +{ + char mapName[ 32 ]; + char landmarkName[ 32 ]; + edict_t *pentLandmark; + vec3_t vecLandmarkOrigin; +} LEVELLIST; +#define MAX_LEVEL_CONNECTIONS 16 // These are encoded in the lower 16bits of ENTITYTABLE->flags + +typedef struct +{ + int id; // Ordinal ID of this entity (used for entity <--> pointer conversions) + edict_t *pent; // Pointer to the in-game entity + + int location; // Offset from the base data of this entity + int size; // Byte size of this entity's data + int flags; // This could be a short -- bit mask of transitions that this entity is in the PVS of + string_t classname; // entity class name + +} ENTITYTABLE; + +#define FENTTABLE_PLAYER 0x80000000 +#define FENTTABLE_REMOVED 0x40000000 +#define FENTTABLE_MOVEABLE 0x20000000 +#define FENTTABLE_GLOBAL 0x10000000 + +typedef struct saverestore_s SAVERESTOREDATA; + +#ifdef _WIN32 +typedef +#endif +struct saverestore_s +{ + char *pBaseData; // Start of all entity save data + char *pCurrentData; // Current buffer pointer for sequential access + int size; // Current data size + int bufferSize; // Total space for data + int tokenSize; // Size of the linear list of tokens + int tokenCount; // Number of elements in the pTokens table + char **pTokens; // Hash table of entity strings (sparse) + int currentIndex; // Holds a global entity table ID + int tableCount; // Number of elements in the entity table + int connectionCount;// Number of elements in the levelList[] + ENTITYTABLE *pTable; // Array of ENTITYTABLE elements (1 for each entity) + LEVELLIST levelList[ MAX_LEVEL_CONNECTIONS ]; // List of connections from this level + + // smooth transition + int fUseLandmark; + char szLandmarkName[20];// landmark we'll spawn near in next level + vec3_t vecLandmarkOffset;// for landmark transitions + float time; + char szCurrentMapName[32]; // To check global entities + +} +#ifdef _WIN32 +SAVERESTOREDATA +#endif +; + +typedef enum _fieldtypes +{ + FIELD_FLOAT = 0, // Any floating point value + FIELD_STRING, // A string ID (return from ALLOC_STRING) + FIELD_ENTITY, // An entity offset (EOFFSET) + FIELD_CLASSPTR, // CBaseEntity * + FIELD_EHANDLE, // Entity handle + FIELD_EVARS, // EVARS * + FIELD_EDICT, // edict_t *, or edict_t * (same thing) + FIELD_VECTOR, // Any vector + FIELD_POSITION_VECTOR, // A world coordinate (these are fixed up across level transitions automagically) + FIELD_POINTER, // Arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER + FIELD_INTEGER, // Any integer or enum + FIELD_FUNCTION, // A class function pointer (Think, Use, etc) + FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression + FIELD_SHORT, // 2 byte integer + FIELD_CHARACTER, // a byte + FIELD_TIME, // a floating point time (these are fixed up automatically too!) + FIELD_MODELNAME, // Engine string that is a model name (needs precache) + FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache) + + FIELD_TYPECOUNT, // MUST BE LAST +} FIELDTYPE; + +#if !defined(offsetof) && !defined(GNUC) +#define offsetof(s,m) (size_t)&(((s *)0)->m) +#endif + +#define _FIELD(type,name,fieldtype,count,flags) { fieldtype, #name, offsetof(type, name), count, flags } +#define DEFINE_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, 0) +#define DEFINE_ARRAY(type,name,fieldtype,count) _FIELD(type, name, fieldtype, count, 0) +#define DEFINE_ENTITY_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, 0 ) +#define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, FTYPEDESC_GLOBAL ) +#define DEFINE_GLOBAL_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, FTYPEDESC_GLOBAL ) + + +#define FTYPEDESC_GLOBAL 0x0001 // This field is masked for global entity save/restore + +typedef struct +{ + FIELDTYPE fieldType; + char *fieldName; + int fieldOffset; + short fieldSize; + short flags; +} TYPEDESCRIPTION; + +#ifndef ARRAYSIZE +#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0])) +#endif + +typedef struct +{ + // Initialize/shutdown the game (one-time call after loading of game .dll ) + void (*pfnGameInit) ( void ); + int (*pfnSpawn) ( edict_t *pent ); + void (*pfnThink) ( edict_t *pent ); + void (*pfnUse) ( edict_t *pentUsed, edict_t *pentOther ); + void (*pfnTouch) ( edict_t *pentTouched, edict_t *pentOther ); + void (*pfnBlocked) ( edict_t *pentBlocked, edict_t *pentOther ); + void (*pfnKeyValue) ( edict_t *pentKeyvalue, KeyValueData *pkvd ); + void (*pfnSave) ( edict_t *pent, SAVERESTOREDATA *pSaveData ); + int (*pfnRestore) ( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ); + void (*pfnSetAbsBox) ( edict_t *pent ); + + void (*pfnSaveWriteFields) ( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int ); + void (*pfnSaveReadFields) ( SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int ); + + void (*pfnSaveGlobalState) ( SAVERESTOREDATA * ); + void (*pfnRestoreGlobalState) ( SAVERESTOREDATA * ); + void (*pfnResetGlobalState) ( void ); + + qboolean (*pfnClientConnect) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ); + + void (*pfnClientDisconnect) ( edict_t *pEntity ); + void (*pfnClientKill) ( edict_t *pEntity ); + void (*pfnClientPutInServer) ( edict_t *pEntity ); + void (*pfnClientCommand) ( edict_t *pEntity ); + void (*pfnClientUserInfoChanged)( edict_t *pEntity, char *infobuffer ); + + void (*pfnServerActivate) ( edict_t *pEdictList, int edictCount, int clientMax ); + void (*pfnServerDeactivate) ( void ); + + void (*pfnPlayerPreThink) ( edict_t *pEntity ); + void (*pfnPlayerPostThink) ( edict_t *pEntity ); + + void (*pfnStartFrame) ( void ); + void (*pfnParmsNewLevel) ( void ); + void (*pfnParmsChangeLevel) ( void ); + + // Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life + const char *(*pfnGetGameDescription)( void ); + + // Notify dll about a player customization. + void (*pfnPlayerCustomization) ( edict_t *pEntity, customization_t *pCustom ); + + // Spectator funcs + void (*pfnSpectatorConnect) ( edict_t *pEntity ); + void (*pfnSpectatorDisconnect) ( edict_t *pEntity ); + void (*pfnSpectatorThink) ( edict_t *pEntity ); + + // Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. + void (*pfnSys_Error) ( const char *error_string ); + + void (*pfnPM_Move) ( struct playermove_s *ppmove, qboolean server ); + void (*pfnPM_Init) ( struct playermove_s *ppmove ); + char (*pfnPM_FindTextureType)( char *name ); + void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas ); + void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ); + int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); + void (*pfnCreateBaseline) ( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ); + void (*pfnRegisterEncoders) ( void ); + int (*pfnGetWeaponData) ( struct edict_s *player, struct weapon_data_s *info ); + + void (*pfnCmdStart) ( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ); + void (*pfnCmdEnd) ( const edict_t *player ); + + // Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max + // size of the response_buffer, so you must zero it out if you choose not to respond. + int (*pfnConnectionlessPacket ) ( const struct netadr_s *net_from_, const char *args, char *response_buffer, int *response_buffer_size ); + + // Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise + int (*pfnGetHullBounds) ( int hullnumber, float *mins, float *maxs ); + + // Create baselines for certain "unplaced" items. + void (*pfnCreateInstancedBaselines) ( void ); + + // One of the pfnForceUnmodified files failed the consistency check for the specified player + // Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters ) + int (*pfnInconsistentFile)( const struct edict_s *player, const char *filename, char *disconnect_message ); + + // The game .dll should return 1 if lag compensation should be allowed ( could also just set + // the sv_unlag cvar. + // Most games right now should return 0, until client-side weapon prediction code is written + // and tested for them. + int (*pfnAllowLagCompensation)( void ); +} DLL_FUNCTIONS; + +extern DLL_FUNCTIONS gEntityInterface; + +// Current version. +#define NEW_DLL_FUNCTIONS_VERSION 1 + +typedef struct +{ + // Called right before the object's memory is freed. + // Calls its destructor. + void (*pfnOnFreeEntPrivateData)(edict_t *pEnt); + void (*pfnGameShutdown)(void); + int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther ); + void (*pfnCvarValue)( const edict_t *pEnt, const char *value ); + void (*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value ); +} NEW_DLL_FUNCTIONS; +typedef int(*NEW_DLL_FUNCTIONS_FN)(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); + +// Pointers will be null if the game DLL doesn't support this API. +extern NEW_DLL_FUNCTIONS gNewDLLFunctions; + +typedef int(*APIFUNCTION)(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); +typedef int(*APIFUNCTION2)(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); diff --git a/reapi/include/cssdk/engine/hookchains_.h b/reapi/include/cssdk/engine/hookchains_.h new file mode 100644 index 0000000..599c4c7 --- /dev/null +++ b/reapi/include/cssdk/engine/hookchains_.h @@ -0,0 +1,69 @@ +/* +* +* 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. +* +*/ +#pragma once + +template +class IHookChain { +protected: + virtual ~IHookChain() {} + +public: + virtual t_ret callNext(t_args... args) = 0; + virtual t_ret callOriginal(t_args... args) = 0; +}; + +template +class IVoidHookChain +{ +protected: + virtual ~IVoidHookChain() {} + +public: + virtual void callNext(t_args... args) = 0; + virtual void callOriginal(t_args... args) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IHookChainRegistry { +public: + typedef t_ret(*hookfunc_t)(IHookChain*, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IVoidHookChainRegistry { +public: + typedef void(*hookfunc_t)(IVoidHookChain*, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; diff --git a/reapi/include/cssdk/engine/keydefs.h b/reapi/include/cssdk/engine/keydefs.h new file mode 100644 index 0000000..ef9b2fc --- /dev/null +++ b/reapi/include/cssdk/engine/keydefs.h @@ -0,0 +1,131 @@ +//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +// keydefs.h +#ifndef KEYDEFS_H +#define KEYDEFS_H +#ifdef _WIN32 +#ifndef __MINGW32__ +#pragma once +#endif /* not __MINGW32__ */ +#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 + + +// +// 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 diff --git a/reapi/include/cssdk/engine/maintypes.h b/reapi/include/cssdk/engine/maintypes.h new file mode 100644 index 0000000..40ae20c --- /dev/null +++ b/reapi/include/cssdk/engine/maintypes.h @@ -0,0 +1,52 @@ +/* +* +* 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 MAINTYPES_H +#define MAINTYPES_H +#ifdef _WIN32 +#pragma once +#endif + + +#include "osconfig.h" +#include "mathlib.h" + + +// Has no references on server side. +#define NOXREF +// Function body is not implemented. +#define NOBODY +// Function is not tested at all. +#define UNTESTED + +#define BIT(n) (1<<(n)) + + +typedef unsigned int string_t; // from engine's pr_comp.h; + +#endif // MAINTYPES_H diff --git a/reapi/include/cssdk/engine/model.h b/reapi/include/cssdk/engine/model.h new file mode 100644 index 0000000..2c155d5 --- /dev/null +++ b/reapi/include/cssdk/engine/model.h @@ -0,0 +1,415 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "const.h" +#include "modelgen.h" +#include "spritegn.h" +#include "bspfile.h" +#include "crc.h" +#include "com_model.h" + +#define SURF_PLANEBACK 2 +#define SURF_DRAWSKY 4 +#define SURF_DRAWSPRITE 8 +#define SURF_DRAWTURB 0x10 +#define SURF_DRAWTILED 0x20 +#define SURF_DRAWBACKGROUND 0x40 +#define ALIAS_MODEL_VERSION 0x006 + +#define MAX_MODEL_NAME 64 +#define MIPLEVELS 4 +#define NUM_AMBIENTS 4 // automatic ambient sounds +#define MAXLIGHTMAPS 4 +#define MAX_KNOWN_MODELS 1024 + +/* <6816> ../engine/model.h:27 */ +typedef struct mvertex_s +{ + vec3_t position; +} mvertex_t; + +/* <6838> ../engine/model.h:39 */ +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; + +/* <68a6> ../engine/model.h:48 */ +typedef struct texture_s +{ + char name[16]; + unsigned width, 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; + +/* <6950> ../engine/model.h:71 */ +typedef struct medge_s +{ + unsigned short v[2]; + unsigned int cachededgeoffset; +} medge_t; + +/* <697e> ../engine/model.h:78 */ +typedef struct mtexinfo_s +{ + 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; +#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision + +/* <69d0> ../engine/model.h:91 */ +typedef struct msurface_s msurface_t; +/* <1db66> ../engine/model.h:92 */ +typedef struct decal_s decal_t; + +// JAY: Compress this as much as possible +/* <1db71> ../engine/model.h:96 */ +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 +}; + +/* <69db> ../engine/model.h:118 */ +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 + + // surface generation data + 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; + + // lighting info + 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; +}; + +/* <6b6c> ../engine/model.h:149 */ +typedef struct mnode_s +{ + // common with leaf + 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; + + // node specific + mplane_t *plane; + struct mnode_s *children[2]; + + unsigned short firstsurface; + unsigned short numsurfaces; +} mnode_t; + +/* <1dcd4> ../engine/model.h:169 */ +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; + +/* <1ddbe> ../engine/model.h:190 */ +typedef struct hull_s +{ + dclipnode_t *clipnodes; + mplane_t *planes; + int firstclipnode; + int lastclipnode; + vec3_t clip_mins, clip_maxs; +} hull_t; + +/* <4b3fe> ../engine/model.h:210 */ +typedef struct mspriteframe_t +{ + int width; + int height; + void *pcachespot; + float up, down, left, right; + byte pixels[4]; +} mspriteframe_s; + +/* <4b485> ../engine/model.h:219 */ +typedef struct mspritegroup_s +{ + int numframes; + float *intervals; + mspriteframe_t *frames[1]; +} mspritegroup_t; + +/* <4b4df> ../engine/model.h:226 */ +typedef struct mspriteframedesc_s +{ + spriteframetype_t type; + mspriteframe_t *frameptr; +} mspriteframedesc_t; + +/* <4b50f> ../engine/model.h:232 */ +typedef struct msprite_s +{ + short int type; + short int texFormat; + int maxwidth, maxheight; + int numframes; + int paloffset; + float beamlength; + void *cachespot; + mspriteframedesc_t frames[1]; +} msprite_t; + +/* <4b5b5> ../engine/model.h:255 */ +typedef struct maliasframedesc_s +{ + aliasframetype_t type; + trivertx_t bboxmin, bboxmax; + int frame; + char name[16]; +} maliasframedesc_t; + +/* <4b615> ../engine/model.h:264 */ +typedef struct maliasskindesc_s +{ + aliasskintype_t type; + void *pcachespot; + int skin; +} maliasskindesc_t; + +/* <4b658> ../engine/model.h:271 */ +typedef struct maliasgroupframedesc_s +{ + trivertx_t bboxmin, bboxmax; + int frame; +} maliasgroupframedesc_t; + +/* <4b69b> ../engine/model.h:278 */ +typedef struct maliasgroup_s +{ + int numframes; + int intervals; + maliasgroupframedesc_t frames[1]; +} maliasgroup_t; + +/* <4b6ee> ../engine/model.h:285 */ +typedef struct maliasskingroup_s +{ + int numskins; + int intervals; + maliasskindesc_t skindescs[1]; +} maliasskingroup_t; + +/* <4b741> ../engine/model.h:293 */ +typedef struct mtriangle_s +{ + int facesfront; + int vertindex[3]; +} mtriangle_t; + +/* <4b779> ../engine/model.h:298 */ +typedef struct aliashdr_s +{ + int model; + int stverts; + int skindesc; + int triangles; + int palette; + maliasframedesc_t frames[1]; +} aliashdr_t; + +/* <1de30> ../engine/model.h:315 */ +typedef enum modtype_e +{ + mod_brush, + mod_sprite, + mod_alias, + mod_studio, +} modtype_t; + +/* <1de5e> ../engine/model.h:331 */ +typedef struct model_s +{ + char name[MAX_MODEL_NAME]; + + //TODO: qboolean? seriously? + int 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 struct cachepic_s +{ + char name[64]; + cache_user_t cache; +} cachepic_t; + +typedef struct cachewad_s cachewad_t; + +typedef void(*PFNCACHE)(cachewad_t *, unsigned char *); + +typedef struct cachewad_s +{ + char *name; + cachepic_t *cache; + int cacheCount; + int cacheMax; + struct lumpinfo_s *lumps; + int lumpCount; + int cacheExtra; + PFNCACHE pfnCacheBuild; + int numpaths; + char **basedirs; + int *lumppathindices; +#ifndef SWDS + int tempWad; +#endif // SWDS +} cachewad_t; + +typedef struct mod_known_info_s +{ + qboolean shouldCRC; + qboolean firstCRCDone; + CRC32_t initialCRC; +} mod_known_info_t; + diff --git a/reapi/include/cssdk/engine/modelgen.h b/reapi/include/cssdk/engine/modelgen.h new file mode 100644 index 0000000..3d90bdd --- /dev/null +++ b/reapi/include/cssdk/engine/modelgen.h @@ -0,0 +1,144 @@ +/* +* +* 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 MODELGEN_H +#define MODELGEN_H +#ifdef _WIN32 +#pragma once +#endif + + +/* <67f6> ../engine/modelgen.h:37 */ +typedef enum synctype_e +{ + ST_SYNC = 0, + ST_RAND = 1, +} synctype_t; + +/* <4abae> ../engine/modelgen.h:40 */ +typedef enum aliasframetype_s +{ + ALIAS_SINGLE = 0, + ALIAS_GROUP = 1, +} aliasframetype_t; + +/* 203 */ +/* <4abce> ../engine/modelgen.h:42 */ +typedef enum aliasskintype_s +{ + ALIAS_SKIN_SINGLE = 0, + ALIAS_SKIN_GROUP = 1, +} aliasskintype_t; + +/* <4abee> ../engine/modelgen.h:44 */ +typedef struct mdl_s +{ + int ident; + int version; + vec3_t scale; + vec3_t scale_origin; + float boundingradius; + vec3_t eyeposition; + int numskins; + int skinwidth; + int skinheight; + int numverts; + int numtris; + int numframes; + synctype_t synctype; + int flags; + float size; +} mdl_t; + +/* <4acd4> ../engine/modelgen.h:64 */ +typedef struct stvert_s +{ + int onseam; + int s; + int t; +} stvert_t; + +/* <4ad0e> ../engine/modelgen.h:70 */ +typedef struct dtriangle_s +{ + int facesfront; + int vertindex[3]; +} dtriangle_t; + +/* <4ad42> ../engine/modelgen.h:80 */ +typedef struct trivertx_s +{ + byte v[3]; + byte lightnormalindex; +} trivertx_t; + +/* <4ad80> ../engine/modelgen.h:85 */ +typedef struct daliasframe_s +{ + trivertx_t bboxmin, bboxmax; + char name[16]; +} daliasframe_t; + +/* <4adbe> ../engine/modelgen.h:91 */ +typedef struct daliasgroup_s +{ + int numframes; + trivertx_t bboxmin, bboxmax; +} daliasgroup_t; + +/* <4adfc> ../engine/modelgen.h:97 */ +typedef struct daliasskingroup_s +{ + int numskins; +} daliasskingroup_t; + +/* <4ae1e> ../engine/modelgen.h:101 */ +typedef struct daliasinterval_s +{ + float interval; +} daliasinterval_t; + +/* <4ae40> ../engine/modelgen.h:105 */ +typedef struct daliasskininterval_s +{ + float interval; +} daliasskininterval_t; + +/* <4ae62> ../engine/modelgen.h:109 */ +typedef struct daliasframetype_s +{ + aliasframetype_t type; +} daliasframetype_t; + +/* <4ae84> ../engine/modelgen.h:113 */ +typedef struct daliasskintype_s +{ + aliasskintype_t type; +} daliasskintype_t; + +#endif // MODELGEN_H diff --git a/reapi/include/cssdk/engine/osconfig.h b/reapi/include/cssdk/engine/osconfig.h new file mode 100644 index 0000000..bb45a62 --- /dev/null +++ b/reapi/include/cssdk/engine/osconfig.h @@ -0,0 +1,194 @@ +/* +* +* 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 _OSCONFIG_H +#define _OSCONFIG_H + +#ifdef _WIN32 // WINDOWS + #pragma warning(disable : 4005) +#endif // _WIN32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef _WIN32 // WINDOWS + #include + #include + #include // for support IPX + #define PSAPI_VERSION 1 + #include + #include + #include + #include + #include + #include +#else // _WIN32 + #include + #include + //#include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // Deail with stupid macro in kernel.h + #undef __FUNCTION__ +#endif // _WIN32 + +#include +#include +#include +#include + +#include +#include + +#ifdef _WIN32 // WINDOWS + #define _CRT_SECURE_NO_WARNINGS + #define WIN32_LEAN_AND_MEAN + + #ifndef CDECL + #define CDECL __cdecl + #endif + #define STDCALL __stdcall + #define HIDDEN + #define NOINLINE __declspec(noinline) + #define ALIGN16 __declspec(align(16)) + #define FORCE_STACK_ALIGN + + //inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); } + //inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); } + typedef int socklen_t; + #define SOCKET_FIONBIO(s, m) ioctlsocket(s, FIONBIO, (u_long*)&m) + #define SOCKET_MSGLEN(s, r) ioctlsocket(s, FIONREAD, (u_long*)&r) + #define SIN_GET_ADDR(saddr, r) r = (saddr)->S_un.S_addr + #define SIN_SET_ADDR(saddr, r) (saddr)->S_un.S_addr = (r) + #define SOCKET_CLOSE(s) closesocket(s) + #define SOCKET_AGAIN() (WSAGetLastError() == WSAEWOULDBLOCK) + + inline void* sys_allocmem(unsigned int size) { + return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE); + } + + inline void sys_freemem(void* ptr, unsigned int size) { + VirtualFree(ptr, 0, MEM_RELEASE); + } +#else // _WIN32 + #ifdef __FUNCTION__ + #undef __FUNCTION__ + #endif + #define __FUNCTION__ __func__ + + #ifndef PAGESIZE + #define PAGESIZE 4096 + #endif + #define ALIGN(addr) (size_t)((size_t)addr & ~(PAGESIZE-1)) + #define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0])) + + #define _MAX_FNAME NAME_MAX + #define MAX_PATH 260 + + typedef void *HWND; + + typedef unsigned long DWORD; + typedef unsigned short WORD; + typedef unsigned int UNINT32; + + #define CDECL __attribute__ ((cdecl)) + #define STDCALL __attribute__ ((stdcall)) + #define HIDDEN __attribute__((visibility("hidden"))) + #define NOINLINE __attribute__((noinline)) + #define ALIGN16 __attribute__((aligned(16))) + #define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer)) + + //inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); } + //inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); } + typedef int SOCKET; + #define INVALID_SOCKET (SOCKET)(~0) + #define SOCKET_FIONBIO(s, m) ioctl(s, FIONBIO, (char*)&m) + #define SOCKET_MSGLEN(s, r) ioctl(s, FIONREAD, (char*)&r) + #define SIN_GET_ADDR(saddr, r) r = (saddr)->s_addr + #define SIN_SET_ADDR(saddr, r) (saddr)->s_addr = (r) + #define SOCKET_CLOSE(s) close(s) + #define SOCKET_AGAIN() (errno == EAGAIN) + #define SOCKET_ERROR -1 + + inline void* sys_allocmem(unsigned int size) { + return mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + } + inline void sys_freemem(void* ptr, unsigned int size) { + munmap(ptr, size); + } + + #define WSAENOPROTOOPT ENOPROTOOPT + + #ifndef FALSE + #define FALSE 0 + #endif + #ifndef TRUE + #define TRUE 1 + #endif +#endif // _WIN32 + +#ifdef _WIN32 + static const bool __isWindows = true; + static const bool __isLinux = false; +#else + static const bool __isWindows = false; + static const bool __isLinux = true; +#endif + +#define EXT_FUNC FORCE_STACK_ALIGN + +extern void __declspec(noreturn) rehlds_syserror(const char* fmt, ...); + +#endif // _OSCONFIG_H diff --git a/reapi/include/cssdk/engine/progdefs.h b/reapi/include/cssdk/engine/progdefs.h new file mode 100644 index 0000000..e27dc50 --- /dev/null +++ b/reapi/include/cssdk/engine/progdefs.h @@ -0,0 +1,224 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#ifndef PROGDEFS_H +#define PROGDEFS_H +#ifdef _WIN32 +#pragma once +#endif + +typedef struct globalvars_s +{ + float time; + float frametime; + float force_retouch; + string_t mapname; + string_t startspot; + float deathmatch_; + float coop_; + float teamplay; + float serverflags; + float found_secrets; + vec3_t v_forward; + vec3_t v_up; + vec3_t v_right; + float trace_allsolid; + float trace_startsolid; + float trace_fraction; + vec3_t trace_endpos; + vec3_t trace_plane_normal; + float trace_plane_dist; + edict_t *trace_ent; + float trace_inopen; + float trace_inwater; + int trace_hitgroup; + int trace_flags; + int msg_entity; + int cdAudioTrack; + int maxClients; + int maxEntities; + const char *pStringBase; + + void *pSaveData; + vec3_t vecLandmarkOffset; +} globalvars_t; + + +typedef struct entvars_s +{ + string_t classname; + string_t globalname; + + vec3_t origin; + vec3_t oldorigin; + vec3_t velocity; + vec3_t basevelocity; + vec3_t clbasevelocity; // Base velocity that was passed in to server physics so + // client can predict conveyors correctly. Server zeroes it, so we need to store here, too. + vec3_t movedir; + + vec3_t angles; // Model angles + vec3_t avelocity; // angle velocity (degrees per second) + vec3_t punchangle; // auto-decaying view angle adjustment + vec3_t v_angle; // Viewing angle (player only) + + // For parametric entities + vec3_t endpos; + vec3_t startpos; + float impacttime; + float starttime; + + int fixangle; // 0:nothing, 1:force view angles, 2:add avelocity + float idealpitch; + float pitch_speed; + float ideal_yaw; + float yaw_speed; + + int modelindex; + string_t model; + + int viewmodel; // player's viewmodel + int weaponmodel; // what other players see + + vec3_t absmin; // BB max translated to world coord + vec3_t absmax; // BB max translated to world coord + vec3_t mins; // local BB min + vec3_t maxs; // local BB max + vec3_t size; // maxs - mins + + float ltime; + float nextthink; + + int movetype; + int solid; + + int skin; + int body; // sub-model selection for studiomodels + int effects; + + float gravity; // % of "normal" gravity + float friction; // inverse elasticity of MOVETYPE_BOUNCE + + int light_level; + + int sequence; // animation sequence + int gaitsequence; // movement animation sequence for player (0 for none) + float frame; // % playback position in animation sequences (0..255) + float animtime; // world time when frame was set + float framerate; // animation playback rate (-8x to 8x) + byte controller[4]; // bone controller setting (0..255) + byte blending[2]; // blending amount between sub-sequences (0..255) + + float scale; // sprite rendering scale (0..255) + + int rendermode; + float renderamt; + vec3_t rendercolor; + int renderfx; + + float health; + float frags; + int weapons; // bit mask for available weapons + float takedamage; + + int deadflag; + vec3_t view_ofs; // eye position + + int button; + int impulse; + + edict_t *chain; // Entity pointer when linked into a linked list + edict_t *dmg_inflictor; + edict_t *enemy; + edict_t *aiment; // entity pointer when MOVETYPE_FOLLOW + edict_t *owner; + edict_t *groundentity; + + int spawnflags; + int flags; + + int colormap; // lowbyte topcolor, highbyte bottomcolor + int team; + + float max_health; + float teleport_time; + float armortype; + float armorvalue; + int waterlevel; + int watertype; + + string_t target; + string_t targetname; + string_t netname; + string_t message; + + float dmg_take; + float dmg_save; + float dmg; + float dmgtime; + + string_t noise; + string_t noise1; + string_t noise2; + string_t noise3; + + float speed; + float air_finished; + float pain_finished; + float radsuit_finished; + + edict_t *pContainingEntity; + + int playerclass; + float maxspeed; + + float fov; + int weaponanim; + + int pushmsec; + + int bInDuck; + int flTimeStepSound; + int flSwimTime; + int flDuckTime; + int iStepLeft; + float flFallVelocity; + + int gamestate; + + int oldbuttons; + + int groupinfo; + + // For mods + int iuser1; + int iuser2; + int iuser3; + int iuser4; + float fuser1; + float fuser2; + float fuser3; + float fuser4; + vec3_t vuser1; + vec3_t vuser2; + vec3_t vuser3; + vec3_t vuser4; + edict_t *euser1; + edict_t *euser2; + edict_t *euser3; + edict_t *euser4; +} entvars_t; + + +#endif // PROGDEFS_H diff --git a/reapi/include/cssdk/engine/progs.h b/reapi/include/cssdk/engine/progs.h new file mode 100644 index 0000000..fe4796e --- /dev/null +++ b/reapi/include/cssdk/engine/progs.h @@ -0,0 +1,82 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#ifndef PROGS_H +#define PROGS_H + +#include "progdefs.h" + +// 16 simultaneous events, max +#define MAX_EVENT_QUEUE 64 + +#define DEFAULT_EVENT_RESENDS 1 + +#include "event_flags.h" + +typedef struct event_info_s event_info_t; + +#include "event_args.h" + +struct event_info_s +{ + unsigned short index; // 0 implies not in use + + short packet_index; // Use data from state info for entity in delta_packet . -1 implies separate info based on event + // parameter signature + short entity_index; // The edict this event is associated with + + float fire_time; // if non-zero, the time when the event should be fired ( fixed up on the client ) + + event_args_t args; + +// CLIENT ONLY + int flags; // Reliable or not, etc. + +}; + +typedef struct event_state_s event_state_t; + +struct event_state_s +{ + struct event_info_s ei[ MAX_EVENT_QUEUE ]; +}; + +#if !defined( ENTITY_STATEH ) +#include "entity_state.h" +#endif + +#if !defined( EDICT_H ) +#include "edict.h" +#endif + +#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m))) +#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area) + +//============================================================================ + +extern char *pr_strings; +extern globalvars_t gGlobalVariables; + +//============================================================================ + +edict_t *ED_Alloc (void); +void ED_Free (edict_t *ed); +void ED_LoadFromFile (char *data); + +edict_t *EDICT_NUM(int n); +int NUM_FOR_EDICT(const edict_t *e); + +#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) + +#endif // PROGS_H diff --git a/reapi/include/cssdk/engine/rehlds_api.h b/reapi/include/cssdk/engine/rehlds_api.h new file mode 100644 index 0000000..f57174b --- /dev/null +++ b/reapi/include/cssdk/engine/rehlds_api.h @@ -0,0 +1,286 @@ +/* +* +* 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. +* +*/ +#pragma once +#include "archtypes.h" +#include "cmd_rehlds.h" +#include "rehlds_interfaces.h" +#include "hookchains.h" +#include "FlightRecorder.h" +#include "interface.h" +#include "model.h" + +#define REHLDS_API_VERSION_MAJOR 2 +#define REHLDS_API_VERSION_MINOR 11 + +//Steam_NotifyClientConnect hook +typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; +typedef IHookChainRegistry IRehldsHookRegistry_Steam_NotifyClientConnect; + +//SV_ConnectClient hook +typedef IVoidHookChain<> IRehldsHook_SV_ConnectClient; +typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_ConnectClient; + +//SV_GetIDString hook +typedef IHookChain IRehldsHook_SV_GetIDString; +typedef IHookChainRegistry IRehldsHookRegistry_SV_GetIDString; + +//SV_SendServerinfo hook +typedef IVoidHookChain IRehldsHook_SV_SendServerinfo; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_SendServerinfo; + +//SV_CheckProtocol hook +typedef IHookChain IRehldsHook_SV_CheckProtocol; +typedef IHookChainRegistry IRehldsHookRegistry_SV_CheckProtocol; + +//SVC_GetChallenge_mod hook +typedef IVoidHookChain IRehldsHook_SVC_GetChallenge_mod; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SVC_GetChallenge_mod; + +//SV_CheckKeyInfo hook +typedef IHookChain IRehldsHook_SV_CheckKeyInfo; +typedef IHookChainRegistry IRehldsHookRegistry_SV_CheckKeyInfo; + +//SV_CheckIPRestrictions hook +typedef IHookChain IRehldsHook_SV_CheckIPRestrictions; +typedef IHookChainRegistry IRehldsHookRegistry_SV_CheckIPRestrictions; + +//SV_FinishCertificateCheck hook +typedef IHookChain IRehldsHook_SV_FinishCertificateCheck; +typedef IHookChainRegistry IRehldsHookRegistry_SV_FinishCertificateCheck; + +//Steam_NotifyBotConnect hook +typedef IHookChain IRehldsHook_Steam_NotifyBotConnect; +typedef IHookChainRegistry IRehldsHookRegistry_Steam_NotifyBotConnect; + +//SerializeSteamId +typedef IVoidHookChain IRehldsHook_SerializeSteamId; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SerializeSteamId; + +//SV_CompareUserID hook +typedef IHookChain IRehldsHook_SV_CompareUserID; +typedef IHookChainRegistry IRehldsHookRegistry_SV_CompareUserID; + +//Steam_NotifyClientDisconnect +typedef IVoidHookChain IRehldsHook_Steam_NotifyClientDisconnect; +typedef IVoidHookChainRegistry IRehldsHookRegistry_Steam_NotifyClientDisconnect; + +//PreProcessPacket +typedef IHookChain IRehldsHook_PreprocessPacket; +typedef IHookChainRegistry IRehldsHookRegistry_PreprocessPacket; + +//ValidateCommand +typedef IHookChain IRehldsHook_ValidateCommand; +typedef IHookChainRegistry IRehldsHookRegistry_ValidateCommand; + +//ExecuteServerStringCmd +typedef IVoidHookChain IRehldsHook_ExecuteServerStringCmd; +typedef IVoidHookChainRegistry IRehldsHookRegistry_ExecuteServerStringCmd; + +//ClientConnected +typedef IVoidHookChain IRehldsHook_ClientConnected; +typedef IVoidHookChainRegistry IRehldsHookRegistry_ClientConnected; + +//HandleNetCommand +typedef IVoidHookChain IRehldsHook_HandleNetCommand; +typedef IVoidHookChainRegistry IRehldsHookRegistry_HandleNetCommand; + +//Mod_LoadBrushModel +typedef IVoidHookChain IRehldsHook_Mod_LoadBrushModel; +typedef IVoidHookChainRegistry IRehldsHookRegistry_Mod_LoadBrushModel; + +//Mod_LoadStudioModel +typedef IVoidHookChain IRehldsHook_Mod_LoadStudioModel; +typedef IVoidHookChainRegistry IRehldsHookRegistry_Mod_LoadStudioModel; + +//SV_EmitEvents hook +typedef IVoidHookChain IRehldsHook_SV_EmitEvents; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_EmitEvents; + +//EV_PlayReliableEvent hook +typedef IVoidHookChain IRehldsHook_EV_PlayReliableEvent; +typedef IVoidHookChainRegistry IRehldsHookRegistry_EV_PlayReliableEvent; + +//SV_StartSound hook +typedef IVoidHookChain IRehldsHook_SV_StartSound; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_StartSound; + +//PF_Remove_I hook +typedef IVoidHookChain IRehldsHook_PF_Remove_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_Remove_I; + +//PF_BuildSoundMsg_I hook +typedef IVoidHookChain IRehldsHook_PF_BuildSoundMsg_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_BuildSoundMsg_I; + +//SV_WriteFullClientUpdate hook +typedef IVoidHookChain IRehldsHook_SV_WriteFullClientUpdate; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_WriteFullClientUpdate; + +//SV_CheckConsistencyResponse hook +typedef IHookChain IRehldsHook_SV_CheckConsistencyResponse; +typedef IHookChainRegistry IRehldsHookRegistry_SV_CheckConsistencyResponse; + +//SV_DropClient hook +typedef IVoidHookChain IRehldsHook_SV_DropClient; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_DropClient; + +//SV_ActivateServer hook +typedef IVoidHookChain IRehldsHook_SV_ActivateServer; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_ActivateServer; + +//SV_WriteVoiceCodec hook +typedef IVoidHookChain IRehldsHook_SV_WriteVoiceCodec; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_WriteVoiceCodec; + +//Steam_GSGetSteamID hook +typedef IHookChain IRehldsHook_Steam_GSGetSteamID; +typedef IHookChainRegistry IRehldsHookRegistry_Steam_GSGetSteamID; + +//SV_TransferConsistencyInfo hook +typedef IHookChain IRehldsHook_SV_TransferConsistencyInfo; +typedef IHookChainRegistry IRehldsHookRegistry_SV_TransferConsistencyInfo; + +//Steam_GSBUpdateUserData hook +typedef IHookChain IRehldsHook_Steam_GSBUpdateUserData; +typedef IHookChainRegistry IRehldsHookRegistry_Steam_GSBUpdateUserData; + +//Cvar_DirectSet hook +typedef IVoidHookChain IRehldsHook_Cvar_DirectSet; +typedef IVoidHookChainRegistry IRehldsHookRegistry_Cvar_DirectSet; + +//SV_EstablishTimeBase hook +typedef IVoidHookChain IRehldsHook_SV_EstablishTimeBase; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_EstablishTimeBase; + +//SV_Spawn_f hook +typedef IVoidHookChain<> IRehldsHook_SV_Spawn_f; +typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Spawn_f; + +class IRehldsHookchains { +public: + virtual ~IRehldsHookchains() { } + + virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect() = 0; + virtual IRehldsHookRegistry_SV_ConnectClient* SV_ConnectClient() = 0; + virtual IRehldsHookRegistry_SV_GetIDString* SV_GetIDString() = 0; + virtual IRehldsHookRegistry_SV_SendServerinfo* SV_SendServerinfo() = 0; + virtual IRehldsHookRegistry_SV_CheckProtocol* SV_CheckProtocol() = 0; + virtual IRehldsHookRegistry_SVC_GetChallenge_mod* SVC_GetChallenge_mod() = 0; + virtual IRehldsHookRegistry_SV_CheckKeyInfo* SV_CheckKeyInfo() = 0; + virtual IRehldsHookRegistry_SV_CheckIPRestrictions* SV_CheckIPRestrictions() = 0; + virtual IRehldsHookRegistry_SV_FinishCertificateCheck* SV_FinishCertificateCheck() = 0; + virtual IRehldsHookRegistry_Steam_NotifyBotConnect* Steam_NotifyBotConnect() = 0; + virtual IRehldsHookRegistry_SerializeSteamId* SerializeSteamId() = 0; + virtual IRehldsHookRegistry_SV_CompareUserID* SV_CompareUserID() = 0; + virtual IRehldsHookRegistry_Steam_NotifyClientDisconnect* Steam_NotifyClientDisconnect() = 0; + virtual IRehldsHookRegistry_PreprocessPacket* PreprocessPacket() = 0; + virtual IRehldsHookRegistry_ValidateCommand* ValidateCommand() = 0; + virtual IRehldsHookRegistry_ClientConnected* ClientConnected() = 0; + virtual IRehldsHookRegistry_HandleNetCommand* HandleNetCommand() = 0; + virtual IRehldsHookRegistry_Mod_LoadBrushModel* Mod_LoadBrushModel() = 0; + virtual IRehldsHookRegistry_Mod_LoadStudioModel* Mod_LoadStudioModel() = 0; + virtual IRehldsHookRegistry_ExecuteServerStringCmd* ExecuteServerStringCmd() = 0; + virtual IRehldsHookRegistry_SV_EmitEvents* SV_EmitEvents() = 0; + virtual IRehldsHookRegistry_EV_PlayReliableEvent* EV_PlayReliableEvent() = 0; + virtual IRehldsHookRegistry_SV_StartSound* SV_StartSound() = 0; + virtual IRehldsHookRegistry_PF_Remove_I* PF_Remove_I() = 0; + virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I() = 0; + virtual IRehldsHookRegistry_SV_WriteFullClientUpdate* SV_WriteFullClientUpdate() = 0; + virtual IRehldsHookRegistry_SV_CheckConsistencyResponse* SV_CheckConsistencyResponse() = 0; + virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0; + virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0; + virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec() = 0; + virtual IRehldsHookRegistry_Steam_GSGetSteamID* Steam_GSGetSteamID() = 0; + virtual IRehldsHookRegistry_SV_TransferConsistencyInfo* SV_TransferConsistencyInfo() = 0; + virtual IRehldsHookRegistry_Steam_GSBUpdateUserData* Steam_GSBUpdateUserData() = 0; + virtual IRehldsHookRegistry_Cvar_DirectSet* Cvar_DirectSet() = 0; + virtual IRehldsHookRegistry_SV_EstablishTimeBase* SV_EstablishTimeBase() = 0; + virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f() = 0; +}; + +struct RehldsFuncs_t { + void(*DropClient)(IGameClient* cl, bool crash, const char* fmt, ...); + void(*RejectConnection)(netadr_t *adr, char *fmt, ...); + qboolean(*SteamNotifyBotConnect)(IGameClient* cl); + sizebuf_t*(*GetNetMessage)(); + IGameClient*(*GetHostClient)(); + int*(*GetMsgReadCount)(); + qboolean(*FilterUser)(USERID_t*); + void(*NET_SendPacket)(unsigned int length, void *data, const netadr_t &to); + void(*TokenizeString)(char* s); + bool(*CheckChallenge)(const netadr_t& adr, int challenge); + void(*SendUserReg)(sizebuf_t* msg); + void(*WriteDeltaDescriptionsToClient)(sizebuf_t* msg); + void(*SetMoveVars)(); + void(*WriteMovevarsToClient)(sizebuf_t* msg); + char*(*GetClientFallback)(); + int*(*GetAllowCheats)(); + bool(*GSBSecure)(); + int(*GetBuildNumber)(); + double(*GetRealTime)(); + int*(*GetMsgBadRead)(); + cmd_source_t*(*GetCmdSource)(); + void(*Log)(const char* prefix, const char* msg); + DLL_FUNCTIONS *(*GetEntityInterface)(); + void(*EV_PlayReliableEvent)(IGameClient *cl, int entindex, short unsigned int eventindex, float delay, struct event_args_s *pargs); + int(*SV_LookupSoundIndex)(const char *sample); + void(*MSG_StartBitWriting)(sizebuf_t *buf); + void(*MSG_WriteBits)(uint32 data, int numbits); + void(*MSG_WriteBitVec3Coord)(const float *fa); + void(*MSG_EndBitWriting)(sizebuf_t *buf); + void*(*SZ_GetSpace)(sizebuf_t *buf, int length); + cvar_t*(*GetCvarVars)(); + int (*SV_GetChallenge)(const netadr_t& adr); + void (*SV_AddResource)(resourcetype_t type, const char *name, int size, unsigned char flags, int index); + int(*MSG_ReadShort)(void); + int(*MSG_ReadBuf)(int iSize, void *pbuf); + void(*MSG_WriteBuf)(sizebuf_t *sb, int iSize, void *buf); + void(*MSG_WriteByte)(sizebuf_t *sb, int c); + void(*MSG_WriteShort)(sizebuf_t *sb, int c); + void(*MSG_WriteString)(sizebuf_t *sb, const char *s); + void*(*GetPluginApi)(const char *name); + void(*RegisterPluginApi)(const char *name, void *impl); + qboolean(*SV_FileInConsistencyList)(const char *filename, struct consistency_s **ppconsist); + qboolean(*Steam_NotifyClientConnect)(IGameClient *cl, const void *pvSteam2Key, unsigned int ucbSteam2Key); + void(*Steam_NotifyClientDisconnect)(IGameClient* cl); +}; + +class IRehldsApi { +public: + virtual ~IRehldsApi() { } + + virtual int GetMajorVersion() = 0; + virtual int GetMinorVersion() = 0; + virtual const RehldsFuncs_t* GetFuncs() = 0; + virtual IRehldsHookchains* GetHookchains() = 0; + virtual IRehldsServerStatic* GetServerStatic() = 0; + virtual IRehldsServerData* GetServerData() = 0; + virtual IRehldsFlightRecorder* GetFlightRecorder() = 0; +}; + +#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001" \ No newline at end of file diff --git a/reapi/include/cssdk/engine/rehlds_interfaces.h b/reapi/include/cssdk/engine/rehlds_interfaces.h new file mode 100644 index 0000000..a5497ff --- /dev/null +++ b/reapi/include/cssdk/engine/rehlds_interfaces.h @@ -0,0 +1,129 @@ +/* +* +* 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. +* +*/ +#pragma once + +class INetChan; +class IGameClient; + +#include "archtypes.h" +#include "const.h" +#include "netadr.h" + +#include "common_rehlds.h" +#include "userid_rehlds.h" + +#ifdef REHLDS_SELF +#include "server.h" +#endif + +class INetChan; +class IGameClient; + +class IGameClient { +public: + virtual int GetId() = 0; + + virtual bool IsActive() = 0; + virtual void SetActive(bool active) = 0; + + virtual bool IsSpawned() = 0; + virtual void SetSpawned(bool spawned) = 0; + + virtual INetChan* GetNetChan() = 0; + + virtual sizebuf_t* GetDatagram() = 0; + + virtual edict_t* GetEdict() = 0; + + virtual USERID_t* GetNetworkUserID() = 0; + + virtual const char* GetName() = 0; + + virtual bool IsConnected() = 0; + virtual void SetConnected(bool connected) = 0; + + virtual uint32 GetVoiceStream(int stream_id) = 0; + virtual void SetLastVoiceTime(double time) = 0; + virtual double GetLastVoiceTime() = 0; + virtual bool GetLoopback() = 0; + virtual struct usercmd_s *GetLastCmd() = 0; + + // this must be the last virtual function in class +#ifdef REHLDS_SELF + virtual client_t* GetClient() = 0; +#endif +}; + +class INetChan { +public: + virtual const netadr_t* GetRemoteAdr() = 0; + virtual sizebuf_t* GetMessageBuf() = 0; + + + // this must be the last virtual function in class +#ifdef REHLDS_SELF + virtual netchan_t* GetChan() = 0; +#endif +}; + +#ifndef REHLDS_SELF +struct client_t; +#endif + +class IRehldsServerStatic { +public: + virtual ~IRehldsServerStatic() { } + + virtual int GetMaxClients() = 0; + virtual bool IsLogActive() = 0; + virtual IGameClient* GetClient(int id) = 0; + virtual client_t* GetClient_t(int id) = 0; + virtual int GetIndexOfClient_t(client_t* client) = 0; +}; + +class IRehldsServerData { +public: + virtual ~IRehldsServerData() { } + + virtual const char* GetModelName() = 0; + virtual const char* GetName() = 0; + virtual uint32 GetWorldmapCrc() = 0; + virtual uint8* GetClientDllMd5() = 0; + virtual sizebuf_t* GetDatagram() = 0; + virtual sizebuf_t* GetReliableDatagram() = 0; + + virtual void SetModelName(const char* modelname) = 0; + virtual void SetConsistencyNum(int num) = 0; + virtual int GetConsistencyNum() = 0; + virtual int GetResourcesNum() = 0; + virtual int GetDecalNameNum() = 0; + + virtual double GetTime() = 0; + virtual void SetResourcesNum(int num) = 0; + virtual struct resource_s *GetResource(int index) = 0; +}; diff --git a/reapi/include/cssdk/engine/shake.h b/reapi/include/cssdk/engine/shake.h new file mode 100644 index 0000000..1146a5e --- /dev/null +++ b/reapi/include/cssdk/engine/shake.h @@ -0,0 +1,57 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#ifndef SHAKE_H +#define SHAKE_H + +// Screen / View effects + +// screen shake +extern int gmsgShake; + +// This structure is sent over the net to describe a screen shake event +typedef struct +{ + unsigned short amplitude; // FIXED 4.12 amount of shake + unsigned short duration; // FIXED 4.12 seconds duration + unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble) +} ScreenShake; + +extern void V_ApplyShake( float *origin, float *angles, float factor ); +extern void V_CalcShake( void ); +extern int V_ScreenShake( const char *pszName, int iSize, void *pbuf ); +extern int V_ScreenFade( const char *pszName, int iSize, void *pbuf ); + + +// Fade in/out +extern int gmsgFade; + +#define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function +#define FFADE_OUT 0x0001 // Fade out (not in) +#define FFADE_MODULATE 0x0002 // Modulate (don't blend) +#define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received +#define FFADE_LONGFADE 0x0008 // used to indicate the fade can be longer than 16 seconds (added for czero) + + +// This structure is sent over the net to describe a screen fade event +typedef struct +{ + unsigned short duration; // FIXED 4.12 seconds duration + unsigned short holdTime; // FIXED 4.12 seconds duration until reset (fade & hold) + short fadeFlags; // flags + byte r, g, b, a; // fade to color ( max alpha ) +} ScreenFade; + +#endif // SHAKE_H + diff --git a/reapi/include/cssdk/engine/spritegn.h b/reapi/include/cssdk/engine/spritegn.h new file mode 100644 index 0000000..96d8b03 --- /dev/null +++ b/reapi/include/cssdk/engine/spritegn.h @@ -0,0 +1,90 @@ +/* +* +* 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 SPRITEGN_H +#define SPRITEGN_H +#ifdef _WIN32 +#pragma once +#endif + +#include "modelgen.h" + + +#define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I') +#define SPRITE_VERSION 2 + + +typedef enum spriteframetype_e +{ + SPR_SINGLE = 0, + SPR_GROUP, + SPR_ANGLED +} spriteframetype_t; + +/* <4aea6> ../engine/spritegn.h:50 */ +typedef struct dsprite_s +{ + int ident; + int version; + int type; + int texFormat; + float boundingradius; + int width; + int height; + int numframes; + float beamlength; + synctype_t synctype; +} dsprite_t; + +/* <4af46> ../engine/spritegn.h:74 */ +typedef struct dspriteframe_s +{ + int origin[2]; + int width; + int height; +} dspriteframe_t; + +/* <4af84> ../engine/spritegn.h:80 */ +typedef struct dspritegroup_s +{ + int numframes; +} dspritegroup_t; + +/* <4afa6> ../engine/spritegn.h:84 */ +typedef struct dspriteinterval_s +{ + float interval; +} dspriteinterval_t; + +/* <4afe8> ../engine/spritegn.h:90 */ +typedef struct dspriteframetype_s +{ + spriteframetype_t type; +} dspriteframetype_t; + +#endif // SPRITEGN_H diff --git a/reapi/include/cssdk/engine/static_map.h b/reapi/include/cssdk/engine/static_map.h new file mode 100644 index 0000000..593cc39 --- /dev/null +++ b/reapi/include/cssdk/engine/static_map.h @@ -0,0 +1,257 @@ +#pragma once + +#include "archtypes.h" +#include "crc32c.h" + +template +class CStaticMap { +protected: + virtual uint32 hash(const T_KEY& val) { + return crc32c((const unsigned char*)&val, sizeof(T_KEY)); + } + + virtual bool equals(const T_KEY& val1, const T_KEY& val2) { + return 0 == memcmp(&val1, &val2, sizeof(T_KEY)); + } + + struct map_node_t { + map_node_t* prev; + map_node_t* next; + T_KEY key; + T_VAL val; + }; + +private: + map_node_t* m_RootNodes[1 << ASSOC_2N]; + map_node_t m_AllNodes[MAX_VALS]; + map_node_t* m_FreeRoot; + + unsigned int GetRoodNodeId(const T_KEY& val) { return hash(val) & (0xFFFFFFFF >> (32 - ASSOC_2N)); } + + void unlink(map_node_t* node) { + map_node_t* prev = node->prev; + map_node_t* next = node->next; + + if (prev) { + prev->next = next; + } + + if (next) { + next->prev = prev; + } + + if (!prev) { + // this was a root node + unsigned int rootId = GetRoodNodeId(node->key); + if (m_RootNodes[rootId] != node) { + util_syserror("%s: invlid root node", __FUNCTION__); + return; + } + + m_RootNodes[rootId] = next; + } + } + + void link(map_node_t* node) { + unsigned int rootId = GetRoodNodeId(node->key); + map_node_t* root = m_RootNodes[rootId]; + node->prev = NULL; + node->next = root; + + if (root) { + root->prev = node; + } + + m_RootNodes[rootId] = node; + } + + void linkToFreeStack(map_node_t* node) { + node->next = m_FreeRoot; + if (m_FreeRoot) { + m_FreeRoot->prev = node; + } + m_FreeRoot = node; + } + +public: + CStaticMap() { + clear(); + } + + void clear() { + memset(m_RootNodes, 0, sizeof(m_RootNodes)); + memset(m_AllNodes, 0, sizeof(m_AllNodes)); + m_FreeRoot = NULL; + + for (int i = 0; i < MAX_VALS; i++) { + linkToFreeStack(&m_AllNodes[i]); + } + } + + map_node_t* get(const T_KEY& key) { + unsigned int rootId = GetRoodNodeId(key); + map_node_t* n = m_RootNodes[rootId]; + while (n) { + if (equals(n->key, key)) { + return n; + } + n = n->next; + } + return NULL; + } + + bool put(const T_KEY& key, T_VAL& val) { + map_node_t* n = get(key); + if (n) { + n->val = val; + return true; + } + + if (!m_FreeRoot) { + return false; + } + + n = m_FreeRoot; + m_FreeRoot = m_FreeRoot->next; + + n->key = key; + n->val = val; + + unsigned int rootId = GetRoodNodeId(key); + map_node_t* root = m_RootNodes[rootId]; + + if (root) { + root->prev = n; + } + + n->prev = NULL; + n->next = root; + m_RootNodes[rootId] = n; + + return true; + } + + void remove(map_node_t* node) { + unlink(node); + linkToFreeStack(node); + } + + bool remove(const T_KEY& key) { + map_node_t* n = get(key); + if (!n) { + return false; + } + + remove(n); + return true; + } + + class Iterator { + friend class CStaticMap; + protected: + CStaticMap* m_Map; + map_node_t** m_RootNodes; + unsigned int m_NextRootNode; + map_node_t* m_CurNode; + + void searchForNextNode() { + if (m_CurNode && m_CurNode->next) { + m_CurNode = m_CurNode->next; + return; + } + + m_CurNode = NULL; + while (!m_CurNode) { + if (m_NextRootNode >= (1 << ASSOC_2N)) { + return; + } + m_CurNode = m_RootNodes[m_NextRootNode++]; + } + } + + + Iterator(CStaticMap* m) { + m_Map = m; + m_RootNodes = m_Map->m_RootNodes; + m_NextRootNode = 0; + m_CurNode = NULL; + searchForNextNode(); + } + + public: + map_node_t* next() { + searchForNextNode(); + return m_CurNode; + } + + map_node_t* current() { + return m_CurNode; + } + + void remove() { + m_Map->remove(m_CurNode); + m_CurNode = NULL; + } + + bool hasElement() { + return m_CurNode != NULL; + } + }; + + Iterator iterator() { + return Iterator(this); + } +}; + +template +class CStringKeyStaticMap : public CStaticMap { +protected: + virtual uint32 hash(const char* const &val) { + return crc32c((const unsigned char*)val, strlen(val)); + } + + virtual bool equals(const char* const &val1, const char* const &val2) { + return !strcmp(val1, val2); + } + +public: + CStringKeyStaticMap() { + } + +}; + +template +class CICaseStringKeyStaticMap : public CStaticMap { +protected: + virtual uint32 hash(const char* const &val) { + uint32 cksum = 0; + const char* pcc = val; + if (cpuinfo.sse4_2) { + while (*pcc) { + char cc = *(pcc++); + if (cc >= 'A' || cc <= 'Z') { + cc |= 0x20; + } + cksum = crc32c_t8_sse(cksum, cc); + } + } else { + while (*pcc) { + char cc = *(pcc++); + if (cc >= 'A' || cc <= 'Z') { + cc |= 0x20; + } + cksum = crc32c_t8_nosse(cksum, cc); + } + } + return cksum; + } + + virtual bool equals(const char* const &val1, const char* const &val2) { + return !_stricmp(val1, val2); + } + +public: + CICaseStringKeyStaticMap() { + } + +}; diff --git a/reapi/include/cssdk/engine/studio.h b/reapi/include/cssdk/engine/studio.h new file mode 100644 index 0000000..1da691e --- /dev/null +++ b/reapi/include/cssdk/engine/studio.h @@ -0,0 +1,358 @@ +/*** +* +* Copyright (c) 1996-2002, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ +#pragma once + +/* +============================================================================== + +STUDIO MODELS + +Studio models are position independent, so the cache manager can move them. +============================================================================== +*/ + + +#define MAXSTUDIOTRIANGLES 20000 // TODO: tune this +#define MAXSTUDIOVERTS 2048 // TODO: tune this +#define MAXSTUDIOSEQUENCES 2048 // total animation sequences +#define MAXSTUDIOSKINS 100 // total textures +#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement +#define MAXSTUDIOBONES 128 // total bones actually used +#define MAXSTUDIOMODELS 32 // sub-models per model +#define MAXSTUDIOBODYPARTS 32 +#define MAXSTUDIOGROUPS 16 +#define MAXSTUDIOANIMATIONS 2048 // per sequence +#define MAXSTUDIOMESHES 256 +#define MAXSTUDIOEVENTS 1024 +#define MAXSTUDIOPIVOTS 256 +#define MAXSTUDIOCONTROLLERS 8 + +typedef struct +{ + int id; + int version; + + char name[64]; + int length; + + vec3_t eyeposition; // ideal eye position + vec3_t min; // ideal movement hull size + vec3_t max; + + vec3_t bbmin; // clipping bounding box + vec3_t bbmax; + + int flags; + + int numbones; // bones + int boneindex; + + int numbonecontrollers; // bone controllers + int bonecontrollerindex; + + int numhitboxes; // complex bounding boxes + int hitboxindex; + + int numseq; // animation sequences + int seqindex; + + int numseqgroups; // demand loaded sequences + int seqgroupindex; + + int numtextures; // raw textures + int textureindex; + int texturedataindex; + + int numskinref; // replaceable textures + int numskinfamilies; + int skinindex; + + int numbodyparts; + int bodypartindex; + + int numattachments; // queryable attachable points + int attachmentindex; + + int soundtable; + int soundindex; + int soundgroups; + int soundgroupindex; + + int numtransitions; // animation node to animation node transition graph + int transitionindex; +} studiohdr_t; + +// header for demand loaded sequence group data +typedef struct +{ + int id; + int version; + + char name[64]; + int length; +} studioseqhdr_t; + +// bones +typedef struct +{ + char name[32]; // bone name for symbolic links + int parent; // parent bone + int flags; // ?? + int bonecontroller[6]; // bone controller index, -1 == none + float value[6]; // default DoF values + float scale[6]; // scale for delta DoF values +} mstudiobone_t; + + +// bone controllers +typedef struct +{ + int bone; // -1 == 0 + int type; // X, Y, Z, XR, YR, ZR, M + float start; + float end; + int rest; // byte index value at rest + int index; // 0-3 user set controller, 4 mouth +} mstudiobonecontroller_t; + +// intersection boxes +typedef struct +{ + int bone; + int group; // intersection group + vec3_t bbmin; // bounding box + vec3_t bbmax; +} mstudiobbox_t; + +// demand loaded sequence groups +typedef struct +{ + char label[32]; // textual name + char name[64]; // file name + int32 unused1; // was "cache" - index pointer + int unused2; // was "data" - hack for group 0 +} mstudioseqgroup_t; + +// sequence descriptions +typedef struct +{ + char label[32]; // sequence label + + float fps; // frames per second + int flags; // looping/non-looping flags + + int activity; + int actweight; + + int numevents; + int eventindex; + + int numframes; // number of frames per sequence + + int numpivots; // number of foot pivots + int pivotindex; + + int motiontype; + int motionbone; + vec3_t linearmovement; + int automoveposindex; + int automoveangleindex; + + vec3_t bbmin; // per sequence bounding box + vec3_t bbmax; + + int numblends; + int animindex; // mstudioanim_t pointer relative to start of sequence group data + // [blend][bone][X, Y, Z, XR, YR, ZR] + + int blendtype[2]; // X, Y, Z, XR, YR, ZR + float blendstart[2]; // starting value + float blendend[2]; // ending value + int blendparent; + + int seqgroup; // sequence group for demand loading + + int entrynode; // transition node at entry + int exitnode; // transition node at exit + int nodeflags; // transition rules + + int nextseq; // auto advancing sequences +} mstudioseqdesc_t; + +// events +#include "studio_event.h" +/* +typedef struct +{ + int frame; + int event; + int type; + char options[64]; +} mstudioevent_t; +*/ + +// pivots +typedef struct +{ + vec3_t org; // pivot point + int start; + int end; +} mstudiopivot_t; + +// attachment +typedef struct +{ + char name[32]; + int type; + int bone; + vec3_t org; // attachment point + vec3_t vectors[3]; +} mstudioattachment_t; + +typedef struct +{ + unsigned short offset[6]; +} mstudioanim_t; + +// animation frames +typedef union +{ + struct { + byte valid; + byte total; + } num; + short value; +} mstudioanimvalue_t; + + + +// body part index +typedef struct +{ + char name[64]; + int nummodels; + int base; + int modelindex; // index into models array +} mstudiobodyparts_t; + + + +// skin info +typedef struct +{ + char name[64]; + int flags; + int width; + int height; + int index; +} mstudiotexture_t; + + +// skin families +// short index[skinfamilies][skinref] + +// studio models +typedef struct +{ + char name[64]; + + int type; + + float boundingradius; + + int nummesh; + int meshindex; + + int numverts; // number of unique vertices + int vertinfoindex; // vertex bone info + int vertindex; // vertex vec3_t + int numnorms; // number of unique surface normals + int norminfoindex; // normal bone info + int normindex; // normal vec3_t + + int numgroups; // deformation groups + int groupindex; +} mstudiomodel_t; + + +// vec3_t boundingbox[model][bone][2]; // complex intersection info + + +// meshes +typedef struct +{ + int numtris; + int triindex; + int skinref; + int numnorms; // per mesh normals + int normindex; // normal vec3_t +} mstudiomesh_t; + +// triangles +#if 0 +typedef struct +{ + short vertindex; // index into vertex array + short normindex; // index into normal array + short s,t; // s,t position on skin +} mstudiotrivert_t; +#endif + +// lighting options +#define STUDIO_NF_FLATSHADE 0x0001 +#define STUDIO_NF_CHROME 0x0002 +#define STUDIO_NF_FULLBRIGHT 0x0004 +#define STUDIO_NF_NOMIPS 0x0008 +#define STUDIO_NF_ALPHA 0x0010 +#define STUDIO_NF_ADDITIVE 0x0020 +#define STUDIO_NF_MASKED 0x0040 + +// motion flags +#define STUDIO_X 0x0001 +#define STUDIO_Y 0x0002 +#define STUDIO_Z 0x0004 +#define STUDIO_XR 0x0008 +#define STUDIO_YR 0x0010 +#define STUDIO_ZR 0x0020 +#define STUDIO_LX 0x0040 +#define STUDIO_LY 0x0080 +#define STUDIO_LZ 0x0100 +#define STUDIO_AX 0x0200 +#define STUDIO_AY 0x0400 +#define STUDIO_AZ 0x0800 +#define STUDIO_AXR 0x1000 +#define STUDIO_AYR 0x2000 +#define STUDIO_AZR 0x4000 +#define STUDIO_TYPES 0x7FFF +#define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance + +// sequence flags +#define STUDIO_LOOPING 0x0001 + +// bone flags +#define STUDIO_HAS_NORMALS 0x0001 +#define STUDIO_HAS_VERTICES 0x0002 +#define STUDIO_HAS_BBOX 0x0004 +#define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them + +#define RAD_TO_STUDIO (32768.0/M_PI) +#define STUDIO_TO_RAD (M_PI/32768.0) + + +#define STUDIO_NUM_HULLS 128 +#define STUDIO_NUM_PLANES (STUDIO_NUM_HULLS * 6) +#define STUDIO_CACHE_SIZE 16 + + diff --git a/reapi/include/cssdk/engine/sys_shared.cpp b/reapi/include/cssdk/engine/sys_shared.cpp new file mode 100644 index 0000000..a642c76 --- /dev/null +++ b/reapi/include/cssdk/engine/sys_shared.cpp @@ -0,0 +1,72 @@ +/* +* +* 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 "sys_shared.h" + +#if defined(__GNUC__) +#include +#endif + +#define SSE3_FLAG (1<<0) +#define SSSE3_FLAG (1<<9) +#define SSE4_1_FLAG (1<<19) +#define SSE4_2_FLAG (1<<20) +#define POPCNT_FLAG (1<<23) +#define AVX_FLAG (1<<28) +#define AVX2_FLAG (1<<5) + +cpuinfo_t cpuinfo; + +void Sys_CheckCpuInstructionsSupport(void) +{ + unsigned int cpuid_data[4]; + +#if defined ASMLIB_H + cpuid_ex((int *)cpuid_data, 1, 0); +#elif defined(__GNUC__) + __get_cpuid(0x1, &cpuid_data[0], &cpuid_data[1], &cpuid_data[2], &cpuid_data[3]); +#else + __cpuidex((int *)cpuid_data, 1, 0); +#endif + + cpuinfo.sse3 = (cpuid_data[2] & SSE3_FLAG) ? 1 : 0; // ecx + cpuinfo.ssse3 = (cpuid_data[2] & SSSE3_FLAG) ? 1 : 0; + cpuinfo.sse4_1 = (cpuid_data[2] & SSE4_1_FLAG) ? 1 : 0; + cpuinfo.sse4_2 = (cpuid_data[2] & SSE4_2_FLAG) ? 1 : 0; + cpuinfo.popcnt = (cpuid_data[2] & POPCNT_FLAG) ? 1 : 0; + cpuinfo.avx = (cpuid_data[2] & AVX_FLAG) ? 1 : 0; + +#if defined ASMLIB_H + cpuid_ex((int *)cpuid_data, 7, 0); +#elif defined(__GNUC__) + __get_cpuid(0x7, &cpuid_data[0], &cpuid_data[1], &cpuid_data[2], &cpuid_data[3]); +#else + __cpuidex((int *)cpuid_data, 7, 0); +#endif + + cpuinfo.avx2 = (cpuid_data[1] & AVX2_FLAG) ? 1 : 0; // ebx +} \ No newline at end of file diff --git a/reapi/include/cssdk/engine/sys_shared.h b/reapi/include/cssdk/engine/sys_shared.h new file mode 100644 index 0000000..5b5da98 --- /dev/null +++ b/reapi/include/cssdk/engine/sys_shared.h @@ -0,0 +1,39 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include + +typedef struct cpuinfo_s +{ + uint8 sse3, ssse3, sse4_1, sse4_2, avx, avx2, popcnt; +} cpuinfo_t; + +extern cpuinfo_t cpuinfo; + +void Sys_CheckCpuInstructionsSupport(void); diff --git a/reapi/include/cssdk/engine/userid_rehlds.h b/reapi/include/cssdk/engine/userid_rehlds.h new file mode 100644 index 0000000..ff73c5d --- /dev/null +++ b/reapi/include/cssdk/engine/userid_rehlds.h @@ -0,0 +1,47 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "archtypes.h" + +// Authentication types +enum AUTH_IDTYPE +{ + AUTH_IDTYPE_UNKNOWN = 0, + AUTH_IDTYPE_STEAM = 1, + AUTH_IDTYPE_VALVE = 2, + AUTH_IDTYPE_LOCAL = 3 +}; + +/* <2e915> ../engine/userid.h:22 */ +typedef struct USERID_s +{ + int idtype; + uint64 m_SteamID; + unsigned int clientip; +} USERID_t; diff --git a/reapi/include/cssdk/game_shared/GameEvent.h b/reapi/include/cssdk/game_shared/GameEvent.h new file mode 100644 index 0000000..c585fff --- /dev/null +++ b/reapi/include/cssdk/game_shared/GameEvent.h @@ -0,0 +1,138 @@ +/* +* +* 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. +* +*/ +#pragma once + +enum GameEventType +{ + EVENT_INVALID = 0, + EVENT_WEAPON_FIRED, // tell bots the player is attack (argumens: 1 = attacker, 2 = NULL) + EVENT_WEAPON_FIRED_ON_EMPTY, // tell bots the player is attack without clip ammo (argumens: 1 = attacker, 2 = NULL) + EVENT_WEAPON_RELOADED, // tell bots the player is reloading his weapon (argumens: 1 = reloader, 2 = NULL) + + EVENT_HE_GRENADE_EXPLODED, // tell bots the HE grenade is exploded (argumens: 1 = grenade thrower, 2 = NULL) + EVENT_FLASHBANG_GRENADE_EXPLODED, // tell bots the flashbang grenade is exploded (argumens: 1 = grenade thrower, 2 = explosion origin) + EVENT_SMOKE_GRENADE_EXPLODED, // tell bots the smoke grenade is exploded (argumens: 1 = grenade thrower, 2 = NULL) + EVENT_GRENADE_BOUNCED, + + EVENT_BEING_SHOT_AT, + EVENT_PLAYER_BLINDED_BY_FLASHBANG, // tell bots the player is flashed (argumens: 1 = flashed player, 2 = NULL) + EVENT_PLAYER_FOOTSTEP, // tell bots the player is running (argumens: 1 = runner, 2 = NULL) + EVENT_PLAYER_JUMPED, // tell bots the player is jumped (argumens: 1 = jumper, 2 = NULL) + EVENT_PLAYER_DIED, // tell bots the player is killed (argumens: 1 = victim, 2 = killer) + EVENT_PLAYER_LANDED_FROM_HEIGHT, // tell bots the player is fell with some damage (argumens: 1 = felled player, 2 = NULL) + EVENT_PLAYER_TOOK_DAMAGE, // tell bots the player is take damage (argumens: 1 = victim, 2 = attacker) + EVENT_HOSTAGE_DAMAGED, // tell bots the player has injured a hostage (argumens: 1 = hostage, 2 = injurer) + EVENT_HOSTAGE_KILLED, // tell bots the player has killed a hostage (argumens: 1 = hostage, 2 = killer) + + EVENT_DOOR, // tell bots the door is moving (argumens: 1 = door, 2 = NULL) + EVENT_BREAK_GLASS, // tell bots the glass has break (argumens: 1 = glass, 2 = NULL) + EVENT_BREAK_WOOD, // tell bots the wood has break (argumens: 1 = wood, 2 = NULL) + EVENT_BREAK_METAL, // tell bots the metal/computer has break (argumens: 1 = metal/computer, 2 = NULL) + EVENT_BREAK_FLESH, // tell bots the flesh has break (argumens: 1 = flesh, 2 = NULL) + EVENT_BREAK_CONCRETE, // tell bots the concrete has break (argumens: 1 = concrete, 2 = NULL) + + EVENT_BOMB_PLANTED, // tell bots the bomb has been planted (argumens: 1 = planter, 2 = NULL) + EVENT_BOMB_DROPPED, // tell bots the bomb has been dropped (argumens: 1 = NULL, 2 = NULL) + EVENT_BOMB_PICKED_UP, // let the bots hear the bomb pickup (argumens: 1 = player that pickup c4, 2 = NULL) + EVENT_BOMB_BEEP, // let the bots hear the bomb beeping (argumens: 1 = c4, 2 = NULL) + EVENT_BOMB_DEFUSING, // tell the bots someone has started defusing (argumens: 1 = defuser, 2 = NULL) + EVENT_BOMB_DEFUSE_ABORTED, // tell the bots someone has aborted defusing (argumens: 1 = NULL, 2 = NULL) + EVENT_BOMB_DEFUSED, // tell the bots the bomb is defused (argumens: 1 = defuser, 2 = NULL) + EVENT_BOMB_EXPLODED, // let the bots hear the bomb exploding (argumens: 1 = NULL, 2 = NULL) + + EVENT_HOSTAGE_USED, // tell bots the hostage is used (argumens: 1 = user, 2 = NULL) + EVENT_HOSTAGE_RESCUED, // tell bots the hostage is rescued (argumens: 1 = rescuer (CBasePlayer *), 2 = hostage (CHostage *)) + EVENT_ALL_HOSTAGES_RESCUED, // tell bots the all hostages are rescued (argumens: 1 = NULL, 2 = NULL) + + EVENT_VIP_ESCAPED, // tell bots the VIP is escaped (argumens: 1 = NULL, 2 = NULL) + EVENT_VIP_ASSASSINATED, // tell bots the VIP is assassinated (argumens: 1 = NULL, 2 = NULL) + EVENT_TERRORISTS_WIN, // tell bots the terrorists won the round (argumens: 1 = NULL, 2 = NULL) + EVENT_CTS_WIN, // tell bots the CTs won the round (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_DRAW, // tell bots the round was a draw (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_WIN, // tell carreer the round was a win (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_LOSS, // tell carreer the round was a loss (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_START, // tell bots the round was started (when freeze period is expired) (argumens: 1 = NULL, 2 = NULL) + EVENT_PLAYER_SPAWNED, // tell bots the player is spawned (argumens: 1 = spawned player, 2 = NULL) + EVENT_CLIENT_CORPSE_SPAWNED, + EVENT_BUY_TIME_START, + EVENT_PLAYER_LEFT_BUY_ZONE, + EVENT_DEATH_CAMERA_START, + EVENT_KILL_ALL, + EVENT_ROUND_TIME, + EVENT_DIE, + EVENT_KILL, + EVENT_HEADSHOT, + EVENT_KILL_FLASHBANGED, + EVENT_TUTOR_BUY_MENU_OPENNED, + EVENT_TUTOR_AUTOBUY, + EVENT_PLAYER_BOUGHT_SOMETHING, + EVENT_TUTOR_NOT_BUYING_ANYTHING, + EVENT_TUTOR_NEED_TO_BUY_PRIMARY_WEAPON, + EVENT_TUTOR_NEED_TO_BUY_PRIMARY_AMMO, + EVENT_TUTOR_NEED_TO_BUY_SECONDARY_AMMO, + EVENT_TUTOR_NEED_TO_BUY_ARMOR, + EVENT_TUTOR_NEED_TO_BUY_DEFUSE_KIT, + EVENT_TUTOR_NEED_TO_BUY_GRENADE, + EVENT_CAREER_TASK_DONE, + + EVENT_START_RADIO_1, + EVENT_RADIO_COVER_ME, + EVENT_RADIO_YOU_TAKE_THE_POINT, + EVENT_RADIO_HOLD_THIS_POSITION, + EVENT_RADIO_REGROUP_TEAM, + EVENT_RADIO_FOLLOW_ME, + EVENT_RADIO_TAKING_FIRE, + EVENT_START_RADIO_2, + EVENT_RADIO_GO_GO_GO, + EVENT_RADIO_TEAM_FALL_BACK, + EVENT_RADIO_STICK_TOGETHER_TEAM, + EVENT_RADIO_GET_IN_POSITION_AND_WAIT, + EVENT_RADIO_STORM_THE_FRONT, + EVENT_RADIO_REPORT_IN_TEAM, + EVENT_START_RADIO_3, + EVENT_RADIO_AFFIRMATIVE, + EVENT_RADIO_ENEMY_SPOTTED, + EVENT_RADIO_NEED_BACKUP, + EVENT_RADIO_SECTOR_CLEAR, + EVENT_RADIO_IN_POSITION, + EVENT_RADIO_REPORTING_IN, + EVENT_RADIO_GET_OUT_OF_THERE, + EVENT_RADIO_NEGATIVE, + EVENT_RADIO_ENEMY_DOWN, + EVENT_END_RADIO, + + EVENT_NEW_MATCH, // tell bots the game is new (argumens: 1 = NULL, 2 = NULL) + EVENT_PLAYER_CHANGED_TEAM, // tell bots the player is switch his team (also called from ClientPutInServer()) (argumens: 1 = switcher, 2 = NULL) + EVENT_BULLET_IMPACT, // tell bots the player is shoot at wall (argumens: 1 = shooter, 2 = shoot trace end position) + EVENT_GAME_COMMENCE, // tell bots the game is commencing (argumens: 1 = NULL, 2 = NULL) + EVENT_WEAPON_ZOOMED, // tell bots the player is switch weapon zoom (argumens: 1 = zoom switcher, 2 = NULL) + EVENT_HOSTAGE_CALLED_FOR_HELP, // tell bots the hostage is talking (argumens: 1 = listener, 2 = NULL) + NUM_GAME_EVENTS, +}; + +extern const char *GameEventName[ NUM_GAME_EVENTS + 1 ]; diff --git a/reapi/include/cssdk/game_shared/bitvec.h b/reapi/include/cssdk/game_shared/bitvec.h new file mode 100644 index 0000000..f541bff --- /dev/null +++ b/reapi/include/cssdk/game_shared/bitvec.h @@ -0,0 +1,157 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CBitVecAccessor { +public: + CBitVecAccessor(uint32 *pDWords, int iBit); + + void operator=(int val); + operator uint32(); + +private: + uint32 *m_pDWords; + int m_iBit; +}; + +// CBitVec allows you to store a list of bits and do operations on them like they were +// an atomic type +template +class CBitVec { +public: + CBitVec(); + + // Set all values to the specified value (0 or 1..) + void Init(int val = 0); + + // Access the bits like an array. + CBitVecAccessor operator[](int i); + + // Operations on other bit vectors. + CBitVec &operator=(CBitVec const &other); + bool operator==(CBitVec const &other); + bool operator!=(CBitVec const &other); + + // Get underlying dword representations of the bits. + int GetNumDWords() { return NUM_DWORDS; } + uint32 GetDWord(int i); + void SetDWord(int i, uint32 val); + int GetNumBits(); + +private: + enum { NUM_DWORDS = NUM_BITS / 32 + !!(NUM_BITS & 31) }; + + unsigned int m_DWords[ NUM_DWORDS ]; +}; + +inline CBitVecAccessor::CBitVecAccessor(uint32 *pDWords, int iBit) +{ + m_pDWords = pDWords; + m_iBit = iBit; +} + +inline void CBitVecAccessor::operator=(int val) +{ + if (val) + m_pDWords[m_iBit >> 5] |= (1 << (m_iBit & 31)); + else + m_pDWords[m_iBit >> 5] &= ~(uint32)(1 << (m_iBit & 31)); +} + +inline CBitVecAccessor::operator uint32() +{ + return m_pDWords[m_iBit >> 5] & (1 << (m_iBit & 31)); +} + +template +inline int CBitVec::GetNumBits() +{ + return NUM_BITS; +} + +template +inline CBitVec::CBitVec() +{ + for (int i = 0; i < NUM_DWORDS; ++i) + m_DWords[i] = 0; +} + +template +inline void CBitVec::Init(int val) +{ + for (int i = 0; i < GetNumBits(); ++i) + { + (*this)[i] = val; + } +} + +template +inline CBitVec &CBitVec::operator=(CBitVec const &other) +{ + Q_memcpy(m_DWords, other.m_DWords, sizeof(m_DWords)); + return *this; +} + +template +inline CBitVecAccessor CBitVec::operator[](int i) +{ + assert(i >= 0 && i < GetNumBits()); + return CBitVecAccessor(m_DWords, i); +} + +template +inline bool CBitVec::operator==(CBitVec const &other) +{ + for (int i = 0; i < NUM_DWORDS; ++i) + { + if (m_DWords[i] != other.m_DWords[i]) + return false; + } + + return true; +} + +template +inline bool CBitVec::operator!=(CBitVec const &other) +{ + return !(*this == other); +} + +template +inline uint32 CBitVec::GetDWord(int i) +{ + assert(i >= 0 && i < NUM_DWORDS); + return m_DWords[i]; +} + +template +inline void CBitVec::SetDWord(int i, uint32 val) +{ + assert(i >= 0 && i < NUM_DWORDS); + m_DWords[i] = val; +} diff --git a/reapi/include/cssdk/game_shared/bot/bot.h b/reapi/include/cssdk/game_shared/bot/bot.h new file mode 100644 index 0000000..a8d060c --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/bot.h @@ -0,0 +1,163 @@ +/* +* +* 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. +* +*/ +#pragma once + +class BotProfile; + +// The base bot class from which bots for specific games are derived +class CBot: public CBasePlayer { +public: + virtual void Spawn() = 0; + + // invoked when injured by something + virtual int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0; + + // invoked when killed + virtual void Killed(entvars_t *pevAttacker, int iGib) = 0; + virtual void Think() = 0; + virtual BOOL IsBot() = 0; + virtual Vector GetAutoaimVector(float flDelta) = 0; + + // invoked when in contact with a CWeaponBox + virtual void OnTouchingWeapon(CWeaponBox *box) = 0; + virtual bool Initialize(const BotProfile *profile) = 0; + virtual void SpawnBot() = 0; + + // lightweight maintenance, invoked frequently + virtual void Upkeep() = 0; + + // heavyweight algorithms, invoked less often + virtual void Update() = 0; + + virtual void Run() = 0; + virtual void Walk() = 0; + virtual void Crouch() = 0; + virtual void StandUp() = 0; + virtual void MoveForward() = 0; + virtual void MoveBackward() = 0; + virtual void StrafeLeft() = 0; + virtual void StrafeRight() = 0; + + // returns true if jump was started + #define MUST_JUMP true + virtual bool Jump(bool mustJump = false) = 0; + + // zero any MoveForward(), Jump(), etc + virtual void ClearMovement() = 0; + + // Weapon interface + virtual void UseEnvironment() = 0; + virtual void PrimaryAttack() = 0; + virtual void ClearPrimaryAttack() = 0; + virtual void TogglePrimaryAttack() = 0; + virtual void SecondaryAttack() = 0; + virtual void Reload() = 0; + + // invoked when event occurs in the game (some events have NULL entities) + virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0; + + // return true if we can see the point + virtual bool IsVisible(const Vector *pos, bool testFOV = false) const = 0; + + // return true if we can see any part of the player + virtual bool IsVisible(CBasePlayer *player, bool testFOV = false, unsigned char *visParts = NULL) const = 0; + + enum VisiblePartType:uint8 + { + NONE = 0x00, + CHEST = 0x01, + HEAD = 0x02, + LEFT_SIDE = 0x04, // the left side of the object from our point of view (not their left side) + RIGHT_SIDE = 0x08, // the right side of the object from our point of view (not their right side) + FEET = 0x10 + }; + + // if enemy is visible, return the part we see + virtual bool IsEnemyPartVisible(VisiblePartType part) const = 0; + + // return true if player is facing towards us + virtual bool IsPlayerFacingMe(CBasePlayer *other) const = 0; + + // returns true if other player is pointing right at us + virtual bool IsPlayerLookingAtMe(CBasePlayer *other) const = 0; + virtual void ExecuteCommand() = 0; + virtual void SetModel(const char *modelName) = 0; + +public: + unsigned int GetID() const { return m_id; } + bool IsRunning() const { return m_isRunning; } + bool IsCrouching() const { return m_isCrouching; } + + // return time last jump began + float GetJumpTimestamp() const { return m_jumpTimestamp; } + + // return our personality profile + const BotProfile *GetProfile() const { return m_profile; } + +public: + // the "personality" profile of this bot + const BotProfile *m_profile; + + // unique bot ID + unsigned int m_id; + + // Think mechanism variables + float m_flNextBotThink; + float m_flNextFullBotThink; + + // Command interface variables + float m_flPreviousCommandTime; + + // run/walk mode + bool m_isRunning; + + // true if crouching (ducking) + bool m_isCrouching; + float m_forwardSpeed; + float m_strafeSpeed; + float m_verticalSpeed; + + // bitfield of movement buttons + unsigned short m_buttonFlags; + + // time when we last began a jump + float m_jumpTimestamp; + + // the PostureContext represents the current settings of walking and crouching + struct PostureContext + { + bool isRunning; + bool isCrouching; + }; + + enum { MAX_POSTURE_STACK = 8 }; + PostureContext m_postureStack[MAX_POSTURE_STACK]; + + // index of top of stack + int m_postureStackIndex; +}; diff --git a/reapi/include/cssdk/game_shared/bot/bot_constants.h b/reapi/include/cssdk/game_shared/bot/bot_constants.h new file mode 100644 index 0000000..14438b5 --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/bot_constants.h @@ -0,0 +1,47 @@ +/* +* +* 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. +* +*/ +#pragma once + +// We'll define our own version of this, because everyone else does. +// This needs to stay in sync with MAX_CLIENTS, but there's no header with the #define. +#define BOT_MAX_CLIENTS 32 + +// version number is MAJOR.MINOR +#define BOT_VERSION_MAJOR 1 +#define BOT_VERSION_MINOR 50 + +// Difficulty levels +enum BotDifficultyType +{ + BOT_EASY = 0, + BOT_NORMAL, + BOT_HARD, + BOT_EXPERT, + + NUM_DIFFICULTY_LEVELS +}; diff --git a/reapi/include/cssdk/game_shared/bot/bot_manager.h b/reapi/include/cssdk/game_shared/bot/bot_manager.h new file mode 100644 index 0000000..e232753 --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/bot_manager.h @@ -0,0 +1,70 @@ +/* +* +* 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. +* +*/ +#pragma once + +// STL uses exceptions, but we are not compiling with them - ignore warning +#pragma warning(disable : 4530) + +#include + +class CNavArea; +class CGrenade; + +class ActiveGrenade { +public: + int m_id; + CGrenade *m_entity; + Vector m_detonationPosition; + float m_dieTimestamp; +}; + +typedef std::list ActiveGrenadeList; + +class CBotManager { +public: + virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0; + virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; + + virtual void ServerActivate() = 0; + virtual void ServerDeactivate() = 0; + + virtual void ServerCommand(const char *pcmd) = 0; + virtual void AddServerCommand(const char *cmd) = 0; + virtual void AddServerCommands() = 0; + + virtual void RestartRound() = 0; + virtual void StartFrame() = 0; + + // Events are propogated to all bots. + virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) = 0; // Invoked when event occurs in the game (some events have NULL entity). + virtual unsigned int GetPlayerPriority(CBasePlayer *player) const = 0; // return priority of player (0 = max pri) + +public: + // the list of active grenades the bots are aware of + ActiveGrenadeList m_activeGrenadeList; +}; diff --git a/reapi/include/cssdk/game_shared/bot/bot_profile.h b/reapi/include/cssdk/game_shared/bot/bot_profile.h new file mode 100644 index 0000000..5f000f5 --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/bot_profile.h @@ -0,0 +1,116 @@ +/* +* +* 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. +* +*/ +#pragma once + +// long STL names get truncated in browse info. +#pragma warning(disable : 4786) + +#ifndef _WIN32 +#include +#include +#endif // _WIN32 + +#undef min +#undef max + +#include +#include + +#include "bot_constants.h" + +enum +{ + FirstCustomSkin = 100, + NumCustomSkins = 100, + LastCustomSkin = FirstCustomSkin + NumCustomSkins - 1, +}; + +enum BotProfileTeamType +{ + BOT_TEAM_T, + BOT_TEAM_CT, + BOT_TEAM_ANY +}; + +class BotProfile { +public: + const char *GetName() const { return m_name; } + float GetAggression() const { return m_aggression; } + float GetSkill() const { return m_skill; } + float GetTeamwork() const { return m_teamwork; } + int GetWeaponPreference(int i) const { return m_weaponPreference[i]; } + int GetWeaponPreferenceCount() const { return m_weaponPreferenceCount; } + int GetCost() const { return m_cost; } + int GetSkin() const { return m_skin; } + int GetVoicePitch() const { return m_voicePitch; } + float GetReactionTime() const { return m_reactionTime; } + float GetAttackDelay() const { return m_attackDelay; } + int GetVoiceBank() const { return m_voiceBank; } + bool PrefersSilencer() const { return m_prefersSilencer; } +public: + friend class BotProfileManager; + + char *m_name; + float m_aggression; + float m_skill; + float m_teamwork; + + enum { MAX_WEAPON_PREFS = 16 }; + + int m_weaponPreference[MAX_WEAPON_PREFS]; + int m_weaponPreferenceCount; + + int m_cost; + int m_skin; + + unsigned char m_difficultyFlags; + int m_voicePitch; + float m_reactionTime; + float m_attackDelay; + enum BotProfileTeamType m_teams; + bool m_prefersSilencer; + int m_voiceBank; +}; + +typedef std::list BotProfileList; + +class BotProfileManager { +public: + typedef std::vector VoiceBankList; + const BotProfileList *GetProfileList() const { return &m_profileList; } + const VoiceBankList *GetVoiceBanks() const { return &m_voiceBanks; } + +public: + BotProfileList m_profileList; + VoiceBankList m_voiceBanks; + + char *m_skins[NumCustomSkins]; + char *m_skinModelnames[NumCustomSkins]; + char *m_skinFilenames[NumCustomSkins]; + int m_nextSkin; +}; diff --git a/reapi/include/cssdk/game_shared/bot/bot_util.h b/reapi/include/cssdk/game_shared/bot/bot_util.h new file mode 100644 index 0000000..776d421 --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/bot_util.h @@ -0,0 +1,141 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define COS_TABLE_SIZE 256 + +#define RAD_TO_DEG(deg) ((deg) * 180.0 / M_PI) +#define DEG_TO_RAD(rad) ((rad) * M_PI / 180.0) + +#define SIGN(num) (((num) < 0) ? -1 : 1) +#define ABS(num) (SIGN(num) * (num)) + +class CBasePlayer; +class BotProfile; + +enum PriorityType +{ + PRIORITY_LOW, PRIORITY_MEDIUM, PRIORITY_HIGH, PRIORITY_UNINTERRUPTABLE +}; + +// Simple class for tracking intervals of game time +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; } + + 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; } + +private: + float m_timestamp; +}; + +// Simple class for counting down a short interval of time +class CountdownTimer { +public: + 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 Invalidate() { m_timestamp = -1.0f; } + bool IsElapsed() const { return (gpGlobals->time > m_timestamp); } + +private: + float m_duration; + float m_timestamp; +}; + +// Return true if the given entity is valid +inline bool IsEntityValid(CBaseEntity *entity) +{ + if (entity == NULL) + return false; + + if (FNullEnt(entity->pev)) + return false; + + if (FStrEq(STRING(entity->pev->netname), "")) + return false; + + if (entity->pev->flags & FL_DORMANT) + return false; + + return true; +} + +// 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. +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); + if (denom == 0.0f) + { + // parallel + return false; + } + + float numS = (startA.y - startB.y) * (endB.x - startB.x) - (startA.x - startB.x) * (endB.y - startB.y); + if (numS == 0.0f) + { + // coincident + return true; + } + + float numT = (startA.y - startB.y) * (endA.x - startA.x) - (startA.x - startB.x) * (endA.y - startA.y); + float s = numS / denom; + if (s < 0.0f || s > 1.0f) + { + // intersection is not within line segment of startA to endA + return false; + } + + float t = numT / denom; + if (t < 0.0f || t > 1.0f) + { + // intersection is not within line segment of startB to endB + return false; + } + + // compute intesection point + if (result != NULL) + { + *result = startA + s * (endA - startA); + } + + return true; +} diff --git a/reapi/include/cssdk/game_shared/bot/improv.h b/reapi/include/cssdk/game_shared/bot/improv.h new file mode 100644 index 0000000..e04d26d --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/improv.h @@ -0,0 +1,120 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CBaseEntity; +class CNavLadder; + +// Improv-specific events +class IImprovEvent { +public: + virtual void OnMoveToSuccess(const Vector &goal) {}; // invoked when an improv reaches its MoveTo goal + + enum MoveToFailureType + { + FAIL_INVALID_PATH = 0, + FAIL_STUCK, + FAIL_FELL_OFF, + }; + + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {} // invoked when an improv fails to reach a MoveTo goal + virtual void OnInjury(float amount) {} // invoked when the improv is injured +}; + +// The Improv interface definition +// An "Improv" is an improvisational actor that simulates the +// behavor of a human in an unscripted, "make it up as you go" manner. +class CImprov: public IImprovEvent { +public: + virtual ~CImprov() {} + virtual bool IsAlive() const = 0; // return true if this improv is alive + + virtual void MoveTo(const Vector &goal) = 0; // move improv towards far-away goal (pathfind) + virtual void LookAt(const Vector &target) = 0; // define desired view target + virtual void ClearLookAt() = 0; // remove view goal + virtual void FaceTo(const Vector &goal) = 0; // orient body towards goal + virtual void ClearFaceTo() = 0; // remove body orientation goal + + virtual bool IsAtMoveGoal(float error = 20.0f) const = 0; // return true if improv is standing on its movement goal + virtual bool HasLookAt() const = 0; // return true if improv has a look at goal + virtual bool HasFaceTo() const = 0; // return true if improv has a face to goal + virtual bool IsAtFaceGoal() const = 0; // return true if improv is facing towards its face goal + virtual bool IsFriendInTheWay(const Vector &goalPos) const = 0; // return true if a friend is blocking our line to the given goal position + virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const = 0; // return true if the given friend is blocking our line to the given goal position + + virtual void MoveForward() = 0; + virtual void MoveBackward() = 0; + virtual void StrafeLeft() = 0; + virtual void StrafeRight() = 0; + virtual bool Jump() = 0; + virtual void Crouch() = 0; + virtual void StandUp() = 0; // "un-crouch" + + virtual void TrackPath(const Vector &pathGoal, float deltaT) = 0; // move along path by following "pathGoal" + virtual void StartLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0; // invoked when a ladder is encountered while following a path + + virtual bool TraverseLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0; // traverse given ladder + virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0; // find "simple" ground height, treating current nav area as part of the floor + + virtual void Run() = 0; + virtual void Walk() = 0; + virtual void Stop() = 0; + + virtual float GetMoveAngle() const = 0; // return direction of movement + virtual float GetFaceAngle() const = 0; // return direction of view + + virtual const Vector &GetFeet() const = 0; // return position of "feet" - point below centroid of improv at feet level + virtual const Vector &GetCentroid() const = 0; + virtual const Vector &GetEyes() const = 0; + + virtual bool IsRunning() const = 0; + virtual bool IsWalking() const = 0; + virtual bool IsStopped() const = 0; + + virtual bool IsCrouching() const = 0; + virtual bool IsJumping() const = 0; + virtual bool IsUsingLadder() const = 0; + virtual bool IsOnGround() const = 0; + virtual bool IsMoving() const = 0; // if true, improv is walking, crawling, running somewhere + + virtual bool CanRun() const = 0; + virtual bool CanCrouch() const = 0; + virtual bool CanJump() const = 0; + virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if improv can see position + virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0; // return true if 'other' is looking right at me + virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; // return player on given team that is looking right at me (team == 0 means any team), NULL otherwise + + virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0; // return actual travel distance to closest player on given team (team == 0 means any team) + virtual CNavArea *GetLastKnownArea() const = 0; + + virtual void OnUpdate(float deltaT) = 0; // a less frequent, full update 'tick' + virtual void OnUpkeep(float deltaT) = 0; // a frequent, lightweight update 'tick' + virtual void OnReset() = 0; // reset improv to initial state + virtual void OnGameEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; // invoked when an event occurs in the game + virtual void OnTouch(CBaseEntity *other) = 0; // "other" has touched us +}; diff --git a/reapi/include/cssdk/game_shared/bot/nav.h b/reapi/include/cssdk/game_shared/bot/nav.h new file mode 100644 index 0000000..65d2721 --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/nav.h @@ -0,0 +1,400 @@ +/* +* +* 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. +* +*/ +#pragma once + +// STL uses exceptions, but we are not compiling with them - ignore warning +#pragma warning(disable : 4530) + +// to help identify nav files +#define NAV_MAGIC_NUMBER 0xFEEDFACE + +// A place is a named group of navigation areas +typedef unsigned int Place; + +// ie: "no place" +#define UNDEFINED_PLACE 0 +#define ANY_PLACE 0xFFFF + +#define WALK_THRU_DOORS 0x01 +#define WALK_THRU_BREAKABLES 0x02 +#define WALK_THRU_EVERYTHING (WALK_THRU_DOORS | WALK_THRU_BREAKABLES) + +enum NavErrorType +{ + NAV_OK, + NAV_CANT_ACCESS_FILE, + NAV_INVALID_FILE, + NAV_BAD_FILE_VERSION, + NAV_CORRUPT_DATA, +}; + +enum NavAttributeType +{ + NAV_CROUCH = 0x01, // must crouch to use this node/area + NAV_JUMP = 0x02, // must jump to traverse this area + NAV_PRECISE = 0x04, // do not adjust for obstacles, just move along area + NAV_NO_JUMP = 0x08, // inhibit discontinuity jumping +}; + +enum NavDirType +{ + NORTH = 0, + EAST, + SOUTH, + WEST, + + NUM_DIRECTIONS +}; + +// Defines possible ways to move from one area to another +enum NavTraverseType +{ + // NOTE: First 4 directions MUST match NavDirType + GO_NORTH = 0, + GO_EAST, + GO_SOUTH, + GO_WEST, + GO_LADDER_UP, + GO_LADDER_DOWN, + GO_JUMP, + + NUM_TRAVERSE_TYPES +}; + +enum NavCornerType +{ + NORTH_WEST = 0, + NORTH_EAST, + SOUTH_EAST, + SOUTH_WEST, + + NUM_CORNERS +}; + +enum NavRelativeDirType +{ + FORWARD = 0, + RIGHT, + BACKWARD, + LEFT, + UP, + DOWN, + + NUM_RELATIVE_DIRECTIONS +}; + +const float GenerationStepSize = 25.0f; // (30) was 20, but bots can't fit always fit +const float StepHeight = 18.0f; // if delta Z is greater than this, we have to jump to get up +const float JumpHeight = 41.8f; // if delta Z is less than this, we can jump up on it +const float JumpCrouchHeight = 58.0f; // (48) if delta Z is less than or equal to this, we can jumpcrouch up on it + +// Strictly speaking, you CAN get up a slope of 1.643 (about 59 degrees), but you move very, very slowly +// This slope will represent the slope you can navigate without much slowdown +// rise/run - if greater than this, we can't move up it (de_survivor canyon ramps) +const float MaxSlope = 1.4f; + +// instead of MaxSlope, we are using the following max Z component of a unit normal +const float MaxUnitZSlope = 0.7f; + +const float BotRadius = 10.0f; // circular extent that contains bot +const float DeathDrop = 200.0f; // (300) distance at which we will die if we fall - should be about 600, and pay attention to fall damage during pathfind + +const float HalfHumanWidth = 16.0f; +const float HalfHumanHeight = 36.0f; +const float HumanHeight = 72.0f; + +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(); } + + // return true if 'pos' is inside of this extent + bool Contains(const Vector *pos) const + { + return (pos->x >= lo.x && pos->x <= hi.x && + pos->y >= lo.y && pos->y <= hi.y && + pos->z >= lo.z && pos->z <= hi.z); + } +}; + +struct Ray +{ + Vector from; + Vector to; +}; + +inline NavDirType OppositeDirection(NavDirType dir) +{ + switch (dir) + { + case NORTH: + return SOUTH; + case EAST: + return WEST; + case SOUTH: + return NORTH; + case WEST: + return EAST; + } + + return NORTH; +} + +inline NavDirType DirectionLeft(NavDirType dir) +{ + switch (dir) + { + case NORTH: + return WEST; + case SOUTH: + return EAST; + case EAST: + return NORTH; + case WEST: + return SOUTH; + } + + return NORTH; +} + +inline NavDirType DirectionRight(NavDirType dir) +{ + switch (dir) + { + case NORTH: + return EAST; + case SOUTH: + return WEST; + case EAST: + return SOUTH; + case WEST: + return NORTH; + } + + return NORTH; +} + +inline void AddDirectionVector(Vector *v, NavDirType dir, float amount) +{ + switch (dir) + { + case NORTH: + v->y -= amount; + return; + case SOUTH: + v->y += amount; + return; + case EAST: + v->x += amount; + return; + case WEST: + v->x -= amount; + return; + } +} + +inline float DirectionToAngle(NavDirType dir) +{ + switch (dir) + { + case NORTH: + return 270.0f; + case EAST: + return 0.0f; + case SOUTH: + return 90.0f; + case WEST: + return 180.0f; + } + + return 0.0f; +} + +inline NavDirType AngleToDirection(float angle) +{ + while (angle < 0.0f) + angle += 360.0f; + + while (angle > 360.0f) + angle -= 360.0f; + + if (angle < 45 || angle > 315) + return EAST; + + if (angle >= 45 && angle < 135) + return SOUTH; + + if (angle >= 135 && angle < 225) + return WEST; + + return NORTH; +} + +inline void DirectionToVector2D(NavDirType dir, Vector2D *v) +{ + switch (dir) + { + case NORTH: + v->x = 0.0f; + v->y = -1.0f; + break; + case SOUTH: + v->x = 0.0f; + v->y = 1.0f; + break; + case EAST: + v->x = 1.0f; + v->y = 0.0f; + break; + case WEST: + v->x = -1.0f; + v->y = 0.0f; + break; + } +} + +inline void SnapToGrid(Vector *pos) +{ + int cx = pos->x / GenerationStepSize; + int cy = pos->y / GenerationStepSize; + pos->x = cx * GenerationStepSize; + pos->y = cy * GenerationStepSize; +} + +inline void SnapToGrid(float *value) +{ + int c = *value / GenerationStepSize; + *value = c * GenerationStepSize; +} + +// custom +inline float SnapToGrid(float value) +{ + int c = value / GenerationStepSize; + return c * GenerationStepSize; +} + +inline float NormalizeAngle(float angle) +{ + while (angle < -180.0f) + angle += 360.0f; + + while (angle > 180.0f) + angle -= 360.0f; + + return angle; +} + +inline float NormalizeAnglePositive(float angle) +{ + while (angle < 0.0f) + angle += 360.0f; + + while (angle >= 360.0f) + angle -= 360.0f; + + return angle; +} + +inline float AngleDifference(float a, float b) +{ + float angleDiff = a - b; + + while (angleDiff > 180.0f) + angleDiff -= 360.0f; + + while (angleDiff < -180.0f) + angleDiff += 360.0f; + + return angleDiff; +} + +inline bool AnglesAreEqual(float a, float b, float tolerance = 5.0f) +{ + if (abs(int64(AngleDifference(a, b))) < tolerance) + return true; + + return false; +} + +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) + return true; + + return false; +} + +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 + if (FClassnameIs(entity, "func_door") || FClassnameIs(entity, "func_door_rotating")) + return (flags & WALK_THRU_DOORS) ? true : false; + + // if we hit a breakable object, assume its walkable because we will shoot it when we touch it + if (FClassnameIs(entity, "func_breakable") && entity->takedamage == DAMAGE_YES) + return (flags & WALK_THRU_BREAKABLES) ? true : false; + + return false; +} + +// Check LOS, ignoring any entities that we can walk through +inline bool IsWalkableTraceLineClear(Vector &from, Vector &to, unsigned int flags = 0) +{ + TraceResult result; + edict_t *ignore = NULL; + Vector useFrom = from; + + while (true) + { + UTIL_TraceLine(useFrom, to, ignore_monsters, ignore, &result); + + if (result.flFraction != 1.0f && IsEntityWalkable(VARS(result.pHit), flags)) + { + ignore = result.pHit; + + Vector dir = to - from; + dir.NormalizeInPlace(); + useFrom = result.vecEndPos + 5.0f * dir; + } + else + break; + } + + if (result.flFraction == 1.0f) + return true; + + return false; +} diff --git a/reapi/include/cssdk/game_shared/bot/nav_area.h b/reapi/include/cssdk/game_shared/bot/nav_area.h new file mode 100644 index 0000000..5c40b2a --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/nav_area.h @@ -0,0 +1,320 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include + +class CNavArea; +enum NavEditCmdType +{ + EDIT_NONE, + EDIT_DELETE, // delete current area + EDIT_SPLIT, // split current area + EDIT_MERGE, // merge adjacent areas + EDIT_JOIN, // define connection between areas + EDIT_BREAK, // break connection between areas + EDIT_MARK, // mark an area for further operations + EDIT_ATTRIB_CROUCH, // toggle crouch attribute on current area + EDIT_ATTRIB_JUMP, // toggle jump attribute on current area + EDIT_ATTRIB_PRECISE, // toggle precise attribute on current area + EDIT_ATTRIB_NO_JUMP, // toggle inhibiting discontinuity jumping in current area + EDIT_BEGIN_AREA, // begin creating a new nav area + EDIT_END_AREA, // end creation of the new nav area + EDIT_CONNECT, // connect marked area to selected area + EDIT_DISCONNECT, // disconnect marked area from selected area + EDIT_SPLICE, // create new area in between marked and selected areas + EDIT_TOGGLE_PLACE_MODE, // switch between normal and place editing + EDIT_TOGGLE_PLACE_PAINTING, // switch between "painting" places onto areas + EDIT_PLACE_FLOODFILL, // floodfill areas out from current area + EDIT_PLACE_PICK, // "pick up" the place at the current area + EDIT_MARK_UNNAMED, // mark an unnamed area for further operations + EDIT_WARP_TO_MARK, // warp a spectating local player to the selected mark + EDIT_SELECT_CORNER, // select a corner on the current area + EDIT_RAISE_CORNER, // raise a corner on the current area + EDIT_LOWER_CORNER, // lower a corner on the current area +}; + +enum RouteType +{ + FASTEST_ROUTE, + SAFEST_ROUTE, +}; + +union NavConnect +{ + unsigned int id; + CNavArea *area; + + bool operator==(const NavConnect &other) const { return (area == other.area) ? true : false; } +}; + +typedef std::list NavConnectList; + +enum LadderDirectionType +{ + LADDER_UP = 0, + LADDER_DOWN, + NUM_LADDER_DIRECTIONS +}; + +class CNavLadder { +public: + Vector m_top; + Vector m_bottom; + float m_length; + NavDirType m_dir; + Vector2D m_dirVector; + CBaseEntity *m_entity; + + CNavArea *m_topForwardArea; + CNavArea *m_topLeftArea; + CNavArea *m_topRightArea; + CNavArea *m_topBehindArea; + CNavArea *m_bottomArea; + + bool m_isDangling; + + void OnDestroyNotify(CNavArea *dead) + { + if (dead == m_topForwardArea) + m_topForwardArea = NULL; + + if (dead == m_topLeftArea) + m_topLeftArea = NULL; + + if (dead == m_topRightArea) + m_topRightArea = NULL; + + if (dead == m_topBehindArea) + m_topBehindArea = NULL; + + if (dead == m_bottomArea) + m_bottomArea = NULL; + } +}; + +typedef std::list NavLadderList; + +class HidingSpot { +public: + enum + { + IN_COVER = 0x01, + GOOD_SNIPER_SPOT = 0x02, + IDEAL_SNIPER_SPOT = 0x04 + }; + + bool HasGoodCover() const { return (m_flags & IN_COVER) ? true : false; } + bool IsGoodSniperSpot() const { return (m_flags & GOOD_SNIPER_SPOT) ? true : false; } + bool IsIdealSniperSpot() const { return (m_flags & IDEAL_SNIPER_SPOT) ? true : false; } + + void SetFlags(unsigned char flags) { m_flags |= flags; } + unsigned char GetFlags() const { return m_flags; } + + const Vector *GetPosition() const { return &m_pos; } + unsigned int GetID() const { return m_id; } + +private: + Vector m_pos; + unsigned int m_id; + unsigned int m_marker; + unsigned char m_flags; +}; + +typedef std::list HidingSpotList; + +struct SpotOrder +{ + float t; + union + { + HidingSpot *spot; + unsigned int id; + }; +}; + +typedef std::list SpotOrderList; + +struct SpotEncounter +{ + NavConnect from; + NavDirType fromDir; + NavConnect to; + NavDirType toDir; + Ray path; // the path segment + SpotOrderList spotList; // list of spots to look at, in order of occurrence +}; + +typedef std::list SpotEncounterList; +typedef std::list NavAreaList; + +// A CNavArea is a rectangular region defining a walkable area in the map +class CNavArea { +public: + 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 + + int GetAdjacentCount(NavDirType dir) const { return m_connect[dir].size(); } // return number of connected areas in given direction + const NavConnectList *GetAdjacentList(NavDirType dir) const { return &m_connect[dir]; } + + const NavLadderList *GetLadderList(LadderDirectionType dir) const { return &m_ladder[dir]; } + + // for hunting algorithm + void SetClearedTimestamp(int teamID) { m_clearedTimestamp[teamID] = gpGlobals->time; } // set this area's "clear" timestamp to now + float GetClearedTimestamp(int teamID) { return m_clearedTimestamp[teamID]; } // get time this area was marked "clear" + + // hiding spots + const HidingSpotList *GetHidingSpotList() const { return &m_hidingSpotList; } + + float GetSizeX() const { return m_extent.hi.x - m_extent.lo.x; } + float GetSizeY() const { return m_extent.hi.y - m_extent.lo.y; } + + const Extent *GetExtent() const { return &m_extent; } + const Vector *GetCenter() const { return &m_center; } + + // approach areas + struct ApproachInfo + { + NavConnect here; // the approach area + NavConnect prev; // the area just before the approach area on the path + NavTraverseType prevToHereHow; + NavConnect next; // the area just after the approach area on the path + NavTraverseType hereToNextHow; + }; + + const ApproachInfo *GetApproachInfo(int i) const { return &m_approach[i]; } + int GetApproachInfoCount() const { return m_approachCount; } + + void SetParent(CNavArea *parent, NavTraverseType how = NUM_TRAVERSE_TYPES) { m_parent = parent; m_parentHow = how; } + CNavArea *GetParent() const { return m_parent; } + NavTraverseType GetParentHow() const { return m_parentHow; } + + 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; } + +public: + friend class CNavAreaGrid; + friend class CCSBotManager; + + unsigned int m_id; // unique area ID + Extent m_extent; // extents of area in world coords (NOTE: lo.z is not necessarily the minimum Z, but corresponds to Z at point (lo.x, lo.y), etc + Vector m_center; // centroid of area + unsigned char m_attributeFlags; // set of attribute bit flags (see NavAttributeType) + Place m_place; // place descriptor + + // height of the implicit corners + float m_neZ; + float m_swZ; + + enum { MAX_AREA_TEAMS = 2 }; + + // for hunting + float m_clearedTimestamp[MAX_AREA_TEAMS]; // time this area was last "cleared" of enemies + + // danger + float m_danger[MAX_AREA_TEAMS]; // danger of this area, allowing bots to avoid areas where they died in the past - zero is no danger + float m_dangerTimestamp[MAX_AREA_TEAMS]; // time when danger value was set - used for decaying + + // hiding spots + HidingSpotList m_hidingSpotList; + + // encounter spots + SpotEncounterList m_spotEncounterList; // list of possible ways to move thru this area, and the spots to look at as we do + + // approach areas + enum { MAX_APPROACH_AREAS = 16 }; + ApproachInfo m_approach[MAX_APPROACH_AREAS]; + unsigned char m_approachCount; + + // A* pathfinding algorithm + unsigned int m_marker; // used to flag the area as visited + CNavArea *m_parent; // the area just prior to this on in the search path + NavTraverseType m_parentHow; // how we get from parent to us + float m_totalCost; // the distance so far plus an estimate of the distance left + float m_costSoFar; // distance travelled so far + + CNavArea *m_nextOpen, *m_prevOpen; // only valid if m_openMarker == m_masterMarker + unsigned int m_openMarker; // if this equals the current marker value, we are on the open list + + // connections to adjacent areas + NavConnectList m_connect[ NUM_DIRECTIONS ]; // a list of adjacent areas for each direction + NavLadderList m_ladder[ NUM_LADDER_DIRECTIONS ]; // list of ladders leading up and down from this area + + CNavNode *m_node[ NUM_CORNERS ]; // nav nodes at each corner of the area + NavAreaList m_overlapList; // list of areas that overlap this area + + CNavArea *m_prevHash, *m_nextHash; // for hash table in CNavAreaGrid +}; + +// 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 ) +class CNavAreaGrid { +public: + const float m_cellSize; + NavAreaList *m_grid; + int m_gridSizeX; + int m_gridSizeY; + float m_minX; + float m_minY; + unsigned int m_areaCount; // total number of nav areas + + enum { HASH_TABLE_SIZE = 256 }; + CNavArea *m_hashTable[HASH_TABLE_SIZE]; // hash table to optimize lookup by ID + inline int ComputeHashKey(unsigned int id) const // returns a hash key for the given nav area ID + { + return id & 0xFF; + } + inline int WorldToGridX(float wx) const + { + int x = (wx - m_minX) / m_cellSize; + if (x < 0) + x = 0; + + else if (x >= m_gridSizeX) + x = m_gridSizeX - 1; + + return x; + } + inline int WorldToGridY(float wy) const + { + int y = (wy - m_minY) / m_cellSize; + if (y < 0) + y = 0; + else if (y >= m_gridSizeY) + y = m_gridSizeY - 1; + + return y; + } +}; diff --git a/reapi/include/cssdk/game_shared/bot/nav_node.h b/reapi/include/cssdk/game_shared/bot/nav_node.h new file mode 100644 index 0000000..4c434a1 --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/nav_node.h @@ -0,0 +1,110 @@ +/* +* +* 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. +* +*/ +#pragma once + +class CNavNode { +public: + // get navigation node connected in given direction, or NULL if cant go that way + CNavNode *GetConnectedNode(NavDirType dir) const; + const Vector *GetPosition() const; + const Vector *GetNormal() const { return &m_normal; } + unsigned int GetID() const { return m_id; } + + CNavNode *GetNext() { return m_next; } + + // create a connection FROM this node TO the given node, in the given direction + CNavNode *GetParent() const; + + void MarkAsVisited(NavDirType dir); // mark the given direction as having been visited + BOOL HasVisited(NavDirType dir); // return TRUE if the given direction has already been searched + + void Cover() { m_isCovered = true; } // TODO: Should pass in area that is covering + BOOL IsCovered() const { return m_isCovered; } // return true if this node has been covered by an area + + void AssignArea(CNavArea *area); // assign the given area to this node + CNavArea *GetArea() const; // return associated area + + void SetAttributes(unsigned char bits) { m_attributeFlags = bits; } + unsigned char GetAttributes() const { return m_attributeFlags; } + +public: + friend void DestroyNavigationMap(); + + Vector m_pos; // position of this node in the world + Vector m_normal; // surface normal at this location + CNavNode *m_to[ NUM_DIRECTIONS ]; // links to north, south, east, and west. NULL if no link + unsigned int m_id; // unique ID of this node + unsigned char m_attributeFlags; // set of attribute bit flags (see NavAttributeType) + + CNavNode *m_next; // next link in master list + + // below are only needed when generating + // flags for automatic node generation. If direction bit is clear, that direction hasn't been explored yet. + unsigned char m_visited; + CNavNode *m_parent; // the node prior to this in the search, which we pop back to when this node's search is done (a stack) + BOOL m_isCovered; // true when this node is "covered" by a CNavArea + CNavArea *m_area; // the area this node is contained within +}; + +inline CNavNode *CNavNode::GetConnectedNode(NavDirType dir) const +{ + return m_to[ dir ]; +} + +inline const Vector *CNavNode::GetPosition() const +{ + return &m_pos; +} + +inline CNavNode *CNavNode::GetParent() const +{ + return m_parent; +} + +inline void CNavNode::MarkAsVisited(NavDirType dir) +{ + m_visited |= (1 << dir); +} + +inline BOOL CNavNode::HasVisited(NavDirType dir) +{ + if (m_visited & (1 << dir)) + return true; + + return false; +} + +inline void CNavNode::AssignArea(CNavArea *area) +{ + m_area = area; +} + +inline CNavArea *CNavNode::GetArea() const +{ + return m_area; +} diff --git a/reapi/include/cssdk/game_shared/bot/nav_path.h b/reapi/include/cssdk/game_shared/bot/nav_path.h new file mode 100644 index 0000000..614aa06 --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/nav_path.h @@ -0,0 +1,99 @@ +/* +* +* 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. +* +*/ +#pragma once + +// STL uses exceptions, but we are not compiling with them - ignore warning +#pragma warning(disable : 4530) + +class CNavPath { +public: + CNavPath() { m_segmentCount = 0; } + + struct PathSegment + { + CNavArea *area; // the area along the path + NavTraverseType how; // how to enter this area from the previous one + Vector pos; // our movement goal position at this point in the path + const CNavLadder *ladder; // if "how" refers to a ladder, this is it + }; + + const PathSegment *operator[](int i) { return (i >= 0 && i < m_segmentCount) ? &m_path[i] : NULL; } + int GetSegmentCount() const { return m_segmentCount; } + const Vector &GetEndpoint() const { return m_path[ m_segmentCount - 1 ].pos; } + + bool IsValid() const { return (m_segmentCount > 0); } + void Invalidate() { m_segmentCount = 0; } +public: + enum { MAX_PATH_SEGMENTS = 256 }; + PathSegment m_path[ MAX_PATH_SEGMENTS ]; + int m_segmentCount; + + bool ComputePathPositions(); // determine actual path positions + bool BuildTrivialPath(const Vector *start, const Vector *goal); // utility function for when start and goal are in the same area + int FindNextOccludedNode(int anchor_); // used by Optimize() +}; + +// Monitor improv movement and determine if it becomes stuck +class CStuckMonitor { +public: + bool IsStuck() const { return m_isStuck; } + float GetDuration() const { return m_isStuck ? m_stuckTimer.GetElapsedTime() : 0.0f; } +public: + bool m_isStuck; // if true, we are stuck + Vector m_stuckSpot; // the location where we became stuck + IntervalTimer m_stuckTimer; // how long we have been stuck + + enum { MAX_VEL_SAMPLES = 5 }; + + float m_avgVel[ MAX_VEL_SAMPLES ]; + int m_avgVelIndex; + int m_avgVelCount; + Vector m_lastCentroid; + float m_lastTime; +}; + +// The CNavPathFollower class implements path following behavior +class CNavPathFollower { +public: + void SetImprov(CImprov *improv) { m_improv = improv; } + void SetPath(CNavPath *path) { m_path = path; } + + void Debug(bool status) { m_isDebug = status; } // turn debugging on/off +public: + 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. + + CImprov *m_improv; // who is doing the path following + CNavPath *m_path; // the path being followed + int m_segmentIndex; // the point on the path the improv is moving towards + int m_behindIndex; // index of the node on the path just behind us + Vector m_goal; // last computed follow goal + bool m_isLadderStarted; + bool m_isDebug; + CStuckMonitor m_stuckMonitor; +}; diff --git a/reapi/include/cssdk/game_shared/bot/simple_state_machine.h b/reapi/include/cssdk/game_shared/bot/simple_state_machine.h new file mode 100644 index 0000000..baa931e --- /dev/null +++ b/reapi/include/cssdk/game_shared/bot/simple_state_machine.h @@ -0,0 +1,101 @@ +/* +* +* 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. +* +*/ +#pragma once + +// Encapsulation of a finite-state-machine state +template +class SimpleState { +public: + SimpleState() { m_parent = NULL; } + + virtual ~SimpleState() {}; + virtual void OnEnter(T userData) {}; // when state is entered + virtual void OnUpdate(T userData) {}; // state behavior + virtual void OnExit(T userData) {}; // when state exited + virtual const char *GetName() const = 0; // return state name + + void SetParent(SimpleState *parent) + { + m_parent = parent; + } + SimpleState *GetParent() const + { + return m_parent; + } + +private: + // the parent state that contains this state + SimpleState *m_parent; +}; + +// Encapsulation of a finite state machine +template +class SimpleStateMachine { +public: + SimpleStateMachine() + { + m_state = NULL; + } + void Reset(T userData) + { + m_userData = userData; + m_state = NULL; + } + // change behavior state - WARNING: not re-entrant. Do not SetState() from within OnEnter() or OnExit() + void SetState(S *newState) + { + if (m_state) + m_state->OnExit(m_userData); + + newState->OnEnter(m_userData); + + m_state = newState; + m_stateTimer.Start(); + } + // how long have we been in the current state + float GetStateDuration() const + { + return m_stateTimer.GetElapsedTime(); + } + // return true if given state is current state of machine + bool IsState(const S *state) const + { + return (state == m_state); + } + // execute current state of machine + void Update() + { + if (m_state) + m_state->OnUpdate(m_userData); + } + +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/reapi/include/cssdk/game_shared/perf_counter.h b/reapi/include/cssdk/game_shared/perf_counter.h new file mode 100644 index 0000000..e99c700 --- /dev/null +++ b/reapi/include/cssdk/game_shared/perf_counter.h @@ -0,0 +1,183 @@ +/* +* +* 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. +* +*/ +#pragma once + +#ifdef _WIN32 + #include + #include + #include +#else + #include + #include + #include + #include + #ifdef OSX + #include + #else + #include + #endif + #include +#endif + +#include +#include +#include +#include +#include + +class CPerformanceCounter +{ +public: + CPerformanceCounter(); + + void InitializePerformanceCounter(); + double GetCurTime(); + +private: + int m_iLowShift; + double m_flPerfCounterFreq; + double m_flCurrentTime; + double m_flLastCurrentTime; +}; + +inline CPerformanceCounter::CPerformanceCounter() : + m_iLowShift(0), + m_flPerfCounterFreq(0), + m_flCurrentTime(0), + m_flLastCurrentTime(0) +{ + InitializePerformanceCounter(); +} + +inline void CPerformanceCounter::InitializePerformanceCounter() +{ +#ifdef _WIN32 + + LARGE_INTEGER performanceFreq; + QueryPerformanceFrequency(&performanceFreq); + + // get 32 out of the 64 time bits such that we have around + // 1 microsecond resolution + unsigned int lowpart, highpart; + lowpart = (unsigned int)performanceFreq.LowPart; + highpart = (unsigned int)performanceFreq.HighPart; + m_iLowShift = 0; + + while (highpart || (lowpart > 2000000.0)) + { + m_iLowShift++; + lowpart >>= 1; + lowpart |= (highpart & 1) << 31; + highpart >>= 1; + } + + m_flPerfCounterFreq = 1.0 / (double)lowpart; + +#endif // _WIN32 +} + +inline double CPerformanceCounter::GetCurTime() +{ +#ifdef _WIN32 + + static int sametimecount; + static unsigned int oldtime; + static int first = 1; + LARGE_INTEGER PerformanceCount; + unsigned int temp, t2; + double time; + + QueryPerformanceCounter(&PerformanceCount); + if (m_iLowShift == 0) + { + temp = (unsigned int)PerformanceCount.LowPart; + } + else + { + temp = ((unsigned int)PerformanceCount.LowPart >> m_iLowShift) | + ((unsigned int)PerformanceCount.HighPart << (32 - m_iLowShift)); + } + + if (first) + { + oldtime = temp; + first = 0; + } + else + { + // check for turnover or backward time + if ((temp <= oldtime) && ((oldtime - temp) < 0x10000000)) + { + // so we can't get stuck + oldtime = temp; + } + else + { + t2 = temp - oldtime; + + time = (double)t2 * m_flPerfCounterFreq; + oldtime = temp; + + m_flCurrentTime += time; + + if (m_flCurrentTime == m_flLastCurrentTime) + { + if (++sametimecount > 100000) + { + m_flCurrentTime += 1.0; + sametimecount = 0; + } + } + else + { + sametimecount = 0; + } + + m_flLastCurrentTime = m_flCurrentTime; + } + } + + return m_flCurrentTime; + +#else // _WIN32 + + struct timeval tp; + static int secbase = 0; + + gettimeofday(&tp, NULL); + + if (!secbase) + { + secbase = tp.tv_sec; + return (tp.tv_usec / 1000000.0); + } + + return ((tp.tv_sec - secbase) + tp.tv_usec / 1000000.0); + +#endif // _WIN32 +} diff --git a/reapi/include/cssdk/game_shared/shared_util.h b/reapi/include/cssdk/game_shared/shared_util.h new file mode 100644 index 0000000..f7670d6 --- /dev/null +++ b/reapi/include/cssdk/game_shared/shared_util.h @@ -0,0 +1,65 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "common.h" + +#ifndef _WIN32 +#include +#include +#endif // _WIN32 + +// Simple utility function to allocate memory and duplicate a string +inline char *CloneString(const char *str) +{ + if (!str) + { + char *cloneStr = new char[1]; + cloneStr[0] = '\0'; + return cloneStr; + } + + char *cloneStr = new char [strlen(str) + 1]; + strcpy(cloneStr, str); + return cloneStr; +} + +// Simple utility function to allocate memory and duplicate a wide string +inline wchar_t *CloneWString(const wchar_t *str) +{ + if (!str) + { + wchar_t *cloneStr = new wchar_t[1]; + cloneStr[0] = L'\0'; + return cloneStr; + } + + wchar_t *cloneStr = new wchar_t [wcslen(str) + 1]; + wcscpy(cloneStr, str); + return cloneStr; +} diff --git a/reapi/include/cssdk/game_shared/simple_checksum.h b/reapi/include/cssdk/game_shared/simple_checksum.h new file mode 100644 index 0000000..236e765 --- /dev/null +++ b/reapi/include/cssdk/game_shared/simple_checksum.h @@ -0,0 +1,49 @@ +/* +* +* 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 SIMPLE_CHECKSUM_H +#define SIMPLE_CHECKSUM_H +#ifdef _WIN32 +#pragma once +#endif + +// Compute a simple checksum for the given data. +// Each byte in the data is multiplied by its position to track re-ordering changes +inline unsigned int ComputeSimpleChecksum(const unsigned char *dataPointer, int dataLength) +{ + unsigned int checksum = 0; + for (int i = 1; i <= dataLength; i++) + { + checksum += (*dataPointer) * i; + ++dataPointer; + } + + return checksum; +} + +#endif // SIMPLE_CHECKSUM_H diff --git a/reapi/include/cssdk/game_shared/steam_util.h b/reapi/include/cssdk/game_shared/steam_util.h new file mode 100644 index 0000000..5431679 --- /dev/null +++ b/reapi/include/cssdk/game_shared/steam_util.h @@ -0,0 +1,76 @@ +/* +* +* 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. +* +*/ +#pragma once + +class SteamFile +{ +public: + SteamFile(const char *filename); + ~SteamFile(); + + bool IsValid() const { return (m_fileData) ? true : false; } + bool Read(void *data, int length); + +private: + byte *m_fileData; + int m_fileDataLength; + + byte *m_cursor; + int m_bytesLeft; +}; + +inline SteamFile::SteamFile(const char *filename) +{ + m_fileData = (byte *)LOAD_FILE_FOR_ME(const_cast(filename), &m_fileDataLength); + m_cursor = m_fileData; + m_bytesLeft = m_fileDataLength; +} + +inline SteamFile::~SteamFile() +{ + if (m_fileData) + { + FREE_FILE(m_fileData); + m_fileData = NULL; + } +} + +inline bool SteamFile::Read(void *data, int length) +{ + if (length > m_bytesLeft || m_cursor == NULL || m_bytesLeft <= 0) + return false; + + byte *readCursor = static_cast(data); + for (int i = 0; i < length; ++i) + { + *readCursor++ = *m_cursor++; + --m_bytesLeft; + } + + return true; +} diff --git a/reapi/include/cssdk/game_shared/voice_common.h b/reapi/include/cssdk/game_shared/voice_common.h new file mode 100644 index 0000000..82dfb39 --- /dev/null +++ b/reapi/include/cssdk/game_shared/voice_common.h @@ -0,0 +1,36 @@ +/* +* +* 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. +* +*/ +#pragma once + +#include "bitvec.h" + +// TODO: this should just be set to MAX_CLIENTS +#define VOICE_MAX_PLAYERS 32 +#define VOICE_MAX_PLAYERS_DW ((VOICE_MAX_PLAYERS / 32) + !!(VOICE_MAX_PLAYERS & 31)) + +typedef CBitVec< VOICE_MAX_PLAYERS > CPlayerBitVec; diff --git a/reapi/include/cssdk/game_shared/voice_gamemgr.h b/reapi/include/cssdk/game_shared/voice_gamemgr.h new file mode 100644 index 0000000..851c93a --- /dev/null +++ b/reapi/include/cssdk/game_shared/voice_gamemgr.h @@ -0,0 +1,56 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define UPDATE_INTERVAL 0.3 + +#include "voice_common.h" + +class CGameRules; +class CBasePlayer; + +class IVoiceGameMgrHelper { +public: + virtual ~IVoiceGameMgrHelper() = 0; + + // 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: + virtual ~CVoiceGameMgr() {}; +public: + int m_msgPlayerVoiceMask; + int m_msgRequestState; + IVoiceGameMgrHelper *m_pHelper; + int m_nMaxPlayers; + double m_UpdateInterval; // How long since the last update. +}; diff --git a/reapi/include/cssdk/pm_shared/pm_defs.h b/reapi/include/cssdk/pm_shared/pm_defs.h new file mode 100644 index 0000000..04bea26 --- /dev/null +++ b/reapi/include/cssdk/pm_shared/pm_defs.h @@ -0,0 +1,192 @@ +/* +* +* 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. +* +*/ +#pragma once + +#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 + +#define PM_NORMAL 0x00000000 +#define PM_STUDIO_IGNORE 0x00000001 // Skip studio models +#define PM_STUDIO_BOX 0x00000002 // Use boxes for non-complex studio models (even in traceline) +#define PM_GLASS_IGNORE 0x00000004 // Ignore entities with non-normal rendermode +#define PM_WORLD_ONLY 0x00000008 // Only trace against the world + +#define PM_TRACELINE_PHYSENTSONLY 0 +#define PM_TRACELINE_ANYVISIBLE 1 + +typedef struct physent_s +{ + char name[32]; // Name of model, or "player" or "world". + int player; + vec3_t origin; // Model's origin in world coordinates. + struct model_s *model; // only for bsp models + struct model_s *studiomodel; // SOLID_BBOX, but studio clip intersections. + vec3_t mins, maxs; // only for non-bsp models + int info; // For client or server to use to identify (index into edicts or cl_entities) + vec3_t angles; // rotated entities need this info for hull testing to work. + + int solid; // Triggers and func_door type WATER brushes are SOLID_NOT + int skin; // BSP Contents for such things like fun_door water brushes. + int rendermode; // So we can ignore glass + + float frame; + int sequence; + byte controller[4]; + byte blending[2]; + + int movetype; + int takedamage; + int blooddecal; + int team; + int classnumber; + + int iuser1; + int iuser2; + int iuser3; + int iuser4; + float fuser1; + float fuser2; + float fuser3; + float fuser4; + vec3_t vuser1; + vec3_t vuser2; + vec3_t vuser3; + vec3_t vuser4; + +} physent_t; + +typedef struct playermove_s +{ + int player_index; // So we don't try to run the PM_CheckStuck nudging too quickly. + qboolean server; // For debugging, are we running physics code on server side? + qboolean multiplayer; // 1 == multiplayer server + float time; // realtime on host, for reckoning duck timing + float frametime; // Duration of this frame + vec3_t forward, right, up; // Vectors for angles + vec3_t origin; // Movement origin. + vec3_t angles; // Movement view angles. + vec3_t oldangles; // Angles before movement view angles were looked at. + vec3_t velocity; // Current movement direction. + vec3_t movedir; // For waterjumping, a forced forward velocity so we can fly over lip of ledge. + vec3_t basevelocity; // Velocity of the conveyor we are standing, e.g. + vec3_t view_ofs; // For ducking/dead + // Our eye position. + float flDuckTime; // Time we started duck + qboolean bInDuck; // In process of ducking or ducked already? + int flTimeStepSound; // For walking/falling + // Next time we can play a step sound + int iStepLeft; + float flFallVelocity; + vec3_t punchangle; + float flSwimTime; + float flNextPrimaryAttack; + int effects; // MUZZLE FLASH, e.g. + int flags; // FL_ONGROUND, FL_DUCKING, etc. + int usehull; // 0 = regular player hull, 1 = ducked player hull, 2 = point hull + float gravity; // Our current gravity and friction. + float friction; + int oldbuttons; // Buttons last usercmd + float waterjumptime; // Amount of time left in jumping out of water cycle. + qboolean dead; // Are we a dead player? + int deadflag; + int spectator; // Should we use spectator physics model? + int movetype; // Our movement type, NOCLIP, WALK, FLY + int onground; // -1 = in air, else pmove entity number + int waterlevel; + int watertype; + int oldwaterlevel; + char sztexturename[256]; + char chtexturetype; + float maxspeed; + float clientmaxspeed; + int iuser1; + int iuser2; + int iuser3; + int iuser4; + float fuser1; + float fuser2; + float fuser3; + float fuser4; + vec3_t vuser1; + vec3_t vuser2; + vec3_t vuser3; + vec3_t vuser4; + int numphysent; // world state + // Number of entities to clip against. + physent_t physents[MAX_PHYSENTS]; + int nummoveent; // Number of momvement entities (ladders) + physent_t moveents[MAX_MOVEENTS]; // just a list of ladders + int numvisent; // All things being rendered, for tracing against things you don't actually collide with + physent_t visents[MAX_PHYSENTS]; + usercmd_t cmd; // input to run through physics. + int numtouch; // Trace results for objects we collided with. + pmtrace_t touchindex[MAX_PHYSENTS]; + char physinfo[MAX_PHYSINFO_STRING]; // Physics info string + struct movevars_s *movevars; + vec_t _player_mins[4][3]; + vec_t _player_maxs[4][3]; + + const char *(*PM_Info_ValueForKey)(const char *s, const char *key); + void (*PM_Particle)(float *origin, int color, float life, int zpos, int zvel); + int (*PM_TestPlayerPosition)(float *pos, pmtrace_t *ptrace); + void (*Con_NPrintf)(int idx, char *fmt, ...); + void (*Con_DPrintf)(char *fmt, ...); + void (*Con_Printf)(char *fmt, ...); + double (*Sys_FloatTime)(); + void (*PM_StuckTouch)(int hitent, pmtrace_t *ptraceresult); + int (*PM_PointContents)(float *p, int *truecontents); + int (*PM_TruePointContents)(float *p); + int (*PM_HullPointContents)(struct hull_s *hull, int num, float *p); + pmtrace_t (*PM_PlayerTrace)(float *start, float *end, int traceFlags, int ignore_pe); + struct pmtrace_s *(*PM_TraceLine)(float *start, float *end, int flags, int usehulll, int ignore_pe); + int32 (*RandomLong)(int32 lLow, int32 lHigh); + float (*RandomFloat)(float flLow, float flHigh); + int (*PM_GetModelType)(struct model_s *mod); + void (*PM_GetModelBounds)(struct model_s *mod, float *mins, float *maxs); + void *(*PM_HullForBsp)(physent_t *pe, float *offset); + float (*PM_TraceModel)(physent_t *pEnt, float *start, float *end, trace_t *trace); + int (*COM_FileSize)(char *filename); + byte *(*COM_LoadFile)(char *path, int usehunk, int *pLength); + void (*COM_FreeFile)(void *buffer); + char *(*memfgets)(byte *pMemFile, int fileSize, int *pFilePos, char *pBuffer, int bufferSize); + qboolean runfuncs; + void (*PM_PlaySound)(int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch); + const char *(*PM_TraceTexture)(int ground, float *vstart, float *vend); + void (*PM_PlaybackEventFull)(int flags, int clientindex, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2); + +} playermove_t; diff --git a/reapi/include/cssdk/pm_shared/pm_info.h b/reapi/include/cssdk/pm_shared/pm_info.h new file mode 100644 index 0000000..68375db --- /dev/null +++ b/reapi/include/cssdk/pm_shared/pm_info.h @@ -0,0 +1,30 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define MAX_PHYSINFO_STRING 256 diff --git a/reapi/include/cssdk/pm_shared/pm_materials.h b/reapi/include/cssdk/pm_shared/pm_materials.h new file mode 100644 index 0000000..6468273 --- /dev/null +++ b/reapi/include/cssdk/pm_shared/pm_materials.h @@ -0,0 +1,45 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define CTEXTURESMAX 1024 // max number of textures loaded +#define CBTEXTURENAMEMAX 17 // only load first n chars of name + +#define CHAR_TEX_CONCRETE 'C' // texture types +#define CHAR_TEX_METAL 'M' +#define CHAR_TEX_DIRT 'D' +#define CHAR_TEX_VENT 'V' +#define CHAR_TEX_GRATE 'G' +#define CHAR_TEX_TILE 'T' +#define CHAR_TEX_SLOSH 'S' +#define CHAR_TEX_WOOD 'W' +#define CHAR_TEX_COMPUTER 'P' +#define CHAR_TEX_GRASS 'X' +#define CHAR_TEX_GLASS 'Y' +#define CHAR_TEX_FLESH 'F' +#define CHAR_TEX_SNOW 'N' diff --git a/reapi/include/cssdk/pm_shared/pm_movevars.h b/reapi/include/cssdk/pm_shared/pm_movevars.h new file mode 100644 index 0000000..9d22d02 --- /dev/null +++ b/reapi/include/cssdk/pm_shared/pm_movevars.h @@ -0,0 +1,59 @@ +/* +* +* 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. +* +*/ +#pragma once + +typedef struct movevars_s +{ + float gravity; // Gravity for map + float stopspeed; // Deceleration when not moving + float maxspeed; // Max allowed speed + float spectatormaxspeed; + float accelerate; // Acceleration factor + float airaccelerate; // Same for when in open air + float wateraccelerate; // Same for when in water + float friction; + float edgefriction; // Extra friction near dropofs + float waterfriction; // Less in water + float entgravity; // 1.0 + float bounce; // Wall bounce value. 1.0 + float stepsize; // sv_stepsize; + float maxvelocity; // maximum server velocity. + float zmax; // Max z-buffer range (for GL) + float waveHeight; // Water wave height (for GL) + qboolean footsteps; // Play footstep sounds + char skyName[32]; // Name of the sky map + float rollangle; + float rollspeed; + float skycolor_r; // Sky color + float skycolor_g; + float skycolor_b; + float skyvec_x; // Sky vector + float skyvec_y; + float skyvec_z; + +} movevars_t; diff --git a/reapi/include/cssdk/pm_shared/pm_shared.h b/reapi/include/cssdk/pm_shared/pm_shared.h new file mode 100644 index 0000000..73a5371 --- /dev/null +++ b/reapi/include/cssdk/pm_shared/pm_shared.h @@ -0,0 +1,75 @@ +/* +* +* 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. +* +*/ +#pragma once + +#define PM_DEAD_VIEWHEIGHT -8 + +#define OBS_NONE 0 +#define OBS_CHASE_LOCKED 1 +#define OBS_CHASE_FREE 2 +#define OBS_ROAMING 3 +#define OBS_IN_EYE 4 +#define OBS_MAP_FREE 5 +#define OBS_MAP_CHASE 6 + +#define STEP_CONCRETE 0 +#define STEP_METAL 1 +#define STEP_DIRT 2 +#define STEP_VENT 3 +#define STEP_GRATE 4 +#define STEP_TILE 5 +#define STEP_SLOSH 6 +#define STEP_WADE 7 +#define STEP_LADDER 8 +#define STEP_SNOW 9 + +#define WJ_HEIGHT 8 +#define STOP_EPSILON 0.1 +#define MAX_CLIMB_SPEED 200 +#define PLAYER_DUCKING_MULTIPLIER 0.333 +#define PM_CHECKSTUCK_MINTIME 0.05 // Don't check again too quickly. + +#define PLAYER_LONGJUMP_SPEED 350.0f // how fast we longjump + +// Ducking time +#define TIME_TO_DUCK 0.4 +#define STUCK_MOVEUP 1 + +#define PM_VEC_DUCK_HULL_MIN -18 +#define PM_VEC_HULL_MIN -36 +#define PM_VEC_DUCK_VIEW 12 +#define PM_VEC_VIEW 17 + +#define PM_PLAYER_MAX_SAFE_FALL_SPEED 580 // approx 20 feet +#define PM_PLAYER_MIN_BOUNCE_SPEED 350 +#define PM_PLAYER_FALL_PUNCH_THRESHHOLD 250 // won't punch player's screen/make scrape noise unless player falling at least this fast. + +// Only allow bunny jumping up to 1.2x server / player maxspeed setting +#define BUNNYJUMP_MAX_SPEED_FACTOR 1.2f + +extern struct playermove_s *pmove; diff --git a/reapi/include/cssdk/public/FileSystem.h b/reapi/include/cssdk/public/FileSystem.h new file mode 100644 index 0000000..e1ce53c --- /dev/null +++ b/reapi/include/cssdk/public/FileSystem.h @@ -0,0 +1,189 @@ +//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef FILESYSTEM_H +#define FILESYSTEM_H +#ifdef _WIN32 +#pragma once +#endif + +#include "interface.h" +#include +#include + + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +typedef FILE * FileHandle_t; +typedef int FileFindHandle_t; +typedef int WaitForResourcesHandle_t; + + +//----------------------------------------------------------------------------- +// Enums used by the interface +//----------------------------------------------------------------------------- +#ifndef FILESYSTEM_INTERNAL_H +typedef enum +{ + FILESYSTEM_SEEK_HEAD = 0, + FILESYSTEM_SEEK_CURRENT, + FILESYSTEM_SEEK_TAIL, +} FileSystemSeek_t; + +enum +{ + FILESYSTEM_INVALID_FIND_HANDLE = -1 +}; + +typedef enum +{ + // Don't print anything + FILESYSTEM_WARNING_QUIET = 0, + + // On shutdown, report names of files left unclosed + FILESYSTEM_WARNING_REPORTUNCLOSED, + + // Report number of times a file was opened, closed + FILESYSTEM_WARNING_REPORTUSAGE, + + // Report all open/close events to console ( !slow! ) + FILESYSTEM_WARNING_REPORTALLACCESSES +} FileWarningLevel_t; + +#define FILESYSTEM_INVALID_HANDLE ( FileHandle_t )0 +#endif + +// turn off any windows defines +#undef GetCurrentDirectory + +//----------------------------------------------------------------------------- +// Purpose: Main file system interface +//----------------------------------------------------------------------------- +class IFileSystem : public IBaseInterface +{ +public: + // Mount and unmount the filesystem + virtual void Mount( void ) = 0; + virtual void Unmount( void ) = 0; + + // Remove all search paths (including write path?) + virtual void RemoveAllSearchPaths( void ) = 0; + + // Add paths in priority order (mod dir, game dir, ....) + // If one or more .pak files are in the specified directory, then they are + // added after the file system path + // If the path is the relative path to a .bsp file, then any previous .bsp file + // override is cleared and the current .bsp is searched for an embedded PAK file + // and this file becomes the highest priority search path ( i.e., it's looked at first + // even before the mod's file system path ). + virtual void AddSearchPath( const char *pPath, const char *pathID ) = 0; + virtual bool RemoveSearchPath( const char *pPath ) = 0; + + // Deletes a file + virtual void RemoveFile( const char *pRelativePath, const char *pathID ) = 0; + + // this isn't implementable on STEAM as is. + virtual void CreateDirHierarchy( const char *path, const char *pathID ) = 0; + + // File I/O and info + virtual bool FileExists( const char *pFileName ) = 0; + virtual bool IsDirectory( const char *pFileName ) = 0; + + // opens a file + // if pathID is NULL, all paths will be searched for the file + virtual FileHandle_t Open( const char *pFileName, const char *pOptions, const char *pathID = 0L ) = 0; + + virtual void Close( FileHandle_t file ) = 0; + + virtual void Seek( FileHandle_t file, int pos, FileSystemSeek_t seekType ) = 0; + virtual unsigned int Tell( FileHandle_t file ) = 0; + + virtual unsigned int Size( FileHandle_t file ) = 0; + virtual unsigned int Size( const char *pFileName ) = 0; + + virtual long GetFileTime( const char *pFileName ) = 0; + virtual void FileTimeToString( char* pStrip, int maxCharsIncludingTerminator, long fileTime ) = 0; + + virtual bool IsOk( FileHandle_t file ) = 0; + + virtual void Flush( FileHandle_t file ) = 0; + virtual bool EndOfFile( FileHandle_t file ) = 0; + + virtual int Read( void* pOutput, int size, FileHandle_t file ) = 0; + virtual int Write( void const* pInput, int size, FileHandle_t file ) = 0; + virtual char *ReadLine( char *pOutput, int maxChars, FileHandle_t file ) = 0; + virtual int FPrintf( FileHandle_t file, char *pFormat, ... ) = 0; + + // direct filesystem buffer access + // returns a handle to a buffer containing the file data + // this is the optimal way to access the complete data for a file, + // since the file preloader has probably already got it in memory + virtual void *GetReadBuffer( FileHandle_t file, int *outBufferSize, bool failIfNotInCache ) = 0; + virtual void ReleaseReadBuffer( FileHandle_t file, void *readBuffer ) = 0; + + // FindFirst/FindNext + virtual const char *FindFirst( const char *pWildCard, FileFindHandle_t *pHandle, const char *pathID = 0L ) = 0; + virtual const char *FindNext( FileFindHandle_t handle ) = 0; + virtual bool FindIsDirectory( FileFindHandle_t handle ) = 0; + virtual void FindClose( FileFindHandle_t handle ) = 0; + + virtual void GetLocalCopy( const char *pFileName ) = 0; + + virtual const char *GetLocalPath( const char *pFileName, char *pLocalPath, int localPathBufferSize ) = 0; + + // Note: This is sort of a secondary feature; but it's really useful to have it here + virtual char *ParseFile( char* pFileBytes, char* pToken, bool* pWasQuoted ) = 0; + + // Returns true on success ( based on current list of search paths, otherwise false if it can't be resolved ) + virtual bool FullPathToRelativePath( const char *pFullpath, char *pRelative ) = 0; + + // Gets the current working directory + virtual bool GetCurrentDirectory( char* pDirectory, int maxlen ) = 0; + + // Dump to printf/OutputDebugString the list of files that have not been closed + virtual void PrintOpenedFiles( void ) = 0; + + virtual void SetWarningFunc( void (*pfnWarning)( const char *fmt, ... ) ) = 0; + virtual void SetWarningLevel( FileWarningLevel_t level ) = 0; + + virtual void LogLevelLoadStarted( const char *name ) = 0; + virtual void LogLevelLoadFinished( const char *name ) = 0; + virtual int HintResourceNeed( const char *hintlist, int forgetEverything ) = 0; + virtual int PauseResourcePreloading( void ) = 0; + virtual int ResumeResourcePreloading( void ) = 0; + virtual int SetVBuf( FileHandle_t stream, char *buffer, int mode, long size ) = 0; + virtual void GetInterfaceVersion( char *p, int maxlen ) = 0; + virtual bool IsFileImmediatelyAvailable(const char *pFileName) = 0; + + // starts waiting for resources to be available + // returns FILESYSTEM_INVALID_HANDLE if there is nothing to wait on + virtual WaitForResourcesHandle_t WaitForResources( const char *resourcelist ) = 0; + // get progress on waiting for resources; progress is a float [0, 1], complete is true on the waiting being done + // returns false if no progress is available + // any calls after complete is true or on an invalid handle will return false, 0.0f, true + virtual bool GetWaitForResourcesProgress( WaitForResourcesHandle_t handle, float *progress /* out */ , bool *complete /* out */ ) = 0; + // cancels a progress call + virtual void CancelWaitForResources( WaitForResourcesHandle_t handle ) = 0; + // returns true if the appID has all its caches fully preloaded + virtual bool IsAppReadyForOfflinePlay( int appID ) = 0; + + // interface for custom pack files > 4Gb + virtual bool AddPackFile( const char *fullpath, const char *pathID ) = 0; + + // open a file but force the data to come from the steam cache, NOT from disk + virtual FileHandle_t OpenFromCacheForRead( const char *pFileName, const char *pOptions, const char *pathID = 0L ) = 0; + + virtual void AddSearchPathNoWrite( const char *pPath, const char *pathID ) = 0; +}; + +// Steam3/Src compat +#define IBaseFileSystem IFileSystem + +#define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" + +#endif // FILESYSTEM_H diff --git a/reapi/include/cssdk/public/interface.cpp b/reapi/include/cssdk/public/interface.cpp new file mode 100644 index 0000000..9a12eef --- /dev/null +++ b/reapi/include/cssdk/public/interface.cpp @@ -0,0 +1,263 @@ +#include "precompiled.h" +#include "interface.h" + +#if !defined ( _WIN32 ) +// Linux doesn't have this function so this emulates its functionality +// +// +void *GetModuleHandle(const char *name) +{ + void *handle; + + if (name == NULL) + { + // hmm, how can this be handled under linux.... + // is it even needed? + return NULL; + } + + if ((handle=dlopen(name, RTLD_NOW)) == NULL) + { + //printf("Error:%s\n",dlerror()); + // couldn't open this file + return NULL; + } + + // read "man dlopen" for details + // in short dlopen() inc a ref count + // so dec the ref count by performing the close + dlclose(handle); + return handle; +} +#endif + +// ------------------------------------------------------------------------------------ // +// InterfaceReg. +// ------------------------------------------------------------------------------------ // +InterfaceReg *InterfaceReg::s_pInterfaceRegs = NULL; + + +InterfaceReg::InterfaceReg( InstantiateInterfaceFn fn, const char *pName ) : m_pName(pName) +{ + m_CreateFn = fn; + m_pNext = s_pInterfaceRegs; + s_pInterfaceRegs = this; +} + + + +// ------------------------------------------------------------------------------------ // +// CreateInterface. +// ------------------------------------------------------------------------------------ // +EXPORT_FUNCTION IBaseInterface *CreateInterface( const char *pName, int *pReturnCode ) +{ + InterfaceReg *pCur; + + for(pCur=InterfaceReg::s_pInterfaceRegs; pCur; pCur=pCur->m_pNext) + { + if(strcmp(pCur->m_pName, pName) == 0) + { + if ( pReturnCode ) + { + *pReturnCode = IFACE_OK; + } + return pCur->m_CreateFn(); + } + } + + if ( pReturnCode ) + { + *pReturnCode = IFACE_FAILED; + } + return NULL; +} + +#ifdef LINUX +static IBaseInterface *CreateInterfaceLocal( const char *pName, int *pReturnCode ) +{ + InterfaceReg *pCur; + + for(pCur=InterfaceReg::s_pInterfaceRegs; pCur; pCur=pCur->m_pNext) + { + if(strcmp(pCur->m_pName, pName) == 0) + { + if ( pReturnCode ) + { + *pReturnCode = IFACE_OK; + } + return pCur->m_CreateFn(); + } + } + + if ( pReturnCode ) + { + *pReturnCode = IFACE_FAILED; + } + return NULL; +} +#endif + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include "windows.h" +#endif + +//----------------------------------------------------------------------------- +// Purpose: returns a pointer to a function, given a module +// Input : pModuleName - module name +// *pName - proc name +//----------------------------------------------------------------------------- +//static hlds_run wants to use this function +void *Sys_GetProcAddress( const char *pModuleName, const char *pName ) +{ + return GetProcAddress( GetModuleHandle(pModuleName), pName ); +} + +//----------------------------------------------------------------------------- +// Purpose: returns a pointer to a function, given a module +// Input : pModuleName - module name +// *pName - proc name +//----------------------------------------------------------------------------- +// hlds_run wants to use this function +void *Sys_GetProcAddress( void *pModuleHandle, const char *pName ) +{ +#if defined ( _WIN32 ) + return GetProcAddress( (HINSTANCE)pModuleHandle, pName ); +#else + return GetProcAddress( pModuleHandle, pName ); +#endif +} + +//----------------------------------------------------------------------------- +// Purpose: Loads a DLL/component from disk and returns a handle to it +// Input : *pModuleName - filename of the component +// Output : opaque handle to the module (hides system dependency) +//----------------------------------------------------------------------------- +CSysModule *Sys_LoadModule( const char *pModuleName ) +{ +#if defined ( _WIN32 ) + HMODULE hDLL = LoadLibrary( pModuleName ); +#else + HMODULE hDLL = NULL; + char szAbsoluteModuleName[1024]; + szAbsoluteModuleName[0] = 0; + if ( pModuleName[0] != '/' ) + { + char szCwd[1024]; + char szAbsoluteModuleName[1024]; + + getcwd( szCwd, sizeof( szCwd ) ); + if ( szCwd[ strlen( szCwd ) - 1 ] == '/' ) + szCwd[ strlen( szCwd ) - 1 ] = 0; + + _snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/%s", szCwd, pModuleName ); + + hDLL = dlopen( szAbsoluteModuleName, RTLD_NOW ); + } + else + { + _snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s", pModuleName ); + hDLL = dlopen( pModuleName, RTLD_NOW ); + } +#endif + + if( !hDLL ) + { + char str[512]; +#if defined ( _WIN32 ) + _snprintf( str, sizeof(str), "%s.dll", pModuleName ); + hDLL = LoadLibrary( str ); +#elif defined(OSX) + printf("Error:%s\n",dlerror()); + _snprintf( str, sizeof(str), "%s.dylib", szAbsoluteModuleName ); + hDLL = dlopen(str, RTLD_NOW); +#else + printf("Error:%s\n",dlerror()); + _snprintf( str, sizeof(str), "%s.so", szAbsoluteModuleName ); + hDLL = dlopen(str, RTLD_NOW); +#endif + } + + return reinterpret_cast(hDLL); +} + +//----------------------------------------------------------------------------- +// Purpose: Unloads a DLL/component from +// Input : *pModuleName - filename of the component +// Output : opaque handle to the module (hides system dependency) +//----------------------------------------------------------------------------- +void Sys_UnloadModule( CSysModule *pModule ) +{ + if ( !pModule ) + return; + + HMODULE hDLL = reinterpret_cast(pModule); +#if defined ( _WIN32 ) + FreeLibrary( hDLL ); +#else + dlclose((void *)hDLL); +#endif + +} + +//----------------------------------------------------------------------------- +// Purpose: returns a pointer to a function, given a module +// Input : module - windows HMODULE from Sys_LoadModule() +// *pName - proc name +// Output : factory for this module +//----------------------------------------------------------------------------- +CreateInterfaceFn Sys_GetFactory( CSysModule *pModule ) +{ + if ( !pModule ) + return NULL; + + HMODULE hDLL = reinterpret_cast(pModule); +#if defined ( _WIN32 ) + return reinterpret_cast(GetProcAddress( hDLL, CREATEINTERFACE_PROCNAME )); +#else +// Linux gives this error: +//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory +//(CSysModule *)) (const char *, int *)': +//../public/interface.cpp:154: ISO C++ forbids casting between +//pointer-to-function and pointer-to-object +// +// so lets get around it :) + return (CreateInterfaceFn)(GetProcAddress( hDLL, CREATEINTERFACE_PROCNAME )); +#endif +} + + + +//----------------------------------------------------------------------------- +// Purpose: returns the instance of this module +// Output : interface_instance_t +//----------------------------------------------------------------------------- +CreateInterfaceFn Sys_GetFactoryThis( void ) +{ +#ifdef LINUX + return CreateInterfaceLocal; +#else + return CreateInterface; +#endif +} + +//----------------------------------------------------------------------------- +// Purpose: returns the instance of the named module +// Input : *pModuleName - name of the module +// Output : interface_instance_t - instance of that module +//----------------------------------------------------------------------------- +CreateInterfaceFn Sys_GetFactory( const char *pModuleName ) +{ +#if defined ( _WIN32 ) + return static_cast( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) ); +#else +// Linux gives this error: +//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory +//(const char *)) (const char *, int *)': +//../public/interface.cpp:186: invalid static_cast from type `void *' to +//type `IBaseInterface *(*) (const char *, int *)' +// +// so lets use the old style cast. + return (CreateInterfaceFn)( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) ); +#endif +} diff --git a/reapi/include/cssdk/public/interface.h b/reapi/include/cssdk/public/interface.h new file mode 100644 index 0000000..3349146 --- /dev/null +++ b/reapi/include/cssdk/public/interface.h @@ -0,0 +1,150 @@ + +// This header defines the interface convention used in the valve engine. +// To make an interface and expose it: +// 1. Derive from IBaseInterface. +// 2. The interface must be ALL pure virtuals, and have no data members. +// 3. Define a name for it. +// 4. In its implementation file, use EXPOSE_INTERFACE or EXPOSE_SINGLE_INTERFACE. + +// Versioning +// There are two versioning cases that are handled by this: +// 1. You add functions to the end of an interface, so it is binary compatible with the previous interface. In this case, +// you need two EXPOSE_INTERFACEs: one to expose your class as the old interface and one to expose it as the new interface. +// 2. You update an interface so it's not compatible anymore (but you still want to be able to expose the old interface +// for legacy code). In this case, you need to make a new version name for your new interface, and make a wrapper interface and +// expose it for the old interface. + +//#if _MSC_VER >= 1300 // VC7 +//#include "tier1/interface.h" +//#else + +#ifndef INTERFACE_H +#define INTERFACE_H + +#if !defined ( _WIN32 ) + +#include // dlopen,dlclose, et al +#include + +#define HMODULE void * +#define GetProcAddress dlsym + +#define _snprintf snprintf + +#endif + +void *Sys_GetProcAddress(const char *pModuleName, const char *pName); +void *Sys_GetProcAddress(void *pModuleHandle, const char *pName); + +// All interfaces derive from this. +class IBaseInterface +{ +public: + + virtual ~IBaseInterface() {} +}; + + +#define CREATEINTERFACE_PROCNAME "CreateInterface" +typedef IBaseInterface* (*CreateInterfaceFn)(const char *pName, int *pReturnCode); + + +typedef IBaseInterface* (*InstantiateInterfaceFn)(); + + +// Used internally to register classes. +class InterfaceReg +{ +public: + InterfaceReg(InstantiateInterfaceFn fn, const char *pName); + +public: + + InstantiateInterfaceFn m_CreateFn; + const char *m_pName; + + InterfaceReg *m_pNext; // For the global list. + static InterfaceReg *s_pInterfaceRegs; +}; + + +// Use this to expose an interface that can have multiple instances. +// e.g.: +// EXPOSE_INTERFACE( CInterfaceImp, IInterface, "MyInterface001" ) +// This will expose a class called CInterfaceImp that implements IInterface (a pure class) +// clients can receive a pointer to this class by calling CreateInterface( "MyInterface001" ) +// +// In practice, the shared header file defines the interface (IInterface) and version name ("MyInterface001") +// so that each component can use these names/vtables to communicate +// +// A single class can support multiple interfaces through multiple inheritance +// +// Use this if you want to write the factory function. +#define EXPOSE_INTERFACE_FN(functionName, interfaceName, versionName) \ + static InterfaceReg __g_Create##className##_reg(functionName, versionName); + +#define EXPOSE_INTERFACE(className, interfaceName, versionName) \ + static IBaseInterface* __Create##className##_interface() {return (interfaceName *)new className;}\ + static InterfaceReg __g_Create##className##_reg(__Create##className##_interface, versionName ); + +// Use this to expose a singleton interface with a global variable you've created. +#define EXPOSE_SINGLE_INTERFACE_GLOBALVAR(className, interfaceName, versionName, globalVarName) \ + static IBaseInterface* __Create##className##interfaceName##_interface() {return (IBaseInterface *)&globalVarName;}\ + static InterfaceReg __g_Create##className##interfaceName##_reg(__Create##className##interfaceName##_interface, versionName); + +// Use this to expose a singleton interface. This creates the global variable for you automatically. +#define EXPOSE_SINGLE_INTERFACE(className, interfaceName, versionName) \ + static className __g_##className##_singleton;\ + EXPOSE_SINGLE_INTERFACE_GLOBALVAR(className, interfaceName, versionName, __g_##className##_singleton) + + +#ifdef _WIN32 + #define EXPORT_FUNCTION __declspec(dllexport) +#else + #define EXPORT_FUNCTION __attribute__ ((visibility("default"))) +#endif + + +// This function is automatically exported and allows you to access any interfaces exposed with the above macros. +// if pReturnCode is set, it will return one of the following values +// extend this for other error conditions/code +enum +{ + IFACE_OK = 0, + IFACE_FAILED +}; + + +extern "C" +{ + EXPORT_FUNCTION IBaseInterface* CreateInterface(const char *pName, int *pReturnCode); +}; + + +extern CreateInterfaceFn Sys_GetFactoryThis( void ); + + +//----------------------------------------------------------------------------- +// UNDONE: This is obsolete, use the module load/unload/get instead!!! +//----------------------------------------------------------------------------- +extern CreateInterfaceFn Sys_GetFactory( const char *pModuleName ); + + +// load/unload components +class CSysModule; + +//----------------------------------------------------------------------------- +// Load & Unload should be called in exactly one place for each module +// The factory for that module should be passed on to dependent components for +// proper versioning. +//----------------------------------------------------------------------------- +extern CSysModule *Sys_LoadModule( const char *pModuleName ); +extern void Sys_UnloadModule( CSysModule *pModule ); + +extern CreateInterfaceFn Sys_GetFactory( CSysModule *pModule ); + + +#endif +//#endif // MSVC 6.0 + + diff --git a/reapi/include/cssdk/public/utlmemory.h b/reapi/include/cssdk/public/utlmemory.h new file mode 100644 index 0000000..72639d6 --- /dev/null +++ b/reapi/include/cssdk/public/utlmemory.h @@ -0,0 +1,356 @@ +/* +* +* 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 UTLMEMORY_H +#define UTLMEMORY_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "osconfig.h" +#include + +#pragma warning (disable:4100) +#pragma warning (disable:4514) + +/*template +inline void Construct(T *pMemory) +{ + ::new(pMemory) T; +} + +template +inline void CopyConstruct(T *pMemory,T const& src) +{ + ::new(pMemory) T(src); +} + +template +inline void Destruct(T *pMemory) +{ + pMemory->~T(); + +#ifdef _DEBUG + memset(pMemory,0xDD,sizeof(T)); +#endif +}*/ +//----------------------------------------------------------------------------- +// The CUtlMemory class: +// A growable memory class which doubles in size by default. +//----------------------------------------------------------------------------- +template< class T > +class CUtlMemory +{ +public: + // constructor, destructor + CUtlMemory(int nGrowSize = 0, int nInitSize = 0); + CUtlMemory(T* pMemory, int numElements); + ~CUtlMemory(); + + // element access + T& operator[](int i); + T const& operator[](int i) const; + T& Element(int i); + T const& Element(int i) const; + + // Can we use this index? + bool IsIdxValid(int i) const; + + // Gets the base address (can change when adding elements!) + T* Base(); + T const* Base() const; + + // Attaches the buffer to external memory.... + void SetExternalBuffer(T* pMemory, int numElements); + + // Size + int NumAllocated() const; + int Count() const; + + // Grows the memory, so that at least allocated + num elements are allocated + void Grow(int num = 1); + + // Makes sure we've got at least this much memory + void EnsureCapacity(int num); + + // Memory deallocation + void Purge(); + + // is the memory externally allocated? + bool IsExternallyAllocated() const; + + // Set the size by which the memory grows + void SetGrowSize(int size); + +private: + enum + { + EXTERNAL_BUFFER_MARKER = -1, + }; + + T* m_pMemory; + int m_nAllocationCount; + int m_nGrowSize; +}; + + +//----------------------------------------------------------------------------- +// constructor, destructor +//----------------------------------------------------------------------------- +template< class T > +CUtlMemory::CUtlMemory(int nGrowSize, int nInitAllocationCount) : m_pMemory(0), +m_nAllocationCount(nInitAllocationCount), m_nGrowSize(nGrowSize) +{ + Assert((nGrowSize >= 0) && (nGrowSize != EXTERNAL_BUFFER_MARKER)); + if (m_nAllocationCount) + { + m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T)); + } +} + +template< class T > +CUtlMemory::CUtlMemory(T* pMemory, int numElements) : m_pMemory(pMemory), +m_nAllocationCount(numElements) +{ + // Special marker indicating externally supplied memory + m_nGrowSize = EXTERNAL_BUFFER_MARKER; +} + +template< class T > +CUtlMemory::~CUtlMemory() +{ + Purge(); +} + + +//----------------------------------------------------------------------------- +// Attaches the buffer to external memory.... +//----------------------------------------------------------------------------- +template< class T > +void CUtlMemory::SetExternalBuffer(T* pMemory, int numElements) +{ + // Blow away any existing allocated memory + Purge(); + + m_pMemory = pMemory; + m_nAllocationCount = numElements; + + // Indicate that we don't own the memory + m_nGrowSize = EXTERNAL_BUFFER_MARKER; +} + + +//----------------------------------------------------------------------------- +// element access +//----------------------------------------------------------------------------- +template< class T > +inline T& CUtlMemory::operator[](int i) +{ + Assert(IsIdxValid(i)); + return m_pMemory[i]; +} + +template< class T > +inline T const& CUtlMemory::operator[](int i) const +{ + Assert(IsIdxValid(i)); + return m_pMemory[i]; +} + +template< class T > +inline T& CUtlMemory::Element(int i) +{ + Assert(IsIdxValid(i)); + return m_pMemory[i]; +} + +template< class T > +inline T const& CUtlMemory::Element(int i) const +{ + Assert(IsIdxValid(i)); + return m_pMemory[i]; +} + + +//----------------------------------------------------------------------------- +// is the memory externally allocated? +//----------------------------------------------------------------------------- +template< class T > +bool CUtlMemory::IsExternallyAllocated() const +{ + return m_nGrowSize == EXTERNAL_BUFFER_MARKER; +} + + +template< class T > +void CUtlMemory::SetGrowSize(int nSize) +{ + Assert((nSize >= 0) && (nSize != EXTERNAL_BUFFER_MARKER)); + m_nGrowSize = nSize; +} + + +//----------------------------------------------------------------------------- +// Gets the base address (can change when adding elements!) +//----------------------------------------------------------------------------- +template< class T > +inline T* CUtlMemory::Base() +{ + return m_pMemory; +} + +template< class T > +inline T const* CUtlMemory::Base() const +{ + return m_pMemory; +} + + +//----------------------------------------------------------------------------- +// Size +//----------------------------------------------------------------------------- +template< class T > +inline int CUtlMemory::NumAllocated() const +{ + return m_nAllocationCount; +} + +template< class T > +inline int CUtlMemory::Count() const +{ + return m_nAllocationCount; +} + + +//----------------------------------------------------------------------------- +// Is element index valid? +//----------------------------------------------------------------------------- +template< class T > +inline bool CUtlMemory::IsIdxValid(int i) const +{ + return (i >= 0) && (i < m_nAllocationCount); +} + + +//----------------------------------------------------------------------------- +// Grows the memory +//----------------------------------------------------------------------------- +template< class T > +void CUtlMemory::Grow(int num) +{ + Assert(num > 0); + + if (IsExternallyAllocated()) + { + // Can't grow a buffer whose memory was externally allocated + Assert(0); + return; + } + + // Make sure we have at least numallocated + num allocations. + // Use the grow rules specified for this memory (in m_nGrowSize) + int nAllocationRequested = m_nAllocationCount + num; + while (m_nAllocationCount < nAllocationRequested) + { + if (m_nAllocationCount != 0) + { + if (m_nGrowSize) + { + m_nAllocationCount += m_nGrowSize; + } + else + { + m_nAllocationCount += m_nAllocationCount; + } + } + else + { + // Compute an allocation which is at least as big as a cache line... + m_nAllocationCount = (31 + sizeof(T)) / sizeof(T); + Assert(m_nAllocationCount != 0); + } + } + + if (m_pMemory) + { + m_pMemory = (T*)realloc(m_pMemory, m_nAllocationCount * sizeof(T)); + } + else + { + m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T)); + } +} + + +//----------------------------------------------------------------------------- +// Makes sure we've got at least this much memory +//----------------------------------------------------------------------------- +template< class T > +inline void CUtlMemory::EnsureCapacity(int num) +{ + if (m_nAllocationCount >= num) + return; + + if (IsExternallyAllocated()) + { + // Can't grow a buffer whose memory was externally allocated + Assert(0); + return; + } + + m_nAllocationCount = num; + if (m_pMemory) + { + m_pMemory = (T*)realloc(m_pMemory, m_nAllocationCount * sizeof(T)); + } + else + { + m_pMemory = (T*)malloc(m_nAllocationCount * sizeof(T)); + } +} + + +//----------------------------------------------------------------------------- +// Memory deallocation +//----------------------------------------------------------------------------- +template< class T > +void CUtlMemory::Purge() +{ + if (!IsExternallyAllocated()) + { + if (m_pMemory) + { + free((void*)m_pMemory); + m_pMemory = 0; + } + m_nAllocationCount = 0; + } +} + +#endif // UTLMEMORY_H diff --git a/reapi/include/cssdk/public/utlvector.h b/reapi/include/cssdk/public/utlvector.h new file mode 100644 index 0000000..263e72f --- /dev/null +++ b/reapi/include/cssdk/public/utlvector.h @@ -0,0 +1,565 @@ +#ifndef UTLVECTOR_H +#define UTLVECTOR_H +#ifdef _WIN32 +#pragma once +#endif + +#include "utlmemory.h" + +template +class CUtlVector +{ +public: + typedef T ElemType_t; + + // constructor, destructor + CUtlVector(int growSize = 0, int initSize = 0); + CUtlVector(T* pMemory, int numElements); + ~CUtlVector(); + + // Copy the array. + CUtlVector& operator=(const CUtlVector &other); + + // element access + T& operator[](int i); + T const& operator[](int i) const; + T& Element(int i); + T const& Element(int i) const; + + // Gets the base address (can change when adding elements!) + T* Base(); + T const* Base() const; + + // Returns the number of elements in the vector + // SIZE IS DEPRECATED! + int Count() const; + int Size() const; // don't use me! + + // Is element index valid? + bool IsValidIndex(int i) const; + static int InvalidIndex(void); + + // Adds an element, uses default constructor + int AddToHead(); + int AddToTail(); + int InsertBefore(int elem); + int InsertAfter(int elem); + + // Adds an element, uses copy constructor + int AddToHead(T const& src); + int AddToTail(T const& src); + int InsertBefore(int elem, T const& src); + int InsertAfter(int elem, T const& src); + + // Adds multiple elements, uses default constructor + int AddMultipleToHead(int num); + int AddMultipleToTail(int num, const T *pToCopy=NULL); + int InsertMultipleBefore(int elem, int num, const T *pToCopy=NULL); // If pToCopy is set, then it's an array of length 'num' and + int InsertMultipleAfter(int elem, int num); + + // Calls RemoveAll() then AddMultipleToTail. + void SetSize(int size); + void SetCount(int count); + + // Calls SetSize and copies each element. + void CopyArray(T const *pArray, int size); + + // Add the specified array to the tail. + int AddVectorToTail(CUtlVector const &src); + + // Finds an element (element needs operator== defined) + int Find(T const& src) const; + + bool HasElement(T const& src); + + // Makes sure we have enough memory allocated to store a requested # of elements + void EnsureCapacity(int num); + + // Makes sure we have at least this many elements + void EnsureCount(int num); + + // Element removal + void FastRemove(int elem); // doesn't preserve order + void Remove(int elem); // preserves order, shifts elements + void FindAndRemove(T const& src); // removes first occurrence of src, preserves order, shifts elements + void RemoveMultiple(int elem, int num); // preserves order, shifts elements + void RemoveAll(); // doesn't deallocate memory + + // Memory deallocation + void Purge(); + + // Purges the list and calls delete on each element in it. + void PurgeAndDeleteElements(); + + // Set the size by which it grows when it needs to allocate more memory. + void SetGrowSize(int size); + +protected: + // Can't copy this unless we explicitly do it! + CUtlVector(CUtlVector const& vec) { assert(0); } + + // Grows the vector + void GrowVector(int num = 1); + + // Shifts elements.... + void ShiftElementsRight(int elem, int num = 1); + void ShiftElementsLeft(int elem, int num = 1); + + // For easier access to the elements through the debugger + void ResetDbgInfo(); + + CUtlMemory m_Memory; + int m_Size; + + // For easier access to the elements through the debugger + // it's in release builds so this can be used in libraries correctly + T *m_pElements; +}; + +//----------------------------------------------------------------------------- +// For easier access to the elements through the debugger +//----------------------------------------------------------------------------- + +template< class T > +inline void CUtlVector::ResetDbgInfo() +{ + m_pElements = m_Memory.Base(); +} + +//----------------------------------------------------------------------------- +// constructor, destructor +//----------------------------------------------------------------------------- + +template< class T > +inline CUtlVector::CUtlVector(int growSize, int initSize) : + m_Memory(growSize, initSize), m_Size(0) +{ + ResetDbgInfo(); +} + +template< class T > +inline CUtlVector::CUtlVector(T* pMemory, int numElements) : + m_Memory(pMemory, numElements), m_Size(0) +{ + ResetDbgInfo(); +} + +template< class T > +inline CUtlVector::~CUtlVector() +{ + Purge(); +} + +template +inline CUtlVector& CUtlVector::operator=(const CUtlVector &other) +{ + CopyArray(other.Base(), other.Count()); + return *this; +} + +//----------------------------------------------------------------------------- +// element access +//----------------------------------------------------------------------------- + +template< class T > +inline T& CUtlVector::operator[](int i) +{ + assert(IsValidIndex(i)); + return m_Memory[i]; +} + +template< class T > +inline T const& CUtlVector::operator[](int i) const +{ + assert(IsValidIndex(i)); + return m_Memory[i]; +} + +template< class T > +inline T& CUtlVector::Element(int i) +{ + assert(IsValidIndex(i)); + return m_Memory[i]; +} + +template< class T > +inline T const& CUtlVector::Element(int i) const +{ + assert(IsValidIndex(i)); + return m_Memory[i]; +} + +//----------------------------------------------------------------------------- +// Gets the base address (can change when adding elements!) +//----------------------------------------------------------------------------- + +template< class T > +inline T* CUtlVector::Base() +{ + return m_Memory.Base(); +} + +template< class T > +inline T const* CUtlVector::Base() const +{ + return m_Memory.Base(); +} + +//----------------------------------------------------------------------------- +// Count +//----------------------------------------------------------------------------- + +template< class T > +inline int CUtlVector::Size() const +{ + return m_Size; +} + +template< class T > +inline int CUtlVector::Count() const +{ + return m_Size; +} + +//----------------------------------------------------------------------------- +// Is element index valid? +//----------------------------------------------------------------------------- + +template< class T > +inline bool CUtlVector::IsValidIndex(int i) const +{ + return (i >= 0) && (i < m_Size); +} + +//----------------------------------------------------------------------------- +// Returns in invalid index +//----------------------------------------------------------------------------- +template< class T > +inline int CUtlVector::InvalidIndex(void) +{ + return -1; +} + +//----------------------------------------------------------------------------- +// Grows the vector +//----------------------------------------------------------------------------- +template< class T > +void CUtlVector::GrowVector(int num) +{ + if (m_Size + num - 1 >= m_Memory.NumAllocated()) + { + m_Memory.Grow(m_Size + num - m_Memory.NumAllocated()); + } + + m_Size += num; + ResetDbgInfo(); +} + +//----------------------------------------------------------------------------- +// Makes sure we have enough memory allocated to store a requested # of elements +//----------------------------------------------------------------------------- +template< class T > +void CUtlVector::EnsureCapacity(int num) +{ + m_Memory.EnsureCapacity(num); + ResetDbgInfo(); +} + +//----------------------------------------------------------------------------- +// Makes sure we have at least this many elements +//----------------------------------------------------------------------------- +template< class T > +void CUtlVector::EnsureCount(int num) +{ + if (Count() < num) + AddMultipleToTail(num - Count()); +} + +//----------------------------------------------------------------------------- +// Shifts elements +//----------------------------------------------------------------------------- +template< class T > +void CUtlVector::ShiftElementsRight(int elem, int num) +{ + assert(IsValidIndex(elem) || (m_Size == 0) || (num == 0)); + int numToMove = m_Size - elem - num; + if ((numToMove > 0) && (num > 0)) + memmove(&Element(elem+num), &Element(elem), numToMove * sizeof(T)); +} + +template< class T > +void CUtlVector::ShiftElementsLeft(int elem, int num) +{ + assert(IsValidIndex(elem) || (m_Size == 0) || (num == 0)); + int numToMove = m_Size - elem - num; + if ((numToMove > 0) && (num > 0)) + { + memmove(&Element(elem), &Element(elem+num), numToMove * sizeof(T)); + +#ifdef _DEBUG + memset(&Element(m_Size-num), 0xDD, num * sizeof(T)); +#endif + } +} + +//----------------------------------------------------------------------------- +// Adds an element, uses default constructor +//----------------------------------------------------------------------------- + +template< class T > +inline int CUtlVector::AddToHead() +{ + return InsertBefore(0); +} + +template< class T > +inline int CUtlVector::AddToTail() +{ + return InsertBefore(m_Size); +} + +template< class T > +inline int CUtlVector::InsertAfter(int elem) +{ + return InsertBefore(elem + 1); +} + +template< class T > +int CUtlVector::InsertBefore(int elem) +{ + // Can insert at the end + assert((elem == Count()) || IsValidIndex(elem)); + + GrowVector(); + ShiftElementsRight(elem); + Construct(&Element(elem)); + return elem; +} + +//----------------------------------------------------------------------------- +// Adds an element, uses copy constructor +//----------------------------------------------------------------------------- + +template< class T > +inline int CUtlVector::AddToHead(T const& src) +{ + return InsertBefore(0, src); +} + +template< class T > +inline int CUtlVector::AddToTail(T const& src) +{ + return InsertBefore(m_Size, src); +} + +template< class T > +inline int CUtlVector::InsertAfter(int elem, T const& src) +{ + return InsertBefore(elem + 1, src); +} + +template< class T > +int CUtlVector::InsertBefore(int elem, T const& src) +{ + // Can insert at the end + assert((elem == Count()) || IsValidIndex(elem)); + + GrowVector(); + ShiftElementsRight(elem); + CopyConstruct(&Element(elem), src); + return elem; +} + + +//----------------------------------------------------------------------------- +// Adds multiple elements, uses default constructor +//----------------------------------------------------------------------------- + +template< class T > +inline int CUtlVector::AddMultipleToHead(int num) +{ + return InsertMultipleBefore(0, num); +} + +template< class T > +inline int CUtlVector::AddMultipleToTail(int num, const T *pToCopy) +{ + return InsertMultipleBefore(m_Size, num, pToCopy); +} + +template< class T > +int CUtlVector::InsertMultipleAfter(int elem, int num) +{ + return InsertMultipleBefore(elem + 1, num); +} + + +template< class T > +void CUtlVector::SetCount(int count) +{ + RemoveAll(); + AddMultipleToTail(count); +} + +template< class T > +inline void CUtlVector::SetSize(int size) +{ + SetCount(size); +} + +template< class T > +void CUtlVector::CopyArray(T const *pArray, int size) +{ + SetSize(size); + for(int i=0; i < size; i++) + (*this)[i] = pArray[i]; +} + +template< class T > +int CUtlVector::AddVectorToTail(CUtlVector const &src) +{ + int base = Count(); + + // Make space. + AddMultipleToTail(src.Count()); + + // Copy the elements. + for (int i=0; i < src.Count(); i++) + (*this)[base + i] = src[i]; + + return base; +} + +template< class T > +inline int CUtlVector::InsertMultipleBefore(int elem, int num, const T *pToInsert) +{ + if(num == 0) + return elem; + + // Can insert at the end + assert((elem == Count()) || IsValidIndex(elem)); + + GrowVector(num); + ShiftElementsRight(elem, num); + + // Invoke default constructors + for (int i = 0; i < num; ++i) + Construct(&Element(elem+i)); + + // Copy stuff in? + if (pToInsert) + { + for (int i=0; i < num; i++) + { + Element(elem+i) = pToInsert[i]; + } + } + + return elem; +} + +//----------------------------------------------------------------------------- +// Finds an element (element needs operator== defined) +//----------------------------------------------------------------------------- +template< class T > +int CUtlVector::Find(T const& src) const +{ + for (int i = 0; i < Count(); ++i) + { + if (Element(i) == src) + return i; + } + return -1; +} + +template< class T > +bool CUtlVector::HasElement(T const& src) +{ + return (Find(src) >= 0); +} + +//----------------------------------------------------------------------------- +// Element removal +//----------------------------------------------------------------------------- + +template< class T > +void CUtlVector::FastRemove(int elem) +{ + assert(IsValidIndex(elem)); + + Destruct(&Element(elem)); + if (m_Size > 0) + { + Q_memcpy(&Element(elem), &Element(m_Size-1), sizeof(T)); + --m_Size; + } +} + +template< class T > +void CUtlVector::Remove(int elem) +{ + Destruct(&Element(elem)); + ShiftElementsLeft(elem); + --m_Size; +} + +template< class T > +void CUtlVector::FindAndRemove(T const& src) +{ + int elem = Find(src); + if (elem != -1) + { + Remove(elem); + } +} + +template< class T > +void CUtlVector::RemoveMultiple(int elem, int num) +{ + assert(IsValidIndex(elem)); + assert(elem + num <= Count()); + + for (int i = elem + num; --i >= elem;) + Destruct(&Element(i)); + + ShiftElementsLeft(elem, num); + m_Size -= num; +} + +template< class T > +void CUtlVector::RemoveAll() +{ + for (int i = m_Size; --i >= 0;) + Destruct(&Element(i)); + + m_Size = 0; +} + +//----------------------------------------------------------------------------- +// Memory deallocation +//----------------------------------------------------------------------------- + +template< class T > +void CUtlVector::Purge() +{ + RemoveAll(); + m_Memory.Purge(); + ResetDbgInfo(); +} + +template +inline void CUtlVector::PurgeAndDeleteElements() +{ + for (int i = 0; i < m_Size; i++) + delete Element(i); + + Purge(); +} + +template< class T > +void CUtlVector::SetGrowSize(int size) +{ + m_Memory.SetGrowSize(size); +} + +#endif // CCVECTOR_H diff --git a/reapi/include/metamod/dllapi.h b/reapi/include/metamod/dllapi.h new file mode 100644 index 0000000..1563be0 --- /dev/null +++ b/reapi/include/metamod/dllapi.h @@ -0,0 +1,189 @@ +// dllapi.h - prototypes and typedefs for Half-Life DLL API routines + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 DLLAPI_H +#define DLLAPI_H + +#include "sdk_util.h" // BOOL +#include "osdep.h" // DLLEXPORT, etc + +// Typedefs for these are provided in SDK engine/eiface.h, but I didn't +// like the names (APIFUNCTION, APIFUNCTION2, NEW_DLL_FUNCTIONS_FN). +typedef int (*GETENTITYAPI_FN) (DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); +typedef int (*GETENTITYAPI2_FN) (DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); +typedef int (*GETNEWDLLFUNCTIONS_FN) (NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); + +// From SDK dlls/cbase.h: +C_DLLEXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); +C_DLLEXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); + +// No example in SDK.. +// From Adminmod dll.cpp: +C_DLLEXPORT int GetNewDLLFunctions( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion ); + + +// From SDK dlls/game.h: +extern void mm_GameDLLInit( void ); + +// From SDK dlls/cbase.h: +extern int mm_DispatchSpawn( edict_t *pent ); +extern void mm_DispatchThink( edict_t *pent ); +extern void mm_DispatchUse( edict_t *pentUsed, edict_t *pentOther ); +extern void mm_DispatchTouch( edict_t *pentTouched, edict_t *pentOther ); +extern void mm_DispatchBlocked( edict_t *pentBlocked, edict_t *pentOther ); +extern void mm_DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd ); +extern void mm_DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData ); +extern int mm_DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ); +extern void mm_DispatchObjectCollisionBox( edict_t *pent ); +extern void mm_SaveWriteFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); +extern void mm_SaveReadFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); +extern void mm_SaveGlobalState( SAVERESTOREDATA *pSaveData ); +extern void mm_RestoreGlobalState( SAVERESTOREDATA *pSaveData ); +extern void mm_ResetGlobalState( void ); + +// From SDK dlls/client.h: +extern BOOL mm_ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ); +extern void mm_ClientDisconnect( edict_t *pEntity ); +extern void mm_ClientKill( edict_t *pEntity ); +extern void mm_ClientPutInServer( edict_t *pEntity ); +extern void mm_ClientCommand( edict_t *pEntity ); +extern void mm_ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ); +extern void mm_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ); +extern void mm_ServerDeactivate( void ); +extern void mm_PlayerPreThink( edict_t *pEntity ); +extern void mm_PlayerPostThink( edict_t *pEntity ); +extern void mm_StartFrame( void ); +extern void mm_ParmsNewLevel( void ); +extern void mm_ParmsChangeLevel( void ); +extern const char *mm_GetGameDescription( void ); +extern void mm_PlayerCustomization( edict_t *pEntity, customization_t *pCust ); +extern void mm_SpectatorConnect ( edict_t *pEntity ); +extern void mm_SpectatorDisconnect ( edict_t *pEntity ); +extern void mm_SpectatorThink ( edict_t *pEntity ); +extern void mm_Sys_Error( const char *error_string ); + +// From SDK pm_shared/pm_shared.h: +extern void mm_PM_Move ( struct playermove_s *ppmove, int server ); +extern void mm_PM_Init ( struct playermove_s *ppmove ); +extern char mm_PM_FindTextureType ( char *name ); + +// From SDK dlls/client.h: +extern void mm_SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ); +extern void mm_UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ); +extern int mm_AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); +extern void mm_CreateBaseline( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ); +extern void mm_RegisterEncoders( void ); +extern int mm_GetWeaponData( struct edict_s *player, struct weapon_data_s *info ); +extern void mm_CmdStart( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ); +extern void mm_CmdEnd ( const edict_t *player ); +extern int mm_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); +extern int mm_GetHullBounds( int hullnumber, float *mins, float *maxs ); +extern void mm_CreateInstancedBaselines ( void ); +extern int mm_InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message ); +extern int mm_AllowLagCompensation( void ); + +// No example from SDK... +extern void mm_OnFreeEntPrivateData(edict_t pEnt); +extern void mm_GameShutdown(void); +extern int mm_ShouldCollide(edict_t *pentTouched, edict_t *pentOther); +//Added 2005-08-11 (no SDK update) +extern void mm_CvarValue(const edict_t *pEnt, const char *value); //! Obsolete! Use mm_CvarValue2 instead +//Added 2005-11-22 (no SDK update) +extern void mm_CvarValue2(const edict_t *pEnt, int requestID, const char *cvarName, const char *value); + + +// Typedefs for the above functions: + +typedef void (*FN_GAMEINIT) ( void ); +typedef int (*FN_DISPATCHSPAWN) ( edict_t *pent ); +typedef void (*FN_DISPATCHTHINK) ( edict_t *pent ); +typedef void (*FN_DISPATCHUSE) ( edict_t *pentUsed, edict_t *pentOther ); +typedef void (*FN_DISPATCHTOUCH) ( edict_t *pentTouched, edict_t *pentOther ); +typedef void (*FN_DISPATCHBLOCKED) ( edict_t *pentBlocked, edict_t *pentOther ); +typedef void (*FN_DISPATCHKEYVALUE) ( edict_t *pentKeyvalue, KeyValueData *pkvd ); +typedef void (*FN_DISPATCHSAVE) ( edict_t *pent, SAVERESTOREDATA *pSaveData ); +typedef int (*FN_DISPATCHRESTORE) ( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ); +typedef void (*FN_DISPATCHOBJECTCOLLISIONBOX) ( edict_t *pent ); +typedef void (*FN_SAVEWRITEFIELDS) ( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); +typedef void (*FN_SAVEREADFIELDS) ( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); +typedef void (*FN_SAVEGLOBALSTATE) ( SAVERESTOREDATA *pSaveData ); +typedef void (*FN_RESTOREGLOBALSTATE) ( SAVERESTOREDATA *pSaveData ); +typedef void (*FN_RESETGLOBALSTATE) ( void ); + +typedef BOOL (*FN_CLIENTCONNECT) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ); +typedef void (*FN_CLIENTDISCONNECT) ( edict_t *pEntity ); +typedef void (*FN_CLIENTKILL) ( edict_t *pEntity ); +typedef void (*FN_CLIENTPUTINSERVER) ( edict_t *pEntity ); +typedef void (*FN_CLIENTCOMMAND) ( edict_t *pEntity ); +typedef void (*FN_CLIENTUSERINFOCHANGED) ( edict_t *pEntity, char *infobuffer ); +typedef void (*FN_SERVERACTIVATE) ( edict_t *pEdictList, int edictCount, int clientMax ); +typedef void (*FN_SERVERDEACTIVATE) ( void ); +typedef void (*FN_PLAYERPRETHINK) ( edict_t *pEntity ); +typedef void (*FN_PLAYERPOSTTHINK) ( edict_t *pEntity ); +typedef void (*FN_STARTFRAME) ( void ); +typedef void (*FN_PARMSNEWLEVEL) ( void ); +typedef void (*FN_PARMSCHANGELEVEL) ( void ); +typedef const char *(*FN_GETGAMEDESCRIPTION) ( void ); +typedef void (*FN_PLAYERCUSTOMIZATION) ( edict_t *pEntity, customization_t *pCust ); +typedef void (*FN_SPECTATORCONNECT) ( edict_t *pEntity ); +typedef void (*FN_SPECTATORDISCONNECT) ( edict_t *pEntity ); +typedef void (*FN_SPECTATORTHINK) ( edict_t *pEntity ); +typedef void (*FN_SYS_ERROR) ( const char *error_string ); + +typedef void (*FN_PM_MOVE) ( struct playermove_s *ppmove, int server ); +typedef void (*FN_PM_INIT) ( struct playermove_s *ppmove ); +typedef char (*FN_PM_FINDTEXTURETYPE) ( char *name ); + +typedef void (*FN_SETUPVISIBILITY) ( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ); +typedef void (*FN_UPDATECLIENTDATA) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ); +typedef int (*FN_ADDTOFULLPACK) ( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ); +typedef void (*FN_CREATEBASELINE) ( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ); +typedef void (*FN_REGISTERENCODERS) ( void ); +typedef int (*FN_GETWEAPONDATA) ( struct edict_s *player, struct weapon_data_s *info ); +typedef void (*FN_CMDSTART) ( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ); +typedef void (*FN_CMDEND) ( const edict_t *player ); +typedef int (*FN_CONNECTIONLESSPACKET) ( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ); +typedef int (*FN_GETHULLBOUNDS) ( int hullnumber, float *mins, float *maxs ); +typedef void (*FN_CREATEINSTANCEDBASELINES) ( void ); +typedef int (*FN_INCONSISTENTFILE) ( const edict_t *player, const char *filename, char *disconnect_message ); +typedef int (*FN_ALLOWLAGCOMPENSATION) ( void ); + +typedef void (*FN_ONFREEENTPRIVATEDATA) (edict_t *pEnt); +typedef void (*FN_GAMESHUTDOWN) (void); +typedef int (*FN_SHOULDCOLLIDE) (edict_t *pentTouched, edict_t *pentOther); +//Added 2005-08-11 (no SDK update) +typedef void (*FN_CVARVALUE)(const edict_t *pEnt, const char *value); //! Obsolete! Use FN_CVARVALUE2 instead +//Added 2005-11-22 (no SDK update) +typedef void (*FN_CVARVALUE2)(const edict_t *pEnt, int requestID, const char *cvarName, const char *value); + +#endif /* DLLAPI_H */ diff --git a/reapi/include/metamod/engine_api.h b/reapi/include/metamod/engine_api.h new file mode 100644 index 0000000..3e46d28 --- /dev/null +++ b/reapi/include/metamod/engine_api.h @@ -0,0 +1,461 @@ +// engine_api.h - prototypes and typedefs for Half-Life engine functions + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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_API_H +#define ENGINE_API_H + +#include + +// Plugin's GetEngineFunctions, called by metamod. +typedef int (*GET_ENGINE_FUNCTIONS_FN) (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion); + +// According to SDK engine/eiface.h: +//! enginefuncs_t +//! ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 +#define ENGINE_INTERFACE_VERSION 138 + +// Protect against other projects which use this include file but use the +// normal enginefuncs_t type for their meta_engfuncs. +#ifdef METAMOD_CORE +# include "meta_eiface.h" // meta_enginefuncs_t +extern meta_enginefuncs_t meta_engfuncs; +#else +extern enginefuncs_t meta_engfuncs; +#endif + +// From SDK engine/eiface.h: +extern int mm_PrecacheModel(char *s); +extern int mm_PrecacheSound(char *s); +extern void mm_SetModel(edict_t *e, const char *m); +extern int mm_ModelIndex(const char *m); +extern int mm_ModelFrames(int modelIndex); + +extern void mm_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax); +extern void mm_ChangeLevel(char *s1, char *s2); +extern void mm_GetSpawnParms(edict_t *ent); +extern void mm_SaveSpawnParms(edict_t *ent); + +extern float mm_VecToYaw(const float *rgflVector); +extern void mm_VecToAngles(const float *rgflVectorIn, float *rgflVectorOut); +extern void mm_MoveToOrigin(edict_t *ent, const float *pflGoal, float dist, int iMoveType); +extern void mm_ChangeYaw(edict_t *ent); +extern void mm_ChangePitch(edict_t *ent); + +extern edict_t *mm_FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); +extern int mm_GetEntityIllum(edict_t *pEnt); +extern edict_t *mm_FindEntityInSphere(edict_t *pEdictStartSearchAfter, const float *org, float rad); +extern edict_t *mm_FindClientInPVS(edict_t *pEdict); +extern edict_t *mm_EntitiesInPVS(edict_t *pplayer); + +extern void mm_MakeVectors(const float *rgflVector); +extern void mm_AngleVectors(const float *rgflVector, float *forward, float *right, float *up); + +extern edict_t *mm_CreateEntity(void); +extern void mm_RemoveEntity(edict_t *e); +extern edict_t *mm_CreateNamedEntity(int className); + +extern void mm_MakeStatic(edict_t *ent); +extern int mm_EntIsOnFloor(edict_t *e); +extern int mm_DropToFloor(edict_t *e); + +extern int mm_WalkMove(edict_t *ent, float yaw, float dist, int iMode); +extern void mm_SetOrigin(edict_t *e, const float *rgflOrigin); + +extern void mm_EmitSound(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); +extern void mm_EmitAmbientSound(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); + +extern void mm_TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +extern void mm_TraceToss(edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr); +extern int mm_TraceMonsterHull(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +extern void mm_TraceHull(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); +extern void mm_TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); +extern const char *mm_TraceTexture(edict_t *pTextureEntity, const float *v1, const float *v2 ); +extern void mm_TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); +extern void mm_GetAimVector(edict_t *ent, float speed, float *rgflReturn); + +extern void mm_ServerCommand(char *str); +extern void mm_ServerExecute(void); +extern void ClientCommand(edict_t *pEdict, char *szFmt, ...); + +extern void mm_ParticleEffect(const float *org, const float *dir, float color, float count); +extern void mm_LightStyle(int style, char *val); +extern int mm_DecalIndex(const char *name); +extern int mm_PointContents(const float *rgflVector); + +extern void mm_MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +extern void mm_MessageEnd(void); + +extern void mm_WriteByte(int iValue); +extern void mm_WriteChar(int iValue); +extern void mm_WriteShort(int iValue); +extern void mm_WriteLong(int iValue); +extern void mm_WriteAngle(float flValue); +extern void mm_WriteCoord(float flValue); +extern void mm_WriteString(const char *sz); +extern void mm_WriteEntity(int iValue); + +extern void mm_CVarRegister(cvar_t *pCvar); +extern float mm_CVarGetFloat(const char *szVarName); +extern const char* mm_CVarGetString(const char *szVarName); +extern void mm_CVarSetFloat(const char *szVarName, float flValue); +extern void mm_CVarSetString(const char *szVarName, const char *szValue); + +extern void mm_AlertMessage(ALERT_TYPE atype, char *szFmt, ...); +#ifdef HLSDK_3_2_OLD_EIFACE +extern void mm_EngineFprintf(FILE *pfile, char *szFmt, ...); +#else +extern void mm_EngineFprintf(void *pfile, char *szFmt, ...); +#endif + +#ifdef HLSDK_3_2_OLD_EIFACE +extern void *mm_PvAllocEntPrivateData(edict_t *pEdict, long cb); +#else +extern void *mm_PvAllocEntPrivateData(edict_t *pEdict, int32 cb); +#endif +extern void *mm_PvEntPrivateData(edict_t *pEdict); +extern void mm_FreeEntPrivateData(edict_t *pEdict); + +extern const char *mm_SzFromIndex(int iString); +extern int mm_AllocString(const char *szValue); + +extern struct entvars_s *mm_GetVarsOfEnt(edict_t *pEdict); +extern edict_t *mm_PEntityOfEntOffset(int iEntOffset); +extern int mm_EntOffsetOfPEntity(const edict_t *pEdict); +extern int mm_IndexOfEdict(const edict_t *pEdict); +extern edict_t *mm_PEntityOfEntIndex(int iEntIndex); +extern edict_t *mm_FindEntityByVars(struct entvars_s *pvars); +extern void *mm_GetModelPtr(edict_t *pEdict); + +extern int mm_RegUserMsg(const char *pszName, int iSize); + +extern void mm_AnimationAutomove(const edict_t *pEdict, float flTime); +extern void mm_GetBonePosition(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); + +#ifdef HLSDK_3_2_OLD_EIFACE +extern unsigned long mm_FunctionFromName( const char *pName ); +extern const char *mm_NameForFunction( unsigned long function ); +#else +extern uint32 mm_FunctionFromName( const char *pName ); +extern const char *mm_NameForFunction( uint32 function ); +#endif + +extern void mm_ClientPrintf( edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg ); //! JOHN: engine callbacks so game DLL can print messages to individual clients +extern void mm_ServerPrint( const char *szMsg ); + +extern const char *mm_Cmd_Args( void ); //! these 3 added +extern const char *mm_Cmd_Argv( int argc ); //! so game DLL can easily +extern int mm_Cmd_Argc( void ); //! access client 'cmd' strings + +extern void mm_GetAttachment(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); + +extern void mm_CRC32_Init(CRC32_t *pulCRC); +extern void mm_CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len); +extern void mm_CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); +extern CRC32_t mm_CRC32_Final(CRC32_t pulCRC); + +#ifdef HLSDK_3_2_OLD_EIFACE +extern long mm_RandomLong(long lLow, long lHigh); +#else +extern int32 mm_RandomLong(int32 lLow, int32 lHigh); +#endif +extern float mm_RandomFloat(float flLow, float flHigh); + +extern void mm_SetView(const edict_t *pClient, const edict_t *pViewent ); +extern float mm_Time( void ); +extern void mm_CrosshairAngle(const edict_t *pClient, float pitch, float yaw); + +extern byte * mm_LoadFileForMe(char *filename, int *pLength); +extern void mm_FreeFile(void *buffer); + +extern void mm_EndSection(const char *pszSectionName); //! trigger_endsection +extern int mm_CompareFileTime(char *filename1, char *filename2, int *iCompare); +extern void mm_GetGameDir(char *szGetGameDir); +extern void mm_Cvar_RegisterVariable(cvar_t *variable); +extern void mm_FadeClientVolume(const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); +extern void mm_SetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed); +extern edict_t * mm_CreateFakeClient(const char *netname); //! returns NULL if fake client can't be created +extern void mm_RunPlayerMove(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); +extern int mm_NumberOfEntities(void); + +extern char *mm_GetInfoKeyBuffer(edict_t *e); //! passing in NULL gets the serverinfo +extern char *mm_InfoKeyValue(char *infobuffer, char *key); +extern void mm_SetKeyValue(char *infobuffer, char *key, char *value); +extern void mm_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value); + +extern int mm_IsMapValid(char *filename); +extern void mm_StaticDecal( const float *origin, int decalIndex, int entityIndex, int modelIndex ); +extern int mm_PrecacheGeneric(char *s); +extern int mm_GetPlayerUserId(edict_t *e ); //! returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients +extern void mm_BuildSoundMsg(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +extern int mm_IsDedicatedServer(void);//! is this a dedicated server? +extern cvar_t *mm_CVarGetPointer(const char *szVarName); +extern unsigned int mm_GetPlayerWONId(edict_t *e); //! returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients + +//! YWB 8/1/99 TFF Physics additions +extern void mm_Info_RemoveKey( char *s, const char *key ); +extern const char *mm_GetPhysicsKeyValue( const edict_t *pClient, const char *key ); +extern void mm_SetPhysicsKeyValue( const edict_t *pClient, const char *key, const char *value ); +extern const char *mm_GetPhysicsInfoString( const edict_t *pClient ); +extern unsigned short mm_PrecacheEvent( int type, const char *psz ); +extern void mm_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); + +extern unsigned char *mm_SetFatPVS( float *org ); +extern unsigned char *mm_SetFatPAS( float *org ); + +extern int mm_CheckVisibility( const edict_t *entity, unsigned char *pset ); + +extern void mm_DeltaSetField( struct delta_s *pFields, const char *fieldname ); +extern void mm_DeltaUnsetField( struct delta_s *pFields, const char *fieldname ); +extern void mm_DeltaAddEncoder( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); +extern int mm_GetCurrentPlayer( void ); +extern int mm_CanSkipPlayer( const edict_t *player ); +extern int mm_DeltaFindField( struct delta_s *pFields, const char *fieldname ); +extern void mm_DeltaSetFieldByIndex( struct delta_s *pFields, int fieldNumber ); +extern void mm_DeltaUnsetFieldByIndex( struct delta_s *pFields, int fieldNumber ); + +extern void mm_SetGroupMask( int mask, int op ); + +extern int CreateInstancedBaseline( int classname, struct entity_state_s *baseline ); +extern void mm_Cvar_DirectSet( struct cvar_s *var, char *value ); + +//! Forces the client and server to be running with the same version of the specified file +//!( e.g., a player model ). +//! Calling this has no effect in single player +extern void mm_ForceUnmodified( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); + +extern void mm_GetPlayerStats( const edict_t *pClient, int *ping, int *packet_loss ); + +extern void mm_AddServerCommand( char *cmd_name, void (*function) (void) ); +// Added in SDK 2.2: +extern qboolean mm_Voice_GetClientListening(int iReceiver, int iSender); +extern qboolean mm_Voice_SetClientListening(int iReceiver, int iSender, qboolean bListen); +// Added for HL 1109 (no SDK update): +extern const char *mm_pfnGetPlayerAuthId(edict_t *e); +// Added 2003-11-10 (no SDK update): +extern sequenceEntry_s * mm_SequenceGet(const char* fileName, const char* entryName); +extern sentenceEntry_s * mm_SequencePickSentence(const char* groupName, int pickMethod, int *picked); +extern int mm_GetFileSize(char *filename); +extern unsigned int mm_GetApproxWavePlayLen(const char *filepath); +extern int mm_IsCareerMatch(void); +extern int mm_GetLocalizedStringLength(const char *label); +extern void mm_RegisterTutorMessageShown(int mid); +extern int mm_GetTimesTutorMessageShown(int mid); +extern void mm_ProcessTutorMessageDecayBuffer(int *buffer, int bufferLength); +extern void mm_ConstructTutorMessageDecayBuffer(int *buffer, int bufferLength); +extern void mm_ResetTutorMessageDecayData(void); +//Added 2005-08-11 (no SDK update) +extern void mm_QueryClientCvarValue(const edict_t *pEdict, const char *cvarName); //! Obsolete! Use mm_QueryClientCvarValue2 instead +//Added 2005-11-22 (no SDK update) +extern void mm_QueryClientCvarValue2(const edict_t *pEdict, const char *cvarName, int requestID); + + +// Typedefs for the above functions: + +typedef int (*FN_PRECACHEMODEL) (char* s); +typedef int (*FN_PRECACHESOUND) (char* s); +typedef void (*FN_SETMODEL) (edict_t *e, const char *m); +typedef int (*FN_MODELINDEX) (const char *m); +typedef int (*FN_MODELFRAMES) (int modelIndex); +typedef void (*FN_SETSIZE) (edict_t *e, const float *rgflMin, const float *rgflMax); +typedef void (*FN_CHANGELEVEL) (char *s1, char *s2); +typedef void (*FN_GETSPAWNPARMS) (edict_t *ent); +typedef void (*FN_SAVESPAWNPARMS) (edict_t *ent); +typedef float (*FN_VECTOYAW) (const float *rgflVector); +typedef void (*FN_VECTOANGLES) (const float *rgflVectorIn, float *rgflVectorOut); +typedef void (*FN_MOVETOORIGIN) (edict_t *ent, const float *pflGoal, float dist, int iMoveType); +typedef void (*FN_CHANGEYAW) (edict_t *ent); +typedef void (*FN_CHANGEPITCH) (edict_t *ent); +typedef edict_t * (*FN_FINDENTITYBYSTRING) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); +typedef int (*FN_GETENTITYILLUM) (edict_t *pEnt); +typedef edict_t * (*FN_FINDENTITYINSPHERE) (edict_t *pEdictStartSearchAfter, const float *org, float rad); +typedef edict_t * (*FN_FINDCLIENTINPVS) (edict_t *pEdict); +typedef edict_t * (*FN_ENTITIESINPVS) (edict_t *pplayer); +typedef void (*FN_MAKEVECTORS) (const float *rgflVector); +typedef void (*FN_ANGLEVECTORS) (const float *rgflVector, float *forward, float *right, float *up); +typedef edict_t * (*FN_CREATEENTITY) (void); +typedef void (*FN_REMOVEENTITY) (edict_t *e); +typedef edict_t * (*FN_CREATENAMEDENTITY) (int className); +typedef void (*FN_MAKESTATIC) (edict_t *ent); +typedef int (*FN_ENTISONFLOOR) (edict_t *e); +typedef int (*FN_DROPTOFLOOR) (edict_t *e); +typedef int (*FN_WALKMOVE) (edict_t *ent, float yaw, float dist, int iMode); +typedef void (*FN_SETORIGIN) (edict_t *e, const float *rgflOrigin); +typedef void (*FN_EMITSOUND) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); +typedef void (*FN_EMITAMBIENTSOUND) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); +typedef void (*FN_TRACELINE) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +typedef void (*FN_TRACETOSS) (edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr); +typedef int (*FN_TRACEMONSTERHULL) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); +typedef void (*FN_TRACEHULL) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); +typedef void (*FN_TRACEMODEL) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); +typedef const char * (*FN_TRACETEXTURE) (edict_t *pTextureEntity, const float *v1, const float *v2 ); +typedef void (*FN_TRACESPHERE) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); +typedef void (*FN_GETAIMVECTOR) (edict_t *ent, float speed, float *rgflReturn); +typedef void (*FN_SERVERCOMMAND) (char *str); +typedef void (*FN_SERVEREXECUTE) (void); +typedef void (*FN_CLIENTCOMMAND_ENG) (edict_t *pEdict, char *szFmt, ...); +typedef void (*FN_PARTICLEEFFECT) (const float *org, const float *dir, float color, float count); +typedef void (*FN_LIGHTSTYLE) (int style, char *val); +typedef int (*FN_DECALINDEX) (const char *name); +typedef int (*FN_POINTCONTENTS) (const float *rgflVector); +typedef void (*FN_MESSAGEBEGIN) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +typedef void (*FN_MESSAGEEND) (void); +typedef void (*FN_WRITEBYTE) (int iValue); +typedef void (*FN_WRITECHAR) (int iValue); +typedef void (*FN_WRITESHORT) (int iValue); +typedef void (*FN_WRITELONG) (int iValue); +typedef void (*FN_WRITEANGLE) (float flValue); +typedef void (*FN_WRITECOORD) (float flValue); +typedef void (*FN_WRITESTRING) (const char *sz); +typedef void (*FN_WRITEENTITY) (int iValue); +typedef void (*FN_CVARREGISTER) (cvar_t *pCvar); +typedef float (*FN_CVARGETFLOAT) (const char *szVarName); +typedef const char * (*FN_CVARGETSTRING) (const char *szVarName); +typedef void (*FN_CVARSETFLOAT) (const char *szVarName, float flValue); +typedef void (*FN_CVARSETSTRING) (const char *szVarName, const char *szValue); +typedef void (*FN_ALERTMESSAGE) (ALERT_TYPE atype, char *szFmt, ...); +#ifdef HLSDK_3_2_OLD_EIFACE +typedef void (*FN_ENGINEFPRINTF) (FILE *pfile, char *szFmt, ...); +typedef void * (*FN_PVALLOCENTPRIVATEDATA) (edict_t *pEdict, long cb); +#else +typedef void (*FN_ENGINEFPRINTF) (void *pfile, char *szFmt, ...); +typedef void * (*FN_PVALLOCENTPRIVATEDATA) (edict_t *pEdict, int32 cb); +#endif +typedef void * (*FN_PVENTPRIVATEDATA) (edict_t *pEdict); +typedef void (*FN_FREEENTPRIVATEDATA) (edict_t *pEdict); +typedef const char * (*FN_SZFROMINDEX) (int iString); +typedef int (*FN_ALLOCSTRING) (const char *szValue); +typedef struct entvars_s * (*FN_GETVARSOFENT) (edict_t *pEdict); +typedef edict_t * (*FN_PENTITYOFENTOFFSET) (int iEntOffset); +typedef int (*FN_ENTOFFSETOFPENTITY) (const edict_t *pEdict); +typedef int (*FN_INDEXOFEDICT) (const edict_t *pEdict); +typedef edict_t * (*FN_PENTITYOFENTINDEX) (int iEntIndex); +typedef edict_t * (*FN_FINDENTITYBYVARS) (struct entvars_s *pvars); +typedef void * (*FN_GETMODELPTR) (edict_t *pEdict); +typedef int (*FN_REGUSERMSG) (const char *pszName, int iSize); +typedef void (*FN_ANIMATIONAUTOMOVE) (const edict_t *pEdict, float flTime); +typedef void (*FN_GETBONEPOSITION) (const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); +#ifdef HLSDK_3_2_OLD_EIFACE +typedef unsigned long (*FN_FUNCTIONFROMNAME) ( const char *pName ); +typedef const char * (*FN_NAMEFORFUNCTION) ( unsigned long function ); +#else +typedef uint32 (*FN_FUNCTIONFROMNAME) ( const char *pName ); +typedef const char * (*FN_NAMEFORFUNCTION) ( uint32 function ); +#endif +typedef void (*FN_CLIENTPRINTF) ( edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg ); +typedef void (*FN_SERVERPRINT) ( const char *szMsg ); +typedef const char * (*FN_CMD_ARGS) ( void ); +typedef const char * (*FN_CMD_ARGV) ( int argc ); +typedef int (*FN_CMD_ARGC) ( void ); +typedef void (*FN_GETATTACHMENT) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); +typedef void (*FN_CRC32_INIT) (CRC32_t *pulCRC); +typedef void (*FN_CRC32_PROCESSBUFFER) (CRC32_t *pulCRC, void *p, int len); +typedef void (*FN_CRC32_PROCESSBYTE) (CRC32_t *pulCRC, unsigned char ch); +typedef CRC32_t (*FN_CRC32_FINAL) (CRC32_t pulCRC); +#ifdef HLSDK_3_2_OLD_EIFACE +typedef long (*FN_RANDOMLONG) (long lLow, long lHigh); +#else +typedef int32 (*FN_RANDOMLONG) (int32 lLow, int32 lHigh); +#endif +typedef float (*FN_RANDOMFLOAT) (float flLow, float flHigh); +typedef void (*FN_SETVIEW) (const edict_t *pClient, const edict_t *pViewent ); +typedef float (*FN_TIME) ( void ); +typedef void (*FN_CROSSHAIRANGLE) (const edict_t *pClient, float pitch, float yaw); +typedef byte * (*FN_LOADFILEFORME) (char *filename, int *pLength); +typedef void (*FN_FREEFILE) (void *buffer); +typedef void (*FN_ENDSECTION) (const char *pszSectionName); +typedef int (*FN_COMPAREFILETIME) (char *filename1, char *filename2, int *iCompare); +typedef void (*FN_GETGAMEDIR) (char *szGetGameDir); +typedef void (*FN_CVAR_REGISTERVARIABLE) (cvar_t *variable); +typedef void (*FN_FADECLIENTVOLUME) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); +typedef void (*FN_SETCLIENTMAXSPEED) (const edict_t *pEdict, float fNewMaxspeed); +typedef edict_t * (*FN_CREATEFAKECLIENT) (const char *netname); +typedef void (*FN_RUNPLAYERMOVE) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); +typedef int (*FN_NUMBEROFENTITIES) (void); +typedef char * (*FN_GETINFOKEYBUFFER) (edict_t *e); +typedef char * (*FN_INFOKEYVALUE) (char *infobuffer, char *key); +typedef void (*FN_SETKEYVALUE) (char *infobuffer, char *key, char *value); +typedef void (*FN_SETCLIENTKEYVALUE) (int clientIndex, char *infobuffer, char *key, char *value); +typedef int (*FN_ISMAPVALID) (char *filename); +typedef void (*FN_STATICDECAL) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); +typedef int (*FN_PRECACHEGENERIC) (char *s); +typedef int (*FN_GETPLAYERUSERID) (edict_t *e ); +typedef void (*FN_BUILDSOUNDMSG) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +typedef int (*FN_ISDEDICATEDSERVER) (void); +typedef cvar_t * (*FN_CVARGETPOINTER) (const char *szVarName); +typedef unsigned int (*FN_GETPLAYERWONID) (edict_t *e); +typedef void (*FN_INFO_REMOVEKEY) ( char *s, const char *key ); +typedef const char * (*FN_GETPHYSICSKEYVALUE) ( const edict_t *pClient, const char *key ); +typedef void (*FN_SETPHYSICSKEYVALUE) ( const edict_t *pClient, const char *key, const char *value ); +typedef const char * (*FN_GETPHYSICSINFOSTRING) ( const edict_t *pClient ); +typedef unsigned short (*FN_PRECACHEEVENT) ( int type, const char *psz ); +typedef void (*FN_PLAYBACKEVENT) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); +typedef unsigned char * (*FN_SETFATPVS) ( float *org ); +typedef unsigned char * (*FN_SETFATPAS) ( float *org ); +typedef int (*FN_CHECKVISIBILITY) ( const edict_t *entity, unsigned char *pset ); +typedef void (*FN_DELTASETFIELD) ( struct delta_s *pFields, const char *fieldname ); +typedef void (*FN_DELTAUNSETFIELD) ( struct delta_s *pFields, const char *fieldname ); +typedef void (*FN_DELTAADDENCODER) ( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); +typedef int (*FN_GETCURRENTPLAYER) ( void ); +typedef int (*FN_CANSKIPPLAYER) ( const edict_t *player ); +typedef int (*FN_DELTAFINDFIELD) ( struct delta_s *pFields, const char *fieldname ); +typedef void (*FN_DELTASETFIELDBYINDEX) ( struct delta_s *pFields, int fieldNumber ); +typedef void (*FN_DELTAUNSETFIELDBYINDEX) ( struct delta_s *pFields, int fieldNumber ); +typedef void (*FN_SETGROUPMASK) ( int mask, int op ); +typedef int (*FN_CREATEINSTANCEDBASELINE) ( int classname, struct entity_state_s *baseline ); +typedef void (*FN_CVAR_DIRECTSET) ( struct cvar_s *var, char *value ); +typedef void (*FN_FORCEUNMODIFIED) ( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); +typedef void (*FN_GETPLAYERSTATS) ( const edict_t *pClient, int *ping, int *packet_loss ); +typedef void (*FN_ADDSERVERCOMMAND) ( char *cmd_name, void (*function) (void) ); +// Added in SDK 2.2: +typedef qboolean (*FN_VOICE_GETCLIENTLISTENING) (int iReceiver, int iSender); +typedef qboolean (*FN_VOICE_SETCLIENTLISTENING) (int iReceiver, int iSender, qboolean bListen); +// Added for HL 1109 (no SDK update): +typedef const char * (*FN_GETPLAYERAUTHID) (edict_t *e); +// Added 2003-11-10 (no SDK update): +typedef sequenceEntry_s * (*FN_SEQUENCEGET) (const char* fileName, const char* entryName); +typedef sentenceEntry_s * (*FN_SEQUENCEPICKSENTENCE) (const char* groupName, int pickMethod, int *picked); +typedef int (*FN_GETFILESIZE) (char *filename); +typedef unsigned int (*FN_GETAPPROXWAVEPLAYLEN) (const char *filepath); +typedef int (*FN_ISCAREERMATCH) (void); +typedef int (*FN_GETLOCALIZEDSTRINGLENGTH) (const char *label); +typedef void (*FN_REGISTERTUTORMESSAGESHOWN) (int mid); +typedef int (*FN_GETTIMESTUTORMESSAGESHOWN) (int mid); +typedef void (*FN_PROCESSTUTORMESSAGEDECAYBUFFER) (int *buffer, int bufferLength); +typedef void (*FN_CONSTRUCTTUTORMESSAGEDECAYBUFFER) (int *buffer, int bufferLength); +typedef void (*FN_RESETTUTORMESSAGEDECAYDATA) (void); +//Added 2005-08-11 (no SDK update) +typedef void (*FN_QUERYCLIENTCVARVALUE)(const edict_t *pEdict, const char *cvarName); //! Obsolete! Use FN_QUERYCLIENTCVARVALUE2 instead +//Added 2005-11-22 (no SDK update) +typedef void (*FN_QUERYCLIENTCVARVALUE2)(const edict_t *pEdict, const char *cvarName, int requestID); + +#endif /* ENGINE_API_H */ \ No newline at end of file diff --git a/reapi/include/metamod/enginecallbacks.h b/reapi/include/metamod/enginecallbacks.h new file mode 100644 index 0000000..7045fbb --- /dev/null +++ b/reapi/include/metamod/enginecallbacks.h @@ -0,0 +1,74 @@ +// enginecallbacks.h - wrapper for + +/* + * Copyright (c) 2001-2006 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 MM_ENGINECALLBACKS_H +#define MM_ENGINECALLBACKS_H + +// This file is a wrapper around the SDK's enginecallback.h file. We need +// this because we use a different type for the global object g_engfuncs, +// which is still compatible with the enginefuncs_t that the SDK +// uses. +// This is only done for files that belong to Metamod, not other projects +// like plugins that use this file, or others that include it, too. +// Since we don't have a clean seperation of include files right now we +// "hack" our way around that by using a flag METAMOD_CORE which is set +// when compiling Metamod proper. + +#ifdef METAMOD_CORE +# include "meta_eiface.h" // HL_enginefuncs_t + +// Use a #define to bend the enginefuncs_t type to our HL_enginefuncs_t +// type instead as we now use that for the global object g_engfuncs. +# define enginefuncs_t HL_enginefuncs_t +#endif /* METAMOD_CORE */ + +#include // ALERT, etc + +#ifdef METAMOD_CORE +# undef enginefuncs_t +#endif /* METAMOD_CORE */ + +// Also, create some additional macros for engine callback functions, which +// weren't in SDK dlls/enginecallbacks.h but probably should have been. + +#define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) +#define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue) +#define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue) +#define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand) +#define SERVER_PRINT (*g_engfuncs.pfnServerPrint) +#define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue) +#define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue) +#define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2) + + +#endif /* MM_ENGINECALLBACKS_H */ diff --git a/reapi/include/metamod/h_export.h b/reapi/include/metamod/h_export.h new file mode 100644 index 0000000..878acd1 --- /dev/null +++ b/reapi/include/metamod/h_export.h @@ -0,0 +1,46 @@ +// h_export.h - prototypes for h_export.cpp + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 H_EXPORT_H +#define H_EXPORT_H + +#include "osdep.h" // DLLEXPORT, WINAPI, etc + +// Our GiveFnptrsToDll, called by engine. +typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t + *pengfuncsFromEngine, globalvars_t *pGlobals); + +C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pengfuncsFromEngine, + globalvars_t *pGlobals); + +#endif /* H_EXPORT_H */ diff --git a/reapi/include/metamod/log_meta.h b/reapi/include/metamod/log_meta.h new file mode 100644 index 0000000..ec47c6d --- /dev/null +++ b/reapi/include/metamod/log_meta.h @@ -0,0 +1,99 @@ +// log_meta.h - functions & macros for logging + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 LOG_META_H +#define LOG_META_H + +#include "enginecallbacks.h" // ALERT, etc +#include "sdk_util.h" // UTIL_VarArgs, etc + +// Debug logging. +// +// This is done as a macro, rather than a function. This way, you can add +// DEBUG statements all over, without worrying about performance +// implications. If the debugging level is set low, all those statements +// will only generate a simple float/int compare each; if we were to use a +// function instead of a macro, it would end up wasting a lot of cpu cycles +// calling/returning from the function every time. With a fair number of +// DEBUG statements, or if they're placed in frequently excuted code, the +// overhead of the wasted function calls could significantly impact server +// performance. +// +// For this reason, we also compare directly to the float value of the +// cvar, rather than calling CVAR_GET_FLOAT() and thus generating a string +// compare for each DEBUG statement. +// +// Called as: +// META_DEBUG(3, ("return code: %d", ret)); +// +// Note the double parens, and the missing parens around "args" in the +// macro itself. Note also the "do..while(0)" loop wrapping the +// statements, so they become a single statement when expanded, necessary +// for times when it might be called as a single-statement result of an +// else (or other flow control). +// +// As suggested by Jussi Kivilinna: Use "if(meta_debug.value < level); else +// DO(something);" style because "meta_debug.value < level" is in most common +// case "false". Check disasm, contitional jumps are predicted not to be +// taken by CPU. +// +// Yes, it's all a bit of a hack. + +#define META_DEBUG(level, args) \ + do { if(meta_debug.value < level) break; else ALERT(at_logged, "[META] (debug:%d) %s\n", level, UTIL_VarArgs args ); } while(0) + +// max buffer size for printed messages +#define MAX_LOGMSG_LEN 1024 + +// max buffer size for client messages +#define MAX_CLIENTMSG_LEN 128 + +extern cvar_t meta_debug; + +// META_DEV provides debug logging via the cvar "developer" (when set to 1) +// and uses a function call rather than a macro as it's really intended to +// be used only during startup, before meta_debug has been set from reading +// server.cfg. +// NOTE: META_DEV has now been mostly obsoleted in the code. + +void META_CONS(char *fmt, ...); +void META_DEV(char *fmt, ...); +void META_INFO(char *fmt, ...); +void META_WARNING(char *fmt, ...); +void META_ERROR(char *fmt, ...); +void META_LOG(char *fmt, ...); +void META_CLIENT(edict_t *pEntity, char *fmt, ...); + +void flush_ALERT_buffer(void); + +#endif /* LOG_META_H */ diff --git a/reapi/include/metamod/meta_api.h b/reapi/include/metamod/meta_api.h new file mode 100644 index 0000000..3bbccfa --- /dev/null +++ b/reapi/include/metamod/meta_api.h @@ -0,0 +1,232 @@ +// meta_api.h - description of metamod's DLL interface + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 META_API_H +#define META_API_H + +#include "dllapi.h" // GETENTITYAPI_FN, etc +#include "engine_api.h" // GET_ENGINE_FUNCTIONS_FN, etc +#include "plinfo.h" // plugin_info_t, etc +#include "mutil.h" // mutil_funcs_t, etc +#include "osdep.h" // DLLEXPORT, etc + +// Version consists of "major:minor", two separate integer numbers. +// Version 1 original +// Version 2 added plugin_info_t **pinfo +// Version 3 init split into query and attach, added detach +// Version 4 added (PLUG_LOADTIME now) to attach +// Version 5 changed mm ifvers int* to string, moved pl ifvers to info +// Version 5:1 added link support for entity "adminmod_timer" (adminmod) +// Version 5:2 added gamedll_funcs to meta_attach() [v1.0-rc2] +// Version 5:3 added mutil_funcs to meta_query() [v1.05] +// Version 5:4 added centersay utility functions [v1.06] +// Version 5:5 added Meta_Init to plugin API [v1.08] +// Version 5:6 added CallGameEntity utility function [v1.09] +// Version 5:7 added GetUserMsgID, GetUserMsgName util funcs [v1.11] +// Version 5:8 added GetPluginPath [v1.11] +// Version 5:9 added GetGameInfo [v1.14] +// Version 5:10 added GINFO_REALDLL_FULLPATH for GetGameInfo [v1.17] +// Version 5:11 added plugin loading and unloading API [v1.18] +// Version 5:12 added util code for checking player query status [v1.18] +// Version 5:13 added cvarquery2 support and api for calling hook tables [v1.19] +#define META_INTERFACE_VERSION "5:13" + +#ifdef UNFINISHED +// Version 5:99 added event hook utility functions [v.???] +#define META_INTERFACE_VERSION "5:99" +#endif /* UNFINISHED */ + +// Flags returned by a plugin's api function. +// NOTE: order is crucial, as greater/less comparisons are made. +typedef enum { + MRES_UNSET = 0, + MRES_IGNORED, // plugin didn't take any action + MRES_HANDLED, // plugin did something, but real function should still be called + MRES_OVERRIDE, // call real function, but use my return value + MRES_SUPERCEDE, // skip real function; use my return value +} META_RES; + +// Variables provided to plugins. +typedef struct meta_globals_s { + META_RES mres; // writable; plugin's return flag + META_RES prev_mres; // readable; return flag of the previous plugin called + META_RES status; // readable; "highest" return flag so far + void *orig_ret; // readable; return value from "real" function + void *override_ret; // readable; return value from overriding/superceding plugin +} meta_globals_t; + +extern meta_globals_t *gpMetaGlobals; +#define SET_META_RESULT(result) gpMetaGlobals->mres=result +#define RETURN_META(result) \ + do { gpMetaGlobals->mres=result; return; } while(0) + +#define RETURN_META_VALUE(result, value) \ + do { gpMetaGlobals->mres=result; return(value); } while(0) + +#define META_RESULT_STATUS gpMetaGlobals->status +#define META_RESULT_PREVIOUS gpMetaGlobals->prev_mres +#define META_RESULT_ORIG_RET(type) *(type *)gpMetaGlobals->orig_ret +#define META_RESULT_OVERRIDE_RET(type) *(type *)gpMetaGlobals->override_ret + +// Table of getapi functions, retrieved from each plugin. +typedef struct { + GETENTITYAPI_FN pfnGetEntityAPI; + GETENTITYAPI_FN pfnGetEntityAPI_Post; + GETENTITYAPI2_FN pfnGetEntityAPI2; + GETENTITYAPI2_FN pfnGetEntityAPI2_Post; + GETNEWDLLFUNCTIONS_FN pfnGetNewDLLFunctions; + GETNEWDLLFUNCTIONS_FN pfnGetNewDLLFunctions_Post; + GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions; + GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions_Post; +} META_FUNCTIONS; + +// Pair of function tables provided by game DLL. +typedef struct { + DLL_FUNCTIONS *dllapi_table; + NEW_DLL_FUNCTIONS *newapi_table; +} gamedll_funcs_t; + +// Declared in plugin; referenced in macros. +extern gamedll_funcs_t *gpGamedllFuncs; +extern mutil_funcs_t *gpMetaUtilFuncs; + +// Tell the dll that we'll be loading it as a metamod plugin, in case it +// needs to do something special prior to the standard query/attach +// procedure. In particular, this will allow for DLL's that can be used as +// both standalone DLL's and metamod plugins. (optional; not required in +// plugin) +C_DLLEXPORT void Meta_Init(void); +typedef void (*META_INIT_FN) (void); + +// Get info about plugin, compare meta_interface versions, provide meta +// utility callback functions. +C_DLLEXPORT int Meta_Query(char *interfaceVersion, + plugin_info_t **plinfo, + mutil_funcs_t *pMetaUtilFuncs); +typedef int (*META_QUERY_FN) (char *interfaceVersion, + plugin_info_t **plinfo, + mutil_funcs_t *pMetaUtilFuncs); + +// Attach the plugin to the API; get the table of getapi functions; give +// meta_globals and gamedll_funcs. +C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, + META_FUNCTIONS *pFunctionTable, + meta_globals_t *pMGlobals, + gamedll_funcs_t *pGamedllFuncs); +typedef int (*META_ATTACH_FN) (PLUG_LOADTIME now, + META_FUNCTIONS *pFunctionTable, + meta_globals_t *pMGlobals, + gamedll_funcs_t *pGamedllFuncs); + +// Detach the plugin; tell why and when. +C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason); +typedef int (*META_DETACH_FN) (PLUG_LOADTIME now, PL_UNLOAD_REASON reason); + +// Standard HL SDK interface function prototypes. +C_DLLEXPORT int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable, + int interfaceVersion ); +C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, + int *interfaceVersion ); + +// Additional SDK-like interface function prototypes. +C_DLLEXPORT int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion ); +C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion); +C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion); + +// Convenience macros for accessing GameDLL functions. Note: these talk +// _directly_ to the gamedll, and are not multiplexed through Metamod to +// the other plugins. +// DLL API functions: +#define MDLL_FUNC gpGamedllFuncs->dllapi_table + +#define MDLL_GameDLLInit MDLL_FUNC->pfnGameInit +#define MDLL_Spawn MDLL_FUNC->pfnSpawn +#define MDLL_Think MDLL_FUNC->pfnThink +#define MDLL_Use MDLL_FUNC->pfnUse +#define MDLL_Touch MDLL_FUNC->pfnTouch +#define MDLL_Blocked MDLL_FUNC->pfnBlocked +#define MDLL_KeyValue MDLL_FUNC->pfnKeyValue +#define MDLL_Save MDLL_FUNC->pfnSave +#define MDLL_Restore MDLL_FUNC->pfnRestore +#define MDLL_ObjectCollsionBox MDLL_FUNC->pfnAbsBox +#define MDLL_SaveWriteFields MDLL_FUNC->pfnSaveWriteFields +#define MDLL_SaveReadFields MDLL_FUNC->pfnSaveReadFields +#define MDLL_SaveGlobalState MDLL_FUNC->pfnSaveGlobalState +#define MDLL_RestoreGlobalState MDLL_FUNC->pfnRestoreGlobalState +#define MDLL_ResetGlobalState MDLL_FUNC->pfnResetGlobalState +#define MDLL_ClientConnect MDLL_FUNC->pfnClientConnect +#define MDLL_ClientDisconnect MDLL_FUNC->pfnClientDisconnect +#define MDLL_ClientKill MDLL_FUNC->pfnClientKill +#define MDLL_ClientPutInServer MDLL_FUNC->pfnClientPutInServer +#define MDLL_ClientCommand MDLL_FUNC->pfnClientCommand +#define MDLL_ClientUserInfoChanged MDLL_FUNC->pfnClientUserInfoChanged +#define MDLL_ServerActivate MDLL_FUNC->pfnServerActivate +#define MDLL_ServerDeactivate MDLL_FUNC->pfnServerDeactivate +#define MDLL_PlayerPreThink MDLL_FUNC->pfnPlayerPreThink +#define MDLL_PlayerPostThink MDLL_FUNC->pfnPlayerPostThink +#define MDLL_StartFrame MDLL_FUNC->pfnStartFrame +#define MDLL_ParmsNewLevel MDLL_FUNC->pfnParmsNewLevel +#define MDLL_ParmsChangeLevel MDLL_FUNC->pfnParmsChangeLevel +#define MDLL_GetGameDescription MDLL_FUNC->pfnGetGameDescription +#define MDLL_PlayerCustomization MDLL_FUNC->pfnPlayerCustomization +#define MDLL_SpectatorConnect MDLL_FUNC->pfnSpectatorConnect +#define MDLL_SpectatorDisconnect MDLL_FUNC->pfnSpectatorDisconnect +#define MDLL_SpectatorThink MDLL_FUNC->pfnSpectatorThink +#define MDLL_Sys_Error MDLL_FUNC->pfnSys_Error +#define MDLL_PM_Move MDLL_FUNC->pfnPM_Move +#define MDLL_PM_Init MDLL_FUNC->pfnPM_Init +#define MDLL_PM_FindTextureType MDLL_FUNC->pfnPM_FindTextureType +#define MDLL_SetupVisibility MDLL_FUNC->pfnSetupVisibility +#define MDLL_UpdateClientData MDLL_FUNC->pfnUpdateClientData +#define MDLL_AddToFullPack MDLL_FUNC->pfnAddToFullPack +#define MDLL_CreateBaseline MDLL_FUNC->pfnCreateBaseline +#define MDLL_RegisterEncoders MDLL_FUNC->pfnRegisterEncoders +#define MDLL_GetWeaponData MDLL_FUNC->pfnGetWeaponData +#define MDLL_CmdStart MDLL_FUNC->pfnCmdStart +#define MDLL_CmdEnd MDLL_FUNC->pfnCmdEnd +#define MDLL_ConnectionlessPacket MDLL_FUNC->pfnConnectionlessPacket +#define MDLL_GetHullBounds MDLL_FUNC->pfnGetHullBounds +#define MDLL_CreateInstancedBaselines MDLL_FUNC->pfnCreateInstancedBaselines +#define MDLL_InconsistentFile MDLL_FUNC->pfnInconsistentFile +#define MDLL_AllowLagCompensation MDLL_FUNC->pfnAllowLagCompensation + +// NEW API functions: +#define MNEW_FUNC gpGamedllFuncs->newapi_table + +#define MNEW_OnFreeEntPrivateData MNEW_FUNC->pfnOnFreeEntPrivateData +#define MNEW_GameShutdown MNEW_FUNC->pfnGameShutdown +#define MNEW_ShouldCollide MNEW_FUNC->pfnShouldCollide +#define MNEW_CvarValue MNEW_FUNC->pfnCvarValue +#define MNEW_CvarValue2 MNEW_FUNC->pfnCvarValue2 + +#endif /* META_API_H */ diff --git a/reapi/include/metamod/mhook.h b/reapi/include/metamod/mhook.h new file mode 100644 index 0000000..b56b0a6 --- /dev/null +++ b/reapi/include/metamod/mhook.h @@ -0,0 +1,157 @@ +#ifdef UNFINISHED + +// mhook.h - class and types to describe hooks and hooklists + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 MHOOK_H +#define MHOOK_H + +#include "plinfo.h" // plid_t, etc +#include "types_meta.h" // mBOOL +#include "osdep.h" // MUTEX_T, etc + +#define MAX_HOOKS 100 + +// Particular game events that we detect, though whatever means we can best +// find. +typedef enum { + EV_NONE = 0, // no event here... + // non-log detected + EV_PLAYER_CONNECT, // ie ClientConnect + EV_PLAYER_ENTER, // ie ClientPutInServer + EV_PLAYER_LEAVE, // ie ClientDisconnect (opposite PutInServer) + EV_PLAYER_SPAWN, // deadflag change to DEAD_NO + EV_PLAYER_DEATH, // deadflag change to DEAD_DEAD + EV_PLAYER_CHANGE_NAME, // netname change in ClientUserInfoChanged + // log detected + EV_PLAYER_JOIN_TEAM, // ie "Joe<15><785><>" joined team "CT" + EV_PLAYER_SUICIDE, // ie "Joe<15><785>" committed suicide ... + EV_PLAYER_CHANGE_ROLE, // TFC: ie "Joe<15><785>" changed role to "Pyro" + EV_TEAM_KILL, // ie "Joe<15><785>" killed "Bob<16><342>" ... + EV_WEAPON_KILL, // ie "Joe<15><785>" killed "Sam<17><197>" with "sg552" + EV_TEAM_SCORE, // ie Team "CT" scored "7" with "2" players +} game_event_t; + +// Info corresponding to a player, in particular the info found in the logline. +typedef struct { + char *name; + int userid; + int wonid; + char *team; +} event_player_t; + +// Info for an event, mostly corresponding to info from a logline. +typedef struct { + game_event_t evtype; // specific event, if identified. + char *buf; // copy of the logmsg, with embedded NULLs + event_player_t *player; + char *action; // "triggered" string, or a generic action string + event_player_t *target; + char *with; +} event_args_t; + +// Types for callback functions to be called for requested event/logline. +typedef void (*event_func_t) (game_event_t event, event_args_t *args, + const char *logline); +typedef void (*logmatch_func_t) (const char *pattern, event_args_t *args, + const char *logline); + +// The 4 types of hook requests we accept. +typedef enum { + H_NONE = 0, + H_EVENT, // Specific event, from a short list. + H_TRIGGER, // A given "triggered" string. + H_STRING, // Any substring of logline. + H_REGEX, // A regular expression matching of logline. +} hook_t; + + +// Class for individual hook function, as registered by a plugin. +class MHook { + friend class MHookList; + friend class MFuncQueue; + private: + // data: + int index; + hook_t type; // EVENT, TRIGGER, etc + plid_t plid; + int pl_index; // index of matching plugin + void *pfnHandle; + game_event_t event; // if type is H_EVENT + const char *match; // if type is TRIGGER, STRING, or REGEX + // Copy/Assignment constructors, to satisfy -Weffc++. + // Note however, we declare them private and don't define them, since + // we don't ever want to copy or assign instances of the class. + // (thanks to O'Reilly "C++: The Core Language", page 113) + MHook(const MHook &src); + void operator=(const MHook &src); + // constructors: + MHook(void); + MHook(int idx, plid_t pid, game_event_t evt, event_func_t pfn); + MHook(int idx, plid_t pid, hook_t tp, const char *cp, logmatch_func_t pfn); + // functions: + mBOOL call(event_args_t *args, const char *logline); + mBOOL enqueue(MFuncQueue *mfq, event_args_t *args, const char *logline); + public: + // no public interfaces; everything done from friend MHookList. +}; + + +// Class for list of registered hook functions. +class MHookList { + private: + // data: + MHook *hlist[MAX_HOOKS]; + int size; // set to MAX_HOOKS in constructor + int endlist; + MUTEX_T mx_hlist; + int MXlock(void) { return(MUTEX_LOCK(&mx_hlist)); }; + int MXunlock(void) { return(MUTEX_UNLOCK(&mx_hlist)); }; + public: + // constructor: + MHookList(void); + // functions: + int add(plid_t plid, game_event_t event, event_func_t pfnHandle); + int add(plid_t plid, hook_t type, const char *match, + logmatch_func_t pfnHandle); + mBOOL remove(plid_t plid, int hindex); + int remove_all(plid_t plid); + mBOOL call(event_args_t *args, const char *logline); + mBOOL enqueue(MFuncQueue *mfq, hook_t htype, event_args_t *evargs, + const char *logline); + char *str_htype(hook_t htype); +}; + +#endif /* MHOOK_H */ + +#endif /* UNFINISHED */ diff --git a/reapi/include/metamod/mreg.h b/reapi/include/metamod/mreg.h new file mode 100644 index 0000000..00fe0c9 --- /dev/null +++ b/reapi/include/metamod/mreg.h @@ -0,0 +1,183 @@ +// mreg.h - description of registered items (classes MRegCmd, MRegCmdList) + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 MREG_H +#define MREG_H + +#include "types_meta.h" // mBOOL + +// Number of entries to add to reglists when they need to grow. Typically +// more cvars than commands, so we grow them at different increments. +#define REG_CMD_GROWSIZE 32 +#define REG_CVAR_GROWSIZE 64 + +// Width required to printf a Reg*List index number, for show() functions. +// This used to correspond to the number of digits in MAX_REG, which was a +// fixed, compile-time limit. However, now that the reg lists are grown +// dynamically, this has less strong correspondance to list sizes. So for +// the moment, it reflects what one might normally expect to be the max +// width needed to print an index number; 4 allows 9999 (which is a damn +// lot, if you ask me). +#define WIDTH_MAX_REG 4 + +// Max number of registered user msgs we can manage. +#define MAX_REG_MSGS 256 + +// Flags to indicate if given cvar or func is part of a loaded plugin. +typedef enum { + RG_INVALID, + RG_VALID, +} REG_STATUS; + +// Pointer to function registered by AddServerCommand. +typedef void (*REG_CMD_FN) (void); + + +// An individual registered function/command. +class MRegCmd { + friend class MRegCmdList; + private: + // data: + int index; // 1-based + public: + char *name; // space is malloc'd + REG_CMD_FN pfnCmd; // pointer to the function + int plugid; // index id of corresponding plugin + REG_STATUS status; // whether corresponding plugin is loaded + // functions: + void init(int idx); // init values, as not using constructors + mBOOL call(void); // try to call the function +}; + + +// A list of registered commands. +class MRegCmdList { + private: + // data: + MRegCmd *mlist; // malloc'd array of registered commands + int size; // current size of list + int endlist; // index of last used entry + // Private; to satisfy -Weffc++ "has pointer data members but does + // not override" copy/assignment constructor. + void operator=(const MRegCmdList &src); + MRegCmdList(const MRegCmdList &src); + + public: + // constructor: + MRegCmdList(void); + + // functions: + MRegCmd *find(const char *findname); // find by MRegCmd->name + MRegCmd *add(const char *addname); + void disable(int plugin_id); // change status to Invalid + void show(void); // list all funcs to console + void show(int plugin_id); // list given plugin's funcs to console +}; + + + +// An individual registered cvar. +class MRegCvar { + friend class MRegCvarList; + private: + // data: + int index; // 1-based + public: + cvar_t *data; // actual cvar structure, malloc'd + int plugid; // index id of corresponding plugin + REG_STATUS status; // whether corresponding plugin is loaded + // functions: + void init(int idx); // init values, as not using constructors + mBOOL set(cvar_t *src); +}; + + +// A list of registered cvars. +class MRegCvarList { + private: + // data: + MRegCvar *vlist; // malloc'd array of registered cvars + int size; // size of list, ie MAX_REG_CVARS + int endlist; // index of last used entry + // Private; to satisfy -Weffc++ "has pointer data members but does + // not override" copy/assignment constructor. + void operator=(const MRegCvarList &src); + MRegCvarList(const MRegCvarList &src); + + public: + // constructor: + MRegCvarList(void); + + // functions: + MRegCvar *add(const char *addname); + MRegCvar *find(const char *findname); // find by MRegCvar->data.name + void disable(int plugin_id); // change status to Invalid + void show(void); // list all cvars to console + void show(int plugin_id); // list given plugin's cvars to console +}; + + + +// An individual registered user msg, from gamedll. +class MRegMsg { + friend class MRegMsgList; + private: + // data: + int index; // 1-based + public: + const char *name; // name, assumed constant string in gamedll + int msgid; // msgid, assigned by engine + int size; // size, if given by gamedll +}; + + +// A list of registered user msgs. +class MRegMsgList { + private: + // data: + MRegMsg mlist[MAX_REG_MSGS]; // array of registered msgs + int size; // size of list, ie MAX_REG_MSGS + int endlist; // index of last used entry + + public: + // constructor: + MRegMsgList(void); + + // functions: + MRegMsg *add(const char *addname, int addmsgid, int addsize); + MRegMsg *find(const char *findname); + MRegMsg *find(int findmsgid); + void show(void); // list all msgs to console +}; + +#endif /* MREG_H */ diff --git a/reapi/include/metamod/mutil.h b/reapi/include/metamod/mutil.h new file mode 100644 index 0000000..eb7edc4 --- /dev/null +++ b/reapi/include/metamod/mutil.h @@ -0,0 +1,157 @@ +// mutil.h - prototypes for utility functions to provide to plugins + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 MUTIL_H +#define MUTIL_H + +#include "plinfo.h" // plugin_info_t, etc +#include "mhook.h" // game_event_t, etc +#include "sdk_util.h" // hudtextparms_t, etc + +// max buffer size for printed messages +#define MAX_LOGMSG_LEN 1024 + +// For GetGameInfo: +typedef enum { + GINFO_NAME = 0, + GINFO_DESC, + GINFO_GAMEDIR, + GINFO_DLL_FULLPATH, + GINFO_DLL_FILENAME, + GINFO_REALDLL_FULLPATH, +} ginfo_t; + +// Meta Utility Function table type. +typedef struct meta_util_funcs_s { + void (*pfnLogConsole) (plid_t plid, const char *fmt, ...); + void (*pfnLogMessage) (plid_t plid, const char *fmt, ...); + void (*pfnLogError) (plid_t plid, const char *fmt, ...); + void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...); + void (*pfnCenterSay) (plid_t plid, const char *fmt, ...); + void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms, + const char *fmt, ...); + void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms, + const char *fmt, va_list ap); + qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr, + entvars_t *pev); + int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size); + const char *(*pfnGetUserMsgName) (plid_t plid, int msgid, int *size); + const char *(*pfnGetPluginPath) (plid_t plid); + const char *(*pfnGetGameInfo) (plid_t plid, ginfo_t tag); + int (*pfnLoadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle); + int (*pfnUnloadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); + int (*pfnUnloadPluginByHandle) (plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); + const char *(*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict); + int (*pfnMakeRequestId) (plid_t plid); + void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); +#ifdef UNFINISHED + int (*pfnHookGameEvent) (plid_t plid, game_event_t event, + event_func_t pfnHandle); + int (*pfnHookLogTrigger) (plid_t plid, const char *trigger, + logmatch_func_t pfnHandle); + int (*pfnHookLogString) (plid_t plid, const char *string, + logmatch_func_t pfnHandle); + int (*pfnHookLogRegex) (plid_t plid, const char *pattern, + logmatch_func_t pfnHandle); + qboolean (*pfnRemoveHookID) (plid_t plid, int hookid); + int (*pfnRemoveHookAll) (plid_t plid); +#endif /* UNFINISHED */ +} mutil_funcs_t; +extern mutil_funcs_t MetaUtilFunctions; + +// Meta Utility Functions +void mutil_LogConsole(plid_t plid, const char *fmt, ...); +void mutil_LogMessage(plid_t plid, const char *fmt, ...); +void mutil_LogError(plid_t plid, const char *fmt, ...); +void mutil_LogDeveloper(plid_t plid, const char *fmt, ...); + +void mutil_CenterSay(plid_t plid, const char *fmt, ...); +void mutil_CenterSayParms(plid_t plid, hudtextparms_t tparms, + const char *fmt, ...); +void mutil_CenterSayVarargs(plid_t plid, hudtextparms_t tparms, + const char *fmt, va_list ap); + +qboolean mutil_CallGameEntity(plid_t plid, const char *entStr, entvars_t *pev); + +int mutil_GetUserMsgID(plid_t plid, const char *name, int *size); +const char *mutil_GetUserMsgName(plid_t plid, int msgid, int *size); +const char *mutil_GetPluginPath(plid_t plid); +const char *mutil_GetGameInfo(plid_t plid, ginfo_t tag); +const char *mutil_IsQueryingClientCvar(plid_t plid, const edict_t *pEdict); +int mutil_MakeRequestId(plid_t plid); +void mutil_GetHookTables(plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); + +#ifdef UNFINISHED +int mutil_HookGameEvent(plid_t plid, game_event_t event, + event_func_t pfnHandle); +int mutil_HookLogTrigger(plid_t plid, const char *trigger, + logmatch_func_t pfnHandle); +int mutil_HookLogString(plid_t plid, const char *string, + logmatch_func_t pfnHandle); +int mutil_HookLogRegex(plid_t plid, const char *pattern, + logmatch_func_t pfnHandle); + +qboolean mutil_RemoveHookID(plid_t plid, int hookid); +int mutil_RemoveHookAll(plid_t plid); +#endif /* UNFINISHED */ + +// Convenience macros for MetaUtil functions +#define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole) +#define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage) +#define LOG_ERROR (*gpMetaUtilFuncs->pfnLogError) +#define LOG_DEVELOPER (*gpMetaUtilFuncs->pfnLogDeveloper) +#define CENTER_SAY (*gpMetaUtilFuncs->pfnCenterSay) +#define CENTER_SAY_PARMS (*gpMetaUtilFuncs->pfnCenterSayParms) +#define CENTER_SAY_VARARGS (*gpMetaUtilFuncs->pfnCenterSayVarargs) +#define CALL_GAME_ENTITY (*gpMetaUtilFuncs->pfnCallGameEntity) +#define GET_USER_MSG_ID (*gpMetaUtilFuncs->pfnGetUserMsgID) +#define GET_USER_MSG_NAME (*gpMetaUtilFuncs->pfnGetUserMsgName) +#define GET_PLUGIN_PATH (*gpMetaUtilFuncs->pfnGetPluginPath) +#define GET_GAME_INFO (*gpMetaUtilFuncs->pfnGetGameInfo) +#define LOAD_PLUGIN (*gpMetaUtilFuncs->pfnLoadPlugin) +#define UNLOAD_PLUGIN (*gpMetaUtilFuncs->pfnUnloadPlugin) +#define UNLOAD_PLUGIN_BY_HANDLE (*gpMetaUtilFuncs->pfnUnloadPluginByHandle) +#define IS_QUERYING_CLIENT_CVAR (*gpMetaUtilFuncs->pfnIsQueryingClientCvar) +#define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestId) +#define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables) + +#ifdef UNFINISHED +#define HOOK_GAME_EVENT (*gpMetaUtilFuncs->pfnHookGameEvent) +#define HOOK_LOG_TRIGGER (*gpMetaUtilFuncs->pfnHookLogTrigger) +#define HOOK_LOG_STRING (*gpMetaUtilFuncs->pfnHookLogString) +#define HOOK_LOG_REGEX (*gpMetaUtilFuncs->pfnHookLogRegex) +#define REMOVE_HOOK_ID (*gpMetaUtilFuncs->pfnRemoveHookID) +#define REMOVE_HOOK_ALL (*gpMetaUtilFuncs->pfnRemoveHookAll) +#endif /* UNFINISHED */ + +#endif /* MUTIL_H */ diff --git a/reapi/include/metamod/osdep.h b/reapi/include/metamod/osdep.h new file mode 100644 index 0000000..e11a8b7 --- /dev/null +++ b/reapi/include/metamod/osdep.h @@ -0,0 +1,519 @@ +// osdep.h - operating system dependencies + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 OSDEP_H +#define OSDEP_H + +#include // strerror() +#include // isupper, tolower +#include // errno + +// Various differences between WIN32 and Linux. + +#include "types_meta.h" // mBOOL +#include "mreg.h" // REG_CMD_FN, etc +#include "log_meta.h" // LOG_ERROR, etc + +extern mBOOL dlclose_handle_invalid; + +// String describing platform/DLL-type, for matching lines in plugins.ini. +#ifdef __linux__ + #define PLATFORM "linux" +# ifdef __amd64__ + #define PLATFORM_SPC "lin64" +# else + #define PLATFORM_SPC "lin32" +# endif +#elif defined(_WIN32) + #define PLATFORM "mswin" + #define PLATFORM_SPC "win32" +#else /* unknown */ + #error "OS unrecognized" +#endif /* unknown */ + + +// Macro for function-exporting from DLL.. +// from SDK dlls/cbase.h: +//! C functions for external declarations that call the appropriate C++ methods + +// Windows uses "__declspec(dllexport)" to mark functions in the DLL that +// should be visible/callable externally. +// +// It also apparently requires WINAPI for GiveFnptrsToDll(). +// +// See doc/notes_windows_coding for more information.. + +// Attributes to specify an "exported" function, visible from outside the +// DLL. +#undef DLLEXPORT +#ifdef _WIN32 + #define DLLEXPORT __declspec(dllexport) + // WINAPI should be provided in the windows compiler headers. + // It's usually defined to something like "__stdcall". +#elif defined(__linux__) + #define DLLEXPORT /* */ + #define WINAPI /* */ +#endif /* linux */ + +#ifdef __GNUC__ +# define DECLSPEC(kw) +# define ATTRIBUTE(kw) __attribute__((kw)) +# define MM_CDECL +#elif defined(_MSC_VER) +# define DECLSPEC(kw) __declspec(kw) +# define ATTRIBUTE(kw) +# define MM_CDECL __cdecl +#endif /* _MSC_VER */ + + +// Simplified macro for declaring/defining exported DLL functions. They +// need to be 'extern "C"' so that the C++ compiler enforces parameter +// type-matching, rather than considering routines with mis-matched +// arguments/types to be overloaded functions... +// +// AFAIK, this is os-independent, but it's included here in osdep.h where +// DLLEXPORT is defined, for convenience. +#define C_DLLEXPORT extern "C" DLLEXPORT + + +#ifdef _MSC_VER + // Disable MSVC warning: + // 4390 : empty controlled statement found; is this what was intended? + // generated by the RETURN macros. + #pragma warning(disable: 4390) +#endif /* _MSC_VER */ + + +// Functions & types for DLL open/close/etc operations. +#ifdef __linux__ + #include + typedef void* DLHANDLE; + typedef void* DLFUNC; + inline DLHANDLE DLOPEN(const char *filename) { + return(dlopen(filename, RTLD_NOW)); + } + inline DLFUNC DLSYM(DLHANDLE handle, const char *string) { + return(dlsym(handle, string)); + } + inline int DLCLOSE(DLHANDLE handle) { + if (!handle) { + dlclose_handle_invalid = mTRUE; + return(1); + } + dlclose_handle_invalid = mFALSE; + return(dlclose(handle)); + } + inline char* DLERROR(void) { + if (dlclose_handle_invalid) + return("Invalid handle."); + return(dlerror()); + } +#elif defined(_WIN32) + typedef HINSTANCE DLHANDLE; + typedef FARPROC DLFUNC; + inline DLHANDLE DLOPEN(const char *filename) { + return(LoadLibrary(filename)); + } + inline DLFUNC DLSYM(DLHANDLE handle, const char *string) { + return(GetProcAddress(handle, string)); + } + inline int DLCLOSE(DLHANDLE handle) { + if (!handle) { + dlclose_handle_invalid = mTRUE; + return(1); + } + dlclose_handle_invalid = mFALSE; + // NOTE: Windows FreeLibrary returns success=nonzero, fail=zero, + // which is the opposite of the unix convention, thus the '!'. + return(!FreeLibrary(handle)); + } + // Windows doesn't provide a function corresponding to dlerror(), so + // we make our own. + char *str_GetLastError(void); + inline char* DLERROR(void) { + if (dlclose_handle_invalid) + return("Invalid handle."); + return(str_GetLastError()); + } +#endif /* _WIN32 */ +const char *DLFNAME(void *memptr); +mBOOL IS_VALID_PTR(void *memptr); + + +// Attempt to call the given function pointer, without segfaulting. +mBOOL os_safe_call(REG_CMD_FN pfn); + + +// Windows doesn't have an strtok_r() routine, so we write our own. +#ifdef _WIN32 + #define strtok_r(s, delim, ptrptr) my_strtok_r(s, delim, ptrptr) + char *my_strtok_r(char *s, const char *delim, char **ptrptr); +#endif /* _WIN32 */ + + +// Set filename and pathname maximum lengths. Note some windows compilers +// provide a which is incomplete and/or causes problems; see +// doc/windows_notes.txt for more information. +// +// Note that both OS's include room for null-termination: +// linux: "# chars in a path name including nul" +// win32: "note that the sizes include space for 0-terminator" +#ifdef __linux__ + #include +#elif defined(_WIN32) + #include + #define NAME_MAX _MAX_FNAME + #define PATH_MAX _MAX_PATH +#endif /* _WIN32 */ + + +// Various other windows routine differences. +#ifdef __linux__ + #include // sleep + #ifndef O_BINARY + #define O_BINARY 0 + #endif +#elif defined(_WIN32) + #define snprintf _snprintf + #define vsnprintf _vsnprintf + #define sleep(x) Sleep(x*1000) + #define strcasecmp _stricmp + #define strncasecmp _strnicmp + #include + #define open _open + #define read _read + #define write _write + #define close _close +#endif /* _WIN32 */ + +#ifdef __GNUC__ + #include // getcwd +#elif defined(_MSC_VER) + #include // getcwd +#endif /* _MSC_VER */ + +#include +#ifndef S_ISREG + // Linux gcc defines this; earlier mingw didn't, later mingw does; + // MSVC doesn't seem to. + #define S_ISREG(m) ((m) & S_IFREG) +#endif /* not S_ISREG */ +#ifdef _WIN32 + // The following two are defined in mingw but not in MSVC + #ifndef S_IRUSR + #define S_IRUSR _S_IREAD + #endif + #ifndef S_IWUSR + #define S_IWUSR _S_IWRITE + #endif + + // The following two are defined neither in mingw nor in MSVC + #ifndef S_IRGRP + #define S_IRGRP S_IRUSR + #endif + #ifndef S_IWGRP + #define S_IWGRP S_IWUSR + #endif +#endif /* _WIN32 */ + + +// Our handler for new(). +// +// Thanks to notes from: +// http://dragon.klte.hu/~kollarl/C++/node45.html +// +// At one point it appeared MSVC++ was no longer different from gcc, according +// to: +// http://msdn.microsoft.com/library/en-us/vclang98/stdlib/info/NEW.asp +// +// However, this page is apparently no longer available from MSDN. The +// only thing now is: +// http://msdn.microsoft.com/library/en-us/vccore98/HTML/_crt_malloc.asp +// +// According to Fritz Elfert : +// set_new_handler() is just a stub which (according to comments in the +// MSVCRT debugging sources) should never be used. It is just an ugly +// hack to make STL compile. It does _not_ set the new handler but +// always calls _set_new_handler(0) instead. _set_new_handler is the +// "real" function and uses the "old" semantic; handler-type is: +// int newhandler(size_t) +// +#if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1300)) + void MM_CDECL meta_new_handler(void); +#elif defined(_MSC_VER) + int meta_new_handler(size_t size); +#endif /* _MSC_VER */ + + +// To keep the rest of the sources clean and keep not only OS but also +// compiler dependant differences in this file, we define a local function +// to set the new handler. +void mm_set_new_handler( void ); + + + +// Thread handling... +#ifdef __linux__ + #include + typedef pthread_t THREAD_T; + // returns 0==success, non-zero==failure + inline int THREAD_CREATE(THREAD_T *tid, void (*func)(void)) { + int ret; + ret=pthread_create(tid, NULL, (void *(*)(void*)) func, NULL); + if(ret != 0) { + META_ERROR("Failure starting thread: %s", strerror(ret)); + return(ret); + } + ret=pthread_detach(*tid); + if(ret != 0) + META_ERROR("Failure detaching thread: %s", strerror(ret)); + return(ret); + } +#elif defined(_WIN32) + // See: + // http://msdn.microsoft.com/library/en-us/dllproc/prothred_4084.asp + typedef DWORD THREAD_T; + // returns 0==success, non-zero==failure + inline int THREAD_CREATE(THREAD_T *tid, void (*func)(void)) { + HANDLE ret; + // win32 returns NULL==failure, non-NULL==success + ret=CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) func, NULL, 0, tid); + if(ret==NULL) + META_ERROR("Failure starting thread: %s", str_GetLastError()); + return(ret==NULL); + } +#endif /* _WIN32 */ +#define THREAD_OK 0 + + +// Mutex handling... +#ifdef __linux__ + typedef pthread_mutex_t MUTEX_T; + inline int MUTEX_INIT(MUTEX_T *mutex) { + int ret; + ret=pthread_mutex_init(mutex, NULL); + if(ret!=THREAD_OK) + META_ERROR("mutex_init failed: %s", strerror(ret)); + return(ret); + } + inline int MUTEX_LOCK(MUTEX_T *mutex) { + int ret; + ret=pthread_mutex_lock(mutex); + if(ret!=THREAD_OK) + META_ERROR("mutex_lock failed: %s", strerror(ret)); + return(ret); + } + inline int MUTEX_UNLOCK(MUTEX_T *mutex) { + int ret; + ret=pthread_mutex_unlock(mutex); + if(ret!=THREAD_OK) + META_ERROR("mutex_unlock failed: %s", strerror(ret)); + return(ret); + } +#elif defined(_WIN32) + // Win32 has "mutexes" as well, but CS's are simpler. + // See: + // http://msdn.microsoft.com/library/en-us/dllproc/synchro_2a2b.asp + typedef CRITICAL_SECTION MUTEX_T; + // Note win32 routines don't return any error (return void). + inline int MUTEX_INIT(MUTEX_T *mutex) { + InitializeCriticalSection(mutex); + return(THREAD_OK); + } + inline int MUTEX_LOCK(MUTEX_T *mutex) { + EnterCriticalSection(mutex); + return(THREAD_OK); + } + inline int MUTEX_UNLOCK(MUTEX_T *mutex) { + LeaveCriticalSection(mutex); + return(THREAD_OK); + } +#endif /* _WIN32 (mutex) */ + + +// Condition variables... +#ifdef __linux__ + typedef pthread_cond_t COND_T; + inline int COND_INIT(COND_T *cond) { + int ret; + ret=pthread_cond_init(cond, NULL); + if(ret!=THREAD_OK) + META_ERROR("cond_init failed: %s", strerror(ret)); + return(ret); + } + inline int COND_WAIT(COND_T *cond, MUTEX_T *mutex) { + int ret; + ret=pthread_cond_wait(cond, mutex); + if(ret!=THREAD_OK) + META_ERROR("cond_wait failed: %s", strerror(ret)); + return(ret); + } + inline int COND_SIGNAL(COND_T *cond) { + int ret; + ret=pthread_cond_signal(cond); + if(ret!=THREAD_OK) + META_ERROR("cond_signal failed: %s", strerror(ret)); + return(ret); + } +#elif defined(_WIN32) + // Since win32 doesn't provide condition-variables, we have to model + // them with mutex/critical-sections and win32 events. This uses the + // second (SetEvent) solution from: + // + // http://www.cs.wustl.edu/~schmidt/win32-cv-1.html + // + // but without the waiters_count overhead, since we don't need + // broadcast functionality anyway. Or actually, I guess it's more like + // the first (PulseEvent) solution, but with SetEven rather than + // PulseEvent. :) + // + // See also: + // http://msdn.microsoft.com/library/en-us/dllproc/synchro_8ann.asp + typedef HANDLE COND_T; + inline int COND_INIT(COND_T *cond) { + *cond = CreateEvent(NULL, // security attributes (none) + FALSE, // manual-reset type (false==auto-reset) + FALSE, // initial state (unsignaled) + NULL); // object name (unnamed) + // returns NULL on error + if(*cond==NULL) { + META_ERROR("cond_init failed: %s", str_GetLastError()); + return(-1); + } + else + return(0); + } + inline int COND_WAIT(COND_T *cond, MUTEX_T *mutex) { + DWORD ret; + LeaveCriticalSection(mutex); + ret=WaitForSingleObject(*cond, INFINITE); + EnterCriticalSection(mutex); + // returns WAIT_OBJECT_0 if object was signaled; other return + // values indicate errors. + if(ret == WAIT_OBJECT_0) + return(0); + else { + META_ERROR("cond_wait failed: %s", str_GetLastError()); + return(-1); + } + } + inline int COND_SIGNAL(COND_T *cond) { + BOOL ret; + ret=SetEvent(*cond); + // returns zero on failure + if(ret==0) { + META_ERROR("cond_signal failed: %s", str_GetLastError()); + return(-1); + } + else + return(0); + } +#endif /* _WIN32 (condition variable) */ + +// Normalize/standardize a pathname. +// - For win32, this involves: +// - Turning backslashes (\) into slashes (/), so that config files and +// Metamod internal code can be simpler and just use slashes (/). +// - Turning upper/mixed case into lowercase, since windows is +// non-case-sensitive. +// - For linux, this requires no work, as paths uses slashes (/) natively, +// and pathnames are case-sensitive. +#ifdef __linux__ +#define normalize_pathname(a) +#elif defined(_WIN32) +inline void normalize_pathname(char *path) { + char *cp; + + META_DEBUG(8, ("normalize: %s", path)); + for(cp=path; *cp; cp++) { + if(isupper(*cp)) *cp=tolower(*cp); + if(*cp=='\\') *cp='/'; + } + META_DEBUG(8, ("normalized: %s", path)); +} +#endif /* _WIN32 */ + +// Indicate if pathname appears to be an absolute-path. Under linux this +// is a leading slash (/). Under win32, this can be: +// - a drive-letter path (ie "D:blah" or "C:\blah") +// - a toplevel path (ie "\blah") +// - a UNC network address (ie "\\srv1\blah"). +// Also, handle both native and normalized pathnames. +inline int is_absolute_path(const char *path) { + if(path[0]=='/') return(TRUE); +#ifdef _WIN32 + if(path[1]==':') return(TRUE); + if(path[0]=='\\') return(TRUE); +#endif /* _WIN32 */ + return(FALSE); +} + +#ifdef _WIN32 +// Buffer pointed to by resolved_name is assumed to be able to store a +// string of PATH_MAX length. +inline char *realpath(const char *file_name, char *resolved_name) { + int ret; + ret=GetFullPathName(file_name, PATH_MAX, resolved_name, NULL); + if(ret > PATH_MAX) { + errno=ENAMETOOLONG; + return(NULL); + } + else if(ret > 0) { + HANDLE handle; + WIN32_FIND_DATA find_data; + handle=FindFirstFile(resolved_name, &find_data); + if(INVALID_HANDLE_VALUE == handle) { + errno=ENOENT; + return NULL; + } + FindClose(handle); + normalize_pathname(resolved_name); + return(resolved_name); + } + else + return(NULL); +} +#endif /* _WIN32 */ + +// Generic "error string" from a recent OS call. For linux, this is based +// on errno. For win32, it's based on GetLastError. +inline const char *str_os_error(void) { +#ifdef __linux__ + return(strerror(errno)); +#elif defined(_WIN32) + return(str_GetLastError()); +#endif /* _WIN32 */ +} + + +#endif /* OSDEP_H */ diff --git a/reapi/include/metamod/plinfo.h b/reapi/include/metamod/plinfo.h new file mode 100644 index 0000000..9e5b744 --- /dev/null +++ b/reapi/include/metamod/plinfo.h @@ -0,0 +1,79 @@ +// plinfo.h - typedefs for plugin info structure + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 PLINFO_H +#define PLINFO_H + +// Flags for plugin to indicate when it can be be loaded/unloaded. +// NOTE: order is crucial, as greater/less comparisons are made. +typedef enum { + PT_NEVER = 0, + PT_STARTUP, // should only be loaded/unloaded at initial hlds execution + PT_CHANGELEVEL, // can be loaded/unloaded between maps + PT_ANYTIME, // can be loaded/unloaded at any time + PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map +} PLUG_LOADTIME; + +// Flags to indicate why the plugin is being unloaded. +typedef enum { + PNL_NULL = 0, + PNL_INI_DELETED, // was deleted from plugins.ini + PNL_FILE_NEWER, // file on disk is newer than last load + PNL_COMMAND, // requested by server/console command + PNL_CMD_FORCED, // forced by server/console command + PNL_DELAYED, // delayed from previous request; can't tell origin +//only used for 'real_reason' on MPlugin::unload() + PNL_PLUGIN, // requested by plugin function call + PNL_PLG_FORCED, // forced by plugin function call + PNL_RELOAD, // forced unload by reload() +} PL_UNLOAD_REASON; + +// Information plugin provides about itself. +typedef struct { + char *ifvers; // meta_interface version + char *name; // full name of plugin + char *version; // version + char *date; // date + char *author; // author name/email + char *url; // URL + char *logtag; // log message prefix (unused right now) + PLUG_LOADTIME loadable; // when loadable + PLUG_LOADTIME unloadable; // when unloadable +} plugin_info_t; +extern plugin_info_t Plugin_info; + +// Plugin identifier, passed to all Meta Utility Functions. +typedef plugin_info_t* plid_t; +#define PLID &Plugin_info + +#endif /* PLINFO_H */ diff --git a/reapi/include/metamod/sdk_util.h b/reapi/include/metamod/sdk_util.h new file mode 100644 index 0000000..a87922c --- /dev/null +++ b/reapi/include/metamod/sdk_util.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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. + * + */ + +// Wrap util.h from SDK with ifndef/endif, to avoid problems from multiple +// inclusions. Dunno why Valve didn't do that in util.h themselves.. + +#ifndef SDK_UTIL_H +#define SDK_UTIL_H + +// We're not including the DBG_EntOfVars and DBG_AssertFunction routines +// mentioned in the SDK util.h, so we're going to unset DEBUG here so that +// we don't get "unresolved symbol" errors. +#ifdef DEBUG +#undef DEBUG +#endif // DEBUG + +// Inlcude local enginecallbacks wrapper *first* so that the g_engfuncs +// type is correct and the header protection is already +// defined. +#include "enginecallbacks.h" +#include + +// Also, create some nice inlines for engine callback combos. + +// Get a setinfo value from a player entity. +inline char *ENTITY_KEYVALUE(edict_t *entity, char *key) { + char *ifbuf=GET_INFOKEYBUFFER(entity); + return(INFOKEY_VALUE(ifbuf, key)); +} + +// Set a setinfo value for a player entity. +inline void ENTITY_SET_KEYVALUE(edict_t *entity, char *key, char *value) { + char *ifbuf=GET_INFOKEYBUFFER(entity); + SET_CLIENT_KEYVALUE(ENTINDEX(entity), ifbuf, key, value); +} + +// Get a "serverinfo" value. +inline char *SERVERINFO(char *key) { + edict_t *server=INDEXENT(0); + return(ENTITY_KEYVALUE(server, key)); +} + +// Set a "serverinfo" value. +inline void SET_SERVERINFO(char *key, char *value) { + edict_t *server=INDEXENT(0); + char *ifbuf=GET_INFOKEYBUFFER(server); + SET_SERVER_KEYVALUE(ifbuf, key, value); +} + +// Get a "localinfo" value. +inline char *LOCALINFO(char *key) { + edict_t *server=NULL; + return(ENTITY_KEYVALUE(server, key)); +} + +// Set a "localinfo" value. +inline void SET_LOCALINFO(char *key, char *value) { + edict_t *server=NULL; + char *ifbuf=GET_INFOKEYBUFFER(server); + SET_SERVER_KEYVALUE(ifbuf, key, value); +} + +short FixedSigned16(float value, float scale); +unsigned short FixedUnsigned16(float value, float scale); + +// Our slightly modified version, using an edict_t pointer instead of a +// CBaseEntity pointer. +void META_UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage); + +#endif // SDK_UTIL_H diff --git a/reapi/include/metamod/types_meta.h b/reapi/include/metamod/types_meta.h new file mode 100644 index 0000000..6f5bb5d --- /dev/null +++ b/reapi/include/metamod/types_meta.h @@ -0,0 +1,79 @@ +// types_meta.h - common internal type, etc definitions + +/* + * Copyright (c) 2001-2003 Will Day + * + * This file is part of Metamod. + * + * Metamod 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. + * + * Metamod 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 Metamod; 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 TYPES_META_H +#define TYPES_META_H + +// Our own boolean type, for stricter type matching. +typedef enum mBOOL { + mFALSE = 0, + mTRUE, +} mBOOL; + +// Like C's errno, for our various functions; describes causes of failure +// or mFALSE returns. +typedef enum { + ME_NOERROR = 0, + ME_FORMAT, // invalid format + ME_COMMENT, // ignored comment + ME_BLANK, // ignored blank (empty) line + ME_ALREADY, // request had already been done + ME_DELAYED, // request is delayed + ME_NOTALLOWED, // request not allowed + ME_SKIPPED, // request is being skipped for whatever reason + ME_BADREQ, // invalid request for this + ME_ARGUMENT, // invalid arguments + ME_NULLRESULT, // resulting data was empty or null + ME_MAXREACHED, // reached max/limit + ME_NOTUNIQ, // not unique (ambigious match) + ME_NOTFOUND, // in find operation, match not found + ME_NOFILE, // file empty or missing + ME_NOMEM, // malloc failed + ME_BADMEMPTR, // invalid memory address + ME_OSNOTSUP, // OS doesn't support this operation + ME_DLOPEN, // failed to open shared lib/dll + ME_DLMISSING, // symbol missing in lib/dll + ME_DLERROR, // some other error encountered calling functions from dll + ME_IFVERSION, // incompatible interface version + ME_UNLOAD_UNLOADER, // tried to unload unloader + ME_UNLOAD_SELF, // tried to unload self +} META_ERRNO; +extern META_ERRNO meta_errno; + +#define RETURN_ERRNO(retval, errval) \ + do { meta_errno=errval; return(retval); } while(0) + +#define RETURN_LOGERR_ERRNO(errargs, retval, errval) \ + do { META_ERROR errargs ; meta_errno=errval; return(retval); } while(0) + +#endif /* TYPES_META_H */ diff --git a/reapi/msvc/PostBuild.bat b/reapi/msvc/PostBuild.bat new file mode 100644 index 0000000..748e2cd --- /dev/null +++ b/reapi/msvc/PostBuild.bat @@ -0,0 +1,56 @@ +@echo OFF +:: +:: Post-build auto-deploy script +:: Create and fill PublishPath.txt file with path to deployment folder +:: I.e. PublishPath.txt should contain one line with a folder path +:: Call it so: +:: IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") +:: + +SET hlds=ServerStart_cs +SET status=0 + +SET targetDir=%~1 +SET targetName=%~2 +SET targetExt=%~3 +SET projectDir=%~4 +SET destination= + +IF EXIST "%hlds%.bat" ( + set status=1 +) +echo "%projectDir%\PublishPath.txt" + +IF NOT EXIST "%projectDir%\PublishPath.txt" ( + ECHO No deployment path specified. Create PublishPath.txt near PostBuild.bat with paths on separate lines for auto deployment. + exit /B 0 +) + +FOR /f "tokens=* delims= usebackq" %%a IN ("%projectDir%\PublishPath.txt") DO ( + ECHO Deploying to: %%a + IF NOT "%%a" == "" ( + copy /Y "%targetDir%%targetName%%targetExt%" "%%a" + + IF "%status%" == "1" ( + SET status=1 + ) + + IF NOT ERRORLEVEL 1 ( + IF EXIST "%targetDir%%targetName%.pdb" ( + copy /Y "%targetDir%%targetName%.pdb" "%%a" + ) + ) ELSE ( + ECHO PostBuild.bat ^(27^) : warning : Can't copy '%targetName%%targetExt%' to deploy path '%%a' + ) + ) +) + +IF "%status%" == "2" ( + start %hlds%.bat +) + +IF "%%a" == "" ( + ECHO No deployment path specified. +) + +exit /B 0 \ No newline at end of file diff --git a/reapi/msvc/PreBuild.bat b/reapi/msvc/PreBuild.bat new file mode 100644 index 0000000..34cddef --- /dev/null +++ b/reapi/msvc/PreBuild.bat @@ -0,0 +1,168 @@ +@echo OFF +:: +:: Pre-build auto-versioning script +:: + +SET srcdir=%~1 +SET repodir=%~2 + +SET old_version= +set old_specialbuild="" +SET version_revision=0 +set version_specialbuild= +SET version_pdate_1=%date:~-4%-%date:~3,2%-%date:~0,2% +SET version_pdate=%version_pdate_1% %time:~0,2%:%time:~3,2%:%time:~6,2% +SET version_date=%version_pdate_1%__%time:~0,2%-%time:~3,2%-%time:~6,2% +SET version_major=0 +SET version_minor=0 +SET version_specialversion= + +:: +:: Check for git.exe presence +:: +CALL git.exe describe >NUL 2>&1 +set errlvl="%ERRORLEVEL%" + +:: +:: Read old appversion.h, if present +:: +IF EXIST "%srcdir%\appversion.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( + IF %%i==#define ( + IF %%j==APP_VERSION_C SET old_version=%%k + IF %%j==APP_VERSION_SPECIALBUILD SET old_specialbuild=%%k + ) + ) +) + +IF %errlvl% == "1" ( + echo can't locate git.exe - auto-versioning step won't be performed + + :: if we haven't appversion.h, we need to create it + IF NOT "%old_version%" == "" ( + SET version_revision=0 + ) +) + +:: +:: Read major, minor and maintenance version components from Version.h +:: +IF EXIST "%srcdir%\version.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( + IF %%i==#define ( + IF %%j==VERSION_MAJOR SET version_major=%%k + IF %%j==VERSION_MINOR SET version_minor=%%k + IF %%j==VERSION_SPECIALVERSION SET version_specialversion=%%k + ) + ) +) ELSE ( + FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do ( + IF NOT [%%j] == [] ( + IF %%i==majorVersion SET version_major=%%j + IF %%i==minorVersion SET version_minor=%%j + IF %%i==specialVersion SET version_specialversion=%%j + ) + ) +) + +:: +:: Read revision and release date from it +:: +IF NOT %errlvl% == "1" ( + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --all | wc -l"') DO ( + IF NOT [%%i] == [] ( + set version_revision=%%i + ) + ) +) + +:: +:: Now form full version string like 1.0.0.1 +:: + +set new_version=%version_major%,%version_minor%,0,%version_revision% + +:: +:: Detect local modifications +:: +SET localChanged=0 +IF NOT %errlvl% == "1" ( + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( + SET localChanged=1 + ) +) + +IF [%localChanged%]==[1] ( + IF NOT [%version_specialversion%] == [] ( + set version_specialbuild=%version_specialversion% + ) ELSE ( + set version_specialbuild=m + ) +) ELSE ( + set version_specialbuild= +) + +:: +:: Update appversion.h if version has changed or modifications/mixed revisions detected +:: +IF NOT "%new_version%"=="%old_version%" goto _update +IF NOT "%version_specialbuild%"==%old_specialbuild% goto _update +goto _exit + +:_update +echo Updating appversion.h, new version is "%new_version%", the old one was "%old_version%" +echo new special build is "%version_specialbuild%", the old one was %old_specialbuild% + +echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" +echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo // This file is generated automatically.>>"%srcdir%\appversion.h" +echo // Don't edit it.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // Version defines>>"%srcdir%\appversion.h" + +IF "%version_specialversion%" == "" ( + echo #define APP_VERSION_D %version_major%.%version_minor%.%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD_RC "%version_major%.%version_minor%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_C %version_major%,%version_minor%,0,%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRCS "%version_major%, %version_minor%, 0, %version_revision%">>"%srcdir%\appversion.h" +) ELSE ( + echo #define APP_VERSION_D %version_major%.%version_minor%.%version_maintenance%.%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_maintenance%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRD_RC "%version_major%.%version_minor%.%version_maintenance%.%version_revision%">>"%srcdir%\appversion.h" + echo #define APP_VERSION_C %version_major%,%version_minor%,%version_maintenance%,%version_revision% >>"%srcdir%\appversion.h" + echo #define APP_VERSION_STRCS "%version_major%, %version_minor%, %version_maintenance%, %version_revision%">>"%srcdir%\appversion.h" +) + +echo.>>"%srcdir%\appversion.h" +echo #define APP_VERSION_DATE %version_date%>>"%srcdir%\appversion.h" +echo #define APP_VERSION_DATE_STR "%version_date%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo #define APP_VERSION_PDATE_STR "%version_pdate%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo #define APP_VERSION_YMD_STR "%version_pdate_1%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +IF NOT "%version_specialbuild%" == "" ( + echo #define APP_VERSION_FLAGS VS_FF_SPECIALBUILD>>"%srcdir%\appversion.h" + echo #define APP_VERSION_SPECIALBUILD "%version_specialbuild%">>"%srcdir%\appversion.h" + echo #define APP_VERSION APP_VERSION_STRD "" APP_VERSION_SPECIALBUILD>>"%srcdir%\appversion.h" +) ELSE ( + echo #define APP_VERSION_FLAGS 0x0L>>"%srcdir%\appversion.h" + echo #define APP_VERSION APP_VERSION_STRD>>"%srcdir%\appversion.h" +) +echo.>>"%srcdir%\appversion.h" + +echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +:: +:: Do update of version.cpp file last modify time to force it recompile +:: +copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp" + +:_exit +exit /B 0 \ No newline at end of file diff --git a/reapi/msvc/reapi.def b/reapi/msvc/reapi.def new file mode 100644 index 0000000..37081ae --- /dev/null +++ b/reapi/msvc/reapi.def @@ -0,0 +1,5 @@ +LIBRARY reapi_amxx +EXPORTS + GiveFnptrsToDll @1 +SECTIONS + .data READ WRITE diff --git a/reapi/msvc/reapi.rc b/reapi/msvc/reapi.rc new file mode 100644 index 0000000..bc666b3 --- /dev/null +++ b/reapi/msvc/reapi.rc @@ -0,0 +1,108 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" +#include "..\version\appversion.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1251) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +VS_VERSION_INFO VERSIONINFO +FILEVERSION APP_VERSION_C +PRODUCTVERSION APP_VERSION_C +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS (APP_VERSION_FLAGS | VS_FF_DEBUG) +#else + FILEFLAGS (APP_VERSION_FLAGS) +#endif +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +FILESUBTYPE VFT2_UNKNOWN + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041904b0" + BEGIN + VALUE "CompanyName", "" + VALUE "FileDescription", "AMX Mod X module, using API regamedll & rehlds" + VALUE "FileVersion", APP_VERSION_STRD_RC + VALUE "InternalName", "Reapi" + VALUE "LegalCopyright", "" + VALUE "OriginalFilename", "reapi_amxx.dll" + VALUE "ProductName", "Reapi" + VALUE "ProductVersion", APP_VERSION_STRD_RC + #if APP_VERSION_FLAGS != 0x0L + VALUE "SpecialBuild", APP_VERSION_SPECIALBUILD + #endif + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x419, 1200 + END +END + +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/reapi/msvc/reapi.vcxproj b/reapi/msvc/reapi.vcxproj new file mode 100644 index 0000000..c436554 --- /dev/null +++ b/reapi/msvc/reapi.vcxproj @@ -0,0 +1,398 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + {74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC} + Win32Proj + reapi + + + + DynamicLibrary + true + v120 + MultiByte + + + DynamicLibrary + false + v120 + true + MultiByte + + + + + + + + + + + + + .dll + $(ProjectName)_amxx + + + false + $(ProjectName)_amxx + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDebug + precompiled.h + $(ProjectDir)\..\src;$(ProjectDir)\..\version;$(ProjectDir)\..\include;$(ProjectDir)\..\include\metamod;$(ProjectDir)\..\include\cssdk\common;$(ProjectDir)\..\include\cssdk\dlls;$(ProjectDir)\..\include\cssdk\engine;$(ProjectDir)\..\include\cssdk\game_shared;$(ProjectDir)\..\include\cssdk\pm_shared;$(ProjectDir)\..\include\cssdk\public;%(AdditionalIncludeDirectories) + ProgramDatabase + true + false + Default + true + false + + + Windows + true + %(AdditionalDependencies) + reapi.def + + + IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") + + + Automatic deployment script + + + echo Empty Action + + + Force build to run Pre-Build event + + + subversion.always.run + + + subversion.always.run + + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + + + Setup version from Git revision + + + + + Level3 + Use + Full + true + true + WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + $(ProjectDir)\..\src;$(ProjectDir)\..\version;$(ProjectDir)\..\include;$(ProjectDir)\..\include\metamod;$(ProjectDir)\..\include\cssdk\common;$(ProjectDir)\..\include\cssdk\dlls;$(ProjectDir)\..\include\cssdk\engine;$(ProjectDir)\..\include\cssdk\game_shared;$(ProjectDir)\..\include\cssdk\pm_shared;$(ProjectDir)\..\include\cssdk\public;%(AdditionalIncludeDirectories) + MultiThreaded + precompiled.h + AnySuitable + Speed + false + + + Windows + true + true + true + %(AdditionalDependencies) + reapi.def + + + echo Empty Action + + + Force build to run Pre-Build event + + + subversion.always.run + + + subversion.always.run + + + IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") + + + Automatic deployment script + + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + + + Setup version from Git revision + + + + + + \ No newline at end of file diff --git a/reapi/msvc/reapi.vcxproj.filters b/reapi/msvc/reapi.vcxproj.filters new file mode 100644 index 0000000..b8be123 --- /dev/null +++ b/reapi/msvc/reapi.vcxproj.filters @@ -0,0 +1,717 @@ + + + + + {64b644ef-df2c-41b1-bfe0-b8245235c6ea} + + + {d0017289-6524-4c7a-832b-f7ee2d1d59ba} + + + {d1429778-ce2d-458b-bd06-bb0f79934df0} + + + {27a5825f-5ecb-4fd0-b371-ff422eab7c54} + + + {8340bf9c-b2db-4b1a-b8d3-7c489a367ec8} + + + {985d7091-9dba-41bd-8c77-f97457a763d0} + + + {42088302-02eb-4c13-9280-13c919348487} + + + {a43e0284-624a-4457-bf34-4582fa761659} + + + {2b49f2e4-4185-4dd1-a8fe-5bfb4614c7e3} + + + {f65fab4e-9d83-4d37-949c-d11ca3d71db1} + + + {958d5371-ecd1-499d-b5f1-cfc80257a634} + + + {39b89a06-fe92-4627-be3f-f81359ba4d33} + + + {38b49b4e-e2ca-4b52-8941-141962eccee2} + + + {acb3d83c-55d3-4d84-be10-aa708abe9d2f} + + + {640c13c3-5f46-403c-8398-3a39d8c7cf6c} + + + {c4bfa412-f9f4-4b90-9f02-3c1531e2ac23} + + + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\metamod + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\common + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls + + + include\cssdk\dlls\bot + + + include\cssdk\dlls\bot + + + include\cssdk\dlls\bot + + + include\cssdk\dlls\bot + + + include\cssdk\dlls\hostage + + + include\cssdk\dlls\hostage + + + include\cssdk\dlls\hostage + + + include\cssdk\dlls\hostage + + + include\cssdk\game_shared + + + include\cssdk\game_shared + + + include\cssdk\game_shared + + + include\cssdk\game_shared + + + include\cssdk\game_shared + + + include\cssdk\game_shared + + + include\cssdk\game_shared + + + include\cssdk\game_shared + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\game_shared\bot + + + include\cssdk\public + + + include\cssdk\public + + + include\cssdk\public + + + include\cssdk\public + + + include\cssdk\pm_shared + + + include\cssdk\pm_shared + + + include\cssdk\pm_shared + + + include\cssdk\pm_shared + + + include\cssdk\pm_shared + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + + + include\cssdk\common + + + include\cssdk\engine + + + include\cssdk\engine + + + include\cssdk\public + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + + + amxmodx\scripting\include + + + amxmodx\scripting + + + src + + + + amxmodx\scripting\include + + + amxmodx\scripting\include + + + amxmodx\scripting\include + + + amxmodx\scripting\include + + + + + + \ No newline at end of file diff --git a/reapi/msvc/resource.h b/reapi/msvc/resource.h new file mode 100644 index 0000000..7c3f681 --- /dev/null +++ b/reapi/msvc/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ReVoice.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/reapi/src/amxxmodule.cpp b/reapi/src/amxxmodule.cpp new file mode 100644 index 0000000..3d4ba88 --- /dev/null +++ b/reapi/src/amxxmodule.cpp @@ -0,0 +1,208 @@ +// vim: set ts=4 sw=4 tw=99 noet: +// +// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO"). +// Copyright (C) The AMX Mod X Development Team. +// Parts Copyright (C) 2001-2003 Will Day +// +// This software is licensed under the GNU General Public License, version 3 or higher. +// Additional exceptions apply. For full license details, see LICENSE.txt or visit: +// https://alliedmods.net/amxmodx-license + +// +// Module SDK +// + +#include "precompiled.h" + +// Module info +static amxx_module_info_s g_ModuleInfo = +{ + Plugin_info.name, + Plugin_info.author, + Plugin_info.version, + FALSE, + Plugin_info.logtag, + "reapi", + "reapi" +}; + +// Storage for the requested functions +amxxapi_t g_amxxapi; + +#define DECLARE_REQ(x) {#x, offsetof(amxxapi_t, x)} + +static struct funcreq_t +{ + const char * name; + size_t offset; +} g_funcrequests[] = +{ + DECLARE_REQ(AddNatives), + //DECLARE_REQ(AddNewNatives), + //DECLARE_REQ(BuildPathname), + //DECLARE_REQ(BuildPathnameR), + DECLARE_REQ(GetAmxAddr), + //DECLARE_REQ(GetAmxVectorNull), + //DECLARE_REQ(PrintSrvConsole), + //DECLARE_REQ(GetModname), + //DECLARE_REQ(GetAmxScriptName), + //DECLARE_REQ(GetAmxScript), + //DECLARE_REQ(FindAmxScriptByAmx), + //DECLARE_REQ(FindAmxScriptByName), + DECLARE_REQ(SetAmxString), + //DECLARE_REQ(SetAmxStringUTF8Char), + //DECLARE_REQ(SetAmxStringUTF8Cell), + DECLARE_REQ(GetAmxString), + //DECLARE_REQ(GetAmxStringNull), + //DECLARE_REQ(GetAmxStringLen), + //DECLARE_REQ(FormatAmxString), + //DECLARE_REQ(CopyAmxMemory), + DECLARE_REQ(Log), + DECLARE_REQ(LogError), + //DECLARE_REQ(RaiseAmxError), + DECLARE_REQ(RegisterForward), + DECLARE_REQ(ExecuteForward), + //DECLARE_REQ(PrepareCellArray), + //DECLARE_REQ(PrepareCharArray), + DECLARE_REQ(PrepareCellArrayA), + //DECLARE_REQ(PrepareCharArrayA), + //DECLARE_REQ(IsPlayerValid), + //DECLARE_REQ(GetPlayerName), + //DECLARE_REQ(GetPlayerIP), + //DECLARE_REQ(IsPlayerIngame), + //DECLARE_REQ(IsPlayerBot), + //DECLARE_REQ(IsPlayerAuthorized), + //DECLARE_REQ(GetPlayerTime), + //DECLARE_REQ(GetPlayerPlayTime), + //DECLARE_REQ(GetPlayerCurweapon), + //DECLARE_REQ(GetPlayerTeam), + //DECLARE_REQ(GetPlayerTeamID), + //DECLARE_REQ(GetPlayerDeaths), + //DECLARE_REQ(GetPlayerMenu), + //DECLARE_REQ(GetPlayerKeys), + //DECLARE_REQ(IsPlayerAlive), + //DECLARE_REQ(GetPlayerFrags), + //DECLARE_REQ(IsPlayerConnecting), + //DECLARE_REQ(IsPlayerHLTV), + //DECLARE_REQ(GetPlayerArmor), + //DECLARE_REQ(GetPlayerHealth), + //DECLARE_REQ(amx_Exec), + //DECLARE_REQ(amx_Execv), + //DECLARE_REQ(amx_Allot), + DECLARE_REQ(amx_FindPublic), + //DECLARE_REQ(LoadAmxScript), + //DECLARE_REQ(UnloadAmxScript), + //DECLARE_REQ(RealToCell), + //DECLARE_REQ(CellToReal), + DECLARE_REQ(RegisterSPForward), + DECLARE_REQ(RegisterSPForwardByName), + DECLARE_REQ(UnregisterSPForward), + //DECLARE_REQ(MergeDefinition_File), + //DECLARE_REQ(amx_FindNative), + //DECLARE_REQ(GetPlayerFlags), + //DECLARE_REQ(GetPlayerEdict), + //DECLARE_REQ(Format), + //DECLARE_REQ(RegisterFunction), + //DECLARE_REQ(RequestFunction), + //DECLARE_REQ(amx_Push), + //DECLARE_REQ(SetTeamInfo), + //DECLARE_REQ(PlayerPropAddr), + //DECLARE_REQ(RegAuthFunc), + //DECLARE_REQ(UnregAuthFunc), + //DECLARE_REQ(FindLibrary), + //DECLARE_REQ(AddLibraries), + //DECLARE_REQ(RemoveLibraries), + //DECLARE_REQ(OverrideNatives), + //DECLARE_REQ(GetLocalInfo), + //DECLARE_REQ(AmxReRegister), + //DECLARE_REQ(RegisterFunctionEx), + //DECLARE_REQ(MessageBlock), +}; + +C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) +{ + // check parameters + if (!interfaceVersion || !moduleInfo) + return AMXX_PARAM; + + // check interface version + if (*interfaceVersion != AMXX_INTERFACE_VERSION) + { + // Tell amxx core our interface version + *interfaceVersion = AMXX_INTERFACE_VERSION; + return AMXX_IFVERS; + } + + // copy module info + memcpy(moduleInfo, &g_ModuleInfo, sizeof(amxx_module_info_s)); + return AMXX_OK; +} + +C_DLLEXPORT int AMXX_CheckGame(const char *game) +{ + return AMXX_GAME_OK; +} + +C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) +{ + // Check pointer + if (!reqFnptrFunc) + return AMXX_PARAM; + + for (size_t i = 0; i < ARRAYSIZE(g_funcrequests); i++) + { + void* fptr = reqFnptrFunc(g_funcrequests[i].name); + if (fptr == NULL) + { + return AMXX_FUNC_NOT_PRESENT; + } + *(void **)((unsigned long)&g_amxxapi + g_funcrequests[i].offset) = fptr; + } + + RegisterNatives(); + return AMXX_OK; +} + +C_DLLEXPORT int AMXX_Detach() +{ + return AMXX_OK; +} + +C_DLLEXPORT int AMXX_PluginsLoaded() +{ + int iFwd = g_amxxapi.RegisterForward("__reapi_version_check", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE); + g_amxxapi.ExecuteForward(iFwd, REAPI_VERISON_MAJOR, REAPI_VERISON_MINOR); + + return AMXX_OK; +} + +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +} + +// Advanced MF functions +NOINLINE void MF_Log(const char *fmt, ...) +{ + char msg[2048]; + va_list arglst; + va_start(arglst, fmt); + vsnprintf(msg, sizeof msg, fmt, arglst); + va_end(arglst); + + g_amxxapi.Log("[%s] %s", g_ModuleInfo.logtag, msg); +} + +NOINLINE void MF_LogError(AMX *amx, int err, const char *fmt, ...) +{ + char msg[2048]; + va_list arglst; + va_start(arglst, fmt); + vsnprintf(msg, sizeof msg, fmt, arglst); + va_end(arglst); + + g_amxxapi.LogError(amx, err, "[%s] %s", g_ModuleInfo.logtag, msg); +} diff --git a/reapi/src/amxxmodule.h b/reapi/src/amxxmodule.h new file mode 100644 index 0000000..7abd5c3 --- /dev/null +++ b/reapi/src/amxxmodule.h @@ -0,0 +1,507 @@ +// vim: set ts=4 sw=4 tw=99 noet: +// +// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO"). +// Copyright (C) The AMX Mod X Development Team. +// +// This software is licensed under the GNU General Public License, version 3 or higher. +// Additional exceptions apply. For full license details, see LICENSE.txt or visit: +// https://alliedmods.net/amxmodx-license +// + +// +// Module SDK +// + +// prevent double include +#ifndef __AMXXMODULE_H__ +#define __AMXXMODULE_H__ + +// module interface version was 1 +// 2 - added logtag to struct (amxx1.1-rc1) +// 3 - added new tagAMX structure (amxx1.5) +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 + +// amxx module info +struct amxx_module_info_s +{ + const char *name; + const char *author; + const char *version; + int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 +}; + +// return values from functions called by amxx +#define AMXX_OK 0 /* no error */ +#define AMXX_IFVERS 1 /* interface version */ +#define AMXX_PARAM 2 /* Invalid parameter */ +#define AMXX_FUNC_NOT_PRESENT 3 /* Function not present */ + +#define AMXX_GAME_OK 0 /* This module can load on the current game mod. */ +#define AMXX_GAME_BAD 1 /* This module can not load on the current game mod. */ + +// *** Small stuff *** +// The next section is copied from the amx.h file +// Copyright (c) ITB CompuPhase, 1997-2005 + +#if defined _LP64 || defined WIN64 || defined _WIN64 +#if !defined __64BIT__ +#define __64BIT__ +#endif +#endif + +/* calling convention for native functions */ +#if !defined AMX_NATIVE_CALL +#define AMX_NATIVE_CALL +#endif +/* calling convention for all interface functions and callback functions */ +#if !defined AMXAPI +#if defined STDECL +#define AMXAPI __stdcall +#elif defined CDECL +#define AMXAPI __cdecl +#else +#define AMXAPI +#endif +#endif +#if !defined AMXEXPORT +#define AMXEXPORT +#endif + +#if !defined PAWN_CELL_SIZE +#define PAWN_CELL_SIZE 32 /* by default, use 32-bit cells */ +#endif +#if PAWN_CELL_SIZE==16 +typedef uint16_t ucell; +typedef int16_t cell; +#elif PAWN_CELL_SIZE==32 +typedef uint32_t ucell; +typedef int32_t cell; +#define REAL float +#elif PAWN_CELL_SIZE==64 +typedef uint64_t ucell; +typedef int64_t cell; +#define REAL double +#else +#error Unsupported cell size (PAWN_CELL_SIZE) +#endif + +#define UNPACKEDMAX ((1 << (sizeof(cell)-1)*8) - 1) +#define UNLIMITED (~1u >> 1) + +struct tagAMX; +typedef cell(AMX_NATIVE_CALL *AMX_NATIVE)( struct tagAMX *amx, cell *params ); +typedef int ( AMXAPI *AMX_CALLBACK )( struct tagAMX *amx, cell index, + cell *result, cell *params ); +typedef int ( AMXAPI *AMX_DEBUG )( struct tagAMX *amx ); +#if !defined _FAR +#define _FAR +#endif + +#if defined _MSC_VER +#pragma warning(disable:4103) /* disable warning message 4103 that complains +* about pragma pack in a header file */ +#pragma warning(disable:4100) /* "'%$S' : unreferenced formal parameter" */ + +#if _MSC_VER >= 1400 +#if !defined NO_MSVC8_AUTO_COMPAT + +/* Disable deprecation warnings concerning unsafe CRT functions */ +#if !defined _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Disable deprecation warnings because MSVC8 seemingly thinks the ISO C++ conformant +* functions above are deprecated. */ +#pragma warning (disable:4996) + +#endif +#else +#define vsnprintf _vsnprintf +#endif +#endif + + +/* Some compilers do not support the #pragma align, which should be fine. Some +* compilers give a warning on unknown #pragmas, which is not so fine... +*/ +#if (defined SN_TARGET_PS2 || defined __GNUC__) && !defined AMX_NO_ALIGN +#define AMX_NO_ALIGN +#endif + +#if defined __GNUC__ +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + +#if !defined AMX_NO_ALIGN +#if defined LINUX || defined __FreeBSD__ || defined __APPLE__ +#pragma pack(1) /* structures must be packed (byte-aligned) */ +#elif defined MACOS && defined __MWERKS__ +#pragma options align=mac68k +#else +#pragma pack(push) +#pragma pack(1) /* structures must be packed (byte-aligned) */ +#if defined __TURBOC__ +#pragma option -a- /* "pack" pragma for older Borland compilers */ +#endif +#endif +#endif + +typedef struct +{ + const char _FAR *name PACKED; + AMX_NATIVE func PACKED; +} AMX_NATIVE_INFO; + +#define AMX_USERNUM 4 + +/* The AMX structure is the internal structure for many functions. Not all +* fields are valid at all times; many fields are cached in local variables. +*/ +typedef struct tagAMX +{ + unsigned char _FAR *base PACKED; /* points to the AMX header plus the code, optionally also the data */ + unsigned char _FAR *data PACKED; /* points to separate data+stack+heap, may be NULL */ + AMX_CALLBACK callback PACKED; + AMX_DEBUG debug PACKED; /* debug callback */ + /* for external functions a few registers must be accessible from the outside */ + cell cip PACKED; /* instruction pointer: relative to base + amxhdr->cod */ + cell frm PACKED; /* stack frame base: relative to base + amxhdr->dat */ + cell hea PACKED; /* top of the heap: relative to base + amxhdr->dat */ + cell hlw PACKED; /* bottom of the heap: relative to base + amxhdr->dat */ + cell stk PACKED; /* stack pointer: relative to base + amxhdr->dat */ + cell stp PACKED; /* top of the stack: relative to base + amxhdr->dat */ + int flags PACKED; /* current status, see amx_Flags() */ + /* user data */ + long usertags[AMX_USERNUM] PACKED; + //okay userdata[3] in AMX Mod X is for the CPlugin * pointer + //we're also gonna set userdata[2] to a special debug structure + void _FAR *userdata[AMX_USERNUM] PACKED; + /* native functions can raise an error */ + int error PACKED; + /* passing parameters requires a "count" field */ + int paramcount; + /* the sleep opcode needs to store the full AMX status */ + cell pri PACKED; + cell alt PACKED; + cell reset_stk PACKED; + cell reset_hea PACKED; + cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */ + /* support variables for the JIT */ + int reloc_size PACKED; /* required temporary buffer for relocations */ + long code_size PACKED; /* estimated memory footprint of the native code */ +} PACKED AMX; + +/* The AMX_HEADER structure is both the memory format as the file format. The +* structure is used internaly. +*/ +typedef struct tagAMX_HEADER +{ + int32_t size PACKED; /* size of the "file" */ + uint16_t magic PACKED; /* signature */ + char file_version; /* file format version */ + char amx_version; /* required version of the AMX */ + int16_t flags PACKED; + int16_t defsize PACKED; /* size of a definition record */ + int32_t cod PACKED; /* initial value of COD - code block */ + int32_t dat PACKED; /* initial value of DAT - data block */ + int32_t hea PACKED; /* initial value of HEA - start of the heap */ + int32_t stp PACKED; /* initial value of STP - stack top */ + int32_t cip PACKED; /* initial value of CIP - the instruction pointer */ + int32_t publics PACKED; /* offset to the "public functions" table */ + int32_t natives PACKED; /* offset to the "native functions" table */ + int32_t libraries PACKED; /* offset to the table of libraries */ + int32_t pubvars PACKED; /* the "public variables" table */ + int32_t tags PACKED; /* the "public tagnames" table */ + int32_t nametable PACKED; /* name table */ +} PACKED AMX_HEADER; + +enum +{ + AMX_ERR_NONE, + /* reserve the first 15 error codes for exit codes of the abstract machine */ + AMX_ERR_EXIT, /* forced exit */ + AMX_ERR_ASSERT, /* assertion failed */ + AMX_ERR_STACKERR, /* stack/heap collision */ + AMX_ERR_BOUNDS, /* index out of bounds */ + AMX_ERR_MEMACCESS, /* invalid memory access */ + AMX_ERR_INVINSTR, /* invalid instruction */ + AMX_ERR_STACKLOW, /* stack underflow */ + AMX_ERR_HEAPLOW, /* heap underflow */ + AMX_ERR_CALLBACK, /* no callback, or invalid callback */ + AMX_ERR_NATIVE, /* native function failed */ + AMX_ERR_DIVIDE, /* divide by zero */ + AMX_ERR_SLEEP, /* go into sleepmode - code can be restarted */ + AMX_ERR_INVSTATE, /* invalid state for this access */ + + AMX_ERR_MEMORY = 16, /* out of memory */ + AMX_ERR_FORMAT, /* invalid file format */ + AMX_ERR_VERSION, /* file is for a newer version of the AMX */ + AMX_ERR_NOTFOUND, /* function not found */ + AMX_ERR_INDEX, /* invalid index parameter (bad entry point) */ + AMX_ERR_DEBUG, /* debugger cannot run */ + AMX_ERR_INIT, /* AMX not initialized (or doubly initialized) */ + AMX_ERR_USERDATA, /* unable to set user data field (table full) */ + AMX_ERR_INIT_JIT, /* cannot initialize the JIT */ + AMX_ERR_PARAMS, /* parameter error */ + AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */ +}; + +#if !defined AMX_NO_ALIGN +#if defined(__linux__) || defined(__APPLE__) +#pragma pack() /* reset default packing */ +#else +#pragma pack(pop) /* reset previous packing */ +#endif +#endif + +// *** Types *** +typedef void* ( *PFN_REQ_FNPTR )( const char * /*name*/ ); + +// ***** Module funcs stuff ***** +enum ForwardExecType +{ + ET_IGNORE = 0, // Ignore return vaue + ET_STOP, // Stop on PLUGIN_HANDLED + ET_STOP2, // Stop on PLUGIN_HANDLED, continue on other values, return biggest return value + ET_CONTINUE, // Continue; return biggest return value +}; + +enum ForwardParam +{ + FP_DONE = -1, // specify this as the last argument + // only tells the function that there are no more arguments + FP_CELL, // normal cell + FP_FLOAT, // float; used as normal cell though + FP_STRING, // string + FP_STRINGEX, // string; will be updated to the last function's value + FP_ARRAY, // array; use the return value of prepareArray. +}; + +enum PlayerProp +{ + Player_Name, //String + Player_Ip, //String + Player_Team, //String + Player_Ingame, //bool + Player_Authorized, //bool + Player_Vgui, //bool + Player_Time, //float + Player_Playtime, //float + Player_MenuExpire, //float + Player_Weapons, //struct{int,int}[32] + Player_CurrentWeapon, //int + Player_TeamID, //int + Player_Deaths, //int + Player_Aiming, //int + Player_Menu, //int + Player_Keys, //int + Player_Flags, //int[32] + Player_Newmenu, //int + Player_NewmenuPage, //int +}; + +enum LibType +{ + LibType_Library, + LibType_Class +}; + +#define STKMARGIN ((cell)(16*sizeof(cell))) + +#define MSGBLOCK_SET 0 +#define MSGBLOCK_GET 1 +#define BLOCK_NOT 0 +#define BLOCK_ONCE 1 +#define BLOCK_SET 2 + +typedef void(*AUTHORIZEFUNC)( int player, const char *authstring ); + +typedef int(*PFN_ADD_NATIVES) ( const AMX_NATIVE_INFO * /*list*/ ); +typedef int(*PFN_ADD_NEW_NATIVES) ( const AMX_NATIVE_INFO * /*list*/ ); +typedef char * ( *PFN_BUILD_PATHNAME ) ( const char * /*format*/, ... ); +typedef char * ( *PFN_BUILD_PATHNAME_R ) ( char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ... ); +typedef cell * ( *PFN_GET_AMXADDR ) ( AMX * /*amx*/, cell /*offset*/ ); +typedef cell * ( *PFN_GET_AMXVECTOR_NULL ) ( AMX * /*amx*/, cell /*offset*/ ); +typedef void(*PFN_PRINT_SRVCONSOLE) ( const char * /*format*/, ... ); +typedef const char * ( *PFN_GET_MODNAME ) ( void ); +typedef const char * ( *PFN_GET_AMXSCRIPTNAME ) ( int /*id*/ ); +typedef AMX * ( *PFN_GET_AMXSCRIPT ) ( int /*id*/ ); +typedef int(*PFN_FIND_AMXSCRIPT_BYAMX) ( const AMX * /*amx*/ ); +typedef int(*PFN_FIND_AMXSCRIPT_BYNAME) ( const char * /*name*/ ); +typedef int(*PFN_SET_AMXSTRING) ( AMX * /*amx*/, cell /*amx_addr*/, const char * /* source */, int /* max */ ); +typedef int(*PFN_SET_AMXSTRING_UTF8_CHAR) ( AMX *amx, cell amx_addr, const char *source, size_t sourcelen, size_t maxlen ); +typedef int(*PFN_SET_AMXSTRING_UTF8_CELL) ( AMX *amx, cell amx_addr, const cell *source, size_t sourcelen, size_t maxlen ); +typedef char * ( *PFN_GET_AMXSTRING ) ( AMX * /*amx*/, cell /*amx_addr*/, int /*bufferId*/, int * /*pLen*/ ); +typedef char * ( *PFN_GET_AMXSTRING_NULL ) ( AMX * /*amx*/, cell /*amx_addr*/, int /*bufferId*/, int * /*pLen*/ ); +typedef int(*PFN_GET_AMXSTRINGLEN) ( const cell *ptr ); +typedef char * ( *PFN_FORMAT_AMXSTRING ) ( AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/ ); +typedef void(*PFN_COPY_AMXMEMORY) ( cell * /*dest*/, const cell * /*src*/, int /*len*/ ); +typedef void(*PFN_LOG) ( const char * /*fmt*/, ... ); +typedef void(*PFN_LOG_ERROR) ( AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ... ); +typedef int(*PFN_RAISE_AMXERROR) ( AMX * /*amx*/, int /*error*/ ); +typedef int(*PFN_REGISTER_FORWARD) ( const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/ ); +typedef int(*PFN_EXECUTE_FORWARD) ( int /*id*/, ... /*params*/ ); +typedef cell(*PFN_PREPARE_CELLARRAY) ( cell * /*ptr*/, unsigned int /*size*/ ); +typedef cell(*PFN_PREPARE_CHARARRAY) ( char * /*ptr*/, unsigned int /*size*/ ); +typedef cell(*PFN_PREPARE_CELLARRAY_A) ( cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/ ); +typedef cell(*PFN_PREPARE_CHARARRAY_A) ( char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/ ); +typedef int(*PFN_IS_PLAYER_VALID) ( int /*id*/ ); +typedef const char * ( *PFN_GET_PLAYER_NAME ) ( int /*id*/ ); +typedef const char * ( *PFN_GET_PLAYER_IP ) ( int /*id*/ ); +typedef int(*PFN_IS_PLAYER_INGAME) ( int /*id*/ ); +typedef int(*PFN_IS_PLAYER_BOT) ( int /*id*/ ); +typedef int(*PFN_IS_PLAYER_AUTHORIZED) ( int /*id*/ ); +typedef float(*PFN_GET_PLAYER_TIME) ( int /*id*/ ); +typedef float(*PFN_GET_PLAYER_PLAYTIME) ( int /*id*/ ); +typedef int(*PFN_GETPLAYERFLAGS) ( int /* id*/ ); +typedef int(*PFN_GET_PLAYER_CURWEAPON) ( int /*id*/ ); +typedef const char * ( *PFN_GET_PLAYER_TEAM ) ( int /*id*/ ); +typedef int(*PFN_GET_PLAYER_TEAMID) ( int /*id*/ ); +typedef int(*PFN_GET_PLAYER_DEATHS) ( int /*id*/ ); +typedef int(*PFN_GET_PLAYER_MENU) ( int /*id*/ ); +typedef int(*PFN_GET_PLAYER_KEYS) ( int /*id*/ ); +typedef int(*PFN_IS_PLAYER_ALIVE) ( int /*id*/ ); +typedef int(*PFN_GET_PLAYER_FRAGS) ( int /*id*/ ); +typedef int(*PFN_IS_PLAYER_CONNECTING) ( int /*id*/ ); +typedef int(*PFN_IS_PLAYER_HLTV) ( int /*id*/ ); +typedef int(*PFN_GET_PLAYER_ARMOR) ( int /*id*/ ); +typedef int(*PFN_GET_PLAYER_HEALTH) ( int /*id*/ ); +#ifdef USE_METAMOD +typedef edict_t * ( *PFN_GET_PLAYER_EDICT ) ( int /*id*/ ); +#else +typedef void * ( *PFN_GET_PLAYER_EDICT ) ( int /*id*/ ); +#endif +typedef void * ( *PFN_PLAYER_PROP_ADDR ) ( int /*id*/, int /*prop*/ ); + +#ifdef MEMORY_TEST +typedef void * ( *PFN_ALLOCATOR ) ( const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, + const unsigned int /*type*/, const size_t /*size*/ ); +typedef void * ( *PFN_REALLOCATOR ) ( const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, + const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); +typedef void(*PFN_DEALLOCATOR) ( const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, + const unsigned int /*type*/, const void* /*addr*/ ); +#endif +typedef int(*PFN_AMX_EXEC) ( AMX* /*amx*/, cell* /*return val*/, int /*index*/ ); +typedef int(*PFN_AMX_EXECV) ( AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/ ); +typedef int(*PFN_AMX_ALLOT) ( AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/ ); +typedef int(*PFN_AMX_FINDPUBLIC) ( AMX* /*amx*/, const char* /*func name*/, int* /*index*/ ); +typedef int(*PFN_AMX_FINDNATIVE) ( AMX* /*amx*/, const char* /*func name*/, int* /*index*/ ); +typedef int(*PFN_LOAD_AMXSCRIPT) ( AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */ ); +typedef int(*PFN_UNLOAD_AMXSCRIPT) ( AMX* /*amx*/, void** /*code*/ ); +typedef cell(*PFN_REAL_TO_CELL) ( REAL /*x*/ ); +typedef REAL(*PFN_CELL_TO_REAL) ( cell /*x*/ ); +typedef int(*PFN_REGISTER_SPFORWARD) ( AMX * /*amx*/, int /*func*/, ... /*params*/ ); +typedef int(*PFN_REGISTER_SPFORWARD_BYNAME) ( AMX * /*amx*/, const char * /*funcName*/, ... /*params*/ ); +typedef void(*PFN_UNREGISTER_SPFORWARD) ( int /*id*/ ); +typedef void(*PFN_MERGEDEFINITION_FILE) ( const char * /*filename*/ ); +typedef const char * ( *PFN_FORMAT ) ( const char * /*fmt*/, ... /*params*/ ); +typedef void(*PFN_REGISTERFUNCTION) ( void * /*pfn*/, const char * /*desc*/ ); +typedef int(*PFN_AMX_PUSH) ( AMX * /*amx*/, cell /*value*/ ); +typedef int(*PFN_SET_TEAM_INFO) ( int /*player */, int /*teamid */, const char * /*name */ ); +typedef void(*PFN_REG_AUTH_FUNC) ( AUTHORIZEFUNC ); +typedef void(*PFN_UNREG_AUTH_FUNC) ( AUTHORIZEFUNC ); +typedef int(*PFN_FINDLIBRARY) ( const char * /*name*/, LibType /*type*/ ); +typedef size_t(*PFN_ADDLIBRARIES) ( const char * /*name*/, LibType /*type*/, void * /*parent*/ ); +typedef size_t(*PFN_REMOVELIBRARIES) ( void * /*parent*/ ); +typedef void(*PFN_OVERRIDENATIVES) ( AMX_NATIVE_INFO * /*natives*/, const char * /*myname*/ ); +typedef const char * ( *PFN_GETLOCALINFO ) ( const char * /*name*/, const char * /*def*/ ); +typedef int(*PFN_AMX_REREGISTER) ( AMX * /*amx*/, AMX_NATIVE_INFO * /*list*/, int /*list*/ ); +typedef void * ( *PFN_REGISTERFUNCTIONEX ) ( void * /*pfn*/, const char * /*desc*/ ); +typedef void(*PFN_MESSAGE_BLOCK) ( int /* mode */, int /* message */, int * /* opt */ ); + +struct amxxapi_t +{ + PFN_ADD_NATIVES AddNatives; + PFN_ADD_NEW_NATIVES AddNewNatives; + PFN_BUILD_PATHNAME BuildPathname; + PFN_BUILD_PATHNAME_R BuildPathnameR; + PFN_GET_AMXADDR GetAmxAddr; + PFN_GET_AMXVECTOR_NULL GetAmxVectorNull; + PFN_PRINT_SRVCONSOLE PrintSrvConsole; + PFN_GET_MODNAME GetModname; + PFN_GET_AMXSCRIPTNAME GetAmxScriptName; + PFN_GET_AMXSCRIPT GetAmxScript; + PFN_FIND_AMXSCRIPT_BYAMX FindAmxScriptByAmx; + PFN_FIND_AMXSCRIPT_BYNAME FindAmxScriptByName; + PFN_SET_AMXSTRING SetAmxString; + PFN_SET_AMXSTRING_UTF8_CHAR SetAmxStringUTF8Char; + PFN_SET_AMXSTRING_UTF8_CELL SetAmxStringUTF8Cell; + PFN_GET_AMXSTRING GetAmxString; + PFN_GET_AMXSTRING_NULL GetAmxStringNull; + PFN_GET_AMXSTRINGLEN GetAmxStringLen; + PFN_FORMAT_AMXSTRING FormatAmxString; + PFN_COPY_AMXMEMORY CopyAmxMemory; + PFN_LOG Log; + PFN_LOG_ERROR LogError; + PFN_RAISE_AMXERROR RaiseAmxError; + PFN_REGISTER_FORWARD RegisterForward; + PFN_EXECUTE_FORWARD ExecuteForward; + PFN_PREPARE_CELLARRAY PrepareCellArray; + PFN_PREPARE_CHARARRAY PrepareCharArray; + PFN_PREPARE_CELLARRAY_A PrepareCellArrayA; + PFN_PREPARE_CHARARRAY_A PrepareCharArrayA; + PFN_IS_PLAYER_VALID IsPlayerValid; + PFN_GET_PLAYER_NAME GetPlayerName; + PFN_GET_PLAYER_IP GetPlayerIP; + PFN_IS_PLAYER_INGAME IsPlayerIngame; + PFN_IS_PLAYER_BOT IsPlayerBot; + PFN_IS_PLAYER_AUTHORIZED IsPlayerAuthorized; + PFN_GET_PLAYER_TIME GetPlayerTime; + PFN_GET_PLAYER_PLAYTIME GetPlayerPlayTime; + PFN_GET_PLAYER_CURWEAPON GetPlayerCurweapon; + PFN_GET_PLAYER_TEAM GetPlayerTeam; + PFN_GET_PLAYER_TEAMID GetPlayerTeamID; + PFN_GET_PLAYER_DEATHS GetPlayerDeaths; + PFN_GET_PLAYER_MENU GetPlayerMenu; + PFN_GET_PLAYER_KEYS GetPlayerKeys; + PFN_IS_PLAYER_ALIVE IsPlayerAlive; + PFN_GET_PLAYER_FRAGS GetPlayerFrags; + PFN_IS_PLAYER_CONNECTING IsPlayerConnecting; + PFN_IS_PLAYER_HLTV IsPlayerHLTV; + PFN_GET_PLAYER_ARMOR GetPlayerArmor; + PFN_GET_PLAYER_HEALTH GetPlayerHealth; + PFN_AMX_EXEC amx_Exec; + PFN_AMX_EXECV amx_Execv; + PFN_AMX_ALLOT amx_Allot; + PFN_AMX_FINDPUBLIC amx_FindPublic; + PFN_LOAD_AMXSCRIPT LoadAmxScript; + PFN_UNLOAD_AMXSCRIPT UnloadAmxScript; + PFN_REAL_TO_CELL RealToCell; + PFN_CELL_TO_REAL CellToReal; + PFN_REGISTER_SPFORWARD RegisterSPForward; + PFN_REGISTER_SPFORWARD_BYNAME RegisterSPForwardByName; + PFN_UNREGISTER_SPFORWARD UnregisterSPForward; + PFN_MERGEDEFINITION_FILE MergeDefinition_File; + PFN_AMX_FINDNATIVE amx_FindNative; + PFN_GETPLAYERFLAGS GetPlayerFlags; + PFN_GET_PLAYER_EDICT GetPlayerEdict; + PFN_FORMAT Format; + PFN_REGISTERFUNCTION RegisterFunction; + PFN_REQ_FNPTR RequestFunction; + PFN_AMX_PUSH amx_Push; + PFN_SET_TEAM_INFO SetTeamInfo; + PFN_PLAYER_PROP_ADDR PlayerPropAddr; + PFN_REG_AUTH_FUNC RegAuthFunc; + PFN_UNREG_AUTH_FUNC UnregAuthFunc; + PFN_FINDLIBRARY FindLibrary; + PFN_ADDLIBRARIES AddLibraries; + PFN_REMOVELIBRARIES RemoveLibraries; + PFN_OVERRIDENATIVES OverrideNatives; + PFN_GETLOCALINFO GetLocalInfo; + PFN_AMX_REREGISTER AmxReRegister; + PFN_REGISTERFUNCTIONEX RegisterFunctionEx; + PFN_MESSAGE_BLOCK MessageBlock; +}; + +extern amxxapi_t g_amxxapi; + +void MF_Log(const char *fmt, ...); +void MF_LogError(AMX *amx, int err, const char *fmt, ...); + +#endif // __AMXXMODULE_H__ \ No newline at end of file diff --git a/reapi/src/api_config.cpp b/reapi/src/api_config.cpp new file mode 100644 index 0000000..bded18e --- /dev/null +++ b/reapi/src/api_config.cpp @@ -0,0 +1,11 @@ +#include "precompiled.h" + +CAPI_Config api_cfg; + +bool CAPI_Config::Init() +{ + m_api_rehlds = RehldsApi_Init(); + m_api_regame = RegamedllApi_Init(); + + return true; +} diff --git a/reapi/src/api_config.h b/reapi/src/api_config.h new file mode 100644 index 0000000..204403e --- /dev/null +++ b/reapi/src/api_config.h @@ -0,0 +1,25 @@ +#pragma once + +// reapi version +#include "reapi_const.inc" + +class CAPI_Config { +public: + bool Init(); + + bool hasReHLDS() const { return m_api_rehlds; } + bool hasReGameDLL() const { return m_api_regame; } + +private: + // to provide API functions + bool m_api_rehlds; // some useful functions + bool m_api_regame; // some useful functions #2 + + // future plans? + //bool m_api_vtc; // for gag + //bool m_api_revoice; // for gag #2 + //bool m_api_reunion; // for information about authorization client + //bool m_api_rechecker; // for detection when checking and adding few files +}; + +extern CAPI_Config api_cfg; diff --git a/reapi/src/dllapi.cpp b/reapi/src/dllapi.cpp new file mode 100644 index 0000000..8b9325a --- /dev/null +++ b/reapi/src/dllapi.cpp @@ -0,0 +1,151 @@ +#include "precompiled.h" + +extern void ServerDeactivate_Post(); + +DLL_FUNCTIONS gFunctionTable = +{ + NULL, // pfnGameInit + NULL, // pfnSpawn + NULL, // pfnThink + NULL, // pfnUse + NULL, // pfnTouch + NULL, // pfnBlocked + NULL, // pfnKeyValue + NULL, // pfnSave + NULL, // pfnRestore + NULL, // pfnSetAbsBox + NULL, // pfnSaveWriteFields + NULL, // pfnSaveReadFields + NULL, // pfnSaveGlobalState + NULL, // pfnRestoreGlobalState + NULL, // pfnResetGlobalState + NULL, // pfnClientConnect + NULL, // pfnClientDisconnect + NULL, // pfnClientKill + NULL, // pfnClientPutInServer + NULL, // pfnClientCommand + NULL, // pfnClientUserInfoChanged + NULL, // pfnServerActivate + NULL, // pfnServerDeactivate + NULL, // pfnPlayerPreThink + NULL, // pfnPlayerPostThink + NULL, // pfnStartFrame + NULL, // pfnParmsNewLevel + NULL, // pfnParmsChangeLevel + NULL, // pfnGetGameDescription + NULL, // pfnPlayerCustomization + NULL, // pfnSpectatorConnect + NULL, // pfnSpectatorDisconnect + NULL, // pfnSpectatorThink + NULL, // pfnSys_Error + NULL, // pfnPM_Move + NULL, // pfnPM_Init + NULL, // pfnPM_FindTextureType + NULL, // pfnSetupVisibility + NULL, // pfnUpdateClientData + NULL, // pfnAddToFullPack + NULL, // pfnCreateBaseline + NULL, // pfnRegisterEncoders + NULL, // pfnGetWeaponData + NULL, // pfnCmdStart + NULL, // pfnCmdEnd + NULL, // pfnConnectionlessPacket + NULL, // pfnGetHullBounds + NULL, // pfnCreateInstancedBaselines + NULL, // pfnInconsistentFile + NULL, // pfnAllowLagCompensation +}; + +DLL_FUNCTIONS gFunctionTable_Post = +{ + NULL, // pfnGameInit + NULL, // pfnSpawn + NULL, // pfnThink + NULL, // pfnUse + NULL, // pfnTouch + NULL, // pfnBlocked + NULL, // pfnKeyValue + NULL, // pfnSave + NULL, // pfnRestore + NULL, // pfnSetAbsBox + NULL, // pfnSaveWriteFields + NULL, // pfnSaveReadFields + NULL, // pfnSaveGlobalState + NULL, // pfnRestoreGlobalState + NULL, // pfnResetGlobalState + NULL, // pfnClientConnect + NULL, // pfnClientDisconnect + NULL, // pfnClientKill + NULL, // pfnClientPutInServer + NULL, // pfnClientCommand + NULL, // pfnClientUserInfoChanged + NULL, // pfnServerActivate + &ServerDeactivate_Post, // pfnServerDeactivate + NULL, // pfnPlayerPreThink + NULL, // pfnPlayerPostThink + NULL, // pfnStartFrame + NULL, // pfnParmsNewLevel + NULL, // pfnParmsChangeLevel + NULL, // pfnGetGameDescription + NULL, // pfnPlayerCustomization + NULL, // pfnSpectatorConnect + NULL, // pfnSpectatorDisconnect + NULL, // pfnSpectatorThink + NULL, // pfnSys_Error + NULL, // pfnPM_Move + NULL, // pfnPM_Init + NULL, // pfnPM_FindTextureType + NULL, // pfnSetupVisibility + NULL, // pfnUpdateClientData + NULL, // pfnAddToFullPack + NULL, // pfnCreateBaseline + NULL, // pfnRegisterEncoders + NULL, // pfnGetWeaponData + NULL, // pfnCmdStart + NULL, // pfnCmdEnd + NULL, // pfnConnectionlessPacket + NULL, // pfnGetHullBounds + NULL, // pfnCreateInstancedBaselines + NULL, // pfnInconsistentFile + NULL, // pfnAllowLagCompensation +}; + +C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion) +{ + if (!pFunctionTable) + { + ALERT(at_logged, __FUNCTION__ " called with null pFunctionTable"); + return FALSE; + } + else if (*interfaceVersion != INTERFACE_VERSION) + { + ALERT(at_logged, __FUNCTION__ " version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION); + + //! Tell metamod what version we had, so it can figure out who is out of date. + *interfaceVersion = INTERFACE_VERSION; + return FALSE; + } + + memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS)); + return TRUE; +} + +C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion) +{ + if (!pFunctionTable) + { + ALERT(at_logged, __FUNCTION__ " called with null pFunctionTable"); + return FALSE; + } + else if (*interfaceVersion != INTERFACE_VERSION) + { + ALERT(at_logged, __FUNCTION__ " version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION); + + //! Tell metamod what version we had, so it can figure out who is out of date. + *interfaceVersion = INTERFACE_VERSION; + return FALSE; + } + + memcpy(pFunctionTable, &gFunctionTable_Post, sizeof(DLL_FUNCTIONS)); + return TRUE; +} diff --git a/reapi/src/engine_api.cpp b/reapi/src/engine_api.cpp new file mode 100644 index 0000000..bcd5722 --- /dev/null +++ b/reapi/src/engine_api.cpp @@ -0,0 +1,192 @@ +#include "precompiled.h" + +enginefuncs_t meta_engfuncs_post = +{ + NULL, // pfnPrecacheModel() + NULL, // pfnPrecacheSound() + NULL, // pfnSetModel() + NULL, // pfnModelIndex() + NULL, // pfnModelFrames() + NULL, // pfnSetSize() + NULL, // pfnChangeLevel() + NULL, // pfnGetSpawnParms() + NULL, // pfnSaveSpawnParms() + NULL, // pfnVecToYaw() + NULL, // pfnVecToAngles() + NULL, // pfnMoveToOrigin() + NULL, // pfnChangeYaw() + NULL, // pfnChangePitch() + NULL, // pfnFindEntityByString() + NULL, // pfnGetEntityIllum() + NULL, // pfnFindEntityInSphere() + NULL, // pfnFindClientInPVS() + NULL, // pfnEntitiesInPVS() + NULL, // pfnMakeVectors() + NULL, // pfnAngleVectors() + NULL, // pfnCreateEntity() + NULL, // pfnRemoveEntity() + NULL, // pfnCreateNamedEntity() + NULL, // pfnMakeStatic() + NULL, // pfnEntIsOnFloor() + NULL, // pfnDropToFloor() + NULL, // pfnWalkMove() + NULL, // pfnSetOrigin() + NULL, // pfnEmitSound() + NULL, // pfnEmitAmbientSound() + NULL, // pfnTraceLine() + NULL, // pfnTraceToss() + NULL, // pfnTraceMonsterHull() + NULL, // pfnTraceHull() + NULL, // pfnTraceModel() + NULL, // pfnTraceTexture() + NULL, // pfnTraceSphere() + NULL, // pfnGetAimVector() + NULL, // pfnServerCommand() + NULL, // pfnServerExecute() + NULL, // pfnClientCommand() + NULL, // pfnParticleEffect() + NULL, // pfnLightStyle() + NULL, // pfnDecalIndex() + NULL, // pfnPointContents() + NULL, // pfnMessageBegin() + NULL, // pfnMessageEnd() + NULL, // pfnWriteByte() + NULL, // pfnWriteChar() + NULL, // pfnWriteShort() + NULL, // pfnWriteLong() + NULL, // pfnWriteAngle() + NULL, // pfnWriteCoord() + NULL, // pfnWriteString() + NULL, // pfnWriteEntity() + NULL, // pfnCVarRegister() + NULL, // pfnCVarGetFloat() + NULL, // pfnCVarGetString() + NULL, // pfnCVarSetFloat() + NULL, // pfnCVarSetString() + NULL, // pfnAlertMessage() + NULL, // pfnEngineFprintf() + NULL, // pfnPvAllocEntPrivateData() + NULL, // pfnPvEntPrivateData() + NULL, // pfnFreeEntPrivateData() + NULL, // pfnSzFromIndex() + NULL, // pfnAllocString() + NULL, // pfnGetVarsOfEnt() + NULL, // pfnPEntityOfEntOffset() + NULL, // pfnEntOffsetOfPEntity() + NULL, // pfnIndexOfEdict() + NULL, // pfnPEntityOfEntIndex() + NULL, // pfnFindEntityByVars() + NULL, // pfnGetModelPtr() + NULL, // pfnRegUserMsg() + NULL, // pfnAnimationAutomove() + NULL, // pfnGetBonePosition() + NULL, // pfnFunctionFromName() + NULL, // pfnNameForFunction() + NULL, // pfnClientPrintf() + NULL, // pfnServerPrint() + NULL, // pfnCmd_Args() + NULL, // pfnCmd_Argv() + NULL, // pfnCmd_Argc() + NULL, // pfnGetAttachment() + NULL, // pfnCRC32_Init() + NULL, // pfnCRC32_ProcessBuffer() + NULL, // pfnCRC32_ProcessByte() + NULL, // pfnCRC32_Final() + NULL, // pfnRandomLong() + NULL, // pfnRandomFloat() + NULL, // pfnSetView() + NULL, // pfnTime() + NULL, // pfnCrosshairAngle() + NULL, // pfnLoadFileForMe() + NULL, // pfnFreeFile() + NULL, // pfnEndSection() + NULL, // pfnCompareFileTime() + NULL, // pfnGetGameDir() + NULL, // pfnCvar_RegisterVariable() + NULL, // pfnFadeClientVolume() + NULL, // pfnSetClientMaxspeed() + NULL, // pfnCreateFakeClient() + NULL, // pfnRunPlayerMove() + NULL, // pfnNumberOfEntities() + NULL, // pfnGetInfoKeyBuffer() + NULL, // pfnInfoKeyValue() + NULL, // pfnSetKeyValue() + NULL, // pfnSetClientKeyValue() + NULL, // pfnIsMapValid() + NULL, // pfnStaticDecal() + NULL, // pfnPrecacheGeneric() + NULL, // pfnGetPlayerUserId() + NULL, // pfnBuildSoundMsg() + NULL, // pfnIsDedicatedServer() + NULL, // pfnCVarGetPointer() + NULL, // pfnGetPlayerWONId() + NULL, // pfnInfo_RemoveKey() + NULL, // pfnGetPhysicsKeyValue() + NULL, // pfnSetPhysicsKeyValue() + NULL, // pfnGetPhysicsInfoString() + NULL, // pfnPrecacheEvent() + NULL, // pfnPlaybackEvent() + NULL, // pfnSetFatPVS() + NULL, // pfnSetFatPAS() + NULL, // pfnCheckVisibility() + NULL, // pfnDeltaSetField() + NULL, // pfnDeltaUnsetField() + NULL, // pfnDeltaAddEncoder() + NULL, // pfnGetCurrentPlayer() + NULL, // pfnCanSkipPlayer() + NULL, // pfnDeltaFindField() + NULL, // pfnDeltaSetFieldByIndex() + NULL, // pfnDeltaUnsetFieldByIndex() + NULL, // pfnSetGroupMask() + NULL, // pfnCreateInstancedBaseline() + NULL, // pfnCvar_DirectSet() + NULL, // pfnForceUnmodified() + NULL, // pfnGetPlayerStats() + NULL, // pfnAddServerCommand() + + // Added in SDK 2.2: + NULL, // pfnVoice_GetClientListening() + NULL, // pfnVoice_SetClientListening() + + // Added for HL 1109 (no SDK update): + NULL, // pfnGetPlayerAuthId() + + // Added 2003/11/10 (no SDK update): + NULL, // pfnSequenceGet() + NULL, // pfnSequencePickSentence() + NULL, // pfnGetFileSize() + NULL, // pfnGetApproxWavePlayLen() + NULL, // pfnIsCareerMatch() + NULL, // pfnGetLocalizedStringLength() + NULL, // pfnRegisterTutorMessageShown() + NULL, // pfnGetTimesTutorMessageShown() + NULL, // pfnProcessTutorMessageDecayBuffer() + NULL, // pfnConstructTutorMessageDecayBuffer() + NULL, // pfnResetTutorMessageDecayData() + + // Added Added 2005-08-11 (no SDK update) + NULL, // pfnQueryClientCvarValue() + // Added Added 2005-11-22 (no SDK update) + NULL, // pfnQueryClientCvarValue2() + // Added 2009-06-17 (no SDK update) + // NULL, // pfnEngCheckParm() // s1lent: comment out this, for compatibility with older versions metamod +}; + +C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion) +{ + if (!pengfuncsFromEngine) + { + ALERT(at_logged, __FUNCTION__ " called with null pengfuncsFromEngine"); + return FALSE; + } + else if (*interfaceVersion != ENGINE_INTERFACE_VERSION) + { + ALERT(at_logged, __FUNCTION__ " version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION); + // Tell metamod what version we had, so it can figure out who is out of date. + *interfaceVersion = ENGINE_INTERFACE_VERSION; + return FALSE; + } + + memcpy(pengfuncsFromEngine, &meta_engfuncs_post, sizeof(enginefuncs_t)); + return TRUE; +} diff --git a/reapi/src/h_export.cpp b/reapi/src/h_export.cpp new file mode 100644 index 0000000..f1e8ab7 --- /dev/null +++ b/reapi/src/h_export.cpp @@ -0,0 +1,13 @@ +#include "precompiled.h" + +enginefuncs_t g_engfuncs; +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. +C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pengfuncsFromEngine, globalvars_t *pGlobals) +{ + memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); + gpGlobals = pGlobals; +} diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp new file mode 100644 index 0000000..a76a784 --- /dev/null +++ b/reapi/src/hook_callback.cpp @@ -0,0 +1,334 @@ +#include "precompiled.h" + +CHook *g_currentHookChain = nullptr; + +/* +* ReHLDS functions +*/ +void SV_StartSound(IRehldsHook_SV_StartSound *chain, int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int fFlags, int pitch) +{ + if (callVoidForward_Pre(RH_SV_StartSound, recipients, ENTINDEX(entity), channel, sample, volume, attenuation, fFlags, pitch)) { + chain->callNext(recipients, entity, channel, sample, volume, attenuation, fFlags, pitch); + } + + callVoidForward_Post(RH_SV_StartSound, recipients, ENTINDEX(entity), channel, sample, volume, attenuation, fFlags, pitch); +} + +void SV_DropClient(IRehldsHook_SV_DropClient *chain, IGameClient *cl, bool crash, const char *fmt) +{ + if (callVoidForward_Pre(RH_SV_DropClient, cl->GetId(), crash, fmt)) { + chain->callNext(cl, crash, fmt); + } + + callVoidForward_Post(RH_SV_DropClient, cl->GetId(), crash, fmt); +} + +void SV_ActivateServer(IRehldsHook_SV_ActivateServer *chain, int runPhysics) +{ + callVoidForward(chain, RH_SV_ActivateServer, runPhysics); +} + +void Cvar_DirectSet(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char *value) +{ + callVoidForward(chain, RH_Cvar_DirectSet, var, value); +} + +/* +* ReGameDLL functions +*/ +void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_Spawn, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_Spawn, pthis->entindex()); +} + +void CBasePlayer_Precache(IReGameHook_CBasePlayer_Precache *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_Precache, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_Precache, pthis->entindex()); +} + +int CBasePlayer_ObjectCaps(IReGameHook_CBasePlayer_ObjectCaps *chain, CBasePlayer *pthis) +{ + int ownresult = 0; // return own for OVERRIDE + int origresult = 0; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_ObjectCaps, pthis->entindex())) { + origresult = chain->callNext(); + } + + if (callForward_Post(RH_CBasePlayer_ObjectCaps, pthis->entindex())) { + // return original + return origresult; + } + + // return from override + return g_currentHookChain->m_data.m_interger; +} + +int CBasePlayer_Classify(IReGameHook_CBasePlayer_Classify *chain, CBasePlayer *pthis) +{ + //int ownresult = 0; // return own for OVERRIDE + int origresult = 0; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_Classify, pthis->entindex())) { + origresult = chain->callNext(); + } + + if (callForward_Post(RH_CBasePlayer_Classify, pthis->entindex())) { + // return original + return origresult; + } + + // return from override + return g_currentHookChain->m_data.m_interger; +} + +void CBasePlayer_TraceAttack(IReGameHook_CBasePlayer_TraceAttack *chain, CBasePlayer *pthis, entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) +{ + if (callVoidForward_Pre(RH_CBasePlayer_TraceAttack, pthis->entindex(), ENTINDEX(pevAttacker), flDamage, g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecDir), 3, false), ptr, bitsDamageType)) { + chain->callNext(pevAttacker, flDamage, vecDir, ptr, bitsDamageType); + } + + callVoidForward_Post(RH_CBasePlayer_TraceAttack, pthis->entindex(), ENTINDEX(pevAttacker), flDamage, g_amxxapi.PrepareCellArrayA(reinterpret_cast(&vecDir), 3, false), ptr, bitsDamageType); +} + +int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlayer *pthis, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) +{ + //int ownresult = 0; // return own for OVERRIDE + int origresult = 0; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_TakeDamage, pthis->entindex(), ENTINDEX(pevInflictor), ENTINDEX(pevAttacker), flDamage, bitsDamageType)) { + origresult = chain->callNext(pevInflictor, pevAttacker, flDamage, bitsDamageType); + } + + if (callForward_Post(RH_CBasePlayer_TakeDamage, pthis->entindex(), ENTINDEX(pevInflictor), ENTINDEX(pevAttacker), flDamage, bitsDamageType)) { + // return original + return origresult; + } + + // return from override + return g_currentHookChain->m_data.m_interger; +} + +int CBasePlayer_TakeHealth(IReGameHook_CBasePlayer_TakeHealth *chain, CBasePlayer *pthis, float flHealth, int bitsDamageType) +{ + //int ownresult = 0; // return own for OVERRIDE + int origresult = 0; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_TakeHealth, pthis->entindex(), flHealth, bitsDamageType)) { + origresult = chain->callNext(flHealth, bitsDamageType); + } + + if (callForward_Post(RH_CBasePlayer_TakeHealth, pthis->entindex(), flHealth, bitsDamageType)) { + // return original + return origresult; + } + + // return from override + return g_currentHookChain->m_data.m_interger; +} + +void CBasePlayer_Killed(IReGameHook_CBasePlayer_Killed *chain, CBasePlayer *pthis, entvars_t *pevAttacker, int iGib) +{ + if (callVoidForward_Pre(RH_CBasePlayer_Killed, pthis->entindex(), ENTINDEX(pevAttacker), iGib)) { + chain->callNext(pevAttacker, iGib); + } + + callVoidForward_Post(RH_CBasePlayer_Killed, pthis->entindex(), ENTINDEX(pevAttacker), iGib); +} + +void CBasePlayer_AddPoints(IReGameHook_CBasePlayer_AddPoints *chain, CBasePlayer *pthis, int score, BOOL bAllowNegativeScore) +{ + if (callVoidForward_Pre(RH_CBasePlayer_AddPoints, pthis->entindex(), score, bAllowNegativeScore)) { + chain->callNext(score, bAllowNegativeScore); + } + + callVoidForward_Post(RH_CBasePlayer_AddPoints, pthis->entindex(), score, bAllowNegativeScore); +} + +void CBasePlayer_AddPointsToTeam(IReGameHook_CBasePlayer_AddPointsToTeam *chain, CBasePlayer *pthis, int score, BOOL bAllowNegativeScore) +{ + if (callVoidForward_Pre(RH_CBasePlayer_AddPointsToTeam, pthis->entindex(), score, bAllowNegativeScore)) { + chain->callNext(score, bAllowNegativeScore); + } + + callVoidForward_Post(RH_CBasePlayer_AddPointsToTeam, pthis->entindex(), score, bAllowNegativeScore); +} + +BOOL CBasePlayer_AddPlayerItem(IReGameHook_CBasePlayer_AddPlayerItem *chain, CBasePlayer *pthis, CBasePlayerItem *pItem) +{ + //BOOL ownresult = 0; // return own for OVERRIDE + BOOL origresult = 0; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_AddPlayerItem, pthis->entindex(), pItem->entindex())) { + origresult = chain->callNext(pItem); + } + + if (callForward_Post(RH_CBasePlayer_AddPlayerItem, pthis->entindex(), pItem->entindex())) { + // return original + return origresult; + } + + // return from override + return (BOOL)g_currentHookChain->m_data.m_interger; +} + +BOOL CBasePlayer_RemovePlayerItem(IReGameHook_CBasePlayer_RemovePlayerItem *chain, CBasePlayer *pthis, CBasePlayerItem *pItem) +{ + //BOOL ownresult = 0; // return own for OVERRIDE + BOOL origresult = 0; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_RemovePlayerItem, pthis->entindex(), pItem->entindex())) { + origresult = chain->callNext(pItem); + } + + if (callForward_Post(RH_CBasePlayer_RemovePlayerItem, pthis->entindex(), pItem->entindex())) { + // return original + return origresult; + } + + // return from override + return (BOOL)g_currentHookChain->m_data.m_interger; +} + +int CBasePlayer_GiveAmmo(IReGameHook_CBasePlayer_GiveAmmo *chain, CBasePlayer *pthis, int iAmount, char *szName, int iMax) +{ + //int ownresult = 0; // return own for OVERRIDE + int origresult = 0; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_GiveAmmo, pthis->entindex(), iAmount, szName, iMax)) { + origresult = chain->callNext(iAmount, szName, iMax); + } + + if (callForward_Post(RH_CBasePlayer_GiveAmmo, pthis->entindex(), iAmount, szName, iMax)) { + // return original + return origresult; + } + + // return from override + return g_currentHookChain->m_data.m_interger; +} + +void CBasePlayer_ResetMaxSpeed(IReGameHook_CBasePlayer_ResetMaxSpeed *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_ResetMaxSpeed, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_ResetMaxSpeed, pthis->entindex()); +} + +void CBasePlayer_Jump(IReGameHook_CBasePlayer_Jump *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_Jump, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_Jump, pthis->entindex()); +} + +void CBasePlayer_Duck(IReGameHook_CBasePlayer_Duck *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_Duck, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_Duck, pthis->entindex()); +} + +void CBasePlayer_PreThink(IReGameHook_CBasePlayer_PreThink *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_PreThink, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_PreThink, pthis->entindex()); +} + +void CBasePlayer_PostThink(IReGameHook_CBasePlayer_PostThink *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_PostThink, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_PostThink, pthis->entindex()); +} + +void CBasePlayer_UpdateClientData(IReGameHook_CBasePlayer_UpdateClientData *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_UpdateClientData, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_UpdateClientData, pthis->entindex()); +} + +void CBasePlayer_ImpulseCommands(IReGameHook_CBasePlayer_ImpulseCommands *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_ImpulseCommands, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_ImpulseCommands, pthis->entindex()); +} + +void CBasePlayer_RoundRespawn(IReGameHook_CBasePlayer_RoundRespawn *chain, CBasePlayer *pthis) +{ + if (callVoidForward_Pre(RH_CBasePlayer_RoundRespawn, pthis->entindex())) { + chain->callNext(); + } + + callVoidForward_Post(RH_CBasePlayer_RoundRespawn, pthis->entindex()); +} + +void CBasePlayer_Blind(IReGameHook_CBasePlayer_Blind *chain, CBasePlayer *pthis, float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha) +{ + if (callVoidForward_Pre(RH_CBasePlayer_Blind, pthis->entindex(), flUntilTime, flHoldTime, flFadeTime, iAlpha)) { + chain->callNext(flUntilTime, flHoldTime, flFadeTime, iAlpha); + } + + callVoidForward_Post(RH_CBasePlayer_Blind, pthis->entindex(), flUntilTime, flHoldTime, flFadeTime, iAlpha); +} + +CBaseEntity *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer_IsValidTarget *chain, CBasePlayer *pthis, int iPlayerIndex, bool bSameTeam) +{ + //CBaseEntity *ownresult = nullptr; // return own for OVERRIDE + CBaseEntity *origresult = nullptr; // return by call original function + + if (callForward_Pre(RH_CBasePlayer_Observer_IsValidTarget, pthis->entindex(), iPlayerIndex, bSameTeam)) { + origresult = chain->callNext(iPlayerIndex, bSameTeam); + } + + if (callForward_Post(RH_CBasePlayer_Observer_IsValidTarget, pthis->entindex(), iPlayerIndex, bSameTeam)) { + // return original + return origresult; + } + + // return from override + return g_currentHookChain->m_data.m_classptr; +} + +int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver) +{ + //int ownresult = 0; // return own for OVERRIDE + int origresult = 0; // return by call original function + + if (callForward_Pre(RH_GetForceCamera, pObserver->entindex())) { + origresult = chain->callNext(pObserver); + } + + if (callForward_Post(RH_GetForceCamera, pObserver->entindex())) { + // return original + return origresult; + } + + // return from override + return g_currentHookChain->m_data.m_interger; +} diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h new file mode 100644 index 0000000..352c765 --- /dev/null +++ b/reapi/src/hook_callback.h @@ -0,0 +1,145 @@ +#pragma once + +enum +{ + RH_UNSET = 0, + RH_IGNORED, // plugin didn't take any action + RH_HANDLED, // plugin did something, but real function should still be called + RH_OVERRIDE, // call real function, but use my return value + RH_SUPERCEDE // skip real function; use my return value +}; + +// for hookchain return +enum HookChainReturn +{ + RHV_STRING = 0, + RHV_FLOAT, + RHV_INTEGER, + RHV_CLASSPTR +}; + +extern CHook *g_currentHookChain; + +template +inline bool callVoidForward_Pre(int func, t_args... args) +{ + register int ret = RH_UNSET; + for (auto it = hooklist[func]->pre.begin(), end = hooklist[func]->pre.end(); it != end; ++it) + { + if ((*it)->GetState() == FSTATE_OK) + { + ret = g_amxxapi.ExecuteForward((*it)->m_forward, args...); + } + } + + // no supercede, continue to call original func + return (ret < RH_SUPERCEDE); +} + +template +inline void callVoidForward_Post(int func, t_args... args) +{ + for (auto it = hooklist[func]->post.begin(), end = hooklist[func]->post.end(); it != end; ++it) + { + if ((*it)->GetState() == FSTATE_OK) + { + g_currentHookChain = (*it); + g_amxxapi.ExecuteForward((*it)->m_forward, args...); + } + } +} + +template +inline void callVoidForward(t_chain chain, int func, t_args... args) +{ + register int ret = RH_UNSET; + for (auto it = hooklist[func]->pre.begin(), end = hooklist[func]->pre.end(); it != end; ++it) + { + if ((*it)->GetState() == FSTATE_OK) + { + ret = g_amxxapi.ExecuteForward((*it)->m_forward, args...); + } + } + + // no supercede, continue to call original func + if (ret < RH_SUPERCEDE) + { + chain->callNext(args...); + } + + // Post + for (auto it = hooklist[func]->post.begin(), end = hooklist[func]->post.end(); it != end; ++it) + { + if ((*it)->GetState() == FSTATE_OK) + { + g_currentHookChain = (*it); + g_amxxapi.ExecuteForward((*it)->m_forward, args...); + } + } +} + +template +inline bool callForward_Pre(int func, t_args... args) +{ + register int ret = RH_UNSET; + for (auto it = hooklist[func]->pre.begin(), end = hooklist[func]->pre.end(); it != end; ++it) + { + if ((*it)->GetState() == FSTATE_OK) + { + ret = g_amxxapi.ExecuteForward((*it)->m_forward, args...); + } + } + + // no supercede, continue to call original func + return (ret < RH_SUPERCEDE); +} + +template +inline bool callForward_Post(int func, t_args... args) +{ + register int ret = RH_UNSET; + for (auto it = hooklist[func]->post.begin(), end = hooklist[func]->post.end(); it != end; ++it) + { + if ((*it)->GetState() == FSTATE_OK) + { + g_currentHookChain = (*it); + ret = g_amxxapi.ExecuteForward((*it)->m_forward, args...); + } + } + + // no override + return (ret < RH_OVERRIDE); +} + +// rehlds functions +void SV_StartSound(IRehldsHook_SV_StartSound *chain, int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int fFlags, int pitch); +void SV_DropClient(IRehldsHook_SV_DropClient *chain, IGameClient *cl, bool crash, const char *fmt); +void SV_ActivateServer(IRehldsHook_SV_ActivateServer *chain, int runPhysics); +void Cvar_DirectSet(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char *value); + +// regamedll functions +void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis); +void CBasePlayer_Precache(IReGameHook_CBasePlayer_Precache *chain, CBasePlayer *pthis); +int CBasePlayer_ObjectCaps(IReGameHook_CBasePlayer_ObjectCaps *chain, CBasePlayer *pthis); +int CBasePlayer_Classify(IReGameHook_CBasePlayer_Classify *chain, CBasePlayer *pthis); +void CBasePlayer_TraceAttack(IReGameHook_CBasePlayer_TraceAttack *chain, CBasePlayer *pthis, entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); +int CBasePlayer_TakeDamage(IReGameHook_CBasePlayer_TakeDamage *chain, CBasePlayer *pthis, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); +int CBasePlayer_TakeHealth(IReGameHook_CBasePlayer_TakeHealth *chain, CBasePlayer *pthis, float flHealth, int bitsDamageType); +void CBasePlayer_Killed(IReGameHook_CBasePlayer_Killed *chain, CBasePlayer *pthis, entvars_t *pevAttacker, int iGib); +void CBasePlayer_AddPoints(IReGameHook_CBasePlayer_AddPoints *chain, CBasePlayer *pthis, int score, BOOL bAllowNegativeScore); +void CBasePlayer_AddPointsToTeam(IReGameHook_CBasePlayer_AddPointsToTeam *chain, CBasePlayer *pthis, int score, BOOL bAllowNegativeScore); +BOOL CBasePlayer_AddPlayerItem(IReGameHook_CBasePlayer_AddPlayerItem *chain, CBasePlayer *pthis, CBasePlayerItem *pItem); +BOOL CBasePlayer_RemovePlayerItem(IReGameHook_CBasePlayer_RemovePlayerItem *chain, CBasePlayer *pthis, CBasePlayerItem *pItem); +int CBasePlayer_GiveAmmo(IReGameHook_CBasePlayer_GiveAmmo *chain, CBasePlayer *pthis, int iAmount, char *szName, int iMax); +void CBasePlayer_ResetMaxSpeed(IReGameHook_CBasePlayer_ResetMaxSpeed *chain, CBasePlayer *pthis); +void CBasePlayer_Jump(IReGameHook_CBasePlayer_Jump *chain, CBasePlayer *pthis); +void CBasePlayer_Duck(IReGameHook_CBasePlayer_Duck *chain, CBasePlayer *pthis); +void CBasePlayer_PreThink(IReGameHook_CBasePlayer_PreThink *chain, CBasePlayer *pthis); +void CBasePlayer_PostThink(IReGameHook_CBasePlayer_PostThink *chain, CBasePlayer *pthis); +void CBasePlayer_UpdateClientData(IReGameHook_CBasePlayer_UpdateClientData *chain, CBasePlayer *pthis); +void CBasePlayer_ImpulseCommands(IReGameHook_CBasePlayer_ImpulseCommands *chain, CBasePlayer *pthis); +void CBasePlayer_RoundRespawn(IReGameHook_CBasePlayer_RoundRespawn *chain, CBasePlayer *pthis); +void CBasePlayer_Blind(IReGameHook_CBasePlayer_Blind *chain, CBasePlayer *pthis, float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha); + +CBaseEntity *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer_IsValidTarget *chain, CBasePlayer *pthis, int iPlayerIndex, bool bSameTeam); +int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver); diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp new file mode 100644 index 0000000..1c13d4c --- /dev/null +++ b/reapi/src/hook_list.cpp @@ -0,0 +1,60 @@ +#include "precompiled.h" + +int regfunc::current_cell = 1; + +#define ENG(h) { {}, {}, #h, "ReHLDS", [](){ return api_cfg.hasReHLDS(); }, ((!(RH_##h & 1023) ? regfunc::current_cell = 1, true : false) || (RH_##h & 1023) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_RehldsHookchains->##h##()->registerHook(&##h); }, [](){ g_RehldsHookchains->##h##()->unregisterHook(&##h); }} +hook_t hooklist_engine[] = { + ENG(SV_StartSound), + ENG(SV_DropClient), + ENG(SV_ActivateServer), + ENG(Cvar_DirectSet) +}; + +#define DLL(h) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RH_##h & 1023) ? regfunc::current_cell = 1, true : false) || (RH_##h & 1023) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_ReGameHookchains->##h##()->registerHook(&##h); }, [](){ g_ReGameHookchains->##h##()->unregisterHook(&##h); }} +hook_t hooklist_gamedll[] = { + DLL(GetForceCamera) +}; + +hook_t hooklist_player[] = { + DLL(CBasePlayer_Spawn), + DLL(CBasePlayer_Precache), + DLL(CBasePlayer_ObjectCaps), + DLL(CBasePlayer_Classify), + DLL(CBasePlayer_TraceAttack), + DLL(CBasePlayer_TakeDamage), + DLL(CBasePlayer_TakeHealth), + DLL(CBasePlayer_Killed), + DLL(CBasePlayer_AddPoints), + DLL(CBasePlayer_AddPointsToTeam), + DLL(CBasePlayer_AddPlayerItem), + DLL(CBasePlayer_RemovePlayerItem), + DLL(CBasePlayer_GiveAmmo), + DLL(CBasePlayer_ResetMaxSpeed), + DLL(CBasePlayer_Jump), + DLL(CBasePlayer_Duck), + DLL(CBasePlayer_PreThink), + DLL(CBasePlayer_PostThink), + DLL(CBasePlayer_UpdateClientData), + DLL(CBasePlayer_ImpulseCommands), + DLL(CBasePlayer_RoundRespawn), + DLL(CBasePlayer_Blind), + DLL(CBasePlayer_Observer_IsValidTarget), +}; + +hooklist_t hooklist; + +hook_t *hooklist_t::operator[](size_t hook) const +{ + #define CASE(h) case ht_##h: if (index < arraysize(hooklist_##h)) return &hooklist_##h[index]; else break; + + const auto table = hooks_tables_e(hook / MAX_RANGE_REGION); + const auto index = hook & (MAX_RANGE_REGION - 1); + + switch (table) { + CASE(engine) + CASE(gamedll) + CASE(player) + } + + return nullptr; +} diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h new file mode 100644 index 0000000..559ad42 --- /dev/null +++ b/reapi/src/hook_list.h @@ -0,0 +1,203 @@ +#pragma once +#include "reapi_utils.h" + +#define MAX_RANGE_REGION 1024 +#define BEGIN_FUNC_REGION(x) (MAX_RANGE_REGION * hooklist_t::hooks_tables_e::ht_##x) + +typedef bool (*ablfunc_t)(); +typedef int (*regfunc_t)(AMX *, const char *); +typedef void (*regchain_t)(); + +struct regfunc +{ + template + regfunc(R (*)(T *, int, edict_t *, int, const char *, int, float, int, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, IGameClient *, bool, const char *)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_STRING, FP_DONE); }; + } + + template + regfunc(R (*)(T *, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, struct cvar_s *, const char *)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_STRING, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, entvars_t *, float, Vector, TraceResult *, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, entvars_t *, entvars_t *, float, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, float, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, entvars_t *, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, int, BOOL)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, CBasePlayerItem *)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, int, char *, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, float, float, float, int)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE); }; + } + + template + regfunc(R (*)(T *, CBasePlayer *, int, bool)) { + func = [](AMX *amx, const char *name) { return g_amxxapi.RegisterSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_DONE); }; + } + + regfunc(const char *error) { UTIL_SysError(error); } // to cause a amxx module failure. + operator regfunc_t() const { return func; } + regfunc_t func; + + static int current_cell; // the counter of cells +}; + +struct hook_t +{ + std::vector pre; // array pre forward + std::vector post; // array post forward + + const char *func_name; // name functions + const char *depend_name; // platform dependency + + ablfunc_t availableFunc; + regfunc_t registerForward; // register AMXX forward and get ID + regchain_t registerHookchain; // register function-hook API + regchain_t unregisterHookchain; // unregister function-hook API +}; + +struct hooklist_t +{ + hook_t *operator[](size_t hook) const; + + enum hooks_tables_e + { + ht_engine, + ht_gamedll, + ht_player, + + ht_end + }; +}; + +enum EngineFunc +{ + //RH_Steam_NotifyClientConnect = 0, + //RH_SV_ConnectClient, + //RH_SV_GetIDString, + //RH_SV_SendServerinfo, + //RH_SV_CheckProtocol, + //RH_SVC_GetChallenge, + //RH_SV_CheckKeyInfo, + //RH_SV_CheckIPRestrictions, + //RH_SV_FinishCertificateCheck, + //RH_Steam_NotifyBotConnect, + //RH_SV_SerializeSteamid, + //RH_SV_CompareUserID, + //RH_Steam_NotifyClientDisconnect, + //RH_NET_GetPacketPreprocessor, + //RH_ValidateCommand, + //RH_ClientConnected, + //RH_SV_HandleClientMessage, + //RH_Mod_LoadBrushModel, + //RH_Mod_LoadStudioModel, + //RH_ExecuteServerStringCmd, + //RH_SV_EmitEvents, + //RH_EV_PlayReliableEvent, + RH_SV_StartSound = BEGIN_FUNC_REGION(engine), + //RH_PF_Remove_I, + //RH_PF_BuildSoundMsg_I, + //RH_SV_WriteFullClientUpdate, + //RH_SV_CheckConsistencyResponse, + RH_SV_DropClient, + RH_SV_ActivateServer, + //RH_SV_WriteVoiceCodec, + //RH_Steam_GSGetSteamID, + //RH_SV_TransferConsistencyInfo, + //RH_Steam_GSBUpdateUserData, + RH_Cvar_DirectSet, + //RH_SV_EstablishTimeBase, + //RH_SV_Spawn_f, + + // [...] + RH_EngineFunc_End +}; + +enum GamedllFunc +{ + RH_GetForceCamera = BEGIN_FUNC_REGION(gamedll), + + // [...] + RH_GameDLL_End +}; + +enum GamedllFunc_CBasePlayer +{ + // CBasePlayer virtual + RH_CBasePlayer_Spawn = BEGIN_FUNC_REGION(player), + RH_CBasePlayer_Precache, + RH_CBasePlayer_ObjectCaps, + RH_CBasePlayer_Classify, + RH_CBasePlayer_TraceAttack, + RH_CBasePlayer_TakeDamage, + RH_CBasePlayer_TakeHealth, + RH_CBasePlayer_Killed, + RH_CBasePlayer_AddPoints, + RH_CBasePlayer_AddPointsToTeam, + RH_CBasePlayer_AddPlayerItem, + RH_CBasePlayer_RemovePlayerItem, + RH_CBasePlayer_GiveAmmo, + RH_CBasePlayer_ResetMaxSpeed, + RH_CBasePlayer_Jump, + RH_CBasePlayer_Duck, + RH_CBasePlayer_PreThink, + RH_CBasePlayer_PostThink, + RH_CBasePlayer_UpdateClientData, + RH_CBasePlayer_ImpulseCommands, + RH_CBasePlayer_RoundRespawn, + RH_CBasePlayer_Blind, + + RH_CBasePlayer_Observer_IsValidTarget, + + // [...] + RH_CBasePlayer_End +}; + +extern hook_t hooklist_engine[]; +extern hook_t hooklist_player[]; +extern hooklist_t hooklist; diff --git a/reapi/src/hook_manager.cpp b/reapi/src/hook_manager.cpp new file mode 100644 index 0000000..bee7eca --- /dev/null +++ b/reapi/src/hook_manager.cpp @@ -0,0 +1,40 @@ +#include "precompiled.h" + +CHookManager g_hookManager; + +CHook *CHookManager::addHandler(int func, int forward, bool post) +{ + if (!hooklist[func]->post.size() && !hooklist[func]->pre.size()) + { + // register API hookchain + hooklist[func]->registerHookchain(); + } + + CHook *hook = new CHook(forward); + if (post) + { + hooklist[func]->post.push_back(hook); + } + else + { + hooklist[func]->pre.push_back(hook); + } + + return hook; +} + +void CHookManager::clearHandlers() +{ +#define CLEAR_HOOKLIST(__END__, __START__)\ + for (size_t i = BEGIN_FUNC_REGION(__START__); i < RH_##__END__##_End; ++i) {\ + if (hooklist[i] == nullptr)\ + continue;\ + hooklist[i]->pre.clear();\ + hooklist[i]->post.clear();\ + hooklist[i]->unregisterHookchain();\ + } + + CLEAR_HOOKLIST(EngineFunc, engine); + CLEAR_HOOKLIST(GameDLL, gamedll); + CLEAR_HOOKLIST(CBasePlayer, player); +} diff --git a/reapi/src/hook_manager.h b/reapi/src/hook_manager.h new file mode 100644 index 0000000..571a2a4 --- /dev/null +++ b/reapi/src/hook_manager.h @@ -0,0 +1,43 @@ +#pragma once +#include "hook_list.h" + +//#define MAX_RANGE_HOOKS RH_EngineFunc_End + RH_GameDLL_End + RH_CBasePlayer_End + +enum fwdstate +{ + FSTATE_INVALID = 0, + FSTATE_OK, + FSTATE_PAUSE, + FSTATE_STOP +}; + +class CHook +{ +public: + CHook(int forward_index) : m_forward(forward_index), m_state(FSTATE_OK) {}; + + int GetForwardID() const { return m_forward; } + fwdstate GetState() const { return m_state; } + +public: + int m_forward; + fwdstate m_state; + + struct data_return_t + { + char* m_string; + float m_float; + int m_interger; + CBaseEntity* m_classptr; + }; + data_return_t m_data; +}; + +class CHookManager +{ +public: + void clearHandlers(); + CHook *addHandler(int func, int forward, bool post); +}; + +extern CHookManager g_hookManager; diff --git a/reapi/src/main.cpp b/reapi/src/main.cpp new file mode 100644 index 0000000..eb40833 --- /dev/null +++ b/reapi/src/main.cpp @@ -0,0 +1,21 @@ +#include "precompiled.h" + +bool OnMetaAttach() +{ + // initialize API + if (!api_cfg.Init()) + return false; + + return true; +} + +void OnMetaDetach() +{ + // clear all hooks? + g_hookManager.clearHandlers(); +} + +void ServerDeactivate_Post() +{ + g_hookManager.clearHandlers(); +} diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp new file mode 100644 index 0000000..ba1e7f7 --- /dev/null +++ b/reapi/src/member_list.cpp @@ -0,0 +1,330 @@ +#include "precompiled.h" + +struct regmember +{ + template + regmember(T &type, size_t maxsize, size_t offset, enum_membertypes member_type) + { + member.size = sizeof(T); + member.max_size = sizeof(T); + member.offset = offset; + member.type = member_type; + } + template + regmember(T type[], size_t maxsize, size_t offset, enum_membertypes member_type) + { + member.size = sizeof(T); + member.max_size = maxsize; + member.offset = offset; + member.type = member_type; + } + + regmember(const char *error) + { + UTIL_SysError("%s", error); + } // to cause a amxx module failure. + operator member_t() const { return member; } + member_t member; + + static int current_cell; // the counter of cells +}; + +static char mem_dummy[0xffff]; +int regmember::current_cell = 1; + +#define GM_MEMBERS(mx, mtype) ((!(mx & 1023) ? regmember::current_cell = 1, true : false) || (mx & 1023) == regmember::current_cell++) ? regmember(((CHalfLifeMultiplay *)&mem_dummy)->##mx, sizeof(((CHalfLifeMultiplay *)&mem_dummy)->##mx), offsetof(CHalfLifeMultiplay, mx), mtype) : regmember(#mx " doesn't match hook definition") +#define GM_VOICE_MEMBERS(mx, mtype) ((!(mx & 1023) ? regmember::current_cell = 1, true : false) || (mx & 1023) == regmember::current_cell++) ? regmember(((CVoiceGameMgr *)&mem_dummy)->##mx, sizeof(((CVoiceGameMgr *)&mem_dummy)->##mx), offsetof(CVoiceGameMgr, mx), mtype) : regmember(#mx " doesn't match hook definition") + +member_t memberlist_gamerules[] = { + GM_MEMBERS(m_bFreezePeriod, MEMBER_INTEGER), + GM_MEMBERS(m_bBombDropped, MEMBER_INTEGER), + // m_VoiceGameMgr -> + GM_VOICE_MEMBERS(m_msgPlayerVoiceMask, MEMBER_INTEGER), + GM_VOICE_MEMBERS(m_msgRequestState, MEMBER_INTEGER), + GM_VOICE_MEMBERS(m_nMaxPlayers, MEMBER_INTEGER), + GM_VOICE_MEMBERS(m_UpdateInterval, MEMBER_DOUBLE), + GM_MEMBERS(m_fTeamCount, MEMBER_FLOAT), + GM_MEMBERS(m_flCheckWinConditions, MEMBER_FLOAT), + GM_MEMBERS(m_fRoundCount, MEMBER_FLOAT), + GM_MEMBERS(m_iRoundTime, MEMBER_INTEGER), + GM_MEMBERS(m_iRoundTimeSecs, MEMBER_INTEGER), + GM_MEMBERS(m_iIntroRoundTime, MEMBER_INTEGER), + GM_MEMBERS(m_fIntroRoundCount, MEMBER_FLOAT), + GM_MEMBERS(m_iAccountTerrorist, MEMBER_INTEGER), + GM_MEMBERS(m_iAccountCT, MEMBER_INTEGER), + GM_MEMBERS(m_iNumTerrorist, MEMBER_INTEGER), + GM_MEMBERS(m_iNumCT, MEMBER_INTEGER), + GM_MEMBERS(m_iNumSpawnableTerrorist, MEMBER_INTEGER), + GM_MEMBERS(m_iNumSpawnableCT, MEMBER_INTEGER), + GM_MEMBERS(m_iSpawnPointCount_Terrorist, MEMBER_INTEGER), + GM_MEMBERS(m_iSpawnPointCount_CT, MEMBER_INTEGER), + GM_MEMBERS(m_iHostagesRescued, MEMBER_INTEGER), + GM_MEMBERS(m_iHostagesTouched, MEMBER_INTEGER), + GM_MEMBERS(m_iRoundWinStatus, MEMBER_INTEGER), + GM_MEMBERS(m_iNumCTWins, MEMBER_SHORT), + GM_MEMBERS(m_iNumTerroristWins, MEMBER_SHORT), + GM_MEMBERS(m_bTargetBombed, MEMBER_BOOL), + GM_MEMBERS(m_bBombDefused, MEMBER_BOOL), + GM_MEMBERS(m_bMapHasBombTarget, MEMBER_BOOL), + GM_MEMBERS(m_bMapHasBombZone, MEMBER_BOOL), + GM_MEMBERS(m_bMapHasBuyZone, MEMBER_BOOL), + GM_MEMBERS(m_bMapHasRescueZone, MEMBER_BOOL), + GM_MEMBERS(m_bMapHasEscapeZone, MEMBER_BOOL), + GM_MEMBERS(m_iMapHasVIPSafetyZone, MEMBER_INTEGER), + GM_MEMBERS(m_bMapHasCameras, MEMBER_INTEGER), + GM_MEMBERS(m_iC4Timer, MEMBER_INTEGER), + GM_MEMBERS(m_iC4Guy, MEMBER_INTEGER), + GM_MEMBERS(m_iLoserBonus, MEMBER_INTEGER), + GM_MEMBERS(m_iNumConsecutiveCTLoses, MEMBER_INTEGER), + GM_MEMBERS(m_iNumConsecutiveTerroristLoses, MEMBER_INTEGER), + GM_MEMBERS(m_fMaxIdlePeriod, MEMBER_FLOAT), + GM_MEMBERS(m_iLimitTeams, MEMBER_INTEGER), + GM_MEMBERS(m_bLevelInitialized, MEMBER_BOOL), + GM_MEMBERS(m_bRoundTerminating, MEMBER_BOOL), + GM_MEMBERS(m_bCompleteReset, MEMBER_BOOL), + GM_MEMBERS(m_flRequiredEscapeRatio, MEMBER_FLOAT), + GM_MEMBERS(m_iNumEscapers, MEMBER_INTEGER), + GM_MEMBERS(m_iHaveEscaped, MEMBER_INTEGER), + GM_MEMBERS(m_bCTCantBuy, MEMBER_BOOL), + GM_MEMBERS(m_bTCantBuy, MEMBER_BOOL), + GM_MEMBERS(m_flBombRadius, MEMBER_FLOAT), + GM_MEMBERS(m_iConsecutiveVIP, MEMBER_INTEGER), + GM_MEMBERS(m_iTotalGunCount, MEMBER_INTEGER), + GM_MEMBERS(m_iTotalGrenadeCount, MEMBER_INTEGER), + GM_MEMBERS(m_iTotalArmourCount, MEMBER_INTEGER), + GM_MEMBERS(m_iUnBalancedRounds, MEMBER_INTEGER), + GM_MEMBERS(m_iNumEscapeRounds, MEMBER_INTEGER), + GM_MEMBERS(m_iMapVotes, MEMBER_INTEGER), // ARRAY 100 + GM_MEMBERS(m_iLastPick, MEMBER_INTEGER), + GM_MEMBERS(m_iMaxMapTime, MEMBER_INTEGER), + GM_MEMBERS(m_iMaxRounds, MEMBER_INTEGER), + GM_MEMBERS(m_iTotalRoundsPlayed, MEMBER_INTEGER), + GM_MEMBERS(m_iMaxRoundsWon, MEMBER_INTEGER), + GM_MEMBERS(m_iStoredSpectValue, MEMBER_INTEGER), + GM_MEMBERS(m_flForceCameraValue, MEMBER_FLOAT), + GM_MEMBERS(m_flForceChaseCamValue, MEMBER_FLOAT), + GM_MEMBERS(m_flFadeToBlackValue, MEMBER_FLOAT), + GM_MEMBERS(m_pVIP, MEMBER_CLASSPTR), + GM_MEMBERS(VIPQueue, MEMBER_CLASSPTR), // ARRAY [5] + GM_MEMBERS(m_flIntermissionEndTime, MEMBER_FLOAT), + GM_MEMBERS(m_flIntermissionStartTime, MEMBER_FLOAT), + GM_MEMBERS(m_iEndIntermissionButtonHit, MEMBER_INTEGER), + GM_MEMBERS(m_tmNextPeriodicThink, MEMBER_FLOAT), + GM_MEMBERS(m_bFirstConnected, MEMBER_BOOL), + GM_MEMBERS(m_bInCareerGame, MEMBER_BOOL), + GM_MEMBERS(m_fCareerRoundMenuTime, MEMBER_FLOAT), + GM_MEMBERS(m_iCareerMatchWins, MEMBER_INTEGER), + GM_MEMBERS(m_iRoundWinDifference, MEMBER_INTEGER), + GM_MEMBERS(m_fCareerMatchMenuTime, MEMBER_FLOAT), + GM_MEMBERS(m_bSkipSpawn, MEMBER_BOOL), +}; + +#define PL_MEMBERS(mx, mtype) ((!(mx & 1023) ? regmember::current_cell = 1, true : false) || (mx & 1023) == regmember::current_cell++) ? regmember(((CBasePlayer *)&mem_dummy)->##mx, sizeof(((CBasePlayer *)&mem_dummy)->##mx), offsetof(CBasePlayer, mx), mtype) : regmember(#mx " doesn't match hook definition") + +member_t memberlist_player[] = { + PL_MEMBERS(random_seed, MEMBER_INTEGER), + PL_MEMBERS(m_usPlayerBleed, MEMBER_SHORT), + PL_MEMBERS(m_hObserverTarget, MEMBER_EHANDLE), + PL_MEMBERS(m_flNextObserverInput, MEMBER_FLOAT), + PL_MEMBERS(m_iObserverWeapon, MEMBER_INTEGER), + PL_MEMBERS(m_iObserverC4State, MEMBER_INTEGER), + PL_MEMBERS(m_bObserverHasDefuser, MEMBER_BOOL), + PL_MEMBERS(m_iObserverLastMode, MEMBER_INTEGER), + PL_MEMBERS(m_flFlinchTime, MEMBER_FLOAT), + PL_MEMBERS(m_flAnimTime, MEMBER_FLOAT), + PL_MEMBERS(m_bHighDamage, MEMBER_BOOL), + PL_MEMBERS(m_flVelocityModifier, MEMBER_FLOAT), + PL_MEMBERS(m_iLastZoom, MEMBER_INTEGER), + PL_MEMBERS(m_bResumeZoom, MEMBER_BOOL), + PL_MEMBERS(m_flEjectBrass, MEMBER_FLOAT), + PL_MEMBERS(m_iKevlar, MEMBER_INTEGER), + PL_MEMBERS(m_bNotKilled, MEMBER_BOOL), + PL_MEMBERS(m_iTeam, MEMBER_INTEGER), + PL_MEMBERS(m_iAccount, MEMBER_INTEGER), + PL_MEMBERS(m_bHasPrimary, MEMBER_BOOL), + PL_MEMBERS(m_flDeathThrowTime, MEMBER_FLOAT), + PL_MEMBERS(m_iThrowDirection, MEMBER_INTEGER), + PL_MEMBERS(m_flLastTalk, MEMBER_FLOAT), + PL_MEMBERS(m_bJustConnected, MEMBER_BOOL), + PL_MEMBERS(m_bContextHelp, MEMBER_BOOL), + PL_MEMBERS(m_iJoiningState, MEMBER_INTEGER), + PL_MEMBERS(m_pIntroCamera, MEMBER_CLASSPTR), + PL_MEMBERS(m_fIntroCamTime, MEMBER_FLOAT), + PL_MEMBERS(m_fLastMovement, MEMBER_FLOAT), + PL_MEMBERS(m_bMissionBriefing, MEMBER_BOOL), + PL_MEMBERS(m_bTeamChanged, MEMBER_BOOL), + PL_MEMBERS(m_iModelName, MEMBER_INTEGER), + PL_MEMBERS(m_iTeamKills, MEMBER_INTEGER), + PL_MEMBERS(m_iIgnoreGlobalChat, MEMBER_INTEGER), + PL_MEMBERS(m_bHasNightVision, MEMBER_BOOL), + PL_MEMBERS(m_bNightVisionOn, MEMBER_BOOL), + PL_MEMBERS(m_vRecentPath, MEMBER_VECTOR), // ARRAY [20] + PL_MEMBERS(m_flIdleCheckTime, MEMBER_FLOAT), + PL_MEMBERS(m_flRadioTime, MEMBER_FLOAT), + PL_MEMBERS(m_iRadioMessages, MEMBER_INTEGER), + PL_MEMBERS(m_bIgnoreRadio, MEMBER_BOOL), + PL_MEMBERS(m_bHasC4, MEMBER_BOOL), + PL_MEMBERS(m_bHasDefuser, MEMBER_BOOL), + PL_MEMBERS(m_bKilledByBomb, MEMBER_BOOL), + PL_MEMBERS(m_vBlastVector, MEMBER_VECTOR), + PL_MEMBERS(m_bKilledByGrenade, MEMBER_BOOL), + //PL_MEMBERS(m_hintMessageQueue), + PL_MEMBERS(m_flDisplayHistory, MEMBER_INTEGER), + PL_MEMBERS(m_iMenu, MEMBER_INTEGER), + PL_MEMBERS(m_iChaseTarget, MEMBER_INTEGER), + PL_MEMBERS(m_pChaseTarget, MEMBER_CLASSPTR), + PL_MEMBERS(m_fCamSwitch, MEMBER_FLOAT), + PL_MEMBERS(m_bEscaped, MEMBER_BOOL), + PL_MEMBERS(m_bIsVIP, MEMBER_BOOL), + PL_MEMBERS(m_tmNextRadarUpdate, MEMBER_FLOAT), + PL_MEMBERS(m_vLastOrigin, MEMBER_VECTOR), + PL_MEMBERS(m_iCurrentKickVote, MEMBER_INTEGER), + PL_MEMBERS(m_flNextVoteTime, MEMBER_FLOAT), + PL_MEMBERS(m_bJustKilledTeammate, MEMBER_BOOL), + PL_MEMBERS(m_iHostagesKilled, MEMBER_INTEGER), + PL_MEMBERS(m_iMapVote, MEMBER_INTEGER), + PL_MEMBERS(m_bCanShoot, MEMBER_BOOL), + PL_MEMBERS(m_flLastFired, MEMBER_FLOAT), + PL_MEMBERS(m_flLastAttackedTeammate, MEMBER_FLOAT), + PL_MEMBERS(m_bHeadshotKilled, MEMBER_BOOL), + PL_MEMBERS(m_bPunishedForTK, MEMBER_BOOL), + PL_MEMBERS(m_bReceivesNoMoneyNextRound, MEMBER_BOOL), + PL_MEMBERS(m_iTimeCheckAllowed, MEMBER_INTEGER), + PL_MEMBERS(m_bHasChangedName, MEMBER_BOOL), + PL_MEMBERS(m_szNewName, MEMBER_CHAR_ARRAY), // ARRAY [32] + PL_MEMBERS(m_bIsDefusing, MEMBER_BOOL), + PL_MEMBERS(m_tmHandleSignals, MEMBER_FLOAT), + PL_MEMBERS(m_signals, MEMBER_SIGNALS), + PL_MEMBERS(m_pentCurBombTarget, MEMBER_EDICT), + PL_MEMBERS(m_iPlayerSound, MEMBER_INTEGER), + PL_MEMBERS(m_iTargetVolume, MEMBER_INTEGER), + PL_MEMBERS(m_iWeaponVolume, MEMBER_INTEGER), + PL_MEMBERS(m_iExtraSoundTypes, MEMBER_INTEGER), + PL_MEMBERS(m_iWeaponFlash, MEMBER_INTEGER), + PL_MEMBERS(m_flStopExtraSoundTime, MEMBER_FLOAT), + PL_MEMBERS(m_flFlashLightTime, MEMBER_FLOAT), + PL_MEMBERS(m_iFlashBattery, MEMBER_INTEGER), + PL_MEMBERS(m_afButtonLast, MEMBER_INTEGER), + PL_MEMBERS(m_afButtonPressed, MEMBER_INTEGER), + PL_MEMBERS(m_afButtonReleased, MEMBER_INTEGER), + PL_MEMBERS(m_pentSndLast, MEMBER_EDICT), + PL_MEMBERS(m_flSndRoomtype, MEMBER_FLOAT), + PL_MEMBERS(m_flSndRange, MEMBER_FLOAT), + PL_MEMBERS(m_flFallVelocity, MEMBER_FLOAT), + PL_MEMBERS(m_rgItems, MEMBER_INTEGER), // ARRAY [4] + PL_MEMBERS(m_fNewAmmo, MEMBER_INTEGER), + PL_MEMBERS(m_afPhysicsFlags, MEMBER_INTEGER), + PL_MEMBERS(m_fNextSuicideTime, MEMBER_FLOAT), + PL_MEMBERS(m_flTimeStepSound, MEMBER_FLOAT), + PL_MEMBERS(m_flTimeWeaponIdle, MEMBER_FLOAT), + PL_MEMBERS(m_flSwimTime, MEMBER_FLOAT), + PL_MEMBERS(m_flDuckTime, MEMBER_FLOAT), + PL_MEMBERS(m_flWallJumpTime, MEMBER_FLOAT), + PL_MEMBERS(m_flSuitUpdate, MEMBER_FLOAT), + PL_MEMBERS(m_rgSuitPlayList, MEMBER_INTEGER), // ARRAY [4] + PL_MEMBERS(m_iSuitPlayNext, MEMBER_INTEGER), + PL_MEMBERS(m_rgiSuitNoRepeat, MEMBER_INTEGER), // ARRAY [32] + PL_MEMBERS(m_rgflSuitNoRepeatTime, MEMBER_FLOAT), // ARRAY [32] + PL_MEMBERS(m_lastDamageAmount, MEMBER_INTEGER), + PL_MEMBERS(m_tbdPrev, MEMBER_FLOAT), + PL_MEMBERS(m_flgeigerRange, MEMBER_FLOAT), + PL_MEMBERS(m_flgeigerDelay, MEMBER_FLOAT), + PL_MEMBERS(m_igeigerRangePrev, MEMBER_INTEGER), + PL_MEMBERS(m_iStepLeft, MEMBER_INTEGER), + PL_MEMBERS(m_szTextureName, MEMBER_CHAR_ARRAY), // ARRAY [17] + PL_MEMBERS(m_chTextureType, MEMBER_BYTE), + PL_MEMBERS(m_idrowndmg, MEMBER_INTEGER), + PL_MEMBERS(m_idrownrestored, MEMBER_INTEGER), + PL_MEMBERS(m_bitsHUDDamage, MEMBER_INTEGER), + PL_MEMBERS(m_fInitHUD, MEMBER_INTEGER), + PL_MEMBERS(m_fGameHUDInitialized, MEMBER_INTEGER), + PL_MEMBERS(m_iTrain, MEMBER_INTEGER), + PL_MEMBERS(m_fWeapon, MEMBER_INTEGER), + PL_MEMBERS(m_pTank, MEMBER_EHANDLE), + PL_MEMBERS(m_fDeadTime, MEMBER_FLOAT), + PL_MEMBERS(m_fNoPlayerSound, MEMBER_INTEGER), + PL_MEMBERS(m_fLongJump, MEMBER_INTEGER), + PL_MEMBERS(m_tSneaking, MEMBER_FLOAT), + PL_MEMBERS(m_iUpdateTime, MEMBER_INTEGER), + PL_MEMBERS(m_iClientHealth, MEMBER_INTEGER), + PL_MEMBERS(m_iClientBattery, MEMBER_INTEGER), + PL_MEMBERS(m_iHideHUD, MEMBER_INTEGER), + PL_MEMBERS(m_iClientHideHUD, MEMBER_INTEGER), + PL_MEMBERS(m_iFOV, MEMBER_INTEGER), + PL_MEMBERS(m_iClientFOV, MEMBER_INTEGER), + PL_MEMBERS(m_iNumSpawns, MEMBER_INTEGER), + PL_MEMBERS(m_pObserver, MEMBER_CLASSPTR), + PL_MEMBERS(m_rgpPlayerItems, MEMBER_CLASSPTR), + PL_MEMBERS(m_pActiveItem, MEMBER_CLASSPTR), + PL_MEMBERS(m_pClientActiveItem, MEMBER_CLASSPTR), + PL_MEMBERS(m_pLastItem, MEMBER_CLASSPTR), + PL_MEMBERS(m_rgAmmo, MEMBER_INTEGER), // ARRAY [32] + PL_MEMBERS(m_rgAmmoLast, MEMBER_INTEGER), // ARRAY [32] + PL_MEMBERS(m_vecAutoAim, MEMBER_VECTOR), + PL_MEMBERS(m_fOnTarget, MEMBER_INTEGER), + PL_MEMBERS(m_iDeaths, MEMBER_INTEGER), + PL_MEMBERS(m_izSBarState, MEMBER_INTEGER), // ARRAY [4] + PL_MEMBERS(m_flNextSBarUpdateTime, MEMBER_FLOAT), + PL_MEMBERS(m_flStatusBarDisappearDelay, MEMBER_FLOAT), + PL_MEMBERS(m_SbarString0, MEMBER_CHAR_ARRAY), // ARRAY [128] + PL_MEMBERS(m_lastx, MEMBER_INTEGER), + PL_MEMBERS(m_lasty, MEMBER_INTEGER), + PL_MEMBERS(m_nCustomSprayFrames, MEMBER_INTEGER), + PL_MEMBERS(m_flNextDecalTime, MEMBER_FLOAT), + PL_MEMBERS(m_szTeamName, MEMBER_CHAR_ARRAY), // ARRAY [16] + PL_MEMBERS(m_modelIndexPlayer, MEMBER_INTEGER), + PL_MEMBERS(m_szAnimExtention, MEMBER_CHAR_ARRAY), // ARRAY [32] + PL_MEMBERS(m_iGaitsequence, MEMBER_INTEGER), + PL_MEMBERS(m_flGaitframe, MEMBER_FLOAT), + PL_MEMBERS(m_flGaityaw, MEMBER_FLOAT), + PL_MEMBERS(m_prevgaitorigin, MEMBER_VECTOR), + PL_MEMBERS(m_flPitch, MEMBER_FLOAT), + PL_MEMBERS(m_flYaw, MEMBER_FLOAT), + PL_MEMBERS(m_flGaitMovement, MEMBER_FLOAT), + PL_MEMBERS(m_iAutoWepSwitch, MEMBER_INTEGER), + PL_MEMBERS(m_bVGUIMenus, MEMBER_BOOL), + PL_MEMBERS(m_bShowHints, MEMBER_BOOL), + PL_MEMBERS(m_bShieldDrawn, MEMBER_BOOL), + PL_MEMBERS(m_bOwnsShield, MEMBER_BOOL), + PL_MEMBERS(m_bWasFollowing, MEMBER_BOOL), + PL_MEMBERS(m_flNextFollowTime, MEMBER_FLOAT), + PL_MEMBERS(m_flYawModifier, MEMBER_FLOAT), + PL_MEMBERS(m_blindUntilTime, MEMBER_FLOAT), + PL_MEMBERS(m_blindStartTime, MEMBER_FLOAT), + PL_MEMBERS(m_blindHoldTime, MEMBER_FLOAT), + PL_MEMBERS(m_blindFadeTime, MEMBER_FLOAT), + PL_MEMBERS(m_blindAlpha, MEMBER_INTEGER), + PL_MEMBERS(m_allowAutoFollowTime, MEMBER_FLOAT), + PL_MEMBERS(m_autoBuyString, MEMBER_CHAR_ARRAY), // ARRAY 256 + PL_MEMBERS(m_rebuyString, MEMBER_CHAR_POINTER), + PL_MEMBERS(m_rebuyStruct, MEBMER_REBUYSTRUCT), + PL_MEMBERS(m_bIsInRebuy, MEMBER_BOOL), + PL_MEMBERS(m_flLastUpdateTime, MEMBER_FLOAT), + PL_MEMBERS(m_lastLocation, MEMBER_CHAR_ARRAY), // ARRAY [32] + PL_MEMBERS(m_progressStart, MEMBER_FLOAT), + PL_MEMBERS(m_progressEnd, MEMBER_FLOAT), + PL_MEMBERS(m_bObserverAutoDirector, MEMBER_BOOL), + PL_MEMBERS(m_canSwitchObserverModes, MEMBER_BOOL), + PL_MEMBERS(m_heartBeatTime, MEMBER_FLOAT), + PL_MEMBERS(m_intenseTimestamp, MEMBER_FLOAT), + PL_MEMBERS(m_silentTimestamp, MEMBER_FLOAT), + PL_MEMBERS(m_musicState, MEMBER_INTEGER), + PL_MEMBERS(m_flLastCommandTime, MEMBER_FLOAT), // ARRAY [8] +}; + +memberlist_t memberlist; + +member_t *memberlist_t::operator[](size_t members) const +{ + #define CASE(h) case ht_##h: if (index < arraysize(memberlist_##h)) return &memberlist_##h[index]; else break; + + const auto table = members_tables_e(members / MAX_RANGE_REGION); + const auto index = members & (MAX_RANGE_REGION - 1); + + switch (table) { + CASE(gamerules) + CASE(player) + } + + return nullptr; +} diff --git a/reapi/src/member_list.h b/reapi/src/member_list.h new file mode 100644 index 0000000..050266c --- /dev/null +++ b/reapi/src/member_list.h @@ -0,0 +1,326 @@ +#pragma once + +#define BEGIN_MEMBER_REGION(x) (MAX_RANGE_REGION * memberlist_t::members_tables_e::ht_##x) + +enum enum_membertypes +{ + MEMBER_FLOAT = 0, // Any floating point value + MEMBER_DOUBLE, // double value + MEMBER_ENTITY, // An entity offset (EOFFSET) + MEMBER_CLASSPTR, // CBaseEntity * + MEMBER_EHANDLE, // Entity handle + MEMBER_EVARS, // EVARS * + MEMBER_EDICT, // edict_t *, or edict_t * (same thing) + MEMBER_VECTOR, // Any vector + MEMBER_CHAR_POINTER, // char * + MEMBER_CHAR_ARRAY, // char [] + MEMBER_INTEGER, // Any integer or enum + MEMBER_SHORT, // 2 byte integer + MEMBER_BYTE, // a byte + MEMBER_BOOL, // a bool + MEMBER_SIGNALS, // class CUnifiedSignals + MEBMER_REBUYSTRUCT, // struct RebuyStruct +}; + +struct member_t +{ + uint16 size; + uint16 max_size; + uint32 offset; + enum_membertypes type; +}; + +struct memberlist_t +{ + member_t *operator[](size_t members) const; + + enum members_tables_e + { + ht_gamerules, + ht_player + }; +}; + +extern memberlist_t memberlist; + +// CSGameRules +enum CSGameRules_Members +{ + m_bFreezePeriod = BEGIN_MEMBER_REGION(gamerules), + m_bBombDropped, + + // m_VoiceGameMgr -> CVoiceGameMgr + m_msgPlayerVoiceMask, + m_msgRequestState, + m_nMaxPlayers, + m_UpdateInterval, + + m_fTeamCount, // m_flRestartRoundTime, the global time when the round is supposed to end, if this is not 0 + m_flCheckWinConditions, + m_fRoundCount, + m_iRoundTime, // (From mp_roundtime) - How many seconds long this round is. + m_iRoundTimeSecs, + m_iIntroRoundTime, // (From mp_freezetime) - How many seconds long the intro round (when players are frozen) is. + m_fIntroRoundCount, // The global time when the intro round ends and the real one starts + // wrote the original "m_flRoundTime" comment for this variable). + m_iAccountTerrorist, + m_iAccountCT, + m_iNumTerrorist, // The number of terrorists on the team (this is generated at the end of a round) + m_iNumCT, // The number of CTs on the team (this is generated at the end of a round) + m_iNumSpawnableTerrorist, + m_iNumSpawnableCT, + m_iSpawnPointCount_Terrorist, // Number of Terrorist spawn points + m_iSpawnPointCount_CT, // Number of CT spawn points + m_iHostagesRescued, + m_iHostagesTouched, + m_iRoundWinStatus, // 1 == CT's won last round, 2 == Terrorists did, 3 == Draw, no winner + m_iNumCTWins, + m_iNumTerroristWins, + m_bTargetBombed, // whether or not the bomb has been bombed + m_bBombDefused, // whether or not the bomb has been defused + m_bMapHasBombTarget, + m_bMapHasBombZone, + m_bMapHasBuyZone, + m_bMapHasRescueZone, + m_bMapHasEscapeZone, + m_iMapHasVIPSafetyZone, // 0 = uninitialized, 1 = has VIP safety zone, 2 = DOES not have VIP safetyzone + m_bMapHasCameras, + m_iC4Timer, + m_iC4Guy, // The current Terrorist who has the C4. + m_iLoserBonus, // the amount of money the losing team gets. This scales up as they lose more rounds in a row + m_iNumConsecutiveCTLoses, // the number of rounds the CTs have lost in a row. + m_iNumConsecutiveTerroristLoses, // the number of rounds the Terrorists have lost in a row. + m_fMaxIdlePeriod, // For the idle kick functionality. This is tha max amount of time that the player has to be idle before being kicked + m_iLimitTeams, + m_bLevelInitialized, + m_bRoundTerminating, + m_bCompleteReset, // Set to TRUE to have the scores reset next time round restarts + m_flRequiredEscapeRatio, + m_iNumEscapers, + m_iHaveEscaped, + m_bCTCantBuy, + m_bTCantBuy, // Who can and can't buy. + m_flBombRadius, + m_iConsecutiveVIP, + m_iTotalGunCount, + m_iTotalGrenadeCount, + m_iTotalArmourCount, + m_iUnBalancedRounds, // keeps track of the # of consecutive rounds that have gone by where one team outnumbers the other team by more than 2 + m_iNumEscapeRounds, // keeps track of the # of consecutive rounds of escape played.. Teams will be swapped after 8 rounds + m_iMapVotes, + m_iLastPick, + m_iMaxMapTime, + m_iMaxRounds, + m_iTotalRoundsPlayed, + m_iMaxRoundsWon, + m_iStoredSpectValue, + m_flForceCameraValue, + m_flForceChaseCamValue, + m_flFadeToBlackValue, + m_pVIP, + VIPQueue, + m_flIntermissionEndTime, + m_flIntermissionStartTime, + m_iEndIntermissionButtonHit, + m_tmNextPeriodicThink, + m_bFirstConnected, + m_bInCareerGame, + m_fCareerRoundMenuTime, + m_iCareerMatchWins, + m_iRoundWinDifference, + m_fCareerMatchMenuTime, + m_bSkipSpawn +}; + +// CBasePlayer +enum CBasePlayer_Members +{ + random_seed = BEGIN_MEMBER_REGION(player), + m_usPlayerBleed, + m_hObserverTarget, + m_flNextObserverInput, + m_iObserverWeapon, + m_iObserverC4State, + m_bObserverHasDefuser, + m_iObserverLastMode, + m_flFlinchTime, + m_flAnimTime, + m_bHighDamage, + m_flVelocityModifier, + m_iLastZoom, + m_bResumeZoom, + m_flEjectBrass, + m_iKevlar, + m_bNotKilled, + m_iTeam, + m_iAccount, + m_bHasPrimary, + m_flDeathThrowTime, + m_iThrowDirection, + m_flLastTalk, + m_bJustConnected, + m_bContextHelp, + m_iJoiningState, + m_pIntroCamera, + m_fIntroCamTime, + m_fLastMovement, + m_bMissionBriefing, + m_bTeamChanged, + m_iModelName, + m_iTeamKills, + m_iIgnoreGlobalChat, + m_bHasNightVision, + m_bNightVisionOn, + m_vRecentPath, + m_flIdleCheckTime, + m_flRadioTime, + m_iRadioMessages, + m_bIgnoreRadio, + m_bHasC4, + m_bHasDefuser, + m_bKilledByBomb, + m_vBlastVector, + m_bKilledByGrenade, + //m_hintMessageQueue, + m_flDisplayHistory, + m_iMenu, + m_iChaseTarget, + m_pChaseTarget, + m_fCamSwitch, + m_bEscaped, + m_bIsVIP, + m_tmNextRadarUpdate, + m_vLastOrigin, + m_iCurrentKickVote, + m_flNextVoteTime, + m_bJustKilledTeammate, + m_iHostagesKilled, + m_iMapVote, + m_bCanShoot, + m_flLastFired, + m_flLastAttackedTeammate, + m_bHeadshotKilled, + m_bPunishedForTK, + m_bReceivesNoMoneyNextRound, + m_iTimeCheckAllowed, + m_bHasChangedName, + m_szNewName, + m_bIsDefusing, + m_tmHandleSignals, + m_signals, + m_pentCurBombTarget, + m_iPlayerSound, + m_iTargetVolume, + m_iWeaponVolume, + m_iExtraSoundTypes, + m_iWeaponFlash, + m_flStopExtraSoundTime, + m_flFlashLightTime, + m_iFlashBattery, + m_afButtonLast, + m_afButtonPressed, + m_afButtonReleased, + m_pentSndLast, + m_flSndRoomtype, + m_flSndRange, + m_flFallVelocity, + m_rgItems, + m_fNewAmmo, + m_afPhysicsFlags, + m_fNextSuicideTime, + m_flTimeStepSound, + m_flTimeWeaponIdle, + m_flSwimTime, + m_flDuckTime, + m_flWallJumpTime, + m_flSuitUpdate, + m_rgSuitPlayList, + m_iSuitPlayNext, + m_rgiSuitNoRepeat, + m_rgflSuitNoRepeatTime, + m_lastDamageAmount, + m_tbdPrev, + m_flgeigerRange, + m_flgeigerDelay, + m_igeigerRangePrev, + m_iStepLeft, + m_szTextureName, + m_chTextureType, + m_idrowndmg, + m_idrownrestored, + m_bitsHUDDamage, + m_fInitHUD, + m_fGameHUDInitialized, + m_iTrain, + m_fWeapon, + m_pTank, + m_fDeadTime, + m_fNoPlayerSound, + m_fLongJump, + m_tSneaking, + m_iUpdateTime, + m_iClientHealth, + m_iClientBattery, + m_iHideHUD, + m_iClientHideHUD, + m_iFOV, + m_iClientFOV, + m_iNumSpawns, + m_pObserver, + m_rgpPlayerItems, + m_pActiveItem, + m_pClientActiveItem, + m_pLastItem, + m_rgAmmo, + m_rgAmmoLast, + m_vecAutoAim, + m_fOnTarget, + m_iDeaths, + m_izSBarState, + m_flNextSBarUpdateTime, + m_flStatusBarDisappearDelay, + m_SbarString0, + m_lastx, + m_lasty, + m_nCustomSprayFrames, + m_flNextDecalTime, + m_szTeamName, + m_modelIndexPlayer, + m_szAnimExtention, + m_iGaitsequence, + m_flGaitframe, + m_flGaityaw, + m_prevgaitorigin, + m_flPitch, + m_flYaw, + m_flGaitMovement, + m_iAutoWepSwitch, + m_bVGUIMenus, + m_bShowHints, + m_bShieldDrawn, + m_bOwnsShield, + m_bWasFollowing, + m_flNextFollowTime, + m_flYawModifier, + m_blindUntilTime, + m_blindStartTime, + m_blindHoldTime, + m_blindFadeTime, + m_blindAlpha, + m_allowAutoFollowTime, + m_autoBuyString, + m_rebuyString, + m_rebuyStruct, + m_bIsInRebuy, + m_flLastUpdateTime, + m_lastLocation, + m_progressStart, + m_progressEnd, + m_bObserverAutoDirector, + m_canSwitchObserverModes, + m_heartBeatTime, + m_intenseTimestamp, + m_silentTimestamp, + m_musicState, + m_flLastCommandTime +}; diff --git a/reapi/src/meta_api.cpp b/reapi/src/meta_api.cpp new file mode 100644 index 0000000..52e7daa --- /dev/null +++ b/reapi/src/meta_api.cpp @@ -0,0 +1,62 @@ +#include "precompiled.h" +#include "appversion.h" + +meta_globals_t *gpMetaGlobals; +gamedll_funcs_t *gpGamedllFuncs; +mutil_funcs_t *gpMetaUtilFuncs; + +plugin_info_t Plugin_info = +{ + META_INTERFACE_VERSION, // ifvers + "ReAPI", // name + APP_VERSION_STRD, // version + APP_VERSION_YMD_STR, // date + "s1lent", // author + "https://github.com/s1lentq/reapi/", // url + "ReAPI", // logtag, all caps please + PT_ANYTIME, // (when) loadable + PT_NEVER, // (when) unloadable +}; + +extern bool OnMetaAttach(); +extern void OnMetaDetach(); + +C_DLLEXPORT int Meta_Query(char *interfaceVersion, plugin_info_t* *plinfo, mutil_funcs_t *pMetaUtilFuncs) +{ + *plinfo = &Plugin_info; + gpMetaUtilFuncs = pMetaUtilFuncs; + return TRUE; +} + +// Must provide at least one of these.. +META_FUNCTIONS gMetaFunctionTable = +{ + NULL, // pfnGetEntityAPI HL SDK; called before game DLL + NULL, // pfnGetEntityAPI_Post META; called after game DLL + NULL, // pfnGetEntityAPI2 HL SDK2; called before game DLL + GetEntityAPI2_Post, // pfnGetEntityAPI2_Post META; called after game DLL + NULL, // pfnGetNewDLLFunctions HL SDK2; called before game DLL + NULL, // pfnGetNewDLLFunctions_Post META; called after game DLL + NULL, // pfnGetEngineFunctions META; called before HL engine + NULL, // pfnGetEngineFunctions_Post META; called after HL engine +}; + +C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs) +{ + gpMetaGlobals = pMGlobals; + gpGamedllFuncs = pGamedllFuncs; + + if (!OnMetaAttach()) + { + return FALSE; + } + + memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS)); + return TRUE; +} + +C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason) +{ + OnMetaDetach(); + return TRUE; +} diff --git a/reapi/src/mod_regamedll_api.cpp b/reapi/src/mod_regamedll_api.cpp new file mode 100644 index 0000000..f00c2df --- /dev/null +++ b/reapi/src/mod_regamedll_api.cpp @@ -0,0 +1,58 @@ +#include "precompiled.h" + +IReGameApi *g_ReGameApi; +const ReGameFuncs_t *g_ReGameFuncs; +IReGameHookchains *g_ReGameHookchains; +CHalfLifeMultiplay **g_pCSGameRules = nullptr; + +bool RegamedllApi_Init() +{ + const char *szGameDLLModule = GET_GAME_INFO(PLID, GINFO_REALDLL_FULLPATH); + + if (szGameDLLModule == NULL) + { + return false; + } + + CSysModule *gameModule = Sys_LoadModule(szGameDLLModule); + + if (!gameModule) + { + return false; + } + + CreateInterfaceFn ifaceFactory = Sys_GetFactory(gameModule); + if (!ifaceFactory) + { + return false; + } + + int retCode = 0; + g_ReGameApi = (IReGameApi *)ifaceFactory(VRE_GAMEDLL_API_VERSION, &retCode); + + if (!g_ReGameApi) + { + return false; + } + + int majorVersion = g_ReGameApi->GetMajorVersion(); + int minorVersion = g_ReGameApi->GetMinorVersion(); + + if (majorVersion != REGAMEDLL_API_VERSION_MAJOR) + { + UTIL_LogPrintf("[%s]: ReGameDLL Api major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MAJOR, majorVersion); + return false; + } + + if (minorVersion < REGAMEDLL_API_VERSION_MINOR) + { + UTIL_LogPrintf("[%s]: ReGameDLL Api minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MINOR, minorVersion); + return false; + } + + g_ReGameFuncs = g_ReGameApi->GetFuncs(); + g_ReGameHookchains = g_ReGameApi->GetHookchains(); + g_pCSGameRules = (CHalfLifeMultiplay **)g_ReGameApi->GetGameData()->GetGameRules(); + + return true; +} \ No newline at end of file diff --git a/reapi/src/mod_regamedll_api.h b/reapi/src/mod_regamedll_api.h new file mode 100644 index 0000000..3b8ef09 --- /dev/null +++ b/reapi/src/mod_regamedll_api.h @@ -0,0 +1,8 @@ +#pragma once + +extern IReGameApi *g_ReGameApi; +extern const ReGameFuncs_t *g_ReGameFuncs; +extern IReGameHookchains *g_ReGameHookchains; +extern CHalfLifeMultiplay **g_pCSGameRules; + +extern bool RegamedllApi_Init(); diff --git a/reapi/src/mod_rehlds_api.cpp b/reapi/src/mod_rehlds_api.cpp new file mode 100644 index 0000000..e363600 --- /dev/null +++ b/reapi/src/mod_rehlds_api.cpp @@ -0,0 +1,55 @@ +#include "precompiled.h" + +IRehldsApi* g_RehldsApi; +const RehldsFuncs_t* g_RehldsFuncs; +IRehldsHookchains* g_RehldsHookchains; +IRehldsServerStatic* g_RehldsSvs; + +bool RehldsApi_Init() +{ +#ifdef WIN32 + CSysModule* engineModule = Sys_LoadModule("swds.dll"); +#else + CSysModule* engineModule = Sys_LoadModule("engine_i486.so"); +#endif + + if (!engineModule) + { + return false; + } + + CreateInterfaceFn ifaceFactory = Sys_GetFactory(engineModule); + if (!ifaceFactory) + { + return false; + } + + int retCode = 0; + g_RehldsApi = (IRehldsApi*)ifaceFactory(VREHLDS_HLDS_API_VERSION, &retCode); + + if (!g_RehldsApi) + { + return false; + } + + int majorVersion = g_RehldsApi->GetMajorVersion(); + int minorVersion = g_RehldsApi->GetMinorVersion(); + + if (majorVersion != REHLDS_API_VERSION_MAJOR) + { + UTIL_LogPrintf("[%s]: ReHLDS Api major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MAJOR, majorVersion); + return false; + } + + if (minorVersion < REHLDS_API_VERSION_MINOR) + { + UTIL_LogPrintf("[%s]: ReHLDS Api minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MINOR, minorVersion); + return false; + } + + g_RehldsFuncs = g_RehldsApi->GetFuncs(); + g_RehldsHookchains = g_RehldsApi->GetHookchains(); + g_RehldsSvs = g_RehldsApi->GetServerStatic(); + + return true; +} diff --git a/reapi/src/mod_rehlds_api.h b/reapi/src/mod_rehlds_api.h new file mode 100644 index 0000000..a2bbfc7 --- /dev/null +++ b/reapi/src/mod_rehlds_api.h @@ -0,0 +1,8 @@ +#pragma once + +extern IRehldsApi* g_RehldsApi; +extern const RehldsFuncs_t* g_RehldsFuncs; +extern IRehldsHookchains* g_RehldsHookchains; +extern IRehldsServerStatic* g_RehldsSvs; + +extern bool RehldsApi_Init(); \ No newline at end of file diff --git a/reapi/src/natives.cpp b/reapi/src/natives.cpp new file mode 100644 index 0000000..5fbc443 --- /dev/null +++ b/reapi/src/natives.cpp @@ -0,0 +1,169 @@ +#include "precompiled.h" + +/* + * Hook API function that are available into enum + * Look at the enum's for parameter lists. + * + * @param function The function to hook. + * @param callback The forward to call. + * @param post Whether or not to forward this in post. + * @return Returns a handle to the hook. Use EnableHookChain/DisableHookChain to toggle the forward on or off. + * + * native RegisterHookChain(any:function_id, const callback[], post = 0); + */ + +static cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_func, arg_handler, arg_post }; + + int func = params[arg_func]; + int post = params[arg_post]; + + if (hooklist[func] == nullptr) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Function (%d) doesn't match hook definition.", func); + return 0; + } + + if (!hooklist[func]->availableFunc()) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Function (%s) is not available, required %s", hooklist[func]->func_name, hooklist[func]->depend_name); + return 0; + } + + int funcid, len; + const char *funcname = g_amxxapi.GetAmxString(amx, params[arg_handler], 0, &len); + if (g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Public function \"%s\" not found.", funcname); + return 0; + } + + int fwid = hooklist[func]->registerForward(amx, funcname); + if (fwid == -1) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Public function \"%s\" not found.", funcname); + return 0; + } + + return (cell)g_hookManager.addHandler(func, fwid, post != 0); +} + +/* + * Starts a hook back up. + * Use the return value from RegisterHookChain as the parameter here! + * + * @param fwd The hook to re-enable. + * @return Returns if the function is successful executed true otherwise false + * + * native bool:EnableHookChain(any:fwd); + */ + +static cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_handle_hook }; + + CHook *hook = reinterpret_cast(params[arg_handle_hook]); + + if (hook == nullptr) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid HookChain handle."); + return 0; + } + + hook->m_state = FSTATE_OK; + return 1; +} + +/* + * Stops a hook from triggering. + * Use the return value from RegisterHookChain as the parameter here! + * + * @param fwd The hook to stop. + * + * native bool:DisableHookChain(any:fwd); + */ + +static cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params) +{ + enum args_e { arg_count, arg_handle_hook }; + + CHook *hook = reinterpret_cast(params[arg_handle_hook]); + + if (hook == nullptr) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid HookChain handle."); + return 0; + } + + hook->m_state = FSTATE_STOP; + return 1; +} + +/* + * Sets the return value of a hookchain. + * This needs to be used in conjunction with RH_OVERRIDE or RH_SUPERCEDE. + * + * @param type To specify the type RHV_*, look at the enum HookChainReturn + * @param value The value to set the return to. + * + * native SetHookChainReturn(HookChainReturn:type, any:...); + */ + +static cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params) +{ + if (!g_currentHookChain) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Trying get return value without active hook."); + return 0; + } + + enum args_e { arg_count, arg_type, arg_value }; + + switch (params[arg_type]) + { + case RHV_STRING: + { + if (g_currentHookChain->m_data.m_string != NULL) { + delete [] g_currentHookChain->m_data.m_string; + } + + int len; + char *dest = g_amxxapi.GetAmxString(amx, params[arg_value], 0, &len); + g_currentHookChain->m_data.m_string = new char [len + 1]; + strcpy(g_currentHookChain->m_data.m_string, dest); + break; + } + case RHV_FLOAT: + g_currentHookChain->m_data.m_float = *(float *)g_amxxapi.GetAmxAddr(amx, params[arg_value]); + break; + case RHV_INTEGER: + g_currentHookChain->m_data.m_interger = *g_amxxapi.GetAmxAddr(amx, params[arg_value]); + break; + case RHV_CLASSPTR: + g_currentHookChain->m_data.m_classptr = CBaseEntity::Instance(INDEXENT(*g_amxxapi.GetAmxAddr(amx, params[arg_value]))); + break; + default: + return 0; + } + + return 1; +} + +AMX_NATIVE_INFO Func_Natives[] = +{ + { "RegisterHookChain", RegisterHookChain }, + + { "EnableHookChain", EnableHookChain }, + { "DisableHookChain", DisableHookChain }, + + { "SetHookChainReturn", SetHookChainReturn }, + + { nullptr, nullptr } +}; + +void RegisterNatives() +{ + g_amxxapi.AddNatives(Func_Natives); + g_amxxapi.AddNatives(Member_Natives); +} diff --git a/reapi/src/natives.h b/reapi/src/natives.h new file mode 100644 index 0000000..ca270c5 --- /dev/null +++ b/reapi/src/natives.h @@ -0,0 +1,9 @@ +#pragma once + +#define PARAMS_COUNT (params[0] / sizeof(cell)) +#define PARAMS_REQUIRE(x) if (params[0] != x * sizeof(cell)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameters count in %s", __FUNCTION__); return nullptr; } +#define NATIVE_MEMBER_REQUIRE(a,x) if (!api_cfg.has##x()) { MF_LogError(amx, AMX_ERR_NATIVE, "Member (%s) is not available, required %s", memberlist[a]->member_name, #x); return 0; } + +extern AMX_NATIVE_INFO Member_Natives[]; + +void RegisterNatives(); diff --git a/reapi/src/natives_member.cpp b/reapi/src/natives_member.cpp new file mode 100644 index 0000000..e237957 --- /dev/null +++ b/reapi/src/natives_member.cpp @@ -0,0 +1,378 @@ +#include "precompiled.h" + +// native set_member(_index, any:_member, any:...); +static cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params) +{ + enum args_member_e { arg_count, arg_index, arg_member, arg_value, arg_elem }; + member_t *member = memberlist[params[arg_member]]; + + if (member == nullptr) { + MF_LogError(amx, AMX_ERR_NATIVE, "Member (%d) is unknown", params[arg_member]); + return 0; + } + + edict_t *pEdict = INDEXENT(params[arg_index]); + if (pEdict == nullptr || pEdict->pvPrivateData == nullptr) { + return 0; + } + + size_t value = *g_amxxapi.GetAmxAddr(amx, params[arg_value]); + size_t element = *g_amxxapi.GetAmxAddr(amx, params[arg_elem]); + + switch (member->type) + { + case MEMBER_ENTITY: + return -1; + case MEMBER_CLASSPTR: + { + // native set_member(_index, any:_member, _value, _elem); + CBaseEntity *pEntity = nullptr; + edict_t *pEdictValue = INDEXENT(value); + + if (pEdictValue != nullptr) { + pEntity = CBaseEntity::Instance(pEdictValue); + } + set_member(pEdict, member->offset, pEntity, element); + return 1; + } + case MEMBER_EHANDLE: + { + // native set_member(_index, any:_member, _value, _elem); + EHANDLE ehandle = get_member(pEdict, member->offset, element); + edict_t *pEdictValue = INDEXENT(value); + ehandle.Set(pEdictValue); + return 1; + } + case MEMBER_EVARS: + return -1; + case MEMBER_EDICT: + { + // native set_member(_index, any:_member, _value, _elem); + edict_t *pEdictValue = INDEXENT(value); + set_member(pEdict, member->offset, pEdictValue, element); + return 1; + } + case MEMBER_VECTOR: + { + // native set_member(_index, any:_member, Float:_value[3], _elem); + cell *pSource = g_amxxapi.GetAmxAddr(amx, params[arg_value]); + Vector vecDest; + vecDest.x = *(vec_t *)&pSource[0]; + vecDest.y = *(vec_t *)&pSource[1]; + vecDest.z = *(vec_t *)&pSource[2]; + + set_member(pEdict, member->offset, vecDest, element); + return 1; + } + case MEMBER_CHAR_ARRAY: + { + // native set_member(_index, any:_member, const source[]); + int len; + char *source = g_amxxapi.GetAmxString(amx, params[arg_value], 0, &len); + char *dest = get_member_direct(pEdict, member->offset); + strcpy(dest, source); + return 1; + } + case MEMBER_CHAR_POINTER: + { + // native set_member(_index, any:_member, const source[]); + int len; + char *source = g_amxxapi.GetAmxString(amx, params[arg_value], 0, &len); + char *dest = get_member(pEdict, member->offset); + + if (dest != nullptr) { + delete [] dest; + } + + dest = new char[len + 1]; + strcpy(dest, source); + + set_member(pEdict, member->offset, dest); + return 1; + } + case MEMBER_FLOAT: + case MEMBER_INTEGER: + { + // native set_member(_index, any:_member, any:_value, _elem); + set_member(pEdict, member->offset, value, element); + return 1; + } + case MEMBER_SHORT: + { + // native set_member(_index, any:_member, _value, _elem); + set_member(pEdict, member->offset, value, element); + return 1; + } + case MEMBER_BYTE: + { + // native set_member(_index, any:_member, _value, _elem); + set_member(pEdict, member->offset, value, element); + return 1; + } + case MEMBER_BOOL: + { + // native set_member(_index, any:_member, bool:_value, _elem); + set_member(pEdict, member->offset, value != 0, element); + return 1; + } + case MEMBER_SIGNALS: + { + // native set_member(_index, any:_member, _value); + CUnifiedSignals signal = get_member(pEdict, member->offset, element); + signal.Signal(value); + return 1; + } + case MEBMER_REBUYSTRUCT: + return -1; + } + + return 0; +} + +// native any:get_member(_index = 0, any:_member, any:...); +static cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params) +{ + enum args_member_e { arg_count, arg_index, arg_member, arg_elem }; + member_t *member = memberlist[params[arg_member]]; + + if (member == nullptr) { + MF_LogError(amx, AMX_ERR_NATIVE, "Member (%d) is unknown", params[arg_member]); + return 0; + } + + edict_t *pEdict = INDEXENT(params[arg_index]); + + if (pEdict == nullptr || pEdict->pvPrivateData == nullptr) { + return 0; + } + + size_t element = *g_amxxapi.GetAmxAddr(amx, params[arg_elem]); + + switch (member->type) + { + case MEMBER_ENTITY: + return -1; + case MEMBER_CLASSPTR: + // native any:get_member(_index, any:_member, element); + return get_member(pEdict, member->offset, element)->entindex(); + case MEMBER_EHANDLE: + { + // native any:get_member(_index, any:_member, element); + EHANDLE ehandle = get_member(pEdict, member->offset, element); + edict_t *pEntity = ehandle.Get(); + if (pEntity != nullptr) { + return ((CBaseEntity *)ehandle)->entindex(); + } + return 0; + } + case MEMBER_EVARS: + return -1; + case MEMBER_EDICT: + { + // native any:get_member(_index, any:_member, element); + edict_t *pEntity = get_member(pEdict, member->offset, element); + if (pEntity != nullptr) { + return ENTINDEX(pEntity); + } + + return 0; + } + case MEMBER_VECTOR: + { + // native any:get_member(_index, any:_member, any:output[], element); + cell *pOutput = g_amxxapi.GetAmxAddr(amx, params[3]); + Vector vecDest = get_member(pEdict, member->offset, *g_amxxapi.GetAmxAddr(amx, params[4])); + + pOutput[0] = *(cell *)&vecDest.x; + pOutput[1] = *(cell *)&vecDest.y; + pOutput[2] = *(cell *)&vecDest.z; + + return 1; + } + case MEMBER_CHAR_ARRAY: + { + // native any:get_member(_index, any:_member, any:output[], maxlength); + char *dest = get_member_direct(pEdict, member->offset); + g_amxxapi.SetAmxString(amx, params[3], dest, *g_amxxapi.GetAmxAddr(amx, params[4])); + return 1; + } + case MEMBER_CHAR_POINTER: + { + // native any:get_member(_index, any:_member, any:output[], maxlength); + char *dest = get_member(pEdict, member->offset); + if (dest != nullptr) { + g_amxxapi.SetAmxString(amx, params[3], dest, *g_amxxapi.GetAmxAddr(amx, params[4])); + return 1; + } + return 0; + } + case MEMBER_FLOAT: + case MEMBER_INTEGER: + { + // native any:get_member(_index, any:_member, element); + return get_member(pEdict, member->offset, element); + } + case MEMBER_SHORT: + // native any:get_member(_index, any:_member, element); + return get_member(pEdict, member->offset, element); + case MEMBER_BYTE: + // native any:get_member(_index, any:_member, element); + return get_member(pEdict, member->offset, element); + case MEMBER_BOOL: + // native any:get_member(_index, any:_member, element); + return get_member(pEdict, member->offset, element); + case MEMBER_SIGNALS: + { + // native any:get_member(_index, any:_member, &_signal = 0, &_state = 0); + CUnifiedSignals signal = get_member(pEdict, member->offset); + cell *pSignal = g_amxxapi.GetAmxAddr(amx, params[3]); + cell *pState = g_amxxapi.GetAmxAddr(amx, params[4]); + + *pSignal = signal.GetSignal(); + *pState = signal.GetState(); + + return 1; + } + case MEBMER_REBUYSTRUCT: + return -1; + } + + return 0; +} + +// native set_member_game(any:_member, any:...); +static cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params) +{ + enum args_member_e { arg_count, arg_member, arg_value, arg_elem }; + member_t *member = memberlist[params[arg_member]]; + + if (member == nullptr) { + MF_LogError(amx, AMX_ERR_NATIVE, "Member (%d) is unknown", params[arg_member]); + return 0; + } + + size_t value = *g_amxxapi.GetAmxAddr(amx, params[arg_value]); + size_t element = *g_amxxapi.GetAmxAddr(amx, params[arg_elem]); + + switch (member->type) + { + case MEMBER_ENTITY: + case MEMBER_EHANDLE: + case MEMBER_EVARS: + case MEMBER_EDICT: + case MEMBER_VECTOR: + case MEMBER_CHAR_ARRAY: + case MEMBER_CHAR_POINTER: + case MEMBER_BYTE: + case MEMBER_SIGNALS: + case MEBMER_REBUYSTRUCT: + return -1; + case MEMBER_CLASSPTR: + { + // native set_member_game(any:_member, _value, _elem); + CBaseEntity *pEntity = NULL; + edict_t *pEdictValue = INDEXENT(value); + + if (pEdictValue != nullptr) { + pEntity = CBaseEntity::Instance(pEdictValue); + } + set_member((*g_pCSGameRules), member->offset, pEntity, element); + return 1; + } + case MEMBER_FLOAT: + case MEMBER_INTEGER: + { + // native set_member_game(any:_member, any:_value, _elem); + set_member((*g_pCSGameRules), member->offset, value, element); + return 1; + } + case MEMBER_SHORT: + { + // native set_member_game(any:_member, _value, _elem); + set_member((*g_pCSGameRules), member->offset, value, element); + return 1; + } + case MEMBER_BOOL: + { + // native set_member_game(any:_member, bool:_value, _elem); + set_member((*g_pCSGameRules), member->offset, value != 0, element); + return 1; + } + case MEMBER_DOUBLE: + { + // native set_member_game(any:_member, _value); + set_member((*g_pCSGameRules), member->offset, value); + return 1; + } + } + + return 0; +} + +// native get_member_game(any:_member, any:...); +static cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params) +{ + enum args_member_e { arg_count, arg_member, arg_elem }; + member_t *member = memberlist[params[arg_member]]; + + if (member == nullptr) { + MF_LogError(amx, AMX_ERR_NATIVE, "Member (%d) is unknown", params[arg_member]); + return 0; + } + + size_t element = *g_amxxapi.GetAmxAddr(amx, params[arg_elem]); + + switch (member->type) + { + case MEMBER_ENTITY: + case MEMBER_EHANDLE: + case MEMBER_EVARS: + case MEMBER_EDICT: + case MEMBER_VECTOR: + case MEMBER_CHAR_ARRAY: + case MEMBER_CHAR_POINTER: + case MEMBER_BYTE: + case MEMBER_SIGNALS: + case MEBMER_REBUYSTRUCT: + return -1; + case MEMBER_CLASSPTR: + // native any:get_member_game(any:_member, element); + return get_member((*g_pCSGameRules), member->offset, element)->entindex(); + case MEMBER_FLOAT: + case MEMBER_INTEGER: + { + // native any:get_member_game(any:_member, element); + // members for m_VoiceGameMgr + if (params[arg_member] >= m_msgPlayerVoiceMask && params[arg_member] <= m_nMaxPlayers) { + return get_member(&((*g_pCSGameRules)->m_VoiceGameMgr), member->offset); + } + (*g_pCSGameRules)->m_iMapVotes[5] = 1337; + return get_member((*g_pCSGameRules), member->offset, element); + } + case MEMBER_SHORT: + // native any:get_member_game(any:_member); + return get_member((*g_pCSGameRules), member->offset); + case MEMBER_BOOL: + // native any:get_member_game(any:_member); + return get_member((*g_pCSGameRules), member->offset); + case MEMBER_DOUBLE: + { + // native get_member_game(any:_member, _value); + float flRet = (float)get_member(&((*g_pCSGameRules)->m_VoiceGameMgr), member->offset); + return *(cell *)&flRet; + } + } + + return 0; +} + +AMX_NATIVE_INFO Member_Natives[] = +{ + { "set_member", set_member }, + { "get_member", get_member }, + + { "set_member_game", set_member_game }, + { "get_member_game", get_member_game }, + + { nullptr, nullptr } +}; diff --git a/reapi/src/precompiled.cpp b/reapi/src/precompiled.cpp new file mode 100644 index 0000000..5f656a4 --- /dev/null +++ b/reapi/src/precompiled.cpp @@ -0,0 +1 @@ +#include "precompiled.h" diff --git a/reapi/src/precompiled.h b/reapi/src/precompiled.h new file mode 100644 index 0000000..0195ded --- /dev/null +++ b/reapi/src/precompiled.h @@ -0,0 +1,38 @@ +#pragma once + +#include +#include +#include +#include +#include +#include // for strncpy(), etc + +#include // std::vector + +#include +#include + +#include "osdep.h" // win32 vsnprintf, etc +#include "sdk_util.h" + +#include +#include +#include "amxxmodule.h" +#include "osconfig.h" + +// gamedll +#include "gamerules.h" + +// regamedll API +#include "regamedll_api.h" +#include "mod_regamedll_api.h" + +// rehlds API +#include "rehlds_api.h" +#include "mod_rehlds_api.h" + +#include "api_config.h" +#include "hook_manager.h" +#include "hook_callback.h" +#include "member_list.h" +#include "natives.h" diff --git a/reapi/src/reapi_const.inc b/reapi/src/reapi_const.inc new file mode 100644 index 0000000..16c7a3b --- /dev/null +++ b/reapi/src/reapi_const.inc @@ -0,0 +1,8 @@ +#if defined _reapi_const_included + #endinput +#endif +#define _reapi_const_included + +// reapi version +#define REAPI_VERISON_MAJOR 1 +#define REAPI_VERISON_MINOR 0 diff --git a/reapi/src/reapi_utils.h b/reapi/src/reapi_utils.h new file mode 100644 index 0000000..7523b4a --- /dev/null +++ b/reapi/src/reapi_utils.h @@ -0,0 +1,50 @@ +#pragma once + +template +char(&ArraySizeHelper(T(&array)[N]))[N]; +#define arraysize(array) (sizeof(ArraySizeHelper(array))) + +// HLTypeConversion.h -> AMXModX +template +inline T &ref_member(void *ptr, int offset, int element = 0) +{ + return *reinterpret_cast((reinterpret_cast(ptr) + offset + (element * sizeof(T)))); +} + +template +inline T &get_member(void *ptr, int offset, int element = 0) +{ + return ref_member(ptr, offset, element); +} + +template +inline T &get_member(edict_t *pEntity, int offset, int element = 0) +{ + return get_member(pEntity->pvPrivateData, offset, element); +} + +template +inline void set_member(void *ptr, int offset, T value, int element = 0) +{ + ref_member(ptr, offset, element) = value; +} + +template +inline void set_member(edict_t *pEntity, int offset, T value, int element = 0) +{ + set_member(pEntity->pvPrivateData, offset, value, element); +} + +template +inline T get_member_direct(void *ptr, int offset, int element = 0, int size = 0) +{ + return reinterpret_cast(reinterpret_cast(ptr) + offset + (element * size)); +} + +template +inline T get_member_direct(edict_t *pEntity, int offset, int element = 0, int size = 0) +{ + return get_member_direct(pEntity->pvPrivateData, offset, element, size); +} + +extern void __declspec(noreturn) UTIL_SysError(const char *fmt, ...); diff --git a/reapi/src/sdk_util.cpp b/reapi/src/sdk_util.cpp new file mode 100644 index 0000000..35fbece --- /dev/null +++ b/reapi/src/sdk_util.cpp @@ -0,0 +1,42 @@ +#include "precompiled.h" + +void __declspec(noreturn) UTIL_SysError(const char *fmt, ...) +{ + va_list argptr; + static char string[8192]; + + va_start(argptr, fmt); + vsnprintf(string, sizeof(string), fmt, argptr); + va_end(argptr); + + printf("%s\n", string); + + //TerminateProcess(GetCurrentProcess(), 1); + + *((int *)NULL) = 0; + while (true); +} + +char *UTIL_VarArgs(char *format, ...) +{ + va_list argptr; + static char string[1024]; + + va_start(argptr, format); + vsprintf(string, format, argptr); + va_end(argptr); + + return string; +} + +void UTIL_LogPrintf(const char *fmt, ...) +{ + va_list argptr; + static char string[1024]; + + va_start(argptr, fmt); + vsprintf(string, fmt, argptr); + va_end(argptr); + + ALERT(at_logged, "%s", string); +} diff --git a/reapi/version/appversion.vm b/reapi/version/appversion.vm new file mode 100644 index 0000000..d3b49a0 --- /dev/null +++ b/reapi/version/appversion.vm @@ -0,0 +1,27 @@ +#ifndef __APPVERSION_H__ +\#define __APPVERSION_H__ + +// +// This file is generated automatically. +// Don't edit it. +// + +// Version defines +\#define VERSION_MAJOR ${verInfo.majorVersion} +\#define VERSION_MINOR ${verInfo.minorVersion} + +\#define APP_VERSION_D ${verInfo.format('.', '-', true)} +\#define APP_VERSION_C ${verInfo.majorVersion},${verInfo.minorVersion},0,${verInfo.countCommit} + +\#define APP_VERSION_STRD "${verInfo.majorVersion}.${verInfo.minorVersion}.${verInfo.countCommit}${formatSpecialVersion}" +\#define APP_VERSION_STRD_RC "${verInfo.majorVersion}.${verInfo.minorVersion}.${verInfo.countCommit}${formatSpecialVersion}" + +\#define APP_VERSION_FLAGS ${appFlags} +\#define APP_VERSION_SPECIALBUILD "${verInfo.specialVersion}" + +#set ( $commitYMD = $_DateTimeFormat.forPattern('yyyy-MM-dd').print($verInfo.lastCommitDate) ) + +\#define APP_VERSION_YMD_STR "${commitYMD}" +\#define APP_VERSION APP_VERSION_STRD + +#endif //__APPVERSION_H__ diff --git a/reapi/version/version.cpp b/reapi/version/version.cpp new file mode 100644 index 0000000..5089a5f --- /dev/null +++ b/reapi/version/version.cpp @@ -0,0 +1,10 @@ +/* +* Version declaration dependency file +* +*/ + +// +// This file needed just to add the dependency and appversion.h +// +#include "precompiled.h" + diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e55fc2b --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'reapi' +include 'reapi' diff --git a/shared.gradle b/shared.gradle new file mode 100644 index 0000000..cc61691 --- /dev/null +++ b/shared.gradle @@ -0,0 +1,33 @@ +import org.doomedsociety.gradlecpp.cfg.BinaryKind +import org.doomedsociety.gradlecpp.toolchain.icc.Icc +import org.gradle.nativeplatform.NativeBinarySpec +import org.gradle.nativeplatform.NativeExecutableBinarySpec +import org.gradle.nativeplatform.SharedLibraryBinarySpec +import org.gradle.nativeplatform.StaticLibraryBinarySpec +import org.gradle.nativeplatform.toolchain.VisualCpp + +apply from: 'shared_msvc.gradle' +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}") + } + + 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}") + } +} diff --git a/shared_icc.gradle b/shared_icc.gradle new file mode 100644 index 0000000..9fb7e9d --- /dev/null +++ b/shared_icc.gradle @@ -0,0 +1,66 @@ +import org.doomedsociety.gradlecpp.cfg.BinaryKind +import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig +import org.doomedsociety.gradlecpp.gcc.OptimizationLevel + +rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind -> + GccToolchainConfig cfg + if (release) { + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.LEVEL_3, + stackProtector: false, + interProceduralOptimizations: true, + noBuiltIn: true, + intelExtensions: false, + asmBlocks: true, + positionIndependentCode: false, + + extraDefines: [ + 'linux': null, + '__linux__': null, + 'NDEBUG': null + ] + ), + + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: true, + stripSymbolTable: true, + staticLibGcc: true, + staticIntel: true, + ), + + librarianOptions: new GccToolchainConfig.LibrarianOptions( + ) + ) + } else { + //debug + cfg = new GccToolchainConfig( + compilerOptions: new GccToolchainConfig.CompilerOptions( + optimizationLevel: OptimizationLevel.DISABLE, + stackProtector: true, + interProceduralOptimizations: false, + noBuiltIn: true, + intelExtensions: false, + asmBlocks: true, + + extraDefines: [ + 'linux': null, + '__linux__': null, + 'NDEBUG': null + ] + ), + + linkerOptions: new GccToolchainConfig.LinkerOptions( + interProceduralOptimizations: false, + stripSymbolTable: false, + staticLibGcc: true, + staticIntel: true, + ), + + librarianOptions: new GccToolchainConfig.LibrarianOptions( + ) + ) + } + + return cfg; +} diff --git a/shared_msvc.gradle b/shared_msvc.gradle new file mode 100644 index 0000000..254b63b --- /dev/null +++ b/shared_msvc.gradle @@ -0,0 +1,125 @@ +import org.doomedsociety.gradlecpp.cfg.BinaryKind +import org.doomedsociety.gradlecpp.msvc.CallingConvention +import org.doomedsociety.gradlecpp.msvc.CodeGenerationKind +import org.doomedsociety.gradlecpp.msvc.CppExceptions +import org.doomedsociety.gradlecpp.msvc.DebugInfoFormat +import org.doomedsociety.gradlecpp.msvc.EnhancedInstructionsSet +import org.doomedsociety.gradlecpp.msvc.ErrorReporting +import org.doomedsociety.gradlecpp.msvc.FloatingPointModel +import org.doomedsociety.gradlecpp.msvc.LinkTimeCodeGenKind +import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig +import org.doomedsociety.gradlecpp.msvc.OptimizationLevel +import org.doomedsociety.gradlecpp.msvc.RuntimeChecks +import org.doomedsociety.gradlecpp.msvc.WarningLevel + +rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind -> + MsvcToolchainConfig cfg + if (release) { + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED, + optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.DISABLED, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, + + enableMinimalRebuild: false, + omitFramePointers: true, + wholeProgramOptimization: true, + enabledFunctionLevelLinking: true, + enableSecurityCheck: false, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, + + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + 'NDEBUG': null, + 'NOMINMAX': null + ] + ), + + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, + + enableIncrementalLinking: false, + eliminateUnusedRefs: true, + enableCOMDATFolding: true, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true + ), + + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), + + generatePdb: true + ) + } else { + //debug + cfg = new MsvcToolchainConfig( + compilerOptions: new MsvcToolchainConfig.CompilerOptions( + codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, + optimizationLevel: OptimizationLevel.DISABLED, + debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, + runtimeChecks: RuntimeChecks.DEFAULT, + cppExceptions: CppExceptions.ENABLED_WITH_SEH, + warningLevel: WarningLevel.LEVEL_3, + callingConvention: CallingConvention.CDECL, + enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, + floatingPointModel: FloatingPointModel.FAST, + + enableMinimalRebuild: true, + omitFramePointers: false, + wholeProgramOptimization: false, + enabledFunctionLevelLinking: true, + enableSecurityCheck: true, + analyzeCode: false, + sdlChecks: false, + treatWarningsAsErrors: false, + treatWchartAsBuiltin: true, + forceConformanceInForLoopScope: true, + + extraDefines: [ + 'WIN32': null, + '_MBCS': null, + '_DEBUG': null, + 'NOMINMAX': null, + ] + ), + + linkerOptions: new MsvcToolchainConfig.LinkerOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, + errorReportingMode: ErrorReporting.NO_ERROR_REPORT, + + enableIncrementalLinking: true, + eliminateUnusedRefs: false, + enableCOMDATFolding: false, + generateDebugInfo: true, + dataExecutionPrevention: true, + randomizedBaseAddress: true + ), + + librarianOptions: new MsvcToolchainConfig.LibrarianOptions( + linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG + ), + + generatePdb: true + ) + + if (binKind == BinaryKind.STATIC_LIBRARY) { + cfg.compilerConfig.extraDefines['_LIB'] = null + } + } + + return cfg +}