mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 19:38:25 +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_ZoneAiraccelerate[MAXPLAYERS+1];
|
||||||
float gF_ZoneSpeedLimit[MAXPLAYERS+1];
|
float gF_ZoneSpeedLimit[MAXPLAYERS+1];
|
||||||
|
|
||||||
float gF_SpeedModGarbage;
|
|
||||||
int gI_SpeedModGarbage = 0;
|
|
||||||
|
|
||||||
// kz support
|
// kz support
|
||||||
bool gB_KZMap[TRACKS_SIZE];
|
bool gB_KZMap[TRACKS_SIZE];
|
||||||
|
|
||||||
@ -545,9 +542,6 @@ public void OnLibraryRemoved(const char[] name)
|
|||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
gF_SpeedModGarbage = 0.0;
|
|
||||||
gI_SpeedModGarbage = 0;
|
|
||||||
|
|
||||||
// styles
|
// styles
|
||||||
if(!LoadStyles())
|
if(!LoadStyles())
|
||||||
{
|
{
|
||||||
@ -2575,13 +2569,12 @@ public void OnEntityCreated(int entity, const char[] classname)
|
|||||||
{
|
{
|
||||||
if (StrEqual(classname, "player_speedmod"))
|
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);
|
gH_AcceptInput.HookEntity(Hook_Post, entity, DHook_AcceptInput_player_speedmod_Post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool CBaseEntity::AcceptInput(char const*, CBaseEntity*, CBaseEntity*, variant_t, int)
|
// 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];
|
char buf[128];
|
||||||
hParams.GetString(1, buf, sizeof(buf));
|
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;
|
int style = gA_Timers[activator].bsStyle;
|
||||||
|
|
||||||
speed *= gA_Timers[activator].fTimescale * GetStyleSettingFloat(style, "speed");
|
speed *= gA_Timers[activator].fTimescale * GetStyleSettingFloat(style, "speed");
|
||||||
gF_SpeedModGarbage = speed;
|
SetEntPropFloat(activator, Prop_Data, "m_flLaggedMovementValue", speed);
|
||||||
gI_SpeedModGarbage = activator;
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
int caller = hParams.Get(3);
|
int caller = hParams.Get(3);
|
||||||
@ -2615,19 +2607,6 @@ public MRESReturn DHook_AcceptInput_player_speedmod(int pThis, DHookReturn hRetu
|
|||||||
return MRES_Ignored;
|
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)
|
public MRESReturn DHook_ProcessMovement(Handle hParams)
|
||||||
{
|
{
|
||||||
int client = DHookGetParam(hParams, 1);
|
int client = DHookGetParam(hParams, 1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user