Add client_cmdStart forward (bug 5779, r=me)

Former-commit-id: 785ce1ea81567e30a729954a74ded7fdfef1ef7c
This commit is contained in:
Vincent Herbet 2013-07-03 01:00:52 +02:00
parent 90e7aa65a1
commit 93339d9be4
4 changed files with 21 additions and 3 deletions

View File

@ -35,6 +35,7 @@ void OnAmxxAttach()
PlayerPostThinkForward = 0;
ClientKillForward = 0;
ClientImpulseForward = 0;
CmdStartForward = 0;
StartFrameForward = 0;
MF_AddNatives(ent_Natives);
MF_AddNewNatives(ent_NewNatives);
@ -55,6 +56,7 @@ void OnPluginsLoaded()
PlayerPostThinkForward = MF_RegisterForward("client_PostThink", ET_STOP, FP_CELL, FP_DONE); // done
ClientKillForward = MF_RegisterForward("client_kill", ET_STOP, FP_CELL, FP_DONE); // done
ClientImpulseForward = MF_RegisterForward("client_impulse", ET_STOP, FP_CELL, FP_CELL, FP_DONE); // done
CmdStartForward = MF_RegisterForward("client_cmdStart", ET_STOP, FP_CELL, FP_DONE); // done
StartFrameForward = MF_RegisterForward("server_frame", ET_IGNORE, FP_DONE); // done
DispatchKeyForward = MF_RegisterForward("pfn_keyvalue", ET_STOP, FP_CELL, FP_DONE); // done
PlaybackForward = MF_RegisterForward("pfn_playbackevent", ET_STOP, 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); // done
@ -92,8 +94,8 @@ void OnPluginsLoaded()
if (CheckForPublic("client_kill"))
g_pFunctionTable->pfnClientKill=ClientKill;
g_pFunctionTable->pfnCmdStart=NULL; // "client_impulse","register_impulse"
if (CheckForPublic("client_impulse"))
g_pFunctionTable->pfnCmdStart=NULL; // "client_impulse","register_impulse","client_cmdStart"
if (CheckForPublic("client_impulse") || CheckForPublic("client_cmdStart"))
g_pFunctionTable->pfnCmdStart=CmdStart;
g_pFunctionTable->pfnThink=NULL; // "pfn_think", "register_think"

View File

@ -28,6 +28,7 @@ extern int PlayerPreThinkForward;
extern int PlayerPostThinkForward;
extern int ClientKillForward;
extern int ClientImpulseForward;
extern int CmdStartForward;
extern int StartFrameForward;
extern int DispatchUseForward;
extern int VexdTouchForward;

View File

@ -11,6 +11,7 @@ int PlayerPreThinkForward = 0;
int PlayerPostThinkForward = 0;
int ClientKillForward = 0;
int ClientImpulseForward = 0;
int CmdStartForward = 0;
int StartFrameForward = 0;
int VexdTouchForward = 0;
int VexdServerForward = 0;
@ -124,7 +125,6 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
int retVal = 0;
edict_t *pEntity = (edict_t *)player;
g_cmd = (struct usercmd_s *)_cmd;
META_RES res = MRES_IGNORED;
int origImpulse = g_cmd->impulse; // incase a plugin alters it
for (i=0; i<Impulses.size(); i++)
{
@ -139,6 +139,7 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
}
}
// client_impulse
if (ClientImpulseForward != -1 && origImpulse != 0)
{
retVal = MF_ExecuteForward(ClientImpulseForward, (cell)ENTINDEX(pEntity), (cell)origImpulse);
@ -147,6 +148,17 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
g_cmd->impulse = 0;
}
// client_CmdStart
if (CmdStartForward != -1)
{
incmd = true;
retVal = MF_ExecuteForward(CmdStartForward, (cell)ENTINDEX(pEntity));
incmd = false;
if (retVal)
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}

View File

@ -207,6 +207,9 @@ forward client_PostThink(id);
/* Forward for impulses. */
forward client_impulse(id, impulse);
/* Forward for CmdStart() on a player. */
forward client_cmdStart(id);
/* Called when an entity "thinks" (DispatchThink) */
forward pfn_think(entid);