From 161eb60cfa542a72a76598b3cb99a6b1994d3f48 Mon Sep 17 00:00:00 2001 From: Bryan Hoyle Date: Tue, 16 Aug 2011 18:07:12 -0400 Subject: [PATCH] Added PGRV and NGRV for positive and negative gravity tools (sortof like air and vac, but with gravity) --- includes/powder.h | 7 ++++++- src/graphics.c | 8 +++++++- src/interface.c | 4 ++-- src/main.c | 2 +- src/powder.c | 17 ++++++++++++++--- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 002d799b2..aacad4331 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -23,7 +23,7 @@ #define UI_WALLSTART 222 #define UI_ACTUALSTART 122 -#define UI_WALLCOUNT 21 +#define UI_WALLCOUNT 23 #define WL_WALLELEC 122 #define WL_EWALL 123 @@ -47,6 +47,8 @@ #define SPC_COOL 238 #define SPC_VACUUM 239 #define SPC_WIND 241 +#define SPC_PGRV 243 +#define SPC_NGRV 244 #define WL_ALLOWGAS 140 @@ -933,6 +935,9 @@ static wall_type wtypes[] = {PIXPACK(0x579777), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and solids, allows gasses"}, {PIXPACK(0x000000), PIXPACK(0x000000), -1, "Drag tool"}, {PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, "Gravity wall"}, + {PIXPACK(0x0000BB), PIXPACK(0x000000), -1, "Postive gravity tool."}, + {PIXPACK(0x000099), PIXPACK(0x000000), -1, "Negative gravity tool."}, + }; #define CHANNELS ((int)(MAX_TEMP-73)/100+2) diff --git a/src/graphics.c b/src/graphics.c index 0a30327c0..0b6dfd7a5 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -856,6 +856,8 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) case SPC_COOL: case SPC_VACUUM: case SPC_WIND: + case SPC_PGRV: + case SPC_NGRV: for (j=1; j<15; j++) for (i=1; i<27; i++) vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; @@ -878,6 +880,10 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); else if (b==SPC_WIND) drawtext(vid_buf, x+14-textwidth("WIND")/2, y+4, "WIND", c, c, c, 255); + else if (b==SPC_PGRV) + drawtext(vid_buf, x+14-textwidth("PGRV")/2, y+4, "PGRV", c, c, c, 255); + else if (b==SPC_NGRV) + drawtext(vid_buf, x+14-textwidth("NGRV")/2, y+4, "NGRV", c, c, c, 255); break; default: for (j=1; j<15; j++) @@ -4513,7 +4519,7 @@ corrupt: void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry) { int i,j,c; - if (t> 8) & 0xFF; - if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM)) + if (x<0 || y<0 || x>=XRES || y>=YRES || ((t<0 || t>=PT_NUM)&&t!=SPC_HEAT&&t!=SPC_COOL&&t!=SPC_AIR&&t!=SPC_VACUUM&&t!=SPC_PGRV&&t!=SPC_NGRV)) return -1; if (t>=0 && t