Make NBHL/NWHL eat things in the same way as BHOL/WHOL

Also make ANAR move opposite to Newtonian gravity
This commit is contained in:
jacksonmj 2011-05-27 22:43:30 +08:00 committed by Simon Robertshaw
parent 6e9cbfdb4a
commit 420f8e7442
3 changed files with 12 additions and 21 deletions

View File

@ -9,7 +9,7 @@ int update_AMTR(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO)
if ((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_NBHL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO)
{
parts[i].life++;
if (parts[i].life==4)

View File

@ -1,21 +1,6 @@
#include <element.h>
int update_NBHL(UPDATE_FUNC_ARGS) {
int r, rx, ry;
gravmap[y/CELL][x/CELL] += 0.1f;
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_NBHL)
{
if((r&0xFF)<PT_NUM && !(ptypes[(r&0xFF)].properties & TYPE_SOLID))
kill_part(r>>8);
}
}
return 0;
}

View File

@ -76,10 +76,10 @@ int eval_move(int pt, int nx, int ny, unsigned *rr)
if (rr)
*rr = r;
if ((r&0xFF)==PT_VOID || (r&0xFF)==PT_BHOL)
if ((r&0xFF)==PT_VOID || (r&0xFF)==PT_BHOL || (r&0xFF)==PT_NBHL)
return 1;
if ((r&0xFF)==PT_WHOL && pt==PT_ANAR)
if (((r&0xFF)==PT_WHOL||(r&0xFF)==PT_NWHL) && pt==PT_ANAR)
return 1;
if (pt==PT_SPRK)//spark shouldn't move
@ -255,7 +255,7 @@ int try_move(int i, int x, int y, int nx, int ny)
parts[i].type=PT_NONE;
return 0;
}
if ((r&0xFF)==PT_BHOL) //this is where blackhole eats particles
if ((r&0xFF)==PT_BHOL || (r&0xFF)==PT_NBHL) //this is where blackhole eats particles
{
if (parts[i].type == PT_STKM)
{
@ -275,7 +275,7 @@ int try_move(int i, int x, int y, int nx, int ny)
return 0;
}
if ((r&0xFF)==PT_WHOL && parts[i].type==PT_ANAR) //whitehole eats anar
if (((r&0xFF)==PT_WHOL||(r&0xFF)==PT_NWHL) && parts[i].type==PT_ANAR) //whitehole eats anar
{
parts[i].type=PT_NONE;
if (!legacy_enable)
@ -1525,7 +1525,13 @@ void update_particles_i(pixel *vid, int start, int inc)
pGravY = ptypes[t].gravity * ((float)(y - YCNTR) / pGravD);
}
//Get some gravity from the gravity map
if(!(ptypes[t].properties & TYPE_SOLID))
if (t==PT_ANAR)
{
// perhaps we should have a ptypes variable for this
pGravX -= gravx[y/CELL][x/CELL];
pGravY -= gravy[y/CELL][x/CELL];
}
else if(!(ptypes[t].properties & TYPE_SOLID))
{
pGravX += gravx[y/CELL][x/CELL];
pGravY += gravy[y/CELL][x/CELL];