mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
Fix the on-ground 0.5s start-timer even further dot dot dot
This commit is contained in:
parent
00feb624c2
commit
128940ff19
@ -92,7 +92,8 @@ Handle gH_Forwards_OnProcessMovementPost = null;
|
|||||||
// player timer variables
|
// player timer variables
|
||||||
timer_snapshot_t gA_Timers[MAXPLAYERS+1];
|
timer_snapshot_t gA_Timers[MAXPLAYERS+1];
|
||||||
bool gB_Auto[MAXPLAYERS+1];
|
bool gB_Auto[MAXPLAYERS+1];
|
||||||
int gI_FirstTouchedGround[MAXPLAYERS+1];
|
// 0 is in air, 1 or greater is on ground, -1 means client was on ground with zero...ish... velocity
|
||||||
|
int gI_FirstTouchedGroundForStartTimer[MAXPLAYERS+1];
|
||||||
int gI_LastTickcount[MAXPLAYERS+1];
|
int gI_LastTickcount[MAXPLAYERS+1];
|
||||||
|
|
||||||
// these are here until the compiler bug is fixed
|
// these are here until the compiler bug is fixed
|
||||||
@ -2569,10 +2570,15 @@ bool CanStartTimer(int client, int track, bool skipGroundCheck)
|
|||||||
|
|
||||||
if (skipGroundTimer) return true;
|
if (skipGroundTimer) return true;
|
||||||
|
|
||||||
if (gI_FirstTouchedGround[client] > 0)
|
if (gI_FirstTouchedGroundForStartTimer[client] < 0)
|
||||||
|
{
|
||||||
|
// was on ground with zero...ish... velocity...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (gI_FirstTouchedGroundForStartTimer[client] > 0)
|
||||||
{
|
{
|
||||||
int halfSecOfTicks = RoundFloat(0.5 / GetTickInterval());
|
int halfSecOfTicks = RoundFloat(0.5 / GetTickInterval());
|
||||||
int onGroundTicks = gI_LastTickcount[client] - gI_FirstTouchedGround[client];
|
int onGroundTicks = gI_LastTickcount[client] - gI_FirstTouchedGroundForStartTimer[client];
|
||||||
|
|
||||||
return onGroundTicks >= halfSecOfTicks;
|
return onGroundTicks >= halfSecOfTicks;
|
||||||
}
|
}
|
||||||
@ -2769,7 +2775,7 @@ public void OnClientPutInServer(int client)
|
|||||||
gA_Timers[client].fNextFrameTime = 0.0;
|
gA_Timers[client].fNextFrameTime = 0.0;
|
||||||
gA_Timers[client].fplayer_speedmod = 1.0;
|
gA_Timers[client].fplayer_speedmod = 1.0;
|
||||||
gS_DeleteMap[client][0] = 0;
|
gS_DeleteMap[client][0] = 0;
|
||||||
gI_FirstTouchedGround[client] = 0;
|
gI_FirstTouchedGroundForStartTimer[client] = 0;
|
||||||
gI_LastTickcount[client] = 0;
|
gI_LastTickcount[client] = 0;
|
||||||
gI_HijackFrames[client] = 0;
|
gI_HijackFrames[client] = 0;
|
||||||
gI_LastPrintedSteamID[client] = 0;
|
gI_LastPrintedSteamID[client] = 0;
|
||||||
@ -3652,10 +3658,35 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
|||||||
|
|
||||||
gI_LastTickcount[client] = tickcount;
|
gI_LastTickcount[client] = tickcount;
|
||||||
|
|
||||||
|
if (bOnGround)
|
||||||
|
{
|
||||||
|
if (gI_FirstTouchedGroundForStartTimer[client] == 0)
|
||||||
|
{
|
||||||
|
// just landed (or teleported to the ground or whatever)
|
||||||
|
gI_FirstTouchedGroundForStartTimer[client] = tickcount;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gI_FirstTouchedGroundForStartTimer[client] > 0)
|
||||||
|
{
|
||||||
|
float fSpeed[3];
|
||||||
|
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
|
||||||
|
|
||||||
|
// zero...ish... velocity... (squared-ish (cubed?))
|
||||||
|
if (GetVectorLength(fSpeed, true) <= 1000.0)
|
||||||
|
{
|
||||||
|
gI_FirstTouchedGroundForStartTimer[client] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gI_FirstTouchedGroundForStartTimer[client] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(bOnGround && !gA_Timers[client].bOnGround)
|
if(bOnGround && !gA_Timers[client].bOnGround)
|
||||||
{
|
{
|
||||||
gA_Timers[client].iLandingTick = tickcount;
|
gA_Timers[client].iLandingTick = tickcount;
|
||||||
gI_FirstTouchedGround[client] = tickcount;
|
gI_FirstTouchedGroundForStartTimer[client] = tickcount;
|
||||||
|
|
||||||
if (gEV_Type != Engine_TF2 && GetStyleSettingBool(gA_Timers[client].bsStyle, "easybhop"))
|
if (gEV_Type != Engine_TF2 && GetStyleSettingBool(gA_Timers[client].bsStyle, "easybhop"))
|
||||||
{
|
{
|
||||||
@ -3677,11 +3708,6 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bOnGround)
|
|
||||||
{
|
|
||||||
gI_FirstTouchedGround[client] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This can be bypassed by spamming +duck on CSS which causes `iGroundEntity` to be `-1` here...
|
// This can be bypassed by spamming +duck on CSS which causes `iGroundEntity` to be `-1` here...
|
||||||
// (e.g. an autobhop + velocity_limit style...)
|
// (e.g. an autobhop + velocity_limit style...)
|
||||||
// m_hGroundEntity changes from 0 -> -1 same tick which causes problems and I'm not sure what the best way / place to handle that is...
|
// m_hGroundEntity changes from 0 -> -1 same tick which causes problems and I'm not sure what the best way / place to handle that is...
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user