Deco apply to fire mode

This commit is contained in:
Simon Robertshaw 2011-10-31 21:57:13 +00:00
parent 5207c6f7c0
commit ec3fdfed1c
3 changed files with 26 additions and 50 deletions

View File

@ -16,6 +16,7 @@
#define PSPEC_STICKMAN 0x00000200
#define NO_DECO 0x00001000
#define DECO_FIRE 0x00002000
#define FIREMODE 0x00FF0000
#define FIRE_ADD 0x00010000

View File

@ -17,6 +17,7 @@ int graphics_DEFAULT(GRAPHICS_FUNC_ARGS)
*fireg = *colg/2;
*fireb = *colb/2;
*firea = 125;
*pixel_mode |= DECO_FIRE;
}
return 1;
}

View File

@ -1800,6 +1800,13 @@ void render_parts(pixel *vid)
colb = (deca*decb + (255-deca)*colb) >> 8;
}
if(pixel_mode & DECO_FIRE && decorations_enable)
{
firer = (deca*decr + (255-deca)*firer) >> 8;
fireg = (deca*decg + (255-deca)*fireg) >> 8;
fireb = (deca*decb + (255-deca)*fireb) >> 8;
}
#ifndef OGLR
//All colours are now set, check ranges
if(colr>255) colr = 255;
@ -2242,27 +2249,10 @@ void render_parts(pixel *vid)
smokeC[csmokeC++] = ((float)firea)/255.0f;
csmoke++;
#else
firea /= 8;
if(cmode==CM_FIRE || cmode==CM_BLOB || cmode==CM_FANCY)
{
fire_r[ny/CELL][nx/CELL] = (firea*firer + (255-firea)*fire_r[ny/CELL][nx/CELL]) >> 8;
fire_g[ny/CELL][nx/CELL] = (firea*fireg + (255-firea)*fire_g[ny/CELL][nx/CELL]) >> 8;
fire_b[ny/CELL][nx/CELL] = (firea*fireb + (255-firea)*fire_b[ny/CELL][nx/CELL]) >> 8;
} else {
//This smoke rendering style is horrendously slow, optimise, optimise, optimise!
for (x=-3; x<4; x++)
{
for (y=-3; y<4; y++)
{
if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2))
blendpixel(vid, x+nx, y+ny, firer, fireg, fireb, (30*(firea))>>8);
if (abs(x)+abs(y) <=3 && abs(x)+abs(y))
blendpixel(vid, x+nx, y+ny, firer, fireg, fireb, (20*(firea))>>8);
if (abs(x)+abs(y) == 2)
blendpixel(vid, x+nx, y+ny, firer, fireg, fireb, (10*(firea))>>8);
}
}
}
firea /= 2;
fire_r[ny/CELL][nx/CELL] = (firea*firer + (255-firea)*fire_r[ny/CELL][nx/CELL]) >> 8;
fire_g[ny/CELL][nx/CELL] = (firea*fireg + (255-firea)*fire_g[ny/CELL][nx/CELL]) >> 8;
fire_b[ny/CELL][nx/CELL] = (firea*fireb + (255-firea)*fire_b[ny/CELL][nx/CELL]) >> 8;
#endif
}
if(firea && (pixel_mode & FIRE_ADD))
@ -2277,36 +2267,20 @@ void render_parts(pixel *vid)
cfire++;
#else
firea /= 8;
if(cmode==CM_FIRE || cmode==CM_BLOB || cmode==CM_FANCY)
{
firer = ((firea*firer) >> 8) + fire_r[ny/CELL][nx/CELL];
fireg = ((firea*fireg) >> 8) + fire_g[ny/CELL][nx/CELL];
fireb = ((firea*fireb) >> 8) + fire_b[ny/CELL][nx/CELL];
firer = ((firea*firer) >> 8) + fire_r[ny/CELL][nx/CELL];
fireg = ((firea*fireg) >> 8) + fire_g[ny/CELL][nx/CELL];
fireb = ((firea*fireb) >> 8) + fire_b[ny/CELL][nx/CELL];
if(firer>255)
firer = 255;
if(fireg>255)
fireg = 255;
if(fireb>255)
fireb = 255;
if(firer>255)
firer = 255;
if(fireg>255)
fireg = 255;
if(fireb>255)
fireb = 255;
fire_r[ny/CELL][nx/CELL] = firer;
fire_g[ny/CELL][nx/CELL] = fireg;
fire_b[ny/CELL][nx/CELL] = fireb;
} else {
for (x=-3; x<4; x++)
{
for (y=-3; y<4; y++)
{
if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2))
addpixel(vid, x+nx, y+ny, firer, fireg, fireb, (175*(firea))>>8);
if (abs(x)+abs(y) <=3 && abs(x)+abs(y))
addpixel(vid, x+nx, y+ny, firer, fireg, fireb, (100*(firea))>>8);
if (abs(x)+abs(y) == 2)
addpixel(vid, x+nx, y+ny, firer, fireg, fireb, (55*(firea))>>8);
}
}
}
fire_r[ny/CELL][nx/CELL] = firer;
fire_g[ny/CELL][nx/CELL] = fireg;
fire_b[ny/CELL][nx/CELL] = fireb;
#endif
}
}