diff --git a/.gitignore b/.gitignore index 75af3bbf..8692a2f5 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,5 @@ Thumbs.db # AMXX plugin build related files plugins/compile.dat plugins/compiled/ + +build_deps/ diff --git a/.travis.yml b/.travis.yml index 0237f218..5dfce31c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ addons: - linux-libc-dev - gcc-multilib - g++-multilib + - nasm sources: - llvm-toolchain-precise-3.7 - ubuntu-toolchain-r-test @@ -23,4 +24,4 @@ script: - mkdir build && cd build - PATH="~/.local/bin:$PATH" - CC=clang-3.7 CXX=clang-3.7 python ../configure.py --enable-optimize - - ambuild \ No newline at end of file + - ambuild diff --git a/AMBuildScript b/AMBuildScript index 7c4388bf..12f361ed 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -20,6 +20,7 @@ class AMXXConfig(object): self.utf8rewind = None self.csx_app = None self.stdcxx_path = None + self.nasm_path = None def use_auto_versioning(self): if builder.backend != 'amb2': @@ -105,6 +106,31 @@ class AMXXConfig(object): if not self.mysql_path: raise Exception('Could not find MySQL! Try passing --mysql to configure.py.') + def detectNASM(self): + import subprocess + + nasm_paths = [ + getattr(builder.options, 'nasm_path', 'nasm'), + ] + if builder.target_platform == 'windows': + nasm_paths += [os.path.join( + builder.sourcePath, + 'build_deps', + 'nasm', + 'nasm.exe') + ] + + for nasm_path in nasm_paths: + try: + subprocess.check_output([nasm_path, '-v']) + self.nasm_path = nasm_path + break + except: + pass + + if self.nasm_path is None: + raise Exception('Could not find a suitable path for nasm') + # Returns list of lines of output from the compiler @staticmethod def invokeCompiler(args): @@ -369,11 +395,42 @@ class AMXXConfig(object): binary = context.compiler.Program(name) return self.AddVersioning(binary) + def AddAssembly(self, context, binary, input_file, output_file, includes=[], extra_argv=[]): + if builder.target_platform == 'windows': + obj_type = 'win32' + elif builder.target_platform == 'linux': + obj_type = 'elf32' + elif builder.target_platform == 'mac': + obj_type = 'macho32' + + input_path = os.path.join(context.currentSourcePath, input_file) + output_path = output_file + + argv = [ + self.nasm_path, + '-I{0}{1}'.format(context.currentSourcePath, os.sep), + input_path, + '-f', obj_type, + '-o', output_path, + ] + extra_argv + + extra_includes = [] + for include_file in includes: + extra_includes.append(os.path.join(context.currentSourcePath, include_file)) + + cmd_node, output_nodes = context.AddCommand( + inputs = [input_path] + extra_includes, + argv = argv, + outputs = [output_path]) + + binary.compiler.linkflags += [output_nodes[0]] + AMXX = AMXXConfig() AMXX.detectProductVersion() AMXX.detectMetamod() AMXX.detectHlsdk() AMXX.detectMysql() +AMXX.detectNASM() AMXX.configure() if AMXX.use_auto_versioning(): diff --git a/amxmodx/AMBuilder b/amxmodx/AMBuilder index 92da4709..815271f7 100644 --- a/amxmodx/AMBuilder +++ b/amxmodx/AMBuilder @@ -9,36 +9,25 @@ binary.compiler.defines += [ 'HAVE_STDINT_H', ] +AMXX.AddAssembly(builder, binary, 'helpers-x86.asm', 'helpers-asm.obj') +AMXX.AddAssembly(builder, binary, 'natives-x86.asm', 'natives-asm.obj') +AMXX.AddAssembly(builder, binary, 'amxexecn.asm', 'amxexecn-asm.obj', + includes=['amxdefn.asm']) +AMXX.AddAssembly(builder, binary, 'amxjitsn.asm', 'amxjitsn-asm.obj', + includes=['amxdefn.asm'], + # Opcode sizes must be maximum width for patching to work. + extra_argv=['-O0']) + if builder.target_platform == 'mac': - jit_objects = [ - binary.Dep('JIT/amxexecn-darwin.o'), - binary.Dep('JIT/amxjitsn-darwin.o'), - binary.Dep('JIT/natives-darwin-x86.o'), - binary.Dep('JIT/helpers-darwin-x86.o'), - ] binary.compiler.postlink += [ '-Wl,-read_only_relocs,suppress' ] -elif builder.target_platform == 'linux': - jit_objects = [ - binary.Dep('JIT/amxexecn.o'), - binary.Dep('JIT/amxjitsn.o'), - binary.Dep('JIT/natives-x86.o'), - binary.Dep('JIT/helpers-x86.o'), - ] elif builder.target_platform == 'windows': - jit_objects = [ - binary.Dep('JIT/amxexecn.obj'), - binary.Dep('JIT/amxjitsn.obj'), - binary.Dep('JIT/helpers-x86.obj'), - binary.Dep('JIT/natives-x86.obj'), - ] binary.compiler.linkflags += [ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1', '/SECTION:.data,RW', ] -binary.compiler.linkflags += jit_objects binary.compiler.linkflags += [AMXX.zlib.binary, AMXX.hashing.binary, AMXX.utf8rewind.binary] binary.sources = [ diff --git a/amxmodx/CGameConfigs.h b/amxmodx/CGameConfigs.h index 3ced7691..b7d58c85 100644 --- a/amxmodx/CGameConfigs.h +++ b/amxmodx/CGameConfigs.h @@ -12,6 +12,7 @@ #include #include "CLibrarySys.h" +#include #include #include #include diff --git a/amxmodx/CPlugin.h b/amxmodx/CPlugin.h index 60fb899f..791c3a4c 100755 --- a/amxmodx/CPlugin.h +++ b/amxmodx/CPlugin.h @@ -15,6 +15,7 @@ #include "amxxfile.h" #include #include +#include // ***************************************************** // class CPluginMngr diff --git a/amxmodx/JIT/amxexecn-darwin.o b/amxmodx/JIT/amxexecn-darwin.o deleted file mode 100644 index b215a7fb..00000000 Binary files a/amxmodx/JIT/amxexecn-darwin.o and /dev/null differ diff --git a/amxmodx/JIT/amxexecn.o b/amxmodx/JIT/amxexecn.o deleted file mode 100755 index a4970395..00000000 Binary files a/amxmodx/JIT/amxexecn.o and /dev/null differ diff --git a/amxmodx/JIT/amxexecn.obj b/amxmodx/JIT/amxexecn.obj deleted file mode 100755 index ba9b1d77..00000000 Binary files a/amxmodx/JIT/amxexecn.obj and /dev/null differ diff --git a/amxmodx/JIT/amxjitsn-darwin.o b/amxmodx/JIT/amxjitsn-darwin.o deleted file mode 100644 index 1a6d578d..00000000 Binary files a/amxmodx/JIT/amxjitsn-darwin.o and /dev/null differ diff --git a/amxmodx/JIT/amxjitsn.o b/amxmodx/JIT/amxjitsn.o deleted file mode 100755 index 2a4375ed..00000000 Binary files a/amxmodx/JIT/amxjitsn.o and /dev/null differ diff --git a/amxmodx/JIT/amxjitsn.obj b/amxmodx/JIT/amxjitsn.obj deleted file mode 100755 index c96c9a8e..00000000 Binary files a/amxmodx/JIT/amxjitsn.obj and /dev/null differ diff --git a/amxmodx/JIT/helpers-darwin-x86.o b/amxmodx/JIT/helpers-darwin-x86.o deleted file mode 100644 index 38447509..00000000 Binary files a/amxmodx/JIT/helpers-darwin-x86.o and /dev/null differ diff --git a/amxmodx/JIT/helpers-x86.o b/amxmodx/JIT/helpers-x86.o deleted file mode 100644 index 1d7e9590..00000000 Binary files a/amxmodx/JIT/helpers-x86.o and /dev/null differ diff --git a/amxmodx/JIT/helpers-x86.obj b/amxmodx/JIT/helpers-x86.obj deleted file mode 100644 index d9268b7f..00000000 Binary files a/amxmodx/JIT/helpers-x86.obj and /dev/null differ diff --git a/amxmodx/JIT/natives-amd64.o b/amxmodx/JIT/natives-amd64.o deleted file mode 100755 index ed6413e2..00000000 Binary files a/amxmodx/JIT/natives-amd64.o and /dev/null differ diff --git a/amxmodx/JIT/natives-darwin-x86.o b/amxmodx/JIT/natives-darwin-x86.o deleted file mode 100644 index 9ad779d2..00000000 Binary files a/amxmodx/JIT/natives-darwin-x86.o and /dev/null differ diff --git a/amxmodx/JIT/natives-x86.o b/amxmodx/JIT/natives-x86.o deleted file mode 100755 index b8f58393..00000000 Binary files a/amxmodx/JIT/natives-x86.o and /dev/null differ diff --git a/amxmodx/JIT/natives-x86.obj b/amxmodx/JIT/natives-x86.obj deleted file mode 100755 index 60855c6a..00000000 Binary files a/amxmodx/JIT/natives-x86.obj and /dev/null differ diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 33b010d5..ac6d79dc 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -214,7 +214,7 @@ static cell AMX_NATIVE_CALL console_print(AMX *amx, cell *params) /* 2 param */ { CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { if (len > 126) // Client console truncates after byte 127. (126 + \n = 127) { @@ -247,7 +247,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */ { CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { g_langMngr.SetDefLang(i); msg = format_amxstring(amx, params, 3, len); @@ -280,7 +280,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { g_langMngr.SetDefLang(index); @@ -427,7 +427,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 3 param */ { CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) UTIL_ShowMOTD(pPlayer->pEdict, sToShow, ilen, szHead); } } else { @@ -444,7 +444,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 3 param */ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) UTIL_ShowMOTD(pPlayer->pEdict, sToShow, ilen, szHead); } @@ -524,7 +524,7 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param * { CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { g_langMngr.SetDefLang(i); message = UTIL_SplitHudMessage(format_amxstring(amx, params, 2, len)); @@ -551,7 +551,7 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param * CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { if (aut) { @@ -787,22 +787,27 @@ static cell AMX_NATIVE_CALL is_user_alive(AMX *amx, cell *params) /* 1 param */ if (index < 1 || index > gpGlobals->maxClients) { - return 0; + return FALSE; } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (!pPlayer->ingame) + { + return FALSE; + } + if (g_bmod_tfc) { edict_t *e = pPlayer->pEdict; if (e->v.flags & FL_SPECTATOR || (!e->v.team || !e->v.playerclass)) { - return 0; + return FALSE; } } - return ((pPlayer->ingame && pPlayer->IsAlive()) ? 1 : 0); + return pPlayer->IsAlive() ? TRUE : FALSE; } static cell AMX_NATIVE_CALL get_amxx_verstring(AMX *amx, cell *params) /* 2 params */ @@ -1106,6 +1111,12 @@ static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx, cell *params) } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + + if (!pPlayer->ingame) + { + return 0; + } + edict_t *pEntity = pPlayer->pEdict; if (params[3] == -1) @@ -1344,17 +1355,20 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */ } else { CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - pPlayer->keys = keys; - pPlayer->menu = menuid; - pPlayer->vgui = false; + if (pPlayer->ingame) + { + pPlayer->keys = keys; + pPlayer->menu = menuid; + pPlayer->vgui = false; - if (time == -1) - pPlayer->menuexpire = INFINITE; - else - pPlayer->menuexpire = gpGlobals->time + static_cast(time); + if (time == -1) + pPlayer->menuexpire = INFINITE; + else + pPlayer->menuexpire = gpGlobals->time + static_cast(time); - pPlayer->page = 0; - UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen); + pPlayer->page = 0; + UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen); + } } return 1; diff --git a/amxmodx/emsg.cpp b/amxmodx/emsg.cpp index 2c76801b..9e6da0cf 100755 --- a/amxmodx/emsg.cpp +++ b/amxmodx/emsg.cpp @@ -87,6 +87,7 @@ void Client_TeamInfo(void* mValue) case 1: if (index < 1 || index > gpGlobals->maxClients) break; char* msg = (char*)mValue; + if (!msg) break; g_players[index].team = msg; g_teamsIds.registerTeam(msg, -1); g_players[index].teamId = g_teamsIds.findTeamId(msg); diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 32c81cfd..6a4e10ad 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -657,10 +657,11 @@ void C_ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax) pPlayer->Init(pEdictList + i, i); } + CoreCfg.ExecuteMainConfig(); // Execute amxx.cfg + executeForwards(FF_PluginInit); executeForwards(FF_PluginCfg); - CoreCfg.ExecuteMainConfig(); // Execute amxx.cfg CoreCfg.ExecuteAutoConfigs(); // Execute configs created with AutoExecConfig native. CoreCfg.SetMapConfigTimer(6.1); // Prepare per-map configs to be executed 6.1 seconds later. // Original value which was used in admin.sma. @@ -1433,8 +1434,15 @@ int C_Cmd_Argc(void) // Only here we may find out who is an owner. void C_SetModel(edict_t *e, const char *m) { - if (e->v.owner && m[7]=='w' && m[8]=='_' && m[9]=='h') - g_grenades.put(e, 1.75, 4, GET_PLAYER_POINTER(e->v.owner)); + if (!m || strcmp(m, "models/w_hegrenade.mdl") != 0) + { + RETURN_META(MRES_IGNORED); + } + + if (e->v.owner) + { + g_grenades.put(e, 1.75f, 4, GET_PLAYER_POINTER(e->v.owner)); + } RETURN_META(MRES_IGNORED); } diff --git a/amxmodx/msvc12/amxmodx_mm.vcxproj b/amxmodx/msvc12/amxmodx_mm.vcxproj index 5ced2abd..e1675884 100644 --- a/amxmodx/msvc12/amxmodx_mm.vcxproj +++ b/amxmodx/msvc12/amxmodx_mm.vcxproj @@ -96,6 +96,14 @@ false .data,RW + + cd .. +md -p JIT 2>NUL +%NASM_PATH%nasm.exe -f win32 helpers-x86.asm -o JIT/helpers-x86.obj +%NASM_PATH%nasm.exe -f win32 natives-x86.asm -o JIT/natives-x86.obj +%NASM_PATH%nasm.exe -f win32 amxexecn.asm -o JIT/amxexecn.obj +%NASM_PATH%nasm.exe -O0 -f win32 amxjitsn.asm -o JIT/amxjitsn.obj + @@ -148,6 +156,14 @@ false .data,RW + + cd .. +md -p JIT 2>NUL +%NASM_PATH%nasm.exe -f win32 helpers-x86.asm -o JIT/helpers-x86.obj +%NASM_PATH%nasm.exe -f win32 natives-x86.asm -o JIT/natives-x86.obj +%NASM_PATH%nasm.exe -f win32 amxexecn.asm -o JIT/amxexecn.obj +%NASM_PATH%nasm.exe -O0 -f win32 amxjitsn.asm -o JIT/amxjitsn.obj + @@ -474,4 +490,4 @@ - + \ No newline at end of file diff --git a/amxmodx/util.cpp b/amxmodx/util.cpp index 913e1427..8b3713dc 100755 --- a/amxmodx/util.cpp +++ b/amxmodx/util.cpp @@ -373,8 +373,8 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1, { if ((*aa).matchCommandLine(cmd, arg1) && (*aa).getPlugin()->isExecutable((*aa).getFunction())) { - if (executeForwards((*aa).getFunction(), static_cast(GET_PLAYER_POINTER(pEdict)->index)), - static_cast((*aa).getFlags()), static_cast((*aa).getId()) > 0) + if (executeForwards((*aa).getFunction(), static_cast(GET_PLAYER_POINTER(pEdict)->index), + static_cast((*aa).getFlags()), static_cast((*aa).getId())) > 0) { g_fakecmd.notify = false; return; diff --git a/appveyor.yml b/appveyor.yml index 6fa4a461..71556206 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,11 @@ clone_folder: c:\projects\amxmodx install: - git submodule update --init --recursive - 'c:' +- mkdir c:\nasm +- set PATH=c:\nasm\nasm-2.13.03;%PATH% +- curl -o "c:\nasm\nasm.zip" http://www.nasm.us/pub/nasm/releasebuilds/2.13.03/win32/nasm-2.13.03-win32.zip +- chdir c:\nasm +- 7z x nasm.zip - chdir c:\projects - git clone https://github.com/alliedmodders/ambuild - git clone https://github.com/alliedmodders/metamod-hl1 @@ -22,5 +27,5 @@ build_script: - '"%VS120COMNTOOLS%\vsvars32.bat"' - mkdir build - cd build -- c:\python27\python ../configure.py --enable-optimize -- c:\python27\scripts\ambuild \ No newline at end of file +- c:\python27\python ../configure.py --enable-optimize --nasm="C:\nasm\nasm-2.13.03\nasm.exe" +- c:\python27\scripts\ambuild diff --git a/configure.py b/configure.py index 6c8ab69d..567b09fd 100644 --- a/configure.py +++ b/configure.py @@ -30,4 +30,6 @@ run.options.add_option('--mysql', type='string', dest='mysql_path', default='', help='Path to MySQL') run.options.add_option('--disable-auto-versioning', action='store_true', dest='disable_auto_versioning', default=False, help='Disable the auto versioning script') +run.options.add_option('--nasm', type='string', dest='nasm_path', + default='nasm', help='Path to NASM') run.Configure() diff --git a/modules/cstrike/cstrike/CstrikeHacks.cpp b/modules/cstrike/cstrike/CstrikeHacks.cpp index 562c6a34..2e0f27ad 100644 --- a/modules/cstrike/cstrike/CstrikeHacks.cpp +++ b/modules/cstrike/cstrike/CstrikeHacks.cpp @@ -721,9 +721,9 @@ void InitFuncsAddresses() MF_Log("UTIL_FindEntByString is not available - native cs_find_ent_by_class() has been disabled"); } - if (!AddEntityHashValue || !AddEntityHashValue) + if (!AddEntityHashValue || !RemoveEntityHashValue) { - MF_Log("AddEntityHashValue or AddEntityHashValue is not available - native cs_set_ent_class() has been disabled"); + MF_Log("AddEntityHashValue or RemoveEntityHashValue is not available - native cs_set_ent_class() has been disabled"); } if (!HasReGameDll && !GetWeaponInfo) diff --git a/modules/cstrike/cstrike/CstrikeItemsInfos.cpp b/modules/cstrike/cstrike/CstrikeItemsInfos.cpp index 72934985..bf20b937 100644 --- a/modules/cstrike/cstrike/CstrikeItemsInfos.cpp +++ b/modules/cstrike/cstrike/CstrikeItemsInfos.cpp @@ -17,7 +17,7 @@ #include CsItemInfo ItemsManager; -ItemInfo WeaponsList[MAX_WEAPONS]; +ItemInfos WeaponsList[MAX_WEAPONS]; #define PSTATE_ALIASES_TYPE 0 #define PSTATE_ALIASES_ALIAS 1 diff --git a/modules/cstrike/cstrike/CstrikeItemsInfos.h b/modules/cstrike/cstrike/CstrikeItemsInfos.h index 294843a9..49223e89 100644 --- a/modules/cstrike/cstrike/CstrikeItemsInfos.h +++ b/modules/cstrike/cstrike/CstrikeItemsInfos.h @@ -20,12 +20,12 @@ #include #include -struct ItemInfo +struct ItemInfos { - ItemInfo() : name("Empty"), ammoIndex1(-1), maxAmmo1(0), ammoIndex2(-1), maxAmmo2(0), slot(0), position(0), id(0), flags(0) + ItemInfos() : name("Empty"), ammoIndex1(-1), maxAmmo1(0), ammoIndex2(-1), maxAmmo2(0), slot(0), position(0), id(0), flags(0) {} - ItemInfo &operator = (ItemInfo &other) + ItemInfos &operator = (ItemInfos &other) { name = other.name; ammoIndex1 = other.ammoIndex1; @@ -133,7 +133,7 @@ class CsItemInfo : public ITextListener_SMC int m_EquipmentsPrice[static_cast(Equipments::Count)]; }; -extern ItemInfo WeaponsList[MAX_WEAPONS]; +extern ItemInfos WeaponsList[MAX_WEAPONS]; extern CsItemInfo ItemsManager; #endif // _CSTRIKE_WEAPONS_INFOS_H_ diff --git a/modules/cstrike/cstrike/CstrikeNatives.cpp b/modules/cstrike/cstrike/CstrikeNatives.cpp index 97cae380..fb973847 100644 --- a/modules/cstrike/cstrike/CstrikeNatives.cpp +++ b/modules/cstrike/cstrike/CstrikeNatives.cpp @@ -882,7 +882,7 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params) GET_OFFSET("CBasePlayer", m_modelIndexPlayer); - char modelpath[260]; + char modelpath[PLATFORM_MAX_PATH]; ke::SafeSprintf(modelpath, sizeof(modelpath), "models/player/%s/%s.mdl", newModel, newModel); auto modelIndex = 0; diff --git a/modules/cstrike/cstrike/CstrikeUserMessages.cpp b/modules/cstrike/cstrike/CstrikeUserMessages.cpp index e05329d1..c1995eae 100644 --- a/modules/cstrike/cstrike/CstrikeUserMessages.cpp +++ b/modules/cstrike/cstrike/CstrikeUserMessages.cpp @@ -22,7 +22,7 @@ bool ShouldBlock; bool ShouldBlockHLTV; bool ShouldDisableHooks; bool RetrieveWeaponList; -ItemInfo CurrentWeaponList; +ItemInfos CurrentWeaponList; int ArgPosition; int MessageIdArmorType; diff --git a/modules/cstrike/cstrike/CstrikeUtils.cpp b/modules/cstrike/cstrike/CstrikeUtils.cpp index b0992f62..863b9d62 100644 --- a/modules/cstrike/cstrike/CstrikeUtils.cpp +++ b/modules/cstrike/cstrike/CstrikeUtils.cpp @@ -13,12 +13,13 @@ #include "amxxmodule.h" #include +#include extern int MessageIdTextMsg; bool UTIL_IsPlayer(edict_t *pPlayer) { - return strcmp(STRING(pPlayer->v.classname), "player") == 0; + return pPlayer && strcmp(STRING(pPlayer->v.classname), "player") == 0; } void UTIL_TextMsg_Generic(edict_t* pPlayer, const char* message) @@ -36,7 +37,7 @@ bool UTIL_CheckForPublic(const char *publicname) int i = 0; char blah[64]; - strncpy(blah, publicname, sizeof(blah) - 1); + ke::SafeStrcpy(blah, sizeof(blah), publicname); while ((amx = MF_GetScriptAmx(i++))) { diff --git a/modules/cstrike/cstrike/CstrikeUtils.h b/modules/cstrike/cstrike/CstrikeUtils.h index c5b9acdc..d0a7a2ec 100644 --- a/modules/cstrike/cstrike/CstrikeUtils.h +++ b/modules/cstrike/cstrike/CstrikeUtils.h @@ -49,6 +49,10 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength); MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \ return 0; \ } \ + else if (!MF_GetPlayerEdict(x)->pvPrivateData) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (no private data)", x); \ + return 0; \ + } \ } else { \ if (x != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \ @@ -62,8 +66,12 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength); MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \ return 0; \ } else { \ - if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \ - MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \ + if (!MF_IsPlayerIngame(x)) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \ + return 0; \ + } \ + else if (!MF_GetPlayerEdict(x)->pvPrivateData) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (no private data)", x); \ return 0; \ } \ } diff --git a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj index a4236b78..91f3b0ab 100644 --- a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj +++ b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj @@ -165,9 +165,18 @@ + + + + + - + + + + + @@ -188,4 +197,4 @@ - + \ No newline at end of file diff --git a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters index 784cc11c..3d023ab5 100644 --- a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters +++ b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters @@ -39,6 +39,9 @@ {ba0b72ba-25d8-48c3-af84-c1d4d7436636} + + {67de85cb-b8e7-4cd6-b8cf-2ff7ed540c2b} + @@ -127,9 +130,6 @@ ReSDK\cstrike - - ReSDK\cstrike - ReSDK\engine @@ -142,6 +142,36 @@ ReSDK + + ReSDK\cstrike\API + + + ReSDK\cstrike\API + + + ReSDK\cstrike\API + + + ReSDK\cstrike\API + + + ReSDK\cstrike\API + + + ReSDK\engine + + + ReSDK\engine + + + ReSDK\engine + + + ReSDK\engine + + + ReSDK\engine + diff --git a/modules/cstrike/csx/meta_api.cpp b/modules/cstrike/csx/meta_api.cpp index 19f0f495..f438d84f 100644 --- a/modules/cstrike/csx/meta_api.cpp +++ b/modules/cstrike/csx/meta_api.cpp @@ -178,14 +178,18 @@ void PlayerPreThink_Post( edict_t *pEntity ) { RETURN_META(MRES_IGNORED); } -void ServerDeactivate() { +void ServerDeactivate() +{ int i; - for( i = 1;i<=gpGlobals->maxClients; ++i){ - CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->rank) pPlayer->Disconnect(); + + for( i = 1; i <= gpGlobals->maxClients; ++i) + { + GET_PLAYER_POINTER_I(i)->Disconnect(); } - if ( (g_rank.getRankNum() >= (int)csstats_maxsize->value) || ((int)csstats_reset->value == 1 ) ) { - CVAR_SET_FLOAT("csstats_reset",0.0); + + if (static_cast(csstats_maxsize->value) <= 0 || g_rank.getRankNum() >= static_cast(csstats_maxsize->value) || static_cast(csstats_reset->value) != 0) + { + CVAR_SET_FLOAT("csstats_reset", 0.0f); g_rank.clear(); // clear before save to file } g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("csstats")) ); @@ -197,27 +201,26 @@ void ServerDeactivate() { RETURN_META(MRES_IGNORED); } -BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){ +BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) +{ CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - if (pPlayer->pEdict == NULL) - { - pPlayer->Init(ENTINDEX(pEntity), pEntity); - } - pPlayer->Connect(pszAddress); RETURN_META_VALUE(MRES_IGNORED, TRUE); } -void ClientDisconnect( edict_t *pEntity ) { - CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - if (pPlayer->rank) pPlayer->Disconnect(); +void ClientDisconnect( edict_t *pEntity ) +{ + GET_PLAYER_POINTER(pEntity)->Disconnect(); + RETURN_META(MRES_IGNORED); } -void ClientPutInServer_Post( edict_t *pEntity ) { +void ClientPutInServer_Post( edict_t *pEntity ) +{ GET_PLAYER_POINTER(pEntity)->PutInServer(); + RETURN_META(MRES_IGNORED); } diff --git a/modules/cstrike/csx/msvc12/csx.vcxproj b/modules/cstrike/csx/msvc12/csx.vcxproj index 6a6d695b..2badf907 100644 --- a/modules/cstrike/csx/msvc12/csx.vcxproj +++ b/modules/cstrike/csx/msvc12/csx.vcxproj @@ -160,6 +160,7 @@ + diff --git a/modules/cstrike/csx/msvc12/csx.vcxproj.filters b/modules/cstrike/csx/msvc12/csx.vcxproj.filters index e0865b43..cc5eab35 100644 --- a/modules/cstrike/csx/msvc12/csx.vcxproj.filters +++ b/modules/cstrike/csx/msvc12/csx.vcxproj.filters @@ -60,6 +60,9 @@ Pawn Includes + + Pawn Includes + Pawn Includes diff --git a/modules/engine/engine.cpp b/modules/engine/engine.cpp index 55506857..f574bfca 100644 --- a/modules/engine/engine.cpp +++ b/modules/engine/engine.cpp @@ -456,6 +456,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) { plinfo[iIndex].iViewType = CAMERA_3RDPERSON; pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); + + if (!pNewCamera) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity."); + return 0; + } + pNewCamera->v.classname = MAKE_STRING("VexdCam"); SET_MODEL(pNewCamera, "models/rpgrocket.mdl"); @@ -486,6 +493,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) { plinfo[iIndex].iViewType = CAMERA_UPLEFT; pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); + + if (!pNewCamera) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity."); + return 0; + } + pNewCamera->v.classname = MAKE_STRING("VexdCam"); SET_MODEL(pNewCamera, "models/rpgrocket.mdl"); @@ -516,6 +530,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) { plinfo[iIndex].iViewType = CAMERA_TOPDOWN; pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); + + if (!pNewCamera) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity."); + return 0; + } + pNewCamera->v.classname = MAKE_STRING("VexdCam"); SET_MODEL(pNewCamera, "models/rpgrocket.mdl"); diff --git a/modules/fakemeta/fakemeta_amxx.h b/modules/fakemeta/fakemeta_amxx.h index 9b7b084b..6fb0518c 100644 --- a/modules/fakemeta/fakemeta_amxx.h +++ b/modules/fakemeta/fakemeta_amxx.h @@ -50,6 +50,16 @@ #define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(TypeConversion.id_to_edict(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity"); return 0; } #define CHECK_OFFSET(x) if (x < 0) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset"); return 0; } +#define CHECK_ENTITY_PDATA(x) \ + if (FNullEnt(TypeConversion.id_to_edict(x))) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \ + return 0; \ + } \ + else if (!TypeConversion.id_to_edict(x)->pvPrivateData) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d (no private data)", x); \ + return 0; \ + } + extern AMX_NATIVE_INFO engfunc_natives[]; extern AMX_NATIVE_INFO dllfunc_natives[]; diff --git a/modules/fakemeta/fm_tr.cpp b/modules/fakemeta/fm_tr.cpp index fa002c9e..6b735f06 100644 --- a/modules/fakemeta/fm_tr.cpp +++ b/modules/fakemeta/fm_tr.cpp @@ -86,7 +86,7 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params) case TR_pHit: { e = TypeConversion.id_to_edict(*ptr); - if (!e || FNullEnt(e)) + if (*ptr != -1 && FNullEnt(e)) return 0; //TODO: return error gfm_tr->pHit = e; return 1; @@ -167,7 +167,7 @@ static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params) } case TR_pHit: { - if (gfm_tr->pHit == NULL || FNullEnt(gfm_tr->pHit)) + if (FNullEnt(gfm_tr->pHit)) return -1; return ENTINDEX(gfm_tr->pHit); break; diff --git a/modules/fakemeta/fm_tr2.cpp b/modules/fakemeta/fm_tr2.cpp index e9305191..57db06c9 100644 --- a/modules/fakemeta/fm_tr2.cpp +++ b/modules/fakemeta/fm_tr2.cpp @@ -99,7 +99,7 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params) case TR_pHit: { edict_t *e = TypeConversion.id_to_edict(*ptr); - if (!e || FNullEnt(e)) + if (*ptr != -1 && FNullEnt(e)) return 0; //TODO: return error tr->pHit = e; return 1; @@ -187,7 +187,7 @@ static cell AMX_NATIVE_CALL get_tr2(AMX *amx, cell *params) } case TR_pHit: { - if (tr->pHit == NULL || FNullEnt(tr->pHit)) + if (FNullEnt(tr->pHit)) return -1; return ENTINDEX(tr->pHit); break; diff --git a/modules/fakemeta/misc.cpp b/modules/fakemeta/misc.cpp index 8c38c4c6..c6022444 100644 --- a/modules/fakemeta/misc.cpp +++ b/modules/fakemeta/misc.cpp @@ -18,7 +18,7 @@ static cell AMX_NATIVE_CALL copy_infokey_buffer(AMX *amx, cell *params) { char *infobuffer = reinterpret_cast(params[1]); - return MF_SetAmxString(amx, params[2], infobuffer, params[3]); + return MF_SetAmxString(amx, params[2], infobuffer ? infobuffer : "", params[3]); } // lookup_sequence(entid, "sequence name", &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0); diff --git a/modules/fakemeta/msvc12/fakemeta.vcxproj b/modules/fakemeta/msvc12/fakemeta.vcxproj index 25774f26..3cf5703f 100644 --- a/modules/fakemeta/msvc12/fakemeta.vcxproj +++ b/modules/fakemeta/msvc12/fakemeta.vcxproj @@ -120,11 +120,14 @@ + + + + + - - @@ -148,4 +151,4 @@ - + \ No newline at end of file diff --git a/modules/fakemeta/msvc12/fakemeta.vcxproj.filters b/modules/fakemeta/msvc12/fakemeta.vcxproj.filters index 4c16bd55..bc479670 100644 --- a/modules/fakemeta/msvc12/fakemeta.vcxproj.filters +++ b/modules/fakemeta/msvc12/fakemeta.vcxproj.filters @@ -45,6 +45,9 @@ {0d1c5025-071d-43aa-b19a-2eee0d34a906} + + {2800175e-06bf-42bf-b3c1-f86561471531} + @@ -145,14 +148,23 @@ ReSDK\cstrike - - ReSDK\cstrike - ReSDK - - ReSDK + + ReSDK\cstrike\API + + + ReSDK\cstrike\API + + + ReSDK\cstrike\API + + + ReSDK\cstrike\API + + + ReSDK\cstrike\API diff --git a/modules/fakemeta/pdata.cpp b/modules/fakemeta/pdata.cpp index b69dfbe0..870be62e 100644 --- a/modules/fakemeta/pdata.cpp +++ b/modules/fakemeta/pdata.cpp @@ -32,18 +32,18 @@ //implement these with setjmp later. bool IsBadReadPtr(void *l, size_t size) { - return false; + return l ? false : true; } bool IsBadWritePtr(void *l, size_t size) { - return false; + return l ? false : true; } #endif static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -65,7 +65,7 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -87,7 +87,7 @@ static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -109,7 +109,7 @@ static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -130,7 +130,7 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -167,7 +167,7 @@ static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -192,30 +192,35 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params) szData = get_pdata_direct(pEdict, iOffset); if (IsBadWritePtr(szData, 1)) return 0; - strcpy(szData, data); } else { szData = get_pdata(pEdict, iOffset); if (IsBadWritePtr(szData, 1)) return 0; - if (params[4] == 1) + + if (len > static_cast(strlen(szData))) { - free(szData); - szData = (char *)malloc(len + 1); - } else if (params[4] == 2) { - delete [] szData; - szData = new char[len + 1]; + if (params[4] == 1) + { + free(szData); + szData = (char *)malloc(len + 1); + } + else if (params[4] == 2) { + delete[] szData; + szData = new char[len + 1]; + } + set_pdata(pEdict, iOffset, szData); } - strcpy(szData, data); - set_pdata(pEdict, iOffset, szData); } + strncopy(szData, data, len + 1); + return 1; } static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -256,7 +261,7 @@ static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -282,7 +287,7 @@ static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -303,7 +308,7 @@ static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -328,7 +333,7 @@ static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -349,7 +354,7 @@ static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -374,7 +379,7 @@ static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -395,7 +400,7 @@ static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -420,7 +425,7 @@ static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -449,7 +454,7 @@ static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -476,7 +481,7 @@ static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -524,7 +529,7 @@ static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); diff --git a/modules/fakemeta/pdata_entities.cpp b/modules/fakemeta/pdata_entities.cpp index 039e3fca..c2420264 100644 --- a/modules/fakemeta/pdata_entities.cpp +++ b/modules/fakemeta/pdata_entities.cpp @@ -18,7 +18,7 @@ static cell AMX_NATIVE_CALL get_ent_data(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -33,7 +33,7 @@ static cell AMX_NATIVE_CALL get_ent_data(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -57,7 +57,7 @@ static cell AMX_NATIVE_CALL set_ent_data(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_float(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -72,7 +72,7 @@ static cell AMX_NATIVE_CALL get_ent_data_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data_float(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -90,7 +90,7 @@ static cell AMX_NATIVE_CALL set_ent_data_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_vector(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -107,7 +107,7 @@ static cell AMX_NATIVE_CALL get_ent_data_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data_vector(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -125,7 +125,7 @@ static cell AMX_NATIVE_CALL set_ent_data_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_entity(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -142,7 +142,7 @@ static cell AMX_NATIVE_CALL set_ent_data_entity(AMX *amx, cell *params) int entity = params[1]; int value = params[4]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); if (value != -1) { @@ -165,7 +165,7 @@ static cell AMX_NATIVE_CALL set_ent_data_entity(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_string(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -190,7 +190,7 @@ static cell AMX_NATIVE_CALL get_ent_data_string(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data_string(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); diff --git a/modules/fun/fun.cpp b/modules/fun/fun.cpp index 86f00fd8..44e42790 100644 --- a/modules/fun/fun.cpp +++ b/modules/fun/fun.cpp @@ -325,6 +325,32 @@ static cell AMX_NATIVE_CALL set_user_rendering(AMX *amx, cell *params) // set_us return 1; } +static cell AMX_NATIVE_CALL get_user_rendering(AMX *amx, cell *params) // get_user_rendering(index, &fx = kRenderFxNone, &r = 0, &g = 0, &b = 0, &render = kRenderNormal, &amount = 0); = 7 arguments +{ + // Gets user rendering. + // params[1] = index + // params[2] = fx + // params[3] = r + // params[4] = g + // params[5] = b + // params[6] = render + // params[7] = amount + + // Check index + CHECK_PLAYER(params[1]); + + // Fetch player pointer + edict_t *pPlayer = TypeConversion.id_to_edict(params[1]); + + *MF_GetAmxAddr(amx, params[2]) = pPlayer->v.renderfx; + *MF_GetAmxAddr(amx, params[3]) = pPlayer->v.rendercolor[0]; + *MF_GetAmxAddr(amx, params[4]) = pPlayer->v.rendercolor[1]; + *MF_GetAmxAddr(amx, params[5]) = pPlayer->v.rendercolor[2]; + *MF_GetAmxAddr(amx, params[6]) = pPlayer->v.rendermode; + *MF_GetAmxAddr(amx, params[7]) = pPlayer->v.renderamt; + + return 1; +} static cell AMX_NATIVE_CALL set_user_maxspeed(AMX *amx, cell *params) // set_user_maxspeed(index, Float:speed = -1.0) = 2 arguments { @@ -548,6 +574,7 @@ AMX_NATIVE_INFO fun_Exports[] = { {"set_user_armor", set_user_armor}, {"set_user_origin", set_user_origin}, {"set_user_rendering", set_user_rendering}, + {"get_user_rendering", get_user_rendering}, {"set_user_maxspeed", set_user_maxspeed}, {"get_user_maxspeed", get_user_maxspeed}, {"set_user_gravity", set_user_gravity}, diff --git a/plugins/include/amxconst.inc b/plugins/include/amxconst.inc index 1e7ac379..ca5011ee 100755 --- a/plugins/include/amxconst.inc +++ b/plugins/include/amxconst.inc @@ -151,6 +151,7 @@ public stock const Float:NULL_VECTOR[3]; #define HIT_LEFTLEG 6 #define HIT_RIGHTLEG 7 #define HIT_SHIELD 8 // CS only +#define MAX_BODYHITS 8 /** * @section emit_sound() constants @@ -516,4 +517,20 @@ enum FindPlayerFlags (<<= 1) FindPlayer_IncludeConnecting // Include connecting clients } +/** + * Constants for client statistics + */ +enum +{ + STATSX_KILLS = 0, + STATSX_DEATHS, + STATSX_HEADSHOTS, + STATSX_TEAMKILLS, + STATSX_SHOTS, + STATSX_HITS, + STATSX_DAMAGE, + STATSX_RANK, + STATSX_MAX_STATS +} + #include // To keep backward compatibility diff --git a/plugins/include/amxmodx.inc b/plugins/include/amxmodx.inc index ce554cf8..a60bd0ad 100755 --- a/plugins/include/amxmodx.inc +++ b/plugins/include/amxmodx.inc @@ -2142,6 +2142,9 @@ native random_num(a, b); * @note Example usage: get_user_msgid("TextMsg") * @note The message id is unique as long as the server is running, but might * change between updates. They should not be hardcoded into plugins. + * @note On first server start, this function will return 0 if used inside + * plugin_precache(). Consider hooking RegUserMsg in order to retrieve + * the correct message id. * * @param name Client message name * @@ -3283,7 +3286,7 @@ native DestroyForward(forward_handle); * * @noreturn */ -native arrayset(array[], value, size); +native arrayset(any:array[], any:value, size); /** * Returns the weapon id associated with a weapon name. diff --git a/plugins/include/csstats.inc b/plugins/include/csstats.inc index 96e168ef..84b7a4da 100755 --- a/plugins/include/csstats.inc +++ b/plugins/include/csstats.inc @@ -12,6 +12,8 @@ #endif #define _csstats_included +#include + /** * Retrieves the client's current weapon statistics. * @@ -19,6 +21,8 @@ * amxconst.inc, this function also works on custom weapons. * @note For a list of possible body hitplaces see the HIT_* constants in * amxconst.inc + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - Kills * 1 - Deaths @@ -39,7 +43,7 @@ * @error If an invalid client index or weapon id is provided, an * error will be thrown. */ -native get_user_wstats(index, wpnindex, stats[8], bodyhits[8]); +native get_user_wstats(index, wpnindex, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]); /** * Retrieves the client's weapon statistics from the current round. @@ -48,6 +52,8 @@ native get_user_wstats(index, wpnindex, stats[8], bodyhits[8]); * amxconst.inc, this function also works on custom weapons. * @note For a list of possible body hitplaces see the HIT_* constants in * amxconst.inc + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - Kills * 1 - Deaths @@ -68,7 +74,7 @@ native get_user_wstats(index, wpnindex, stats[8], bodyhits[8]); * @error If an invalid client index or weapon id is provided, an * error will be thrown. */ -native get_user_wrstats(index, wpnindex, stats[8], bodyhits[8]); +native get_user_wrstats(index, wpnindex, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]); /** * Retrieves the client's weapon statistics from the permanent storage on the @@ -80,6 +86,8 @@ native get_user_wrstats(index, wpnindex, stats[8], bodyhits[8]); * deaths/teamkills. * @note For a list of possible body hitplaces see the HIT_* constants in * amxconst.inc + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - Kills * 1 - Deaths @@ -99,13 +107,15 @@ native get_user_wrstats(index, wpnindex, stats[8], bodyhits[8]); * @error If an invalid client index is provided, an error will be * thrown. */ -native get_user_stats(index, stats[8], bodyhits[8]); +native get_user_stats(index, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]); /** * Retrieves the client's statistics from the current round. * * @note For a list of possible body hitplaces see the HIT_* constants in * amxconst.inc + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - Kills * 1 - Deaths @@ -123,7 +133,7 @@ native get_user_stats(index, stats[8], bodyhits[8]); * @error If an invalid client index is provided, an error will be * thrown. */ -native get_user_rstats(index, stats[8], bodyhits[8]); +native get_user_rstats(index, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS]); /** * Retrieves the client's statistics inflicted upon another client from the @@ -131,6 +141,8 @@ native get_user_rstats(index, stats[8], bodyhits[8]); * * @note For a list of possible body hitplaces see the HIT_* constants in * amxconst.inc + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - Kills * 1 - Deaths @@ -153,7 +165,7 @@ native get_user_rstats(index, stats[8], bodyhits[8]); * @error If an invalid client index is provided, an error will be * thrown. */ -native get_user_vstats(index, victim, stats[8], bodyhits[8], wpnname[] = "", len = 0); +native get_user_vstats(index, victim, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS], wpnname[] = "", len = 0); /** * Retrieves the client's statistics received from another client from the @@ -161,6 +173,8 @@ native get_user_vstats(index, victim, stats[8], bodyhits[8], wpnname[] = "", len * * @note For a list of possible body hitplaces see the HIT_* constants in * amxconst.inc + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - Kills * 1 - Deaths @@ -183,7 +197,7 @@ native get_user_vstats(index, victim, stats[8], bodyhits[8], wpnname[] = "", len * @error If an invalid client index is provided, an error will be * thrown. */ -native get_user_astats(index, wpnindex, stats[8], bodyhits[8], wpnname[] = "", len = 0); +native get_user_astats(index, wpnindex, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS], wpnname[] = "", len = 0); /** * Resets the current round weapon, attacker and victim statistics. @@ -206,6 +220,8 @@ native reset_user_wstats(index); * deaths/teamkills. * @note For a list of possible body hitplaces see the HIT_* constants in * amxconst.inc + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - Kills * 1 - Deaths @@ -227,7 +243,7 @@ native reset_user_wstats(index); * @return Next rank index (> 0 and > index), or 0 if no more * statistics exist */ -native get_stats(index, stats[8], bodyhits[8], name[], len, authid[] = "", authidlen = 0); +native get_stats(index, stats[STATSX_MAX_STATS], bodyhits[MAX_BODYHITS], name[], len, authid[] = "", authidlen = 0); /** * Returns the number of all entries in the permanent statistics storage. @@ -240,6 +256,8 @@ native get_statsnum(); * Retrieves the client's objective statistics from the permanent storage. * * @note The permanent storage is updated on every respawn or client disconnect. + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - total defusions * 1 - bomb defused @@ -254,13 +272,15 @@ native get_statsnum(); * @error If an invalid client index is provided, an error will be * thrown. */ -native get_user_stats2(index, stats[4]); +native get_user_stats2(index, stats[STATSX_MAX_OBJECTIVE]); /** * Retrieves objective statistics from the permanent storage on the server via * iterative, incremental access. * * @note The permanent storage is updated on every respawn or client disconnect. + * @note For a list of possible stat constants see the STATSX_* constants in + * amxconst.inc * @note The fields in the statistics are: * 0 - total defusions * 1 - bomb defused @@ -275,4 +295,4 @@ native get_user_stats2(index, stats[4]); * @return Next rank index (> 0 and > index), or 0 if no more * statistics exist */ -native get_stats2(index, stats[4], authid[] = "", authidlen = 0); +native get_stats2(index, stats[STATSX_MAX_OBJECTIVE], authid[] = "", authidlen = 0); diff --git a/plugins/include/csstats_const.inc b/plugins/include/csstats_const.inc new file mode 100644 index 00000000..a392d1bb --- /dev/null +++ b/plugins/include/csstats_const.inc @@ -0,0 +1,29 @@ +// 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 + +// +// Counter-Strike Functions +// + +#if defined _csstats_const_included + #endinput +#endif +#define _csstats_const_included + +/** + * Constants for objective based statistics + */ +enum +{ + STATSX_TOTAL_DEFUSIONS = 0, + STATSX_BOMBS_DEFUSED, + STATSX_BOMBS_PLANTED, + STATSX_BOMB_EXPLOSIONS, + STATSX_MAX_OBJECTIVE +} diff --git a/plugins/include/dodconst.inc b/plugins/include/dodconst.inc index ca53e802..14807e53 100755 --- a/plugins/include/dodconst.inc +++ b/plugins/include/dodconst.inc @@ -136,3 +136,17 @@ enum { DODC_PIAT, //DODC_BRIT_MORTAR, }; + +/* DoD stats constants */ +enum { + DODX_KILLS = 0, + DODX_DEATHS, + DODX_HEADSHOTS, + DODX_TEAMKILLS, + DODX_SHOTS, + DODX_HITS, + DODX_DAMAGE, + DODX_POINTS, + DODX_RANK, + DODX_MAX_STATS +} diff --git a/plugins/include/dodstats.inc b/plugins/include/dodstats.inc index a250a2ba..381496a2 100755 --- a/plugins/include/dodstats.inc +++ b/plugins/include/dodstats.inc @@ -28,34 +28,34 @@ * 6 - damage * 7 - score * For body hits fields see amxconst.inc. */ -native get_user_wstats(index,wpnindex,stats[9],bodyhits[8]); +native get_user_wstats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets round stats from given weapon index.*/ -native get_user_wrstats(index,wpnindex,stats[9],bodyhits[8]); +native get_user_wrstats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets life (from spawn to spawn) stats from given weapon index.*/ -native get_user_wlstats(index,wpnindex,stats[9],bodyhits[8]); +native get_user_wlstats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets overall stats which are stored in file on server * and updated on every respawn or user disconnect. * Function returns the position in stats by diff. kills to deaths. */ -native get_user_stats(index,stats[9],bodyhits[8]); +native get_user_stats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets round stats of player. */ -native get_user_rstats(index,stats[9],bodyhits[8]); +native get_user_rstats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets life (from spawn to spawn) stats of player. */ -native get_user_lstats(index,stats[9],bodyhits[8]); +native get_user_lstats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets stats with which user have killed/hurt his victim. If victim is 0 * then stats are from all victims. If victim has not been hurt, function * returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_vstats(index,victim,stats[9],bodyhits[8],wpnname[]="",len=0); +native get_user_vstats(index,victim,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0); /* Gets stats with which user have been killed/hurt. If killer is 0 * then stats are from all attacks. If killer has not hurt user, function * returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_astats(index,wpnindex,stats[9],bodyhits[8],wpnname[]="",len=0); +native get_user_astats(index,wpnindex,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0); /* Resets life, weapon, victims and attackers user stats. */ native reset_user_wstats(index); @@ -63,7 +63,7 @@ native reset_user_wstats(index); /* Gets overall stats which stored in stats.dat file in amx folder * and updated on every mapchange or user disconnect. * Function returns next index of stats entry or 0 if no more exists. */ -native get_stats(index,stats[9],bodyhits[8],name[],len); +native get_stats(index,stats[DODX_MAX_STATS],bodyhits[MAX_BODYHITS],name[],len); /* Returns number of all entries in stats. */ native get_statsnum(); diff --git a/plugins/include/fun.inc b/plugins/include/fun.inc index d284af1e..a68213a8 100755 --- a/plugins/include/fun.inc +++ b/plugins/include/fun.inc @@ -125,6 +125,26 @@ native set_user_origin(index, const origin[3]); */ native set_user_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0); +/** + * Gets player's rendering mode. + * + * @note A really useful render modes reference: + * https://sites.google.com/site/svenmanor/rendermodes + * + * @param index Client index + * @param fx Variable to store the rendering effect + * @param r Variable to store the amount of red color + * @param g Variable to store the amount of green color + * @param b Variable to store the amount of blue color + * @param render Variable to store the render mode + * @param amount Variable to store the render amount + * + * @noreturn + * @error If player is not connected or not within the range + * of 1 to MaxClients. + */ +native get_user_rendering(index, &fx = kRenderFxNone, &r = 0, &g = 0, &b = 0, &render = kRenderNormal, &amount = 0); + /** * Gives an item to a player. * diff --git a/plugins/include/message_stocks.inc b/plugins/include/message_stocks.inc index 219446dc..a9161945 100644 --- a/plugins/include/message_stocks.inc +++ b/plugins/include/message_stocks.inc @@ -16,7 +16,15 @@ #endif #define _message_stocks_included -/* Creates a death message. */ +/** + * Sends a death message. + * + * @param killer Killer id + * @param victim Victim id + * @param weaponNUM Weapon index + * + * @noreturn + */ stock dod_make_deathmsg(killer, victim, weaponNUM) { static msgid = 0; @@ -33,7 +41,14 @@ stock dod_make_deathmsg(killer, victim, weaponNUM) return 1; } -/* Kills a user without a message. */ +/** + * Kills a user without a message. + * + * @param index Client index + * @param flag If nonzero, the death will not affect the client's score + * + * @noreturn + */ stock user_silentkill(index, flag = 1) { static msgid = 0; @@ -50,7 +65,16 @@ stock user_silentkill(index, flag = 1) return 1; } -/* Creates a death message. */ +/** + * Creates a death message. + * + * @param killer Killer id + * @param victim Victim id + * @param headshot Headshot + * @param weapon Weapon + * + * @noreturn + */ stock make_deathmsg(killer, victim, headshot, const weapon[]) { static msgid = 0; diff --git a/plugins/include/messages.inc b/plugins/include/messages.inc index 97ed18d0..c0ef1569 100644 --- a/plugins/include/messages.inc +++ b/plugins/include/messages.inc @@ -18,88 +18,587 @@ #include -/* These functinos are used to generate client messages. - * You may generate menu, smoke, shockwaves, thunderlights, - * intermission and many many others messages. - * See HL SDK for more examples. */ +/** + * Marks the beginning of a client message. + * + * @note You may generate menus, smoke, shockwaves, thunderlights, + * intermission and many other messages. + * @note For a list of HL game events, visit https://wiki.alliedmods.net/Half-Life_1_Game_Events + * @note For a list of HL engine messages, visit https://wiki.alliedmods.net/Half-Life_1_Engine_Messages + * @note You may also refer to the messages_const.inc file for examples. + * @note Each message starts with a message_begin() or message_begin_f() function + * and ends with message_end(). The specific message arguments go in between + * these two by using the write_*() functions found in messages.inc. + * + * @param dest Destination type (see MSG_* constants in messages_const.inc) + * @param msg_type Message id + * @param origin Message origin + * @param player Client index receiving the message or 0 for all clients + * + * @noreturn + * @error If an invalid message id is specified or an invalid number + * of parameters is passed, an error will be thrown. + */ native message_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0); + +/** + * Marks the beginning of a client message. + * + * @note You may generate menus, smoke, shockwaves, thunderlights, + * intermission and many other messages. + * @note For a list of HL game events, visit https://wiki.alliedmods.net/Half-Life_1_Game_Events + * @note For a list of HL engine messages, visit https://wiki.alliedmods.net/Half-Life_1_Engine_Messages + * @note You may also refer to the messages_const.inc file for examples. + * @note This function is the same as message_begin(), but the origin + * argument accepts only float values in this one. + * @note Each message starts with a message_begin() or message_begin_f() function + * and ends with message_end(). The specific message arguments go in between + * these two by using the write_*() functions found in messages.inc. + * + * @param dest Destination type (see MSG_* constants in messages_const.inc) + * @param msg_type Message id + * @param origin Message origin + * @param player Client index receiving the message or 0 for all clients + * + * @noreturn + * @error If an invalid message id is specified or an invalid number + * of parameters is passed, an error will be thrown. + */ native message_begin_f(dest, msg_type, const Float:origin[3] = {0.0,0.0,0.0}, player = 0); + +/** + * Ends a message that was started with message_begin() or message_begin_f(). + * + * @note If the function is called without using message_begin() or + * message_begin_f() first, the server will crash immediately. + * + * @noreturn + */ native message_end(); + +/** + * Writes a single byte to a message. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Byte to write + * + * @noreturn + */ native write_byte(x); + +/** + * Writes a single character to a message. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Character to write + * + * @noreturn + */ native write_char(x); + +/** + * Writes a single number to a message (short). + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Number to write + * + * @noreturn + */ native write_short(x); + +/** + * Writes a single number to a message (long). + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Number to write + * + * @noreturn + */ native write_long(x); + +/** + * Writes an entity index to a message. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Entity index to write + * + * @noreturn + */ native write_entity(x); + +/** + * Writes an angle entry to a message. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Angle to write + * + * @noreturn + */ native write_angle(x); + +/** + * Writes an angle entry to a message using a float value. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Angle to write + * + * @noreturn + */ native write_angle_f(Float:x); + +/** + * Writes a coordinate entry to a message. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Coordinate to write + * + * @noreturn + */ native write_coord(x); + +/** + * Writes a coordinate entry to a message using a float value. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Coordinate to write + * + * @noreturn + */ native write_coord_f(Float:x); + +/** + * Writes a string to a message. + * + * @note This function should only be used in between a message_begin() + * or message_begin_f() and a message_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x String to write + * + * @noreturn + */ native write_string(const x[]); -/* These are the same as above, except that the messages sent - * are also sent to all other plugins and Metamod plugins. - * This means that if you send one of these messages, other plugins will - * be notified, which was previously impossible. - * BE CAREFUL! Using these incorrectly, or not for their intended purpose, - * could cause infinite recursion or something just as bad. - * NOTE! These natives are experimental. +/** + * Marks the beginning of a client message. + * + * @note You may generate menus, smoke, shockwaves, thunderlights, + * intermission and many other messages. + * @note For a list of HL game events, visit https://wiki.alliedmods.net/Half-Life_1_Game_Events + * @note For a list of HL engine messages, visit https://wiki.alliedmods.net/Half-Life_1_Engine_Messages + * @note You may also refer to the messages_const.inc file for examples. + * @note This function is the same as message_begin(), except that the messages + * sent with this one are also sent to all other AMXX and Metamod plugins. + * This means that if you send one of these messages, other plugins will + * be notified of that message, which was previously impossible. + * @note BE CAREFUL! Using this incorrectly, or not for its intended purpose, + * could cause infinite recursion or something just as bad! + * @note Each message starts with a emessage_begin() or emessage_begin_f() function + * and ends with emessage_end(). The specific message arguments go in between + * these two by using the ewrite_*() functions found in messages.inc. + * + * @param dest Destination type (see MSG_* constants in messages_const.inc) + * @param msg_type Message id + * @param origin Message origin + * @param player Client index receiving the message or 0 for all clients + * + * @noreturn + * @error If an invalid message id is specified or an invalid number + * of parameters is passed, an error will be thrown. */ native emessage_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0); + +/** + * Marks the beginning of a client message. + * + * @note You may generate menus, smoke, shockwaves, thunderlights, + * intermission and many other messages. + * @note For a list of HL game events, visit https://wiki.alliedmods.net/Half-Life_1_Game_Events + * @note For a list of HL engine messages, visit https://wiki.alliedmods.net/Half-Life_1_Engine_Messages + * @note You may also refer to the messages_const.inc file for examples. + * @note This function is the same as message_begin_f(), except that the messages + * sent with this one are also sent to all other AMXX and Metamod plugins. + * This means that if you send one of these messages, other plugins will + * be notified of that message, which was previously impossible. + * @note BE CAREFUL! Using this incorrectly, or not for its intended purpose, + * could cause infinite recursion or something just as bad! + * @note This function is the same as emessage_begin(), but the origin + * argument accepts only float values in this one. + * @note Each message starts with a emessage_begin() or emessage_begin_f() function + * and ends with emessage_end(). The specific message arguments go in between + * these two by using the ewrite_*() functions found in messages.inc. + * + * @param dest Destination type (see MSG_* constants in messages_const.inc) + * @param msg_type Message id + * @param origin Message origin + * @param player Client index receiving the message or 0 for all clients + * + * @noreturn + * @error If an invalid message id is specified or an invalid number + * of parameters is passed, an error will be thrown. + */ native emessage_begin_f(dest, msg_type, const Float:origin[3] = {0.0,0.0,0.0}, player = 0); + +/** + * Ends a message that was started with emessage_begin() or emessage_begin_f(). + * + * @note If the function is called without using emessage_begin() or + * emessage_begin_f() first, the server will crash immediately. + * + * @noreturn + */ native emessage_end(); + +/** + * Writes a single byte to a message. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Byte to write + * + * @noreturn + */ native ewrite_byte(x); + +/** + * Writes a single character to a message. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Character to write + * + * @noreturn + */ native ewrite_char(x); + +/** + * Writes a single number to a message (short). + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Number to write + * + * @noreturn + */ native ewrite_short(x); + +/** + * Writes a single number to a message (long). + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Number to write + * + * @noreturn + */ native ewrite_long(x); + +/** + * Writes an entity index to a message. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Entity index to write + * + * @noreturn + */ native ewrite_entity(x); + +/** + * Writes an angle entry to a message. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Angle to write + * + * @noreturn + */ native ewrite_angle(x); + +/** + * Writes an angle entry to a message using a float value. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Angle to write + * + * @noreturn + */ native ewrite_angle_f(Float:x); + +/** + * Writes a coordinate entry to a message. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Coordinate to write + * + * @noreturn + */ native ewrite_coord(x); + +/** + * Writes a coordinate entry to a message using a float value. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x Coordinate to write + * + * @noreturn + */ native ewrite_coord_f(Float:x); + +/** + * Writes a string to a message. + * + * @note This function should only be used in between a emessage_begin() + * or emessage_begin_f() and a emessage_end() function. Trying to use + * it outside of these functions will crash the server immediately. + * + * @param x String to write + * + * @noreturn + */ native ewrite_string(const x[]); -/* Sets/Gets what engine messages are blocked. */ +/** + * Sets whether or not an engine message will be blocked. + * + * @note For a list of message flags, have a look at the BLOCK_* constants + * in message_const.inc. + * + * @param iMessage Message id + * @param iMessageFlags BLOCK_* constant + * + * @noreturn + * @error If an invalid message id is specified, an error + * will be thrown. + */ native set_msg_block(iMessage, iMessageFlags); + +/** + * Gets whether or not an engine message is blocked. + * + * @param iMessage Message id + * + * @return BLOCK_* constant + * @error If an invalid message id is specified, an error + * will be thrown. + */ native get_msg_block(iMessage); -/* Lets you directly hook a message in the engine! - * You can overwrite the message before anything happens and either let the message continue - * or fully block it. Here is how it works: - * If you hook a message, the message is stored but not sent. You have the opportunity to - * not only execute code, but to get/set the contents of the message, before you choose to - * either block it or let it go on its way. The hooked function will be passed a msg_id, msg_dest, and entity index. - * The return value can be passed to unregister_message() to stop the message from being hooked */ +/** + * Lets you directly hook a message in the engine. + * + * @note The function is called in the following manner: + * msg_id - Message id + * msg_dest - Destination type (see MSG_* constants in messages_const.inc) + * msg_entity - Entity receiving the message + * + * @note You can overwrite the message before anything happens by using the + * set_msg_arg_* functions and either let the message continue by + * returning PLUGIN_CONTINUE or fully block it with PLUGIN_HANDLED. + * @note If you hook a message, the message is stored but not sent. You have + * the opportunity to not only execute code, but to get/set the contents + * of the message before you choose to either block it or let it go on + * its way. + * @note The return value can be passed to unregister_message() in order to + * stop the message from being hooked. + * + * @param iMsgId Message id + * @param szFunction Function that will be called + * + * @return Id that can be passed to unregister_message() on + * success, or 0 if an invalid message id is passed + * @error If the specified function can't be found, an + * error will be thrown. + */ native register_message(iMsgId, const szFunction[]); -/* Unregisters a message hook previously created with register_message - * You must pass the proper message id, and return value from the message to unregister the message successfully. */ +/** + * Unregisters a message hook previously created with register_message(). + * + * @note You must pass the proper message id and return value from the + * message to unregister the message successfully. + * + * @param iMsgId Message id + * @param registeredmsg Registered message id + * + * @return Id that can again be passed to register_message() on + * success, or 0 if an invalid message id is passed + * @error If an invalid registered message handle is passed, an + * error will be thrown. + */ native unregister_message(iMsgId, registeredmsg); - -/* The get/set _msg commands will fail if used outside a hooked message scope. - * They should never be used unless inside a registered message function. - * There are eight different ways of sending a message, five are ints, two are floats, and one is string. - * These are denoted by iArgType. argn is the number - * of the argument. Exceeding the bounds of 1 to get_msg_args() is a bad idea. - * As of AMX Mod X 1.5, the middle parameter of set_* no longer does anything. - * You cannot change the message argument type (as this would crash the mod anyway) +/** + * Gets number of arguments that were passed to a message. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @return Number of arguments */ - -/* Gets number of arguments that were passed to this message */ native get_msg_args(); -/* Gets the argument type of argument argn */ +/** + * Gets the argument type of a specified argument. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param argn Argument number + * + * @return Argument type (see ARG_* constants in message_const.inc) + */ native get_msg_argtype(argn); -/* Gets the value of argn. */ +/** + * Gets the integer value of a specified argument. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param argn Argument number + * + * @return Argument value as an integer + * @error If an invalid message argument is passed, an + * error will be thrown. + */ native get_msg_arg_int(argn); + +/** + * Gets the float value of a specified argument. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param argn Argument number + * + * @return Argument value as a float + * @error If an invalid message argument is passed, an + * error will be thrown. + */ native Float:get_msg_arg_float(argn); + +/** + * Gets the string value from a specified argument. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param argn Argument number + * @param szReturn Buffer to store the value in + * @param iLength Maximum buffer length + * + * @return String length + * @error If an invalid message argument is passed, an + * error will be thrown. + */ native get_msg_arg_string(argn, szReturn[], iLength); -/* sets the value of argn. */ +/** + * Sets the integer value of a specified argument. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param argn Argument number + * @param argtype Argument type (see ARG_* constants in message_const.inc) + * @param iValue Argument value + * + * @noreturn + * @error If an invalid message argument is passed, an + * error will be thrown. + */ native set_msg_arg_int(argn, argtype, iValue); + +/** + * Sets the float value of a specified argument. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param argn Argument number + * @param argtype Argument type (see ARG_* constants in message_const.inc) + * @param fValue Argument value + * + * @noreturn + * @error If an invalid message argument is passed, an + * error will be thrown. + */ native set_msg_arg_float(argn, argtype, Float:fValue); + +/** + * Sets the string value of a specified argument. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param argn Argument number + * @param szString Argument value + * + * @noreturn + * @error If an invalid message argument is passed, an + * error will be thrown. + */ native set_msg_arg_string(argn, const szString[]); -/* Gets the origin of a message */ +/** + * Gets the origin of a message. + * + * @note This function will fail if used outside a hooked message scope, thus + * it should never be used unless inside a registered message function. + * + * @param _Origin Array to store the origin in + * + * @noreturn + * @error If the function is used outside a message hook, an + * error will be thrown. + */ native get_msg_origin(const Float:_Origin[3]); diff --git a/plugins/include/tfcstats.inc b/plugins/include/tfcstats.inc index 9417a0f6..367406a3 100755 --- a/plugins/include/tfcstats.inc +++ b/plugins/include/tfcstats.inc @@ -27,28 +27,28 @@ * 5 - hits * 6 - damage * For body hits fields see amxconst.inc. */ -native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]); +native get_user_wstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets round stats from given weapon index.*/ -native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]); +native get_user_wrstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets overall stats which are stored in file on server * and updated on every respawn or user disconnect. * Function returns the position in stats by diff. kills to deaths. */ -native get_user_stats(index,stats[8],bodyhits[8]); +native get_user_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets round stats of player. */ -native get_user_rstats(index,stats[8],bodyhits[8]); +native get_user_rstats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets stats with which user have killed/hurt his victim. If victim is 0 * then stats are from all victims. If victim has not been hurt, function * returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0); +native get_user_vstats(index,victim,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0); /* Gets stats with which user have been killed/hurt. If killer is 0 * then stats are from all attacks. If killer has not hurt user, function * returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0); +native get_user_astats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0); /* Resets life, weapon, victims and attackers user stats. */ native reset_user_wstats(index); @@ -56,7 +56,7 @@ native reset_user_wstats(index); /* Gets overall stats which stored in stats.dat file in amx folder * and updated on every mapchange or user disconnect. * Function returns next index of stats entry or 0 if no more exists. */ -native get_stats(index,stats[8],bodyhits[8],name[],len); +native get_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],name[],len); /* Returns number of all entries in stats. */ native get_statsnum(); diff --git a/plugins/include/tsstats.inc b/plugins/include/tsstats.inc index 4b43a784..dd2ba60a 100755 --- a/plugins/include/tsstats.inc +++ b/plugins/include/tsstats.inc @@ -27,31 +27,31 @@ * 5 - hits * 6 - damage * For body hits fields see amxconst.inc. */ -native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]); +native get_user_wstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets round stats from given weapon index.*/ -native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]); +native get_user_wrstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets life (from spawn to spawn) stats from given weapon index.*/ -native get_user_wlstats(index,wpnindex,stats[8],bodyhits[8]); +native get_user_wlstats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets overall stats which are stored in file on server * and updated on every respawn or user disconnect. * Function returns the position in stats by diff. kills to deaths. */ -native get_user_stats(index,stats[8],bodyhits[8]); +native get_user_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets round stats of player. */ -native get_user_rstats(index,stats[8],bodyhits[8]); +native get_user_rstats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]); /* Gets stats with which user have killed/hurt his victim. If victim is 0 * then stats are from all victims. If victim has not been hurt, function * returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0); +native get_user_vstats(index,victim,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0); /* Gets stats with which user have been killed/hurt. If killer is 0 * then stats are from all attacks. If killer has not hurt user, function * returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0); +native get_user_astats(index,wpnindex,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],wpnname[]="",len=0); /* Resets life, weapon, victims and attackers user stats. */ native reset_user_wstats(index); @@ -59,7 +59,7 @@ native reset_user_wstats(index); /* Gets overall stats which stored in stats.dat file in amx folder * and updated on every mapchange or user disconnect. * Function returns next index of stats entry or 0 if no more exists. */ -native get_stats(index,stats[8],bodyhits[8],name[],len); +native get_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS],name[],len); /* Returns number of all entries in stats. */ native get_statsnum(); diff --git a/public/amtl b/public/amtl index c91e8560..bee3fc51 160000 --- a/public/amtl +++ b/public/amtl @@ -1 +1 @@ -Subproject commit c91e8560fb00984465a1a916172123b80a76dd04 +Subproject commit bee3fc51a95a6aab4143779316353ed64531fbf3 diff --git a/public/engine_strucs.h b/public/engine_strucs.h index c426466d..bb3bf806 100644 --- a/public/engine_strucs.h +++ b/public/engine_strucs.h @@ -516,4 +516,16 @@ typedef struct client_s } client_t; +using cvar_callback_t = void (*)(const char *pszNewValue); + +struct cvar_listener_t +{ + cvar_listener_t(const char *var_name, cvar_callback_t handler) : + func(handler), name(var_name) {} + + cvar_callback_t func; + const char *name; +}; + + #endif //_ENGINE_STRUCTS_H_ diff --git a/public/resdk/common/hookchains.h b/public/resdk/common/hookchains.h index 7ea472a6..38b8747a 100644 --- a/public/resdk/common/hookchains.h +++ b/public/resdk/common/hookchains.h @@ -25,6 +25,7 @@ * version. * */ + #pragma once template diff --git a/public/resdk/cstrike/API/CSEntity.h b/public/resdk/cstrike/API/CSEntity.h new file mode 100644 index 00000000..ef47f30f --- /dev/null +++ b/public/resdk/cstrike/API/CSEntity.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 + +class CBaseEntity; +class CCSEntity +{ +public: + virtual ~CCSEntity() {} + virtual void FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker); + virtual Vector FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand); + +public: + CBaseEntity *m_pContainingEntity; +}; + +class CCSDelay: public CCSEntity +{ +public: + +}; + +class CCSAnimating: public CCSDelay +{ +public: + +}; + +class CCSToggle: public CCSAnimating +{ +public: + +}; + +class CCSMonster: public CCSToggle +{ +public: + +}; diff --git a/public/resdk/cstrike/regamedll_interfaces.h b/public/resdk/cstrike/API/CSInterfaces.h similarity index 75% rename from public/resdk/cstrike/regamedll_interfaces.h rename to public/resdk/cstrike/API/CSInterfaces.h index cf49c325..a17e3379 100644 --- a/public/resdk/cstrike/regamedll_interfaces.h +++ b/public/resdk/cstrike/API/CSInterfaces.h @@ -28,89 +28,17 @@ #pragma once -#include "regamedll_const.h" +#include "CSEntity.h" +#include "CSPlayer.h" -class CBaseEntity; -class CBasePlayer; - -// Implementation wrapper -class CCSEntity { -public: - virtual ~CCSEntity() {} - virtual void FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker); - virtual Vector FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand); -public: - CBaseEntity *m_pContainingEntity; -}; - -class CCSDelay: public CCSEntity {}; -class CCSAnimating: public CCSDelay {}; -class CCSPlayerItem: public CCSAnimating {}; -class CCSToggle: public CCSAnimating {}; -class CCSMonster: public CCSToggle {}; class CCSWeaponBox: public CCSEntity {}; class CCSArmoury: public CCSEntity {}; - -class CCSPlayer: public CCSMonster { -public: - CCSPlayer() : m_bForceShowMenu(false) - { - m_szModel[0] = '\0'; - } - - virtual bool IsConnected() const; - virtual void SetAnimation(PLAYER_ANIM playerAnim); - virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true); - virtual CBaseEntity *GiveNamedItem(const char *pszName); - virtual CBaseEntity *GiveNamedItemEx(const char *pszName); - virtual void GiveDefaultItems(); - virtual void GiveShield(bool bDeploy = true); - virtual void DropShield(bool bDeploy = true); - virtual void DropPlayerItem(const char *pszItemName); - virtual void RemoveShield(); - virtual void RemoveAllItems(bool bRemoveSuit); - virtual bool RemovePlayerItem(const char* pszItemName); - virtual void SetPlayerModel(bool bHasC4); - virtual void SetPlayerModelEx(const char *modelName); - virtual void SetNewPlayerModel(const char *modelName); - virtual void ClientCommand(const char *cmd, const char *arg1 = nullptr, const char *arg2 = nullptr, const char *arg3 = nullptr); - virtual void SetProgressBarTime(int time); - virtual void SetProgressBarTime2(int time, float timeElapsed); - virtual struct edict_s *EntSelectSpawnPoint(); - virtual void SetBombIcon(bool bFlash = false); - virtual void SetScoreAttrib(CBasePlayer *dest); - virtual void SendItemStatus(); - virtual void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false); - virtual void Observer_SetMode(int iMode); - virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot); - virtual bool SwitchWeapon(CBasePlayerItem *pWeapon); - virtual void SwitchTeam(); - virtual bool JoinTeam(TeamName team); - virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle); - virtual void TeamChangeUpdate(); - virtual void DropSecondary(); - virtual void DropPrimary(); - virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem); - virtual bool HasNamedPlayerItem(const char *pszItemName); - virtual CBasePlayerItem *GetItemById(WeaponIdType weaponID); - virtual CBasePlayerItem *GetItemByName(const char *itemName); - virtual void Disappear(); - virtual void MakeVIP(); - virtual bool MakeBomber(); - - CBasePlayer *BasePlayer() const; -public: - char m_szModel[32]; - bool m_bForceShowMenu; -}; - class CAPI_Bot: public CCSPlayer {}; class CAPI_CSBot: public CAPI_Bot {}; class CCSShield: public CCSEntity {}; class CCSDeadHEV: public CCSMonster {}; class CCSSprayCan: public CCSEntity {}; class CCSBloodSplat: public CCSEntity {}; -class CCSPlayerWeapon: public CCSPlayerItem {}; class CCSWorld: public CCSEntity {}; class CCSDecal: public CCSEntity {}; class CCSCorpse: public CCSEntity {}; @@ -297,7 +225,6 @@ class CCSTriggerChangeTarget: public CCSDelay {}; class CCSTriggerCamera: public CCSDelay {}; class CCSWeather: public CCSTrigger {}; class CCSClientFog: public CCSEntity {}; - -inline CBasePlayer *CCSPlayer::BasePlayer() const { - return reinterpret_cast(this->m_pContainingEntity); -} +class CCSTriggerSetOrigin: public CCSDelay {}; +class CCSTriggerRandom: public CCSDelay {}; +class CCSItemAirBox: public CCSArmoury {}; diff --git a/public/resdk/cstrike/API/CSPlayer.h b/public/resdk/cstrike/API/CSPlayer.h new file mode 100644 index 00000000..46a88fe4 --- /dev/null +++ b/public/resdk/cstrike/API/CSPlayer.h @@ -0,0 +1,123 @@ +/* +* +* 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 "CSPlayerItem.h" +#include "CSPlayerWeapon.h" + +class CCSPlayer: public CCSMonster { +public: + CCSPlayer() : m_bForceShowMenu(false), m_flRespawnPending(0), m_flSpawnProtectionEndTime(0) + { + m_szModel[0] = '\0'; + } + + virtual bool IsConnected() const; + virtual void SetAnimation(PLAYER_ANIM playerAnim); + virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true); + virtual CBaseEntity *GiveNamedItem(const char *pszName); + virtual CBaseEntity *GiveNamedItemEx(const char *pszName); + virtual void GiveDefaultItems(); + virtual void GiveShield(bool bDeploy = true); + virtual void DropShield(bool bDeploy = true); + virtual void DropPlayerItem(const char *pszItemName); + virtual void RemoveShield(); + virtual void RemoveAllItems(bool bRemoveSuit); + virtual bool RemovePlayerItem(const char* pszItemName); + virtual void SetPlayerModel(bool bHasC4); + virtual void SetPlayerModelEx(const char *modelName); + virtual void SetNewPlayerModel(const char *modelName); + virtual void ClientCommand(const char *cmd, const char *arg1 = nullptr, const char *arg2 = nullptr, const char *arg3 = nullptr); + virtual void SetProgressBarTime(int time); + virtual void SetProgressBarTime2(int time, float timeElapsed); + virtual struct edict_s *EntSelectSpawnPoint(); + virtual void SetBombIcon(bool bFlash = false); + virtual void SetScoreAttrib(CBasePlayer *dest); + virtual void SendItemStatus(); + virtual void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false); + virtual void Observer_SetMode(int iMode); + virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot); + virtual bool SwitchWeapon(CBasePlayerItem *pWeapon); + virtual void SwitchTeam(); + virtual bool JoinTeam(TeamName team); + virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle); + virtual void TeamChangeUpdate(); + virtual void DropSecondary(); + virtual void DropPrimary(); + virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem); + virtual bool HasNamedPlayerItem(const char *pszItemName); + virtual CBasePlayerItem *GetItemById(WeaponIdType weaponID); + virtual CBasePlayerItem *GetItemByName(const char *itemName); + virtual void Disappear(); + virtual void MakeVIP(); + virtual bool MakeBomber(); + virtual void ResetSequenceInfo(); + virtual void StartDeathCam(); + virtual bool RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo); + virtual void SetSpawnProtection(float flProtectionTime); + virtual void RemoveSpawnProtection(); + + CBasePlayer *BasePlayer() const; + +public: + enum EProtectionState + { + ProtectionSt_NoSet, + ProtectionSt_Active, + ProtectionSt_Expired, + }; + + EProtectionState GetProtectionState() const; + +public: + char m_szModel[32]; + bool m_bForceShowMenu; + float m_flRespawnPending; + float m_flSpawnProtectionEndTime; +}; + +// Inlines +inline CBasePlayer *CCSPlayer::BasePlayer() const +{ + return reinterpret_cast(this->m_pContainingEntity); +} + +inline CCSPlayer::EProtectionState CCSPlayer::GetProtectionState() const +{ + // no protection set + if (m_flSpawnProtectionEndTime <= 0.0f) + return ProtectionSt_NoSet; + + // check if end time of protection isn't expired yet + if (m_flSpawnProtectionEndTime >= gpGlobals->time) + return ProtectionSt_Active; + + // has expired + return ProtectionSt_Expired; +} diff --git a/public/resdk/cstrike/API/CSPlayerItem.h b/public/resdk/cstrike/API/CSPlayerItem.h new file mode 100644 index 00000000..633f3252 --- /dev/null +++ b/public/resdk/cstrike/API/CSPlayerItem.h @@ -0,0 +1,68 @@ +/* +* +* 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 +{ + 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; +} +ItemInfo; + +class CBasePlayerItem; +class CCSPlayerItem: public CCSAnimating +{ +public: + CCSPlayerItem() + { + memset(&m_ItemInfo, 0, sizeof(m_ItemInfo)); + } + + virtual void SetItemInfo(ItemInfo *pInfo); + + CBasePlayerItem *BasePlayerItem() const; + +public: + ItemInfo m_ItemInfo; +}; + +// Inlines +inline CBasePlayerItem *CCSPlayerItem::BasePlayerItem() const +{ + return reinterpret_cast(this->m_pContainingEntity); +} diff --git a/public/resdk/cstrike/API/CSPlayerWeapon.h b/public/resdk/cstrike/API/CSPlayerWeapon.h new file mode 100644 index 00000000..32e32f90 --- /dev/null +++ b/public/resdk/cstrike/API/CSPlayerWeapon.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 + +class CBasePlayerWeapon; +class CCSPlayerWeapon: public CCSPlayerItem +{ +public: + CCSPlayerWeapon() : + m_bHasSecondaryAttack(false) + { + } + + CBasePlayerWeapon *BasePlayerWeapon() const; + +public: + bool m_bHasSecondaryAttack; +}; + +// Inlines +inline CBasePlayerWeapon *CCSPlayerWeapon::BasePlayerWeapon() const +{ + return reinterpret_cast(this->m_pContainingEntity); +} diff --git a/public/resdk/cstrike/regamedll_api.h b/public/resdk/cstrike/regamedll_api.h index 81999943..e92845bc 100644 --- a/public/resdk/cstrike/regamedll_api.h +++ b/public/resdk/cstrike/regamedll_api.h @@ -25,23 +25,24 @@ * version. * */ + #pragma once #include -#include "regamedll_interfaces.h" #include "regamedll_const.h" +#include "API/CSInterfaces.h" #include "../common/hookchains.h" #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 1 +#define REGAMEDLL_API_VERSION_MINOR 8 // CBasePlayer::Spawn hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Spawn; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Spawn; +typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Spawn; // CBasePlayer::Precache hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Precache; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Precache; +typedef IHookChainClass IReGameHook_CBasePlayer_Precache; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Precache; // CBasePlayer::ObjectCaps hook typedef IHookChainClass IReGameHook_CBasePlayer_ObjectCaps; @@ -52,8 +53,8 @@ typedef IHookChainClass IReGameHook_CBasePlayer_Classify typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Classify; // CBasePlayer::TraceAttack hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_TraceAttack; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TraceAttack; +typedef IHookChainClass IReGameHook_CBasePlayer_TraceAttack; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TraceAttack; // CBasePlayer::TakeDamage hook typedef IHookChainClass IReGameHook_CBasePlayer_TakeDamage; @@ -64,16 +65,16 @@ typedef IHookChainClass IReGameHook_CBasePl typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_TakeHealth; // CBasePlayer::Killed hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Killed; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Killed; +typedef IHookChainClass IReGameHook_CBasePlayer_Killed; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Killed; // CBasePlayer::AddPoints hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_AddPoints; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPoints; +typedef IHookChainClass IReGameHook_CBasePlayer_AddPoints; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPoints; // CBasePlayer::AddPointsToTeam hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_AddPointsToTeam; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPointsToTeam; +typedef IHookChainClass IReGameHook_CBasePlayer_AddPointsToTeam; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddPointsToTeam; // CBasePlayer::AddPlayerItem hook typedef IHookChainClass IReGameHook_CBasePlayer_AddPlayerItem; @@ -84,72 +85,72 @@ typedef IHookChainClass IReGam typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemovePlayerItem; // CBasePlayer::GiveAmmo hook -typedef IHookChainClass IReGameHook_CBasePlayer_GiveAmmo; -typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveAmmo; +typedef IHookChainClass IReGameHook_CBasePlayer_GiveAmmo; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveAmmo; // CBasePlayer::ResetMaxSpeed hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_ResetMaxSpeed; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ResetMaxSpeed; +typedef IHookChainClass IReGameHook_CBasePlayer_ResetMaxSpeed; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ResetMaxSpeed; // CBasePlayer::Jump hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Jump; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Jump; +typedef IHookChainClass IReGameHook_CBasePlayer_Jump; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Jump; // CBasePlayer::Duck hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Duck; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Duck; +typedef IHookChainClass IReGameHook_CBasePlayer_Duck; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Duck; // CBasePlayer::PreThink hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_PreThink; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PreThink; +typedef IHookChainClass IReGameHook_CBasePlayer_PreThink; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PreThink; // CBasePlayer::PostThink hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_PostThink; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PostThink; +typedef IHookChainClass IReGameHook_CBasePlayer_PostThink; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_PostThink; // CBasePlayer::UpdateClientData hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_UpdateClientData; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_UpdateClientData; +typedef IHookChainClass IReGameHook_CBasePlayer_UpdateClientData; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_UpdateClientData; // CBasePlayer::ImpulseCommands hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_ImpulseCommands; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ImpulseCommands; +typedef IHookChainClass IReGameHook_CBasePlayer_ImpulseCommands; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ImpulseCommands; // CBasePlayer::RoundRespawn hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_RoundRespawn; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RoundRespawn; +typedef IHookChainClass IReGameHook_CBasePlayer_RoundRespawn; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RoundRespawn; // CBasePlayer::Blind hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Blind; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Blind; +typedef IHookChainClass IReGameHook_CBasePlayer_Blind; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Blind; // CBasePlayer::Observer_IsValidTarget hook typedef IHookChainClass IReGameHook_CBasePlayer_Observer_IsValidTarget; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget; // CBasePlayer::SetAnimation hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetAnimation; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetAnimation; +typedef IHookChainClass IReGameHook_CBasePlayer_SetAnimation; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetAnimation; // CBasePlayer::GiveDefaultItems hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_GiveDefaultItems; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveDefaultItems; +typedef IHookChainClass IReGameHook_CBasePlayer_GiveDefaultItems; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveDefaultItems; // CBasePlayer::GiveNamedItem hook typedef IHookChainClass IReGameHook_CBasePlayer_GiveNamedItem; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveNamedItem; // CBasePlayer::AddAccount hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_AddAccount; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddAccount; +typedef IHookChainClass IReGameHook_CBasePlayer_AddAccount; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_AddAccount; // CBasePlayer::GiveShield hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_GiveShield; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveShield; +typedef IHookChainClass IReGameHook_CBasePlayer_GiveShield; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveShield; // CBasePlayer:SetClientUserInfoModel hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoModel; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel; +typedef IHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoModel; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel; // CBasePlayer:SetClientUserInfoName hook typedef IHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoName; @@ -160,56 +161,56 @@ typedef IHookChainClass IReGameHo typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_HasRestrictItem; // CBasePlayer::DropPlayerItem hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_DropPlayerItem; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropPlayerItem; +typedef IHookChainClass IReGameHook_CBasePlayer_DropPlayerItem; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropPlayerItem; // CBasePlayer::DropShield hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_DropShield; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropShield; +typedef IHookChainClass IReGameHook_CBasePlayer_DropShield; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropShield; // CBasePlayer::OnSpawnEquip hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_OnSpawnEquip; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_OnSpawnEquip; +typedef IHookChainClass IReGameHook_CBasePlayer_OnSpawnEquip; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_OnSpawnEquip; // CBasePlayer::Radio hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Radio; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Radio; +typedef IHookChainClass IReGameHook_CBasePlayer_Radio; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Radio; // CBasePlayer::Disappear hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_Disappear; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Disappear; +typedef IHookChainClass IReGameHook_CBasePlayer_Disappear; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_Disappear; // CBasePlayer::MakeVIP hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_MakeVIP; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_MakeVIP; +typedef IHookChainClass IReGameHook_CBasePlayer_MakeVIP; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_MakeVIP; // CBasePlayer::MakeBomber hook typedef IHookChainClass IReGameHook_CBasePlayer_MakeBomber; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_MakeBomber; // CBasePlayer::StartObserver hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_StartObserver; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_StartObserver; +typedef IHookChainClass IReGameHook_CBasePlayer_StartObserver; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_StartObserver; // CBasePlayer::GetIntoGame hook typedef IHookChainClass IReGameHook_CBasePlayer_GetIntoGame; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GetIntoGame; // CBaseAnimating::ResetSequenceInfo hook -typedef IVoidHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; +typedef IHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; +typedef IHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; // GetForceCamera hook typedef IHookChain IReGameHook_GetForceCamera; typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; // PlayerBlind hook -typedef IVoidHookChain IReGameHook_PlayerBlind; -typedef IVoidHookChainRegistry IReGameHookRegistry_PlayerBlind; +typedef IHookChain IReGameHook_PlayerBlind; +typedef IHookChainRegistry IReGameHookRegistry_PlayerBlind; // RadiusFlash_TraceLine hook -typedef IVoidHookChain IReGameHook_RadiusFlash_TraceLine; -typedef IVoidHookChainRegistry IReGameHookRegistry_RadiusFlash_TraceLine; +typedef IHookChain IReGameHook_RadiusFlash_TraceLine; +typedef IHookChainRegistry IReGameHookRegistry_RadiusFlash_TraceLine; // RoundEnd hook typedef IHookChain IReGameHook_RoundEnd; @@ -220,32 +221,32 @@ typedef IHookChain IReGameHook_InstallGameRules; typedef IHookChainRegistry IReGameHookRegistry_InstallGameRules; // PM_Init hook -typedef IVoidHookChain IReGameHook_PM_Init; -typedef IVoidHookChainRegistry IReGameHookRegistry_PM_Init; +typedef IHookChain IReGameHook_PM_Init; +typedef IHookChainRegistry IReGameHookRegistry_PM_Init; // PM_Move hook -typedef IVoidHookChain IReGameHook_PM_Move; -typedef IVoidHookChainRegistry IReGameHookRegistry_PM_Move; +typedef IHookChain IReGameHook_PM_Move; +typedef IHookChainRegistry IReGameHookRegistry_PM_Move; // PM_AirMove hook -typedef IVoidHookChain IReGameHook_PM_AirMove; -typedef IVoidHookChainRegistry IReGameHookRegistry_PM_AirMove; +typedef IHookChain IReGameHook_PM_AirMove; +typedef IHookChainRegistry IReGameHookRegistry_PM_AirMove; // HandleMenu_ChooseAppearance hook -typedef IVoidHookChain IReGameHook_HandleMenu_ChooseAppearance; -typedef IVoidHookChainRegistry IReGameHookRegistry_HandleMenu_ChooseAppearance; +typedef IHookChain IReGameHook_HandleMenu_ChooseAppearance; +typedef IHookChainRegistry IReGameHookRegistry_HandleMenu_ChooseAppearance; // HandleMenu_ChooseTeam hook typedef IHookChain IReGameHook_HandleMenu_ChooseTeam; typedef IHookChainRegistry IReGameHookRegistry_HandleMenu_ChooseTeam; // ShowMenu hook -typedef IVoidHookChain IReGameHook_ShowMenu; -typedef IVoidHookChainRegistry IReGameHookRegistry_ShowMenu; +typedef IHookChain IReGameHook_ShowMenu; +typedef IHookChainRegistry IReGameHookRegistry_ShowMenu; // ShowVGUIMenu hook -typedef IVoidHookChain IReGameHook_ShowVGUIMenu; -typedef IVoidHookChainRegistry IReGameHookRegistry_ShowVGUIMenu; +typedef IHookChain IReGameHook_ShowVGUIMenu; +typedef IHookChainRegistry IReGameHookRegistry_ShowVGUIMenu; // BuyGunAmmo hook typedef IHookChain IReGameHook_BuyGunAmmo; @@ -256,8 +257,8 @@ typedef IHookChain IReGa typedef IHookChainRegistry IReGameHookRegistry_BuyWeaponByWeaponID; // InternalCommand hook -typedef IVoidHookChain IReGameHook_InternalCommand; -typedef IVoidHookChainRegistry IReGameHookRegistry_InternalCommand; +typedef IHookChain IReGameHook_InternalCommand; +typedef IHookChainRegistry IReGameHookRegistry_InternalCommand; // CHalfLifeMultiplay::FShouldSwitchWeapon hook typedef IHookChain IReGameHook_CSGameRules_FShouldSwitchWeapon; @@ -276,8 +277,8 @@ typedef IHookChain IReGameHook_CSGameR typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage; // CHalfLifeMultiplay::PlayerSpawn hook -typedef IVoidHookChain IReGameHook_CSGameRules_PlayerSpawn; -typedef IVoidHookChainRegistry IReGameHookRegistry_CSGameRules_PlayerSpawn; +typedef IHookChain IReGameHook_CSGameRules_PlayerSpawn; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_PlayerSpawn; // CHalfLifeMultiplay::FPlayerCanRespawn hook typedef IHookChain IReGameHook_CSGameRules_FPlayerCanRespawn; @@ -288,16 +289,16 @@ typedef IHookChain IReGameHook_CSGameRule typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot; // CHalfLifeMultiplay::ClientUserInfoChanged hook -typedef IVoidHookChain IReGameHook_CSGameRules_ClientUserInfoChanged; -typedef IVoidHookChainRegistry IReGameHookRegistry_CSGameRules_ClientUserInfoChanged; +typedef IHookChain IReGameHook_CSGameRules_ClientUserInfoChanged; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_ClientUserInfoChanged; // CHalfLifeMultiplay::PlayerKilled hook -typedef IVoidHookChain IReGameHook_CSGameRules_PlayerKilled; -typedef IVoidHookChainRegistry IReGameHookRegistry_CSGameRules_PlayerKilled; +typedef IHookChain IReGameHook_CSGameRules_PlayerKilled; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_PlayerKilled; // CHalfLifeMultiplay::DeathNotice hook -typedef IVoidHookChain IReGameHook_CSGameRules_DeathNotice; -typedef IVoidHookChainRegistry IReGameHookRegistry_CSGameRules_DeathNotice; +typedef IHookChain IReGameHook_CSGameRules_DeathNotice; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_DeathNotice; // CHalfLifeMultiplay::CanHavePlayerItem hook typedef IHookChain IReGameHook_CSGameRules_CanHavePlayerItem; @@ -308,142 +309,237 @@ typedef IHookChain IReGameHook_CSGameRules_DeadPlayerW typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_DeadPlayerWeapons; // CHalfLifeMultiplay::ServerDeactivate hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_ServerDeactivate; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ServerDeactivate; +typedef IHookChain IReGameHook_CSGameRules_ServerDeactivate; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_ServerDeactivate; // CHalfLifeMultiplay::CheckMapConditions hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckMapConditions; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckMapConditions; +typedef IHookChain IReGameHook_CSGameRules_CheckMapConditions; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckMapConditions; // CHalfLifeMultiplay::CleanUpMap hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_CleanUpMap; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CleanUpMap; +typedef IHookChain IReGameHook_CSGameRules_CleanUpMap; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CleanUpMap; // CHalfLifeMultiplay::RestartRound hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_RestartRound; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RestartRound; +typedef IHookChain IReGameHook_CSGameRules_RestartRound; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_RestartRound; // CHalfLifeMultiplay::CheckWinConditions hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_CheckWinConditions; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_CheckWinConditions; +typedef IHookChain IReGameHook_CSGameRules_CheckWinConditions; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CheckWinConditions; // CHalfLifeMultiplay::RemoveGuns hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_RemoveGuns; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_RemoveGuns; +typedef IHookChain IReGameHook_CSGameRules_RemoveGuns; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_RemoveGuns; // CHalfLifeMultiplay::GiveC4 hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_GiveC4; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GiveC4; +typedef IHookChain IReGameHook_CSGameRules_GiveC4; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_GiveC4; // CHalfLifeMultiplay::ChangeLevel hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_ChangeLevel; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_ChangeLevel; +typedef IHookChain IReGameHook_CSGameRules_ChangeLevel; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_ChangeLevel; // CHalfLifeMultiplay::GoToIntermission hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_GoToIntermission; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermission; +typedef IHookChain IReGameHook_CSGameRules_GoToIntermission; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_GoToIntermission; // CHalfLifeMultiplay::BalanceTeams hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams; +typedef IHookChain IReGameHook_CSGameRules_BalanceTeams; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_BalanceTeams; // CHalfLifeMultiplay::OnRoundFreezeEnd hook -typedef IVoidHookChain<> IReGameHook_CSGameRules_OnRoundFreezeEnd; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; +typedef IHookChain IReGameHook_CSGameRules_OnRoundFreezeEnd; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd; + +// CSGameRules::CanPlayerHearPlayer hook +typedef IHookChain IReGameHook_CSGameRules_CanPlayerHearPlayer; +typedef IHookChainRegistry IReGameHookRegistry_CSGameRules_CanPlayerHearPlayer; // PM_UpdateStepSound hook -typedef IVoidHookChain<> IReGameHook_PM_UpdateStepSound; -typedef IVoidHookChainRegistry<> IReGameHookRegistry_PM_UpdateStepSound; +typedef IHookChain IReGameHook_PM_UpdateStepSound; +typedef IHookChainRegistry IReGameHookRegistry_PM_UpdateStepSound; + +// CBasePlayer::StartDeathCam hook +typedef IHookChainClass IReGameHook_CBasePlayer_StartDeathCam; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_StartDeathCam; + +// CBasePlayer::SwitchTeam hook +typedef IHookChainClass IReGameHook_CBasePlayer_SwitchTeam; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SwitchTeam; + +// CBasePlayer::CanSwitchTeam hook +typedef IHookChainClass IReGameHook_CBasePlayer_CanSwitchTeam; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_CanSwitchTeam; + +// CBasePlayer::ThrowGrenade hook +typedef IHookChainClass IReGameHook_CBasePlayer_ThrowGrenade; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_ThrowGrenade; + +// CWeaponBox::SetModel hook +typedef IHookChainClass IReGameHook_CWeaponBox_SetModel; +typedef IHookChainRegistryClass IReGameHookRegistry_CWeaponBox_SetModel; + +// CGrenade::DefuseBombStart hook +typedef IHookChainClass IReGameHook_CGrenade_DefuseBombStart; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_DefuseBombStart; + +// CGrenade::DefuseBombEnd hook +typedef IHookChainClass IReGameHook_CGrenade_DefuseBombEnd; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_DefuseBombEnd; + +// CGrenade::ExplodeHeGrenade hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeHeGrenade; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeHeGrenade; + +// CGrenade::ExplodeFlashbang hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeFlashbang; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeFlashbang; + +// CGrenade::ExplodeSmokeGrenade hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeSmokeGrenade; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeSmokeGrenade; + +// CGrenade::ExplodeBomb hook +typedef IHookChainClass IReGameHook_CGrenade_ExplodeBomb; +typedef IHookChainRegistryClass IReGameHookRegistry_CGrenade_ExplodeBomb; + +// ThrowHeGrenade hook +typedef IHookChain IReGameHook_ThrowHeGrenade; +typedef IHookChainRegistry IReGameHookRegistry_ThrowHeGrenade; + +// ThrowFlashbang hook +typedef IHookChain IReGameHook_ThrowFlashbang; +typedef IHookChainRegistry IReGameHookRegistry_ThrowFlashbang; + +// ThrowSmokeGrenade hook +typedef IHookChain IReGameHook_ThrowSmokeGrenade; +typedef IHookChainRegistry IReGameHookRegistry_ThrowSmokeGrenade; + +// PlantBomb hook +typedef IHookChain IReGameHook_PlantBomb; +typedef IHookChainRegistry IReGameHookRegistry_PlantBomb; + +// CBasePlayer::SetSpawnProtection hook +typedef IHookChainClass IReGameHook_CBasePlayer_SetSpawnProtection; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetSpawnProtection; + +// CBasePlayer::RemoveSpawnProtection hook +typedef IHookChainClass IReGameHook_CBasePlayer_RemoveSpawnProtection; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_RemoveSpawnProtection; + +// IsPenetrableEntity hook +typedef IHookChain IReGameHook_IsPenetrableEntity; +typedef IHookChainRegistry IReGameHookRegistry_IsPenetrableEntity; 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_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_CBasePlayer_SetAnimation* CBasePlayer_SetAnimation() = 0; - virtual IReGameHookRegistry_CBasePlayer_GiveDefaultItems* CBasePlayer_GiveDefaultItems() = 0; - virtual IReGameHookRegistry_CBasePlayer_GiveNamedItem* CBasePlayer_GiveNamedItem() = 0; - virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount() = 0; - virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0; - virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0; - virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0; - virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0; - virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0; - virtual IReGameHookRegistry_CBasePlayer_DropShield* CBasePlayer_DropShield() = 0; - virtual IReGameHookRegistry_CBasePlayer_OnSpawnEquip* CBasePlayer_OnSpawnEquip() = 0; - virtual IReGameHookRegistry_CBasePlayer_Radio* CBasePlayer_Radio() = 0; - virtual IReGameHookRegistry_CBasePlayer_Disappear* CBasePlayer_Disappear() = 0; - virtual IReGameHookRegistry_CBasePlayer_MakeVIP* CBasePlayer_MakeVIP() = 0; - virtual IReGameHookRegistry_CBasePlayer_MakeBomber* CBasePlayer_MakeBomber() = 0; - virtual IReGameHookRegistry_CBasePlayer_StartObserver* CBasePlayer_StartObserver() = 0; - virtual IReGameHookRegistry_CBasePlayer_GetIntoGame* CBasePlayer_GetIntoGame() = 0; + virtual IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget *CBasePlayer_Observer_IsValidTarget() = 0; + virtual IReGameHookRegistry_CBasePlayer_SetAnimation *CBasePlayer_SetAnimation() = 0; + virtual IReGameHookRegistry_CBasePlayer_GiveDefaultItems *CBasePlayer_GiveDefaultItems() = 0; + virtual IReGameHookRegistry_CBasePlayer_GiveNamedItem *CBasePlayer_GiveNamedItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_AddAccount *CBasePlayer_AddAccount() = 0; + virtual IReGameHookRegistry_CBasePlayer_GiveShield *CBasePlayer_GiveShield() = 0; + virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel *CBasePlayer_SetClientUserInfoModel() = 0; + virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName *CBasePlayer_SetClientUserInfoName() = 0; + virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem *CBasePlayer_HasRestrictItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem *CBasePlayer_DropPlayerItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_DropShield *CBasePlayer_DropShield() = 0; + virtual IReGameHookRegistry_CBasePlayer_OnSpawnEquip *CBasePlayer_OnSpawnEquip() = 0; + virtual IReGameHookRegistry_CBasePlayer_Radio *CBasePlayer_Radio() = 0; + virtual IReGameHookRegistry_CBasePlayer_Disappear *CBasePlayer_Disappear() = 0; + virtual IReGameHookRegistry_CBasePlayer_MakeVIP *CBasePlayer_MakeVIP() = 0; + virtual IReGameHookRegistry_CBasePlayer_MakeBomber *CBasePlayer_MakeBomber() = 0; + virtual IReGameHookRegistry_CBasePlayer_StartObserver *CBasePlayer_StartObserver() = 0; + virtual IReGameHookRegistry_CBasePlayer_GetIntoGame *CBasePlayer_GetIntoGame() = 0; - virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0; + virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo *CBaseAnimating_ResetSequenceInfo() = 0; - virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0; - virtual IReGameHookRegistry_PlayerBlind* PlayerBlind() = 0; - virtual IReGameHookRegistry_RadiusFlash_TraceLine* RadiusFlash_TraceLine() = 0; - virtual IReGameHookRegistry_RoundEnd* RoundEnd() = 0; - virtual IReGameHookRegistry_InstallGameRules* InstallGameRules() = 0; - virtual IReGameHookRegistry_PM_Init* PM_Init() = 0; - virtual IReGameHookRegistry_PM_Move* PM_Move() = 0; - virtual IReGameHookRegistry_PM_AirMove* PM_AirMove() = 0; - virtual IReGameHookRegistry_HandleMenu_ChooseAppearance* HandleMenu_ChooseAppearance() = 0; - virtual IReGameHookRegistry_HandleMenu_ChooseTeam* HandleMenu_ChooseTeam() = 0; - virtual IReGameHookRegistry_ShowMenu* ShowMenu() = 0; - virtual IReGameHookRegistry_ShowVGUIMenu* ShowVGUIMenu() = 0; - virtual IReGameHookRegistry_BuyGunAmmo* BuyGunAmmo() = 0; - virtual IReGameHookRegistry_BuyWeaponByWeaponID* BuyWeaponByWeaponID() = 0; - virtual IReGameHookRegistry_InternalCommand* InternalCommand() = 0; + virtual IReGameHookRegistry_GetForceCamera *GetForceCamera() = 0; + virtual IReGameHookRegistry_PlayerBlind *PlayerBlind() = 0; + virtual IReGameHookRegistry_RadiusFlash_TraceLine *RadiusFlash_TraceLine() = 0; + virtual IReGameHookRegistry_RoundEnd *RoundEnd() = 0; + virtual IReGameHookRegistry_InstallGameRules *InstallGameRules() = 0; + virtual IReGameHookRegistry_PM_Init *PM_Init() = 0; + virtual IReGameHookRegistry_PM_Move *PM_Move() = 0; + virtual IReGameHookRegistry_PM_AirMove *PM_AirMove() = 0; + virtual IReGameHookRegistry_HandleMenu_ChooseAppearance *HandleMenu_ChooseAppearance() = 0; + virtual IReGameHookRegistry_HandleMenu_ChooseTeam *HandleMenu_ChooseTeam() = 0; + virtual IReGameHookRegistry_ShowMenu *ShowMenu() = 0; + virtual IReGameHookRegistry_ShowVGUIMenu *ShowVGUIMenu() = 0; + virtual IReGameHookRegistry_BuyGunAmmo *BuyGunAmmo() = 0; + virtual IReGameHookRegistry_BuyWeaponByWeaponID *BuyWeaponByWeaponID() = 0; + virtual IReGameHookRegistry_InternalCommand *InternalCommand() = 0; - virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon* CSGameRules_FShouldSwitchWeapon() = 0; - virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon* CSGameRules_GetNextBestWeapon() = 0; - virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage* CSGameRules_FlPlayerFallDamage() = 0; - virtual IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage* CSGameRules_FPlayerCanTakeDamage() = 0; - virtual IReGameHookRegistry_CSGameRules_PlayerSpawn* CSGameRules_PlayerSpawn() = 0; - virtual IReGameHookRegistry_CSGameRules_FPlayerCanRespawn* CSGameRules_FPlayerCanRespawn() = 0; - virtual IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot* CSGameRules_GetPlayerSpawnSpot() = 0; - virtual IReGameHookRegistry_CSGameRules_ClientUserInfoChanged* CSGameRules_ClientUserInfoChanged() = 0; - virtual IReGameHookRegistry_CSGameRules_PlayerKilled* CSGameRules_PlayerKilled() = 0; - virtual IReGameHookRegistry_CSGameRules_DeathNotice* CSGameRules_DeathNotice() = 0; - virtual IReGameHookRegistry_CSGameRules_CanHavePlayerItem* CSGameRules_CanHavePlayerItem() = 0; - virtual IReGameHookRegistry_CSGameRules_DeadPlayerWeapons* CSGameRules_DeadPlayerWeapons() = 0; - virtual IReGameHookRegistry_CSGameRules_ServerDeactivate* CSGameRules_ServerDeactivate() = 0; - virtual IReGameHookRegistry_CSGameRules_CheckMapConditions* CSGameRules_CheckMapConditions() = 0; - virtual IReGameHookRegistry_CSGameRules_CleanUpMap* CSGameRules_CleanUpMap() = 0; - virtual IReGameHookRegistry_CSGameRules_RestartRound* CSGameRules_RestartRound() = 0; - virtual IReGameHookRegistry_CSGameRules_CheckWinConditions* CSGameRules_CheckWinConditions() = 0; - virtual IReGameHookRegistry_CSGameRules_RemoveGuns* CSGameRules_RemoveGuns() = 0; - virtual IReGameHookRegistry_CSGameRules_GiveC4* CSGameRules_GiveC4() = 0; - virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0; - virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; - virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; - virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd* CSGameRules_OnRoundFreezeEnd() = 0; - virtual IReGameHookRegistry_PM_UpdateStepSound* PM_UpdateStepSound() = 0; + virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon *CSGameRules_FShouldSwitchWeapon() = 0; + virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon *CSGameRules_GetNextBestWeapon() = 0; + virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage *CSGameRules_FlPlayerFallDamage() = 0; + virtual IReGameHookRegistry_CSGameRules_FPlayerCanTakeDamage *CSGameRules_FPlayerCanTakeDamage() = 0; + virtual IReGameHookRegistry_CSGameRules_PlayerSpawn *CSGameRules_PlayerSpawn() = 0; + virtual IReGameHookRegistry_CSGameRules_FPlayerCanRespawn *CSGameRules_FPlayerCanRespawn() = 0; + virtual IReGameHookRegistry_CSGameRules_GetPlayerSpawnSpot *CSGameRules_GetPlayerSpawnSpot() = 0; + virtual IReGameHookRegistry_CSGameRules_ClientUserInfoChanged *CSGameRules_ClientUserInfoChanged() = 0; + virtual IReGameHookRegistry_CSGameRules_PlayerKilled *CSGameRules_PlayerKilled() = 0; + virtual IReGameHookRegistry_CSGameRules_DeathNotice *CSGameRules_DeathNotice() = 0; + virtual IReGameHookRegistry_CSGameRules_CanHavePlayerItem *CSGameRules_CanHavePlayerItem() = 0; + virtual IReGameHookRegistry_CSGameRules_DeadPlayerWeapons *CSGameRules_DeadPlayerWeapons() = 0; + virtual IReGameHookRegistry_CSGameRules_ServerDeactivate *CSGameRules_ServerDeactivate() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckMapConditions *CSGameRules_CheckMapConditions() = 0; + virtual IReGameHookRegistry_CSGameRules_CleanUpMap *CSGameRules_CleanUpMap() = 0; + virtual IReGameHookRegistry_CSGameRules_RestartRound *CSGameRules_RestartRound() = 0; + virtual IReGameHookRegistry_CSGameRules_CheckWinConditions *CSGameRules_CheckWinConditions() = 0; + virtual IReGameHookRegistry_CSGameRules_RemoveGuns *CSGameRules_RemoveGuns() = 0; + virtual IReGameHookRegistry_CSGameRules_GiveC4 *CSGameRules_GiveC4() = 0; + virtual IReGameHookRegistry_CSGameRules_ChangeLevel *CSGameRules_ChangeLevel() = 0; + virtual IReGameHookRegistry_CSGameRules_GoToIntermission *CSGameRules_GoToIntermission() = 0; + virtual IReGameHookRegistry_CSGameRules_BalanceTeams *CSGameRules_BalanceTeams() = 0; + virtual IReGameHookRegistry_CSGameRules_OnRoundFreezeEnd *CSGameRules_OnRoundFreezeEnd() = 0; + virtual IReGameHookRegistry_PM_UpdateStepSound *PM_UpdateStepSound() = 0; + virtual IReGameHookRegistry_CBasePlayer_StartDeathCam *CBasePlayer_StartDeathCam() = 0; + virtual IReGameHookRegistry_CBasePlayer_SwitchTeam *CBasePlayer_SwitchTeam() = 0; + virtual IReGameHookRegistry_CBasePlayer_CanSwitchTeam *CBasePlayer_CanSwitchTeam() = 0; + virtual IReGameHookRegistry_CBasePlayer_ThrowGrenade *CBasePlayer_ThrowGrenade() = 0; + virtual IReGameHookRegistry_CSGameRules_CanPlayerHearPlayer *CSGameRules_CanPlayerHearPlayer() = 0; + virtual IReGameHookRegistry_CWeaponBox_SetModel *CWeaponBox_SetModel() = 0; + virtual IReGameHookRegistry_CGrenade_DefuseBombStart *CGrenade_DefuseBombStart() = 0; + virtual IReGameHookRegistry_CGrenade_DefuseBombEnd *CGrenade_DefuseBombEnd() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeHeGrenade *CGrenade_ExplodeHeGrenade() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeFlashbang *CGrenade_ExplodeFlashbang() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeSmokeGrenade *CGrenade_ExplodeSmokeGrenade() = 0; + virtual IReGameHookRegistry_CGrenade_ExplodeBomb *CGrenade_ExplodeBomb() = 0; + virtual IReGameHookRegistry_ThrowHeGrenade *ThrowHeGrenade() = 0; + virtual IReGameHookRegistry_ThrowFlashbang *ThrowFlashbang() = 0; + virtual IReGameHookRegistry_ThrowSmokeGrenade *ThrowSmokeGrenade() = 0; + virtual IReGameHookRegistry_PlantBomb *PlantBomb() = 0; + virtual IReGameHookRegistry_CBasePlayer_RemoveSpawnProtection *CBasePlayer_RemoveSpawnProtection() = 0; + virtual IReGameHookRegistry_CBasePlayer_SetSpawnProtection *CBasePlayer_SetSpawnProtection() = 0; + virtual IReGameHookRegistry_IsPenetrableEntity *IsPenetrableEntity() = 0; }; struct ReGameFuncs_t { @@ -466,17 +562,19 @@ public: virtual int GetMajorVersion() = 0; virtual int GetMinorVersion() = 0; - virtual const ReGameFuncs_t* GetFuncs() = 0; - virtual IReGameHookchains* GetHookchains() = 0; + virtual const ReGameFuncs_t *GetFuncs() = 0; + virtual IReGameHookchains *GetHookchains() = 0; - virtual class CGameRules* GetGameRules() = 0; - virtual struct WeaponInfoStruct* GetWeaponInfo(int weaponID) = 0; - virtual struct WeaponInfoStruct* GetWeaponInfo(const char* weaponName) = 0; - virtual struct playermove_s* GetPlayerMove() = 0; - virtual struct WeaponSlotInfo* GetWeaponSlot(WeaponIdType weaponID) = 0; - virtual struct WeaponSlotInfo* GetWeaponSlot(const char* weaponName) = 0; - virtual struct ItemInfo* GetItemInfo(WeaponIdType weaponID) = 0; - virtual struct AmmoInfo* GetAmmoInfo(AmmoType ammoID) = 0; + virtual class CGameRules *GetGameRules() = 0; + virtual struct WeaponInfoStruct *GetWeaponInfo(int weaponID) = 0; + virtual struct WeaponInfoStruct *GetWeaponInfo(const char *weaponName) = 0; + virtual struct playermove_s *GetPlayerMove() = 0; + virtual struct WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID) = 0; + virtual struct WeaponSlotInfo *GetWeaponSlot(const char *weaponName) = 0; + virtual ItemInfo *GetItemInfo(WeaponIdType weaponID) = 0; + virtual struct AmmoInfo *GetAmmoInfo(AmmoType ammoID) = 0; + virtual struct AmmoInfoStruct *GetAmmoInfoEx(AmmoType ammoID) = 0; + virtual struct AmmoInfoStruct *GetAmmoInfoEx(const char *ammoName) = 0; }; #define VRE_GAMEDLL_API_VERSION "VRE_GAMEDLL_API_VERSION001" diff --git a/public/resdk/engine/IObjectContainer.h b/public/resdk/engine/IObjectContainer.h new file mode 100644 index 00000000..333e9d04 --- /dev/null +++ b/public/resdk/engine/IObjectContainer.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 + +class IObjectContainer { +public: + virtual ~IObjectContainer() {} + + virtual void Init() = 0; + + virtual bool Add(void *newObject) = 0; + virtual bool Remove(void *object) = 0; + virtual void Clear(bool freeElementsMemory) = 0; + + virtual void *GetFirst() = 0; + virtual void *GetNext() = 0; + + virtual int CountElements() = 0; + virtual bool Contains(void *object) = 0; + virtual bool IsEmpty() = 0; +}; diff --git a/public/resdk/engine/ObjectList.h b/public/resdk/engine/ObjectList.h new file mode 100644 index 00000000..aa023f84 --- /dev/null +++ b/public/resdk/engine/ObjectList.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 "IObjectContainer.h" + +class ObjectList: public IObjectContainer { +public: + EXT_FUNC void Init(); + EXT_FUNC bool Add(void *newObject); + EXT_FUNC void *GetFirst(); + EXT_FUNC void *GetNext(); + + ObjectList(); + virtual ~ObjectList(); + + EXT_FUNC void Clear(bool freeElementsMemory = false); + EXT_FUNC int CountElements(); + void *RemoveTail(); + void *RemoveHead(); + + bool AddTail(void *newObject); + bool AddHead(void *newObject); + EXT_FUNC bool Remove(void *object); + EXT_FUNC bool Contains(void *object); + EXT_FUNC bool IsEmpty(); + + typedef struct element_s { + struct element_s *prev; // pointer to the last element or NULL + struct element_s *next; // pointer to the next elemnet or NULL + void *object; // the element's object + } element_t; + +protected: + element_t *m_head; // first element in list + element_t *m_tail; // last element in list + element_t *m_current; // current element in list + int m_number; +}; diff --git a/public/resdk/engine/cmd_rehlds.h b/public/resdk/engine/cmd_rehlds.h index 7660e561..003cb600 100644 --- a/public/resdk/engine/cmd_rehlds.h +++ b/public/resdk/engine/cmd_rehlds.h @@ -27,11 +27,13 @@ */ #pragma once +#include "archtypes.h" + typedef void(*xcommand_t)(void); typedef struct cmd_function_s { struct cmd_function_s *next; - char *name; + const char *name; xcommand_t function; int flags; } cmd_function_t; diff --git a/public/resdk/engine/pr_dlls.h b/public/resdk/engine/pr_dlls.h new file mode 100644 index 00000000..95c34304 --- /dev/null +++ b/public/resdk/engine/pr_dlls.h @@ -0,0 +1,48 @@ +/* +* +* 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 + +const int MAX_EXTENSION_DLL = 50; + +typedef struct functiontable_s +{ + uint32 pFunction; + char *pFunctionName; +} functiontable_t; + +typedef struct extensiondll_s +{ + void *lDLLHandle; + functiontable_t *functionTable; + int functionCount; +} extensiondll_t; + +typedef void(*ENTITYINIT)(struct entvars_s *); +typedef void(*DISPATCHFUNCTION)(struct entvars_s *, void *); +typedef void(*FIELDIOFUNCTION)(SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int); diff --git a/public/resdk/engine/rehlds_api.h b/public/resdk/engine/rehlds_api.h index a6d8ebb3..63348948 100644 --- a/public/resdk/engine/rehlds_api.h +++ b/public/resdk/engine/rehlds_api.h @@ -27,15 +27,25 @@ */ #pragma once +#if defined(WIN32) + #define FORCE_STACK_ALIGN +#else + #define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer)) +#endif + +#define EXT_FUNC FORCE_STACK_ALIGN + #include #include #include "cmd_rehlds.h" +#include "ObjectList.h" +#include "pr_dlls.h" #include "rehlds_interfaces.h" #include "FlightRecorder.h" #include "../common/hookchains.h" #define REHLDS_API_VERSION_MAJOR 3 -#define REHLDS_API_VERSION_MINOR 0 +#define REHLDS_API_VERSION_MINOR 4 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -189,6 +199,10 @@ typedef IHookChainRegistry IRehldsHook_SV_EmitSound2; typedef IHookChainRegistry IRehldsHookRegistry_SV_EmitSound2; +//CreateFakeClient hook +typedef IHookChain IRehldsHook_CreateFakeClient; +typedef IHookChainRegistry IRehldsHookRegistry_CreateFakeClient; + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -231,6 +245,7 @@ public: virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f() = 0; virtual IRehldsHookRegistry_SV_CreatePacketEntities* SV_CreatePacketEntities() = 0; virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2() = 0; + virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient() = 0; }; struct RehldsFuncs_t { @@ -267,7 +282,7 @@ struct RehldsFuncs_t { 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_ReadShort)(); 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); @@ -282,6 +297,13 @@ struct RehldsFuncs_t { bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin); void(*SV_UpdateUserInfo)(IGameClient *pGameClient); bool(*StripUnprintableAndSpace)(char *pch); + void(*Cmd_RemoveCmd)(const char *cmd_name); + void(*GetCommandMatches)(const char *string, ObjectList *pMatchList); + bool(*AddExtDll)(void *hModule); + void(*AddCvarListener)(const char *var_name, cvar_callback_t func); + void(*RemoveExtDll)(void *hModule); + void(*RemoveCvarListener)(const char *var_name, cvar_callback_t func); + ENTITYINIT(*GetEntityInit)(char *pszClassName); }; class IRehldsApi { @@ -297,4 +319,4 @@ public: virtual IRehldsFlightRecorder* GetFlightRecorder() = 0; }; -#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001" \ No newline at end of file +#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001" diff --git a/public/resdk/engine/rehlds_interfaces.h b/public/resdk/engine/rehlds_interfaces.h index 4ad70346..30f15f0f 100644 --- a/public/resdk/engine/rehlds_interfaces.h +++ b/public/resdk/engine/rehlds_interfaces.h @@ -81,6 +81,7 @@ public: virtual IGameClient* GetClient(int id) = 0; virtual client_t* GetClient_t(int id) = 0; virtual int GetIndexOfClient_t(client_t* client) = 0; + virtual int GetMaxClientsLimit() = 0; }; class IRehldsServerData { diff --git a/public/resdk/mod_regamedll_api.cpp b/public/resdk/mod_regamedll_api.cpp index 0139fc71..74464ad4 100644 --- a/public/resdk/mod_regamedll_api.cpp +++ b/public/resdk/mod_regamedll_api.cpp @@ -7,15 +7,15 @@ IReGameHookchains * ReGameHookchains; bool RegamedllApi_Init() { - auto library = GET_GAME_INFO(PLID, GINFO_DLL_FULLPATH); + const auto library = GET_GAME_INFO(PLID, GINFO_DLL_FULLPATH); if (!library || !GET_IFACE(library, ReGameApi, VRE_GAMEDLL_API_VERSION, false) || !ReGameApi) { return false; } - auto majorVersion = ReGameApi->GetMajorVersion(); - auto minorVersion = ReGameApi->GetMinorVersion(); + const auto majorVersion = ReGameApi->GetMajorVersion(); + const auto minorVersion = ReGameApi->GetMinorVersion(); if (majorVersion != REGAMEDLL_API_VERSION_MAJOR || minorVersion < REGAMEDLL_API_VERSION_MINOR) { diff --git a/public/resdk/mod_rehlds_api.cpp b/public/resdk/mod_rehlds_api.cpp index 8312e771..14724704 100644 --- a/public/resdk/mod_rehlds_api.cpp +++ b/public/resdk/mod_rehlds_api.cpp @@ -15,9 +15,9 @@ bool RehldsApi_Init() } #if defined(PLATFORM_WINDOWS) - auto library = "swds"; + const auto library = "swds"; #elif defined(PLATFORM_POSIX) - auto library = "engine_i486"; + const auto library = "engine_i486"; #endif if (!GET_IFACE(library, RehldsApi, VREHLDS_HLDS_API_VERSION) || !RehldsApi) @@ -25,8 +25,8 @@ bool RehldsApi_Init() return false; } - auto majorVersion = RehldsApi->GetMajorVersion(); - auto minorVersion = RehldsApi->GetMinorVersion(); + const auto majorVersion = RehldsApi->GetMajorVersion(); + const auto minorVersion = RehldsApi->GetMinorVersion(); if (majorVersion != REHLDS_API_VERSION_MAJOR || minorVersion < REHLDS_API_VERSION_MINOR) { diff --git a/support/PackageScript b/support/PackageScript index fb754562..fe70fe8f 100644 --- a/support/PackageScript +++ b/support/PackageScript @@ -275,6 +275,7 @@ scripting_files = [ 'include/amxmodx.inc', 'include/core.inc', 'include/csstats.inc', + 'include/csstats_const.inc', 'include/cstrike.inc', 'include/cstrike_const.inc', 'include/csx.inc', diff --git a/support/checkout-deps.sh b/support/checkout-deps.sh index 0153595f..df15be39 100755 --- a/support/checkout-deps.sh +++ b/support/checkout-deps.sh @@ -5,6 +5,22 @@ if [ ! -d "amxmodx" ]; then git clone --recursive https://github.com/alliedmodders/amxmodx.git fi +if [ ! -d "amxmodx/build_deps" ]; then + mkdir amxmodx/build_deps +fi + +download_archive () +{ + if [ `command -v wget` ]; then + wget "$url" -O "$dest" + elif [ `command -v curl` ]; then + curl -o $dest $url + else + echo "Failed to locate wget or curl. Please install one of these programs." + exit 1 + fi +} + if [ "$1" != "--no-mysql" ]; then ismac=0 iswin=0 @@ -34,14 +50,9 @@ if [ "$1" != "--no-mysql" ]; then fi if [ ! -d "mysql-5.5" ]; then - if [ `command -v wget` ]; then - wget $mysqlurl -O mysql.$archive_ext - elif [ `command -v curl` ]; then - curl -o mysql.$archive_ext $mysqlurl - else - echo "Failed to locate wget or curl. Install one of these programs to download MySQL." - exit 1 - fi + url=$mysqlurl + dest=mysql.$archive_ext + download_archive $decomp mysql.$archive_ext mv $mysqlver mysql-5.5 rm mysql.$archive_ext @@ -95,3 +106,15 @@ if [ $? -eq 1 ]; then python setup.py install --user fi fi + +if [ $iswin -eq 1 ]; then + if [ ! -d "amxmodx/build_deps/nasm-2.13.03" ]; then + url=http://www.nasm.us/pub/nasm/releasebuilds/2.13.03/win32/nasm-2.13.03-win32.zip + dest=amxmodx/build_deps/nasm-2.13.03-win32.zip + download_archive + cd amxmodx/build_deps + unzip nasm-2.13.03-win32.zip + rm nasm-2.13.03-win32.zip + mv nasm-2.13.03 nasm + fi +fi