summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-12-03 00:11:19 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-12-03 00:11:19 (GMT)
commitcb75e1d924ee33251c65a8bc10288ddd9e978882 (patch)
tree42680af35123199d3d4d272c4f07ab8e6b88a9e6 /src/elements
parent52d2facf913880a8813e5e4bad0b0f40bce0df4f (diff)
downloadpowder-cb75e1d924ee33251c65a8bc10288ddd9e978882.zip
powder-cb75e1d924ee33251c65a8bc10288ddd9e978882.tar.gz
Fix spark effect on BOMB, another attempt at TNT (Explosive with more pressure)
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/bomb.c26
-rw-r--r--src/elements/elec.c2
-rw-r--r--src/elements/newgraphics.c11
3 files changed, 24 insertions, 15 deletions
diff --git a/src/elements/bomb.c b/src/elements/bomb.c
index 31f01ab..ee45624 100644
--- a/src/elements/bomb.c
+++ b/src/elements/bomb.c
@@ -3,14 +3,14 @@
int update_BOMB(UPDATE_FUNC_ARGS) {
int r, rx, ry, nb;
if (parts[i].tmp==1) {
- for (rx=-2; rx<3; rx++)
- for (ry=-2; ry<3; ry++)
+ for (rx=-1; rx<2; rx++)
+ for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)!=PT_BOMB) {
+ if (ptypes[r&0xFF].properties & (TYPE_SOLID | TYPE_PART | TYPE_LIQUID) && (r&0xFF)!=PT_BOMB) {
kill_part(i);
return 1;
}
@@ -62,3 +62,23 @@ int update_BOMB(UPDATE_FUNC_ARGS) {
}
return 0;
}
+int graphics_BOMB(GRAPHICS_FUNC_ARGS)
+{
+ if (cpart->tmp==0) {
+ //Normal bomb
+ *pixel_mode |= PMODE_FLARE;
+ }
+ else if(cpart->tmp==2)
+ {
+ //Flash
+ *pixel_mode = PMODE_FLAT | FIRE_ADD;
+ *colr = *colg = *colb = *firer = *fireg = *fireb = *firea = 255;
+ }
+ else
+ {
+ //Flying spark
+ *pixel_mode = PMODE_SPARK | PMODE_ADD;
+ *cola = 4*cpart->life;
+ }
+ return 0;
+}
diff --git a/src/elements/elec.c b/src/elements/elec.c
index 4c3232e..a054102 100644
--- a/src/elements/elec.c
+++ b/src/elements/elec.c
@@ -19,7 +19,7 @@ int update_ELEC(UPDATE_FUNC_ARGS) {
continue;
if ((r&0xFF)==PT_GLAS)
{
- fire_r[y/CELL][x/CELL] += rand()%200; //D: Doesn't work with OpenGL, also should be here
+ fire_r[y/CELL][x/CELL] += rand()%200; //D: Doesn't work with OpenGL, also shouldn't be here
fire_g[y/CELL][x/CELL] += rand()%200;
fire_b[y/CELL][x/CELL] += rand()%200;
for (rrx=-2; rrx<=2; rrx++)
diff --git a/src/elements/newgraphics.c b/src/elements/newgraphics.c
index c846b94..9af28a1 100644
--- a/src/elements/newgraphics.c
+++ b/src/elements/newgraphics.c
@@ -483,17 +483,6 @@ int graphics_FIRW(GRAPHICS_FUNC_ARGS)
}
return 0;
}
-int graphics_BOMB(GRAPHICS_FUNC_ARGS)
-{
- if (cpart->tmp==0) {
- *pixel_mode |= PMODE_FLARE;
- }
- else
- {
- *pixel_mode |= PMODE_SPARK;
- }
- return 0;
-}
int graphics_GBMB(GRAPHICS_FUNC_ARGS)
{
if (cpart->life <= 0) {