Allow decoration layer to affect firework explosion colour
This commit is contained in:
parent
741014770c
commit
a7ede2659a
@ -1,7 +1,7 @@
|
||||
#include <element.h>
|
||||
|
||||
int update_FIRW(UPDATE_FUNC_ARGS) {
|
||||
int r, rx, ry, rt;
|
||||
int r, rx, ry, rt, np;
|
||||
if (parts[i].tmp==0) {
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
@ -40,18 +40,16 @@ int update_FIRW(UPDATE_FUNC_ARGS) {
|
||||
for (ry=-2; ry<3; ry++)
|
||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
tmul = rand()%7;
|
||||
create_part(-1, x+rx, y+ry, PT_FIRW);
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_FIRW) {
|
||||
parts[r>>8].vx = (rand()%3-1)*tmul;
|
||||
parts[r>>8].vy = (rand()%3-1)*tmul;
|
||||
parts[r>>8].tmp = col;
|
||||
parts[r>>8].life = rand()%100+100;
|
||||
parts[r>>8].temp = 6000.0f;
|
||||
np = create_part(-1, x+rx, y+ry, PT_FIRW);
|
||||
if (np>-1)
|
||||
{
|
||||
parts[np].vx = (rand()%3-1)*tmul;
|
||||
parts[np].vy = (rand()%3-1)*tmul;
|
||||
parts[np].tmp = col;
|
||||
parts[np].life = rand()%100+100;
|
||||
parts[np].temp = 6000.0f;
|
||||
parts[np].dcolour = parts[i].dcolour;
|
||||
}
|
||||
}
|
||||
pv[y/CELL][x/CELL] += 20;
|
||||
|
@ -10,6 +10,7 @@ int update_FWRK(UPDATE_FUNC_ARGS) {
|
||||
parts[np].vy = rand()%8-22;
|
||||
parts[np].vx = rand()%20-rand()%20;
|
||||
parts[np].life=rand()%15+25;
|
||||
parts[np].dcolour = parts[i].dcolour;
|
||||
kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
@ -40,6 +41,7 @@ int update_FWRK(UPDATE_FUNC_ARGS) {
|
||||
parts[np].flags=w;
|
||||
parts[np].ctype=e;
|
||||
parts[np].temp= rand()%20+6000;
|
||||
parts[np].dcolour = parts[i].dcolour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2264,12 +2264,22 @@ void draw_parts(pixel *vid)
|
||||
{
|
||||
x = nx;
|
||||
y = ny;
|
||||
cr = parts[i].flags;
|
||||
cg = parts[i].tmp;
|
||||
cb = parts[i].ctype;
|
||||
if (decorations_enable && parts[i].dcolour)
|
||||
{
|
||||
int a = (parts[i].dcolour>>24)&0xFF;
|
||||
cr = (a*((parts[i].dcolour>>16)&0xFF) + (255-a)*cr) >> 8;
|
||||
cg = (a*((parts[i].dcolour>>8)&0xFF) + (255-a)*cg) >> 8;
|
||||
cb = (a*((parts[i].dcolour)&0xFF) + (255-a)*cb) >> 8;
|
||||
}
|
||||
if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
|
||||
{
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(parts[i].tmp,parts[i].ctype,parts[i].flags);//yes i know this pixel is different color than the glow... i don't know why
|
||||
cg = parts[i].tmp/4;
|
||||
cb = parts[i].ctype/4;
|
||||
cr = parts[i].flags/4;
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cg,cb,cr);//yes i know this pixel is different color than the glow... i don't know why
|
||||
cg = cg/4;
|
||||
cb = cb/4;
|
||||
cr = cr/4;
|
||||
x = nx/CELL;
|
||||
y = ny/CELL;
|
||||
cg += fire_g[y][x];
|
||||
@ -2283,7 +2293,7 @@ void draw_parts(pixel *vid)
|
||||
fire_r[y][x] = cr;
|
||||
}
|
||||
else
|
||||
blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255);
|
||||
blendpixel(vid,x,y,cg,cb,cr,255);
|
||||
}
|
||||
else if (t==PT_GRAV)
|
||||
{
|
||||
@ -3174,6 +3184,13 @@ void draw_parts(pixel *vid)
|
||||
uint8 R = firw_data[caddress];
|
||||
uint8 G = firw_data[caddress+1];
|
||||
uint8 B = firw_data[caddress+2];
|
||||
if (decorations_enable && parts[i].dcolour)
|
||||
{
|
||||
int a = (parts[i].dcolour>>24)&0xFF;
|
||||
R = (a*((parts[i].dcolour>>16)&0xFF) + (255-a)*R) >> 8;
|
||||
G = (a*((parts[i].dcolour>>8)&0xFF) + (255-a)*G) >> 8;
|
||||
B = (a*((parts[i].dcolour)&0xFF) + (255-a)*B) >> 8;
|
||||
}
|
||||
if (cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
|
||||
{
|
||||
cr = R/2;
|
||||
|
Loading…
Reference in New Issue
Block a user