summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/dest.c12
-rw-r--r--src/elements/deut.c19
-rw-r--r--src/elements/emp.c18
-rw-r--r--src/elements/figh.c17
-rw-r--r--src/elements/fire.c19
-rw-r--r--src/elements/graphics_default.c22
-rw-r--r--src/elements/lava.c19
-rw-r--r--src/elements/ligh.c8
-rw-r--r--src/elements/neut.c11
-rw-r--r--src/elements/newgraphics.c513
-rw-r--r--src/elements/phot.c24
-rw-r--r--src/elements/pipe.c82
-rw-r--r--src/elements/plsm.c20
-rw-r--r--src/elements/smke.c18
-rw-r--r--src/elements/sprk.c13
-rw-r--r--src/elements/stkm.c16
-rw-r--r--src/elements/stkm2.c15
17 files changed, 846 insertions, 0 deletions
diff --git a/src/elements/dest.c b/src/elements/dest.c
index 772065a..a315b09 100644
--- a/src/elements/dest.c
+++ b/src/elements/dest.c
@@ -52,3 +52,15 @@ int update_DEST(UPDATE_FUNC_ARGS) {
parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP);
return 0;
}
+int graphics_DEST(GRAPHICS_FUNC_ARGS)
+{
+ if(cpart->life)
+ {
+ *pixel_mode |= PMODE_LFLARE;
+ }
+ else
+ {
+ *pixel_mode |= PMODE_SPARK;
+ }
+ return 0;
+}
diff --git a/src/elements/deut.c b/src/elements/deut.c
index f272fa6..9276de1 100644
--- a/src/elements/deut.c
+++ b/src/elements/deut.c
@@ -68,3 +68,22 @@ int update_DEUT(UPDATE_FUNC_ARGS) {
}
return 0;
}
+
+int graphics_DEUT(GRAPHICS_FUNC_ARGS)
+{
+ if(cpart->life>=700)
+ {
+ *colr += cpart->life*1;
+ *colg += cpart->life*2;
+ *colb += cpart->life*3;
+ *pixel_mode |= PMODE_GLOW;
+ }
+ else
+ {
+ *colr += cpart->life*1;
+ *colg += cpart->life*2;
+ *colb += cpart->life*3;
+ *pixel_mode |= PMODE_BLUR;
+ }
+ return 0;
+}
diff --git a/src/elements/emp.c b/src/elements/emp.c
index c47c902..a7978a3 100644
--- a/src/elements/emp.c
+++ b/src/elements/emp.c
@@ -108,3 +108,21 @@ int update_EMP(UPDATE_FUNC_ARGS) {
}
return 0;
}
+int graphics_EMP(GRAPHICS_FUNC_ARGS)
+{
+ if(cpart->life)
+ {
+ *colr = cpart->life*1.5;
+ *colg = cpart->life*1.5;
+ *colb = 200-(cpart->life);
+ if (*colr>255)
+ *colr = 255;
+ if (*colg>255)
+ *colg = 255;
+ if (*colb>255)
+ *colb = 255;
+ if (*colb<=0)
+ *colb = 0;
+ }
+ return 0;
+}
diff --git a/src/elements/figh.c b/src/elements/figh.c
index fb172fb..99f39b1 100644
--- a/src/elements/figh.c
+++ b/src/elements/figh.c
@@ -72,3 +72,20 @@ int update_FIGH(UPDATE_FUNC_ARGS)
run_stickman(figh, UPDATE_FUNC_SUBCALL_ARGS);
return 0;
}
+
+int graphics_FIGH(GRAPHICS_FUNC_ARGS)
+{
+ playerst * cplayer = &fighters[(unsigned char)cpart->tmp];
+ *pixel_mode = PSPEC_STICKMAN;
+ if (cplayer->elem<PT_NUM)
+ {
+ *colr = PIXR(ptypes[cplayer->elem].pcolors);
+ *colg = PIXG(ptypes[cplayer->elem].pcolors);
+ *colb = PIXB(ptypes[cplayer->elem].pcolors);
+ }
+ else
+ {
+ *colr = *colg = *colb = 255;
+ }
+ return 1;
+}
diff --git a/src/elements/fire.c b/src/elements/fire.c
new file mode 100644
index 0000000..6dc620e
--- /dev/null
+++ b/src/elements/fire.c
@@ -0,0 +1,19 @@
+#include <element.h>
+
+int graphics_FIRE(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)flm_data[caddress];
+ *colg = (unsigned char)flm_data[caddress+1];
+ *colb = (unsigned char)flm_data[caddress+2];
+
+ *firea = 255;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+
+ *pixel_mode = PMODE_NONE; //Clear default, don't draw pixel
+ *pixel_mode |= FIRE_ADD;
+ //Returning 0 means dynamic, do not cache
+ return 0;
+}
diff --git a/src/elements/graphics_default.c b/src/elements/graphics_default.c
new file mode 100644
index 0000000..d64c0e1
--- /dev/null
+++ b/src/elements/graphics_default.c
@@ -0,0 +1,22 @@
+#include <element.h>
+
+int graphics_DEFAULT(GRAPHICS_FUNC_ARGS)
+{
+ int t = cpart->type;
+ //Property based defaults
+ if(ptypes[t].properties & PROP_RADIOACTIVE) *pixel_mode |= PMODE_GLOW;
+ if(ptypes[t].properties & TYPE_LIQUID)
+ {
+ *pixel_mode |= PMODE_BLUR;
+ }
+ if(ptypes[t].properties & TYPE_GAS)
+ {
+ *pixel_mode &= ~PMODE;
+ *pixel_mode |= FIRE_BLEND;
+ *firer = *colr/2;
+ *fireg = *colg/2;
+ *fireb = *colb/2;
+ *firea = 125;
+ }
+ return 1;
+}
diff --git a/src/elements/lava.c b/src/elements/lava.c
new file mode 100644
index 0000000..0a9fb8a
--- /dev/null
+++ b/src/elements/lava.c
@@ -0,0 +1,19 @@
+#include <element.h>
+
+int graphics_LAVA(GRAPHICS_FUNC_ARGS)
+{
+ *colr = cpart->life * 2 + 0xE0;
+ *colg = cpart->life * 1 + 0x50;
+ *colb = cpart->life / 2 + 0x10;
+ if (*colr>255) *colr = 255;
+ if (*colg>192) *colg = 192;
+ if (*colb>128) *colb = 128;
+ *firea = 40;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+ *pixel_mode |= FIRE_ADD;
+ *pixel_mode |= PMODE_BLUR;
+ //Returning 0 means dynamic, do not cache
+ return 0;
+}
diff --git a/src/elements/ligh.c b/src/elements/ligh.c
index 9b20069..0fb700e 100644
--- a/src/elements/ligh.c
+++ b/src/elements/ligh.c
@@ -285,3 +285,11 @@ int update_LIGH(UPDATE_FUNC_ARGS)
parts[i].tmp2=-1;
return 1;
}
+int graphics_LIGH(GRAPHICS_FUNC_ARGS)
+{
+ *colr = 235;
+ *colg = 245;
+ *colb = 255;
+ *pixel_mode |= PMODE_GLOW;
+ return 1;
+}
diff --git a/src/elements/neut.c b/src/elements/neut.c
index 0677af8..78552d5 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 = 120;
+ *firer = 10;
+ *fireg = 80;
+ *fireb = 120;
+
+ *pixel_mode |= FIRE_ADD;
+ return 1;
+}
diff --git a/src/elements/newgraphics.c b/src/elements/newgraphics.c
new file mode 100644
index 0000000..7a8fc32
--- /dev/null
+++ b/src/elements/newgraphics.c
@@ -0,0 +1,513 @@
+#include <element.h>
+#include "hmap.h"
+
+int graphics_QRTZ(GRAPHICS_FUNC_ARGS) //QRTZ and PQRT
+{
+ int t = cpart->type, z = cpart->tmp - 5;//speckles!
+ if (cpart->temp>(ptransitions[t].thv-800.0f))//hotglow for quartz
+ {
+ float frequency = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
+ int q = (cpart->temp>ptransitions[t].thv)?ptransitions[t].thv-(ptransitions[t].thv-800.0f):cpart->temp-(ptransitions[t].thv-800.0f);
+ *colr += sin(frequency*q) * 226 + (z * 16);
+ *colg += sin(frequency*q*4.55 +3.14) * 34 + (z * 16);
+ *colb += sin(frequency*q*2.22 +3.14) * 64 + (z * 16);
+ }
+ else
+ {
+ *colr += z * 16;
+ *colg += z * 16;
+ *colb += z * 16;
+ }
+ return 0;
+}
+int graphics_CLST(GRAPHICS_FUNC_ARGS)
+{
+ int z = cpart->tmp - 5;//speckles!
+ *colr += z * 16;
+ *colg += z * 16;
+ *colb += z * 16;
+ return 0;
+}
+int graphics_CBNW(GRAPHICS_FUNC_ARGS)
+{
+ int z = cpart->tmp2 - 20;//speckles!
+ *colr += z * 1;
+ *colg += z * 2;
+ *colb += z * 8;
+ return 0;
+}
+int graphics_SPNG(GRAPHICS_FUNC_ARGS)
+{
+ *colr -= cpart->life*15;
+ *colg -= cpart->life*15;
+ *colb -= cpart->life*15;
+ if (*colr<=50)
+ *colr = 50;
+ if (*colg<=50)
+ *colg = 50;
+ if (*colb<=20)
+ *colb = 20;
+ return 0;
+}
+int graphics_LIFE(GRAPHICS_FUNC_ARGS)
+{
+ pixel pc;
+ if (cpart->ctype==NGT_LOTE)//colors for life states
+ {
+ if (cpart->tmp==2)
+ pc = PIXRGB(255, 128, 0);
+ else if (cpart->tmp==1)
+ pc = PIXRGB(255, 255, 0);
+ else
+ pc = PIXRGB(255, 0, 0);
+ }
+ else if (cpart->ctype==NGT_FRG2)//colors for life states
+ {
+ if (cpart->tmp==2)
+ pc = PIXRGB(0, 100, 50);
+ else
+ pc = PIXRGB(0, 255, 90);
+ }
+ else if (cpart->ctype==NGT_STAR)//colors for life states
+ {
+ if (cpart->tmp==4)
+ pc = PIXRGB(0, 0, 128);
+ else if (cpart->tmp==3)
+ pc = PIXRGB(0, 0, 150);
+ else if (cpart->tmp==2)
+ pc = PIXRGB(0, 0, 190);
+ else if (cpart->tmp==1)
+ pc = PIXRGB(0, 0, 230);
+ else
+ pc = PIXRGB(0, 0, 70);
+ }
+ else if (cpart->ctype==NGT_FROG)//colors for life states
+ {
+ if (cpart->tmp==2)
+ pc = PIXRGB(0, 100, 0);
+ else
+ pc = PIXRGB(0, 255, 0);
+ }
+ else if (cpart->ctype==NGT_BRAN)//colors for life states
+ {
+ if (cpart->tmp==1)
+ pc = PIXRGB(150, 150, 0);
+ else
+ pc = PIXRGB(255, 255, 0);
+ } else {
+ pc = gmenu[cpart->ctype].colour;
+ }
+ *colr = PIXR(pc);
+ *colg = PIXG(pc);
+ *colb = PIXB(pc);
+ return 0;
+}
+int graphics_DUST(GRAPHICS_FUNC_ARGS)
+{
+ if(cpart->life >= 1)
+ {
+ *colr = cpart->flags;
+ *colg = cpart->tmp;
+ *colb = cpart->ctype;
+ if (decorations_enable && cpart->dcolour)
+ {
+ int a = (cpart->dcolour>>24)&0xFF;
+ *colr = (a*((cpart->dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
+ *colg = (a*((cpart->dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
+ *colb = (a*((cpart->dcolour)&0xFF) + (255-a)**colb) >> 8;
+ }
+ *firea = 255;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+ }
+ return 0;
+}
+int graphics_GRAV(GRAPHICS_FUNC_ARGS)
+{
+ *colr = 20;
+ *colg = 20;
+ *colb = 20;
+ if (cpart->vx>0)
+ {
+ *colr += (cpart->vx)*GRAV_R;
+ *colg += (cpart->vx)*GRAV_G;
+ *colb += (cpart->vx)*GRAV_B;
+ }
+ if (cpart->vy>0)
+ {
+ *colr += (cpart->vy)*GRAV_G;
+ *colg += (cpart->vy)*GRAV_B;
+ *colb += (cpart->vy)*GRAV_R;
+
+ }
+ if (cpart->vx<0)
+ {
+ *colr -= (cpart->vx)*GRAV_B;
+ *colg -= (cpart->vx)*GRAV_R;
+ *colb -= (cpart->vx)*GRAV_G;
+
+ }
+ if (cpart->vy<0)
+ {
+ *colr -= (cpart->vy)*GRAV_R2;
+ *colg -= (cpart->vy)*GRAV_G2;
+ *colb -= (cpart->vy)*GRAV_B2;
+ }
+ return 0;
+}
+int graphics_WIFI(GRAPHICS_FUNC_ARGS)
+{
+ float frequency = 0.0628;
+ int q = cpart->tmp;
+ *colr = sin(frequency*q + 0) * 127 + 128;
+ *colg = sin(frequency*q + 2) * 127 + 128;
+ *colb = sin(frequency*q + 4) * 127 + 128;
+ return 0;
+}
+int graphics_PRTI(GRAPHICS_FUNC_ARGS)
+{
+ *firea = 8;
+ *firer = 255;
+ *fireg = 0;
+ *fireb = 0;
+ *pixel_mode |= EFFECT_GRAVIN;
+ *pixel_mode &= ~PMODE;
+ *pixel_mode |= PMODE_ADD;
+ return 1;
+}
+int graphics_PRTO(GRAPHICS_FUNC_ARGS)
+{
+ *firea = 8;
+ *firer = 0;
+ *fireg = 0;
+ *fireb = 255;
+ *pixel_mode |= EFFECT_GRAVOUT;
+ *pixel_mode &= ~PMODE;
+ *pixel_mode |= PMODE_ADD;
+ return 1;
+}
+int graphics_BIZR(GRAPHICS_FUNC_ARGS) //BIZR, BIZRG, BIZRS
+{
+ int x = 0;
+ *colg = 0;
+ *colb = 0;
+ *colr = 0;
+ for (x=0; x<12; x++) {
+ *colr += (cpart->ctype >> (x+18)) & 1;
+ *colb += (cpart->ctype >> x) & 1;
+ }
+ for (x=0; x<12; x++)
+ *colg += (cpart->ctype >> (x+9)) & 1;
+ x = 624/(*colr+*colg+*colb+1);
+ *colr *= x;
+ *colg *= x;
+ *colb *= x;
+ if(fabs(cpart->vx)+fabs(cpart->vy)>0)
+ {
+ *firea = 255;
+ *fireg = *colg/5 * fabs(cpart->vx)+fabs(cpart->vy);
+ *fireb = *colb/5 * fabs(cpart->vx)+fabs(cpart->vy);
+ *firer = *colr/5 * fabs(cpart->vx)+fabs(cpart->vy);
+ *pixel_mode |= FIRE_ADD;
+ }
+ return 0;
+}
+int graphics_INVS(GRAPHICS_FUNC_ARGS)
+{
+ if(pv[ny/CELL][nx/CELL]>4.0f || pv[ny/CELL][nx/CELL]<-4.0f)
+ {
+ *colr = 15;
+ *colg = 0;
+ *colb = 150;
+ }
+ return 0;
+}
+int graphics_ACID(GRAPHICS_FUNC_ARGS)
+{
+ int s = cpart->life;
+ if (s>75) s = 75; //These two should not be here.
+ if (s<49) s = 49;
+ s = (s-49)*3;
+ if (s==0) s = 1;
+ *colr += s*4;
+ *colg += s*1;
+ *colb += s*2;
+ *pixel_mode |= PMODE_BLUR;
+ return 0;
+}
+int graphics_FILT(GRAPHICS_FUNC_ARGS)
+{
+ int x, temp_bin = (int)((cpart->temp-273.0f)*0.025f);
+ if (temp_bin < 0) temp_bin = 0;
+ if (temp_bin > 25) temp_bin = 25;
+ cpart->ctype = 0x1F << temp_bin;
+ *colg = 0;
+ *colb = 0;
+ *colr = 0;
+ for (x=0; x<12; x++) {
+ *colr += (cpart->ctype >> (x+18)) & 1;
+ *colb += (cpart->ctype >> x) & 1;
+ }
+ for (x=0; x<12; x++)
+ *colg += (cpart->ctype >> (x+9)) & 1;
+ x = 624/(*colr+*colg+*colb+1);
+ *colr *= x;
+ *colg *= x;
+ *colb *= x;
+ return 0;
+}
+int graphics_BRAY(GRAPHICS_FUNC_ARGS)
+{
+ int x, trans = 255;
+ if(cpart->tmp==0)
+ {
+ trans = cpart->life * 7;
+ if (trans>255) trans = 255;
+ if (cpart->ctype) {
+ *colg = 0;
+ *colb = 0;
+ *colr = 0;
+ for (x=0; x<12; x++) {
+ *colr += (cpart->ctype >> (x+18)) & 1;
+ *colb += (cpart->ctype >> x) & 1;
+ }
+ for (x=0; x<12; x++)
+ *colg += (cpart->ctype >> (x+9)) & 1;
+ x = 624/(*colr+*colg+*colb+1);
+ *colr *= x;
+ *colg *= x;
+ *colb *= x;
+ }
+ }
+ else if(cpart->tmp==1)
+ {
+ trans = cpart->life/4;
+ if (trans>255) trans = 255;
+ if (cpart->ctype) {
+ *colg = 0;
+ *colb = 0;
+ *colr = 0;
+ for (x=0; x<12; x++) {
+ *colr += (cpart->ctype >> (x+18)) & 1;
+ *colb += (cpart->ctype >> x) & 1;
+ }
+ for (x=0; x<12; x++)
+ *colg += (cpart->ctype >> (x+9)) & 1;
+ x = 624/(*colr+*colg+*colb+1);
+ *colr *= x;
+ *colg *= x;
+ *colb *= x;
+ }
+ }
+ else if(cpart->tmp==2)
+ {
+ trans = cpart->life*100;
+ if (trans>255) trans = 255;
+ *colr = 255;
+ *colr = 150;
+ *colr = 50;
+ }
+ //*cola = trans;
+ *pixel_mode &= ~PMODE;
+ *pixel_mode |= PMODE_BLEND;
+ return 0;
+}
+int graphics_SWCH(GRAPHICS_FUNC_ARGS)
+{
+ if(cpart->life >= 10)
+ {
+ *colr = 17;
+ *colg = 217;
+ *colb = 24;
+ *pixel_mode |= PMODE_GLOW;
+ }
+ return 0;
+}
+int graphics_THDR(GRAPHICS_FUNC_ARGS)
+{
+ *firea = 160;
+ *fireg = 192;
+ *fireb = 255;
+ *firer = 144;
+ *pixel_mode |= FIRE_ADD;
+ return 1;
+}
+int graphics_GLOW(GRAPHICS_FUNC_ARGS)
+{
+ *firer = restrict_flt(cpart->temp-(275.13f+32.0f), 0, 128)/50.0f;
+ *fireg = restrict_flt(cpart->ctype, 0, 128)/50.0f;
+ *fireb = restrict_flt(cpart->tmp, 0, 128)/50.0f;
+
+ *colr = restrict_flt(64.0f+cpart->temp-(275.13f+32.0f), 0, 255);
+ *colg = restrict_flt(64.0f+cpart->ctype, 0, 255);
+ *colb = restrict_flt(64.0f+cpart->tmp, 0, 255);
+
+ *pixel_mode |= FIRE_ADD;
+ return 0;
+}
+int graphics_LCRY(GRAPHICS_FUNC_ARGS)
+{
+ int lifemod = ((cpart->life>10?10:cpart->life)*10);
+ if(cpart->dcolour && cpart->dcolour&0xFF000000)
+ {
+ *colr += (lifemod * (255-(cpart->dcolour>>16)&0xFF))>>8;
+ *colg += (lifemod * (255-(cpart->dcolour>>8)&0xFF))>>8;
+ *colb += (lifemod * (255-(cpart->dcolour)&0xFF))>>8;
+ }
+ else
+ {
+ *colr += lifemod;
+ *colg += lifemod;
+ *colb += lifemod;
+ }
+ *pixel_mode |= NO_DECO;
+ return 0;
+}
+int graphics_PCLN(GRAPHICS_FUNC_ARGS)
+{
+ int lifemod = ((cpart->life>10?10:cpart->life)*10);
+ *colr += lifemod;
+ *colg += lifemod;
+ return 0;
+}
+int graphics_PBCN(GRAPHICS_FUNC_ARGS)
+{
+ int lifemod = ((cpart->life>10?10:cpart->life)*10);
+ *colr += lifemod;
+ *colg += lifemod/2;
+ return 0;
+}
+int graphics_DLAY(GRAPHICS_FUNC_ARGS)
+{
+ int stage = (int)(((float)cpart->life/(cpart->temp-273.15))*100.0f);
+ *colr += stage;
+ *colg += stage;
+ *colb += stage;
+ return 0;
+}
+int graphics_HSWC(GRAPHICS_FUNC_ARGS)
+{
+ int lifemod = ((cpart->life>10?10:cpart->life)*19);
+ *colr += lifemod;
+ return 0;
+}
+int graphics_PVOD(GRAPHICS_FUNC_ARGS)
+{
+ int lifemod = ((cpart->life>10?10:cpart->life)*16);
+ *colr += lifemod;
+ return 0;
+}
+int graphics_STOR(GRAPHICS_FUNC_ARGS)
+{
+ if(cpart->tmp){
+ *colr = 0x50;
+ *colg = 0xDF;
+ *colb = 0xDF;
+ } else {
+ *colr = 0x20;
+ *colg = 0xAF;
+ *colb = 0xAF;
+ }
+ return 0;
+}
+int graphics_PUMP(GRAPHICS_FUNC_ARGS)
+{
+ int lifemod = ((cpart->life>10?10:cpart->life)*19);
+ *colb += lifemod;
+ return 0;
+}
+int graphics_GPMP(GRAPHICS_FUNC_ARGS)
+{
+ int lifemod = ((cpart->life>10?10:cpart->life)*19);
+ *colg += lifemod;
+ *colb += lifemod;
+ return 0;
+}
+int graphics_HFLM(GRAPHICS_FUNC_ARGS)
+{
+ int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
+ *colr = (unsigned char)hflm_data[caddress];
+ *colg = (unsigned char)hflm_data[caddress+1];
+ *colb = (unsigned char)hflm_data[caddress+2];
+
+ *firea = 255;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+
+ *pixel_mode = PMODE_NONE; //Clear default, don't draw pixel
+ *pixel_mode |= FIRE_ADD;
+ //Returning 0 means dynamic, do not cache
+ return 0;
+}
+int graphics_FIRW(GRAPHICS_FUNC_ARGS)
+{
+ int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
+ *colr = (unsigned char)firw_data[caddress];
+ *colg = (unsigned char)firw_data[caddress+1];
+ *colb = (unsigned char)firw_data[caddress+2];
+
+ if (decorations_enable && cpart->dcolour)
+ {
+ int a = (cpart->dcolour>>24)&0xFF;
+ *colr = (a*((cpart->dcolour>>16)&0xFF) + (255-a)**colr) >> 8;
+ *colg = (a*((cpart->dcolour>>8)&0xFF) + (255-a)**colg) >> 8;
+ *colb = (a*((cpart->dcolour)&0xFF) + (255-a)**colb) >> 8;
+ }
+
+ *firea = 255;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+
+ *pixel_mode = PMODE_NONE; //Clear default, don't draw pixel
+ *pixel_mode |= FIRE_ADD;
+ //Returning 0 means dynamic, do not cache
+ 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) {
+ *pixel_mode |= PMODE_FLARE;
+ }
+ else
+ {
+ *pixel_mode |= PMODE_SPARK;
+ }
+ return 0;
+}
+int graphics_COAL(GRAPHICS_FUNC_ARGS) //Both COAL and Broken Coal
+{
+ *colr += (cpart->tmp2-295.15f)/3;
+
+ if (*colr > 170)
+ *colr = 170;
+ if (*colr < *colg)
+ *colr = *colg;
+
+ *colg = *colb = *colr;
+
+ if((cpart->temp-295.15f) > 300.0f-200.0f)
+ {
+ float frequency = 3.1415/(2*300.0f-(300.0f-200.0f));
+ int q = ((cpart->temp-295.15f)>300.0f)?300.0f-(300.0f-200.0f):(cpart->temp-295.15f)-(300.0f-200.0f);
+
+ *colr += sin(frequency*q) * 226;
+ *colg += sin(frequency*q*4.55 +3.14) * 34;
+ *colb += sin(frequency*q*2.22 +3.14) * 64;
+ }
+ return 0;
+}
+
diff --git a/src/elements/phot.c b/src/elements/phot.c
index 630171a..7a9d4f2 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 += (cpart->ctype >> (x+18)) & 1;
+ *colb += (cpart->ctype >> x) & 1;
+ }
+ for (x=0; x<12; x++)
+ *colg += (cpart->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/pipe.c b/src/elements/pipe.c
index 7411932..7014536 100644
--- a/src/elements/pipe.c
+++ b/src/elements/pipe.c
@@ -235,3 +235,85 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
}
return 0;
}
+
+int graphics_PIPE(GRAPHICS_FUNC_ARGS)
+{
+ if (cpart->ctype==2)
+ {
+ *colr = 50;
+ *colg = 1;
+ *colb = 1;
+ }
+ else if (cpart->ctype==3)
+ {
+ *colr = 1;
+ *colg = 50;
+ *colb = 1;
+ }
+ else if (cpart->ctype==4)
+ {
+ *colr = 1;
+ *colg = 1;
+ *colb = 50;
+ }
+ else if (cpart->temp<272.15&&cpart->ctype!=1)
+ {
+ if (cpart->temp>173.25&&cpart->temp<273.15)
+ {
+ *colr = 50;
+ *colg = 1;
+ *colb = 1;
+ }
+ if (cpart->temp>73.25&&cpart->temp<=173.15)
+ {
+ *colr = 1;
+ *colg = 50;
+ *colb = 1;
+ }
+ if (cpart->temp>=0&&cpart->temp<=73.15)
+ {
+ *colr = 1;
+ *colg = 1;
+ *colb = 50;
+ }
+ }
+ if ((cpart->tmp&0xFF)>0 && (cpart->tmp&0xFF)<PT_NUM)
+ {
+ //Create a temp. particle and do a subcall.
+ particle tpart;
+ int t;
+ memset(&tpart, 0, sizeof(particle));
+ tpart.type = cpart->tmp&0xFF;
+ tpart.temp = cpart->temp;
+ tpart.life = cpart->flags;
+ tpart.tmp = cpart->pavg[0];
+ tpart.ctype = cpart->pavg[1];
+ t = tpart.type;
+ if (graphicscache[t].isready)
+ {
+ *pixel_mode = graphicscache[t].pixel_mode;
+ *colr = graphicscache[t].colr;
+ *colg = graphicscache[t].colg;
+ *colb = graphicscache[t].colb;
+ *firea = graphicscache[t].firea;
+ *firer = graphicscache[t].firer;
+ *fireg = graphicscache[t].fireg;
+ *fireb = graphicscache[t].fireb;
+ }
+ else
+ {
+ if (ptypes[t].graphics_func)
+ {
+ (*(ptypes[t].graphics_func))(&tpart, nx, ny, pixel_mode, colr, colg, colb, firea, firer, fireg, fireb);
+ }
+ else
+ {
+ graphics_DEFAULT(&tpart, nx, ny, pixel_mode, colr, colg, colb, firea, firer, fireg, fireb);
+ }
+ }
+ //*colr = PIXR(ptypes[cpart->tmp&0xFF].pcolors);
+ //*colg = PIXG(ptypes[cpart->tmp&0xFF].pcolors);
+ //*colb = PIXB(ptypes[cpart->tmp&0xFF].pcolors);
+ }
+ return 0;
+}
diff --git a/src/elements/plsm.c b/src/elements/plsm.c
new file mode 100644
index 0000000..7fa99bb
--- /dev/null
+++ b/src/elements/plsm.c
@@ -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)plasma_data[caddress];
+ *colg = (unsigned char)plasma_data[caddress+1];
+ *colb = (unsigned char)plasma_data[caddress+2];
+
+ *firea = 255;
+ *firer = *colr;
+ *fireg = *colg;
+ *fireb = *colb;
+
+ *pixel_mode = PMODE_GLOW; //Clear default, don't draw pixel
+ *pixel_mode |= FIRE_ADD;
+ //Returning 0 means dynamic, do not cache
+ return 0;
+}
diff --git a/src/elements/smke.c b/src/elements/smke.c
new file mode 100644
index 0000000..3e0e88e
--- /dev/null
+++ b/src/elements/smke.c
@@ -0,0 +1,18 @@
+#include <element.h>
+
+int graphics_SMKE(GRAPHICS_FUNC_ARGS)
+{
+ *colr = 55;
+ *colg = 55;
+ *colb = 55;
+
+ *firea = 55;
+ *firer = 55;
+ *fireg = 55;
+ *fireb = 55;
+
+ *pixel_mode = PMODE_NONE; //Clear default, don't draw pixel
+ *pixel_mode |= FIRE_BLEND;
+ //Returning 1 means static, cache as we please
+ return 1;
+} \ No newline at end of file
diff --git a/src/elements/sprk.c b/src/elements/sprk.c
index efab62e..fdbdb2d 100644
--- a/src/elements/sprk.c
+++ b/src/elements/sprk.c
@@ -211,3 +211,16 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
}
return 0;
}
+
+int graphics_SPRK(GRAPHICS_FUNC_ARGS)
+{
+ //*firea = 80;
+ //*firer = *colr*0.5;
+ //*fireg = *colg;
+ //*fireb = *colb*2;
+ *colr *= 0.5;
+ *colb *= 2;
+ //*pixel_mode |= FIRE_ADD;
+ *pixel_mode |= PMODE_GLOW;
+ return 1;
+}
diff --git a/src/elements/stkm.c b/src/elements/stkm.c
index 972bd86..e8a1241 100644
--- a/src/elements/stkm.c
+++ b/src/elements/stkm.c
@@ -13,6 +13,22 @@ int update_STKM(UPDATE_FUNC_ARGS)
return 0;
}
+int graphics_STKM(GRAPHICS_FUNC_ARGS)
+{
+ *pixel_mode = PSPEC_STICKMAN;
+ if ((int)player.elem<PT_NUM)
+ {
+ *colr = PIXR(ptypes[player.elem].pcolors);
+ *colg = PIXG(ptypes[player.elem].pcolors);
+ *colb = PIXB(ptypes[player.elem].pcolors);
+ }
+ else
+ {
+ *colr = *colg = *colb = 255;
+ }
+ return 1;
+}
+
int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
int r, rx, ry;
float pp, d;
diff --git a/src/elements/stkm2.c b/src/elements/stkm2.c
index e49f170..f43262c 100644
--- a/src/elements/stkm2.c
+++ b/src/elements/stkm2.c
@@ -12,3 +12,18 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
return 0;
}
+int graphics_STKM2(GRAPHICS_FUNC_ARGS)
+{
+ *pixel_mode = PSPEC_STICKMAN;
+ if ((int)player2.elem<PT_NUM)
+ {
+ *colr = PIXR(ptypes[player2.elem].pcolors);
+ *colg = PIXG(ptypes[player2.elem].pcolors);
+ *colb = PIXB(ptypes[player2.elem].pcolors);
+ }
+ else
+ {
+ *colr = *colg = *colb = 255;
+ }
+ return 1;
+}