HUDEXTRAS messages
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5034 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+1
-1
@@ -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] =
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user