summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-08-30 09:59:47 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-08-30 11:34:28 (GMT)
commita7ede2659ab354d36d9cf21bba040da884cc0357 (patch)
treead0148a5993c21a5f65ae3b1d449b1e1085c3a05 /src/elements
parent741014770c3fb9683f3dcf598e077cc36b9b1af6 (diff)
downloadpowder-a7ede2659ab354d36d9cf21bba040da884cc0357.zip
powder-a7ede2659ab354d36d9cf21bba040da884cc0357.tar.gz
Allow decoration layer to affect firework explosion colour
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/firw.c22
-rw-r--r--src/elements/fwrk.c2
2 files changed, 12 insertions, 12 deletions
diff --git a/src/elements/firw.c b/src/elements/firw.c
index 9c8f546..7415dcd 100644
--- a/src/elements/firw.c
+++ b/src/elements/firw.c
@@ -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;
diff --git a/src/elements/fwrk.c b/src/elements/fwrk.c
index 5095cde..0fa744f 100644
--- a/src/elements/fwrk.c
+++ b/src/elements/fwrk.c
@@ -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;
}
}
}