summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan Hoyle <starfoxprime@gmail.com>2011-08-16 22:07:12 (GMT)
committer Bryan Hoyle <starfoxprime@gmail.com>2011-08-16 22:07:12 (GMT)
commit161eb60cfa542a72a76598b3cb99a6b1994d3f48 (patch)
treee1535de4bd4b5493889f21f9b4e1eab40bc27cc9 /src
parente2df8e2c16e17222794fbe94dc9b491101cc34df (diff)
downloadpowder-161eb60cfa542a72a76598b3cb99a6b1994d3f48.zip
powder-161eb60cfa542a72a76598b3cb99a6b1994d3f48.tar.gz
Added PGRV and NGRV for positive and negative gravity tools (sortof like air and vac, but with gravity)
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c8
-rw-r--r--src/interface.c4
-rw-r--r--src/main.c2
-rw-r--r--src/powder.c17
4 files changed, 24 insertions, 7 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 0a30327..0b6dfd7 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<PT_NUM||(t&0xFF)==PT_LIFE||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM||t==SPC_WIND)
+ if (t<PT_NUM||(t&0xFF)==PT_LIFE||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM||t==SPC_WIND||t==SPC_PGRV||t==SPC_NGRV)
{
if (rx<=0)
xor_pixel(x, y, vid);
diff --git a/src/interface.c b/src/interface.c
index 7286c4d..c77141f 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -1910,7 +1910,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *dae, int b, int bq
{
for (n = UI_WALLSTART; n<UI_WALLSTART+UI_WALLCOUNT; n++)
{
- if (n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM&&n!=SPC_WIND)
+ if (n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM&&n!=SPC_WIND&&n!=SPC_PGRV&&n!=SPC_NGRV)
{
/*if (x-18<=2)
{
@@ -1947,7 +1947,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *dae, int b, int bq
{
for (n = UI_WALLSTART; n<UI_WALLSTART+UI_WALLCOUNT; n++)
{
- if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM||n==SPC_WIND)
+ if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM||n==SPC_WIND||n==SPC_PGRV||n==SPC_NGRV)
{
/*if (x-18<=0)
{
diff --git a/src/main.c b/src/main.c
index 4c5b239..19aa160 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3220,7 +3220,7 @@ int main(int argc, char *argv[])
{
if (sdl_mod & (KMOD_CAPS))
c = 0;
- if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE&&c!=SPC_WIND)
+ if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE&&c!=SPC_WIND&&c!=SPC_PGRV&&c!=SPC_NGRV)
flood_parts(x, y, c, -1, -1);
if (c==SPC_HEAT || c==SPC_COOL)
create_parts(x, y, bsx, bsy, c);
diff --git a/src/powder.c b/src/powder.c
index 85c31e1..abff116 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -647,7 +647,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
int t = tv & 0xFF;
int v = (tv >> 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<PT_NUM && !ptypes[t].enabled)
return -1;
@@ -709,6 +709,17 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
}
return -1;
}
+ if (t==SPC_PGRV)
+ {
+ gravmap[y/CELL][x/CELL] = 5;
+ return -1;
+ }
+ if (t==SPC_NGRV)
+ {
+ gravmap[y/CELL][x/CELL] = -5;
+ return -1;
+ }
+
if (t==PT_SPRK)
{
@@ -2667,7 +2678,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
{
if (wall==r)
{
- if (c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM)
+ if (c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM || c == SPC_PGRV || c == SPC_NGRV)
break;
if (wall == WL_ERASE)
b = 0;
@@ -2752,7 +2763,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
}
//why do these need a special if
- if (c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM)
+ if (c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM || c == SPC_PGRV || c == SPC_NGRV)
{
if (rx==0&&ry==0)
{