Removed un-needed calls

Added a few more calls (over 50% are done!)
This commit is contained in:
Steve Dudenhoeffer 2004-08-06 04:30:10 +00:00
parent 9d3ffda996
commit 2c4be26756
3 changed files with 103 additions and 230 deletions

View File

@ -103,14 +103,10 @@ void OnPluginsLoaded()
RESETE(SetGroupMask);
RESETE(Voice_GetClientListening);
RESETE(Voice_SetClientListening);
RESETE(MessageBegin);
RESETE(WriteCoord);
RESETE(WriteAngle);
RESETE(InfoKeyValue);
RESETE(SetKeyValue);
RESETE(SetClientKeyValue);
RESETD(GameInit);
RESETD(Spawn);
RESETD(Think);
RESETD(Use);

View File

@ -12,162 +12,7 @@ const char *mlStringResult;
int retType = 0;
int lastFmRes = FMRES_IGNORED;
#define SIMPLE_INT_HOOK_STRING(call) \
int call (char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_CONSTSTRING(call) \
int call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_EDICT(call) \
void call (edict_t *ent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(ent))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *ent) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(ent))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT_EDICT(call) \
void call (edict_t *ent,edict_t *entb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(ent), ENTINDEX(entb))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *ent,edict_t *entb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(ent), ENTINDEX(entb))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_VOID(call) \
void call (void) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (void) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
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_INT(call) \
int call (int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (int v) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_VOID(call) \
int call () \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post () \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define ENGHOOK(pfnCall) \
if (post) \
{ \
if (engtable->pfn##pfnCall == NULL) \
engtable->pfn##pfnCall = pfnCall##_post; \
} \
else \
{ \
if (engtable->pfn##pfnCall == NULL) \
engtable->pfn##pfnCall = pfnCall; \
}
#define DLLHOOK(pfnCall) \
if (post) \
{ \
if (dlltable->pfn##pfnCall == NULL) \
dlltable->pfn##pfnCall = pfnCall##_post; \
} \
else \
{ \
if (dlltable->pfn##pfnCall == NULL) \
dlltable->pfn##pfnCall = pfnCall; \
}
#define FM_ENG_HANDLE(pfnCall, pfnArgs) \
register unsigned int i = 0; \
clfm(); \
int fmres = FMRES_IGNORED; \
for (i=0; i<Engine[pfnCall].size(); i++) \
{ \
fmres = MF_ExecuteForward pfnArgs; \
if (fmres >= lastFmRes) { \
if (retType == FMV_STRING) \
mlStringResult = mStringResult; \
else if (retType == FMV_CELL) \
mlCellResult = mCellResult; \
else if (retType == FMV_FLOAT) \
mlFloatResult = mFloatResult; \
lastFmRes = fmres; \
} \
}
#define FM_ENG_HANDLE_POST(pfnCall, pfnArgs) \
register unsigned int i = 0; \
clfm(); \
int fmres = FMRES_IGNORED; \
for (i=0; i<EnginePost[pfnCall].size(); i++) \
{ \
fmres = MF_ExecuteForward pfnArgs; \
if (fmres >= lastFmRes) { \
if (retType == FMV_STRING) \
mlStringResult = mStringResult; \
else if (retType == FMV_CELL) \
mlCellResult = mCellResult; \
else if (retType == FMV_FLOAT) \
mlFloatResult = mFloatResult; \
lastFmRes = fmres; \
} \
}
#include "forwardmacros.h"
META_RES mswi(int fmres)
{
@ -347,9 +192,15 @@ SIMPLE_VOID_HOOK_EDICT(ChangeYaw);
// pfnChangePitch
SIMPLE_VOID_HOOK_EDICT(ChangePitch);
// pfnCreateEntity
SIMPLE_EDICT_HOOK_VOID(CreateEntity);
// pfnRemoveEntity
SIMPLE_VOID_HOOK_EDICT(RemoveEntity);
// pfnCreateNamedEntity
SIMPLE_EDICT_HOOK_INT(CreateNamedEntity);
// pfnMakeStatic
SIMPLE_VOID_HOOK_EDICT(MakeStatic);
@ -359,10 +210,23 @@ SIMPLE_INT_HOOK_EDICT(EntIsOnFloor);
// pfnDropToFloor
SIMPLE_INT_HOOK_EDICT(DropToFloor);
// pfnDecalIndex
SIMPLE_INT_HOOK_CONSTSTRING(DecalIndex);
// pfnFreeEntPrivateData
SIMPLE_VOID_HOOK_EDICT(FreeEntPrivateData);
// pfnAllocString
SIMPLE_INT_HOOK_CONSTSTRING(AllocString);
// pfnPrecacheGeneric
SIMPLE_INT_HOOK_STRING(PrecacheGeneric);
// pfnNumberOfEntities
SIMPLE_INT_HOOK_VOID(NumberOfEntities);
// pfnGetCurrentPlayer
SIMPLE_INT_HOOK_VOID(GetCurrentPlayer);
/*
* Beginning of Game DLL hooks
@ -416,6 +280,9 @@ SIMPLE_VOID_HOOK_VOID(ParmsNewLevel);
// pfnParmsChangeLevel
SIMPLE_VOID_HOOK_VOID(ParmsChangeLevel);
// pfnGetGameDescription
SIMPLE_CONSTSTRING_HOOK_VOID(GetGameDescription);
// pfnSpectatorConnect
SIMPLE_VOID_HOOK_EDICT(SpectatorConnect);
@ -425,11 +292,29 @@ SIMPLE_VOID_HOOK_EDICT(SpectatorDisconnect);
// pfnSpectatorThink
SIMPLE_VOID_HOOK_EDICT(SpectatorThink);
// pfnSys_Error
SIMPLE_VOID_HOOK_CONSTSTRING(Sys_Error);
// pfnPM_FindTextureType
SIMPLE_CHAR_HOOK_STRING(PM_FindTextureType);
// pfnRegisterEncoders
SIMPLE_VOID_HOOK_VOID(RegisterEncoders);
// pfnCreateInstancedBaselines
SIMPLE_VOID_HOOK_VOID(CreateInstancedBaselines);
// pfnAllowLagCompensation
SIMPLE_INT_HOOK_VOID(AllowLagCompensation);
static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
{
int func = params[1];
@ -534,6 +419,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
break;
case FM_CreateEntity:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
ENGHOOK(CreateEntity);
break;
case FM_RemoveEntity:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
@ -541,6 +427,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
break;
case FM_CreateNamedEntity:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(CreateNamedEntity);
break;
case FM_MakeStatic:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
@ -598,18 +485,21 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
break;
case FM_DecalIndex:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(DecalIndex);
break;
case FM_PointContents:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE);
break;
case FM_FreeEntPrivateData:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_ARRAY, FP_DONE);
ENGHOOK(FreeEntPrivateData);
break;
case FM_SzFromIndex:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
break;
case FM_AllocString:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(AllocString);
break;
case FM_RegUserMsg:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_CELL, FP_DONE);
@ -653,6 +543,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
break;
case FM_PrecacheGeneric:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(PrecacheGeneric);
break;
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);
@ -679,6 +570,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
//EngFunc_GetCurrentPlayer, //) ( void );
case FM_GetCurrentPlayer:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
ENGHOOK(GetCurrentPlayer);
break;
//EngFunc_CanSkipPlayer, //) ( const edict_t *player );
case FM_CanSkipPlayer:
@ -696,18 +588,6 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
case FM_Voice_SetClientListening:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_DONE); // TODO: bool as cell 3rd arg?
break;
//EngFunc_MessageBegin, // void (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
case FM_MessageBegin:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
break;
//EngFunc_WriteCoord, // void (float)
case FM_WriteCoord:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_FLOAT, FP_DONE);
break;
//EngFunc_WriteAngle, // void (float)
case FM_WriteAngle:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_FLOAT, FP_DONE);
break;
//EngFunc_InfoKeyValue, // char* ) (char *infobuffer, char *key);
case FM_InfoKeyValue:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_STRING, FP_DONE);
@ -725,10 +605,6 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
/*
* Begin of DLLFuncs
*/
//DLLFunc_GameInit, // void) ( void );
case FM_GameInit:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
break;
//DLLFunc_Spawn, // int ) ( edict_t *pent );
case FM_Spawn:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
@ -828,6 +704,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
//DLLFunc_GetGameDescription, // const char * )( void );
case FM_GetGameDescription:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(GetGameDescription);
break;
// Spectator funcs
@ -851,15 +728,18 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
//DLLFunc_Sys_Error, // void ) ( const char *error_string );
case FM_Sys_Error:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
DLLHOOK(Sys_Error);
break;
//DLLFunc_PM_FindTextureType, // char )( char *name );
case FM_PM_FindTextureType:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
DLLHOOK(PM_FindTextureType);
break;
//DLLFunc_RegisterEncoders, // void ) ( void );
case FM_RegisterEncoders:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(RegisterEncoders);
break;
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise

View File

@ -13,31 +13,31 @@
#define FMRES_OVERRIDE 3
enum {
FM_PrecacheModel = 1, // int ) (char* s);
FM_PrecacheSound, // int ) (char* s);
FM_SetModel, // void ) (edict_t *e, const char *m);
FM_ModelIndex, // int ) (const char *m);
FM_ModelFrames, // int ) (int modelIndex);
FM_SetSize, // void ) (edict_t *e, const float *rgflMin, const float *rgflMax);
FM_ChangeLevel, // void ) (char* s1, char* s2);
FM_VecToYaw, // float) (const float *rgflVector);
FM_VecToAngles, // void ) (const float *rgflVectorIn, float *rgflVectorOut);
FM_MoveToOrigin, // void ) (edict_t *ent, const float *pflGoal, float dist, int iMoveType);
FM_ChangeYaw, // void ) (edict_t* ent);
FM_ChangePitch, // void ) (edict_t* ent);
FM_FindEntityByString, // edict) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
FM_GetEntityIllum, // int ) (edict_t* pEnt);
FM_PrecacheModel = 1, // done
FM_PrecacheSound, // done
FM_SetModel, // done
FM_ModelIndex, // done
FM_ModelFrames, // done
FM_SetSize, // done
FM_ChangeLevel, // done
FM_VecToYaw, // done
FM_VecToAngles, // done
FM_MoveToOrigin, // done
FM_ChangeYaw, // done
FM_ChangePitch, // done
FM_FindEntityByString, // done
FM_GetEntityIllum, // done
FM_FindEntityInSphere, // edict) (edict_t *pEdictStartSearchAfter, const float *org, float rad);
FM_FindClientInPVS, // edict) (edict_t *pEdict);
FM_EntitiesInPVS, // edict) (edict_t *pplayer);
FM_MakeVectors, // void ) (const float *rgflVector);
FM_AngleVectors, // void ) (const float *rgflVector, float *forward, float *right, float *up);
FM_CreateEntity, // edict) (void);
FM_RemoveEntity, // void ) (edict_t* e);
FM_CreateNamedEntity, // edict) (int className);
FM_MakeStatic, // void ) (edict_t *ent);
FM_EntIsOnFloor, // int ) (edict_t *e);
FM_DropToFloor, // int ) (edict_t* e);
FM_CreateEntity, // done
FM_RemoveEntity, // done
FM_CreateNamedEntity, // done
FM_MakeStatic, // done
FM_EntIsOnFloor, // done
FM_DropToFloor, // done
FM_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode);
FM_SetOrigin, // void ) (edict_t *e, const float *rgflOrigin);
FM_EmitSound, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
@ -52,11 +52,11 @@ enum {
FM_GetAimVector, // void ) (edict_t* ent, float speed, float *rgflReturn);
FM_ParticleEffect, // void ) (const float *org, const float *dir, float color, float count);
FM_LightStyle, // void ) (int style, char* val);
FM_DecalIndex, // int ) (const char *name);
FM_DecalIndex, // done
FM_PointContents, // int ) (const float *rgflVector);
FM_FreeEntPrivateData, // void ) (edict_t *pEdict);
FM_FreeEntPrivateData, // done
FM_SzFromIndex, // const char * ) (int iString);
FM_AllocString, // int ) (const char *szValue);
FM_AllocString, // done
FM_RegUserMsg, // int ) (const char *pszName, int iSize);
FM_AnimationAutomove, // void ) (const edict_t* pEdict, float flTime);
FM_GetBonePosition, // void ) (const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
@ -68,9 +68,9 @@ enum {
FM_SetClientMaxspeed, // void ) (const edict_t *pEdict, float fNewMaxspeed);
FM_CreateFakeClient, // edict) (const char *netname); // returns NULL if fake client can't be created
FM_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
FM_NumberOfEntities, // int ) (void);
FM_NumberOfEntities, // done
FM_StaticDecal, // void ) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
FM_PrecacheGeneric, // int ) (char* s);
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_GetPhysicsKeyValue, // const char* ) ( const edict_t *pClient, const char *key );
FM_SetPhysicsKeyValue, // void ) ( const edict_t *pClient, const char *key, const char *value );
@ -83,59 +83,56 @@ enum {
FM_SetGroupMask, //) ( int mask, int op );
FM_Voice_GetClientListening, // bool (int iReceiver, int iSender)
FM_Voice_SetClientListening, // bool (int iReceiver, int iSender, bool Listen)
FM_MessageBegin, // void (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
FM_WriteCoord, // void (float)
FM_WriteAngle, // void (float)
FM_InfoKeyValue, // char* ) (char *infobuffer, char *key);
FM_SetKeyValue, // void ) (char *infobuffer, char *key, char *value);
FM_SetClientKeyValue, // void ) (int clientIndex, char *infobuffer, char *key, char *value);
FM_GameInit, // void) ( void );
FM_Spawn, // int ) ( edict_t *pent );
FM_Think, // void ) ( edict_t *pent );
FM_Use, // void ) ( edict_t *pentUsed, edict_t *pentOther );
FM_Touch, // void ) ( edict_t *pentTouched, edict_t *pentOther );
FM_Blocked, // void ) ( edict_t *pentBlocked, edict_t *pentOther );
// FM_GameInit, // Removed -- it will *never* be called after plugins are loaded
FM_Spawn, // done
FM_Think, // done
FM_Use, // done
FM_Touch, // done
FM_Blocked, // done
FM_KeyValue, // void ) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
FM_SetAbsBox, // void ) ( edict_t *pent );
FM_SetAbsBox, // done
FM_ClientConnect, // bool) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
FM_ClientDisconnect, // void ) ( edict_t *pEntity );
FM_ClientKill, // void ) ( edict_t *pEntity );
FM_ClientPutInServer, // void ) ( edict_t *pEntity );
FM_ClientCommand, // void ) ( edict_t *pEntity );
FM_ClientDisconnect, // done
FM_ClientKill, // done
FM_ClientPutInServer, // done
FM_ClientCommand, // done
FM_ServerDeactivate, // void) ( void );
FM_ServerDeactivate, // done
FM_PlayerPreThink, // void ) ( edict_t *pEntity );
FM_PlayerPostThink, // void ) ( edict_t *pEntity );
FM_PlayerPreThink, // done
FM_PlayerPostThink, // done
FM_StartFrame, // void ) ( void );
FM_ParmsNewLevel, // void ) ( void );
FM_ParmsChangeLevel, // void ) ( void );
FM_StartFrame, // done
FM_ParmsNewLevel, // done
FM_ParmsChangeLevel, // done
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
FM_GetGameDescription, // const char * )( void );
// Spectator funcs
FM_SpectatorConnect, // void) ( edict_t *pEntity );
FM_SpectatorDisconnect, // void ) ( edict_t *pEntity );
FM_SpectatorThink, // void ) ( edict_t *pEntity );
FM_SpectatorConnect, // done
FM_SpectatorDisconnect, // done
FM_SpectatorThink, // done
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
FM_Sys_Error, // void ) ( const char *error_string );
FM_Sys_Error, // done
FM_PM_FindTextureType, // char )( char *name );
FM_RegisterEncoders, // void ) ( void );
FM_PM_FindTextureType, // done
FM_RegisterEncoders, // done
// 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.
FM_CreateInstancedBaselines, // void ) ( void );
FM_AllowLagCompensation, // int )( void );
FM_CreateInstancedBaselines, // done
FM_AllowLagCompensation, // done
};
extern CVector<int> Engine[];