mirror of
https://github.com/ENSL/NS.git
synced 2024-11-27 14:52:11 +00:00
o Changes to the shotgun
- The pellets now distribute evenly out to 20 degrees. 1/3 of the bullets distribute within 3 degrees, 1/3 from 3 to 8 degrees, 1/3 from 8 to 20 degrees. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@371 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
bb58d18d8c
commit
55a9fa6a17
4 changed files with 44 additions and 5 deletions
|
@ -1702,15 +1702,37 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
|
||||||
// x * vecSpread.x * vecRight +
|
// x * vecSpread.x * vecRight +
|
||||||
// y * vecSpread.y * vecUp;
|
// y * vecSpread.y * vecUp;
|
||||||
|
|
||||||
|
Vector vecDir;
|
||||||
// tankefugl: 0000973
|
// tankefugl: 0000973
|
||||||
// added inner cone for half of the shots
|
// added inner cone for half of the shots
|
||||||
if (isShotgun && (iShot > (cShots/2)))
|
if (isShotgun)
|
||||||
{
|
{
|
||||||
vecSpread = kSGInnerSpread;
|
vecSpread = kSGInnerSpread;
|
||||||
|
Vector vecMinSpread;
|
||||||
|
|
||||||
|
if ((iShot > (cShots/3)) && (iShot < (cShots*2/3)))
|
||||||
|
{
|
||||||
|
vecSpread = kSGMidSpread;
|
||||||
|
vecMinSpread = kSGInnerSpread;
|
||||||
|
vecDir = UTIL_GetRandomSpreadDirFrom(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread, vecMinSpread);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ((iShot > (cShots*2/3)))
|
||||||
|
{
|
||||||
|
vecMinSpread = kSGMidSpread;
|
||||||
|
vecDir = UTIL_GetRandomSpreadDirFrom(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread, vecMinSpread);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vecSpread = kSGInnerSpread;
|
||||||
|
vecDir = UTIL_GetRandomSpreadDir(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// :tankefugl
|
// :tankefugl
|
||||||
|
else
|
||||||
Vector vecDir = UTIL_GetRandomSpreadDir(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread);
|
{
|
||||||
|
vecDir = UTIL_GetRandomSpreadDir(shared_rand, iShot, vecDirShooting, vecRight, vecUp, vecSpread);
|
||||||
|
}
|
||||||
Vector vecEnd;
|
Vector vecEnd;
|
||||||
|
|
||||||
vecEnd = vecSrc + vecDir * flDistance;
|
vecEnd = vecSrc + vecDir * flDistance;
|
||||||
|
|
|
@ -117,6 +117,21 @@ Vector UTIL_GetRandomSpreadDir(unsigned int inSeed, int inShotNumber, const Vect
|
||||||
return theRandomDir;
|
return theRandomDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test
|
||||||
|
Vector UTIL_GetRandomSpreadDirFrom(unsigned int inSeed, int inShotNumber, const Vector& inBaseDirection, const Vector& inRight, const Vector& inUp, const Vector& inSpread, const Vector& inFromSpread)
|
||||||
|
{
|
||||||
|
// Use player's random seed.
|
||||||
|
// get circular gaussian spread
|
||||||
|
float x = UTIL_SharedRandomFloat( inSeed + inShotNumber, -0.5, 0.5 ) + UTIL_SharedRandomFloat( inSeed + ( 1 + inShotNumber ) , -0.5, 0.5 );
|
||||||
|
float y = UTIL_SharedRandomFloat( inSeed + ( 2 + inShotNumber ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( inSeed + ( 3 + inShotNumber ), -0.5, 0.5 );
|
||||||
|
float z = x * x + y * y;
|
||||||
|
float xdir = x / fabs(x);
|
||||||
|
float ydir = y / fabs(y);
|
||||||
|
|
||||||
|
Vector theRandomDir = inBaseDirection + inFromSpread.x * inRight * xdir + x * inSpread.x * inRight + inFromSpread.y * inUp * ydir + y * inSpread.y * inUp;
|
||||||
|
|
||||||
|
return theRandomDir;
|
||||||
|
}
|
||||||
|
|
||||||
AvHBasePlayerWeapon::AvHBasePlayerWeapon()
|
AvHBasePlayerWeapon::AvHBasePlayerWeapon()
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,7 @@ const int kShootEmptyAnimation = 4;
|
||||||
const int kDeployAnimation = 5;
|
const int kDeployAnimation = 5;
|
||||||
|
|
||||||
Vector UTIL_GetRandomSpreadDir(unsigned int inSeed, int inShotNumber, const Vector& inBaseDirection, const Vector& inRight, const Vector& inUp, const Vector& inSpread);
|
Vector UTIL_GetRandomSpreadDir(unsigned int inSeed, int inShotNumber, const Vector& inBaseDirection, const Vector& inRight, const Vector& inUp, const Vector& inSpread);
|
||||||
|
Vector UTIL_GetRandomSpreadDirFrom(unsigned int inSeed, int inShotNumber, const Vector& inBaseDirection, const Vector& inRight, const Vector& inUp, const Vector& inSpread, const Vector& inFromSpread);
|
||||||
|
|
||||||
class AvHBasePlayerWeapon : public CBasePlayerWeapon
|
class AvHBasePlayerWeapon : public CBasePlayerWeapon
|
||||||
{
|
{
|
||||||
|
|
|
@ -152,7 +152,7 @@ const int kHGBarrelLength = 10;
|
||||||
#define kHGSpread VECTOR_CONE_1DEGREES
|
#define kHGSpread VECTOR_CONE_1DEGREES
|
||||||
|
|
||||||
// Sonic/Shot gun constants.
|
// Sonic/Shot gun constants.
|
||||||
const int kSGRange = 8192;
|
const int kSGRange = 700;
|
||||||
const float kSGXPunch = .8f;
|
const float kSGXPunch = .8f;
|
||||||
#define kSGEjectModel "models/shotshell.mdl"
|
#define kSGEjectModel "models/shotshell.mdl"
|
||||||
#define kSGEventName "events/SonicGun.sc"
|
#define kSGEventName "events/SonicGun.sc"
|
||||||
|
@ -169,7 +169,8 @@ const float kSGXPunch = .8f;
|
||||||
#define kSGDeploySound "weapons/sg-deploy.wav"
|
#define kSGDeploySound "weapons/sg-deploy.wav"
|
||||||
const int kSGBarrelLength = 25;
|
const int kSGBarrelLength = 25;
|
||||||
#define kSGSpread VECTOR_CONE_20DEGREES
|
#define kSGSpread VECTOR_CONE_20DEGREES
|
||||||
#define kSGInnerSpread VECTOR_CONE_7DEGREES
|
#define kSGMidSpread VECTOR_CONE_8DEGREES
|
||||||
|
#define kSGInnerSpread VECTOR_CONE_3DEGREES
|
||||||
|
|
||||||
// Heavy machine gun
|
// Heavy machine gun
|
||||||
const int kHMGRange = 6000;
|
const int kHMGRange = 6000;
|
||||||
|
|
Loading…
Reference in a new issue