Consistency: Replace INDEXENT2 and others things with HLTypeConversion in fakemeta module
This commit is contained in:
parent
9980b7ac62
commit
429a4596c1
@ -36,7 +36,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
{
|
||||
|
||||
// pfnGameInit
|
||||
case DLLFunc_GameInit: // void) ( void );
|
||||
case DLLFunc_GameInit: // void) ( void );
|
||||
gpGamedllFuncs->dllapi_table->pfnGameInit();
|
||||
return 1;
|
||||
|
||||
@ -45,14 +45,14 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
return gpGamedllFuncs->dllapi_table->pfnSpawn(INDEXENT2(index));
|
||||
return gpGamedllFuncs->dllapi_table->pfnSpawn(TypeConversion.id_to_edict(index));
|
||||
|
||||
// pfnThink
|
||||
case DLLFunc_Think: // void ) ( edict_t *pent );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnThink(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnThink(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
// pfnUse
|
||||
@ -63,7 +63,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
indexb=cRet[0];
|
||||
CHECK_ENTITY(indexb);
|
||||
gpGamedllFuncs->dllapi_table->pfnUse(INDEXENT2(index),INDEXENT2(indexb));
|
||||
gpGamedllFuncs->dllapi_table->pfnUse(TypeConversion.id_to_edict(index), TypeConversion.id_to_edict(indexb));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_KeyValue:
|
||||
@ -79,7 +79,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
else
|
||||
kvd = reinterpret_cast<KeyValueData *>(*cRet);
|
||||
|
||||
gpGamedllFuncs->dllapi_table->pfnKeyValue(INDEXENT2(index), kvd);
|
||||
gpGamedllFuncs->dllapi_table->pfnKeyValue(TypeConversion.id_to_edict(index), kvd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
indexb=cRet[0];
|
||||
CHECK_ENTITY(indexb);
|
||||
gpGamedllFuncs->dllapi_table->pfnTouch(INDEXENT2(index),INDEXENT2(indexb));
|
||||
gpGamedllFuncs->dllapi_table->pfnTouch(TypeConversion.id_to_edict(index), TypeConversion.id_to_edict(indexb));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_Blocked: // void ) ( edict_t *pentBlocked, edict_t *pentOther );
|
||||
@ -101,15 +101,15 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
indexb=cRet[0];
|
||||
CHECK_ENTITY(indexb);
|
||||
gpGamedllFuncs->dllapi_table->pfnBlocked(INDEXENT2(index),INDEXENT2(indexb));
|
||||
gpGamedllFuncs->dllapi_table->pfnBlocked(TypeConversion.id_to_edict(index), TypeConversion.id_to_edict(indexb));
|
||||
return 1;
|
||||
|
||||
|
||||
|
||||
case DLLFunc_SetAbsBox: // void ) ( edict_t *pent );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnSetAbsBox(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnSetAbsBox(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_ClientConnect: // bool) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
|
||||
@ -120,30 +120,30 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
temp = MF_GetAmxString(amx,params[3],0,&len);
|
||||
temp2 = MF_GetAmxString(amx,params[4],1,&len);
|
||||
//temp3 = GET_AMXSTRING(amx,params[5],2,len);
|
||||
iparam1 = MDLL_ClientConnect(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),(char *)temp3);
|
||||
iparam1 = MDLL_ClientConnect(TypeConversion.id_to_edict(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),(char *)temp3);
|
||||
cRet = MF_GetAmxAddr(amx,params[6]);
|
||||
MF_SetAmxString(amx,params[5],temp3,cRet[0]);
|
||||
return iparam1;
|
||||
|
||||
|
||||
case DLLFunc_ClientDisconnect: // void ) ( edict_t *pEntity );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnClientDisconnect(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnClientDisconnect(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_ClientKill: // void ) ( edict_t *pEntity );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnClientKill(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnClientKill(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_ClientPutInServer: // void ) ( edict_t *pEntity );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnClientPutInServer(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnClientPutInServer(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_ServerDeactivate: // void) ( void );
|
||||
@ -154,14 +154,14 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnPlayerPreThink(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnPlayerPreThink(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_PlayerPostThink: // void ) ( edict_t *pEntity );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnPlayerPostThink(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnPlayerPostThink(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
case DLLFunc_StartFrame: // void ) ( void );
|
||||
@ -177,7 +177,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
return 1;
|
||||
|
||||
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
|
||||
case DLLFunc_GetGameDescription: // const char * )( void );
|
||||
case DLLFunc_GetGameDescription: // const char * )( void );
|
||||
temp = (char*)gpGamedllFuncs->dllapi_table->pfnGetGameDescription();
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
MF_SetAmxString(amx,params[2],temp,cRet[0]);
|
||||
@ -188,19 +188,19 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnSpectatorConnect(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnSpectatorConnect(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
case DLLFunc_SpectatorDisconnect: // void ) ( edict_t *pEntity );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnSpectatorDisconnect(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnSpectatorDisconnect(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
case DLLFunc_SpectatorThink: // void ) ( edict_t *pEntity );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnSpectatorThink(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnSpectatorThink(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
|
||||
@ -244,13 +244,13 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
iparam1 = gpMetaUtilFuncs->pfnCallGameEntity(PLID,STRING(ALLOC_STRING(temp)),VARS(INDEXENT2(index)));
|
||||
iparam1 = gpMetaUtilFuncs->pfnCallGameEntity(PLID,STRING(ALLOC_STRING(temp)),VARS(TypeConversion.id_to_edict(index)));
|
||||
return iparam1;
|
||||
case DLLFunc_ClientUserInfoChanged: // void ) (edict_t *pEntity, char *infobuffer)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
gpGamedllFuncs->dllapi_table->pfnClientUserInfoChanged(INDEXENT2(index),(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)));
|
||||
gpGamedllFuncs->dllapi_table->pfnClientUserInfoChanged(TypeConversion.id_to_edict(index),(*g_engfuncs.pfnGetInfoKeyBuffer)(TypeConversion.id_to_edict(index)));
|
||||
return 1;
|
||||
case DLLFunc_UpdateClientData: // void ) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd)
|
||||
cRet = MF_GetAmxAddr(amx, params[2]);
|
||||
@ -258,7 +258,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
cRet = MF_GetAmxAddr(amx, params[3]);
|
||||
iparam1 = cRet[0];
|
||||
|
||||
|
||||
clientdata_t *cd;
|
||||
|
||||
if ((params[0] / sizeof(cell)) == 4)
|
||||
@ -273,7 +273,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cd = &g_cd_glb;
|
||||
|
||||
|
||||
gpGamedllFuncs->dllapi_table->pfnUpdateClientData(INDEXENT2(index), iparam1, cd);
|
||||
gpGamedllFuncs->dllapi_table->pfnUpdateClientData(TypeConversion.id_to_edict(index), iparam1, cd);
|
||||
|
||||
return 1;
|
||||
case DLLFunc_AddToFullPack: // int ) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet)
|
||||
@ -310,7 +310,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx, params[8]);
|
||||
pset = reinterpret_cast<unsigned char *>(*cRet);
|
||||
|
||||
return gpGamedllFuncs->dllapi_table->pfnAddToFullPack(es, iparam1, INDEXENT2(index), INDEXENT2(indexb), iparam2, iparam3, pset);
|
||||
return gpGamedllFuncs->dllapi_table->pfnAddToFullPack(es, iparam1, TypeConversion.id_to_edict(index), TypeConversion.id_to_edict(indexb), iparam2, iparam3, pset);
|
||||
case DLLFunc_CmdStart: // void ) (const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed)
|
||||
cRet = MF_GetAmxAddr(amx, params[2]);
|
||||
index = cRet[0];
|
||||
@ -328,7 +328,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
cRet = MF_GetAmxAddr(amx, params[4]);
|
||||
iparam1 = cRet[0];
|
||||
|
||||
gpGamedllFuncs->dllapi_table->pfnCmdStart(INDEXENT2(index), uc, iparam1);
|
||||
gpGamedllFuncs->dllapi_table->pfnCmdStart(TypeConversion.id_to_edict(index), uc, iparam1);
|
||||
|
||||
return 1;
|
||||
case DLLFunc_CmdEnd: // void ) (const edict_t *player)
|
||||
@ -336,7 +336,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
gpGamedllFuncs->dllapi_table->pfnCmdEnd(INDEXENT2(index));
|
||||
gpGamedllFuncs->dllapi_table->pfnCmdEnd(TypeConversion.id_to_edict(index));
|
||||
|
||||
return 1;
|
||||
|
||||
@ -370,8 +370,8 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
Vec2.x = amx_ctof(cRet[0]);
|
||||
Vec2.y = amx_ctof(cRet[1]);
|
||||
Vec2.z = amx_ctof(cRet[2]);
|
||||
|
||||
gpGamedllFuncs->dllapi_table->pfnCreateBaseline(iparam1, iparam2, es, INDEXENT2(index), iparam3, Vec1, Vec2);
|
||||
|
||||
gpGamedllFuncs->dllapi_table->pfnCreateBaseline(iparam1, iparam2, es, TypeConversion.id_to_edict(index), iparam3, Vec1, Vec2);
|
||||
|
||||
return 1;
|
||||
default:
|
||||
|
@ -68,7 +68,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
(*g_engfuncs.pfnSetModel)(INDEXENT2(index),(char*)STRING(ALLOC_STRING(temp)));
|
||||
(*g_engfuncs.pfnSetModel)(TypeConversion.id_to_edict(index),(char*)STRING(ALLOC_STRING(temp)));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
Vec2[0]=amx_ctof(cRet[0]);
|
||||
Vec2[1]=amx_ctof(cRet[1]);
|
||||
Vec2[2]=amx_ctof(cRet[2]);
|
||||
(*g_engfuncs.pfnSetSize)(INDEXENT2(index),Vec1,Vec2);
|
||||
(*g_engfuncs.pfnSetSize)(TypeConversion.id_to_edict(index),Vec1,Vec2);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[5]);
|
||||
iparam1=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
(*g_engfuncs.pfnMoveToOrigin)(INDEXENT2(index),Vec1,fparam1,iparam1);
|
||||
(*g_engfuncs.pfnMoveToOrigin)(TypeConversion.id_to_edict(index),Vec1,fparam1,iparam1);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
(*g_engfuncs.pfnChangeYaw)(INDEXENT2(index));
|
||||
(*g_engfuncs.pfnChangeYaw)(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
(*g_engfuncs.pfnChangePitch)(INDEXENT2(index));
|
||||
(*g_engfuncs.pfnChangePitch)(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
index=cRet[0];
|
||||
temp = MF_GetAmxString(amx,params[3],0,&len);
|
||||
temp2 = MF_GetAmxString(amx,params[4],1,&len);
|
||||
pRet = (*g_engfuncs.pfnFindEntityByString)(index == -1 ? NULL : INDEXENT2(index),temp,temp2);
|
||||
pRet = (*g_engfuncs.pfnFindEntityByString)(index == -1 ? NULL : TypeConversion.id_to_edict(index),temp,temp2);
|
||||
if (pRet)
|
||||
return ENTINDEX(pRet);
|
||||
return -1;
|
||||
@ -189,7 +189,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
return (*g_engfuncs.pfnGetEntityIllum)(INDEXENT2(index));
|
||||
return (*g_engfuncs.pfnGetEntityIllum)(TypeConversion.id_to_edict(index));
|
||||
|
||||
|
||||
// pfnFindEntityInSphere
|
||||
@ -202,7 +202,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
Vec1[2]=amx_ctof(cRet[2]);
|
||||
cRet = MF_GetAmxAddr(amx,params[4]);
|
||||
fparam1 = amx_ctof(cRet[0]);
|
||||
pRet = (*g_engfuncs.pfnFindEntityInSphere)(index == -1 ? NULL : INDEXENT2(index),Vec1,fparam1);
|
||||
pRet = (*g_engfuncs.pfnFindEntityInSphere)(index == -1 ? NULL : TypeConversion.id_to_edict(index),Vec1,fparam1);
|
||||
if (pRet)
|
||||
return ENTINDEX(pRet);
|
||||
return -1;
|
||||
@ -213,7 +213,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
pRet=(*g_engfuncs.pfnFindClientInPVS)(INDEXENT2(index));
|
||||
pRet=(*g_engfuncs.pfnFindClientInPVS)(TypeConversion.id_to_edict(index));
|
||||
return ENTINDEX(pRet);
|
||||
|
||||
|
||||
@ -222,7 +222,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index=cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
pRet=(*g_engfuncs.pfnEntitiesInPVS)(INDEXENT2(index));
|
||||
pRet=(*g_engfuncs.pfnEntitiesInPVS)(TypeConversion.id_to_edict(index));
|
||||
return ENTINDEX(pRet);
|
||||
|
||||
|
||||
@ -273,7 +273,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
if (index == 0)
|
||||
return 0;
|
||||
(*g_engfuncs.pfnRemoveEntity)(INDEXENT2(index));
|
||||
(*g_engfuncs.pfnRemoveEntity)(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -292,7 +292,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
(*g_engfuncs.pfnMakeStatic)(INDEXENT2(index));
|
||||
(*g_engfuncs.pfnMakeStatic)(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
return (*g_engfuncs.pfnEntIsOnFloor)(INDEXENT2(index));
|
||||
return (*g_engfuncs.pfnEntIsOnFloor)(TypeConversion.id_to_edict(index));
|
||||
|
||||
|
||||
// pfnDropToFloor
|
||||
@ -309,7 +309,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
return (*g_engfuncs.pfnDropToFloor)(INDEXENT2(index));
|
||||
return (*g_engfuncs.pfnDropToFloor)(TypeConversion.id_to_edict(index));
|
||||
|
||||
|
||||
// pfnWalkMove
|
||||
@ -323,7 +323,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
fparam2 = amx_ctof(cRet[0]);
|
||||
cRet = MF_GetAmxAddr(amx,params[5]);
|
||||
iparam1 = cRet[0];
|
||||
return (*g_engfuncs.pfnWalkMove)(INDEXENT2(index),fparam1,fparam2,iparam1);
|
||||
return (*g_engfuncs.pfnWalkMove)(TypeConversion.id_to_edict(index),fparam1,fparam2,iparam1);
|
||||
|
||||
|
||||
// pfnSetOrigin
|
||||
@ -335,7 +335,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
Vec1[0]=amx_ctof(cRet[0]);
|
||||
Vec1[1]=amx_ctof(cRet[1]);
|
||||
Vec1[2]=amx_ctof(cRet[2]);
|
||||
(*g_engfuncs.pfnSetOrigin)(INDEXENT2(index),Vec1);
|
||||
(*g_engfuncs.pfnSetOrigin)(TypeConversion.id_to_edict(index),Vec1);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -355,7 +355,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
iparam2=cRet[0];
|
||||
cRet = MF_GetAmxAddr(amx,params[8]);
|
||||
iparam3=cRet[0];
|
||||
(*g_engfuncs.pfnEmitSound)(INDEXENT2(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3);
|
||||
(*g_engfuncs.pfnEmitSound)(TypeConversion.id_to_edict(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -377,7 +377,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
iparam1=cRet[0];
|
||||
cRet = MF_GetAmxAddr(amx,params[8]);
|
||||
iparam2=cRet[0];
|
||||
(*g_engfuncs.pfnEmitAmbientSound)(INDEXENT2(index),Vec1,temp,fparam1,fparam2,iparam1,iparam2);
|
||||
(*g_engfuncs.pfnEmitAmbientSound)(TypeConversion.id_to_edict(index),Vec1,temp,fparam1,fparam2,iparam1,iparam2);
|
||||
return 1;
|
||||
|
||||
// pfnTraceLine
|
||||
@ -405,7 +405,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
} else {
|
||||
tr = &g_tr;
|
||||
}
|
||||
(*g_engfuncs.pfnTraceLine)(Vec1,Vec2,iparam1,index != -1 ? INDEXENT2(index) : NULL, tr);
|
||||
(*g_engfuncs.pfnTraceLine)(Vec1,Vec2,iparam1,index != -1 ? TypeConversion.id_to_edict(index) : NULL, tr);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -426,7 +426,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
} else {
|
||||
tr = &g_tr;
|
||||
}
|
||||
(*g_engfuncs.pfnTraceToss)(INDEXENT2(index),iparam1 == -1 ? NULL : INDEXENT2(iparam1),tr);
|
||||
(*g_engfuncs.pfnTraceToss)(TypeConversion.id_to_edict(index),iparam1 == -1 ? NULL : TypeConversion.id_to_edict(iparam1),tr);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -457,7 +457,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
} else {
|
||||
tr = &g_tr;
|
||||
}
|
||||
(*g_engfuncs.pfnTraceMonsterHull)(INDEXENT2(index),Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : INDEXENT2(iparam2),tr);
|
||||
(*g_engfuncs.pfnTraceMonsterHull)(TypeConversion.id_to_edict(index),Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : TypeConversion.id_to_edict(iparam2),tr);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -487,7 +487,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
} else {
|
||||
tr = &g_tr;
|
||||
}
|
||||
(*g_engfuncs.pfnTraceHull)(Vec1,Vec2,iparam1,iparam2,iparam3 == 0 ? 0 : INDEXENT2(iparam3),tr);
|
||||
(*g_engfuncs.pfnTraceHull)(Vec1,Vec2,iparam1,iparam2,iparam3 == 0 ? 0 : TypeConversion.id_to_edict(iparam3),tr);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -515,7 +515,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
} else {
|
||||
tr = &g_tr;
|
||||
}
|
||||
(*g_engfuncs.pfnTraceModel)(Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : INDEXENT2(iparam2),tr);
|
||||
(*g_engfuncs.pfnTraceModel)(Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : TypeConversion.id_to_edict(iparam2),tr);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -532,7 +532,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
Vec2[0]=amx_ctof(cRet[0]);
|
||||
Vec2[1]=amx_ctof(cRet[1]);
|
||||
Vec2[2]=amx_ctof(cRet[2]);
|
||||
temp = (char*)(*g_engfuncs.pfnTraceTexture)(INDEXENT2(index),Vec1,Vec2);
|
||||
temp = (char*)(*g_engfuncs.pfnTraceTexture)(TypeConversion.id_to_edict(index),Vec1,Vec2);
|
||||
cRet = MF_GetAmxAddr(amx,params[6]);
|
||||
MF_SetAmxString(amx, params[5], (temp == NULL) ? "NoTexture" : temp, cRet[0]);
|
||||
return (temp != NULL);
|
||||
@ -554,7 +554,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
fparam1 = amx_ctof(cRet[0]);
|
||||
cRet = MF_GetAmxAddr(amx,params[6]);
|
||||
index = cRet[0];
|
||||
(*g_engfuncs.pfnTraceSphere)(Vec1,Vec2,iparam1,fparam1,index == 0 ? NULL : INDEXENT2(index),&g_tr);
|
||||
(*g_engfuncs.pfnTraceSphere)(Vec1,Vec2,iparam1,fparam1,index == 0 ? NULL : TypeConversion.id_to_edict(index),&g_tr);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -565,7 +565,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
fparam1 = amx_ctof(cRet[0]);
|
||||
(*g_engfuncs.pfnGetAimVector)(INDEXENT2(index),fparam1,Vec1);
|
||||
(*g_engfuncs.pfnGetAimVector)(TypeConversion.id_to_edict(index),fparam1,Vec1);
|
||||
cRet = MF_GetAmxAddr(amx,params[4]);
|
||||
cRet[0] = amx_ftoc(Vec1[0]);
|
||||
cRet[1] = amx_ftoc(Vec1[1]);
|
||||
@ -620,7 +620,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
(*g_engfuncs.pfnFreeEntPrivateData)(INDEXENT2(index));
|
||||
(*g_engfuncs.pfnFreeEntPrivateData)(TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -655,7 +655,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
fparam1 = amx_ctof(cRet[0]);
|
||||
(*g_engfuncs.pfnAnimationAutomove)(INDEXENT2(index),fparam1);
|
||||
(*g_engfuncs.pfnAnimationAutomove)(TypeConversion.id_to_edict(index),fparam1);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -666,7 +666,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
iparam1=cRet[0];
|
||||
(*g_engfuncs.pfnGetBonePosition)(INDEXENT2(index),iparam1,Vec1,Vec2);
|
||||
(*g_engfuncs.pfnGetBonePosition)(TypeConversion.id_to_edict(index),iparam1,Vec1,Vec2);
|
||||
cRet = MF_GetAmxAddr(amx,params[4]);
|
||||
cRet[0]=amx_ftoc(Vec1[0]);
|
||||
cRet[1]=amx_ftoc(Vec1[1]);
|
||||
@ -685,7 +685,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
iparam1=cRet[0];
|
||||
(*g_engfuncs.pfnGetAttachment)(INDEXENT2(index),iparam1,Vec1,Vec2);
|
||||
(*g_engfuncs.pfnGetAttachment)(TypeConversion.id_to_edict(index),iparam1,Vec1,Vec2);
|
||||
cRet = MF_GetAmxAddr(amx,params[4]);
|
||||
cRet[0]=amx_ftoc(Vec1[0]);
|
||||
cRet[1]=amx_ftoc(Vec1[1]);
|
||||
@ -705,7 +705,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
iparam2 = cRet[0];
|
||||
CHECK_ENTITY(iparam1);
|
||||
CHECK_ENTITY(iparam2);
|
||||
(*g_engfuncs.pfnSetView)(INDEXENT2(iparam1),INDEXENT2(iparam2));
|
||||
(*g_engfuncs.pfnSetView)(TypeConversion.id_to_edict(iparam1),TypeConversion.id_to_edict(iparam2));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -724,7 +724,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
fparam1 = amx_ctof(cRet[0]);
|
||||
cRet = MF_GetAmxAddr(amx,params[4]);
|
||||
fparam2 = amx_ctof(cRet[0]);
|
||||
(*g_engfuncs.pfnCrosshairAngle)(INDEXENT2(index),fparam1,fparam2);
|
||||
(*g_engfuncs.pfnCrosshairAngle)(TypeConversion.id_to_edict(index),fparam1,fparam2);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -741,7 +741,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
iparam3 = cRet[0];
|
||||
cRet = MF_GetAmxAddr(amx,params[6]);
|
||||
iparam4 = cRet[0];
|
||||
(*g_engfuncs.pfnFadeClientVolume)(INDEXENT2(index),iparam1,iparam2,iparam3,iparam4);
|
||||
(*g_engfuncs.pfnFadeClientVolume)(TypeConversion.id_to_edict(index),iparam1,iparam2,iparam3,iparam4);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -752,7 +752,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
cRet = MF_GetAmxAddr(amx,params[3]);
|
||||
fparam1 = amx_ctof(cRet[0]);
|
||||
(*g_engfuncs.pfnSetClientMaxspeed)(INDEXENT2(index),fparam1);
|
||||
(*g_engfuncs.pfnSetClientMaxspeed)(TypeConversion.id_to_edict(index),fparam1);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -786,7 +786,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
iparam2 = cRet[0];
|
||||
cRet = MF_GetAmxAddr(amx,params[9]);
|
||||
iparam3 = cRet[0];
|
||||
(*g_engfuncs.pfnRunPlayerMove)(INDEXENT2(index),Vec1,fparam1,fparam2,fparam3,iparam1,iparam2,iparam3);
|
||||
(*g_engfuncs.pfnRunPlayerMove)(TypeConversion.id_to_edict(index),Vec1,fparam1,fparam2,fparam3,iparam1,iparam2,iparam3);
|
||||
return 1;
|
||||
|
||||
|
||||
@ -846,7 +846,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
/* don't check, it might not be included
|
||||
CHECK_ENTITY(iparam5);
|
||||
*/
|
||||
(*g_engfuncs.pfnBuildSoundMsg)(INDEXENT2(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3,iparam4,iparam5,Vec1,iparam6 == 0 ? NULL : INDEXENT2(iparam6));
|
||||
(*g_engfuncs.pfnBuildSoundMsg)(TypeConversion.id_to_edict(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3,iparam4,iparam5,Vec1,iparam6 == 0 ? NULL : TypeConversion.id_to_edict(iparam6));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -856,7 +856,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
temp = MF_GetAmxString(amx,params[3],0,&len);
|
||||
temp2 = (char*)(*g_engfuncs.pfnGetPhysicsKeyValue)(INDEXENT2(index),(const char *)temp);
|
||||
temp2 = (char*)(*g_engfuncs.pfnGetPhysicsKeyValue)(TypeConversion.id_to_edict(index),(const char *)temp);
|
||||
cRet = MF_GetAmxAddr(amx,params[5]);
|
||||
MF_SetAmxString(amx,params[4],temp2,cRet[0]);
|
||||
return 1;
|
||||
@ -869,7 +869,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
temp = MF_GetAmxString(amx,params[3],0,&len);
|
||||
temp2 = MF_GetAmxString(amx,params[4],1,&len);
|
||||
(*g_engfuncs.pfnSetPhysicsKeyValue)(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)));
|
||||
(*g_engfuncs.pfnSetPhysicsKeyValue)(TypeConversion.id_to_edict(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -878,7 +878,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
temp = (char*)(*g_engfuncs.pfnGetPhysicsInfoString)(INDEXENT2(index));
|
||||
temp = (char*)(*g_engfuncs.pfnGetPhysicsInfoString)(TypeConversion.id_to_edict(index));
|
||||
cRet = MF_GetAmxAddr(amx,params[4]);
|
||||
|
||||
MF_SetAmxString(amx,params[3],temp,cRet[0]);
|
||||
@ -924,7 +924,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
iparam5 = cRet[0];
|
||||
cRet = MF_GetAmxAddr(amx,params[13]);
|
||||
iparam6 = cRet[0];
|
||||
(*g_engfuncs.pfnPlaybackEvent)(iparam1,INDEXENT2(index),iparam2,fparam1,Vec1,Vec2,fparam2,fparam3,iparam3,iparam4,iparam5,iparam6);
|
||||
(*g_engfuncs.pfnPlaybackEvent)(iparam1,TypeConversion.id_to_edict(index),iparam2,fparam1,Vec1,Vec2,fparam2,fparam3,iparam3,iparam4,iparam5,iparam6);
|
||||
return 1;
|
||||
|
||||
//pfnCheckVisibility
|
||||
@ -934,7 +934,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
cRet = MF_GetAmxAddr(amx, params[3]);
|
||||
pset = (unsigned char *)cRet[0];
|
||||
return (*g_engfuncs.pfnCheckVisibility)(INDEXENT2(index), pset);
|
||||
return (*g_engfuncs.pfnCheckVisibility)(TypeConversion.id_to_edict(index), pset);
|
||||
|
||||
// pfnGetCurrentPlayer
|
||||
case EngFunc_GetCurrentPlayer: // int ) ( void );
|
||||
@ -946,7 +946,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
index = cRet[0];
|
||||
CHECK_ENTITY(index);
|
||||
return (*g_engfuncs.pfnCanSkipPlayer)(INDEXENT2(index));
|
||||
return (*g_engfuncs.pfnCanSkipPlayer)(TypeConversion.id_to_edict(index));
|
||||
|
||||
|
||||
// pfnSetGroupMask
|
||||
@ -991,7 +991,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
Vec1[2]=amx_ctof(cRet[2]);
|
||||
cRet = MF_GetAmxAddr(amx,params[5]);
|
||||
index = cRet[0];
|
||||
(*g_engfuncs.pfnMessageBegin)(iparam1,iparam2,Vec1,index == 0 ? NULL : INDEXENT2(index));
|
||||
(*g_engfuncs.pfnMessageBegin)(iparam1,iparam2,Vec1,index == 0 ? NULL : TypeConversion.id_to_edict(index));
|
||||
return 1;
|
||||
|
||||
|
||||
@ -1065,7 +1065,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
}
|
||||
|
||||
temp = (*g_engfuncs.pfnGetInfoKeyBuffer)((index == -1) ? NULL : INDEXENT2(index));
|
||||
temp = (*g_engfuncs.pfnGetInfoKeyBuffer)((index == -1) ? NULL : TypeConversion.id_to_edict(index));
|
||||
return reinterpret_cast<cell>(temp);
|
||||
case EngFunc_AlertMessage: // void ) (ALERT_TYPE atype, char *szFmt, ...);
|
||||
cRet = MF_GetAmxAddr(amx, params[2]);
|
||||
@ -1083,7 +1083,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
iparam1 = cRet[0];
|
||||
temp = MF_GetAmxString(amx,params[4], 0, &len);
|
||||
|
||||
(*g_engfuncs.pfnClientPrintf)(INDEXENT2(index), static_cast<PRINT_TYPE>(iparam1), temp);
|
||||
(*g_engfuncs.pfnClientPrintf)(TypeConversion.id_to_edict(index), static_cast<PRINT_TYPE>(iparam1), temp);
|
||||
return 1;
|
||||
case EngFunc_ServerPrint: // void ) (const char *szMsg);
|
||||
temp = MF_GetAmxString(amx, params[2], 0, &len);
|
||||
|
@ -14,8 +14,6 @@
|
||||
#include "fakemeta_amxx.h"
|
||||
#include "sh_stack.h"
|
||||
|
||||
edict_t *g_player_edicts[33]; // Used for INDEXENT() forward.
|
||||
|
||||
IGameConfig *CommonConfig;
|
||||
IGameConfigManager *ConfigManager;
|
||||
|
||||
@ -78,15 +76,12 @@ void OnAmxxDetach()
|
||||
delete g_FreeKVDWs.popCopy();
|
||||
}
|
||||
|
||||
int GetHullBounds(int hullnumber, float *mins, float *maxs);
|
||||
// sawce: Do not null out the forward for ServerActivate. It's required for the INDEXENT() fix. (I don't think ServerActivate is planned on being forwarded anyway)
|
||||
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
{
|
||||
for(int i = 1; i <= gpGlobals->maxClients;i++)
|
||||
g_player_edicts[i]=pEdictList + i;
|
||||
g_pFunctionTable_Post->pfnServerDeactivate = FMH_ServerDeactivate_Post;
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
#define RESETD(tcall) \
|
||||
g_pFunctionTable->pfn##tcall =0; \
|
||||
g_pFunctionTable_Post->pfn##tcall =NULL; \
|
||||
|
@ -28,15 +28,6 @@
|
||||
#include <IGameConfigs.h>
|
||||
#include <HLTypeConversion.h>
|
||||
|
||||
extern edict_t *g_player_edicts[33];
|
||||
|
||||
inline edict_t* INDEXENT2( int iEdictNum )
|
||||
{
|
||||
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
|
||||
return MF_GetPlayerEdict(iEdictNum);
|
||||
else
|
||||
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||
}
|
||||
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
||||
#define CHECK_ENTITY(x) \
|
||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||
@ -49,7 +40,7 @@ inline edict_t* INDEXENT2( int iEdictNum )
|
||||
return 0; \
|
||||
} \
|
||||
} else { \
|
||||
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||
if (x != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||
return 0; \
|
||||
} \
|
||||
|
@ -25,9 +25,9 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "No data passed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
cell *ptr = MF_GetAmxAddr(amx, params[2]);
|
||||
edict_t *e = 0;
|
||||
edict_t *e;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@ -85,7 +85,7 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
|
||||
}
|
||||
case TR_pHit:
|
||||
{
|
||||
e = INDEXENT2(*ptr);
|
||||
e = TypeConversion.id_to_edict(*ptr);
|
||||
if (!e || FNullEnt(e))
|
||||
return 0; //TODO: return error
|
||||
gfm_tr->pHit = e;
|
||||
|
@ -98,7 +98,7 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
|
||||
}
|
||||
case TR_pHit:
|
||||
{
|
||||
edict_t *e = INDEXENT2(*ptr);
|
||||
edict_t *e = TypeConversion.id_to_edict(*ptr);
|
||||
if (!e || FNullEnt(e))
|
||||
return 0; //TODO: return error
|
||||
tr->pHit = e;
|
||||
|
@ -341,14 +341,14 @@ void MoveToOrigin_post(edict_t *ent, const float *pflGoal, float dist, int iMove
|
||||
edict_t *FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue)
|
||||
{
|
||||
FM_ENG_HANDLE(FM_FindEntityByString, (Engine[FM_FindEntityByString].at(i), (cell)ENTINDEX(pEdictStartSearchAfter), pszField, pszValue));
|
||||
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT2((int)mlCellResult));
|
||||
RETURN_META_VALUE(mswi(lastFmRes), TypeConversion.id_to_edict((int)mlCellResult));
|
||||
}
|
||||
|
||||
edict_t *FindEntityByString_post(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue)
|
||||
{
|
||||
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *));
|
||||
FM_ENG_HANDLE_POST(FM_FindEntityByString, (EnginePost[FM_FindEntityByString].at(i), (cell)ENTINDEX(pEdictStartSearchAfter), pszField, pszValue));
|
||||
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult));
|
||||
RETURN_META_VALUE(MRES_IGNORED, TypeConversion.id_to_edict((int)mlCellResult));
|
||||
}
|
||||
// pfnGetEntityIllum
|
||||
SIMPLE_INT_HOOK_EDICT(GetEntityIllum);
|
||||
|
@ -205,13 +205,13 @@
|
||||
edict_t* call (const char *s) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
} \
|
||||
edict_t* call##_post (const char *s) \
|
||||
{ \
|
||||
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
}
|
||||
#define SIMPLE_CHAR_HOOK_STRING(call) \
|
||||
char call (char *s) \
|
||||
@ -413,38 +413,38 @@
|
||||
edict_t* call () \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes),INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes),TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
} \
|
||||
edict_t* call##_post () \
|
||||
{ \
|
||||
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
|
||||
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED,TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
}
|
||||
#define SIMPLE_EDICT_HOOK_INT(call) \
|
||||
edict_t* call (int v) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)v)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes),INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes),TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
} \
|
||||
edict_t* call##_post (int v) \
|
||||
{ \
|
||||
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED,TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
}
|
||||
|
||||
#define SIMPLE_EDICT_HOOK_EDICT(call) \
|
||||
edict_t* call (edict_t *e) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)ENTINDEX(e))); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes),INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes),TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
} \
|
||||
edict_t* call##_post (edict_t *e) \
|
||||
{ \
|
||||
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX(e))); \
|
||||
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED,TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
}
|
||||
|
||||
#define SIMPLE_EDICT_HOOK_EDICT_CONSTVECT_FLOAT(call) \
|
||||
@ -452,14 +452,14 @@
|
||||
{ \
|
||||
PREPARE_VECTOR(vec); \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(ed), p_vec, fla)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
} \
|
||||
edict_t* call##_post (edict_t *ed, const float *vec, float fla) \
|
||||
{ \
|
||||
PREPARE_VECTOR(vec); \
|
||||
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(ed), p_vec, fla)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, TypeConversion.id_to_edict((int)mlCellResult)); \
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,26 +21,6 @@ static cell AMX_NATIVE_CALL copy_infokey_buffer(AMX *amx, cell *params)
|
||||
return MF_SetAmxString(amx, params[2], infobuffer, params[3]);
|
||||
}
|
||||
|
||||
int UTIL_stricmp(const char *s1, const char *s2)
|
||||
{
|
||||
unsigned char c1, c2;
|
||||
|
||||
for (;;) {
|
||||
c1 = *s1++;
|
||||
c2 = *s2++;
|
||||
|
||||
if (!c1 || !c2)
|
||||
break;
|
||||
|
||||
if (c1 == c2)
|
||||
continue;
|
||||
|
||||
if ((c1 = tolower(c1)) != (c2 = tolower(c2)))
|
||||
break;
|
||||
}
|
||||
return (int)c1 - (int)c2;
|
||||
}
|
||||
|
||||
// lookup_sequence(entid, "sequence name", &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
|
||||
static cell AMX_NATIVE_CALL lookup_sequence(AMX* amx, cell* params)
|
||||
{
|
||||
@ -48,7 +28,7 @@ static cell AMX_NATIVE_CALL lookup_sequence(AMX* amx, cell* params)
|
||||
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
edict_t* ent = INDEXENT(index);
|
||||
edict_t* ent = TypeConversion.id_to_edict(index);
|
||||
|
||||
studiohdr_t* pstudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(ent));
|
||||
|
||||
@ -67,7 +47,7 @@ static cell AMX_NATIVE_CALL lookup_sequence(AMX* amx, cell* params)
|
||||
|
||||
for (int i = 0; i < pstudiohdr->numseq; i++)
|
||||
{
|
||||
if (UTIL_stricmp( pseqdesc[i].label, label ) == 0)
|
||||
if (stricmp( pseqdesc[i].label, label ) == 0)
|
||||
{
|
||||
REAL* FrameRate = reinterpret_cast<REAL*>(MF_GetAmxAddr(amx, params[3]));
|
||||
cell* Loops = MF_GetAmxAddr(amx, params[4]);
|
||||
@ -95,7 +75,7 @@ static cell AMX_NATIVE_CALL set_controller(AMX* amx, cell* params)
|
||||
// SetController( void *pmodel, entvars_t *pev, int iController, float flValue )
|
||||
int entindex = params[1];
|
||||
CHECK_ENTITY(entindex);
|
||||
edict_t* entity = INDEXENT(entindex);
|
||||
edict_t* entity = TypeConversion.id_to_edict(entindex);
|
||||
|
||||
int iController = params[2];
|
||||
|
||||
@ -176,7 +156,7 @@ static cell AMX_NATIVE_CALL GetModelCollisionBox(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ENTITY(entityIndex);
|
||||
|
||||
edict_t *pEdict = INDEXENT2(entityIndex);
|
||||
edict_t *pEdict = TypeConversion.id_to_edict(entityIndex);
|
||||
|
||||
if (!FNullEnt(pEdict))
|
||||
{
|
||||
@ -212,7 +192,7 @@ static cell AMX_NATIVE_CALL GetModelBoundingBox(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ENTITY(entityIndex);
|
||||
|
||||
edict_t *pentModel = INDEXENT2(entityIndex);
|
||||
edict_t *pentModel = TypeConversion.id_to_edict(entityIndex);
|
||||
|
||||
if (!FNullEnt(pentModel))
|
||||
{
|
||||
@ -269,7 +249,7 @@ static cell AMX_NATIVE_CALL SetModelCollisionBox(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ENTITY(entityIndex);
|
||||
|
||||
edict_t *pentModel = INDEXENT2(entityIndex);
|
||||
edict_t *pentModel = TypeConversion.id_to_edict(entityIndex);
|
||||
|
||||
if (!FNullEnt(pentModel))
|
||||
{
|
||||
@ -296,7 +276,7 @@ static cell AMX_NATIVE_CALL SetModelBoundingBox(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ENTITY(entityIndex);
|
||||
|
||||
edict_t *pentModel = INDEXENT2(entityIndex);
|
||||
edict_t *pentModel = TypeConversion.id_to_edict(entityIndex);
|
||||
|
||||
if (!FNullEnt(pentModel))
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
CHECK_OFFSET(iOffset);
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[4];
|
||||
@ -58,16 +58,17 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
|
||||
iOffset += params[5];
|
||||
#endif
|
||||
int iValue=params[3];
|
||||
*((int *)INDEXENT2(index)->pvPrivateData + iOffset) = iValue;
|
||||
set_pdata<int>(TypeConversion.id_to_edict(index), iOffset, iValue);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
CHECK_OFFSET(iOffset);
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[3];
|
||||
@ -79,8 +80,9 @@ static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
return *((int *)INDEXENT2(index)->pvPrivateData + iOffset);
|
||||
return get_pdata<int>(TypeConversion.id_to_edict(index), iOffset);
|
||||
}
|
||||
|
||||
// Float
|
||||
static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
|
||||
{
|
||||
@ -101,7 +103,7 @@ static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
|
||||
#endif
|
||||
|
||||
float fValue=amx_ctof(params[3]);
|
||||
*((float *)INDEXENT2(index)->pvPrivateData + iOffset) = fValue;
|
||||
set_pdata<float>(TypeConversion.id_to_edict(index), iOffset, fValue);
|
||||
return 1;
|
||||
}
|
||||
static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
|
||||
@ -110,7 +112,7 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
CHECK_OFFSET(iOffset);
|
||||
CHECK_OFFSET(iOffset);
|
||||
|
||||
#if defined( __linux__ )
|
||||
iOffset += params[3];
|
||||
@ -122,7 +124,7 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
return amx_ftoc(*((float *)INDEXENT2(index)->pvPrivateData + iOffset));
|
||||
return amx_ftoc(get_pdata<float>(TypeConversion.id_to_edict(index), iOffset));
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
|
||||
@ -142,15 +144,14 @@ static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
|
||||
else
|
||||
iOffset += params[7];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
edict_t *pEdict = TypeConversion.id_to_edict(index);
|
||||
|
||||
char *szData;
|
||||
if (params[5])
|
||||
{
|
||||
szData = *((char **)pEdict->pvPrivateData + iOffset);
|
||||
szData = get_pdata<char*>(pEdict, iOffset);
|
||||
} else {
|
||||
szData = (char *)pEdict->pvPrivateData + iOffset;
|
||||
szData = get_pdata_direct<char*>(pEdict, iOffset);
|
||||
}
|
||||
|
||||
if (IsBadReadPtr(szData, 1))
|
||||
@ -181,19 +182,19 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
|
||||
iOffset += params[6];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
edict_t *pEdict = TypeConversion.id_to_edict(index);
|
||||
|
||||
char *szData;
|
||||
int len;
|
||||
char *data = MF_GetAmxString(amx, params[3], 0, &len);
|
||||
if (params[4] == -1)
|
||||
{
|
||||
szData = (char *)pEdict->pvPrivateData + iOffset;
|
||||
szData = get_pdata_direct<char*>(pEdict, iOffset);
|
||||
if (IsBadWritePtr(szData, 1))
|
||||
return 0;
|
||||
strcpy(szData, data);
|
||||
} else {
|
||||
szData = *((char **)pEdict->pvPrivateData + iOffset);
|
||||
szData = get_pdata<char*>(pEdict, iOffset);
|
||||
if (IsBadWritePtr(szData, 1))
|
||||
return 0;
|
||||
if (params[4] == 1)
|
||||
@ -205,7 +206,7 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
|
||||
szData = new char[len + 1];
|
||||
}
|
||||
strcpy(szData, data);
|
||||
*((char **)pEdict->pvPrivateData + iOffset) = szData;
|
||||
set_pdata<char*>(pEdict, iOffset, szData);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -229,7 +230,7 @@ static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = *(edict_t **)((char *)(INDEXENT2(index)->pvPrivateData) + iOffset);
|
||||
edict_t *pEdict = get_pdata<edict_t*>(TypeConversion.id_to_edict(index), iOffset);
|
||||
|
||||
if (pEdict == NULL)
|
||||
{
|
||||
@ -273,7 +274,7 @@ static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params)
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*(edict_t **)((char *)(INDEXENT2(index)->pvPrivateData) + offset) = INDEXENT2(entity);
|
||||
set_pdata<edict_t*>(TypeConversion.id_to_edict(index), offset, TypeConversion.id_to_edict(entity));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -296,7 +297,7 @@ static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params)
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
return *(bool *)((char *)INDEXENT2(index)->pvPrivateData + offset) ? TRUE : FALSE;
|
||||
return get_pdata<bool>(TypeConversion.id_to_edict(index), offset) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params)
|
||||
@ -319,7 +320,7 @@ static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params)
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*(bool *)((char *)INDEXENT2(index)->pvPrivateData + offset) = value;
|
||||
set_pdata<bool>(TypeConversion.id_to_edict(index), offset, value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -341,8 +342,8 @@ static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params)
|
||||
else
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
return static_cast<cell>(*((byte *)INDEXENT2(index)->pvPrivateData + offset));
|
||||
|
||||
return static_cast<cell>(get_pdata<byte>(TypeConversion.id_to_edict(index), offset));
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params)
|
||||
@ -365,7 +366,7 @@ static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params)
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*((byte *)INDEXENT2(index)->pvPrivateData + offset) = value;
|
||||
set_pdata<byte>(TypeConversion.id_to_edict(index), offset, value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -388,7 +389,7 @@ static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params)
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
return static_cast<cell>(*(short *)((char *)INDEXENT2(index)->pvPrivateData + offset));
|
||||
return static_cast<cell>(get_pdata<short>(TypeConversion.id_to_edict(index), offset));
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params)
|
||||
@ -411,7 +412,7 @@ static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params)
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
*(short *)((char *)INDEXENT2(index)->pvPrivateData + offset) = value;
|
||||
set_pdata<short>(TypeConversion.id_to_edict(index), offset, value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -436,7 +437,7 @@ static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params)
|
||||
|
||||
cell *cpvec = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
Vector vec = *(Vector *)((char *)INDEXENT2(index)->pvPrivateData + offset);
|
||||
Vector vec = get_pdata<Vector>(TypeConversion.id_to_edict(index), offset);
|
||||
|
||||
cpvec[0] = amx_ftoc(vec.x);
|
||||
cpvec[1] = amx_ftoc(vec.y);
|
||||
@ -467,7 +468,7 @@ static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params)
|
||||
|
||||
Vector vec(amx_ctof(pcvec[0]), amx_ctof(pcvec[1]), amx_ctof(pcvec[2]));
|
||||
|
||||
*(Vector *)((char *)INDEXENT2(index)->pvPrivateData + offset) = vec;
|
||||
set_pdata<Vector>(TypeConversion.id_to_edict(index), offset, vec);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -490,7 +491,7 @@ static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params)
|
||||
offset += params[4];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = *(edict_t **)((char * )(INDEXENT2(index)->pvPrivateData) + offset);
|
||||
edict_t *pEdict = get_pdata<edict_t*>(TypeConversion.id_to_edict(index), offset);
|
||||
|
||||
if (pEdict == NULL)
|
||||
{
|
||||
@ -510,7 +511,7 @@ static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int serialnumber = *(int *)((char *)INDEXENT2(index)->pvPrivateData + offset + 4);
|
||||
int serialnumber = get_pdata<int>(TypeConversion.id_to_edict(index), offset + 4);
|
||||
|
||||
if (pEdict->serialnumber != serialnumber)
|
||||
{
|
||||
@ -541,13 +542,13 @@ static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params)
|
||||
offset += params[5];
|
||||
#endif
|
||||
|
||||
edict_t *pEntity = INDEXENT2(entity);
|
||||
edict_t *pEntity = TypeConversion.id_to_edict(entity);
|
||||
|
||||
*(edict_t **)((char* )(INDEXENT2(index)->pvPrivateData) + offset) = pEntity;
|
||||
set_pdata<edict_t*>(TypeConversion.id_to_edict(index), offset, pEntity);
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
*(int *)((char *)INDEXENT2(index)->pvPrivateData + offset + 4) = pEntity->serialnumber;
|
||||
set_pdata<int>(TypeConversion.id_to_edict(index), offset + 4, pEntity->serialnumber);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -162,7 +162,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_ENTITY(index);
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
edict_t *pEdict = TypeConversion.id_to_edict(index);
|
||||
int iSwitch = params[2];
|
||||
|
||||
//onto normal cases - sanity check
|
||||
@ -347,7 +347,7 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
|
||||
// index, pevdata
|
||||
int index = params[1];
|
||||
CHECK_ENTITY(index);
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
edict_t *pEdict = TypeConversion.id_to_edict(index);
|
||||
int iSwitch = params[2];
|
||||
|
||||
//onto normal cases - sanity check
|
||||
@ -382,7 +382,7 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
|
||||
*(string_t *)EDICT_OFFS(v, offs) = value;
|
||||
} else if ( (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
|
||||
|| (iSwitch > pev_edict2_start && iSwitch < pev_absolute_end) ) {
|
||||
edict_t *e = INDEXENT2((int)*blah);
|
||||
edict_t *e = TypeConversion.id_to_edict((int)*blah);
|
||||
*(edict_t **)EDICT_OFFS(v, offs) = e;
|
||||
} else if (iSwitch > pev_vecarray_start && iSwitch < pev_vecarray_end) {
|
||||
vec3_t vec;
|
||||
@ -416,7 +416,7 @@ static cell AMX_NATIVE_CALL amx_set_pev_string(AMX *amx, cell *params)
|
||||
// index, pevdata
|
||||
int index = params[1];
|
||||
CHECK_ENTITY(index);
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
edict_t *pEdict = TypeConversion.id_to_edict(index);
|
||||
int iSwitch = params[2];
|
||||
|
||||
//onto normal cases - sanity check
|
||||
@ -455,7 +455,7 @@ static cell AMX_NATIVE_CALL amx_pev_valid(AMX *amx, cell *params)
|
||||
{
|
||||
int idx = static_cast<int>(params[1]);
|
||||
|
||||
edict_t *e = INDEXENT2(idx);
|
||||
edict_t *e = TypeConversion.id_to_edict(idx);
|
||||
|
||||
if (FNullEnt(e))
|
||||
return 0;
|
||||
@ -470,7 +470,7 @@ static cell AMX_NATIVE_CALL amx_pev_serial(AMX* amx, cell* params)
|
||||
int id = static_cast<int>(params[1]);
|
||||
|
||||
CHECK_ENTITY(id);
|
||||
edict_t* ent = INDEXENT(id);
|
||||
edict_t* ent = TypeConversion.id_to_edict(id);
|
||||
|
||||
return ent->serialnumber;
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ template <typename T>inline void set_pdata(edict_t *pEntity, int offset, T value
|
||||
}
|
||||
|
||||
|
||||
extern globalvars_t *gpGlobals;
|
||||
|
||||
class HLTypeConversion
|
||||
{
|
||||
public:
|
||||
@ -102,7 +104,24 @@ class HLTypeConversion
|
||||
|
||||
edict_t* id_to_edict(int index)
|
||||
{
|
||||
return static_cast<edict_t*>(m_FirstEdict + index);
|
||||
if (index < 0 || index >= gpGlobals->maxEntities)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!index)
|
||||
{
|
||||
return m_FirstEdict;
|
||||
}
|
||||
|
||||
auto pEdict = static_cast<edict_t*>(m_FirstEdict + index);
|
||||
|
||||
if (pEdict && (pEdict->free || (index > gpGlobals->maxClients && !pEdict->pvPrivateData)))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pEdict;
|
||||
}
|
||||
|
||||
entvars_t* id_to_entvars(int index)
|
||||
|
Loading…
Reference in New Issue
Block a user