Talk:Magazine style reloads

From Valve Developer Community
Jump to: navigation, search

Clarification and Questioning the need for the "Extension" section

To clarify "m_iClip1" is the amount of currently available ammo in the clip. Where as pOwner->RemoveAmmo removes from total amount of ammo (ammo of each clip * number of clips). Ex. I have 6 clips of 30 ammo size... (30 * 6 = 180). 180 is total amount of ammo, and "m_iClip1" would be 30 or however much bullets left in the currently used clip.

So in using the magazine style reloads:

m_iClip1 = m_bMagazineStyleReloads ? GetMaxClip1() : m_iClip1 + primary;

we return the current clip to full capacity.

And in:

pOwner->RemoveAmmo( m_bMagazineStyleReloads ? GetMaxClip1() : primary, m_iPrimaryAmmoType);

we would remove a full capacity of a clip. ex. 180 - 30 = 150 (or 5 clips left). Simple.

So I don't understand the point of the "Extension" which changes the code to remove only 1 ammo from the total ammo count. The person who added that wrote: "Corrected reload using up all spare clips". And probably mistook the "RemoveAmmo" function to remove number of clips (you lose 1 clip every reload) where as it actually removes from total ammo count, as this way we are localizing the code so that the rest of the hl2 code system doesn't need to worry about this. So once again "pOwner->GetAmmoCount(m_iPrimaryAmmoType) / GetMaxClip1()" (rounded up) is the amount of clips available. If anybody wants to make the article more understandable by clarifying that the hl2 system actually uses a total ammo system rather than a magazine system (and the article is just a hack to work around hl2) then go ahead.--3dwarrior 20:21, 3 August 2009 (UTC)




-in the "Covering your ass section, shouldn't the majority of the function be removed? not just the reload?

// We can’t be active
if ( GetOwner()->GetActiveWeapon() == this )
return;
/*
// If it’s been longer than three seconds, reload
if ( ( gpGlobals->curtime – m_flHolsterTime ) > sk_auto_reload_time.GetFloat() )
{
// Just load the clip with no animations
FinishReload();
m_flHolsterTime = gpGlobals->curtime;
*/

Like so? --Stoopdapoop 11:33, 19 May 2010 (UTC)