mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-19 22:00:03 +01:00
more accurate O2 fusion calculation, fixes #505
seemed to only be 3% slower in my tests with a full screen of heated pressurized O2
This commit is contained in:
parent
2adae64041
commit
d666559481
@ -74,37 +74,42 @@ int Element_O2::update(UPDATE_FUNC_ARGS)
|
||||
parts[i].tmp |= 2;
|
||||
}
|
||||
}
|
||||
if (parts[i].temp > 9973.15 && sim->pv[y/CELL][x/CELL] > 250.0f && abs(sim->gravx[((y/CELL)*(XRES/CELL))+(x/CELL)]) + abs(sim->gravy[((y/CELL)*(XRES/CELL))+(x/CELL)]) > 20)
|
||||
if (parts[i].temp > 9973.15 && sim->pv[y/CELL][x/CELL] > 250.0f)
|
||||
{
|
||||
if (!(rand()%5))
|
||||
float gravx = sim->gravx[((y/CELL)*(XRES/CELL))+(x/CELL)];
|
||||
float gravy = sim->gravy[((y/CELL)*(XRES/CELL))+(x/CELL)];
|
||||
if (gravx*gravx + gravy*gravy > 400)
|
||||
{
|
||||
int j;
|
||||
sim->create_part(i,x,y,PT_BRMT);
|
||||
if (!(rand()%5))
|
||||
{
|
||||
int j;
|
||||
sim->create_part(i,x,y,PT_BRMT);
|
||||
|
||||
j = sim->create_part(-3,x,y,PT_NEUT);
|
||||
if (j != -1)
|
||||
parts[j].temp = MAX_TEMP;
|
||||
j = sim->create_part(-3,x,y,PT_PHOT);
|
||||
if (j != -1)
|
||||
{
|
||||
parts[j].temp = MAX_TEMP;
|
||||
parts[j].tmp = 0x1;
|
||||
}
|
||||
rx = x+rand()%3-1, ry = y+rand()%3-1, r = TYP(pmap[ry][rx]);
|
||||
if (sim->can_move[PT_PLSM][r] || r == PT_O2)
|
||||
{
|
||||
j = sim->create_part(-3,rx,ry,PT_PLSM);
|
||||
if (j > -1)
|
||||
j = sim->create_part(-3,x,y,PT_NEUT);
|
||||
if (j != -1)
|
||||
parts[j].temp = MAX_TEMP;
|
||||
j = sim->create_part(-3,x,y,PT_PHOT);
|
||||
if (j != -1)
|
||||
{
|
||||
parts[j].temp = MAX_TEMP;
|
||||
parts[j].tmp |= 4;
|
||||
parts[j].tmp = 0x1;
|
||||
}
|
||||
rx = x+rand()%3-1, ry = y+rand()%3-1, r = TYP(pmap[ry][rx]);
|
||||
if (sim->can_move[PT_PLSM][r] || r == PT_O2)
|
||||
{
|
||||
j = sim->create_part(-3,rx,ry,PT_PLSM);
|
||||
if (j > -1)
|
||||
{
|
||||
parts[j].temp = MAX_TEMP;
|
||||
parts[j].tmp |= 4;
|
||||
}
|
||||
}
|
||||
j = sim->create_part(-3,x,y,PT_GRVT);
|
||||
if (j != -1)
|
||||
parts[j].temp = MAX_TEMP;
|
||||
parts[i].temp = MAX_TEMP;
|
||||
sim->pv[y/CELL][x/CELL] = 256;
|
||||
}
|
||||
j = sim->create_part(-3,x,y,PT_GRVT);
|
||||
if (j != -1)
|
||||
parts[j].temp = MAX_TEMP;
|
||||
parts[i].temp = MAX_TEMP;
|
||||
sim->pv[y/CELL][x/CELL] = 256;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user