diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index ca0fc262..dea7a69c 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -225,6 +225,19 @@ bool good_map() return checked; } +VARP(hudextras, 0, 0, 2); + +void showhudextras(char hudextras, char value){ + void (*outf)(const char *s, ...) = (hudextras == 2 ? hudoutf : conoutf); + switch(value) + { + case 0: + outf("\f2COMBO"); break; + default: + outf("\f2new message"); break; + } +} + void parsemessages(int cn, playerent *d, ucharbuf &p) { static char text[MAXTRANS]; @@ -572,6 +585,12 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) break; } + case SV_HUDEXTRAS: + { + char value = getint(p); + if (hudextras) showhudextras(hudextras, value); + } + case SV_HITPUSH: { int gun = getint(p), damage = getint(p); diff --git a/source/src/protocol.cpp b/source/src/protocol.cpp index eda30fc3..f2f1b06e 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_MAPIDENT, 3, SV_HUDEXTRAS, 1, -1 }; diff --git a/source/src/protocol.h b/source/src/protocol.h index 95eccad4..8f424d48 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_NUM + SV_MAPIDENT, SV_HUDEXTRAS, SV_NUM }; #ifdef _DEBUG diff --git a/source/src/server.cpp b/source/src/server.cpp index 5679e3e0..16149f2a 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1314,7 +1314,7 @@ void serverdamage(client *target, client *actor, int damage, int gun, bool gib, if(!v.iszero()) v.normalize(); sendf(target->clientnum, 1, "ri6", SV_HITPUSH, gun, damage, int(v.x*DNF), int(v.y*DNF), int(v.z*DNF)); - combopoints (target, actor, damage, gun); + checkcombo (target, actor, damage, gun); } if(ts.health<=0) { diff --git a/source/src/server.h b/source/src/server.h index 6b394452..0a90d46e 100644 --- a/source/src/server.h +++ b/source/src/server.h @@ -362,7 +362,7 @@ const char *messagenames[SV_NUM] = "SV_SWITCHNAME", "SV_SWITCHSKIN", "SV_SWITCHTEAM", "SV_CLIENT", "SV_EXTENSION", - "SV_MAPIDENT" + "SV_MAPIDENT", "SV_HUDEXTRAS" }; const char *entnames[MAXENTTYPES] = diff --git a/source/src/serverchecks.h b/source/src/serverchecks.h index d4c0a4ba..c6f43af5 100644 --- a/source/src/serverchecks.h +++ b/source/src/serverchecks.h @@ -89,7 +89,7 @@ inline int minhits2combo(int gun) } } -void combopoints (client *target, client *actor, int damage, int gun) +void checkcombo (client *target, client *actor, int damage, int gun) { int diffhittime = gamemillis - actor->lasthit; actor->lasthit = gamemillis; @@ -97,7 +97,7 @@ void combopoints (client *target, client *actor, int damage, int gun) if ( diffhittime < 900 ) { if ( gun == actor->lastgun ) { - if ( diffhittime < guns[gun].attackdelay * 1.25 ) { + if ( diffhittime * 4 < guns[gun].attackdelay * 5 ) { actor->combohits++; actor->combotime+=diffhittime; actor->combodamage+=damage; @@ -106,6 +106,7 @@ void combopoints (client *target, client *actor, int damage, int gun) actor->combo++; actor->points++; actor->ncombos++; + sendf(actor->clientnum, 1, "ri", SV_HUDEXTRAS, 0); } } } else { @@ -121,6 +122,7 @@ void combopoints (client *target, client *actor, int damage, int gun) actor->combo++; actor->points++; actor->ncombos++; + sendf(actor->clientnum, 1, "ri", SV_HUDEXTRAS, 0); break; } } @@ -131,6 +133,7 @@ void combopoints (client *target, client *actor, int damage, int gun) actor->combodamage=0; actor->combohits=0; } + actor->lastgun = gun; }