*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1543 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-01-03 08:54:38 +00:00
parent 472c0ef3a2
commit 0b1f05f2e6
6 changed files with 78 additions and 18 deletions
+4
View File
@@ -21,6 +21,10 @@ packages/misc/crosshairs
Mostly by makkE, some by the Death Illustrated team (topher), permission to use given by Pushplay (thanks!!)
packages/misc/bullethole.png
made by leileilol of OpenArena (licensed under GPL)
------------TEXTURES--------------------
--------------packages/textures/arcitool
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

+7 -5
View File
@@ -307,8 +307,9 @@ int mitemslider::sliderwidth = 0;
struct mitemkeyinput : mitem
{
char *text, *bindcmd, *keyname;
static char *unknown, *empty;
char *text, *bindcmd;
const char *keyname;
static const char *unknown, *empty;
bool capture;
mitemkeyinput(gmenu *parent, char *text, char *bindcmd, color *bgcolor) : mitem(parent, bgcolor), text(text), bindcmd(bindcmd), keyname(NULL), capture(false)
@@ -354,8 +355,8 @@ struct mitemkeyinput : mitem
}
};
char *mitemkeyinput::unknown = "?";
char *mitemkeyinput::empty = " ";
const char *mitemkeyinput::unknown = "?";
const char *mitemkeyinput::empty = " ";
// checkbox menu item
@@ -705,4 +706,5 @@ void gmenu::renderbg(int x1, int y1, int x2, int y2, bool border)
static Texture *tex = NULL;
if(!tex) tex = textureload("packages/textures/makke/menu.jpg");
blendbox(x1, y1, x2, y2, border, tex->id);
}
}
+32 -11
View File
@@ -199,7 +199,7 @@ void particleinit()
parttex[0] = textureload("packages/misc/base.png");
parttex[1] = textureload("packages/misc/smoke.png");
parttex[2] = textureload("packages/misc/explosion.jpg");
parttex[3] = textureload("packages/misc/hole.png");
parttex[3] = textureload("<decal>packages/misc/bullethole.png");
parttex[4] = textureload("packages/misc/blood.png");
parttex[5] = textureload("packages/misc/scorch.png");
}
@@ -247,22 +247,23 @@ enum
PT_FIREBALL,
PT_SHOTLINE,
PT_DECAL,
PT_BULLETHOLE,
PT_BLOOD,
PT_STAIN
};
static struct parttype { int type; float r, g, b; int gr, tex; float sz; } parttypes[] =
{
{ 0, 0.4f, 0.4f, 0.4f, 2, 0, 0.06f }, // yellow: sparks
{ 0, 1.0f, 1.0f, 1.0f, 20, 1, 0.15f }, // grey: small smoke
{ 0, 0.2f, 0.2f, 1.0f, 20, 0, 0.08f }, // blue: edit mode entities
{ PT_BLOOD, 0.5f, 0.0f, 0.0f, 1, 4, 0.3f }, // red: blood spats
{ 0, 1.0f, 0.1f, 0.1f, 0, 1, 0.2f }, // red: demotrack
{ PT_FIREBALL, 1.0f, 0.5f, 0.5f, 0, 2, 7.0f }, // explosion fireball
{ PT_SHOTLINE, 1.0f, 1.0f, 0.7f, 0, -1, 0.0f }, // yellow: shotline
{ PT_DECAL, 1.0f, 1.0f, 1.0f, 0, 3, 0.1f }, // hole decal
{ PT_STAIN, 0.5f, 0.0f, 0.0f, 0, 4, 0.6f }, // red: blood stain
{ PT_DECAL, 1.0f, 1.0f, 1.0f, 0, 5, 1.5f }, // scorch decal
{ 0, 0.4f, 0.4f, 0.4f, 2, 0, 0.06f }, // yellow: sparks
{ 0, 1.0f, 1.0f, 1.0f, 20, 1, 0.15f }, // grey: small smoke
{ 0, 0.2f, 0.2f, 1.0f, 20, 0, 0.08f }, // blue: edit mode entities
{ PT_BLOOD, 0.5f, 0.0f, 0.0f, 1, 4, 0.3f }, // red: blood spats
{ 0, 1.0f, 0.1f, 0.1f, 0, 1, 0.2f }, // red: demotrack
{ PT_FIREBALL, 1.0f, 0.5f, 0.5f, 0, 2, 7.0f }, // explosion fireball
{ PT_SHOTLINE, 1.0f, 1.0f, 0.7f, 0, -1, 0.0f }, // yellow: shotline
{ PT_BULLETHOLE, 1.0f, 1.0f, 1.0f, 0, 3, 0.3f }, // hole decal
{ PT_STAIN, 0.5f, 0.0f, 0.0f, 0, 4, 0.6f }, // red: blood stain
{ PT_DECAL, 1.0f, 1.0f, 1.0f, 0, 5, 1.5f }, // scorch decal
};
VAR(particlesize, 20, 100, 500);
@@ -312,6 +313,11 @@ void render_particles(int time)
glBegin(GL_QUADS);
break;
case PT_BULLETHOLE:
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS);
break;
case PT_BLOOD:
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
glColor3f(1-pt.r, 1-pt.g, 1-pt.b);
@@ -378,6 +384,20 @@ void render_particles(int time)
break;
}
case PT_BULLETHOLE:
{
float blend = max(0.0f, min((p->millis+p->fade - lastmillis)/1000.0f, 1.0f));
glColor4f(pt.r*blend, pt.g*blend, pt.b*blend, blend);
vec dx(0, 0, 0), dy(0, 0, 0);
loopk(3) if(p->d[k]) { dx[(k+1)%3] = -1; dy[(k+2)%3] = p->d[k]; break; }
glTexCoord2i(0, 1); glVertex3f(p->o.x+(-dx.x+dy.x)*pt.sz, p->o.y+(-dx.y+dy.y)*pt.sz, p->o.z+(-dx.z+dy.z)*pt.sz);
glTexCoord2i(1, 1); glVertex3f(p->o.x+( dx.x+dy.x)*pt.sz, p->o.y+( dx.y+dy.y)*pt.sz, p->o.z+( dx.z+dy.z)*pt.sz);
glTexCoord2i(1, 0); glVertex3f(p->o.x+( dx.x-dy.x)*pt.sz, p->o.y+( dx.y-dy.y)*pt.sz, p->o.z+( dx.z-dy.z)*pt.sz);
glTexCoord2i(0, 0); glVertex3f(p->o.x+(-dx.x-dy.x)*pt.sz, p->o.y+(-dx.y-dy.y)*pt.sz, p->o.z+(-dx.z-dy.z)*pt.sz);
xtraverts += 4;
break;
}
case PT_BLOOD:
{
int n = detrnd((size_t)p, 4), o = detrnd((size_t)p, 11);;
@@ -441,6 +461,7 @@ void render_particles(int time)
case PT_PART:
case PT_SHOTLINE:
case PT_DECAL:
case PT_BULLETHOLE:
case PT_BLOOD:
case PT_STAIN:
glEnd();
+35 -2
View File
@@ -50,23 +50,56 @@ GLenum texformat(int bpp)
{
switch(bpp)
{
case 8: return GL_LUMINANCE;
case 16: return GL_LUMINANCE_ALPHA;
case 24: return GL_RGB;
case 32: return GL_RGBA;
default: return 0;
}
}
SDL_Surface *texdecal(SDL_Surface *s)
{
SDL_Surface *m = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h, 16, 0, 0, 0, 0);
if(!m) fatal("create surface");
uchar *dst = (uchar *)m->pixels, *src = (uchar *)s->pixels;
loopi(s->h*s->w)
{
*dst++ = *src;
*dst++ = 255 - *src;
src += s->format->BytesPerPixel;
}
SDL_FreeSurface(s);
return m;
}
GLuint loadsurface(const char *texname, int &xs, int &ys, int &bpp, int clamp)
{
SDL_Surface *s = IMG_Load(findfile(texname, "rb"));
const char *file = texname;
if(texname[0]=='<')
{
file = strchr(texname, '>');
if(!file) { conoutf("could not load texture %s", texname); return 0; }
file++;
}
SDL_Surface *s = IMG_Load(findfile(file, "rb"));
if(!s) { conoutf("couldn't load texture %s", texname); return 0; }
GLenum format = texformat(s->format->BitsPerPixel);
if(!format)
{
SDL_FreeSurface(s);
conoutf("texture must be 24bpp or 32bpp: %s", texname);
conoutf("texture must be 8, 16, 24, or 32 bpp: %s", texname);
return 0;
}
if(texname[0]=='<')
{
const char *cmd = &texname[1], *arg1 = strchr(cmd, ':');//, *arg2 = arg1 ? strchr(arg1, ',') : NULL;
if(!arg1) arg1 = strchr(cmd, '>');
if(!strncmp(cmd, "decal", arg1-cmd)) { s = texdecal(s); format = texformat(s->format->BitsPerPixel); }
}
GLuint tnum;
glGenTextures(1, &tnum);
createtexture(tnum, s->w, s->h, s->pixels, clamp, true, format);