Limit SPNG saturation and reduce absorbtion rate for GEL and SPNG with some elements

This commit is contained in:
Simon Robertshaw 2012-08-28 12:48:50 +01:00
parent 5ded005b0c
commit 99b2d8d67d
2 changed files with 13 additions and 9 deletions

View File

@ -50,8 +50,10 @@ Element_GEL::Element_GEL()
int Element_GEL::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
int absorbChanceDenom;
if (parts[i].tmp>100) parts[i].tmp = 100;
if (parts[i].tmp<0) parts[i].tmp = 0;
absorbChanceDenom = parts[i].tmp*10 + 500;
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))
@ -61,17 +63,17 @@ int Element_GEL::update(UPDATE_FUNC_ARGS)
continue;
//Desaturation
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW) && parts[i].tmp<100)
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW) && parts[i].tmp<100 && 500>rand()%absorbChanceDenom)
{
parts[i].tmp++;
sim->kill_part(r>>8);
}
if (((r&0xFF)==PT_PSTE) && parts[i].tmp<100)
if (((r&0xFF)==PT_PSTE) && parts[i].tmp<100 && 20>rand()%absorbChanceDenom)
{
parts[i].tmp++;
sim->create_part(r>>8, x+rx, y+ry, PT_CLST);
}
if (((r&0xFF)==PT_SLTW) && parts[i].tmp<100)
if (((r&0xFF)==PT_SLTW) && parts[i].tmp<100 && 50>rand()%absorbChanceDenom)
{
parts[i].tmp++;
if (rand()%4)
@ -79,7 +81,7 @@ int Element_GEL::update(UPDATE_FUNC_ARGS)
else
sim->part_change_type(r>>8, x+rx, y+ry, PT_SALT);
}
if (((r&0xFF)==PT_CBNW) && parts[i].tmp<100)
if (((r&0xFF)==PT_CBNW) && parts[i].tmp<100 && 100>rand()%absorbChanceDenom)
{
parts[i].tmp++;
sim->part_change_type(r>>8, x+rx, y+ry, PT_CO2);

View File

@ -50,8 +50,10 @@ Element_SPNG::Element_SPNG()
int Element_SPNG::update(UPDATE_FUNC_ARGS)
{
int r, trade, rx, ry, tmp, np;
if (sim->pv[y/CELL][x/CELL]<=3 && sim->pv[y/CELL][x/CELL]>=-3&&parts[i].temp<=374.0f)
int limit = 50;
if (parts[i].life<limit && sim->pv[y/CELL][x/CELL]<=3&&sim->pv[y/CELL][x/CELL]>=-3&&parts[i].temp<=374.0f)
{
int absorbChanceDenom = parts[i].life*1000/limit + 500;
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))
@ -59,12 +61,12 @@ int Element_SPNG::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx];
if (!r)
continue;
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW)&&33>=rand()/(RAND_MAX/100)+1)
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW) && parts[i].life<limit && 500>rand()%absorbChanceDenom)
{
parts[i].life++;
sim->kill_part(r>>8);
}
if ((r&0xFF)==PT_SLTW&&33>=rand()/(RAND_MAX/100)+1)
if ((r&0xFF)==PT_SLTW && parts[i].life<limit && 50>rand()%absorbChanceDenom)
{
parts[i].life++;
if (rand()%4)
@ -72,12 +74,12 @@ int Element_SPNG::update(UPDATE_FUNC_ARGS)
else
sim->part_change_type(r>>8, x+rx, y+ry, PT_SALT);
}
if ((r&0xFF)==PT_CBNW&&33>=rand()/(RAND_MAX/100)+1)
if ((r&0xFF)==PT_CBNW && parts[i].life<limit && 100>rand()%absorbChanceDenom)
{
parts[i].life++;
sim->part_change_type(r>>8, x+rx, y+ry, PT_CO2);
}
if ((r&0xFF)==PT_PSTE&&33>=rand()/(RAND_MAX/100)+1)
if ((r&0xFF)==PT_PSTE && parts[i].life<limit && 20>rand()%absorbChanceDenom)
{
parts[i].life++;
sim->create_part(r>>8, x+rx, y+ry, PT_CLST);