Small modifications part three.

This commit is contained in:
cracker64 2013-02-27 12:08:10 -05:00
parent 27e3e12518
commit 3d2e594150
18 changed files with 140 additions and 146 deletions

View File

@ -77,7 +77,7 @@ int Element_DEST::update(UPDATE_FUNC_ARGS)
{ {
sim->create_part(r>>8, x+rx, y+ry, PT_PLSM); sim->create_part(r>>8, x+rx, y+ry, PT_PLSM);
} }
else if (!rand()%3) else if (!(rand()%3))
{ {
sim->kill_part(r>>8); sim->kill_part(r>>8);
parts[i].life -= 4*((sim->elements[r&0xFF].Properties&TYPE_SOLID)?3:1); parts[i].life -= 4*((sim->elements[r&0xFF].Properties&TYPE_SOLID)?3:1);

View File

@ -62,7 +62,7 @@ int Element_DSTW::update(UPDATE_FUNC_ARGS)
{ {
sim->part_change_type(i,x,y,PT_SLTW); sim->part_change_type(i,x,y,PT_SLTW);
// on average, convert 3 DSTW to SLTW before SALT turns into SLTW // on average, convert 3 DSTW to SLTW before SALT turns into SLTW
if (!rand()%3) if (!(rand()%3))
sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW); sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
} }
if ((rt==PT_WATR||rt==PT_SLTW) && !(rand()%500)) if ((rt==PT_WATR||rt==PT_SLTW) && !(rand()%500))

View File

@ -49,7 +49,7 @@ Element_EMP::Element_EMP()
//#TPT-Directive ElementHeader Element_EMP static int update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_EMP static int update(UPDATE_FUNC_ARGS)
int Element_EMP::update(UPDATE_FUNC_ARGS) int Element_EMP::update(UPDATE_FUNC_ARGS)
{ {
int r,rx,ry,ok=0,t,n,nx,ny; int r,rx,ry,t,n,nx,ny;
if (parts[i].life) if (parts[i].life)
return 0; return 0;
for (rx=-2; rx<3; rx++) for (rx=-2; rx<3; rx++)

View File

@ -55,7 +55,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
sim->part_change_type(i,x,y,PT_NBLE); sim->part_change_type(i,x,y,PT_NBLE);
parts[i].life = 0; parts[i].life = 0;
} }
if (t==PT_FIRE && parts[i].life <=1) else if (t==PT_FIRE && parts[i].life <=1)
{ {
if ((parts[i].tmp&0x3) == 3){ if ((parts[i].tmp&0x3) == 3){
sim->part_change_type(i,x,y,PT_DSTW); sim->part_change_type(i,x,y,PT_DSTW);
@ -68,7 +68,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
parts[i].life = rand()%20+250; parts[i].life = rand()%20+250;
} }
} }
if (t==PT_PLSM && parts[i].life <=1) else if (t==PT_PLSM && parts[i].life <=1)
{ {
if ((parts[i].tmp&0x3) == 3){ if ((parts[i].tmp&0x3) == 3){
sim->part_change_type(i,x,y,PT_DSTW); sim->part_change_type(i,x,y,PT_DSTW);

View File

@ -69,7 +69,7 @@ int Element_GBMB::update(UPDATE_FUNC_ARGS)
} }
if(parts[i].life>20) if(parts[i].life>20)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 20; sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 20;
if(parts[i].life<20 && parts[i].life>=1) else if(parts[i].life>=1)
sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = -80; sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = -80;
return 0; return 0;
} }

View File

@ -49,7 +49,8 @@ Element_GEL::Element_GEL()
//#TPT-Directive ElementHeader Element_GEL static int update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_GEL static int update(UPDATE_FUNC_ARGS)
int Element_GEL::update(UPDATE_FUNC_ARGS) int Element_GEL::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; int r, rx, ry, rt;
bool gel;
int absorbChanceDenom; int absorbChanceDenom;
if (parts[i].tmp>100) parts[i].tmp = 100; if (parts[i].tmp>100) parts[i].tmp = 100;
if (parts[i].tmp<0) parts[i].tmp = 0; if (parts[i].tmp<0) parts[i].tmp = 0;
@ -58,22 +59,23 @@ int Element_GEL::update(UPDATE_FUNC_ARGS)
for (ry=-2; ry<3; ry++) for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
gel=false;
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (!r) if (!r)
continue; continue;
rt = r&0xFF;
//Desaturation //Desaturation
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW) && parts[i].tmp<100 && 500>rand()%absorbChanceDenom) if ((rt==PT_WATR || rt==PT_DSTW || rt==PT_FRZW) && parts[i].tmp<100 && 500>rand()%absorbChanceDenom)
{ {
parts[i].tmp++; parts[i].tmp++;
sim->kill_part(r>>8); sim->kill_part(r>>8);
} }
if (((r&0xFF)==PT_PSTE) && parts[i].tmp<100 && 20>rand()%absorbChanceDenom) else if ((rt==PT_PSTE) && parts[i].tmp<100 && 20>rand()%absorbChanceDenom)
{ {
parts[i].tmp++; parts[i].tmp++;
sim->create_part(r>>8, x+rx, y+ry, PT_CLST); sim->create_part(r>>8, x+rx, y+ry, PT_CLST);
} }
if (((r&0xFF)==PT_SLTW) && parts[i].tmp<100 && 50>rand()%absorbChanceDenom) else if ((rt==PT_SLTW) && parts[i].tmp<100 && 50>rand()%absorbChanceDenom)
{ {
parts[i].tmp++; parts[i].tmp++;
if (rand()%4) if (rand()%4)
@ -81,30 +83,25 @@ int Element_GEL::update(UPDATE_FUNC_ARGS)
else else
sim->part_change_type(r>>8, x+rx, y+ry, PT_SALT); sim->part_change_type(r>>8, x+rx, y+ry, PT_SALT);
} }
if (((r&0xFF)==PT_CBNW) && parts[i].tmp<100 && 100>rand()%absorbChanceDenom) else if ((rt==PT_CBNW) && parts[i].tmp<100 && 100>rand()%absorbChanceDenom)
{ {
parts[i].tmp++; parts[i].tmp++;
sim->part_change_type(r>>8, x+rx, y+ry, PT_CO2); sim->part_change_type(r>>8, x+rx, y+ry, PT_CO2);
} }
if ((r&0xFF)==PT_SPNG && parts[i].tmp<100 && ((parts[r>>8].life+1)>parts[i].tmp)) else if (rt==PT_SPNG && parts[i].tmp<100 && ((parts[r>>8].life+1)>parts[i].tmp))
{ {
parts[r>>8].life--; parts[r>>8].life--;
parts[i].tmp++; parts[i].tmp++;
} }
char gel = 0;
if ((r&0xFF)==PT_GEL)
gel = 1;
//Concentration diffusion //Concentration diffusion
if (gel && (parts[r>>8].tmp+1)<parts[i].tmp) if (rt==PT_GEL && (parts[r>>8].tmp+1)<parts[i].tmp)
{ {
parts[r>>8].tmp++; parts[r>>8].tmp++;
parts[i].tmp--; parts[i].tmp--;
gel = true;
} }
else if (rt==PT_SPNG && (parts[r>>8].life+1)<parts[i].tmp)
if ((r&0xFF)==PT_SPNG && (parts[r>>8].life+1)<parts[i].tmp)
{ {
parts[r>>8].life++; parts[r>>8].life++;
parts[i].tmp--; parts[i].tmp--;
@ -127,7 +124,7 @@ int Element_GEL::update(UPDATE_FUNC_ARGS)
dx *= per; dy *= per; dx *= per; dy *= per;
parts[i].vx += dx; parts[i].vx += dx;
parts[i].vy += dy; parts[i].vy += dy;
if ((sim->elements[r&0xFF].Properties&TYPE_PART) || (r&0xFF)==PT_GOO) if ((sim->elements[r&0xFF].Properties&TYPE_PART) || rt==PT_GOO)
{ {
parts[r>>8].vx -= dx; parts[r>>8].vx -= dx;
parts[r>>8].vy -= dy; parts[r>>8].vy -= dy;

View File

@ -57,21 +57,17 @@ int Element_GLOW::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (!r) if (!r)
continue; continue;
if ((r&0xFF)==PT_WATR&&5>(rand()%2000)) if ((r&0xFF)==PT_WATR && !(rand()%400))
{ {
parts[i].type = PT_NONE; sim->kill_part(i);
sim->part_change_type(r>>8,x+rx,y+ry,PT_DEUT); sim->part_change_type(r>>8,x+rx,y+ry,PT_DEUT);
parts[r>>8].life = 10; parts[r>>8].life = 10;
return 1;
} }
} }
parts[i].ctype = sim->pv[y/CELL][x/CELL]*16; parts[i].ctype = sim->pv[y/CELL][x/CELL]*16;
parts[i].tmp = abs((int)((sim->vx[y/CELL][x/CELL]+sim->vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f)); parts[i].tmp = abs((int)((sim->vx[y/CELL][x/CELL]+sim->vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f));
//printf("%f %f\n", parts[i].vx, parts[i].vy);
if (parts[i].type==PT_NONE) {
sim->kill_part(i);
return 1;
}
return 0; return 0;
} }

View File

@ -50,9 +50,9 @@ Element_GPMP::Element_GPMP()
int Element_GPMP::update(UPDATE_FUNC_ARGS) int Element_GPMP::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; int r, rx, ry;
if (parts[i].life>0 && parts[i].life!=10) if (parts[i].life!=10 && parts[i].life>0)
parts[i].life--; parts[i].life--;
if (parts[i].life==10) else if (parts[i].life==10)
{ {
if (parts[i].temp>=256.0+273.15) if (parts[i].temp>=256.0+273.15)
parts[i].temp=256.0+273.15; parts[i].temp=256.0+273.15;

View File

@ -42,25 +42,9 @@ Element_GRAV::Element_GRAV()
HighTemperature = ITH; HighTemperature = ITH;
HighTemperatureTransition = NT; HighTemperatureTransition = NT;
Update = &Element_GRAV::update; Update = NULL;
Graphics = &Element_GRAV::graphics; Graphics = &Element_GRAV::graphics;
} }
//#TPT-Directive ElementHeader Element_GRAV static int update(UPDATE_FUNC_ARGS)
int Element_GRAV::update(UPDATE_FUNC_ARGS)
{
/*int t = parts[i].type;
if (t==PT_LOVE)
ISLOVE=1;
else if (t==PT_LOLZ)
ISLOLZ=1;
else if (t==PT_GRAV)
ISGRAV=1;*/
return 0;
}
int lastIndex;
//#TPT-Directive ElementHeader Element_GRAV static int graphics(GRAPHICS_FUNC_ARGS) //#TPT-Directive ElementHeader Element_GRAV static int graphics(GRAPHICS_FUNC_ARGS)
int Element_GRAV::graphics(GRAPHICS_FUNC_ARGS) int Element_GRAV::graphics(GRAPHICS_FUNC_ARGS)

View File

@ -63,18 +63,25 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
sim->part_change_type(r>>8,x+rx,y+ry,PT_WATR); sim->part_change_type(r>>8,x+rx,y+ry,PT_WATR);
sim->part_change_type(i,x,y,PT_OIL); sim->part_change_type(i,x,y,PT_OIL);
} }
if (parts[r>>8].temp > 2273.15 && sim->pv[y/CELL][x/CELL] > 45.0f)
continue; if (sim->pv[y/CELL][x/CELL] > 45.0f)
if (sim->pv[y/CELL][x/CELL] <= 45.0f) {
if (parts[r>>8].temp > 2273.15)
continue;
}
else
{ {
if (rt==PT_FIRE) if (rt==PT_FIRE)
{ {
parts[r>>8].temp=2473.15; parts[r>>8].temp=2473.15;
if(parts[r>>8].tmp&0x02) if(parts[r>>8].tmp&0x02)
parts[r>>8].temp=3473; parts[r>>8].temp=3473;
parts[r>>8].tmp |= 1; parts[r>>8].tmp |= 1;
sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()/(RAND_MAX/100));
parts[i].tmp |= 1;
} }
if (rt==PT_FIRE || (rt==PT_PLSM && !(parts[r>>8].tmp&4)) || (rt==PT_LAVA && parts[r>>8].ctype != PT_BMTL)) else if ((rt==PT_PLSM && !(parts[r>>8].tmp&4)) || (rt==PT_LAVA && parts[r>>8].ctype != PT_BMTL))
{ {
sim->create_part(i,x,y,PT_FIRE); sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()/(RAND_MAX/100)); parts[i].temp+=(rand()/(RAND_MAX/100));
@ -84,30 +91,30 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
} }
if (parts[i].temp > 2273.15 && sim->pv[y/CELL][x/CELL] > 50.0f) if (parts[i].temp > 2273.15 && sim->pv[y/CELL][x/CELL] > 50.0f)
{ {
if (rand()%5 < 1) if (!(rand()%5))
{ {
int j; int j;
float temp = parts[i].temp; float temp = parts[i].temp;
sim->create_part(i,x,y,PT_NBLE); sim->create_part(i,x,y,PT_NBLE);
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
if (j != -1) if (j>-1)
parts[j].temp = temp; parts[j].temp = temp;
if (!(rand()%10)) if (!(rand()%10))
{ {
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
if (j != -1) if (j>-1)
parts[j].temp = temp; parts[j].temp = temp;
} }
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
if (j != -1) if (j>-1)
{ {
parts[j].ctype = 0x7C0000; parts[j].ctype = 0x7C0000;
parts[j].temp = temp; parts[j].temp = temp;
} }
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM); j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM);
if (j != -1) if (j>-1)
{ {
parts[j].temp = temp; parts[j].temp = temp;
parts[j].tmp |= 4; parts[j].tmp |= 4;

View File

@ -50,9 +50,9 @@ Element_HSWC::Element_HSWC()
int Element_HSWC::update(UPDATE_FUNC_ARGS) int Element_HSWC::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; int r, rx, ry;
if (parts[i].life>0 && parts[i].life!=10) if (parts[i].life!=10 && parts[i].life>0)
parts[i].life--; parts[i].life--;
if (parts[i].life==10) else if (parts[i].life==10)
{ {
for (rx=-2; rx<3; rx++) for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++) for (ry=-2; ry<3; ry++)

View File

@ -61,14 +61,16 @@ int Element_ICEI::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (!r) if (!r)
continue; continue;
if (((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && parts[i].temp > sim->elements[PT_SLTW].LowTemperature && 1>(rand()%1000)) if (((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && parts[i].temp > sim->elements[PT_SLTW].LowTemperature && !(rand()%1000))
{ {
sim->part_change_type(i,x,y,PT_SLTW); sim->part_change_type(i,x,y,PT_SLTW);
sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW); sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
goto done;
} }
if (((r&0xFF)==PT_FRZZ) && (parts[i].ctype=PT_FRZW) && 1>(rand()%1000)) else if (((r&0xFF)==PT_FRZZ) && (parts[i].ctype=PT_FRZW) && !(rand()%1000))
sim->part_change_type(r>>8,x+rx,y+ry,PT_ICEI); sim->part_change_type(r>>8,x+rx,y+ry,PT_ICEI);
} }
done:
return 0; return 0;
} }

View File

@ -49,7 +49,7 @@ Element_IGNT::Element_IGNT()
//#TPT-Directive ElementHeader Element_IGNT static int update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_IGNT static int update(UPDATE_FUNC_ARGS)
int Element_IGNT::update(UPDATE_FUNC_ARGS) int Element_IGNT::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; int r, rx, ry, rt;
if(parts[i].tmp==0) if(parts[i].tmp==0)
{ {
for (rx=-1; rx<2; rx++) for (rx=-1; rx<2; rx++)
@ -59,11 +59,8 @@ int Element_IGNT::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (!r) if (!r)
continue; continue;
if ((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) rt = r&0xFF;
{ if (rt==PT_FIRE || rt==PT_PLSM || rt==PT_SPRK || rt==PT_LIGH || (rt==PT_IGNT && parts[r>>8].life==1))
parts[i].tmp = 1;
}
else if ((r&0xFF)==PT_SPRK || (r&0xFF)==PT_LIGH || ((r&0xFF)==PT_IGNT && parts[r>>8].life==1))
{ {
parts[i].tmp = 1; parts[i].tmp = 1;
} }

View File

@ -49,7 +49,7 @@ Element_IRON::Element_IRON()
//#TPT-Directive ElementHeader Element_IRON static int update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_IRON static int update(UPDATE_FUNC_ARGS)
int Element_IRON::update(UPDATE_FUNC_ARGS) int Element_IRON::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; int r, rx, ry, rt;
for (rx=-1; rx<2; rx++) for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++) for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@ -57,12 +57,13 @@ int Element_IRON::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (!r) if (!r)
continue; continue;
if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) || rt = r&0xFF;
((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) || if ((!(parts[i].life)) &&
((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) || ((rt == PT_SALT && !(rand()%47)) ||
((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) || (rt == PT_SLTW && !(rand()%67)) ||
((r&0xFF) == PT_LO2))&& (rt == PT_WATR && !(rand()%1200)) ||
(!(parts[i].life)) (rt == PT_O2 && !(rand()%250)) ||
(rt == PT_LO2))
) )
{ {
sim->part_change_type(i,x,y,PT_BMTL); sim->part_change_type(i,x,y,PT_BMTL);

View File

@ -50,7 +50,7 @@ Element_ISOZ::Element_ISOZ()
int Element_ISOZ::update(UPDATE_FUNC_ARGS) int Element_ISOZ::update(UPDATE_FUNC_ARGS)
{ // for both ISZS and ISOZ { // for both ISZS and ISOZ
float rr, rrr; float rr, rrr;
if (1>rand()%200 && ((int)(-4.0f*(sim->pv[y/CELL][x/CELL])))>(rand()%1000)) if (!(rand()%200) && ((int)(-4.0f*(sim->pv[y/CELL][x/CELL])))>(rand()%1000))
{ {
sim->create_part(i, x, y, PT_PHOT); sim->create_part(i, x, y, PT_PHOT);
rr = (rand()%228+128)/127.0f; rr = (rand()%228+128)/127.0f;

View File

@ -50,7 +50,7 @@ Element_ISZS::Element_ISZS()
int Element_ISZS::update(UPDATE_FUNC_ARGS) int Element_ISZS::update(UPDATE_FUNC_ARGS)
{ // for both ISZS and ISOZ { // for both ISZS and ISOZ
float rr, rrr; float rr, rrr;
if (1>rand()%200 && ((int)(-4.0f*(sim->pv[y/CELL][x/CELL])))>(rand()%1000)) if (!(rand()%200) && ((int)(-4.0f*(sim->pv[y/CELL][x/CELL])))>(rand()%1000))
{ {
sim->create_part(i, x, y, PT_PHOT); sim->create_part(i, x, y, PT_PHOT);
rr = (rand()%228+128)/127.0f; rr = (rand()%228+128)/127.0f;

View File

@ -50,61 +50,59 @@ Element_LCRY::Element_LCRY()
int Element_LCRY::update(UPDATE_FUNC_ARGS) int Element_LCRY::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; int r, rx, ry, check, setto;
if(parts[i].tmp==1 || parts[i].tmp==0) switch (parts[i].tmp)
{ {
if(parts[i].tmp==1) case 0:
check=3;
setto=1;
break;
case 1:
check=3;
setto=1;
if(parts[i].life<=0)
parts[i].tmp = 0;
else
{ {
if(parts[i].life<=0) parts[i].life-=2;
parts[i].tmp = 0; if(parts[i].life < 0)
else parts[i].life = 0;
{ parts[i].tmp2 = parts[i].life;
parts[i].life-=2;
if(parts[i].life < 0)
parts[i].life = 0;
parts[i].tmp2 = parts[i].life;
}
} }
for (rx=-1; rx<2; rx++) break;
for (ry=-1; ry<2; ry++) case 3:
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) check=0;
{ setto=2;
r = pmap[y+ry][x+rx]; break;
if (!r) case 2:
continue; check=0;
if ((r&0xFF)==PT_LCRY && parts[r>>8].tmp == 3) setto=2;
{ if(parts[i].life>=10)
parts[r>>8].tmp = 1; parts[i].tmp = 3;
} else
}
}
else if(parts[i].tmp==2 || parts[i].tmp==3)
{
if(parts[i].tmp==2)
{ {
if(parts[i].life>=10) parts[i].life+=2;
parts[i].tmp = 3; if(parts[i].life > 10)
else parts[i].life = 10;
{ parts[i].tmp2 = parts[i].life;
parts[i].life+=2;
if(parts[i].life > 10)
parts[i].life = 10;
parts[i].tmp2 = parts[i].life;
}
} }
for (rx=-1; rx<2; rx++) break;
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) default:
{ return 0;
r = pmap[y+ry][x+rx];
if (!r)
continue;
if ((r&0xFF)==PT_LCRY && parts[r>>8].tmp == 0)
{
parts[r>>8].tmp = 2;
}
}
} }
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+ry][x+rx];
if (!r)
continue;
if ((r&0xFF)==PT_LCRY && parts[r>>8].tmp == check)
{
parts[r>>8].tmp = setto;
}
}
return 0; return 0;
} }

View File

@ -68,11 +68,11 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS)
* tmp - angle of lighting, measured in degrees anticlockwise from the positive x direction * tmp - angle of lighting, measured in degrees anticlockwise from the positive x direction
* *
*/ */
int r,rx,ry, multipler, powderful; int r,rx,ry,rt, multipler, powderful;
float angle, angle2=-1; float angle, angle2=-1;
int pNear = 0; int pNear = 0;
powderful = powderful = parts[i].temp*(1+parts[i].life/40)*LIGHTING_POWER; powderful = powderful = parts[i].temp*(1+parts[i].life/40)*LIGHTING_POWER;
Element_FIRE::update(UPDATE_FUNC_SUBCALL_ARGS); //Element_FIRE::update(UPDATE_FUNC_SUBCALL_ARGS);
if (sim->aheat_enable) if (sim->aheat_enable)
{ {
sim->hv[y/CELL][x/CELL]+=powderful/50; sim->hv[y/CELL][x/CELL]+=powderful/50;
@ -87,9 +87,21 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (!r) if (!r)
continue; continue;
if ((r&0xFF)!=PT_LIGH && (r&0xFF)!=PT_TESC) rt = r&0xFF;
if ((surround_space || sim->elements[rt].Explosive) &&
(rt!=PT_SPNG || parts[r>>8].life==0) &&
sim->elements[rt].Flammable && (sim->elements[rt].Flammable + (int)(sim->pv[(y+ry)/CELL][(x+rx)/CELL]*10.0f))>(rand()%1000))
{ {
if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT) sim->part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
parts[r>>8].temp = restrict_flt(sim->elements[PT_FIRE].Temperature + (sim->elements[rt].Flammable/2), MIN_TEMP, MAX_TEMP);
parts[r>>8].life = rand()%80+180;
parts[r>>8].tmp = parts[r>>8].ctype = 0;
if (sim->elements[rt].Explosive)
sim->pv[y/CELL][x/CELL] += 0.25f * CFDS;
}
if (rt!=PT_LIGH && rt!=PT_TESC)
{
if (rt!=PT_CLNE&&rt!=PT_THDR&&rt!=PT_DMND&&rt!=PT_FIRE&&rt!=PT_NEUT&&rt!=PT_PHOT)
{ {
if ((sim->elements[r&0xFF].Properties&PROP_CONDUCTS) && parts[r>>8].life==0) if ((sim->elements[r&0xFF].Properties&PROP_CONDUCTS) && parts[r>>8].life==0)
{ {
@ -98,7 +110,7 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS)
sim->pv[y/CELL][x/CELL] += powderful/400; sim->pv[y/CELL][x/CELL] += powderful/400;
if (sim->elements[r&0xFF].HeatConduct) parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/1.5, MIN_TEMP, MAX_TEMP); if (sim->elements[r&0xFF].HeatConduct) parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/1.5, MIN_TEMP, MAX_TEMP);
} }
if ((r&0xFF)==PT_DEUT || (r&0xFF)==PT_PLUT) // start nuclear reactions if (rt==PT_DEUT || rt==PT_PLUT) // start nuclear reactions
{ {
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful, MIN_TEMP, MAX_TEMP); parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful, MIN_TEMP, MAX_TEMP);
sim->pv[y/CELL][x/CELL] +=powderful/35; sim->pv[y/CELL][x/CELL] +=powderful/35;
@ -110,7 +122,7 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS)
parts[r>>8].vy=rand()%10-5; parts[r>>8].vy=rand()%10-5;
} }
} }
if ((r&0xFF)==PT_COAL || (r&0xFF)==PT_BCOL) // ignite coal if (rt==PT_COAL || rt==PT_BCOL) // ignite coal
{ {
if (parts[r>>8].life>100) { if (parts[r>>8].life>100) {
parts[r>>8].life = 99; parts[r>>8].life = 99;
@ -118,7 +130,7 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS)
} }
if (sim->elements[r&0xFF].HeatConduct) if (sim->elements[r&0xFF].HeatConduct)
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/10, MIN_TEMP, MAX_TEMP); parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/10, MIN_TEMP, MAX_TEMP);
if (((r&0xFF)==PT_STKM && sim->player.elem!=PT_LIGH) || ((r&0xFF)==PT_STKM2 && sim->player2.elem!=PT_LIGH)) if ((rt==PT_STKM && sim->player.elem!=PT_LIGH) || (rt==PT_STKM2 && sim->player2.elem!=PT_LIGH))
{ {
parts[r>>8].life-=powderful/100; parts[r>>8].life-=powderful/100;
} }