Removed DEBUG_HITBOXES_ALWAYS_ON (bandwidth problems)

This commit is contained in:
Kamay Xutax 2024-07-26 17:50:55 +02:00
parent c1bf6cdfcc
commit 578ed3f25d
6 changed files with 8 additions and 68 deletions

View file

@ -19,7 +19,7 @@
#include "proto_version.h"
// Flow control bytes per second limits
#define MAX_RATE (1024*1024)
#define MAX_RATE (16777216)
#define MIN_RATE 1000
#define DEFAULT_RATE 80000
@ -50,13 +50,14 @@
#define STREAM_CMD_ACKN 4 // acknowledged a recveived blob
// NETWORKING INFO
// TODO_ENHANCED: Before we had little 54k modems. It's different today.
// This is the packet payload without any header bytes (which are attached for actual sending)
#define NET_MAX_PAYLOAD 288000 // largest message we can send in bytes
#define NET_MAX_PAYLOAD_V23 96000 // largest message we can send in bytes
#define NET_MAX_PAYLOAD_BITS_V23 17 // 2^NET_MAX_PAYLOAD_BITS > NET_MAX_PAYLOAD
// This is just the client_t->netchan.datagram buffer size (shouldn't ever need to be huge)
#define NET_MAX_DATAGRAM_PAYLOAD 4000 // = maximum unreliable payload size
#define NET_MAX_DATAGRAM_PAYLOAD (1<<14) // = maximum unreliable payload size
// UDP has 28 byte headers
#define UDP_HEADER_SIZE (20+8) // IP = 20, UDP = 8

View file

@ -2150,7 +2150,6 @@ void C_CSPlayer::FireGameEvent(IGameEvent* event)
bool shouldShowImpacts = cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 3;
bool shouldShowFireBulletHitboxes = cl_showfirebullethitboxes.GetInt() == 1 || cl_showfirebullethitboxes.GetInt() == 3;
bool shouldShowHitboxes = cl_showhitboxes.GetInt() == 1 || cl_showhitboxes.GetInt() == 3;
const auto showEventHitboxes = [&](float flDuration)
{
@ -2228,10 +2227,6 @@ void C_CSPlayer::FireGameEvent(IGameEvent* event)
{
showEventHitboxes(m_flDebugDuration);
}
else if (FStrEq(event->GetName(), "player_lag_hitboxes") && shouldShowHitboxes)
{
showEventHitboxes(-1.0f);
}
}
@ -2339,7 +2334,7 @@ void C_CSPlayer::Simulate( void )
if ((cl_showhitboxes.GetInt() == 1 || cl_showhitboxes.GetInt() == 2) && !IsLocalPlayer())
{
DrawClientHitboxes(gpGlobals->absoluteframetime, true);
DrawClientHitboxes(gpGlobals->frametime, true);
}
}

View file

@ -1319,11 +1319,6 @@ void CInput::CreateMove ( int sequence_number, float input_sample_frametime, boo
static ConVarRef cl_showimpacts("cl_showimpacts");
cmd->debug_hitboxes = CUserCmd::DEBUG_HITBOXES_OFF;
if (cl_showhitboxes.GetBool())
{
cmd->debug_hitboxes |= CUserCmd::DEBUG_HITBOXES_ALWAYS_ON;
}
if (cl_showfirebullethitboxes.GetBool())
{

View file

@ -1586,56 +1586,6 @@ void CCSPlayer::UpdateMouseoverHints()
void CCSPlayer::PostThink()
{
if (m_pCurrentCommand->debug_hitboxes & CUserCmd::DEBUG_HITBOXES_ALWAYS_ON)
{
lagcompensation->StartLagCompensation( this, GetCurrentCommand() );
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
CBasePlayer* lagPlayer = UTIL_PlayerByIndex(i);
if (!lagPlayer)
continue;
IGameEvent* event = gameeventmanager->CreateEvent("player_lag_hitboxes");
if (event)
{
event->SetInt("userid", GetUserID());
event->SetInt("player_index", lagPlayer->entindex());
Vector positions[MAXSTUDIOBONES];
QAngle angles[MAXSTUDIOBONES];
int indexes[MAXSTUDIOBONES];
int numhitboxes = lagPlayer->GetServerHitboxes(positions, angles, indexes);
event->SetInt("num_hitboxes", numhitboxes);
for (int i = 0; i < numhitboxes; i++)
{
char buffer[256];
V_sprintf_safe(buffer, "hitbox_index_%i", i);
event->SetInt(buffer, indexes[i]);
V_sprintf_safe(buffer, "hitbox_position_x_%i", i);
event->SetFloat(buffer, positions[indexes[i]].x);
V_sprintf_safe(buffer, "hitbox_position_y_%i", i);
event->SetFloat(buffer, positions[indexes[i]].y);
V_sprintf_safe(buffer, "hitbox_position_z_%i", i);
event->SetFloat(buffer, positions[indexes[i]].z);
V_sprintf_safe(buffer, "hitbox_angle_x_%i", i);
event->SetFloat(buffer, angles[indexes[i]].x);
V_sprintf_safe(buffer, "hitbox_angle_y_%i", i);
event->SetFloat(buffer, angles[indexes[i]].y);
V_sprintf_safe(buffer, "hitbox_angle_z_%i", i);
event->SetFloat(buffer, angles[indexes[i]].z);
}
gameeventmanager->FireEvent(event);
}
}
lagcompensation->FinishLagCompensation( this );
}
BaseClass::PostThink();
UpdateAddonBits();

View file

@ -219,7 +219,7 @@ void WriteUsercmd( bf_write *buf, const CUserCmd *to, const CUserCmd *from )
if (to->debug_hitboxes != from->debug_hitboxes)
{
buf->WriteOneBit(1);
buf->WriteUBitLong(to->debug_hitboxes, 3);
buf->WriteUBitLong(to->debug_hitboxes, 2);
}
else
{
@ -362,7 +362,7 @@ void ReadUsercmd( bf_read *buf, CUserCmd *move, CUserCmd *from )
if ( buf->ReadOneBit() )
{
move->debug_hitboxes = (CUserCmd::debug_hitboxes_t)buf->ReadUBitLong(3);
move->debug_hitboxes = (CUserCmd::debug_hitboxes_t)buf->ReadUBitLong(2);
}
#if defined( HL2_DLL )

View file

@ -220,9 +220,8 @@ public:
enum debug_hitboxes_t : uint8
{
DEBUG_HITBOXES_OFF,
DEBUG_HITBOXES_ALWAYS_ON = 1 << 0,
DEBUG_HITBOXES_ON_FIRE = 1 << 1,
DEBUG_HITBOXES_ON_HIT = 1 << 2
DEBUG_HITBOXES_ON_FIRE = 1 << 0,
DEBUG_HITBOXES_ON_HIT = 1 << 1
};
uint8 debug_hitboxes;