summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-05-27 14:43:30 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-28 10:51:57 (GMT)
commit420f8e7442077aab83b92270bef22f123113af73 (patch)
tree0a047807e2092c7c4481bbca77ec0d973d6a8fc7 /src
parent6e9cbfdb4a1cec1ab1a400bc5f6c30ecb61c84b3 (diff)
downloadpowder-420f8e7442077aab83b92270bef22f123113af73.zip
powder-420f8e7442077aab83b92270bef22f123113af73.tar.gz
Make NBHL/NWHL eat things in the same way as BHOL/WHOL
Also make ANAR move opposite to Newtonian gravity
Diffstat (limited to 'src')
-rw-r--r--src/elements/amtr.c2
-rw-r--r--src/elements/nbhl.c15
-rw-r--r--src/powder.c16
3 files changed, 12 insertions, 21 deletions
diff --git a/src/elements/amtr.c b/src/elements/amtr.c
index 54d8a85..49a9618 100644
--- a/src/elements/amtr.c
+++ b/src/elements/amtr.c
@@ -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)
diff --git a/src/elements/nbhl.c b/src/elements/nbhl.c
index da0942d..69b6881 100644
--- a/src/elements/nbhl.c
+++ b/src/elements/nbhl.c
@@ -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;
}
diff --git a/src/powder.c b/src/powder.c
index 1fc094d..544430b 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -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];