*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@871 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2007-04-01 02:09:27 +00:00
parent 0b9eff11fe
commit 72e15c9435
7 changed files with 199 additions and 271 deletions
-149
View File
@@ -118,78 +118,6 @@ void blendbox(int x1, int y1, int x2, int y2, bool border, int tex)
glDepthMask(GL_TRUE);
}
const int MAXSPHERES = 50;
struct sphere { vec o; float size, max; int type; sphere *next; };
sphere spheres[MAXSPHERES], *slist = NULL, *sempty = NULL;
bool sinit = false;
void newsphere(vec &o, float max, int type)
{
if(!sinit)
{
loopi(MAXSPHERES)
{
spheres[i].next = sempty;
sempty = &spheres[i];
}
sinit = true;
}
if(sempty)
{
sphere *p = sempty;
sempty = p->next;
p->o = o;
p->max = max;
p->size = 1;
p->type = type;
p->next = slist;
slist = p;
}
}
void renderspheres(int time)
{
if(!slist) return;
static Texture *exptex = NULL;
if(!exptex) exptex = textureload("packages/misc/explosion.jpg");
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glBindTexture(GL_TEXTURE_2D, exptex->id);
for(sphere *p, **pp = &slist; (p = *pp);)
{
glPushMatrix();
float size = p->size/p->max;
glColor4f(1.0f, 1.0f, 1.0f, 1.0f-size);
glTranslatef(p->o.x, p->o.z, p->o.y);
glRotatef(lastmillis/5.0f, 1, 1, 1);
glScalef(p->size, p->size, p->size);
glCallList(1);
glScalef(0.8f, 0.8f, 0.8f);
glCallList(1);
glPopMatrix();
xtraverts += 12*6*2;
if(p->size>p->max)
{
*pp = p->next;
p->next = sempty;
sempty = p;
}
else
{
p->size += time/100.0f;
pp = &p->next;
}
}
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
}
string closeent;
char *entnames[] =
{
@@ -505,83 +433,6 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
glEnable(GL_DEPTH_TEST);
}
#define MAXSHOTLINES 100
struct shotline
{
vec from, to;
bool inuse;
int millis;
};
shotline shotlines[MAXSHOTLINES];
void shotlinereset() { loopi(MAXSHOTLINES) shotlines[i].inuse = false; }
void addshotline(dynent *d, vec &from, vec &to)
{
if(d == player1) return;
if(rnd(3) != 0) return;
loopi(MAXSHOTLINES)
{
shotline *s = &shotlines[i];
if(s->inuse) continue;
int start = 10;
if(camera1->o.dist(to) <= 10.0f) start = 8;
else start = 5;
vec unitv;
float dist = to.dist(from, unitv);
unitv.div(dist);
s->inuse = true;
s->from = unitv;
s->from.mul(dist/10*start).add(from);
s->to = unitv;
s->to.mul(dist/10*-(10-start-2)).add(to);
s->millis = lastmillis;
return;
}
}
void rendershotlines()
{
int lines = 0;
loopi(MAXSHOTLINES)
{
shotline *s = &shotlines[i];
if(!s->inuse) continue;
const int shotline_duration = 75;
if(lastmillis-s->millis > shotline_duration) { s->inuse = false; continue; }
if(!lines)
{
glPushMatrix();
glDisable(GL_TEXTURE_2D);
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
glDisable(GL_FOG);
glColor4f(1.0f, 1.0f, 0.7f, 0.5f);
glBegin(GL_LINES);
}
++lines;
glVertex3f(s->from.x, s->from.z, s->from.y);
glVertex3f(s->to.x, s->to.z, s->to.y);
}
if(lines)
{
glEnd();
glEnable(GL_FOG);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
}
}
void renderbounceents()
{
loopv(bounceents)