halflife icon indicating copy to clipboard operation
halflife copied to clipboard

[HL] Glitchy Hivehand

Open Matthaiks opened this issue 11 years ago • 5 comments

This is an old bug. The Hivehand sometimes behaves oddly when its magazine is empty.

In this video there are 3 examples. The first one seems rather normal. Check it out:

http://youtu.be/R4alKH4uEpQ

Matthaiks avatar Feb 23 '13 15:02 Matthaiks

I think this is the same kind of bug with the shotguns on CS and CZ that I just posted beneath(https://github.com/ValveSoftware/halflife/issues/555).

di57inct avatar Feb 23 '13 15:02 di57inct

@Matthaiks, can you give text description?

LevShisterov avatar Feb 24 '13 11:02 LevShisterov

Occasionally, there is a problem with sound when one shoots during hornets regeneration (and ammo counter shows 0). Sometimes there is a sound glitch, sometimes there are no sound and movement at all (except hornets).

Matthaiks avatar Feb 24 '13 12:02 Matthaiks

Most likely caused by #1621 due to the client hitting the <= 0 condition before the server does, resulting in the client simulating the attack twice instead of once.

SamVanheer avatar Feb 08 '21 12:02 SamVanheer

These bugs happen because the client is also simulating the ammo regeneration and not properly synchronizing the ammo value with the server. Because the reload time variable is an absolute time value it will vary and cause inconsistent regeneration intervals.

These bugs can be mostly fixed by making the following changes.

Change these lines: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/hornetgun.cpp#L136 https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/hornetgun.cpp#L186

To this:

if (m_pPlayer->ammo_hornets <= 0)

Change this function: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/hornetgun.cpp#L265-L275

To this:

void CHgun::Reload( void )
{
#ifndef CLIENT_DLL
	if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= HORNET_MAX_CARRY)
		return;

	while (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time)
	{
		m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
		m_flRechargeTime += 0.5;
	}

	m_pPlayer->TabulateAmmo();
#endif
}

I say mostly because with high ping the attack animation will sometimes not play. This is because the client isn't simulating ammo regeneration so the client thinks it's out of ammo. I tried to implement that, but it caused the client to simulate attacks at a higher rate than the server so i opted for this instead.

SamVanheer avatar Feb 21 '22 15:02 SamVanheer