summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-03-15 01:52:23 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-03-15 01:52:23 (GMT)
commit7a454d4d729a5715a7c1e71dfbaf303471bf8d1f (patch)
tree234cb5ba80e5227ecc5dc7c7e9b4845444e5f1a9 /src/elements
parentb4a06df0b2264c690f0161b099c2c5a2c11f8b3b (diff)
parentbf5484ca63f0ee5165b394f98d91e16089f657a2 (diff)
downloadpowder-7a454d4d729a5715a7c1e71dfbaf303471bf8d1f.zip
powder-7a454d4d729a5715a7c1e71dfbaf303471bf8d1f.tar.gz
Merge pull request #57 from jacob1/test
Bug fixes + Some stuff from jacob1's mod
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/co2.c15
-rw-r--r--src/elements/elec.c2
-rw-r--r--src/elements/h2.c56
-rw-r--r--src/elements/nble.c26
-rw-r--r--src/elements/newgraphics.c3
-rw-r--r--src/elements/prti.c4
-rw-r--r--src/elements/prto.c9
-rw-r--r--src/elements/pyro.c1
-rw-r--r--src/elements/sprk.c10
-rw-r--r--src/elements/stkm.c2
10 files changed, 105 insertions, 23 deletions
diff --git a/src/elements/co2.c b/src/elements/co2.c
index f820425..3356397 100644
--- a/src/elements/co2.c
+++ b/src/elements/co2.c
@@ -27,5 +27,20 @@ int update_CO2(UPDATE_FUNC_ARGS) {
kill_part(r>>8);
}
}
+ if (parts[i].temp > 9773.15 && pv[y/CELL][x/CELL] > 200.0f)
+ {
+ if (rand()%5 < 1)
+ {
+ int j;
+ kill_part(i);
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = 15000;
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = 15000;
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_O2); if (j != -1) parts[j].temp = 15000;
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_SING); if (j != -1) { parts[j].temp = 15000; parts[i].life = rand()%100+450; }
+
+ parts[i].temp += 15000;
+ pv[y/CELL][x/CELL] += 100;
+ }
+ }
return 0;
}
diff --git a/src/elements/elec.c b/src/elements/elec.c
index 6acbbab..a5c254f 100644
--- a/src/elements/elec.c
+++ b/src/elements/elec.c
@@ -79,7 +79,7 @@ int update_ELEC(UPDATE_FUNC_ARGS) {
kill_part(i);
return 1;
}
- if (ptypes[r&0xFF].properties & PROP_CONDUCTS)
+ if (ptypes[r&0xFF].properties & PROP_CONDUCTS && ((r&0xFF)!=PT_H2||parts[i].tmp!=1))
{
create_part(-1, x+rx, y+ry, PT_SPRK);
kill_part(i);
diff --git a/src/elements/h2.c b/src/elements/h2.c
index c601108..e80f04a 100644
--- a/src/elements/h2.c
+++ b/src/elements/h2.c
@@ -3,6 +3,8 @@
int update_H2(UPDATE_FUNC_ARGS)
{
int r,rx,ry,rt;
+ if (parts[i].temp > 2273.15 && pv[y/CELL][x/CELL] > 50.0f)
+ parts[i].tmp = 1;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -16,19 +18,51 @@ int update_H2(UPDATE_FUNC_ARGS)
part_change_type(r>>8,x+rx,y+ry,PT_WATR);
part_change_type(i,x,y,PT_OIL);
}
- if ((r&0xFF)==PT_FIRE)
- {
- parts[r>>8].temp=2473.15;
- if(parts[r>>8].tmp&0x02)
- parts[r>>8].temp=3473;
- parts[r>>8].tmp |= 1;
- }
- if ((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)
+ if (parts[r>>8].temp > 2273.15)// && pv[y/CELL][x/CELL] > 50.0f)
+ continue;
+ if (parts[i].tmp != 1)
{
- create_part(i,x,y,PT_FIRE);
- parts[i].temp+=(rand()/(RAND_MAX/100));
- parts[i].tmp |= 1;
+ if (rt==PT_FIRE)
+ {
+ parts[r>>8].temp=2473.15;
+ if(parts[r>>8].tmp&0x02)
+ parts[r>>8].temp=3473;
+ parts[r>>8].tmp |= 1;
+ }
+ if (rt==PT_FIRE || rt==PT_PLSM || rt==PT_LAVA)
+ {
+ create_part(i,x,y,PT_FIRE);
+ parts[i].temp+=(rand()/(RAND_MAX/100));
+ parts[i].tmp |= 1;
+ }
}
}
+ if (parts[i].temp > 2273.15 && pv[y/CELL][x/CELL] > 50.0f)
+ {
+ parts[i].tmp = 1;
+ if (rand()%5 < 1)
+ {
+ int j;
+ float temp = parts[i].temp;
+ part_change_type(i,x,y,PT_PLSM);
+ parts[i].life = rand()%150+50;
+ create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
+ create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
+ if (j != -1) { parts[j].ctype = 0xFFFF00; parts[j].temp = temp; }
+
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NBLE);
+ if (j != -1) { parts[j].tmp = 1; parts[j].temp = temp; }
+
+ if (rand()%2)
+ {
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NBLE);
+ if (j != -1) { parts[j].tmp = 1; parts[j].temp = temp; }
+ }
+
+ parts[i].temp += 6000;
+ pv[y/CELL][x/CELL] += 30;
+ }
+ }
return 0;
}
diff --git a/src/elements/nble.c b/src/elements/nble.c
new file mode 100644
index 0000000..43264b4
--- /dev/null
+++ b/src/elements/nble.c
@@ -0,0 +1,26 @@
+#include <element.h>
+
+int update_NBLE(UPDATE_FUNC_ARGS)
+{
+ if (parts[i].temp > 5273.15 && pv[y/CELL][x/CELL] > 100.0f)
+ {
+ if (rand()%5 < 1)
+ {
+ int j;
+ float temp = parts[i].temp;
+ part_change_type(i,x,y,PT_PLSM);
+ parts[i].life = rand()%150+50;
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1)
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1)
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
+ if (j != -1) { parts[j].ctype = 0xFF0000; parts[j].temp = temp; }
+
+ j = create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_CO2);
+ if (j != -1) parts[j].temp = temp - 1000;
+
+ parts[i].temp += 10000;
+ pv[y/CELL][x/CELL] += 30;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/newgraphics.c b/src/elements/newgraphics.c
index 8957df9..4c9225c 100644
--- a/src/elements/newgraphics.c
+++ b/src/elements/newgraphics.c
@@ -164,6 +164,7 @@ int graphics_WIFI(GRAPHICS_FUNC_ARGS)
*colr = sin(frequency*q + 0) * 127 + 128;
*colg = sin(frequency*q + 2) * 127 + 128;
*colb = sin(frequency*q + 4) * 127 + 128;
+ *pixel_mode |= EFFECT_LINES;
return 0;
}
int graphics_PRTI(GRAPHICS_FUNC_ARGS)
@@ -173,6 +174,7 @@ int graphics_PRTI(GRAPHICS_FUNC_ARGS)
*fireg = 0;
*fireb = 0;
*pixel_mode |= EFFECT_GRAVIN;
+ *pixel_mode |= EFFECT_LINES;
*pixel_mode &= ~PMODE;
*pixel_mode |= PMODE_ADD;
return 1;
@@ -184,6 +186,7 @@ int graphics_PRTO(GRAPHICS_FUNC_ARGS)
*fireg = 0;
*fireb = 255;
*pixel_mode |= EFFECT_GRAVOUT;
+ *pixel_mode |= EFFECT_LINES;
*pixel_mode &= ~PMODE;
*pixel_mode |= PMODE_ADD;
return 1;
diff --git a/src/elements/prti.c b/src/elements/prti.c
index 8d8f685..8b15598 100644
--- a/src/elements/prti.c
+++ b/src/elements/prti.c
@@ -55,8 +55,8 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
if (fe) {
int orbd[4] = {0, 0, 0, 0}; //Orbital distances
int orbl[4] = {0, 0, 0, 0}; //Orbital locations
- if (!parts[i].life) parts[i].life = rand();
- if (!parts[i].ctype) parts[i].ctype = rand();
+ if (!parts[i].life) parts[i].life = rand()*rand()*rand();
+ if (!parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
for (r = 0; r < 4; r++) {
if (orbd[r]>1) {
diff --git a/src/elements/prto.c b/src/elements/prto.c
index 1e7cde0..1dd00d4 100644
--- a/src/elements/prto.c
+++ b/src/elements/prto.c
@@ -85,8 +85,8 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
if (fe) {
int orbd[4] = {0, 0, 0, 0}; //Orbital distances
int orbl[4] = {0, 0, 0, 0}; //Orbital locations
- if (!parts[i].life) parts[i].life = rand();
- if (!parts[i].ctype) parts[i].life = rand();
+ if (!parts[i].life) parts[i].life = rand()*rand()*rand();
+ if (!parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
for (r = 0; r < 4; r++) {
if (orbd[r]<254) {
@@ -94,9 +94,10 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
if (orbd[r]>254) {
orbd[r] = 0;
orbl[r] = rand()%255;
+ } else {
+ orbl[r] += 1;
+ orbl[r] = orbl[r]%255;
}
- //orbl[r] += 1;
- //orbl[r] = orbl[r]%255;
} else {
orbd[r] = 0;
orbl[r] = rand()%255;
diff --git a/src/elements/pyro.c b/src/elements/pyro.c
index dc51e76..003c8f8 100644
--- a/src/elements/pyro.c
+++ b/src/elements/pyro.c
@@ -46,6 +46,7 @@ int update_PYRO(UPDATE_FUNC_ARGS) {
(t!=PT_SPRK || (rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL)) &&
(t!=PT_PHOT || rt!=PT_INSL) &&
(rt!=PT_SPNG || parts[r>>8].life==0) &&
+ (rt!=PT_H2 || (parts[r>>8].temp < 2273.15 && pv[y/CELL][x/CELL] < 50.0f)) &&
ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ry)/CELL][(x+rx)/CELL]*10.0f))>(rand()%1000))
{
part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
diff --git a/src/elements/sprk.c b/src/elements/sprk.c
index 67b8132..00279f5 100644
--- a/src/elements/sprk.c
+++ b/src/elements/sprk.c
@@ -44,7 +44,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
parts[nearp].ctype = PT_ETRD;
}
}
- else if (ct==PT_NBLE&&parts[i].life<=1)
+ else if (ct==PT_NBLE&&parts[i].life<=1&&parts[i].tmp!=1)
{
parts[i].life = rand()%150+50;
part_change_type(i,x,y,PT_PLSM);
@@ -179,6 +179,8 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
conduct_sprk = 0;
if (rt==PT_INST&&ct!=PT_PSCN)
conduct_sprk = 0;
+ if (rt == PT_NBLE && parts[r>>8].tmp == 1)
+ conduct_sprk = 0;
if (conduct_sprk) {
if (rt==PT_WATR||rt==PT_SLTW) {
@@ -221,9 +223,9 @@ int graphics_SPRK(GRAPHICS_FUNC_ARGS)
{
*firea = 80;
- *firer = *colr = 170;
- *fireg = *colg = 200;
- *fireb = *colb = 220;
+ *firer = 170;
+ *fireg = 200;
+ *fireb = 220;
//*pixel_mode |= FIRE_ADD;
*pixel_mode |= FIRE_ADD;
return 1;
diff --git a/src/elements/stkm.c b/src/elements/stkm.c
index d8286d5..7a67b65 100644
--- a/src/elements/stkm.c
+++ b/src/elements/stkm.c
@@ -257,7 +257,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
{
int np = -1;
if (playerp->elem == SPC_AIR)
- create_parts(rx + 3*((((int)playerp->pcomm)&0x02) == 0x02) - 3*((((int)playerp->pcomm)&0x01) == 0x01), ry, 4, 4, SPC_AIR, 0);
+ create_parts(rx + 3*((((int)playerp->pcomm)&0x02) == 0x02) - 3*((((int)playerp->pcomm)&0x01) == 0x01), ry, 4, 4, SPC_AIR, 0, 1);
else if (playerp->elem==PT_LIGH && playerp->frames<30)//limit lightning creation rate
np = -1;
else