Cstrike: Move AMXX API in a new file.

This commit is contained in:
Arkshine 2014-05-26 18:02:30 +02:00
parent 7ae802d736
commit 88c489d393
5 changed files with 62 additions and 56 deletions

View File

@ -5,6 +5,7 @@ binary = AMXX.MetaModule(builder, 'cstrike')
binary.sources = [
'sdk/amxxmodule.cpp',
'amxx_api.cpp',
'CstrikePlayer.cpp',
'cstrike.cpp',
'CstrikeHacks.cpp',

View File

@ -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 ###

View File

@ -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();
}

View File

@ -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},
@ -1919,23 +1886,3 @@ 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();
}

View File

@ -135,6 +135,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\amxx_api.cpp" />
<ClCompile Include="..\cstrike.cpp" />
<ClCompile Include="..\CstrikeHacks.cpp" />
<ClCompile Include="..\CstrikePlayer.cpp" />