TPT: Fix bounds checking for SING and make explosion pressure area smaller d7f798da60
This commit is contained in:
parent
a270acfc54
commit
2633af01d7
@ -63,21 +63,21 @@ int Element_SING::update(UPDATE_FUNC_ARGS)
|
||||
if (y+CELL<YRES)
|
||||
sim->pv[y/CELL+1][x/CELL+1] += 0.1f*(singularity-sim->pv[y/CELL+1][x/CELL+1]);
|
||||
}
|
||||
if (y+CELL>0 && sim->pv[y/CELL-1][x/CELL]<singularity)
|
||||
if (y-CELL>=0 && sim->pv[y/CELL-1][x/CELL]<singularity)
|
||||
sim->pv[y/CELL-1][x/CELL] += 0.1f*(singularity-sim->pv[y/CELL-1][x/CELL]);
|
||||
if (x+CELL>0)
|
||||
if (x-CELL>=0)
|
||||
{
|
||||
sim->pv[y/CELL][x/CELL-1] += 0.1f*(singularity-sim->pv[y/CELL][x/CELL-1]);
|
||||
if (y+CELL>0)
|
||||
if (y-CELL>=0)
|
||||
sim->pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-sim->pv[y/CELL-1][x/CELL-1]);
|
||||
}
|
||||
if (parts[i].life<1) {
|
||||
//Pop!
|
||||
for (rx=-2; rx<3; rx++) {
|
||||
for (rx=-1; rx<2; rx++) {
|
||||
crx = (x/CELL)+rx;
|
||||
for (ry=-2; ry<3; ry++) {
|
||||
for (ry=-1; ry<2; ry++) {
|
||||
cry = (y/CELL)+ry;
|
||||
if (cry > 0 && crx > 0 && crx < (XRES/CELL) && cry < (YRES/CELL)) {
|
||||
if (cry >= 0 && crx >= 0 && crx < (XRES/CELL) && cry < (YRES/CELL)) {
|
||||
sim->pv[cry][crx] += (float)parts[i].tmp;
|
||||
}
|
||||
}
|
||||
@ -152,4 +152,4 @@ int Element_SING::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
|
||||
|
||||
Element_SING::~Element_SING() {}
|
||||
Element_SING::~Element_SING() {}
|
||||
|
Reference in New Issue
Block a user