combat pistol

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5314 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-07-08 20:54:09 +00:00
parent 3ea2a3a173
commit 8d75ed76c3
3 changed files with 15 additions and 8 deletions
+2 -2
View File
@@ -421,7 +421,7 @@ itemstat ammostats[NUMGUNS] =
{60, 90, 90, S_ITEMAMMO}, //subgun
{10, 20, 15, S_ITEMAMMO}, //sniper
{40, 60, 60, S_ITEMAMMO}, //assault
{16, 32, 72, S_ITEMAMMO}, //cpistol
{30, 30, 75, S_ITEMAMMO}, //cpistol
{1, 0, 3, S_ITEMAMMO}, //grenade
{72, 0, 72, S_ITEMAKIMBO} //akimbo
};
@@ -442,7 +442,7 @@ guninfo guns[NUMGUNS] =
{ "subgun", S_SUBGUN, S_RSUBGUN, 1650, 80, 15, 0, 0, 40, 15, 30, 1, 2, 4, 15, 40, 175, 1, true },
{ "sniper", S_SNIPER, S_RSNIPER, 1950, 1500, 80, 0, 0, 60, 50, 5, 4, 4, 10, 85, 85, 100, 1, false },
{ "assault", S_ASSAULT, S_RASSAULT, 2000, 120, 24, 0, 0, 20, 40, 20, 0, 2, 2, 18, 50, 125, 1, true },
{ "cpistol", S_PISTOL, S_RPISTOL, 1400, 80, 19, 0, 0, 35, 10, 12, 6, 5, 6, 35, 58, 125, 1, false }, // temporary
{ "cpistol", S_PISTOL, S_RPISTOL, 1400, 80, 19, 0, 0, 35, 10, 15, 6, 5, 6, 35, 58, 125, 1, false }, // temporary
{ "grenade", S_NULL, S_NULL, 1000, 650, 200, 20, 6, 1, 1, 1, 3, 1, 0, 0, 0, 0, 3, false },
{ "pistol", S_PISTOL, S_RAKIMBO, 1400, 80, 19, 0, 0, 45, 10, 16, 6, 5, 8, 10, 18, 150, 1, true },
};
+12 -6
View File
@@ -603,11 +603,11 @@ bool weapon::reload()
gunwait += info.reloadtime;
int numbullets = min(info.magsize - mag, ammo);
mag += numbullets;
ammo -= numbullets;
mag += numbullets;
ammo -= numbullets;
bool local = (player1 == owner);
if(owner->type==ENT_BOT) audiomgr.playsound(info.reload, owner);
if(owner->type==ENT_BOT) audiomgr.playsound(info.reload, owner);
else audiomgr.playsoundc(info.reload, NULL, local ? SP_HIGH : SP_NORMAL);
if(local) addmsg(SV_RELOAD, "ri2", lastmillis, owner->weaponsel->type);
return true;
@@ -976,8 +976,8 @@ bool gun::attack(vec &targ)
{
int attackmillis = lastmillis-owner->lastaction;
if(timebalance < gunwait) attackmillis += timebalance;
if(attackmillis<gunwait) return false;
timebalance = gunwait ? attackmillis - gunwait : 0;
if(attackmillis<gunwait) return false;
timebalance = gunwait ? attackmillis - gunwait : 0;
gunwait = reloading = 0;
if(!owner->attacking)
@@ -1040,7 +1040,7 @@ shotgun::shotgun(playerent *owner) : gun(owner, GUN_SHOTGUN) {}
bool shotgun::attack(vec &targ)
{
vec from = owner->o;
from.z -= weaponbeloweye;
from.z -= weaponbeloweye;
createrays(from, targ);
return gun::attack(targ);
}
@@ -1150,6 +1150,12 @@ cpistol::cpistol(playerent *owner) : gun(owner, GUN_CPISTOL), bursting(false) {}
bool cpistol::selectable() { return weapon::selectable() && !m_noprimary && this == owner->primweap; }
void cpistol::onselecting() { weapon::onselecting(); bursting = false; }
void cpistol::ondeselecting() { bursting = false; }
bool cpistol::reload()
{
bool r = weapon::reload();
if(owner==player1 && r) { bursting = false; }
return r;
}
void cpistol::setburst(bool enable)
{
if(this == owner->weaponsel && !reloading && owner->state == CS_ALIVE)
+1
View File
@@ -146,6 +146,7 @@ struct cpistol : gun
{
bool bursting;
cpistol(playerent *owner);
bool reload();
bool selectable();
void onselecting();
void ondeselecting();