diff --git a/config/admin.cfg b/config/admin.cfg
index 6a3d223d..03a7da3d 100644
--- a/config/admin.cfg
+++ b/config/admin.cfg
@@ -95,7 +95,7 @@ menuitemvar [ concat (c 2)Kick ] [ if (> (strlen $tmpKBR) 3) [ if $votepending [
menuitemvar [ concat (c 3)Ban ] [ if (> (strlen $tmpKBR) 3) [ if $votepending [ if (currole) [ vote 2 ]; sleep 250 [ ban $tmpVic $tmpKBR ] ] ] [ ban $tmpVic $tmpKBR ] ]
menuitemvar [ concat (c 9)Forceteam ] [ if (curmodeattr team) [ forceteam $tmpVic ] [ echo (c 3)Error: (c 5) (getmodeacr) is not a team mode. ] ]
menuitemvar [ concat (c 1)Whois ] [ whois $tmpVic ]
-menuitem "Spectate" [ if (&& $connected (> (curplayers) 1)) [ if (alive) [ suicide ]; sleep 50 [ togglespect ]; sleep 100 [ setfollowplayer $tmpVic ] ] [ echo (c 3)Error: (c 5)Not connected or not enough players. ] ]
+menuitem "Spectate" [ if (&& $connected (> (curplayers) 1)) [ spectate; setfollowplayer $tmpVic ] [ echo (c 3)Error: (c 5)Not connected or not enough players. ] ]
menuitemvar [ concat (c 0)Refresh] [ refreshKBM 1 ]
menuitem "" -1
menuitem "Back" [ closemenu reason ]
@@ -112,4 +112,4 @@ menuitem "" -1
menuitem "Refresh" [ closemenu stats; sleep 0 [ showmenu stats ] ]
menuitem "Back" [ closemenu stats ]
-addListOnQuit "hvcOutput tmpArg1 tmpKArg tmpKBP tmpVic votepending"
\ No newline at end of file
+addListOnQuit "hvcOutput tmpArg1 tmpKArg tmpKBP tmpVic votepending"
diff --git a/config/scripts.cfg b/config/scripts.cfg
index 12361ef3..9fb5fd7d 100644
--- a/config/scripts.cfg
+++ b/config/scripts.cfg
@@ -102,7 +102,6 @@ gamemodedesc 19 [Bot Last Swiss Standing: TODO]
const resetbinds [ run resetbinds; echo (c 3)All binds have been reset to default values! ]
const changeteam [ if (< (curteam) 4) [ team (at "RVSF CLA RVSF-SPECT CLA-SPECT" (curteam)) ] ]
-const spectate [ if $connected [ suicide; sleep 500 [ team SPECTATOR ] ] ]
const NUM_WEAPONS 10
const NUM_MODES 22
@@ -383,4 +382,4 @@ run faq
persistidents 1
execdir scripts
-persistidents 0
\ No newline at end of file
+persistidents 0
diff --git a/docs/reference.xml b/docs/reference.xml
index 751d6089..eeb36409 100644
--- a/docs/reference.xml
+++ b/docs/reference.xml
@@ -3057,14 +3057,22 @@ Output:
- Toggle into spectator mode - only possible when you're dead!
+ Sets the desired spectating mode.
+
+
+
-
-
+
+ Toggles spectator mode. If you are alive while changing into spectator mode, suicide will be invoked.
+
+
+
+
+
Stops any demo recording or playback.
@@ -3080,7 +3088,7 @@ Output:
- Kills your player. You will lose 1 frag point and gain 1 death point when using this command.
+ Kills your player. You will lose 1 frag point and receive 1 death point when using this command.
diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp
index 3d491d76..1773b542 100644
--- a/source/src/clientgame.cpp
+++ b/source/src/clientgame.cpp
@@ -139,7 +139,7 @@ const char *highlight(const char *text)
void ignore(int cn)
{
playerent *d = getclient(cn);
- if(d) d->ignored = true;
+ if(d && d != player1) d->ignored = true;
}
void listignored()
@@ -160,7 +160,7 @@ void clearignored(char *ccn)
void muteplayer(int cn)
{
playerent *d = getclient(cn);
- if(d) d->muted = true;
+ if(d && d != player1) d->muted = true;
}
void listmuted()
@@ -264,7 +264,7 @@ int curmodeattr(char *attr)
COMMANDN(team, newteam, ARG_1STR);
COMMANDN(name, newname, ARG_1STR);
COMMAND(benchme, ARG_NONE);
-ICOMMANDF(isclient, ARG_1EXP, (int cn) { return cn == player1->clientnum || getclient(cn) != NULL ? 1 : 0; } );
+ICOMMANDF(isclient, ARG_1EXP, (int cn) { return getclient(cn) != NULL ? 1 : 0; } );
ICOMMANDF(isSpect, ARG_IVAL, (void) { return (player1->team==TEAM_SPECT || player1->spectatemode==SM_FLY); });
ICOMMANDF(currole, ARG_IVAL, (void) { return player1->clientrole; });
ICOMMANDF(curmastermode, ARG_IVAL, (void) { return servstate.mastermode; });
@@ -285,7 +285,7 @@ void playerinfo(const char *cn, const char *attr)
if(!*cn || !cn || !*attr || !attr) return;
int clientnum = atoi(cn); // get player clientnum
- playerent *p = clientnum == player1->clientnum || clientnum < 0 ? player1 : getclient(clientnum);
+ playerent *p = clientnum < 0 ? player1 : getclient(clientnum);
if(!p)
{
conoutf("invalid clientnum");
@@ -411,13 +411,9 @@ void deathstate(playerent *pl)
setburst(false);
if(editmode) toggleedit(true);
damageblend(-1);
- if(pl->team == TEAM_SPECT) spectate(SM_FLY);
- else if(team_isspect(pl->team)) spectate(SM_FOLLOW1ST);
- if(pl->spectatemode == SM_DEATHCAM)
- {
- player1->followplayercn = FPCN_DEATHCAM;
- addmsg(SV_SPECTCN, "ri", player1->followplayercn);
- }
+ if(pl->team == TEAM_SPECT) spectatemode(SM_FLY);
+ else if(team_isspect(pl->team)) spectatemode(SM_FOLLOW1ST);
+ if(pl->spectatemode == SM_DEATHCAM) player1->followplayercn = FPCN_DEATHCAM;
}
else pl->resetinterp();
}
@@ -739,11 +735,9 @@ void findplayerstart(playerent *d, bool mapcenter, int arenaspawn)
void spawnplayer(playerent *d)
{
- //2011oct16:flowtron:keep spectator state
- bool dws = d->state == CS_SPECTATE;
d->respawn();
d->spawnstate(gamemode);
- d->state = (d==player1 && editmode) ? CS_EDITING : (dws?CS_SPECTATE:CS_ALIVE);
+ d->state = (d==player1 && editmode) ? CS_EDITING : CS_ALIVE;
findplayerstart(d);
}
@@ -993,7 +987,7 @@ COMMAND(pstat_score, ARG_1INT);
void pstat_weap(int cn)
{
string weapstring = "";
- playerent *pl = cn == player1->clientnum ? player1 : getclient(cn);
+ playerent *pl = getclient(cn);
if(pl) loopi(NUMGUNS) concatformatstring(weapstring, "%s%d %d", strlen(weapstring) ? " " : "", pl->pstatshots[i], pl->pstatdamage[i]);
result(weapstring);
}
@@ -1063,6 +1057,7 @@ playerent *newclient(int cn) // ensure valid entity
playerent *getclient(int cn) // ensure valid entity
{
+ if(cn == player1->clientnum) return player1;
return players.inrange(cn) ? players[cn] : NULL;
}
@@ -1352,7 +1347,7 @@ char *votestring(int type, const char *arg1, const char *arg2)
case SA_GIVEADMIN:
{
int cn = atoi(arg1);
- playerent *p = (cn == getclientnum() ? player1 : getclient(cn));
+ playerent *p = getclient(cn);
if(!p) break;
if (type == SA_KICK || type == SA_BAN)
{
@@ -1687,33 +1682,38 @@ playerent *updatefollowplayer(int shiftdirection)
// rotate
int oldidx = -1;
- if(players.inrange(player1->followplayercn)) oldidx = available.find(players[player1->followplayercn]);
+ if(players.inrange(player1->followplayercn)) oldidx = available.find(players[player1->followplayercn]);
if(oldidx<0) oldidx = 0;
int idx = (oldidx+shiftdirection) % available.length();
if(idx<0) idx += available.length();
- if(player1->followplayercn != available[idx]->clientnum) addmsg(SV_SPECTCN, "ri", available[idx]->clientnum);
player1->followplayercn = available[idx]->clientnum;
return players[player1->followplayercn];
}
+void spectate()
+{
+ if(m_demo) return;
+ if(!team_isspect(player1->team)) addmsg(SV_SPECTATE, "ri", player1->clientnum);
+ else tryrespawn();
+}
+
void setfollowplayer(int cn)
{
// silently ignores invalid player-cn value passed
if(players.inrange(cn))
{
- if(!(m_teammode && player1->team != TEAM_SPECT && !watchingdemo && team_base(players[cn]->team) != team_base(player1->team)))
+ if(!(m_teammode && !watchingdemo && team_base(players[cn]->team) != team_base(player1->team)))
{
- if(player1->followplayercn != players[cn]->clientnum) addmsg(SV_SPECTCN, "ri", cn);
player1->followplayercn = cn;
+ if(player1->spectatemode == SM_FLY) player1->spectatemode = SM_FOLLOW1ST;
}
}
}
// set new spect mode
-void spectate(int mode)
+void spectatemode(int mode)
{
- if(!player1->isspectating()) return;
if(!m_teammode && !team_isspect(player1->team) && servstate.mastermode == MM_MATCH) return; // during ffa matches only SPECTATORS can spectate
if(mode == player1->spectatemode) return;
showscores(false);
@@ -1740,7 +1740,6 @@ void spectate(int mode)
}
else entinmap(player1); // or drop 'em at a random place
player1->followplayercn = FPCN_FLY;
- addmsg(SV_SPECTCN, "ri", player1->followplayercn);
}
break;
}
@@ -1755,13 +1754,13 @@ void spectate(int mode)
void togglespect() // cycle through all spectating modes
{
if(m_botmode)
- spectate(SM_FLY);
+ spectatemode(SM_FLY);
else
{
int mode;
if(player1->spectatemode==SM_NONE) mode = SM_FOLLOW1ST; // start with 1st person spect
else mode = SM_FOLLOW1ST + ((player1->spectatemode - SM_FOLLOW1ST + 1) % (SM_OVERVIEW-SM_FOLLOW1ST)); // replace SM_OVERVIEW by SM_NUM to enable overview mode
- spectate(mode);
+ spectatemode(mode);
}
}
@@ -1770,7 +1769,8 @@ void changefollowplayer(int shift)
updatefollowplayer(shift);
}
-COMMANDN(spectatemode, spectate, ARG_1INT);
+COMMAND(spectate, ARG_NONE);
+COMMAND(spectatemode, ARG_1INT);
COMMAND(togglespect, ARG_NONE);
COMMAND(changefollowplayer, ARG_1INT);
COMMAND(setfollowplayer, ARG_1INT);
diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp
index 56f35576..b7ea6359 100644
--- a/source/src/clients2c.cpp
+++ b/source/src/clients2c.cpp
@@ -660,7 +660,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_SPAWNSTATE:
{
-
if ( map_quality == MAP_IS_BAD )
{
loopi(6+2*NUMGUNS) getint(p);
@@ -681,9 +680,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
int arenaspawn = getint(p);
loopi(NUMGUNS) player1->ammo[i] = getint(p);
loopi(NUMGUNS) player1->mag[i] = getint(p);
- //2011oct16:flowtron:keep spectator state
- bool pws = player1->state == CS_SPECTATE;
- player1->state = pws?CS_SPECTATE:CS_ALIVE;
+ player1->state = CS_ALIVE;
lastspawn = lastmillis;
findplayerstart(player1, false, arenaspawn);
arenaintermission = 0;
@@ -701,9 +698,20 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
break;
}
- case SV_SPECTCN:
- getint(p);
+ case SV_SPECTATE:
+ {
+ int cn = getint(p);
+ playerent *s = getclient(cn);
+ if(!s) break;
+ s->state = CS_SPECTATE;
+ s->team = TEAM_SPECT;
+ if(s == player1)
+ {
+ showscores(false);
+ spectatemode(SM_FLY);
+ }
break;
+ }
case SV_SHOTFX:
{
@@ -750,7 +758,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_RELOAD:
{
int cn = getint(p), gun = getint(p);
- playerent *p = cn==getclientnum() ? player1 : getclient(cn);
+ playerent *p = getclient(cn);
if(p && p!=player1) p->weapons[gun]->reload();
break;
}
@@ -792,8 +800,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
damage = getint(p),
armour = getint(p),
health = getint(p);
- playerent *target = tcn==getclientnum() ? player1 : getclient(tcn),
- *actor = acn==getclientnum() ? player1 : getclient(acn);
+ playerent *target = getclient(tcn), *actor = getclient(acn);
if(!target || !actor) break;
target->armour = armour;
target->health = health;
@@ -808,7 +815,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
if ( count > 0 ) {
loopi(count){
int pcn = getint(p); int score = getint(p);
- playerent *ppl = pcn == getclientnum() ? player1 : getclient(pcn);
+ playerent *ppl = getclient(pcn);
if (!ppl) break;
ppl->points += score;
}
@@ -847,8 +854,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_DIED:
{
int vcn = getint(p), acn = getint(p), frags = getint(p), gun = getint(p);
- playerent *victim = vcn==getclientnum() ? player1 : getclient(vcn),
- *actor = acn==getclientnum() ? player1 : getclient(acn);
+ playerent *victim = getclient(vcn), *actor = getclient(acn);
if(!actor) break;
if ( m_mp(gamemode) ) actor->frags = frags;
if(!victim) break;
@@ -916,7 +922,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_ITEMACC:
{
int i = getint(p), cn = getint(p);
- playerent *d = cn==getclientnum() ? player1 : getclient(cn);
+ playerent *d = getclient(cn);
pickupeffects(i, d);
break;
}
@@ -1053,7 +1059,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
{
int fcn = getint(p);
int flags = getint(p);
- playerent *p = (fcn == getclientnum() ? player1 : getclient(fcn));
+ playerent *p = getclient(fcn);
if(p) p->flagscore = flags;
break;
}
@@ -1061,7 +1067,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_ARENAWIN:
{
int acn = getint(p);
- playerent *alive = acn<0 ? NULL : (acn==getclientnum() ? player1 : getclient(acn));
+ playerent *alive = getclient(acn);
conoutf(_("the round is over! next round in 5 seconds..."));
if(m_botmode && acn==-2) hudoutf(_("the bots have won the round!"));
else if(!alive) hudoutf(_("everyone died!"));
@@ -1169,7 +1175,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
break;
}
}
- if(you && !team_isspect(d->team) && team_isspect(fnt) && d->state == CS_DEAD) spectate(SM_FLY);
+ if(you && !team_isspect(d->team) && team_isspect(fnt) && d->state == CS_DEAD) spectatemode(SM_FLY);
}
}
else if(d->team != fnt && ftr == FTR_PLAYERWISH) conoutf(_("%s changed to active play"), you ? _("you") : colorname(d));
@@ -1282,7 +1288,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_WHOISINFO:
{
int cn = getint(p);
- playerent *pl = cn == getclientnum() ? player1 : getclient(cn);
+ playerent *pl = getclient(cn);
int ip = getint(p);
if(m_teammode) conoutf(_("%c0INFO: %c5%s has %d teamkills."), CC, CC, pl->name, pl->tks);
if((ip>>24&0xFF) > 0 || player1->clientrole==CR_ADMIN)
diff --git a/source/src/entities.cpp b/source/src/entities.cpp
index 5a2a6f0f..c7c2ca64 100644
--- a/source/src/entities.cpp
+++ b/source/src/entities.cpp
@@ -552,7 +552,7 @@ void flagscore(int fln)
void flagstolen(int flag, int act)
{
- playerent *actor = act == getclientnum() ? player1 : getclient(act);
+ playerent *actor = getclient(act);
flaginfo &f = flaginfos[flag];
f.actor = actor; // could be NULL if we just connected
f.actor_cn = act;
@@ -662,4 +662,4 @@ void syncentchanges(bool force)
}
changedents.setsize(0);
lastentsync = lastmillis;
-}
\ No newline at end of file
+}
diff --git a/source/src/protocol.cpp b/source/src/protocol.cpp
index 789c06a8..e09c289d 100644
--- a/source/src/protocol.cpp
+++ b/source/src/protocol.cpp
@@ -337,7 +337,7 @@ static const int msgsizes[] = // size inclusive message token, 0 f
SV_SETTEAM, 3, SV_TEAMDENY, 2, SV_SERVERMODE, 2,
SV_WHOIS, 2, SV_WHOISINFO, 3,
SV_LISTDEMOS, 1, SV_SENDDEMOLIST, 0, SV_GETDEMO, 2, SV_SENDDEMO, 0, SV_DEMOPLAYBACK, 3,
- SV_CONNECT, 0, SV_SPECTCN, 2,
+ SV_CONNECT, 0, SV_SPECTATE, 2,
SV_SWITCHNAME, 0, SV_SWITCHSKIN, 0, SV_SWITCHTEAM, 0,
SV_CLIENT, 0,
SV_EXTENSION, 0,
diff --git a/source/src/protocol.h b/source/src/protocol.h
index 9f3eeb71..d076c780 100644
--- a/source/src/protocol.h
+++ b/source/src/protocol.h
@@ -36,7 +36,7 @@ enum
SV_SETTEAM, SV_TEAMDENY, SV_SERVERMODE,
SV_WHOIS, SV_WHOISINFO,
SV_LISTDEMOS, SV_SENDDEMOLIST, SV_GETDEMO, SV_SENDDEMO, SV_DEMOPLAYBACK,
- SV_CONNECT, SV_SPECTCN,
+ SV_CONNECT, SV_SPECTATE,
SV_SWITCHNAME, SV_SWITCHSKIN, SV_SWITCHTEAM,
SV_CLIENT,
SV_EXTENSION,
diff --git a/source/src/protos.h b/source/src/protos.h
index 7f766ec8..c9e6e29c 100644
--- a/source/src/protos.h
+++ b/source/src/protos.h
@@ -423,7 +423,7 @@ extern char *colorpj(int pj);
extern const char *highlight(const char *text);
extern void togglespect();
extern playerent *updatefollowplayer(int shiftdirection = 0);
-extern void spectate(int mode);
+extern void spectatemode(int mode);
struct votedisplayinfo
{
diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp
index 6095c3f8..fb378066 100644
--- a/source/src/renderhud.cpp
+++ b/source/src/renderhud.cpp
@@ -436,22 +436,22 @@ void drawradar_showmap(playerent *p, int w, int h)
quad(minimaptex, 0, 0, minimapviewsize, 0.0f, 0.0f, 1.0f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_BLEND);
-
+
float gdim = max(mapdims[4], mapdims[5]); //no border
//float orthd = gdim/2.0f;
//float displace = (minimapviewsize/orthd)/2.0f;
float coordtrans = (minimapviewsize)/(gdim);
-
+
float offd = fabs(float(mapdims[5])-float(mapdims[4])) /2.0f;
if(!gdim) { gdim = ssize/2.0f; offd = 0; }
float offx = gdim==mapdims[5] ? offd : 0;
float offy = gdim==mapdims[4] ? offd : 0;
-
+
vec mdd = vec(mapdims[0]-offx, mapdims[1]-offy, 0);
vec cod(offx, offy, 0);
vec ppv = vec(p->o).sub(mdd).mul(coordtrans);
- if(team_isactive(p->team)) drawradarent(ppv.x, ppv.y, p->yaw, p->state==CS_ALIVE ? (isattacking(p) ? 2 : 0) : 1, 2, iconsize, isattacking(p), "%s", colorname(p)); // local player
+ if(team_isactive(p->team)) drawradarent(ppv.x, ppv.y, p->yaw, p->state==CS_ALIVE ? (isattacking(p) ? 2 : 0) : 1, 2, iconsize, isattacking(p), "%s", colorname(p)); // local player
loopv(players) // other players
{
playerent *pl = players[i];
@@ -692,7 +692,7 @@ void drawscores()
desttime+=0.3;
if(time < desttime) continue;
drawmedals(left, top, 0, 0, tex);
- playerent *mpl = a_medals[i].cn == getclientnum() ? player1 : getclient(a_medals[i].cn);
+ playerent *mpl = getclient(a_medals[i].cn);
draw_textf("%s %s: %d", left+txtdx, top+txtdy, medal_str[i], mpl->name, a_medals[i].item); top+=medalsdy;
}
}
diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp
index 707d3c0a..74840ea8 100644
--- a/source/src/rendermodel.cpp
+++ b/source/src/rendermodel.cpp
@@ -719,7 +719,7 @@ void renderclient(playerent *d)
void renderclients()
{
playerent *d;
- loopv(players) if((d = players[i]) && d->state!=CS_SPAWNING && (!player1->isspectating() || player1->spectatemode != SM_FOLLOW1ST || player1->followplayercn != i)) renderclient(d);
+ loopv(players) if((d = players[i]) && d->state!=CS_SPAWNING && d->state!=CS_SPECTATE && (!player1->isspectating() || player1->spectatemode != SM_FOLLOW1ST || player1->followplayercn != i)) renderclient(d);
if(player1->state==CS_DEAD || (reflecting && !refracting)) renderclient(player1);
}
diff --git a/source/src/server.cpp b/source/src/server.cpp
index 46f24b69..51680788 100644
--- a/source/src/server.cpp
+++ b/source/src/server.cpp
@@ -3030,11 +3030,18 @@ void process(ENetPacket *packet, int sender, int chan)
break;
}
- case SV_SPECTCN:
- cl->spectcn = getint(p);
-// logline(ACLOG_DEBUG, "[%s] %s is now spectating cn %d", cl->hostname, cl->name, cl->spectcn); // FIXME: comment out later
- QUEUE_MSG;
+ case SV_SPECTATE:
+ {
+ getint(p); // clientnum
+ if(team_isspect(cl->team)) break;
+
+ if(cl->state.state == CS_ALIVE) serverdamage(cl, cl, INT_MAX, GUN_KNIFE, false); // suicide if alive
+ cl->state.state = CS_SPECTATE;
+ cl->team = TEAM_SPECT;
+
+ sendf(-1, 1, "rii", SV_SPECTATE, cl->clientnum);
break;
+ }
case SV_SUICIDE:
{
@@ -3998,7 +4005,7 @@ void extinfo_statsbuf(ucharbuf &p, int pid, int bpos, ENetSocket &pongsock, ENet
putint(p,clients[i]->clientnum); //add player id
putint(p,clients[i]->ping); //Ping
sendstring(clients[i]->name,p); //Name
- sendstring(team_string(clients[i]->team),p); //Team
+ sendstring(team_string(clients[i]->team),p); //Team
// "team_string(clients[i]->team)" sometimes return NULL according to RK, causing the server to crash. WTF ?
putint(p,clients[i]->state.frags); //Frags
putint(p,clients[i]->state.flagscore); //Flagscore
diff --git a/source/src/server.h b/source/src/server.h
index c80f9f87..fcaba6f8 100644
--- a/source/src/server.h
+++ b/source/src/server.h
@@ -255,7 +255,6 @@ struct client // server side version of "dynent" type
int gameoffset, lastevent, lastvotecall;
int demoflags;
clientstate state;
- int spectcn;
vector events;
vector position, messages;
string lastsaytext;
@@ -344,7 +343,6 @@ struct client // server side version of "dynent" type
lastsaytext[0] = '\0';
saychars = 0;
spawnindex = -1;
- spectcn = FPCN_VOID;
authreq = 0; // for AUTH
mapchange();
freshgame = false; // don't spawn into running games
@@ -434,7 +432,7 @@ const char *messagenames[SV_NUM] =
"SV_SETTEAM", "SV_TEAMDENY", "SV_SERVERMODE",
"SV_WHOIS", "SV_WHOISINFO",
"SV_LISTDEMOS", "SV_SENDDEMOLIST", "SV_GETDEMO", "SV_SENDDEMO", "SV_DEMOPLAYBACK",
- "SV_CONNECT", "SV_SPECTCN",
+ "SV_CONNECT", "SV_SPECTATE",
"SV_SWITCHNAME", "SV_SWITCHSKIN", "SV_SWITCHTEAM",
"SV_CLIENT",
"SV_EXTENSION",
@@ -481,15 +479,15 @@ guninfo guns[NUMGUNS] =
//modelname reload attackdelay projspeed spread magsize mKB reB reF isauto
// sound reloadtime damage part recoil mKR reI reM pFX
{ "knife", S_KNIFE, S_NULL, 0, 500, 50, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, false },
- { "pistol", S_PISTOL, S_RPISTOL, 1400, 160, 18, 0, 0, 53, 10, 10, 6, 5, 6, 35, 58, 125, 1, false },
+ { "pistol", S_PISTOL, S_RPISTOL, 1400, 160, 18, 0, 0, 53, 10, 10, 6, 5, 6, 35, 58, 125, 1, false },
{ "carbine", S_CARBINE, S_RCARBINE, 1800, 720, 60, 0, 0, 10, 60, 10, 4, 4, 10, 60, 60, 150, 1, false },
{ "shotgun", S_SHOTGUN, S_RSHOTGUN, 2400, 1000, 1, 0, 0, 1, 35, 7, 9, 9, 10, 140, 140, 125, 1, false }, // CAUTION dmg only sane for server!
- { "subgun", S_SUBGUN, S_RSUBGUN, 1650, 80, 15, 0, 0, 45, 15, 30, 1, 2, 4, 30, 50, 188, 1, true },
+ { "subgun", S_SUBGUN, S_RSUBGUN, 1650, 80, 15, 0, 0, 45, 15, 30, 1, 2, 4, 30, 50, 188, 1, true },
{ "sniper", S_SNIPER, S_RSNIPER, 1950, 1500, 80, 0, 0, 50, 50, 5, 4, 4, 10, 85, 85, 100, 1, false }, // 2011may22:ft: dmg 82->80, spread 50
{ "assault", S_ASSAULT, S_RASSAULT, 2000, 120, 22, 0, 0, 20, 40, 15, 0, 2, 2, 22, 55, 115, 1, true }, // 2011jan17:ft: 24=>22
{ "cpistol", S_PISTOL, S_RPISTOL, 1400, 120, 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, 50, 10, 20, 6, 5, 10, 10, 18, 115, 1, true },
+ { "pistol", S_PISTOL, S_RAKIMBO, 1400, 80, 19, 0, 0, 50, 10, 20, 6, 5, 10, 10, 18, 115, 1, true },
};
const char *teamnames[TEAM_NUM+1] = {"CLA", "RVSF", "CLA-SPECT", "RVSF-SPECT", "SPECTATOR", "void"};
diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp
index 716a0e8f..d5a6421d 100644
--- a/source/src/weapon.cpp
+++ b/source/src/weapon.cpp
@@ -624,7 +624,7 @@ void raydamage(vec &from, vec &to, playerent *d)
dmgreal = min(dmgreal, SGMAXDMGABS);
}
if(numhits) hitpush( dmgreal, o, d, from, to, d->weaponsel->type, dmgreal == SGMAXDMGABS, dmgreal);
-
+
if(d==player1) hitted = true;
hitscount+=numhits;
}
@@ -688,7 +688,7 @@ void r_accuracy()
vector lines;
int rows=0, cols=0;
float x_offset = curfont->defaultw, y_offset = 3*VIRTH/2, spacing = curfont->defaultw*2;
- loopi(NUMGUNS) if(i != GUN_CPISTOL && accuracym[i].shots)
+ loopi(NUMGUNS) if(i != GUN_CPISTOL && accuracym[i].shots)
{
float acc;
string line;
@@ -848,7 +848,7 @@ void weapon::renderhudmodel(int lastaction, int index)
weaponmove wm;
if(!intermission) wm.calcmove(unitv, lastaction, p);
defformatstring(widn)("modmdlweap%d", type);
- defformatstring(path)("weapons/%s", identexists(widn)?getalias(widn):info.modelname);
+ defformatstring(path)("weapons/%s", identexists(widn)?getalias(widn):info.modelname);
bool emit = (wm.anim&ANIM_INDEX)==ANIM_GUN_SHOOT && (lastmillis - lastaction) < flashtime();
rendermodel(path, wm.anim|ANIM_DYNALLOC|(righthanded==index ? ANIM_MIRROR : 0)|(emit ? ANIM_PARTICLE : 0), 0, -1, wm.pos, p->yaw+90, p->pitch+wm.k_rot, 40.0f, wm.basetime, NULL, NULL, 1.28f);
}
@@ -936,7 +936,7 @@ void grenadeent::splash()
if(owner == player1)
{
accuracym[GUN_GRENADE].shots++;
- }
+ }
else if(!m_botmode)
{
return;
@@ -1556,7 +1556,7 @@ COMMAND(setscope, ARG_1INT);
void shoot(playerent *p, vec &targ)
{
- if(p->state==CS_DEAD || p->weaponchanging) return;
+ if(p->state!=CS_ALIVE || p->weaponchanging) return;
weapon *weap = p->weaponsel;
if(weap)
{
@@ -1619,6 +1619,6 @@ void checkweaponstate()
{
checkweaponswitch();
checkakimbo();
-
+
// TODO : here we need to check properly that the spectated player weapon has finished to reload...
-}
\ No newline at end of file
+}