summaryrefslogtreecommitdiff
path: root/elements/plsm.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-08 17:39:03 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-08 17:39:03 (GMT)
commitb0ea52690ba56a0d0602ad8674b7e5ab2ba3e778 (patch)
tree7d72e0509f4d2643d3be837a337d088ca5949c73 /elements/plsm.cpp
downloadpowder-b0ea52690ba56a0d0602ad8674b7e5ab2ba3e778.zip
powder-b0ea52690ba56a0d0602ad8674b7e5ab2ba3e778.tar.gz
Initial
Diffstat (limited to 'elements/plsm.cpp')
-rw-r--r--elements/plsm.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/elements/plsm.cpp b/elements/plsm.cpp
new file mode 100644
index 0000000..c6f7c20
--- /dev/null
+++ b/elements/plsm.cpp
@@ -0,0 +1,20 @@
+#include "element.h"
+#include "hmap.h"
+
+int graphics_PLSM(GRAPHICS_FUNC_ARGS)
+{
+ int caddress = restrict_flt(restrict_flt((float)cpart->life, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
+ *colr = (unsigned char)ren->plasma_data[caddress];
+ *colg = (unsigned char)ren->plasma_data[caddress+1];
+ *colb = (unsigned char)ren->plasma_data[caddress+2];
+
+ *firea = 255;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+
+ *pixel_mode = PMODE_GLOW | PMODE_ADD; //Clear default, don't draw pixel
+ *pixel_mode |= FIRE_ADD;
+ //Returning 0 means dynamic, do not cache
+ return 0;
+}