From da4a5ddfe62a9bf4964a3ace7643382afd931d23 Mon Sep 17 00:00:00 2001 From: driAn Date: Thu, 27 Dec 2007 15:14:53 +0000 Subject: [PATCH] spawning in bot modes fixed, damageblend lock fixed, reloading locks weapon switch git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1507 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 5 +++-- source/src/docs.cpp | 2 +- source/src/renderhud.cpp | 2 +- source/src/rendermodel.cpp | 2 +- source/src/weapon.cpp | 11 ++++++++--- source/src/weapon.h | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 02f76aa2..a8ab1c0f 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -333,10 +333,10 @@ void findplayerstart(playerent *d) void spawnplayer(playerent *d) { - findplayerstart(d); d->respawn(); d->spawnstate(gamemode); d->state = d==player1 && editmode ? CS_EDITING : CS_ALIVE; + findplayerstart(d); } void respawnself() @@ -344,9 +344,10 @@ void respawnself() if(m_mp(gamemode)) addmsg(SV_TRYSPAWN, "r"); else { + showscores(false); + setscope(false); spawnplayer(player1); player1->lifesequence++; - showscores(false); } } diff --git a/source/src/docs.cpp b/source/src/docs.cpp index 4f5983fc..1cdb332b 100644 --- a/source/src/docs.cpp +++ b/source/src/docs.cpp @@ -5,7 +5,7 @@ void renderdocsection(void *menu, bool init); -extern hashtable *idents; +extern hashtable *idents; struct docargument { diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 0956e455..a5a1d4bc 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -323,7 +323,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat glVertex2i(0, VIRTH); glEnd(); glDepthMask(GL_TRUE); - dblend -= max(0, curtime/3); + dblend = max(0, dblend-curtime/3); } glEnable(GL_TEXTURE_2D); diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index d5810256..df007772 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -303,7 +303,7 @@ void preload_playermodels() void preload_entmodels() { - extern char *entmdlnames[]; + extern const char *entmdlnames[]; loopi(I_AKIMBO-I_CLIPS+1) { model *mdl = loadmodel(entmdlnames[i]); diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 862c437f..80345c5e 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -36,7 +36,11 @@ void weaponswitch(weapon *w) w->onselecting(); } -void selectweapon(weapon *w) { if(w && w->selectable()) weaponswitch(w); } +void selectweapon(weapon *w) +{ + if(w && w->selectable() && player1->weaponsel->deselectable()) + weaponswitch(w); +} void selectweaponi(int w) { @@ -637,8 +641,8 @@ void weapon::onselecting() void weapon::renderhudmodel() { renderhudmodel(owner->lastaction); } int weapon::dynspread() { return info.spread; } float weapon::dynrecoil() { return info.recoil; } -bool weapon::selectable() { return !reloading && this != owner->weaponsel && owner->state == CS_ALIVE && !owner->weaponchanging; } - +bool weapon::selectable() { return this != owner->weaponsel && owner->state == CS_ALIVE && !owner->weaponchanging; } +bool weapon::deselectable() { return !reloading; } struct grenadeent : bounceent @@ -752,6 +756,7 @@ struct grenades : weapon from.mul(1.1f*owner->radius); from.add(owner->o); thrownade(from, vel, inhandnade); + owner->attacking = false; } void thrownade(const vec &from, const vec &vel, bounceent *p) diff --git a/source/src/weapon.h b/source/src/weapon.h index d9e32732..ff986619 100644 --- a/source/src/weapon.h +++ b/source/src/weapon.h @@ -27,6 +27,7 @@ struct weapon virtual int modelanim() = 0; virtual void updatetimers(); virtual bool selectable(); + virtual bool deselectable(); virtual void renderstats(); virtual void renderhudmodel();