fixed all registered forwards

This commit is contained in:
Steve Dudenhoeffer 2004-08-31 05:02:19 +00:00
parent 813bc1a212
commit c6d2516df8
2 changed files with 34 additions and 29 deletions

View File

@ -901,9 +901,6 @@ AMX_NATIVE_INFO engine_Natives[] = {
//These are mostly from original VexD //These are mostly from original VexD
// TODO: Backwards compatibility: VelocityByAim->velocity_by_aim
// RadiusDamage->radius_damage
// PointContents->point_contents
{"velocity_by_aim", VelocityByAim}, {"velocity_by_aim", VelocityByAim},
{"radius_damage", RadiusDamage}, {"radius_damage", RadiusDamage},
{"point_contents", PointContents}, {"point_contents", PointContents},

View File

@ -93,13 +93,11 @@ void KeyValue(edict_t *pEntity, KeyValueData *pkvd)
if (DispatchKeyForward != -1) { if (DispatchKeyForward != -1) {
retVal = MF_ExecuteForward(DispatchKeyForward, index); retVal = MF_ExecuteForward(DispatchKeyForward, index);
g_inKeyValue=false; g_inKeyValue=false;
if (retVal > 0) if (retVal)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
else
RETURN_META(MRES_HANDLED);
} }
g_inKeyValue=false; g_inKeyValue=false;
RETURN_META(MRES_HANDLED); RETURN_META(MRES_IGNORED);
} }
void StartFrame() void StartFrame()
@ -125,23 +123,25 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
int retVal = 0; int retVal = 0;
edict_t *pEntity = (edict_t *)player; edict_t *pEntity = (edict_t *)player;
struct usercmd_s *g_cmd = (struct usercmd_s *)_cmd; struct usercmd_s *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++) for (i=0; i<Impulses.size(); i++)
{ {
if (Impulses[i]->Check == g_cmd->impulse) if (Impulses[i]->Check == g_cmd->impulse)
{ {
retVal = MF_ExecuteForward(Impulses[i]->Forward, ENTINDEX(pEntity)); retVal = MF_ExecuteForward(Impulses[i]->Forward, ENTINDEX(pEntity));
if (retVal) if (retVal & 2 /*PLUGIN_HANDLED_MAIN*/)
{ {
g_cmd->impulse=0; g_cmd->impulse=0;
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
else else if (retVal)
RETURN_META(MRES_IGNORED); res = MRES_SUPERCEDE;
} }
} }
if (CmdStartForward != -1) { if (CmdStartForward != -1) {
incmd = true; incmd = true;
retVal = MF_ExecuteForward(CmdStartForward, ENTINDEX(pEntity), g_cmd->impulse); retVal = MF_ExecuteForward(CmdStartForward, ENTINDEX(pEntity), origImpulse);
incmd = false; incmd = false;
if (retVal) { if (retVal) {
g_cmd->impulse = 0; g_cmd->impulse = 0;
@ -149,7 +149,7 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
} }
} }
RETURN_META(MRES_IGNORED); RETURN_META(res);
} }
void ClientKill(edict_t *pEntity) void ClientKill(edict_t *pEntity)
@ -225,6 +225,7 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
int retVal = 0; int retVal = 0;
const char *ptrClass = STRING(pToucher->v.classname); const char *ptrClass = STRING(pToucher->v.classname);
const char *ptdClass = STRING(pTouched->v.classname); const char *ptdClass = STRING(pTouched->v.classname);
META_RES res=MRES_IGNORED;
for (i=0; i<Touches.size(); i++) for (i=0; i<Touches.size(); i++)
{ {
if (Touches[i]->Toucher == 0) if (Touches[i]->Toucher == 0)
@ -232,31 +233,31 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
if (Touches[i]->Touched == 0) if (Touches[i]->Touched == 0)
{ {
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
if (retVal) if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
else else if (retVal)
RETURN_META(MRES_IGNORED); res=MRES_SUPERCEDE;
} else if (fstrcmp(Touches[i]->Touched, ptdClass)) { } else if (fstrcmp(Touches[i]->Touched, ptdClass)) {
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
if (retVal) if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
else else if (retVal)
RETURN_META(MRES_IGNORED); res=MRES_SUPERCEDE;
} }
} else if (fstrcmp(Touches[i]->Toucher, ptrClass)) { } else if (fstrcmp(Touches[i]->Toucher, ptrClass)) {
if (Touches[i]->Touched == 0) if (Touches[i]->Touched == 0)
{ {
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
if (retVal) if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
else else if (retVal)
RETURN_META(MRES_IGNORED); res=MRES_SUPERCEDE;
} else if (fstrcmp(Touches[i]->Touched, ptdClass)) { } else if (fstrcmp(Touches[i]->Touched, ptdClass)) {
retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched));
if (retVal) if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
else else if (retVal)
RETURN_META(MRES_IGNORED); res=MRES_SUPERCEDE;
} }
} }
} }
@ -271,22 +272,29 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }
RETURN_META(MRES_IGNORED); RETURN_META(res);
} }
void Think(edict_t *pent) void Think(edict_t *pent)
{ {
unsigned int i = 0; unsigned int i = 0;
const char *cls = STRING(pent->v.classname); const char *cls = STRING(pent->v.classname);
META_RES res=MRES_IGNORED;
int retVal=0;
for (i=0; i<Thinks.size(); i++) for (i=0; i<Thinks.size(); i++)
{ {
if (fstrcmp(cls, Thinks[i]->Class)) if (fstrcmp(cls, Thinks[i]->Class))
{ {
MF_ExecuteForward(Thinks[i]->Forward, ENTINDEX(pent)); retVal=MF_ExecuteForward(Thinks[i]->Forward, ENTINDEX(pent));
RETURN_META(MRES_IGNORED); if (retVal & 2/*PLUGIN_HANDLED_MAIN*/)
RETURN_META(MRES_SUPERCEDE);
else if (retVal)
res=MRES_SUPERCEDE;
} }
} }
MF_ExecuteForward(pfnThinkForward, ENTINDEX(pent)); retVal=MF_ExecuteForward(pfnThinkForward, ENTINDEX(pent));
if (retVal)
res=MRES_SUPERCEDE;
RETURN_META(MRES_IGNORED); RETURN_META(res);
} }