From 88c489d39323df897d287e4739588cc244038584 Mon Sep 17 00:00:00 2001 From: Arkshine Date: Mon, 26 May 2014 18:02:30 +0200 Subject: [PATCH] Cstrike: Move AMXX API in a new file. --- dlls/cstrike/cstrike/AMBuilder | 1 + dlls/cstrike/cstrike/Makefile | 2 +- dlls/cstrike/cstrike/amxx_api.cpp | 57 +++++++++++++++++++++ dlls/cstrike/cstrike/cstrike.cpp | 57 +-------------------- dlls/cstrike/cstrike/msvc10/cstrike.vcxproj | 1 + 5 files changed, 62 insertions(+), 56 deletions(-) create mode 100644 dlls/cstrike/cstrike/amxx_api.cpp diff --git a/dlls/cstrike/cstrike/AMBuilder b/dlls/cstrike/cstrike/AMBuilder index dbb36069..b96e0207 100644 --- a/dlls/cstrike/cstrike/AMBuilder +++ b/dlls/cstrike/cstrike/AMBuilder @@ -5,6 +5,7 @@ binary = AMXX.MetaModule(builder, 'cstrike') binary.sources = [ 'sdk/amxxmodule.cpp', + 'amxx_api.cpp', 'CstrikePlayer.cpp', 'cstrike.cpp', 'CstrikeHacks.cpp', diff --git a/dlls/cstrike/cstrike/Makefile b/dlls/cstrike/cstrike/Makefile index 7edf61fd..c3c22401 100755 --- a/dlls/cstrike/cstrike/Makefile +++ b/dlls/cstrike/cstrike/Makefile @@ -14,7 +14,7 @@ MM_ROOT = ../../../../metamod/metamod PROJECT = cstrike -OBJECTS = sdk/amxxmodule.cpp CstrikePlayer.cpp cstrike.cpp CstrikeHacks.cpp +OBJECTS = sdk/amxxmodule.cpp amxx_api.cpp CstrikePlayer.cpp cstrike.cpp CstrikeHacks.cpp ############################################## ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### diff --git a/dlls/cstrike/cstrike/amxx_api.cpp b/dlls/cstrike/cstrike/amxx_api.cpp new file mode 100644 index 00000000..2b8c27eb --- /dev/null +++ b/dlls/cstrike/cstrike/amxx_api.cpp @@ -0,0 +1,57 @@ +/* AMX Mod X + * Counter-Strike Module + * + * by the AMX Mod X Development Team + * + * This file is part of AMX Mod X. + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of this program with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ +#include "amxxmodule.h" +#include "cstrike.h" + +extern AMX_NATIVE_INFO cstrikeNatives[]; + +int AmxxCheckGame(const char *game) +{ + if (strcasecmp(game, "cstrike") == 0 || + strcasecmp(game, "czero") == 0) + { + return AMXX_GAME_OK; + } + return AMXX_GAME_BAD; +} + +void OnAmxxAttach() +{ + MF_AddNatives(cstrikeNatives); + InitializeHacks(); +} + +void OnAmxxDetach() +{ + ShutdownHacks(); +} \ No newline at end of file diff --git a/dlls/cstrike/cstrike/cstrike.cpp b/dlls/cstrike/cstrike/cstrike.cpp index 4e9b41ac..dc90838f 100755 --- a/dlls/cstrike/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike/cstrike.cpp @@ -1,38 +1,5 @@ #include "cstrike.h" -/* AMX Mod X - * Counter-Strike Module - * - * by the AMX Mod X Development Team - * - * This file is part of AMX Mod X. - * - * - * 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. - */ - CCstrikePlayer g_players[33]; int g_zooming[33] = {0}; bool g_precachedknife = false; @@ -1777,7 +1744,7 @@ static cell AMX_NATIVE_CALL not_on_64(AMX* amx, cell* params) #endif -AMX_NATIVE_INFO cstrike_Exports[] = { +AMX_NATIVE_INFO cstrikeNatives[] = { {"cs_set_user_money", cs_set_user_money}, {"cs_get_user_money", cs_get_user_money}, {"cs_get_user_deaths", cs_get_user_deaths}, @@ -1918,24 +1885,4 @@ void PlayerPreThink(edict_t *pPlayer) } RETURN_META(MRES_IGNORED); -} - -int AmxxCheckGame(const char *game) -{ - if (strcasecmp(game, "cstrike") == 0 || - strcasecmp(game, "czero") == 0) - { - return AMXX_GAME_OK; - } - return AMXX_GAME_BAD; -} -void OnAmxxAttach() -{ - MF_AddNatives(cstrike_Exports); - InitializeHacks(); -} - -void OnAmxxDetach() -{ - ShutdownHacks(); -} +} \ No newline at end of file diff --git a/dlls/cstrike/cstrike/msvc10/cstrike.vcxproj b/dlls/cstrike/cstrike/msvc10/cstrike.vcxproj index 23494392..5904a14e 100644 --- a/dlls/cstrike/cstrike/msvc10/cstrike.vcxproj +++ b/dlls/cstrike/cstrike/msvc10/cstrike.vcxproj @@ -135,6 +135,7 @@ +