This commit is contained in:
Steve Dudenhoeffer 2004-08-11 05:06:27 +00:00
parent f90ab9d732
commit 74d278d1c6
8 changed files with 1037 additions and 198 deletions

View File

@ -8,8 +8,9 @@ void OnAmxxAttach()
MF_AddNatives(dllfunc_natives); MF_AddNatives(dllfunc_natives);
MF_AddNatives(pev_natives); MF_AddNatives(pev_natives);
MF_AddNatives(forward_natives); MF_AddNatives(forward_natives);
MF_AddNatives(pdata_natives);
} }
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) // 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) void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{ {
@ -106,6 +107,21 @@ void OnPluginsLoaded()
RESETE(InfoKeyValue); RESETE(InfoKeyValue);
RESETE(SetKeyValue); RESETE(SetKeyValue);
RESETE(SetClientKeyValue); RESETE(SetClientKeyValue);
RESETE(MessageBegin);
RESETE(MessageEnd);
RESETE(WriteByte);
RESETE(WriteChar);
RESETE(WriteShort);
RESETE(WriteLong);
RESETE(WriteAngle);
RESETE(WriteCoord);
RESETE(WriteString);
RESETE(WriteEntity);
RESETE(CVarGetFloat);
RESETE(CVarGetString);
RESETE(CVarSetFloat);
RESETE(CVarSetString);
RESETD(Spawn); RESETD(Spawn);
RESETD(Think); RESETD(Think);
@ -132,7 +148,6 @@ void OnPluginsLoaded()
RESETD(Sys_Error); RESETD(Sys_Error);
RESETD(PM_FindTextureType); RESETD(PM_FindTextureType);
RESETD(RegisterEncoders); RESETD(RegisterEncoders);
RESETD(GetHullBounds);
RESETD(CreateInstancedBaselines); RESETD(CreateInstancedBaselines);
RESETD(AllowLagCompensation); RESETD(AllowLagCompensation);

View File

@ -24,6 +24,7 @@ extern AMX_NATIVE_INFO engfunc_natives[];
extern AMX_NATIVE_INFO dllfunc_natives[]; extern AMX_NATIVE_INFO dllfunc_natives[];
extern AMX_NATIVE_INFO pev_natives[]; extern AMX_NATIVE_INFO pev_natives[];
extern AMX_NATIVE_INFO forward_natives[]; extern AMX_NATIVE_INFO forward_natives[];
extern AMX_NATIVE_INFO pdata_natives[];
extern TraceResult g_tr; extern TraceResult g_tr;
/* Wouldnt modifying the table AFTER it's memcpy'd be ... pointless? /* Wouldnt modifying the table AFTER it's memcpy'd be ... pointless?

View File

@ -69,7 +69,9 @@ static cell AMX_NATIVE_CALL fm_return(AMX *amx, cell *params)
return 1; return 1;
} }
/*
* Begining of Game DLL->Engine hooks
*/
// pfnPrecacheModel // pfnPrecacheModel
SIMPLE_INT_HOOK_STRING(PrecacheModel); SIMPLE_INT_HOOK_STRING(PrecacheModel);
@ -94,50 +96,14 @@ SIMPLE_INT_HOOK_CONSTSTRING(ModelIndex);
// pfnModelFrames // pfnModelFrames
SIMPLE_INT_HOOK_INT(ModelFrames); SIMPLE_INT_HOOK_INT(ModelFrames);
void SetSize(edict_t *e, const float *rgflMin, const float *rgflMax) // pfnSetSize
{ SIMPLE_VOID_HOOK_EDICT_CONSTVECT_CONSTVECT(SetSize);
cell vec1[3] = {amx_ftoc(rgflMin[0]), amx_ftoc(rgflMin[1]), amx_ftoc(rgflMin[2])};
cell vec2[3] = {amx_ftoc(rgflMax[0]), amx_ftoc(rgflMax[1]), amx_ftoc(rgflMax[2])};;
cell retvec1 = MF_PrepareCellArray(vec1, 3);
cell retvec2 = MF_PrepareCellArray(vec2, 3);
FM_ENG_HANDLE(FM_SetSize, (Engine[FM_SetSize].at(i), ENTINDEX(e), retvec1, retvec2));
RETURN_META(mswi(lastFmRes));
}
void SetSize_post(edict_t *e, const float *rgflMin, const float *rgflMax)
{
cell vec1[3] = {amx_ftoc(rgflMin[0]), amx_ftoc(rgflMin[1]), amx_ftoc(rgflMin[2])};
cell vec2[3] = {amx_ftoc(rgflMax[0]), amx_ftoc(rgflMax[1]), amx_ftoc(rgflMax[2])};;
cell retvec1 = MF_PrepareCellArray(vec1, 3);
cell retvec2 = MF_PrepareCellArray(vec2, 3);
FM_ENG_HANDLE(FM_SetSize, (Engine[FM_SetSize].at(i), ENTINDEX(e), retvec1, retvec2));
RETURN_META(MRES_IGNORED);
}
void ChangeLevel(char *s1, char *s2) // pfnChangeLevel
{ SIMPLE_VOID_HOOK_STRING_STRING(ChangeLevel);
FM_ENG_HANDLE(FM_ChangeLevel, (Engine[FM_ChangeLevel].at(i), s1, s2));
RETURN_META(mswi(lastFmRes));
}
void ChangeLevel_post(char *s1, char *s2)
{
FM_ENG_HANDLE(FM_ChangeLevel, (Engine[FM_ChangeLevel].at(i), s1, s2));
RETURN_META(MRES_IGNORED);
}
float VecToYaw(const float *rgflVector) // pfnVecToYaw
{ SIMPLE_FLOAT_HOOK_CONSTVECT(VecToYaw);
cell vec[3] = {amx_ftoc(rgflVector[0]), amx_ftoc(rgflVector[1]), amx_ftoc(rgflVector[2])};
cell retvec = MF_PrepareCellArray(vec, 3);
FM_ENG_HANDLE(FM_VecToYaw, (Engine[FM_VecToYaw].at(i), retvec));
RETURN_META_VALUE(mswi(lastFmRes), mlFloatResult);
}
float VecToYaw_post(const float *rgflVector)
{
cell vec[3] = {amx_ftoc(rgflVector[0]), amx_ftoc(rgflVector[1]), amx_ftoc(rgflVector[2])};
cell retvec = MF_PrepareCellArray(vec, 3);
FM_ENG_HANDLE(FM_VecToYaw, (Engine[FM_VecToYaw].at(i), retvec));
RETURN_META_VALUE(MRES_IGNORED, mlFloatResult);
}
void VecToAngles(const float *rgflVectorIn, float *rgflVectorOut) void VecToAngles(const float *rgflVectorIn, float *rgflVectorOut)
{ {
@ -186,6 +152,21 @@ edict_t *FindEntityByString_post(edict_t *pEdictStartSearchAfter, const char *ps
// pfnGetEntityIllum // pfnGetEntityIllum
SIMPLE_INT_HOOK_EDICT(GetEntityIllum); SIMPLE_INT_HOOK_EDICT(GetEntityIllum);
// pfnFindEntityInSphere
SIMPLE_EDICT_HOOK_EDICT_CONSTVECT_FLOAT(FindEntityInSphere);
// pfnFindClientInPVS
SIMPLE_EDICT_HOOK_EDICT(FindClientInPVS);
// pfnEntitiesInPVS
SIMPLE_EDICT_HOOK_EDICT(EntitiesInPVS);
// pfnMakeVectors
SIMPLE_VOID_HOOK_CONSTVECT(MakeVectors);
// pfnAngleVectors
SIMPLE_VOID_HOOK_CONSTVECT_VECT_VECT_VECT(AngleVectors);
// pfnChangeYaw // pfnChangeYaw
SIMPLE_VOID_HOOK_EDICT(ChangeYaw); SIMPLE_VOID_HOOK_EDICT(ChangeYaw);
@ -210,26 +191,149 @@ SIMPLE_INT_HOOK_EDICT(EntIsOnFloor);
// pfnDropToFloor // pfnDropToFloor
SIMPLE_INT_HOOK_EDICT(DropToFloor); SIMPLE_INT_HOOK_EDICT(DropToFloor);
// pfnSetOrigin
SIMPLE_VOID_HOOK_EDICT_CONSTVECT(SetOrigin);
// pfnEmitSound
SIMPLE_VOID_HOOK_EDICT_INT_CONSTSTRING_FLOAT_FLOAT_INT_INT(EmitSound);
// pfnEmitAmbientSound
SIMPLE_VOID_HOOK_EDICT_VECT_CONSTSTRING_FLOAT_FLOAT_INT_INT(EmitAmbientSound);
// pfnGetAimVector
SIMPLE_VOID_HOOK_EDICT_FLOAT_VECT(GetAimVector);
// pfnParticleEffect
SIMPLE_VOID_HOOK_CONSTVECT_CONSTVECT_FLOAT_FLOAT(ParticleEffect);
// pfnLightStyle
SIMPLE_VOID_HOOK_INT_STRING(LightStyle);
// pfnDecalIndex // pfnDecalIndex
SIMPLE_INT_HOOK_CONSTSTRING(DecalIndex); SIMPLE_INT_HOOK_CONSTSTRING(DecalIndex);
// pfnPointContents
SIMPLE_INT_HOOK_CONSTVECT(PointContents);
// pfnMessageBegin
SIMPLE_VOID_HOOK_INT_INT_CONSTVECT_EDICT(MessageBegin);
// pfnMessageEnd
SIMPLE_VOID_HOOK_VOID(MessageEnd);
// pfnWriteByte
SIMPLE_VOID_HOOK_INT(WriteByte);
// pfnWriteChar
SIMPLE_VOID_HOOK_INT(WriteChar);
// pfnWriteShort
SIMPLE_VOID_HOOK_INT(WriteShort);
// pfnWriteLong
SIMPLE_VOID_HOOK_INT(WriteLong);
// pfnWriteAngle
SIMPLE_VOID_HOOK_FLOAT(WriteAngle);
// pfnWriteCoord
SIMPLE_VOID_HOOK_FLOAT(WriteCoord);
// pfnWriteString
SIMPLE_VOID_HOOK_CONSTSTRING(WriteString);
// pfnWriteEntity
SIMPLE_VOID_HOOK_INT(WriteEntity);
SIMPLE_FLOAT_HOOK_CONSTSTRING(CVarGetFloat);
SIMPLE_CONSTSTRING_HOOK_CONSTSTRING(CVarGetString);
SIMPLE_VOID_HOOK_CONSTSTRING_FLOAT(CVarSetFloat);
SIMPLE_VOID_HOOK_CONSTSTRING_CONSTSTRING(CVarSetString);
// pfnFreeEntPrivateData // pfnFreeEntPrivateData
SIMPLE_VOID_HOOK_EDICT(FreeEntPrivateData); SIMPLE_VOID_HOOK_EDICT(FreeEntPrivateData);
// pfnSzFromIndex
SIMPLE_CONSTSTRING_HOOK_INT(SzFromIndex);
// pfnAllocString // pfnAllocString
SIMPLE_INT_HOOK_CONSTSTRING(AllocString); SIMPLE_INT_HOOK_CONSTSTRING(AllocString);
SIMPLE_INT_HOOK_CONSTSTRING_INT(RegUserMsg);
// pfnAnimationAutomove
SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT(AnimationAutomove);
// pfnSetView
SIMPLE_VOID_HOOK_CONSTEDICT_CONSTEDICT(SetView);
// pfnTime
SIMPLE_FLOAT_HOOK_VOID(Time);
// pfnCrosshairAngle
SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT_FLOAT(CrosshairAngle);
SIMPLE_VOID_HOOK_CONSTEDICT_INT_INT_INT_INT(FadeClientVolume);
// pfnSetClientMaxspeed
SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT(SetClientMaxspeed);
// pfnPrecacheGeneric // pfnPrecacheGeneric
SIMPLE_INT_HOOK_STRING(PrecacheGeneric); SIMPLE_INT_HOOK_STRING(PrecacheGeneric);
// pfnPrecacheEvent
SIMPLE_USHORT_HOOK_INT_CONSTSTRING(PrecacheEvent);
// pfnGetPhysicsKeyValue
SIMPLE_CONSTSTRING_HOOK_CONSTEDICT_CONSTSTRING(GetPhysicsKeyValue);
// pfnSetPhysicsKeyValue
SIMPLE_VOID_HOOK_CONSTEDICT_CONSTSTRING_CONSTSTRING(SetPhysicsKeyValue);
// pfnGetPhysicsInfoString
SIMPLE_CONSTSTRING_HOOK_CONSTEDICT(GetPhysicsInfoString);
// pfnPlaybackEvent
HOOK_PLAYBACK_EVENT(PlaybackEvent);
// pfnCreateFakeClient
SIMPLE_EDICT_HOOK_CONSTSTRING(CreateFakeClient);
// pfnNumberOfEntities // pfnNumberOfEntities
SIMPLE_INT_HOOK_VOID(NumberOfEntities); SIMPLE_INT_HOOK_VOID(NumberOfEntities);
// pfnGetCurrentPlayer // pfnGetCurrentPlayer
SIMPLE_INT_HOOK_VOID(GetCurrentPlayer); SIMPLE_INT_HOOK_VOID(GetCurrentPlayer);
// pfnCanSkipPlayer
SIMPLE_INT_HOOK_CONSTEDICT(CanSkipPlayer);
// pfnSetGroupMask
SIMPLE_VOID_HOOK_INT_INT(SetGroupMask);
// pfnVoice_GetClientListening
SIMPLE_BOOL_HOOK_INT_INT(Voice_GetClientListening);
// pfnVoice_SetClientListening
SIMPLE_BOOL_HOOK_INT_INT_BOOL(Voice_SetClientListening);
SIMPLE_STRING_HOOK_STRING_STRING(InfoKeyValue);
SIMPLE_VOID_HOOK_STRING_STRING_STRING(SetKeyValue);
SIMPLE_VOID_HOOK_INT_STRING_STRING_STRING(SetClientKeyValue);
SIMPLE_CONSTSTRING_HOOK_EDICT(GetPlayerAuthId);
SIMPLE_UINT_HOOK_EDICT(GetPlayerWONId);
SIMPLE_INT_HOOK_STRING(IsMapValid);
/* /*
* Beginning of Game DLL hooks * Beginning of Engine->Game DLL hooks
*/ */
// pfnSpawn // pfnSpawn
@ -250,6 +354,9 @@ SIMPLE_VOID_HOOK_EDICT_EDICT(Blocked);
// pfnSetAbsBox // pfnSetAbsBox
SIMPLE_VOID_HOOK_EDICT(SetAbsBox); SIMPLE_VOID_HOOK_EDICT(SetAbsBox);
// pfnClientConnect
SIMPLE_BOOL_HOOK_EDICT_CONSTSTRING_CONSTSTRING_STRING128(ClientConnect);
// pfnClientDisconnect // pfnClientDisconnect
SIMPLE_VOID_HOOK_EDICT(ClientDisconnect); SIMPLE_VOID_HOOK_EDICT(ClientDisconnect);
@ -328,7 +435,6 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
int len, fId=0; int len, fId=0;
const char *funcname = MF_GetAmxString(amx, params[2], 0, &len); const char *funcname = MF_GetAmxString(amx, params[2], 0, &len);
LOG_CONSOLE(PLID,"Registering: Function: %s Post: %i Type: %i",funcname,params[3],params[1]);
enginefuncs_t *engtable; enginefuncs_t *engtable;
DLL_FUNCTIONS *dlltable; DLL_FUNCTIONS *dlltable;
@ -404,18 +510,23 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
break; break;
case FM_FindEntityInSphere: case FM_FindEntityInSphere:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_FLOAT, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_FLOAT, FP_DONE);
ENGHOOK(FindEntityInSphere);
break; break;
case FM_FindClientInPVS: case FM_FindClientInPVS:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(FindClientInPVS);
break; break;
case FM_EntitiesInPVS: case FM_EntitiesInPVS:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(EntitiesInPVS);
break; break;
case FM_MakeVectors: case FM_MakeVectors:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE);
ENGHOOK(MakeVectors);
break; break;
case FM_AngleVectors: case FM_AngleVectors:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_DONE);
ENGHOOK(AngleVectors);
break; break;
case FM_CreateEntity: case FM_CreateEntity:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
@ -426,7 +537,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
ENGHOOK(RemoveEntity); ENGHOOK(RemoveEntity);
break; break;
case FM_CreateNamedEntity: case FM_CreateNamedEntity:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(CreateNamedEntity); ENGHOOK(CreateNamedEntity);
break; break;
case FM_MakeStatic: case FM_MakeStatic:
@ -443,45 +554,59 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
break; break;
case FM_WalkMove: case FM_WalkMove:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE);
// ENGHOOK(WalkMove);
break; break;
case FM_SetOrigin: case FM_SetOrigin:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_DONE);
ENGHOOK(SetOrigin);
break; break;
case FM_EmitSound: case FM_EmitSound:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
ENGHOOK(EmitSound);
break; break;
case FM_EmitAmbientSound: case FM_EmitAmbientSound:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_STRING, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_STRING, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
ENGHOOK(EmitAmbientSound);
break; break;
case FM_TraceLine: case FM_TraceLine:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
// ENGHOOK(TraceLine);
break; break;
case FM_TraceToss: case FM_TraceToss:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
// ENGHOOK(TraceToss);
break; break;
case FM_TraceMonsterHull: case FM_TraceMonsterHull:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
// ENGHOOK(TraceMonsterHull);
break; break;
case FM_TraceHull: case FM_TraceHull:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
// ENGHOOK(TraceHull);
break; break;
case FM_TraceModel: case FM_TraceModel:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
// ENGHOOK(TraceModel);
break; break;
case FM_TraceTexture: case FM_TraceTexture:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
// ENGHOOK(TraceTexture);
break; break;
case FM_TraceSphere: case FM_TraceSphere:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
// ENGHOOK(TraceSphere);
break; break;
case FM_GetAimVector: case FM_GetAimVector:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_ARRAY, FP_DONE);
ENGHOOK(GetAimVector);
break; break;
case FM_ParticleEffect: case FM_ParticleEffect:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_DONE);
ENGHOOK(ParticleEffect);
break; break;
case FM_LightStyle: case FM_LightStyle:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE);
ENGHOOK(LightStyle);
break; break;
case FM_DecalIndex: case FM_DecalIndex:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
@ -489,85 +614,191 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
break; break;
case FM_PointContents: case FM_PointContents:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE);
ENGHOOK(PointContents);
break; break;
case FM_MessageBegin:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
ENGHOOK(MessageBegin);
break;
case FM_MessageEnd:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
ENGHOOK(MessageEnd);
break;
case FM_WriteByte:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(WriteByte);
break;
case FM_WriteChar:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(WriteChar);
break;
case FM_WriteShort:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(WriteShort);
break;
case FM_WriteLong:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(WriteLong);
break;
case FM_WriteAngle:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_FLOAT, FP_DONE);
ENGHOOK(WriteAngle);
break;
case FM_WriteCoord:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_FLOAT, FP_DONE);
ENGHOOK(WriteCoord);
break;
case FM_WriteString:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(WriteString);
break;
case FM_WriteEntity:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(WriteEntity);
break;
case FM_CVarGetFloat:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(CVarGetFloat);
break;
case FM_CVarGetString:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(CVarGetString);
break;
case FM_CVarSetFloat:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_FLOAT, FP_DONE);
ENGHOOK(CVarSetFloat);
break;
case FM_CVarSetString:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_STRING, FP_DONE);
ENGHOOK(CVarSetString);
break;
case FM_FreeEntPrivateData: case FM_FreeEntPrivateData:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE);
ENGHOOK(FreeEntPrivateData); ENGHOOK(FreeEntPrivateData);
break; break;
case FM_SzFromIndex: case FM_SzFromIndex:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(SzFromIndex);
break; break;
case FM_AllocString: case FM_AllocString:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(AllocString); ENGHOOK(AllocString);
break; break;
case FM_RegUserMsg: case FM_RegUserMsg:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_CELL, FP_DONE);
ENGHOOK(RegUserMsg);
break; break;
case FM_AnimationAutomove: case FM_AnimationAutomove:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_DONE);
ENGHOOK(AnimationAutomove);
break; break;
case FM_GetBonePosition: case FM_GetBonePosition:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
// ENGHOOK(GetBonePosition);
break; break;
case FM_GetAttachment: case FM_GetAttachment:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
// ENGHOOK(GetAttachment);
break; break;
case FM_SetView: case FM_SetView:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
ENGHOOK(SetView);
break; break;
case FM_Time: case FM_Time:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
ENGHOOK(Time);
break; break;
case FM_CrosshairAngle: case FM_CrosshairAngle:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
ENGHOOK(CrosshairAngle);
break; break;
case FM_FadeClientVolume: case FM_FadeClientVolume:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
ENGHOOK(FadeClientVolume);
break; break;
case FM_SetClientMaxspeed: case FM_SetClientMaxspeed:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_FLOAT, FP_DONE);
ENGHOOK(SetClientMaxspeed);
break; break;
case FM_CreateFakeClient: case FM_CreateFakeClient:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(CreateFakeClient);
break; break;
case FM_RunPlayerMove: case FM_RunPlayerMove:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
// ENGHOOK(RunPlayerMove);
break; break;
case FM_NumberOfEntities: case FM_NumberOfEntities:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
ENGHOOK(NumberOfEntities); ENGHOOK(NumberOfEntities);
break; break;
case FM_StaticDecal: case FM_StaticDecal:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_CELL, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
// ENGHOOK(StaticDecal);
break; break;
case FM_PrecacheGeneric: case FM_PrecacheGeneric:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(PrecacheGeneric); ENGHOOK(PrecacheGeneric);
break; break;
case FM_BuildSoundMsg: case FM_BuildSoundMsg:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
// ENGHOOK(BuildSoundMsg);
break; break;
case FM_GetPhysicsKeyValue: case FM_GetPhysicsKeyValue:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE);
ENGHOOK(GetPhysicsKeyValue);
break; break;
case FM_SetPhysicsKeyValue: case FM_SetPhysicsKeyValue:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
ENGHOOK(SetPhysicsKeyValue);
break; break;
case FM_GetPhysicsInfoString: case FM_GetPhysicsInfoString:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(GetPhysicsInfoString);
break; break;
case FM_PrecacheEvent: case FM_PrecacheEvent:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE);
ENGHOOK(PrecacheEvent);
break; break;
case FM_PlaybackEvent: case FM_PlaybackEvent:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
ENGHOOK(PlaybackEvent); // waaaaaaaaaah, its so damn big. :~(
break; break;
//EngFunc_CheckVisibility, //) ( const edict_t *entity, unsigned char *pset ); //EngFunc_CheckVisibility, //) ( const edict_t *entity, unsigned char *pset );
case FM_CheckVisibility: case FM_CheckVisibility:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE);
// ENGHOOK(CheckVisibility);
break; break;
//EngFunc_GetCurrentPlayer, //) ( void );
case FM_GetCurrentPlayer: case FM_GetCurrentPlayer:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
ENGHOOK(GetCurrentPlayer); ENGHOOK(GetCurrentPlayer);
@ -575,65 +806,88 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
//EngFunc_CanSkipPlayer, //) ( const edict_t *player ); //EngFunc_CanSkipPlayer, //) ( const edict_t *player );
case FM_CanSkipPlayer: case FM_CanSkipPlayer:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(CanSkipPlayer);
break; break;
//EngFunc_SetGroupMask, //) ( int mask, int op ); //EngFunc_SetGroupMask, //) ( int mask, int op );
case FM_SetGroupMask: case FM_SetGroupMask:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
ENGHOOK(SetGroupMask);
break; break;
//EngFunc_GetClientListening, // bool (int iReceiver, int iSender) //EngFunc_GetClientListening, // bool (int iReceiver, int iSender)
case FM_Voice_GetClientListening: case FM_Voice_GetClientListening:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
ENGHOOK(Voice_GetClientListening);
break; break;
//EngFunc_SetClientListening, // bool (int iReceiver, int iSender, bool Listen) //EngFunc_SetClientListening, // bool (int iReceiver, int iSender, bool Listen)
case FM_Voice_SetClientListening: case FM_Voice_SetClientListening:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_DONE); // TODO: bool as cell 3rd arg? fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_DONE); // TODO: bool as cell 3rd arg?
ENGHOOK(Voice_SetClientListening);
break; break;
//EngFunc_InfoKeyValue, // char* ) (char *infobuffer, char *key); //EngFunc_InfoKeyValue, // char* ) (char *infobuffer, char *key);
case FM_InfoKeyValue: case FM_InfoKeyValue:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_STRING, FP_DONE);
ENGHOOK(InfoKeyValue);
break; break;
//EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value); //EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value);
case FM_SetKeyValue: case FM_SetKeyValue:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_STRING, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_STRING, FP_STRING, FP_DONE);
ENGHOOK(SetKeyValue);
break; break;
//EngFunc_SetClientKeyValue // void ) (int clientIndex, char *infobuffer, char *key, char *value); //EngFunc_SetClientKeyValue // void ) (int clientIndex, char *infobuffer, char *key, char *value);
case FM_SetClientKeyValue: case FM_SetClientKeyValue:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_STRING, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_STRING, FP_STRING, FP_DONE);
ENGHOOK(SetClientKeyValue);
break; break;
case FM_GetPlayerAuthId:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
ENGHOOK(GetPlayerAuthId);
break;
case FM_GetPlayerWONId:
fId = MF_RegisterSPForwardByName(amx,funcname,FP_CELL,FP_DONE);
ENGHOOK(GetPlayerWONId);
break;
case FM_IsMapValid:
fId = MF_RegisterSPForwardByName(amx, funcname,FP_STRING,FP_DONE);
ENGHOOK(IsMapValid);
break;
/* /*
* Begin of DLLFuncs * Begin of DLLFuncs
*/ */
//DLLFunc_Spawn, // int ) ( edict_t *pent );
case FM_Spawn: case FM_Spawn:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(Spawn); DLLHOOK(Spawn);
break; break;
//DLLFunc_Think, // void ) ( edict_t *pent );
case FM_Think: case FM_Think:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(Think); DLLHOOK(Think);
break; break;
//DLLFunc_Use, // void ) ( edict_t *pentUsed, edict_t *pentOther );
case FM_Use: case FM_Use:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
DLLHOOK(Use); DLLHOOK(Use);
break; break;
//DLLFunc_Touch, // void ) ( edict_t *pentTouched, edict_t *pentOther );
case FM_Touch: case FM_Touch:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
DLLHOOK(Touch); DLLHOOK(Touch);
break; break;
//DLLFunc_Blocked, // void ) ( edict_t *pentBlocked, edict_t *pentOther );
case FM_Blocked: case FM_Blocked:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
DLLHOOK(Blocked); DLLHOOK(Blocked);
break; break;
//DLLFunc_KeyValue, // void ) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
/* /*
TODO: Expand the structure (simple: just a bunch of strings and a float.)
//DLLFunc_KeyValue, // void ) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
case FM_KeyValue: case FM_KeyValue:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_????, FP_DONE); // TODO: undefined structure? fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_????, FP_DONE);
break; break;
*/ */
//DLLFunc_SetAbsBox, // void ) ( edict_t *pent ); //DLLFunc_SetAbsBox, // void ) ( edict_t *pent );
@ -642,119 +896,101 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
DLLHOOK(SetAbsBox); DLLHOOK(SetAbsBox);
break; break;
//DLLFunc_ClientConnect, // bool) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
case FM_ClientConnect: case FM_ClientConnect:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_STRING, FP_STRING, FP_DONE); // TODO: 4th arg must be of set size 128? fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_STRING, FP_STRING, FP_DONE); // TODO: 4th arg must be of set size 128?
DLLHOOK(ClientConnect);
break; break;
//DLLFunc_ClientDisconnect, // void ) ( edict_t *pEntity );
case FM_ClientDisconnect: case FM_ClientDisconnect:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(ClientDisconnect); DLLHOOK(ClientDisconnect);
break; break;
//DLLFunc_ClientKill, // void ) ( edict_t *pEntity );
case FM_ClientKill: case FM_ClientKill:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(ClientKill); DLLHOOK(ClientKill);
break; break;
//DLLFunc_ClientPutInServer, // void ) ( edict_t *pEntity );
case FM_ClientPutInServer: case FM_ClientPutInServer:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(ClientPutInServer); DLLHOOK(ClientPutInServer);
break; break;
//DLLFunc_ClientCommand, // void ) ( edict_t *pEntity );
case FM_ClientCommand: case FM_ClientCommand:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(ClientCommand); DLLHOOK(ClientCommand);
break; break;
//DLLFunc_ServerDeactivate, // void) ( void );
case FM_ServerDeactivate: case FM_ServerDeactivate:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(ServerDeactivate); DLLHOOK(ServerDeactivate);
break; break;
//DLLFunc_PlayerPreThink, // void ) ( edict_t *pEntity );
case FM_PlayerPreThink: case FM_PlayerPreThink:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(PlayerPreThink); DLLHOOK(PlayerPreThink);
break; break;
//DLLFunc_PlayerPostThink, // void ) ( edict_t *pEntity );
case FM_PlayerPostThink: case FM_PlayerPostThink:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(PlayerPostThink); DLLHOOK(PlayerPostThink);
break; break;
//DLLFunc_StartFrame, // void ) ( void );
case FM_StartFrame: case FM_StartFrame:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(StartFrame); DLLHOOK(StartFrame);
break; break;
//DLLFunc_ParmsNewLevel, // void ) ( void );
case FM_ParmsNewLevel: case FM_ParmsNewLevel:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(ParmsNewLevel); DLLHOOK(ParmsNewLevel);
break; break;
//DLLFunc_ParmsChangeLevel, // void ) ( void );
case FM_ParmsChangeLevel: case FM_ParmsChangeLevel:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(ParmsChangeLevel); DLLHOOK(ParmsChangeLevel);
break; break;
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
//DLLFunc_GetGameDescription, // const char * )( void );
case FM_GetGameDescription: case FM_GetGameDescription:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(GetGameDescription); DLLHOOK(GetGameDescription);
break; break;
// Spectator funcs
//DLLFunc_SpectatorConnect, // void) ( edict_t *pEntity );
case FM_SpectatorConnect: case FM_SpectatorConnect:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(SpectatorConnect); DLLHOOK(SpectatorConnect);
break; break;
//DLLFunc_SpectatorDisconnect, // void ) ( edict_t *pEntity );
case FM_SpectatorDisconnect: case FM_SpectatorDisconnect:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(SpectatorDisconnect); DLLHOOK(SpectatorDisconnect);
break; break;
//DLLFunc_SpectatorThink, // void ) ( edict_t *pEntity );
case FM_SpectatorThink: case FM_SpectatorThink:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
DLLHOOK(SpectatorThink); DLLHOOK(SpectatorThink);
break; break;
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
//DLLFunc_Sys_Error, // void ) ( const char *error_string );
case FM_Sys_Error: case FM_Sys_Error:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
DLLHOOK(Sys_Error); DLLHOOK(Sys_Error);
break; break;
//DLLFunc_PM_FindTextureType, // char )( char *name );
case FM_PM_FindTextureType: case FM_PM_FindTextureType:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
DLLHOOK(PM_FindTextureType); DLLHOOK(PM_FindTextureType);
break; break;
//DLLFunc_RegisterEncoders, // void ) ( void );
case FM_RegisterEncoders: case FM_RegisterEncoders:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(RegisterEncoders); DLLHOOK(RegisterEncoders);
break; break;
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
//DLLFunc_GetHullBounds, // int) ( int hullnumber, float *mins, float *maxs );
case FM_GetHullBounds:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
break;
// Create baselines for certain "unplaced" items.
//DLLFunc_CreateInstancedBaselines, // void ) ( void );
case FM_CreateInstancedBaselines: case FM_CreateInstancedBaselines:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(CreateInstancedBaselines); DLLHOOK(CreateInstancedBaselines);
break; break;
//DLLFunc_pfnAllowLagCompensation, // int )( void );
case FM_AllowLagCompensation: case FM_AllowLagCompensation:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(AllowLagCompensation); DLLHOOK(AllowLagCompensation);
@ -785,5 +1021,6 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
AMX_NATIVE_INFO forward_natives[] = { AMX_NATIVE_INFO forward_natives[] = {
{ "register_forward", register_forward }, { "register_forward", register_forward },
{ "forward_return", fm_return },
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -27,11 +27,11 @@ enum {
FM_ChangePitch, // done FM_ChangePitch, // done
FM_FindEntityByString, // done FM_FindEntityByString, // done
FM_GetEntityIllum, // done FM_GetEntityIllum, // done
FM_FindEntityInSphere, // edict) (edict_t *pEdictStartSearchAfter, const float *org, float rad); FM_FindEntityInSphere, // done
FM_FindClientInPVS, // edict) (edict_t *pEdict); FM_FindClientInPVS, // done
FM_EntitiesInPVS, // edict) (edict_t *pplayer); FM_EntitiesInPVS, // done
FM_MakeVectors, // void ) (const float *rgflVector); FM_MakeVectors, // done
FM_AngleVectors, // void ) (const float *rgflVector, float *forward, float *right, float *up); FM_AngleVectors, // done
FM_CreateEntity, // done FM_CreateEntity, // done
FM_RemoveEntity, // done FM_RemoveEntity, // done
FM_CreateNamedEntity, // done FM_CreateNamedEntity, // done
@ -39,9 +39,9 @@ enum {
FM_EntIsOnFloor, // done FM_EntIsOnFloor, // done
FM_DropToFloor, // done FM_DropToFloor, // done
FM_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode); FM_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode);
FM_SetOrigin, // void ) (edict_t *e, const float *rgflOrigin); FM_SetOrigin, // done
FM_EmitSound, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); FM_EmitSound, // done
FM_EmitAmbientSound, // void ) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); FM_EmitAmbientSound, // done
FM_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); FM_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
FM_TraceToss, // void ) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr); FM_TraceToss, // void ) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr);
FM_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); FM_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
@ -50,43 +50,59 @@ enum {
FM_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 ); FM_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 );
FM_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); FM_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
FM_GetAimVector, // void ) (edict_t* ent, float speed, float *rgflReturn); FM_GetAimVector, // void ) (edict_t* ent, float speed, float *rgflReturn);
FM_ParticleEffect, // void ) (const float *org, const float *dir, float color, float count); FM_ParticleEffect, // done
FM_LightStyle, // void ) (int style, char* val); FM_LightStyle, // done
FM_DecalIndex, // done FM_DecalIndex, // done
FM_PointContents, // int ) (const float *rgflVector); FM_PointContents, // done
FM_MessageBegin, // done
FM_MessageEnd, // done
FM_WriteByte, // done
FM_WriteChar, // done
FM_WriteShort, // done
FM_WriteLong, // done
FM_WriteAngle, // done
FM_WriteCoord, // done
FM_WriteString, // done
FM_WriteEntity, // done
FM_CVarGetFloat, // done
FM_CVarGetString, // done
FM_CVarSetFloat, // done
FM_CVarSetString, // done
FM_FreeEntPrivateData, // done FM_FreeEntPrivateData, // done
FM_SzFromIndex, // const char * ) (int iString); FM_SzFromIndex, // done
FM_AllocString, // done FM_AllocString, // done
FM_RegUserMsg, // int ) (const char *pszName, int iSize); FM_RegUserMsg, // done
FM_AnimationAutomove, // void ) (const edict_t* pEdict, float flTime); FM_AnimationAutomove, // done
FM_GetBonePosition, // void ) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); FM_GetBonePosition, // void ) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
FM_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); FM_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
FM_SetView, // void ) (const edict_t *pClient, const edict_t *pViewent ); FM_SetView, // done
FM_Time, // float) ( void ); FM_Time, // done
FM_CrosshairAngle, // void ) (const edict_t *pClient, float pitch, float yaw); FM_CrosshairAngle, // done
FM_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); FM_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
FM_SetClientMaxspeed, // void ) (const edict_t *pEdict, float fNewMaxspeed); FM_SetClientMaxspeed, // done
FM_CreateFakeClient, // edict) (const char *netname); // returns NULL if fake client can't be created FM_CreateFakeClient, // done
FM_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); FM_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
FM_NumberOfEntities, // done FM_NumberOfEntities, // done
FM_StaticDecal, // void ) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); FM_StaticDecal, // void ) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
FM_PrecacheGeneric, // done FM_PrecacheGeneric, // done
FM_BuildSoundMsg, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); FM_BuildSoundMsg, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
FM_GetPhysicsKeyValue, // const char* ) ( const edict_t *pClient, const char *key ); FM_GetPhysicsKeyValue, // done
FM_SetPhysicsKeyValue, // void ) ( const edict_t *pClient, const char *key, const char *value ); FM_SetPhysicsKeyValue, // done
FM_GetPhysicsInfoString,// const char* ) ( const edict_t *pClient ); FM_GetPhysicsInfoString,// done
FM_PrecacheEvent, // unsigned short ) ( int type, const char*psz ); FM_PrecacheEvent, // done
FM_PlaybackEvent, // void ) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); FM_PlaybackEvent, // done
FM_CheckVisibility, //) ( const edict_t *entity, unsigned char *pset ); FM_CheckVisibility, //) ( const edict_t *entity, unsigned char *pset );
FM_GetCurrentPlayer, //) ( void ); FM_GetCurrentPlayer, // done
FM_CanSkipPlayer, //) ( const edict_t *player ); FM_CanSkipPlayer, // done
FM_SetGroupMask, //) ( int mask, int op ); FM_SetGroupMask, //done
FM_Voice_GetClientListening, // bool (int iReceiver, int iSender) FM_Voice_GetClientListening, // done
FM_Voice_SetClientListening, // bool (int iReceiver, int iSender, bool Listen) FM_Voice_SetClientListening, // done
FM_InfoKeyValue, // char* ) (char *infobuffer, char *key); FM_InfoKeyValue, // done
FM_SetKeyValue, // void ) (char *infobuffer, char *key, char *value); FM_SetKeyValue, // done
FM_SetClientKeyValue, // void ) (int clientIndex, char *infobuffer, char *key, char *value); FM_SetClientKeyValue, // done
FM_GetPlayerAuthId, // done
FM_GetPlayerWONId, // done
FM_IsMapValid, // done
// FM_GameInit, // Removed -- it will *never* be called after plugins are loaded // FM_GameInit, // Removed -- it will *never* be called after plugins are loaded
@ -97,7 +113,7 @@ enum {
FM_Blocked, // done FM_Blocked, // done
FM_KeyValue, // void ) ( edict_t *pentKeyvalue, KeyValueData *pkvd ); FM_KeyValue, // void ) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
FM_SetAbsBox, // done FM_SetAbsBox, // done
FM_ClientConnect, // bool) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ); FM_ClientConnect, // done
FM_ClientDisconnect, // done FM_ClientDisconnect, // done
FM_ClientKill, // done FM_ClientKill, // done
@ -114,7 +130,7 @@ enum {
FM_ParmsChangeLevel, // done FM_ParmsChangeLevel, // done
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life // Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
FM_GetGameDescription, // const char * )( void ); FM_GetGameDescription, // done
// Spectator funcs // Spectator funcs
FM_SpectatorConnect, // done FM_SpectatorConnect, // done
@ -128,7 +144,6 @@ enum {
FM_RegisterEncoders, // done FM_RegisterEncoders, // done
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise // Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
FM_GetHullBounds, // int) ( int hullnumber, float *mins, float *maxs );
// Create baselines for certain "unplaced" items. // Create baselines for certain "unplaced" items.
FM_CreateInstancedBaselines, // done FM_CreateInstancedBaselines, // done

View File

@ -13,6 +13,109 @@
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
} }
#define SIMPLE_CONSTSTRING_HOOK_INT(call) \
const char* call (int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),v)); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (int v) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),v)); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_CONSTEDICT(call) \
const char* call (const edict_t *e) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),ENTINDEX((edict_t*)e))); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (const edict_t *e) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),ENTINDEX((edict_t*)e))); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_CONSTEDICT_CONSTSTRING(call) \
const char* call (const edict_t *e, const char *c) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),ENTINDEX((edict_t*)e),c)); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (const edict_t *e, const char *c) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),ENTINDEX((edict_t*)e),c)); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_INT_INT_INT_INT(call) \
void call (const edict_t *e, int v, int vb, int vc, int vd) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),ENTINDEX((edict_t*)e),v,vb,vc,vd)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *e, int v, int vb, int vc, int vd) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),ENTINDEX((edict_t*)e),v,vb,vc,vd)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_INT_STRING_STRING_STRING(call) \
void call (int v,char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),v,c,cb,cc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),v,c,cb,cc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_STRING_STRING_STRING(call) \
void call (char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb,cc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb,cc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_STRING_HOOK_STRING_STRING(call) \
char* call (char *c, char *cb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb)); \
RETURN_META_VALUE(mswi(lastFmRes), (char*)mlStringResult); \
} \
char* call##_post (char *c, char *cb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb)); \
RETURN_META_VALUE(MRES_IGNORED, (char*)mlStringResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_EDICT(call) \
const char* call (edict_t *e) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),ENTINDEX(e))); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (edict_t *e) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),ENTINDEX(e))); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_CONSTSTRING_CONSTSTRING(call) \
void call (const edict_t *e, const char *c, const char *cb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),ENTINDEX((edict_t*)e),c,cb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *e, const char *c, const char *cb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),ENTINDEX((edict_t*)e),c,cb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_INT_HOOK_STRING(call) \ #define SIMPLE_INT_HOOK_STRING(call) \
@ -38,6 +141,18 @@
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
#define SIMPLE_EDICT_HOOK_CONSTSTRING(call) \
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)); \
} \
edict_t* call##_post (const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_CHAR_HOOK_STRING(call) \ #define SIMPLE_CHAR_HOOK_STRING(call) \
char call (char *s) \ char call (char *s) \
{ \ { \
@ -61,6 +176,144 @@
RETURN_META(MRES_IGNORED); \ RETURN_META(MRES_IGNORED); \
} }
#define SIMPLE_VOID_HOOK_STRING_STRING(call) \
void call (char *s, char *sb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, sb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (char *s, char *sb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, sb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_INT_CONSTSTRING(call) \
void call (int v, const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, s)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v,const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, s)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTSTRING_FLOAT(call) \
void call (const char *s, float f) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, f)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const char *s, float f) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, f)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_INT_HOOK_CONSTSTRING_INT(call) \
int call (const char *s, int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, v)); \
RETURN_META_VALUE(mswi(lastFmRes),(int)mlCellResult); \
} \
int call##_post (const char *s, int v) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, v)); \
RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_CONSTSTRING_CONSTSTRING(call) \
void call (const char *s,const char *sb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, sb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const char *s, const char *sb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, sb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_USHORT_HOOK_INT_CONSTSTRING(call) \
unsigned short call (int v, const char *s) \
{ \
printf("Addr: %d\n",s); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, s)); \
RETURN_META_VALUE(mswi(lastFmRes),(unsigned short)mlCellResult); \
} \
unsigned short call##_post (int v,const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, s)); \
RETURN_META_VALUE(MRES_IGNORED,(unsigned short)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_INT_STRING(call) \
void call (int v, char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, s)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v,char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, s)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_INT(call) \
void call (int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_FLOAT(call) \
void call (float v) \
{ \
PREPARE_FLOAT(v); \
printf("[before] v is now: %f\n",v); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), c_v)); \
BYREF_FLOAT(v); \
printf("[after] v is now: %f\n",v); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (float v) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT(call) \
void call (const edict_t *ent, float blah) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX((edict_t*)ent), amx_ftoc(blah))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *ent, float blah) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX((edict_t*)ent), amx_ftoc(blah))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT_FLOAT(call) \
void call (const edict_t *ent, float blah, float blahb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX((edict_t*)ent), amx_ftoc(blah), amx_ftoc(blahb))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *ent, float blah, float blahb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX((edict_t*)ent), amx_ftoc(blah), amx_ftoc(blahb))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT(call) \ #define SIMPLE_VOID_HOOK_EDICT(call) \
void call (edict_t *ent) \ void call (edict_t *ent) \
@ -96,6 +349,33 @@
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \ RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
} }
#define SIMPLE_EDICT_HOOK_EDICT(call) \
edict_t* call (edict_t *e) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),ENTINDEX(e))); \
RETURN_META_VALUE(mswi(lastFmRes),INDEXENT2((int)mlCellResult)); \
} \
edict_t* call##_post (edict_t *e) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),ENTINDEX(e))); \
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_EDICT_HOOK_EDICT_CONSTVECT_FLOAT(call) \
edict_t* call (edict_t *ed, const float *vec, float fla) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(ed), p_vec, fla)); \
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT2((int)mlCellResult)); \
} \
edict_t* call##_post (edict_t *ed, const float *vec, float fla) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(ed), p_vec, fla)); \
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_VOID_HOOK_EDICT_EDICT(call) \ #define SIMPLE_VOID_HOOK_EDICT_EDICT(call) \
void call (edict_t *ent,edict_t *entb) \ void call (edict_t *ent,edict_t *entb) \
{ \ { \
@ -108,6 +388,18 @@
RETURN_META(MRES_IGNORED); \ RETURN_META(MRES_IGNORED); \
} }
#define SIMPLE_VOID_HOOK_CONSTEDICT_CONSTEDICT(call) \
void call (const edict_t *ent,const edict_t *entb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX((edict_t*)ent), ENTINDEX((edict_t*)entb))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *ent,const edict_t *entb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX((edict_t*)ent), ENTINDEX((edict_t*)entb))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_VOID(call) \ #define SIMPLE_VOID_HOOK_VOID(call) \
void call (void) \ void call (void) \
{ \ { \
@ -131,6 +423,29 @@
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(pent))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(pent))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
#define SIMPLE_UINT_HOOK_EDICT(call) \
unsigned int call (edict_t *pent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(pent))); \
RETURN_META_VALUE(mswi(lastFmRes), (unsigned int)mlCellResult); \
} \
unsigned int call##_post (edict_t *pent) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(pent))); \
RETURN_META_VALUE(MRES_IGNORED, (unsigned int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_CONSTEDICT(call) \
int call (const edict_t *pent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX((edict_t*)pent))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (const edict_t *pent) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX((edict_t*)pent))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_INT(call) \ #define SIMPLE_INT_HOOK_INT(call) \
int call (int v) \ int call (int v) \
@ -144,6 +459,42 @@
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
#define SIMPLE_VOID_HOOK_INT_INT(call) \
void call (int v, int vb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, vb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, int vb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, vb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_BOOL_HOOK_INT_INT(call) \
qboolean call (int v, int vb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, vb)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult > 0 ? 1 : 0); \
} \
qboolean call##_post (int v, int vb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, vb)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \
}
#define SIMPLE_BOOL_HOOK_INT_INT_BOOL(call) \
qboolean call (int v, int vb, qboolean bah) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, vb, bah > 0 ? 1 : 0)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult > 0 ? 1 : 0); \
} \
qboolean call##_post (int v, int vb, qboolean bah) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, vb, bah > 0 ? 1 : 0)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \
}
#define SIMPLE_INT_HOOK_VOID(call) \ #define SIMPLE_INT_HOOK_VOID(call) \
int call () \ int call () \
{ \ { \
@ -155,8 +506,231 @@
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
#define SIMPLE_FLOAT_HOOK_VOID(call) \
float call () \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META_VALUE(mswi(lastFmRes), (float)mFloatResult); \
} \
float call##_post () \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META_VALUE(MRES_IGNORED, (float)mFloatResult); \
}
#define SIMPLE_INT_HOOK_CONSTVECT(call) \
int call (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_EDICT_CONSTVECT(call) \
void call (edict_t *e, const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(e), p_vec)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(e), p_vec)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT_FLOAT_VECT(call) \
void call (edict_t *e, float f, float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(e), f, p_vec)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, float f, float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(e), f, p_vec)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTVECT(call) \
void call (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTVECT_VECT_VECT_VECT(call) \
void call (const float *vec, float *vecb, float *vecc, float *vecd) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
PREPARE_VECTOR(vecc); \
PREPARE_VECTOR(vecd); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec, p_vecb, p_vecc, p_vecd)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const float *vec, float *vecb, float *vecc, float *vecd) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
PREPARE_VECTOR(vecc); \
PREPARE_VECTOR(vecd); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec, p_vecb, p_vecc, p_vecd)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT_CONSTVECT_CONSTVECT(call) \
void call (edict_t *e, const float *vec, const float *vecb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(e), p_vec, p_vecb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, const float *vec, const float *vecb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(e), p_vec, p_vecb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_FLOAT_HOOK_CONSTVECT(call) \
float call (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(mswi(lastFmRes),mlFloatResult); \
} \
float call##_post (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(MRES_IGNORED,mlFloatResult); \
}
#define SIMPLE_FLOAT_HOOK_CONSTSTRING(call) \
float call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes),mlFloatResult); \
} \
float call##_post (const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED,mlFloatResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_CONSTSTRING(call) \
const char* call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes),mlStringResult); \
} \
const char* call##_post (const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED,mlStringResult); \
}
#define SIMPLE_VOID_HOOK_INT_INT_CONSTVECT_EDICT(call) \
void call (int v, int vb, const float *vec, edict_t *e) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, vb, p_vec, ENTINDEX(e))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, int vb, const float *vec, edict_t *e) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, vb, p_vec, ENTINDEX(e))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_BOOL_HOOK_EDICT_CONSTSTRING_CONSTSTRING_STRING128(call) \
qboolean call (edict_t *e, const char *sza, const char *szb, char blah[128]) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(e), sza, szb, blah)); \
RETURN_META_VALUE(mswi(lastFmRes),(int)mlCellResult > 0 ? 0 : 1); \
} \
qboolean call##_post (edict_t *e, const char *sza, const char *szb, char blah[128]) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(e), sza, szb, blah)); \
RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult > 0 ? 0 : 1); \
}
#define SIMPLE_VOID_HOOK_EDICT_INT_CONSTSTRING_FLOAT_FLOAT_INT_INT(call) \
void call (edict_t *e, int v, const char *sz, float f, float fb, int vb, int vc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(e), v, sz, f, fb, vb, vc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, int v, const char *sz, float f, float fb, int vb, int vc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(e), v, sz, f, fb, vb, vc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT_VECT_CONSTSTRING_FLOAT_FLOAT_INT_INT(call) \
void call (edict_t *e, float *vec, const char *sz, float f, float fb, int vb, int vc) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(e), p_vec, sz, f, fb, vb, vc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, float *vec, const char *sz, float f, float fb, int vb, int vc) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(e), p_vec, sz, f, fb, vb, vc)); \
RETURN_META(MRES_IGNORED); \
}
//int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
#define HOOK_PLAYBACK_EVENT(call) \
void call (int v, const edict_t *e, unsigned short eb, float f, float *vec, float *vecb, float fb, float fc, int vb, int vc, int vd, int ve) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v, ENTINDEX((edict_t*)e), eb, f, p_vec, p_vecb, fb, fc, vb, vc, vd, ve)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, const edict_t *e, unsigned short eb, float f, float *vec, float *vecb, float fb, float fc, int vb, int vc, int vd, int ve) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v, ENTINDEX((edict_t*)e), eb, f, p_vec, p_vecb, fb, fc, vb, vc, vd, ve)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTVECT_CONSTVECT_FLOAT_FLOAT(call) \
void call (const float *vec,const float *vecb, float fla, float flb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec, p_vecb, fla, flb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const float *vec,const float *vecb, float fla, float flb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), vec, vecb, fla, flb)); \
RETURN_META(MRES_IGNORED); \
}
@ -189,6 +763,17 @@
dlltable->pfn##pfnCall = pfnCall; \ dlltable->pfn##pfnCall = pfnCall; \
} }
#define PREPARE_VECTOR(vector_name) \
cell vector_name##_cell[3] = {amx_ftoc(vector_name[0]), amx_ftoc(vector_name[1]), amx_ftoc(vector_name[2])}; \
cell p_##vector_name = MF_PrepareCellArray(vector_name##_cell, 3) \
#define PREPARE_FLOAT(float_name) \
cell c_##float_name = amx_ftoc(float_name);
#define BYREF_FLOAT(float_name) \
float_name = amx_ctof(c_##float_name);
#define FM_ENG_HANDLE(pfnCall, pfnArgs) \ #define FM_ENG_HANDLE(pfnCall, pfnArgs) \
register unsigned int i = 0; \ register unsigned int i = 0; \
clfm(); \ clfm(); \

62
dlls/fakemeta/pdata.cpp Executable file
View File

@ -0,0 +1,62 @@
#include "fakemeta_amxx.h"
static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
if (iOffset <0)
return 1;
#ifdef __linux__
iOffset += params[4];
#endif
int iValue=params[3];
*((int *)INDEXENT2(index)->pvPrivateData + 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];
if (iOffset <0)
return 0;
#ifdef __linux__
iOffset += params[3];
#endif
return *((int *)INDEXENT2(index)->pvPrivateData + iOffset);
}
// Float
static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
if (iOffset <0)
return 1;
#ifdef __linux__
iOffset += params[4];
#endif
float fValue=amx_ctof(params[3]);
*((float *)INDEXENT2(index)->pvPrivateData + iOffset) = fValue;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
if (iOffset <0)
return 1;
#ifdef __linux__
iOffset += params[3];
#endif
return amx_ftoc(*((float *)INDEXENT2(index)->pvPrivateData + iOffset));
}
AMX_NATIVE_INFO pdata_natives[] = {
{ "get_pdata_int", get_pdata_int },
{ "set_pdata_int", set_pdata_int },
{ "get_pdata_float", get_pdata_float },
{ "set_pdata_float", set_pdata_float },
{ NULL, NULL }
};

View File

@ -2893,7 +2893,6 @@ void operator delete[](void *reportedAddress)
#include <extdll.h> #include <extdll.h>
#include "sdk_util.h" #include "sdk_util.h"
#include <cbase.h>
#include <string.h> // for strncpy(), etc #include <string.h> // for strncpy(), etc
@ -2930,76 +2929,4 @@ void UTIL_LogPrintf( char *fmt, ... )
} }
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms,
const char *pMessage)
{
if ( !pEntity )
return;
MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, ENT(pEntity->pev) );
WRITE_BYTE( TE_TEXTMESSAGE );
WRITE_BYTE( textparms.channel & 0xFF );
WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) );
WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) );
WRITE_BYTE( textparms.effect );
WRITE_BYTE( textparms.r1 );
WRITE_BYTE( textparms.g1 );
WRITE_BYTE( textparms.b1 );
WRITE_BYTE( textparms.a1 );
WRITE_BYTE( textparms.r2 );
WRITE_BYTE( textparms.g2 );
WRITE_BYTE( textparms.b2 );
WRITE_BYTE( textparms.a2 );
WRITE_SHORT( FixedUnsigned16( textparms.fadeinTime, 1<<8 ) );
WRITE_SHORT( FixedUnsigned16( textparms.fadeoutTime, 1<<8 ) );
WRITE_SHORT( FixedUnsigned16( textparms.holdTime, 1<<8 ) );
if ( textparms.effect == 2 )
WRITE_SHORT( FixedUnsigned16( textparms.fxTime, 1<<8 ) );
if ( strlen( pMessage ) < 512 )
{
WRITE_STRING( pMessage );
}
else
{
char tmp[512];
strncpy( tmp, pMessage, 511 );
tmp[511] = 0;
WRITE_STRING( tmp );
}
MESSAGE_END();
}
short FixedSigned16( float value, float scale )
{
int output;
output = (int) (value * scale);
if ( output > 32767 )
output = 32767;
if ( output < -32768 )
output = -32768;
return (short)output;
}
unsigned short FixedUnsigned16( float value, float scale )
{
int output;
output = (int) (value * scale);
if ( output < 0 )
output = 0;
if ( output > 0xFFFF )
output = 0xFFFF;
return (unsigned short)output;
}
#endif // USE_METAMOD #endif // USE_METAMOD

View File

@ -245,9 +245,6 @@ enum {
#ifdef USE_METAMOD #ifdef USE_METAMOD
void UTIL_LogPrintf( char *fmt, ... ); void UTIL_LogPrintf( char *fmt, ... );
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
short FixedSigned16( float value, float scale );
unsigned short FixedUnsigned16( float value, float scale );
#ifdef FN_META_QUERY #ifdef FN_META_QUERY
void FN_META_QUERY(void); void FN_META_QUERY(void);