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
This commit is contained in:
driAn
2008-11-08 20:46:11 +00:00
parent 0034503276
commit c86bec4250
4 changed files with 27 additions and 4 deletions
+3 -1
View File
@@ -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);
+1
View File
@@ -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);
+22 -3
View File
@@ -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);
+1
View File
@@ -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);
}