diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index df7259c6..cb2c0df2 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -228,6 +228,7 @@ bool good_map() VARP(hudextras, 0, 0, 3); int teamworkid = -1; + void showhudextras(char hudextras, char value){ void (*outf)(const char *s, ...) = (hudextras > 1 ? hudoutf : conoutf); char *(*spam)(const char *s, char *o, int max) = (hudextras == 2 ? stolower : stoupper), o[50]; @@ -235,26 +236,39 @@ void showhudextras(char hudextras, char value){ switch(value) { case HE_COMBO: - outf("\f5%s",SSPAM("Combo")); break; - case HE_MASTERCOMBO: - outf("\f5%s",SSPAM("Mastercombo")); break; + case HE_COMBO2: + case HE_COMBO3: + case HE_COMBO4: + case HE_COMBO5: + { + int n = value+1 - HE_COMBO; + if (n > 4) outf("\f3%s",SSPAM("monster combo!!!")); + else if (!n) outf("\f5%s",SSPAM("combo")); + else outf("\f5%s x%d",SSPAM("multi combo"),n); + break; + } + case HE_KILL2: + case HE_KILL3: + case HE_KILL4: + case HE_KILL5: + { + int n = value - HE_KILL2; + if (n > 4) outf("\f3%s",SSPAM("monster kill!!!")); + else if (!n) outf("\f5%s",SSPAM("double kill")); + else outf("\f5%s x%d",SSPAM("multi kill"),n+1); + break; + } case HE_TEAMWORK: - outf("\f5%s",SSPAM("Teamwork done")); break; + outf("\f5%s",SSPAM("teamwork done")); break; case HE_FLAGDEFENDED: - outf("\f5%s",SSPAM("You defended the flag")); break; + outf("\f5%s",SSPAM("you defended the flag")); break; case HE_FLAGCOVERED: - outf("\f5%s",SSPAM("You covered the flag")); break; - case HE_DOUBLEKILL: - outf("\f5%s",SSPAM("Double kill")); break; - case HE_MULTIKILL: - outf("\f5%s",SSPAM("Multi kill")); break; - case HE_MONSTERKILL: - outf("\f5%s",SSPAM("Monster kill")); break; + outf("\f5%s",SSPAM("you covered the flag")); break; case HE_COVER: if (teamworkid >= 0) { playerent *p = getclient(teamworkid); if (!p || p == player1) teamworkid = -1; - else outf("\f5%s %s",SSPAM("You covered"),p->name); break; + else outf("\f5you covered %s",p->name); break; } default: { @@ -262,7 +276,7 @@ void showhudextras(char hudextras, char value){ teamworkid = value-100; playerent *p = getclient(teamworkid); if (!p || p == player1) teamworkid = -1; - else outf("\f4You replied to %s",p->name); + else outf("\f4you replied to %s",p->name); } else outf("\f3Update your client, NOOB!"); break; diff --git a/source/src/entity.h b/source/src/entity.h index 92ea9e4c..e6888641 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -43,9 +43,6 @@ struct entity : persistent_entity } }; -/** I did not find better place to put this definition FIXME*/ -enum { HE_COMBO, HE_MASTERCOMBO, HE_COVER, HE_TEAMWORK, HE_FLAGDEFENDED, HE_FLAGCOVERED, HE_DOUBLEKILL, HE_MULTIKILL, HE_MONSTERKILL, HE_NUM }; - enum { GUN_KNIFE = 0, GUN_PISTOL, GUN_RIFLE, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT, GUN_GRENADE, GUN_AKIMBO, NUMGUNS }; #define reloadable_gun(g) (g != GUN_KNIFE && g != GUN_GRENADE) diff --git a/source/src/protocol.cpp b/source/src/protocol.cpp index f2f1b06e..d67099ef 100644 --- a/source/src/protocol.cpp +++ b/source/src/protocol.cpp @@ -339,7 +339,7 @@ static const int msgsizes[] = // size inclusive message token, 0 f SV_SWITCHNAME, 0, SV_SWITCHSKIN, 0, SV_SWITCHTEAM, 0, SV_CLIENT, 0, SV_EXTENSION, 0, - SV_MAPIDENT, 3, SV_HUDEXTRAS, 1, + SV_MAPIDENT, 3, SV_HUDEXTRAS, 1, SV_POINTS, 0, -1 }; diff --git a/source/src/protocol.h b/source/src/protocol.h index 8f424d48..74933dfc 100644 --- a/source/src/protocol.h +++ b/source/src/protocol.h @@ -40,7 +40,7 @@ enum SV_SWITCHNAME, SV_SWITCHSKIN, SV_SWITCHTEAM, SV_CLIENT, SV_EXTENSION, - SV_MAPIDENT, SV_HUDEXTRAS, SV_NUM + SV_MAPIDENT, SV_HUDEXTRAS, SV_POINTS, SV_NUM }; #ifdef _DEBUG @@ -61,6 +61,8 @@ enum { FM_PICKUP = 0, FM_DROP, FM_LOST, FM_RETURN, FM_SCORE, FM_KTFSCORE, FM_SCO enum { LMSITEM_CLEAR = 0, LMSITEM_ANNOUNCE, LMSITEM_SPAWN, LMSITEM_NUM }; enum { FTR_INFO = 0, FTR_PLAYERWISH, FTR_AUTOTEAM, FTR_SILENTFORCE, FTR_NUM }; // forceteam-reasons enum { SP_OK = 0, SP_REFILLMATCH, SP_OK_NUM, SP_WRONGMAP, SP_SPECT, SP_NUM }; // spawn permission (md.points += points; + c->md.updated = true; + c->md.upmillis = gamemillis + 200; +} + inline int minhits2combo(int gun) { switch (gun) @@ -111,9 +117,9 @@ void checkcombo (client *target, client *actor, int damage, int gun) actor->md.combotime+=diffhittime; actor->md.combodamage+=damage; int mh2c = minhits2combo(gun); - if ( actor->md.combohits > mh2c && actor->md.combo < 3 && actor->md.combohits % mh2c == 1 ) { - actor->md.combo++; - actor->md.points += 10; + if ( actor->md.combohits > mh2c && actor->md.combohits % mh2c == 1 ) { + if (actor->md.combo < 5) actor->md.combo++; + addpt(actor,10); actor->md.ncombos++; } } @@ -126,8 +132,8 @@ void checkcombo (client *target, client *actor, int damage, int gun) actor->md.combohits++; actor->md.combotime+=diffhittime; actor->md.combodamage+=damage; - actor->md.combo++; - actor->md.points += 10; + if (actor->md.combo < 5) actor->md.combo++; + addpt(actor,10); actor->md.ncombos++; break; } @@ -138,7 +144,6 @@ void checkcombo (client *target, client *actor, int damage, int gun) actor->md.combodamage=0; actor->md.combohits=0; } - actor->md.lastgun = gun; } @@ -218,7 +223,7 @@ inline void testcover(int msg, int factor, client *actor) { if ( a2c < COVERDIST && c2t < COVERDIST && a2t < COVERDIST ) { sendf(actor->clientnum, 1, "ri2", SV_HUDEXTRAS, msg); - actor->md.points += factor * clientnumber; /** clientnumber now include the spectators... FIXME */ + addpt(actor, factor * clientnumber); /** clientnumber now include the spectators... FIXME */ actor->md.ncovers++; } } @@ -286,42 +291,40 @@ void checkfrag (client *target, client *actor, int gun, bool gib) { int targethasflag = clienthasflag(target->clientnum); int actorhasflag = clienthasflag(actor->clientnum); - target->md.points -= 5; + addpt(target,-5); if(target!=actor) { if(!isteam(target->team, actor->team)) { if (m_teammode) { - if(!m_flags) actor->md.points += 5 * target->md.points / 100; - else actor->md.points += 4 * target->md.points / 100; + if(!m_flags) addpt(actor, 5 * target->md.points / 100); + else addpt(actor, 4 * target->md.points / 100); checkcover (target, actor); - if ( m_htf && actorhasflag >= 0 ) actor->md.points += clientnumber; + if ( m_htf && actorhasflag >= 0 ) addpt(actor, clientnumber); if ( targethasflag >= 0 ) { - actor->md.points += 3 * clientnumber; - if ( m_htf ) target->md.points -= clientnumber; + addpt(actor, 3 * clientnumber); + if ( m_htf ) addpt(target, -1 * clientnumber); } } - else actor->md.points += 3 * target->md.points / 100; + else addpt(actor, 3 * target->md.points / 100); if (gib) { - if ( gun == GUN_GRENADE ) actor->md.points += 10; + if ( gun == GUN_GRENADE ) addpt(actor, 10); else if ( gun == GUN_SNIPER ) { - actor->md.points += 15; + addpt(actor, 15); actor->md.nhs++; } - else if ( gun == GUN_KNIFE ) actor->md.points += 20; + else if ( gun == GUN_KNIFE ) addpt(actor, 20); } - else actor->md.points += 10; + else addpt(actor, 10); - if ( actor->md.combo ) sendf(actor->clientnum, 1, "ri2", SV_HUDEXTRAS, actor->md.combo > 2 ? HE_MASTERCOMBO : HE_COMBO); + if ( actor->md.combo ) sendf(actor->clientnum, 1, "ri2", SV_HUDEXTRAS, actor->md.combo-1 + HE_COMBO); } else { - if ( targethasflag >= 0 ) { - actor->md.points -= 2 * clientnumber; - } - else actor->md.points -= 10; + if ( targethasflag >= 0 ) addpt(actor, -2 * clientnumber); + else addpt(actor, -10); } }