fix the player_speedmod button disable flags not working (for things like bhop_futile)

This commit is contained in:
rtldg 2021-12-17 00:56:18 +00:00
parent 51427be3e9
commit 1802dd8007

View File

@ -154,6 +154,9 @@ bool gB_CookiesRetrieved[MAXPLAYERS+1];
float gF_ZoneAiraccelerate[MAXPLAYERS+1];
float gF_ZoneSpeedLimit[MAXPLAYERS+1];
float gF_SpeedModGarbage;
int gI_SpeedModGarbage = 0;
// kz support
bool gB_KZMap[TRACKS_SIZE];
@ -542,6 +545,9 @@ public void OnLibraryRemoved(const char[] name)
public void OnMapStart()
{
gF_SpeedModGarbage = 0.0;
gI_SpeedModGarbage = 0;
// styles
if(!LoadStyles())
{
@ -2549,6 +2555,7 @@ public void OnEntityCreated(int entity, const char[] classname)
if (StrEqual(classname, "player_speedmod"))
{
gH_AcceptInput.HookEntity(Hook_Pre, entity, DHook_AcceptInput_player_speedmod);
gH_AcceptInput.HookEntity(Hook_Post, entity, DHook_AcceptInput_player_speedmod_Post);
}
}
@ -2576,15 +2583,28 @@ public MRESReturn DHook_AcceptInput_player_speedmod(int pThis, DHookReturn hRetu
int style = gA_Timers[activator].bsStyle;
speed *= gA_Timers[activator].fTimescale * GetStyleSettingFloat(style, "speed");
SetEntPropFloat(activator, Prop_Data, "m_flLaggedMovementValue", speed);
gF_SpeedModGarbage = speed;
gI_SpeedModGarbage = activator;
#if DEBUG
int caller = hParams.Get(3);
PrintToServer("ModifySpeed activator = %d(%N), caller = %d, old_speed = %s, new_speed = %f", activator, activator, caller, buf, speed);
#endif
hReturn.Value = true;
return MRES_Supercede;
return MRES_Ignored;
}
// bool CBaseEntity::AcceptInput(char const*, CBaseEntity*, CBaseEntity*, variant_t, int)
public MRESReturn DHook_AcceptInput_player_speedmod_Post(int pThis, DHookReturn hReturn, DHookParam hParams)
{
if (gI_SpeedModGarbage)
{
SetEntPropFloat(gI_SpeedModGarbage, Prop_Data, "m_flLaggedMovementValue", gF_SpeedModGarbage);
gI_SpeedModGarbage = 0;
gF_SpeedModGarbage = 0.0;
}
return MRES_Ignored;
}
public MRESReturn DHook_ProcessMovement(Handle hParams)