Better Oxygen/Hydrogen burning

This commit is contained in:
Simon
2011-04-10 11:38:29 +01:00
parent 00d8af2404
commit 422fcc68ec
3 changed files with 24 additions and 34 deletions

View File

@@ -13,39 +13,13 @@ int update_O2(UPDATE_FUNC_ARGS)
if ((r&0xFF)==PT_FIRE)
{
parts[r>>8].life+=(rand()/(RAND_MAX/100))*2;
parts[r>>8].temp+=(rand()/(RAND_MAX/100));
parts[i].tmp++;
parts[r>>8].tmp |= 2;
create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()/(RAND_MAX/100));
parts[i].tmp |= 2;
}
}
if (pv[y/CELL][x/CELL] > 8.0f)
{
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_H2)
{
part_change_type(r>>8,x+rx,y+ry,PT_WATR);
if (50<(rand()/(RAND_MAX/100))) {
part_change_type(i,x,y,PT_WATR);
rx = ry = 3;
}
}
}
}
if (parts[i].tmp>=50)
{
create_part(i,x,y,PT_FIRE);
parts[i].life+=(rand()/(RAND_MAX/100))+50;
parts[i].temp+=(rand()/(RAND_MAX/100));
}
return 0;
}

View File

@@ -16,6 +16,14 @@ 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+=(rand()/(RAND_MAX/100));
parts[r>>8].tmp |= 1;
create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()/(RAND_MAX/100));
parts[i].tmp |= 1;
}
}
return 0;
}

View File

@@ -8,11 +8,19 @@ int update_PYRO(UPDATE_FUNC_ARGS) {
part_change_type(i,x,y,t);
parts[i].life = 0;
}
if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<625)
if(t==PT_FIRE && parts[i].life <=1)
{
t = PT_SMKE;
part_change_type(i,x,y,t);
parts[i].life = rand()%20+250;
if (parts[i].tmp==3){
t = PT_WATR;
part_change_type(i,x,y,t);
parts[i].life = 0;
}
else if (parts[i].temp<625)
{
t = PT_SMKE;
part_change_type(i,x,y,t);
parts[i].life = rand()%20+250;
}
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)