Finish update function cleanup

This commit is contained in:
jacksonmj 2011-01-10 14:41:03 +00:00
parent 855281295f
commit 54f9f872b9
29 changed files with 489 additions and 499 deletions

View File

@ -221,10 +221,9 @@
#define PROP_RADIOACTIVE 0x2000 //8192 Radioactive
#define FLAG_STAGNANT 1
// TODO: which of these arguments are actually used?
#define UPDATE_FUNC_ARGS int i, int x, int y, int nx, int ny, float lx, float ly, int a
#define UPDATE_FUNC_ARGS int i, int x, int y, int a
// to call another update function with same arguments:
#define UPDATE_FUNC_SUBCALL_ARGS i, x, y, nx, ny, lx, ly, a
#define UPDATE_FUNC_SUBCALL_ARGS i, x, y, a
int update_ACID(UPDATE_FUNC_ARGS);
int update_AMTR(UPDATE_FUNC_ARGS);
@ -286,6 +285,7 @@ int update_WTRV(UPDATE_FUNC_ARGS);
int update_YEST(UPDATE_FUNC_ARGS);
int update_MISC(UPDATE_FUNC_ARGS);
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
int update_legacy_all(UPDATE_FUNC_ARGS);

View File

@ -1,23 +1,22 @@
#include <powder.h>
int update_BTRY(UPDATE_FUNC_ARGS) {
int r, rt;
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry, rt;
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
rt = parts[r>>8].type;
if (parts_avg(i,r>>8,PT_INSL) != PT_INSL)
{
if ((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && abs(nx)+abs(ny) < 4)
if ((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && abs(rx)+abs(ry) < 4)
{
parts[r>>8].life = 4;
parts[r>>8].ctype = rt;
parts[r>>8].type = PT_SPRK;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
}
}
}

View File

@ -1,19 +1,19 @@
#include <powder.h>
int update_C5(UPDATE_FUNC_ARGS) {
int r;
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((parts[r>>8].temp<100 && parts[r>>8].type!=PT_C5)||parts[r>>8].type==PT_HFLM)
if (((r&0xFF)!=PT_C5 && parts[r>>8].temp<100)||(r&0xFF)==PT_HFLM)
{
if (1>rand()%6)
{
parts[i].type = PT_HFLM;
part_change_type(i,x,y,PT_HFLM);
parts[r>>8].temp = parts[i].temp = 0;
parts[i].life = rand()%150+50;
pv[y/CELL][x/CELL] += 1.5;

View File

@ -1,11 +1,9 @@
#include <powder.h>
int update_COAL(UPDATE_FUNC_ARGS) {
int r;
int r, rx, ry;
if (parts[i].life<=0) {
parts[i].type = PT_NONE;
kill_part(i);
create_part(-1, x, y, PT_FIRE);
create_part(i, x, y, PT_FIRE);
return 1;
} else if (parts[i].life < 100) {
parts[i].life--;
@ -16,17 +14,14 @@ int update_COAL(UPDATE_FUNC_ARGS) {
else if (parts[i].tmp<40&&parts[i].tmp>0)
parts[i].tmp--;
else if (parts[i].tmp<=0) {
parts[i].type = PT_NONE;
kill_part(i);
r = create_part(-1, x, y, PT_BCOL);
create_part(i, x, y, PT_BCOL);
return 1;
}
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))

View File

@ -1,58 +1,59 @@
#include <powder.h>
int update_DEUT(UPDATE_FUNC_ARGS) {
int r, trade;
int r, rx, ry, trade, np;
int maxlife = ((10000/(parts[i].temp + 1))-1);
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
maxlife ++;
if (parts[i].life < maxlife)
{
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r || (parts[i].life >=maxlife))
continue;
if (parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
if ((r&0xFF)==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
{
if ((parts[i].life + parts[r>>8].life + 1) <= maxlife)
{
parts[i].life += parts[r>>8].life + 1;
parts[r>>8].type=PT_NONE;
kill_part(r>>8);
}
}
}
}
else
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || (parts[i].life<=maxlife))
continue;
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_EWALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||
bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWAIR||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWGAS))
continue;
if ((!r)&&parts[i].life>=1)//if nothing then create deut
{
create_part(-1,x+nx,y+ny,PT_DEUT);
np = create_part(-1,x+rx,y+ry,PT_DEUT);
if (np<0) continue;
parts[i].life--;
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
parts[pmap[y+ny][x+nx]>>8].life = 0;
parts[np].temp = parts[i].temp;
parts[np].life = 0;
}
}
for ( trade = 0; trade<4; trade ++)
{
nx = rand()%5-2;
ny = rand()%5-2;
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
rx = rand()%5-2;
ry = rand()%5-2;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (parts[r>>8].type==PT_DEUT&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
if ((r&0xFF)==PT_DEUT&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{
int temp = parts[i].life - parts[r>>8].life;
if (temp ==1)

View File

@ -1,14 +1,13 @@
#include <powder.h>
int update_FIRW(UPDATE_FUNC_ARGS) {
int r, rt;
int r, rx, ry, rt;
if (parts[i].tmp==0) {
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
rt = parts[r>>8].type;
@ -25,26 +24,28 @@ int update_FIRW(UPDATE_FUNC_ARGS) {
} else {
float newVel = parts[i].life/25;
parts[i].flags = parts[i].flags&0xFFFFFFFE;
/* TODO:
if ((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE && ly-newVel>0) {
parts[i].vy = -newVel;
// TODO
//ly-=newVel;
//iy-=newVel;
}
ly-=newVel;
iy-=newVel;
}*/
parts[i].vy = -newVel;
}
}
else if (parts[i].tmp==2) {
int col = rand()%200+4;
for (nx=-2; nx<3; nx++) {
for (ny=-2; ny<3; ny++) {
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
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))
{
r = pmap[y+ry][x+rx];
int tmul = rand()%7;
create_part(-1, x+nx, y+ny, PT_FIRW);
r = pmap[y+ny][x+nx];
create_part(-1, x+rx, y+ry, PT_FIRW);
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (parts[r>>8].type==PT_FIRW) {
if ((r&0xFF)==PT_FIRW) {
parts[r>>8].vx = (rand()%3-1)*tmul;
parts[r>>8].vy = (rand()%3-1)*tmul;
parts[r>>8].tmp = col;
@ -52,8 +53,6 @@ int update_FIRW(UPDATE_FUNC_ARGS) {
parts[r>>8].temp = 6000.0f;
}
}
}
}
pv[y/CELL][x/CELL] += 20;
kill_part(i);
return 1;

View File

@ -1,22 +1,19 @@
#include <powder.h>
int update_FOG(UPDATE_FUNC_ARGS) {
int r;
if (parts[i].temp>=373.15)
parts[i].type = PT_WTRV;
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN))
if (pstates[r&0xFF].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!((r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
{
parts[i].type = PT_RIME;
part_change_type(i,x,y,PT_RIME);
}
if (parts[r>>8].type==PT_SPRK)
if ((r&0xFF)==PT_SPRK)
{
parts[i].life += rand()%20;
}

View File

@ -1,35 +1,30 @@
#include <powder.h>
int update_FRZW(UPDATE_FUNC_ARGS) {
int r;
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (parts[r>>8].type==PT_WATR&&5>rand()%70)
if ((r&0xFF)==PT_WATR&&5>rand()%70)
{
parts[r>>8].type=PT_FRZW;
part_change_type(r>>8,x+rx,y+ry,PT_FRZW);
}
}
if (parts[i].life==0&&13>rand()%2500)
{
parts[i].type=PT_ICEI;
part_change_type(i,x,y,PT_ICEI);
parts[i].ctype=PT_FRZW;
parts[i].temp -= 200.0f;
if (parts[i].temp<0)
parts[i].temp = 0;
parts[i].temp = restrict_flt(parts[i].temp-200.0f, MIN_TEMP, MAX_TEMP);
}
else if ((100-(parts[i].life))>rand()%50000)
{
parts[i].type=PT_ICEI;
part_change_type(i,x,y,PT_ICEI);
parts[i].ctype=PT_FRZW;
parts[i].temp -= 200.0f;
if (parts[i].temp<0)
parts[i].temp = 0;
parts[i].temp = restrict_flt(parts[i].temp-200.0f, MIN_TEMP, MAX_TEMP);
}
return 0;
}

View File

@ -1,22 +1,25 @@
#include <powder.h>
int update_FRZZ(UPDATE_FUNC_ARGS) {
int r;
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (parts[r>>8].type==PT_WATR&&5>rand()%100)
if ((r&0xFF)==PT_WATR&&5>rand()%100)
{
parts[r>>8].type=PT_FRZW;
part_change_type(r>>8,x+rx,y+ry,PT_FRZW);
parts[r>>8].life = 100;
parts[i].type = PT_NONE;
}
}
if (parts[i].type==PT_NONE) {
kill_part(i);
return 1;
}
return 0;
}

View File

@ -1,36 +1,35 @@
#include <powder.h>
int update_FSEP(UPDATE_FUNC_ARGS) {
int r;
int r, rx, ry;
if (parts[i].life<=0) {
//t = PT_NONE;
kill_part(i);
r = create_part(-1, x, y, PT_PLSM);
r = create_part(i, x, y, PT_PLSM);
if (r!=-1)
parts[r].life = 50;
return 1;
} else if (parts[i].life < 40) {
parts[i].life--;
if ((rand()%10)==0) {
r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
r = create_part(-1, (rx=x+rand()%3-1), (ry=y+rand()%3-1), PT_PLSM);
if (r!=-1)
parts[r].life = 50;
}
}
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
else {
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))
{
if (parts[i].life>40) {
parts[i].life = 39;
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
{
if (parts[i].life>40) {
parts[i].life = 39;
}
}
}
}
}
return 0;
}

View File

@ -1,18 +1,16 @@
#include <powder.h>
int update_FUSE(UPDATE_FUNC_ARGS) {
int r;
int r, rx, ry;
if (parts[i].life<=0) {
//t = parts[i].life = PT_NONE;
kill_part(i);
r = create_part(-1, x, y, PT_PLSM);
r = create_part(i, x, y, PT_PLSM);
if (r!=-1)
parts[r].life = 50;
return 1;
} else if (parts[i].life < 40) {
parts[i].life--;
if ((rand()%100)==0) {
r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
r = create_part(-1, (rx=x+rand()%3-1), (ry=y+rand()%3-1), PT_PLSM);
if (r!=-1)
parts[r].life = 50;
}
@ -22,17 +20,14 @@ int update_FUSE(UPDATE_FUNC_ARGS) {
else if (parts[i].tmp<40&&parts[i].tmp>0)
parts[i].tmp--;
else if (parts[i].tmp<=0) {
//t = PT_NONE;
kill_part(i);
r = create_part(-1, x, y, PT_FSEP);
create_part(i, x, y, PT_FSEP);
return 1;
}
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))

View File

@ -1,42 +1,37 @@
#include <powder.h>
int update_FWRK(UPDATE_FUNC_ARGS) {
int r;
int r, rx, ry, np;
if ((parts[i].temp>400&&(9+parts[i].temp/40)>rand()%100000&&parts[i].life==0&&!pmap[y-1][x])||parts[i].ctype==PT_DUST)
{
create_part(-1, x , y-1 , PT_FWRK);
r = pmap[y-1][x];
if ((r&0xFF)==PT_FWRK)
np = create_part(-1, x , y-1 , PT_FWRK);
if (np!=-1)
{
parts[r>>8].vy = rand()%8-22;
parts[r>>8].vx = rand()%20-rand()%20;
parts[r>>8].life=rand()%15+25;
parts[i].type=PT_NONE;
kill_part(i);
return 1;
}
}
if (parts[i].life>1)
{
if (parts[i].life>=45&&parts[i].type==PT_FWRK)
parts[i].life=0;
}
if (parts[i].life>=45)
parts[i].life=0;
if ((parts[i].life<3&&parts[i].life>0)||parts[i].vy>6&&parts[i].life>0)
{
int q = (rand()%255+1);
int w = (rand()%255+1);
int e = (rand()%255+1);
for (nx=-1; nx<2; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES)
for (rx=-1; rx<2; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
if (5>=rand()%8)
{
if (!pmap[y+ny][x+nx])
if (!pmap[y+ry][x+rx])
{
create_part(-1, x+nx, y+ny , PT_DUST);
np = create_part(-1, x+rx, y+ry , PT_DUST);
pv[y/CELL][x/CELL] += 2.00f*CFDS;
r = pmap[y+ny][x+nx];
if (parts[r>>8].type==PT_DUST)
if (np!=-1)
{
parts[r>>8].vy = -(rand()%10-1);
parts[r>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
@ -49,7 +44,8 @@ int update_FWRK(UPDATE_FUNC_ARGS) {
}
}
}
parts[i].type=PT_NONE;
kill_part(i);
return 1;
}
return 0;
}

View File

@ -1,21 +1,24 @@
#include <powder.h>
int update_GLOW(UPDATE_FUNC_ARGS) {
int r;
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (parts[r>>8].type==PT_WATR&&5>(rand()%2000))
if ((r&0xFF)==PT_WATR&&5>(rand()%2000))
{
parts[i].type = PT_NONE;
parts[r>>8].type = PT_DEUT;
part_change_type(r>>8,x+rx,y+ry,PT_DEUT);
parts[r>>8].life = 10;
}
}
if (parts[i].type==PT_NONE) {
kill_part(i);
return 1;
}
return 0;
}

View File

@ -1,18 +1,17 @@
#include <powder.h>
int update_HSWC(UPDATE_FUNC_ARGS) {
int r;
int r, rx, ry;
if (parts[i].life==10)
{
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_PUMP)
if ((r&0xFF)==PT_HSWC)
{
if (parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;

View File

@ -1,36 +1,22 @@
#include <powder.h>
int update_ICEI(UPDATE_FUNC_ARGS) { //currently used for snow as well
int r;
int r, rx, ry;
if (parts[i].ctype==PT_FRZW)
{
parts[i].temp -= 1.0f;
if (parts[i].temp<0)
parts[i].temp = 0;
parts[i].temp = restrict_flt(parts[i].temp-1.0f, MIN_TEMP, MAX_TEMP);
}
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000))
{
parts[i].type = PT_SLTW;
parts[r>>8].type = PT_SLTW;
}
if (legacy_enable)
{
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
{
parts[i].type = PT_ICEI;
parts[r>>8].type = PT_ICEI;
}
if (parts[i].type==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000))
parts[i].type = PT_WATR;
part_change_type(i,x,y,PT_SLTW);
part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
}
}
return 0;

View File

@ -1,12 +1,12 @@
#include <powder.h>
int update_IRON(UPDATE_FUNC_ARGS) {
int r;
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
@ -17,7 +17,7 @@ int update_IRON(UPDATE_FUNC_ARGS) {
(!(parts[i].life))
)
{
parts[i].type=PT_BMTL;
part_change_type(i,x,y,PT_BMTL);
parts[i].tmp=(rand()/(RAND_MAX/10))+20;
}
}

View File

@ -1,17 +1,14 @@
#include <powder.h>
int update_ISZ(UPDATE_FUNC_ARGS) {
int update_ISZ(UPDATE_FUNC_ARGS) { // for both ISZS and ISOZ
float rr, rrr;
if (1>rand()%200 && ((int)(-4.0f*(pv[y/CELL][x/CELL])))>(rand()%1000))
{
parts[i].type = PT_PHOT;
create_part(i, x, y, PT_PHOT);
rr = (rand()%228+128)/127.0f;
rrr = (rand()%360)*3.14159f/180.0f;
parts[i].life = 680;
parts[i].ctype = 0x3FFFFFFF;
parts[i].vx = rr*cosf(rrr);
parts[i].vy = rr*sinf(rrr);
create_part(i, x, y, PT_PHOT);
}
return 0;
}

View File

@ -1,15 +1,14 @@
#include <powder.h>
int update_LCRY(UPDATE_FUNC_ARGS) {
int r;
if (parts[i].life==10)
{
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_LCRY)

View File

@ -23,7 +23,7 @@ int update_legacy_all(UPDATE_FUNC_ARGS) {
{
part_change_type(i,x,y,PT_WATR);
if (1>(rand()%1000))
part_change_type(r>>8,x+nx,y+ny,PT_WATR);
part_change_type(r>>8,x+rx,y+ry,PT_WATR);
}
}
}
@ -73,5 +73,37 @@ int update_legacy_all(UPDATE_FUNC_ARGS) {
}
}
}
else if (t==PT_ICEI) {
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))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
{
part_change_type(i,x,y,PT_ICEI);
part_change_type(r>>8,x+rx,y+ry,PT_ICEI);
}
}
}
else if (t==PT_SNOW) {
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))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
{
part_change_type(i,x,y,PT_ICEI);
part_change_type(r>>8,x+rx,y+ry,PT_ICEI);
}
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000))
part_change_type(i,x,y,PT_WATR);
}
}
return 0;
}

View File

@ -12,7 +12,7 @@ int update_MISC(UPDATE_FUNC_ARGS) { // should probably get their own functions l
parts[i].pavg[1] = pv[y/CELL][x/CELL];
if (parts[i].pavg[1]-parts[i].pavg[0] > 0.25f || parts[i].pavg[1]-parts[i].pavg[0] < -0.25f)
{
parts[i].type = PT_BGLA;
part_change_type(i,x,y,PT_BGLA);
}
}
else if (t==PT_QRTZ)
@ -21,7 +21,7 @@ int update_MISC(UPDATE_FUNC_ARGS) { // should probably get their own functions l
parts[i].pavg[1] = pv[y/CELL][x/CELL];
if (parts[i].pavg[1]-parts[i].pavg[0] > 0.05*(parts[i].temp/3) || parts[i].pavg[1]-parts[i].pavg[0] < -0.05*(parts[i].temp/3))
{
parts[i].type = PT_PQRT;
part_change_type(i,x,y,PT_PQRT);
}
}
else if (t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000))

View File

@ -1,14 +1,13 @@
#include <powder.h>
int update_NEUT(UPDATE_FUNC_ARGS) {
int r;
int rt = 3 + (int)pv[y/CELL][x/CELL];
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
int pressureFactor = 3 + (int)pv[y/CELL][x/CELL];
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW)
@ -16,11 +15,11 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
parts[i].vx *= 0.995;
parts[i].vy *= 0.995;
}
if ((r&0xFF)==PT_PLUT && rt>(rand()%1000))
if ((r&0xFF)==PT_PLUT && pressureFactor>(rand()%1000))
{
if (33>rand()%100)
{
create_part(r>>8, x+nx, y+ny, rand()%3 ? PT_LAVA : PT_URAN);
create_part(r>>8, x+rx, y+ry, rand()%3 ? PT_LAVA : PT_URAN);
parts[r>>8].temp = MAX_TEMP;
if (parts[r>>8].type==PT_LAVA) {
parts[r>>8].tmp = 100;
@ -29,19 +28,19 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
}
else
{
create_part(r>>8, x+nx, y+ny, PT_NEUT);
create_part(r>>8, x+rx, y+ry, PT_NEUT);
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
}
pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough
update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
}
if ((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000))
else if ((r&0xFF)==PT_DEUT && (pressureFactor+1)>(rand()%1000))
{
#ifdef SDEUT
create_n_parts(parts[r>>8].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT);
create_n_parts(parts[r>>8].life, x+rx, y+ry, parts[i].vx, parts[i].vy, PT_NEUT);
#else
create_part(r>>8, x+nx, y+ny, PT_NEUT);
create_part(r>>8, x+rx, y+ry, PT_NEUT);
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
if (parts[r>>8].life>0)
@ -49,44 +48,39 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
parts[r>>8].life --;
parts[r>>8].temp += (parts[r>>8].life*17);
pv[y/CELL][x/CELL] += 6.0f * CFDS;
}
else
parts[r>>8].type = PT_NONE;
kill_part(r>>8);
#endif
}
if ((r&0xFF)==PT_GUNP && 15>(rand()%1000))
parts[r>>8].type = PT_DUST;
if ((r&0xFF)==PT_DYST && 15>(rand()%1000))
parts[r>>8].type = PT_YEST;
if ((r&0xFF)==PT_YEST) {
else if ((r&0xFF)==PT_GUNP && 15>(rand()%1000))
part_change_type(i,x,y,PT_DUST);
else if ((r&0xFF)==PT_DYST && 15>(rand()%1000))
part_change_type(i,x,y,PT_YEST);
else if ((r&0xFF)==PT_YEST) {
if (15>(rand()%100000)&&isplayer==0)
parts[r>>8].type = PT_STKM;
create_part(r>>8, x+rx, y+ry, PT_STKM);
else
parts[r>>8].type = PT_DYST;
}
if ((r&0xFF)==PT_WATR && 15>(rand()%100))
parts[r>>8].type = PT_DSTW;
if ((r&0xFF)==PT_PLEX && 15>(rand()%1000))
parts[r>>8].type = PT_GOO;
if ((r&0xFF)==PT_NITR && 15>(rand()%1000))
parts[r>>8].type = PT_DESL;
if ((r&0xFF)==PT_PLNT && 5>(rand()%100))
parts[r>>8].type = PT_WOOD;
if ((r&0xFF)==PT_DESL && 15>(rand()%1000))
parts[r>>8].type = PT_GAS;
if ((r&0xFF)==PT_COAL && 5>(rand()%100))
parts[r>>8].type = PT_WOOD;
if ((r&0xFF)==PT_DUST && 5>(rand()%100))
parts[r>>8].type = PT_FWRK;
if ((r&0xFF)==PT_FWRK && 5>(rand()%100))
parts[r>>8].ctype = PT_DUST;
if ((r&0xFF)==PT_ACID && 5>(rand()%100))
{
parts[r>>8].type = PT_ISOZ;
parts[r>>8].life = 0;
part_change_type(i,x,y,PT_DYST);
}
else if ((r&0xFF)==PT_WATR && 15>(rand()%100))
part_change_type(r>>8,x+rx,y+ry,PT_DSTW);
else if ((r&0xFF)==PT_PLEX && 15>(rand()%1000))
part_change_type(i,x,y,PT_GOO);
else if ((r&0xFF)==PT_NITR && 15>(rand()%1000))
part_change_type(i,x,y,PT_DESL);
else if ((r&0xFF)==PT_PLNT && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_WOOD);
else if ((r&0xFF)==PT_DESL && 15>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_GAS);
else if ((r&0xFF)==PT_COAL && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_WOOD);
else if ((r&0xFF)==PT_DUST && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_FWRK);
else if ((r&0xFF)==PT_FWRK && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_DUST);
else if ((r&0xFF)==PT_ACID && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_ISOZ);
/*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM &&
(ptypes[parts[r>>8].type-1].menusection==SC_LIQUID||
ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE||

View File

@ -1,13 +1,12 @@
#include <powder.h>
int update_PCLN(UPDATE_FUNC_ARGS) {
int r;
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
int r, rx, ry;
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPRK)
@ -26,37 +25,36 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
}
}
if (!parts[i].ctype)
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES &&
pmap[y+ny][x+nx] &&
(pmap[y+ny][x+nx]&0xFF)!=PT_CLNE &&
(pmap[y+ny][x+nx]&0xFF)!=PT_PCLN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_BCLN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_SPRK &&
(pmap[y+ny][x+nx]&0xFF)!=PT_NSCN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_PSCN &&
(pmap[y+ny][x+nx]&0xFF)!=PT_STKM &&
(pmap[y+ny][x+nx]&0xFF)!=PT_STKM2 &&
(pmap[y+ny][x+nx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES &&
pmap[y+ry][x+rx] &&
(pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
(pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_SPRK &&
(pmap[y+ry][x+rx]&0xFF)!=PT_NSCN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_PSCN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
(pmap[y+ry][x+rx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
if (parts[i].ctype && parts[i].life==10) {
if (parts[i].ctype==PT_PHOT) {
for (nx=-1; nx<2; nx++) {
for (ny=-1; ny<2; ny++) {
int r = create_part(-1, x+nx, y+ny, parts[i].ctype);
for (rx=-1; rx<2; rx++) {
for (ry=-1; ry<2; ry++) {
int r = create_part(-1, x+rx, y+ry, parts[i].ctype);
if (r!=-1) {
parts[r].vx = nx*3;
parts[r].vy = ny*3;
parts[r].vx = rx*3;
parts[r].vy = ry*3;
}
}
}
}
else if (ptypes[parts[i].ctype].properties&PROP_LIFE) {
for (nx=-1; nx<2; nx++) {
for (ny=-1; ny<2; ny++) {
create_part(-1, x+nx, y+ny, parts[i].ctype);
for (rx=-1; rx<2; rx++) {
for (ry=-1; ry<2; ry++) {
create_part(-1, x+rx, y+ry, parts[i].ctype);
}
}
} else {

View File

@ -2,39 +2,20 @@
int update_PHOT(UPDATE_FUNC_ARGS) {
if (1>rand()%10) update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
int r, rt;
int r, rt, rx, ry;
float rr, rrr;
for (nx=0; nx<1; nx++)
for (ny=0; ny<1; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW)
{
parts[i].vx *= 0.995;
parts[i].vy *= 0.995;
}
}
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) {
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_ISOZ && 5>(rand()%2000))
{
parts[i].vx *= 0.90;
parts[i].vy *= 0.90;
parts[r>>8].type = PT_PHOT;
create_part(r>>8, x+rx, y+ry, PT_PHOT);
rrr = (rand()%360)*3.14159f/180.0f;
rr = (rand()%128+128)/127.0f;
parts[r>>8].life = 680;
parts[r>>8].ctype = 0x3FFFFFFF;
parts[r>>8].vx = rr*cosf(rrr);
parts[r>>8].vy = rr*sinf(rrr);
pv[y/CELL][x/CELL] -= 15.0f * CFDS;
@ -43,26 +24,20 @@ int update_PHOT(UPDATE_FUNC_ARGS) {
{
parts[i].vx *= 0.90;
parts[i].vy *= 0.90;
parts[r>>8].type = PT_PHOT;
create_part(r>>8, x+rx, y+ry, PT_PHOT);
rr = (rand()%228+128)/127.0f;
rrr = (rand()%360)*3.14159f/180.0f;
parts[r>>8].life = 680;
parts[r>>8].ctype = 0x3FFFFFFF;
parts[r>>8].vx = rr*cosf(rrr);
parts[r>>8].vy = rr*sinf(rrr);
pv[y/CELL][x/CELL] -= 15.0f * CFDS;
}
}
r = pmap[ny][nx];
r = pmap[y][x];
rt = r&0xFF;
if (rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN) {
if (!parts[r>>8].ctype)
parts[r>>8].ctype = PT_PHOT;
}
// TODO
return 0;
}

View File

@ -1,7 +1,7 @@
#include <powder.h>
int update_PIPE(UPDATE_FUNC_ARGS) {
int r, trade, q, ctype;
int r, rx, ry, np, trade, q, ctype;
if (!parts[i].ctype && parts[i].life<=10)
{
if (parts[i].temp<272.15)
@ -24,15 +24,15 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
}
else
{
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART )
continue;
if (!r)
create_part(-1,x+nx,y+ny,PT_BRCK);
create_part(-1,x+rx,y+ry,PT_BRCK);
}
if (parts[i].life==1)
parts[i].ctype = 1;
@ -40,11 +40,11 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
}
if (parts[i].ctype==1)
{
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if (!r&&!parts[i].life)
@ -64,14 +64,14 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
{
if (parts[i].life==3)
{
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1)
if ((r&0xFF)==PT_PIPE&&parts[r>>8].ctype==1)
{
parts[r>>8].ctype = (((ctype)%3)+2);//reverse
parts[r>>8].life = 6;
@ -80,33 +80,34 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
}
else
{
nx = rand()%3-1;
ny = rand()%3-1;
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
rx = rand()%3-1;
ry = rand()%3-1;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
else if (!r&&parts[i].tmp!=0)
{
if (create_part(-1,x+nx,y+ny,parts[i].tmp))
np = create_part(-1,x+rx,y+ry,parts[i].tmp);
if (np!=-1)
{
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;//pipe saves temp and life now
parts[pmap[y+ny][x+nx]>>8].life = parts[i].flags;
parts[np].temp = parts[i].temp;//pipe saves temp and life now
parts[np].life = parts[i].flags;
}
parts[i].tmp = 0;
continue;
}
else if (!r)
continue;
else if (parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))
else if (parts[i].tmp == 0 && (ptypes[r&0xFF].falldown!= 0 || pstates[r&0xFF].state == ST_GAS))
{
parts[i].tmp = parts[r>>8].type;
parts[i].temp = parts[r>>8].temp;
parts[i].flags = parts[r>>8].life;
parts[r>>8].type = PT_NONE;
kill_part(r>>8);
}
else if (parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
else if ((r&0xFF)==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
{
parts[r>>8].tmp = parts[i].tmp;
parts[r>>8].temp = parts[i].temp;

View File

@ -25,7 +25,7 @@ int update_PLNT(UPDATE_FUNC_ARGS) {
kill_part(r>>8);
parts[i].life = rand()%60 + 60;
}
else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(rx+ry)<=2 && VINE_MODE)
{
int nnx = rand()%3 -1;
int nny = rand()%3 -1;

View File

@ -1,97 +1,109 @@
#include <powder.h>
int update_PYRO(UPDATE_FUNC_ARGS) {
int r, rt, lpv, t = parts[i].type;
int r, rx, ry, rt, t = parts[i].type;
if (t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1)
{
parts[i].type = PT_NBLE;
t = PT_NBLE;
part_change_type(i,x,y,t);
parts[i].life = 0;
}
if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<625)
{
t = parts[i].type = PT_SMKE;
t = PT_SMKE;
part_change_type(i,x,y,t);
parts[i].life = rand()%20+250;
}
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
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))
{
r = pmap[y+ny][x+nx];
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=WL_STREAM)
if (bmap[(y+ry)/CELL][(x+rx)/CELL] && bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
continue;
rt = parts[r>>8].type;
if ((a || ptypes[rt].explosive) && (t!=PT_SPRK || (rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH)) &&
!(t==PT_PHOT && rt==PT_INSL) &&
(t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR && rt!=PT_QRTZ))
&& !(rt==PT_SPNG && parts[r>>8].life>0) &&
ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000))
ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ry)/CELL][(x+rx)/CELL]*10.0f))>(rand()%1000))
{
parts[r>>8].type = PT_FIRE;
parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2);
part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
parts[r>>8].temp = restrict_flt(ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2), MIN_TEMP, MAX_TEMP);
parts[r>>8].life = rand()%80+180;
if (ptypes[rt].explosive)
pv[y/CELL][x/CELL] += 0.25f * CFDS;
continue;
}
lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL];
}
if (legacy_enable) update_legacy_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
return 0;
}
int update_legacy_PYRO(UPDATE_FUNC_ARGS) {
int r, rx, ry, rt, lpv, t = parts[i].type;
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))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (bmap[(y+ry)/CELL][(x+rx)/CELL] && bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
continue;
rt = r&0xFF;
lpv = (int)pv[(y+ry)/CELL][(x+rx)/CELL];
if (lpv < 1) lpv = 1;
if (legacy_enable)
if (t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) &&
ptypes[rt].meltable*lpv>(rand()%1000))
{
if (t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) &&
ptypes[rt].meltable*lpv>(rand()%1000))
if (t!=PT_LAVA || parts[i].life>0)
{
if (t!=PT_LAVA || parts[i].life>0)
{
parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type;
parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype;
parts[r>>8].type = PT_LAVA;
parts[r>>8].life = rand()%120+240;
}
else
{
parts[i].life = 0;
t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE;
parts[i].ctype = PT_NONE;//rt;
return 1;
}
parts[r>>8].ctype = (rt==PT_BRMT)?PT_BMTL:parts[r>>8].type;
parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype;
part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
parts[r>>8].life = rand()%120+240;
}
if (t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW))
else
{
parts[r>>8].type = PT_WATR;
if (t==PT_FIRE)
{
parts[i].x = lx;
parts[i].y = ly;
kill_part(i);
return 1;
}
if (t==PT_LAVA)
{
parts[i].life = 0;
t = parts[i].type = PT_STNE;
return 1;
}
parts[i].life = 0;
t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE;
parts[i].ctype = PT_NONE;//rt;
part_change_type(i,x,y,t);
return 1;
}
if (t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW))
}
if (t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW))
{
parts[r>>8].type = PT_WATR;
if (t==PT_FIRE)
{
kill_part(r>>8);
if (t==PT_FIRE)
{
parts[i].x = lx;
parts[i].y = ly;
kill_part(i);
return 1;
}
if (t==PT_LAVA)
{
parts[i].life = 0;
t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE;
parts[i].ctype = PT_NONE;
return 1;
}
kill_part(i);
return 1;
}
if (t==PT_LAVA)
{
parts[i].life = 0;
t = parts[i].type = PT_STNE;
part_change_type(i,x,y,t);
}
}
if (t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW))
{
kill_part(r>>8);
if (t==PT_FIRE)
{
kill_part(i);
return 1;
}
if (t==PT_LAVA)
{
parts[i].life = 0;
t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE;
parts[i].ctype = PT_NONE;
part_change_type(i,x,y,t);
}
}
}

View File

@ -11,7 +11,7 @@ int update_SPAWN(UPDATE_FUNC_ARGS) {
}
int update_STKM(UPDATE_FUNC_ARGS) {
int r;
int r, rx, ry;
float pp, d;
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
//Tempirature handling
@ -173,56 +173,58 @@ int update_STKM(UPDATE_FUNC_ARGS) {
set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL);
//Searching for particles near head
for (nx = -2; nx <= 2; nx++)
for (ny = 0; ny>=-2; ny--)
{
if (!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART)
continue;
if (ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT)
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))
{
player[2] = pmap[ny+y][nx+x]&0xFF; //Current element
}
if ((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if (parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
kill_part(pmap[ny+y][nx+x]>>8);
}
r = pmap[y+ry][x+rx];
if (!r || (r>>8)>=NPART)
continue;
if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) // TODO: photons are not in the pmap. This line may not work as intended.
{
player[2] = r&0xFF; //Current element
}
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if (parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
kill_part(r>>8);
}
if ((pmap[ny+y][nx+x]&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
kill_part(pmap[ny+y][nx+x]>>8);
if ((r&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
kill_part(r>>8);
}
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
player[2] = SPC_AIR;
}
if (bmap[(ny+y)/CELL][(nx+x)/CELL]==WL_FAN)
player[2] = SPC_AIR;
}
//Head position
nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01);
ny = y - 3*(player[1] == 0);
rx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01);
ry = y - 3*(player[1] == 0);
//Spawn
if (((int)(player[0])&0x08) == 0x08)
{
ny -= 2*(rand()%2)+1;
r = pmap[ny][nx];
ry -= 2*(rand()%2)+1;
r = pmap[ry][rx];
if (!((r>>8)>=NPART))
{
if (pstates[r&0xFF].state == ST_SOLID)
{
create_part(-1, nx, ny, PT_SPRK);
create_part(-1, rx, ry, PT_SPRK);
}
else
{
if (player[2] == SPC_AIR)
create_parts(nx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ny, 4, 4, SPC_AIR);
create_parts(rx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR);
else
create_part(-1, nx, ny, player[2]);
create_part(-1, rx, ry, player[2]);
r = pmap[ny][nx];
r = pmap[ry][rx];
if ( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR)
parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01);
if (((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT)
@ -270,26 +272,26 @@ int update_STKM(UPDATE_FUNC_ARGS) {
player[12] += (player[12]-parts[i].y)*d;
//Side collisions checking
for (nx = -3; nx <= 3; nx++)
for (rx = -3; rx <= 3; rx++)
{
r = pmap[(int)(player[16]-2)][(int)(player[15]+nx)];
r = pmap[(int)(player[16]-2)][(int)(player[15]+rx)];
if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player[15] -= nx;
player[15] -= rx;
r = pmap[(int)(player[8]-2)][(int)(player[7]+nx)];
r = pmap[(int)(player[8]-2)][(int)(player[7]+rx)];
if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player[7] -= nx;
player[7] -= rx;
}
//Collision checks
for (ny = -2-(int)parts[i].vy; ny<=0; ny++)
for (ry = -2-(int)parts[i].vy; ry<=0; ry++)
{
r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
r = pmap[(int)(player[8]+ry)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
//For left leg
if (r && (r&0xFF)!=PT_STKM)
{
if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks //Liquid checks
if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
{
if (parts[i].y<(player[8]-10))
parts[i].vy = 1*dt;
@ -302,14 +304,14 @@ int update_STKM(UPDATE_FUNC_ARGS) {
{
if (pstates[r&0xFF].state != ST_GAS)
{
player[8] += ny-1;
player[8] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
player[9] = player[7];
}
r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)];
r = pmap[(int)(player[16]+ry)][(int)(player[15]+0.5)];
//For right leg
if (r && (r&0xFF)!=PT_STKM)
@ -327,7 +329,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
{
if (pstates[r&0xFF].state != ST_GAS)
{
player[16] += ny-1;
player[16] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
@ -337,7 +339,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
//If it falls too fast
if (parts[i].vy>=30)
{
parts[i].y -= (10+ny)*dt;
parts[i].y -= (10+ry)*dt;
parts[i].vy = -10*dt;
}
@ -363,9 +365,9 @@ int update_STKM(UPDATE_FUNC_ARGS) {
parts[i].life -= (int)(rand()/1000)+38;
}
if (r>0 && (r>>8)<NPART) //If hot or cold
if (r>0 && (r>>8)<NPART)
{
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243) //If hot or cold
{
parts[i].life -= 2;
player[26] -= 1;

View File

@ -11,7 +11,7 @@ int update_SPAWN2(UPDATE_FUNC_ARGS) {
}
int update_STKM2(UPDATE_FUNC_ARGS) {
int r;
int r, rx, ry;
float pp, d;
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
//Tempirature handling
@ -173,56 +173,58 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
set_emap((int)(player2[15]+0.5)/CELL, (int)(player2[16]+0.5)/CELL);
//Searching for particles near head
for (nx = -2; nx <= 2; nx++)
for (ny = 0; ny>=-2; ny--)
{
if (!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART)
continue;
if (ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT)
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))
{
player2[2] = pmap[ny+y][nx+x]&0xFF; //Current element
}
if ((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if (parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
kill_part(pmap[ny+y][nx+x]>>8);
}
r = pmap[y+ry][x+rx];
if (!r || (r>>8)>=NPART)
continue;
if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) // TODO: photons are not in the pmap. This line may not work as intended.
{
player2[2] = r&0xFF; //Current element
}
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if (parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
kill_part(r>>8);
}
if ((pmap[ny+y][nx+x]&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
kill_part(pmap[ny+y][nx+x]>>8);
if ((r&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
kill_part(r>>8);
}
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
player2[2] = SPC_AIR;
}
if (bmap[(ny+y)/CELL][(nx+x)/CELL]==WL_FAN)
player2[2] = SPC_AIR;
}
//Head position
nx = x + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01);
ny = y - 3*(player2[1] == 0);
rx = x + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01);
ry = y - 3*(player2[1] == 0);
//Spawn
if (((int)(player2[0])&0x08) == 0x08)
{
ny -= 2*(rand()%2)+1;
r = pmap[ny][nx];
ry -= 2*(rand()%2)+1;
r = pmap[ry][rx];
if (!((r>>8)>=NPART))
{
if (pstates[r&0xFF].state == ST_SOLID)
{
create_part(-1, nx, ny, PT_SPRK);
create_part(-1, rx, ry, PT_SPRK);
}
else
{
if (player2[2] == SPC_AIR)
create_parts(nx + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01), ny, 4, 4, SPC_AIR);
create_parts(rx + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR);
else
create_part(-1, nx, ny, player2[2]);
create_part(-1, rx, ry, player2[2]);
r = pmap[ny][nx];
r = pmap[ry][rx];
if ( ((r>>8) < NPART) && (r>>8)>=0 && player2[2] != PT_PHOT && player2[2] != SPC_AIR)
parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player2[1])&0x02) == 0x02) - 5*(((int)(player2[1])&0x01) == 0x01);
if (((r>>8) < NPART) && (r>>8)>=0 && player2[2] == PT_PHOT)
@ -270,26 +272,26 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
player2[12] += (player2[12]-parts[i].y)*d;
//Side collisions checking
for (nx = -3; nx <= 3; nx++)
for (rx = -3; rx <= 3; rx++)
{
r = pmap[(int)(player2[16]-2)][(int)(player2[15]+nx)];
r = pmap[(int)(player2[16]-2)][(int)(player2[15]+rx)];
if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player2[15] -= nx;
player2[15] -= rx;
r = pmap[(int)(player2[8]-2)][(int)(player2[7]+nx)];
r = pmap[(int)(player2[8]-2)][(int)(player2[7]+rx)];
if (r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player2[7] -= nx;
player2[7] -= rx;
}
//Collision checks
for (ny = -2-(int)parts[i].vy; ny<=0; ny++)
for (ry = -2-(int)parts[i].vy; ry<=0; ry++)
{
r = pmap[(int)(player2[8]+ny)][(int)(player2[7]+0.5)]; //This is to make coding more pleasant :-)
r = pmap[(int)(player2[8]+ry)][(int)(player2[7]+0.5)]; //This is to make coding more pleasant :-)
//For left leg
if (r && (r&0xFF)!=PT_STKM2)
if (r && (r&0xFF)!=PT_STKM)
{
if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks //Liquid checks
if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
{
if (parts[i].y<(player2[8]-10))
parts[i].vy = 1*dt;
@ -302,17 +304,17 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
{
if (pstates[r&0xFF].state != ST_GAS)
{
player2[8] += ny-1;
player2[8] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
player2[9] = player2[7];
}
r = pmap[(int)(player2[16]+ny)][(int)(player2[15]+0.5)];
r = pmap[(int)(player2[16]+ry)][(int)(player2[15]+0.5)];
//For right leg
if (r && (r&0xFF)!=PT_STKM2)
if (r && (r&0xFF)!=PT_STKM)
{
if (pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
{
@ -327,7 +329,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
{
if (pstates[r&0xFF].state != ST_GAS)
{
player2[16] += ny-1;
player2[16] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
@ -337,7 +339,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
//If it falls too fast
if (parts[i].vy>=30)
{
parts[i].y -= (10+ny)*dt;
parts[i].y -= (10+ry)*dt;
parts[i].vy = -10*dt;
}
@ -363,9 +365,9 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
parts[i].life -= (int)(rand()/1000)+38;
}
if (r>0 && (r>>8)<NPART) //If hot or cold
if (r>0 && (r>>8)<NPART)
{
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243) //If hot or cold
{
parts[i].life -= 2;
player2[26] -= 1;
@ -402,3 +404,4 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
isplayer2 = 1;
return 0;
}

View File

@ -1486,7 +1486,6 @@ void update_particles_i(pixel *vid, int start, int inc)
surround[5] = pmap[y+1][x-1];
surround[6] = pmap[y+1][x];
surround[7] = pmap[y+1][x+1];
// TODO: should surround be extended to cover radius of 2, and then passed to update_PART functions?
a = nt = 0;
for (j=0,nx=-1; nx<2; nx++)
@ -1570,6 +1569,11 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].tmp = 0;
t = PT_BMTL;
}
if (parts[i].ctype==PT_PLUT)
{
parts[i].tmp = 0;
t = parts[i].ctype = PT_LAVA;
}
}
}
else if (pt<973.0f) t = PT_STNE;
@ -1608,6 +1612,11 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].tmp--;
parts[i].temp = 3500;
}
if (parts[i].ctype==PT_PLUT&&parts[i].tmp>0)
{
parts[i].tmp--;
parts[i].temp = MAX_TEMP;
}
}
}
}
@ -1688,11 +1697,11 @@ void update_particles_i(pixel *vid, int start, int inc)
if (ptypes[t].update_func)
{
if ((*(ptypes[t].update_func))(i,x,y,nx,ny,lx,ly,a))
if ((*(ptypes[t].update_func))(i,x,y,a))
continue;
}
if (legacy_enable)
update_legacy_all(i,x,y,nx,ny,lx,ly,a);
update_legacy_all(i,x,y,a);
if (ptypes[t].properties&PROP_LIFE)
{
if (parts[i].temp>0)
@ -1759,6 +1768,7 @@ killed:
}
}
// TODO: some particles use flags for unrelated purposes
rt = parts[i].flags & FLAG_STAGNANT;
parts[i].flags &= ~FLAG_STAGNANT;
if (!try_move(i, x, y, nx, ny))