attribute damage blend effects to spectated player

...and clear it in case a different player is followed

also: cleanup
This commit is contained in:
ac-stef
2017-05-12 19:07:38 +02:00
parent 33af150e23
commit 12925eaebc
5 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -875,7 +875,7 @@ void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bo
if(pl == h)
{
if(pl != actor) updatedmgindicator(pl, actor->o);
damageblend(damage);
damageblend(damage, pl);
pl->damageroll(damage);
}
+1 -1
View File
@@ -388,7 +388,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false)
{
static char text[MAXTRANS];
int type, joining = 0;
bool demoplayback = false;
while(p.remaining())
{
@@ -1385,6 +1384,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false)
case SV_DEMOPLAYBACK:
{
bool demoplayback = false;
string demofile;
extern char *curdemofile;
if(demo && watchingdemo && demoprotocol == 1132)
+1 -1
View File
@@ -402,7 +402,6 @@ extern void renderaboveheadicon(playerent *p);
extern void drawscope(bool preload = false);
extern float dynfov();
extern int fog;
extern void damageblend(int n);
// shadow
extern bool addshadowbox(const vec &bbmin, const vec &bbmax, const vec &extrude, const glmatrixf &mat);
@@ -772,6 +771,7 @@ enum
HUDMSG_TYPE = 0xFF,
HUDMSG_OVERWRITE = 1<<8
};
extern void damageblend(int n, void *p);
extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater);
extern void loadingscreen(const char *fmt = NULL, ...) PRINTFARGS(1, 2);
extern void hudoutf(const char *s, ...) PRINTFARGS(1, 2);
+5 -3
View File
@@ -692,17 +692,19 @@ void drawteamicons(int w, int h, bool spect)
}
int damageblendmillis = 0;
void *damageblendplayer = NULL;
VARFP(damagescreen, 0, 1, 1, { if(!damagescreen) damageblendmillis = 0; });
VARP(damagescreenfactor, 1, 7, 100);
VARP(damagescreenalpha, 1, 45, 100);
VARP(damagescreenfade, 0, 125, 1000);
void damageblend(int n)
void damageblend(int n, void *p)
{
if(!damagescreen) return;
if(lastmillis > damageblendmillis) damageblendmillis = lastmillis;
if(lastmillis > damageblendmillis || damageblendplayer != p) damageblendmillis = lastmillis;
damageblendmillis += n*damagescreenfactor;
damageblendplayer = p;
}
void drawmedals(float x, float y, int col, int row, Texture *tex)
@@ -790,7 +792,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
glEnd();
}
if(lastmillis < damageblendmillis)
if(lastmillis < damageblendmillis && damageblendplayer == p)
{
static Texture *damagetex = NULL;
if(!damagetex) damagetex = textureload("packages/misc/damage.png", 3);
+1 -1
View File
@@ -423,7 +423,7 @@ void hit(int damage, playerent *d, playerent *at, const vec &vel, int gun, bool
h.dir = ivec(0, 0, 0);
d->damageroll(damage);
if(d != at) updatedmgindicator(player1, at->o);
damageblend(damage);
damageblend(damage, d);
damageeffect(damage, d);
audiomgr.playsound(S_PAIN6, SP_HIGH);
}