From c86bec42503c544370709cc89967f2ff855ab2f2 Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 8 Nov 2008 20:46:11 +0000 Subject: [PATCH] reintroduced old&nasty things: var damagescreen, disabled by default git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3456 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 4 +++- source/src/protos.h | 1 + source/src/renderhud.cpp | 25 ++++++++++++++++++++++--- source/src/weapon.cpp | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 541126b3..a42ece51 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -156,11 +156,12 @@ void deathstate(playerent *pl) pl->attacking = false; pl->weaponsel->onownerdies(); - if(pl == player1) + if(pl==player1) { if(showscoresondeath) showscores(true); setscope(false); if(editmode) toggleedit(true); + damageblend(-1); } else pl->resetinterp(); } @@ -518,6 +519,7 @@ void dodamage(int damage, playerent *pl, playerent *actor, bool gib, bool local) if(pl==player1) { updatedmgindicator(actor->o); + damageblend(damage); pl->damageroll(damage); } damageeffect(damage, pl); diff --git a/source/src/protos.h b/source/src/protos.h index 9df325ac..73293704 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -234,6 +234,7 @@ extern void renderaboveheadicon(playerent *p); extern void drawcrosshair(playerent *p, bool showteamwarning, int weaponspecific = -1, struct color *c = NULL, float size = -1.0f); extern void drawscope(); extern float dynfov(); +extern void damageblend(int n); // shadow extern bool addshadowbox(const vec &bbmin, const vec &bbmax, const vec &extrude, const glmatrixf &mat); diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 9666378c..5b4acaa8 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -467,6 +467,14 @@ void drawteamicons(int w, int h) quad(icons->id, VIRTW-VIRTH/12-10, 10, VIRTH/12, team_int(player1->team) ? 0.5f : 0, 0, 0.49f, 1.0f); } +VARP(damagescreen, 0, 0, 1); +int dblend = 0; +void damageblend(int n) +{ + if(!damagescreen || n==-1) dblend = 0; + else dblend += n; +} + void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater) { playerent *p = camera1->type==ENT_PLAYER ? (playerent *)camera1 : player1; @@ -482,12 +490,20 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat glOrtho(0, VIRTW, VIRTH, 0, -1, 1); glEnable(GL_BLEND); - if(underwater) + if(underwater || dblend) { glDepthMask(GL_FALSE); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4ub(hdr.watercolor[0], hdr.watercolor[1], hdr.watercolor[2], 102); + if(dblend) + { + glBlendFunc(GL_ZERO, GL_SRC_COLOR); + glColor3f(1.0f, 0.1f, 0.1f); + } + else + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4ub(hdr.watercolor[0], hdr.watercolor[1], hdr.watercolor[2], 102); + } glBegin(GL_QUADS); glVertex2f(0, 0); glVertex2f(VIRTW, 0); @@ -495,6 +511,9 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat glVertex2f(0, VIRTH); glEnd(); glDepthMask(GL_TRUE); + + dblend -= min(1, curtime/3); + if(dblend<0) dblend = 0; } glEnable(GL_TEXTURE_2D); diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 648dab90..819d8124 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -325,6 +325,7 @@ void hit(int damage, playerent *d, playerent *at, const vec &vel, int gun, bool h.dir = ivec(0, 0, 0); d->damageroll(damage); updatedmgindicator(at->o); + damageblend(damage); damageeffect(damage, d); playsound(S_PAIN6, SP_HIGH); }