Going through again.
This commit is contained in:
parent
c65081d3ed
commit
5873d69586
@ -58,8 +58,7 @@ int Element_AMTR::update(UPDATE_FUNC_ARGS)
|
||||
if (!r)
|
||||
continue;
|
||||
rt = r&0xFF;
|
||||
//would a table lookup be faster than 11 checks?
|
||||
if (rt!=PT_AMTR && rt!=PT_DMND && rt!=PT_CLNE && rt!=PT_PCLN && rt!=PT_NONE && rt!=PT_PHOT && rt!=PT_VOID && rt!=PT_BHOL && rt!=PT_NBHL && rt!=PT_PRTI && rt!=PT_PRTO)
|
||||
if (rt!=PT_AMTR && rt!=PT_DMND && rt!=PT_CLNE && rt!=PT_PCLN && rt!=PT_VOID && rt!=PT_BHOL && rt!=PT_NBHL && rt!=PT_PRTI && rt!=PT_PRTO)
|
||||
{
|
||||
parts[i].life++;
|
||||
if (parts[i].life==4)
|
||||
@ -67,7 +66,7 @@ int Element_AMTR::update(UPDATE_FUNC_ARGS)
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
if (10>(rand()/(RAND_MAX/100)))
|
||||
if (!(rand()%10))
|
||||
sim->create_part(r>>8, x+rx, y+ry, PT_PHOT);
|
||||
else
|
||||
sim->kill_part(r>>8);
|
||||
|
@ -60,15 +60,12 @@ int Element_ANAR::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_HFLM)
|
||||
if ((r&0xFF)==PT_HFLM && !(rand()%22))
|
||||
{
|
||||
if (1>rand()%22)
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_HFLM);
|
||||
parts[i].life = rand()%150+50;
|
||||
parts[r>>8].temp = parts[i].temp = 0;
|
||||
sim->pv[y/CELL][x/CELL] -= 0.5;
|
||||
}
|
||||
sim->part_change_type(i,x,y,PT_HFLM);
|
||||
parts[i].life = rand()%150+50;
|
||||
parts[r>>8].temp = parts[i].temp = 0;
|
||||
sim->pv[y/CELL][x/CELL] -= 0.5;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -78,17 +78,20 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
||||
parts[nr].temp = parts[i].temp;
|
||||
}
|
||||
} else if (!destroy) {
|
||||
if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==0) {//if it hits another BRAY that isn't red
|
||||
if (nyy!=0 || nxx!=0) {
|
||||
parts[r>>8].life = 1020;//makes it last a while
|
||||
parts[r>>8].tmp = 1;
|
||||
if (!parts[r>>8].ctype)//and colors it if it isn't already
|
||||
parts[r>>8].ctype = colored;
|
||||
if ((r&0xFF)==PT_BRAY) {
|
||||
if (parts[r>>8].tmp==0){//if it hits another BRAY that isn't red
|
||||
if (nyy!=0 || nxx!=0) {
|
||||
parts[r>>8].life = 1020;//makes it last a while
|
||||
parts[r>>8].tmp = 1;
|
||||
if (!parts[r>>8].ctype)//and colors it if it isn't already
|
||||
parts[r>>8].ctype = colored;
|
||||
}
|
||||
docontinue = 0;//then stop it
|
||||
}
|
||||
else if (parts[r>>8].tmp==1) {//if it hits one that already was a long life, reset it
|
||||
parts[r>>8].life = 1020;
|
||||
//docontinue = 1;
|
||||
}
|
||||
docontinue = 0;//then stop it
|
||||
} else if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==1) {//if it hits one that already was a long life, reset it
|
||||
parts[r>>8].life = 1020;
|
||||
//docontinue = 1;
|
||||
} else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT
|
||||
colored = parts[r>>8].ctype;
|
||||
//this if prevents BRAY from stopping on certain materials
|
||||
@ -151,4 +154,4 @@ int Element_ARAY::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
|
||||
|
||||
Element_ARAY::~Element_ARAY() {}
|
||||
Element_ARAY::~Element_ARAY() {}
|
||||
|
@ -65,15 +65,15 @@ int Element_BCOL::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM))
|
||||
{
|
||||
if (parts[i].life>100) {
|
||||
if (parts[i].life>100 && !(rand()%500)) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
if ((r&0xFF)==PT_LAVA && 1>(rand()%500))
|
||||
else if ((r&0xFF)==PT_LAVA)
|
||||
{
|
||||
if (parts[r>>8].ctype == PT_IRON) {
|
||||
if (parts[r>>8].ctype == PT_IRON && !(rand()%500)) {
|
||||
parts[r>>8].ctype = PT_METL;
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
@ -143,4 +143,4 @@ int Element_BCOL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
|
||||
|
||||
Element_BCOL::~Element_BCOL() {}
|
||||
Element_BCOL::~Element_BCOL() {}
|
||||
|
@ -82,7 +82,7 @@ int Element_BIZR::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(((r = sim->photons[y][x])&0xFF)==PT_PHOT)
|
||||
if(((r = sim->photons[y][x])&0xFF)==PT_PHOT)//this should be in movement checks?
|
||||
{
|
||||
sim->part_change_type(r>>8, x, y, PT_ELEC);
|
||||
parts[r>>8].ctype = 0;
|
||||
|
@ -60,14 +60,14 @@ int Element_BMTL::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
|
||||
if (((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON) && !(rand()%100))
|
||||
{
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_BMTL);
|
||||
parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (parts[i].tmp==1 && 1>rand()%1000)
|
||||
else if (parts[i].tmp==1 && !(rand()%1000))
|
||||
{
|
||||
parts[i].tmp = 0;
|
||||
sim->part_change_type(i,x,y,PT_BRMT);
|
||||
|
@ -76,19 +76,23 @@ int Element_BOYL::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_WATR && 1>rand()%30)
|
||||
if ((r&0xFF)==PT_WATR)
|
||||
{
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_FOG);
|
||||
if (!(rand()%30))
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_FOG);
|
||||
}
|
||||
else if ((r&0xFF)==PT_O2 && 1>rand()%9)
|
||||
else if ((r&0xFF)==PT_O2)
|
||||
{
|
||||
sim->kill_part(r>>8);
|
||||
sim->part_change_type(i,x,y,PT_WATR);
|
||||
sim->pv[y/CELL][x/CELL] += 4.0;
|
||||
if (!(rand()%9))
|
||||
{
|
||||
sim->kill_part(r>>8);
|
||||
sim->part_change_type(i,x,y,PT_WATR);
|
||||
sim->pv[y/CELL][x/CELL] += 4.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_BOYL::~Element_BOYL() {}
|
||||
Element_BOYL::~Element_BOYL() {}
|
||||
|
@ -54,12 +54,12 @@ int Element_BREC::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (sim->pv[y/CELL][x/CELL]>10.0f)
|
||||
{
|
||||
if (parts[i].temp>9000 && sim->pv[y/CELL][x/CELL]>30.0f && 1>rand()%200)
|
||||
if (parts[i].temp>9000 && sim->pv[y/CELL][x/CELL]>30.0f && !(rand()%200))
|
||||
{
|
||||
sim->part_change_type(i, x ,y ,PT_EXOT);
|
||||
parts[i].life = 1000;
|
||||
}
|
||||
parts[i].temp = parts[i].temp + (sim->pv[y/CELL][x/CELL])/8;
|
||||
parts[i].temp += (sim->pv[y/CELL][x/CELL])/8;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ int Element_BRMT::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_BREC && 1>(rand()%tempFactor))
|
||||
if ((r&0xFF)==PT_BREC && !(rand()%tempFactor))
|
||||
{
|
||||
if(rand()%2)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ int Element_C5::update(UPDATE_FUNC_ARGS)
|
||||
continue;
|
||||
if (((r&0xFF)!=PT_C5 && parts[r>>8].temp<100 && sim->elements[r&0xFF].HeatConduct && ((r&0xFF)!=PT_HSWC||parts[r>>8].life==10)) || (r&0xFF)==PT_HFLM)
|
||||
{
|
||||
if (1>rand()%6)
|
||||
if (!(rand()%6))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_HFLM);
|
||||
parts[r>>8].temp = parts[i].temp = 0;
|
||||
@ -72,4 +72,4 @@ int Element_C5::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
|
||||
|
||||
Element_C5::~Element_C5() {}
|
||||
Element_C5::~Element_C5() {}
|
||||
|
@ -48,91 +48,93 @@ Element_CBNW::Element_CBNW()
|
||||
|
||||
//#TPT-Directive ElementHeader Element_CBNW static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_CBNW::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (sim->pv[y/CELL][x/CELL]<=3)
|
||||
{
|
||||
if(sim->pv[y/CELL][x/CELL]<=-0.5)
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.5f;
|
||||
}
|
||||
else if(1>(rand()%4000))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.5f;
|
||||
}
|
||||
}
|
||||
if (parts[i].tmp2!=20) {
|
||||
parts[i].tmp2 -= (parts[i].tmp2>20)?1:-1;
|
||||
}
|
||||
else if(!(rand()%200))
|
||||
{
|
||||
parts[i].tmp2 = rand()%40;
|
||||
}
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (sim->pv[y/CELL][x/CELL]<=3)
|
||||
{
|
||||
if(sim->pv[y/CELL][x/CELL]<=-0.5)
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.5f;
|
||||
}
|
||||
else if(!(rand()%4000))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.5f;
|
||||
}
|
||||
}
|
||||
if (parts[i].tmp2!=20) {
|
||||
parts[i].tmp2 -= (parts[i].tmp2>20)?1:-1;
|
||||
}
|
||||
else if(!(rand()%200))
|
||||
{
|
||||
parts[i].tmp2 = rand()%40;
|
||||
}
|
||||
|
||||
if(parts[i].tmp>0)
|
||||
{
|
||||
//Explode
|
||||
if(parts[i].tmp==1 && rand()%4)
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.2f;
|
||||
}
|
||||
parts[i].tmp--;
|
||||
}
|
||||
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)
|
||||
continue;
|
||||
if ((sim->elements[r&0xFF].Properties&TYPE_PART) && parts[i].tmp == 0 && 1>(rand()%250))
|
||||
{
|
||||
//Start explode
|
||||
parts[i].tmp = rand()%25;//(rand()%100)+50;
|
||||
}
|
||||
else if((r&0xFF)!=PT_DMND && (r&0xFF)!=PT_GLAS && (sim->elements[r&0xFF].Properties&TYPE_SOLID) && parts[i].tmp == 0 && (2-sim->pv[y/CELL][x/CELL])>(rand()%40000))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.2f;
|
||||
|
||||
}
|
||||
if ((r&0xFF)==PT_CBNW)
|
||||
{
|
||||
if(!parts[i].tmp && parts[r>>8].tmp)
|
||||
{
|
||||
parts[i].tmp = parts[r>>8].tmp;
|
||||
if((r>>8)>i) //If the other particle hasn't been life updated
|
||||
parts[i].tmp--;
|
||||
}
|
||||
else if(parts[i].tmp && !parts[r>>8].tmp)
|
||||
{
|
||||
parts[r>>8].tmp = parts[i].tmp;
|
||||
if((r>>8)>i) //If the other particle hasn't been life updated
|
||||
parts[r>>8].tmp++;
|
||||
}
|
||||
}
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && 1>(rand()%500))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
parts[i].ctype = PT_WATR;
|
||||
}
|
||||
if ((r&0xFF)==PT_FIRE && parts[r>>8].ctype!=PT_WATR){
|
||||
sim->kill_part(r>>8);
|
||||
if(1>(rand()%150)){
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if(parts[i].tmp>0)
|
||||
{
|
||||
//Explode
|
||||
if(parts[i].tmp==1 && rand()%4)
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.2f;
|
||||
}
|
||||
parts[i].tmp--;
|
||||
}
|
||||
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)
|
||||
continue;
|
||||
if ((sim->elements[r&0xFF].Properties&TYPE_PART) && parts[i].tmp == 0 && !(rand()%250))
|
||||
{
|
||||
//Start explode
|
||||
parts[i].tmp = rand()%25;//(rand()%100)+50;
|
||||
}
|
||||
else if((sim->elements[r&0xFF].Properties&TYPE_SOLID) && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_GLAS && parts[i].tmp == 0 && (2-sim->pv[y/CELL][x/CELL])>(rand()%40000))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
sim->pv[y/CELL][x/CELL] += 0.2f;
|
||||
}
|
||||
if ((r&0xFF)==PT_CBNW)
|
||||
{
|
||||
if(!parts[i].tmp && parts[r>>8].tmp)
|
||||
{
|
||||
parts[i].tmp = parts[r>>8].tmp;
|
||||
if((r>>8)>i) //If the other particle hasn't been life updated
|
||||
parts[i].tmp--;
|
||||
}
|
||||
else if(parts[i].tmp && !parts[r>>8].tmp)
|
||||
{
|
||||
parts[r>>8].tmp = parts[i].tmp;
|
||||
if((r>>8)>i) //If the other particle hasn't been life updated
|
||||
parts[r>>8].tmp++;
|
||||
}
|
||||
}
|
||||
else if ((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD)
|
||||
{
|
||||
if ((sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%500))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
parts[i].ctype = PT_WATR;
|
||||
}
|
||||
}
|
||||
else if ((r&0xFF)==PT_FIRE && parts[r>>8].ctype!=PT_WATR){
|
||||
sim->kill_part(r>>8);
|
||||
if(1>(rand()%150)){
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,23 +58,26 @@ int Element_CLST::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_WATR && 1>(rand()%1500))
|
||||
if ((r&0xFF)==PT_WATR)
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_PSTS);
|
||||
sim->kill_part(r>>8);
|
||||
if (!(rand()%1500))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_PSTS);
|
||||
sim->kill_part(r>>8);
|
||||
}
|
||||
}
|
||||
if ((r&0xFF)==PT_NITR)
|
||||
else if ((r&0xFF)==PT_NITR)
|
||||
{
|
||||
sim->create_part(i, x, y, PT_BANG);
|
||||
sim->create_part(r>>8, x+rx, y+ry, PT_BANG);
|
||||
}
|
||||
if ((r&0xFF)==PT_CLST)
|
||||
else if ((r&0xFF)==PT_CLST)
|
||||
{
|
||||
if(parts[i].temp <195)
|
||||
cxy = 0.05;
|
||||
else if(parts[i].temp >= 195 && parts[i].temp <295)
|
||||
else if(parts[i].temp <295)
|
||||
cxy = 0.015;
|
||||
else if(parts[i].temp >= 295 && parts[i].temp <350)
|
||||
else if(parts[i].temp <350)
|
||||
cxy = 0.01;
|
||||
else
|
||||
cxy = 0.005;
|
||||
|
@ -64,11 +64,14 @@ int Element_CO2::update(UPDATE_FUNC_ARGS)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && !(rand()%250))
|
||||
else if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && !(rand()%250))
|
||||
{
|
||||
sim->part_change_type(r>>8, x+rx, y+ry, PT_CBNW);
|
||||
if (parts[i].ctype==5) //conserve number of water particles - ctype=5 means this CO2 hasn't released the water particle from BUBW yet
|
||||
{
|
||||
sim->create_part(i, x, y, PT_WATR);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sim->kill_part(i);
|
||||
|
@ -72,15 +72,15 @@ int Element_COAL::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM))
|
||||
{
|
||||
if (parts[i].life>100) {
|
||||
if (parts[i].life>100 && !(rand()%500)) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
if ((r&0xFF)==PT_LAVA && 1>(rand()%500))
|
||||
else if ((r&0xFF)==PT_LAVA)
|
||||
{
|
||||
if (parts[r>>8].ctype == PT_IRON) {
|
||||
if (parts[r>>8].ctype == PT_IRON && !(rand()%500)) {
|
||||
parts[r>>8].ctype = PT_METL;
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
@ -150,4 +150,4 @@ int Element_COAL::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
|
||||
|
||||
Element_COAL::~Element_COAL() {}
|
||||
Element_COAL::~Element_COAL() {}
|
||||
|
@ -57,7 +57,7 @@ int Element_SHLD2::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
{
|
||||
if ( parts[i].life>0)
|
||||
if (parts[i].life>0)
|
||||
sim->create_part(-1,x+rx,y+ry,PT_SHLD1);
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user