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

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

View File

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

View File

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