I always felt that the rifles are a little inaccurate in long range so I did a little accuracy test today (on target.bsp) and found out that I was right. The inaccuracy size is as big as the circle crosshair so I looked to source code (g_weapons.c). Here’s what I found:
float G_GetWeaponSpread( int weapon )
...
case WP_MP40:
case WP_THOMPSON:
return 400;
...
case WP_GARAND:
case WP_CARBINE:
case WP_KAR98:
case WP_K43:
return 250;
...
That looks fine, rifles are more accurate than SMGs, but there’s still something out there:
void FireWeapon( gentity_t *ent )
...
case WP_GARAND:
!! aimSpreadScale = 1.0f; !!
Bullet_Fire( ent, GARAND_SPREAD*aimSpreadScale, GARAND_DAMAGE, qfalse );
break;
...
case WP_K43:
!! aimSpreadScale = 1.0; !!
Bullet_Fire( ent, K43_SPREAD*aimSpreadScale, K43_DAMAGE, qfalse );
break;
...
Notice the lines marked with exclamation marks. That looks very interesting compared to other weapons’ code:
void FireWeapon( gentity_t *ent )
...
case WP_MP40:
Bullet_Fire( ent, MP40_SPREAD*aimSpreadScale, MP40_DAMAGE, qtrue );
break;
case WP_THOMPSON:
Bullet_Fire( ent, THOMPSON_SPREAD*aimSpreadScale, THOMPSON_DAMAGE, qtrue );
break;
...
For those who don’t see the result - unscoped rifles ALWAYS fire at full spread. No matter if u jump (doubled max spread) or shoot the very first shot (all other weapons fire at 0.15 spread). I think those two lines should be removed when u have complete spread code for rifles that is useless because it’s always overridden by those two lines.
Rifle spread code is there, works right and it’s used by unscoped FG-42 - spread flies to max after each shot but returns back to 0.15.
Here’re the spreads for guns:
MP40/Thompson:
first shot - 60
full spread - 400
jump spread - 800
Colt/Luger:
first shot - 90
full spread - 600
jump spread - 1200
Garand/K43:
first shot - 250 (overridden 37.5)
full spread - 250
jump spread - 250 (overridden 500)
