mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
it's fine to have all the speedmod stuff in a post hook
This commit is contained in:
parent
4b711b1fab
commit
03c3af1a4f
@ -154,9 +154,6 @@ 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];
|
||||
|
||||
@ -545,9 +542,6 @@ public void OnLibraryRemoved(const char[] name)
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
gF_SpeedModGarbage = 0.0;
|
||||
gI_SpeedModGarbage = 0;
|
||||
|
||||
// styles
|
||||
if(!LoadStyles())
|
||||
{
|
||||
@ -2575,13 +2569,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
// bool CBaseEntity::AcceptInput(char const*, CBaseEntity*, CBaseEntity*, variant_t, int)
|
||||
public MRESReturn DHook_AcceptInput_player_speedmod(int pThis, DHookReturn hReturn, DHookParam hParams)
|
||||
public MRESReturn DHook_AcceptInput_player_speedmod_Post(int pThis, DHookReturn hReturn, DHookParam hParams)
|
||||
{
|
||||
char buf[128];
|
||||
hParams.GetString(1, buf, sizeof(buf));
|
||||
@ -2604,8 +2597,7 @@ public MRESReturn DHook_AcceptInput_player_speedmod(int pThis, DHookReturn hRetu
|
||||
int style = gA_Timers[activator].bsStyle;
|
||||
|
||||
speed *= gA_Timers[activator].fTimescale * GetStyleSettingFloat(style, "speed");
|
||||
gF_SpeedModGarbage = speed;
|
||||
gI_SpeedModGarbage = activator;
|
||||
SetEntPropFloat(activator, Prop_Data, "m_flLaggedMovementValue", speed);
|
||||
|
||||
#if DEBUG
|
||||
int caller = hParams.Get(3);
|
||||
@ -2615,19 +2607,6 @@ public MRESReturn DHook_AcceptInput_player_speedmod(int pThis, DHookReturn hRetu
|
||||
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)
|
||||
{
|
||||
int client = DHookGetParam(hParams, 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user