From 070afb8edaf151bacd156d6b29f2cc371d0351aa Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Tue, 25 Dec 2007 01:24:20 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1481 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/entity.h | 5 +++-- source/src/pch.h | 3 ++- source/src/weapon.cpp | 10 +++++----- source/src/weapon.h | 13 ++++++++----- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/source/src/entity.h b/source/src/entity.h index bc1b4589..228466f8 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -208,6 +208,7 @@ struct playerstate int ammo[NUMGUNS], mag[NUMGUNS], gunwait[NUMGUNS]; playerstate() : primary(GUN_ASSAULT), nextprimary(GUN_ASSAULT) {} + virtual ~playerstate() {} itemstat &itemstats(int type) { @@ -332,8 +333,8 @@ struct playerent : dynent, playerstate poshist history; // Previous stored locations of this player playerent() : clientnum(-1), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), lastpain(0), lastteamkill(0), clientrole(CR_DEFAULT), - skin(0), nextskin(0), spectating(SM_NONE), followplayercn(0), inhandnade(NULL), - weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL) + skin(0), nextskin(0), spectating(SM_NONE), followplayercn(0), + weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL), inhandnade(NULL) { type = ENT_PLAYER; name[0] = team[0] = 0; diff --git a/source/src/pch.h b/source/src/pch.h index 5f924215..bb41d088 100644 --- a/source/src/pch.h +++ b/source/src/pch.h @@ -46,4 +46,5 @@ #endif #include -#include \ No newline at end of file +#include + diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 36b7cc76..e3c37708 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -521,8 +521,8 @@ void raydamage(vec &from, vec &to, playerent *d) } } -weapon::weapon(struct playerent *owner, int type) : type(type), info(guns[type]), owner(owner), reloading(0), - ammo(owner->ammo[type]), mag(owner->mag[type]), gunwait(owner->gunwait[type]) +weapon::weapon(struct playerent *owner, int type) : type(type), owner(owner), info(guns[type]), + ammo(owner->ammo[type]), mag(owner->mag[type]), gunwait(owner->gunwait[type]), reloading(0) { } @@ -628,7 +628,7 @@ void weapon::onselecting() void weapon::renderhudmodel() { renderhudmodel(owner->lastaction); } int weapon::dynspread() { return info.spread; } -int weapon::dynrecoil() { return info.recoil; } +float weapon::dynrecoil() { return info.recoil; } bool weapon::selectable() { return !reloading && this != owner->weaponsel && owner->state == CS_ALIVE && !owner->weaponchanging; } @@ -892,7 +892,7 @@ struct sniperrifle : gun } int dynspread() { return scoped ? 1 : info.spread; } - int dynrecoil() { return scoped ? info.recoil / 3 : info.recoil; } + float dynrecoil() { return scoped ? info.recoil / 3 : info.recoil; } bool selectable() { return weapon::selectable() && !m_noprimary && this == owner->primweap; } void onselecting() { weapon::onselecting(); setscope(false); } void ondeselecting() { setscope(false); } @@ -903,7 +903,7 @@ struct assaultrifle : gun assaultrifle(playerent *owner) : gun(owner, GUN_ASSAULT) {} int dynspread() { return shots > 3 ? 70 : info.spread; } - int dynrecoil() { return info.recoil + (rnd(8)*-0.01f); } + float dynrecoil() { return info.recoil + (rnd(8)*-0.01f); } bool selectable() { return weapon::selectable() && !m_noprimary && this == owner->primweap; } }; diff --git a/source/src/weapon.h b/source/src/weapon.h index 116aa956..28191ed7 100644 --- a/source/src/weapon.h +++ b/source/src/weapon.h @@ -7,12 +7,14 @@ struct weapon static void equipplayer(playerent *pl); weapon(struct playerent *owner, int type); + virtual ~weapon() {} int type; playerent *owner; const struct guninfo &info; int &ammo, &mag, &gunwait, shots; - virtual int dynspread(), dynrecoil(); + virtual int dynspread(); + virtual float dynrecoil(); int reloading, lastaction; virtual bool attack(vec &targ) = 0; @@ -20,7 +22,7 @@ struct weapon virtual void attackphysics(vec &from, vec &to); virtual void attacksound(); virtual bool reload(); - virtual void reset() {}; + virtual void reset() {} virtual int modelanim() = 0; virtual void updatetimers(); @@ -29,10 +31,11 @@ struct weapon virtual void renderhudmodel(); virtual void onselecting(); - virtual void ondeselecting() {}; - virtual void onammopicked() {}; + virtual void ondeselecting() {} + virtual void onammopicked() {} void sendshoot(vec &from, vec &to); bool modelattacking(); void renderhudmodel(int lastaction, int index = 0); -}; \ No newline at end of file +}; +