Oh dear, lots of changes:

1) Added get_orig_retval for retrieving the original return value of an engine function
2) Fixed engfunc being called with EngFunc_CheckVisibility so that it now works as intended
3) Hooks should now also work with FM_WalkMove, FM_TraceToss, FM_TraceMonsterHull, FM_TraceHull,
   FM_TraceModel, FM_TraceTexture, FM_TraceSphere, FM_GetBonePosition, FM_GetAttachment, FM_RunPlayerMove,
   FM_StaticDecal, FM_BuildSoundMsg and FM_CheckVisibility
4) Reformatted comments in some header files so they look a bit neater
This commit is contained in:
Scott Ehlert 2006-04-17 17:02:57 +00:00
parent b57c752b1c
commit 4101eea5e8
8 changed files with 547 additions and 299 deletions

View File

@ -3,53 +3,56 @@
enum enum
{ {
DLLFunc_GameInit, // void) ( void ); DLLFunc_GameInit, // void ) ( void );
DLLFunc_Spawn, // int ) ( edict_t *pent ); DLLFunc_Spawn, // int ) (edict_t *pent);
DLLFunc_Think, // void ) ( edict_t *pent ); DLLFunc_Think, // void ) (edict_t *pent);
DLLFunc_Use, // void ) ( edict_t *pentUsed, edict_t *pentOther ); DLLFunc_Use, // void ) (edict_t *pentUsed, edict_t *pentOther);
DLLFunc_Touch, // void ) ( edict_t *pentTouched, edict_t *pentOther ); DLLFunc_Touch, // void ) (edict_t *pentTouched, edict_t *pentOther);
DLLFunc_Blocked, // void ) ( edict_t *pentBlocked, edict_t *pentOther ); DLLFunc_Blocked, // void ) (edict_t *pentBlocked, edict_t *pentOther);
DLLFunc_KeyValue, // void ) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
DLLFunc_SetAbsBox, // void ) ( edict_t *pent );
DLLFunc_ClientConnect, // bool) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
DLLFunc_ClientDisconnect, // void ) ( edict_t *pEntity ); //You can pass in 0 for glb kvd handle or a kvd handle here
DLLFunc_ClientKill, // void ) ( edict_t *pEntity ); DLLFunc_KeyValue, // void ) (edict_t *pentKeyvalue, KeyValueData *pkvd);
DLLFunc_ClientPutInServer, // void ) ( edict_t *pEntity ); DLLFunc_SetAbsBox, // void ) (edict_t *pent);
DLLFunc_ClientCommand, // void ) ( edict_t *pEntity ); DLLFunc_ClientConnect, // bool ) (edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);
DLLFunc_ServerDeactivate, // void) ( void ); DLLFunc_ClientDisconnect, // void ) (edict_t *pEntity);
DLLFunc_ClientKill, // void ) (edict_t *pEntity);
DLLFunc_ClientPutInServer, // void ) (edict_t *pEntity);
DLLFunc_ClientCommand, // void ) (edict_t *pEntity);
DLLFunc_PlayerPreThink, // void ) ( edict_t *pEntity ); DLLFunc_ServerDeactivate, // void ) ( void );
DLLFunc_PlayerPostThink, // void ) ( edict_t *pEntity );
DLLFunc_PlayerPreThink, // void ) (edict_t *pEntity);
DLLFunc_PlayerPostThink, // void ) (edict_t *pEntity);
DLLFunc_StartFrame, // void ) ( void ); DLLFunc_StartFrame, // void ) ( void );
DLLFunc_ParmsNewLevel, // void ) ( void ); DLLFunc_ParmsNewLevel, // void ) ( void );
DLLFunc_ParmsChangeLevel, // void ) ( void ); DLLFunc_ParmsChangeLevel, // void ) ( void );
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life // Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
DLLFunc_GetGameDescription, // const char * )( void ); // This also gets called when the server is queried for information (for example, by a server browser tool)
DLLFunc_GetGameDescription, // const char *) ( void );
// Spectator funcs // Spectator funcs
DLLFunc_SpectatorConnect, // void) ( edict_t *pEntity ); DLLFunc_SpectatorConnect, // void ) (edict_t *pEntity);
DLLFunc_SpectatorDisconnect, // void ) ( edict_t *pEntity ); DLLFunc_SpectatorDisconnect, // void ) (edict_t *pEntity);
DLLFunc_SpectatorThink, // void ) ( edict_t *pEntity ); DLLFunc_SpectatorThink, // void ) (edict_t *pEntity);
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. // 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 ); DLLFunc_Sys_Error, // void ) (const char *error_string);
DLLFunc_PM_FindTextureType, // char )( char *name ); DLLFunc_PM_FindTextureType, // char ) (char *name);
DLLFunc_RegisterEncoders, // void ) ( void ); DLLFunc_RegisterEncoders, // void ) ( void );
// 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
DLLFunc_GetHullBounds, // int) ( int hullnumber, float *mins, float *maxs ); DLLFunc_GetHullBounds, // int ) (int hullnumber, float *mins, float *maxs);
// Create baselines for certain "unplaced" items. // Create baselines for certain "unplaced" items.
DLLFunc_CreateInstancedBaselines, // void ) ( void ); DLLFunc_CreateInstancedBaselines, // void ) ( void );
DLLFunc_pfnAllowLagCompensation, // int )( void ); DLLFunc_pfnAllowLagCompensation, // int ) ( void );
// I know this does not fit with DLLFUNC(), but I dont want another native just for it. // I know this does not fit with DLLFUNC(), but I dont want another native just for it.
MetaFunc_CallGameEntity, // bool (plid_t plid, const char *entStr,entvars_t *pev); MetaFunc_CallGameEntity, // bool ) (plid_t plid, const char *entStr,entvars_t *pev);
DLLFunc_ClientUserInfoChanged // void ) (edict_t *pEntity, char *infobuffer) DLLFunc_ClientUserInfoChanged // void ) (idplayer)
}; };
#endif //_INCLUDE_DLLFUNC_H #endif //_INCLUDE_DLLFUNC_H

View File

@ -913,6 +913,14 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
(*g_engfuncs.pfnPlaybackEvent)(iparam1,INDEXENT2(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; return 1;
//pfnCheckVisibility
case EngFunc_CheckVisibility: // int ) ( const edict_t *entity, unsigned char *pset );
cRet = MF_GetAmxAddr(amx, params[2]);
index = cRet[0];
CHECK_ENTITY(index);
temp = MF_GetAmxString(amx,params[3],0,&len);
return (*g_engfuncs.pfnCheckVisibility)(INDEXENT2(index), (unsigned char *)STRING(ALLOC_STRING(temp)));
// pfnGetCurrentPlayer // pfnGetCurrentPlayer
case EngFunc_GetCurrentPlayer: // int ) ( void ); case EngFunc_GetCurrentPlayer: // int ) ( void );
return (*g_engfuncs.pfnGetCurrentPlayer)(); return (*g_engfuncs.pfnGetCurrentPlayer)();

View File

@ -2,8 +2,8 @@
#define _ENGFUNC_INCLUDE_H #define _ENGFUNC_INCLUDE_H
enum { enum {
EngFunc_PrecacheModel, // int ) (char* s); EngFunc_PrecacheModel, // int ) (char *s);
EngFunc_PrecacheSound, // int ) (char* s); EngFunc_PrecacheSound, // int ) (char *s);
EngFunc_SetModel, // void ) (edict_t *e, const char *m); EngFunc_SetModel, // void ) (edict_t *e, const char *m);
EngFunc_ModelIndex, // int ) (const char *m); EngFunc_ModelIndex, // int ) (const char *m);
EngFunc_ModelFrames, // int ) (int modelIndex); EngFunc_ModelFrames, // int ) (int modelIndex);
@ -22,60 +22,60 @@ enum {
EngFunc_MakeVectors, // void ) (const float *rgflVector); EngFunc_MakeVectors, // void ) (const float *rgflVector);
EngFunc_AngleVectors, // void ) (const float *rgflVector, float *forward, float *right, float *up); EngFunc_AngleVectors, // void ) (const float *rgflVector, float *forward, float *right, float *up);
EngFunc_CreateEntity, // edict) (void); EngFunc_CreateEntity, // edict) (void);
EngFunc_RemoveEntity, // void ) (edict_t* e); EngFunc_RemoveEntity, // void ) (edict_t *e);
EngFunc_CreateNamedEntity, // edict) (int className); EngFunc_CreateNamedEntity, // edict) (int className);
EngFunc_MakeStatic, // void ) (edict_t *ent); EngFunc_MakeStatic, // void ) (edict_t *ent);
EngFunc_EntIsOnFloor, // int ) (edict_t *e); EngFunc_EntIsOnFloor, // int ) (edict_t *e);
EngFunc_DropToFloor, // int ) (edict_t* e); EngFunc_DropToFloor, // int ) (edict_t *e);
EngFunc_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode); EngFunc_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode);
EngFunc_SetOrigin, // void ) (edict_t *e, const float *rgflOrigin); EngFunc_SetOrigin, // void ) (edict_t *e, const float *rgflOrigin);
EngFunc_EmitSound, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch); EngFunc_EmitSound, // void ) (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
EngFunc_EmitAmbientSound, // void ) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch); EngFunc_EmitAmbientSound, // void ) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
EngFunc_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); EngFunc_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceToss, // void ) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr); EngFunc_TraceToss, // void ) (edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
EngFunc_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); EngFunc_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceHull, // void ) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); EngFunc_TraceHull, // void ) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceModel, // void ) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); EngFunc_TraceModel, // void ) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
EngFunc_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 ); EngFunc_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 );
EngFunc_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); EngFunc_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_GetAimVector, // void ) (edict_t* ent, float speed, float *rgflReturn); EngFunc_GetAimVector, // void ) (edict_t *ent, float speed, float *rgflReturn);
EngFunc_ParticleEffect, // void ) (const float *org, const float *dir, float color, float count); EngFunc_ParticleEffect, // void ) (const float *org, const float *dir, float color, float count);
EngFunc_LightStyle, // void ) (int style, char* val); EngFunc_LightStyle, // void ) (int style, char *val);
EngFunc_DecalIndex, // int ) (const char *name); EngFunc_DecalIndex, // int ) (const char *name);
EngFunc_PointContents, // int ) (const float *rgflVector); EngFunc_PointContents, // int ) (const float *rgflVector);
EngFunc_FreeEntPrivateData, // void ) (edict_t *pEdict); EngFunc_FreeEntPrivateData, // void ) (edict_t *pEdict);
EngFunc_SzFromIndex, // const char * ) (int iString); EngFunc_SzFromIndex, // const char *) (int iString);
EngFunc_AllocString, // int ) (const char *szValue); EngFunc_AllocString, // int ) (const char *szValue);
EngFunc_RegUserMsg, // int ) (const char *pszName, int iSize); EngFunc_RegUserMsg, // int ) (const char *pszName, int iSize);
EngFunc_AnimationAutomove, // void ) (const edict_t* pEdict, float flTime); EngFunc_AnimationAutomove, // void ) (const edict_t *pEdict, float flTime);
EngFunc_GetBonePosition, // void ) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); EngFunc_GetBonePosition, // void ) (const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles);
EngFunc_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); EngFunc_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles);
EngFunc_SetView, // void ) (const edict_t *pClient, const edict_t *pViewent ); EngFunc_SetView, // void ) (const edict_t *pClient, const edict_t *pViewent);
EngFunc_Time, // float) ( void ); EngFunc_Time, // float) ( void );
EngFunc_CrosshairAngle, // void ) (const edict_t *pClient, float pitch, float yaw); EngFunc_CrosshairAngle, // void ) (const edict_t *pClient, float pitch, float yaw);
EngFunc_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); EngFunc_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
EngFunc_SetClientMaxspeed, // void ) (const edict_t *pEdict, float fNewMaxspeed); EngFunc_SetClientMaxspeed, // void ) (const edict_t *pEdict, float fNewMaxspeed);
EngFunc_CreateFakeClient, // edict) (const char *netname); // returns NULL if fake client can't be created EngFunc_CreateFakeClient, // edict) (const char *netname); // returns NULL if fake client can't be created
EngFunc_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); EngFunc_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
EngFunc_NumberOfEntities, // int ) (void); EngFunc_NumberOfEntities, // int ) ( void );
EngFunc_StaticDecal, // void ) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); EngFunc_StaticDecal, // void ) (const float *origin, int decalIndex, int entityIndex, int modelIndex);
EngFunc_PrecacheGeneric, // int ) (char* s); EngFunc_PrecacheGeneric, // int ) (char* s);
EngFunc_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); EngFunc_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);
EngFunc_GetPhysicsKeyValue, // const char* ) ( const edict_t *pClient, const char *key ); EngFunc_GetPhysicsKeyValue, // const char *) (const edict_t *pClient, const char *key);
EngFunc_SetPhysicsKeyValue, // void ) ( const edict_t *pClient, const char *key, const char *value ); EngFunc_SetPhysicsKeyValue, // void ) (const edict_t *pClient, const char *key, const char *value);
EngFunc_GetPhysicsInfoString,// const char* ) ( const edict_t *pClient ); EngFunc_GetPhysicsInfoString, // const char *) (const edict_t *pClient);
EngFunc_PrecacheEvent, // unsigned short ) ( int type, const char*psz ); EngFunc_PrecacheEvent, // unsigned short) (int type, const char*psz);
EngFunc_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 ); EngFunc_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);
EngFunc_CheckVisibility, //) ( const edict_t *entity, unsigned char *pset ); EngFunc_CheckVisibility, // int ) (const edict_t *entity, unsigned char *pset);
EngFunc_GetCurrentPlayer, //) ( void ); EngFunc_GetCurrentPlayer, // int ) ( void );
EngFunc_CanSkipPlayer, //) ( const edict_t *player ); EngFunc_CanSkipPlayer, // int ) (const edict_t *player);
EngFunc_SetGroupMask, //) ( int mask, int op ); EngFunc_SetGroupMask, // void ) (int mask, int op);
EngFunc_GetClientListening, // bool (int iReceiver, int iSender) EngFunc_GetClientListening, // bool ) (int iReceiver, int iSender)
EngFunc_SetClientListening, // bool (int iReceiver, int iSender, bool Listen) EngFunc_SetClientListening, // bool ) (int iReceiver, int iSender, bool Listen)
EngFunc_MessageBegin, // void (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) EngFunc_MessageBegin, // void ) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
EngFunc_WriteCoord, // void (float) EngFunc_WriteCoord, // void ) (float flValue)
EngFunc_WriteAngle, // void (float) EngFunc_WriteAngle, // void ) (float flValue)
EngFunc_InfoKeyValue, // char* ) (char *infobuffer, char *key); EngFunc_InfoKeyValue, // char*) (char *infobuffer, char *key);
EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value); EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value);
EngFunc_SetClientKeyValue // void ) (int clientIndex, char *infobuffer, char *key, char *value); EngFunc_SetClientKeyValue // void ) (int clientIndex, char *infobuffer, char *key, char *value);
}; };

View File

@ -4,6 +4,7 @@
Version="7.10" Version="7.10"
Name="fakemeta" Name="fakemeta"
ProjectGUID="{5E393C37-22F2-4CA2-9022-6400DC582447}" ProjectGUID="{5E393C37-22F2-4CA2-9022-6400DC582447}"
RootNamespace="fakemeta"
Keyword="Win32Proj"> Keyword="Win32Proj">
<Platforms> <Platforms>
<Platform <Platform
@ -150,7 +151,7 @@
</Filter> </Filter>
</Filter> </Filter>
<Filter <Filter
Name="engfunc" Name="Engine Funcs"
Filter=""> Filter="">
<File <File
RelativePath=".\dllfunc.cpp"> RelativePath=".\dllfunc.cpp">
@ -166,7 +167,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="pev" Name="PEV"
Filter=""> Filter="">
<File <File
RelativePath=".\pev.cpp"> RelativePath=".\pev.cpp">
@ -181,7 +182,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="forward" Name="Forwards"
Filter=""> Filter="">
<File <File
RelativePath=".\forward.cpp"> RelativePath=".\forward.cpp">
@ -194,11 +195,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="hlsdk" Name="Pawn Includes"
Filter="">
</Filter>
<Filter
Name="Pawn includes"
Filter=""> Filter="">
<File <File
RelativePath="..\..\plugins\include\fakemeta.inc"> RelativePath="..\..\plugins\include\fakemeta.inc">
@ -211,7 +208,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="global" Name="Globals"
Filter=""> Filter="">
<File <File
RelativePath=".\glb.cpp"> RelativePath=".\glb.cpp">

View File

@ -13,6 +13,10 @@ int retType = 0;
int lastFmRes = FMRES_IGNORED; int lastFmRes = FMRES_IGNORED;
KVD_Wrapper g_kvd_hook; KVD_Wrapper g_kvd_hook;
cell origCellRet;
float origFloatRet;
const char *origStringRet;
#include "forwardmacros.h" #include "forwardmacros.h"
META_RES mswi(int fmres) META_RES mswi(int fmres)
@ -124,6 +128,110 @@ void TraceLine_post(const float *v1, const float *v2, int fNoMonsters, edict_t *
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void TraceToss(edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr)
{
gfm_tr = ptr;
FM_ENG_HANDLE(FM_TraceToss, (Engine[FM_TraceToss].at(i), ENTINDEX(pent), ENTINDEX(pentToIgnore), (cell)ptr));
RETURN_META(mswi(lastFmRes));
}
void TraceToss_post(edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr)
{
gfm_tr = ptr;
FM_ENG_HANDLE_POST(FM_TraceToss, (EnginePost[FM_TraceToss].at(i), ENTINDEX(pent), ENTINDEX(pentToIgnore), (cell)ptr));
RETURN_META(MRES_IGNORED);
}
int TraceMonsterHull(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE(FM_TraceMonsterHull, (Engine[FM_TraceMonsterHull].at(i), ENTINDEX(pEdict), p_v1, p_v2, fNoMonsters, ENTINDEX(pentToSkip), (cell)ptr));
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult);
}
int TraceMonsterHull_post(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
origCellRet = META_RESULT_ORIG_RET(int);
FM_ENG_HANDLE_POST(FM_TraceMonsterHull, (EnginePost[FM_TraceMonsterHull].at(i), ENTINDEX(pEdict), p_v1, p_v2, fNoMonsters, ENTINDEX(pentToSkip), (cell)ptr));
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult);
}
void TraceHull(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE(FM_TraceHull, (Engine[FM_TraceHull].at(i), p_v1, p_v2, fNoMonsters, hullNumber, ENTINDEX(pentToSkip), (cell)ptr));
RETURN_META(mswi(lastFmRes));
}
void TraceHull_post(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE_POST(FM_TraceHull, (EnginePost[FM_TraceHull].at(i), p_v1, p_v2, fNoMonsters, hullNumber, ENTINDEX(pentToSkip), (cell)ptr));
RETURN_META(MRES_IGNORED);
}
void TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE(FM_TraceModel, (Engine[FM_TraceModel].at(i), p_v1, p_v2, hullNumber, ENTINDEX(pent), ptr));
RETURN_META(mswi(lastFmRes));
}
void TraceModel_post(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE_POST(FM_TraceModel, (EnginePost[FM_TraceModel].at(i), p_v1, p_v2, hullNumber, ENTINDEX(pent), ptr));
RETURN_META(MRES_IGNORED);
}
const char *TraceTexture(edict_t *pTextureEntity, const float *v1, const float *v2)
{
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE(FM_TraceTexture, (Engine[FM_TraceTexture].at(i), ENTINDEX(pTextureEntity), p_v1, p_v2));
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult);
}
const char *TraceTexture_post(edict_t *pTextureEntity, const float *v1, const float *v2)
{
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
origStringRet = META_RESULT_ORIG_RET(const char *);
FM_ENG_HANDLE_POST(FM_TraceTexture, (EnginePost[FM_TraceTexture].at(i), ENTINDEX(pTextureEntity), p_v1, p_v2));
RETURN_META_VALUE(MRES_IGNORED, mlStringResult);
}
void TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE(FM_TraceSphere, (Engine[FM_TraceSphere].at(i), p_v1, p_v2, fNoMonsters, radius, ENTINDEX(pentToSkip), (cell)ptr));
RETURN_META(mswi(lastFmRes));
}
void TraceSphere_post(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr)
{
gfm_tr = ptr;
PREPARE_VECTOR(v1);
PREPARE_VECTOR(v2);
FM_ENG_HANDLE_POST(FM_TraceSphere, (EnginePost[FM_TraceSphere].at(i), p_v1, p_v2, fNoMonsters, radius, ENTINDEX(pentToSkip), (cell)ptr));
RETURN_META(MRES_IGNORED);
}
/* /*
// Passed to pfnKeyValue // Passed to pfnKeyValue
@ -188,36 +296,30 @@ SIMPLE_FLOAT_HOOK_CONSTVECT(VecToYaw);
void VecToAngles(const float *rgflVectorIn, float *rgflVectorOut) void VecToAngles(const float *rgflVectorIn, float *rgflVectorOut)
{ {
cell vec1[3] = {amx_ftoc(rgflVectorIn[0]), amx_ftoc(rgflVectorIn[1]), amx_ftoc(rgflVectorIn[2])}; PREPARE_VECTOR(rgflVectorIn);
cell vec2[3] = {amx_ftoc(rgflVectorOut[0]), amx_ftoc(rgflVectorOut[1]), amx_ftoc(rgflVectorOut[2])};; PREPARE_VECTOR(rgflVectorOut);
cell retvec1 = MF_PrepareCellArray(vec1, 3); FM_ENG_HANDLE(FM_VecToAngles, (Engine[FM_VecToAngles].at(i), p_rgflVectorIn, p_rgflVectorOut));
cell retvec2 = MF_PrepareCellArray(vec2, 3);
FM_ENG_HANDLE(FM_VecToAngles, (Engine[FM_VecToAngles].at(i), retvec1, retvec2));
RETURN_META(mswi(lastFmRes)); RETURN_META(mswi(lastFmRes));
} }
void VecToAngles_post(const float *rgflVectorIn, float *rgflVectorOut) void VecToAngles_post(const float *rgflVectorIn, float *rgflVectorOut)
{ {
cell vec1[3] = {amx_ftoc(rgflVectorIn[0]), amx_ftoc(rgflVectorIn[1]), amx_ftoc(rgflVectorIn[2])}; PREPARE_VECTOR(rgflVectorIn);
cell vec2[3] = {amx_ftoc(rgflVectorOut[0]), amx_ftoc(rgflVectorOut[1]), amx_ftoc(rgflVectorOut[2])};; PREPARE_VECTOR(rgflVectorOut);
cell retvec1 = MF_PrepareCellArray(vec1, 3); FM_ENG_HANDLE_POST(FM_VecToAngles, (EnginePost[FM_VecToAngles].at(i), p_rgflVectorIn, p_rgflVectorOut));
cell retvec2 = MF_PrepareCellArray(vec2, 3);
FM_ENG_HANDLE_POST(FM_VecToAngles, (EnginePost[FM_VecToAngles].at(i), retvec1, retvec2));
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void MoveToOrigin(edict_t *ent, const float *pflGoal, float dist, int iMoveType) void MoveToOrigin(edict_t *ent, const float *pflGoal, float dist, int iMoveType)
{ {
cell vec[3] = {amx_ftoc(pflGoal[0]), amx_ftoc(pflGoal[1]), amx_ftoc(pflGoal[2])}; PREPARE_VECTOR(pflGoal);
cell retvec = MF_PrepareCellArray(vec, 3); FM_ENG_HANDLE(FM_MoveToOrigin, (Engine[FM_MoveToOrigin].at(i), ENTINDEX(ent), p_pflGoal, dist, iMoveType));
FM_ENG_HANDLE(FM_MoveToOrigin, (Engine[FM_MoveToOrigin].at(i), ENTINDEX(ent), retvec, dist, iMoveType));
RETURN_META(mswi(lastFmRes)); RETURN_META(mswi(lastFmRes));
} }
void MoveToOrigin_post(edict_t *ent, const float *pflGoal, float dist, int iMoveType) void MoveToOrigin_post(edict_t *ent, const float *pflGoal, float dist, int iMoveType)
{ {
cell vec[3] = {amx_ftoc(pflGoal[0]), amx_ftoc(pflGoal[1]), amx_ftoc(pflGoal[2])}; PREPARE_VECTOR(pflGoal);
cell retvec = MF_PrepareCellArray(vec, 3); FM_ENG_HANDLE_POST(FM_MoveToOrigin, (EnginePost[FM_MoveToOrigin].at(i), ENTINDEX(ent), p_pflGoal, dist, iMoveType));
FM_ENG_HANDLE_POST(FM_MoveToOrigin, (EnginePost[FM_MoveToOrigin].at(i), ENTINDEX(ent), retvec, dist, iMoveType));
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
@ -229,6 +331,7 @@ edict_t *FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszFiel
edict_t *FindEntityByString_post(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue) edict_t *FindEntityByString_post(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue)
{ {
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *));
FM_ENG_HANDLE_POST(FM_FindEntityByString, (EnginePost[FM_FindEntityByString].at(i), ENTINDEX(pEdictStartSearchAfter), pszField, pszValue)); FM_ENG_HANDLE_POST(FM_FindEntityByString, (EnginePost[FM_FindEntityByString].at(i), ENTINDEX(pEdictStartSearchAfter), pszField, pszValue));
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult));
} }
@ -274,6 +377,9 @@ SIMPLE_INT_HOOK_EDICT(EntIsOnFloor);
// pfnDropToFloor // pfnDropToFloor
SIMPLE_INT_HOOK_EDICT(DropToFloor); SIMPLE_INT_HOOK_EDICT(DropToFloor);
// pfnWalkMove
SIMPLE_INT_HOOK_EDICT_FLOAT_FLOAT_INT(WalkMove);
// pfnSetOrigin // pfnSetOrigin
SIMPLE_VOID_HOOK_EDICT_CONSTVECT(SetOrigin); SIMPLE_VOID_HOOK_EDICT_CONSTVECT(SetOrigin);
@ -350,6 +456,38 @@ SIMPLE_INT_HOOK_CONSTSTRING_INT(RegUserMsg);
// pfnAnimationAutomove // pfnAnimationAutomove
SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT(AnimationAutomove); SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT(AnimationAutomove);
void GetBonePosition(const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles)
{
PREPARE_VECTOR(rgflOrigin);
PREPARE_VECTOR(rgflAngles);
FM_ENG_HANDLE(FM_GetBonePosition, (Engine[FM_GetBonePosition].at(i), ENTINDEX(pEdict), iBone, p_rgflOrigin, p_rgflAngles));
RETURN_META(mswi(lastFmRes));
}
void GetBonePosition_post(const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles)
{
PREPARE_VECTOR(rgflOrigin);
PREPARE_VECTOR(rgflAngles);
FM_ENG_HANDLE_POST(FM_GetBonePosition, (EnginePost[FM_GetBonePosition].at(i), ENTINDEX(pEdict), iBone, p_rgflOrigin, p_rgflAngles));
RETURN_META(MRES_IGNORED);
}
void GetAttachment(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles)
{
PREPARE_VECTOR(rgflOrigin);
PREPARE_VECTOR(rgflAngles);
FM_ENG_HANDLE(FM_GetAttachment, (Engine[FM_GetAttachment].at(i), ENTINDEX(pEdict), iAttachment, p_rgflOrigin, p_rgflAngles));
RETURN_META(mswi(lastFmRes));
}
void GetAttachment_post(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles)
{
PREPARE_VECTOR(rgflOrigin);
PREPARE_VECTOR(rgflAngles);
FM_ENG_HANDLE_POST(FM_GetAttachment, (EnginePost[FM_GetAttachment].at(i), ENTINDEX(pEdict), iAttachment, p_rgflOrigin, p_rgflAngles));
RETURN_META(MRES_IGNORED);
}
// pfnSetView // pfnSetView
SIMPLE_VOID_HOOK_CONSTEDICT_CONSTEDICT(SetView); SIMPLE_VOID_HOOK_CONSTEDICT_CONSTEDICT(SetView);
@ -385,9 +523,64 @@ HOOK_PLAYBACK_EVENT(PlaybackEvent);
// pfnCreateFakeClient // pfnCreateFakeClient
SIMPLE_EDICT_HOOK_CONSTSTRING(CreateFakeClient); SIMPLE_EDICT_HOOK_CONSTSTRING(CreateFakeClient);
void RunPlayerMove(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec)
{
PREPARE_VECTOR(viewangles);
FM_ENG_HANDLE(FM_RunPlayerMove, (Engine[FM_RunPlayerMove].at(i), ENTINDEX(fakeclient), p_viewangles, forwardmove, sidemove, upmove, buttons, impulse, msec));
RETURN_META(mswi(lastFmRes));
}
void RunPlayerMove_post(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec)
{
PREPARE_VECTOR(viewangles);
FM_ENG_HANDLE_POST(FM_RunPlayerMove, (EnginePost[FM_RunPlayerMove].at(i), ENTINDEX(fakeclient), p_viewangles, forwardmove, sidemove, upmove, buttons, impulse, msec));
RETURN_META(MRES_IGNORED);
}
// pfnNumberOfEntities // pfnNumberOfEntities
SIMPLE_INT_HOOK_VOID(NumberOfEntities); SIMPLE_INT_HOOK_VOID(NumberOfEntities);
void StaticDecal(const float *origin, int decalIndex, int entityIndex, int modelIndex)
{
PREPARE_VECTOR(origin);
FM_ENG_HANDLE(FM_StaticDecal, (Engine[FM_StaticDecal].at(i), p_origin, decalIndex, entityIndex, modelIndex));
RETURN_META(mswi(lastFmRes));
}
void StaticDecal_post(const float *origin, int decalIndex, int entityIndex, int modelIndex)
{
PREPARE_VECTOR(origin);
FM_ENG_HANDLE_POST(FM_StaticDecal, (EnginePost[FM_StaticDecal].at(i), p_origin, decalIndex, entityIndex, modelIndex));
RETURN_META(MRES_IGNORED);
}
void BuildSoundMsg(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
{
PREPARE_VECTOR(pOrigin);
FM_ENG_HANDLE(FM_BuildSoundMsg, (Engine[FM_BuildSoundMsg].at(i), ENTINDEX(entity), channel, sample, volume, attenuation, fFlags, pitch, msg_dest, msg_type, p_pOrigin, ENTINDEX(ed)));
RETURN_META(mswi(lastFmRes));
}
void BuildSoundMsg_post(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
{
PREPARE_VECTOR(pOrigin);
FM_ENG_HANDLE_POST(FM_BuildSoundMsg, (EnginePost[FM_BuildSoundMsg].at(i), ENTINDEX(entity), channel, sample, volume, attenuation, fFlags, pitch, msg_dest, msg_type, p_pOrigin, ENTINDEX(ed)));
RETURN_META(MRES_IGNORED);
}
int CheckVisibility(const edict_t *entity, unsigned char *pset)
{
FM_ENG_HANDLE(FM_CheckVisibility, (Engine[FM_CheckVisibility].at(i), ENTINDEX(entity), pset));
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult);
}
int CheckVisibility_post(const edict_t *entity, unsigned char *pset)
{
origCellRet = META_RESULT_ORIG_RET(int);
FM_ENG_HANDLE(FM_CheckVisibility, (Engine[FM_CheckVisibility].at(i), ENTINDEX(entity), pset));
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult);
}
// pfnGetCurrentPlayer // pfnGetCurrentPlayer
SIMPLE_INT_HOOK_VOID(GetCurrentPlayer); SIMPLE_INT_HOOK_VOID(GetCurrentPlayer);
@ -509,7 +702,6 @@ SIMPLE_VOID_HOOK_VOID(GameShutdown);
SIMPLE_INT_HOOK_EDICT_EDICT(ShouldCollide); SIMPLE_INT_HOOK_EDICT_EDICT(ShouldCollide);
static cell AMX_NATIVE_CALL unregister_forward(AMX *amx, cell *params) static cell AMX_NATIVE_CALL unregister_forward(AMX *amx, cell *params)
{ {
int func = params[1]; int func = params[1];
@ -683,7 +875,7 @@ 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); 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);
@ -703,27 +895,27 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
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); 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); 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); 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); 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); 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); 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);
@ -843,12 +1035,12 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
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); 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); ENGHOOK(GetAttachment);
break; break;
case FM_SetView: case FM_SetView:
@ -882,7 +1074,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
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); ENGHOOK(RunPlayerMove);
break; break;
case FM_NumberOfEntities: case FM_NumberOfEntities:
@ -891,7 +1083,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
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); ENGHOOK(StaticDecal);
break; break;
case FM_PrecacheGeneric: case FM_PrecacheGeneric:
@ -900,7 +1092,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
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); 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);
@ -925,7 +1117,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
//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); ENGHOOK(CheckVisibility);
break; break;
case FM_GetCurrentPlayer: case FM_GetCurrentPlayer:
@ -1171,9 +1363,32 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
return fId; return fId;
} }
static cell AMX_NATIVE_CALL get_orig_retval(AMX *amx, cell *params)
{
int paramCount = params[0] / sizeof(cell);
cell *refFloatRet = 0;
switch (paramCount)
{
case 0:
return origCellRet;
case 1:
refFloatRet = MF_GetAmxAddr(amx, params[1]);
*refFloatRet = amx_ftoc(origFloatRet);
return 1;
case 2:
MF_SetAmxString(amx, params[1], origStringRet, params[2]);
return 1;
default:
MF_LogError(amx, AMX_ERR_NATIVE, "Too many parameters passed");
return 0;
}
}
AMX_NATIVE_INFO forward_natives[] = { AMX_NATIVE_INFO forward_natives[] = {
{ "register_forward", register_forward }, { "register_forward", register_forward },
{ "unregister_forward", unregister_forward }, { "unregister_forward", unregister_forward },
{ "forward_return", fm_return }, { "forward_return", fm_return },
{ "get_orig_retval", get_orig_retval },
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -14,150 +14,147 @@
enum { enum {
FM_FIRST_DONT_USE_ME = 0, FM_FIRST_DONT_USE_ME = 0,
FM_PrecacheModel = 1, // done FM_PrecacheModel ,
FM_PrecacheSound, // done FM_PrecacheSound,
FM_SetModel, // done FM_SetModel,
FM_ModelIndex, // done FM_ModelIndex,
FM_ModelFrames, // done FM_ModelFrames,
FM_SetSize, // done FM_SetSize,
FM_ChangeLevel, // done FM_ChangeLevel,
FM_VecToYaw, // done FM_VecToYaw,
FM_VecToAngles, // done FM_VecToAngles,
FM_MoveToOrigin, // done FM_MoveToOrigin,
FM_ChangeYaw, // done FM_ChangeYaw,
FM_ChangePitch, // done FM_ChangePitch,
FM_FindEntityByString, // done FM_FindEntityByString,
FM_GetEntityIllum, // done FM_GetEntityIllum,
FM_FindEntityInSphere, // done FM_FindEntityInSphere,
FM_FindClientInPVS, // done FM_FindClientInPVS,
FM_EntitiesInPVS, // done FM_EntitiesInPVS,
FM_MakeVectors, // done FM_MakeVectors,
FM_AngleVectors, // done FM_AngleVectors,
FM_CreateEntity, // done FM_CreateEntity,
FM_RemoveEntity, // done FM_RemoveEntity,
FM_CreateNamedEntity, // done FM_CreateNamedEntity,
FM_MakeStatic, // done FM_MakeStatic,
FM_EntIsOnFloor, // done FM_EntIsOnFloor,
FM_DropToFloor, // done FM_DropToFloor,
FM_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode); FM_WalkMove,
FM_SetOrigin, // done FM_SetOrigin,
FM_EmitSound, // done FM_EmitSound,
FM_EmitAmbientSound, // done FM_EmitAmbientSound,
FM_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); FM_TraceLine,
FM_TraceToss, // void ) (edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr); FM_TraceToss,
FM_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); FM_TraceMonsterHull,
FM_TraceHull, // void ) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); FM_TraceHull,
FM_TraceModel, // void ) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr); FM_TraceModel,
FM_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 ); FM_TraceTexture,
FM_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); FM_TraceSphere,
FM_GetAimVector, // void ) (edict_t* ent, float speed, float *rgflReturn); FM_GetAimVector,
FM_ParticleEffect, // done FM_ParticleEffect,
FM_LightStyle, // done FM_LightStyle,
FM_DecalIndex, // done FM_DecalIndex,
FM_PointContents, // done FM_PointContents,
FM_MessageBegin, // done FM_MessageBegin,
FM_MessageEnd, // done FM_MessageEnd,
FM_WriteByte, // done FM_WriteByte,
FM_WriteChar, // done FM_WriteChar,
FM_WriteShort, // done FM_WriteShort,
FM_WriteLong, // done FM_WriteLong,
FM_WriteAngle, // done FM_WriteAngle,
FM_WriteCoord, // done FM_WriteCoord,
FM_WriteString, // done FM_WriteString,
FM_WriteEntity, // done FM_WriteEntity,
FM_CVarGetFloat, // done FM_CVarGetFloat,
FM_CVarGetString, // done FM_CVarGetString,
FM_CVarSetFloat, // done FM_CVarSetFloat,
FM_CVarSetString, // done FM_CVarSetString,
FM_FreeEntPrivateData, // done FM_FreeEntPrivateData,
FM_SzFromIndex, // done FM_SzFromIndex,
FM_AllocString, // done FM_AllocString,
FM_RegUserMsg, // done FM_RegUserMsg,
FM_AnimationAutomove, // done FM_AnimationAutomove,
FM_GetBonePosition, // void ) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles ); FM_GetBonePosition,
FM_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); FM_GetAttachment,
FM_SetView, // done FM_SetView,
FM_Time, // done FM_Time,
FM_CrosshairAngle, // done FM_CrosshairAngle,
FM_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); FM_FadeClientVolume,
FM_SetClientMaxspeed, // done FM_SetClientMaxspeed,
FM_CreateFakeClient, // done FM_CreateFakeClient,
FM_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); FM_RunPlayerMove,
FM_NumberOfEntities, // done FM_NumberOfEntities,
FM_StaticDecal, // void ) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); FM_StaticDecal,
FM_PrecacheGeneric, // done FM_PrecacheGeneric,
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,
FM_GetPhysicsKeyValue, // done FM_GetPhysicsKeyValue,
FM_SetPhysicsKeyValue, // done FM_SetPhysicsKeyValue,
FM_GetPhysicsInfoString,// done FM_GetPhysicsInfoString,
FM_PrecacheEvent, // done FM_PrecacheEvent,
FM_PlaybackEvent, // done FM_PlaybackEvent,
FM_CheckVisibility, //) ( const edict_t *entity, unsigned char *pset ); FM_CheckVisibility,
FM_GetCurrentPlayer, // done FM_GetCurrentPlayer,
FM_CanSkipPlayer, // done FM_CanSkipPlayer,
FM_SetGroupMask, //done FM_SetGroupMask,
FM_Voice_GetClientListening, // done FM_Voice_GetClientListening,
FM_Voice_SetClientListening, // done FM_Voice_SetClientListening,
FM_InfoKeyValue, // done FM_InfoKeyValue,
FM_SetKeyValue, // done FM_SetKeyValue,
FM_SetClientKeyValue, // done FM_SetClientKeyValue,
FM_GetPlayerAuthId, // done FM_GetPlayerAuthId,
FM_GetPlayerWONId, // done FM_GetPlayerWONId,
FM_IsMapValid, // done FM_IsMapValid,
FM_Spawn,
FM_Think,
FM_Use,
FM_Touch,
FM_Blocked,
FM_KeyValue,
FM_SetAbsBox,
FM_ClientConnect,
// FM_GameInit, // Removed -- it will *never* be called after plugins are loaded FM_ClientDisconnect,
FM_Spawn, // done FM_ClientKill,
FM_Think, // done FM_ClientPutInServer,
FM_Use, // done FM_ClientCommand,
FM_Touch, // done
FM_Blocked, // done
FM_KeyValue, // void ) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
FM_SetAbsBox, // done
FM_ClientConnect, // done
FM_ClientDisconnect, // done FM_ServerDeactivate,
FM_ClientKill, // done
FM_ClientPutInServer, // done
FM_ClientCommand, // done
FM_ServerDeactivate, // done FM_PlayerPreThink,
FM_PlayerPostThink,
FM_PlayerPreThink, // done FM_StartFrame,
FM_PlayerPostThink, // done FM_ParmsNewLevel,
FM_ParmsChangeLevel,
FM_StartFrame, // done
FM_ParmsNewLevel, // 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, // done // This also gets called when the server is queried for information (for example, by a server browser tool)
FM_GetGameDescription,
// Spectator funcs // Spectator funcs
FM_SpectatorConnect, // done FM_SpectatorConnect,
FM_SpectatorDisconnect, // done FM_SpectatorDisconnect,
FM_SpectatorThink, // done FM_SpectatorThink,
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. // Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
FM_Sys_Error, // done FM_Sys_Error,
FM_PM_FindTextureType, // done FM_PM_FindTextureType,
FM_RegisterEncoders, // done FM_RegisterEncoders,
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
// Create baselines for certain "unplaced" items. // Create baselines for certain "unplaced" items.
FM_CreateInstancedBaselines, // done FM_CreateInstancedBaselines,
FM_AllowLagCompensation, // done
FM_AllowLagCompensation,
FM_AlertMessage, FM_AlertMessage,
// NEW_DLL_FUNCTIONS // NEW_DLL_FUNCTIONS:
FM_OnFreeEntPrivateData, FM_OnFreeEntPrivateData,
FM_GameShutdown, FM_GameShutdown,
FM_ShouldCollide, FM_ShouldCollide,
// FM_CvarValue FM_ClientInfoChanged, //passes id only
FM_ClientInfoChanged, FM_LAST_DONT_USE_ME
FM_LAST_DONT_USE_ME,
}; };
extern CVector<int> Engine[]; extern CVector<int> Engine[];

View File

@ -10,6 +10,7 @@
} \ } \
const char* call##_post () \ const char* call##_post () \
{ \ { \
origStringRet = META_RESULT_ORIG_RET(const char *); \
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, mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
} }
@ -22,6 +23,7 @@
} \ } \
const char* call##_post (int v) \ const char* call##_post (int v) \
{ \ { \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v)); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
} }
@ -34,6 +36,7 @@
} \ } \
const char* call##_post (const edict_t *e) \ const char* call##_post (const edict_t *e) \
{ \ { \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e))); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
} }
@ -45,6 +48,7 @@
} \ } \
const char* call##_post (const edict_t *e, const char *c) \ const char* call##_post (const edict_t *e, const char *c) \
{ \ { \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),c)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),c)); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
} }
@ -91,6 +95,7 @@
} \ } \
char* call##_post (char *c, char *cb) \ char* call##_post (char *c, char *cb) \
{ \ { \
origStringRet = META_RESULT_ORIG_RET(char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb)); \
RETURN_META_VALUE(MRES_IGNORED, (char*)mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED, (char*)mlStringResult); \
} }
@ -102,6 +107,7 @@
} \ } \
const char* call##_post (edict_t *e) \ const char* call##_post (edict_t *e) \
{ \ { \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX(e))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX(e))); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
} }
@ -127,6 +133,7 @@
} \ } \
int call##_post (char *s) \ int call##_post (char *s) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
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); \
} }
@ -139,6 +146,7 @@
} \ } \
int call##_post (const char *s) \ int call##_post (const char *s) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
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); \
} }
@ -151,6 +159,7 @@
} \ } \
edict_t* call##_post (const char *s) \ edict_t* call##_post (const char *s) \
{ \ { \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \ RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
} }
@ -162,6 +171,7 @@
} \ } \
char call##_post (char *s) \ char call##_post (char *s) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(char); \
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, (char)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (char)mlCellResult); \
} }
@ -221,6 +231,7 @@
} \ } \
int call##_post (const char *s, int v) \ int call##_post (const char *s, int v) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, (cell)v)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, (cell)v)); \
RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult); \
} }
@ -246,6 +257,7 @@
} \ } \
unsigned short call##_post (int v,const char *s) \ unsigned short call##_post (int v,const char *s) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(unsigned short); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v, s)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v, s)); \
RETURN_META_VALUE(MRES_IGNORED,(unsigned short)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED,(unsigned short)mlCellResult); \
} }
@ -333,6 +345,7 @@
} \ } \
edict_t* call##_post () \ edict_t* call##_post () \
{ \ { \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
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,INDEXENT2((int)mlCellResult)); \ RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
} }
@ -344,6 +357,7 @@
} \ } \
edict_t* call##_post (int v) \ edict_t* call##_post (int v) \
{ \ { \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),v)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),v)); \
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \ RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
} }
@ -356,6 +370,7 @@
} \ } \
edict_t* call##_post (edict_t *e) \ edict_t* call##_post (edict_t *e) \
{ \ { \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX(e))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX(e))); \
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \ RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
} }
@ -370,6 +385,7 @@
edict_t* call##_post (edict_t *ed, const float *vec, float fla) \ edict_t* call##_post (edict_t *ed, const float *vec, float fla) \
{ \ { \
PREPARE_VECTOR(vec); \ PREPARE_VECTOR(vec); \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(ed), p_vec, fla)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(ed), p_vec, fla)); \
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \ RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
} }
@ -419,6 +435,7 @@
} \ } \
int call##_post (edict_t *pent) \ int call##_post (edict_t *pent) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
@ -430,6 +447,7 @@
} \ } \
unsigned int call##_post (edict_t *pent) \ unsigned int call##_post (edict_t *pent) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(unsigned int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent))); \
RETURN_META_VALUE(MRES_IGNORED, (unsigned int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (unsigned int)mlCellResult); \
} }
@ -442,6 +460,7 @@
} \ } \
int call##_post (const edict_t *pent) \ int call##_post (const edict_t *pent) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX((edict_t*)pent))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX((edict_t*)pent))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
@ -454,6 +473,7 @@
} \ } \
int call##_post (int v) \ int call##_post (int v) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
@ -478,6 +498,7 @@
} \ } \
qboolean call##_post (int v, int vb) \ qboolean call##_post (int v, int vb) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(qboolean); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \
} }
@ -490,6 +511,7 @@
} \ } \
qboolean call##_post (int v, int vb, qboolean bah) \ qboolean call##_post (int v, int vb, qboolean bah) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(qboolean); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb, (cell)(bah > 0 ? 1 : 0))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb, (cell)(bah > 0 ? 1 : 0))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \
} }
@ -502,6 +524,7 @@
} \ } \
int call##_post () \ int call##_post () \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
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); \
} }
@ -513,6 +536,7 @@
} \ } \
float call##_post () \ float call##_post () \
{ \ { \
origFloatRet = META_RESULT_ORIG_RET(float); \
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, (float)mFloatResult); \ RETURN_META_VALUE(MRES_IGNORED, (float)mFloatResult); \
} }
@ -528,6 +552,7 @@
int call##_post (const float *vec) \ int call##_post (const float *vec) \
{ \ { \
PREPARE_VECTOR(vec); \ PREPARE_VECTOR(vec); \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
@ -621,6 +646,7 @@
float call##_post (const float *vec) \ float call##_post (const float *vec) \
{ \ { \
PREPARE_VECTOR(vec); \ PREPARE_VECTOR(vec); \
origFloatRet = META_RESULT_ORIG_RET(float); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(MRES_IGNORED,mlFloatResult); \ RETURN_META_VALUE(MRES_IGNORED,mlFloatResult); \
} }
@ -632,6 +658,7 @@
} \ } \
float call##_post (const char *s) \ float call##_post (const char *s) \
{ \ { \
origFloatRet = META_RESULT_ORIG_RET(float); \
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,mlFloatResult); \ RETURN_META_VALUE(MRES_IGNORED,mlFloatResult); \
} }
@ -644,6 +671,7 @@
} \ } \
const char* call##_post (const char *s) \ const char* call##_post (const char *s) \
{ \ { \
origStringRet = META_RESULT_ORIG_RET(const char *); \
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,mlStringResult); \ RETURN_META_VALUE(MRES_IGNORED,mlStringResult); \
} }
@ -681,6 +709,7 @@
} \ } \
qboolean call##_post (edict_t *e, const char *sza, const char *szb, char blah[128]) \ qboolean call##_post (edict_t *e, const char *sza, const char *szb, char blah[128]) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(qboolean); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), sza, szb, blah)); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), sza, szb, blah)); \
RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult > 0 ? 0 : 1); \ RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult > 0 ? 0 : 1); \
} }
@ -743,20 +772,6 @@
RETURN_META(MRES_IGNORED); \ RETURN_META(MRES_IGNORED); \
} }
/*
#define SIMPLE_INT_HOOK_EDICT(call) \
int call (edict_t *pent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(pent))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (edict_t *pent) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(pent))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
*/
#define SIMPLE_INT_HOOK_EDICT_EDICT(call) \ #define SIMPLE_INT_HOOK_EDICT_EDICT(call) \
int call (edict_t *pent,edict_t *pentb) \ int call (edict_t *pent,edict_t *pentb) \
{ \ { \
@ -765,10 +780,24 @@
} \ } \
int call##_post (edict_t *pent,edict_t *pentb) \ int call##_post (edict_t *pent,edict_t *pentb) \
{ \ { \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent), (cell)ENTINDEX(pentb))); \ FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent), (cell)ENTINDEX(pentb))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \ RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} }
#define SIMPLE_INT_HOOK_EDICT_FLOAT_FLOAT_INT(call) \
int call (edict_t *pent, float f, float fb, int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(pent), f, fb, (cell)v)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (edict_t *pent, float f, float fb, int v) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent), f, fb, (cell)v)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} \
#define ENGHOOK(pfnCall) \ #define ENGHOOK(pfnCall) \
if (post) \ if (post) \
{ \ { \
@ -848,7 +877,10 @@
mlFloatResult = mFloatResult; \ mlFloatResult = mFloatResult; \
lastFmRes = fmres; \ lastFmRes = fmres; \
} \ } \
} } \
origCellRet = 0; \
origFloatRet = 0.0; \
origStringRet = "";

View File

@ -228,7 +228,7 @@
</Filter> </Filter>
</Filter> </Filter>
<Filter <Filter
Name="engfunc" Name="Engine Funcs"
> >
<File <File
RelativePath="..\dllfunc.cpp" RelativePath="..\dllfunc.cpp"
@ -248,7 +248,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="pev" Name="PEV"
> >
<File <File
RelativePath="..\pev.cpp" RelativePath="..\pev.cpp"
@ -267,7 +267,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="forward" Name="Forwards"
> >
<File <File
RelativePath="..\forward.cpp" RelativePath="..\forward.cpp"
@ -283,11 +283,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="hlsdk" Name="Pawn Includes"
>
</Filter>
<Filter
Name="Pawn includes"
> >
<File <File
RelativePath="..\..\..\plugins\include\fakemeta.inc" RelativePath="..\..\..\plugins\include\fakemeta.inc"
@ -303,7 +299,7 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="global" Name="Globals"
> >
<File <File
RelativePath="..\glb.cpp" RelativePath="..\glb.cpp"