Added set_pev

Added punchangle to pev/set_pev
Added INDEXENT fix (fixed all occurances of INDEXENT as well)
Added pev_natives on amxx_attach
This commit is contained in:
Steve Dudenhoeffer 2004-08-05 20:57:03 +00:00
parent 5dd3fe742c
commit 7f41ac3410
6 changed files with 571 additions and 67 deletions

View File

@ -28,14 +28,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(INDEXENT(index));
return gpGamedllFuncs->dllapi_table->pfnSpawn(INDEXENT2(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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnThink(INDEXENT2(index));
return 1;
// pfnUse
@ -43,10 +43,10 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
cRet = MF_GetAmxAddr(amx,params[2]);
cRet = MF_GetAmxAddr(amx,params[3]);
indexb=cRet[0];
CHECK_ENTITY(indexb);
gpGamedllFuncs->dllapi_table->pfnUse(INDEXENT(index),INDEXENT(indexb));
gpGamedllFuncs->dllapi_table->pfnUse(INDEXENT2(index),INDEXENT2(indexb));
return 1;
// pfnTouch
@ -57,7 +57,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(INDEXENT(index),INDEXENT(indexb));
gpGamedllFuncs->dllapi_table->pfnTouch(INDEXENT2(index),INDEXENT2(indexb));
return 1;
case DLLFunc_Blocked: // void ) ( edict_t *pentBlocked, edict_t *pentOther );
@ -67,7 +67,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->pfnBlocked(INDEXENT(index),INDEXENT(indexb));
gpGamedllFuncs->dllapi_table->pfnBlocked(INDEXENT2(index),INDEXENT2(indexb));
return 1;
@ -75,7 +75,7 @@ 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->pfnSetAbsBox(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnSetAbsBox(INDEXENT2(index));
return 1;
case DLLFunc_ClientConnect: // bool) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
@ -86,7 +86,7 @@ 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(INDEXENT(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),temp3);
iparam1 = MDLL_ClientConnect(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),temp3);
cRet = MF_GetAmxAddr(amx,params[6]);
MF_SetAmxString(amx,params[5],temp3,cRet[0]);
return 1;
@ -95,21 +95,21 @@ 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->pfnClientDisconnect(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnClientDisconnect(INDEXENT2(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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnClientKill(INDEXENT2(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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnClientPutInServer(INDEXENT2(index));
return 1;
case DLLFunc_ServerDeactivate: // void) ( void );
@ -120,14 +120,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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnPlayerPreThink(INDEXENT2(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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnPlayerPostThink(INDEXENT2(index));
return 1;
case DLLFunc_StartFrame: // void ) ( void );
@ -153,19 +153,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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnSpectatorConnect(INDEXENT2(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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnSpectatorDisconnect(INDEXENT2(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(INDEXENT(index));
gpGamedllFuncs->dllapi_table->pfnSpectatorThink(INDEXENT2(index));
return 1;
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
@ -209,7 +209,7 @@ 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(INDEXENT(index)));
iparam1 = gpMetaUtilFuncs->pfnCallGameEntity(PLID,STRING(ALLOC_STRING(temp)),VARS(INDEXENT2(index)));
return iparam1;
default:
MF_Log("Unknown dllfunc entry.");

View File

@ -53,7 +53,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)(INDEXENT(index),(char*)STRING(ALLOC_STRING(temp)));
(*g_engfuncs.pfnSetModel)(INDEXENT2(index),(char*)STRING(ALLOC_STRING(temp)));
return 1;
@ -83,7 +83,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)(INDEXENT(index),Vec1,Vec2);
(*g_engfuncs.pfnSetSize)(INDEXENT2(index),Vec1,Vec2);
return 1;
@ -135,7 +135,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)(INDEXENT(index),Vec1,fparam1,iparam1);
(*g_engfuncs.pfnMoveToOrigin)(INDEXENT2(index),Vec1,fparam1,iparam1);
return 1;
@ -144,7 +144,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)(INDEXENT(index));
(*g_engfuncs.pfnChangeYaw)(INDEXENT2(index));
return 1;
@ -153,7 +153,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)(INDEXENT(index));
(*g_engfuncs.pfnChangePitch)(INDEXENT2(index));
return 1;
@ -163,7 +163,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 : INDEXENT(index),temp,temp2);
pRet = (*g_engfuncs.pfnFindEntityByString)(index == -1 ? NULL : INDEXENT2(index),temp,temp2);
if (pRet)
return ENTINDEX(pRet);
return -1;
@ -174,7 +174,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)(INDEXENT(index));
return (*g_engfuncs.pfnGetEntityIllum)(INDEXENT2(index));
// pfnFindEntityInSphere
@ -187,7 +187,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 : INDEXENT(index),Vec1,fparam1);
pRet = (*g_engfuncs.pfnFindEntityInSphere)(index == -1 ? NULL : INDEXENT2(index),Vec1,fparam1);
if (pRet)
return ENTINDEX(pRet);
return -1;
@ -198,7 +198,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)(INDEXENT(index));
pRet=(*g_engfuncs.pfnFindClientInPVS)(INDEXENT2(index));
return ENTINDEX(pRet);
@ -207,7 +207,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)(INDEXENT(index));
pRet=(*g_engfuncs.pfnEntitiesInPVS)(INDEXENT2(index));
return ENTINDEX(pRet);
@ -258,7 +258,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
CHECK_ENTITY(index);
if (index == 0)
return 0;
(*g_engfuncs.pfnRemoveEntity)(INDEXENT(index));
(*g_engfuncs.pfnRemoveEntity)(INDEXENT2(index));
return 1;
@ -277,7 +277,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)(INDEXENT(index));
(*g_engfuncs.pfnMakeStatic)(INDEXENT2(index));
return 1;
@ -286,7 +286,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)(INDEXENT(index));
return (*g_engfuncs.pfnEntIsOnFloor)(INDEXENT2(index));
// pfnDropToFloor
@ -294,7 +294,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)(INDEXENT(index));
return (*g_engfuncs.pfnDropToFloor)(INDEXENT2(index));
// pfnWalkMove
@ -308,7 +308,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)(INDEXENT(index),fparam1,fparam2,iparam1);
return (*g_engfuncs.pfnWalkMove)(INDEXENT2(index),fparam1,fparam2,iparam1);
// pfnSetOrigin
@ -320,7 +320,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)(INDEXENT(index),Vec1);
(*g_engfuncs.pfnSetOrigin)(INDEXENT2(index),Vec1);
return 1;
@ -340,7 +340,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)(INDEXENT(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3);
(*g_engfuncs.pfnEmitSound)(INDEXENT2(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3);
return 1;
@ -362,7 +362,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)(INDEXENT(index),Vec1,temp,fparam1,fparam2,iparam1,iparam2);
(*g_engfuncs.pfnEmitAmbientSound)(INDEXENT2(index),Vec1,temp,fparam1,fparam2,iparam1,iparam2);
return 1;
// pfnTraceLine
@ -379,7 +379,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
iparam1=cRet[0];
cRet = MF_GetAmxAddr(amx,params[5]);
index=cRet[0];
(*g_engfuncs.pfnTraceLine)(Vec1,Vec2,iparam1,index != -1 ? INDEXENT(index) : NULL, &g_tr);
(*g_engfuncs.pfnTraceLine)(Vec1,Vec2,iparam1,index != -1 ? INDEXENT2(index) : NULL, &g_tr);
return 1;
@ -390,7 +390,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
cRet = MF_GetAmxAddr(amx,params[3]);
iparam1 = cRet[0];
CHECK_ENTITY(index);
(*g_engfuncs.pfnTraceToss)(INDEXENT(index),iparam1 == -1 ? NULL : INDEXENT(iparam1),&g_tr);
(*g_engfuncs.pfnTraceToss)(INDEXENT2(index),iparam1 == -1 ? NULL : INDEXENT2(iparam1),&g_tr);
return 1;
@ -411,7 +411,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
iparam1=cRet[0];
cRet = MF_GetAmxAddr(amx,params[6]);
iparam2=cRet[0];
(*g_engfuncs.pfnTraceMonsterHull)(INDEXENT(index),Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : INDEXENT(iparam2),&g_tr);
(*g_engfuncs.pfnTraceMonsterHull)(INDEXENT2(index),Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : INDEXENT2(iparam2),&g_tr);
return 1;
@ -431,7 +431,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
iparam2 = cRet[0];
cRet = MF_GetAmxAddr(amx,params[6]);
iparam3 = cRet[0];
(*g_engfuncs.pfnTraceHull)(Vec1,Vec2,iparam1,iparam2,iparam3 == 0 ? 0 : INDEXENT(iparam3),&g_tr);
(*g_engfuncs.pfnTraceHull)(Vec1,Vec2,iparam1,iparam2,iparam3 == 0 ? 0 : INDEXENT2(iparam3),&g_tr);
return 1;
@ -449,7 +449,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
iparam1 = cRet[0];
cRet = MF_GetAmxAddr(amx,params[5]);
iparam2 = cRet[0];
(*g_engfuncs.pfnTraceModel)(Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : INDEXENT(iparam2),&g_tr);
(*g_engfuncs.pfnTraceModel)(Vec1,Vec2,iparam1,iparam2 == 0 ? NULL : INDEXENT2(iparam2),&g_tr);
return 1;
@ -466,7 +466,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)(INDEXENT(index),Vec1,Vec2);
temp = (char*)(*g_engfuncs.pfnTraceTexture)(INDEXENT2(index),Vec1,Vec2);
cRet = MF_GetAmxAddr(amx,params[6]);
MF_SetAmxString(amx, params[5], temp, cRet[0]);
return 1;
@ -488,7 +488,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 : INDEXENT(index),&g_tr);
(*g_engfuncs.pfnTraceSphere)(Vec1,Vec2,iparam1,fparam1,index == 0 ? NULL : INDEXENT2(index),&g_tr);
return 1;
@ -499,7 +499,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)(INDEXENT(index),fparam1,Vec1);
(*g_engfuncs.pfnGetAimVector)(INDEXENT2(index),fparam1,Vec1);
cRet = MF_GetAmxAddr(amx,params[4]);
cRet[0] = amx_ftoc(Vec1[0]);
cRet[1] = amx_ftoc(Vec1[1]);
@ -554,7 +554,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)(INDEXENT(index));
(*g_engfuncs.pfnFreeEntPrivateData)(INDEXENT2(index));
// pfnSzFromIndex
@ -588,7 +588,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)(INDEXENT(index),fparam1);
(*g_engfuncs.pfnAnimationAutomove)(INDEXENT2(index),fparam1);
return 1;
@ -599,7 +599,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)(INDEXENT(index),iparam1,Vec1,Vec2);
(*g_engfuncs.pfnGetBonePosition)(INDEXENT2(index),iparam1,Vec1,Vec2);
cRet = MF_GetAmxAddr(amx,params[4]);
cRet[0]=amx_ftoc(Vec1[0]);
cRet[1]=amx_ftoc(Vec1[1]);
@ -618,7 +618,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)(INDEXENT(index),iparam1,Vec1,Vec2);
(*g_engfuncs.pfnGetAttachment)(INDEXENT2(index),iparam1,Vec1,Vec2);
cRet = MF_GetAmxAddr(amx,params[4]);
cRet[0]=amx_ftoc(Vec1[0]);
cRet[1]=amx_ftoc(Vec1[1]);
@ -638,7 +638,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
iparam2 = cRet[0];
CHECK_ENTITY(iparam1);
CHECK_ENTITY(iparam2);
(*g_engfuncs.pfnSetView)(INDEXENT(iparam1),INDEXENT(iparam2));
(*g_engfuncs.pfnSetView)(INDEXENT2(iparam1),INDEXENT2(iparam2));
return 1;
@ -657,7 +657,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)(INDEXENT(index),fparam1,fparam2);
(*g_engfuncs.pfnCrosshairAngle)(INDEXENT2(index),fparam1,fparam2);
return 1;
@ -674,7 +674,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)(INDEXENT(index),iparam1,iparam2,iparam3,iparam4);
(*g_engfuncs.pfnFadeClientVolume)(INDEXENT2(index),iparam1,iparam2,iparam3,iparam4);
return 1;
@ -685,7 +685,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)(INDEXENT(index),fparam1);
(*g_engfuncs.pfnSetClientMaxspeed)(INDEXENT2(index),fparam1);
return 1;
@ -719,7 +719,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)(INDEXENT(index),Vec1,fparam1,fparam2,fparam3,iparam1,iparam2,iparam3);
(*g_engfuncs.pfnRunPlayerMove)(INDEXENT2(index),Vec1,fparam1,fparam2,fparam3,iparam1,iparam2,iparam3);
return 1;
@ -779,7 +779,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)(INDEXENT(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3,iparam4,iparam5,Vec1,iparam6 == 0 ? NULL : INDEXENT(iparam6));
(*g_engfuncs.pfnBuildSoundMsg)(INDEXENT2(index),iparam1,temp,fparam1,fparam2,iparam2,iparam3,iparam4,iparam5,Vec1,iparam6 == 0 ? NULL : INDEXENT2(iparam6));
return 1;
@ -789,7 +789,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)(INDEXENT(index),(const char *)temp);
temp2 = (char*)(*g_engfuncs.pfnGetPhysicsKeyValue)(INDEXENT2(index),(const char *)temp);
cRet = MF_GetAmxAddr(amx,params[5]);
MF_SetAmxString(amx,params[4],temp2,cRet[0]);
return 1;
@ -802,7 +802,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)(INDEXENT(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)));
(*g_engfuncs.pfnSetPhysicsKeyValue)(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)));
return 1;
@ -811,7 +811,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)(INDEXENT(index));
temp = (char*)(*g_engfuncs.pfnGetPhysicsInfoString)(INDEXENT2(index));
cRet = MF_GetAmxAddr(amx,params[4]);
MF_SetAmxString(amx,params[3],temp,cRet[0]);
@ -857,7 +857,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,INDEXENT(index),iparam2,fparam1,Vec1,Vec2,fparam2,fparam3,iparam3,iparam4,iparam5,iparam6);
(*g_engfuncs.pfnPlaybackEvent)(iparam1,INDEXENT2(index),iparam2,fparam1,Vec1,Vec2,fparam2,fparam3,iparam3,iparam4,iparam5,iparam6);
return 1;
// pfnGetCurrentPlayer
@ -870,7 +870,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)(INDEXENT(index));
return (*g_engfuncs.pfnCanSkipPlayer)(INDEXENT2(index));
// pfnSetGroupMask
@ -915,7 +915,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 : INDEXENT(index));
(*g_engfuncs.pfnMessageBegin)(iparam1,iparam2,Vec1,index == 0 ? NULL : INDEXENT2(index));
return 1;
@ -942,7 +942,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
iparam1 = cRet[0];
CHECK_ENTITY(index);
temp2 = MF_GetAmxString(amx,params[3],0,&len);
temp = (*g_engfuncs.pfnInfoKeyValue)((*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT(index)),temp2);
temp = (*g_engfuncs.pfnInfoKeyValue)((*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp2);
MF_SetAmxString(amx,params[4],temp,iparam1);
return 1;
@ -952,7 +952,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.pfnSetKeyValue)((*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT(index)),temp,temp2);
(*g_engfuncs.pfnSetKeyValue)((*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp,temp2);
return 1;
case EngFunc_SetClientKeyValue: // void ) (int clientIndex, char *infobuffer, char *key, char *value);
cRet = MF_GetAmxAddr(amx,params[2]);
@ -960,7 +960,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.pfnSetClientKeyValue)(index,(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT(index)),temp,temp2);
(*g_engfuncs.pfnSetClientKeyValue)(index,(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp,temp2);
return 1;
default:

View File

@ -1,7 +1,18 @@
#include "fakemeta_amxx.h"
edict_t *g_player_edicts[33]; // Used for INDEXENT() forward.
void OnAmxxAttach()
{
MF_AddNatives(engfunc_natives);
MF_AddNatives(dllfunc_natives);
}
MF_AddNatives(pev_natives);
}
// 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;
RETURN_META(MRES_IGNORED);
}

View File

@ -8,7 +8,17 @@
#include "pev.h"
#include "forward.h"
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
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 AMX_NATIVE_INFO engfunc_natives[];
extern AMX_NATIVE_INFO dllfunc_natives[];

View File

@ -1,5 +1,6 @@
#include "fakemeta_amxx.h"
CVector<int> Engine[ENGFUNC_NUM+10];
CVector<int> EnginePost[ENGFUNC_NUM+10];
cell mCellResult;
@ -11,6 +12,8 @@ const char *mlStringResult;
int retType = 0;
int lastFmRes = FMRES_IGNORED;
#define ENGHOOK(pfnCall) \
if (engtable->pfn##pfnCall == NULL) \
engtable->pfn##pfnCall = pfnCall
@ -89,6 +92,8 @@ static cell AMX_NATIVE_CALL fm_return(AMX *amx, cell *params)
return 1;
}
int PrecacheModel(char *s)
{
FM_ENG_HANDLE(FM_PrecacheModel, (Engine[FM_PrecacheModel].at(i), s));
@ -176,7 +181,7 @@ void ChangePitch(edict_t *ent)
edict_t *FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue)
{
FM_ENG_HANDLE(FM_FindEntityByString, (Engine[FM_FindEntityByString].at(i), ENTINDEX(pEdictStartSearchAfter), pszField, pszValue));
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT((int)mlCellResult));
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT2((int)mlCellResult));
}
int GetEntityIllum(edict_t *pent)

View File

@ -18,7 +18,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
return 0;
}
}
edict_t *pPlayer = INDEXENT(index);
edict_t *pPlayer = INDEXENT2(index);
int returntype = *params/sizeof(cell);
int valuetype=0;
int iReturn=0;
@ -430,6 +430,9 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
case vuser4:
vReturn = pPlayer->v.vuser4;
break;
case punchangle:
vReturn = pPlayer->v.punchangle;
break;
default:
return 0;
}
@ -608,4 +611,479 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
}
return 0;
}
}
static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
{
// index, pevdata
int index = params[1];
CHECK_ENTITY(index);
edict_t *pPlayer = INDEXENT2(index);
int iSwitch = params[2];
cell *blah = MF_GetAmxAddr(amx,params[3]);
if (iSwitch > pev_int_start && iSwitch < pev_int_end)
{
// Grrr...
int iValue = blah[0];
switch(iSwitch)
{
case fixangle:
pPlayer->v.fixangle = iValue;
return 1;
case modelindex:
pPlayer->v.modelindex = iValue;
return 1;
case viewmodel:
pPlayer->v.viewmodel = iValue;
return 1;
case weaponmodel:
pPlayer->v.weaponmodel = iValue;
return 1;
case movetype:
pPlayer->v.movetype = iValue;
return 1;
case solid:
pPlayer->v.solid = iValue;
return 1;
case skin:
pPlayer->v.skin = iValue;
return 1;
case body:
pPlayer->v.body = iValue;
return 1;
case effects:
pPlayer->v.effects = iValue;
return 1;
case light_level:
pPlayer->v.light_level = iValue;
return 1;
case sequence:
pPlayer->v.sequence = iValue;
return 1;
case gaitsequence:
pPlayer->v.gaitsequence = iValue;
return 1;
case rendermode:
pPlayer->v.rendermode = iValue;
return 1;
case renderfx:
pPlayer->v.renderfx = iValue;
return 1;
case weapons:
pPlayer->v.weapons = iValue;
return 1;
case deadflag:
pPlayer->v.deadflag = iValue;
return 1;
case button:
pPlayer->v.button = iValue;
return 1;
case impulse:
pPlayer->v.impulse = iValue;
return 1;
case spawnflags:
pPlayer->v.spawnflags = iValue;
return 1;
case flags:
pPlayer->v.flags = iValue;
return 1;
case colormap:
pPlayer->v.colormap = iValue;
return 1;
case team:
pPlayer->v.team = iValue;
return 1;
case waterlevel:
pPlayer->v.waterlevel = iValue;
return 1;
case watertype:
pPlayer->v.watertype = iValue;
return 1;
case playerclass:
pPlayer->v.playerclass = iValue;
return 1;
case weaponanim:
pPlayer->v.weaponanim = iValue;
return 1;
case pushmsec:
pPlayer->v.pushmsec = iValue;
return 1;
case bInDuck:
pPlayer->v.bInDuck = iValue;
return 1;
case flTimeStepSound:
pPlayer->v.flTimeStepSound = iValue;
return 1;
case flSwimTime:
pPlayer->v.flSwimTime = iValue;
return 1;
case flDuckTime:
pPlayer->v.flDuckTime = iValue;
return 1;
case iStepLeft:
pPlayer->v.iStepLeft = iValue;
return 1;
case gamestate:
pPlayer->v.gamestate = iValue;
return 1;
case oldbuttons:
pPlayer->v.oldbuttons = iValue;
return 1;
case groupinfo:
pPlayer->v.groupinfo = iValue;
return 1;
case iuser1:
pPlayer->v.iuser1 = iValue;
return 1;
case iuser2:
pPlayer->v.iuser2 = iValue;
return 1;
case iuser3:
pPlayer->v.iuser3 = iValue;
return 1;
case iuser4:
pPlayer->v.iuser4 = iValue;
return 1;
default:
return 0;
}
}
else if (iSwitch > pev_float_start && iSwitch < pev_float_end)
{
float fValue = amx_ctof(blah[0]);
switch(iSwitch)
{
case impacttime:
pPlayer->v.impacttime = fValue;
return 1;
case starttime:
pPlayer->v.starttime = fValue;
return 1;
case idealpitch:
pPlayer->v.idealpitch = fValue;
return 1;
case pitch_speed:
pPlayer->v.pitch_speed = fValue;
return 1;
case yaw_speed:
pPlayer->v.yaw_speed = fValue;
return 1;
case ltime:
pPlayer->v.ltime = fValue;
return 1;
case nextthink:
pPlayer->v.nextthink = fValue;
return 1;
case gravity:
pPlayer->v.gravity = fValue;
return 1;
case friction:
pPlayer->v.friction = fValue;
return 1;
case frame:
pPlayer->v.frame = fValue;
return 1;
case animtime:
pPlayer->v.animtime = fValue;
return 1;
case framerate:
pPlayer->v.framerate = fValue;
return 1;
case scale:
pPlayer->v.scale = fValue;
return 1;
case renderamt:
pPlayer->v.renderamt = fValue;
return 1;
case health:
pPlayer->v.health = fValue;
return 1;
case frags:
pPlayer->v.frags = fValue;
return 1;
case takedamage:
pPlayer->v.takedamage = fValue;
return 1;
case max_health:
pPlayer->v.max_health = fValue;
return 1;
case teleport_time:
pPlayer->v.teleport_time = fValue;
return 1;
case armortype:
pPlayer->v.armortype = fValue;
return 1;
case armorvalue:
pPlayer->v.armorvalue = fValue;
return 1;
case dmg_take:
pPlayer->v.dmg_take = fValue;
return 1;
case dmg_save:
pPlayer->v.dmg_save = fValue;
return 1;
case dmg:
pPlayer->v.dmg = fValue;
return 1;
case dmgtime:
pPlayer->v.dmgtime = fValue;
return 1;
case speed:
pPlayer->v.speed = fValue;
return 1;
case air_finished:
pPlayer->v.air_finished = fValue;
return 1;
case pain_finished:
pPlayer->v.pain_finished = fValue;
return 1;
case radsuit_finished:
pPlayer->v.radsuit_finished = fValue;
return 1;
case maxspeed:
pPlayer->v.maxspeed = fValue;
return 1;
case fov:
pPlayer->v.fov = fValue;
return 1;
case flFallVelocity:
pPlayer->v.flFallVelocity = fValue;
return 1;
case fuser1:
pPlayer->v.fuser1 = fValue;
return 1;
case fuser2:
pPlayer->v.fuser2 = fValue;
return 1;
case fuser3:
pPlayer->v.fuser3 = fValue;
return 1;
case fuser4:
pPlayer->v.fuser4 = fValue;
return 1;
default:
return 0;
}
}
else if (iSwitch > pev_string_start && iSwitch < pev_string_end)
{
int iValue = blah[0];
switch (iSwitch)
{
case classname:
pPlayer->v.classname = iValue;
return 1;
case globalname:
pPlayer->v.globalname = iValue;
return 1;
case model:
pPlayer->v.model = iValue;
return 1;
case target:
pPlayer->v.target = iValue;
return 1;
case targetname:
pPlayer->v.targetname = iValue;
return 1;
case netname:
pPlayer->v.netname = iValue;
return 1;
case message:
pPlayer->v.message = iValue;
return 1;
case noise:
pPlayer->v.noise = iValue;
return 1;
case noise1:
pPlayer->v.noise1 = iValue;
return 1;
case noise2:
pPlayer->v.noise2 = iValue;
return 1;
case noise3:
pPlayer->v.noise3 = iValue;
return 1;
default:
return 0;
}
}
else if (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
{
switch (iSwitch)
{
case chain:
pPlayer->v.chain = INDEXENT2(params[3]);
return 1;
case dmg_inflictor:
pPlayer->v.dmg_inflictor = INDEXENT2(params[3]);
return 1;
case enemy:
pPlayer->v.enemy = INDEXENT2(params[3]);
return 1;
case aiment:
pPlayer->v.aiment = INDEXENT2(params[3]);
return 1;
case owner:
pPlayer->v.owner = INDEXENT2(params[3]);
return 1;
case groundentity:
pPlayer->v.groundentity = INDEXENT2(params[3]);
return 1;
case euser1:
pPlayer->v.euser1 = INDEXENT2(params[3]);
return 1;
case euser2:
pPlayer->v.euser2 = INDEXENT2(params[3]);
return 1;
case euser3:
pPlayer->v.euser3 = INDEXENT2(params[3]);
return 1;
case euser4:
pPlayer->v.euser4 = INDEXENT2(params[3]);
return 1;
default:
return 0;
}
}
else if (iSwitch > pev_vecarray_start && iSwitch < pev_vecarray_end)
{
cell *vCell = MF_GetAmxAddr(amx,params[3]);
Vector vValue;
vValue.x = amx_ctof(vCell[0]);
vValue.y = amx_ctof(vCell[1]);
vValue.z = amx_ctof(vCell[2]);
switch(iSwitch)
{
case origin:
pPlayer->v.origin = vValue;
return 1;
case oldorigin:
pPlayer->v.oldorigin = vValue;
return 1;
case velocity:
pPlayer->v.velocity = vValue;
return 1;
case basevelocity:
pPlayer->v.basevelocity = vValue;
return 1;
case clbasevelocity:
pPlayer->v.clbasevelocity = vValue;
return 1;
case movedir:
pPlayer->v.movedir = vValue;
return 1;
case angles:
pPlayer->v.angles = vValue;
return 1;
case avelocity:
pPlayer->v.avelocity = vValue;
return 1;
case v_angle:
pPlayer->v.v_angle = vValue;
return 1;
case endpos:
pPlayer->v.endpos = vValue;
return 1;
case startpos:
pPlayer->v.startpos = vValue;
return 1;
case absmin:
pPlayer->v.absmin = vValue;
return 1;
case absmax:
pPlayer->v.absmax = vValue;
return 1;
case mins:
pPlayer->v.mins = vValue;
return 1;
case maxs:
pPlayer->v.maxs = vValue;
return 1;
case size:
pPlayer->v.size = vValue;
return 1;
case rendercolor:
pPlayer->v.rendercolor = vValue;
return 1;
case view_ofs:
pPlayer->v.view_ofs = vValue;
return 1;
case vuser1:
pPlayer->v.vuser1 = vValue;
return 1;
case vuser2:
pPlayer->v.vuser2 = vValue;
return 1;
case vuser3:
pPlayer->v.vuser3 = vValue;
return 1;
case vuser4:
pPlayer->v.vuser4 = vValue;
return 1;
case punchangle:
pPlayer->v.punchangle = vValue;
return 1;
default:
return 0;
}
}
else if (iSwitch > pev_byte_start && iSwitch < pev_byte_end)
{
cell *blah = MF_GetAmxAddr(amx,params[3]);
int iValue = blah[0];
switch(iSwitch)
{
case controller_0:
pPlayer->v.controller[0]=iValue;
return 1;
case controller_1:
pPlayer->v.controller[1]=iValue;
return 1;
case controller_2:
pPlayer->v.controller[2]=iValue;
return 1;
case controller_3:
pPlayer->v.controller[3]=iValue;
return 1;
case blending_0:
pPlayer->v.blending[0]=iValue;
return 1;
case blending_1:
pPlayer->v.blending[1]=iValue;
return 1;
default:
return 0;
}
}
else if (iSwitch > pev_bytearray_start && iSwitch < pev_bytearray_end)
{
cell *vCell = MF_GetAmxAddr(amx,params[3]);
switch(iSwitch)
{
case controller:
pPlayer->v.controller[0]=vCell[0];
pPlayer->v.controller[1]=vCell[1];
pPlayer->v.controller[2]=vCell[2];
pPlayer->v.controller[3]=vCell[3];
return 1;
case blending:
pPlayer->v.controller[0]=vCell[0];
pPlayer->v.controller[1]=vCell[1];
return 1;
default:
return 0;
}
}
return 0;
}
AMX_NATIVE_INFO pev_natives[] = {
{ "pev", amx_pev },
{ "set_pev", amx_set_pev },
{NULL, NULL},
};