summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-10-12 11:37:04 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-10-12 11:37:04 (GMT)
commit2cf9ef60aa3d3c1509b3cba69e35a840a6841731 (patch)
tree040e0a378dbcd60c2a6f5467eddd5069b3c06c77 /src/elements
parent0e61956b243ac90d8ff557134d24221f923be4ed (diff)
downloadpowder-2cf9ef60aa3d3c1509b3cba69e35a840a6841731.zip
powder-2cf9ef60aa3d3c1509b3cba69e35a840a6841731.tar.gz
Implement more particle graphics
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/deut.c20
-rw-r--r--src/elements/lava.c19
-rw-r--r--src/elements/neut.c11
-rw-r--r--src/elements/phot.c24
-rw-r--r--src/elements/plsm.c19
-rw-r--r--src/elements/sprk.c11
6 files changed, 104 insertions, 0 deletions
diff --git a/src/elements/deut.c b/src/elements/deut.c
index f272fa6..376f5f9 100644
--- a/src/elements/deut.c
+++ b/src/elements/deut.c
@@ -68,3 +68,23 @@ int update_DEUT(UPDATE_FUNC_ARGS) {
}
return 0;
}
+
+int graphics_DEUT(GRAPHICS_FUNC_ARGS)
+{
+ if(parts[i].life>=700)
+ {
+ *firea = 20;
+ *firer = *fireg = *fireb = 255;
+
+ *pixel_mode |= FIRE_ADD;
+ *pixel_mode &= ~PMODE;
+ }
+ else
+ {
+ *colr += parts[i].life*1;
+ *colg += parts[i].life*2;
+ *colb += parts[i].life*3;
+ *pixel_mode |= PMODE_BLUR;
+ }
+ return 0;
+}
diff --git a/src/elements/lava.c b/src/elements/lava.c
new file mode 100644
index 0000000..873b175
--- /dev/null
+++ b/src/elements/lava.c
@@ -0,0 +1,19 @@
+#include <element.h>
+
+int graphics_LAVA(GRAPHICS_FUNC_ARGS)
+{
+ *colr = parts[i].life * 2 + 0xE0;
+ *colg = parts[i].life * 1 + 0x50;
+ *colb = parts[i].life / 2 + 0x10;
+ if (*colr>255) *colr = 255;
+ if (*colg>192) *colg = 192;
+ if (*colb>128) *colb = 128;
+ *firea = 5;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+ *pixel_mode |= FIRE_ADD;
+ *pixel_mode |= PMODE_BLUR;
+ //Returning 0 means dynamic, do not cache
+ return 0;
+} \ No newline at end of file
diff --git a/src/elements/neut.c b/src/elements/neut.c
index 0677af8..0dfc2b1 100644
--- a/src/elements/neut.c
+++ b/src/elements/neut.c
@@ -132,3 +132,14 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
}
return 0;
}
+
+int graphics_NEUT(GRAPHICS_FUNC_ARGS)
+{
+ *firea = 15;
+ *firer = 10;
+ *fireg = 80;
+ *fireb = 120;
+
+ *pixel_mode |= FIRE_ADD;
+ return 1;
+}
diff --git a/src/elements/phot.c b/src/elements/phot.c
index 630171a..f999753 100644
--- a/src/elements/phot.c
+++ b/src/elements/phot.c
@@ -58,3 +58,27 @@ int update_PHOT(UPDATE_FUNC_ARGS) {
return 0;
}
+
+int graphics_PHOT(GRAPHICS_FUNC_ARGS)
+{
+ int x = 0;
+ *colr = *colg = *colb = 0;
+ for (x=0; x<12; x++) {
+ *colr += (parts[i].ctype >> (x+18)) & 1;
+ *colb += (parts[i].ctype >> x) & 1;
+ }
+ for (x=0; x<12; x++)
+ *colg += (parts[i].ctype >> (x+9)) & 1;
+ x = 624/(*colr+*colg+*colb+1);
+ *colr *= x;
+ *colg *= x;
+ *colb *= x;
+
+ *firea = 15;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+
+ *pixel_mode |= FIRE_ADD;
+ return 0;
+}
diff --git a/src/elements/plsm.c b/src/elements/plsm.c
new file mode 100644
index 0000000..e7906af
--- /dev/null
+++ b/src/elements/plsm.c
@@ -0,0 +1,19 @@
+#include <element.h>
+
+int graphics_PLSM(GRAPHICS_FUNC_ARGS)
+{
+ int caddress = restrict_flt(restrict_flt((float)parts[i].life, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
+ *colr = (unsigned char)plasma_data[caddress];
+ *colg = (unsigned char)plasma_data[caddress+1];
+ *colb = (unsigned char)plasma_data[caddress+2];
+
+ *firea = 255;
+ *firer = *colr/8;
+ *fireg = *colg/8;
+ *fireb = *colb/8;
+
+ *pixel_mode = PMODE_NONE; //Clear default, don't draw pixel
+ *pixel_mode |= FIRE_ADD;
+ //Returning 0 means dynamic, do not cache
+ return 0;
+} \ No newline at end of file
diff --git a/src/elements/sprk.c b/src/elements/sprk.c
index bae66e8..f9d3fda 100644
--- a/src/elements/sprk.c
+++ b/src/elements/sprk.c
@@ -175,3 +175,14 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
}
return 0;
}
+
+int graphics_SPRK(GRAPHICS_FUNC_ARGS)
+{
+ *firea = 10;
+ *firer = *colr*0.5;
+ *fireg = *colg;
+ *fireb = *colb*2;
+ *pixel_mode |= FIRE_ADD;
+ *pixel_mode |= PMODE_BLUR;
+ return 1;
+}