Compare commits
221 Commits
amxmodx-0.
...
amxmodx-0.
Author | SHA1 | Date | |
---|---|---|---|
b5680a27f5 | |||
69e7cbc722 | |||
54e88bf8a8 | |||
b0315f5d56 | |||
ec55a2ab97 | |||
1082ef31c7 | |||
ee28532c53 | |||
e4294da5bd | |||
1ba9a39b3f | |||
5453b55bdc | |||
16f51ea619 | |||
b209d92a2a | |||
0def8c9354 | |||
ac59f75523 | |||
f2faf990a0 | |||
7f6e9f5e20 | |||
c12b04d302 | |||
9922b5016f | |||
77fffb46b2 | |||
e7cd31b1d5 | |||
9006673b09 | |||
96271810d8 | |||
8377680989 | |||
00582481c6 | |||
c2255016d2 | |||
9e1c5f2808 | |||
897d93a892 | |||
04be9fb703 | |||
acf722e855 | |||
d2fe1dc043 | |||
dafc8bb678 | |||
d303a2e0b7 | |||
7c8e9509ce | |||
7334f968a8 | |||
f5a997069d | |||
c7f8b3f965 | |||
316ddad7ab | |||
4d34270ee9 | |||
2573c9c4d2 | |||
d72b8de045 | |||
49d24f6829 | |||
6f9ec854dc | |||
9a3e713a69 | |||
3ec4ccd9da | |||
5867e3398f | |||
07ed1baee9 | |||
1e1d479d76 | |||
78c191b4c9 | |||
cf65ebf647 | |||
7b626ab632 | |||
90eafe59a6 | |||
a055d3d373 | |||
267db7cc2b | |||
5043a40c51 | |||
0a74f09273 | |||
767795b91e | |||
8089d42eda | |||
6b9c8ac1ea | |||
3c037270a6 | |||
6ac682cc5b | |||
e378c45be7 | |||
66da3375ba | |||
1df654c6a1 | |||
388915e6f8 | |||
4d8a927ff7 | |||
b8721e0123 | |||
59880371e1 | |||
6c73a7d8d1 | |||
4232d68c92 | |||
17faf3af1f | |||
1c3a871831 | |||
a313c5b95b | |||
b23eba293d | |||
08682ab378 | |||
39cb15cc56 | |||
c5d7417f8e | |||
4c202dadb0 | |||
78dc3ffd39 | |||
1d3dd15e61 | |||
02446ac5f1 | |||
2601879c0b | |||
313e0603e9 | |||
1d145d6c79 | |||
213b0e65dc | |||
079a3e8bcd | |||
3010241fbd | |||
f3ea36c5d7 | |||
55dfbefb40 | |||
1aee2c6f81 | |||
226c7300be | |||
f2af6ad1e6 | |||
02d60ded5d | |||
3d0e25a8ef | |||
baef3362ed | |||
8903bc7f04 | |||
fe2e3a1468 | |||
3cbcebae56 | |||
0fe010f4f0 | |||
cd6e51271c | |||
711ad7b3dc | |||
7ed66f0b38 | |||
3c67dcd326 | |||
8d0b5360c2 | |||
44c5265757 | |||
3297cf2e9b | |||
b040f4474b | |||
5094bba5e9 | |||
e0e4f5cb34 | |||
c0d73ce572 | |||
7d3d04b13d | |||
88e199ff10 | |||
ec3ade999a | |||
57e93ef281 | |||
6122364a24 | |||
ff1be08b8a | |||
a66d04d26f | |||
d20e9527f7 | |||
5c72931b94 | |||
276886022e | |||
8df987cf95 | |||
de30d647d4 | |||
7f70805e63 | |||
1822261046 | |||
2a622424a0 | |||
37a5a38be5 | |||
580b20e720 | |||
9a4f15e4ad | |||
dd5c75888a | |||
e8ec0ad5bf | |||
961b92db2c | |||
af6349454d | |||
32b07e4c0c | |||
e73b3bbbb7 | |||
fbb7c0bb92 | |||
04c43f8589 | |||
9d733d7a6b | |||
30ddeda877 | |||
72e5e9885f | |||
5c6b34b1d8 | |||
7a627f75cf | |||
02cb4b94f5 | |||
0b5c02f678 | |||
ec5f9ec5ca | |||
551d51ea42 | |||
560cd184cc | |||
14297c8408 | |||
385fa07884 | |||
35fdb8aa6e | |||
34c6a1d4be | |||
745c595fc8 | |||
e979252742 | |||
90b7dc2b9c | |||
66bed5a1ab | |||
8575c9a637 | |||
e73acf4fe4 | |||
2f37ab7ede | |||
b1dd324354 | |||
5f00f09314 | |||
f06796c275 | |||
e15c151167 | |||
0b2eae8e0a | |||
4fff936626 | |||
e2c9dbaa62 | |||
b2f3a52884 | |||
a720b62aaa | |||
71e6ce30a3 | |||
4ee0573203 | |||
68354f8964 | |||
d0b37726d5 | |||
51e8519d96 | |||
c6d2516df8 | |||
813bc1a212 | |||
aa3c8fa377 | |||
8cb5ad18f5 | |||
b34179e997 | |||
91aacb1036 | |||
2134a7e36d | |||
6da1dc3e4a | |||
b33a53d258 | |||
bec1e418e7 | |||
5c6db6d743 | |||
ac25c5fc60 | |||
1e36d0ca39 | |||
945900605d | |||
3b6d22d3bf | |||
b254f14285 | |||
38e89f11f4 | |||
f4960433bc | |||
ebe778d0ee | |||
36ad12b6b3 | |||
0c022b1543 | |||
4e9de62da6 | |||
727c798892 | |||
d9b768e2cf | |||
c1d75857f3 | |||
6d91af30b8 | |||
a1d36ff75d | |||
9a3e53478e | |||
7703c36a90 | |||
a3d048880f | |||
53f8d12237 | |||
54fb9fbfef | |||
5a80d24780 | |||
b8bbe4ae8f | |||
da13f4797d | |||
6d35912c67 | |||
02be09dd00 | |||
93cd6dbed5 | |||
8c8ccc51c4 | |||
c7982c2bc3 | |||
4015655141 | |||
980ccfddf5 | |||
891be11032 | |||
269a0e4305 | |||
9fb04f552c | |||
19101470fd | |||
fb8a883eec | |||
8d714dd84e | |||
c6c958db2d | |||
185070a9ad | |||
a86c892af2 |
@ -174,6 +174,7 @@ void CSPForward::Set(int func, AMX *amx, int numParams, const ForwardParam *para
|
|||||||
m_NumParams = numParams;
|
m_NumParams = numParams;
|
||||||
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
||||||
m_HasFunc = true;
|
m_HasFunc = true;
|
||||||
|
isFree = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes)
|
void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes)
|
||||||
@ -182,10 +183,13 @@ void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const Forwar
|
|||||||
m_NumParams = numParams;
|
m_NumParams = numParams;
|
||||||
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
||||||
m_HasFunc = (amx_FindPublic(amx, funcName, &m_Func) == AMX_ERR_NONE);
|
m_HasFunc = (amx_FindPublic(amx, funcName, &m_Func) == AMX_ERR_NONE);
|
||||||
|
isFree = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
||||||
{
|
{
|
||||||
|
if (isFree)
|
||||||
|
return 0;
|
||||||
const int STRINGEX_MAXLENGTH = 128;
|
const int STRINGEX_MAXLENGTH = 128;
|
||||||
|
|
||||||
cell realParams[FORWARD_MAX_PARAMS];
|
cell realParams[FORWARD_MAX_PARAMS];
|
||||||
@ -286,11 +290,13 @@ int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const For
|
|||||||
{
|
{
|
||||||
int retVal = (m_SPForwards.size() << 1) | 1;
|
int retVal = (m_SPForwards.size() << 1) | 1;
|
||||||
CSPForward *pForward;
|
CSPForward *pForward;
|
||||||
if (m_FreeSPForwards.size())
|
if (!m_FreeSPForwards.empty())
|
||||||
{
|
{
|
||||||
pForward = m_SPForwards[m_FreeSPForwards.back()];
|
pForward = m_SPForwards[m_FreeSPForwards.front() >> 1];
|
||||||
m_FreeSPForwards.pop_back();
|
|
||||||
pForward->Set(func, amx, numParams, paramTypes);
|
pForward->Set(func, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
return -1;
|
||||||
|
m_FreeSPForwards.pop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -298,6 +304,12 @@ int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const For
|
|||||||
if (!pForward)
|
if (!pForward)
|
||||||
return -1;
|
return -1;
|
||||||
pForward->Set(func, amx, numParams, paramTypes);
|
pForward->Set(func, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
delete pForward;
|
||||||
|
}
|
||||||
|
|
||||||
m_SPForwards.push_back(pForward);
|
m_SPForwards.push_back(pForward);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -307,11 +319,14 @@ int CForwardMngr::registerSPForward(const char *funcName, AMX *amx, int numParam
|
|||||||
{
|
{
|
||||||
int retVal = (m_SPForwards.size() << 1) | 1;
|
int retVal = (m_SPForwards.size() << 1) | 1;
|
||||||
CSPForward *pForward;
|
CSPForward *pForward;
|
||||||
if (m_FreeSPForwards.size())
|
if (!m_FreeSPForwards.empty())
|
||||||
{
|
{
|
||||||
pForward = m_SPForwards[m_FreeSPForwards.back()];
|
retVal = m_FreeSPForwards.front();
|
||||||
m_FreeSPForwards.pop_back();
|
pForward = m_SPForwards[retVal>>1]; // >>1 because unregisterSPForward pushes the id which contains the sp flag
|
||||||
pForward->Set(funcName, amx, numParams, paramTypes);
|
pForward->Set(funcName, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
return -1;
|
||||||
|
m_FreeSPForwards.pop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -319,6 +334,11 @@ int CForwardMngr::registerSPForward(const char *funcName, AMX *amx, int numParam
|
|||||||
if (!pForward)
|
if (!pForward)
|
||||||
return -1;
|
return -1;
|
||||||
pForward->Set(funcName, amx, numParams, paramTypes);
|
pForward->Set(funcName, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
{
|
||||||
|
delete pForward;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
m_SPForwards.push_back(pForward);
|
m_SPForwards.push_back(pForward);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -345,6 +365,12 @@ int CForwardMngr::getParamsNum(int id) const
|
|||||||
m_Forwards[id >> 1]->getParamsNum();
|
m_Forwards[id >> 1]->getParamsNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ForwardParam CForwardMngr::getParamType(int id, int paramNum) const
|
||||||
|
{
|
||||||
|
return (id & 1) ? m_SPForwards[id >> 1]->getParamType(paramNum) :
|
||||||
|
m_Forwards[id >> 1]->getParamType(paramNum);
|
||||||
|
}
|
||||||
|
|
||||||
void CForwardMngr::clear()
|
void CForwardMngr::clear()
|
||||||
{
|
{
|
||||||
for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter)
|
for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter)
|
||||||
@ -359,7 +385,8 @@ void CForwardMngr::clear()
|
|||||||
|
|
||||||
m_Forwards.clear();
|
m_Forwards.clear();
|
||||||
m_SPForwards.clear();
|
m_SPForwards.clear();
|
||||||
m_FreeSPForwards.clear();
|
while (!m_FreeSPForwards.empty())
|
||||||
|
m_FreeSPForwards.pop();
|
||||||
m_TmpArraysNum = 0;
|
m_TmpArraysNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +397,13 @@ bool CForwardMngr::isSPForward(int id) const
|
|||||||
|
|
||||||
void CForwardMngr::unregisterSPForward(int id)
|
void CForwardMngr::unregisterSPForward(int id)
|
||||||
{
|
{
|
||||||
m_FreeSPForwards.push_back(id);
|
//make sure the id is valid
|
||||||
|
if ( !isIdValid(id) || m_SPForwards.at(id >> 1)->isFree )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_SPForwards.at(id >> 1)->isFree = true;
|
||||||
|
|
||||||
|
m_FreeSPForwards.push(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int registerForward(const char *funcName, ForwardExecType et, ...)
|
int registerForward(const char *funcName, ForwardExecType et, ...)
|
||||||
@ -447,7 +480,7 @@ cell executeForwards(int id, ...)
|
|||||||
va_start(argptr, id);
|
va_start(argptr, id);
|
||||||
for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i)
|
for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i)
|
||||||
{
|
{
|
||||||
if (params[i] == FP_FLOAT)
|
if (g_forwards.getParamType(id, i) == FP_FLOAT)
|
||||||
{
|
{
|
||||||
REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles
|
REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles
|
||||||
params[i] = *(cell*)&tmp;
|
params[i] = *(cell*)&tmp;
|
||||||
|
@ -108,6 +108,12 @@ public:
|
|||||||
{
|
{
|
||||||
return m_Funcs.size();
|
return m_Funcs.size();
|
||||||
}
|
}
|
||||||
|
ForwardParam getParamType(int paramId) const
|
||||||
|
{
|
||||||
|
if (paramId < 0 || paramId >= m_NumParams)
|
||||||
|
return FP_DONE;
|
||||||
|
return m_ParamTypes[paramId];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Single plugin forward
|
// Single plugin forward
|
||||||
@ -119,6 +125,8 @@ class CSPForward
|
|||||||
AMX *m_Amx;
|
AMX *m_Amx;
|
||||||
int m_Func;
|
int m_Func;
|
||||||
bool m_HasFunc;
|
bool m_HasFunc;
|
||||||
|
public:
|
||||||
|
bool isFree;
|
||||||
public:
|
public:
|
||||||
CSPForward() { m_HasFunc = false; }
|
CSPForward() { m_HasFunc = false; }
|
||||||
void Set(const char *funcName, AMX *amx, int numParams, const ForwardParam * paramTypes);
|
void Set(const char *funcName, AMX *amx, int numParams, const ForwardParam * paramTypes);
|
||||||
@ -133,13 +141,19 @@ public:
|
|||||||
{
|
{
|
||||||
return (m_HasFunc) ? 1 : 0;
|
return (m_HasFunc) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
ForwardParam getParamType(int paramId) const
|
||||||
|
{
|
||||||
|
if (paramId < 0 || paramId >= m_NumParams)
|
||||||
|
return FP_DONE;
|
||||||
|
return m_ParamTypes[paramId];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CForwardMngr
|
class CForwardMngr
|
||||||
{
|
{
|
||||||
typedef CVector<CForward*> ForwardVec;
|
typedef CVector<CForward*> ForwardVec;
|
||||||
typedef CVector<CSPForward*> SPForwardVec;
|
typedef CVector<CSPForward*> SPForwardVec;
|
||||||
typedef CVector<int> FreeSPVec; // Free SP Forwards
|
typedef CQueue<int> FreeSPVec; // Free SP Forwards
|
||||||
|
|
||||||
ForwardVec m_Forwards;
|
ForwardVec m_Forwards;
|
||||||
|
|
||||||
@ -170,6 +184,7 @@ public:
|
|||||||
bool isSPForward(int id) const; // check whether forward is single plugin
|
bool isSPForward(int id) const; // check whether forward is single plugin
|
||||||
int getParamsNum(int id) const; // get num of params of a forward
|
int getParamsNum(int id) const; // get num of params of a forward
|
||||||
int getFuncsNum(int id) const; // get num of found functions of a forward
|
int getFuncsNum(int id) const; // get num of found functions of a forward
|
||||||
|
ForwardParam getParamType(int id, int paramId) const;
|
||||||
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type); // prepare array
|
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type); // prepare array
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,15 +47,6 @@
|
|||||||
#define FFHL_VERSION 4
|
#define FFHL_VERSION 4
|
||||||
#define FFHL_MIN_VERSION 4
|
#define FFHL_MIN_VERSION 4
|
||||||
|
|
||||||
#define NEXT_PARAM() \
|
|
||||||
if (parm > paramCount) \
|
|
||||||
{ \
|
|
||||||
strcpy(outbuf, ""); \
|
|
||||||
len = 0; \
|
|
||||||
AMXXLOG_Log("[AMXX] Plugin did not format a string correctly (parameter %d (total %d), line %d, \"%s\")", parm, paramCount, amx->curline, g_plugins.findPluginFast(amx)); \
|
|
||||||
return outbuf; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*version history:
|
/*version history:
|
||||||
* 1 (BAILOPAN) - Simplest form possible, no reverse
|
* 1 (BAILOPAN) - Simplest form possible, no reverse
|
||||||
* 2 (BAILOPAN) - One language per file with full reverse
|
* 2 (BAILOPAN) - One language per file with full reverse
|
||||||
@ -350,7 +341,7 @@ void CLangMngr::CLang::MergeDefinitions(CQueue<sKeyDef*> &vec)
|
|||||||
entry->SetKey(key);
|
entry->SetKey(key);
|
||||||
entry->SetCache(false);
|
entry->SetCache(false);
|
||||||
} else {
|
} else {
|
||||||
AMXXLOG_Log("[AMXX] Language key %s[%s] defined twice", m_LMan->GetKey(key), m_LanguageName);
|
//AMXXLOG_Log("[AMXX] Language key %s[%s] defined twice", m_LMan->GetKey(key), m_LanguageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete vec.front();
|
delete vec.front();
|
||||||
@ -506,153 +497,36 @@ int CLangMngr::GetKeyEntry(String &key)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CLangMngr::Format(const char *src, ...)
|
#define CHECK_PTR(ptr, start, bufsize) if ((ptr) - (start) >= (bufsize)) { \
|
||||||
{
|
AMXXLOG_Log("[AMXX] Buffer overflow in formatting (line %d, \"%s\")", amx->curline, g_plugins.findPluginFast(amx)->getName()); \
|
||||||
va_list argptr;
|
outbuf[0] = 0; \
|
||||||
va_start(argptr, src);
|
len = 0; \
|
||||||
static char outbuf[4096];
|
return outbuf; }
|
||||||
char *outptr = outbuf;
|
#define CHECK_OUTPTR(offset) CHECK_PTR(outptr+offset, outbuf, sizeof(outbuf))
|
||||||
enum State
|
#define ZEROTERM(buf) buf[(sizeof(buf)/sizeof(buf[0]))-1]=0;
|
||||||
{
|
#define NEXT_PARAM() \
|
||||||
S_Normal,
|
if (parm > paramCount) \
|
||||||
S_PercentSign,
|
{ \
|
||||||
};
|
strcpy(outbuf, ""); \
|
||||||
|
len = 0; \
|
||||||
State curState = S_Normal;
|
AMXXLOG_Log("[AMXX] Plugin did not format a string correctly (parameter %d (total %d), line %d, \"%s\")", parm, paramCount, amx->curline, g_plugins.findPluginFast(amx)->getName()); \
|
||||||
while (*src)
|
return outbuf; \
|
||||||
{
|
|
||||||
if (*src == '%' && curState == S_Normal)
|
|
||||||
curState = S_PercentSign;
|
|
||||||
else if (curState == S_PercentSign)
|
|
||||||
{
|
|
||||||
switch (*src)
|
|
||||||
{
|
|
||||||
case 's':
|
|
||||||
{
|
|
||||||
char *tmpArg = va_arg(argptr, char*);
|
|
||||||
while (*tmpArg)
|
|
||||||
*outptr++ = *tmpArg++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'f':
|
|
||||||
case 'g':
|
|
||||||
{
|
|
||||||
char format[16];
|
|
||||||
format[0] = '%';
|
|
||||||
char *ptr = format+1;
|
|
||||||
while (!isalpha(*ptr++ = *src++))
|
|
||||||
/*nothing*/;
|
|
||||||
--src;
|
|
||||||
*ptr = 0;
|
|
||||||
sprintf(outptr, format, va_arg(argptr, double));
|
|
||||||
outptr += strlen(outptr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'L':
|
|
||||||
{
|
|
||||||
char *langName = va_arg(argptr, char*);
|
|
||||||
const char *cpLangName=NULL;
|
|
||||||
// Handle player ids (1-32) and server language
|
|
||||||
if ((int)langName == LANG_PLAYER)
|
|
||||||
{
|
|
||||||
langName = (char*)m_CurGlobId;
|
|
||||||
}
|
|
||||||
if ((int)langName == LANG_SERVER)
|
|
||||||
{
|
|
||||||
cpLangName = g_vault.get("server_language");
|
|
||||||
} else if ((int)langName >= 1 && (int)langName <= 32) {
|
|
||||||
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
|
|
||||||
{
|
|
||||||
cpLangName = g_vault.get("server_language");
|
|
||||||
} else {
|
|
||||||
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I((int)langName)->pEdict, "lang");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cpLangName = langName;
|
|
||||||
}
|
|
||||||
if (!cpLangName || strlen(cpLangName) < 1)
|
|
||||||
cpLangName = "en";
|
|
||||||
char *key = va_arg(argptr, char*);
|
|
||||||
const char *def = GetDef(cpLangName, key);
|
|
||||||
while (*def)
|
|
||||||
{
|
|
||||||
switch (*def)
|
|
||||||
{
|
|
||||||
case INSERT_NUMBER:
|
|
||||||
{
|
|
||||||
sprintf(outptr, "%d", va_arg(argptr, int));
|
|
||||||
outptr += strlen(outptr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INSERT_STRING:
|
|
||||||
{
|
|
||||||
char *tmpArg = va_arg(argptr, char*);
|
|
||||||
while (*tmpArg)
|
|
||||||
*outptr++ = *tmpArg++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INSERT_FLOAT:
|
|
||||||
{
|
|
||||||
double tmpArg = va_arg(argptr, double);
|
|
||||||
sprintf(outptr, "%f", tmpArg);
|
|
||||||
outptr += strlen(outptr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INSERT_NEWLINE:
|
|
||||||
*outptr++ = '\n';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
*outptr++ = *def;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'd':
|
|
||||||
{
|
|
||||||
char format[16];
|
|
||||||
format[0] = '%';
|
|
||||||
char *ptr = format+1;
|
|
||||||
while (!isalpha(*ptr++ = *src++))
|
|
||||||
/*nothing*/;
|
|
||||||
--src;
|
|
||||||
*ptr = 0;
|
|
||||||
sprintf(outptr, format, va_arg(argptr, int));
|
|
||||||
outptr += strlen(outptr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
*outptr++ = '%';
|
|
||||||
*outptr++ = *src;
|
|
||||||
}
|
|
||||||
curState = S_Normal;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*outptr++ = *src;
|
|
||||||
++src;
|
|
||||||
}
|
}
|
||||||
*outptr++ = 0;
|
|
||||||
return outbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
||||||
{
|
{
|
||||||
|
// number of parameters ( for NEXT_PARAM macro )
|
||||||
int paramCount = *params / sizeof(cell);
|
int paramCount = *params / sizeof(cell);
|
||||||
|
// the output buffer
|
||||||
static char outbuf[4096];
|
static char outbuf[4096];
|
||||||
cell *src = get_amxaddr(amx, params[parm++]);
|
|
||||||
char *outptr = outbuf;
|
char *outptr = outbuf;
|
||||||
enum State
|
cell *src = get_amxaddr(amx, params[parm++]);
|
||||||
{
|
|
||||||
S_Normal,
|
|
||||||
S_PercentSign,
|
|
||||||
};
|
|
||||||
|
|
||||||
State curState = S_Normal;
|
|
||||||
while (*src)
|
while (*src)
|
||||||
{
|
{
|
||||||
if (*src == '%' && curState == S_Normal)
|
if (*src == '%')
|
||||||
curState = S_PercentSign;
|
|
||||||
else if (curState == S_PercentSign)
|
|
||||||
{
|
{
|
||||||
|
++src;
|
||||||
if (*src=='L')
|
if (*src=='L')
|
||||||
{
|
{
|
||||||
cell langName = params[parm]; // "en" case (langName contains the address to the string)
|
cell langName = params[parm]; // "en" case (langName contains the address to the string)
|
||||||
@ -678,14 +552,14 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pAmxLangName)->pEdict, "lang");
|
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pAmxLangName)->pEdict, "lang");
|
||||||
}
|
}
|
||||||
} else { // Language Name
|
} else { // Language Name
|
||||||
int len = 0;
|
int tmplen = 0;
|
||||||
cpLangName = get_amxstring(amx, langName, 2, len);
|
cpLangName = get_amxstring(amx, langName, 2, tmplen);
|
||||||
}
|
}
|
||||||
if (!cpLangName || strlen(cpLangName) < 1)
|
if (!cpLangName || strlen(cpLangName) < 1)
|
||||||
cpLangName = "en";
|
cpLangName = "en";
|
||||||
int len = 0;
|
int tmplen = 0;
|
||||||
NEXT_PARAM();
|
NEXT_PARAM();
|
||||||
char *key = get_amxstring(amx, params[parm++], 1, len);
|
char *key = get_amxstring(amx, params[parm++], 1, tmplen);
|
||||||
const char *def = GetDef(cpLangName, key);
|
const char *def = GetDef(cpLangName, key);
|
||||||
if (def == NULL)
|
if (def == NULL)
|
||||||
{
|
{
|
||||||
@ -699,7 +573,8 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
}
|
}
|
||||||
if (!def)
|
if (!def)
|
||||||
{
|
{
|
||||||
static char buf[255];
|
static char buf[512];
|
||||||
|
CHECK_PTR((char*)(buf+17+strlen(key)), buf, sizeof(buf));
|
||||||
sprintf(buf, "ML_LNOTFOUND: %s", key);
|
sprintf(buf, "ML_LNOTFOUND: %s", key);
|
||||||
def = buf;
|
def = buf;
|
||||||
}
|
}
|
||||||
@ -709,24 +584,28 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
if (*def == '%')
|
if (*def == '%')
|
||||||
{
|
{
|
||||||
++def;
|
++def;
|
||||||
char format[16];
|
static char format[32];
|
||||||
format[0] = '%';
|
format[0] = '%';
|
||||||
char *ptr = format+1;
|
char *ptr = format+1;
|
||||||
while (!isalpha(*ptr++ = *def++))
|
while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++))
|
||||||
/*nothing*/;
|
/*nothing*/;
|
||||||
|
ZEROTERM(format);
|
||||||
|
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
switch ( *(ptr-1) )
|
switch ( *(ptr-1) )
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
{
|
{
|
||||||
char tmpString[256];
|
static char tmpString[4096];
|
||||||
char *tmpPtr = tmpString;
|
char *tmpPtr = tmpString;
|
||||||
NEXT_PARAM();
|
NEXT_PARAM();
|
||||||
cell *tmpCell = get_amxaddr(amx, params[parm++]);
|
cell *tmpCell = get_amxaddr(amx, params[parm++]);
|
||||||
while (*tmpCell)
|
while (tmpPtr-tmpString < sizeof(tmpString) && *tmpCell)
|
||||||
*tmpPtr++ = *tmpCell++;
|
*tmpPtr++ = *tmpCell++;
|
||||||
|
|
||||||
*tmpPtr = 0;
|
*tmpPtr = 0;
|
||||||
sprintf(outptr, format, tmpString);
|
sprintf(outptr, format, tmpString);
|
||||||
|
ZEROTERM(outbuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'g':
|
case 'g':
|
||||||
@ -734,19 +613,22 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
{
|
{
|
||||||
NEXT_PARAM();
|
NEXT_PARAM();
|
||||||
sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++]));
|
sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++]));
|
||||||
|
ZEROTERM(outbuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'i':
|
case 'i':
|
||||||
case 'd':
|
case 'd':
|
||||||
|
case 'c':
|
||||||
{
|
{
|
||||||
NEXT_PARAM();
|
NEXT_PARAM();
|
||||||
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
|
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
|
||||||
|
ZEROTERM(outbuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
*outptr++ = '%';
|
CHECK_OUTPTR(strlen(format)+1);
|
||||||
*outptr++ = *(ptr-1);
|
strcpy(outptr, format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -758,15 +640,19 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
switch (*def)
|
switch (*def)
|
||||||
{
|
{
|
||||||
case 'n':
|
case 'n':
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
*outptr++ = '\n';
|
*outptr++ = '\n';
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
*outptr++ = '\t';
|
*outptr++ = '\t';
|
||||||
break;
|
break;
|
||||||
case '^':
|
case '^':
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
*outptr++ = '^';
|
*outptr++ = '^';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
CHECK_OUTPTR(2);
|
||||||
*outptr++ = '^';
|
*outptr++ = '^';
|
||||||
*outptr++ = *def;
|
*outptr++ = *def;
|
||||||
break;
|
break;
|
||||||
@ -774,33 +660,37 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
++def;
|
++def;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
*outptr++ = *def++;
|
*outptr++ = *def++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char tmpString[256];
|
static char tmpString[4096];
|
||||||
char *tmpPtr = tmpString;
|
char *tmpPtr = tmpString;
|
||||||
int tmpLen =0;
|
int tmpLen = 0;
|
||||||
char format[16];
|
static char format[32] = {'%'};
|
||||||
format[0] = '%';
|
|
||||||
char *ptr = format+1;
|
char *ptr = format+1;
|
||||||
if (*src != '%')
|
if (*src != '%')
|
||||||
{
|
{
|
||||||
while (!isalpha(*ptr++ = *src++))
|
while (*src != 0 && ptr-format<sizeof(format) && !isalpha(*ptr++ = *src++))
|
||||||
/*nothing*/;
|
/*nothing*/;
|
||||||
--src;
|
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
|
ZEROTERM(format);
|
||||||
|
--src;
|
||||||
switch ( *(ptr-1) )
|
switch ( *(ptr-1) )
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
{
|
{
|
||||||
NEXT_PARAM();
|
NEXT_PARAM();
|
||||||
cell *tmpCell = get_amxaddr(amx, params[parm++]);
|
cell *tmpCell = get_amxaddr(amx, params[parm++]);
|
||||||
while (*tmpCell)
|
while (tmpPtr-tmpString<sizeof(tmpString) && *tmpCell)
|
||||||
*tmpPtr++ = *tmpCell++;
|
*tmpPtr++ = *tmpCell++;
|
||||||
*tmpPtr = 0;
|
*tmpPtr = 0;
|
||||||
sprintf(outptr, format, tmpString);
|
sprintf(outptr, format, tmpString);
|
||||||
|
ZEROTERM(outbuf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'g':
|
case 'g':
|
||||||
@ -812,6 +702,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
}
|
}
|
||||||
case 'i':
|
case 'i':
|
||||||
case 'd':
|
case 'd':
|
||||||
|
case 'c':
|
||||||
{
|
{
|
||||||
NEXT_PARAM();
|
NEXT_PARAM();
|
||||||
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
|
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
|
||||||
@ -819,29 +710,225 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
*outptr++ = '%';
|
CHECK_OUTPTR(strlen(format)+1);
|
||||||
*outptr++ = *(ptr-1);
|
strcpy(outptr, format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
outptr += strlen(outptr);
|
||||||
} else {
|
} else {
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
*outptr++ = '%';
|
*outptr++ = '%';
|
||||||
*outptr++ = '%';
|
|
||||||
src++;
|
|
||||||
}
|
}
|
||||||
outptr += strlen(outptr);
|
|
||||||
}
|
}
|
||||||
curState = S_Normal;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
*outptr++ = *src;
|
*outptr++ = *src;
|
||||||
|
}
|
||||||
++src;
|
++src;
|
||||||
}
|
}
|
||||||
len = outptr - outbuf;
|
len = outptr - outbuf;
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
*outptr++ = 0;
|
*outptr++ = 0;
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *CLangMngr::Format(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
const char *retVal = FormatString(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef CHECK_PTR
|
||||||
|
#undef CHECK_OUTPR
|
||||||
|
#undef ZEROTERM
|
||||||
|
#undef NEXT_PARAM
|
||||||
|
|
||||||
|
#define CHECK_PTR(ptr, start, bufsize) if ((ptr) - (start) >= (bufsize)) { \
|
||||||
|
AMXXLOG_Log("[AMXX] Buffer overflow in formatting"); \
|
||||||
|
outbuf[0] = 0; \
|
||||||
|
return outbuf; }
|
||||||
|
#define CHECK_OUTPTR(offset) CHECK_PTR(outptr+offset, outbuf, sizeof(outbuf))
|
||||||
|
#define ZEROTERM(buf) buf[(sizeof(buf)/sizeof(buf[0]))-1]=0;
|
||||||
|
#define NEXT_PARAM()
|
||||||
|
|
||||||
|
char *CLangMngr::FormatString(const char *fmt, va_list &ap)
|
||||||
|
{
|
||||||
|
// the output buffer
|
||||||
|
static char outbuf[4096];
|
||||||
|
char *outptr = outbuf;
|
||||||
|
const char *src = fmt;
|
||||||
|
|
||||||
|
while (*src)
|
||||||
|
{
|
||||||
|
if (*src == '%')
|
||||||
|
{
|
||||||
|
++src;
|
||||||
|
if (*src=='L')
|
||||||
|
{
|
||||||
|
NEXT_PARAM();
|
||||||
|
const char *pAmxLangName = va_arg(ap, const char*);
|
||||||
|
const char *cpLangName=NULL;
|
||||||
|
// Handle player ids (1-32) and server language
|
||||||
|
if (pAmxLangName == (const char *)LANG_PLAYER) // LANG_PLAYER
|
||||||
|
{
|
||||||
|
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
|
||||||
|
{
|
||||||
|
cpLangName = g_vault.get("server_language");
|
||||||
|
} else {
|
||||||
|
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(m_CurGlobId)->pEdict, "lang");
|
||||||
|
}
|
||||||
|
} else if (pAmxLangName == (const char *)LANG_SERVER) { // LANG_SERVER
|
||||||
|
cpLangName = g_vault.get("server_language");
|
||||||
|
} else if (pAmxLangName >= (const char *)1 && pAmxLangName <= (const char *)32) { // Direct Client Id
|
||||||
|
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
|
||||||
|
{
|
||||||
|
cpLangName = g_vault.get("server_language");
|
||||||
|
} else {
|
||||||
|
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I((int)pAmxLangName)->pEdict, "lang");
|
||||||
|
}
|
||||||
|
} else { // Language Name
|
||||||
|
int tmplen = 0;
|
||||||
|
cpLangName = pAmxLangName;
|
||||||
|
}
|
||||||
|
if (!cpLangName || strlen(cpLangName) < 1)
|
||||||
|
cpLangName = "en";
|
||||||
|
int tmplen = 0;
|
||||||
|
const char *key = va_arg(ap, const char *);
|
||||||
|
const char *def = GetDef(cpLangName, key);
|
||||||
|
if (def == NULL)
|
||||||
|
{
|
||||||
|
if (pAmxLangName != LANG_SERVER)
|
||||||
|
{
|
||||||
|
def = GetDef(g_vault.get("server_language"), key);
|
||||||
|
}
|
||||||
|
if (strcmp(cpLangName, "en")!=0 && strcmp(g_vault.get("server_language"), "en")!=0)
|
||||||
|
{
|
||||||
|
def = GetDef("en", key);
|
||||||
|
}
|
||||||
|
if (!def)
|
||||||
|
{
|
||||||
|
static char buf[512];
|
||||||
|
CHECK_PTR((char*)(buf+17+strlen(key)), buf, sizeof(buf));
|
||||||
|
sprintf(buf, "ML_LNOTFOUND: %s", key);
|
||||||
|
def = buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (*def)
|
||||||
|
{
|
||||||
|
if (*def == '%')
|
||||||
|
{
|
||||||
|
++def;
|
||||||
|
static char format[32];
|
||||||
|
format[0] = '%';
|
||||||
|
char *ptr = format+1;
|
||||||
|
while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++))
|
||||||
|
/*nothing*/;
|
||||||
|
ZEROTERM(format);
|
||||||
|
|
||||||
|
*ptr = 0;
|
||||||
|
vsprintf(outptr, format, ap);
|
||||||
|
// vsprintf doesnt alter the ap, increment here
|
||||||
|
switch (*(ptr-1))
|
||||||
|
{
|
||||||
|
case 'f':
|
||||||
|
va_arg(ap, double);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
va_arg(ap, char *);
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
case 'd':
|
||||||
|
case 'i':
|
||||||
|
default: // default: assume int-like parameter
|
||||||
|
va_arg(ap, int);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
outptr += strlen(outptr);
|
||||||
|
}
|
||||||
|
else if (*def == '^')
|
||||||
|
{
|
||||||
|
++def;
|
||||||
|
switch (*def)
|
||||||
|
{
|
||||||
|
case 'n':
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
|
*outptr++ = '\n';
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
|
*outptr++ = '\t';
|
||||||
|
break;
|
||||||
|
case '^':
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
|
*outptr++ = '^';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CHECK_OUTPTR(2);
|
||||||
|
*outptr++ = '^';
|
||||||
|
*outptr++ = *def;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++def;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
|
*outptr++ = *def++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static char format[32] = {'%'};
|
||||||
|
char *ptr = format+1;
|
||||||
|
if (*src != '%')
|
||||||
|
{
|
||||||
|
while (*src != 0 && ptr-format<sizeof(format) && !isalpha(*ptr++ = *src++))
|
||||||
|
/*nothing*/;
|
||||||
|
*ptr = 0;
|
||||||
|
ZEROTERM(format);
|
||||||
|
--src;
|
||||||
|
vsprintf(outptr, format, ap);
|
||||||
|
// vsprintf doesnt alter the ap, increment here
|
||||||
|
switch (*(ptr-1))
|
||||||
|
{
|
||||||
|
case 'f':
|
||||||
|
va_arg(ap, double);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
va_arg(ap, char *);
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
case 'd':
|
||||||
|
case 'i':
|
||||||
|
default: // default: assume int-like parameter
|
||||||
|
va_arg(ap, int);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
outptr += strlen(outptr);
|
||||||
|
} else {
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
|
*outptr++ = '%';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
|
*outptr++ = *src;
|
||||||
|
}
|
||||||
|
++src;
|
||||||
|
}
|
||||||
|
CHECK_OUTPTR(1);
|
||||||
|
*outptr++ = 0;
|
||||||
|
return outbuf;
|
||||||
|
}
|
||||||
void CLangMngr::MergeDefinitions(const char *lang, CQueue<sKeyDef*> &tmpVec)
|
void CLangMngr::MergeDefinitions(const char *lang, CQueue<sKeyDef*> &tmpVec)
|
||||||
{
|
{
|
||||||
CLang * language = GetLang(lang);
|
CLang * language = GetLang(lang);
|
||||||
@ -938,7 +1025,7 @@ int CLangMngr::MergeDefinitionFile(const char *file)
|
|||||||
language[0] = buf[1];
|
language[0] = buf[1];
|
||||||
language[1] = buf[2];
|
language[1] = buf[2];
|
||||||
language[2] = 0;
|
language[2] = 0;
|
||||||
} else if (buf.size() > 4) {
|
} else {
|
||||||
if (!multiline)
|
if (!multiline)
|
||||||
{
|
{
|
||||||
pos = buf.find('=');
|
pos = buf.find('=');
|
||||||
|
@ -171,6 +171,7 @@ public:
|
|||||||
const char *Format(const char *src, ...);
|
const char *Format(const char *src, ...);
|
||||||
// Format a string for an AMX plugin
|
// Format a string for an AMX plugin
|
||||||
char *FormatAmxString(AMX *amx, cell *params, int parm, int &len);
|
char *FormatAmxString(AMX *amx, cell *params, int parm, int &len);
|
||||||
|
char *FormatString(const char *fmt, va_list &ap);
|
||||||
// Save
|
// Save
|
||||||
bool Save(const char *filename);
|
bool Save(const char *filename);
|
||||||
// Load
|
// Load
|
||||||
|
@ -126,8 +126,9 @@ pfnmodule_engine_g engModuleFunc = {
|
|||||||
// class CModule
|
// class CModule
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
|
|
||||||
CModule::CModule(const char* fname) : m_Filename(fname)
|
CModule::CModule(const char* fname)
|
||||||
{
|
{
|
||||||
|
m_Filename.assign(fname);
|
||||||
clear(false);
|
clear(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public:
|
|||||||
inline module_info_s* getInfo() const { return m_InfoOld; } // old
|
inline module_info_s* getInfo() const { return m_InfoOld; } // old
|
||||||
inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new
|
inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new
|
||||||
inline int getStatusValue() { return m_Status; }
|
inline int getStatusValue() { return m_Status; }
|
||||||
inline bool operator==( void* fname ) { return !strcmp( m_Filename.c_str() , (char*)fname ); }
|
inline bool operator==( const char* fname ) { return !strcmp( m_Filename.c_str() , fname ); }
|
||||||
inline bool isReloadable() { return m_Amxx ? ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)) : ( (m_Status==MODULE_LOADED) && (m_InfoOld->type==RELOAD_MODULE)); }
|
inline bool isReloadable() { return m_Amxx ? ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)) : ( (m_Status==MODULE_LOADED) && (m_InfoOld->type==RELOAD_MODULE)); }
|
||||||
inline bool isAmxx() const { return m_Amxx; }
|
inline bool isAmxx() const { return m_Amxx; }
|
||||||
inline const char *getMissingFunc() const { return m_MissingFunc; }
|
inline const char *getMissingFunc() const { return m_MissingFunc; }
|
||||||
|
@ -34,11 +34,11 @@
|
|||||||
#include "CForward.h"
|
#include "CForward.h"
|
||||||
#include "CFile.h"
|
#include "CFile.h"
|
||||||
|
|
||||||
CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error) {
|
CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error, int debug) {
|
||||||
CPlugin** a = &head;
|
CPlugin** a = &head;
|
||||||
while( *a ) a = &(*a)->next;
|
while( *a ) a = &(*a)->next;
|
||||||
*a = new CPlugin( pCounter++ ,path,name,error);
|
*a = new CPlugin( pCounter++ ,path,name,error, debug);
|
||||||
return *error ? 0 : *a;
|
return (*a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPluginMngr::unloadPlugin( CPlugin** a ) {
|
void CPluginMngr::unloadPlugin( CPlugin** a ) {
|
||||||
@ -59,20 +59,35 @@ int CPluginMngr::loadPluginsFromFile( const char* filename )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find now folder
|
// Find now folder
|
||||||
char pluginName[256], line[256], error[256];
|
char pluginName[256], line[256], error[256], debug[256];
|
||||||
const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxx/plugins");
|
int debugFlag = 0;
|
||||||
|
const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins");
|
||||||
|
|
||||||
|
|
||||||
while ( fp.getline(line , 255 ) )
|
while ( fp.getline(line , 255 ) )
|
||||||
{
|
{
|
||||||
*pluginName = 0;
|
*pluginName = 0;
|
||||||
sscanf(line,"%s",pluginName);
|
*debug = 0;
|
||||||
|
debugFlag = 0;
|
||||||
|
sscanf(line,"%s %s",pluginName, debug);
|
||||||
if (!isalnum(*pluginName)) continue;
|
if (!isalnum(*pluginName)) continue;
|
||||||
|
|
||||||
CPlugin* plugin = loadPlugin( pluginsDir , pluginName , error );
|
#ifdef JIT
|
||||||
|
if (isalnum(*debug) && strcmp(debug, "debug") == 0)
|
||||||
|
{
|
||||||
|
debugFlag = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!plugin)
|
CPlugin* plugin = loadPlugin( pluginsDir , pluginName , error, debugFlag);
|
||||||
AMXXLOG_Log("[AMXX] %s (plugin \"%s\")", error, pluginName );
|
|
||||||
|
if (plugin->getStatusCode() == ps_bad_load)
|
||||||
|
{
|
||||||
|
char errorMsg[255];
|
||||||
|
sprintf(errorMsg, "%s (plugin \"%s\")", error, pluginName);
|
||||||
|
plugin->setError(errorMsg);
|
||||||
|
AMXXLOG_Log("[AMXX] %s", plugin->getError());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pCounter;
|
return pCounter;
|
||||||
@ -87,10 +102,6 @@ void CPluginMngr::clear() {
|
|||||||
CPluginMngr::CPlugin* CPluginMngr::findPluginFast(AMX *amx)
|
CPluginMngr::CPlugin* CPluginMngr::findPluginFast(AMX *amx)
|
||||||
{
|
{
|
||||||
return (CPlugin*)(amx->userdata[3]);
|
return (CPlugin*)(amx->userdata[3]);
|
||||||
/*CPlugin*a = head;
|
|
||||||
while ( a && &a->amx != amx )
|
|
||||||
a=a->next;
|
|
||||||
return a;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CPluginMngr::CPlugin* CPluginMngr::findPlugin(AMX *amx) {
|
CPluginMngr::CPlugin* CPluginMngr::findPlugin(AMX *amx) {
|
||||||
@ -128,16 +139,20 @@ const char* CPluginMngr::CPlugin::getStatus() const {
|
|||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
CPluginMngr::CPlugin::CPlugin(int i, const char* p,const char* n, char* e) : name(n), title(n) {
|
CPluginMngr::CPlugin::CPlugin(int i, const char* p,const char* n, char* e, int d) : name(n), title(n) {
|
||||||
const char* unk = "unknown";
|
const char* unk = "unknown";
|
||||||
title.assign(unk);
|
title.assign(unk);
|
||||||
author.assign(unk);
|
author.assign(unk);
|
||||||
version.assign(unk);
|
version.assign(unk);
|
||||||
char* path = build_pathname("%s/%s",p,n);
|
char* path = build_pathname("%s/%s",p,n);
|
||||||
code = 0;
|
code = 0;
|
||||||
int err = load_amxscript(&amx,&code,path,e );
|
int err = load_amxscript(&amx,&code,path,e, d);
|
||||||
if ( err == AMX_ERR_NONE ) status = ps_running;
|
if ( err == AMX_ERR_NONE )
|
||||||
else status = ps_bad_load;
|
{
|
||||||
|
status = ps_running;
|
||||||
|
} else {
|
||||||
|
status = ps_bad_load;
|
||||||
|
}
|
||||||
amx.userdata[3] = this;
|
amx.userdata[3] = this;
|
||||||
paused_fun = 0;
|
paused_fun = 0;
|
||||||
next = 0;
|
next = 0;
|
||||||
|
@ -63,11 +63,12 @@ public:
|
|||||||
String version;
|
String version;
|
||||||
String title;
|
String title;
|
||||||
String author;
|
String author;
|
||||||
|
String errorMsg;
|
||||||
int paused_fun;
|
int paused_fun;
|
||||||
int status;
|
int status;
|
||||||
CPlugin* next;
|
CPlugin* next;
|
||||||
int id;
|
int id;
|
||||||
CPlugin(int i , const char* p,const char* n, char* e);
|
CPlugin(int i , const char* p,const char* n, char* e, int d);
|
||||||
~CPlugin( );
|
~CPlugin( );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -76,11 +77,14 @@ public:
|
|||||||
inline const char* getVersion() { return version.c_str();}
|
inline const char* getVersion() { return version.c_str();}
|
||||||
inline const char* getTitle() { return title.c_str();}
|
inline const char* getTitle() { return title.c_str();}
|
||||||
inline const char* getAuthor() { return author.c_str();}
|
inline const char* getAuthor() { return author.c_str();}
|
||||||
|
inline const char* getError() { return errorMsg.c_str();}
|
||||||
|
inline int getStatusCode() { return status; }
|
||||||
inline int getId() const { return id; }
|
inline int getId() const { return id; }
|
||||||
inline AMX* getAMX() { return &amx; }
|
inline AMX* getAMX() { return &amx; }
|
||||||
inline void setTitle( const char* n ) { title.assign(n); }
|
inline void setTitle( const char* n ) { title.assign(n); }
|
||||||
inline void setAuthor( const char* n ) { author.assign(n); }
|
inline void setAuthor( const char* n ) { author.assign(n); }
|
||||||
inline void setVersion( const char* n ) { version.assign(n); }
|
inline void setVersion( const char* n ) { version.assign(n); }
|
||||||
|
inline void setError( const char* n ) { errorMsg.assign(n); }
|
||||||
inline bool isValid() const { return ((status != ps_bad_load) && (status != ps_locked)); }
|
inline bool isValid() const { return ((status != ps_bad_load) && (status != ps_locked)); }
|
||||||
inline bool isPaused() const { return ( (status == ps_paused) || (status == ps_stopped)); }
|
inline bool isPaused() const { return ( (status == ps_paused) || (status == ps_stopped)); }
|
||||||
inline bool isFunctionPaused( int id ) const { return (paused_fun & (1<<id)) ? true : false; }
|
inline bool isFunctionPaused( int id ) const { return (paused_fun & (1<<id)) ? true : false; }
|
||||||
@ -104,7 +108,7 @@ public:
|
|||||||
|
|
||||||
// Interface
|
// Interface
|
||||||
|
|
||||||
CPlugin* loadPlugin(const char* path, const char* name, char* error);
|
CPlugin* loadPlugin(const char* path, const char* name, char* error, int debug);
|
||||||
void unloadPlugin( CPlugin** a );
|
void unloadPlugin( CPlugin** a );
|
||||||
int loadPluginsFromFile( const char* filename );
|
int loadPluginsFromFile( const char* filename );
|
||||||
CPlugin* findPluginFast(AMX *amx);
|
CPlugin* findPluginFast(AMX *amx);
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
void append(const char *t)
|
void append(const char *t)
|
||||||
{
|
{
|
||||||
Grow(cSize + strlen(t));
|
Grow(cSize + strlen(t) + 1);
|
||||||
strcat(v, t);
|
strcat(v, t);
|
||||||
cSize = strlen(v);
|
cSize = strlen(v);
|
||||||
}
|
}
|
||||||
|
@ -61,14 +61,11 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
|
|||||||
|
|
||||||
if (iParamsLen)
|
if (iParamsLen)
|
||||||
{
|
{
|
||||||
// also add a cell to the back with the value 0
|
|
||||||
m_iParamLen = iParamsLen + 1;
|
m_iParamLen = iParamsLen + 1;
|
||||||
m_pParams = new cell[m_iParamLen];
|
m_pParams = new cell[m_iParamLen];
|
||||||
memcpy(m_pParams, pParams, sizeof(cell)*iParamsLen);
|
memcpy(m_pParams, pParams, sizeof(cell)*iParamsLen);
|
||||||
m_pParams[iParamsLen] = 0;
|
m_pParams[iParamsLen] = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
m_iParamLen = 0;
|
m_iParamLen = 0;
|
||||||
m_pParams = NULL;
|
m_pParams = NULL;
|
||||||
}
|
}
|
||||||
@ -78,7 +75,10 @@ void CTaskMngr::CTask::clear()
|
|||||||
{
|
{
|
||||||
m_bFree = true;
|
m_bFree = true;
|
||||||
if (m_pParams)
|
if (m_pParams)
|
||||||
|
{
|
||||||
delete [] m_pParams;
|
delete [] m_pParams;
|
||||||
|
m_pParams = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTaskMngr::CTask::isFree() const
|
bool CTaskMngr::CTask::isFree() const
|
||||||
@ -114,28 +114,12 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
|
|||||||
|
|
||||||
if (execute)
|
if (execute)
|
||||||
{
|
{
|
||||||
if (m_pPlugin->isExecutable(m_iFunc))
|
if (m_iParamLen) // call with parameters
|
||||||
{
|
{
|
||||||
int err;
|
cell arr = prepareCellArray(m_pParams, m_iParamLen);
|
||||||
if (m_iParamLen) // call with parameters
|
executeForwards(m_iFunc, arr, m_iId);
|
||||||
{
|
} else {
|
||||||
cell amx_addr, *phys_addr;
|
executeForwards(m_iFunc, m_iId);
|
||||||
if (amx_Allot(m_pPlugin->getAMX(), m_iParamLen, &amx_addr, &phys_addr) != AMX_ERR_NONE)
|
|
||||||
AMXXLOG_Log("[AMXX] Failed to allocate AMX memory (task \"%d\") (plugin \"%s\")", m_iId, m_pPlugin->getName());
|
|
||||||
else
|
|
||||||
{
|
|
||||||
copy_amxmemory(phys_addr, m_pParams, m_iParamLen);
|
|
||||||
if ((err = amx_Exec(m_pPlugin->getAMX(), NULL, m_iFunc, 2, amx_addr, m_iId)) != AMX_ERR_NONE)
|
|
||||||
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (task \"%d\") (plugin \"%s\")", err, m_pPlugin->getAMX()->curline, m_iId, m_pPlugin->getName());
|
|
||||||
|
|
||||||
amx_Release(m_pPlugin->getAMX(), amx_addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((err = amx_Exec(m_pPlugin->getAMX(), NULL, m_iFunc, 1, m_iId)) != AMX_ERR_NONE)
|
|
||||||
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (task \"%d\") (plugin \"%s\")", err, m_pPlugin->getAMX()->curline, m_iId, m_pPlugin->getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set new exec time OR remove the task if needed
|
// set new exec time OR remove the task if needed
|
||||||
@ -145,6 +129,8 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unregisterSPForward(m_iFunc);
|
||||||
|
m_iFunc = 0;
|
||||||
m_bFree = true;
|
m_bFree = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,19 +54,19 @@ private:
|
|||||||
// execution
|
// execution
|
||||||
float m_fNextExecTime;
|
float m_fNextExecTime;
|
||||||
public:
|
public:
|
||||||
inline void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
|
void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
|
||||||
inline void clear();
|
void clear();
|
||||||
inline bool isFree() const;
|
bool isFree() const;
|
||||||
|
|
||||||
inline CPluginMngr::CPlugin *getPlugin() const;
|
CPluginMngr::CPlugin *getPlugin() const;
|
||||||
inline int getTaskId() const;
|
int getTaskId() const;
|
||||||
|
|
||||||
inline void executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft); // also removes the task if needed
|
void executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft); // also removes the task if needed
|
||||||
|
|
||||||
inline void changeBase(float fNewBase);
|
void changeBase(float fNewBase);
|
||||||
inline void resetNextExecTime(float fCurrentTime);
|
void resetNextExecTime(float fCurrentTime);
|
||||||
|
|
||||||
inline bool shouldRepeat();
|
bool shouldRepeat();
|
||||||
|
|
||||||
CTask();
|
CTask();
|
||||||
~CTask();
|
~CTask();
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#ifndef __CVECTOR_H__
|
#ifndef __CVECTOR_H__
|
||||||
#define __CVECTOR_H__
|
#define __CVECTOR_H__
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
// Vector
|
// Vector
|
||||||
template <class T> class CVector
|
template <class T> class CVector
|
||||||
{
|
{
|
||||||
@ -284,7 +286,7 @@ public:
|
|||||||
iterator iterAt(size_t pos)
|
iterator iterAt(size_t pos)
|
||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
return iterator(m_Data + pos);
|
return iterator(m_Data + pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +333,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[pos];
|
return m_Data[pos];
|
||||||
}
|
}
|
||||||
@ -340,7 +342,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[pos];
|
return m_Data[pos];
|
||||||
}
|
}
|
||||||
@ -359,7 +361,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[0];
|
return m_Data[0];
|
||||||
}
|
}
|
||||||
@ -368,7 +370,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[0];
|
return m_Data[0];
|
||||||
}
|
}
|
||||||
@ -377,7 +379,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[m_CurrentUsedSize - 1];
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
}
|
}
|
||||||
@ -386,7 +388,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[m_CurrentUsedSize - 1];
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
}
|
}
|
||||||
|
@ -101,15 +101,6 @@
|
|||||||
; to compute the destination address: It searches backwards now.
|
; to compute the destination address: It searches backwards now.
|
||||||
; 1999/07/08 MP - initial revision
|
; 1999/07/08 MP - initial revision
|
||||||
|
|
||||||
|
|
||||||
; Controls generation of LINE op-codes: 0 - no, all other values - yes
|
|
||||||
; Beware that, if set to 1, this makes the compiled code slower by a factor of
|
|
||||||
; up to 3!
|
|
||||||
;
|
|
||||||
; GWMV: to generate LINE opcode, %define ALLOWOPLINE
|
|
||||||
;
|
|
||||||
%undef ALLOWOPLINE
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; If this is set to 1 the JIT generates relocatable code for case tables, too.
|
; If this is set to 1 the JIT generates relocatable code for case tables, too.
|
||||||
; If set to 0, a faster variant for switch (using absolute addresses) is
|
; If set to 0, a faster variant for switch (using absolute addresses) is
|
||||||
@ -164,8 +155,9 @@ _alt: resd 1
|
|||||||
_reset_stk: resd 1
|
_reset_stk: resd 1
|
||||||
_reset_hea: resd 1
|
_reset_hea: resd 1
|
||||||
_syscall_d: resd 1
|
_syscall_d: resd 1
|
||||||
; the two fields below are for the JIT; they do not exist in
|
; the two fields below are for the JIT
|
||||||
; the non-JIT version of the abstract machine
|
; they are included in the non-JIT version for AMX Mod X
|
||||||
|
; this is to make sure that the structs match universally!
|
||||||
_reloc_size: resd 1 ; memory block for relocations
|
_reloc_size: resd 1 ; memory block for relocations
|
||||||
_code_size: resd 1 ; memory size of the native code
|
_code_size: resd 1 ; memory size of the native code
|
||||||
endstruc
|
endstruc
|
||||||
@ -230,6 +222,7 @@ DBG_SYMTAG equ 9
|
|||||||
|
|
||||||
AMX_FLAG_CHAR16 equ 0001h ; characters are 16-bit
|
AMX_FLAG_CHAR16 equ 0001h ; characters are 16-bit
|
||||||
AMX_FLAG_DEBUG equ 0002h ; symbolic info. available
|
AMX_FLAG_DEBUG equ 0002h ; symbolic info. available
|
||||||
|
AMX_FLAG_LINEOPS equ 0020h ; line ops should be parsed [load time only flag] - ~dvander
|
||||||
AMX_FLAG_BROWSE equ 4000h
|
AMX_FLAG_BROWSE equ 4000h
|
||||||
AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated
|
AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated
|
||||||
|
|
||||||
@ -791,7 +784,7 @@ OP_ALIGN_PRI:
|
|||||||
CHECKCODESIZE j_align_pri
|
CHECKCODESIZE j_align_pri
|
||||||
|
|
||||||
OP_ALIGN_ALT:
|
OP_ALIGN_ALT:
|
||||||
;nop;
|
;nop
|
||||||
mov eax,4
|
mov eax,4
|
||||||
sub eax,[ebx+4]
|
sub eax,[ebx+4]
|
||||||
mov dword [j_align_alt+1],eax
|
mov dword [j_align_alt+1],eax
|
||||||
@ -1734,13 +1727,29 @@ OP_FILE: ;opcode is simply ignored
|
|||||||
|
|
||||||
OP_LINE:
|
OP_LINE:
|
||||||
;nop;
|
;nop;
|
||||||
%ifndef ALLOWOPLINE
|
;~dvander - opline is now variable on compile time :]
|
||||||
|
;save registers
|
||||||
|
push eax
|
||||||
|
push ebp
|
||||||
|
;get .amx flags
|
||||||
|
mov ebp,[amxhead]
|
||||||
|
mov eax,[ebp+_h_flags]
|
||||||
|
;check to see if the flag has line ops
|
||||||
|
and eax,AMX_FLAG_LINEOPS
|
||||||
|
cmp eax,AMX_FLAG_LINEOPS
|
||||||
|
;restore registers
|
||||||
|
pop ebp
|
||||||
|
pop eax
|
||||||
|
;if so, skip down to debug compiler
|
||||||
|
je _go_debug
|
||||||
|
|
||||||
mov [ebx],edi ; no line number support: ignore opcode
|
mov [ebx],edi ; no line number support: ignore opcode
|
||||||
add ebx,12 ; move on to next opcode
|
add ebx,12 ; move on to next opcode
|
||||||
cmp ebx,[end_code]
|
cmp ebx,[end_code]
|
||||||
jae code_gen_done
|
jae code_gen_done
|
||||||
jmp dword [ebx] ; go on with the next opcode
|
jmp dword [ebx] ; go on with the next opcode
|
||||||
%else
|
|
||||||
|
_go_debug:
|
||||||
putval j_line+6
|
putval j_line+6
|
||||||
mov eax,[ebx+8]
|
mov eax,[ebx+8]
|
||||||
mov [j_line_sm],eax
|
mov [j_line_sm],eax
|
||||||
@ -1750,7 +1759,6 @@ OP_LINE:
|
|||||||
DD 0 ; space for curline
|
DD 0 ; space for curline
|
||||||
j_line_sm DD 0 ; space for curfile
|
j_line_sm DD 0 ; space for curfile
|
||||||
CHECKCODESIZE j_line
|
CHECKCODESIZE j_line
|
||||||
%endif
|
|
||||||
|
|
||||||
OP_SYMBOL: ;ignored
|
OP_SYMBOL: ;ignored
|
||||||
mov [ebx],edi
|
mov [ebx],edi
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
LIBRARY jits
|
|
||||||
DESCRIPTION "JIT for AMX Mod X"
|
|
||||||
EXPORTS
|
|
||||||
asm_runJIT @1
|
|
||||||
getMaxCodeSize @2
|
|
||||||
amx_exec_asm @3
|
|
||||||
amx_opcodelist @4
|
|
||||||
SECTIONS
|
|
||||||
.data READ WRITE
|
|
||||||
.code EXECUTE
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
amxmodx/JIT/jits.obj
Executable file
BIN
amxmodx/JIT/jits.obj
Executable file
Binary file not shown.
@ -12,23 +12,38 @@
|
|||||||
# amd64 - compile for AMD64 (impiles no jit)
|
# amd64 - compile for AMD64 (impiles no jit)
|
||||||
# proc=ix86 - assumed not amd64
|
# proc=ix86 - assumed not amd64
|
||||||
# clean - clean the specifications above
|
# clean - clean the specifications above
|
||||||
|
# asm - for ASM implementation
|
||||||
|
# !! TODO - add memory mananger support
|
||||||
|
# lineop - for JIT only, uses slow version
|
||||||
|
|
||||||
$PROJECT = "amxx_mm";
|
$PROJECT = "amxmodx_mm";
|
||||||
$sdk = "../hlsdk/SourceCode";
|
$sdk = "../hlsdk/SourceCode";
|
||||||
$mm = "../metamod/metamod";
|
$mm = "../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
$ccf = "cc";
|
||||||
|
$amd64_lstdc = "-lstdc++";
|
||||||
|
|
||||||
@CPP_SOURCE_FILES = ("meta_api.cpp", "CFile.cpp", "CVault.cpp", "vault.cpp", "float.cpp", "file.cpp", "modules.cpp", "CMisc.cpp", "CTask.cpp", "string.cpp", "amxmodx.cpp", "CEvent.cpp", "CCmd.cpp", "CLogEvent.cpp", "srvcmd.cpp", "strptime.cpp", "amxcore.cpp", "amxtime.cpp", "power.cpp", "amxxlog.cpp", "fakemeta.cpp", "MMGR/MMGR.cpp", "amxxfile.cpp", "CLang.cpp", "md5.cpp", "emsg.cpp", "CForward.cpp", "CPlugin.cpp", "CModule.cpp", "CMenu.cpp", "util.cpp");
|
@CPP_SOURCE_FILES = ("meta_api.cpp", "CFile.cpp", "CVault.cpp", "vault.cpp", "float.cpp", "file.cpp", "modules.cpp", "CMisc.cpp", "CTask.cpp", "string.cpp", "amxmodx.cpp", "CEvent.cpp", "CCmd.cpp", "CLogEvent.cpp", "srvcmd.cpp", "strptime.cpp", "amxcore.cpp", "amxtime.cpp", "power.cpp", "amxxlog.cpp", "fakemeta.cpp", "amxxfile.cpp", "CLang.cpp", "md5.cpp", "emsg.cpp", "CForward.cpp", "CPlugin.cpp", "CModule.cpp", "CMenu.cpp", "util.cpp");
|
||||||
|
|
||||||
@C_SOURCE_FILES = ();
|
@C_SOURCE_FILES = ();
|
||||||
my %OPTIONS, %OPT;
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
$OPT{"debug"} = "-g -ggdb";
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
while ($cmd = shift)
|
while ($cmd = shift)
|
||||||
{
|
{
|
||||||
|
if ($cmd =~ /asm/)
|
||||||
|
{
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
die "You cannot compile the ASM core with AMD64 yet.\n";
|
||||||
|
} else {
|
||||||
|
$OPTIONS{"asm"} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($cmd =~ /jit/)
|
if ($cmd =~ /jit/)
|
||||||
{
|
{
|
||||||
if ($OPTIONS{"amd64"})
|
if ($OPTIONS{"amd64"})
|
||||||
@ -38,9 +53,9 @@ while ($cmd = shift)
|
|||||||
$OPTIONS{"jit"} = 1;
|
$OPTIONS{"jit"} = 1;
|
||||||
}
|
}
|
||||||
} elsif ($cmd =~ /amd64/) {
|
} elsif ($cmd =~ /amd64/) {
|
||||||
if ($OPTIONS{"jit"})
|
if ($OPTIONS{"jit"} || $OPTIONS{"asm"})
|
||||||
{
|
{
|
||||||
die "You cannot compile the JIT and AMD64 yet.\n";
|
die "You cannot compile the JIT or ASM and AMD64 yet.\n";
|
||||||
} else {
|
} else {
|
||||||
$OPTIONS{"amd64"} = 1;
|
$OPTIONS{"amd64"} = 1;
|
||||||
}
|
}
|
||||||
@ -56,19 +71,26 @@ while ($cmd = shift)
|
|||||||
}
|
}
|
||||||
} elsif ($cmd =~ /clean/) {
|
} elsif ($cmd =~ /clean/) {
|
||||||
$OPTIONS{"clean"} = 1;
|
$OPTIONS{"clean"} = 1;
|
||||||
|
} elsif ($cmd =~ /lineop/) {
|
||||||
|
$OPTIONS{"lineop"} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = `gcc --version`;
|
$gcc = `$gccf --version`;
|
||||||
if ($gcc =~ /2\.9/)
|
if ($gcc =~ /2\.9/)
|
||||||
{
|
{
|
||||||
`ln -s amx.cpp amx.c`;
|
#if ($OPTIONS{"jit"})
|
||||||
push(@C_SOURCE_FILES, "amx.c");
|
#{
|
||||||
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
# push(@CPP_SOURCE_FILES, "amx.cpp");
|
||||||
|
# $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
|
# } else {
|
||||||
|
`ln -s amx.cpp amx.c`;
|
||||||
|
push(@C_SOURCE_FILES, "amx.c");
|
||||||
|
# }
|
||||||
} else {
|
} else {
|
||||||
if ($OPTIONS{"amd64"})
|
if ($OPTIONS{"amd64"})
|
||||||
{
|
{
|
||||||
`cp amx.cpp amx.c`;
|
`ln -s amx.cpp amx.c`;
|
||||||
push(@C_SOURCE_FILES, "amx.c");
|
push(@C_SOURCE_FILES, "amx.c");
|
||||||
} else {
|
} else {
|
||||||
push(@CPP_SOURCE_FILES, "amx.cpp");
|
push(@CPP_SOURCE_FILES, "amx.cpp");
|
||||||
@ -95,12 +117,17 @@ if ($OPTIONS{"debug"})
|
|||||||
|
|
||||||
if ($OPTIONS{"amd64"})
|
if ($OPTIONS{"amd64"})
|
||||||
{
|
{
|
||||||
$cflags .= " -m64 -DSMALL_CELL_SIZE=64 -DHAVE_I64 $cflags";
|
$cflags = " -m64 -DSMALL_CELL_SIZE=64 -DHAVE_I64 $cflags";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($OPTIONS{"jit"})
|
if ($OPTIONS{"jit"})
|
||||||
{
|
{
|
||||||
$cflags .= "-DJIT";
|
$cflags .= " -DJIT";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"asm"})
|
||||||
|
{
|
||||||
|
$cflags .= " -DASM32";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($OPTIONS{"debug"})
|
if ($OPTIONS{"debug"})
|
||||||
@ -129,8 +156,6 @@ if ($OPTIONS{"amd64"})
|
|||||||
if ($OPTIONS{"clean"})
|
if ($OPTIONS{"clean"})
|
||||||
{
|
{
|
||||||
`rm $outdir/*.o`;
|
`rm $outdir/*.o`;
|
||||||
`rm $outdir/MMGR/*.o`;
|
|
||||||
`rm $outdir/minilzo/*.o`;
|
|
||||||
`rm $outdir/$bin`;
|
`rm $outdir/$bin`;
|
||||||
die("Project cleaned.\n");
|
die("Project cleaned.\n");
|
||||||
}
|
}
|
||||||
@ -152,25 +177,32 @@ for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
if ($OPTIONS{"jit"})
|
if ($OPTIONS{"jit"})
|
||||||
{
|
{
|
||||||
push(@LINK, "JIT/jits.o");
|
if ($OPTIONS{"lineop"}) {
|
||||||
|
push(@LINK, "JIT/jits-lineop.o");
|
||||||
|
} else {
|
||||||
|
push(@LINK, "JIT/jits.o");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
push(@LINK, "zlib/libz64.a");
|
||||||
|
push(@LINK, $amd64_lstdc);
|
||||||
|
} else {
|
||||||
|
push(@LINK, "zlib/libz.a");
|
||||||
|
}
|
||||||
|
if ($OPTIONS{"asm"})
|
||||||
|
{
|
||||||
|
push(@LINK, "amxexecn.o");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(-d $outdir))
|
if (!(-d $outdir))
|
||||||
{
|
{
|
||||||
mkdir($outdir);
|
mkdir($outdir);
|
||||||
}
|
}
|
||||||
if (!(-d "$outdir/MMGR"))
|
|
||||||
{
|
|
||||||
mkdir("$outdir/MMGR");
|
|
||||||
}
|
|
||||||
if (!(-d "$outdir/JIT"))
|
if (!(-d "$outdir/JIT"))
|
||||||
{
|
{
|
||||||
mkdir("$outdir/JIT");
|
mkdir("$outdir/JIT");
|
||||||
}
|
}
|
||||||
if (!(-d "$outdir/minilzo"))
|
|
||||||
{
|
|
||||||
mkdir("$outdir/minilzo");
|
|
||||||
}
|
|
||||||
|
|
||||||
$inc = $OPTIONS{"include"};
|
$inc = $OPTIONS{"include"};
|
||||||
|
|
||||||
@ -180,13 +212,14 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.cpp/\.o/;
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "gcc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
|
`rm $ofile`;
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
}
|
}
|
||||||
@ -202,11 +235,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.c/\.o/;
|
$ofile =~ s/\.c/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$ccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -218,6 +251,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = "gcc $cflags -Lzlib/ -shared -ldl -lm @LINK -lz -o $outdir/$bin";
|
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
|
114
amxmodx/amx.cpp
114
amxmodx/amx.cpp
@ -21,7 +21,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
// not used
|
||||||
#define AMX_NODYNALOAD
|
#define AMX_NODYNALOAD
|
||||||
|
|
||||||
// bad bad workaround but we have to prevent a compiler crash :/
|
// bad bad workaround but we have to prevent a compiler crash :/
|
||||||
@ -51,27 +51,30 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined __LCC__ || defined __linux__
|
#if defined __LCC__ || defined __GNUC__
|
||||||
#include <wchar.h> /* for wcslen() */
|
#include <wchar.h> /* for wcslen() */
|
||||||
#endif
|
#endif
|
||||||
|
#if (defined _Windows && !defined AMX_NODYNALOAD) || (defined JIT && !defined __linux__)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// this file does not include amxmodx.h so we have to include the mem mngr here
|
// this file does not include amxmodx.h, so we have to include the memory manager here
|
||||||
#ifdef MEMORY_TEST
|
#ifdef MEMORY_TEST
|
||||||
#include "mmgr/mmgr.h"
|
#include "mmgr/mmgr.h"
|
||||||
#endif //MEMORY_TEST
|
#endif // MEMORY_TEST
|
||||||
|
|
||||||
#include "amx.h"
|
#include "amx.h"
|
||||||
|
|
||||||
#ifdef JIT
|
#ifdef JIT
|
||||||
# ifdef __WIN32__
|
# ifdef __WIN32__
|
||||||
# include <windows.h>
|
# include <windows.h> // DWORD, VirtualProtect, ...
|
||||||
# elif defined __linux__
|
# elif defined __linux__
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h> // mprotect, PROT_*
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# else
|
# else
|
||||||
// :TODO:
|
// :TODO:
|
||||||
# endif
|
# endif
|
||||||
#endif //JIT
|
#endif // JIT
|
||||||
|
|
||||||
/* When one or more of the AMX_funcname macris are defined, we want
|
/* When one or more of the AMX_funcname macris are defined, we want
|
||||||
* to compile only those functions. However, when none of these macros
|
* to compile only those functions. However, when none of these macros
|
||||||
@ -477,8 +480,13 @@ int AMXAPI amx_Debug(AMX *amx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined JIT
|
#if defined JIT
|
||||||
|
#if defined WIN32 || defined __cplusplus
|
||||||
extern "C" int AMXAPI getMaxCodeSize(void);
|
extern "C" int AMXAPI getMaxCodeSize(void);
|
||||||
extern "C" int AMXAPI asm_runJIT(void *sourceAMXbase, void *jumparray, void *compiledAMXbase);
|
extern "C" int AMXAPI asm_runJIT(void *sourceAMXbase, void *jumparray, void *compiledAMXbase);
|
||||||
|
#else
|
||||||
|
extern int AMXAPI getMaxCodeSize(void);
|
||||||
|
extern int AMXAPI asm_runJIT(void *sourceAMXbase, void *jumparray, void *compiledAMXbase);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SMALL_CELL_SIZE==16
|
#if SMALL_CELL_SIZE==16
|
||||||
@ -535,19 +543,16 @@ static int amx_BrowseRelocate(AMX *amx)
|
|||||||
if (debug)
|
if (debug)
|
||||||
amx->flags|=AMX_FLAG_DEBUG;
|
amx->flags|=AMX_FLAG_DEBUG;
|
||||||
|
|
||||||
#if (defined __GNUC__ || defined ASM32 || defined JIT) && !defined __64BIT__
|
#if defined __GNUC__ || defined ASM32 || defined JIT && !defined __64BIT__
|
||||||
amx_Exec(amx, (cell*)&opcode_list, 0, 0);
|
amx_Exec(amx, (cell*)&opcode_list, 0, 0);
|
||||||
#if !defined JIT
|
#if !defined JIT
|
||||||
/* to use direct system requests, a function pointer must fit in a cell;
|
amx->sysreq_d=(sizeof(AMX_NATIVE)<=sizeof(cell)) ? opcode_list[OP_SYSREQ_D] : 0;
|
||||||
* because the native function's address will be stored as the parameter
|
|
||||||
* of SYSREQ.D
|
|
||||||
*/
|
|
||||||
amx->sysreq_d= (sizeof(AMX_NATIVE)<=sizeof(cell)) ? opcode_list[OP_SYSREQ_D] : 0;
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
/* ANSI C
|
/* ANSI C
|
||||||
* to use direct system requests, a function pointer must fit in a cell;
|
* to use direct system requests, a function pointer must fit in a cell;
|
||||||
* see the comment above
|
* because the native function's address will be stored as the parameter
|
||||||
|
* of SYSREQ.D
|
||||||
*/
|
*/
|
||||||
amx->sysreq_d= (sizeof(AMX_NATIVE)<=sizeof(cell)) ? OP_SYSREQ_D : 0;
|
amx->sysreq_d= (sizeof(AMX_NATIVE)<=sizeof(cell)) ? OP_SYSREQ_D : 0;
|
||||||
#endif
|
#endif
|
||||||
@ -1049,19 +1054,16 @@ int AMXAPI amx_Init(AMX *amx,void *program)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else /* #if defined __WIN32 __ */
|
#else /* #if defined __WIN32 __ */
|
||||||
|
// DOS32 has no imposed limits on its segments.
|
||||||
|
#if defined __BORLANDC__ || defined __WATCOMC__
|
||||||
|
#pragma argsused
|
||||||
|
#endif
|
||||||
|
int memoryFullAccess( void* addr, int len ) { return 1; }
|
||||||
|
|
||||||
// TODO: Add cases for Linux, Unix, OS/2, ...
|
#if defined __BORLANDC__ || defined __WATCOMC__
|
||||||
|
#pragma argsused
|
||||||
// DOS32 has no imposed limits on its segments.
|
#endif
|
||||||
#if defined __BORLANDC__ || defined __WATCOMC__
|
int memorySetAccess( void* addr, int len, int access ) { return 1; }
|
||||||
#pragma argsused
|
|
||||||
#endif
|
|
||||||
int memoryFullAccess( void* addr, int len ) { return 1; }
|
|
||||||
|
|
||||||
#if defined __BORLANDC__ || defined __WATCOMC__
|
|
||||||
#pragma argsused
|
|
||||||
#endif
|
|
||||||
int memorySetAccess( void* addr, int len, int access ) { return 1; }
|
|
||||||
|
|
||||||
#endif /* #if defined __WIN32 __ */
|
#endif /* #if defined __WIN32 __ */
|
||||||
|
|
||||||
@ -1103,7 +1105,7 @@ int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code)
|
|||||||
*(cell *)((char*)native_code + hdr->dat + hdr->stp - sizeof(cell)) = 0;
|
*(cell *)((char*)native_code + hdr->dat + hdr->stp - sizeof(cell)) = 0;
|
||||||
amx->stk = amx->stp;
|
amx->stk = amx->stp;
|
||||||
|
|
||||||
memorySetAccess( asm_runJIT, 20000, mac );
|
memorySetAccess( (void*)asm_runJIT, 20000, mac );
|
||||||
return AMX_ERR_NONE;
|
return AMX_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1573,8 +1575,7 @@ static AMX_NATIVE findfunction(const char *name, AMX_NATIVE_INFO *list, int numb
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *no_function;
|
const char *no_function; // PM: Nice hack ;)
|
||||||
|
|
||||||
int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number)
|
int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number)
|
||||||
{
|
{
|
||||||
AMX_FUNCSTUB *func;
|
AMX_FUNCSTUB *func;
|
||||||
@ -1594,15 +1595,11 @@ int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number)
|
|||||||
if (func->address==0) {
|
if (func->address==0) {
|
||||||
/* this function is not yet located */
|
/* this function is not yet located */
|
||||||
funcptr=(list!=NULL) ? findfunction(GETENTRYNAME(hdr,func),list,number) : NULL;
|
funcptr=(list!=NULL) ? findfunction(GETENTRYNAME(hdr,func),list,number) : NULL;
|
||||||
/* on 64-bit architectures with, only the lower 32-bits of the address
|
|
||||||
* can be stored; hopefully, all addresses can be assumed to have the
|
|
||||||
* same value for the upper 32-bits
|
|
||||||
*/
|
|
||||||
if (funcptr!=NULL)
|
if (funcptr!=NULL)
|
||||||
func->address=(ucell)funcptr;
|
func->address=(ucell)funcptr;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
no_function = GETENTRYNAME(hdr,func);
|
no_function = GETENTRYNAME(hdr,func);
|
||||||
err=AMX_ERR_NOTFOUND;
|
err=AMX_ERR_NOTFOUND;
|
||||||
}
|
}
|
||||||
} /* if */
|
} /* if */
|
||||||
@ -1610,6 +1607,40 @@ int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number)
|
|||||||
} /* for */
|
} /* for */
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL null_native(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void amx_NullNativeTable(AMX *amx)
|
||||||
|
{
|
||||||
|
AMX_FUNCSTUB *func;
|
||||||
|
AMX_HEADER *hdr;
|
||||||
|
int i, numnatives;
|
||||||
|
|
||||||
|
hdr=(AMX_HEADER *)amx->base;
|
||||||
|
if (hdr == NULL)
|
||||||
|
return;
|
||||||
|
if (hdr->magic!=AMX_MAGIC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
numnatives = NUMENTRIES(hdr, natives, libraries);
|
||||||
|
|
||||||
|
func=GETENTRY(hdr, natives, 0);
|
||||||
|
|
||||||
|
for (i=0; i<numnatives; i++)
|
||||||
|
{
|
||||||
|
if (strcmp(GETENTRYNAME(hdr,func), "require_module")==0)
|
||||||
|
{
|
||||||
|
func->address = NULL;
|
||||||
|
} else {
|
||||||
|
func->address = (ucell)null_native;
|
||||||
|
}
|
||||||
|
func=(AMX_FUNCSTUB*)((unsigned char*)func+hdr->defsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* AMX_REGISTER || AMX_EXEC || AMX_INIT */
|
#endif /* AMX_REGISTER || AMX_EXEC || AMX_INIT */
|
||||||
|
|
||||||
#if defined AMX_NATIVEINFO
|
#if defined AMX_NATIVEINFO
|
||||||
@ -1634,7 +1665,7 @@ AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name, AMX_NATIVE func)
|
|||||||
#define CHKSTACK() if (stk>amx->stp) return AMX_ERR_STACKLOW
|
#define CHKSTACK() if (stk>amx->stp) return AMX_ERR_STACKLOW
|
||||||
#define CHKHEAP() if (hea<amx->hlw) return AMX_ERR_HEAPLOW
|
#define CHKHEAP() if (hea<amx->hlw) return AMX_ERR_HEAPLOW
|
||||||
|
|
||||||
#if defined __GNUC__ && !defined ASM32
|
#if defined __GNUC__ && !defined ASM32 && !defined JIT
|
||||||
/* GNU C version uses the "labels as values" extension to create
|
/* GNU C version uses the "labels as values" extension to create
|
||||||
* fast "indirect threaded" interpreter.
|
* fast "indirect threaded" interpreter.
|
||||||
*/
|
*/
|
||||||
@ -2736,7 +2767,11 @@ static void *amx_opcodelist_nodebug[] = {
|
|||||||
#endif
|
#endif
|
||||||
#elif defined __GNUC__
|
#elif defined __GNUC__
|
||||||
/* force "cdecl" by adding an "attribute" to the declaration */
|
/* force "cdecl" by adding an "attribute" to the declaration */
|
||||||
|
#if defined __cplusplus
|
||||||
extern "C" cell amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea) __attribute__((cdecl));
|
extern "C" cell amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea) __attribute__((cdecl));
|
||||||
|
#else
|
||||||
|
extern cell amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea) __attribute__((cdecl));
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
/* force "cdecl" by specifying it as a "function class" with the "__cdecl" keyword */
|
/* force "cdecl" by specifying it as a "function class" with the "__cdecl" keyword */
|
||||||
extern "C" cell __cdecl amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea);
|
extern "C" cell __cdecl amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea);
|
||||||
@ -2744,8 +2779,13 @@ static void *amx_opcodelist_nodebug[] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined ASM32 || defined JIT
|
#if defined ASM32 || defined JIT
|
||||||
|
#if defined WIN32 || defined __cplusplus
|
||||||
extern "C" void *amx_opcodelist[];
|
extern "C" void *amx_opcodelist[];
|
||||||
extern "C" void *amx_opcodelist_nodebug[];
|
extern "C" void *amx_opcodelist_nodebug[];
|
||||||
|
#else
|
||||||
|
extern void *amx_opcodelist[];
|
||||||
|
extern void *amx_opcodelist_nodebug[];
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
|
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
|
||||||
@ -4039,7 +4079,7 @@ static long utf8_lowmark[5] = { 0x80, 0x800, 0x10000, 0x200000, 0x4000000 };
|
|||||||
*/
|
*/
|
||||||
if (result<utf8_lowmark[followup])
|
if (result<utf8_lowmark[followup])
|
||||||
goto error;
|
goto error;
|
||||||
if (result>=0xd800 && result<=0xdfff || result==0xfffe || result==0xffff)
|
if ((result>=0xd800 && result<=0xdfff) || result==0xfffe || result==0xffff)
|
||||||
goto error;
|
goto error;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
|
@ -22,14 +22,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined __linux__
|
#if defined __linux__
|
||||||
#include "sclinux.h"
|
#include <sclinux.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef AMX_H_INCLUDED
|
#ifndef AMX_H_INCLUDED
|
||||||
#define AMX_H_INCLUDED
|
#define AMX_H_INCLUDED
|
||||||
|
|
||||||
//#define JIT
|
|
||||||
|
|
||||||
#if defined __LCC__ || defined __DMC__ || defined __linux__
|
#if defined __LCC__ || defined __DMC__ || defined __linux__
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
|
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
|
||||||
@ -219,11 +217,9 @@ typedef struct tagAMX {
|
|||||||
cell reset_stk PACKED;
|
cell reset_stk PACKED;
|
||||||
cell reset_hea PACKED;
|
cell reset_hea PACKED;
|
||||||
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
||||||
#if defined JIT
|
|
||||||
/* support variables for the JIT */
|
/* support variables for the JIT */
|
||||||
int reloc_size PACKED; /* required temporary buffer for relocations */
|
int reloc_size PACKED; /* required temporary buffer for relocations */
|
||||||
long code_size PACKED; /* estimated memory footprint of the native code */
|
long code_size PACKED; /* estimated memory footprint of the native code */
|
||||||
#endif
|
|
||||||
} AMX;
|
} AMX;
|
||||||
|
|
||||||
/* The AMX_HEADER structure is both the memory format as the file format. The
|
/* The AMX_HEADER structure is both the memory format as the file format. The
|
||||||
@ -297,6 +293,7 @@ enum {
|
|||||||
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */
|
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */
|
||||||
#define AMX_FLAG_BIGENDIAN 0x08 /* big endian encoding */
|
#define AMX_FLAG_BIGENDIAN 0x08 /* big endian encoding */
|
||||||
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking */
|
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking */
|
||||||
|
#define AMX_FLAG_LINEOPS 0x20 /* line ops are parsed by the JIT [loadtime only flag] */
|
||||||
#define AMX_FLAG_BROWSE 0x4000 /* browsing/relocating or executing */
|
#define AMX_FLAG_BROWSE 0x4000 /* browsing/relocating or executing */
|
||||||
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
|
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
|
||||||
|
|
||||||
@ -337,6 +334,7 @@ uint32_t * AMXAPI amx_Align32(uint32_t *v);
|
|||||||
#if defined _I64_MAX || defined HAVE_I64
|
#if defined _I64_MAX || defined HAVE_I64
|
||||||
uint64_t * AMXAPI amx_Align64(uint64_t *v);
|
uint64_t * AMXAPI amx_Align64(uint64_t *v);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SMALL_CELL_SIZE==32
|
#if SMALL_CELL_SIZE==32
|
||||||
#define amx_AlignCell amx_Align32
|
#define amx_AlignCell amx_Align32
|
||||||
#elif SMALL_CELL_SIZE==64
|
#elif SMALL_CELL_SIZE==64
|
||||||
@ -344,6 +342,7 @@ uint32_t * AMXAPI amx_Align32(uint32_t *v);
|
|||||||
#else
|
#else
|
||||||
#error Unsupported cell size
|
#error Unsupported cell size
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int AMXAPI amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr);
|
int AMXAPI amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr);
|
||||||
int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params);
|
int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params);
|
||||||
int AMXAPI amx_Cleanup(AMX *amx);
|
int AMXAPI amx_Cleanup(AMX *amx);
|
||||||
@ -383,7 +382,7 @@ int AMXAPI amx_StrLen(cell *cstring, int *length);
|
|||||||
int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);
|
int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);
|
||||||
int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
|
int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
|
||||||
int AMXAPI amx_UTF8Check(const char *string);
|
int AMXAPI amx_UTF8Check(const char *string);
|
||||||
|
void amx_NullNativeTable(AMX *amx);
|
||||||
|
|
||||||
#if !defined AMX_NO_ALIGN
|
#if !defined AMX_NO_ALIGN
|
||||||
#if defined __linux__
|
#if defined __linux__
|
||||||
|
2102
amxmodx/amxexecn.asm
Executable file
2102
amxmodx/amxexecn.asm
Executable file
File diff suppressed because it is too large
Load Diff
@ -70,8 +70,8 @@ static cell AMX_NATIVE_CALL emit_sound(AMX *amx, cell *params) /* 7 param */
|
|||||||
|
|
||||||
int len;
|
int len;
|
||||||
char* szSample = get_amxstring(amx,params[3],0,len);
|
char* szSample = get_amxstring(amx,params[3],0,len);
|
||||||
float vol = *(REAL *)((void *)¶ms[4]);
|
REAL vol = amx_ctof(params[4]);
|
||||||
float att = *(REAL *)((void *)¶ms[5]);
|
REAL att = amx_ctof(params[5]);
|
||||||
int channel = params[2];
|
int channel = params[2];
|
||||||
int pitch = params[7];
|
int pitch = params[7];
|
||||||
int flags = params[6];
|
int flags = params[6];
|
||||||
@ -273,13 +273,13 @@ static cell AMX_NATIVE_CALL set_hudmessage(AMX *amx, cell *params) /* 11 param
|
|||||||
g_hudset.r1 = params[1];
|
g_hudset.r1 = params[1];
|
||||||
g_hudset.g1 = params[2];
|
g_hudset.g1 = params[2];
|
||||||
g_hudset.b1 = params[3];
|
g_hudset.b1 = params[3];
|
||||||
g_hudset.x = *(REAL *)((void *)¶ms[4]);
|
g_hudset.x = amx_ctof(params[4]);
|
||||||
g_hudset.y = *(REAL *)((void *)¶ms[5]);
|
g_hudset.y = amx_ctof(params[5]);
|
||||||
g_hudset.effect = params[6];
|
g_hudset.effect = params[6];
|
||||||
g_hudset.fxTime = *(REAL *)((void *)¶ms[7]);
|
g_hudset.fxTime = amx_ctof(params[7]);
|
||||||
g_hudset.holdTime = *(REAL *)((void *)¶ms[8]);
|
g_hudset.holdTime = amx_ctof(params[8]);
|
||||||
g_hudset.fadeinTime = *(REAL *)((void *)¶ms[9]);
|
g_hudset.fadeinTime = amx_ctof(params[9]);
|
||||||
g_hudset.fadeoutTime = *(REAL *)((void *)¶ms[10]);
|
g_hudset.fadeoutTime = amx_ctof(params[10]);
|
||||||
g_hudset.channel = params[11];
|
g_hudset.channel = params[11];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1159,13 +1159,13 @@ static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */
|
|||||||
{
|
{
|
||||||
int ilen;
|
int ilen;
|
||||||
REAL pFloat = CVAR_GET_FLOAT(get_amxstring(amx,params[1],0,ilen));
|
REAL pFloat = CVAR_GET_FLOAT(get_amxstring(amx,params[1],0,ilen));
|
||||||
return *(cell*)((void *)&pFloat);
|
return amx_ftoc(pFloat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */
|
static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */
|
||||||
{
|
{
|
||||||
int ilen;
|
int ilen;
|
||||||
CVAR_SET_FLOAT(get_amxstring(amx,params[1],0,ilen),*(REAL *)((void *)¶ms[2]));
|
CVAR_SET_FLOAT(get_amxstring(amx,params[1],0,ilen), amx_ctof(params[2]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1584,7 +1584,7 @@ static cell AMX_NATIVE_CALL get_maxplayers(AMX *amx, cell *params)
|
|||||||
static cell AMX_NATIVE_CALL get_gametime(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_gametime(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
REAL pFloat = gpGlobals->time;
|
REAL pFloat = gpGlobals->time;
|
||||||
return *(cell*)((void *)&pFloat);
|
return amx_ftoc(pFloat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_mapname(AMX *amx, cell *params) /* 2 param */
|
static cell AMX_NATIVE_CALL get_mapname(AMX *amx, cell *params) /* 2 param */
|
||||||
@ -1676,23 +1676,27 @@ static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */
|
|||||||
|
|
||||||
char* stemp = get_amxstring(amx,params[2],1, a );
|
char* stemp = get_amxstring(amx,params[2],1, a );
|
||||||
|
|
||||||
if (amx_FindPublic(amx, stemp , &iFunc) != AMX_ERR_NONE){
|
if (params[5])
|
||||||
|
{
|
||||||
|
iFunc = registerSPForwardByName(amx, stemp, FP_ARRAY, FP_CELL, FP_DONE);
|
||||||
|
} else {
|
||||||
|
iFunc = registerSPForwardByName(amx, stemp, FP_CELL, FP_DONE);
|
||||||
|
}
|
||||||
|
if (iFunc == -1)
|
||||||
|
{
|
||||||
AMXXLOG_Log("[AMXX] Function is not present (function \"%s\") (plugin \"%s\")",stemp,plugin->getName() );
|
AMXXLOG_Log("[AMXX] Function is not present (function \"%s\") (plugin \"%s\")",stemp,plugin->getName() );
|
||||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float base = *(REAL *)((void *)¶ms[1]);
|
float base = amx_ctof(params[1]);
|
||||||
|
|
||||||
if ( base < 0.1 )
|
if ( base < 0.1 )
|
||||||
base = 0.1;
|
base = 0.1;
|
||||||
|
|
||||||
char* temp = get_amxstring(amx,params[6],0,a);
|
char* temp = get_amxstring(amx,params[6],0,a);
|
||||||
|
|
||||||
g_tasksMngr.registerTask( plugin ,
|
g_tasksMngr.registerTask( plugin , iFunc , UTIL_ReadFlags(temp), params[3], base , params[5] , get_amxaddr(amx,params[4]) , params[7] );
|
||||||
iFunc , UTIL_ReadFlags(temp), params[3], base ,
|
|
||||||
params[5] ,
|
|
||||||
get_amxaddr(amx,params[4]) , params[7] );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1728,7 +1732,7 @@ static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params) /* 3 param */
|
|||||||
{
|
{
|
||||||
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
|
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
|
||||||
CCVar* cvar = new CCVar( temp , plugin->getName() , params[3] ,
|
CCVar* cvar = new CCVar( temp , plugin->getName() , params[3] ,
|
||||||
*(REAL *)((void *)¶ms[4]) );
|
amx_ctof(params[4]) );
|
||||||
|
|
||||||
if ( cvar == 0 )
|
if ( cvar == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
@ -2011,10 +2015,10 @@ static cell AMX_NATIVE_CALL get_distance(AMX *amx, cell *params) /* 2 param */
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL random_float(AMX *amx, cell *params) /* 2 param */
|
static cell AMX_NATIVE_CALL random_float(AMX *amx, cell *params) /* 2 param */
|
||||||
{
|
{
|
||||||
float one = *(REAL *)((void *)¶ms[1]);
|
float one = amx_ctof(params[1]);
|
||||||
float two = *(REAL *)((void *)¶ms[2]);
|
float two = amx_ctof(params[2]);
|
||||||
REAL fRnd = RANDOM_FLOAT(one,two);
|
REAL fRnd = RANDOM_FLOAT(one,two);
|
||||||
return *(cell*)((void *)&fRnd);
|
return amx_ftoc(fRnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL random_num(AMX *amx, cell *params) /* 2 param */
|
static cell AMX_NATIVE_CALL random_num(AMX *amx, cell *params) /* 2 param */
|
||||||
@ -2253,7 +2257,7 @@ static cell AMX_NATIVE_CALL is_module_loaded(AMX *amx, cell *params)
|
|||||||
int len;
|
int len;
|
||||||
char *name = get_amxstring(amx, params[1], 0, len);
|
char *name = get_amxstring(amx, params[1], 0, len);
|
||||||
int id = 0;
|
int id = 0;
|
||||||
for (CList<CModule>::iterator iter = g_modules.begin(); iter; ++iter)
|
for (CList<CModule,const char *>::iterator iter = g_modules.begin(); iter; ++iter)
|
||||||
{
|
{
|
||||||
if (stricmp((*iter).getName(), name) == 0)
|
if (stricmp((*iter).getName(), name) == 0)
|
||||||
return id;
|
return id;
|
||||||
@ -2286,7 +2290,7 @@ static cell AMX_NATIVE_CALL get_modulesnum(AMX *amx, cell *params)
|
|||||||
// native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status);
|
// native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status);
|
||||||
static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator moduleIter;
|
CList<CModule,const char *>::iterator moduleIter;
|
||||||
|
|
||||||
// find the module
|
// find the module
|
||||||
int i = params[1];
|
int i = params[1];
|
||||||
@ -2469,7 +2473,7 @@ static cell AMX_NATIVE_CALL callfunc_end(AMX *amx, cell *params)
|
|||||||
|
|
||||||
// native callfunc_push_int(value);
|
// native callfunc_push_int(value);
|
||||||
// native callfunc_push_float(Float: value);
|
// native callfunc_push_float(Float: value);
|
||||||
static cell callfunc_push_byval(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL callfunc_push_byval(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
|
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
|
||||||
if (!g_CallFunc_Plugin)
|
if (!g_CallFunc_Plugin)
|
||||||
@ -2495,7 +2499,7 @@ static cell callfunc_push_byval(AMX *amx, cell *params)
|
|||||||
|
|
||||||
// native callfunc_push_intref(&value);
|
// native callfunc_push_intref(&value);
|
||||||
// native callfunc_push_floatref(Float: &value);
|
// native callfunc_push_floatref(Float: &value);
|
||||||
static cell callfunc_push_byref(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL callfunc_push_byref(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
|
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
|
||||||
if (!g_CallFunc_Plugin)
|
if (!g_CallFunc_Plugin)
|
||||||
@ -2553,7 +2557,7 @@ static cell callfunc_push_byref(AMX *amx, cell *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// native callfunc_push_str(value[]);
|
// native callfunc_push_str(value[]);
|
||||||
static cell callfunc_push_str(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL callfunc_push_str(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
|
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
|
||||||
if (!g_CallFunc_Plugin)
|
if (!g_CallFunc_Plugin)
|
||||||
@ -2614,34 +2618,54 @@ static cell callfunc_push_str(AMX *amx, cell *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get_langsnum();
|
// get_langsnum();
|
||||||
static cell get_langsnum(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_langsnum(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return g_langMngr.GetLangsNum();
|
return g_langMngr.GetLangsNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get_lang(id, name[(at least 3)]);
|
// get_lang(id, name[(at least 3)]);
|
||||||
static cell get_lang(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_lang(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
set_amxstring(amx, params[2], g_langMngr.GetLangName(params[1]), 2);
|
set_amxstring(amx, params[2], g_langMngr.GetLangName(params[1]), 2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// register_dictionary(const filename[]);
|
// register_dictionary(const filename[]);
|
||||||
static cell register_dictionary(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL register_dictionary(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int result = g_langMngr.MergeDefinitionFile(build_pathname("%s/lang/%s",
|
int result = g_langMngr.MergeDefinitionFile(build_pathname("%s/lang/%s",
|
||||||
get_localinfo("amxx_datadir", "addons/amxx/data"), get_amxstring(amx, params[1], 1, len)));
|
get_localinfo("amxx_datadir", "addons/amxmodx/data"), get_amxstring(amx, params[1], 1, len)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL plugin_flags(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
AMX_HEADER *hdr;
|
||||||
|
hdr = (AMX_HEADER *)amx->base;
|
||||||
|
return hdr->flags;
|
||||||
|
}
|
||||||
|
|
||||||
// lang_exists(const name[]);
|
// lang_exists(const name[]);
|
||||||
static cell lang_exists(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL lang_exists(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
return g_langMngr.LangExists(get_amxstring(amx, params[1], 1, len)) ? 1 : 0;
|
return g_langMngr.LangExists(get_amxstring(amx, params[1], 1, len)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
s.assign(get_amxstring(amx, params[1], 0, len));
|
||||||
|
|
||||||
|
CurModuleList.push(s);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO amxmod_Natives[] = {
|
AMX_NATIVE_INFO amxmod_Natives[] = {
|
||||||
{ "client_cmd", client_cmd },
|
{ "client_cmd", client_cmd },
|
||||||
{ "client_print", client_print },
|
{ "client_print", client_print },
|
||||||
@ -2741,6 +2765,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
|||||||
{ "register_logevent",register_logevent},
|
{ "register_logevent",register_logevent},
|
||||||
{ "register_menucmd", register_menucmd },
|
{ "register_menucmd", register_menucmd },
|
||||||
{ "register_menuid", register_menuid },
|
{ "register_menuid", register_menuid },
|
||||||
|
{ "require_module", require_module },
|
||||||
{ "register_plugin", register_plugin },
|
{ "register_plugin", register_plugin },
|
||||||
{ "register_srvcmd", register_srvcmd },
|
{ "register_srvcmd", register_srvcmd },
|
||||||
{ "remove_cvar_flags", remove_cvar_flags },
|
{ "remove_cvar_flags", remove_cvar_flags },
|
||||||
@ -2798,5 +2823,6 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
|||||||
{ "lang_exists", lang_exists },
|
{ "lang_exists", lang_exists },
|
||||||
{ "md5", amx_md5 },
|
{ "md5", amx_md5 },
|
||||||
{ "md5_file", amx_md5_file },
|
{ "md5_file", amx_md5_file },
|
||||||
|
{ "plugin_flags", plugin_flags},
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
@ -140,7 +140,7 @@ extern CList<CCVar> g_cvars;
|
|||||||
extern CList<ForceObject> g_forcemodels;
|
extern CList<ForceObject> g_forcemodels;
|
||||||
extern CList<ForceObject> g_forcesounds;
|
extern CList<ForceObject> g_forcesounds;
|
||||||
extern CList<ForceObject> g_forcegeneric;
|
extern CList<ForceObject> g_forcegeneric;
|
||||||
extern CList<CModule> g_modules;
|
extern CList<CModule,const char *> g_modules;
|
||||||
extern CList<CPlayer*> g_auth;
|
extern CList<CPlayer*> g_auth;
|
||||||
extern EventsMngr g_events;
|
extern EventsMngr g_events;
|
||||||
extern Grenades g_grenades;
|
extern Grenades g_grenades;
|
||||||
@ -157,7 +157,6 @@ extern XVars g_xvars;
|
|||||||
extern bool g_bmod_cstrike;
|
extern bool g_bmod_cstrike;
|
||||||
extern bool g_bmod_dod;
|
extern bool g_bmod_dod;
|
||||||
extern bool g_dontprecache;
|
extern bool g_dontprecache;
|
||||||
extern bool g_initialized;
|
|
||||||
extern int g_srvindex;
|
extern int g_srvindex;
|
||||||
extern cvar_t* amxmodx_version;
|
extern cvar_t* amxmodx_version;
|
||||||
extern cvar_t* hostname;
|
extern cvar_t* hostname;
|
||||||
@ -243,7 +242,7 @@ AMX* get_amxscript(int, void**,const char**);
|
|||||||
const char* get_amxscriptname(AMX* amx);
|
const char* get_amxscriptname(AMX* amx);
|
||||||
char* get_amxstring(AMX *amx,cell amx_addr,int id,int& len);
|
char* get_amxstring(AMX *amx,cell amx_addr,int id,int& len);
|
||||||
int amxstring_len(cell* cstr);
|
int amxstring_len(cell* cstr);
|
||||||
int load_amxscript(AMX* amx, void** program, const char* path, char error[64]);
|
int load_amxscript(AMX* amx, void** program, const char* path, char error[64], int debug);
|
||||||
int set_amxnatives(AMX* amx,char error[64]);
|
int set_amxnatives(AMX* amx,char error[64]);
|
||||||
int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max);
|
int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max);
|
||||||
int unload_amxscript(AMX* amx,void** program);
|
int unload_amxscript(AMX* amx,void** program);
|
||||||
@ -255,6 +254,7 @@ void* alloc_amxmemory(void**, int size);
|
|||||||
void free_amxmemory(void **ptr);
|
void free_amxmemory(void **ptr);
|
||||||
// get_localinfo
|
// get_localinfo
|
||||||
const char* get_localinfo( const char* name , const char* def );
|
const char* get_localinfo( const char* name , const char* def );
|
||||||
|
cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params);
|
||||||
|
|
||||||
enum ModuleCallReason
|
enum ModuleCallReason
|
||||||
{
|
{
|
||||||
@ -267,6 +267,7 @@ enum ModuleCallReason
|
|||||||
extern ModuleCallReason g_ModuleCallReason; // modules.cpp
|
extern ModuleCallReason g_ModuleCallReason; // modules.cpp
|
||||||
extern CModule *g_CurrentlyCalledModule; // modules.cpp
|
extern CModule *g_CurrentlyCalledModule; // modules.cpp
|
||||||
extern const char *g_LastRequestedFunc; // modules.cpp
|
extern const char *g_LastRequestedFunc; // modules.cpp
|
||||||
|
extern CQueue<String> CurModuleList;
|
||||||
|
|
||||||
void *Module_ReqFnptr(const char *funcName); // modules.cpp
|
void *Module_ReqFnptr(const char *funcName); // modules.cpp
|
||||||
|
|
||||||
|
@ -270,6 +270,7 @@ CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
|
|||||||
// AMXXLOG_Log("|||| First Bytes: %d %d %d %d", tempBuffer[0], tempBuffer[1], tempBuffer[2], tempBuffer[3]);
|
// AMXXLOG_Log("|||| First Bytes: %d %d %d %d", tempBuffer[0], tempBuffer[1], tempBuffer[2], tempBuffer[3]);
|
||||||
int result = uncompress((Bytef *)buffer, &destLen,
|
int result = uncompress((Bytef *)buffer, &destLen,
|
||||||
(Bytef *)tempBuffer, m_SectionLength);
|
(Bytef *)tempBuffer, m_SectionLength);
|
||||||
|
delete [] tempBuffer;
|
||||||
// AMXXLOG_Log("|||| Result: %d, m_SectionLength=%d, destLen=%d", result, m_SectionLength, destLen);
|
// AMXXLOG_Log("|||| Result: %d, m_SectionLength=%d, destLen=%d", result, m_SectionLength, destLen);
|
||||||
if (result != Z_OK)
|
if (result != Z_OK)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "amxmodx.h"
|
#include "amxmodx.h"
|
||||||
|
|
||||||
|
#ifndef __linux__
|
||||||
|
#define vsnprintf _vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
CLog::CLog()
|
CLog::CLog()
|
||||||
{
|
{
|
||||||
m_LogType = 0;
|
m_LogType = 0;
|
||||||
@ -158,7 +162,7 @@ void CLog::Log(const char *fmt, ...)
|
|||||||
|
|
||||||
va_list arglst;
|
va_list arglst;
|
||||||
va_start(arglst, fmt);
|
va_start(arglst, fmt);
|
||||||
vsprintf(msg, fmt, arglst);
|
vsnprintf(msg, 3071, fmt, arglst);
|
||||||
va_end(arglst);
|
va_end(arglst);
|
||||||
|
|
||||||
FILE *pF;
|
FILE *pF;
|
||||||
@ -181,9 +185,18 @@ void CLog::Log(const char *fmt, ...)
|
|||||||
{
|
{
|
||||||
pF = fopen(build_pathname("%s/L%02d%02d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday), "a+");
|
pF = fopen(build_pathname("%s/L%02d%02d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday), "a+");
|
||||||
}
|
}
|
||||||
fprintf(pF, "L %s: %s\n", date, msg);
|
if (pF)
|
||||||
|
{
|
||||||
|
fprintf(pF, "L %s: %s\n", date, msg);
|
||||||
|
fclose(pF);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", m_LogFile.c_str());
|
||||||
|
m_LogType = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fclose(pF);
|
|
||||||
// print on server console
|
// print on server console
|
||||||
print_srvconsole("L %s: %s\n", date, msg);
|
print_srvconsole("L %s: %s\n", date, msg);
|
||||||
}
|
}
|
||||||
@ -194,7 +207,7 @@ void CLog::Log(const char *fmt, ...)
|
|||||||
char msg[3072];
|
char msg[3072];
|
||||||
va_list arglst;
|
va_list arglst;
|
||||||
va_start(arglst, fmt);
|
va_start(arglst, fmt);
|
||||||
vsprintf(msg, fmt, arglst);
|
vsnprintf(msg, 3071, fmt, arglst);
|
||||||
va_end(arglst);
|
va_end(arglst);
|
||||||
ALERT(at_logged, "%s\n", msg);
|
ALERT(at_logged, "%s\n", msg);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@
|
|||||||
prev_mres = mres; \
|
prev_mres = mres; \
|
||||||
if (mres == MRES_UNSET) \
|
if (mres == MRES_UNSET) \
|
||||||
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
||||||
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \
|
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
/* Set meta result to the highest value */ \
|
/* Set meta result to the highest value */ \
|
||||||
@ -353,7 +353,7 @@
|
|||||||
prev_mres = mres; \
|
prev_mres = mres; \
|
||||||
if (mres == MRES_UNSET) \
|
if (mres == MRES_UNSET) \
|
||||||
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
||||||
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \
|
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
/* Set meta result to the highest value */ \
|
/* Set meta result to the highest value */ \
|
||||||
@ -379,7 +379,7 @@
|
|||||||
prev_mres = mres; \
|
prev_mres = mres; \
|
||||||
if (mres == MRES_UNSET) \
|
if (mres == MRES_UNSET) \
|
||||||
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
||||||
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \
|
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
/* Set meta result to the highest value */ \
|
/* Set meta result to the highest value */ \
|
||||||
@ -412,7 +412,10 @@
|
|||||||
prev_mres = mres; \
|
prev_mres = mres; \
|
||||||
if (mres == MRES_UNSET) \
|
if (mres == MRES_UNSET) \
|
||||||
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
|
||||||
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \
|
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
|
||||||
|
if (mres == MRES_SUPERCEDE) \
|
||||||
|
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has set meta result in \"%s\" to supercede", \
|
||||||
|
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
/* Set meta result to the highest value */ \
|
/* Set meta result to the highest value */ \
|
||||||
@ -2700,7 +2703,7 @@ int CFakeMeta::GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *int
|
|||||||
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy( pNewFunctionTable, &g_NewDllFunctionTable, sizeof( DLL_FUNCTIONS ) );
|
memcpy( pNewFunctionTable, &g_NewDllFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) );
|
||||||
|
|
||||||
// Make sure there is a core plugin
|
// Make sure there is a core plugin
|
||||||
AddCorePlugin();
|
AddCorePlugin();
|
||||||
@ -2735,7 +2738,7 @@ int CFakeMeta::GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int
|
|||||||
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy( pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof( DLL_FUNCTIONS ) );
|
memcpy( pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof( NEW_DLL_FUNCTIONS ) );
|
||||||
|
|
||||||
// Make sure there is a core plugin
|
// Make sure there is a core plugin
|
||||||
AddCorePlugin();
|
AddCorePlugin();
|
||||||
|
@ -37,6 +37,19 @@
|
|||||||
|
|
||||||
#define PI 3.1415926535897932384626433832795
|
#define PI 3.1415926535897932384626433832795
|
||||||
|
|
||||||
|
static REAL FromRadians(REAL angle, int radix)
|
||||||
|
{
|
||||||
|
switch (radix)
|
||||||
|
{
|
||||||
|
case 1: /* degrees, sexagesimal system (technically: degrees/minutes/seconds) */
|
||||||
|
return (REAL)(angle / PI * 180.0);
|
||||||
|
case 2: /* grades, centesimal system */
|
||||||
|
return (REAL)(angle / PI * 200.0);
|
||||||
|
default: /* assume already radian */
|
||||||
|
return angle;
|
||||||
|
} /* switch */
|
||||||
|
}
|
||||||
|
|
||||||
#if defined __BORLANDC__ || defined __WATCOMC__
|
#if defined __BORLANDC__ || defined __WATCOMC__
|
||||||
#pragma argsused
|
#pragma argsused
|
||||||
#endif
|
#endif
|
||||||
@ -357,6 +370,7 @@ static cell AMX_NATIVE_CALL n_floatatan(AMX *amx, cell *params)
|
|||||||
REAL fA = amx_ctof(params[1]);
|
REAL fA = amx_ctof(params[1]);
|
||||||
fA = ToRadians(fA, params[2]);
|
fA = ToRadians(fA, params[2]);
|
||||||
fA = atan(fA);
|
fA = atan(fA);
|
||||||
|
fA = FromRadians(fA, params[2]);
|
||||||
return amx_ftoc(fA);
|
return amx_ftoc(fA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,8 +385,8 @@ static cell AMX_NATIVE_CALL n_floatacos(AMX *amx, cell *params)
|
|||||||
* params[2] = radix
|
* params[2] = radix
|
||||||
*/
|
*/
|
||||||
REAL fA = amx_ctof(params[1]);
|
REAL fA = amx_ctof(params[1]);
|
||||||
fA = ToRadians(fA, params[2]);
|
|
||||||
fA = acos(fA);
|
fA = acos(fA);
|
||||||
|
fA = FromRadians(fA, params[2]);
|
||||||
return amx_ftoc(fA);
|
return amx_ftoc(fA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,8 +401,8 @@ static cell AMX_NATIVE_CALL n_floatasin(AMX *amx, cell *params)
|
|||||||
* params[2] = radix
|
* params[2] = radix
|
||||||
*/
|
*/
|
||||||
REAL fA = amx_ctof(params[1]);
|
REAL fA = amx_ctof(params[1]);
|
||||||
fA = ToRadians(fA, params[2]);
|
|
||||||
fA = asin(fA);
|
fA = asin(fA);
|
||||||
|
fA = FromRadians(fA, params[2]);
|
||||||
return amx_ftoc(fA);
|
return amx_ftoc(fA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,6 +421,7 @@ static cell AMX_NATIVE_CALL n_floatatan2(AMX *amx, cell *params)
|
|||||||
REAL fB = amx_ctof(params[2]);
|
REAL fB = amx_ctof(params[2]);
|
||||||
REAL fC;
|
REAL fC;
|
||||||
fC = atan2(fA, fB);
|
fC = atan2(fA, fB);
|
||||||
|
fC = FromRadians(fC, params[3]);
|
||||||
return amx_ftoc(fC);
|
return amx_ftoc(fC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ void (*function)(void*);
|
|||||||
void (*endfunction)(void*);
|
void (*endfunction)(void*);
|
||||||
|
|
||||||
CLog g_log;
|
CLog g_log;
|
||||||
|
CQueue<String> CurModuleList;
|
||||||
CForwardMngr g_forwards;
|
CForwardMngr g_forwards;
|
||||||
CList<CPlayer*> g_auth;
|
CList<CPlayer*> g_auth;
|
||||||
CList<CCVar> g_cvars;
|
CList<CCVar> g_cvars;
|
||||||
@ -81,7 +82,6 @@ bool g_bmod_dod;
|
|||||||
bool g_dontprecache;
|
bool g_dontprecache;
|
||||||
bool g_forcedmodules;
|
bool g_forcedmodules;
|
||||||
bool g_forcedsounds;
|
bool g_forcedsounds;
|
||||||
bool g_initialized;
|
|
||||||
fakecmd_t g_fakecmd;
|
fakecmd_t g_fakecmd;
|
||||||
float g_game_restarting;
|
float g_game_restarting;
|
||||||
float g_game_timeleft;
|
float g_game_timeleft;
|
||||||
@ -105,6 +105,7 @@ int g_srvindex;
|
|||||||
|
|
||||||
cvar_t init_amxmodx_version = {"amxmodx_version", "", FCVAR_SERVER | FCVAR_SPONLY};
|
cvar_t init_amxmodx_version = {"amxmodx_version", "", FCVAR_SERVER | FCVAR_SPONLY};
|
||||||
cvar_t init_amxmodx_modules = {"amxmodx_modules", "", FCVAR_SPONLY};
|
cvar_t init_amxmodx_modules = {"amxmodx_modules", "", FCVAR_SPONLY};
|
||||||
|
cvar_t init_amxmodx_debug = {"amx_debug", "", FCVAR_SPONLY};
|
||||||
cvar_t* amxmodx_version = NULL;
|
cvar_t* amxmodx_version = NULL;
|
||||||
cvar_t* amxmodx_modules = NULL;
|
cvar_t* amxmodx_modules = NULL;
|
||||||
cvar_t* hostname = NULL;
|
cvar_t* hostname = NULL;
|
||||||
@ -128,8 +129,8 @@ int FF_ChangeLevel = -1;
|
|||||||
// fake metamod api
|
// fake metamod api
|
||||||
CFakeMeta g_FakeMeta;
|
CFakeMeta g_FakeMeta;
|
||||||
|
|
||||||
// Precache stuff from force consistency calls
|
// Precache stuff from force consistency calls
|
||||||
// or check for pointed files won't be done
|
// or check for pointed files won't be done
|
||||||
int C_PrecacheModel(char *s) {
|
int C_PrecacheModel(char *s) {
|
||||||
if ( !g_forcedmodules ){
|
if ( !g_forcedmodules ){
|
||||||
g_forcedmodules = true;
|
g_forcedmodules = true;
|
||||||
@ -157,8 +158,8 @@ int C_PrecacheSound(char *s) {
|
|||||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On InconsistentFile call forward function from plugins
|
// On InconsistentFile call forward function from plugins
|
||||||
int C_InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message )
|
int C_InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message )
|
||||||
{
|
{
|
||||||
if (FF_InconsistentFile < 0)
|
if (FF_InconsistentFile < 0)
|
||||||
RETURN_META_VALUE(MRES_IGNORED, FALSE);
|
RETURN_META_VALUE(MRES_IGNORED, FALSE);
|
||||||
@ -190,19 +191,15 @@ const char* get_localinfo( const char* name , const char* def )
|
|||||||
{
|
{
|
||||||
const char* b = LOCALINFO( (char*)name );
|
const char* b = LOCALINFO( (char*)name );
|
||||||
if ( b == 0 || *b == 0 )
|
if ( b == 0 || *b == 0 )
|
||||||
SET_LOCALINFO((char*)name,(char*)(b = def) );
|
SET_LOCALINFO((char*)name,(char*)(b = def) );
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Very first point at map load
|
// Very first point at map load
|
||||||
// Load AMX modules for new native functions
|
// Load AMX modules for new native functions
|
||||||
// Initialize AMX stuff and load it's plugins from plugins.ini list
|
// Initialize AMX stuff and load it's plugins from plugins.ini list
|
||||||
// Call precache forward function from plugins
|
// Call precache forward function from plugins
|
||||||
int C_Spawn( edict_t *pent ) {
|
int C_Spawn( edict_t *pent ) {
|
||||||
|
|
||||||
if ( g_initialized ) RETURN_META_VALUE(MRES_IGNORED, 0);
|
|
||||||
|
|
||||||
g_initialized = true;
|
|
||||||
g_forcedmodules = false;
|
g_forcedmodules = false;
|
||||||
g_forcedsounds = false;
|
g_forcedsounds = false;
|
||||||
|
|
||||||
@ -211,34 +208,35 @@ int C_Spawn( edict_t *pent ) {
|
|||||||
hostname = CVAR_GET_POINTER("hostname");
|
hostname = CVAR_GET_POINTER("hostname");
|
||||||
mp_timelimit = CVAR_GET_POINTER("mp_timelimit");
|
mp_timelimit = CVAR_GET_POINTER("mp_timelimit");
|
||||||
|
|
||||||
|
g_forwards.clear();
|
||||||
|
|
||||||
g_log.MapChange();
|
g_log.MapChange();
|
||||||
|
|
||||||
// ###### Initialize task manager
|
// ###### Initialize task manager
|
||||||
g_tasksMngr.registerTimers( &gpGlobals->time, &mp_timelimit->value, &g_game_timeleft );
|
g_tasksMngr.registerTimers( &gpGlobals->time, &mp_timelimit->value, &g_game_timeleft );
|
||||||
|
|
||||||
// ###### Load lang
|
// ###### Load lang
|
||||||
g_langMngr.LoadCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxx/data")));
|
g_langMngr.LoadCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
|
||||||
g_langMngr.Load(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxx/data")));
|
g_langMngr.Load(build_pathname("%s/languages.dat", get_localinfo("amxmodx_datadir", "addons/amxmodx/data")));
|
||||||
// ###### Initialize commands prefixes
|
// ###### Initialize commands prefixes
|
||||||
g_commands.registerPrefix( "amx" );
|
g_commands.registerPrefix( "amx" );
|
||||||
g_commands.registerPrefix( "amxx" );
|
g_commands.registerPrefix( "amxx" );
|
||||||
g_commands.registerPrefix( "say" );
|
g_commands.registerPrefix( "say" );
|
||||||
g_commands.registerPrefix( "admin_" );
|
g_commands.registerPrefix( "admin_" );
|
||||||
g_commands.registerPrefix( "sm_" );
|
g_commands.registerPrefix( "sm_" );
|
||||||
g_commands.registerPrefix( "cm_" );
|
g_commands.registerPrefix( "cm_" );
|
||||||
|
|
||||||
// make sure localinfos are set
|
// make sure localinfos are set
|
||||||
get_localinfo("amxx_basedir", "addons/amxx");
|
get_localinfo("amxx_basedir", "addons/amxmodx");
|
||||||
get_localinfo("amxx_pluginsdir", "addons/amxx/plugins");
|
get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins");
|
||||||
get_localinfo("amxx_modulesdir", "addons/amxx/modules");
|
get_localinfo("amxx_modulesdir", "addons/amxmodx/modules");
|
||||||
get_localinfo("amxx_configsdir", "addons/amxx/configs");
|
get_localinfo("amxx_configsdir", "addons/amxmodx/configs");
|
||||||
get_localinfo("amxx_customdir", "addons/amxx/custom");
|
get_localinfo("amxx_customdir", "addons/amxmodx/custom");
|
||||||
|
|
||||||
// ###### Load modules
|
// ###### Load modules
|
||||||
loadModules(get_localinfo("amxx_modules", "addons/amxx/configs/modules.ini"));
|
loadModules(get_localinfo("amxx_modules", "addons/amxmodx/configs/modules.ini"));
|
||||||
attachModules();
|
attachModules();
|
||||||
int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat
|
int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat
|
||||||
// Set some info about amx version and modules
|
// Set some info about amx version and modules
|
||||||
CVAR_SET_STRING(init_amxmodx_version.name, AMX_VERSION);
|
CVAR_SET_STRING(init_amxmodx_version.name, AMX_VERSION);
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
@ -246,7 +244,7 @@ int C_Spawn( edict_t *pent ) {
|
|||||||
CVAR_SET_STRING(init_amxmodx_modules.name, buffer);
|
CVAR_SET_STRING(init_amxmodx_modules.name, buffer);
|
||||||
|
|
||||||
// ###### Load Vault
|
// ###### Load Vault
|
||||||
g_vault.setSource( build_pathname("%s", get_localinfo("amxx_vault", "addons/amxx/configs/vault.ini")) );
|
g_vault.setSource( build_pathname("%s", get_localinfo("amxx_vault", "addons/amxmodx/configs/vault.ini")) );
|
||||||
g_vault.loadVault( );
|
g_vault.loadVault( );
|
||||||
if (strlen(g_vault.get("server_language")) < 1)
|
if (strlen(g_vault.get("server_language")) < 1)
|
||||||
{
|
{
|
||||||
@ -268,11 +266,11 @@ int C_Spawn( edict_t *pent ) {
|
|||||||
memset(g_players[0].flags,-1,sizeof(g_players[0].flags));
|
memset(g_players[0].flags,-1,sizeof(g_players[0].flags));
|
||||||
|
|
||||||
// ###### Load AMX scripts
|
// ###### Load AMX scripts
|
||||||
g_plugins.loadPluginsFromFile( get_localinfo("amxx_plugins", "addons/amxx/configs/plugins.ini") );
|
g_plugins.loadPluginsFromFile( get_localinfo("amxx_plugins", "addons/amxmodx/configs/plugins.ini") );
|
||||||
|
|
||||||
// Register forwards
|
// Register forwards
|
||||||
FF_PluginInit = registerForward("plugin_init", ET_IGNORE, FP_DONE);
|
FF_PluginInit = registerForward("plugin_init", ET_IGNORE, FP_DONE);
|
||||||
FF_ClientCommand = registerForward("client_command", ET_IGNORE, FP_CELL, FP_DONE);
|
FF_ClientCommand = registerForward("client_command", ET_STOP, FP_CELL, FP_DONE);
|
||||||
FF_ClientConnect = registerForward("client_connect", ET_IGNORE, FP_CELL, FP_DONE);
|
FF_ClientConnect = registerForward("client_connect", ET_IGNORE, FP_CELL, FP_DONE);
|
||||||
FF_ClientDisconnect = registerForward("client_disconnect", ET_IGNORE, FP_CELL, FP_DONE);
|
FF_ClientDisconnect = registerForward("client_disconnect", ET_IGNORE, FP_CELL, FP_DONE);
|
||||||
FF_ClientInfoChanged = registerForward("client_infochanged", ET_IGNORE, FP_CELL, FP_DONE);
|
FF_ClientInfoChanged = registerForward("client_infochanged", ET_IGNORE, FP_CELL, FP_DONE);
|
||||||
@ -292,13 +290,16 @@ int C_Spawn( edict_t *pent ) {
|
|||||||
executeForwards(FF_PluginPrecache);
|
executeForwards(FF_PluginPrecache);
|
||||||
g_dontprecache = true;
|
g_dontprecache = true;
|
||||||
|
|
||||||
for(CList<ForceObject>::iterator a = g_forcegeneric.begin(); a ; ++a){
|
for(CList<ForceObject>::iterator a = g_forcegeneric.begin(); a ; ++a){
|
||||||
PRECACHE_GENERIC((char*)(*a).getFilename());
|
PRECACHE_GENERIC((char*)(*a).getFilename());
|
||||||
ENGINE_FORCE_UNMODIFIED((*a).getForceType(),
|
ENGINE_FORCE_UNMODIFIED((*a).getForceType(),
|
||||||
(*a).getMin(),(*a).getMax(),(*a).getFilename());
|
(*a).getMin(),(*a).getMax(),(*a).getFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// HACKHACK:
|
||||||
|
// Make sure this function wont be called anymore
|
||||||
|
g_FakeMeta.m_Plugins.begin()->GetDllFuncTable().pfnSpawn = NULL;
|
||||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,24 +359,24 @@ int C_RegUserMsg_Post(const char *pszName, int iSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Much more later after precache. All is precached, server
|
Much more later after precache. All is precached, server
|
||||||
will be flaged as ready to use so call
|
will be flaged as ready to use so call
|
||||||
plugin_init forward function from plugins
|
plugin_init forward function from plugins
|
||||||
*/
|
*/
|
||||||
void C_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ){
|
void C_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
for (int i = 0; g_user_msg[ i ].name; ++i )
|
for (int i = 0; g_user_msg[ i ].name; ++i )
|
||||||
{
|
{
|
||||||
if ( (*g_user_msg[ i ].id == 0) &&
|
if ( (*g_user_msg[ i ].id == 0) &&
|
||||||
(id = GET_USER_MSG_ID(PLID, g_user_msg[ i ].name , NULL ))!=0)
|
(id = GET_USER_MSG_ID(PLID, g_user_msg[ i ].name , NULL ))!=0)
|
||||||
{
|
{
|
||||||
*g_user_msg[ i ].id = id;
|
*g_user_msg[ i ].id = id;
|
||||||
|
|
||||||
if ( !g_user_msg[ i ].cstrike || g_bmod_cstrike )
|
if ( !g_user_msg[ i ].cstrike || g_bmod_cstrike )
|
||||||
{
|
{
|
||||||
if ( g_user_msg[ i ].endmsg )
|
if ( g_user_msg[ i ].endmsg )
|
||||||
modMsgsEnd[ id ] = g_user_msg[ i ].func;
|
modMsgsEnd[ id ] = g_user_msg[ i ].func;
|
||||||
else
|
else
|
||||||
modMsgs[ id ] = g_user_msg[ i ].func;
|
modMsgs[ id ] = g_user_msg[ i ].func;
|
||||||
}
|
}
|
||||||
@ -391,17 +392,17 @@ void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax )
|
|||||||
|
|
||||||
for(int i = 1; i <= gpGlobals->maxClients; ++i) {
|
for(int i = 1; i <= gpGlobals->maxClients; ++i) {
|
||||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
||||||
pPlayer->Init( pEdictList + i , i );
|
pPlayer->Init( pEdictList + i , i );
|
||||||
}
|
}
|
||||||
|
|
||||||
executeForwards(FF_PluginInit);
|
executeForwards(FF_PluginInit);
|
||||||
executeForwards(FF_PluginCfg);
|
executeForwards(FF_PluginCfg);
|
||||||
|
|
||||||
// ###### Save lang
|
// ###### Save lang
|
||||||
g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxx/data")));
|
g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
|
||||||
g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxx/data")));
|
g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
|
||||||
|
|
||||||
// Correct time in Counter-Strike and other mods (except DOD)
|
// Correct time in Counter-Strike and other mods (except DOD)
|
||||||
if ( !g_bmod_dod) g_game_timeleft = 0;
|
if ( !g_bmod_dod) g_game_timeleft = 0;
|
||||||
|
|
||||||
g_task_time = gpGlobals->time;
|
g_task_time = gpGlobals->time;
|
||||||
@ -416,8 +417,8 @@ void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax )
|
|||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call plugin_end forward function from plugins.
|
// Call plugin_end forward function from plugins.
|
||||||
void C_ServerDeactivate() {
|
void C_ServerDeactivate() {
|
||||||
|
|
||||||
for(int i = 1; i <= gpGlobals->maxClients; ++i){
|
for(int i = 1; i <= gpGlobals->maxClients; ++i){
|
||||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
||||||
@ -440,10 +441,12 @@ void C_ServerDeactivate() {
|
|||||||
// However leave AMX modules which are loaded only once
|
// However leave AMX modules which are loaded only once
|
||||||
void C_ServerDeactivate_Post() {
|
void C_ServerDeactivate_Post() {
|
||||||
|
|
||||||
g_initialized = false;
|
// HACKHACK:
|
||||||
|
// Make sure the spawn function will be called again
|
||||||
|
// pft that's not really a hack
|
||||||
|
g_FakeMeta.m_Plugins.begin()->GetDllFuncTable().pfnSpawn = C_Spawn;
|
||||||
|
|
||||||
detachReloadModules();
|
detachReloadModules();
|
||||||
|
|
||||||
g_auth.clear();
|
g_auth.clear();
|
||||||
g_forwards.clear();
|
g_forwards.clear();
|
||||||
g_commands.clear();
|
g_commands.clear();
|
||||||
@ -458,9 +461,16 @@ void C_ServerDeactivate_Post() {
|
|||||||
g_vault.clear();
|
g_vault.clear();
|
||||||
g_xvars.clear();
|
g_xvars.clear();
|
||||||
g_plugins.clear();
|
g_plugins.clear();
|
||||||
g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxx/data")));
|
g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
|
||||||
g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxx/data")));
|
g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
|
||||||
g_langMngr.Clear();
|
g_langMngr.Clear();
|
||||||
|
|
||||||
|
//clear module name cache
|
||||||
|
while (!CurModuleList.empty())
|
||||||
|
{
|
||||||
|
CurModuleList.pop();
|
||||||
|
}
|
||||||
|
|
||||||
// last memreport
|
// last memreport
|
||||||
#ifdef MEMORY_TEST
|
#ifdef MEMORY_TEST
|
||||||
if (g_memreport_enabled)
|
if (g_memreport_enabled)
|
||||||
@ -473,14 +483,14 @@ void C_ServerDeactivate_Post() {
|
|||||||
tm *curTime = localtime(&td);
|
tm *curTime = localtime(&td);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx")), 0700);
|
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")), 0700);
|
||||||
#else
|
#else
|
||||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx")));
|
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")));
|
||||||
#endif
|
#endif
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxx"), curTime->tm_mon + 1, curTime->tm_mday, i);
|
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxmodx"), curTime->tm_mon + 1, curTime->tm_mday, i);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
|
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
|
||||||
if (mkdir(build_pathname(buffer), 0700) < 0)
|
if (mkdir(build_pathname(buffer), 0700) < 0)
|
||||||
@ -528,7 +538,7 @@ BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *ps
|
|||||||
if ( a )
|
if ( a )
|
||||||
{
|
{
|
||||||
CPlayer** aa = new CPlayer*(pPlayer);
|
CPlayer** aa = new CPlayer*(pPlayer);
|
||||||
if ( aa ) g_auth.put( aa );
|
if ( aa ) g_auth.put( aa );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -738,14 +748,14 @@ void C_StartFrame_Post( void ) {
|
|||||||
tm *curTime = localtime(&td);
|
tm *curTime = localtime(&td);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx")), 0700);
|
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")), 0700);
|
||||||
#else
|
#else
|
||||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx")));
|
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")));
|
||||||
#endif
|
#endif
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxx"), curTime->tm_mon + 1, curTime->tm_mday, i);
|
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxmodx"), curTime->tm_mon + 1, curTime->tm_mday, i);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
|
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
|
||||||
if (mkdir(build_pathname(buffer), 0700) < 0)
|
if (mkdir(build_pathname(buffer), 0700) < 0)
|
||||||
@ -1023,13 +1033,14 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
|
|||||||
gMetaFunctionTable.pfnGetEntityAPI2_Post = GetEntityAPI2_Post;
|
gMetaFunctionTable.pfnGetEntityAPI2_Post = GetEntityAPI2_Post;
|
||||||
gMetaFunctionTable.pfnGetEngineFunctions = GetEngineFunctions;
|
gMetaFunctionTable.pfnGetEngineFunctions = GetEngineFunctions;
|
||||||
gMetaFunctionTable.pfnGetEngineFunctions_Post = GetEngineFunctions_Post;
|
gMetaFunctionTable.pfnGetEngineFunctions_Post = GetEngineFunctions_Post;
|
||||||
//gMetaFunctionTable.pfnGetNewDLLFunctions = GetNewDLLFunctions;
|
gMetaFunctionTable.pfnGetNewDLLFunctions = GetNewDLLFunctions;
|
||||||
//gMetaFunctionTable.pfnGetNewDLLFunctions_Post = GetNewDLLFunctions_Post;
|
gMetaFunctionTable.pfnGetNewDLLFunctions_Post = GetNewDLLFunctions_Post;
|
||||||
|
|
||||||
memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS));
|
memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS));
|
||||||
gpGamedllFuncs=pGamedllFuncs;
|
gpGamedllFuncs=pGamedllFuncs;
|
||||||
CVAR_REGISTER(&init_amxmodx_version);
|
CVAR_REGISTER(&init_amxmodx_version);
|
||||||
CVAR_REGISTER(&init_amxmodx_modules);
|
CVAR_REGISTER(&init_amxmodx_modules);
|
||||||
|
CVAR_REGISTER(&init_amxmodx_debug);
|
||||||
amxmodx_version = CVAR_GET_POINTER(init_amxmodx_version.name);
|
amxmodx_version = CVAR_GET_POINTER(init_amxmodx_version.name);
|
||||||
REG_SVR_COMMAND("amxx",amx_command);
|
REG_SVR_COMMAND("amxx",amx_command);
|
||||||
|
|
||||||
@ -1050,7 +1061,7 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
|
|||||||
|
|
||||||
// ###### Load custom path configuration
|
// ###### Load custom path configuration
|
||||||
Vault amx_config;
|
Vault amx_config;
|
||||||
amx_config.setSource(build_pathname("%s", get_localinfo("amxx_cfg", "addons/amxx/configs/core.ini")));
|
amx_config.setSource(build_pathname("%s", get_localinfo("amxx_cfg", "addons/amxmodx/configs/core.ini")));
|
||||||
|
|
||||||
if ( amx_config.loadVault() ){
|
if ( amx_config.loadVault() ){
|
||||||
Vault::iterator a = amx_config.begin();
|
Vault::iterator a = amx_config.begin();
|
||||||
@ -1062,11 +1073,11 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ###### Initialize logging here
|
// ###### Initialize logging here
|
||||||
g_log_dir.assign(get_localinfo("amxx_logs", "addons/amxx/logs"));
|
g_log_dir.assign(get_localinfo("amxx_logs", "addons/amxmodx/logs"));
|
||||||
|
|
||||||
// ###### Now attach metamod modules
|
// ###### Now attach metamod modules
|
||||||
// This will also call modules Meta_Query and Meta_Attach functions
|
// This will also call modules Meta_Query and Meta_Attach functions
|
||||||
attachMetaModModules(now, get_localinfo("amxx_modules", "addons/amxx/configs/modules.ini") );
|
attachMetaModModules(now, get_localinfo("amxx_modules", "addons/amxmodx/configs/modules.ini") );
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
@ -1227,15 +1238,6 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
|
|||||||
meta_engfuncs.pfnChangeLevel = C_ChangeLevel;
|
meta_engfuncs.pfnChangeLevel = C_ChangeLevel;
|
||||||
|
|
||||||
return g_FakeMeta.GetEngineFunctions(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs);
|
return g_FakeMeta.GetEngineFunctions(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs);
|
||||||
/*
|
|
||||||
if(*interfaceVersion!=ENGINE_INTERFACE_VERSION) {
|
|
||||||
LOG_ERROR(PLID, "GetEngineFunctions version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION);
|
|
||||||
*interfaceVersion = ENGINE_INTERFACE_VERSION;
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
memcpy(pengfuncsFromEngine, &meta_engfuncs, sizeof(enginefuncs_t));
|
|
||||||
return(TRUE);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enginefuncs_t meta_engfuncs_post;
|
enginefuncs_t meta_engfuncs_post;
|
||||||
@ -1278,15 +1280,6 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
|
|||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
return g_FakeMeta.GetEngineFunctions_Post(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs_post);
|
return g_FakeMeta.GetEngineFunctions_Post(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs_post);
|
||||||
/*
|
|
||||||
if(*interfaceVersion!=ENGINE_INTERFACE_VERSION) {
|
|
||||||
LOG_ERROR(PLID, "GetEngineFunctions_Post version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION);
|
|
||||||
*interfaceVersion = ENGINE_INTERFACE_VERSION;
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
memcpy(pengfuncsFromEngine, &meta_engfuncs_post, sizeof(enginefuncs_t));
|
|
||||||
return(TRUE);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NEW_DLL_FUNCTIONS gNewDLLFunctionTable;
|
NEW_DLL_FUNCTIONS gNewDLLFunctionTable;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "CFile.h"
|
#include "CFile.h"
|
||||||
#include "amxxfile.h"
|
#include "amxxfile.h"
|
||||||
|
|
||||||
CList<CModule> g_modules;
|
CList<CModule,const char*> g_modules;
|
||||||
CList<CScript,AMX*> g_loadedscripts;
|
CList<CScript,AMX*> g_loadedscripts;
|
||||||
|
|
||||||
CModule *g_CurrentlyCalledModule = NULL; // The module we are in at the moment; NULL otherwise
|
CModule *g_CurrentlyCalledModule = NULL; // The module we are in at the moment; NULL otherwise
|
||||||
@ -44,7 +44,6 @@ ModuleCallReason g_ModuleCallReason;
|
|||||||
|
|
||||||
extern const char* no_function; // stupid work around
|
extern const char* no_function; // stupid work around
|
||||||
|
|
||||||
|
|
||||||
void report_error( int code, char* fmt, ... )
|
void report_error( int code, char* fmt, ... )
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
@ -88,7 +87,7 @@ void free_amxmemory(void **ptr)
|
|||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_amxscript(AMX *amx, void **program, const char *filename, char error[64])
|
int load_amxscript(AMX *amx, void **program, const char *filename, char error[64], int debug)
|
||||||
{
|
{
|
||||||
*error = 0;
|
*error = 0;
|
||||||
CAmxxReader reader(filename, SMALL_CELL_SIZE / 8);
|
CAmxxReader reader(filename, SMALL_CELL_SIZE / 8);
|
||||||
@ -149,6 +148,14 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
|
|||||||
return (amx->error = AMX_ERR_FORMAT);
|
return (amx->error = AMX_ERR_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef JIT
|
||||||
|
if ( ((int)CVAR_GET_FLOAT("amx_debug") == 2 || (debug && (int)CVAR_GET_FLOAT("amx_debug"))) )
|
||||||
|
{
|
||||||
|
//automatic debug mode
|
||||||
|
hdr->flags |= AMX_FLAG_LINEOPS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
memset(amx, 0, sizeof(*amx));
|
memset(amx, 0, sizeof(*amx));
|
||||||
if ((err = amx_Init( amx, *program )) != AMX_ERR_NONE)
|
if ((err = amx_Init( amx, *program )) != AMX_ERR_NONE)
|
||||||
@ -157,7 +164,6 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
|
|||||||
return (amx->error = AMX_ERR_INIT);
|
return (amx->error = AMX_ERR_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef JIT
|
#ifdef JIT
|
||||||
void *np = new char[ amx->code_size ];
|
void *np = new char[ amx->code_size ];
|
||||||
void *rt = new char[ amx->reloc_size ];
|
void *rt = new char[ amx->reloc_size ];
|
||||||
@ -207,9 +213,96 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
|
|||||||
return set_amxnatives(amx,error);
|
return set_amxnatives(amx,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *StrCaseStr(const char *as, const char *bs)
|
||||||
|
{
|
||||||
|
static char a[256];
|
||||||
|
static char b[256];
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int len = strlen(as);
|
||||||
|
|
||||||
|
if (len > 254)
|
||||||
|
len = 254;
|
||||||
|
|
||||||
|
for (i=0; i<len; i++)
|
||||||
|
{
|
||||||
|
a[i] = tolower(as[i]);
|
||||||
|
}
|
||||||
|
a[len] = 0;
|
||||||
|
|
||||||
|
len = strlen(bs);
|
||||||
|
|
||||||
|
if (len > 254)
|
||||||
|
len = 254;
|
||||||
|
|
||||||
|
for (i=0; i<len; i++)
|
||||||
|
{
|
||||||
|
b[i] = tolower(bs[i]);
|
||||||
|
}
|
||||||
|
b[len] = 0;
|
||||||
|
|
||||||
|
return strstr(a,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
//BAILOPAN
|
||||||
|
int CheckModules(AMX *amx, char error[64])
|
||||||
|
{
|
||||||
|
int idx = 0, flag = -1;
|
||||||
|
if (amx_FindPublic(amx, "plugin_modules", &idx) == AMX_ERR_NONE)
|
||||||
|
{
|
||||||
|
cell retVal = 0;
|
||||||
|
int err = 0;
|
||||||
|
if ( (err = amx_Exec(amx, &retVal, idx, 0)) == AMX_ERR_NONE )
|
||||||
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
while (!CurModuleList.empty())
|
||||||
|
{
|
||||||
|
if (!flag)
|
||||||
|
{
|
||||||
|
CurModuleList.pop();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//assume module is not found
|
||||||
|
flag = 0;
|
||||||
|
for (CList<CModule,const char *>::iterator pMod = g_modules.begin(); pMod; ++pMod)
|
||||||
|
{
|
||||||
|
if (strcmpi(CurModuleList.front().c_str(), "dbi") == 0)
|
||||||
|
{
|
||||||
|
if (StrCaseStr( (*pMod).getName(), "sql") || strstr( (*pMod).getName(), "dbi" ))
|
||||||
|
{
|
||||||
|
// the module checks in
|
||||||
|
flag = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (strcmpi( (*pMod).getName(), CurModuleList.front().c_str() ) == 0)
|
||||||
|
{
|
||||||
|
flag = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//module was not found
|
||||||
|
if (!flag)
|
||||||
|
{
|
||||||
|
sprintf(error, "Module \"%s\" required for plugin. Check modules.ini.", CurModuleList.front().c_str());
|
||||||
|
}
|
||||||
|
CurModuleList.pop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AMXXLOG_Log("[AMXX] Run time error %d on line %ld during module check.", err, amx->curline);
|
||||||
|
//could not execute
|
||||||
|
return -1; //bad! very bad!
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
int set_amxnatives(AMX* amx,char error[64])
|
int set_amxnatives(AMX* amx,char error[64])
|
||||||
{
|
{
|
||||||
for ( CList<CModule>::iterator a = g_modules.begin(); a ; ++a )
|
for ( CList<CModule,const char *>::iterator a = g_modules.begin(); a ; ++a )
|
||||||
{
|
{
|
||||||
for( CList<AMX_NATIVE_INFO*>::iterator cc =
|
for( CList<AMX_NATIVE_INFO*>::iterator cc =
|
||||||
(*a).m_Natives.begin(); cc; ++cc )
|
(*a).m_Natives.begin(); cc; ++cc )
|
||||||
@ -226,14 +319,29 @@ int set_amxnatives(AMX* amx,char error[64])
|
|||||||
|
|
||||||
if ( amx_Register(amx, core_Natives, -1) != AMX_ERR_NONE )
|
if ( amx_Register(amx, core_Natives, -1) != AMX_ERR_NONE )
|
||||||
{
|
{
|
||||||
sprintf(error,"Function not found (name \"%s\")",no_function);
|
//HACKHACK - if we get here, nullify the plugin's native table
|
||||||
|
//then reregister the one native we need
|
||||||
|
// - BAILOPAN
|
||||||
|
String save;
|
||||||
|
save.assign(no_function);
|
||||||
|
amx_NullNativeTable(amx);
|
||||||
|
AMX_NATIVE_INFO p[] = {
|
||||||
|
{ "require_module", require_module },
|
||||||
|
{ NULL, NULL },
|
||||||
|
};
|
||||||
|
amx_Register(amx, p, -1);
|
||||||
|
if (CheckModules(amx, error) == -1 || *error == 0)
|
||||||
|
{
|
||||||
|
sprintf(error,"Plugin uses an unknown function (name \"%s\") - check your modules.ini.",save.c_str());
|
||||||
|
}
|
||||||
return (amx->error = AMX_ERR_NATIVE);
|
return (amx->error = AMX_ERR_NATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckModules(amx, error);
|
||||||
|
|
||||||
return AMX_ERR_NONE;
|
return AMX_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int unload_amxscript(AMX* amx, void** program)
|
int unload_amxscript(AMX* amx, void** program)
|
||||||
{
|
{
|
||||||
CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx );
|
CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx );
|
||||||
@ -332,7 +440,7 @@ char* build_pathname_addons(char *fmt, ... )
|
|||||||
|
|
||||||
int add_amxnatives(module_info_s* info,AMX_NATIVE_INFO*natives)
|
int add_amxnatives(module_info_s* info,AMX_NATIVE_INFO*natives)
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator a = g_modules.begin();
|
CList<CModule,const char *>::iterator a = g_modules.begin();
|
||||||
|
|
||||||
while ( a )
|
while ( a )
|
||||||
{
|
{
|
||||||
@ -364,9 +472,109 @@ bool validFile(const char* file)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConvertModuleName(const char *pathString, String &path)
|
||||||
|
{
|
||||||
|
#if SMALL_CELL_SIZE==64
|
||||||
|
char *ptr = strstr(pathString, "i386");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
//attempt to fix the binary name
|
||||||
|
*ptr = 0;
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append("amd64.so");
|
||||||
|
} else {
|
||||||
|
ptr = strstr(pathString, ".dll");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
*ptr = 0;
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append("_amd64.so");
|
||||||
|
} else {
|
||||||
|
ptr = strstr(pathString, ".so");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
path.assign(pathString);
|
||||||
|
} else {
|
||||||
|
//no extension at all
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append("_amd64.so");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#ifdef __linux__
|
||||||
|
char *ptr = strstr(pathString, "amd64");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
//attempt to fix the binary name
|
||||||
|
*ptr = 0;
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append("i386.so");
|
||||||
|
} else {
|
||||||
|
ptr = strstr(pathString, ".dll");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
*ptr = 0;
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append("_i386.so");
|
||||||
|
} else {
|
||||||
|
//check to see if this file even has an extension
|
||||||
|
ptr = strstr(pathString, ".so");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
path.assign(pathString);
|
||||||
|
} else {
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append("_i386.so");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
char *ptr = strstr(pathString, ".dll");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
path.assign(pathString);
|
||||||
|
} else {
|
||||||
|
//prevent this from loading .so too
|
||||||
|
ptr = strstr(pathString, ".so");
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
int i = 0, len = strlen(pathString), c = -1;
|
||||||
|
for (i=len-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
//cut off at first _
|
||||||
|
if (pathString[i] == '_')
|
||||||
|
{
|
||||||
|
//make sure this is a valid _
|
||||||
|
if (i == len-1 || strncmp(&(pathString[i+1]), "amxx", 4) == 0)
|
||||||
|
break;
|
||||||
|
c = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*ptr = 0;
|
||||||
|
if (c == -1)
|
||||||
|
{
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append(".dll");
|
||||||
|
} else {
|
||||||
|
ptr = (char *)&(pathString[c]);
|
||||||
|
*ptr = 0;
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append(".dll");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
path.assign(pathString);
|
||||||
|
path.append(".dll");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //__linux__
|
||||||
|
#endif //SMALL_CELL_SIZE==64
|
||||||
|
}
|
||||||
|
|
||||||
int loadModules(const char* filename)
|
int loadModules(const char* filename)
|
||||||
{
|
{
|
||||||
File fp( build_pathname("%s",filename), "r" );
|
FILE *fp = fopen(build_pathname("%s",filename), "rt");
|
||||||
|
|
||||||
if ( !fp )
|
if ( !fp )
|
||||||
{
|
{
|
||||||
@ -374,23 +582,40 @@ int loadModules(const char* filename)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char line[256], moduleName[256];
|
char moduleName[256];
|
||||||
|
char pathString[512];
|
||||||
|
String line;
|
||||||
int loaded = 0;
|
int loaded = 0;
|
||||||
|
|
||||||
while ( fp.getline( line , 255 ) )
|
String path;
|
||||||
|
|
||||||
|
while (!feof(fp))
|
||||||
{
|
{
|
||||||
|
if (!line._fread(fp) || line.size() < 1)
|
||||||
|
continue;
|
||||||
|
line.trim();
|
||||||
*moduleName = 0;
|
*moduleName = 0;
|
||||||
sscanf(line,"%s",moduleName);
|
if (sscanf(line.c_str(),"%s",moduleName) == EOF)
|
||||||
if (!isalnum(*moduleName) || !validFile(moduleName) )
|
continue;
|
||||||
|
if (moduleName[0] == ';')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line);
|
|
||||||
|
|
||||||
CList<CModule>::iterator a = g_modules.find( pathname );
|
char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxmodx/modules"), moduleName);
|
||||||
|
strcpy(pathString, pathname);
|
||||||
|
|
||||||
|
path.assign("");
|
||||||
|
|
||||||
|
ConvertModuleName(pathString, path);
|
||||||
|
|
||||||
|
if (!validFile(path.c_str()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CList<CModule,const char *>::iterator a = g_modules.find( path.c_str() );
|
||||||
|
|
||||||
if ( a ) continue; // already loaded
|
if ( a ) continue; // already loaded
|
||||||
|
|
||||||
CModule* cc = new CModule( pathname );
|
CModule* cc = new CModule( path.c_str() );
|
||||||
|
|
||||||
if ( cc == 0 ) return loaded;
|
if ( cc == 0 ) return loaded;
|
||||||
|
|
||||||
@ -398,42 +623,45 @@ int loadModules(const char* filename)
|
|||||||
|
|
||||||
switch( cc->getStatusValue() ) {
|
switch( cc->getStatusValue() ) {
|
||||||
case MODULE_BADLOAD:
|
case MODULE_BADLOAD:
|
||||||
report_error( 1 , "[AMXX] Module is not a valid library (file \"%s\")",pathname );
|
report_error( 1 , "[AMXX] Module is not a valid library (file \"%s\")", path.c_str());
|
||||||
break;
|
break;
|
||||||
case MODULE_NOINFO:
|
case MODULE_NOINFO:
|
||||||
report_error( 1 ,"[AMXX] Couldn't find info. about module (file \"%s\")",pathname );
|
report_error( 1 ,"[AMXX] Couldn't find info. about module (file \"%s\")", path.c_str());
|
||||||
break;
|
break;
|
||||||
case MODULE_NOQUERY:
|
case MODULE_NOQUERY:
|
||||||
report_error( 1 , "[AMXX] Couldn't find \"AMX_Query\" or \"AMXX_Query\" (file \"%s\")", pathname );
|
report_error( 1 , "[AMXX] Couldn't find \"AMX_Query\" or \"AMXX_Query\" (file \"%s\")", path.c_str());
|
||||||
break;
|
break;
|
||||||
case MODULE_NOATTACH:
|
case MODULE_NOATTACH:
|
||||||
report_error( 1 , "[AMXX] Couldn't find \"%s\" (file \"%s\")", cc->isAmxx() ? "AMXX_Attach" : "AMX_Attach", pathname );
|
report_error( 1 , "[AMXX] Couldn't find \"%s\" (file \"%s\")", cc->isAmxx() ? "AMXX_Attach" : "AMX_Attach", path.c_str());
|
||||||
break;
|
break;
|
||||||
case MODULE_OLD:
|
case MODULE_OLD:
|
||||||
report_error( 1 , "[AMXX] Module has a different interface version (file \"%s\")",pathname );
|
report_error( 1 , "[AMXX] Module has a different interface version (file \"%s\")",path.c_str());
|
||||||
break;
|
break;
|
||||||
case MODULE_NEWER:
|
case MODULE_NEWER:
|
||||||
report_error(1, "[AMXX] Module has a newer interface version (file \"%s\"). Please download a new amxmodx.", pathname);
|
report_error(1, "[AMXX] Module has a newer interface version (file \"%s\"). Please download a new amxmodx.", path.c_str());
|
||||||
break;
|
break;
|
||||||
case MODULE_INTERROR:
|
case MODULE_INTERROR:
|
||||||
report_error(1, "[AMXX] Internal error during module load (file \"%s\")", pathname);
|
report_error(1, "[AMXX] Internal error during module load (file \"%s\")", path.c_str());
|
||||||
break;
|
break;
|
||||||
case MODULE_NOT64BIT:
|
case MODULE_NOT64BIT:
|
||||||
report_error(1, "[AMXX] Module \"%s\" is not 64 bit compatible.", pathname);
|
report_error(1, "[AMXX] Module \"%s\" is not 64 bit compatible.", path.c_str());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
++loaded;
|
++loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_modules.put( cc );
|
g_modules.put( cc );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void detachModules()
|
void detachModules()
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator a = g_modules.begin();
|
CList<CModule,const char *>::iterator a = g_modules.begin();
|
||||||
|
|
||||||
while ( a )
|
while ( a )
|
||||||
{
|
{
|
||||||
@ -444,7 +672,7 @@ void detachModules()
|
|||||||
|
|
||||||
void detachReloadModules()
|
void detachReloadModules()
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator a = g_modules.begin();
|
CList<CModule,const char *>::iterator a = g_modules.begin();
|
||||||
|
|
||||||
while ( a )
|
while ( a )
|
||||||
{
|
{
|
||||||
@ -462,7 +690,7 @@ void detachReloadModules()
|
|||||||
|
|
||||||
void attachModules()
|
void attachModules()
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator a = g_modules.begin();
|
CList<CModule,const char *>::iterator a = g_modules.begin();
|
||||||
|
|
||||||
while ( a )
|
while ( a )
|
||||||
{
|
{
|
||||||
@ -514,6 +742,7 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char line[256], moduleName[256];
|
char line[256], moduleName[256];
|
||||||
|
String modPath, mmPath;
|
||||||
DLHANDLE module;
|
DLHANDLE module;
|
||||||
|
|
||||||
while ( fp.getline( line , 255 ) )
|
while ( fp.getline( line , 255 ) )
|
||||||
@ -521,12 +750,34 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
|
|||||||
*moduleName = 0;
|
*moduleName = 0;
|
||||||
sscanf(line,"%s",moduleName);
|
sscanf(line,"%s",moduleName);
|
||||||
|
|
||||||
if (!isalnum(*moduleName) || !validFile(moduleName) )
|
if (!isalnum(*moduleName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line);
|
char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxmodx/modules"), line);
|
||||||
char* mmpathname = build_pathname_addons("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line);
|
char* mmpathname = build_pathname_addons("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxmodx/modules"), line);
|
||||||
module = DLLOAD( pathname ); // link dll
|
|
||||||
|
ConvertModuleName(pathname, modPath);
|
||||||
|
ConvertModuleName(mmpathname, mmPath);
|
||||||
|
|
||||||
|
CList<CFakeMeta::CFakeMetaPlugin>::iterator iter = g_FakeMeta.m_Plugins.begin();
|
||||||
|
|
||||||
|
//prevent double loading
|
||||||
|
int foundFlag = 0;
|
||||||
|
|
||||||
|
while (iter)
|
||||||
|
{
|
||||||
|
if ( strcmp( (*iter).GetPath(), mmPath.c_str() ) == 0 )
|
||||||
|
{
|
||||||
|
foundFlag = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundFlag)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
module = DLLOAD( modPath.c_str() ); // link dll
|
||||||
|
|
||||||
if ( module )
|
if ( module )
|
||||||
{
|
{
|
||||||
@ -535,7 +786,7 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
|
|||||||
|
|
||||||
if ( a )
|
if ( a )
|
||||||
{
|
{
|
||||||
g_FakeMeta.AddPlugin(mmpathname);
|
g_FakeMeta.AddPlugin(mmPath.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,7 +799,7 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
|
|||||||
// Get the number of running modules
|
// Get the number of running modules
|
||||||
int countModules(CountModulesMode mode)
|
int countModules(CountModulesMode mode)
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator iter;
|
CList<CModule,const char *>::iterator iter;
|
||||||
int num;
|
int num;
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
@ -581,7 +832,7 @@ int countModules(CountModulesMode mode)
|
|||||||
// Call all modules' AMXX_PluginsLoaded functions
|
// Call all modules' AMXX_PluginsLoaded functions
|
||||||
void modules_callPluginsLoaded()
|
void modules_callPluginsLoaded()
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator iter = g_modules.begin();
|
CList<CModule,const char *>::iterator iter = g_modules.begin();
|
||||||
while (iter)
|
while (iter)
|
||||||
{
|
{
|
||||||
(*iter).CallPluginsLoaded();
|
(*iter).CallPluginsLoaded();
|
||||||
@ -593,7 +844,7 @@ void modules_callPluginsLoaded()
|
|||||||
|
|
||||||
int MNF_AddNatives(AMX_NATIVE_INFO* natives)
|
int MNF_AddNatives(AMX_NATIVE_INFO* natives)
|
||||||
{
|
{
|
||||||
CList<CModule>::iterator a = g_modules.begin();
|
CList<CModule,const char *>::iterator a = g_modules.begin();
|
||||||
|
|
||||||
if (!g_CurrentlyCalledModule || g_ModuleCallReason != ModuleCall_Attach)
|
if (!g_CurrentlyCalledModule || g_ModuleCallReason != ModuleCall_Attach)
|
||||||
return FALSE; // may only be called from attach
|
return FALSE; // may only be called from attach
|
||||||
@ -703,6 +954,14 @@ char *MNF_FormatAmxString(AMX *amx, cell *params, int startParam, int *pLen)
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MNF_GetPlayerFlags(int id)
|
||||||
|
{
|
||||||
|
if (id < 1 || id > gpGlobals->maxClients)
|
||||||
|
return 0;
|
||||||
|
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||||
|
return (pPlayer->flags[0]);
|
||||||
|
}
|
||||||
|
|
||||||
void MNF_CopyAmxMemory(cell * dest, const cell * src, int len)
|
void MNF_CopyAmxMemory(cell * dest, const cell * src, int len)
|
||||||
{
|
{
|
||||||
memcpy((void*)dest, (const void *)src, (size_t)len*sizeof(cell));
|
memcpy((void*)dest, (const void *)src, (size_t)len*sizeof(cell));
|
||||||
@ -856,6 +1115,39 @@ void MNF_MergeDefinitionFile(const char *file)
|
|||||||
g_langMngr.MergeDefinitionFile(file);
|
g_langMngr.MergeDefinitionFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edict_t* MNF_GetPlayerEdict(int id)
|
||||||
|
{
|
||||||
|
if (id < 1 || id > gpGlobals->maxClients)
|
||||||
|
return NULL;
|
||||||
|
return (GET_PLAYER_POINTER_I(id)->pEdict);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *MNF_Format(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
const char *retVal = g_langMngr.FormatString(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef MEMORY_TEST
|
||||||
|
void *MNF_Allocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, const unsigned int allocationType, const size_t reportedSize)
|
||||||
|
{
|
||||||
|
return malloc(reportedSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *MNF_Reallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, const unsigned int reallocationType, const size_t reportedSize, void *reportedAddress)
|
||||||
|
{
|
||||||
|
return realloc(reportedAddress, reportedSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MNF_Deallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, const unsigned int deallocationType, void *reportedAddress)
|
||||||
|
{
|
||||||
|
free(reportedAddress);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fnptr Request function for the new interface
|
// Fnptr Request function for the new interface
|
||||||
const char *g_LastRequestedFunc = NULL;
|
const char *g_LastRequestedFunc = NULL;
|
||||||
#define REGISTER_FUNC(name, func) { name, (void*)func },
|
#define REGISTER_FUNC(name, func) { name, (void*)func },
|
||||||
@ -874,6 +1166,7 @@ void *Module_ReqFnptr(const char *funcName)
|
|||||||
REGISTER_FUNC("GetModname", MNF_GetModname)
|
REGISTER_FUNC("GetModname", MNF_GetModname)
|
||||||
REGISTER_FUNC("Log", MNF_Log)
|
REGISTER_FUNC("Log", MNF_Log)
|
||||||
REGISTER_FUNC("MergeDefinitionFile", MNF_MergeDefinitionFile)
|
REGISTER_FUNC("MergeDefinitionFile", MNF_MergeDefinitionFile)
|
||||||
|
REGISTER_FUNC("Format", MNF_Format)
|
||||||
|
|
||||||
// Amx scripts loading / unloading / managing
|
// Amx scripts loading / unloading / managing
|
||||||
REGISTER_FUNC("GetAmxScript", MNF_GetAmxScript)
|
REGISTER_FUNC("GetAmxScript", MNF_GetAmxScript)
|
||||||
@ -910,6 +1203,7 @@ void *Module_ReqFnptr(const char *funcName)
|
|||||||
REGISTER_FUNC("PrepareCharArray", prepareCharArray)
|
REGISTER_FUNC("PrepareCharArray", prepareCharArray)
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
|
REGISTER_FUNC("GetPlayerFlags", MNF_GetPlayerFlags)
|
||||||
REGISTER_FUNC("IsPlayerValid", MNF_IsPlayerValid)
|
REGISTER_FUNC("IsPlayerValid", MNF_IsPlayerValid)
|
||||||
REGISTER_FUNC("GetPlayerName", MNF_GetPlayerName)
|
REGISTER_FUNC("GetPlayerName", MNF_GetPlayerName)
|
||||||
REGISTER_FUNC("GetPlayerIP", MNF_GetPlayerIP)
|
REGISTER_FUNC("GetPlayerIP", MNF_GetPlayerIP)
|
||||||
@ -929,6 +1223,7 @@ void *Module_ReqFnptr(const char *funcName)
|
|||||||
REGISTER_FUNC("IsPlayerHLTV", MNF_IsPlayerHLTV)
|
REGISTER_FUNC("IsPlayerHLTV", MNF_IsPlayerHLTV)
|
||||||
REGISTER_FUNC("GetPlayerArmor", MNF_GetPlayerArmor)
|
REGISTER_FUNC("GetPlayerArmor", MNF_GetPlayerArmor)
|
||||||
REGISTER_FUNC("GetPlayerHealth", MNF_GetPlayerHealth)
|
REGISTER_FUNC("GetPlayerHealth", MNF_GetPlayerHealth)
|
||||||
|
REGISTER_FUNC("GetPlayerEdict", MNF_GetPlayerEdict)
|
||||||
REGISTER_FUNC("CellToReal", MNF_CellToReal)
|
REGISTER_FUNC("CellToReal", MNF_CellToReal)
|
||||||
REGISTER_FUNC("RealToCell", MNF_RealToCell)
|
REGISTER_FUNC("RealToCell", MNF_RealToCell)
|
||||||
|
|
||||||
@ -936,6 +1231,10 @@ void *Module_ReqFnptr(const char *funcName)
|
|||||||
REGISTER_FUNC("Allocator", m_allocator)
|
REGISTER_FUNC("Allocator", m_allocator)
|
||||||
REGISTER_FUNC("Deallocator", m_deallocator)
|
REGISTER_FUNC("Deallocator", m_deallocator)
|
||||||
REGISTER_FUNC("Reallocator", m_reallocator)
|
REGISTER_FUNC("Reallocator", m_reallocator)
|
||||||
|
#else
|
||||||
|
REGISTER_FUNC("Allocator", MNF_Allocator)
|
||||||
|
REGISTER_FUNC("Deallocator", MNF_Deallocator)
|
||||||
|
REGISTER_FUNC("Reallocator", MNF_Reallocator)
|
||||||
#endif // MEMORY_TEST
|
#endif // MEMORY_TEST
|
||||||
|
|
||||||
REGISTER_FUNC("Haha_HiddenStuff", MNF_HiddenStuff)
|
REGISTER_FUNC("Haha_HiddenStuff", MNF_HiddenStuff)
|
||||||
|
@ -144,7 +144,7 @@ struct pfnmodule_engine_g {
|
|||||||
const char* (*pfnget_amxscriptname)(AMX* amx); // amx
|
const char* (*pfnget_amxscriptname)(AMX* amx); // amx
|
||||||
char* (*pfnget_amxstring)(AMX*,cell,int, int&); // amx, src, buffer (0-3), len
|
char* (*pfnget_amxstring)(AMX*,cell,int, int&); // amx, src, buffer (0-3), len
|
||||||
void (*pfnget_modname)(char*); // modname
|
void (*pfnget_modname)(char*); // modname
|
||||||
int (*pfnload_amxscript)(AMX*, void**, const char*, char[64]); // amx, code, path, error info
|
int (*pfnload_amxscript)(AMX*, void**, const char*, char[64], int); // amx, code, path, error info
|
||||||
void (*pfnprint_console)(char*, ...); // format, ....
|
void (*pfnprint_console)(char*, ...); // format, ....
|
||||||
void (*pfnreport_error)(int code, char*, ... );
|
void (*pfnreport_error)(int code, char*, ... );
|
||||||
int (*pfnset_amxnatives)(AMX*,char[64]); // amx, error info
|
int (*pfnset_amxnatives)(AMX*,char[64]); // amx, error info
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
||||||
OutputFile="debug/amxx_mm.dll"
|
OutputFile="debug/amxmodx_mm.dll"
|
||||||
Version="0.1"
|
Version="0.1"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
@ -112,8 +112,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib"
|
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
||||||
OutputFile="release/amxx_mm.dll"
|
OutputFile="release/amxmodx_mm.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||||
@ -179,8 +179,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib"
|
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
||||||
OutputFile="memtestdebug/amxx_mm.dll"
|
OutputFile="memtestdebug/amxmodx_mm.dll"
|
||||||
Version="0.1"
|
Version="0.1"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
@ -249,8 +249,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib"
|
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
||||||
OutputFile="memtestrelease/amxx_mm.dll"
|
OutputFile="memtestrelease/amxmodx_mm.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||||
@ -316,8 +316,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib"
|
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
|
||||||
OutputFile="jitdebug/amxx_mm.dll"
|
OutputFile="jitdebug/amxmodx_mm.dll"
|
||||||
Version="0.1"
|
Version="0.1"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
@ -386,8 +386,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
|
AdditionalDependencies="..\jit\jits.obj ..\zlib\zlib.lib"
|
||||||
OutputFile="jitrelease/amxx_mm.dll"
|
OutputFile="jitrelease/amxmodx_mm.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||||
@ -454,8 +454,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib"
|
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
|
||||||
OutputFile="jitmemtestrelease/amxx_mm.dll"
|
OutputFile="jitmemtestrelease/amxmodx_mm.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||||
@ -525,8 +525,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib"
|
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
|
||||||
OutputFile="MaximalSpeed/amxx_mm.dll"
|
OutputFile="MaximalSpeed/amxmodx_mm.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||||
|
@ -2479,6 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
|||||||
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2523,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2530,6 +2534,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
||||||
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
||||||
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
||||||
|
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
|
||||||
|
|
||||||
// String / mem in amx scripts support
|
// String / mem in amx scripts support
|
||||||
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
||||||
@ -2576,6 +2581,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2670,11 +2677,14 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||||
MF_AmxFindPublic(0, 0, 0);
|
MF_AmxFindPublic(0, 0, 0);
|
||||||
MF_AmxAllot(0, 0, 0, 0);
|
MF_AmxAllot(0, 0, 0, 0);
|
||||||
MF_LoadAmxScript(0, 0, 0, 0);
|
MF_LoadAmxScript(0, 0, 0, 0, 0);
|
||||||
MF_UnloadAmxScript(0, 0);
|
MF_UnloadAmxScript(0, 0);
|
||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2791,7 +2801,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2804,7 +2814,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2818,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2830,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
|
@ -204,11 +204,9 @@ typedef struct tagAMX {
|
|||||||
cell reset_stk PACKED;
|
cell reset_stk PACKED;
|
||||||
cell reset_hea PACKED;
|
cell reset_hea PACKED;
|
||||||
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
||||||
#if defined JIT
|
|
||||||
/* support variables for the JIT */
|
/* support variables for the JIT */
|
||||||
int reloc_size PACKED; /* required temporary buffer for relocations */
|
int reloc_size PACKED; /* required temporary buffer for relocations */
|
||||||
long code_size PACKED; /* estimated memory footprint of the native code */
|
long code_size PACKED; /* estimated memory footprint of the native code */
|
||||||
#endif
|
|
||||||
} AMX;
|
} AMX;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -240,6 +238,14 @@ enum {
|
|||||||
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined AMX_NO_ALIGN
|
||||||
|
#if defined __linux__
|
||||||
|
#pragma pack() /* reset default packing */
|
||||||
|
#else
|
||||||
|
#pragma pack(pop) /* reset previous packing */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ***** declare functions *****
|
// ***** declare functions *****
|
||||||
|
|
||||||
@ -1926,6 +1932,7 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
||||||
|
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
||||||
@ -1937,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1948,7 +1961,7 @@ typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*in
|
|||||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||||
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
||||||
@ -1956,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa
|
|||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -2009,6 +2023,9 @@ extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
|||||||
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
extern PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2057,6 +2074,9 @@ cell amx_ftoc (float x) { }
|
|||||||
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2111,6 +2131,9 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
|
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
|
||||||
|
#define MF_Format g_fn_Format;
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -62,6 +62,18 @@ void amx_command(){
|
|||||||
++a;
|
++a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a = g_plugins.begin();
|
||||||
|
|
||||||
|
while (a)
|
||||||
|
{
|
||||||
|
if ( (*a).getStatusCode() == ps_bad_load )
|
||||||
|
{
|
||||||
|
//error
|
||||||
|
print_srvconsole("Load fails: %s\n", (*a).getError());
|
||||||
|
}
|
||||||
|
++a;
|
||||||
|
}
|
||||||
|
|
||||||
print_srvconsole( "%d plugins, %d running\n",plugins,running );
|
print_srvconsole( "%d plugins, %d running\n",plugins,running );
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,7 +150,15 @@ void amx_command(){
|
|||||||
print_srvconsole( "%s %s\n", Plugin_info.name, Plugin_info.version);
|
print_srvconsole( "%s %s\n", Plugin_info.name, Plugin_info.version);
|
||||||
print_srvconsole( "author: %s (%s)\n", Plugin_info.author, Plugin_info.url);
|
print_srvconsole( "author: %s (%s)\n", Plugin_info.author, Plugin_info.url);
|
||||||
print_srvconsole( "compiled: %s\n", __DATE__ ", " __TIME__);
|
print_srvconsole( "compiled: %s\n", __DATE__ ", " __TIME__);
|
||||||
|
#ifdef JIT
|
||||||
|
print_srvconsole( "Core mode: JIT\n");
|
||||||
|
#else
|
||||||
|
#ifdef ASM32
|
||||||
|
print_srvconsole( "Core mode: ASM\n");
|
||||||
|
#else
|
||||||
|
print_srvconsole( "Core mode: Normal\n");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (!strcmp(cmd,"modules"))
|
else if (!strcmp(cmd,"modules"))
|
||||||
{
|
{
|
||||||
@ -149,7 +169,7 @@ void amx_command(){
|
|||||||
int running = 0;
|
int running = 0;
|
||||||
int modules = 0;
|
int modules = 0;
|
||||||
|
|
||||||
CList<CModule>::iterator a = g_modules.begin();
|
CList<CModule,const char *>::iterator a = g_modules.begin();
|
||||||
|
|
||||||
while ( a )
|
while ( a )
|
||||||
{
|
{
|
||||||
@ -165,8 +185,7 @@ void amx_command(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_srvconsole( "%d modules, %d correct\n",modules,running);
|
print_srvconsole( "%d modules, %d correct\n",modules,running);
|
||||||
}
|
} else if (!strcmp(cmd, "gpl"))
|
||||||
else if (!strcmp(cmd, "gpl"))
|
|
||||||
{
|
{
|
||||||
print_srvconsole("AMX Mod X\n");
|
print_srvconsole("AMX Mod X\n");
|
||||||
print_srvconsole("\n");
|
print_srvconsole("\n");
|
||||||
|
@ -79,12 +79,15 @@ void UTIL_ShowMenu( edict_t* pEdict, int slots, int time, char *menu, int mlen )
|
|||||||
/* warning - don't pass here const string */
|
/* warning - don't pass here const string */
|
||||||
void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name)
|
void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name)
|
||||||
{
|
{
|
||||||
if (!gmsgServerName)
|
if (!gmsgMOTD)
|
||||||
return; // :TODO: Maybe output a warning log?
|
return; // :TODO: Maybe output a warning log?
|
||||||
|
|
||||||
MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client );
|
if (gmsgServerName)
|
||||||
WRITE_STRING(name);
|
{
|
||||||
MESSAGE_END();
|
MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client );
|
||||||
|
WRITE_STRING(name);
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
|
||||||
char *n = motd;
|
char *n = motd;
|
||||||
char c = 0;
|
char c = 0;
|
||||||
@ -104,9 +107,12 @@ void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name)
|
|||||||
motd = n;
|
motd = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client );
|
if (gmsgServerName)
|
||||||
WRITE_STRING( hostname->string );
|
{
|
||||||
MESSAGE_END();
|
MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client );
|
||||||
|
WRITE_STRING( hostname->string );
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UTIL_IntToString(int value, char *output)
|
void UTIL_IntToString(int value, char *output)
|
||||||
|
BIN
amxmodx/zlib/libz.a
Executable file
BIN
amxmodx/zlib/libz.a
Executable file
Binary file not shown.
BIN
amxmodx/zlib/libz64.a
Executable file
BIN
amxmodx/zlib/libz64.a
Executable file
Binary file not shown.
176
compiler/scasm/Makefile.pl
Executable file
176
compiler/scasm/Makefile.pl
Executable file
@ -0,0 +1,176 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#(C)2004 AMX Mod X Development Team
|
||||||
|
# by David "BAILOPAN" Anderson
|
||||||
|
|
||||||
|
# output will occur in bin.x.proc
|
||||||
|
# where x is debug or opt and proc is ix86 or amd64
|
||||||
|
# You must use this script from the project src dir
|
||||||
|
|
||||||
|
#options =
|
||||||
|
# debug - enable gdb debugging
|
||||||
|
# amd64 - compile for AMD64
|
||||||
|
# proc=ix86 - assumed not amd64
|
||||||
|
# clean - clean the specifications above
|
||||||
|
|
||||||
|
$PROJECT = "sasm";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
|
@CPP_SOURCE_FILES = ("amx_compiler.cpp", "amx_data.cpp", "amx_define.cpp", "amx_error.cpp", "amx_label.cpp", "amx_macro.cpp", "amx_natives.cpp", "amx_proc.cpp", "amx_parser.cpp", "amx_symbol.cpp", "amxasm.cpp", "cexpr.cpp");
|
||||||
|
|
||||||
|
@C_SOURCE_FILES = ();
|
||||||
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
||||||
|
|
||||||
|
$OPTIONS{"include"} = "";
|
||||||
|
|
||||||
|
while ($cmd = shift)
|
||||||
|
{
|
||||||
|
if ($cmd =~ /amd64/) {
|
||||||
|
$OPTIONS{"amd64"} = 1;
|
||||||
|
} elsif ($cmd =~ /debug/) {
|
||||||
|
$OPTIONS{"debug"} = 1;
|
||||||
|
} elsif ($cmd =~ /proc=i(\d)86/) {
|
||||||
|
$proc = $1;
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
die "You cannot compile for i".$proc."86 and AMD64.\n";
|
||||||
|
} else {
|
||||||
|
$OPTIONS{"proc"} = "i".$proc."86";
|
||||||
|
}
|
||||||
|
} elsif ($cmd =~ /clean/) {
|
||||||
|
$OPTIONS{"clean"} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gcc = `$gccf --version`;
|
||||||
|
if ($gcc =~ /2\.9/)
|
||||||
|
{
|
||||||
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
|
} else {
|
||||||
|
$OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"debug"})
|
||||||
|
{
|
||||||
|
$cflags = $OPT{"debug"};
|
||||||
|
} else {
|
||||||
|
if (!$OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$proc = $OPTIONS{"proc"};
|
||||||
|
if (!$proc)
|
||||||
|
{
|
||||||
|
$proc = 3;
|
||||||
|
}
|
||||||
|
$cflags = "-march=i".$proc."86 ".$OPT{"opt"};
|
||||||
|
} else {
|
||||||
|
$cflags = $OPT{"opt"};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$cflags .= " -m64 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"debug"})
|
||||||
|
{
|
||||||
|
$outdir = "bin.debug";
|
||||||
|
} else {
|
||||||
|
$outdir = "bin.opt";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$outdir .= ".amd64";
|
||||||
|
$bin = $PROJECT."_amd64.so";
|
||||||
|
} else {
|
||||||
|
$proc = $OPTIONS{"proc"};
|
||||||
|
if ($proc)
|
||||||
|
{
|
||||||
|
$outdir .= ".i".$proc."86";
|
||||||
|
$bin = $PROJECT."_i".$proc."86.so";
|
||||||
|
} else {
|
||||||
|
$outdir .= ".i386";
|
||||||
|
$bin = $PROJECT."_i386.so";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink("$outdir/$bin");
|
||||||
|
if ($OPTIONS{"clean"})
|
||||||
|
{
|
||||||
|
`rm $outdir/*.o`;
|
||||||
|
die("Project cleaned.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#create the dirs
|
||||||
|
#build link list
|
||||||
|
my @LINK;
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $CPP_SOURCE_FILES[$i];
|
||||||
|
$file =~ s/\.cpp/\.o/;
|
||||||
|
push(@LINK, $outdir."/".$file);
|
||||||
|
}
|
||||||
|
for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $C_SOURCE_FILES[$i];
|
||||||
|
$file =~ s/\.c/\.o/;
|
||||||
|
push(@LINK, $outdir."/".$file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(-d $outdir))
|
||||||
|
{
|
||||||
|
mkdir($outdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inc = $OPTIONS{"include"};
|
||||||
|
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $CPP_SOURCE_FILES[$i];
|
||||||
|
$ofile = $file;
|
||||||
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
|
$ofile = "$outdir/$ofile";
|
||||||
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
|
if (-e $ofile)
|
||||||
|
{
|
||||||
|
$file_time = (stat($file))[9];
|
||||||
|
$ofile_time = (stat($ofile))[9];
|
||||||
|
if ($file_time > $ofile_time)
|
||||||
|
{
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $C_SOURCE_FILES[$i];
|
||||||
|
$ofile = $file;
|
||||||
|
$ofile =~ s/\.c/\.o/;
|
||||||
|
$ofile = "$outdir/$ofile";
|
||||||
|
$gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
|
if (-e $ofile)
|
||||||
|
{
|
||||||
|
$file_time = (stat($file))[9];
|
||||||
|
$ofile_time = (stat($file))[9];
|
||||||
|
if ($file_time > $ofile_time)
|
||||||
|
{
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gcc = "$gccf $cflags -shared -lstdc++ -ldl -lm @LINK -o $outdir/$bin";
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
@ -70,3 +70,10 @@ amx_extendmap_step 15
|
|||||||
|
|
||||||
//If you set this to 0, clients cannot chose their language
|
//If you set this to 0, clients cannot chose their language
|
||||||
amx_client_languages 1
|
amx_client_languages 1
|
||||||
|
|
||||||
|
// Plugin Debug mode
|
||||||
|
// 0 - No debugging (garbage line numbers)
|
||||||
|
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
|
||||||
|
// 2 - All plugins are put in debug mode
|
||||||
|
// Note - debug mode will affect JIT performance
|
||||||
|
amx_debug 1
|
@ -1,12 +1,12 @@
|
|||||||
; Configuration file for AMX Mod X
|
; Configuration file for AMX Mod X
|
||||||
amxx_logdir addons/amxx/logs
|
amxx_logdir addons/amxmodx/logs
|
||||||
amxx_configsdir addons/amxx/configs
|
amxx_configsdir addons/amxmodx/configs
|
||||||
amxx_datadir addons/amxx/data
|
amxx_datadir addons/amxmodx/data
|
||||||
amxx_modules addons/amxx/configs/modules.ini
|
amxx_modules addons/amxmodx/configs/modules.ini
|
||||||
amxx_plugins addons/amxx/configs/plugins.ini
|
amxx_plugins addons/amxmodx/configs/plugins.ini
|
||||||
amxx_pluginsdir addons/amxx/plugins
|
amxx_pluginsdir addons/amxmodx/plugins
|
||||||
amxx_modulesdir addons/amxx/modules
|
amxx_modulesdir addons/amxmodx/modules
|
||||||
amxx_vault addons/amxx/data/vault.ini
|
amxx_vault addons/amxmodx/data/vault.ini
|
||||||
|
|
||||||
; Logging mode
|
; Logging mode
|
||||||
; 0 - no logging
|
; 0 - no logging
|
||||||
|
@ -86,3 +86,10 @@ amx_statsx_freeze -2.0
|
|||||||
|
|
||||||
//If you set this to 0, clients cannot chose their language
|
//If you set this to 0, clients cannot chose their language
|
||||||
amx_client_languages 1
|
amx_client_languages 1
|
||||||
|
|
||||||
|
// Plugin Debug mode
|
||||||
|
// 0 - No debugging (garbage line numbers)
|
||||||
|
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
|
||||||
|
// 2 - All plugins are put in debug mode
|
||||||
|
// Note - debug mode will affect JIT performance
|
||||||
|
amx_debug 1
|
@ -1,14 +1,14 @@
|
|||||||
; Configuration file for AMX Mod X
|
; Configuration file for AMX Mod X
|
||||||
amxx_logdir addons/amxx/logs
|
amxx_logdir addons/amxmodx/logs
|
||||||
amxx_configsdir addons/amxx/configs
|
amxx_configsdir addons/amxmodx/configs
|
||||||
amxx_datadir addons/amxx/data
|
amxx_datadir addons/amxmodx/data
|
||||||
amxx_modules addons/amxx/configs/modules.ini
|
amxx_modules addons/amxmodx/configs/modules.ini
|
||||||
amxx_plugins addons/amxx/configs/plugins.ini
|
amxx_plugins addons/amxmodx/configs/plugins.ini
|
||||||
amxx_pluginsdir addons/amxx/plugins
|
amxx_pluginsdir addons/amxmodx/plugins
|
||||||
amxx_modulesdir addons/amxx/modules
|
amxx_modulesdir addons/amxmodx/modules
|
||||||
amxx_vault addons/amxx/data/vault.ini
|
amxx_vault addons/amxmodx/data/vault.ini
|
||||||
csstats_score addons/amxx/data/csstats.amxx
|
csstats_score addons/amxmodx/data/csstats.amxx
|
||||||
csstats addons/amxx/data/csstats.dat
|
csstats addons/amxmodx/data/csstats.dat
|
||||||
|
|
||||||
; Logging mode
|
; Logging mode
|
||||||
; 0 - no logging
|
; 0 - no logging
|
||||||
|
@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
|
|||||||
|
|
||||||
; Chat / Messages
|
; Chat / Messages
|
||||||
adminchat.amxx ; console chat commands
|
adminchat.amxx ; console chat commands
|
||||||
;antiflood.amxx ; prevent clients from chat-flooding the server
|
antiflood.amxx ; prevent clients from chat-flooding the server
|
||||||
scrollmsg.amxx ; displays a scrolling message
|
scrollmsg.amxx ; displays a scrolling message
|
||||||
imessage.amxx ; displays information messages
|
imessage.amxx ; displays information messages
|
||||||
adminvote.amxx ; vote commands
|
adminvote.amxx ; vote commands
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
; Configuration file for AMX Mod X
|
; Configuration file for AMX Mod X
|
||||||
amxx_logdir addons/amxx/logs
|
amxx_logdir addons/amxmodx/logs
|
||||||
amxx_configsdir addons/amxx/configs
|
amxx_configsdir addons/amxmodx/configs
|
||||||
amxx_datadir addons/amxx/data
|
amxx_datadir addons/amxmodx/data
|
||||||
amxx_modules addons/amxx/configs/modules.ini
|
amxx_modules addons/amxmodx/configs/modules.ini
|
||||||
amxx_plugins addons/amxx/configs/plugins.ini
|
amxx_plugins addons/amxmodx/configs/plugins.ini
|
||||||
amxx_pluginsdir addons/amxx/plugins
|
amxx_pluginsdir addons/amxmodx/plugins
|
||||||
amxx_modulesdir addons/amxx/modules
|
amxx_modulesdir addons/amxmodx/modules
|
||||||
amxx_vault addons/amxx/data/vault.ini
|
amxx_vault addons/amxmodx/data/vault.ini
|
||||||
|
|
||||||
; Logging mode
|
; Logging mode
|
||||||
; 0 - no logging
|
; 0 - no logging
|
||||||
@ -15,5 +15,5 @@ amxx_vault addons/amxx/data/vault.ini
|
|||||||
; 3 - HL Logs
|
; 3 - HL Logs
|
||||||
amx_logging 1
|
amx_logging 1
|
||||||
|
|
||||||
dodstats_score addons/amxx/data/dodstats.amxx
|
dodstats_score addons/amxmodx/data/dodstats.amxx
|
||||||
dodstats addons/amxx/data/dodstats.dat
|
dodstats addons/amxmodx/data/dodstats.dat
|
||||||
|
@ -10,29 +10,38 @@
|
|||||||
"pausable" "0" "1" "u"
|
"pausable" "0" "1" "u"
|
||||||
"sv_voiceenable" "0" "1" "u"
|
"sv_voiceenable" "0" "1" "u"
|
||||||
"mp_chattime" "0" "1" "3" "u"
|
"mp_chattime" "0" "1" "3" "u"
|
||||||
"mp_logmessages" "0" "1" "u"
|
|
||||||
"mp_friendlyfire" "0" "1" "u"
|
"mp_friendlyfire" "0" "1" "u"
|
||||||
"mp_allowspectators" "0" "1" "u"
|
"mp_allowspectators" "0" "1" "u"
|
||||||
|
"mp_flashlight" "0" "1" "u"
|
||||||
"mp_deathmsg" "0" "1" "u"
|
"mp_deathmsg" "0" "1" "u"
|
||||||
"mp_fadetoblack" "0" "1" "u"
|
"mp_fadetoblack" "0" "1" "u"
|
||||||
"mp_tkpenalty" "-1" "3" "6" "u"
|
"mp_tkpenalty" "0" "3" "6" "u"
|
||||||
"mp_limitallies30cal" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_spawnbazookas" "0" "1" "u"
|
||||||
"mp_limitalliesbar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
|
||||||
"mp_limitalliescarbine" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
|
||||||
"mp_limitalliesgarand" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitalliesgarand" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitalliescarbine" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitalliesthompson" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitalliesgreasegun" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitalliesgreasegun" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitalliesspring" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitalliesspring" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitalliesthompson" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitalliesbar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxisfg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitallies30cal" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxisfg42s" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitalliesbazooka" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxisk43" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitalliesmortar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxiskar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitaxiskar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxismg34" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitaxisk43" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxismg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
|
||||||
"mp_limitaxismp40" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitaxismp40" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxismp44" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitaxismp44" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitaxisscopedkar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitaxisscopedkar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitbritassault" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitaxisfg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitaxisfg42s" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitaxismg34" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitaxismg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_combinemglimits" "0" "1" "u"
|
||||||
|
"mp_limitaxispschreck" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitaxismortar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitbritlight" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitbritlight" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitbritmg" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitbritassault" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
"mp_limitbritsniper" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
"mp_limitbritsniper" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitbritmg" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitbritpiat" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
"mp_limitbritmortar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
|
|||||||
|
|
||||||
; Chat / Messages
|
; Chat / Messages
|
||||||
adminchat.amxx ; console chat commands
|
adminchat.amxx ; console chat commands
|
||||||
;antiflood.amxx ; prevent clients from chat-flooding the server
|
antiflood.amxx ; prevent clients from chat-flooding the server
|
||||||
scrollmsg.amxx ; displays a scrolling message
|
scrollmsg.amxx ; displays a scrolling message
|
||||||
imessage.amxx ; displays information messages
|
imessage.amxx ; displays information messages
|
||||||
adminvote.amxx ; vote commands
|
adminvote.amxx ; vote commands
|
||||||
|
@ -73,3 +73,10 @@ amx_mapnum_ignore 0
|
|||||||
|
|
||||||
//If you set this to 0, clients cannot chose their language
|
//If you set this to 0, clients cannot chose their language
|
||||||
amx_client_languages 1
|
amx_client_languages 1
|
||||||
|
|
||||||
|
// Plugin Debug mode
|
||||||
|
// 0 - No debugging (garbage line numbers)
|
||||||
|
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
|
||||||
|
// 2 - All plugins are put in debug mode
|
||||||
|
// Note - debug mode will affect JIT performance
|
||||||
|
amx_debug 1
|
@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
|
|||||||
|
|
||||||
; Chat / Messages
|
; Chat / Messages
|
||||||
adminchat.amxx ; console chat commands
|
adminchat.amxx ; console chat commands
|
||||||
;antiflood.amxx ; prevent clients from chat-flooding the server
|
antiflood.amxx ; prevent clients from chat-flooding the server
|
||||||
scrollmsg.amxx ; displays a scrolling message
|
scrollmsg.amxx ; displays a scrolling message
|
||||||
imessage.amxx ; displays information messages
|
imessage.amxx ; displays information messages
|
||||||
adminvote.amxx ; vote commands
|
adminvote.amxx ; vote commands
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
; Configuration file for AMX Mod X
|
; Configuration file for AMX Mod X
|
||||||
amxx_logdir addons/amxx/logs
|
amxx_logdir addons/amxmodx/logs
|
||||||
amxx_configsdir addons/amxx/configs
|
amxx_configsdir addons/amxmodx/configs
|
||||||
amxx_datadir addons/amxx/data
|
amxx_datadir addons/amxmodx/data
|
||||||
amxx_modules addons/amxx/configs/modules.ini
|
amxx_modules addons/amxmodx/configs/modules.ini
|
||||||
amxx_plugins addons/amxx/configs/plugins.ini
|
amxx_plugins addons/amxmodx/configs/plugins.ini
|
||||||
amxx_pluginsdir addons/amxx/plugins
|
amxx_pluginsdir addons/amxmodx/plugins
|
||||||
amxx_modulesdir addons/amxx/modules
|
amxx_modulesdir addons/amxmodx/modules
|
||||||
amxx_vault addons/amxx/data/vault.ini
|
amxx_vault addons/amxmodx/data/vault.ini
|
||||||
tfcstats_score addons/amxx/data/tfcstats.amxx
|
tfcstats_score addons/amxmodx/data/tfcstats.amxx
|
||||||
tfcstats addons/amxx/data/tfcstats.dat
|
tfcstats addons/amxmodx/data/tfcstats.dat
|
||||||
|
|
||||||
; Logging mode
|
; Logging mode
|
||||||
; 0 - no logging
|
; 0 - no logging
|
||||||
|
@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
|
|||||||
|
|
||||||
; Chat / Messages
|
; Chat / Messages
|
||||||
adminchat.amxx ; console chat commands
|
adminchat.amxx ; console chat commands
|
||||||
;antiflood.amxx ; prevent clients from chat-flooding the server
|
antiflood.amxx ; prevent clients from chat-flooding the server
|
||||||
scrollmsg.amxx ; displays a scrolling message
|
scrollmsg.amxx ; displays a scrolling message
|
||||||
imessage.amxx ; displays information messages
|
imessage.amxx ; displays information messages
|
||||||
adminvote.amxx ; vote commands
|
adminvote.amxx ; vote commands
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
; Configuration file for AMX Mod X
|
; Configuration file for AMX Mod X
|
||||||
amxx_logdir addons/amxx/logs
|
amxx_logdir addons/amxmodx/logs
|
||||||
amxx_configsdir addons/amxx/configs
|
amxx_configsdir addons/amxmodx/configs
|
||||||
amxx_datadir addons/amxx/data
|
amxx_datadir addons/amxmodx/data
|
||||||
amxx_modules addons/amxx/configs/modules.inia
|
amxx_modules addons/amxmodx/configs/modules.inia
|
||||||
mxx_plugins addons/amxx/configs/plugins.ini
|
mxx_plugins addons/amxmodx/configs/plugins.ini
|
||||||
amxx_pluginsdir addons/amxx/plugins
|
amxx_pluginsdir addons/amxmodx/plugins
|
||||||
amxx_modulesdir addons/amxx/modules
|
amxx_modulesdir addons/amxmodx/modules
|
||||||
amxx_vault addons/amxx/data/vault.ini
|
amxx_vault addons/amxmodx/data/vault.ini
|
||||||
tsstats_score addons/amxx/data/tsstats.amxx
|
tsstats_score addons/amxmodx/data/tsstats.amxx
|
||||||
tsstats addons/amxx/data/tsstats.dat
|
tsstats addons/amxmodx/data/tsstats.dat
|
||||||
|
|
||||||
; Logging mode
|
; Logging mode
|
||||||
; 0 - no logging
|
; 0 - no logging
|
||||||
|
@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
|
|||||||
|
|
||||||
; Chat / Messages
|
; Chat / Messages
|
||||||
adminchat.amxx ; console chat commands
|
adminchat.amxx ; console chat commands
|
||||||
;antiflood.amxx ; prevent clients from chat-flooding the server
|
antiflood.amxx ; prevent clients from chat-flooding the server
|
||||||
scrollmsg.amxx ; displays a scrolling message
|
scrollmsg.amxx ; displays a scrolling message
|
||||||
imessage.amxx ; displays information messages
|
imessage.amxx ; displays information messages
|
||||||
adminvote.amxx ; vote commands
|
adminvote.amxx ; vote commands
|
||||||
|
@ -130,7 +130,7 @@ void RankSystem::clear(){
|
|||||||
|
|
||||||
bool RankSystem::loadCalc(const char* filename, char* error)
|
bool RankSystem::loadCalc(const char* filename, char* error)
|
||||||
{
|
{
|
||||||
if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error)!=AMX_ERR_NONE)||
|
if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
|
||||||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
|
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
|
||||||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
|
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
|
||||||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
|
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
$PROJECT = "csstats_amxx";
|
$PROJECT = "csstats_amxx";
|
||||||
$sdk = "../../../hlsdk/SourceCode";
|
$sdk = "../../../hlsdk/SourceCode";
|
||||||
$mm = "../../../metamod/metamod";
|
$mm = "../../../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
@CPP_SOURCE_FILES = ("amxxmodule.cpp", "CMisc.cpp", "usermsg.cpp", "meta_api.cpp", "rank.cpp", "CRank.cpp");
|
@CPP_SOURCE_FILES = ("amxxmodule.cpp", "CMisc.cpp", "usermsg.cpp", "meta_api.cpp", "rank.cpp", "CRank.cpp");
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ $mm = "../../../metamod/metamod";
|
|||||||
my %OPTIONS, %OPT;
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
$OPT{"debug"} = "-g -ggdb";
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ while ($cmd = shift)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = `gcc --version`;
|
$gcc = `$gccf --version`;
|
||||||
if ($gcc =~ /2\.9/)
|
if ($gcc =~ /2\.9/)
|
||||||
{
|
{
|
||||||
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
@ -134,11 +135,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.cpp/\.o/;
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "gcc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -160,7 +161,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -172,6 +173,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = "gcc $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
|
@ -2477,6 +2477,11 @@ PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2520,6 +2525,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2527,6 +2534,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
||||||
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
||||||
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
||||||
|
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
|
||||||
|
|
||||||
// String / mem in amx scripts support
|
// String / mem in amx scripts support
|
||||||
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
||||||
@ -2540,6 +2548,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
||||||
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
||||||
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
||||||
|
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
|
||||||
|
|
||||||
// Natives / Forwards
|
// Natives / Forwards
|
||||||
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
||||||
@ -2572,6 +2581,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2666,11 +2677,14 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||||
MF_AmxFindPublic(0, 0, 0);
|
MF_AmxFindPublic(0, 0, 0);
|
||||||
MF_AmxAllot(0, 0, 0, 0);
|
MF_AmxAllot(0, 0, 0, 0);
|
||||||
MF_LoadAmxScript(0, 0, 0, 0);
|
MF_LoadAmxScript(0, 0, 0, 0, 0);
|
||||||
MF_UnloadAmxScript(0, 0);
|
MF_UnloadAmxScript(0, 0);
|
||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2787,7 +2801,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2800,7 +2814,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2814,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2826,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
|
@ -204,11 +204,9 @@ typedef struct tagAMX {
|
|||||||
cell reset_stk PACKED;
|
cell reset_stk PACKED;
|
||||||
cell reset_hea PACKED;
|
cell reset_hea PACKED;
|
||||||
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
||||||
#if defined JIT
|
|
||||||
/* support variables for the JIT */
|
/* support variables for the JIT */
|
||||||
int reloc_size PACKED; /* required temporary buffer for relocations */
|
int reloc_size PACKED; /* required temporary buffer for relocations */
|
||||||
long code_size PACKED; /* estimated memory footprint of the native code */
|
long code_size PACKED; /* estimated memory footprint of the native code */
|
||||||
#endif
|
|
||||||
} AMX;
|
} AMX;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -240,6 +238,14 @@ enum {
|
|||||||
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined AMX_NO_ALIGN
|
||||||
|
#if defined __linux__
|
||||||
|
#pragma pack() /* reset default packing */
|
||||||
|
#else
|
||||||
|
#pragma pack(pop) /* reset previous packing */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ***** declare functions *****
|
// ***** declare functions *****
|
||||||
|
|
||||||
@ -1926,6 +1932,7 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
||||||
|
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
||||||
@ -1937,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1947,13 +1960,16 @@ typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*in
|
|||||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
|
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||||
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -2005,6 +2021,11 @@ extern PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
extern PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2053,6 +2074,9 @@ cell amx_ftoc (float x) { }
|
|||||||
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2098,13 +2122,18 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_AmxExecv g_fn_AmxExecv
|
#define MF_AmxExecv g_fn_AmxExecv
|
||||||
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
||||||
#define MF_AmxAllot g_fn_AmxAllot
|
#define MF_AmxAllot g_fn_AmxAllot
|
||||||
|
#define MF_AmxFindNative g_fn_AmxFindNative
|
||||||
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
||||||
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
||||||
|
#define MF_MergeDefinitionFile g_fn_MergeDefinition_File
|
||||||
#define amx_ctof g_fn_CellToReal
|
#define amx_ctof g_fn_CellToReal
|
||||||
#define amx_ftoc g_fn_RealToCell
|
#define amx_ftoc g_fn_RealToCell
|
||||||
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
|
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
|
||||||
|
#define MF_Format g_fn_Format;
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -289,7 +289,7 @@ void OnMetaAttach() {
|
|||||||
|
|
||||||
void OnAmxxAttach(){
|
void OnAmxxAttach(){
|
||||||
MF_AddNatives(stats_Natives);
|
MF_AddNatives(stats_Natives);
|
||||||
const char* path = get_localinfo("csstats_score","addons/amxx/data/csstats.amxx");
|
const char* path = get_localinfo("csstats_score","addons/amxmodx/data/csstats.amxx");
|
||||||
if ( path && *path )
|
if ( path && *path )
|
||||||
{
|
{
|
||||||
char error[128];
|
char error[128];
|
||||||
@ -299,7 +299,7 @@ void OnAmxxAttach(){
|
|||||||
if ( !g_rank.begin() )
|
if ( !g_rank.begin() )
|
||||||
{
|
{
|
||||||
g_rank.loadRank( MF_BuildPathname("%s",
|
g_rank.loadRank( MF_BuildPathname("%s",
|
||||||
get_localinfo("csstats","addons/amxx/data/csstats.dat") ) );
|
get_localinfo("csstats","addons/amxmodx/data/csstats.dat") ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#define __MODULECONFIG_H__
|
#define __MODULECONFIG_H__
|
||||||
|
|
||||||
// Module info
|
// Module info
|
||||||
#define MODULE_NAME "CS Stats"
|
#define MODULE_NAME "CSStats"
|
||||||
#define MODULE_VERSION "0.20"
|
#define MODULE_VERSION "0.20"
|
||||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||||
#define MODULE_URL "http://www.amxmodx.org"
|
#define MODULE_URL "http://www.amxmodx.org"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
$PROJECT = "cstrike_amxx";
|
$PROJECT = "cstrike_amxx";
|
||||||
$sdk = "../hlsdk/SourceCode";
|
$sdk = "../hlsdk/SourceCode";
|
||||||
$mm = "../metamod/metamod";
|
$mm = "../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
@CPP_SOURCE_FILES = ("CstrikePlayer.cpp", "cstrike.cpp", "amxxmodule.cpp");
|
@CPP_SOURCE_FILES = ("CstrikePlayer.cpp", "cstrike.cpp", "amxxmodule.cpp");
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ $mm = "../metamod/metamod";
|
|||||||
my %OPTIONS, %OPT;
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
$OPT{"debug"} = "-g -ggdb";
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ while ($cmd = shift)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = `gcc --version`;
|
$gcc = `$gccf --version`;
|
||||||
if ($gcc =~ /2\.9/)
|
if ($gcc =~ /2\.9/)
|
||||||
{
|
{
|
||||||
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
@ -72,7 +73,7 @@ if ($OPTIONS{"debug"})
|
|||||||
|
|
||||||
if ($OPTIONS{"amd64"})
|
if ($OPTIONS{"amd64"})
|
||||||
{
|
{
|
||||||
$cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags";
|
$cflags = " -m64 -DSMALL_CELL_SIZE=64 $cflags";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($OPTIONS{"debug"})
|
if ($OPTIONS{"debug"})
|
||||||
@ -134,11 +135,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.cpp/\.o/;
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "gcc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -160,7 +161,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -172,5 +173,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = "gcc $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
|
@ -2477,6 +2477,11 @@ PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2520,6 +2525,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2527,6 +2534,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
||||||
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
||||||
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
||||||
|
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
|
||||||
|
|
||||||
// String / mem in amx scripts support
|
// String / mem in amx scripts support
|
||||||
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
||||||
@ -2540,6 +2548,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
||||||
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
||||||
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
||||||
|
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
|
||||||
|
|
||||||
// Natives / Forwards
|
// Natives / Forwards
|
||||||
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
||||||
@ -2572,6 +2581,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2666,11 +2677,14 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||||
MF_AmxFindPublic(0, 0, 0);
|
MF_AmxFindPublic(0, 0, 0);
|
||||||
MF_AmxAllot(0, 0, 0, 0);
|
MF_AmxAllot(0, 0, 0, 0);
|
||||||
MF_LoadAmxScript(0, 0, 0, 0);
|
MF_LoadAmxScript(0, 0, 0, 0, 0);
|
||||||
MF_UnloadAmxScript(0, 0);
|
MF_UnloadAmxScript(0, 0);
|
||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2787,7 +2801,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2800,7 +2814,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2814,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2826,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
|
@ -204,11 +204,9 @@ typedef struct tagAMX {
|
|||||||
cell reset_stk PACKED;
|
cell reset_stk PACKED;
|
||||||
cell reset_hea PACKED;
|
cell reset_hea PACKED;
|
||||||
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
||||||
#if defined JIT
|
|
||||||
/* support variables for the JIT */
|
/* support variables for the JIT */
|
||||||
int reloc_size PACKED; /* required temporary buffer for relocations */
|
int reloc_size PACKED; /* required temporary buffer for relocations */
|
||||||
long code_size PACKED; /* estimated memory footprint of the native code */
|
long code_size PACKED; /* estimated memory footprint of the native code */
|
||||||
#endif
|
|
||||||
} AMX;
|
} AMX;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -240,6 +238,14 @@ enum {
|
|||||||
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined AMX_NO_ALIGN
|
||||||
|
#if defined __linux__
|
||||||
|
#pragma pack() /* reset default packing */
|
||||||
|
#else
|
||||||
|
#pragma pack(pop) /* reset previous packing */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ***** declare functions *****
|
// ***** declare functions *****
|
||||||
|
|
||||||
@ -257,9 +263,9 @@ void FN_META_QUERY(void);
|
|||||||
void FN_META_ATTACH(void);
|
void FN_META_ATTACH(void);
|
||||||
#endif // FN_META_ATTACH
|
#endif // FN_META_ATTACH
|
||||||
|
|
||||||
#ifdef FN_META_DETTACH
|
#ifdef FN_META_DETACH
|
||||||
void FN_META_DETTACH(void);
|
void FN_META_DETACH(void);
|
||||||
#endif // FN_META_DETTACH
|
#endif // FN_META_DETACH
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1869,9 +1875,9 @@ void FN_AMXX_QUERY(void);
|
|||||||
void FN_AMXX_ATTACH(void);
|
void FN_AMXX_ATTACH(void);
|
||||||
#endif // FN_AMXX_ATTACH
|
#endif // FN_AMXX_ATTACH
|
||||||
|
|
||||||
#ifdef FN_AMXX_DETTACH
|
#ifdef FN_AMXX_DETACH
|
||||||
void FN_AMXX_DETTACH(void);
|
void FN_AMXX_DETACH(void);
|
||||||
#endif // FN_AMXX_DETTACH
|
#endif // FN_AMXX_DETACH
|
||||||
|
|
||||||
#ifdef FN_AMXX_PLUGINSLOADED
|
#ifdef FN_AMXX_PLUGINSLOADED
|
||||||
void FN_AMXX_PLUGINSLOADED(void);
|
void FN_AMXX_PLUGINSLOADED(void);
|
||||||
@ -1926,6 +1932,7 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
||||||
|
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
||||||
@ -1937,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1947,13 +1960,16 @@ typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*in
|
|||||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
|
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||||
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -2005,6 +2021,11 @@ extern PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
extern PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2053,6 +2074,9 @@ cell amx_ftoc (float x) { }
|
|||||||
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2098,13 +2122,18 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_AmxExecv g_fn_AmxExecv
|
#define MF_AmxExecv g_fn_AmxExecv
|
||||||
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
||||||
#define MF_AmxAllot g_fn_AmxAllot
|
#define MF_AmxAllot g_fn_AmxAllot
|
||||||
|
#define MF_AmxFindNative g_fn_AmxFindNative
|
||||||
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
||||||
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
||||||
|
#define MF_MergeDefinitionFile g_fn_MergeDefinition_File
|
||||||
#define amx_ctof g_fn_CellToReal
|
#define amx_ctof g_fn_CellToReal
|
||||||
#define amx_ftoc g_fn_RealToCell
|
#define amx_ftoc g_fn_RealToCell
|
||||||
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
|
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
|
||||||
|
#define MF_Format g_fn_Format;
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
$PROJECT = "dodfun_amxx";
|
$PROJECT = "dodfun_amxx";
|
||||||
$sdk = "../../../hlsdk/SourceCode";
|
$sdk = "../../../hlsdk/SourceCode";
|
||||||
$mm = "../../../metamod/metamod";
|
$mm = "../../../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
@CPP_SOURCE_FILES = ("CMisc.cpp", "NPD.cpp", "NBase.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp");
|
@CPP_SOURCE_FILES = ("CMisc.cpp", "NPD.cpp", "NBase.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp");
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ $mm = "../../../metamod/metamod";
|
|||||||
my %OPTIONS, %OPT;
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
$OPT{"debug"} = "-g -ggdb";
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ while ($cmd = shift)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = `gcc --version`;
|
$gcc = `$gccf --version`;
|
||||||
if ($gcc =~ /2\.9/)
|
if ($gcc =~ /2\.9/)
|
||||||
{
|
{
|
||||||
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
@ -134,11 +135,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.cpp/\.o/;
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "gcc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -160,7 +161,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -172,6 +173,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = "gcc $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
|
@ -274,9 +274,9 @@ static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){
|
|||||||
case DODW_KAR:
|
case DODW_KAR:
|
||||||
case DODW_SCOPED_KAR:
|
case DODW_SCOPED_KAR:
|
||||||
case DODW_ENFIELD:
|
case DODW_ENFIELD:
|
||||||
*( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET ) = params[3];
|
*( (int*)pPlayer->pEdict->pvPrivateData + 54+LINUXOFFSET ) = params[3];
|
||||||
*( (int*)pPlayer->pEdict->pvPrivateData + 281+LINUXOFFSET ) = params[3];
|
*( (int*)pPlayer->pEdict->pvPrivateData + 283+LINUXOFFSET ) = params[3];
|
||||||
*( (int*)pPlayer->pEdict->pvPrivateData + 313+LINUXOFFSET ) = params[3];
|
*( (int*)pPlayer->pEdict->pvPrivateData + 315+LINUXOFFSET ) = params[3];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//57,286,318
|
//57,286,318
|
||||||
@ -284,9 +284,9 @@ static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){
|
|||||||
case DODW_BAR:
|
case DODW_BAR:
|
||||||
case DODW_FG42:
|
case DODW_FG42:
|
||||||
case DODW_BREN:
|
case DODW_BREN:
|
||||||
*( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET ) = params[3];
|
*( (int*)pPlayer->pEdict->pvPrivateData + 57+LINUXOFFSET ) = params[3];
|
||||||
*( (int*)pPlayer->pEdict->pvPrivateData + 281+LINUXOFFSET ) = params[3];
|
*( (int*)pPlayer->pEdict->pvPrivateData + 286+LINUXOFFSET ) = params[3];
|
||||||
*( (int*)pPlayer->pEdict->pvPrivateData + 313+LINUXOFFSET ) = params[3];
|
*( (int*)pPlayer->pEdict->pvPrivateData + 318+LINUXOFFSET ) = params[3];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//56,281,313
|
//56,281,313
|
||||||
@ -386,7 +386,7 @@ static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){
|
|||||||
case DODW_KAR:
|
case DODW_KAR:
|
||||||
case DODW_SCOPED_KAR:
|
case DODW_SCOPED_KAR:
|
||||||
case DODW_ENFIELD:
|
case DODW_ENFIELD:
|
||||||
return *( (int*)pPlayer->pEdict->pvPrivateData + 56+LINUXOFFSET );
|
return *( (int*)pPlayer->pEdict->pvPrivateData + 54+LINUXOFFSET );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//55,285,317
|
//55,285,317
|
||||||
|
@ -2477,6 +2477,11 @@ PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2520,6 +2525,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2527,6 +2534,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
||||||
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
||||||
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
||||||
|
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
|
||||||
|
|
||||||
// String / mem in amx scripts support
|
// String / mem in amx scripts support
|
||||||
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
||||||
@ -2540,6 +2548,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
||||||
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
||||||
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
||||||
|
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
|
||||||
|
|
||||||
// Natives / Forwards
|
// Natives / Forwards
|
||||||
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
||||||
@ -2572,6 +2581,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2666,11 +2677,14 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||||
MF_AmxFindPublic(0, 0, 0);
|
MF_AmxFindPublic(0, 0, 0);
|
||||||
MF_AmxAllot(0, 0, 0, 0);
|
MF_AmxAllot(0, 0, 0, 0);
|
||||||
MF_LoadAmxScript(0, 0, 0, 0);
|
MF_LoadAmxScript(0, 0, 0, 0, 0);
|
||||||
MF_UnloadAmxScript(0, 0);
|
MF_UnloadAmxScript(0, 0);
|
||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2787,7 +2801,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2800,7 +2814,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2814,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2826,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
|
@ -204,11 +204,9 @@ typedef struct tagAMX {
|
|||||||
cell reset_stk PACKED;
|
cell reset_stk PACKED;
|
||||||
cell reset_hea PACKED;
|
cell reset_hea PACKED;
|
||||||
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
||||||
#if defined JIT
|
|
||||||
/* support variables for the JIT */
|
/* support variables for the JIT */
|
||||||
int reloc_size PACKED; /* required temporary buffer for relocations */
|
int reloc_size PACKED; /* required temporary buffer for relocations */
|
||||||
long code_size PACKED; /* estimated memory footprint of the native code */
|
long code_size PACKED; /* estimated memory footprint of the native code */
|
||||||
#endif
|
|
||||||
} AMX;
|
} AMX;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -240,6 +238,14 @@ enum {
|
|||||||
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined AMX_NO_ALIGN
|
||||||
|
#if defined __linux__
|
||||||
|
#pragma pack() /* reset default packing */
|
||||||
|
#else
|
||||||
|
#pragma pack(pop) /* reset previous packing */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ***** declare functions *****
|
// ***** declare functions *****
|
||||||
|
|
||||||
@ -1926,6 +1932,7 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
||||||
|
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
||||||
@ -1937,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1947,13 +1960,16 @@ typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*in
|
|||||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
|
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||||
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -2005,6 +2021,11 @@ extern PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
extern PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2053,6 +2074,9 @@ cell amx_ftoc (float x) { }
|
|||||||
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2098,13 +2122,18 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_AmxExecv g_fn_AmxExecv
|
#define MF_AmxExecv g_fn_AmxExecv
|
||||||
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
||||||
#define MF_AmxAllot g_fn_AmxAllot
|
#define MF_AmxAllot g_fn_AmxAllot
|
||||||
|
#define MF_AmxFindNative g_fn_AmxFindNative
|
||||||
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
||||||
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
||||||
|
#define MF_MergeDefinitionFile g_fn_MergeDefinition_File
|
||||||
#define amx_ctof g_fn_CellToReal
|
#define amx_ctof g_fn_CellToReal
|
||||||
#define amx_ftoc g_fn_RealToCell
|
#define amx_ftoc g_fn_RealToCell
|
||||||
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
|
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
|
||||||
|
#define MF_Format g_fn_Format;
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#define __MODULECONFIG_H__
|
#define __MODULECONFIG_H__
|
||||||
|
|
||||||
// Module info
|
// Module info
|
||||||
#define MODULE_NAME "Day of Defeat Fun"
|
#define MODULE_NAME "DoD Fun"
|
||||||
#define MODULE_VERSION "0.1"
|
#define MODULE_VERSION "0.1"
|
||||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||||
#define MODULE_URL "http://www.amxmodx.org"
|
#define MODULE_URL "http://www.amxmodx.org"
|
||||||
|
@ -367,6 +367,14 @@ void Forward::exec(int p1,int p2,int p3,int p4,int p5){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Forward::exec(int p1,int p2,int p3){
|
||||||
|
AmxCall* a = head;
|
||||||
|
while ( a ){
|
||||||
|
MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 3,p1, p2, p3);
|
||||||
|
a = a->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Forward::exec(int p1,int p2){
|
void Forward::exec(int p1,int p2){
|
||||||
AmxCall* a = head;
|
AmxCall* a = head;
|
||||||
while ( a ){
|
while ( a ){
|
||||||
|
@ -74,11 +74,14 @@ public:
|
|||||||
int current;
|
int current;
|
||||||
int wpnModel;
|
int wpnModel;
|
||||||
|
|
||||||
int savedScore;
|
float savedScore;
|
||||||
|
int lastScore;
|
||||||
|
int sendScore;
|
||||||
|
|
||||||
bool ingame;
|
bool ingame;
|
||||||
bool bot;
|
bool bot;
|
||||||
float clearStats;
|
float clearStats;
|
||||||
|
float clearRound;
|
||||||
|
|
||||||
struct PlayerWeapon : public Stats {
|
struct PlayerWeapon : public Stats {
|
||||||
char* name;
|
char* name;
|
||||||
@ -178,6 +181,7 @@ public:
|
|||||||
void put( AMX *a , int i );
|
void put( AMX *a , int i );
|
||||||
void exec(int p1,int p2,int p3,int p4,int p5,int p6);
|
void exec(int p1,int p2,int p3,int p4,int p5,int p6);
|
||||||
void exec(int p1,int p2,int p3,int p4,int p5);
|
void exec(int p1,int p2,int p3,int p4,int p5);
|
||||||
|
void exec(int p1,int p2,int p3);
|
||||||
void exec(int p1,int p2);
|
void exec(int p1,int p2);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -147,7 +147,7 @@ void RankSystem::clear(){
|
|||||||
|
|
||||||
bool RankSystem::loadCalc(const char* filename, char* error)
|
bool RankSystem::loadCalc(const char* filename, char* error)
|
||||||
{
|
{
|
||||||
if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error)!=AMX_ERR_NONE)||
|
if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
|
||||||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
|
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
|
||||||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
|
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
|
||||||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
|
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
$PROJECT = "dodx_amxx";
|
$PROJECT = "dodx_amxx";
|
||||||
$sdk = "../../../hlsdk/SourceCode";
|
$sdk = "../../../hlsdk/SourceCode";
|
||||||
$mm = "../../../metamod/metamod";
|
$mm = "../../../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
@CPP_SOURCE_FILES = ("CMisc.cpp", "CRank.cpp", "NBase.cpp", "NRank.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp");
|
@CPP_SOURCE_FILES = ("CMisc.cpp", "CRank.cpp", "NBase.cpp", "NRank.cpp", "Utils.cpp", "moduleconfig.cpp", "usermsg.cpp", "amxxmodule.cpp");
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ $mm = "../../../metamod/metamod";
|
|||||||
my %OPTIONS, %OPT;
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
$OPT{"debug"} = "-g -ggdb";
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ while ($cmd = shift)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = `gcc --version`;
|
$gcc = `$gccf --version`;
|
||||||
if ($gcc =~ /2\.9/)
|
if ($gcc =~ /2\.9/)
|
||||||
{
|
{
|
||||||
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
@ -134,11 +135,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.cpp/\.o/;
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "gcc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -160,7 +161,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -172,6 +173,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = "gcc $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
|
@ -205,11 +205,19 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params){ // forward
|
|||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
if( MF_AmxFindPublic(amx, "client_score", &iFunctionIndex) == AMX_ERR_NONE )
|
||||||
|
g_score_info.put( amx , iFunctionIndex );
|
||||||
|
else
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2477,6 +2477,11 @@ PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2520,6 +2525,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2527,6 +2534,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
||||||
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
||||||
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
||||||
|
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
|
||||||
|
|
||||||
// String / mem in amx scripts support
|
// String / mem in amx scripts support
|
||||||
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
||||||
@ -2540,6 +2548,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
||||||
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
||||||
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
||||||
|
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
|
||||||
|
|
||||||
// Natives / Forwards
|
// Natives / Forwards
|
||||||
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
||||||
@ -2572,6 +2581,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2666,11 +2677,14 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||||
MF_AmxFindPublic(0, 0, 0);
|
MF_AmxFindPublic(0, 0, 0);
|
||||||
MF_AmxAllot(0, 0, 0, 0);
|
MF_AmxAllot(0, 0, 0, 0);
|
||||||
MF_LoadAmxScript(0, 0, 0, 0);
|
MF_LoadAmxScript(0, 0, 0, 0, 0);
|
||||||
MF_UnloadAmxScript(0, 0);
|
MF_UnloadAmxScript(0, 0);
|
||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2787,7 +2801,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2800,7 +2814,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2814,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2826,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
|
@ -204,11 +204,9 @@ typedef struct tagAMX {
|
|||||||
cell reset_stk PACKED;
|
cell reset_stk PACKED;
|
||||||
cell reset_hea PACKED;
|
cell reset_hea PACKED;
|
||||||
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
||||||
#if defined JIT
|
|
||||||
/* support variables for the JIT */
|
/* support variables for the JIT */
|
||||||
int reloc_size PACKED; /* required temporary buffer for relocations */
|
int reloc_size PACKED; /* required temporary buffer for relocations */
|
||||||
long code_size PACKED; /* estimated memory footprint of the native code */
|
long code_size PACKED; /* estimated memory footprint of the native code */
|
||||||
#endif
|
|
||||||
} AMX;
|
} AMX;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -240,6 +238,14 @@ enum {
|
|||||||
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined AMX_NO_ALIGN
|
||||||
|
#if defined __linux__
|
||||||
|
#pragma pack() /* reset default packing */
|
||||||
|
#else
|
||||||
|
#pragma pack(pop) /* reset previous packing */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ***** declare functions *****
|
// ***** declare functions *****
|
||||||
|
|
||||||
@ -1926,6 +1932,7 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
||||||
|
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
||||||
@ -1937,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1947,13 +1960,16 @@ typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*in
|
|||||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
|
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||||
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -2005,6 +2021,11 @@ extern PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
extern PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2053,6 +2074,9 @@ cell amx_ftoc (float x) { }
|
|||||||
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2098,13 +2122,18 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_AmxExecv g_fn_AmxExecv
|
#define MF_AmxExecv g_fn_AmxExecv
|
||||||
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
||||||
#define MF_AmxAllot g_fn_AmxAllot
|
#define MF_AmxAllot g_fn_AmxAllot
|
||||||
|
#define MF_AmxFindNative g_fn_AmxFindNative
|
||||||
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
||||||
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
||||||
|
#define MF_MergeDefinitionFile g_fn_MergeDefinition_File
|
||||||
#define amx_ctof g_fn_CellToReal
|
#define amx_ctof g_fn_CellToReal
|
||||||
#define amx_ftoc g_fn_RealToCell
|
#define amx_ftoc g_fn_RealToCell
|
||||||
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
|
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
|
||||||
|
#define MF_Format g_fn_Format;
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -81,11 +81,13 @@ extern int gmsgPTeam;
|
|||||||
|
|
||||||
extern Forward g_death_info;
|
extern Forward g_death_info;
|
||||||
extern Forward g_damage_info;
|
extern Forward g_damage_info;
|
||||||
|
extern Forward g_score_info;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern int iFDamage;
|
extern int iFDamage;
|
||||||
extern int iFDeath;
|
extern int iFDeath;
|
||||||
|
extern int iFScore;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -51,11 +51,13 @@ int AxisScore;
|
|||||||
|
|
||||||
Forward g_death_info;
|
Forward g_death_info;
|
||||||
Forward g_damage_info;
|
Forward g_damage_info;
|
||||||
|
Forward g_score_info;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int iFDamage;
|
int iFDamage;
|
||||||
int iFDeath;
|
int iFDeath;
|
||||||
|
int iFScore;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -152,16 +154,32 @@ void PlayerPreThink_Post( edict_t *pEntity ) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||||
|
if ( !pPlayer->ingame )
|
||||||
|
return;
|
||||||
|
|
||||||
if (pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time && pPlayer->ingame){
|
if (pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time){
|
||||||
|
if ( !ignoreBots(pEntity) ){
|
||||||
if ( !ignoreBots(pEntity) ){
|
pPlayer->clearStats = 0.0f;
|
||||||
pPlayer->clearStats = 0.0f;
|
pPlayer->rank->updatePosition( &pPlayer->life );
|
||||||
pPlayer->rank->updatePosition( &pPlayer->life );
|
pPlayer->restartStats(false);
|
||||||
pPlayer->restartStats(false);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pPlayer->clearRound && pPlayer->clearRound < gpGlobals->time){
|
||||||
|
pPlayer->clearRound = 0.0f;
|
||||||
|
memset(&pPlayer->round,0,sizeof(pPlayer->round));
|
||||||
|
memset(pPlayer->weaponsRnd,0,sizeof(pPlayer->weaponsRnd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pPlayer->sendScore && pPlayer->sendScore < gpGlobals->time){
|
||||||
|
pPlayer->sendScore = 0.0f;
|
||||||
|
#ifdef FORWARD_OLD_SYSTEM
|
||||||
|
g_score_info.exec( pPlayer->index, pPlayer->lastScore, pPlayer->savedScore );
|
||||||
|
#else
|
||||||
|
MF_ExecuteForward( iFScore,pPlayer->index, pPlayer->lastScore, pPlayer->savedScore );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +201,7 @@ void ServerDeactivate() {
|
|||||||
|
|
||||||
g_damage_info.clear();
|
g_damage_info.clear();
|
||||||
g_death_info.clear();
|
g_death_info.clear();
|
||||||
|
g_score_info.clear();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -372,7 +391,7 @@ void OnAmxxAttach() {
|
|||||||
MF_AddNatives( stats_Natives );
|
MF_AddNatives( stats_Natives );
|
||||||
MF_AddNatives( base_Natives );
|
MF_AddNatives( base_Natives );
|
||||||
|
|
||||||
const char* path = get_localinfo("dodstats_score","addons/amxx/data/dodstats.amxx");
|
const char* path = get_localinfo("dodstats_score","addons/amxmodx/data/dodstats.amxx");
|
||||||
if ( path && *path ) {
|
if ( path && *path ) {
|
||||||
char error[128];
|
char error[128];
|
||||||
g_rank.loadCalc( MF_BuildPathname("%s",path) , error );
|
g_rank.loadCalc( MF_BuildPathname("%s",path) , error );
|
||||||
@ -380,7 +399,7 @@ void OnAmxxAttach() {
|
|||||||
|
|
||||||
if ( !g_rank.begin() ){
|
if ( !g_rank.begin() ){
|
||||||
g_rank.loadRank( MF_BuildPathname("%s",
|
g_rank.loadRank( MF_BuildPathname("%s",
|
||||||
get_localinfo("dodstats","addons/amxx/data/dodstats.dat") ) );
|
get_localinfo("dodstats","addons/amxmodx/data/dodstats.dat") ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
g_map.Init();
|
g_map.Init();
|
||||||
@ -398,7 +417,7 @@ void OnAmxxDetach() {
|
|||||||
void OnPluginsLoaded(){
|
void OnPluginsLoaded(){
|
||||||
iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||||
iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||||
|
iFScore = MF_RegisterForward("client_score",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#define __MODULECONFIG_H__
|
#define __MODULECONFIG_H__
|
||||||
|
|
||||||
// Module info
|
// Module info
|
||||||
#define MODULE_NAME "Day of Defeat X"
|
#define MODULE_NAME "DoDX"
|
||||||
#define MODULE_VERSION "0.20"
|
#define MODULE_VERSION "0.20"
|
||||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||||
#define MODULE_URL "http://www.amxmodx.org"
|
#define MODULE_URL "http://www.amxmodx.org"
|
||||||
|
@ -42,8 +42,7 @@ void Client_RoundState(void* mValue){
|
|||||||
for (int i=1;i<=gpGlobals->maxClients;i++){
|
for (int i=1;i<=gpGlobals->maxClients;i++){
|
||||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
||||||
if (pPlayer->ingame) {
|
if (pPlayer->ingame) {
|
||||||
memset(&pPlayer->round,0,sizeof(pPlayer->round));
|
pPlayer->clearRound = gpGlobals->time + 0.25f;
|
||||||
memset(pPlayer->weaponsRnd,0,sizeof(pPlayer->weaponsRnd));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,18 +69,18 @@ void Client_TeamScore(void* mValue){
|
|||||||
|
|
||||||
void Client_ObjScore(void* mValue){
|
void Client_ObjScore(void* mValue){
|
||||||
static CPlayer *pPlayer;
|
static CPlayer *pPlayer;
|
||||||
static int TMScore; //total map score :-)
|
static int score;
|
||||||
switch(mState++){
|
switch(mState++){
|
||||||
case 0:
|
case 0:
|
||||||
pPlayer = GET_PLAYER_POINTER_I(*(int*)mValue);
|
pPlayer = GET_PLAYER_POINTER_I(*(int*)mValue);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
TMScore = *(int*)mValue;
|
score = *(int*)mValue;
|
||||||
int score = TMScore - pPlayer->savedScore;
|
if ( (pPlayer->lastScore = score - pPlayer->savedScore) && isModuleActive() ){
|
||||||
if ( score && isModuleActive() ){
|
pPlayer->updateScore(pPlayer->current,pPlayer->lastScore);
|
||||||
pPlayer->updateScore(pPlayer->current,score);
|
pPlayer->sendScore = gpGlobals->time + 0.25f;
|
||||||
}
|
}
|
||||||
pPlayer->savedScore = TMScore;
|
pPlayer->savedScore = score;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,30 +33,67 @@
|
|||||||
#define _INCLUDE_CSTRING_H
|
#define _INCLUDE_CSTRING_H
|
||||||
|
|
||||||
//by David "BAILOPAN" Anderson
|
//by David "BAILOPAN" Anderson
|
||||||
class CString
|
class String
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CString() { v = NULL; mSize = 0; }
|
String()
|
||||||
~CString() { if (v) delete [] v; }
|
{
|
||||||
|
v = NULL;
|
||||||
|
mSize = 0;
|
||||||
|
cSize = 0;
|
||||||
|
Grow(2);
|
||||||
|
assign("");
|
||||||
|
}
|
||||||
|
|
||||||
//added these for amxx
|
~String()
|
||||||
CString(const char *src) { v = NULL; mSize = 0; assign(src); }
|
{
|
||||||
CString(CString &src) { v = NULL; mSize = 0; assign(src.c_str()); }
|
if (v)
|
||||||
|
delete [] v;
|
||||||
|
}
|
||||||
|
|
||||||
|
String(const char *src)
|
||||||
|
{
|
||||||
|
v = NULL;
|
||||||
|
mSize = 0;
|
||||||
|
cSize = 0; assign(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
String(String &src)
|
||||||
|
{
|
||||||
|
v = NULL;
|
||||||
|
mSize = 0;
|
||||||
|
cSize = 0;
|
||||||
|
assign(src.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
const char *c_str() { return v?v:""; }
|
const char *c_str() { return v?v:""; }
|
||||||
const char *c_str() const { return v?v:""; }
|
const char *c_str() const { return v?v:""; }
|
||||||
|
|
||||||
void append(const char *t)
|
void append(const char *t)
|
||||||
{
|
{
|
||||||
Grow(strlen(v) + strlen(t));
|
Grow(cSize + strlen(t));
|
||||||
strcat(v, t);
|
strcat(v, t);
|
||||||
|
cSize = strlen(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void append(CString &d)
|
void append(const char c)
|
||||||
|
{
|
||||||
|
Grow(cSize + 2);
|
||||||
|
v[cSize] = c;
|
||||||
|
v[++cSize] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void append(String &d)
|
||||||
{
|
{
|
||||||
const char *t = d.c_str();
|
const char *t = d.c_str();
|
||||||
Grow(strlen(v) + strlen(t));
|
Grow(cSize + strlen(t));
|
||||||
strcat(v, t);
|
strcat(v, t);
|
||||||
|
cSize = strlen(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
void assign(const String &src)
|
||||||
|
{
|
||||||
|
assign(src.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void assign(const char *d)
|
void assign(const char *d)
|
||||||
@ -64,20 +101,27 @@ public:
|
|||||||
if (!d)
|
if (!d)
|
||||||
{
|
{
|
||||||
Grow(1);
|
Grow(1);
|
||||||
|
cSize = 0;
|
||||||
strcpy(v, "");
|
strcpy(v, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Grow(strlen(d));
|
Grow(strlen(d));
|
||||||
if (v)
|
if (v)
|
||||||
|
{
|
||||||
strcpy(v, d);
|
strcpy(v, d);
|
||||||
|
cSize = strlen(v);
|
||||||
|
} else {
|
||||||
|
cSize = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
if (v)
|
if (v)
|
||||||
delete [] v;
|
{
|
||||||
v = NULL;
|
v[0] = 0;
|
||||||
mSize = 0;
|
cSize = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int compare (const char *d)
|
int compare (const char *d)
|
||||||
@ -100,7 +144,7 @@ public:
|
|||||||
//Added this for amxx inclusion
|
//Added this for amxx inclusion
|
||||||
bool empty()
|
bool empty()
|
||||||
{
|
{
|
||||||
if (!v || !mSize)
|
if (!v || !cSize)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -110,20 +154,239 @@ public:
|
|||||||
{
|
{
|
||||||
if (!v)
|
if (!v)
|
||||||
return 0;
|
return 0;
|
||||||
return strlen(v);
|
return cSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * _fread(FILE *fp)
|
||||||
|
{
|
||||||
|
Grow(512);
|
||||||
|
char * ret = fgets(v, 511, fp);
|
||||||
|
cSize = strlen(v);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int find(const char c, int index = 0)
|
||||||
|
{
|
||||||
|
if (!v)
|
||||||
|
return npos;
|
||||||
|
if (index >= (int)cSize || index < 0)
|
||||||
|
return npos;
|
||||||
|
unsigned int i = 0;
|
||||||
|
for (i=index; i<cSize; i++)
|
||||||
|
{
|
||||||
|
if (v[i] == c)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return npos;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_space(int c)
|
||||||
|
{
|
||||||
|
if (c == '\f' || c == '\n' ||
|
||||||
|
c == '\t' || c == '\r' ||
|
||||||
|
c == 'v' || c == ' ')
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void trim()
|
||||||
|
{
|
||||||
|
if (!v)
|
||||||
|
return;
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int j = 0;
|
||||||
|
|
||||||
|
if (cSize == 1)
|
||||||
|
{
|
||||||
|
if (is_space(v[i]))
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char c0 = v[0];
|
||||||
|
|
||||||
|
if (is_space(c0))
|
||||||
|
{
|
||||||
|
for (i=0; i<cSize; i++)
|
||||||
|
{
|
||||||
|
if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==cSize-1)))
|
||||||
|
{
|
||||||
|
erase(0, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cSize = strlen(v);
|
||||||
|
|
||||||
|
if (cSize < 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_space(v[cSize-1]))
|
||||||
|
{
|
||||||
|
for (i=cSize-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
if (!is_space(v[i])
|
||||||
|
|| (is_space(v[i]) && i==0))
|
||||||
|
{
|
||||||
|
erase(i+1, j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cSize == 1)
|
||||||
|
{
|
||||||
|
if (is_space(v[0]))
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String & erase(unsigned int start, int num = npos)
|
||||||
|
{
|
||||||
|
if (!v)
|
||||||
|
return (*this);
|
||||||
|
unsigned int i = 0;
|
||||||
|
//check for bounds
|
||||||
|
if (num == npos || start+num > cSize-num+1)
|
||||||
|
num = cSize - start;
|
||||||
|
//do the erasing
|
||||||
|
bool copyflag = false;
|
||||||
|
for (i=0; i<cSize; i++)
|
||||||
|
{
|
||||||
|
if (i>=start && i<start+num)
|
||||||
|
{
|
||||||
|
if (i+num < cSize)
|
||||||
|
{
|
||||||
|
v[i] = v[i+num];
|
||||||
|
} else {
|
||||||
|
v[i] = 0;
|
||||||
|
}
|
||||||
|
copyflag = true;
|
||||||
|
} else if (copyflag) {
|
||||||
|
if (i+num < cSize)
|
||||||
|
{
|
||||||
|
v[i] = v[i+num];
|
||||||
|
} else {
|
||||||
|
v[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cSize -= num;
|
||||||
|
v[cSize] = 0;
|
||||||
|
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
String substr(unsigned int index, int num = npos)
|
||||||
|
{
|
||||||
|
String ns;
|
||||||
|
|
||||||
|
if (index >= cSize || !v)
|
||||||
|
return ns;
|
||||||
|
|
||||||
|
if (num == npos)
|
||||||
|
{
|
||||||
|
num = cSize - index;
|
||||||
|
} else if (index+num >= cSize) {
|
||||||
|
num = cSize - index;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int i = 0, j=0;
|
||||||
|
char *s = new char[cSize+1];
|
||||||
|
|
||||||
|
for (i=index; i<index+num; i++)
|
||||||
|
{
|
||||||
|
s[j++] = v[i];
|
||||||
|
}
|
||||||
|
s[j] = 0;
|
||||||
|
|
||||||
|
ns.assign(s);
|
||||||
|
|
||||||
|
delete [] s;
|
||||||
|
|
||||||
|
return ns;
|
||||||
|
}
|
||||||
|
|
||||||
|
void toLower()
|
||||||
|
{
|
||||||
|
if (!v)
|
||||||
|
return;
|
||||||
|
unsigned int i = 0;
|
||||||
|
for (i=0; i<cSize; i++)
|
||||||
|
{
|
||||||
|
if (v[i] >= 65 && v[i] <= 90)
|
||||||
|
v[i] |= 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String & operator = (const String &src)
|
||||||
|
{
|
||||||
|
assign(src);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
String & operator = (const char *src)
|
||||||
|
{
|
||||||
|
assign(src);
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
char operator [] (unsigned int index)
|
||||||
|
{
|
||||||
|
if (index > cSize)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return v[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int at(int a)
|
||||||
|
{
|
||||||
|
if (a < 0 || a >= (int)cSize)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return v[a];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool at(int at, char c)
|
||||||
|
{
|
||||||
|
if (at < 0 || at >= (int)cSize)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
v[at] = c;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Grow(int d)
|
void Grow(unsigned int d)
|
||||||
{
|
{
|
||||||
if (d<1)
|
if (d<1)
|
||||||
return;
|
return;
|
||||||
if (d > mSize)
|
if (d > mSize)
|
||||||
{
|
{
|
||||||
|
mSize = d + 16; // allocate a buffer
|
||||||
char *t = new char[d+1];
|
char *t = new char[d+1];
|
||||||
if (v) {
|
if (v) {
|
||||||
strcpy(t, v);
|
strcpy(t, v);
|
||||||
t[strlen(v)] = 0;
|
t[cSize] = 0;
|
||||||
delete [] v;
|
delete [] v;
|
||||||
}
|
}
|
||||||
v = t;
|
v = t;
|
||||||
@ -132,7 +395,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *v;
|
char *v;
|
||||||
int mSize;
|
unsigned int mSize;
|
||||||
|
unsigned int cSize;
|
||||||
|
public:
|
||||||
|
static const int npos = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_INCLUDE_CSTRING_H
|
#endif //_INCLUDE_CSTRING_H
|
@ -32,6 +32,8 @@
|
|||||||
#ifndef __CVECTOR_H__
|
#ifndef __CVECTOR_H__
|
||||||
#define __CVECTOR_H__
|
#define __CVECTOR_H__
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
// Vector
|
// Vector
|
||||||
template <class T> class CVector
|
template <class T> class CVector
|
||||||
{
|
{
|
||||||
@ -284,7 +286,7 @@ public:
|
|||||||
iterator iterAt(size_t pos)
|
iterator iterAt(size_t pos)
|
||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
return iterator(m_Data + pos);
|
return iterator(m_Data + pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +333,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[pos];
|
return m_Data[pos];
|
||||||
}
|
}
|
||||||
@ -340,7 +342,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[pos];
|
return m_Data[pos];
|
||||||
}
|
}
|
||||||
@ -359,7 +361,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[0];
|
return m_Data[0];
|
||||||
}
|
}
|
||||||
@ -368,7 +370,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[0];
|
return m_Data[0];
|
||||||
}
|
}
|
||||||
@ -377,7 +379,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[m_CurrentUsedSize - 1];
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
}
|
}
|
||||||
@ -386,7 +388,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[m_CurrentUsedSize - 1];
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
$PROJECT = "engine_amxx";
|
$PROJECT = "engine_amxx";
|
||||||
$sdk = "../hlsdk/SourceCode";
|
$sdk = "../hlsdk/SourceCode";
|
||||||
$mm = "../metamod/metamod";
|
$mm = "../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
@CPP_SOURCE_FILES = ("amxxmodule.cpp", "forwards.cpp", "messages.cpp", "entity.cpp", "globals.cpp", "amxxapi.cpp", "engine.cpp");
|
@CPP_SOURCE_FILES = ("amxxmodule.cpp", "forwards.cpp", "messages.cpp", "entity.cpp", "globals.cpp", "amxxapi.cpp", "engine.cpp");
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ $mm = "../metamod/metamod";
|
|||||||
my %OPTIONS, %OPT;
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
$OPT{"debug"} = "-g -ggdb";
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ while ($cmd = shift)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = `gcc --version`;
|
$gcc = `$gccf --version`;
|
||||||
if ($gcc =~ /2\.9/)
|
if ($gcc =~ /2\.9/)
|
||||||
{
|
{
|
||||||
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
@ -72,7 +73,7 @@ if ($OPTIONS{"debug"})
|
|||||||
|
|
||||||
if ($OPTIONS{"amd64"})
|
if ($OPTIONS{"amd64"})
|
||||||
{
|
{
|
||||||
$cflags .= "-m64 -DSMALL_CELLSIZE=64 $cflags";
|
$cflags = " -m64 -DSMALL_CELL_SIZE=64 $cflags";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($OPTIONS{"debug"})
|
if ($OPTIONS{"debug"})
|
||||||
@ -134,11 +135,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.cpp/\.o/;
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "gcc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -160,7 +161,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -172,5 +173,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = "gcc $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
$gcc = "$gccf $cflags -shared -fPIC -ldl -lm -o $outdir/$bin @LINK";
|
||||||
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
|
@ -11,6 +11,38 @@ int AmxStringToEngine(AMX *amx, cell param, int &len)
|
|||||||
return ALLOC_STRING(szString);
|
return ALLOC_STRING(szString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EngineError(AMX *amx, char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list p;
|
||||||
|
va_start(p, fmt);
|
||||||
|
char errbuf[512];
|
||||||
|
vsprintf(errbuf, fmt, p);
|
||||||
|
va_end(p);
|
||||||
|
MF_Log("%s (\"%s\", line %d)", errbuf, MF_GetScriptName(MF_FindScriptByAmx(amx)), amx->curline);
|
||||||
|
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearHooks()
|
||||||
|
{
|
||||||
|
register unsigned int i = 0;
|
||||||
|
for (i=0; i<256; i++) {
|
||||||
|
msgHooks[i].clear();
|
||||||
|
msgBlocks[i] = 0;
|
||||||
|
}
|
||||||
|
for (i=0; i<Msg.size(); i++)
|
||||||
|
delete Msg[i];
|
||||||
|
for (i=0; i<Touches.size(); i++)
|
||||||
|
delete Touches[i];
|
||||||
|
for (i=0; i<Impulses.size(); i++)
|
||||||
|
delete Impulses[i];
|
||||||
|
for (i=0; i<Thinks.size(); i++)
|
||||||
|
delete Thinks[i];
|
||||||
|
Msg.clear();
|
||||||
|
Touches.clear();
|
||||||
|
Impulses.clear();
|
||||||
|
Thinks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void OnAmxxAttach()
|
void OnAmxxAttach()
|
||||||
{
|
{
|
||||||
pfnTouchForward = 0;
|
pfnTouchForward = 0;
|
||||||
@ -182,16 +214,6 @@ void ServerDeactivate()
|
|||||||
memset(glinfo.szRealLights, 0x0, 128);
|
memset(glinfo.szRealLights, 0x0, 128);
|
||||||
glinfo.bLights = false;
|
glinfo.bLights = false;
|
||||||
glinfo.fNextLights = 0;
|
glinfo.fNextLights = 0;
|
||||||
Msg.clear();
|
|
||||||
register int i = 0;
|
|
||||||
for (i=0; i<256; i++) {
|
|
||||||
msgHooks[i] = 0;
|
|
||||||
msgBlocks[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Touches.clear();
|
|
||||||
Impulses.clear();
|
|
||||||
Thinks.clear();
|
|
||||||
|
|
||||||
// Reset all forwarding function tables (so that forwards won't be called before plugins are initialized)
|
// Reset all forwarding function tables (so that forwards won't be called before plugins are initialized)
|
||||||
g_pFunctionTable->pfnAddToFullPack=NULL;
|
g_pFunctionTable->pfnAddToFullPack=NULL;
|
||||||
@ -206,6 +228,8 @@ void ServerDeactivate()
|
|||||||
g_pFunctionTable->pfnStartFrame=NULL; // "server_frame","ServerFrame"
|
g_pFunctionTable->pfnStartFrame=NULL; // "server_frame","ServerFrame"
|
||||||
g_pFunctionTable->pfnTouch=NULL; // "pfn_touch","vexd_pfntouch"
|
g_pFunctionTable->pfnTouch=NULL; // "pfn_touch","vexd_pfntouch"
|
||||||
|
|
||||||
|
ClearHooks();
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,9 +238,12 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
|||||||
for(int f = 1; f <= gpGlobals->maxClients;f++)
|
for(int f = 1; f <= gpGlobals->maxClients;f++)
|
||||||
g_player_edicts[f]=pEdictList + f;
|
g_player_edicts[f]=pEdictList + f;
|
||||||
Msg.clear();
|
Msg.clear();
|
||||||
register int i = 0;
|
register int i = 0, j = 0;
|
||||||
for (i=0; i<256; i++) {
|
for (i=0; i<256; i++) {
|
||||||
msgHooks[i] = 0;
|
for (j=0; j<msgHooks[i].size(); j++)
|
||||||
|
if (msgHooks[i].at(j) != -1)
|
||||||
|
MF_UnregisterSPForward(msgHooks[i].at(j));
|
||||||
|
msgHooks[i].clear();
|
||||||
msgBlocks[i] = 0;
|
msgBlocks[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2539,6 +2539,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
||||||
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
||||||
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
||||||
|
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
|
||||||
|
|
||||||
// String / mem in amx scripts support
|
// String / mem in amx scripts support
|
||||||
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
||||||
@ -2799,7 +2800,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2812,7 +2813,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2826,7 +2827,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2838,7 +2839,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
|
@ -204,11 +204,9 @@ typedef struct tagAMX {
|
|||||||
cell reset_stk PACKED;
|
cell reset_stk PACKED;
|
||||||
cell reset_hea PACKED;
|
cell reset_hea PACKED;
|
||||||
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
|
||||||
#if defined JIT
|
|
||||||
/* support variables for the JIT */
|
/* support variables for the JIT */
|
||||||
int reloc_size PACKED; /* required temporary buffer for relocations */
|
int reloc_size PACKED; /* required temporary buffer for relocations */
|
||||||
long code_size PACKED; /* estimated memory footprint of the native code */
|
long code_size PACKED; /* estimated memory footprint of the native code */
|
||||||
#endif
|
|
||||||
} AMX;
|
} AMX;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -240,6 +238,14 @@ enum {
|
|||||||
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !defined AMX_NO_ALIGN
|
||||||
|
#if defined __linux__
|
||||||
|
#pragma pack() /* reset default packing */
|
||||||
|
#else
|
||||||
|
#pragma pack(pop) /* reset previous packing */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ***** declare functions *****
|
// ***** declare functions *****
|
||||||
|
|
||||||
@ -257,9 +263,9 @@ void FN_META_QUERY(void);
|
|||||||
void FN_META_ATTACH(void);
|
void FN_META_ATTACH(void);
|
||||||
#endif // FN_META_ATTACH
|
#endif // FN_META_ATTACH
|
||||||
|
|
||||||
#ifdef FN_META_DETTACH
|
#ifdef FN_META_DETACH
|
||||||
void FN_META_DETTACH(void);
|
void FN_META_DETACH(void);
|
||||||
#endif // FN_META_DETTACH
|
#endif // FN_META_DETACH
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1869,9 +1875,9 @@ void FN_AMXX_QUERY(void);
|
|||||||
void FN_AMXX_ATTACH(void);
|
void FN_AMXX_ATTACH(void);
|
||||||
#endif // FN_AMXX_ATTACH
|
#endif // FN_AMXX_ATTACH
|
||||||
|
|
||||||
#ifdef FN_AMXX_DETTACH
|
#ifdef FN_AMXX_DETACH
|
||||||
void FN_AMXX_DETTACH(void);
|
void FN_AMXX_DETACH(void);
|
||||||
#endif // FN_AMXX_DETTACH
|
#endif // FN_AMXX_DETACH
|
||||||
|
|
||||||
#ifdef FN_AMXX_PLUGINSLOADED
|
#ifdef FN_AMXX_PLUGINSLOADED
|
||||||
void FN_AMXX_PLUGINSLOADED(void);
|
void FN_AMXX_PLUGINSLOADED(void);
|
||||||
@ -1926,6 +1932,7 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
||||||
|
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
||||||
@ -1947,6 +1954,7 @@ typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*in
|
|||||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
|
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
||||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||||
@ -1954,6 +1962,7 @@ typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
|||||||
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*params*/);
|
||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -2005,6 +2014,9 @@ extern PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2053,6 +2065,7 @@ cell amx_ftoc (float x) { }
|
|||||||
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
|
int MF_GetPlayerFlags (int id) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2098,13 +2111,16 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_AmxExecv g_fn_AmxExecv
|
#define MF_AmxExecv g_fn_AmxExecv
|
||||||
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
#define MF_AmxFindPublic g_fn_AmxFindPublic
|
||||||
#define MF_AmxAllot g_fn_AmxAllot
|
#define MF_AmxAllot g_fn_AmxAllot
|
||||||
|
#define MF_AmxFindNative g_fn_AmxFindNative
|
||||||
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
#define MF_LoadAmxScript g_fn_LoadAmxScript
|
||||||
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
#define MF_UnloadAmxScript g_fn_UnloadAmxScript
|
||||||
|
#define MF_MergeDefinitionFile g_fn_MergeDefinition_File
|
||||||
#define amx_ctof g_fn_CellToReal
|
#define amx_ctof g_fn_CellToReal
|
||||||
#define amx_ftoc g_fn_RealToCell
|
#define amx_ftoc g_fn_RealToCell
|
||||||
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
|
||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -28,14 +28,15 @@ static cell AMX_NATIVE_CALL register_think(AMX *amx, cell *params)
|
|||||||
|
|
||||||
EntClass *p = new EntClass;
|
EntClass *p = new EntClass;
|
||||||
const char *clsname = MF_GetAmxString(amx, params[1], 0, &len);
|
const char *clsname = MF_GetAmxString(amx, params[1], 0, &len);
|
||||||
p->Class = new char[strlen(clsname)+1];
|
p->Class.assign(clsname);
|
||||||
strcpy(p->Class, clsname);
|
|
||||||
|
|
||||||
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_DONE);
|
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_DONE);
|
||||||
|
|
||||||
Thinks.push_back(p);
|
Thinks.push_back(p);
|
||||||
|
|
||||||
g_pFunctionTable->pfnThink=Think;
|
if (!g_pFunctionTable->pfnThink)
|
||||||
|
g_pFunctionTable->pfnThink=Think;
|
||||||
|
|
||||||
return p->Forward;
|
return p->Forward;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +47,13 @@ static cell AMX_NATIVE_CALL register_impulse(AMX *amx, cell *params)
|
|||||||
Impulse *p = new Impulse;
|
Impulse *p = new Impulse;
|
||||||
p->Check = params[1];
|
p->Check = params[1];
|
||||||
|
|
||||||
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_DONE);
|
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_CELL, FP_DONE);
|
||||||
|
|
||||||
Impulses.push_back(p);
|
Impulses.push_back(p);
|
||||||
|
|
||||||
g_pFunctionTable->pfnCmdStart=CmdStart;
|
if (!g_pFunctionTable->pfnCmdStart)
|
||||||
|
g_pFunctionTable->pfnCmdStart=CmdStart;
|
||||||
|
|
||||||
return p->Forward;
|
return p->Forward;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,23 +67,22 @@ static cell AMX_NATIVE_CALL register_touch(AMX *amx, cell *params)
|
|||||||
Touch *p = new Touch;
|
Touch *p = new Touch;
|
||||||
|
|
||||||
if (!strlen(Toucher) || strcmp(Toucher, "*")==0) {
|
if (!strlen(Toucher) || strcmp(Toucher, "*")==0) {
|
||||||
p->Toucher = 0;
|
p->Toucher.assign("");
|
||||||
} else {
|
} else {
|
||||||
p->Toucher = new char[strlen(Toucher)+1];
|
p->Toucher.assign(Toucher);
|
||||||
strcpy(p->Toucher, Toucher);
|
|
||||||
}
|
}
|
||||||
if (!strlen(Touched) || strcmp(Touched, "*")==0) {
|
if (!strlen(Touched) || strcmp(Touched, "*")==0) {
|
||||||
p->Touched = 0;
|
p->Touched.assign("");
|
||||||
} else {
|
} else {
|
||||||
p->Touched = new char[strlen(Touched)+1];
|
p->Touched.assign(Touched);
|
||||||
strcpy(p->Touched, Touched);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[3], 2, &len), FP_CELL, FP_CELL, FP_DONE);
|
p->Forward = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[3], 2, &len), FP_CELL, FP_CELL, FP_DONE);
|
||||||
|
|
||||||
Touches.push_back(p);
|
Touches.push_back(p);
|
||||||
|
|
||||||
g_pFunctionTable->pfnTouch=pfnTouch;
|
if (!g_pFunctionTable->pfnTouch)
|
||||||
|
g_pFunctionTable->pfnTouch=pfnTouch;
|
||||||
|
|
||||||
return p->Forward;
|
return p->Forward;
|
||||||
}
|
}
|
||||||
@ -100,7 +102,7 @@ static cell AMX_NATIVE_CALL VelocityByAim(AMX *amx, cell *params)
|
|||||||
Vector vVector = Vector(0, 0, 0);
|
Vector vVector = Vector(0, 0, 0);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,8 +325,8 @@ static cell AMX_NATIVE_CALL set_speak(AMX *amx, cell *params) {
|
|||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
int iNewSpeakFlags = params[2];
|
int iNewSpeakFlags = params[2];
|
||||||
|
|
||||||
if (iIndex> 32 || !is_ent_valid(iIndex)) {
|
if (iIndex> gpGlobals->maxClients || !is_ent_valid(iIndex)) {
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,8 +338,8 @@ static cell AMX_NATIVE_CALL set_speak(AMX *amx, cell *params) {
|
|||||||
static cell AMX_NATIVE_CALL get_speak(AMX *amx, cell *params) {
|
static cell AMX_NATIVE_CALL get_speak(AMX *amx, cell *params) {
|
||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iIndex) || iIndex > 32) {
|
if (!is_ent_valid(iIndex) || iIndex > gpGlobals->maxClients) {
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +366,7 @@ static cell AMX_NATIVE_CALL get_info_keybuffer(AMX *amx, cell *params)
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +384,7 @@ static cell AMX_NATIVE_CALL drop_to_floor(AMX *amx, cell *params)
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,13 +409,13 @@ static cell AMX_NATIVE_CALL attach_view(AMX *amx, cell *params)
|
|||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
int iTargetIndex = params[2];
|
int iTargetIndex = params[2];
|
||||||
|
|
||||||
if (iIndex > 32 || !is_ent_valid(iIndex)) {
|
if (iIndex > gpGlobals->maxClients || !is_ent_valid(iIndex)) {
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_ent_valid(iTargetIndex)) {
|
if (!is_ent_valid(iTargetIndex)) {
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,8 +431,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
|
|||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
int iCameraType = params[2];
|
int iCameraType = params[2];
|
||||||
|
|
||||||
if (iIndex > 32 || !is_ent_valid(iIndex)) {
|
if (iIndex > gpGlobals->maxClients || !is_ent_valid(iIndex)) {
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -896,36 +898,11 @@ static cell AMX_NATIVE_CALL traceresult(AMX *amx, cell *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//(mahnsawce)
|
|
||||||
static cell AMX_NATIVE_CALL take_damage(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int indexa = params[1];
|
|
||||||
int indexb = params[2];
|
|
||||||
int indexc = params[3];
|
|
||||||
if (!is_ent_valid(indexa) || !is_ent_valid(indexb) || !is_ent_valid(indexc)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
REAL fnDamage = amx_ctof(params[4]);
|
|
||||||
int inType = params[5];
|
|
||||||
edict_t* pEntitya = INDEXENT2(indexa);
|
|
||||||
edict_t* pEntityb = INDEXENT2(indexb);
|
|
||||||
edict_t* pEntityc = INDEXENT2(indexc);
|
|
||||||
CBaseEntity *pCEntity = NULL;
|
|
||||||
pCEntity = CBaseEntity::Instance(INDEXENT2(indexa));
|
|
||||||
pCEntity->TakeDamage(VARS(pEntityb),VARS(pEntityc),fnDamage,inType);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO engine_Natives[] = {
|
AMX_NATIVE_INFO engine_Natives[] = {
|
||||||
{"halflife_time", halflife_time},
|
{"halflife_time", halflife_time},
|
||||||
|
|
||||||
//These are mostly from original VexD
|
//These are mostly from original VexD
|
||||||
|
|
||||||
// TODO: Backwards compatibility: VelocityByAim->velocity_by_aim
|
|
||||||
// RadiusDamage->radius_damage
|
|
||||||
// PointContents->point_contents
|
|
||||||
{"velocity_by_aim", VelocityByAim},
|
{"velocity_by_aim", VelocityByAim},
|
||||||
{"radius_damage", RadiusDamage},
|
{"radius_damage", RadiusDamage},
|
||||||
{"point_contents", PointContents},
|
{"point_contents", PointContents},
|
||||||
@ -937,7 +914,6 @@ AMX_NATIVE_INFO engine_Natives[] = {
|
|||||||
{"trace_line", trace_line},
|
{"trace_line", trace_line},
|
||||||
{"trace_hull", trace_hull},
|
{"trace_hull", trace_hull},
|
||||||
{"traceresult", traceresult},
|
{"traceresult", traceresult},
|
||||||
{"take_damage", take_damage},
|
|
||||||
|
|
||||||
{"set_speak", set_speak},
|
{"set_speak", set_speak},
|
||||||
{"get_speak", get_speak},
|
{"get_speak", get_speak},
|
||||||
|
@ -7,11 +7,6 @@
|
|||||||
#include <sdk_util.h>
|
#include <sdk_util.h>
|
||||||
#include "CVector.h"
|
#include "CVector.h"
|
||||||
#include "CString.h"
|
#include "CString.h"
|
||||||
#ifndef CBASEPLAYER_H
|
|
||||||
#define CBASEPLAYER_H
|
|
||||||
#include <cbase.h>
|
|
||||||
#include <player.h>
|
|
||||||
#endif
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include <usercmd.h>
|
#include <usercmd.h>
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
@ -125,6 +120,11 @@ struct GlobalInfo {
|
|||||||
class Impulse
|
class Impulse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~Impulse()
|
||||||
|
{
|
||||||
|
if (Forward != -1)
|
||||||
|
MF_UnregisterSPForward(Forward);
|
||||||
|
}
|
||||||
int Forward;
|
int Forward;
|
||||||
int Check;
|
int Check;
|
||||||
};
|
};
|
||||||
@ -133,18 +133,12 @@ class Touch
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int Forward;
|
int Forward;
|
||||||
char *Toucher;
|
String Toucher;
|
||||||
char *Touched;
|
String Touched;
|
||||||
~Touch()
|
~Touch()
|
||||||
{
|
{
|
||||||
if (Toucher) {
|
if (Forward != -1)
|
||||||
delete [] Toucher;
|
MF_UnregisterSPForward(Forward);
|
||||||
Toucher = 0;
|
|
||||||
}
|
|
||||||
if (Touched) {
|
|
||||||
delete [] Touched;
|
|
||||||
Touched = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -152,13 +146,11 @@ class EntClass
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int Forward;
|
int Forward;
|
||||||
char *Class;
|
String Class;
|
||||||
~EntClass()
|
~EntClass()
|
||||||
{
|
{
|
||||||
if (Class) {
|
if (Forward != -1)
|
||||||
delete [] Class;
|
MF_UnregisterSPForward(Forward);
|
||||||
Class = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -177,7 +169,22 @@ inline edict_t* INDEXENT2( int iEdictNum )
|
|||||||
else
|
else
|
||||||
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||||
}
|
}
|
||||||
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
|
|
||||||
|
void EngineError(AMX *amx, char *fmt, ...);
|
||||||
|
|
||||||
|
int Spawn(edict_t *pEntity);
|
||||||
|
void ChangeLevel(char* s1, char* s2);
|
||||||
|
void PlaybackEvent(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
||||||
|
void KeyValue(edict_t *pEntity, KeyValueData *pkvd);
|
||||||
|
void StartFrame();
|
||||||
|
void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int random_seed);
|
||||||
|
void ClientKill(edict_t *pEntity);
|
||||||
|
void PlayerPreThink(edict_t *pEntity);
|
||||||
|
void PlayerPostThink_Post(edict_t *pEntity);
|
||||||
|
void pfnTouch(edict_t *pToucher, edict_t *pTouched);
|
||||||
|
void Think(edict_t *pent);
|
||||||
|
|
||||||
|
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { EngineError(amx, "Invalid entity %d", x); return 0; }
|
||||||
|
|
||||||
extern bool g_inKeyValue;
|
extern bool g_inKeyValue;
|
||||||
extern KeyValueData *g_pkvd;
|
extern KeyValueData *g_pkvd;
|
||||||
@ -191,3 +198,4 @@ extern CVector<EntClass *> Thinks;
|
|||||||
extern CVector<Touch *> Touches;
|
extern CVector<Touch *> Touches;
|
||||||
|
|
||||||
#endif //_ENGINE_INCLUDE_H
|
#endif //_ENGINE_INCLUDE_H
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="5"
|
RuntimeLibrary="5"
|
||||||
|
StructMemberAlignment="3"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="FALSE"
|
Detect64BitPortabilityProblems="FALSE"
|
||||||
@ -70,6 +71,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS"
|
||||||
RuntimeLibrary="4"
|
RuntimeLibrary="4"
|
||||||
|
StructMemberAlignment="3"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="FALSE"
|
Detect64BitPortabilityProblems="FALSE"
|
||||||
|
@ -27,7 +27,7 @@ static cell AMX_NATIVE_CALL entity_range(AMX *amx, cell *params)
|
|||||||
int idxb = params[2];
|
int idxb = params[2];
|
||||||
|
|
||||||
if (!is_ent_valid(idxa) || !is_ent_valid(idxb)) {
|
if (!is_ent_valid(idxa) || !is_ent_valid(idxb)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ static cell AMX_NATIVE_CALL call_think(AMX *amx, cell *params)
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (is_ent_valid(iEnt)) {
|
if (is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ static cell AMX_NATIVE_CALL fake_touch(AMX *amx, cell *params)
|
|||||||
int iPtd = params[2];
|
int iPtd = params[2];
|
||||||
|
|
||||||
if (!is_ent_valid(iPtr) || !is_ent_valid(iPtd)) {
|
if (!is_ent_valid(iPtr) || !is_ent_valid(iPtd)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ static cell AMX_NATIVE_CALL force_use(AMX *amx, cell *params)
|
|||||||
int iPtd = params[2];
|
int iPtd = params[2];
|
||||||
|
|
||||||
if (!is_ent_valid(iPtr) || !is_ent_valid(iPtd)) {
|
if (!is_ent_valid(iPtr) || !is_ent_valid(iPtd)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ static cell AMX_NATIVE_CALL DispatchKeyValue(AMX *amx, cell *params)
|
|||||||
cell *cVal = MF_GetAmxAddr(amx, params[1]);
|
cell *cVal = MF_GetAmxAddr(amx, params[1]);
|
||||||
int iValue = *cVal;
|
int iValue = *cVal;
|
||||||
if (!is_ent_valid(iValue)) {
|
if (!is_ent_valid(iValue)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iValue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
edict_t *pEntity = INDEXENT2(iValue);
|
edict_t *pEntity = INDEXENT2(iValue);
|
||||||
@ -173,7 +173,7 @@ static cell AMX_NATIVE_CALL get_keyvalue(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int idx = params[1];
|
int idx = params[1];
|
||||||
if (!is_ent_valid(idx)) {
|
if (!is_ent_valid(idx)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", idx);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
edict_t *pEntity = INDEXENT2(idx);
|
edict_t *pEntity = INDEXENT2(idx);
|
||||||
@ -203,7 +203,7 @@ static cell AMX_NATIVE_CALL DispatchSpawn(AMX *amx, cell *params)
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ static cell AMX_NATIVE_CALL entity_get_float(AMX *amx, cell *params)
|
|||||||
REAL fVal = 0;
|
REAL fVal = 0;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ static cell AMX_NATIVE_CALL entity_set_float(AMX *amx, cell *params)
|
|||||||
REAL fVal = amx_ctof(params[3]);
|
REAL fVal = amx_ctof(params[3]);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params)
|
|||||||
int iRetValue = 0;
|
int iRetValue = 0;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params)
|
|||||||
iRetValue = pEnt->v.deadflag;
|
iRetValue = pEnt->v.deadflag;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid property %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -628,7 +628,7 @@ static cell AMX_NATIVE_CALL entity_set_int(AMX *amx, cell *params)
|
|||||||
int iNewValue = params[3];
|
int iNewValue = params[3];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ static cell AMX_NATIVE_CALL entity_get_vector(AMX *amx, cell *params)
|
|||||||
Vector vRetValue = Vector(0, 0, 0);
|
Vector vRetValue = Vector(0, 0, 0);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,7 +859,7 @@ static cell AMX_NATIVE_CALL entity_set_vector(AMX *amx, cell *params)
|
|||||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -956,7 +956,7 @@ static cell AMX_NATIVE_CALL entity_get_string(AMX *amx, cell *params)
|
|||||||
const char *szRet = NULL;
|
const char *szRet = NULL;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,7 +1021,7 @@ static cell AMX_NATIVE_CALL entity_set_string(AMX *amx, cell *params)
|
|||||||
int iszString = AmxStringToEngine(amx, params[3], iLen);
|
int iszString = AmxStringToEngine(amx, params[3], iLen);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1083,7 +1083,7 @@ static cell AMX_NATIVE_CALL entity_get_edict(AMX *amx, cell *params)
|
|||||||
edict_t *pRet;
|
edict_t *pRet;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,7 +1142,7 @@ static cell AMX_NATIVE_CALL entity_set_edict(AMX *amx, cell *params)
|
|||||||
int iSetEnt = params[3];
|
int iSetEnt = params[3];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt) || !is_ent_valid(iSetEnt)) {
|
if (!is_ent_valid(iEnt) || !is_ent_valid(iSetEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1199,7 +1199,7 @@ static cell AMX_NATIVE_CALL entity_get_byte(AMX *amx, cell *params)
|
|||||||
int iRetValue = 0;
|
int iRetValue = 0;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1240,7 +1240,7 @@ static cell AMX_NATIVE_CALL entity_set_byte(AMX *amx, cell *params)
|
|||||||
int iNewValue = params[3];
|
int iNewValue = params[3];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1284,7 +1284,7 @@ static cell AMX_NATIVE_CALL entity_set_origin(AMX *amx, cell *params)
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1306,7 +1306,7 @@ static cell AMX_NATIVE_CALL entity_set_model(AMX *amx, cell *params)
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1328,7 +1328,7 @@ static cell AMX_NATIVE_CALL entity_set_size(AMX *amx, cell *params)
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
if (!is_ent_valid(iEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", iEnt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1351,167 +1351,6 @@ static cell AMX_NATIVE_CALL entity_set_size(AMX *amx, cell *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************
|
|
||||||
Offset control natives
|
|
||||||
***********************/
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_offset_short(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *((short *)pEnt->pvPrivateData + off);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_offset_short(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*((short *)pEnt->pvPrivateData + off) = (short)params[3];
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_offset_char(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char r = *((char *)pEnt->pvPrivateData + off);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_offset_char(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char data = params[3];
|
|
||||||
*((char *)pEnt->pvPrivateData + off) = data;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_offset_int(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return *((int *)pEnt->pvPrivateData + off);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_offset_int(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*((int *)pEnt->pvPrivateData + off) = params[3];
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_offset_float(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
REAL fRet = (REAL)(*((REAL*)pEnt->pvPrivateData + off));
|
|
||||||
|
|
||||||
return amx_ftoc(fRet);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_offset_float(AMX *amx, cell *params)
|
|
||||||
{
|
|
||||||
int idx = params[1];
|
|
||||||
int off = params[2];
|
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
|
||||||
#ifdef __linux__
|
|
||||||
off += params[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
REAL fVal = amx_ctof(params[3]);
|
|
||||||
*((float *)pEnt->pvPrivateData + off) = fVal;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_entity_pointer(AMX *amx, cell *params) // get_entity_pointer(index, pointer[], len); = 3 params
|
static cell AMX_NATIVE_CALL get_entity_pointer(AMX *amx, cell *params) // get_entity_pointer(index, pointer[], len); = 3 params
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -1525,14 +1364,9 @@ static cell AMX_NATIVE_CALL find_ent_in_sphere(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int idx = params[1];
|
int idx = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(idx)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(idx);
|
edict_t *pEnt = INDEXENT2(idx);
|
||||||
cell *cAddr = MF_GetAmxAddr(amx, params[2]);
|
cell *cAddr = MF_GetAmxAddr(amx, params[2]);
|
||||||
REAL origin[3] = {
|
float origin[3] = {
|
||||||
amx_ctof(cAddr[0]),
|
amx_ctof(cAddr[0]),
|
||||||
amx_ctof(cAddr[1]),
|
amx_ctof(cAddr[1]),
|
||||||
amx_ctof(cAddr[2])
|
amx_ctof(cAddr[2])
|
||||||
@ -1578,7 +1412,7 @@ static cell AMX_NATIVE_CALL find_sphere_class(AMX *amx, cell *params) // find_sp
|
|||||||
vec3_t vecOrigin;
|
vec3_t vecOrigin;
|
||||||
if (params[1] > 0) {
|
if (params[1] > 0) {
|
||||||
if (!is_ent_valid(params[1])) {
|
if (!is_ent_valid(params[1])) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", params[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1687,9 +1521,9 @@ static cell AMX_NATIVE_CALL find_ent_by_owner(AMX *amx, cell *params) // native
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
int oEnt = params[3];
|
int oEnt = params[3];
|
||||||
// Check index to start searching at, 0 must be possible.
|
// Check index to start searching at, 0 must be possible for iEnt.
|
||||||
if (!is_ent_valid(iEnt) || !is_ent_valid(oEnt)) {
|
if (!is_ent_valid(oEnt)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1727,7 +1561,7 @@ static cell AMX_NATIVE_CALL get_grenade_id(AMX *amx, cell *params) /* 4 param *
|
|||||||
char* szModel;
|
char* szModel;
|
||||||
|
|
||||||
if (!is_ent_valid(index)) {
|
if (!is_ent_valid(index)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
EngineError(amx, "Invalid Entity %d", index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1780,16 +1614,6 @@ AMX_NATIVE_INFO ent_Natives[] = {
|
|||||||
{"fake_touch", fake_touch},
|
{"fake_touch", fake_touch},
|
||||||
{"force_use", force_use},
|
{"force_use", force_use},
|
||||||
|
|
||||||
{"get_offset_short", get_offset_short},
|
|
||||||
{"set_offset_short", set_offset_short},
|
|
||||||
{"get_offset_char", get_offset_char},
|
|
||||||
{"set_offset_char", set_offset_char},
|
|
||||||
{"get_offset", get_offset_int},
|
|
||||||
{"set_offset", set_offset_int},
|
|
||||||
{"get_offset_int", get_offset_int},
|
|
||||||
{"set_offset_int", set_offset_int},
|
|
||||||
{"get_offset_float", get_offset_float},
|
|
||||||
{"set_offset_float", set_offset_float},
|
|
||||||
{"get_entity_pointer", get_entity_pointer},
|
{"get_entity_pointer", get_entity_pointer},
|
||||||
|
|
||||||
{"find_ent_in_sphere", find_ent_in_sphere},
|
{"find_ent_in_sphere", find_ent_in_sphere},
|
||||||
@ -1801,8 +1625,11 @@ AMX_NATIVE_INFO ent_Natives[] = {
|
|||||||
{"find_ent_by_owner", find_ent_by_owner},
|
{"find_ent_by_owner", find_ent_by_owner},
|
||||||
{"get_grenade_id", get_grenade_id},
|
{"get_grenade_id", get_grenade_id},
|
||||||
|
|
||||||
|
{"get_keyvalue", get_keyvalue },
|
||||||
|
|
||||||
{"copy_keyvalue", copy_keyvalue},
|
{"copy_keyvalue", copy_keyvalue},
|
||||||
|
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
///////////////////
|
///////////////////
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ int fstrcmp(const char *s1, const char *s2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Spawn(edict_t *pEntity) {
|
int Spawn(edict_t *pEntity) {
|
||||||
if (SpawnForward) {
|
if (SpawnForward != -1) {
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
int id = ENTINDEX(pEntity);
|
int id = ENTINDEX(pEntity);
|
||||||
retVal = MF_ExecuteForward(SpawnForward, id);
|
retVal = MF_ExecuteForward(SpawnForward, id);
|
||||||
@ -49,7 +49,7 @@ int Spawn(edict_t *pEntity) {
|
|||||||
|
|
||||||
void ChangeLevel(char* s1, char* s2)
|
void ChangeLevel(char* s1, char* s2)
|
||||||
{
|
{
|
||||||
if (ChangelevelForward) {
|
if (ChangelevelForward != -1) {
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
char *map = s1;
|
char *map = s1;
|
||||||
retVal = MF_ExecuteForward(ChangelevelForward, map);
|
retVal = MF_ExecuteForward(ChangelevelForward, map);
|
||||||
@ -61,7 +61,7 @@ void ChangeLevel(char* s1, char* s2)
|
|||||||
|
|
||||||
void PlaybackEvent(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2)
|
void PlaybackEvent(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2)
|
||||||
{
|
{
|
||||||
if (PlaybackForward) {
|
if (PlaybackForward != -1) {
|
||||||
edict_t *e = (edict_t *)pInvoker;
|
edict_t *e = (edict_t *)pInvoker;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
static cell cOrigin[3];
|
static cell cOrigin[3];
|
||||||
@ -90,16 +90,14 @@ void KeyValue(edict_t *pEntity, KeyValueData *pkvd)
|
|||||||
g_inKeyValue=true;
|
g_inKeyValue=true;
|
||||||
g_pkvd=pkvd;
|
g_pkvd=pkvd;
|
||||||
int index = ENTINDEX(pEntity);
|
int index = ENTINDEX(pEntity);
|
||||||
if (DispatchKeyForward) {
|
if (DispatchKeyForward != -1) {
|
||||||
retVal = MF_ExecuteForward(DispatchKeyForward, index);
|
retVal = MF_ExecuteForward(DispatchKeyForward, index);
|
||||||
g_inKeyValue=false;
|
g_inKeyValue=false;
|
||||||
if (retVal > 0)
|
if (retVal)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
else
|
|
||||||
RETURN_META(MRES_HANDLED);
|
|
||||||
}
|
}
|
||||||
g_inKeyValue=false;
|
g_inKeyValue=false;
|
||||||
RETURN_META(MRES_HANDLED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartFrame()
|
void StartFrame()
|
||||||
@ -111,9 +109,9 @@ void StartFrame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StartFrameForward)
|
if (StartFrameForward != -1)
|
||||||
MF_ExecuteForward(StartFrameForward);
|
MF_ExecuteForward(StartFrameForward);
|
||||||
else if (VexdServerForward)
|
else if (VexdServerForward != -1)
|
||||||
MF_ExecuteForward(VexdServerForward);
|
MF_ExecuteForward(VexdServerForward);
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
@ -125,35 +123,41 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
|
|||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
edict_t *pEntity = (edict_t *)player;
|
edict_t *pEntity = (edict_t *)player;
|
||||||
struct usercmd_s *g_cmd = (struct usercmd_s *)_cmd;
|
struct usercmd_s *g_cmd = (struct usercmd_s *)_cmd;
|
||||||
|
META_RES res = MRES_IGNORED;
|
||||||
|
int origImpulse = g_cmd->impulse; // incase a plugin alters it
|
||||||
for (i=0; i<Impulses.size(); i++)
|
for (i=0; i<Impulses.size(); i++)
|
||||||
{
|
{
|
||||||
if (Impulses[i]->Check == g_cmd->impulse)
|
if (Impulses[i]->Check == g_cmd->impulse)
|
||||||
{
|
{
|
||||||
retVal = MF_ExecuteForward(Impulses[i]->Forward, ENTINDEX(pEntity));
|
retVal = MF_ExecuteForward(Impulses[i]->Forward, ENTINDEX(pEntity),origImpulse);
|
||||||
if (retVal)
|
if (retVal & 2 /*PLUGIN_HANDLED_MAIN*/)
|
||||||
|
{
|
||||||
|
g_cmd->impulse=0;
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
else
|
}
|
||||||
RETURN_META(MRES_IGNORED);
|
else if (retVal)
|
||||||
|
res = MRES_SUPERCEDE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CmdStartForward) {
|
if (CmdStartForward != -1) {
|
||||||
incmd = true;
|
incmd = true;
|
||||||
retVal = MF_ExecuteForward(CmdStartForward, ENTINDEX(pEntity), g_cmd->impulse);
|
retVal = MF_ExecuteForward(CmdStartForward, ENTINDEX(pEntity), origImpulse);
|
||||||
incmd = false;
|
incmd = false;
|
||||||
if (retVal) {
|
if (retVal) {
|
||||||
g_cmd->impulse = 0;
|
g_cmd->impulse = 0;
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (res == MRES_SUPERCEDE)
|
||||||
RETURN_META(MRES_IGNORED);
|
g_cmd->impulse=0;
|
||||||
|
RETURN_META(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientKill(edict_t *pEntity)
|
void ClientKill(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
|
|
||||||
if (ClientKillForward) {
|
if (ClientKillForward != -1) {
|
||||||
retVal = MF_ExecuteForward(ClientKillForward, ENTINDEX(pEntity));
|
retVal = MF_ExecuteForward(ClientKillForward, ENTINDEX(pEntity));
|
||||||
if (retVal)
|
if (retVal)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
@ -167,6 +171,7 @@ void PlayerPreThink(edict_t *pEntity)
|
|||||||
MF_ExecuteForward(PlayerPreThinkForward, ENTINDEX(pEntity));
|
MF_ExecuteForward(PlayerPreThinkForward, ENTINDEX(pEntity));
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerPostThink_Post(edict_t *pEntity)
|
void PlayerPostThink_Post(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
if(plinfo[ENTINDEX(pEntity)].pViewEnt) {
|
if(plinfo[ENTINDEX(pEntity)].pViewEnt) {
|
||||||
@ -206,7 +211,7 @@ void PlayerPostThink_Post(edict_t *pEntity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerPostThinkForward)
|
if (PlayerPostThinkForward != -1)
|
||||||
{
|
{
|
||||||
if (MF_ExecuteForward(PlayerPostThinkForward, ENTINDEX(pEntity)))
|
if (MF_ExecuteForward(PlayerPostThinkForward, ENTINDEX(pEntity)))
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
@ -221,68 +226,77 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
|
|||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
const char *ptrClass = STRING(pToucher->v.classname);
|
const char *ptrClass = STRING(pToucher->v.classname);
|
||||||
const char *ptdClass = STRING(pTouched->v.classname);
|
const char *ptdClass = STRING(pTouched->v.classname);
|
||||||
|
META_RES res=MRES_IGNORED;
|
||||||
for (i=0; i<Touches.size(); i++)
|
for (i=0; i<Touches.size(); i++)
|
||||||
{
|
{
|
||||||
if (Touches[i]->Toucher == 0)
|
if (Touches[i]->Toucher.size() == 0)
|
||||||
{
|
{
|
||||||
if (Touches[i]->Touched == 0)
|
if (Touches[i]->Touched.size() == 0)
|
||||||
{
|
{
|
||||||
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
||||||
if (retVal)
|
if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
else
|
else if (retVal)
|
||||||
RETURN_META(MRES_IGNORED);
|
res=MRES_SUPERCEDE;
|
||||||
} else if (fstrcmp(Touches[i]->Touched, ptdClass)) {
|
} else if (Touches[i]->Touched.compare(ptdClass)==0) {
|
||||||
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
||||||
if (retVal)
|
if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
else
|
else if (retVal)
|
||||||
RETURN_META(MRES_IGNORED);
|
res=MRES_SUPERCEDE;
|
||||||
}
|
}
|
||||||
} else if (fstrcmp(Touches[i]->Toucher, ptrClass)) {
|
} else if (Touches[i]->Toucher.compare(ptrClass)==0) {
|
||||||
if (Touches[i]->Touched == 0)
|
if (Touches[i]->Touched.size() == 0)
|
||||||
{
|
{
|
||||||
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
||||||
if (retVal)
|
if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
else
|
else if (retVal)
|
||||||
RETURN_META(MRES_IGNORED);
|
res=MRES_SUPERCEDE;
|
||||||
} else if (fstrcmp(Touches[i]->Touched, ptdClass)) {
|
} else if (Touches[i]->Touched.compare(ptdClass)==0) {
|
||||||
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
||||||
if (retVal)
|
if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
else
|
else if (retVal)
|
||||||
RETURN_META(MRES_IGNORED);
|
res=MRES_SUPERCEDE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Execute pfnTouch forwards */
|
/* Execute pfnTouch forwards */
|
||||||
if (pfnTouchForward) {
|
if (pfnTouchForward != -1) {
|
||||||
retVal = MF_ExecuteForward(pfnTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
retVal = MF_ExecuteForward(pfnTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
||||||
if (retVal)
|
if (retVal)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
} else if (VexdTouchForward) {
|
}
|
||||||
|
if (VexdTouchForward != -1) {
|
||||||
retVal = MF_ExecuteForward(VexdTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
retVal = MF_ExecuteForward(VexdTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
||||||
if (retVal)
|
if (retVal)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Think(edict_t *pent)
|
void Think(edict_t *pent)
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
const char *cls = STRING(pent->v.classname);
|
const char *cls = STRING(pent->v.classname);
|
||||||
|
META_RES res=MRES_IGNORED;
|
||||||
|
int retVal=0;
|
||||||
for (i=0; i<Thinks.size(); i++)
|
for (i=0; i<Thinks.size(); i++)
|
||||||
{
|
{
|
||||||
if (fstrcmp(cls, Thinks[i]->Class))
|
if (Thinks[i]->Class.compare(cls)==0)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(Thinks[i]->Forward, ENTINDEX(pent));
|
retVal=MF_ExecuteForward(Thinks[i]->Forward, ENTINDEX(pent));
|
||||||
RETURN_META(MRES_IGNORED);
|
if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
|
||||||
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
|
else if (retVal)
|
||||||
|
res=MRES_SUPERCEDE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MF_ExecuteForward(pfnThinkForward, ENTINDEX(pent));
|
retVal=MF_ExecuteForward(pfnThinkForward, ENTINDEX(pent));
|
||||||
|
if (retVal)
|
||||||
|
res=MRES_SUPERCEDE;
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(res);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
CVector<argMsg*> Msg;
|
CVector<argMsg*> Msg;
|
||||||
int msgHooks[256] = {0};
|
CVector<int> msgHooks[256];
|
||||||
|
//int msgHooks[256] = {0};
|
||||||
int msgBlocks[256] = {0};
|
int msgBlocks[256] = {0};
|
||||||
int msgDest;
|
int msgDest;
|
||||||
int msgType;
|
int msgType;
|
||||||
@ -94,7 +95,7 @@ void MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
|
|||||||
if (msgBlocks[msg_type]) {
|
if (msgBlocks[msg_type]) {
|
||||||
inblock = true;
|
inblock = true;
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
} else if (msgHooks[msg_type]) {
|
} else if (msgHooks[msg_type].size()) {
|
||||||
inhook = true;
|
inhook = true;
|
||||||
msgCount = 0;
|
msgCount = 0;
|
||||||
msgDest = msg_dest;
|
msgDest = msg_dest;
|
||||||
@ -269,7 +270,7 @@ void WriteEntity(int iValue)
|
|||||||
|
|
||||||
void MessageEnd(void)
|
void MessageEnd(void)
|
||||||
{
|
{
|
||||||
int mres = 0;
|
int mres = 0, mresB = 0;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
if (inblock) {
|
if (inblock) {
|
||||||
inblock = false;
|
inblock = false;
|
||||||
@ -277,7 +278,12 @@ void MessageEnd(void)
|
|||||||
msgBlocks[msgType] = BLOCK_NOT;
|
msgBlocks[msgType] = BLOCK_NOT;
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
} else if (inhook) {
|
} else if (inhook) {
|
||||||
mres = MF_ExecuteForward(msgHooks[msgType], msgType, msgDest, ENTINDEX(msgpEntity));
|
for (i=0; i<msgHooks[msgType].size(); i++)
|
||||||
|
{
|
||||||
|
mresB = MF_ExecuteForward(msgHooks[msgType].at(i), msgType, msgDest, ENTINDEX(msgpEntity));
|
||||||
|
if (mresB > mres)
|
||||||
|
mres = mresB;
|
||||||
|
}
|
||||||
inhook = false;
|
inhook = false;
|
||||||
if (mres & 1)
|
if (mres & 1)
|
||||||
{
|
{
|
||||||
@ -302,9 +308,13 @@ static cell AMX_NATIVE_CALL register_message(AMX *amx, cell *params)
|
|||||||
int len;
|
int len;
|
||||||
if (params[1]>0 && params[1] < 256) {
|
if (params[1]>0 && params[1] < 256) {
|
||||||
int id = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
int id = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
// MF_Log("Registering message %d with result %d", params[1], id);
|
if (id != -1)
|
||||||
msgHooks[params[1]] = id;
|
{
|
||||||
return id;
|
msgHooks[params[1]].push_back(id);
|
||||||
|
return id;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -377,7 +387,8 @@ static cell AMX_NATIVE_CALL set_msg_arg_int(AMX *amx, cell *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Msg[argn]->iData = params[2];
|
Msg[argn]->type = params[2];
|
||||||
|
Msg[argn]->iData = params[3];
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,13 @@ public:
|
|||||||
|
|
||||||
int type;
|
int type;
|
||||||
REAL fData;
|
REAL fData;
|
||||||
CString cData;
|
String cData;
|
||||||
int iData;
|
int iData;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern AMX_NATIVE_INFO msg_Natives[];
|
extern AMX_NATIVE_INFO msg_Natives[];
|
||||||
extern CVector<argMsg*> Msg;
|
extern CVector<argMsg*> Msg;
|
||||||
extern int msgHooks[256];
|
extern CVector<int> msgHooks[256];
|
||||||
extern int msgBlocks[256];
|
extern int msgBlocks[256];
|
||||||
|
|
||||||
#endif //_MSGS_INCLUDE_H
|
#endif //_MSGS_INCLUDE_H
|
||||||
|
@ -54,12 +54,12 @@
|
|||||||
// (wd) are Will Day's notes
|
// (wd) are Will Day's notes
|
||||||
// - GetEntityAPI2 functions
|
// - GetEntityAPI2 functions
|
||||||
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
|
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
|
||||||
#define FN_DispatchSpawn Spawn /* pfnSpawn() */
|
//#define FN_DispatchSpawn Spawn /* pfnSpawn() */
|
||||||
#define FN_DispatchThink Think /* pfnThink() */
|
//#define FN_DispatchThink Think /* pfnThink() */
|
||||||
// #define FN_DispatchUse Use /* pfnUse() */
|
// #define FN_DispatchUse Use /* pfnUse() */
|
||||||
#define FN_DispatchTouch pfnTouch /* pfnTouch() */
|
//#define FN_DispatchTouch pfnTouch /* pfnTouch() */
|
||||||
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
|
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
|
||||||
#define FN_DispatchKeyValue KeyValue /* pfnKeyValue() */
|
//#define FN_DispatchKeyValue KeyValue /* pfnKeyValue() */
|
||||||
// #define FN_DispatchSave DispatchSave /* pfnSave() */
|
// #define FN_DispatchSave DispatchSave /* pfnSave() */
|
||||||
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
|
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
|
||||||
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
|
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
|
||||||
@ -70,15 +70,15 @@
|
|||||||
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
|
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
|
||||||
#define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
|
#define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
|
||||||
#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
|
#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
|
||||||
#define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
|
//#define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
|
||||||
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
|
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
|
||||||
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
||||||
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
||||||
#define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
|
#define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
|
||||||
#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
|
#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
|
||||||
#define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
|
//#define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
|
||||||
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
|
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
|
||||||
#define FN_StartFrame StartFrame /* pfnStartFrame() */
|
//#define FN_StartFrame StartFrame /* pfnStartFrame() */
|
||||||
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
|
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
|
||||||
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
|
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
|
||||||
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
|
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
|
||||||
@ -96,7 +96,7 @@
|
|||||||
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
|
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
|
||||||
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
|
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
|
||||||
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
|
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
|
||||||
#define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
|
//#define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
|
||||||
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
|
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
|
||||||
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
|
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
|
||||||
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
|
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
|
||||||
@ -129,7 +129,7 @@
|
|||||||
// #define FN_ServerActivate_Post ServerActivate_Post
|
// #define FN_ServerActivate_Post ServerActivate_Post
|
||||||
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
|
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
|
||||||
// #define FN_PlayerPreThink_Post PlayerPreThink_Post
|
// #define FN_PlayerPreThink_Post PlayerPreThink_Post
|
||||||
#define FN_PlayerPostThink_Post PlayerPostThink_Post
|
//#define FN_PlayerPostThink_Post PlayerPostThink_Post
|
||||||
// #define FN_StartFrame_Post StartFrame_Post
|
// #define FN_StartFrame_Post StartFrame_Post
|
||||||
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
|
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
|
||||||
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
|
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
|
||||||
@ -280,7 +280,7 @@
|
|||||||
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
|
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
|
||||||
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
|
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
|
||||||
// #define FN_PrecacheEvent PrecacheEvent
|
// #define FN_PrecacheEvent PrecacheEvent
|
||||||
#define FN_PlaybackEvent PlaybackEvent
|
//#define FN_PlaybackEvent PlaybackEvent
|
||||||
// #define FN_SetFatPVS SetFatPVS
|
// #define FN_SetFatPVS SetFatPVS
|
||||||
// #define FN_SetFatPAS SetFatPAS
|
// #define FN_SetFatPAS SetFatPAS
|
||||||
// #define FN_CheckVisibility CheckVisibility
|
// #define FN_CheckVisibility CheckVisibility
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#ifndef __CVECTOR_H__
|
#ifndef __CVECTOR_H__
|
||||||
#define __CVECTOR_H__
|
#define __CVECTOR_H__
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
// Vector
|
// Vector
|
||||||
template <class T> class CVector
|
template <class T> class CVector
|
||||||
{
|
{
|
||||||
@ -76,7 +78,7 @@ template <class T> class CVector
|
|||||||
delete [] m_Data;
|
delete [] m_Data;
|
||||||
}
|
}
|
||||||
if (m_Size < size)
|
if (m_Size < size)
|
||||||
m_CurrentUsedSize = size;
|
m_CurrentSize = size;
|
||||||
m_Data = newData;
|
m_Data = newData;
|
||||||
m_Size = size;
|
m_Size = size;
|
||||||
return true;
|
return true;
|
||||||
@ -284,7 +286,7 @@ public:
|
|||||||
iterator iterAt(size_t pos)
|
iterator iterAt(size_t pos)
|
||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
return iterator(m_Data + pos);
|
return iterator(m_Data + pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +333,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[pos];
|
return m_Data[pos];
|
||||||
}
|
}
|
||||||
@ -340,7 +342,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (pos > m_CurrentUsedSize)
|
if (pos > m_CurrentUsedSize)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[pos];
|
return m_Data[pos];
|
||||||
}
|
}
|
||||||
@ -359,7 +361,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[0];
|
return m_Data[0];
|
||||||
}
|
}
|
||||||
@ -368,7 +370,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[0];
|
return m_Data[0];
|
||||||
}
|
}
|
||||||
@ -377,7 +379,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[m_CurrentUsedSize - 1];
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
}
|
}
|
||||||
@ -386,7 +388,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_CurrentUsedSize < 1)
|
if (m_CurrentUsedSize < 1)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
return m_Data[m_CurrentUsedSize - 1];
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
$PROJECT = "fakemeta_amxx";
|
$PROJECT = "fakemeta_amxx";
|
||||||
$sdk = "../../hlsdk/SourceCode";
|
$sdk = "../../hlsdk/SourceCode";
|
||||||
$mm = "../../metamod/metamod";
|
$mm = "../../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
@CPP_SOURCE_FILES = ("dllfunc.cpp", "fakemeta_amxx.cpp", "forward.cpp", "pdata.cpp", "pev.cpp", "engfunc.cpp", "sdk/amxxmodule.cpp");
|
@CPP_SOURCE_FILES = ("dllfunc.cpp", "fakemeta_amxx.cpp", "forward.cpp", "pdata.cpp", "pev.cpp", "engfunc.cpp", "sdk/amxxmodule.cpp");
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ $mm = "../../metamod/metamod";
|
|||||||
my %OPTIONS, %OPT;
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
$OPT{"debug"} = "-g -ggdb";
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ while ($cmd = shift)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = `gcc --version`;
|
$gcc = `$gccf --version`;
|
||||||
if ($gcc =~ /2\.9/)
|
if ($gcc =~ /2\.9/)
|
||||||
{
|
{
|
||||||
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
@ -139,11 +140,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
$ofile = $file;
|
$ofile = $file;
|
||||||
$ofile =~ s/\.cpp/\.o/;
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
$ofile = "$outdir/$ofile";
|
$ofile = "$outdir/$ofile";
|
||||||
$gcc = "gcc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -165,7 +166,7 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
if (-e $ofile)
|
if (-e $ofile)
|
||||||
{
|
{
|
||||||
$file_time = (stat($file))[9];
|
$file_time = (stat($file))[9];
|
||||||
$ofile_time = (stat($file))[9];
|
$ofile_time = (stat($ofile))[9];
|
||||||
if ($file_time > $ofile_time)
|
if ($file_time > $ofile_time)
|
||||||
{
|
{
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
@ -177,6 +178,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$gcc = "gcc $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
print "$gcc\n";
|
print "$gcc\n";
|
||||||
`$gcc`;
|
`$gcc`;
|
||||||
|
@ -211,6 +211,13 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
|||||||
CHECK_ENTITY(index);
|
CHECK_ENTITY(index);
|
||||||
iparam1 = gpMetaUtilFuncs->pfnCallGameEntity(PLID,STRING(ALLOC_STRING(temp)),VARS(INDEXENT2(index)));
|
iparam1 = gpMetaUtilFuncs->pfnCallGameEntity(PLID,STRING(ALLOC_STRING(temp)),VARS(INDEXENT2(index)));
|
||||||
return iparam1;
|
return iparam1;
|
||||||
|
case DLLFunc_ClientUserInfoChanged: // void ) (edict_t *pEntity, char *infobuffer)
|
||||||
|
index = cRet[0];
|
||||||
|
CHECK_ENTITY(index);
|
||||||
|
gpGamedllFuncs->dllapi_table->pfnClientUserInfoChanged(INDEXENT2(index),(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)));
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
MF_Log("Unknown dllfunc entry.");
|
MF_Log("Unknown dllfunc entry.");
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||||
|
@ -48,7 +48,8 @@ enum
|
|||||||
DLLFunc_CreateInstancedBaselines, // void ) ( void );
|
DLLFunc_CreateInstancedBaselines, // void ) ( void );
|
||||||
DLLFunc_pfnAllowLagCompensation, // int )( void );
|
DLLFunc_pfnAllowLagCompensation, // int )( void );
|
||||||
// I know this does not fit with DLLFUNC(), but I dont want another native just for it.
|
// I know this does not fit with DLLFUNC(), but I dont want another native just for it.
|
||||||
MetaFunc_CallGameEntity // bool (plid_t plid, const char *entStr,entvars_t *pev);
|
MetaFunc_CallGameEntity, // bool (plid_t plid, const char *entStr,entvars_t *pev);
|
||||||
|
DLLFunc_ClientUserInfoChanged // void ) (edict_t *pEntity, char *infobuffer)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_INCLUDE_DLLFUNC_H
|
#endif //_INCLUDE_DLLFUNC_H
|
||||||
|
@ -962,7 +962,6 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
|||||||
temp2 = MF_GetAmxString(amx,params[4],1,&len);
|
temp2 = MF_GetAmxString(amx,params[4],1,&len);
|
||||||
(*g_engfuncs.pfnSetClientKeyValue)(index,(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp,temp2);
|
(*g_engfuncs.pfnSetClientKeyValue)(index,(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp,temp2);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_CONSOLE(PLID,"[NS2AMX] Unknown engfunc type provided.");
|
LOG_CONSOLE(PLID,"[NS2AMX] Unknown engfunc type provided.");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -175,6 +175,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\forward.h">
|
RelativePath=".\forward.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\forwardmacros.h">
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
||||||
{
|
{
|
||||||
int index=params[1];
|
int index=params[1];
|
||||||
if (index >= 1 && index <= 32)
|
if (index >= 1 && index <= gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
if (!MF_IsPlayerIngame(index))
|
if (!MF_IsPlayerIngame(index))
|
||||||
{
|
{
|
||||||
@ -12,7 +12,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (index > gpGlobals->maxEntities)
|
if (index > gpGlobals->maxEntities || index < 1)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
@ -176,6 +176,9 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
|||||||
case idealpitch:
|
case idealpitch:
|
||||||
fReturn = pPlayer->v.idealpitch;
|
fReturn = pPlayer->v.idealpitch;
|
||||||
break;
|
break;
|
||||||
|
case ideal_yaw:
|
||||||
|
fReturn = pPlayer->v.ideal_yaw;
|
||||||
|
break;
|
||||||
case pitch_speed:
|
case pitch_speed:
|
||||||
fReturn = pPlayer->v.pitch_speed;
|
fReturn = pPlayer->v.pitch_speed;
|
||||||
break;
|
break;
|
||||||
@ -764,6 +767,8 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
|
|||||||
case idealpitch:
|
case idealpitch:
|
||||||
pPlayer->v.idealpitch = fValue;
|
pPlayer->v.idealpitch = fValue;
|
||||||
return 1;
|
return 1;
|
||||||
|
case ideal_yaw:
|
||||||
|
pPlayer->v.ideal_yaw = fValue;
|
||||||
case pitch_speed:
|
case pitch_speed:
|
||||||
pPlayer->v.pitch_speed = fValue;
|
pPlayer->v.pitch_speed = fValue;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -43,6 +43,7 @@ enum pev_pointers
|
|||||||
impacttime,
|
impacttime,
|
||||||
starttime,
|
starttime,
|
||||||
idealpitch,
|
idealpitch,
|
||||||
|
ideal_yaw,
|
||||||
pitch_speed,
|
pitch_speed,
|
||||||
yaw_speed,
|
yaw_speed,
|
||||||
ltime,
|
ltime,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user