From 8d75ed76c3590efda6c19a7acfe79679050eda1a Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Thu, 8 Jul 2010 20:54:09 +0000 Subject: [PATCH] combat pistol git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5314 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/server.h | 4 ++-- source/src/weapon.cpp | 18 ++++++++++++------ source/src/weapon.h | 1 + 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/source/src/server.h b/source/src/server.h index 99b408f2..07530d16 100644 --- a/source/src/server.h +++ b/source/src/server.h @@ -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 }, }; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 36130927..a1de5146 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -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(attackmillisattacking) @@ -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) diff --git a/source/src/weapon.h b/source/src/weapon.h index 38406462..703bba47 100644 --- a/source/src/weapon.h +++ b/source/src/weapon.h @@ -146,6 +146,7 @@ struct cpistol : gun { bool bursting; cpistol(playerent *owner); + bool reload(); bool selectable(); void onselecting(); void ondeselecting();