mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Update globally Hamsandwich module (bug 5611, r=sawce)
This commit is contained in:
parent
9815050287
commit
1a7daad657
6352
configs/hamdata.ini
6352
configs/hamdata.ini
File diff suppressed because it is too large
Load Diff
@ -1,321 +1,512 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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 "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include "DataHandler.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
#include "ham_utils.h"
|
||||
#include "NEW_Util.h"
|
||||
|
||||
CStack< Data * > ReturnStack;
|
||||
CStack< Data * > OrigReturnStack;
|
||||
CStack< CVector< Data * > * > ParamStack;
|
||||
CStack< int * > ReturnStatus;
|
||||
#define CHECK_STACK(__STACK__) \
|
||||
if ( ( __STACK__ ).size() <= 0) \
|
||||
{ \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s is empty!", #__STACK__); \
|
||||
return 0; \
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include "DataHandler.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
#include "ham_utils.h"
|
||||
#include "NEW_Util.h"
|
||||
|
||||
CStack< Data * > ReturnStack;
|
||||
CStack< Data * > OrigReturnStack;
|
||||
CStack< CVector< Data * > * > ParamStack;
|
||||
CStack< int * > ReturnStatus;
|
||||
#define CHECK_STACK(__STACK__) \
|
||||
if ( ( __STACK__ ).size() <= 0) \
|
||||
{ \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "%s is empty!", #__STACK__); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#define PARSE_RETURN() \
|
||||
if (ret==-2) \
|
||||
{ \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Data pointer is NULL!"); \
|
||||
} \
|
||||
else if (ret==-1) \
|
||||
{ \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Wrong data type (data is of type %s)", returntypes[dat->GetType()]); \
|
||||
} \
|
||||
return ret
|
||||
|
||||
static const char *returntypes[] =
|
||||
{
|
||||
"void",
|
||||
"integer",
|
||||
"float",
|
||||
"vector",
|
||||
"string",
|
||||
"entity",
|
||||
"entity",
|
||||
"traceresult",
|
||||
"iteminfo"
|
||||
};
|
||||
|
||||
static cell AMX_NATIVE_CALL GetHamReturnInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetInt(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetInt(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetFloat(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetFloat(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetVector(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetVector(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetEntity(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetEntity(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetString(MF_GetAmxAddr(amx, params[1]), params[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetString(MF_GetAmxAddr(amx, params[1]), params[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetInt(¶ms[1]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetFloat(¶ms[1]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetVector(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetEntity(¶ms[1]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetString(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetInt(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamTraceResult(AMX *amx, cell *params)
|
||||
{
|
||||
if (params[2] == 0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Null traceresult provided.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetInt(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1] || params[1] < 1)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetFloat(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetVector(MF_GetAmxAddr(amx, params[2]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetEntity(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetString(MF_GetAmxAddr(amx, params[2]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL SetHamParamItemInfo(AMX *amx, cell *params)
|
||||
{
|
||||
if (params[2] == 0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Null ItemInfo handle provided.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec = ParamStack.front();
|
||||
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Data *dat = vec->at(params[1] - 1);
|
||||
|
||||
int ret = dat->SetInt(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL GetHamItemInfo(AMX *amx, cell *params)
|
||||
{
|
||||
if (params[1] == 0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Null iteminfo handle provided.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PARSE_RETURN() \
|
||||
if (ret==-2) \
|
||||
{ \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Data pointer is NULL!"); \
|
||||
} \
|
||||
else if (ret==-1) \
|
||||
{ \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Wrong data type (data is of type %s)", returntypes[dat->GetType()]); \
|
||||
} \
|
||||
return ret
|
||||
int type = params[2];
|
||||
|
||||
static const char *returntypes[] =
|
||||
{
|
||||
"void",
|
||||
"integer",
|
||||
"float",
|
||||
"vector",
|
||||
"string",
|
||||
"entity",
|
||||
"entity",
|
||||
"traceresult",
|
||||
"iteminfo"
|
||||
};
|
||||
|
||||
static cell AMX_NATIVE_CALL GetHamReturnInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetInt(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetInt(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetFloat(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetFloat(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetVector(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetVector(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetEntity(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetEntity(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->GetString(MF_GetAmxAddr(amx, params[1]), params[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetOrigHamReturnString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(OrigReturnStack);
|
||||
Data *dat=OrigReturnStack.front();
|
||||
|
||||
int ret=dat->GetString(MF_GetAmxAddr(amx, params[1]), params[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetInt(¶ms[1]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetFloat(¶ms[1]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetVector(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetEntity(¶ms[1]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamReturnString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStack);
|
||||
Data *dat=ReturnStack.front();
|
||||
|
||||
int ret=dat->SetString(MF_GetAmxAddr(amx, params[1]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetInt(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamTraceResult(AMX *amx, cell *params)
|
||||
{
|
||||
if (params[2] == 0)
|
||||
if ((type == ItemInfo_pszAmmo1 || type == ItemInfo_pszAmmo2 || type == ItemInfo_pszName) && (*params / sizeof(cell)) != 4)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Null traceresult provided.");
|
||||
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Bad arg count. Expected %d, got %d.", 4, *params / sizeof(cell));
|
||||
return 0;
|
||||
}
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetInt(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamFloat(AMX *amx, cell *params)
|
||||
ItemInfo *pItem = reinterpret_cast<ItemInfo *>(params[1]);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ItemInfo_iSlot:
|
||||
return pItem->iSlot;
|
||||
|
||||
case ItemInfo_iPosition:
|
||||
return pItem->iPosition;
|
||||
|
||||
case ItemInfo_pszAmmo1:
|
||||
return MF_SetAmxString( amx, params[3], pItem->pszAmmo1 > 0 ? pItem->pszAmmo1 : "", params[4] );
|
||||
|
||||
case ItemInfo_iMaxAmmo1:
|
||||
return pItem->iMaxAmmo1;
|
||||
|
||||
case ItemInfo_pszAmmo2:
|
||||
return MF_SetAmxString( amx, params[3], pItem->pszAmmo2 > 0 ? pItem->pszAmmo2 : "", params[4] );
|
||||
|
||||
case ItemInfo_iMaxAmmo2:
|
||||
return pItem->iMaxAmmo2;
|
||||
|
||||
case ItemInfo_pszName:
|
||||
return MF_SetAmxString( amx, params[3], pItem->pszName > 0 ? pItem->pszName : "", params[4] );
|
||||
|
||||
case ItemInfo_iMaxClip:
|
||||
return pItem->iMaxClip;
|
||||
|
||||
case ItemInfo_iId:
|
||||
return pItem->iId;
|
||||
|
||||
case ItemInfo_iFlags:
|
||||
return pItem->iFlags;
|
||||
|
||||
case ItemInfo_iWeight:
|
||||
return pItem->iWeight;
|
||||
}
|
||||
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown ItemInfo type %d", type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CStack<ItemInfo *> g_FreeIIs;
|
||||
|
||||
static cell AMX_NATIVE_CALL CreateHamItemInfo(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1] || params[1] < 1)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
ItemInfo *ii;
|
||||
|
||||
int ret=dat->SetFloat(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
if (g_FreeIIs.empty())
|
||||
{
|
||||
ii = new ItemInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
ii = g_FreeIIs.front();
|
||||
g_FreeIIs.pop();
|
||||
}
|
||||
|
||||
int ret=dat->SetVector(MF_GetAmxAddr(amx, params[2]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
memset(ii, 0, sizeof(ItemInfo));
|
||||
|
||||
int ret=dat->SetEntity(¶ms[2]);
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL SetHamParamString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
|
||||
int ret=dat->SetString(MF_GetAmxAddr(amx, params[2]));
|
||||
PARSE_RETURN();
|
||||
}
|
||||
static cell AMX_NATIVE_CALL GetHamReturnStatus(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStatus);
|
||||
int *i=ReturnStatus.front();
|
||||
|
||||
return *i;
|
||||
return reinterpret_cast<cell>(ii);
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO ReturnNatives[] =
|
||||
static cell AMX_NATIVE_CALL FreeHamItemInfo(AMX *amx, cell *params)
|
||||
{
|
||||
{ "GetHamReturnInteger", GetHamReturnInteger },
|
||||
{ "GetHamReturnFloat", GetHamReturnFloat },
|
||||
{ "GetHamReturnVector", GetHamReturnVector },
|
||||
{ "GetHamReturnEntity", GetHamReturnEntity },
|
||||
{ "GetHamReturnString", GetHamReturnString },
|
||||
{ "GetOrigHamReturnInteger", GetOrigHamReturnInteger },
|
||||
{ "GetOrigHamReturnFloat", GetOrigHamReturnFloat },
|
||||
{ "GetOrigHamReturnVector", GetOrigHamReturnVector },
|
||||
{ "GetOrigHamReturnEntity", GetOrigHamReturnEntity },
|
||||
{ "GetOrigHamReturnString", GetOrigHamReturnString },
|
||||
{ "SetHamReturnInteger", SetHamReturnInteger },
|
||||
{ "SetHamReturnFloat", SetHamReturnFloat },
|
||||
{ "SetHamReturnVector", SetHamReturnVector },
|
||||
{ "SetHamReturnEntity", SetHamReturnEntity },
|
||||
{ "SetHamReturnString", SetHamReturnString },
|
||||
ItemInfo *ii = reinterpret_cast<ItemInfo *>(params[1]);
|
||||
|
||||
{ "GetHamReturnStatus", GetHamReturnStatus },
|
||||
if (!ii)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
{ "SetHamParamInteger", SetHamParamInteger },
|
||||
{ "SetHamParamFloat", SetHamParamFloat },
|
||||
{ "SetHamParamVector", SetHamParamVector },
|
||||
{ "SetHamParamEntity", SetHamParamEntity },
|
||||
{ "SetHamParamString", SetHamParamString },
|
||||
{ "SetHamParamTraceResult", SetHamParamTraceResult },
|
||||
g_FreeIIs.push(ii);
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params)
|
||||
{
|
||||
if (params[1] == 0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Null iteminfo handle provided.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ItemInfo *pItem = reinterpret_cast<ItemInfo *>(params[1]);
|
||||
cell *ptr = MF_GetAmxAddr(amx, params[3]);
|
||||
int iLen;
|
||||
|
||||
switch (params[2])
|
||||
{
|
||||
case ItemInfo_iSlot:
|
||||
pItem->iSlot = *ptr;
|
||||
break;
|
||||
|
||||
case ItemInfo_iPosition:
|
||||
pItem->iPosition = *ptr;
|
||||
break;
|
||||
|
||||
case ItemInfo_pszAmmo1:
|
||||
pItem->pszAmmo1 = MF_GetAmxString(amx, params[3], 0, &iLen);
|
||||
return iLen;
|
||||
|
||||
case ItemInfo_iMaxAmmo1:
|
||||
pItem->iMaxAmmo1 = *ptr;
|
||||
break;
|
||||
|
||||
case ItemInfo_pszAmmo2:
|
||||
pItem->pszAmmo2 = MF_GetAmxString(amx, params[3], 0, &iLen);
|
||||
return iLen;
|
||||
|
||||
case ItemInfo_iMaxAmmo2:
|
||||
pItem->iMaxAmmo2 = *ptr;
|
||||
break;
|
||||
|
||||
case ItemInfo_pszName:
|
||||
pItem->pszName = MF_GetAmxString(amx, params[3], 0, &iLen);
|
||||
return iLen;
|
||||
|
||||
case ItemInfo_iMaxClip:
|
||||
pItem->iMaxClip = *ptr;
|
||||
break;
|
||||
|
||||
case ItemInfo_iId:
|
||||
pItem->iId = *ptr;
|
||||
break;
|
||||
|
||||
case ItemInfo_iFlags:
|
||||
pItem->iFlags = *ptr;
|
||||
break;
|
||||
|
||||
case ItemInfo_iWeight:
|
||||
pItem->iWeight = *ptr;
|
||||
break;
|
||||
|
||||
default:
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown ItemInfo type %d", params[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL GetHamReturnStatus(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ReturnStatus);
|
||||
int *i=ReturnStatus.front();
|
||||
|
||||
return *i;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO ReturnNatives[] =
|
||||
{
|
||||
{ "GetHamReturnInteger", GetHamReturnInteger },
|
||||
{ "GetHamReturnFloat", GetHamReturnFloat },
|
||||
{ "GetHamReturnVector", GetHamReturnVector },
|
||||
{ "GetHamReturnEntity", GetHamReturnEntity },
|
||||
{ "GetHamReturnString", GetHamReturnString },
|
||||
{ "GetOrigHamReturnInteger", GetOrigHamReturnInteger },
|
||||
{ "GetOrigHamReturnFloat", GetOrigHamReturnFloat },
|
||||
{ "GetOrigHamReturnVector", GetOrigHamReturnVector },
|
||||
{ "GetOrigHamReturnEntity", GetOrigHamReturnEntity },
|
||||
{ "GetOrigHamReturnString", GetOrigHamReturnString },
|
||||
{ "SetHamReturnInteger", SetHamReturnInteger },
|
||||
{ "SetHamReturnFloat", SetHamReturnFloat },
|
||||
{ "SetHamReturnVector", SetHamReturnVector },
|
||||
{ "SetHamReturnEntity", SetHamReturnEntity },
|
||||
{ "SetHamReturnString", SetHamReturnString },
|
||||
|
||||
{ "GetHamReturnStatus", GetHamReturnStatus },
|
||||
|
||||
{ "SetHamParamInteger", SetHamParamInteger },
|
||||
{ "SetHamParamFloat", SetHamParamFloat },
|
||||
{ "SetHamParamVector", SetHamParamVector },
|
||||
{ "SetHamParamEntity", SetHamParamEntity },
|
||||
{ "SetHamParamString", SetHamParamString },
|
||||
{ "SetHamParamTraceResult", SetHamParamTraceResult },
|
||||
{ "SetHamParamItemInfo", SetHamParamItemInfo },
|
||||
|
||||
{ "GetHamItemInfo", GetHamItemInfo },
|
||||
{ "SetHamItemInfo", SetHamItemInfo },
|
||||
{ "CreateHamItemInfo", CreateHamItemInfo },
|
||||
{ "FreeHamItemInfo", FreeHamItemInfo },
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
@ -1,304 +1,389 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef RETURNHANDLER_H
|
||||
#define RETURNHANDLER_H
|
||||
|
||||
#include "ham_utils.h"
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
|
||||
enum
|
||||
#ifndef RETURNHANDLER_H
|
||||
#define RETURNHANDLER_H
|
||||
|
||||
#include "ham_utils.h"
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
|
||||
enum
|
||||
{
|
||||
RET_VOID,
|
||||
RET_BOOL,
|
||||
RET_INTEGER,
|
||||
RET_SHORT,
|
||||
RET_FLOAT,
|
||||
RET_VECTOR,
|
||||
RET_STRING,
|
||||
RET_CBASE,
|
||||
RET_ENTVAR,
|
||||
RET_EDICT,
|
||||
RET_TRACE,
|
||||
RET_ITEMINFO
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RET_VOID,
|
||||
RET_INTEGER,
|
||||
RET_FLOAT,
|
||||
RET_VECTOR,
|
||||
RET_STRING,
|
||||
RET_CBASE,
|
||||
RET_ENTVAR,
|
||||
RET_TRACE,
|
||||
RET_ITEMINFO
|
||||
};
|
||||
// Container for return and parameter data.
|
||||
// Contains a void pointer, and a flag telling what it contains.
|
||||
class Data
|
||||
{
|
||||
private:
|
||||
void *m_data;
|
||||
int *m_index;
|
||||
int m_type;
|
||||
|
||||
bool IsSet(void)
|
||||
{
|
||||
return (m_type != RET_VOID &&
|
||||
m_data != NULL);
|
||||
};
|
||||
bool IsType(const int type)
|
||||
{
|
||||
return (m_type == type);
|
||||
};
|
||||
|
||||
public:
|
||||
Data() : m_data(NULL), m_index(NULL), m_type(RET_VOID)
|
||||
{ /* nothing */ };
|
||||
|
||||
Data(int type, void *ptr) : m_data(ptr), m_index(NULL), m_type(type)
|
||||
{ /* nothing */ };
|
||||
|
||||
Data(int type, void *ptr, int *cptr) : m_data(ptr), m_index(NULL), m_type(type)
|
||||
{ /* nothing */ };
|
||||
|
||||
~Data()
|
||||
{ /* nothing */ };
|
||||
|
||||
int GetType()
|
||||
{
|
||||
return m_type;
|
||||
};
|
||||
|
||||
// All Get/Set value natives return < 0 on failure.
|
||||
// -1: Wrong type
|
||||
// -2: Bad data pointer (void, etc).
|
||||
int SetInt(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_INTEGER))
|
||||
{
|
||||
*(reinterpret_cast<int *>(m_data))=*data;
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_TRACE))
|
||||
{
|
||||
*(reinterpret_cast<int *>(m_data))=*data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
int SetFloat(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_FLOAT))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*(reinterpret_cast<REAL *>(m_data))=amx_ctof2(*data);
|
||||
|
||||
return 0;
|
||||
};
|
||||
int SetVector(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_VECTOR))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
Vector *vec=reinterpret_cast<Vector *>(m_data);
|
||||
|
||||
vec->x=amx_ctof2(data[0]);
|
||||
vec->y=amx_ctof2(data[1]);
|
||||
vec->z=amx_ctof2(data[2]);
|
||||
|
||||
return 0;
|
||||
};
|
||||
int SetString(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_STRING))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
String *str=reinterpret_cast<String *>(m_data);
|
||||
|
||||
cell *i=data;
|
||||
size_t len=0;
|
||||
|
||||
while (*i!=0)
|
||||
{
|
||||
i++;
|
||||
len++;
|
||||
};
|
||||
char *temp=new char[len+1];
|
||||
i=data;
|
||||
char *j=temp;
|
||||
|
||||
while ((*j++=*i++)!=0)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
str->assign(temp);
|
||||
|
||||
delete[] temp;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
int SetEntity(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_CBASE))
|
||||
{
|
||||
*(reinterpret_cast<void **>(m_data))=IndexToPrivate(*data);
|
||||
if (m_index != 0)
|
||||
{
|
||||
*m_index=*data;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_ENTVAR))
|
||||
{
|
||||
*(reinterpret_cast<entvars_t **>(m_data))=IndexToEntvar(*data);
|
||||
if (m_index != 0)
|
||||
{
|
||||
*m_index=*data;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
int GetInt(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_INTEGER))
|
||||
{
|
||||
*data=*(reinterpret_cast<int *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_TRACE))
|
||||
{
|
||||
*data=*(reinterpret_cast<int *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
int GetFloat(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_FLOAT))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*data=amx_ftoc2(*(reinterpret_cast<REAL *>(m_data)));
|
||||
|
||||
return 0;
|
||||
};
|
||||
int GetVector(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_VECTOR))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
Vector *vec=reinterpret_cast<Vector *>(m_data);
|
||||
data[0]=amx_ftoc2(vec->x);
|
||||
data[1]=amx_ftoc2(vec->y);
|
||||
data[2]=amx_ftoc2(vec->z);
|
||||
|
||||
return 0;
|
||||
};
|
||||
int GetString(cell *data, int len)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_STRING))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
const char *i=(reinterpret_cast<String *>(m_data)->c_str());
|
||||
|
||||
while (len-- &&
|
||||
(*data++=*i++)!='\0')
|
||||
{
|
||||
/* nothing */
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
int GetEntity(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_CBASE))
|
||||
{
|
||||
*data=PrivateToIndex(m_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_ENTVAR))
|
||||
{
|
||||
*data=EntvarToIndex(reinterpret_cast<entvars_t *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
extern CStack< Data * > ReturnStack;
|
||||
extern CStack< Data * > OrigReturnStack;
|
||||
extern CStack< CVector< Data * > * > ParamStack;
|
||||
extern CStack< int * > ReturnStatus;
|
||||
#endif
|
||||
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;
|
||||
|
||||
enum
|
||||
{
|
||||
ItemInfo_iSlot,
|
||||
ItemInfo_iPosition,
|
||||
ItemInfo_pszAmmo1,
|
||||
ItemInfo_iMaxAmmo1,
|
||||
ItemInfo_pszAmmo2,
|
||||
ItemInfo_iMaxAmmo2,
|
||||
ItemInfo_pszName,
|
||||
ItemInfo_iMaxClip,
|
||||
ItemInfo_iId,
|
||||
ItemInfo_iFlags,
|
||||
ItemInfo_iWeight
|
||||
};
|
||||
|
||||
// Container for return and parameter data.
|
||||
// Contains a void pointer, and a flag telling what it contains.
|
||||
class Data
|
||||
{
|
||||
private:
|
||||
void *m_data;
|
||||
int *m_index;
|
||||
int m_type;
|
||||
|
||||
bool IsSet(void)
|
||||
{
|
||||
return (m_type != RET_VOID &&
|
||||
m_data != NULL);
|
||||
};
|
||||
bool IsType(const int type)
|
||||
{
|
||||
return (m_type == type);
|
||||
};
|
||||
|
||||
public:
|
||||
Data() : m_data(NULL), m_index(NULL), m_type(RET_VOID)
|
||||
{ /* nothing */ };
|
||||
|
||||
Data(int type, void *ptr) : m_data(ptr), m_index(NULL), m_type(type)
|
||||
{ /* nothing */ };
|
||||
|
||||
Data(int type, void *ptr, int *cptr) : m_data(ptr), m_index(NULL), m_type(type)
|
||||
{ /* nothing */ };
|
||||
|
||||
~Data()
|
||||
{ /* nothing */ };
|
||||
|
||||
int GetType()
|
||||
{
|
||||
return m_type;
|
||||
};
|
||||
|
||||
// All Get/Set value natives return < 0 on failure.
|
||||
// -1: Wrong type
|
||||
// -2: Bad data pointer (void, etc).
|
||||
int SetInt(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_INTEGER))
|
||||
{
|
||||
*(reinterpret_cast<int *>(m_data))=*data;
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_BOOL))
|
||||
{
|
||||
*(reinterpret_cast<bool *>(m_data)) = *data > 0;
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_SHORT))
|
||||
{
|
||||
*(reinterpret_cast<short *>(m_data)) = *data;
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_ITEMINFO))
|
||||
{
|
||||
*(reinterpret_cast<int *>(m_data)) = *data;
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_TRACE))
|
||||
{
|
||||
*(reinterpret_cast<int *>(m_data))=*data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
int SetFloat(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_FLOAT))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*(reinterpret_cast<REAL *>(m_data))=amx_ctof2(*data);
|
||||
|
||||
return 0;
|
||||
};
|
||||
int SetVector(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_VECTOR))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
Vector *vec=reinterpret_cast<Vector *>(m_data);
|
||||
|
||||
vec->x=amx_ctof2(data[0]);
|
||||
vec->y=amx_ctof2(data[1]);
|
||||
vec->z=amx_ctof2(data[2]);
|
||||
|
||||
return 0;
|
||||
};
|
||||
int SetString(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_STRING))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
String *str=reinterpret_cast<String *>(m_data);
|
||||
|
||||
cell *i=data;
|
||||
size_t len=0;
|
||||
|
||||
while (*i!=0)
|
||||
{
|
||||
i++;
|
||||
len++;
|
||||
};
|
||||
char *temp=new char[len+1];
|
||||
i=data;
|
||||
char *j=temp;
|
||||
|
||||
while ((*j++=*i++)!=0)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
str->assign(temp);
|
||||
|
||||
delete[] temp;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
int SetEntity(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_CBASE))
|
||||
{
|
||||
*(reinterpret_cast<void **>(m_data))=IndexToPrivate(*data);
|
||||
if (m_index != 0)
|
||||
{
|
||||
*m_index=*data;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_ENTVAR))
|
||||
{
|
||||
*(reinterpret_cast<entvars_t **>(m_data))=IndexToEntvar(*data);
|
||||
if (m_index != 0)
|
||||
{
|
||||
*m_index=*data;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_EDICT))
|
||||
{
|
||||
*(reinterpret_cast<edict_t **>(m_data)) = IndexToEdict(*data);
|
||||
if (m_index != 0)
|
||||
{
|
||||
*m_index = *data;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
int GetInt(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_INTEGER))
|
||||
{
|
||||
*data=*(reinterpret_cast<int *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_BOOL))
|
||||
{
|
||||
*data = *(reinterpret_cast<bool *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
else if (IsType(RET_SHORT))
|
||||
{
|
||||
*data = *(reinterpret_cast<short *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_ITEMINFO))
|
||||
{
|
||||
*data = *(reinterpret_cast<int *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_TRACE))
|
||||
{
|
||||
*data=*(reinterpret_cast<int *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
int GetFloat(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_FLOAT))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*data=amx_ftoc2(*(reinterpret_cast<REAL *>(m_data)));
|
||||
|
||||
return 0;
|
||||
};
|
||||
int GetVector(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_VECTOR))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
Vector *vec=reinterpret_cast<Vector *>(m_data);
|
||||
data[0]=amx_ftoc2(vec->x);
|
||||
data[1]=amx_ftoc2(vec->y);
|
||||
data[2]=amx_ftoc2(vec->z);
|
||||
|
||||
return 0;
|
||||
};
|
||||
int GetString(cell *data, int len)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (!IsType(RET_STRING))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
const char *i=(reinterpret_cast<String *>(m_data)->c_str());
|
||||
|
||||
while (len-- &&
|
||||
(*data++=*i++)!='\0')
|
||||
{
|
||||
/* nothing */
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
int GetEntity(cell *data)
|
||||
{
|
||||
if (!IsSet())
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (IsType(RET_CBASE))
|
||||
{
|
||||
*data=PrivateToIndex(m_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_ENTVAR))
|
||||
{
|
||||
*data=EntvarToIndex(reinterpret_cast<entvars_t *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (IsType(RET_EDICT))
|
||||
{
|
||||
*data = EdictToIndex(reinterpret_cast<edict_t *>(m_data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
extern CStack< Data * > ReturnStack;
|
||||
extern CStack< Data * > OrigReturnStack;
|
||||
extern CStack< CVector< Data * > * > ParamStack;
|
||||
extern CStack< int * > ReturnStatus;
|
||||
#endif
|
||||
|
@ -1,87 +1,87 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
*/
|
||||
|
||||
/* Inlined replacements for INDEXENT/ENTINDEX
|
||||
* It only really removes the overhead of the push/jump
|
||||
* but since INDEXENT/ENTINDEX are used a lot with amxx
|
||||
* it might be beneficial to include.
|
||||
* NOTE: Bad stuff will happen if you call these before
|
||||
* NEW_Initialize()
|
||||
* NOTE: No bounds checking is done because natives
|
||||
* should use their own bounds checking!
|
||||
*/
|
||||
|
||||
#ifndef NEW_UTIL_H
|
||||
#define NEW_UTIL_H
|
||||
|
||||
|
||||
extern edict_t *NEW_FirstEdict;
|
||||
extern bool NEW_Initialized;
|
||||
|
||||
/**
|
||||
* This is called on the first Spawn() ever hooked. This would be worldspawn (index 0)
|
||||
*/
|
||||
inline void NEW_Initialize(edict_t *Entity)
|
||||
{
|
||||
NEW_FirstEdict=Entity;
|
||||
NEW_Initialized=true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts an integer index into an edict pointer
|
||||
*/
|
||||
inline edict_t *INDEXENT_NEW(const int Index)
|
||||
{
|
||||
return (edict_t *)(NEW_FirstEdict + Index);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts an edict pointer into an integer index
|
||||
*/
|
||||
inline int ENTINDEX_NEW(const edict_t *Ent)
|
||||
{
|
||||
return (int)(Ent - NEW_FirstEdict);
|
||||
};
|
||||
|
||||
// Inlined replacement of MF_GetAmxAddr
|
||||
|
||||
|
||||
inline REAL amx_ctof2(cell x)
|
||||
{
|
||||
return *(REAL*)&x;
|
||||
}
|
||||
inline cell amx_ftoc2(REAL x)
|
||||
{
|
||||
return *(cell*)&x;
|
||||
}
|
||||
|
||||
|
||||
#endif // NEW_UTIL_H
|
||||
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
*/
|
||||
|
||||
/* Inlined replacements for INDEXENT/ENTINDEX
|
||||
* It only really removes the overhead of the push/jump
|
||||
* but since INDEXENT/ENTINDEX are used a lot with amxx
|
||||
* it might be beneficial to include.
|
||||
* NOTE: Bad stuff will happen if you call these before
|
||||
* NEW_Initialize()
|
||||
* NOTE: No bounds checking is done because natives
|
||||
* should use their own bounds checking!
|
||||
*/
|
||||
|
||||
#ifndef NEW_UTIL_H
|
||||
#define NEW_UTIL_H
|
||||
|
||||
|
||||
extern edict_t *NEW_FirstEdict;
|
||||
extern bool NEW_Initialized;
|
||||
|
||||
/**
|
||||
* This is called on the first Spawn() ever hooked. This would be worldspawn (index 0)
|
||||
*/
|
||||
inline void NEW_Initialize(edict_t *Entity)
|
||||
{
|
||||
NEW_FirstEdict=Entity;
|
||||
NEW_Initialized=true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts an integer index into an edict pointer
|
||||
*/
|
||||
inline edict_t *INDEXENT_NEW(const int Index)
|
||||
{
|
||||
return (edict_t *)(NEW_FirstEdict + Index);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts an edict pointer into an integer index
|
||||
*/
|
||||
inline int ENTINDEX_NEW(const edict_t *Ent)
|
||||
{
|
||||
return (int)(Ent - NEW_FirstEdict);
|
||||
};
|
||||
|
||||
// Inlined replacement of MF_GetAmxAddr
|
||||
|
||||
|
||||
inline REAL amx_ctof2(cell x)
|
||||
{
|
||||
return *(REAL*)&x;
|
||||
}
|
||||
inline cell amx_ftoc2(REAL x)
|
||||
{
|
||||
return *(cell*)&x;
|
||||
}
|
||||
|
||||
|
||||
#endif // NEW_UTIL_H
|
||||
|
||||
|
@ -641,9 +641,9 @@ namespace Trampolines
|
||||
/**
|
||||
* Utility to make a generic trampoline.
|
||||
*/
|
||||
inline void *CreateGenericTrampoline(bool thiscall, bool voidcall, int paramcount, void *extraptr, void *callee)
|
||||
inline void *CreateGenericTrampoline(bool thiscall, bool voidcall, bool retbuf, int paramcount, void *extraptr, void *callee)
|
||||
{
|
||||
Trampolines::TrampolineMaker tramp;
|
||||
Trampolines::TrampolineMaker tramp;
|
||||
|
||||
if (voidcall)
|
||||
{
|
||||
@ -684,7 +684,14 @@ inline void *CreateGenericTrampoline(bool thiscall, bool voidcall, int paramcoun
|
||||
#if defined(_WIN32)
|
||||
tramp.VoidEpilogueAndFree();
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
tramp.VoidEpilogue();
|
||||
if (retbuf)
|
||||
{
|
||||
tramp.VoidEpilogue(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
tramp.ThisVoidPrologue();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -1,122 +1,146 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
*/
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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 <extdll.h>
|
||||
|
||||
#include "NEW_Util.h"
|
||||
#include "CVector.h"
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
#include "ham_const.h"
|
||||
#include "hooklist.h"
|
||||
#include "offsets.h"
|
||||
#include <assert.h>
|
||||
#include "DataHandler.h"
|
||||
|
||||
edict_t *NEW_FirstEdict;
|
||||
bool NEW_Initialized;
|
||||
|
||||
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
|
||||
extern AMX_NATIVE_INFO RegisterNatives[];
|
||||
extern AMX_NATIVE_INFO ReturnNatives[];
|
||||
extern AMX_NATIVE_INFO pdata_natives[];
|
||||
extern AMX_NATIVE_INFO pdata_natives_safe[];
|
||||
|
||||
|
||||
extern hook_t hooklist[];
|
||||
|
||||
int ReadConfig(void);
|
||||
|
||||
void OnAmxxAttach(void)
|
||||
{
|
||||
// Assert that the enum is aligned properly with the table
|
||||
|
||||
assert(strcmp(hooklist[Ham_FVecVisible].name, "fvecvisible")==0);
|
||||
assert(strcmp(hooklist[Ham_Player_UpdateClientData].name, "player_updateclientdata")==0);
|
||||
assert(strcmp(hooklist[Ham_Item_AddToPlayer].name, "item_addtoplayer")==0);
|
||||
assert(strcmp(hooklist[Ham_Weapon_ExtractAmmo].name, "weapon_extractammo")==0);
|
||||
assert(strcmp(hooklist[Ham_TS_BreakableRespawn].name, "ts_breakablerespawn")==0);
|
||||
assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0);
|
||||
assert(strcmp(hooklist[Ham_TS_ShouldCollide].name, "ts_shouldcollide")==0);
|
||||
|
||||
assert(strcmp(hooklist[Ham_GetDeathActivity].name, "getdeathactivity")==0);
|
||||
assert(strcmp(hooklist[Ham_StopFollowing].name, "stopfollowing")==0);
|
||||
assert(strcmp(hooklist[Ham_CS_Player_OnTouchingWeapon].name, "cstrike_player_ontouchingweapon")==0);
|
||||
assert(strcmp(hooklist[Ham_DOD_Weapon_Special].name, "dod_weapon_special")==0);
|
||||
assert(strcmp(hooklist[Ham_TFC_RadiusDamage2].name, "tfc_radiusdamage2")==0);
|
||||
assert(strcmp(hooklist[Ham_ESF_Weapon_HolsterWhenMeleed].name, "esf_weapon_holsterwhenmeleed") == 0);
|
||||
assert(strcmp(hooklist[Ham_NS_Weapon_GetDeployTime].name, "ns_weapon_getdeploytime")==0);
|
||||
assert(strcmp(hooklist[Ham_SC_MedicCallSound].name, "sc_mediccallsound")==0);
|
||||
assert(strcmp(hooklist[Ham_SC_Player_CanTouchPlayer].name, "sc_player_cantouchplayer")==0);
|
||||
assert(strcmp(hooklist[Ham_SC_Weapon_ChangeWeaponSkin].name, "sc_weapon_changeweaponskin")==0);
|
||||
assert(strcmp(hooklist[Ham_Item_GetItemInfo].name, "item_getiteminfo") == 0);
|
||||
|
||||
#include "amxxmodule.h"
|
||||
#include <extdll.h>
|
||||
MF_AddNatives(pdata_natives_safe);
|
||||
if (ReadConfig() > 0)
|
||||
{
|
||||
if (Offsets.IsValid())
|
||||
{
|
||||
MF_AddNatives(RegisterNatives);
|
||||
MF_AddNatives(ReturnNatives);
|
||||
MF_AddNatives(pdata_natives);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MF_Log("Error: pev and base not set for section \"%s windows\", cannot register natives.", MF_GetModname());
|
||||
#elif defined(__linux__)
|
||||
MF_Log("Error: pev and base not set for section \"%s linux\", cannot register natives.", MF_GetModname());
|
||||
#elif defined(__APPLE__)
|
||||
MF_Log("Error: pev and base not set for section \"%s mac\", cannot register natives.", MF_GetModname());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MF_Log("Error: Cannot read config file, natives not registered!");
|
||||
}
|
||||
}
|
||||
|
||||
extern CStack<ItemInfo *> g_FreeIIs;
|
||||
|
||||
#include "NEW_Util.h"
|
||||
#include "CVector.h"
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
#include "ham_const.h"
|
||||
#include "hooklist.h"
|
||||
#include "offsets.h"
|
||||
#include <assert.h>
|
||||
|
||||
edict_t *NEW_FirstEdict;
|
||||
bool NEW_Initialized;
|
||||
|
||||
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
|
||||
extern AMX_NATIVE_INFO RegisterNatives[];
|
||||
extern AMX_NATIVE_INFO ReturnNatives[];
|
||||
extern AMX_NATIVE_INFO pdata_natives[];
|
||||
extern AMX_NATIVE_INFO pdata_natives_safe[];
|
||||
|
||||
|
||||
extern hook_t hooklist[];
|
||||
|
||||
int ReadConfig(void);
|
||||
|
||||
void OnAmxxAttach(void)
|
||||
void OnAmxxDetach()
|
||||
{
|
||||
// Assert that the enum is aligned properly with the table
|
||||
|
||||
assert(strcmp(hooklist[Ham_FVecVisible].name, "fvecvisible")==0);
|
||||
assert(strcmp(hooklist[Ham_Player_UpdateClientData].name, "player_updateclientdata")==0);
|
||||
assert(strcmp(hooklist[Ham_Item_AddToPlayer].name, "item_addtoplayer")==0);
|
||||
assert(strcmp(hooklist[Ham_Weapon_ExtractAmmo].name, "weapon_extractammo")==0);
|
||||
assert(strcmp(hooklist[Ham_TS_BreakableRespawn].name, "ts_breakablerespawn")==0);
|
||||
assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0);
|
||||
assert(strcmp(hooklist[Ham_TS_ShouldCollide].name, "ts_shouldcollide")==0);
|
||||
|
||||
MF_AddNatives(pdata_natives_safe);
|
||||
if (ReadConfig() > 0)
|
||||
while (!g_FreeIIs.empty())
|
||||
{
|
||||
if (Offsets.IsValid())
|
||||
{
|
||||
MF_AddNatives(RegisterNatives);
|
||||
MF_AddNatives(ReturnNatives);
|
||||
MF_AddNatives(pdata_natives);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MF_Log("Error: pev and base not set for section \"%s windows\", cannot register natives.", MF_GetModname());
|
||||
#elif defined(__linux__)
|
||||
MF_Log("Error: pev and base not set for section \"%s linux\", cannot register natives.", MF_GetModname());
|
||||
#elif defined(__APPLE__)
|
||||
MF_Log("Error: pev and base not set for section \"%s mac\", cannot register natives.", MF_GetModname());
|
||||
#endif
|
||||
}
|
||||
delete g_FreeIIs.front();
|
||||
g_FreeIIs.pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
MF_Log("Error: Cannot read config file, natives not registered!");
|
||||
}
|
||||
}
|
||||
|
||||
void HamCommand(void);
|
||||
|
||||
void OnPluginsUnloaded(void)
|
||||
{
|
||||
|
||||
CVector <Hook *>::iterator end;
|
||||
for (int i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
end=hooks[i].end();
|
||||
|
||||
for (CVector<Hook*>::iterator j=hooks[i].begin();
|
||||
j!=end;
|
||||
++j)
|
||||
{
|
||||
delete (*j);
|
||||
}
|
||||
hooks[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
void OnPluginsLoaded(void)
|
||||
{
|
||||
NEW_Initialize(INDEXENT(0));
|
||||
}
|
||||
void OnMetaAttach(void)
|
||||
{
|
||||
REG_SVR_COMMAND("ham", HamCommand);
|
||||
}
|
||||
}
|
||||
|
||||
void HamCommand(void);
|
||||
|
||||
void OnPluginsUnloaded(void)
|
||||
{
|
||||
|
||||
CVector <Hook *>::iterator end;
|
||||
for (int i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
end=hooks[i].end();
|
||||
|
||||
for (CVector<Hook*>::iterator j=hooks[i].begin();
|
||||
j!=end;
|
||||
++j)
|
||||
{
|
||||
delete (*j);
|
||||
}
|
||||
hooks[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
void OnPluginsLoaded(void)
|
||||
{
|
||||
NEW_Initialize(INDEXENT(0));
|
||||
}
|
||||
void OnMetaAttach(void)
|
||||
{
|
||||
REG_SVR_COMMAND("ham", HamCommand);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,93 +1,206 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef HOOK_Call_H
|
||||
#define HOOK_Call_H
|
||||
#ifndef HOOK_Call_H
|
||||
#define HOOK_Call_H
|
||||
|
||||
|
||||
cell Call_Void_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Float_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Float_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Entvar_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Int_Str_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Int_Str_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Entvar(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Vector_Float_Cbase_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Float_Vector_Trace_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Str_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Cbase_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Vector_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Vector_pVector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_pVector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Float_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_pFloat_pFloat(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Int_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_ItemInfo(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Float_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Float_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Float_Float_Cbase(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Float(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Float_Float_Float_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Float_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Vector_Float(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Float_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Float_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Short(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Float_Int_Float(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Str(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Edict(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Int_Str_Bool(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Vector_Vector(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Str_Bool(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Str_Str_Int_Str_Int_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Int_Int_Float_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Str_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Cbase_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Str(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Vector(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Str_Vector_Str(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Str_Str(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Float_Float(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Str_Str_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_pVector_pVector_Cbase_pFloat(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Cbase_pVector_Float(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_pVector_pVector_Float_Cbase_pVector(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Cbase_Bool(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Vector_Vector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Entvar_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Float_Float(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Entvar_Entvar_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Bool_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Int_Vector_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Vector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Cbase_pVector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Bool(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Bool_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Bool_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Cbase_Float(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Void_Cbase_Bool(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Vector_Vector_Vector_Vector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Str_Str(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Short(AMX *amx, cell *params);
|
||||
|
||||
|
||||
cell Call_Void_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Float_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Cbase(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Int_Str_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Entvar(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Float_Vector_Trace_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Str_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Cbase_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Vector_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Vector_pVector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_pVector(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Float_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Int_pFloat_pFloat(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Entvar_Float(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Int_Int_Int(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_ItemInfo(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Float_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Float_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Deprecated(AMX* amx, cell* params);
|
||||
|
||||
#endif
|
||||
cell Call_Deprecated(AMX* amx, cell* params);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,403 +1,403 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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 "ham_const.h"
|
||||
#include "hooklist.h"
|
||||
#include "offsets.h"
|
||||
|
||||
extern hook_t hooklist[];
|
||||
|
||||
enum
|
||||
{
|
||||
LEX_INVALID = 0,
|
||||
|
||||
LEX_UNKNOWN,
|
||||
|
||||
LEX_START_SEC,
|
||||
LEX_END_SEC,
|
||||
|
||||
LEX_MIRROR,
|
||||
|
||||
LEX_PEV,
|
||||
LEX_BASE,
|
||||
|
||||
LEX_END
|
||||
};
|
||||
|
||||
const char *tokens[] =
|
||||
{
|
||||
"", // LEX_INVALID
|
||||
|
||||
"", // LEX_UNKNOWN
|
||||
|
||||
"@section", // LEX_START_SEC
|
||||
"@end", // LEX_END_SEC
|
||||
|
||||
"@mirror", // LEX_MIRROR
|
||||
|
||||
"pev", // LEX_PEV
|
||||
"base", // LEX_BASE
|
||||
|
||||
"", // LEX_END
|
||||
};
|
||||
|
||||
static void trim_line(char *input);
|
||||
static void read_mirror(char *input);
|
||||
static void skip_to_end_of_section(FILE *fp);
|
||||
static int lex(char*& buffer);
|
||||
|
||||
int lex(char*& buffer)
|
||||
{
|
||||
trim_line(buffer);
|
||||
|
||||
size_t len;
|
||||
|
||||
for (int i=0; i<LEX_END; i++)
|
||||
{
|
||||
if (tokens[i]!=NULL && *(tokens[i])!='\0')
|
||||
{
|
||||
len=strlen(tokens[i]);
|
||||
if (strncmp(buffer,tokens[i],len)==0)
|
||||
{
|
||||
buffer+=len+1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return LEX_UNKNOWN;
|
||||
}
|
||||
|
||||
// How we handle "mirrors"
|
||||
// We just note down the current mod name, and every time
|
||||
// we come across a mirror with the destination that matches
|
||||
// the current mod name, we change the current mod name to
|
||||
// the source for that mirror.
|
||||
|
||||
char CurrentModName[64];
|
||||
|
||||
static void read_mirror(char *input)
|
||||
{
|
||||
char *data=input;
|
||||
char *data2;
|
||||
|
||||
char source[64];
|
||||
char dest[64];
|
||||
|
||||
char old;
|
||||
while ( *data!=' ' &&
|
||||
*data!='\t' &&
|
||||
*data!='\0')
|
||||
{
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
old=*data;
|
||||
*data='\0';
|
||||
|
||||
// mark down the source
|
||||
snprintf(source, sizeof(source)-1, "%s", input);
|
||||
|
||||
*data=old;
|
||||
|
||||
while ( *data==' ' ||
|
||||
*data=='\t')
|
||||
{
|
||||
data++;
|
||||
}
|
||||
data2=data;
|
||||
|
||||
while ( *data!=' ' &&
|
||||
*data!='\t' &&
|
||||
*data!='\0')
|
||||
{
|
||||
data++;
|
||||
}
|
||||
old=*data;
|
||||
*data='\0';
|
||||
|
||||
snprintf(dest, sizeof(dest)-1, "%s", data2);
|
||||
|
||||
*data=old;
|
||||
|
||||
if (strcmp(dest, CurrentModName)==0)
|
||||
{
|
||||
snprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void trim_line(char *input)
|
||||
{
|
||||
char *oldinput=input;
|
||||
char *start=input;
|
||||
|
||||
while ( *start==' ' ||
|
||||
*start=='\t' ||
|
||||
*start=='\r' ||
|
||||
*start=='\n')
|
||||
{
|
||||
start++;
|
||||
}
|
||||
|
||||
// Overwrite the whitespace
|
||||
|
||||
if (start != input)
|
||||
{
|
||||
while ((*input++=*start++)!='\0')
|
||||
/* do nothing */ ;
|
||||
}
|
||||
|
||||
start=oldinput;
|
||||
|
||||
start+=strlen(start) - 1;
|
||||
|
||||
while ( start >= oldinput &&
|
||||
( *start == '\0' ||
|
||||
*start == ' ' ||
|
||||
*start == '\r' ||
|
||||
*start == '\n' ||
|
||||
*start == '\t'))
|
||||
{
|
||||
start--;
|
||||
}
|
||||
start++;
|
||||
*start='\0';
|
||||
|
||||
// Now find any comments and cut off at the start
|
||||
|
||||
while (*start != '\0')
|
||||
{
|
||||
if (*start == ';')
|
||||
{
|
||||
*start='\0';
|
||||
break;
|
||||
}
|
||||
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
void skip_to_end_of_section(FILE *fp)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
while (!feof(fp))
|
||||
{
|
||||
buffer[0]='\0';
|
||||
|
||||
fgets(buffer, sizeof(buffer)-1, fp);
|
||||
|
||||
trim_line(buffer);
|
||||
|
||||
char *b=&buffer[0];
|
||||
if (lex(b)==LEX_END_SEC)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
static const char* get_localinfo( const char* name , const char* def = 0 )
|
||||
{
|
||||
const char* b = LOCALINFO( (char*)name );
|
||||
if (((b==0)||(*b==0)) && def )
|
||||
SET_LOCALINFO((char*)name,(char*)(b = def) );
|
||||
return b;
|
||||
}
|
||||
int read_start_section(char *data)
|
||||
{
|
||||
if (strncmp(data, CurrentModName, strlen(CurrentModName))==0)
|
||||
{
|
||||
data+=strlen(CurrentModName)+1;
|
||||
trim_line(data);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (strcmp(data, "windows")==0)
|
||||
#elif defined(__linux__)
|
||||
if (strcmp(data, "linux")==0)
|
||||
#elif defined(__APPLE__)
|
||||
if (strcmp(data, "mac")==0)
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int read_number(char *input)
|
||||
{
|
||||
char *end; /* Temporary pointer, needed for strtoul(). */
|
||||
|
||||
// if begins with 0x or 0X it's to be interpretted as hex
|
||||
if (*input=='0' &&
|
||||
(*(input+1)=='x' || *(input+1)=='X'))
|
||||
{
|
||||
return strtoul(input,&end,16);
|
||||
}
|
||||
|
||||
// otherwise it's to be interpretted as base 10
|
||||
return strtoul(input,&end,10);
|
||||
}
|
||||
void process_pev(char *data)
|
||||
{
|
||||
trim_line(data);
|
||||
Offsets.SetPev(read_number(data));
|
||||
}
|
||||
void process_base(char *data)
|
||||
{
|
||||
trim_line(data);
|
||||
Offsets.SetBase(read_number(data));
|
||||
}
|
||||
void process_key(char *data)
|
||||
{
|
||||
size_t size=0;
|
||||
|
||||
char *a=data;
|
||||
|
||||
while (*a != ' ' && *a != '\t' && *a != '\0')
|
||||
{
|
||||
a++;
|
||||
size++;
|
||||
}
|
||||
|
||||
if (size==0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int set=0;
|
||||
for (int i=0; i< HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
if (strncmp(data, hooklist[i].name, size)==0)
|
||||
{
|
||||
data+=size+1;
|
||||
|
||||
trim_line(data);
|
||||
int value=read_number(data);
|
||||
|
||||
hooklist[i].isset=1;
|
||||
hooklist[i].vtid=value;
|
||||
|
||||
|
||||
set=1;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (set==0)
|
||||
{
|
||||
printf("stray key in process_key: %s\n", data);
|
||||
}
|
||||
|
||||
}
|
||||
int ReadConfig(void)
|
||||
{
|
||||
char FileName[512];
|
||||
|
||||
MF_BuildPathnameR(FileName,sizeof(FileName)-1,"%s",get_localinfo("amxx_configsdir","addons/amxmodx/configs"));
|
||||
|
||||
strncat(FileName,"/hamdata.ini",sizeof(FileName)-1);
|
||||
|
||||
FILE *fp=fopen(FileName,"r");
|
||||
|
||||
|
||||
snprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", MF_GetModname());
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
MF_Log("Unable to open \"%s\" for reading.", FileName);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
char data[2048];
|
||||
|
||||
int insec=0;
|
||||
|
||||
while (!feof(fp))
|
||||
{
|
||||
data[0]='\0';
|
||||
|
||||
fgets(data, sizeof(data)-1, fp);
|
||||
|
||||
char *b=&data[0];
|
||||
|
||||
switch(lex(b))
|
||||
{
|
||||
case LEX_PEV:
|
||||
{
|
||||
if (insec)
|
||||
{
|
||||
process_pev(b);
|
||||
}
|
||||
break;
|
||||
};
|
||||
case LEX_BASE:
|
||||
{
|
||||
if (insec)
|
||||
{
|
||||
process_base(b);
|
||||
}
|
||||
break;
|
||||
};
|
||||
case LEX_MIRROR:
|
||||
{
|
||||
read_mirror(b);
|
||||
break;
|
||||
};
|
||||
case LEX_START_SEC:
|
||||
{
|
||||
insec=read_start_section(b);
|
||||
|
||||
if (!insec)
|
||||
{
|
||||
skip_to_end_of_section(fp);
|
||||
}
|
||||
break;
|
||||
};
|
||||
case LEX_END_SEC:
|
||||
{
|
||||
insec=0;
|
||||
break;
|
||||
};
|
||||
case LEX_UNKNOWN:
|
||||
{
|
||||
if (insec)
|
||||
{
|
||||
process_key(b);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
#include "hooklist.h"
|
||||
#include "offsets.h"
|
||||
|
||||
extern hook_t hooklist[];
|
||||
|
||||
enum
|
||||
{
|
||||
LEX_INVALID = 0,
|
||||
|
||||
LEX_UNKNOWN,
|
||||
|
||||
LEX_START_SEC,
|
||||
LEX_END_SEC,
|
||||
|
||||
LEX_MIRROR,
|
||||
|
||||
LEX_PEV,
|
||||
LEX_BASE,
|
||||
|
||||
LEX_END
|
||||
};
|
||||
|
||||
const char *tokens[] =
|
||||
{
|
||||
"", // LEX_INVALID
|
||||
|
||||
"", // LEX_UNKNOWN
|
||||
|
||||
"@section", // LEX_START_SEC
|
||||
"@end", // LEX_END_SEC
|
||||
|
||||
"@mirror", // LEX_MIRROR
|
||||
|
||||
"pev", // LEX_PEV
|
||||
"base", // LEX_BASE
|
||||
|
||||
"", // LEX_END
|
||||
};
|
||||
|
||||
static void trim_line(char *input);
|
||||
static void read_mirror(char *input);
|
||||
static void skip_to_end_of_section(FILE *fp);
|
||||
static int lex(char*& buffer);
|
||||
|
||||
int lex(char*& buffer)
|
||||
{
|
||||
trim_line(buffer);
|
||||
|
||||
size_t len;
|
||||
|
||||
for (int i=0; i<LEX_END; i++)
|
||||
{
|
||||
if (tokens[i]!=NULL && *(tokens[i])!='\0')
|
||||
{
|
||||
len=strlen(tokens[i]);
|
||||
if (strncmp(buffer,tokens[i],len)==0)
|
||||
{
|
||||
buffer+=len+1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return LEX_UNKNOWN;
|
||||
}
|
||||
|
||||
// How we handle "mirrors"
|
||||
// We just note down the current mod name, and every time
|
||||
// we come across a mirror with the destination that matches
|
||||
// the current mod name, we change the current mod name to
|
||||
// the source for that mirror.
|
||||
|
||||
char CurrentModName[64];
|
||||
|
||||
static void read_mirror(char *input)
|
||||
{
|
||||
char *data=input;
|
||||
char *data2;
|
||||
|
||||
char source[64];
|
||||
char dest[64];
|
||||
|
||||
char old;
|
||||
while ( *data!=' ' &&
|
||||
*data!='\t' &&
|
||||
*data!='\0')
|
||||
{
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
old=*data;
|
||||
*data='\0';
|
||||
|
||||
// mark down the source
|
||||
snprintf(source, sizeof(source)-1, "%s", input);
|
||||
|
||||
*data=old;
|
||||
|
||||
while ( *data==' ' ||
|
||||
*data=='\t')
|
||||
{
|
||||
data++;
|
||||
}
|
||||
data2=data;
|
||||
|
||||
while ( *data!=' ' &&
|
||||
*data!='\t' &&
|
||||
*data!='\0')
|
||||
{
|
||||
data++;
|
||||
}
|
||||
old=*data;
|
||||
*data='\0';
|
||||
|
||||
snprintf(dest, sizeof(dest)-1, "%s", data2);
|
||||
|
||||
*data=old;
|
||||
|
||||
if (strcmp(dest, CurrentModName)==0)
|
||||
{
|
||||
snprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void trim_line(char *input)
|
||||
{
|
||||
char *oldinput=input;
|
||||
char *start=input;
|
||||
|
||||
while ( *start==' ' ||
|
||||
*start=='\t' ||
|
||||
*start=='\r' ||
|
||||
*start=='\n')
|
||||
{
|
||||
start++;
|
||||
}
|
||||
|
||||
// Overwrite the whitespace
|
||||
|
||||
if (start != input)
|
||||
{
|
||||
while ((*input++=*start++)!='\0')
|
||||
/* do nothing */ ;
|
||||
}
|
||||
|
||||
start=oldinput;
|
||||
|
||||
start+=strlen(start) - 1;
|
||||
|
||||
while ( start >= oldinput &&
|
||||
( *start == '\0' ||
|
||||
*start == ' ' ||
|
||||
*start == '\r' ||
|
||||
*start == '\n' ||
|
||||
*start == '\t'))
|
||||
{
|
||||
start--;
|
||||
}
|
||||
start++;
|
||||
*start='\0';
|
||||
|
||||
// Now find any comments and cut off at the start
|
||||
|
||||
while (*start != '\0')
|
||||
{
|
||||
if (*start == ';')
|
||||
{
|
||||
*start='\0';
|
||||
break;
|
||||
}
|
||||
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
void skip_to_end_of_section(FILE *fp)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
while (!feof(fp))
|
||||
{
|
||||
buffer[0]='\0';
|
||||
|
||||
fgets(buffer, sizeof(buffer)-1, fp);
|
||||
|
||||
trim_line(buffer);
|
||||
|
||||
char *b=&buffer[0];
|
||||
if (lex(b)==LEX_END_SEC)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
static const char* get_localinfo( const char* name , const char* def = 0 )
|
||||
{
|
||||
const char* b = LOCALINFO( (char*)name );
|
||||
if (((b==0)||(*b==0)) && def )
|
||||
SET_LOCALINFO((char*)name,(char*)(b = def) );
|
||||
return b;
|
||||
}
|
||||
int read_start_section(char *data)
|
||||
{
|
||||
if (strncasecmp(data, CurrentModName, strlen(CurrentModName))==0)
|
||||
{
|
||||
data+=strlen(CurrentModName)+1;
|
||||
trim_line(data);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (strcmp(data, "windows")==0)
|
||||
#elif defined(__linux__)
|
||||
if (strcmp(data, "linux")==0)
|
||||
#elif defined(__APPLE__)
|
||||
if (strcmp(data, "mac")==0)
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int read_number(char *input)
|
||||
{
|
||||
char *end; /* Temporary pointer, needed for strtoul(). */
|
||||
|
||||
// if begins with 0x or 0X it's to be interpretted as hex
|
||||
if (*input=='0' &&
|
||||
(*(input+1)=='x' || *(input+1)=='X'))
|
||||
{
|
||||
return strtoul(input,&end,16);
|
||||
}
|
||||
|
||||
// otherwise it's to be interpretted as base 10
|
||||
return strtoul(input,&end,10);
|
||||
}
|
||||
void process_pev(char *data)
|
||||
{
|
||||
trim_line(data);
|
||||
Offsets.SetPev(read_number(data));
|
||||
}
|
||||
void process_base(char *data)
|
||||
{
|
||||
trim_line(data);
|
||||
Offsets.SetBase(read_number(data));
|
||||
}
|
||||
void process_key(char *data)
|
||||
{
|
||||
size_t size=0;
|
||||
|
||||
char *a=data;
|
||||
|
||||
while (*a != ' ' && *a != '\t' && *a != '\0')
|
||||
{
|
||||
a++;
|
||||
size++;
|
||||
}
|
||||
|
||||
if (size==0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int set=0;
|
||||
for (int i=0; i< HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
if (strncmp(data, hooklist[i].name, size)==0)
|
||||
{
|
||||
data+=size+1;
|
||||
|
||||
trim_line(data);
|
||||
int value=read_number(data);
|
||||
|
||||
hooklist[i].isset=1;
|
||||
hooklist[i].vtid=value;
|
||||
|
||||
|
||||
set=1;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (set==0)
|
||||
{
|
||||
printf("stray key in process_key: %s\n", data);
|
||||
}
|
||||
|
||||
}
|
||||
int ReadConfig(void)
|
||||
{
|
||||
char FileName[512];
|
||||
|
||||
MF_BuildPathnameR(FileName,sizeof(FileName)-1,"%s",get_localinfo("amxx_configsdir","addons/amxmodx/configs"));
|
||||
|
||||
strncat(FileName,"/hamdata.ini",sizeof(FileName)-1);
|
||||
|
||||
FILE *fp=fopen(FileName,"r");
|
||||
|
||||
|
||||
snprintf(CurrentModName, sizeof(CurrentModName)-1, "%s", MF_GetModname());
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
MF_Log("Unable to open \"%s\" for reading.", FileName);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
char data[2048];
|
||||
|
||||
int insec=0;
|
||||
|
||||
while (!feof(fp))
|
||||
{
|
||||
data[0]='\0';
|
||||
|
||||
fgets(data, sizeof(data)-1, fp);
|
||||
|
||||
char *b=&data[0];
|
||||
|
||||
switch(lex(b))
|
||||
{
|
||||
case LEX_PEV:
|
||||
{
|
||||
if (insec)
|
||||
{
|
||||
process_pev(b);
|
||||
}
|
||||
break;
|
||||
};
|
||||
case LEX_BASE:
|
||||
{
|
||||
if (insec)
|
||||
{
|
||||
process_base(b);
|
||||
}
|
||||
break;
|
||||
};
|
||||
case LEX_MIRROR:
|
||||
{
|
||||
read_mirror(b);
|
||||
break;
|
||||
};
|
||||
case LEX_START_SEC:
|
||||
{
|
||||
insec=read_start_section(b);
|
||||
|
||||
if (!insec)
|
||||
{
|
||||
skip_to_end_of_section(fp);
|
||||
}
|
||||
break;
|
||||
};
|
||||
case LEX_END_SEC:
|
||||
{
|
||||
insec=0;
|
||||
break;
|
||||
};
|
||||
case LEX_UNKNOWN:
|
||||
{
|
||||
if (insec)
|
||||
{
|
||||
process_key(b);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,68 +1,68 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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"
|
||||
|
||||
#ifndef FORWARD_H
|
||||
#define FORWARD_H
|
||||
|
||||
enum fwdstate
|
||||
{
|
||||
FSTATE_INVALID = 0,
|
||||
FSTATE_OK,
|
||||
FSTATE_PAUSE,
|
||||
FSTATE_STOP,
|
||||
FSTATE_DESTROY
|
||||
};
|
||||
|
||||
class Forward
|
||||
{
|
||||
public:
|
||||
int id; // id of the forward
|
||||
fwdstate state;
|
||||
Forward(int id_) : id(id_), state(FSTATE_OK)
|
||||
{
|
||||
/* do nothing */
|
||||
};
|
||||
Forward() : id(-1), state(FSTATE_INVALID)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
~Forward()
|
||||
{
|
||||
MF_UnregisterSPForward(id);
|
||||
}
|
||||
inline void Set(int i)
|
||||
{
|
||||
state=FSTATE_OK;
|
||||
id=i;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#ifndef FORWARD_H
|
||||
#define FORWARD_H
|
||||
|
||||
enum fwdstate
|
||||
{
|
||||
FSTATE_INVALID = 0,
|
||||
FSTATE_OK,
|
||||
FSTATE_PAUSE,
|
||||
FSTATE_STOP,
|
||||
FSTATE_DESTROY
|
||||
};
|
||||
|
||||
class Forward
|
||||
{
|
||||
public:
|
||||
int id; // id of the forward
|
||||
fwdstate state;
|
||||
Forward(int id_) : id(id_), state(FSTATE_OK)
|
||||
{
|
||||
/* do nothing */
|
||||
};
|
||||
Forward() : id(-1), state(FSTATE_INVALID)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
~Forward()
|
||||
{
|
||||
MF_UnregisterSPForward(id);
|
||||
}
|
||||
inline void Set(int i)
|
||||
{
|
||||
state=FSTATE_OK;
|
||||
id=i;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,199 +1,516 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifndef HAM_CONST_H
|
||||
#define HAM_CONST_H
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
HAM_UNSET = 0,
|
||||
HAM_IGNORED,
|
||||
HAM_HANDLED,
|
||||
HAM_OVERRIDE,
|
||||
HAM_SUPERCEDE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Ham_Spawn = 0,
|
||||
Ham_Precache,
|
||||
Ham_Keyvalue,
|
||||
Ham_ObjectCaps,
|
||||
Ham_Activate,
|
||||
Ham_SetObjectCollisionBox,
|
||||
Ham_Classify,
|
||||
Ham_DeathNotice,
|
||||
Ham_TraceAttack,
|
||||
Ham_TakeDamage,
|
||||
Ham_TakeHealth,
|
||||
Ham_Killed,
|
||||
Ham_BloodColor,
|
||||
Ham_TraceBleed,
|
||||
Ham_IsTriggered,
|
||||
Ham_MyMonsterPointer,
|
||||
Ham_MySquadMonsterPointer,
|
||||
Ham_GetToggleState,
|
||||
Ham_AddPoints,
|
||||
Ham_AddPointsToTeam,
|
||||
Ham_AddPlayerItem,
|
||||
Ham_RemovePlayerItem,
|
||||
Ham_GiveAmmo,
|
||||
Ham_GetDelay,
|
||||
Ham_IsMoving,
|
||||
Ham_OverrideReset,
|
||||
Ham_DamageDecal,
|
||||
Ham_SetToggleState,
|
||||
Ham_StartSneaking,
|
||||
Ham_StopSneaking,
|
||||
Ham_OnControls,
|
||||
Ham_IsSneaking,
|
||||
Ham_IsAlive,
|
||||
Ham_IsBSPModel,
|
||||
Ham_ReflectGauss,
|
||||
Ham_HasTarget,
|
||||
Ham_IsInWorld,
|
||||
Ham_IsPlayer,
|
||||
Ham_IsNetClient,
|
||||
Ham_TeamId,
|
||||
Ham_GetNextTarget,
|
||||
Ham_Think,
|
||||
Ham_Touch,
|
||||
Ham_Use,
|
||||
Ham_Blocked,
|
||||
Ham_Respawn,
|
||||
Ham_UpdateOwner,
|
||||
Ham_FBecomeProne,
|
||||
Ham_Center,
|
||||
Ham_EyePosition,
|
||||
Ham_EarPosition,
|
||||
Ham_BodyTarget,
|
||||
Ham_Illumination,
|
||||
Ham_FVisible,
|
||||
Ham_FVecVisible,
|
||||
|
||||
Ham_Player_Jump,
|
||||
Ham_Player_Duck,
|
||||
Ham_Player_PreThink,
|
||||
Ham_Player_PostThink,
|
||||
Ham_Player_GetGunPosition,
|
||||
Ham_Player_ShouldFadeOnDeath,
|
||||
Ham_Player_ImpulseCommands,
|
||||
Ham_Player_UpdateClientData,
|
||||
|
||||
Ham_Item_AddToPlayer,
|
||||
Ham_Item_AddDuplicate,
|
||||
Ham_Item_CanDeploy,
|
||||
Ham_Item_Deploy,
|
||||
Ham_Item_CanHolster,
|
||||
Ham_Item_Holster,
|
||||
Ham_Item_UpdateItemInfo,
|
||||
Ham_Item_PreFrame,
|
||||
Ham_Item_PostFrame,
|
||||
Ham_Item_Drop,
|
||||
Ham_Item_Kill,
|
||||
Ham_Item_AttachToPlayer,
|
||||
Ham_Item_PrimaryAmmoIndex,
|
||||
Ham_Item_SecondaryAmmoIndex,
|
||||
Ham_Item_UpdateClientData,
|
||||
Ham_Item_GetWeaponPtr,
|
||||
Ham_Item_ItemSlot,
|
||||
|
||||
Ham_Weapon_ExtractAmmo,
|
||||
Ham_Weapon_ExtractClipAmmo,
|
||||
Ham_Weapon_AddWeapon,
|
||||
Ham_Weapon_PlayEmptySound,
|
||||
Ham_Weapon_ResetEmptySound,
|
||||
Ham_Weapon_SendWeaponAnim,
|
||||
Ham_Weapon_IsUsable,
|
||||
Ham_Weapon_PrimaryAttack,
|
||||
Ham_Weapon_SecondaryAttack,
|
||||
Ham_Weapon_Reload,
|
||||
Ham_Weapon_WeaponIdle,
|
||||
Ham_Weapon_RetireWeapon,
|
||||
Ham_Weapon_ShouldWeaponIdle,
|
||||
Ham_Weapon_UseDecrement,
|
||||
|
||||
Ham_TS_BreakableRespawn,
|
||||
Ham_TS_CanUsedThroughWalls,
|
||||
Ham_TS_RespawnWait,
|
||||
|
||||
Ham_CS_Restart,
|
||||
Ham_CS_RoundRespawn,
|
||||
Ham_CS_Item_CanDrop,
|
||||
Ham_CS_Item_GetMaxSpeed,
|
||||
|
||||
Ham_DOD_RoundRespawn,
|
||||
Ham_DOD_RoundRespawnEnt,
|
||||
Ham_DOD_RoundStore,
|
||||
Ham_DOD_AreaSetIndex,
|
||||
Ham_DOD_AreaSendStatus,
|
||||
Ham_DOD_GetState,
|
||||
Ham_DOD_GetStateEnt,
|
||||
Ham_DOD_Item_CanDrop,
|
||||
|
||||
Ham_TFC_EngineerUse,
|
||||
Ham_TFC_Finished,
|
||||
Ham_TFC_EmpExplode,
|
||||
Ham_TFC_CalcEmpDmgRad,
|
||||
Ham_TFC_TakeEmpBlast,
|
||||
Ham_TFC_EmpRemove,
|
||||
Ham_TFC_TakeConcussionBlast,
|
||||
Ham_TFC_Concuss,
|
||||
|
||||
Ham_ESF_IsEnvModel, // Only valid in ESF Open Beta
|
||||
Ham_ESF_TakeDamage2, // Only valid in ESF Open Beta
|
||||
|
||||
Ham_NS_GetPointValue,
|
||||
Ham_NS_AwardKill,
|
||||
Ham_NS_ResetEntity,
|
||||
Ham_NS_UpdateOnRemove,
|
||||
|
||||
Ham_TS_GiveSlowMul,
|
||||
Ham_TS_GoSlow,
|
||||
Ham_TS_InSlow,
|
||||
Ham_TS_IsObjective,
|
||||
Ham_TS_EnableObjective,
|
||||
Ham_TS_OnFreeEntPrivateData,
|
||||
Ham_TS_ShouldCollide,
|
||||
|
||||
HAM_LAST_ENTRY_DONT_USE_ME_LOL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HAM_OK = 0,
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifndef HAM_CONST_H
|
||||
#define HAM_CONST_H
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
HAM_UNSET = 0,
|
||||
HAM_IGNORED,
|
||||
HAM_HANDLED,
|
||||
HAM_OVERRIDE,
|
||||
HAM_SUPERCEDE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Ham_Spawn = 0,
|
||||
Ham_Precache,
|
||||
Ham_Keyvalue,
|
||||
Ham_ObjectCaps,
|
||||
Ham_Activate,
|
||||
Ham_SetObjectCollisionBox,
|
||||
Ham_Classify,
|
||||
Ham_DeathNotice,
|
||||
Ham_TraceAttack,
|
||||
Ham_TakeDamage,
|
||||
Ham_TakeHealth,
|
||||
Ham_Killed,
|
||||
Ham_BloodColor,
|
||||
Ham_TraceBleed,
|
||||
Ham_IsTriggered,
|
||||
Ham_MyMonsterPointer,
|
||||
Ham_MySquadMonsterPointer,
|
||||
Ham_GetToggleState,
|
||||
Ham_AddPoints,
|
||||
Ham_AddPointsToTeam,
|
||||
Ham_AddPlayerItem,
|
||||
Ham_RemovePlayerItem,
|
||||
Ham_GiveAmmo,
|
||||
Ham_GetDelay,
|
||||
Ham_IsMoving,
|
||||
Ham_OverrideReset,
|
||||
Ham_DamageDecal,
|
||||
Ham_SetToggleState,
|
||||
Ham_StartSneaking,
|
||||
Ham_StopSneaking,
|
||||
Ham_OnControls,
|
||||
Ham_IsSneaking,
|
||||
Ham_IsAlive,
|
||||
Ham_IsBSPModel,
|
||||
Ham_ReflectGauss,
|
||||
Ham_HasTarget,
|
||||
Ham_IsInWorld,
|
||||
Ham_IsPlayer,
|
||||
Ham_IsNetClient,
|
||||
Ham_TeamId,
|
||||
Ham_GetNextTarget,
|
||||
Ham_Think,
|
||||
Ham_Touch,
|
||||
Ham_Use,
|
||||
Ham_Blocked,
|
||||
Ham_Respawn,
|
||||
Ham_UpdateOwner,
|
||||
Ham_FBecomeProne,
|
||||
Ham_Center,
|
||||
Ham_EyePosition,
|
||||
Ham_EarPosition,
|
||||
Ham_BodyTarget,
|
||||
Ham_Illumination,
|
||||
Ham_FVisible,
|
||||
Ham_FVecVisible,
|
||||
|
||||
Ham_Player_Jump,
|
||||
Ham_Player_Duck,
|
||||
Ham_Player_PreThink,
|
||||
Ham_Player_PostThink,
|
||||
Ham_Player_GetGunPosition,
|
||||
Ham_Player_ShouldFadeOnDeath,
|
||||
Ham_Player_ImpulseCommands,
|
||||
Ham_Player_UpdateClientData,
|
||||
|
||||
HAM_INVALID_FUNC, // The function is not valid
|
||||
HAM_FUNC_NOT_CONFIGURED, // This function is not configured in hamdata.ini
|
||||
|
||||
HAM_ERR_END
|
||||
};
|
||||
Ham_Item_AddToPlayer,
|
||||
Ham_Item_AddDuplicate,
|
||||
Ham_Item_CanDeploy,
|
||||
Ham_Item_Deploy,
|
||||
Ham_Item_CanHolster,
|
||||
Ham_Item_Holster,
|
||||
Ham_Item_UpdateItemInfo,
|
||||
Ham_Item_PreFrame,
|
||||
Ham_Item_PostFrame,
|
||||
Ham_Item_Drop,
|
||||
Ham_Item_Kill,
|
||||
Ham_Item_AttachToPlayer,
|
||||
Ham_Item_PrimaryAmmoIndex,
|
||||
Ham_Item_SecondaryAmmoIndex,
|
||||
Ham_Item_UpdateClientData,
|
||||
Ham_Item_GetWeaponPtr,
|
||||
Ham_Item_ItemSlot,
|
||||
|
||||
Ham_Weapon_ExtractAmmo,
|
||||
Ham_Weapon_ExtractClipAmmo,
|
||||
Ham_Weapon_AddWeapon,
|
||||
Ham_Weapon_PlayEmptySound,
|
||||
Ham_Weapon_ResetEmptySound,
|
||||
Ham_Weapon_SendWeaponAnim,
|
||||
Ham_Weapon_IsUsable,
|
||||
Ham_Weapon_PrimaryAttack,
|
||||
Ham_Weapon_SecondaryAttack,
|
||||
Ham_Weapon_Reload,
|
||||
Ham_Weapon_WeaponIdle,
|
||||
Ham_Weapon_RetireWeapon,
|
||||
Ham_Weapon_ShouldWeaponIdle,
|
||||
Ham_Weapon_UseDecrement,
|
||||
|
||||
Ham_TS_BreakableRespawn,
|
||||
Ham_TS_CanUsedThroughWalls,
|
||||
Ham_TS_RespawnWait,
|
||||
|
||||
Ham_CS_Restart,
|
||||
Ham_CS_RoundRespawn,
|
||||
Ham_CS_Item_CanDrop,
|
||||
Ham_CS_Item_GetMaxSpeed,
|
||||
|
||||
Ham_DOD_RoundRespawn,
|
||||
Ham_DOD_RoundRespawnEnt,
|
||||
Ham_DOD_RoundStore,
|
||||
Ham_DOD_AreaSetIndex,
|
||||
Ham_DOD_AreaSendStatus,
|
||||
Ham_DOD_GetState,
|
||||
Ham_DOD_GetStateEnt,
|
||||
Ham_DOD_Item_CanDrop,
|
||||
|
||||
Ham_TFC_EngineerUse,
|
||||
Ham_TFC_Finished,
|
||||
Ham_TFC_EmpExplode,
|
||||
Ham_TFC_CalcEmpDmgRad,
|
||||
Ham_TFC_TakeEmpBlast,
|
||||
Ham_TFC_EmpRemove,
|
||||
Ham_TFC_TakeConcussionBlast,
|
||||
Ham_TFC_Concuss,
|
||||
|
||||
Ham_ESF_IsEnvModel, // Only valid in ESF Open Beta
|
||||
Ham_ESF_TakeDamage2, // Only valid in ESF Open Beta
|
||||
|
||||
Ham_NS_GetPointValue,
|
||||
Ham_NS_AwardKill,
|
||||
Ham_NS_ResetEntity,
|
||||
Ham_NS_UpdateOnRemove,
|
||||
|
||||
Ham_TS_GiveSlowMul,
|
||||
Ham_TS_GoSlow,
|
||||
Ham_TS_InSlow,
|
||||
Ham_TS_IsObjective,
|
||||
Ham_TS_EnableObjective,
|
||||
Ham_TS_OnFreeEntPrivateData,
|
||||
Ham_TS_ShouldCollide,
|
||||
|
||||
//
|
||||
// New addition - 2011
|
||||
//
|
||||
|
||||
#endif
|
||||
Ham_ChangeYaw,
|
||||
Ham_HasHumanGibs,
|
||||
Ham_HasAlienGibs,
|
||||
Ham_FadeMonster,
|
||||
Ham_GibMonster,
|
||||
Ham_BecomeDead,
|
||||
Ham_IRelationship,
|
||||
Ham_PainSound,
|
||||
Ham_ReportAIState,
|
||||
Ham_MonsterInitDead,
|
||||
Ham_Look,
|
||||
Ham_BestVisibleEnemy,
|
||||
Ham_FInViewCone,
|
||||
Ham_FVecInViewCone,
|
||||
Ham_GetDeathActivity,
|
||||
|
||||
// Not valid in CS, NS and TS.
|
||||
Ham_RunAI,
|
||||
Ham_MonsterThink,
|
||||
Ham_MonsterInit,
|
||||
Ham_CheckLocalMove,
|
||||
Ham_Move,
|
||||
Ham_MoveExecute,
|
||||
Ham_ShouldAdvanceRoute,
|
||||
Ham_GetStoppedActivity,
|
||||
Ham_Stop,
|
||||
Ham_CheckRangeAttack1,
|
||||
Ham_CheckRangeAttack2,
|
||||
Ham_CheckMeleeAttack1,
|
||||
Ham_CheckMeleeAttack2,
|
||||
Ham_ScheduleChange,
|
||||
Ham_CanPlaySequence,
|
||||
Ham_CanPlaySentence,
|
||||
Ham_PlaySentence,
|
||||
Ham_PlayScriptedSentence,
|
||||
Ham_SentenceStop,
|
||||
Ham_GetIdealState,
|
||||
Ham_SetActivity,
|
||||
Ham_CheckEnemy,
|
||||
Ham_FTriangulate,
|
||||
Ham_SetYawSpeed,
|
||||
Ham_BuildNearestRoute,
|
||||
Ham_FindCover,
|
||||
Ham_CoverRadius,
|
||||
Ham_FCanCheckAttacks,
|
||||
Ham_CheckAmmo,
|
||||
Ham_IgnoreConditions,
|
||||
Ham_FValidateHintType,
|
||||
Ham_FCanActiveIdle,
|
||||
Ham_ISoundMask,
|
||||
Ham_HearingSensitivity,
|
||||
Ham_BarnacleVictimBitten,
|
||||
Ham_BarnacleVictimReleased,
|
||||
Ham_PrescheduleThink,
|
||||
Ham_DeathSound,
|
||||
Ham_AlertSound,
|
||||
Ham_IdleSound,
|
||||
Ham_StopFollowing,
|
||||
|
||||
Ham_CS_Weapon_SendWeaponAnim,
|
||||
Ham_CS_Player_ResetMaxSpeed,
|
||||
Ham_CS_Player_IsBot,
|
||||
Ham_CS_Player_GetAutoaimVector,
|
||||
Ham_CS_Player_Blind,
|
||||
Ham_CS_Player_OnTouchingWeapon,
|
||||
|
||||
Ham_DOD_SetScriptReset,
|
||||
Ham_DOD_Item_SpawnDeploy,
|
||||
Ham_DOD_Item_SetDmgTime,
|
||||
Ham_DOD_Item_DropGren,
|
||||
Ham_DOD_Weapon_IsUseable,
|
||||
Ham_DOD_Weapon_Aim,
|
||||
Ham_DOD_Weapon_flAim,
|
||||
Ham_DOD_Weapon_RemoveStamina,
|
||||
Ham_DOD_Weapon_ChangeFOV,
|
||||
Ham_DOD_Weapon_ZoomOut,
|
||||
Ham_DOD_Weapon_ZoomIn,
|
||||
Ham_DOD_Weapon_GetFOV,
|
||||
Ham_DOD_Weapon_IsWaterSniping,
|
||||
Ham_DOD_Weapon_UpdateZoomSpeed,
|
||||
Ham_DOD_Weapon_Special,
|
||||
|
||||
Ham_TFC_DB_GetItemName,
|
||||
Ham_TFC_RadiusDamage,
|
||||
Ham_TFC_RadiusDamage2,
|
||||
|
||||
Ham_ESF_IsFighter,
|
||||
Ham_ESF_IsBuddy,
|
||||
Ham_ESF_EmitSound,
|
||||
Ham_ESF_EmitNullSound,
|
||||
Ham_ESF_IncreaseStrength,
|
||||
Ham_ESF_IncreasePL,
|
||||
Ham_ESF_SetPowerLevel,
|
||||
Ham_ESF_SetMaxPowerLevel,
|
||||
Ham_ESF_StopAniTrigger,
|
||||
Ham_ESF_StopFly,
|
||||
Ham_ESF_HideWeapon,
|
||||
Ham_ESF_ClientRemoveWeapon,
|
||||
Ham_ESF_SendClientsCustomModel,
|
||||
Ham_ESF_CanTurbo,
|
||||
Ham_ESF_CanPrimaryFire,
|
||||
Ham_ESF_CanSecondaryFire,
|
||||
Ham_ESF_CanStopFly,
|
||||
Ham_ESF_CanBlock,
|
||||
Ham_ESF_CanRaiseKi,
|
||||
Ham_ESF_CanRaiseStamina,
|
||||
Ham_ESF_CanTeleport,
|
||||
Ham_ESF_CanStartFly,
|
||||
Ham_ESF_CanStartPowerup,
|
||||
Ham_ESF_CanJump,
|
||||
Ham_ESF_CanWallJump,
|
||||
Ham_ESF_IsSuperJump,
|
||||
Ham_ESF_IsMoveBack,
|
||||
Ham_ESF_CheckWallJump,
|
||||
Ham_ESF_EnableWallJump,
|
||||
Ham_ESF_DisableWallJump,
|
||||
Ham_ESF_ResetWallJumpVars,
|
||||
Ham_ESF_GetWallJumpAnim,
|
||||
Ham_ESF_GetWallJumpAnim2,
|
||||
Ham_ESF_SetWallJumpAnimation,
|
||||
Ham_ESF_SetFlyMoveType,
|
||||
Ham_ESF_IsFlyMoveType,
|
||||
Ham_ESF_IsWalkMoveType,
|
||||
Ham_ESF_SetWalkMoveType,
|
||||
Ham_ESF_DrawChargeBar,
|
||||
Ham_ESF_StartBlock,
|
||||
Ham_ESF_StopBlock,
|
||||
Ham_ESF_StartFly,
|
||||
Ham_ESF_GetMaxSpeed,
|
||||
Ham_ESF_SetAnimation,
|
||||
Ham_ESF_PlayAnimation,
|
||||
Ham_ESF_GetMoveForward,
|
||||
Ham_ESF_GetMoveRight,
|
||||
Ham_ESF_GetMoveUp,
|
||||
Ham_ESF_AddBlindFX,
|
||||
Ham_ESF_RemoveBlindFX,
|
||||
Ham_ESF_DisablePSBar,
|
||||
Ham_ESF_AddBeamBoxCrosshair,
|
||||
Ham_ESF_RemoveBeamBoxCrosshair,
|
||||
Ham_ESF_DrawPSWinBonus,
|
||||
Ham_ESF_DrawPSBar,
|
||||
Ham_ESF_LockCrosshair,
|
||||
Ham_ESF_UnLockCrosshair,
|
||||
Ham_ESF_RotateCrosshair,
|
||||
Ham_ESF_UnRotateCrosshair,
|
||||
Ham_ESF_WaterMove,
|
||||
Ham_ESF_CheckTimeBasedDamage,
|
||||
Ham_ESF_DoesSecondaryAttack,
|
||||
Ham_ESF_DoesPrimaryAttack,
|
||||
Ham_ESF_RemoveSpecialModes,
|
||||
Ham_ESF_StopTurbo,
|
||||
Ham_ESF_TakeBean,
|
||||
Ham_ESF_GetPowerLevel,
|
||||
Ham_ESF_RemoveAllOtherWeapons,
|
||||
Ham_ESF_StopSwoop,
|
||||
Ham_ESF_SetDeathAnimation,
|
||||
Ham_ESF_SetModel,
|
||||
Ham_ESF_AddAttacks,
|
||||
Ham_ESF_EmitClassSound,
|
||||
Ham_ESF_CheckLightning,
|
||||
Ham_ESF_FreezeControls,
|
||||
Ham_ESF_UnFreezeControls,
|
||||
Ham_ESF_UpdateKi,
|
||||
Ham_ESF_UpdateHealth,
|
||||
Ham_ESF_GetTeleportDir,
|
||||
Ham_ESF_Weapon_HolsterWhenMeleed,
|
||||
|
||||
Ham_NS_SetBoneController,
|
||||
Ham_NS_SaveDataForReset,
|
||||
Ham_NS_GetHull,
|
||||
Ham_NS_GetMaxWalkSpeed,
|
||||
Ham_NS_SetTeamID,
|
||||
Ham_NS_GetEffectivePlayerClass,
|
||||
Ham_NS_GetAuthenticationMask,
|
||||
Ham_NS_EffectivePlayerClassChanged,
|
||||
Ham_NS_NeedsTeamUpdate,
|
||||
Ham_NS_SendTeamUpdate,
|
||||
Ham_NS_SendWeaponUpdate,
|
||||
Ham_NS_InitPlayerFromSpawn,
|
||||
Ham_NS_PackDeadPlayerItems,
|
||||
Ham_NS_GetAnimationForActivity,
|
||||
Ham_NS_StartObserver,
|
||||
Ham_NS_StopObserver,
|
||||
Ham_NS_GetAdrenalineFactor,
|
||||
Ham_NS_GetNamedItem,
|
||||
Ham_NS_Suicide,
|
||||
Ham_NS_GetCanUseWeapon,
|
||||
Ham_NS_Weapon_GetWeapPrimeTime,
|
||||
Ham_NS_Weapon_PrimeWeapon,
|
||||
Ham_NS_Weapon_GetIsWeaponPrimed,
|
||||
Ham_NS_Weapon_GetIsWeaponPriming,
|
||||
Ham_NS_Weapon_DefaultDeploy,
|
||||
Ham_NS_Weapon_DefaultReload,
|
||||
Ham_NS_Weapon_GetDeployTime,
|
||||
|
||||
Ham_SC_GetClassification,
|
||||
Ham_SC_IsMonster,
|
||||
Ham_SC_IsPhysX,
|
||||
Ham_SC_IsPointEntity,
|
||||
Ham_SC_IsMachine,
|
||||
Ham_SC_CriticalRemove,
|
||||
Ham_SC_UpdateOnRemove,
|
||||
Ham_SC_FVisible,
|
||||
Ham_SC_FVisibleFromPos,
|
||||
Ham_SC_IsFacings,
|
||||
Ham_SC_GetPointsForDamage,
|
||||
Ham_SC_GetDamagePoints,
|
||||
Ham_SC_OnCreate,
|
||||
Ham_SC_OnDestroy,
|
||||
Ham_SC_IsValidEntity,
|
||||
Ham_SC_ShouldFadeOnDeath,
|
||||
Ham_SC_SetupFriendly,
|
||||
Ham_SC_ReviveThink,
|
||||
Ham_SC_Revive,
|
||||
Ham_SC_StartMonster,
|
||||
Ham_SC_CheckRangeAttack1_Move,
|
||||
Ham_SC_CheckRangeAttack2_Move,
|
||||
Ham_SC_CheckMeleeAttack1_Move,
|
||||
Ham_SC_CheckMeleeAttack2_Move,
|
||||
Ham_SC_CheckTankUsage,
|
||||
Ham_SC_SetGaitActivity,
|
||||
Ham_SC_FTriangulate,
|
||||
Ham_SC_FTriangulateExtension,
|
||||
Ham_SC_FindCoverGrenade,
|
||||
Ham_SC_FindCoverDistance,
|
||||
Ham_SC_FindAttackPoint,
|
||||
Ham_SC_FValidateCover,
|
||||
Ham_SC_NoFriendlyFire1,
|
||||
Ham_SC_NoFriendlyFire2,
|
||||
Ham_SC_NoFriendlyFire3,
|
||||
Ham_SC_NoFriendlyFireToPos,
|
||||
Ham_SC_FVisibleGunPos,
|
||||
Ham_SC_FInBulletCone,
|
||||
Ham_SC_CallGibMonster,
|
||||
Ham_SC_CheckTimeBasedDamage,
|
||||
Ham_SC_IsMoving,
|
||||
Ham_SC_IsPlayerFollowing,
|
||||
Ham_SC_StartPlayerFollowing,
|
||||
Ham_SC_StopPlayerFollowing,
|
||||
Ham_SC_UseSound,
|
||||
Ham_SC_UnUseSound,
|
||||
Ham_SC_RideMonster,
|
||||
Ham_SC_CheckApplyGenericAttacks,
|
||||
Ham_SC_CheckScared,
|
||||
Ham_SC_CheckCreatureDanger,
|
||||
Ham_SC_CheckFallDamage,
|
||||
Ham_SC_CheckRevival,
|
||||
Ham_SC_MedicCallSound,
|
||||
|
||||
Ham_SC_Player_MenuInputPerformed,
|
||||
Ham_SC_Player_IsMenuInputDone,
|
||||
Ham_SC_Player_SpecialSpawn,
|
||||
Ham_SC_Player_IsValidInfoEntity,
|
||||
Ham_SC_Player_LevelEnd,
|
||||
Ham_SC_Player_VoteStarted,
|
||||
Ham_SC_Player_CanStartNextVote,
|
||||
Ham_SC_Player_Vote,
|
||||
Ham_SC_Player_HasVoted,
|
||||
Ham_SC_Player_ResetVote,
|
||||
Ham_SC_Player_LastVoteInput,
|
||||
Ham_SC_Player_InitVote,
|
||||
Ham_SC_Player_TimeToStartNextVote,
|
||||
Ham_SC_Player_ResetView,
|
||||
Ham_SC_Player_GetLogFrequency,
|
||||
Ham_SC_Player_LogPlayerStats,
|
||||
Ham_SC_Player_DisableCollisionWithPlayer,
|
||||
Ham_SC_Player_EnableCollisionWithPlayer,
|
||||
Ham_SC_Player_CanTouchPlayer,
|
||||
|
||||
Ham_SC_Item_Materialize,
|
||||
|
||||
Ham_SC_Weapon_BulletAccuracy,
|
||||
Ham_SC_Weapon_TertiaryAttack,
|
||||
Ham_SC_Weapon_BurstSupplement,
|
||||
Ham_SC_Weapon_GetP_Model,
|
||||
Ham_SC_Weapon_GetW_Model,
|
||||
Ham_SC_Weapon_GetV_Model,
|
||||
Ham_SC_Weapon_PrecacheCustomModels,
|
||||
Ham_SC_Weapon_IsMultiplayer,
|
||||
Ham_SC_Weapon_FRunfuncs,
|
||||
Ham_SC_Weapon_SetFOV,
|
||||
Ham_SC_Weapon_FCanRun,
|
||||
Ham_SC_Weapon_CustomDecrement,
|
||||
Ham_SC_Weapon_SetV_Model,
|
||||
Ham_SC_Weapon_SetP_Model,
|
||||
Ham_SC_Weapon_ChangeWeaponSkin,
|
||||
|
||||
//
|
||||
// New addition - 2013
|
||||
//
|
||||
|
||||
Ham_TFC_Killed,
|
||||
Ham_TFC_IsTriggered,
|
||||
Ham_TFC_Weapon_SendWeaponAnim,
|
||||
Ham_TFC_Weapon_GetNextAttackDelay,
|
||||
|
||||
Ham_SC_TakeHealth,
|
||||
Ham_SC_TakeArmor,
|
||||
Ham_SC_GiveAmmo,
|
||||
Ham_SC_CheckAttacker,
|
||||
Ham_SC_Player_IsConnected,
|
||||
|
||||
Ham_DOD_Weapon_SendWeaponAnim,
|
||||
|
||||
Ham_CS_Item_IsWeapon,
|
||||
|
||||
Ham_OPF_MySquadTalkMonsterPointer,
|
||||
Ham_OPF_WeaponTimeBase,
|
||||
|
||||
Ham_TS_Weapon_AlternateAttack,
|
||||
|
||||
Ham_Item_GetItemInfo,
|
||||
|
||||
HAM_LAST_ENTRY_DONT_USE_ME_LOL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HAM_OK = 0,
|
||||
|
||||
HAM_INVALID_FUNC, // The function is not valid
|
||||
HAM_FUNC_NOT_CONFIGURED, // This function is not configured in hamdata.ini
|
||||
|
||||
HAM_ERR_END
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,161 +1,176 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifndef HAM_UTILS_H
|
||||
#define HAM_UTILS_H
|
||||
|
||||
#include "amxxmodule.h"
|
||||
#include "offsets.h"
|
||||
#include "NEW_Util.h"
|
||||
|
||||
#define CHECK_FUNCTION(x) \
|
||||
if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \
|
||||
char msg[1024]; \
|
||||
snprintf(msg, sizeof(msg)-1, "Function out of bounds. Got: %d Max: %d",x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \
|
||||
FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \
|
||||
return 0; \
|
||||
} else if (hooklist[x].isset == 0) { \
|
||||
char msg[1024]; \
|
||||
snprintf(msg, sizeof(msg)-1, "Function %s is not configured in hamdata.ini.",hooklist[x].name); \
|
||||
FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
|
||||
#define CHECK_ENTITY(x) \
|
||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||
return 0; \
|
||||
} else { \
|
||||
if (INDEXENT_NEW(x)->free) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity (%d)", x); \
|
||||
return 0; \
|
||||
} else if (INDEXENT_NEW(x)->pvPrivateData == NULL) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity has null private data (%d)", x); \
|
||||
return 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
inline edict_t *PrivateToEdict(const void *pdata)
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifndef HAM_UTILS_H
|
||||
#define HAM_UTILS_H
|
||||
|
||||
#include "amxxmodule.h"
|
||||
#include "offsets.h"
|
||||
#include "NEW_Util.h"
|
||||
|
||||
#define CHECK_FUNCTION(x) \
|
||||
if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \
|
||||
char msg[1024]; \
|
||||
snprintf(msg, sizeof(msg)-1, "Function out of bounds. Got: %d Max: %d",x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \
|
||||
FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \
|
||||
return 0; \
|
||||
} else if (hooklist[x].isset == 0) { \
|
||||
char msg[1024]; \
|
||||
snprintf(msg, sizeof(msg)-1, "Function %s is not configured in hamdata.ini.",hooklist[x].name); \
|
||||
FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
|
||||
#define CHECK_ENTITY(x) \
|
||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||
return 0; \
|
||||
} else { \
|
||||
if (INDEXENT_NEW(x)->free) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity (%d)", x); \
|
||||
return 0; \
|
||||
} else if (INDEXENT_NEW(x)->pvPrivateData == NULL) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity has null private data (%d)", x); \
|
||||
return 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
inline edict_t *PrivateToEdict(const void *pdata)
|
||||
{
|
||||
|
||||
if (!pdata)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *ptr=(char*)pdata + Offsets.GetPev();
|
||||
entvars_t *pev=(entvars_t *)ptr;
|
||||
|
||||
if (!pev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return pev->pContainingEntity;
|
||||
};
|
||||
|
||||
inline int PrivateToIndex(const void *pdata)
|
||||
{
|
||||
|
||||
if (pdata==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
char *ptr=(char*)pdata;
|
||||
|
||||
ptr+=Offsets.GetPev();
|
||||
|
||||
entvars_t *pev=*(entvars_t **)ptr;
|
||||
|
||||
|
||||
if (pev==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pev->pContainingEntity==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(pev->pContainingEntity);
|
||||
};
|
||||
inline void *IndexToPrivate(int index)
|
||||
{
|
||||
return INDEXENT_NEW(index)->pvPrivateData;
|
||||
};
|
||||
inline entvars_t *IndexToEntvar(int index)
|
||||
{
|
||||
return &(INDEXENT_NEW(index)->v);
|
||||
};
|
||||
|
||||
inline int EntvarToIndex(entvars_t *pev)
|
||||
{
|
||||
if (pev==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pev->pContainingEntity==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(pev->pContainingEntity);
|
||||
};
|
||||
|
||||
inline int EdictToIndex(edict_t *v)
|
||||
{
|
||||
|
||||
if (!pdata)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *ptr=(char*)pdata + Offsets.GetPev();
|
||||
entvars_t *pev=(entvars_t *)ptr;
|
||||
|
||||
if (!pev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return pev->pContainingEntity;
|
||||
};
|
||||
|
||||
inline int PrivateToIndex(const void *pdata)
|
||||
{
|
||||
|
||||
if (pdata==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
char *ptr=(char*)pdata;
|
||||
|
||||
ptr+=Offsets.GetPev();
|
||||
|
||||
entvars_t *pev=*(entvars_t **)ptr;
|
||||
|
||||
|
||||
if (pev==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pev->pContainingEntity==NULL)
|
||||
if (v==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(pev->pContainingEntity);
|
||||
};
|
||||
inline void *IndexToPrivate(int index)
|
||||
{
|
||||
return INDEXENT_NEW(index)->pvPrivateData;
|
||||
};
|
||||
inline entvars_t *IndexToEntvar(int index)
|
||||
{
|
||||
return &(INDEXENT_NEW(index)->v);
|
||||
};
|
||||
|
||||
inline int EntvarToIndex(entvars_t *pev)
|
||||
{
|
||||
if (pev==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pev->pContainingEntity==NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(pev->pContainingEntity);
|
||||
};
|
||||
|
||||
inline edict_t *EntvarToEdict(entvars_t *pev)
|
||||
{
|
||||
if (pev==NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pev->pContainingEntity;
|
||||
};
|
||||
inline void **EdictToVTable(edict_t *ent)
|
||||
{
|
||||
char *btbl=(char *)ent->pvPrivateData;
|
||||
btbl+=Offsets.GetBase();
|
||||
return *((void ***)btbl);
|
||||
};
|
||||
|
||||
inline void **GetVTable(void *pthis, int size)
|
||||
{
|
||||
return *((void***)(((char*)pthis)+size));
|
||||
}
|
||||
inline void *GetVTableEntry(void *pthis, int ventry, int size)
|
||||
{
|
||||
void **vtbl=GetVTable(pthis, size);
|
||||
|
||||
return vtbl[ventry];
|
||||
return ENTINDEX_NEW(v);
|
||||
}
|
||||
|
||||
void print_srvconsole(char *fmt, ...);
|
||||
#endif
|
||||
inline edict_t *IndexToEdict(int index)
|
||||
{
|
||||
return INDEXENT_NEW(index);
|
||||
};
|
||||
|
||||
inline edict_t *EntvarToEdict(entvars_t *pev)
|
||||
{
|
||||
if (pev==NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pev->pContainingEntity;
|
||||
};
|
||||
inline void **EdictToVTable(edict_t *ent)
|
||||
{
|
||||
char *btbl=(char *)ent->pvPrivateData;
|
||||
btbl+=Offsets.GetBase();
|
||||
return *((void ***)btbl);
|
||||
};
|
||||
|
||||
inline void **GetVTable(void *pthis, int size)
|
||||
{
|
||||
return *((void***)(((char*)pthis)+size));
|
||||
}
|
||||
inline void *GetVTableEntry(void *pthis, int ventry, int size)
|
||||
{
|
||||
void **vtbl=GetVTable(pthis, size);
|
||||
|
||||
return vtbl[ventry];
|
||||
}
|
||||
|
||||
void print_srvconsole(const char *fmt, ...);
|
||||
#endif
|
||||
|
@ -1,124 +1,124 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef HOOK_H
|
||||
#define HOOK_H
|
||||
|
||||
#include "forward.h"
|
||||
#include "Trampolines.h"
|
||||
|
||||
// This is just a simple container for data so I only have to add 1 extra
|
||||
// parameter to calls that get trampolined
|
||||
|
||||
#ifndef HOOK_H
|
||||
#define HOOK_H
|
||||
|
||||
#include "forward.h"
|
||||
#include "Trampolines.h"
|
||||
|
||||
#define ALIGN(ar) ((intptr_t)ar & ~(sysconf(_SC_PAGESIZE)-1))
|
||||
|
||||
class Hook
|
||||
{
|
||||
public:
|
||||
CVector<Forward *> pre; // pre forwards
|
||||
CVector<Forward *> post; // post forwards
|
||||
void *func; // original function
|
||||
void **vtable; // vtable of the original location
|
||||
int entry; // vtable entry of the function
|
||||
void *target; // target function being called (the hook)
|
||||
int exec; // 1 when this hook is in execution
|
||||
int del; // 1 if this hook should be destroyed after exec
|
||||
void *tramp; // trampoline for this hook
|
||||
char *ent; // ent name that's being hooked
|
||||
|
||||
Hook(void **vtable_, int entry_, void *target_, bool voidcall, int paramcount, char *name) :
|
||||
func(NULL), vtable(vtable_), entry(entry_), target(target_), exec(0), del(0), tramp(NULL)
|
||||
{
|
||||
// original function is vtable[entry]
|
||||
// to not make the compiler whine, cast vtable to int **
|
||||
int **ivtable=(int **)vtable;
|
||||
func=(void *)ivtable[entry];
|
||||
|
||||
// now install a trampoline
|
||||
// (int thiscall, int voidcall, int paramcount, void *extraptr)
|
||||
tramp=CreateGenericTrampoline(true, voidcall, paramcount, (void*)this, target);
|
||||
|
||||
// Insert into vtable
|
||||
#if defined(_WIN32)
|
||||
DWORD OldFlags;
|
||||
VirtualProtect(&ivtable[entry],sizeof(int*),PAGE_READWRITE,&OldFlags);
|
||||
// This is just a simple container for data so I only have to add 1 extra
|
||||
// parameter to calls that get trampolined
|
||||
|
||||
class Hook
|
||||
{
|
||||
public:
|
||||
CVector<Forward *> pre; // pre forwards
|
||||
CVector<Forward *> post; // post forwards
|
||||
void *func; // original function
|
||||
void **vtable; // vtable of the original location
|
||||
int entry; // vtable entry of the function
|
||||
void *target; // target function being called (the hook)
|
||||
int exec; // 1 when this hook is in execution
|
||||
int del; // 1 if this hook should be destroyed after exec
|
||||
void *tramp; // trampoline for this hook
|
||||
char *ent; // ent name that's being hooked
|
||||
|
||||
Hook(void **vtable_, int entry_, void *target_, bool voidcall, bool retbuf, int paramcount, char *name) :
|
||||
func(NULL), vtable(vtable_), entry(entry_), target(target_), exec(0), del(0), tramp(NULL)
|
||||
{
|
||||
// original function is vtable[entry]
|
||||
// to not make the compiler whine, cast vtable to int **
|
||||
int **ivtable=(int **)vtable;
|
||||
func=(void *)ivtable[entry];
|
||||
|
||||
// now install a trampoline
|
||||
// (int thiscall, int voidcall, int paramcount, void *extraptr)
|
||||
tramp = CreateGenericTrampoline(true, voidcall, retbuf, paramcount, (void*)this, target);
|
||||
|
||||
// Insert into vtable
|
||||
#if defined(_WIN32)
|
||||
DWORD OldFlags;
|
||||
VirtualProtect(&ivtable[entry],sizeof(int*),PAGE_READWRITE,&OldFlags);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void *addr = (void *)ALIGN(&ivtable[entry]);
|
||||
mprotect(addr,sysconf(_SC_PAGESIZE),PROT_READ|PROT_WRITE);
|
||||
#endif
|
||||
ivtable[entry]=(int*)tramp;
|
||||
|
||||
size_t len=strlen(name);
|
||||
ent=new char[len+1];
|
||||
|
||||
snprintf(ent,len+1,"%s",name);
|
||||
};
|
||||
|
||||
~Hook()
|
||||
{
|
||||
// Insert the original function back into the vtable
|
||||
int **ivtable=(int **)vtable;
|
||||
|
||||
#if defined(_WIN32)
|
||||
DWORD OldFlags;
|
||||
VirtualProtect(&ivtable[entry],sizeof(int*),PAGE_READWRITE,&OldFlags);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void *addr = (void *)ALIGN(&ivtable[entry]);
|
||||
mprotect(addr,sysconf(_SC_PAGESIZE),PROT_READ|PROT_WRITE);
|
||||
#endif
|
||||
ivtable[entry]=(int*)tramp;
|
||||
|
||||
size_t len=strlen(name);
|
||||
ent=new char[len+1];
|
||||
|
||||
snprintf(ent,len+1,"%s",name);
|
||||
};
|
||||
|
||||
~Hook()
|
||||
{
|
||||
// Insert the original function back into the vtable
|
||||
int **ivtable=(int **)vtable;
|
||||
|
||||
#if defined(_WIN32)
|
||||
DWORD OldFlags;
|
||||
VirtualProtect(&ivtable[entry],sizeof(int*),PAGE_READWRITE,&OldFlags);
|
||||
#elif defined(__linux_) || defined(__APPLE__)
|
||||
void *addr = (void *)ALIGN(&ivtable[entry]);
|
||||
mprotect(addr,sysconf(_SC_PAGESIZE),PROT_READ|PROT_WRITE);
|
||||
#endif
|
||||
|
||||
ivtable[entry]=(int *)func;
|
||||
#if defined(_WIN32)
|
||||
VirtualFree(tramp, 0, MEM_RELEASE);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
free(tramp);
|
||||
#endif
|
||||
|
||||
delete[] ent;
|
||||
|
||||
CVector<Forward *>::iterator end=pre.end();
|
||||
|
||||
for (CVector<Forward *>::iterator i=pre.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
end=post.end();
|
||||
for (CVector<Forward *>::iterator i=post.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
pre.clear();
|
||||
post.clear();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
void *addr = (void *)ALIGN(&ivtable[entry]);
|
||||
mprotect(addr,sysconf(_SC_PAGESIZE),PROT_READ|PROT_WRITE);
|
||||
#endif
|
||||
|
||||
ivtable[entry]=(int *)func;
|
||||
#if defined(_WIN32)
|
||||
VirtualFree(tramp, 0, MEM_RELEASE);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
free(tramp);
|
||||
#endif
|
||||
|
||||
delete[] ent;
|
||||
|
||||
CVector<Forward *>::iterator end=pre.end();
|
||||
|
||||
for (CVector<Forward *>::iterator i=pre.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
end=post.end();
|
||||
for (CVector<Forward *>::iterator i=post.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
pre.clear();
|
||||
post.clear();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,187 +1,513 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
*/
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef HOOK_CALLBACKS_H
|
||||
#define HOOK_CALLBACKS_H
|
||||
|
||||
// RT_<TYPE> is true if the function returns void, false otherwise
|
||||
// (it also would be true for large return functions such as Vector)
|
||||
// RB_<TYPE> is true if the function returns an object and requires a pointer to a buffer as its first parameter in order to store its value
|
||||
// PC_<TYPE> is how many dwords get passed to the function (minus the "this" pointer)
|
||||
// (it is one larger for large return functions such as Vector)
|
||||
|
||||
const bool RT_Void_Void = true;
|
||||
const bool RB_Void_Void = false;
|
||||
const int PC_Void_Void = 0;
|
||||
void Hook_Void_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Int_Void = false;
|
||||
const bool RB_Int_Void = false;
|
||||
const int PC_Int_Void = 0;
|
||||
int Hook_Int_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Void_Entvar = true;
|
||||
const bool RB_Void_Entvar = false;
|
||||
const int PC_Void_Entvar = 1;
|
||||
void Hook_Void_Entvar(Hook *hook, void *pthis, entvars_t *entvar);
|
||||
|
||||
const bool RT_Void_Cbase = true;
|
||||
const bool RB_Void_Cbase = false;
|
||||
const int PC_Void_Cbase = 1;
|
||||
void Hook_Void_Cbase(Hook *hook, void *pthis, void *other);
|
||||
|
||||
const bool RT_Int_Float_Int = false;
|
||||
const bool RB_Int_Float_Int = false;
|
||||
const int PC_Int_Float_Int = 2;
|
||||
int Hook_Int_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
||||
|
||||
const bool RT_Int_Float_Int_Int = false;
|
||||
const bool RB_Int_Float_Int_Int = false;
|
||||
const int PC_Int_Float_Int_Int = 3;
|
||||
int Hook_Int_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2);
|
||||
|
||||
#ifndef HOOK_CALLBACKS_H
|
||||
#define HOOK_CALLBACKS_H
|
||||
const bool RT_Void_Entvar_Int = true;
|
||||
const bool RB_Void_Entvar_Int = false;
|
||||
const int PC_Void_Entvar_Int = 2;
|
||||
void Hook_Void_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, int i1);
|
||||
|
||||
const bool RT_Void_Entvar_Entvar_Int = true;
|
||||
const bool RB_Void_Entvar_Entvar_Int = false;
|
||||
const int PC_Void_Entvar_Entvar_Int = 3;
|
||||
void Hook_Void_Entvar_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, entvars_t *ev2, int i1);
|
||||
|
||||
// RT_<TYPE> is true if the function returns void, false otherwise
|
||||
// (it also would be true for large return functions such as Vector)
|
||||
// PC_<TYPE> is how many dwords get passed to the function (minus the "this" pointer)
|
||||
// (it is one larger for large return functions such as Vector)
|
||||
|
||||
const bool RT_Void_Void = true;
|
||||
const int PC_Void_Void = 0;
|
||||
void Hook_Void_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Int_Void = false;
|
||||
const int PC_Int_Void = 0;
|
||||
int Hook_Int_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Void_Entvar = true;
|
||||
const int PC_Void_Entvar = 1;
|
||||
void Hook_Void_Entvar(Hook *hook, void *pthis, entvars_t *entvar);
|
||||
|
||||
const bool RT_Void_Cbase = true;
|
||||
const int PC_Void_Cbase = 1;
|
||||
void Hook_Void_Cbase(Hook *hook, void *pthis, void *other);
|
||||
|
||||
const bool RT_Int_Float_Int = false;
|
||||
const int PC_Int_Float_Int = 2;
|
||||
int Hook_Int_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
||||
|
||||
const bool RT_Void_Entvar_Int = true;
|
||||
const int PC_Void_Entvar_Int = 2;
|
||||
void Hook_Void_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, int i1);
|
||||
|
||||
const bool RT_Int_Cbase = false;
|
||||
const int PC_Int_Cbase = 1;
|
||||
int Hook_Int_Cbase(Hook *hook, void *pthis, void *cb1);
|
||||
|
||||
const bool RT_Void_Int_Int = true;
|
||||
const int PC_Void_Int_Int = 2;
|
||||
void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2);
|
||||
|
||||
const bool RT_Int_Int_Str_Int = false;
|
||||
const int PC_Int_Int_Str_Int = 3;
|
||||
int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1,
|
||||
int i2);
|
||||
|
||||
const bool RT_Int_Int = false;
|
||||
const int PC_Int_Int = 1;
|
||||
int Hook_Int_Int(Hook *hook, void *pthis, int i1);
|
||||
|
||||
const bool RT_Int_Entvar = false;
|
||||
const int PC_Int_Entvar = 1;
|
||||
int Hook_Int_Entvar(Hook *hook, void *pthis, entvars_t *ev1);
|
||||
|
||||
const bool RT_Int_Entvar_Entvar_Float_Int = false;
|
||||
const int PC_Int_Entvar_Entvar_Float_Int = 4;
|
||||
int Hook_Int_Entvar_Entvar_Float_Int(Hook *hook, void *pthis,
|
||||
entvars_t *inflictor,
|
||||
entvars_t *attacker, float damage,
|
||||
int damagebits);
|
||||
|
||||
const bool RT_Int_Entvar_Entvar_Float_Float_Int = false;
|
||||
const int PC_Int_Entvar_Entvar_Float_Float_Int = 5;
|
||||
int Hook_Int_Entvar_Entvar_Float_Float_Int(Hook *hook, void *pthis,
|
||||
entvars_t *inflictor,
|
||||
entvars_t *attacker, float damage,
|
||||
float unknown, int damagebits);
|
||||
|
||||
const bool RT_Void_Int = true;
|
||||
const int PC_Void_Int = 1;
|
||||
void Hook_Void_Int(Hook *hook, void *pthis, int i1);
|
||||
|
||||
const bool RT_Void_Cbase_Cbase_Int_Float = true;
|
||||
const int PC_Void_Cbase_Cbase_Int_Float = 4;
|
||||
void Hook_Void_Cbase_Cbase_Int_Float(Hook *hook, void *pthis, void *cb1,
|
||||
void *cb2, int i1, float f1);
|
||||
|
||||
const bool RT_Void_Entvar_Float_Vector_Trace_Int = true;
|
||||
const int PC_Void_Entvar_Float_Vector_Trace_Int = 7;
|
||||
void Hook_Void_Entvar_Float_Vector_Trace_Int(Hook *hook, void *pthis,
|
||||
entvars_t *ev1, float f1,
|
||||
Vector v1, TraceResult *tr1,
|
||||
int i1);
|
||||
|
||||
const bool RT_Void_Float_Vector_Trace_Int = true;
|
||||
const int PC_Void_Float_Vector_Trace_Int = 6;
|
||||
void Hook_Void_Float_Vector_Trace_Int(Hook *hook, void *pthis, float f1,
|
||||
Vector v1, TraceResult *tr1,
|
||||
int i1);
|
||||
|
||||
const bool RT_Str_Void = false;
|
||||
const int PC_Str_Void = 0;
|
||||
const char *Hook_Str_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Cbase_Void = false;
|
||||
const int PC_Cbase_Void = 0;
|
||||
void *Hook_Cbase_Void(Hook *hook, void *pthis);
|
||||
|
||||
// HACK: I'm too lazy to fix up trampoline generator to deal with
|
||||
// special return values. this is so much easier.
|
||||
const bool RT_Vector_Void = true;
|
||||
const int PC_Vector_Void = 1;
|
||||
#ifdef _WIN32
|
||||
void Hook_Vector_Void(Hook *hook, void *pthis, Vector *out);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis);
|
||||
const bool RT_Int_Cbase = false;
|
||||
const bool RB_Int_Cbase = false;
|
||||
const int PC_Int_Cbase = 1;
|
||||
int Hook_Int_Cbase(Hook *hook, void *pthis, void *cb1);
|
||||
|
||||
const bool RT_Void_Int_Int = true;
|
||||
const bool RB_Void_Int_Int = false;
|
||||
const int PC_Void_Int_Int = 2;
|
||||
void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2);
|
||||
|
||||
const bool RT_Int_Int_Str_Int = false;
|
||||
const bool RB_Int_Int_Str_Int = false;
|
||||
const int PC_Int_Int_Str_Int = 3;
|
||||
int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1,
|
||||
int i2);
|
||||
|
||||
const bool RT_Int_Int_Str_Int_Int = false;
|
||||
const bool RB_Int_Int_Str_Int_Int = false;
|
||||
const int PC_Int_Int_Str_Int_Int = 4;
|
||||
int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i2, int i3);
|
||||
|
||||
const bool RT_Int_Int = false;
|
||||
const bool RB_Int_Int = false;
|
||||
const int PC_Int_Int = 1;
|
||||
int Hook_Int_Int(Hook *hook, void *pthis, int i1);
|
||||
|
||||
const bool RT_Int_Entvar = false;
|
||||
const bool RB_Int_Entvar = false;
|
||||
const int PC_Int_Entvar = 1;
|
||||
int Hook_Int_Entvar(Hook *hook, void *pthis, entvars_t *ev1);
|
||||
|
||||
const bool RT_Int_Entvar_Entvar_Float_Int = false;
|
||||
const bool RB_Int_Entvar_Entvar_Float_Int = false;
|
||||
const int PC_Int_Entvar_Entvar_Float_Int = 4;
|
||||
int Hook_Int_Entvar_Entvar_Float_Int(Hook *hook, void *pthis,
|
||||
entvars_t *inflictor,
|
||||
entvars_t *attacker, float damage,
|
||||
int damagebits);
|
||||
|
||||
const bool RT_Int_Entvar_Entvar_Float_Float_Int = false;
|
||||
const bool RB_Int_Entvar_Entvar_Float_Float_Int = false;
|
||||
const int PC_Int_Entvar_Entvar_Float_Float_Int = 5;
|
||||
int Hook_Int_Entvar_Entvar_Float_Float_Int(Hook *hook, void *pthis,
|
||||
entvars_t *inflictor,
|
||||
entvars_t *attacker, float damage,
|
||||
float unknown, int damagebits);
|
||||
|
||||
const bool RT_Void_Int = true;
|
||||
const bool RB_Void_Int = false;
|
||||
const int PC_Void_Int = 1;
|
||||
void Hook_Void_Int(Hook *hook, void *pthis, int i1);
|
||||
|
||||
const bool RT_Void_Cbase_Cbase_Int_Float = true;
|
||||
const bool RB_Void_Cbase_Cbase_Int_Float = false;
|
||||
const int PC_Void_Cbase_Cbase_Int_Float = 4;
|
||||
void Hook_Void_Cbase_Cbase_Int_Float(Hook *hook, void *pthis, void *cb1,
|
||||
void *cb2, int i1, float f1);
|
||||
|
||||
const bool RT_Vector_Float_Cbase_Int = true;
|
||||
const bool RB_Vector_Float_Cbase_Int = true;
|
||||
const int PC_Vector_Float_Cbase_Int = 4;
|
||||
#if defined(_WIN32)
|
||||
void Hook_Vector_Float_Cbase_Int(Hook *hook, void *pthis, Vector *out, float f1, void *cb, int i1);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void Hook_Vector_Float_Cbase_Int(Hook *hook, Vector *out, void *pthis, float f1, void *cb, int i1);
|
||||
#endif
|
||||
|
||||
const bool RT_Vector_pVector = true;
|
||||
const int PC_Vector_pVector = 2;
|
||||
#ifdef _WIN32
|
||||
void Hook_Vector_pVector(Hook *hook, void *pthis, Vector *out, Vector *v1);
|
||||
const bool RT_Void_Entvar_Float_Vector_Trace_Int = true;
|
||||
const bool RB_Void_Entvar_Float_Vector_Trace_Int = false;
|
||||
const int PC_Void_Entvar_Float_Vector_Trace_Int = 7;
|
||||
void Hook_Void_Entvar_Float_Vector_Trace_Int(Hook *hook, void *pthis,
|
||||
entvars_t *ev1, float f1,
|
||||
Vector v1, TraceResult *tr1,
|
||||
int i1);
|
||||
|
||||
const bool RT_Void_Float_Vector_Trace_Int = true;
|
||||
const bool RB_Void_Float_Vector_Trace_Int = false;
|
||||
const int PC_Void_Float_Vector_Trace_Int = 6;
|
||||
void Hook_Void_Float_Vector_Trace_Int(Hook *hook, void *pthis, float f1,
|
||||
Vector v1, TraceResult *tr1,
|
||||
int i1);
|
||||
|
||||
const bool RT_Str_Void = false;
|
||||
const bool RB_Str_Void = false;
|
||||
const int PC_Str_Void = 0;
|
||||
const char *Hook_Str_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Cbase_Void = false;
|
||||
const bool RB_Cbase_Void = false;
|
||||
const int PC_Cbase_Void = 0;
|
||||
void *Hook_Cbase_Void(Hook *hook, void *pthis);
|
||||
|
||||
// HACK: I'm too lazy to fix up trampoline generator to deal with
|
||||
// special return values. this is so much easier.
|
||||
const bool RT_Vector_Void = true;
|
||||
const bool RB_Vector_Void = true;
|
||||
const int PC_Vector_Void = 1;
|
||||
#if defined(_WIN32)
|
||||
void Hook_Vector_Void(Hook *hook, void *pthis, Vector *out);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis);
|
||||
#endif
|
||||
|
||||
const bool RT_Vector_pVector = true;
|
||||
const bool RB_Vector_pVector = true;
|
||||
const int PC_Vector_pVector = 2;
|
||||
#if defined(_WIN32)
|
||||
void Hook_Vector_pVector(Hook *hook, void *pthis, Vector *out, Vector *v1);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1);
|
||||
#endif
|
||||
|
||||
const bool RT_Int_pVector = false;
|
||||
const bool RB_Int_pVector = false;
|
||||
const int PC_Int_pVector = 1;
|
||||
int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1);
|
||||
|
||||
const bool RT_Void_Entvar_Float_Float = true;
|
||||
const bool RB_Void_Entvar_Float_Float = false;
|
||||
const int PC_Void_Entvar_Float_Float = 3;
|
||||
void Hook_Void_Entvar_Float_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1, float f2);
|
||||
|
||||
const bool RT_Void_pFloat_pFloat = true;
|
||||
const bool RB_Void_pFloat_pFloat = false;
|
||||
const int PC_Void_pFloat_pFloat = 2;
|
||||
void Hook_Void_pFloat_pFloat(Hook *hook, void *pthis, float *f1, float *f2);
|
||||
|
||||
const bool RT_Void_Entvar_Float = true;
|
||||
const bool RB_Void_Entvar_Float = false;
|
||||
const int PC_Void_Entvar_Float = 2;
|
||||
void Hook_Void_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
|
||||
|
||||
|
||||
const bool RT_Void_Int_Int_Int = true;
|
||||
const bool RB_Void_Int_Int_Int = false;
|
||||
const int PC_Void_Int_Int_Int = 3;
|
||||
void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3);
|
||||
|
||||
const bool RT_Void_ItemInfo = true;
|
||||
const bool RB_Void_ItemInfo = false;
|
||||
const int PC_Void_ItemInfo = 1;
|
||||
void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
|
||||
|
||||
|
||||
const bool RT_Float_Void = false;
|
||||
const bool RB_Float_Void = false;
|
||||
const int PC_Float_Void = 0;
|
||||
float Hook_Float_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Float_Int = false;
|
||||
const bool RB_Float_Int = false;
|
||||
const int PC_Float_Int = 1;
|
||||
float Hook_Float_Int(Hook *hook, void *pthis, int i1);
|
||||
|
||||
const bool RT_Void_Float_Int = true;
|
||||
const bool RB_Void_Float_Int = false;
|
||||
const int PC_Void_Float_Int = 2;
|
||||
void Hook_Void_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
||||
|
||||
const bool RT_Float_Float_Cbase = true;
|
||||
const bool RB_Float_Float_Cbase = false;
|
||||
const int PC_Float_Float_Cbase = 2;
|
||||
float Hook_Float_Float_Cbase(Hook *hook, void *pthis, float f1, void *cb1);
|
||||
|
||||
const bool RT_Void_Float = true;
|
||||
const bool RB_Void_Float = false;
|
||||
const int PC_Void_Float = 1;
|
||||
void Hook_Void_Float(Hook *hook, void *pthis, float f1);
|
||||
|
||||
const bool RT_Void_Float_Float_Float_Int = true;
|
||||
const bool RB_Void_Float_Float_Float_Int = false;
|
||||
const int PC_Void_Float_Float_Float_Int = 4;
|
||||
void Hook_Void_Float_Float_Float_Int(Hook *hook, void *pthis, float f1, float f2, float f3, int i1);
|
||||
|
||||
const bool RT_Vector_Float = true;
|
||||
const bool RB_Vector_Float = true;
|
||||
const int PC_Vector_Float = 2;
|
||||
#if defined(_WIN32)
|
||||
void Hook_Vector_Float(Hook *hook, void *pthis, Vector *out, float f1);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1);
|
||||
void Hook_Vector_Float(Hook *hook, Vector *out, void *pthis, float f1);
|
||||
#endif
|
||||
|
||||
const bool RT_Int_pVector = false;
|
||||
const int PC_Int_pVector = 1;
|
||||
int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1);
|
||||
const bool RT_Void_Float_Cbase = true;
|
||||
const bool RB_Void_Float_Cbase = false;
|
||||
const int PC_Void_Float_Cbase = 2;
|
||||
void Hook_Void_Float_Cbase(Hook *hook, void *pthis, float f1, void *cb);
|
||||
|
||||
const bool RT_Void_Entvar_Float_Float = true;
|
||||
const int PC_Void_Entvar_Float_Float = 3;
|
||||
void Hook_Void_Entvar_Float_Float(Hook *hook, void *pthis, entvars_t *ev1,
|
||||
float f1, float f2);
|
||||
const bool RT_Int_Float_Float = false;
|
||||
const bool RB_Int_Float_Float = false;
|
||||
const int PC_Int_Float_Float = 2;
|
||||
int Hook_Int_Float_Float(Hook *hook, void *pthis, float f1, float f2);
|
||||
|
||||
const bool RT_Int_pFloat_pFloat = false;
|
||||
const int PC_Int_pFloat_pFloat = 2;
|
||||
int Hook_Int_pFloat_pFloat(Hook *hook, void *pthis, float *f1,
|
||||
float *f2);
|
||||
const bool RT_Int_Float = false;
|
||||
const bool RB_Int_Float = false;
|
||||
const int PC_Int_Float = 1;
|
||||
int Hook_Int_Float(Hook *hook, void *pthis, float f1);
|
||||
|
||||
const bool RT_Void_Entvar_Float = true;
|
||||
const int PC_Void_Entvar_Float = 2;
|
||||
void Hook_Void_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
|
||||
const bool RT_Int_Int_Int = false;
|
||||
const bool RB_Int_Int_Int = false;
|
||||
const int PC_Int_Int_Int = 2;
|
||||
int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2);
|
||||
|
||||
const bool RT_Void_Str_Float_Float_Float = true;
|
||||
const bool RB_Void_Str_Float_Float_Float = false;
|
||||
const int PC_Void_Str_Float_Float_Float = 4;
|
||||
void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3);
|
||||
|
||||
const bool RT_Void_Str_Float_Float_Float_Int_Cbase = true;
|
||||
const bool RB_Void_Str_Float_Float_Float_Int_Cbase = false;
|
||||
const int PC_Void_Str_Float_Float_Float_Int_Cbase = 6;
|
||||
void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3, int i1, void *cb);
|
||||
|
||||
const bool RT_Int_Vector_Vector_Float_Float= false;
|
||||
const bool RB_Int_Vector_Vector_Float_Float = false;
|
||||
const int PC_Int_Vector_Vector_Float_Float = 8;
|
||||
int Hook_Int_Vector_Vector_Float_Float(Hook *hook, void *pthis, Vector v1, Vector v2, float f1, float f2);
|
||||
|
||||
const bool RT_Int_Short = false;
|
||||
const bool RB_Int_Short = false;
|
||||
const int PC_Int_Short = 1;
|
||||
int Hook_Int_Short(Hook *hook, void *pthis, short s1);
|
||||
|
||||
const bool RT_Void_Entvar_Entvar_Float_Int_Int = true;
|
||||
const bool RB_Void_Entvar_Entvar_Float_Int_Int = false;
|
||||
const int PC_Void_Entvar_Entvar_Float_Int_Int = 5;
|
||||
void Hook_Void_Entvar_Entvar_Float_Int_Int(Hook *hook, void *pthis,
|
||||
entvars_t *inflictor,
|
||||
entvars_t *attacker, float damage,
|
||||
int classignore, int damagebits);
|
||||
|
||||
const bool RT_Void_Vector_Entvar_Entvar_Float_Int_Int = true;
|
||||
const bool RB_Void_Vector_Entvar_Entvar_Float_Int_Int = false;
|
||||
const int PC_Void_Vector_Entvar_Entvar_Float_Int_Int = 8;
|
||||
void Hook_Void_Vector_Entvar_Entvar_Float_Int_Int(Hook *hook, void *pthis,
|
||||
Vector source,
|
||||
entvars_t *inflictor,
|
||||
entvars_t *attacker, float damage,
|
||||
int classignore, int damagebits);
|
||||
|
||||
|
||||
const bool RT_Void_Int_Int_Int = true;
|
||||
const int PC_Void_Int_Int_Int = 3;
|
||||
void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3);
|
||||
const bool RT_Float_Int_Float = false;
|
||||
const bool RB_Float_Int_Float = false;
|
||||
const int PC_Float_Int_Float = 2;
|
||||
float Hook_Float_Int_Float(Hook *hook, void *pthis, int i1, float f2);
|
||||
|
||||
const bool RT_Void_ItemInfo = true;
|
||||
const int PC_Void_ItemInfo = 1;
|
||||
void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
|
||||
const bool RT_Int_Str = false;
|
||||
const bool RB_Int_Str = false;
|
||||
const int PC_Int_Str = 1;
|
||||
int Hook_Int_Str(Hook *hook, void *pthis, const char *sz1);
|
||||
|
||||
const bool RT_Void_Edict = true;
|
||||
const bool RB_Void_Edict = false;
|
||||
const int PC_Void_Edict = 1;
|
||||
void Hook_Void_Edict(Hook *hook, void *pthis, edict_t *ed1 );
|
||||
|
||||
const bool RT_Void_Int_Str_Bool = true;
|
||||
const bool RB_Void_Int_Str_Bool = false;
|
||||
const int PC_Void_Int_Str_Bool = 3;
|
||||
void Hook_Void_Int_Str_Bool(Hook *hook, void *pthis, int i1, const char *sz2, bool b3);
|
||||
|
||||
const bool RT_Void_Vector_Vector= true;
|
||||
const bool RB_Void_Vector_Vector = false;
|
||||
const int PC_Void_Vector_Vector = 6;
|
||||
void Hook_Void_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2);
|
||||
|
||||
const bool RT_Void_Str_Bool = true;
|
||||
const bool RB_Void_Str_Bool = false;
|
||||
const int PC_Void_Str_Bool = 2;
|
||||
void Hook_Void_Str_Bool(Hook *hook, void *pthis, const char *sz1, bool b2);
|
||||
|
||||
const bool RT_Float_Void = false;
|
||||
const int PC_Float_Void = 0;
|
||||
float Hook_Float_Void(Hook *hook, void *pthis);
|
||||
const bool RT_Int_Str_Str_Int_Str_Int_Int = false;
|
||||
const bool RB_Int_Str_Str_Int_Str_Int_Int = false;
|
||||
const int PC_Int_Str_Str_Int_Str_Int_Int = 6;
|
||||
int Hook_Int_Str_Str_Int_Str_Int_Int(Hook *hook, void *pthis, const char *sz1, const char *sz2, int i1, const char *sz3, int i2, int i3);
|
||||
|
||||
const bool RT_Int_Int_Int_Float_Int = false;
|
||||
const bool RB_Int_Int_Int_Float_Int = false;
|
||||
const int PC_Int_Int_Int_Float_Int = 4;
|
||||
int Hook_Int_Int_Int_Float_Int(Hook *hook, void *pthis, int i1, int i2, float f1, int i3);
|
||||
|
||||
const bool RT_Void_Str_Int = true;
|
||||
const bool RB_Void_Str_Int = false;
|
||||
const int PC_Void_Str_Int = 2;
|
||||
void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2);
|
||||
|
||||
const bool RT_Void_Cbase_Int = true;
|
||||
const bool RB_Void_Cbase_Int = false;
|
||||
const int PC_Void_Cbase_Int = 2;
|
||||
void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1);
|
||||
|
||||
const bool RT_Void_Str = true;
|
||||
const bool RB_Void_Str = false;
|
||||
const int PC_Void_Str = 1;
|
||||
void Hook_Void_Str(Hook *hook, void *pthis, const char *sz1);
|
||||
|
||||
const bool RT_Void_Vector = true;
|
||||
const bool RB_Void_Vector = false;
|
||||
const int PC_Void_Vector = 3;
|
||||
void Hook_Void_Vector(Hook *hook, void *pthis, Vector v1);
|
||||
|
||||
const bool RT_Int_Str_Vector_Str = false;
|
||||
const bool RB_Int_Str_Vector_Str = false;
|
||||
const int PC_Int_Str_Vector_Str = 5;
|
||||
int Hook_Int_Str_Vector_Str(Hook *hook, void *pthis, const char *sz1, Vector v2, const char *sz2);
|
||||
|
||||
const bool RT_Int_Str_Str = false;
|
||||
const bool RB_Int_Str_Str = false;
|
||||
const int PC_Int_Str_Str = 2;
|
||||
int Hook_Int_Str_Str(Hook *hook, void *pthis, const char *sz1, const char *sz2);
|
||||
|
||||
const bool RT_Void_Float_Float = true;
|
||||
const bool RB_Void_Float_Float = false;
|
||||
const int PC_Void_Float_Float = 2;
|
||||
void Hook_Void_Float_Float(Hook *hook, void *pthis, float f1, float f2);
|
||||
|
||||
const bool RT_Void_Str_Str_Int = true;
|
||||
const bool RB_Void_Str_Str_Int = false;
|
||||
const int PC_Void_Str_Str_Int = 3;
|
||||
void Hook_Void_Str_Str_Int(Hook *hook, void *pthis, const char *sz1, const char *sz2, int i3);
|
||||
|
||||
const bool RT_Int_pVector_pVector_Cbase_pFloat = false;
|
||||
const bool RB_Int_pVector_pVector_Cbase_pFloat = false;
|
||||
const int PC_Int_pVector_pVector_Cbase_pFloat = 4;
|
||||
int Hook_Int_pVector_pVector_Cbase_pFloat(Hook *hook, void *pthis, Vector *v1, Vector *v2, void* cb, float* fl);
|
||||
|
||||
const bool RT_Void_Cbase_pVector_Float = true;
|
||||
const bool RB_Void_Cbase_pVector_Float = false;
|
||||
const int PC_Void_Cbase_pVector_Float = 3;
|
||||
void Hook_Void_Cbase_pVector_Float(Hook *hook, void *pthis, void *p1, Vector *v1, float fl);
|
||||
|
||||
const bool RT_Int_pVector_pVector_Float_Cbase_pVector = false;
|
||||
const bool RB_Int_pVector_pVector_Float_Cbase_pVector = false;
|
||||
const int PC_Int_pVector_pVector_Float_Cbase_pVector = 5;
|
||||
int Hook_Int_pVector_pVector_Float_Cbase_pVector(Hook *hook, void *pthis, Vector *v1, Vector *v2, float fl, void* cb, Vector *v3);
|
||||
|
||||
const bool RT_Int_Cbase_Bool = false;
|
||||
const bool RB_Int_Cbase_Bool = false;
|
||||
const int PC_Int_Cbase_Bool = 2;
|
||||
int Hook_Int_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1);
|
||||
|
||||
const bool RT_Int_Vector_Vector = false;
|
||||
const bool RB_Int_Vector_Vector = false;
|
||||
const int PC_Int_Vector_Vector = 6;
|
||||
int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2);
|
||||
|
||||
const bool RT_Int_Entvar_Float = false;
|
||||
const bool RB_Int_Entvar_Float = false;
|
||||
const int PC_Int_Entvar_Float = 2;
|
||||
int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
|
||||
|
||||
const bool RT_Float_Float = false;
|
||||
const bool RB_Float_Float = false;
|
||||
const int PC_Float_Float = 1;
|
||||
float Hook_Float_Float(Hook *hook, void *pthis, float f1);
|
||||
|
||||
const bool RT_Void_Entvar_Entvar_Float = true;
|
||||
const bool RB_Void_Entvar_Entvar_Float = false;
|
||||
const int PC_Void_Entvar_Entvar_Float = 3;
|
||||
void Hook_Void_Entvar_Entvar_Float(Hook *hook, void *pthis, entvars_t *attacker, entvars_t *inflictor, float damage);
|
||||
|
||||
const bool RT_Bool_Void = false;
|
||||
const bool RB_Bool_Void = false;
|
||||
const int PC_Bool_Void = 0;
|
||||
bool Hook_Bool_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = false;
|
||||
const bool RB_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = false;
|
||||
const int PC_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = 7;
|
||||
int Hook_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(Hook *hook, void *pthis, Vector *v1, Vector *v2, float fl, void* cb, Vector *v3, Vector *v4, bool b1);
|
||||
|
||||
const bool RT_Int_Vector_Cbase = false;
|
||||
const bool RB_Int_Vector_Cbase = false;
|
||||
const int PC_Int_Vector_Cbase = 4;
|
||||
int Hook_Int_Vector_Cbase(Hook *hook, void *pthis, Vector v1, void *cb);
|
||||
|
||||
const bool RT_Int_Vector= false;
|
||||
const bool RB_Int_Vector = false;
|
||||
const int PC_Int_Vector = 3;
|
||||
int Hook_Int_Vector(Hook *hook, void *pthis, Vector v1);
|
||||
|
||||
const bool RT_Int_Cbase_pVector = false;
|
||||
const bool RB_Int_Cbase_pVector = false;
|
||||
const int PC_Int_Cbase_pVector = 2;
|
||||
int Hook_Int_Cbase_pVector(Hook *hook, void *pthis, void *cb1, Vector *v1);
|
||||
|
||||
const bool RT_Void_Bool = true;
|
||||
const bool RB_Void_Bool = false;
|
||||
const int PC_Void_Bool = 1;
|
||||
void Hook_Void_Bool(Hook *hook, void *pthis, bool b1);
|
||||
|
||||
const bool RT_Bool_Cbase = false;
|
||||
const bool RB_Bool_Cbase = false;
|
||||
const int PC_Bool_Cbase = 1;
|
||||
bool Hook_Bool_Cbase(Hook *hook, void *pthis, void *cb);
|
||||
|
||||
const bool RT_Bool_Int = false;
|
||||
const bool RB_Bool_Int = false;
|
||||
const int PC_Bool_Int = 1;
|
||||
bool Hook_Bool_Int(Hook *hook, void *pthis, int i1);
|
||||
|
||||
const bool RT_Void_Cbase_Float = true;
|
||||
const bool RB_Void_Cbase_Float = false;
|
||||
const int PC_Void_Cbase_Float = 2;
|
||||
void Hook_Void_Cbase_Float(Hook *hook, void *pthis, void *p1, float f1);
|
||||
|
||||
const bool RT_Void_Cbase_Bool = true;
|
||||
const bool RB_Void_Cbase_Bool = false;
|
||||
const int PC_Void_Cbase_Bool = 2;
|
||||
void Hook_Void_Cbase_Bool(Hook *hook, void *pthis, void *p1, bool b1);
|
||||
|
||||
const bool RT_Vector_Vector_Vector_Vector = true;
|
||||
const bool RB_Vector_Vector_Vector_Vector = true;
|
||||
const int PC_Vector_Vector_Vector_Vector = 10;
|
||||
#if defined(_WIN32)
|
||||
void Hook_Vector_Vector_Vector_Vector(Hook *hook, void *pthis, Vector *out, Vector v1, Vector v2, Vector v3);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
void Hook_Vector_Vector_Vector_Vector(Hook *hook, Vector *out, void *pthis, Vector v1, Vector v2, Vector v3);
|
||||
#endif
|
||||
|
||||
const bool RT_Str_Str = false;
|
||||
const bool RB_Str_Str = false;
|
||||
const int PC_Str_Str = 1;
|
||||
const char *Hook_Str_Str(Hook *hook, void *pthis, const char* str);
|
||||
|
||||
const bool RT_Void_Short = true;
|
||||
const bool RB_Void_Short = false;
|
||||
const int PC_Void_Short = 1;
|
||||
void Hook_Void_Short(Hook *hook, void *pthis, short i1);
|
||||
|
||||
const bool RT_Void_Float_Int = true;
|
||||
const int PC_Void_Float_Int = 2;
|
||||
void Hook_Void_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
||||
|
||||
const bool RT_Deprecated = true;
|
||||
const bool RB_Deprecated = false;
|
||||
const int PC_Deprecated = 0;
|
||||
void Hook_Deprecated(Hook* hook);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,177 +1,461 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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"
|
||||
|
||||
int Create_Void_Void(AMX *amx, const char *func)
|
||||
#include "amxxmodule.h"
|
||||
|
||||
int Create_Void_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Cbase(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Float_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Float_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Void(AMX *amx, const char *func)
|
||||
int Create_Void_Entvar_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar_Entvar_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Cbase(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Int_Str_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Int_Str_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Entvar(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Vector_Float_Cbase_Int(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar(AMX *amx, const char *func)
|
||||
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Float_Vector_Trace_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Str_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Cbase_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Vector_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Vector_pVector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_pVector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar_Float_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_pFloat_pFloat(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Int_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_ItemInfo(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Float_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Float_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Float_Int(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Cbase(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Float_Int(AMX *amx, const char *func)
|
||||
int Create_Float_Float_Cbase(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
|
||||
int Create_Void_Entvar_Int(AMX *amx, const char *func)
|
||||
int Create_Void_Float(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Float_Float_Float_Int(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Vector_Float(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Float_Cbase(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Float_Float(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Float(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Int_Int(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Str_Float_Float_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Cbase(AMX *amx, const char *func)
|
||||
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Short(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Int_Int(AMX *amx, const char *func)
|
||||
int Create_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Int_Str_Int(AMX *amx, const char *func)
|
||||
int Create_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Float_Int_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Str(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Edict(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Int_Str_Bool(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Int(AMX *amx, const char *func)
|
||||
int Create_Void_Vector_Vector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Entvar(AMX *amx, const char *func)
|
||||
int Create_Void_Str_Bool(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Int(AMX *amx, const char *func)
|
||||
int Create_Int_Str_Str_Int_Str_Int_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Int_Int_Float_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, const char *func)
|
||||
int Create_Void_Str_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Float_Vector_Trace_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Str_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Cbase_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Vector_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Vector_pVector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_pVector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar_Float_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_pFloat_pFloat(AMX *amx, const char *func)
|
||||
int Create_Void_Cbase_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Entvar_Float(AMX *amx, const char *func)
|
||||
int Create_Void_Str(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Vector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Str_Vector_Str(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_ARRAY, FP_STRING, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Str_Str(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Float_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Str_Str_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Cbase_pVector_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_ARRAY, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Cbase_Bool(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Vector_Vector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Entvar_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
int Create_Void_Int_Int_Int(AMX *amx, const char *func)
|
||||
|
||||
int Create_Float_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
int Create_Void_ItemInfo(AMX *amx, const char *func)
|
||||
|
||||
int Create_Void_Entvar_Entvar_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
int Create_Float_Void(AMX *amx, const char *func)
|
||||
|
||||
int Create_Bool_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
int Create_Void_Float_Int(AMX* amx, const char* func)
|
||||
|
||||
int Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_DONE);
|
||||
}
|
||||
int Create_Deprecated(AMX* amx, const char* func)
|
||||
|
||||
int Create_Int_Vector_Cbase(AMX *amx, const char *func)
|
||||
{
|
||||
return -1;
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Vector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Int_Cbase_pVector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Bool(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Bool_Cbase(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Bool_Int(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Cbase_Float(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Cbase_Bool(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Vector_Vector_Vector_Vector(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Str_Str(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
||||
}
|
||||
|
||||
int Create_Void_Short(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Create_Deprecated(AMX* amx, const char* func)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,94 +1,206 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef HOOK_CREATE_H
|
||||
#define HOOK_CREATE_H
|
||||
#ifndef HOOK_CREATE_H
|
||||
#define HOOK_CREATE_H
|
||||
|
||||
|
||||
int Create_Void_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Cbase(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Float_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Void(AMX *amx, const char *func);
|
||||
int Create_Void_Entvar_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Entvar_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Void(AMX *amx, const char *func);
|
||||
int Create_Int_Cbase(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Int_Str_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Int_Str_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Entvar(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Vector_Float_Cbase_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar(AMX *amx, const char *func);
|
||||
int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Float_Vector_Trace_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Str_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Cbase_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Vector_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Vector_pVector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_pVector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Float_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_pFloat_pFloat(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Int_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_ItemInfo(AMX *amx, const char *func);
|
||||
|
||||
int Create_Float_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Cbase(AMX *amx, const char *func);
|
||||
int Create_Void_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Float_Float_Cbase(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Int(AMX *amx, const char *func);
|
||||
int Create_Void_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Cbase(AMX *amx, const char *func);
|
||||
int Create_Void_Float_Float_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Int_Int(AMX *amx, const char *func);
|
||||
int Create_Vector_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Int_Str_Int(AMX *amx, const char *func);
|
||||
int Create_Void_Float_Cbase(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Int(AMX *amx, const char *func);
|
||||
int Create_Int_Float_Float(AMX* amx, const char* func);
|
||||
|
||||
int Create_Int_Entvar(AMX *amx, const char *func);
|
||||
int Create_Int_Float(AMX* amx, const char* func);
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Int(AMX *amx, const char *func);
|
||||
int Create_Int_Int_Int(AMX* amx, const char* func);
|
||||
|
||||
int Create_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, const char *func);
|
||||
int Create_Void_Str_Float_Float_Float(AMX* amx, const char* func);
|
||||
|
||||
int Create_Void_Int(AMX *amx, const char *func);
|
||||
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func);
|
||||
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func);
|
||||
int Create_Int_Short(AMX* amx, const char* func);
|
||||
|
||||
int Create_Void_Float_Vector_Trace_Int(AMX *amx, const char *func);
|
||||
int Create_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Str_Void(AMX *amx, const char *func);
|
||||
int Create_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Cbase_Void(AMX *amx, const char *func);
|
||||
int Create_Float_Int_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Vector_Void(AMX *amx, const char *func);
|
||||
int Create_Int_Str(AMX *amx, const char *func);
|
||||
|
||||
int Create_Vector_pVector(AMX *amx, const char *func);
|
||||
int Create_Void_Edict(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_pVector(AMX *amx, const char *func);
|
||||
int Create_Void_Int_Str_Bool(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Float_Float(AMX *amx, const char *func);
|
||||
int Create_Void_Vector_Vector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_pFloat_pFloat(AMX *amx, const char *func);
|
||||
int Create_Void_Str_Bool(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Float(AMX *amx, const char *func);
|
||||
int Create_Int_Str_Str_Int_Str_Int_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Int_Int_Int(AMX *amx, const char *func);
|
||||
int Create_Int_Int_Int_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_ItemInfo(AMX *amx, const char *func);
|
||||
int Create_Void_Str_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Float_Void(AMX *amx, const char *func);
|
||||
int Create_Void_Cbase_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Float_Int(AMX *amx, const char *func);
|
||||
int Create_Void_Str(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Vector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Deprecated(AMX* amx, const char* func);
|
||||
int Create_Int_Str_Vector_Str(AMX *amx, const char *func);
|
||||
|
||||
#endif
|
||||
int Create_Int_Str_Str(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Float_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Str_Str_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Cbase_pVector_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Cbase_Bool(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Vector_Vector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Entvar_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Float_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Entvar_Entvar_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Bool_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Vector_Cbase(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Vector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Int_Cbase_pVector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Bool(AMX *amx, const char *func);
|
||||
|
||||
int Create_Bool_Cbase(AMX *amx, const char *func);
|
||||
|
||||
int Create_Bool_Int(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Cbase_Float(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Cbase_Bool(AMX *amx, const char *func);
|
||||
|
||||
int Create_Vector_Vector_Vector_Vector(AMX *amx, const char *func);
|
||||
|
||||
int Create_Str_Str(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Short(AMX *amx, const char *func);
|
||||
|
||||
|
||||
int Create_Deprecated(AMX* amx, const char* func);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,46 +1,47 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef HOOKLIST_T_H
|
||||
#define HOOKLIST_T_H
|
||||
|
||||
typedef struct hook_s
|
||||
{
|
||||
int isset; // whether or not this hook is registered with hamdata
|
||||
int vtid; // vtable index of this function
|
||||
const char *name; // name used in the keys
|
||||
bool isvoid; // whether or not the target trampoline uses voids
|
||||
int paramcount; // how many parameters are in the func
|
||||
void *targetfunc; // the target hook
|
||||
int (*makefunc)(AMX *, const char*); // function that creates forwards
|
||||
cell (*call)(AMX *, cell*); // function to call the vcall
|
||||
} hook_t;
|
||||
|
||||
extern hook_t hooklist[];
|
||||
|
||||
#endif
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef HOOKLIST_T_H
|
||||
#define HOOKLIST_T_H
|
||||
|
||||
typedef struct hook_s
|
||||
{
|
||||
int isset; // whether or not this hook is registered with hamdata
|
||||
int vtid; // vtable index of this function
|
||||
const char *name; // name used in the keys
|
||||
bool isvoid; // whether or not the target trampoline uses voids
|
||||
bool needsretbuf; // whether or not a pointer to a memory buffer is needed to store a return value
|
||||
int paramcount; // how many parameters are in the func
|
||||
void *targetfunc; // the target hook
|
||||
int (*makefunc)(AMX *, const char*); // function that creates forwards
|
||||
cell (*call)(AMX *, cell*); // function to call the vcall
|
||||
} hook_t;
|
||||
|
||||
extern hook_t hooklist[];
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,379 +0,0 @@
|
||||
/**
|
||||
* Ham Sandwich module include file.
|
||||
* (c) 2007, The AMX Mod X Development Team
|
||||
*
|
||||
* -
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ham Sandwich is a module that is used to hook and call virtual functions of
|
||||
* entities.
|
||||
* Virtual functions are mod-specific functions. This means that in order
|
||||
* for this to work on a mod, it needs to be configured with the hamdata.ini
|
||||
* file.
|
||||
* Be very careful with parameter passing to these functions.
|
||||
*/
|
||||
|
||||
#if defined _hamsandwich_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _hamsandwich_included
|
||||
|
||||
#include <ham_const>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib hamsandwich
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib hamsandwich
|
||||
#endif
|
||||
#else
|
||||
#pragma library hamsandwich
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityClass The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity's class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
* Note: This will cause hooks for the entire internal class that the entity is
|
||||
* not exclusively for the provided entity.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityId The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
|
||||
|
||||
|
||||
/**
|
||||
* Stops a ham forward from triggering.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to stop.
|
||||
*/
|
||||
native DisableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Starts a ham forward back up.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to re-enable.
|
||||
*/
|
||||
native EnableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity.
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHam(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity, this will trigger all hooks on that function.
|
||||
* Be very careful about recursion!
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHamB(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Gets the return status of the current hook.
|
||||
* This is useful to determine what return natives to use.
|
||||
*
|
||||
* @return The current status of the hook (such as HAM_SUPERCEDE).
|
||||
*/
|
||||
native GetHamReturnStatus();
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return float.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. Will be -1 on null.
|
||||
*/
|
||||
native GetHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The string size of the buffer.
|
||||
*/
|
||||
native GetHamReturnString(output[], size);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return floats.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. -1 on null.
|
||||
*/
|
||||
native GetOrigHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The size of the buffer.
|
||||
*/
|
||||
native GetOrigHamReturnString(output[], size);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an integer or boolean.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnInteger(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a float.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnFloat(Float:value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a Vector.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnVector(const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an entity. Set to -1 for null.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnEntity(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a string.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnString(const value[]);
|
||||
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are integers.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamInteger(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are floats.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamFloat(which, Float:value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are Vectors.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamVector(which, const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are entities.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamEntity(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are strings.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamString(which, const output[]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are trace result handles.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamTraceResult(which, tr_handle);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the function for the specified Ham is valid.
|
||||
* Things that would make it invalid would be bounds (an older module version
|
||||
* may not have all of the functions), and the function not being found in
|
||||
* the mod's hamdata.ini file.
|
||||
*
|
||||
* @param function The function to look up.
|
||||
* @return true if the function is valid, false otherwise.
|
||||
*/
|
||||
native bool:IsHamValid(Ham:function);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* Note this dereferences memory! Improper use of this will crash the server.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @return The index of the corresponding pdata field. -1 for none set.
|
||||
*/
|
||||
native get_pdata_cbase(id, offset, linuxdiff=5);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* This will set the corresponding cbase field in private data with the index.
|
||||
* Pass -1 to null the entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param value The index to store, -1 for invalid
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
*/
|
||||
native set_pdata_cbase(id, offset, value, linuxdiff=5);
|
||||
|
||||
/**
|
||||
* This is similar to the get_pdata_cbase, however it does not dereference memory.
|
||||
* This is many times slower than get_pdata_cbase, and this should only be used
|
||||
* for testing and finding of offsets, not actual release quality plugins.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry. -2 on an invalid entry.
|
||||
*
|
||||
* @param id Entry to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @return The index of the corresponding pdata field, -1 for null, -2 for invalid.
|
||||
*/
|
||||
native get_pdata_cbase_safe(id, offset, linuxdiff=5);
|
||||
|
||||
|
||||
|
||||
|
||||
// This is the callback from the module, this handles any fatal errors.
|
||||
// This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists.
|
||||
// Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing.
|
||||
// Any other return value will fail the plugin.
|
||||
// You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin.
|
||||
// Do not modify this!
|
||||
public __fatal_ham_error(Ham:id, HamError:err, const reason[])
|
||||
{
|
||||
|
||||
new func=get_func_id("HamFilter", -1);
|
||||
new bool:fail=true;
|
||||
|
||||
if (func != -1 && callfunc_begin_i(func, -1)==1)
|
||||
{
|
||||
callfunc_push_int(_:id);
|
||||
callfunc_push_int(_:err);
|
||||
callfunc_push_str(reason, false);
|
||||
if (callfunc_end()==PLUGIN_HANDLED)
|
||||
{
|
||||
fail=false;
|
||||
}
|
||||
}
|
||||
if (fail)
|
||||
{
|
||||
set_fail_state(reason);
|
||||
}
|
||||
|
||||
}
|
@ -1,84 +1,84 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifndef OFFSETS_H
|
||||
#define OFFSETS_H
|
||||
|
||||
#include "ham_const.h"
|
||||
|
||||
// Just a singleton class that keeps pev/base/offset values managed.
|
||||
|
||||
class OffsetManager
|
||||
{
|
||||
private:
|
||||
size_t pev;
|
||||
size_t baseclass;
|
||||
int baseset;
|
||||
int pevset;
|
||||
|
||||
public:
|
||||
OffsetManager()
|
||||
{
|
||||
memset(this,0x0,sizeof(*this));
|
||||
}
|
||||
void SetPev(size_t value)
|
||||
{
|
||||
pevset=1;
|
||||
pev=value;
|
||||
};
|
||||
size_t GetPev(void)
|
||||
{
|
||||
return pev;
|
||||
};
|
||||
int IsPevSet()
|
||||
{
|
||||
return pevset;
|
||||
};
|
||||
int IsBaseSet()
|
||||
{
|
||||
return baseset;
|
||||
};
|
||||
void SetBase(size_t value)
|
||||
{
|
||||
baseset=1;
|
||||
baseclass=value;
|
||||
};
|
||||
size_t GetBase(void)
|
||||
{
|
||||
return baseclass;
|
||||
};
|
||||
bool IsValid()
|
||||
{
|
||||
return pevset != 0 && baseset != 0;
|
||||
}
|
||||
};
|
||||
|
||||
extern OffsetManager Offsets;
|
||||
|
||||
#endif
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifndef OFFSETS_H
|
||||
#define OFFSETS_H
|
||||
|
||||
#include "ham_const.h"
|
||||
|
||||
// Just a singleton class that keeps pev/base/offset values managed.
|
||||
|
||||
class OffsetManager
|
||||
{
|
||||
private:
|
||||
size_t pev;
|
||||
size_t baseclass;
|
||||
int baseset;
|
||||
int pevset;
|
||||
|
||||
public:
|
||||
OffsetManager()
|
||||
{
|
||||
memset(this,0x0,sizeof(*this));
|
||||
}
|
||||
void SetPev(size_t value)
|
||||
{
|
||||
pevset=1;
|
||||
pev=value;
|
||||
};
|
||||
size_t GetPev(void)
|
||||
{
|
||||
return pev;
|
||||
};
|
||||
int IsPevSet()
|
||||
{
|
||||
return pevset;
|
||||
};
|
||||
int IsBaseSet()
|
||||
{
|
||||
return baseset;
|
||||
};
|
||||
void SetBase(size_t value)
|
||||
{
|
||||
baseset=1;
|
||||
baseclass=value;
|
||||
};
|
||||
size_t GetBase(void)
|
||||
{
|
||||
return baseclass;
|
||||
};
|
||||
bool IsValid()
|
||||
{
|
||||
return pevset != 0 && baseset != 0;
|
||||
}
|
||||
};
|
||||
|
||||
extern OffsetManager Offsets;
|
||||
|
||||
#endif
|
||||
|
@ -1,182 +1,182 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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 "offsets.h"
|
||||
#include "NEW_Util.h"
|
||||
#include "ham_utils.h"
|
||||
|
||||
inline edict_t* INDEXENT2( int iEdictNum )
|
||||
{
|
||||
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
|
||||
return MF_GetPlayerEdict(iEdictNum);
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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 "offsets.h"
|
||||
#include "NEW_Util.h"
|
||||
#include "ham_utils.h"
|
||||
|
||||
inline edict_t* INDEXENT2( int iEdictNum )
|
||||
{
|
||||
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
|
||||
return MF_GetPlayerEdict(iEdictNum);
|
||||
else
|
||||
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||
}
|
||||
|
||||
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
||||
#define FM_CHECK_ENTITY(x) \
|
||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||
return 0; \
|
||||
} else { \
|
||||
if (x <= gpGlobals->maxClients) { \
|
||||
if (!MF_IsPlayerIngame(x)) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||
return 0; \
|
||||
} \
|
||||
} else { \
|
||||
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||
return 0; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define FM_CHECK_ENTITY(x) \
|
||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||
return 0; \
|
||||
} else if (x != 0 && FNullEnt(INDEXENT2(x))) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
// Return -1 on null, -2 on invalid, and the the index of any other.
|
||||
static cell AMX_NATIVE_CALL get_pdata_cbase_safe(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
FM_CHECK_ENTITY(index);
|
||||
int iOffset=params[2];
|
||||
#ifdef __linux__
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
else
|
||||
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||
}
|
||||
|
||||
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
||||
#define FM_CHECK_ENTITY(x) \
|
||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||
return 0; \
|
||||
} else { \
|
||||
if (x <= gpGlobals->maxClients) { \
|
||||
if (!MF_IsPlayerIngame(x)) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||
return 0; \
|
||||
} \
|
||||
} else { \
|
||||
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||
return 0; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define FM_CHECK_ENTITY(x) \
|
||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||
return 0; \
|
||||
} else if (x != 0 && FNullEnt(INDEXENT2(x))) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
// Return -1 on null, -2 on invalid, and the the index of any other.
|
||||
static cell AMX_NATIVE_CALL get_pdata_cbase_safe(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
FM_CHECK_ENTITY(index);
|
||||
int iOffset=params[2];
|
||||
#ifdef __linux__
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
else
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
if (iOffset <0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
|
||||
return 0;
|
||||
}
|
||||
void *ptr=*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset));
|
||||
|
||||
if (ptr == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i=0; i<gpGlobals->maxEntities; ++i)
|
||||
{
|
||||
if (ptr == INDEXENT_NEW(i)->pvPrivateData)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
static cell AMX_NATIVE_CALL get_pdata_cbase(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
FM_CHECK_ENTITY(index);
|
||||
int iOffset=params[2];
|
||||
#ifdef __linux__
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
else
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
if (iOffset <0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
|
||||
return 0;
|
||||
}
|
||||
void *ptr=*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset));
|
||||
|
||||
return PrivateToIndex(ptr);
|
||||
}
|
||||
static cell AMX_NATIVE_CALL set_pdata_cbase(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
FM_CHECK_ENTITY(index);
|
||||
int target=params[3];
|
||||
|
||||
if (target != -1)
|
||||
{
|
||||
FM_CHECK_ENTITY(target);
|
||||
}
|
||||
int iOffset=params[2];
|
||||
#ifdef __linux__
|
||||
iOffset += params[4];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 4)
|
||||
iOffset += params[4];
|
||||
else
|
||||
iOffset += params[5];
|
||||
#endif
|
||||
if (iOffset <0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (target == -1)
|
||||
{
|
||||
*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset)) = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset)) = INDEXENT_NEW(target)->pvPrivateData;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO pdata_natives_safe[] =
|
||||
{
|
||||
{ "get_pdata_cbase_safe", get_pdata_cbase_safe },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
AMX_NATIVE_INFO pdata_natives[] =
|
||||
{
|
||||
{ "get_pdata_cbase", get_pdata_cbase },
|
||||
{ "set_pdata_cbase", set_pdata_cbase },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
if (iOffset <0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
|
||||
return 0;
|
||||
}
|
||||
void *ptr=*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset));
|
||||
|
||||
if (ptr == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i=0; i<gpGlobals->maxEntities; ++i)
|
||||
{
|
||||
if (ptr == INDEXENT_NEW(i)->pvPrivateData)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
static cell AMX_NATIVE_CALL get_pdata_cbase(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
FM_CHECK_ENTITY(index);
|
||||
int iOffset=params[2];
|
||||
#ifdef __linux__
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
else
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
if (iOffset <0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
|
||||
return 0;
|
||||
}
|
||||
void *ptr=*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset));
|
||||
|
||||
return PrivateToIndex(ptr);
|
||||
}
|
||||
static cell AMX_NATIVE_CALL set_pdata_cbase(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
FM_CHECK_ENTITY(index);
|
||||
int target=params[3];
|
||||
|
||||
if (target != -1)
|
||||
{
|
||||
FM_CHECK_ENTITY(target);
|
||||
}
|
||||
int iOffset=params[2];
|
||||
#ifdef __linux__
|
||||
iOffset += params[4];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 4)
|
||||
iOffset += params[4];
|
||||
else
|
||||
iOffset += params[5];
|
||||
#endif
|
||||
if (iOffset <0)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset provided. (got: %d)", iOffset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (target == -1)
|
||||
{
|
||||
*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset)) = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((void **)((int *)INDEXENT_NEW(index)->pvPrivateData + iOffset)) = INDEXENT_NEW(target)->pvPrivateData;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO pdata_natives_safe[] =
|
||||
{
|
||||
{ "get_pdata_cbase_safe", get_pdata_cbase_safe },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
AMX_NATIVE_INFO pdata_natives[] =
|
||||
{
|
||||
{ "get_pdata_cbase", get_pdata_cbase },
|
||||
{ "set_pdata_cbase", set_pdata_cbase },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
@ -56,7 +56,7 @@
|
||||
#define FN_AMXX_ATTACH OnAmxxAttach
|
||||
|
||||
/** AMXX Detach (unload) */
|
||||
//#define FN_AMXX_DETACH OnAmxxDetach
|
||||
#define FN_AMXX_DETACH OnAmxxDetach
|
||||
|
||||
/** All plugins loaded
|
||||
* Do forward functions init here (MF_RegisterForward)
|
||||
|
@ -1,140 +1,139 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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 <stdarg.h>
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
#include "hooklist.h"
|
||||
#include "offsets.h"
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
|
||||
|
||||
extern hook_t hooklist[];
|
||||
extern CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
|
||||
void print_srvconsole(const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[384];
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(string, sizeof(string) - 1, fmt, argptr);
|
||||
string[sizeof(string) - 1] = '\0';
|
||||
va_end(argptr);
|
||||
|
||||
SERVER_PRINT(string);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HamCommand(void)
|
||||
{
|
||||
const char *cmd=CMD_ARGV(1);
|
||||
|
||||
if (strcmp(cmd, "list")==0)
|
||||
{
|
||||
unsigned int Total=0;
|
||||
print_srvconsole("%-24s | %10s\n","Name","Set","Value");
|
||||
print_srvconsole("------------------------------------\n");
|
||||
print_srvconsole("%-24s | %10d\n", "pev", Offsets.GetPev());
|
||||
print_srvconsole("%-24s | %10d\n", "base", Offsets.GetBase());
|
||||
|
||||
if (Offsets.IsPevSet())
|
||||
{
|
||||
Total++;
|
||||
}
|
||||
if (Offsets.IsBaseSet())
|
||||
{
|
||||
Total++;
|
||||
}
|
||||
|
||||
int count=2;
|
||||
for (int i=0; i<HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
|
||||
|
||||
if (hooklist[i].isset != 0)
|
||||
{
|
||||
print_srvconsole("%-24s | %10d\n", hooklist[i].name, hooklist[i].vtid);
|
||||
Total++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= 5)
|
||||
{
|
||||
count = 0;
|
||||
print_srvconsole("------------------------------------\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
print_srvconsole("\n%u keys, %u set.\n\n", HAM_LAST_ENTRY_DONT_USE_ME_LOL, Total);
|
||||
return;
|
||||
}
|
||||
else if (strcmp(cmd, "hooks")==0)
|
||||
{
|
||||
print_srvconsole("%-24s | %-27s | %10s | %10s\n", "Key", "Classname", "Pre", "Post");
|
||||
print_srvconsole("--------------------------------------------------------------------------------\n");
|
||||
unsigned int ForwardCount=0;
|
||||
unsigned int HookCount=0;
|
||||
int count = 0;
|
||||
for (int i=0; i<HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
CVector<Hook *>::iterator end=hooks[i].end();
|
||||
|
||||
for (CVector<Hook *>::iterator j=hooks[i].begin();
|
||||
j!=end;
|
||||
++j)
|
||||
{
|
||||
HookCount++;
|
||||
ForwardCount+=(*j)->pre.size() + (*j)->post.size();
|
||||
|
||||
print_srvconsole("%-24s | %-27s | %10d | %10d\n",hooklist[i].name, (*j)->ent, (*j)->pre.size(), (*j)->post.size());
|
||||
if (count >= 5)
|
||||
{
|
||||
print_srvconsole("--------------------------------------------------------------------------------\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
print_srvconsole("\n%u hooks, %u forwards.\n\n", HookCount, ForwardCount);
|
||||
return;
|
||||
}
|
||||
|
||||
// Unknown command
|
||||
print_srvconsole("Usage: ham < command > [ argument ]\n");
|
||||
print_srvconsole("Commands:\n");
|
||||
print_srvconsole(" %-22s - %s\n", "list", "list all keys and their values from the config file.");
|
||||
print_srvconsole(" %-22s - %s\n", "hooks", "list all active hooks");
|
||||
}
|
||||
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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 <stdarg.h>
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
#include "hooklist.h"
|
||||
#include "offsets.h"
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
|
||||
|
||||
extern hook_t hooklist[];
|
||||
extern CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
|
||||
void print_srvconsole(const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[384];
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(string, sizeof(string) - 1, fmt, argptr);
|
||||
string[sizeof(string) - 1] = '\0';
|
||||
va_end(argptr);
|
||||
|
||||
SERVER_PRINT(string);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HamCommand(void)
|
||||
{
|
||||
const char *cmd=CMD_ARGV(1);
|
||||
|
||||
if (strcmp(cmd, "list")==0)
|
||||
{
|
||||
unsigned int Total=0;
|
||||
print_srvconsole("%-24s | %10s\n","Name","Set","Value");
|
||||
print_srvconsole("------------------------------------\n");
|
||||
print_srvconsole("%-24s | %10d\n", "pev", Offsets.GetPev());
|
||||
print_srvconsole("%-24s | %10d\n", "base", Offsets.GetBase());
|
||||
|
||||
if (Offsets.IsPevSet())
|
||||
{
|
||||
Total++;
|
||||
}
|
||||
if (Offsets.IsBaseSet())
|
||||
{
|
||||
Total++;
|
||||
}
|
||||
|
||||
int count=2;
|
||||
for (int i=0; i<HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
|
||||
|
||||
if (hooklist[i].isset != 0)
|
||||
{
|
||||
print_srvconsole("%-24s | %10d\n", hooklist[i].name, hooklist[i].vtid);
|
||||
Total++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= 5)
|
||||
{
|
||||
count = 0;
|
||||
print_srvconsole("------------------------------------\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
print_srvconsole("\n%u keys, %u set.\n\n", HAM_LAST_ENTRY_DONT_USE_ME_LOL, Total);
|
||||
return;
|
||||
}
|
||||
else if (strcmp(cmd, "hooks")==0)
|
||||
{
|
||||
print_srvconsole("%-24s | %-27s | %10s | %10s\n", "Key", "Classname", "Pre", "Post");
|
||||
print_srvconsole("--------------------------------------------------------------------------------\n");
|
||||
unsigned int ForwardCount=0;
|
||||
unsigned int HookCount=0;
|
||||
int count = 0;
|
||||
for (int i=0; i<HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
CVector<Hook *>::iterator end=hooks[i].end();
|
||||
|
||||
for (CVector<Hook *>::iterator j=hooks[i].begin();
|
||||
j!=end;
|
||||
++j)
|
||||
{
|
||||
HookCount++;
|
||||
ForwardCount+=(*j)->pre.size() + (*j)->post.size();
|
||||
|
||||
print_srvconsole("%-24s | %-27s | %10d | %10d\n",hooklist[i].name, (*j)->ent, (*j)->pre.size(), (*j)->post.size());
|
||||
if (count >= 5)
|
||||
{
|
||||
print_srvconsole("--------------------------------------------------------------------------------\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
print_srvconsole("\n%u hooks, %u forwards.\n\n", HookCount, ForwardCount);
|
||||
return;
|
||||
}
|
||||
|
||||
// Unknown command
|
||||
print_srvconsole("Usage: ham < command > [ argument ]\n");
|
||||
print_srvconsole("Commands:\n");
|
||||
print_srvconsole(" %-22s - %s\n", "list", "list all keys and their values from the config file.");
|
||||
print_srvconsole(" %-22s - %s\n", "hooks", "list all active hooks");
|
||||
}
|
||||
|
@ -1,89 +1,89 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
#ifndef TYPETOCELL_H
|
||||
#define TYPETOCELL_H
|
||||
|
||||
#include <extdll.h>
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include "hook.h"
|
||||
#include "forward.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
#include "ham_utils.h"
|
||||
|
||||
|
||||
|
||||
inline cell TypeToCell(const float& value)
|
||||
{
|
||||
return amx_ftoc2(value);
|
||||
}
|
||||
inline cell TypeToCell(const float*& value)
|
||||
{
|
||||
return amx_ftoc2(*value);
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const Vector*& value)
|
||||
{
|
||||
return reinterpret_cast<cell>(value);
|
||||
}
|
||||
inline cell TypeToCell(const int& value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const edict_t*& value)
|
||||
{
|
||||
if (value == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(value);
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const entvars_t*& value)
|
||||
{
|
||||
if (value == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(value->pContainingEntity);
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const HLBaseEntity*& value)
|
||||
{
|
||||
return PrivateToIndex(reinterpret_cast<const void *>(value));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef TYPETOCELL_H
|
||||
#define TYPETOCELL_H
|
||||
|
||||
#include <extdll.h>
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include "hook.h"
|
||||
#include "forward.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
#include "ham_utils.h"
|
||||
|
||||
|
||||
|
||||
inline cell TypeToCell(const float& value)
|
||||
{
|
||||
return amx_ftoc2(value);
|
||||
}
|
||||
inline cell TypeToCell(const float*& value)
|
||||
{
|
||||
return amx_ftoc2(*value);
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const Vector*& value)
|
||||
{
|
||||
return reinterpret_cast<cell>(value);
|
||||
}
|
||||
inline cell TypeToCell(const int& value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const edict_t*& value)
|
||||
{
|
||||
if (value == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(value);
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const entvars_t*& value)
|
||||
{
|
||||
if (value == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ENTINDEX_NEW(value->pContainingEntity);
|
||||
}
|
||||
|
||||
inline cell TypeToCell(const HLBaseEntity*& value)
|
||||
{
|
||||
return PrivateToIndex(reinterpret_cast<const void *>(value));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,382 +1,429 @@
|
||||
/* Ham Sandwich
|
||||
* Copyright 2007-2014
|
||||
* By the AMX Mod X Development Team
|
||||
*
|
||||
* Ham Sandwich 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.
|
||||
*
|
||||
* Ham Sandwich 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 Ham Sandwich; 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 Ham Sandwich 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ham Sandwich is a module that is used to hook and call virtual functions of
|
||||
* entities.
|
||||
* Virtual functions are mod-specific functions. This means that in order
|
||||
* for this to work on a mod, it needs to be configured with the hamdata.ini
|
||||
* file.
|
||||
* Be very careful with parameter passing to these functions.
|
||||
*/
|
||||
|
||||
#if defined _hamsandwich_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _hamsandwich_included
|
||||
|
||||
#include <ham_const>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib hamsandwich
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib hamsandwich
|
||||
#endif
|
||||
#else
|
||||
#pragma library hamsandwich
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityClass The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity's class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
* Note: This will cause hooks for the entire internal class that the entity is
|
||||
* not exclusively for the provided entity.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityId The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
|
||||
|
||||
|
||||
/**
|
||||
* Stops a ham forward from triggering.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to stop.
|
||||
*/
|
||||
native DisableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Starts a ham forward back up.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to re-enable.
|
||||
*/
|
||||
native EnableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity.
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHam(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity, this will trigger all hooks on that function.
|
||||
* Be very careful about recursion!
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHamB(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Gets the return status of the current hook.
|
||||
* This is useful to determine what return natives to use.
|
||||
*
|
||||
* @return The current status of the hook (such as HAM_SUPERCEDE).
|
||||
*/
|
||||
native GetHamReturnStatus();
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return float.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. Will be -1 on null.
|
||||
*/
|
||||
native GetHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The string size of the buffer.
|
||||
*/
|
||||
native GetHamReturnString(output[], size);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return floats.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. -1 on null.
|
||||
*/
|
||||
native GetOrigHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The size of the buffer.
|
||||
*/
|
||||
native GetOrigHamReturnString(output[], size);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an integer or boolean.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnInteger(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a float.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnFloat(Float:value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a Vector.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnVector(const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an entity. Set to -1 for null.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnEntity(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a string.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnString(const value[]);
|
||||
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are integers.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamInteger(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are floats.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamFloat(which, Float:value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are Vectors.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamVector(which, const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are entities.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamEntity(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are strings.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param ouput The value to change it to.
|
||||
*/
|
||||
native SetHamParamString(which, const output[]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are trace result handles.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param tr_handle The value to change it to.
|
||||
*/
|
||||
native SetHamParamTraceResult(which, tr_handle);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are trace result handles.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param iteminfo_handle The value to change it to.
|
||||
*/
|
||||
native SetHamParamItemInfo(which, iteminfo_handle);
|
||||
|
||||
|
||||
/**
|
||||
* Gets a parameter on the fly of the current hook.
|
||||
* Use this on parameters that are iteminfo result handles.
|
||||
*
|
||||
* @param iteminfo_handle Item info handle.
|
||||
* @param type Item info type. See ItemInfo_ constants.
|
||||
*/
|
||||
native GetHamItemInfo(iteminfo_handle, ItemInfo:type, any:...);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook.
|
||||
* Use this on parameters that are iteminfo result handles.
|
||||
*
|
||||
* @param iteminfo_handle Item info handle.
|
||||
* @param type Item info type. See HamItemInfo_ constants.
|
||||
*/
|
||||
native SetHamItemInfo(iteminfo_handle, ItemInfo:type, any:...);
|
||||
|
||||
/**
|
||||
* Ham Sandwich module include file.
|
||||
* (c) 2007, The AMX Mod X Development Team
|
||||
* Creates an ItemInfo handle. This value should never be altered.
|
||||
* The handle can be used in Get/SetHamItemInfo.
|
||||
*
|
||||
* -
|
||||
* 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.
|
||||
* NOTE: You must call FreeHamItemInfo() on every handle made with CreateHamItemInfo().
|
||||
*
|
||||
* 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.
|
||||
* @return A new ItemInfo handle.
|
||||
*/
|
||||
native CreateHamItemInfo();
|
||||
|
||||
/**
|
||||
* Ham Sandwich is a module that is used to hook and call virtual functions of
|
||||
* entities.
|
||||
* Virtual functions are mod-specific functions. This means that in order
|
||||
* for this to work on a mod, it needs to be configured with the hamdata.ini
|
||||
* file.
|
||||
* Be very careful with parameter passing to these functions.
|
||||
*/
|
||||
|
||||
#if defined _hamsandwich_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _hamsandwich_included
|
||||
|
||||
#include <ham_const>
|
||||
|
||||
#if AMXX_VERSION_NUM >= 175
|
||||
#pragma reqlib hamsandwich
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib hamsandwich
|
||||
#endif
|
||||
#else
|
||||
#pragma library hamsandwich
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
/**
|
||||
* Frees an ItemIndo handle created with CreateHamItemInfo(). Do not call
|
||||
* this more than once per handle, or on handles not created through
|
||||
* CreateHamItemInfo().
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityClass The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
* @param itemInfo_handle ItemInfo handle created via CreateHamItemInfo().
|
||||
* @noreturn
|
||||
*/
|
||||
native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity's class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
* Note: This will cause hooks for the entire internal class that the entity is
|
||||
* not exclusively for the provided entity.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityId The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
|
||||
|
||||
|
||||
/**
|
||||
* Stops a ham forward from triggering.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to stop.
|
||||
*/
|
||||
native DisableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Starts a ham forward back up.
|
||||
* Use the return value from RegisterHam as the parameter here!
|
||||
*
|
||||
* @param fwd The forward to re-enable.
|
||||
*/
|
||||
native EnableHamForward(HamHook:fwd);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity.
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHam(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Executes the virtual function on the entity, this will trigger all hooks on that function.
|
||||
* Be very careful about recursion!
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to call.
|
||||
* @param id The id of the entity to execute it on.
|
||||
*/
|
||||
native ExecuteHamB(Ham:function, this, any:...);
|
||||
|
||||
/**
|
||||
* Gets the return status of the current hook.
|
||||
* This is useful to determine what return natives to use.
|
||||
*
|
||||
* @return The current status of the hook (such as HAM_SUPERCEDE).
|
||||
*/
|
||||
native GetHamReturnStatus();
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return float.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. Will be -1 on null.
|
||||
*/
|
||||
native GetHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The string size of the buffer.
|
||||
*/
|
||||
native GetHamReturnString(output[], size);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return integers or booleans.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnInteger(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return floats.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnFloat(&Float:output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return Vectors.
|
||||
*
|
||||
* @param output The variable to store the value in.
|
||||
*/
|
||||
native GetOrigHamReturnVector(Float:output[3]);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return entities.
|
||||
*
|
||||
* @param output The variable to store the value in. -1 on null.
|
||||
*/
|
||||
native GetOrigHamReturnEntity(&output);
|
||||
|
||||
/**
|
||||
* Gets the original return value of a hook for hooks that return strings.
|
||||
*
|
||||
* @param output The buffer to store the string in.
|
||||
* @param size The size of the buffer.
|
||||
*/
|
||||
native GetOrigHamReturnString(output[], size);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an integer or boolean.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnInteger(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a float.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnFloat(Float:value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a Vector.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnVector(const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns an entity. Set to -1 for null.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnEntity(value);
|
||||
|
||||
/**
|
||||
* Sets the return value of a hook that returns a string.
|
||||
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
|
||||
*
|
||||
* @param value The value to set the return to.
|
||||
*/
|
||||
native SetHamReturnString(const value[]);
|
||||
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are integers.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamInteger(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are floats.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamFloat(which, Float:value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are Vectors.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamVector(which, const Float:value[3]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are entities.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamEntity(which, value);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are strings.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamString(which, const output[]);
|
||||
|
||||
/**
|
||||
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
|
||||
* Use this on parameters that are trace result handles.
|
||||
*
|
||||
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
|
||||
* @param value The value to change it to.
|
||||
*/
|
||||
native SetHamParamTraceResult(which, tr_handle);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the function for the specified Ham is valid.
|
||||
* Things that would make it invalid would be bounds (an older module version
|
||||
* may not have all of the functions), and the function not being found in
|
||||
* the mod's hamdata.ini file.
|
||||
*
|
||||
* @param function The function to look up.
|
||||
* @return true if the function is valid, false otherwise.
|
||||
*/
|
||||
native bool:IsHamValid(Ham:function);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* Note this dereferences memory! Improper use of this will crash the server.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
* @return The index of the corresponding pdata field. -1 for none set.
|
||||
*/
|
||||
native get_pdata_cbase(id, offset, linuxdiff=5, macdiff=5);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* This will set the corresponding cbase field in private data with the index.
|
||||
* Pass -1 to null the entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param value The index to store, -1 for invalid
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
*/
|
||||
native set_pdata_cbase(id, offset, value, linuxdiff=5, macdiff=5);
|
||||
|
||||
/**
|
||||
* This is similar to the get_pdata_cbase, however it does not dereference memory.
|
||||
* This is many times slower than get_pdata_cbase, and this should only be used
|
||||
* for testing and finding of offsets, not actual release quality plugins.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry. -2 on an invalid entry.
|
||||
*
|
||||
* @param id Entry to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
* @return The index of the corresponding pdata field, -1 for null, -2 for invalid.
|
||||
*/
|
||||
native get_pdata_cbase_safe(id, offset, linuxdiff=5, macdiff=5);
|
||||
|
||||
|
||||
|
||||
|
||||
// This is the callback from the module, this handles any fatal errors.
|
||||
// This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists.
|
||||
// Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing.
|
||||
// Any other return value will fail the plugin.
|
||||
// You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin.
|
||||
// Do not modify this!
|
||||
public __fatal_ham_error(Ham:id, HamError:err, const reason[])
|
||||
{
|
||||
|
||||
new func=get_func_id("HamFilter", -1);
|
||||
new bool:fail=true;
|
||||
|
||||
if (func != -1 && callfunc_begin_i(func, -1)==1)
|
||||
{
|
||||
callfunc_push_int(_:id);
|
||||
callfunc_push_int(_:err);
|
||||
callfunc_push_str(reason, false);
|
||||
if (callfunc_end()==PLUGIN_HANDLED)
|
||||
{
|
||||
fail=false;
|
||||
}
|
||||
}
|
||||
if (fail)
|
||||
{
|
||||
set_fail_state(reason);
|
||||
}
|
||||
|
||||
}
|
||||
native FreeHamItemInfo(itemInfo_handle);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the function for the specified Ham is valid.
|
||||
* Things that would make it invalid would be bounds (an older module version
|
||||
* may not have all of the functions), and the function not being found in
|
||||
* the mod's hamdata.ini file.
|
||||
*
|
||||
* @param function The function to look up.
|
||||
* @return true if the function is valid, false otherwise.
|
||||
*/
|
||||
native bool:IsHamValid(Ham:function);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* Note this dereferences memory! Improper use of this will crash the server.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
* @return The index of the corresponding pdata field. -1 for none set.
|
||||
*/
|
||||
native get_pdata_cbase(id, offset, linuxdiff=5, macdiff=5);
|
||||
|
||||
/**
|
||||
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
|
||||
* This requires the mod to have the pev and base fields set in hamdata.ini.
|
||||
* This will set the corresponding cbase field in private data with the index.
|
||||
* Pass -1 to null the entry.
|
||||
*
|
||||
* @param id The entity to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param value The index to store, -1 for invalid
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
*/
|
||||
native set_pdata_cbase(id, offset, value, linuxdiff=5, macdiff=5);
|
||||
|
||||
/**
|
||||
* This is similar to the get_pdata_cbase, however it does not dereference memory.
|
||||
* This is many times slower than get_pdata_cbase, and this should only be used
|
||||
* for testing and finding of offsets, not actual release quality plugins.
|
||||
* This will return an index of the corresponding cbase field in private data.
|
||||
* Returns -1 on a null entry. -2 on an invalid entry.
|
||||
*
|
||||
* @param id Entry to examine the private data.
|
||||
* @param offset The windows offset of the data.
|
||||
* @param linuxdiff The linux difference of the data.
|
||||
* @param macdiff The mac os x difference of the data.
|
||||
* @return The index of the corresponding pdata field, -1 for null, -2 for invalid.
|
||||
*/
|
||||
native get_pdata_cbase_safe(id, offset, linuxdiff=5, macdiff=5);
|
||||
|
||||
|
||||
|
||||
|
||||
// This is the callback from the module, this handles any fatal errors.
|
||||
// This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists.
|
||||
// Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing.
|
||||
// Any other return value will fail the plugin.
|
||||
// You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin.
|
||||
// Do not modify this!
|
||||
public __fatal_ham_error(Ham:id, HamError:err, const reason[])
|
||||
{
|
||||
|
||||
new func=get_func_id("HamFilter", -1);
|
||||
new bool:fail=true;
|
||||
|
||||
if (func != -1 && callfunc_begin_i(func, -1)==1)
|
||||
{
|
||||
callfunc_push_int(_:id);
|
||||
callfunc_push_int(_:err);
|
||||
callfunc_push_str(reason, false);
|
||||
if (callfunc_end()==PLUGIN_HANDLED)
|
||||
{
|
||||
fail=false;
|
||||
}
|
||||
}
|
||||
if (fail)
|
||||
{
|
||||
set_fail_state(reason);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user