Always check bmap when creating particles

This commit is contained in:
jacksonmj 2011-08-30 08:16:42 +08:00 committed by Simon Robertshaw
parent df504330e2
commit e506934655
5 changed files with 6 additions and 17 deletions

View File

@ -32,9 +32,6 @@ int update_DEUT(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (parts[i].life<=maxlife) if (parts[i].life<=maxlife)
continue; continue;
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_EWALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||
bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWAIR||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWGAS))
continue;
if ((!r)&&parts[i].life>=1)//if nothing then create deut if ((!r)&&parts[i].life>=1)//if nothing then create deut
{ {
np = create_part(-1,x+rx,y+ry,PT_DEUT); np = create_part(-1,x+rx,y+ry,PT_DEUT);

View File

@ -32,9 +32,6 @@ int update_MERC(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (parts[i].tmp<=maxtmp) if (parts[i].tmp<=maxtmp)
continue; continue;
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_EWALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||
bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWAIR||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWGAS))
continue;
if ((!r)&&parts[i].tmp>=1)//if nothing then create deut if ((!r)&&parts[i].tmp>=1)//if nothing then create deut
{ {
np = create_part(-1,x+rx,y+ry,PT_MERC); np = create_part(-1,x+rx,y+ry,PT_MERC);

View File

@ -130,7 +130,7 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
{ {
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if (surround_space && !r && (parts[i].tmp&0xFF)!=0 && eval_move(parts[i].tmp&0xFF, x+rx, y+ry, NULL)) //creating at end if (surround_space && !r && (parts[i].tmp&0xFF)!=0) //creating at end
{ {
np = create_part(-1,x+rx,y+ry,parts[i].tmp&0xFF); np = create_part(-1,x+rx,y+ry,parts[i].tmp&0xFF);
if (np!=-1) if (np!=-1)

View File

@ -24,13 +24,10 @@ int update_SPNG(UPDATE_FUNC_ARGS) {
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_EWALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||
bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWAIR||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWGAS))
continue;
if ((!r)&&parts[i].life>=1)//if nothing then create water if ((!r)&&parts[i].life>=1)//if nothing then create water
{ {
create_part(-1,x+rx,y+ry,PT_WATR); np = create_part(-1,x+rx,y+ry,PT_WATR);
parts[i].life--; if (np>-1) parts[i].life--;
} }
} }
for ( trade = 0; trade<9; trade ++) for ( trade = 0; trade<9; trade ++)
@ -90,8 +87,6 @@ int update_SPNG(UPDATE_FUNC_ARGS) {
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID))
continue;
if ((!r)&&parts[i].life>=1)//if nothing then create steam if ((!r)&&parts[i].life>=1)//if nothing then create steam
{ {
np = create_part(-1,x+rx,y+ry,PT_WTRV); np = create_part(-1,x+rx,y+ry,PT_WTRV);
@ -99,9 +94,9 @@ int update_SPNG(UPDATE_FUNC_ARGS) {
{ {
parts[np].temp = parts[i].temp; parts[np].temp = parts[i].temp;
tmp--; tmp--;
parts[i].life--;
parts[i].temp -= 20.0f;
} }
parts[i].life--;
parts[i].temp -= 20.0f;
} }
} }
if (tmp>0) if (tmp>0)

View File

@ -732,7 +732,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
return -1; return -1;
if (p==-1)//creating from anything but brush if (p==-1)//creating from anything but brush
{ {
if (pmap[y][x]) if (pmap[y][x] || (bmap[y/CELL][x/CELL] && !eval_move(t, x, y, NULL)))
{ {
if ((pmap[y][x]&0xFF)!=PT_SPAWN&&(pmap[y][x]&0xFF)!=PT_SPAWN2) if ((pmap[y][x]&0xFF)!=PT_SPAWN&&(pmap[y][x]&0xFF)!=PT_SPAWN2)
{ {