clean up, and FIXME comments

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5527 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-08-02 21:10:49 +00:00
parent 437aca87f5
commit 53d17b76ad
5 changed files with 12 additions and 110 deletions
+1 -12
View File
@@ -631,20 +631,9 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
break;
}
case SV_SCOPE:
case SV_SCOPE: // FIXME remove in the next protocol change
{
int cn = getint(p), val = getint(p);
playerent *p = cn==getclientnum() ? player1 : getclient(cn);
if(!p || p==player1) break;
if(p->weaponsel->type != GUN_SNIPER)
{
/* The change weapon and the scope informations may exchange due to lag */
/* So, I do not think this break is necessary... */
// conoutf(_("bad scope-message for %s"), p->name);
break;
}
sniperrifle *sr = (sniperrifle *)p->weaponsel;
sr->setscope(val!=0);
break;
}
+3 -3
View File
@@ -20,7 +20,7 @@ enum
{
SV_SERVINFO = 0, SV_WELCOME, SV_INITCLIENT, SV_POS, SV_POSC, SV_POSN, SV_TEXT, SV_TEAMTEXT, SV_TEXTME, SV_TEAMTEXTME,
SV_SOUND, SV_VOICECOM, SV_VOICECOMTEAM, SV_CDIS,
SV_SHOOT, SV_EXPLODE, SV_SUICIDE, SV_AKIMBO, SV_RELOAD, SV_SCOPE,
SV_SHOOT, SV_EXPLODE, SV_SUICIDE, SV_AKIMBO, SV_RELOAD, SV_SCOPE, // FIXME remove SV_SCOPE in the next protocol change
SV_GIBDIED, SV_DIED, SV_GIBDAMAGE, SV_DAMAGE, SV_HITPUSH, SV_SHOTFX, SV_THROWNADE,
SV_TRYSPAWN, SV_SPAWNSTATE, SV_SPAWN, SV_SPAWNDENY, SV_FORCEDEATH, SV_RESUME,
SV_DISCSCORES, SV_TIMEUP, SV_EDITENT, SV_ITEMACC,
@@ -31,9 +31,9 @@ enum
SV_SERVMSG, SV_ITEMLIST, SV_WEAPCHANGE, SV_PRIMARYWEAP,
SV_FLAGACTION, SV_FLAGINFO, SV_FLAGMSG, SV_FLAGCNT,
SV_ARENAWIN, SV_LMSITEM,
SV_SETADMIN, SV_SERVOPINFO,
SV_SETADMIN, SV_SERVOPINFO,
SV_CALLVOTE, SV_CALLVOTESUC, SV_CALLVOTEERR, SV_VOTE, SV_VOTERESULT,
SV_SETTEAM, SV_TEAMDENY, SV_SERVERMODE,
SV_SETTEAM, SV_TEAMDENY, SV_SERVERMODE,
SV_WHOIS, SV_WHOISINFO,
SV_LISTDEMOS, SV_SENDDEMOLIST, SV_GETDEMO, SV_SENDDEMO, SV_DEMOPLAYBACK,
SV_CONNECT, SV_SPECTCN,
+1 -83
View File
@@ -1107,80 +1107,6 @@ void arenacheck()
if(autoteam && m_teammode) refillteams(true);
}
//#define LMS_CLEARATROUNDSTART
//#define LMS_ITEMMAXAGE 2
/*void lmscheck() // spawn random item class once per round
{
const int types[] = { I_CLIPS, I_AMMO, I_GRENADE, I_GRENADE, I_HEALTH, I_HELMET, I_ARMOUR, I_AKIMBO }, types_n = sizeof(types) / sizeof(types[0]); // double probability for grenades ;)
static bool cleared = false, announced = false, spawned = false;
#ifndef LMS_CLEARATROUNDSTART
static int lasttypes[LMS_ITEMMAXAGE + 1] = { NOTUSED };
#endif
if(!m_lms || !numactiveclients()) return;
if(arenaround || !arenaroundstartmillis) // during intermission:
{
cleared = false;
arenaroundstartmillis |= 1;
}
else if(gamemillis - arenaroundstartmillis < 5 * 1000) // at round start: clear remaining items from former rounds
{
if(!cleared)
{
#ifdef LMS_CLEARATROUNDSTART
loopv(sents) sents[i].spawned = sents[i].legalpickup = false;
sendf(-1, 1, "riii", SV_LMSITEM, LMSITEM_CLEAR, NOTUSED);
#else
bool doclear = lasttypes[LMS_ITEMMAXAGE] != NOTUSED;
loopv(sents)
{
if(!sents[i].spawned || (doclear && lasttypes[LMS_ITEMMAXAGE] == sents[i].type) > 2) sents[i].spawned = sents[i].legalpickup = false;
else sents[i].legalpickup = sents[i].spawned;
}
if(doclear) sendf(-1, 1, "riii", SV_LMSITEM, LMSITEM_CLEAR, lasttypes[LMS_ITEMMAXAGE]);
#endif
announced = false;
spawned = false;
}
cleared = true;
}
else if(gamemillis - arenaroundstartmillis < 15 * 1000) // 5 seconds after round start: announce item class
{
if(!announced)
{
int avail = 0;
loopi(types_n) if(smapstats.entcnt[types[i]]) avail++;
int pick = rnd(avail + avail / 2 + 1);
lmsitemtype = NOTUSED;
if(pick < avail)
{
loopi(types_n) if(smapstats.entcnt[types[i]] && !pick--) lmsitemtype = types[i];
}
if(avail) sendf(-1, 1, "riii", SV_LMSITEM, LMSITEM_ANNOUNCE, lmsitemtype);
#ifndef LMS_CLEARATROUNDSTART
for(int i = LMS_ITEMMAXAGE - 1; i >= 0; i--) lasttypes[i + 1] = lasttypes[i] == lmsitemtype ? NOTUSED : lasttypes[i];
lasttypes[0] = lmsitemtype;
#endif
}
announced = true;
cleared = false;
}
else // 15 seconds after round start: spawn items
{
if(!spawned && lmsitemtype != NOTUSED)
{
#ifdef LMS_CLEARATROUNDSTART
loopv(sents) sents[i].spawned = sents[i].legalpickup = sents[i].type == lmsitemtype;
#else
loopv(sents) if(sents[i].type == lmsitemtype) sents[i].spawned = sents[i].legalpickup = true;
#endif
sendf(-1, 1, "riii", SV_LMSITEM, LMSITEM_SPAWN, lmsitemtype);
logline(ACLOG_INFO, "spawned all \"%s\" items", entnames[lmsitemtype]);
}
spawned = true;
}
}*/
#define SPAMREPEATINTERVAL 20 // detect doubled lines only if interval < 20 seconds
#define SPAMMAXREPEAT 3 // 4th time is SPAM
#define SPAMCHARPERMINUTE 220 // good typist
@@ -1537,15 +1463,11 @@ bool updateclientteam(int cln, int newteam, int ftr)
int calcscores() // skill eval
{
/* int fp12 = (m_ctf || m_htf) ? 55 : 33;
int fp3 = (m_ctf || m_htf) ? 25 : 15;*/
int sum = 0;
loopv(clients) if(clients[i]->type!=ST_EMPTY)
{
clientstate &cs = clients[i]->state;
sum += clients[i]->at3_score = cs.points > 0 ? ufSqrt((float)cs.points) : -ufSqrt((float)-cs.points);
/* sum += clients[i]->at3_score = (cs.frags * 100) / (cs.deaths ? cs.deaths : 1)
+ (cs.flagscore < 3 ? fp12 * cs.flagscore : 2 * fp12 + fp3 * (cs.flagscore - 2));*/
}
return sum;
}
@@ -2900,12 +2822,8 @@ void process(ENetPacket *packet, int sender, int chan)
break;
}
case SV_SCOPE:
case SV_SCOPE: // FIXME remove in the next protocol change
{
gameevent &scoping = cl->addevent();
scoping.type = GE_SCOPING;
seteventmillis(scoping.scoping);
scoping.scoping.scoped = getint(p)!=0;
break;
}
+2 -2
View File
@@ -89,9 +89,9 @@ void processevent(client *c, pickupevent &e)
serverpickup(e.ent, c->clientnum);
}
void processevent(client *c, scopeevent &e)
void processevent(client *c, scopeevent &e) // FIXME remove in the next protocol change
{
clientstate &gs = c->state;
clientstate &gs = c->state;
if(!gs.isalive(gamemillis)/* || e.gun!=GUN_SNIPER*/) return; // currently we check the gun on the client-side only
gs.scoped = e.scoped;
sendf(-1, 1, "ri3", SV_SCOPE, c->clientnum, gs.scoped);
+5 -10
View File
@@ -1083,7 +1083,7 @@ void sniperrifle::attackfx(const vec &from, const vec &to, int millis)
bool sniperrifle::reload()
{
bool r = weapon::reload();
if(owner==player1 && r) { scoped = false; player1->scoping = false; /*addmsg(SV_SCOPE, "ri2", lastmillis, 0);*/ }
if(owner==player1 && r) { scoped = false; player1->scoping = false; }
return r;
}
@@ -1102,9 +1102,9 @@ int sniperrifle::dynspread()
}
float sniperrifle::dynrecoil() { return scoped && lastmillis - scoped_since > SCOPESETTLETIME ? info.recoil / 3 : info.recoil; }
bool sniperrifle::selectable() { return weapon::selectable() && !m_noprimary && this == owner->primweap; }
void sniperrifle::onselecting() { weapon::onselecting(); scoped = false; player1->scoping = false; /*addmsg(SV_SCOPE, "ri2", lastmillis, 0);*/ }
void sniperrifle::ondeselecting() { scoped = false; player1->scoping = false; /*addmsg(SV_SCOPE, "ri2", lastmillis, 0);*/ }
void sniperrifle::onownerdies() { scoped = false; player1->scoping = false; /*addmsg(SV_SCOPE, "ri2", lastmillis, 0);*/ }
void sniperrifle::onselecting() { weapon::onselecting(); scoped = false; player1->scoping = false; }
void sniperrifle::ondeselecting() { scoped = false; player1->scoping = false; }
void sniperrifle::onownerdies() { scoped = false; player1->scoping = false; }
void sniperrifle::renderhudmodel() { if(!scoped) weapon::renderhudmodel(); }
void sniperrifle::renderaimhelp(bool teamwarning)
@@ -1118,12 +1118,7 @@ void sniperrifle::setscope(bool enable)
if(this == owner->weaponsel && !reloading && owner->state == CS_ALIVE)
{
if(scoped == false && enable == true) scoped_since = lastmillis;
if(player1 == owner && enable != scoped) player1->scoping = enable /*addmsg(SV_SCOPE, "ri2", lastmillis, enable)*/;
// 2010 MAY 17 : flowtron:
// if(watching_demo) we might need to ignore some messages
// e.g. I got one where I pressed SCOPE during the auto-reload -
// that makes it pop up during playback, but not during actual gametime
// since then reloading was true - seems it isn't during playback - test, verify, correct bug .. test, verify .. commit
if(player1 == owner && enable != scoped) player1->scoping = enable;
scoped = enable;
}
}