From af256cdf2a2b6d4f7d65373885f95bf57b672924 Mon Sep 17 00:00:00 2001 From: driAn Date: Sun, 23 Oct 2005 12:50:51 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@56 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/protos.h | 2 +- source/src/renderextras.cpp | 47 +++++++++++++++++++++++++++---------- source/src/weapon.cpp | 4 ++-- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/source/src/protos.h b/source/src/protos.h index 72ccbce7..e92cd014 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -160,7 +160,7 @@ extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool u extern void readdepth(int w, int h); extern void blendbox(int x1, int y1, int x2, int y2, bool border); extern void damageblend(int n); -extern void addshotline(vec &from, vec &to); +extern void addshotline(dynent *d, vec &from, vec &to); extern void rendershotlines(); extern void shotlinereset(); diff --git a/source/src/renderextras.cpp b/source/src/renderextras.cpp index fde6514d..74e0cbce 100644 --- a/source/src/renderextras.cpp +++ b/source/src/renderextras.cpp @@ -225,14 +225,14 @@ void readdepth(int w, int h) setorient(r, u); }; -void drawicon(float tx, float ty, int x, int y) +void drawicon(float tx, float ty, int x, int y, float scale=1.0f) { glBindTexture(GL_TEXTURE_2D, 5); glBegin(GL_QUADS); tx /= 192; ty /= 192; float o = 1/3.0f; - int s = 120; + int s = 120*scale; glTexCoord2f(tx, ty); glVertex2i(x, y); glTexCoord2f(tx+o, ty); glVertex2i(x+s, y); glTexCoord2f(tx+o, ty+o); glVertex2i(x+s, y+s); @@ -262,7 +262,7 @@ int dblend = 0; void damageblend(int n) { dblend += n; }; VAR(hidestats, 0, 0, 1); -VAR(crosshairfx, 0, 1, 1); +VAR(crosshairfx, 0, 1, 1); void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater) { @@ -375,13 +375,30 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat glPopMatrix(); glPushMatrix(); glOrtho(0, VIRTW, VIRTH, 0, -1, 1); - glDisable(GL_BLEND); - drawicon(64, 0, 20, 1650); //drawicon(128, 128, 20, 1650); + glDisable(GL_BLEND); + + glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); + glColor4f(1.0f, 1.0f, 1.0f, (float) (sin(lastmillis/100)+1)/2); + + if(player1->health <= 20) + { + glEnable(GL_BLEND); + drawicon(64, 0, 20, 1650); //drawicon(128, 128, 20, 1650); + glDisable(GL_BLEND); + } + else drawicon(64, 0, 20, 1650); //drawicon(128, 128, 20, 1650); if(player1->armour) drawicon((float)(128), 0, 620, 1650); //if(player1->armour) drawicon((float)(player1->armourtype*64), 0, 620, 1650); int g = player1->gunselect; int r = 64; - if(g>2) { g -= 3; r = 128; }; - drawicon((float)(g*64), (float)r, 1220, 1650); + if(g>2) { g -= 3; r = 128; }; + + if(!player1->ammo[player1->gunselect] && !player1->mag[player1->gunselect]) + { + glEnable(GL_BLEND); + drawicon((float)(g*64), (float)r, 1220, 1650); + glDisable(GL_BLEND); + } + else drawicon((float)(g*64), (float)r, 1220, 1650); glPopMatrix(); }; @@ -401,28 +418,34 @@ shotline shotlines[MAXSHOTLINES]; void shotlinereset() { loopi(MAXSHOTLINES) shotlines[i].inuse = false; }; -void addshotline(vec &from, vec &to) +void addshotline(dynent *d, vec &from, vec &to) { if(rnd(3) != 0) return; loopi(MAXSHOTLINES) { shotline *s = &shotlines[i]; if(s->inuse) continue; + int start = 10; + vdist(_dist, _unitv, player1->o, to); + if(d == player1) start = 1; + else if(_dist <= 10.0f) start = 8; + else start = 5; + vdist(dist, unitv, from, to); vdiv(unitv, dist); s->inuse = true; s->from = unitv; - vmul(s->from, dist/6*4); + vmul(s->from, dist/10*start); vadd(s->from, from); s->to = unitv; - vmul(s->to, dist/6*-1); + vmul(s->to, dist/10*-(10-start-2)); vadd(s->to, to); s->millis = lastmillis; return; }; }; -VAR(shotline_duration, 0, 50, 10000); +VAR(shotline_duration, 0, 75, 10000); void rendershotlines() { @@ -441,7 +464,7 @@ void rendershotlines() glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glBegin(GL_LINES); - glColor4f(1.0f, 1.0f, 0.7f, 0.5f); + glColor4f(1.0f, 1.0f, 0.7f, 0.25f); glVertex3f(s->from.x, s->from.z, s->from.y); glVertex3f(s->to.x, s->to.z, s->to.y); glEnd(); diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 0d0c1a12..e279d875 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -346,7 +346,7 @@ void shootv(int gun, vec &from, vec &to, dynent *d, bool local) // create vi case GUN_PISTOL: case GUN_SUBGUN: case GUN_ASSULT: - addshotline(from, to); + addshotline(d, from, to); particle_splash(0, 100, 250, to); //particle_trail(1, 10, from, to); break; @@ -358,7 +358,7 @@ void shootv(int gun, vec &from, vec &to, dynent *d, bool local) // create vi break; case GUN_SNIPER: - addshotline(from, to); + addshotline(d, from, to); particle_splash(0, 50, 200, to); particle_trail(1, 500, from, to); break;