jlecorre / hlinvasion

Source code for Half-Life: Invasion, a singleplayer Half-Life modification.
15 stars 4 forks source link

Supergun secondary attack is missing additional delay. #5

Open malortie opened 3 years ago

malortie commented 3 years ago

The next secondary attack time is specified as follows:

https://github.com/jlecorre/hlinvasion/blob/7f494fe04acd6773bc92312ce545bd720797799b/SourceCode/dlls/supergun.cpp#L506

The number of frames (31) is divided by the FPS (20), which gives the time until the next secondary attack is allowed. This is meant to match the secondary attack sequence duration.

There are 2 issues:

  1. According to the SMD, the secondary attack sequence has 32 frames.
  2. The operator / performs integer division, which drops the fraction portion and returns an integer, which removes additional delay.

The line should be changed as follows:

m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 32.0f / 20.0f;