summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorCatelite <liclockwork@yahoo.com>2012-06-06 13:41:56 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-07 13:03:16 (GMT)
commitc07afe4c892711b58061e5c0a3180ea3865f9452 (patch)
tree27f9836659c0ee42d884b8cd0e22ccade3fa0425 /src/elements
parentfe39fdb0e5e91e3c09fe18d6bd1af72db4059ef7 (diff)
downloadpowder-c07afe4c892711b58061e5c0a3180ea3865f9452.zip
powder-c07afe4c892711b58061e5c0a3180ea3865f9452.tar.gz
Ton of changes to make EXOT work as expected. Added graphics to WARP to make it actually invisible besides BLOB mode, EXOT now makes rainbows and explodes with too many electrons o__o
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/brel.c1
-rw-r--r--src/elements/elec.c2
-rw-r--r--src/elements/exot.c65
-rw-r--r--src/elements/warp.c18
4 files changed, 75 insertions, 11 deletions
diff --git a/src/elements/brel.c b/src/elements/brel.c
index 06ea363..c97118b 100644
--- a/src/elements/brel.c
+++ b/src/elements/brel.c
@@ -20,6 +20,7 @@ int update_BREL(UPDATE_FUNC_ARGS) {
if (1>rand()%200 && (pv[y/CELL][x/CELL] > 30.0f) && parts[i].temp>9000 && parts[i].life>0)
{
part_change_type(i, x ,y ,PT_EXOT);
+ parts[i].life = 1000;
}
if ((pv[y/CELL][x/CELL] > 10.0f) && (parts[i].life>0)) {
parts[i].temp = parts[i].temp + (pv[y/CELL][x/CELL])/8;
diff --git a/src/elements/elec.c b/src/elements/elec.c
index 919ee87..12f9fac 100644
--- a/src/elements/elec.c
+++ b/src/elements/elec.c
@@ -94,6 +94,8 @@ int update_ELEC(UPDATE_FUNC_ARGS) {
kill_part(i);
return 1;
}
+ if ((r&0xFF)==PT_EXOT)
+ parts[r>>8].tmp2 += 5;
if (ptypes[r&0xFF].properties & PROP_CONDUCTS && ((r&0xFF)!=PT_NBLE||parts[i].temp<2273.15))
{
create_part(-1, x+rx, y+ry, PT_SPRK);
diff --git a/src/elements/exot.c b/src/elements/exot.c
index 234ab9e..81f7c7d 100644
--- a/src/elements/exot.c
+++ b/src/elements/exot.c
@@ -16,20 +16,67 @@
#include <element.h>
int update_EXOT(UPDATE_FUNC_ARGS) {
-
-
+ int r, rt, rx, ry, nb, rrx, rry;
+ for (rx=-2; rx<=2; rx++)
+ for (ry=-2; ry<=2; ry++)
+ if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) {
+ r = pmap[y+ry][x+rx];
+ if (!r)
+ continue;
+ if ((r&0xFF)==PT_WARP)
+ {
+ if (parts[r>>8].tmp2>2000)
+ if (1>rand()%100)
+ {
+ parts[i].tmp2 += 50;
+ }
+ }
+ }
parts[i].tmp--;
- if (parts[i].tmp<1) {
+ parts[i].tmp2--;
+ if (parts[i].tmp<1 || parts[i].tmp>250)
parts[i].tmp = 250;
+ if (parts[i].tmp2<1)
+ parts[i].tmp2 = 1;
+ else if (parts[i].tmp2>2500)
+ {
+ parts[i].tmp2 = 2500;
+ part_change_type(i, x, y, PT_WARP);
+ parts[i].temp = 10000;
}
-
+ else
+ pv[y/CELL][x/CELL] += (parts[i].tmp2/2000) * CFDS;
+ if (pv[y/CELL][x/CELL]>200 && parts[i].temp>9000 && parts[i].tmp2>200)
+ {
+ part_change_type(i, x, y, PT_WARP);
+ parts[i].tmp2 = 2500;
+ }
return 0;
}
int graphics_EXOT(GRAPHICS_FUNC_ARGS)
{
- *colr = cpart->tmp / 2 + 0x08;
- *colg = cpart->tmp * 2 + 0x28;
- *colb = cpart->tmp / 2 + 0x08;
+ int q = cpart->temp;
+ int b = cpart->tmp;
+ if ((cpart->tmp2 - 1)>rand()%1000)
+ {
+ float frequency = 0.90045;
+ *colr = (sin(frequency*q + 0) * 127 + 255);
+ *colg = (sin(frequency*q + 2) * 127 + 255);
+ *colb = (sin(frequency*q + 4) * 127 + 255);
+ *firea = 100;
+ *firer = 0;
+ *fireg = 0;
+ *fireb = 0;
+ *pixel_mode |= PMODE_FLAT;
+// *pixel_mode |= FIRE_ADD;
+ *pixel_mode |= PMODE_FLARE;
+ }
+ else
+ {
+ float frequency = 0.00045;
+ *colr = (sin(frequency*q + 0) * 127 + (b/1.7));
+ *colg = (sin(frequency*q + 2) * 127 + (b/1.7));
+ *colb = (sin(frequency*q + 4) * 127 + (b/1.7));
*cola = cpart->tmp / 6;
*firea = *cola;
*firer = *colr;
@@ -37,8 +84,6 @@ int graphics_EXOT(GRAPHICS_FUNC_ARGS)
*fireb = *colb;
*pixel_mode |= FIRE_ADD;
*pixel_mode |= PMODE_BLUR;
-
-
-
+ }
return 0;
}
diff --git a/src/elements/warp.c b/src/elements/warp.c
index 27352fd..0108bb9 100644
--- a/src/elements/warp.c
+++ b/src/elements/warp.c
@@ -17,6 +17,14 @@
int update_WARP(UPDATE_FUNC_ARGS) {
int trade, r, rx, ry;
+
+ if (parts[i].tmp2>2000)
+ {
+ parts[i].temp = 10000;
+ pv[y/CELL][x/CELL] += (parts[i].tmp2/2000) * CFDS;
+ if (2>rand()%1000)
+ create_part(-3, x, y, PT_ELEC);
+ }
for ( trade = 0; trade<5; trade ++)
{
rx = rand()%3-1;
@@ -26,12 +34,14 @@ int update_WARP(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)!=PT_WARP&&(r&0xFF)!=PT_STKM&&(r&0xFF)!=PT_STKM2&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_BCLN&&(r&0xFF)!=PT_PCLN&&(10>=rand()%200))
+ if ((r&0xFF)!=PT_WARP&&(r&0xFF)!=PT_STKM&&(r&0xFF)!=PT_STKM2&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_BCLN&&(r&0xFF)!=PT_PCLN)
{
parts[i].x = parts[r>>8].x;
parts[i].y = parts[r>>8].y;
parts[r>>8].x = x;
parts[r>>8].y = y;
+ parts[r>>8].vx = (rand()%4)-1.5;
+ parts[r>>8].vy = (rand()%4)-2;
parts[i].life += 4;
pmap[y][x] = r;
pmap[y+ry][x+rx] = (i<<8)|parts[i].type;
@@ -41,3 +51,9 @@ int update_WARP(UPDATE_FUNC_ARGS) {
}
return 0;
}
+int graphics_WARP(GRAPHICS_FUNC_ARGS)
+{
+ *cola = 0;
+ *pixel_mode &= ~PMODE;
+ return 0;
+}