Fix incorrect behavior of impulse forwards (bug 3243, r=Arkshine)

Former-commit-id: 1aae4c3ec5
This commit is contained in:
connorr 2013-07-03 00:19:12 +02:00
parent 6c2655c841
commit 90e7aa65a1
3 changed files with 17 additions and 21 deletions

View File

@ -34,7 +34,7 @@ void OnAmxxAttach()
PlayerPreThinkForward = 0;
PlayerPostThinkForward = 0;
ClientKillForward = 0;
CmdStartForward = 0;
ClientImpulseForward = 0;
StartFrameForward = 0;
MF_AddNatives(ent_Natives);
MF_AddNewNatives(ent_NewNatives);
@ -54,7 +54,7 @@ void OnPluginsLoaded()
PlayerPreThinkForward = MF_RegisterForward("client_PreThink", ET_STOP, FP_CELL, FP_DONE); // done
PlayerPostThinkForward = MF_RegisterForward("client_PostThink", ET_STOP, FP_CELL, FP_DONE); // done
ClientKillForward = MF_RegisterForward("client_kill", ET_STOP, FP_CELL, FP_DONE); // done
CmdStartForward = MF_RegisterForward("client_impulse", ET_STOP, FP_CELL, FP_CELL, FP_DONE); // done
ClientImpulseForward = MF_RegisterForward("client_impulse", ET_STOP, FP_CELL, 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

View File

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

View File

@ -10,7 +10,7 @@ int pfnThinkForward = 0;
int PlayerPreThinkForward = 0;
int PlayerPostThinkForward = 0;
int ClientKillForward = 0;
int CmdStartForward = 0;
int ClientImpulseForward = 0;
int StartFrameForward = 0;
int VexdTouchForward = 0;
int VexdServerForward = 0;
@ -131,27 +131,23 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
if (Impulses[i]->Check == g_cmd->impulse)
{
retVal = MF_ExecuteForward(Impulses[i]->Forward, (cell)ENTINDEX(pEntity), (cell)origImpulse);
if (retVal & 2 /*PLUGIN_HANDLED_MAIN*/)
{
g_cmd->impulse=0;
RETURN_META(MRES_SUPERCEDE);
}
else if (retVal)
res = MRES_SUPERCEDE;
}
}
if (CmdStartForward != -1) {
incmd = true;
retVal = MF_ExecuteForward(CmdStartForward, (cell)ENTINDEX(pEntity), (cell)origImpulse);
incmd = false;
if (retVal) {
// don't return SUPERCEDE in any way here,
// we don't want to break client_impulse forward and access to cmd with [g/s]et_usercmd
if (retVal)
g_cmd->impulse = 0;
RETURN_META(MRES_SUPERCEDE);
}
}
if (res == MRES_SUPERCEDE)
g_cmd->impulse=0;
RETURN_META(res);
if (ClientImpulseForward != -1 && origImpulse != 0)
{
retVal = MF_ExecuteForward(ClientImpulseForward, (cell)ENTINDEX(pEntity), (cell)origImpulse);
if (retVal)
g_cmd->impulse = 0;
}
RETURN_META(MRES_IGNORED);
}
void ClientKill(edict_t *pEntity)