From 63dd1cfd4b6c2f784e86f9dc330ba3d9274d43d6 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Thu, 8 Sep 2011 11:54:50 +0100 Subject: [PATCH] Add energy-only wall and make STOR show when it's holding a particle --- includes/powder.h | 7 ++++--- src/graphics.c | 8 ++++++++ src/powder.c | 7 +++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 3182d0550..38e0ffd41 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -25,7 +25,7 @@ #define UI_WALLSTART 222 #define UI_ACTUALSTART 122 -#define UI_WALLCOUNT 23 +#define UI_WALLCOUNT 24 #define WL_WALLELEC 122 #define WL_EWALL 123 @@ -42,7 +42,6 @@ #define WL_ALLOWSOLID 133 #define WL_ALLOWALLELEC 134 #define WL_EHOLE 135 -#define WL_GRAV 142 #define SPC_AIR 236 #define SPC_HEAT 237 @@ -53,7 +52,8 @@ #define SPC_NGRV 244 #define WL_ALLOWGAS 140 - +#define WL_GRAV 142 +#define WL_ALLOWENERGY 145 #define PT_NONE 0 @@ -953,6 +953,7 @@ static wall_type wtypes[] = {PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, "Gravity wall"}, {PIXPACK(0x0000BB), PIXPACK(0x000000), -1, "Postive gravity tool."}, {PIXPACK(0x000099), PIXPACK(0x000000), -1, "Negative gravity tool."}, + {PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, "Energy wall, allows only energy type particles to pass"}, }; diff --git a/src/graphics.c b/src/graphics.c index 305674241..6f46c57d6 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -3083,6 +3083,14 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny+1, GR, 30, 30, 112); } } + else if (t==PT_STOR) + { + if(parts[i].tmp){ + vid[ny*(XRES+BARSIZE)+nx] = PIXPACK(0x50DFDF); + } else { + vid[ny*(XRES+BARSIZE)+nx] = PIXPACK(0x20AFAF); + } + } else if (t==PT_PUMP) { uint8 GR = 0x3B+((parts[i].life>10?10:parts[i].life)*19); diff --git a/src/powder.c b/src/powder.c index 65bca43a4..4902b751e 100644 --- a/src/powder.c +++ b/src/powder.c @@ -173,6 +173,8 @@ int eval_move(int pt, int nx, int ny, unsigned *rr) { if (bmap[ny/CELL][nx/CELL]==WL_ALLOWGAS && !(ptypes[pt].properties&TYPE_GAS))// && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) return 0; + if (bmap[ny/CELL][nx/CELL]==WL_ALLOWENERGY && !(ptypes[pt].properties&TYPE_ENERGY))// && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) + return 0; if (bmap[ny/CELL][nx/CELL]==WL_ALLOWLIQUID && ptypes[pt].falldown!=2) return 0; if (bmap[ny/CELL][nx/CELL]==WL_ALLOWSOLID && ptypes[pt].falldown!=1) @@ -1603,7 +1605,8 @@ void update_particles_i(pixel *vid, int start, int inc) (bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID && ptypes[t].falldown!=2) || (bmap[y/CELL][x/CELL]==WL_ALLOWSOLID && ptypes[t].falldown!=1) || (bmap[y/CELL][x/CELL]==WL_ALLOWGAS && !(ptypes[t].properties&TYPE_GAS)) || //&& ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE && parts[i].type!=PT_HFLM) || - (bmap[y/CELL][x/CELL]==WL_DETECT && (t==PT_METL || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==WL_ALLOWENERGY && !(ptypes[t].properties&TYPE_ENERGY)) || + (bmap[y/CELL][x/CELL]==WL_DETECT && (t==PT_METL || t==PT_SPRK)) || (bmap[y/CELL][x/CELL]==WL_EWALL && !emap[y/CELL][x/CELL])) && (t!=PT_STKM) && (t!=PT_STKM2))) { kill_part(i); @@ -2880,7 +2883,7 @@ void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flag if (e >= 0.5f) { y += sy; - if (c==WL_EHOLE+100 || c==WL_ALLOWGAS+100 || c==WL_ALLOWALLELEC+100 || c==WL_ALLOWSOLID+100 || c==WL_ALLOWAIR+100 || c==WL_WALL+100 || c==WL_DESTROYALL+100 || c==WL_ALLOWLIQUID+100 || c==WL_FAN+100 || c==WL_STREAM+100 || c==WL_DETECT+100 || c==WL_EWALL+100 || c==WL_WALLELEC+100 || !(rx+ry)) + if (c==WL_EHOLE+100 || c==WL_ALLOWGAS+100 || c==WL_ALLOWENERGY+100 || c==WL_ALLOWALLELEC+100 || c==WL_ALLOWSOLID+100 || c==WL_ALLOWAIR+100 || c==WL_WALL+100 || c==WL_DESTROYALL+100 || c==WL_ALLOWLIQUID+100 || c==WL_FAN+100 || c==WL_STREAM+100 || c==WL_DETECT+100 || c==WL_EWALL+100 || c==WL_WALLELEC+100 || !(rx+ry)) { if (cp) create_parts(y, x, rx, ry, c, flags);