Hauptseite | Weapon Spread Code - Forum | Registrieren | Login
[ Neue Beiträge · User · Suche · RSS ]

Seite 1 von 11
Forum » Mapping & Modding » Mapping & Modding » Weapon Spread Code

Weapon Spread Code
WEAPON SPREAD CODE

Weapon spread (higher values=higher spread, again from the file g_weapon.c, these values can be modified later on):

Code

float G_GetWeaponSpread( int weapon ) {
        switch (weapon) {
            case WP_LUGER:
            case WP_SILENCER:
            case WP_AKIMBO_LUGER:
            case WP_AKIMBO_SILENCEDLUGER:
                return 600;
            case WP_COLT:
            case WP_SILENCED_COLT:
            case WP_AKIMBO_COLT:
            case WP_AKIMBO_SILENCEDCOLT:
                return 600;
            case WP_MP40:
            case WP_THOMPSON:
                return 400;
            case WP_STEN:
                return 200;
            case WP_FG42SCOPE:
                return 200;
            case WP_FG42:
                return 500;
            case WP_GARAND:
            case WP_CARBINE:
            case WP_KAR98:
            case WP_K43:
                return 250;
            case WP_GARAND_SCOPE:
            case WP_K43_SCOPE:
                return 700;
            case WP_MOBILE_MG42:
            case WP_MOBILE_MG42_SET:
                return 2500;
        }

        G_Printf( "shouldn't ever get here (weapon %d)\n", weapon );
        // jpw
        return 0;    // shouldn't get here
}

The spread is usually reduced by skill and by alternate firemode (e.g. MG42
oder sniper rifles)

Here some examples from the source code (file g_weapon.c, function
FireWeapon):

Undeployed mobile MG42 spread (i.e. firing from the hip): 2500
(MOBILE_MG42_SPREAD=2500, see above)
Deployed mobile MG42 spread: 2500*0.05=125
Undeployed mobile MG42 while prone or crouched: 2500*0.6=1500

Code

        case WP_MOBILE_MG42_SET:
            Bullet_Fire( ent, MOBILE_MG42_SPREAD*0.05f*aimSpreadScale,     
MOBILE_MG42_DAMAGE, qfalse );
            break;

        case WP_MOBILE_MG42:
            if( ent->client->ps.pm_flags & PMF_DUCKED || ent->client->ps.eFlags &     
EF_PRONE ) {
                Bullet_Fire( ent, MOBILE_MG42_SPREAD*0.6f*aimSpreadScale,     
MOBILE_MG42_DAMAGE, qfalse );
            } else {
                Bullet_Fire( ent, MOBILE_MG42_SPREAD*aimSpreadScale, MOBILE_MG42_DAMAGE,     
qfalse );
            }
            break;

The weapon spread increases with each shot (for a short time), see file
bg_pmocve.c, function PM_Weapon. As far as I can see SMGs have the same
values (aimSpreadScaleAdd = 15-24). But there is a difference between
pistols: aimSpreadScaleAdd = 20 for (silenced)Colt and aimSpreadScaleAdd =
35 for (silenced)luger.

submitted by Ragnar-X-

Forum » Mapping & Modding » Mapping & Modding » Weapon Spread Code
Seite 1 von 11
Suche:

Copyright etpro.de © 2008-2016 . Toolbar | Impressum | Kontakt

Bookmark and Share