INDEXENT() fix (Use INDEXENT2() now)

Stop forwarding after ServerActivate() has been called (until next map)
This commit is contained in:
Steve Dudenhoeffer 2004-08-12 04:14:47 +00:00
parent b41a3631aa
commit f4ed94a9da
4 changed files with 92 additions and 64 deletions

View File

@ -2,6 +2,8 @@
BOOL CheckForPublic(const char *publicname); BOOL CheckForPublic(const char *publicname);
edict_t *g_player_edicts[33];
int AmxStringToEngine(AMX *amx, cell param, int &len) int AmxStringToEngine(AMX *amx, cell param, int &len)
{ {
char *szString = MF_GetAmxString(amx, param, 0, &len); char *szString = MF_GetAmxString(amx, param, 0, &len);
@ -149,8 +151,8 @@ void ClientDisconnect(edict_t *pEntity)
g_CameraCount--; g_CameraCount--;
if (g_CameraCount < 0) if (g_CameraCount < 0)
g_CameraCount=0; g_CameraCount=0;
if (g_CameraCount==0) if (g_CameraCount==0) // Reset the AddToFullPack pointer if there's no more cameras in use...
g_pFunctionTable->pfnAddToFullPack=AddToFullPack; g_pFunctionTable->pfnAddToFullPack=NULL;
} }
plinfo[id].iSpeakFlags = SPEAK_NORMAL; plinfo[id].iSpeakFlags = SPEAK_NORMAL;
@ -191,11 +193,26 @@ void ServerDeactivate()
Impulses.clear(); Impulses.clear();
Thinks.clear(); Thinks.clear();
// Reset all forwarding function tables (so that forwards won't be called before plugins are initialized)
g_pFunctionTable->pfnAddToFullPack=NULL;
g_pFunctionTable->pfnKeyValue=NULL;
g_pengfuncsTable->pfnPlaybackEvent=NULL; // "pfn_playbackevent"
g_pFunctionTable->pfnPlayerPreThink=NULL; // "client_PreThink"
g_pFunctionTable->pfnPlayerPostThink=NULL; // "client_PostThink"
g_pFunctionTable->pfnSpawn=NULL; // "pfn_spawn"
g_pFunctionTable->pfnClientKill=NULL; // "client_kill"
g_pFunctionTable->pfnCmdStart=NULL; // "client_impulse","register_impulse"
g_pFunctionTable->pfnThink=NULL; // "pfn_think", "register_think"
g_pFunctionTable->pfnStartFrame=NULL; // "server_frame","ServerFrame"
g_pFunctionTable->pfnTouch=NULL; // "pfn_touch","vexd_pfntouch"
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{ {
for(int f = 1; f <= gpGlobals->maxClients;f++)
g_player_edicts[f]=pEdictList + f;
Msg.clear(); Msg.clear();
register int i = 0; register int i = 0;
for (i=0; i<256; i++) { for (i=0; i<256; i++) {

View File

@ -104,7 +104,7 @@ static cell AMX_NATIVE_CALL VelocityByAim(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
MAKE_VECTORS(pEnt->v.v_angle); MAKE_VECTORS(pEnt->v.v_angle);
vVector = gpGlobals->v_forward * iVelocity; vVector = gpGlobals->v_forward * iVelocity;
@ -270,7 +270,7 @@ static cell AMX_NATIVE_CALL trace_normal(AMX *amx, cell *params)
Vector vEnd = Vector(fEndX, fEndY, fEndZ); Vector vEnd = Vector(fEndX, fEndY, fEndZ);
TraceResult tr; TraceResult tr;
TRACE_LINE(vStart, vEnd, dont_ignore_monsters, INDEXENT(iEnt), &tr); TRACE_LINE(vStart, vEnd, dont_ignore_monsters, INDEXENT2(iEnt), &tr);
vRet[0] = amx_ftoc(tr.vecPlaneNormal.x); vRet[0] = amx_ftoc(tr.vecPlaneNormal.x);
vRet[1] = amx_ftoc(tr.vecPlaneNormal.y); vRet[1] = amx_ftoc(tr.vecPlaneNormal.y);
@ -305,7 +305,7 @@ static cell AMX_NATIVE_CALL trace_line(AMX *amx, cell *params)
if (iEnt == -1) if (iEnt == -1)
TRACE_LINE(vStart, vEnd, ignore_monsters, NULL, &tr); TRACE_LINE(vStart, vEnd, ignore_monsters, NULL, &tr);
else else
TRACE_LINE(vStart, vEnd, dont_ignore_monsters, INDEXENT(iEnt), &tr); TRACE_LINE(vStart, vEnd, dont_ignore_monsters, INDEXENT2(iEnt), &tr);
edict_t *pHit = tr.pHit; edict_t *pHit = tr.pHit;
@ -368,7 +368,7 @@ static cell AMX_NATIVE_CALL get_info_keybuffer(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *e = INDEXENT(iEnt); edict_t *e = INDEXENT2(iEnt);
char *info = GETINFOKEYBUFFER(e); char *info = GETINFOKEYBUFFER(e);
@ -386,7 +386,7 @@ static cell AMX_NATIVE_CALL drop_to_floor(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *e = INDEXENT(iEnt); edict_t *e = INDEXENT2(iEnt);
return DROP_TO_FLOOR(e); return DROP_TO_FLOOR(e);
} }
@ -417,7 +417,7 @@ static cell AMX_NATIVE_CALL attach_view(AMX *amx, cell *params)
return 0; return 0;
} }
SET_VIEW(INDEXENT(iIndex), INDEXENT(iTargetIndex)); SET_VIEW(INDEXENT2(iIndex), INDEXENT2(iTargetIndex));
return 1; return 1;
} }
@ -434,7 +434,7 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
return 0; return 0;
} }
edict_t *pPlayer = INDEXENT(iIndex); edict_t *pPlayer = INDEXENT2(iIndex);
edict_t *pNewCamera; edict_t *pNewCamera;
switch(iCameraType) switch(iCameraType)
@ -612,7 +612,7 @@ static cell AMX_NATIVE_CALL trace_hull(AMX *amx,cell *params)
vPos.y = amx_ctof(vCell[1]); vPos.y = amx_ctof(vCell[1]);
vPos.z = amx_ctof(vCell[2]); vPos.z = amx_ctof(vCell[2]);
TRACE_HULL(vPos,vPos, params[4], params[2], params[3] > 0 ? INDEXENT(params[3]) : 0 , &tr); TRACE_HULL(vPos,vPos, params[4], params[2], params[3] > 0 ? INDEXENT2(params[3]) : 0 , &tr);
if (tr.fStartSolid) { if (tr.fStartSolid) {
iResult += 1; iResult += 1;
@ -646,7 +646,7 @@ static cell AMX_NATIVE_CALL playback_event(AMX *amx, cell *params)
int bparam1; int bparam1;
int bparam2; int bparam2;
flags = params[1]; flags = params[1];
pInvoker=INDEXENT(params[2]); pInvoker=INDEXENT2(params[2]);
eventindex=params[3]; eventindex=params[3];
delay=amx_ctof(params[4]); delay=amx_ctof(params[4]);
cell *cOrigin=MF_GetAmxAddr(amx, params[5]); cell *cOrigin=MF_GetAmxAddr(amx, params[5]);
@ -908,11 +908,11 @@ static cell AMX_NATIVE_CALL take_damage(AMX *amx, cell *params)
} }
REAL fnDamage = amx_ctof(params[4]); REAL fnDamage = amx_ctof(params[4]);
int inType = params[5]; int inType = params[5];
edict_t* pEntitya = INDEXENT(indexa); edict_t* pEntitya = INDEXENT2(indexa);
edict_t* pEntityb = INDEXENT(indexb); edict_t* pEntityb = INDEXENT2(indexb);
edict_t* pEntityc = INDEXENT(indexc); edict_t* pEntityc = INDEXENT2(indexc);
CBaseEntity *pCEntity = NULL; CBaseEntity *pCEntity = NULL;
pCEntity = CBaseEntity::Instance(INDEXENT(indexa)); pCEntity = CBaseEntity::Instance(INDEXENT2(indexa));
pCEntity->TakeDamage(VARS(pEntityb),VARS(pEntityc),fnDamage,inType); pCEntity->TakeDamage(VARS(pEntityb),VARS(pEntityc),fnDamage,inType);
return 1; return 1;
} }

View File

@ -18,7 +18,7 @@
#include "entity.h" #include "entity.h"
#include "gpglobals.h" #include "gpglobals.h"
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; } //#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
extern DLL_FUNCTIONS *g_pFunctionTable; extern DLL_FUNCTIONS *g_pFunctionTable;
extern DLL_FUNCTIONS *g_pFunctionTable_Post; extern DLL_FUNCTIONS *g_pFunctionTable_Post;
@ -167,6 +167,17 @@ int AmxStringToEngine(AMX *amx, cell param, int &len);
edict_t *UTIL_FindEntityInSphere(edict_t *pStart, const Vector &vecCenter, float flRadius); edict_t *UTIL_FindEntityInSphere(edict_t *pStart, const Vector &vecCenter, float flRadius);
extern int g_CameraCount; extern int g_CameraCount;
extern edict_t *g_player_edicts[33];
inline edict_t* INDEXENT2( int iEdictNum )
{
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
return g_player_edicts[iEdictNum];
else
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; }
extern bool g_inKeyValue; extern bool g_inKeyValue;
extern KeyValueData *g_pkvd; extern KeyValueData *g_pkvd;

View File

@ -9,7 +9,7 @@ int is_ent_valid(int iEnt)
if (!MF_IsPlayerIngame(iEnt)) if (!MF_IsPlayerIngame(iEnt))
return 0; return 0;
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
if (FNullEnt(pEnt)) if (FNullEnt(pEnt))
return 0; return 0;
@ -31,8 +31,8 @@ static cell AMX_NATIVE_CALL entity_range(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEntA = INDEXENT(idxa); edict_t *pEntA = INDEXENT2(idxa);
edict_t *pEntB = INDEXENT(idxb); edict_t *pEntB = INDEXENT2(idxb);
REAL fRet = (pEntA->v.origin - pEntB->v.origin).Length(); REAL fRet = (pEntA->v.origin - pEntB->v.origin).Length();
@ -52,7 +52,7 @@ static cell AMX_NATIVE_CALL call_think(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
MDLL_Think(pEnt); MDLL_Think(pEnt);
@ -70,8 +70,8 @@ static cell AMX_NATIVE_CALL fake_touch(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pToucher = INDEXENT(iPtr); edict_t *pToucher = INDEXENT2(iPtr);
edict_t *pTouched = INDEXENT(iPtd); edict_t *pTouched = INDEXENT2(iPtd);
MDLL_Touch(pToucher, pTouched); MDLL_Touch(pToucher, pTouched);
@ -88,8 +88,8 @@ static cell AMX_NATIVE_CALL force_use(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pUser = INDEXENT(iPtr); edict_t *pUser = INDEXENT2(iPtr);
edict_t *pUsed = INDEXENT(iPtd); edict_t *pUsed = INDEXENT2(iPtd);
MDLL_Use(pUsed, pUser); MDLL_Use(pUsed, pUser);
@ -112,7 +112,7 @@ static cell AMX_NATIVE_CALL create_entity(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL remove_entity(AMX *amx, cell *params) static cell AMX_NATIVE_CALL remove_entity(AMX *amx, cell *params)
{ {
int id = params[1]; int id = params[1];
edict_t *pEnt = INDEXENT(id); edict_t *pEnt = INDEXENT2(id);
if (FNullEnt(pEnt)) if (FNullEnt(pEnt))
return 0; return 0;
@ -142,7 +142,7 @@ static cell AMX_NATIVE_CALL DispatchKeyValue(AMX *amx, cell *params)
MF_RaiseAmxError(amx, AMX_ERR_NATIVE); MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
return 0; return 0;
} }
edict_t *pEntity = INDEXENT(iValue); edict_t *pEntity = INDEXENT2(iValue);
KeyValueData kvd; KeyValueData kvd;
int iLength=0; int iLength=0;
char *char1 = MF_GetAmxString(amx, params[2], 0, &iLength); char *char1 = MF_GetAmxString(amx, params[2], 0, &iLength);
@ -175,7 +175,7 @@ static cell AMX_NATIVE_CALL get_keyvalue(AMX *amx, cell *params)
MF_RaiseAmxError(amx, AMX_ERR_NATIVE); MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
return 0; return 0;
} }
edict_t *pEntity = INDEXENT(idx); edict_t *pEntity = INDEXENT2(idx);
char *test = INFO_KEY_BUFFER(pEntity); char *test = INFO_KEY_BUFFER(pEntity);
int iLength=0; int iLength=0;
char *char1 = MF_GetAmxString(amx, params[2], 1, &iLength); char *char1 = MF_GetAmxString(amx, params[2], 1, &iLength);
@ -206,7 +206,7 @@ static cell AMX_NATIVE_CALL DispatchSpawn(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
MDLL_Spawn(pEnt); MDLL_Spawn(pEnt);
@ -228,7 +228,7 @@ static cell AMX_NATIVE_CALL entity_get_float(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -362,7 +362,7 @@ static cell AMX_NATIVE_CALL entity_set_float(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -496,7 +496,7 @@ static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -631,7 +631,7 @@ static cell AMX_NATIVE_CALL entity_set_int(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -766,7 +766,7 @@ static cell AMX_NATIVE_CALL entity_get_vector(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -866,7 +866,7 @@ static cell AMX_NATIVE_CALL entity_set_vector(AMX *amx, cell *params)
REAL fY = amx_ctof(vAmx[1]); REAL fY = amx_ctof(vAmx[1]);
REAL fZ = amx_ctof(vAmx[2]); REAL fZ = amx_ctof(vAmx[2]);
Vector vSet = Vector(fX, fY, fZ); Vector vSet = Vector(fX, fY, fZ);
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -959,7 +959,7 @@ static cell AMX_NATIVE_CALL entity_get_string(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -1024,7 +1024,7 @@ static cell AMX_NATIVE_CALL entity_set_string(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -1086,7 +1086,7 @@ static cell AMX_NATIVE_CALL entity_get_edict(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -1145,8 +1145,8 @@ static cell AMX_NATIVE_CALL entity_set_edict(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
edict_t *pSetEnt = INDEXENT(iSetEnt); edict_t *pSetEnt = INDEXENT2(iSetEnt);
switch (idx) switch (idx)
{ {
@ -1202,7 +1202,7 @@ static cell AMX_NATIVE_CALL entity_get_byte(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -1248,7 +1248,7 @@ static cell AMX_NATIVE_CALL entity_set_byte(AMX *amx, cell *params)
if(iNewValue < 0) if(iNewValue < 0)
iNewValue = 0; iNewValue = 0;
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
switch (idx) switch (idx)
{ {
@ -1287,7 +1287,7 @@ static cell AMX_NATIVE_CALL entity_set_origin(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
cell *vVector = MF_GetAmxAddr(amx, params[2]); cell *vVector = MF_GetAmxAddr(amx, params[2]);
REAL fX = amx_ctof(vVector[0]); REAL fX = amx_ctof(vVector[0]);
REAL fY = amx_ctof(vVector[1]); REAL fY = amx_ctof(vVector[1]);
@ -1309,7 +1309,7 @@ static cell AMX_NATIVE_CALL entity_set_model(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
int iLen; int iLen;
char *szModel = MF_GetAmxString(amx, params[2], 0, &iLen); char *szModel = MF_GetAmxString(amx, params[2], 0, &iLen);
char *szStatic = new char[iLen+1]; char *szStatic = new char[iLen+1];
@ -1331,7 +1331,7 @@ static cell AMX_NATIVE_CALL entity_set_size(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
cell *cMin = MF_GetAmxAddr(amx, params[2]); cell *cMin = MF_GetAmxAddr(amx, params[2]);
REAL x1 = amx_ctof(cMin[0]); REAL x1 = amx_ctof(cMin[0]);
@ -1364,7 +1364,7 @@ static cell AMX_NATIVE_CALL get_offset_short(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1382,7 +1382,7 @@ static cell AMX_NATIVE_CALL set_offset_short(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1402,7 +1402,7 @@ static cell AMX_NATIVE_CALL get_offset_char(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1421,7 +1421,7 @@ static cell AMX_NATIVE_CALL set_offset_char(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1442,7 +1442,7 @@ static cell AMX_NATIVE_CALL get_offset_int(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1460,7 +1460,7 @@ static cell AMX_NATIVE_CALL set_offset_int(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1480,7 +1480,7 @@ static cell AMX_NATIVE_CALL get_offset_float(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1500,7 +1500,7 @@ static cell AMX_NATIVE_CALL set_offset_float(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
#ifdef __linux__ #ifdef __linux__
off += params[3]; off += params[3];
#endif #endif
@ -1529,7 +1529,7 @@ static cell AMX_NATIVE_CALL find_ent_in_sphere(AMX *amx, cell *params)
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(idx); edict_t *pEnt = INDEXENT2(idx);
cell *cAddr = MF_GetAmxAddr(amx, params[2]); cell *cAddr = MF_GetAmxAddr(amx, params[2]);
REAL origin[3] = { REAL origin[3] = {
amx_ctof(cAddr[0]), amx_ctof(cAddr[0]),
@ -1548,7 +1548,7 @@ static cell AMX_NATIVE_CALL find_ent_in_sphere(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL find_ent_by_class(AMX *amx, cell *params) /* 3 param */ static cell AMX_NATIVE_CALL find_ent_by_class(AMX *amx, cell *params) /* 3 param */
{ {
edict_t *pEnt = INDEXENT(params[1]); edict_t *pEnt = INDEXENT2(params[1]);
int len; int len;
char* sValue = MF_GetAmxString(amx, params[2], 0, &len); char* sValue = MF_GetAmxString(amx, params[2], 0, &len);
@ -1581,7 +1581,7 @@ static cell AMX_NATIVE_CALL find_sphere_class(AMX *amx, cell *params) // find_sp
return 0; return 0;
} }
edict_t* pEntity = INDEXENT(params[1]); edict_t* pEntity = INDEXENT2(params[1]);
vecOrigin = pEntity->v.origin; vecOrigin = pEntity->v.origin;
} else { } else {
cell *cAddr = MF_GetAmxAddr(amx, params[6]); cell *cAddr = MF_GetAmxAddr(amx, params[6]);
@ -1589,7 +1589,7 @@ static cell AMX_NATIVE_CALL find_sphere_class(AMX *amx, cell *params) // find_sp
} }
int entsFound = 0; int entsFound = 0;
edict_t* pSearchEnt = INDEXENT(0); edict_t* pSearchEnt = INDEXENT2(0);
while (entsFound < params[5]) { while (entsFound < params[5]) {
pSearchEnt = FIND_ENTITY_IN_SPHERE(pSearchEnt, vecOrigin, radius); // takes const float origin pSearchEnt = FIND_ENTITY_IN_SPHERE(pSearchEnt, vecOrigin, radius); // takes const float origin
@ -1620,7 +1620,7 @@ static cell AMX_NATIVE_CALL find_ent_by_target(AMX *amx, cell *params)
if (!is_ent_valid(iStart)) if (!is_ent_valid(iStart))
pStart = NULL; pStart = NULL;
else else
pStart = INDEXENT(iStart); pStart = INDEXENT2(iStart);
} }
int iReturnEnt = ENTINDEX(FIND_ENTITY_BY_TARGET(pStart, szValue)); int iReturnEnt = ENTINDEX(FIND_ENTITY_BY_TARGET(pStart, szValue));
@ -1642,7 +1642,7 @@ static cell AMX_NATIVE_CALL find_ent_by_model(AMX *amx, cell *params) {
if (!is_ent_valid(iStart)) if (!is_ent_valid(iStart))
pStart = NULL; pStart = NULL;
else else
pStart = INDEXENT(iStart); pStart = INDEXENT2(iStart);
} }
int checkEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStart, "classname", szClass)); int checkEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStart, "classname", szClass));
@ -1653,7 +1653,7 @@ static cell AMX_NATIVE_CALL find_ent_by_model(AMX *amx, cell *params) {
if (strcmp(CheckModel, szModel)==0) { if (strcmp(CheckModel, szModel)==0) {
return checkEnt; return checkEnt;
} else { } else {
pStart = INDEXENT(checkEnt); pStart = INDEXENT2(checkEnt);
checkEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStart, "classname", szClass)); checkEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStart, "classname", szClass));
} }
} }
@ -1674,7 +1674,7 @@ static cell AMX_NATIVE_CALL find_ent_by_tname(AMX *amx, cell *params) {
if (!is_ent_valid(iStart)) if (!is_ent_valid(iStart))
pStart = NULL; pStart = NULL;
else else
pStart = INDEXENT(iStart); pStart = INDEXENT2(iStart);
} }
int iReturnEnt = ENTINDEX(FIND_ENTITY_BY_TARGETNAME(pStart, szValue)); int iReturnEnt = ENTINDEX(FIND_ENTITY_BY_TARGETNAME(pStart, szValue));
@ -1692,8 +1692,8 @@ static cell AMX_NATIVE_CALL find_ent_by_owner(AMX *amx, cell *params) // native
return 0; return 0;
} }
edict_t *pEnt = INDEXENT(iEnt); edict_t *pEnt = INDEXENT2(iEnt);
edict_t *entOwner = INDEXENT(oEnt); edict_t *entOwner = INDEXENT2(oEnt);
//optional fourth parameter is for jghg2 compatibility //optional fourth parameter is for jghg2 compatibility
char* sCategory = NULL; char* sCategory = NULL;
@ -1730,8 +1730,8 @@ static cell AMX_NATIVE_CALL get_grenade_id(AMX *amx, cell *params) /* 4 param *
return 0; return 0;
} }
edict_t* pentFind = INDEXENT(params[4]); edict_t* pentFind = INDEXENT2(params[4]);
edict_t* pentOwner = INDEXENT(index); edict_t* pentOwner = INDEXENT2(index);
pentFind = FIND_ENTITY_BY_CLASSNAME( pentFind, "grenade" ); pentFind = FIND_ENTITY_BY_CLASSNAME( pentFind, "grenade" );
while (!FNullEnt(pentFind)) { while (!FNullEnt(pentFind)) {