Added PGRV and NGRV for positive and negative gravity tools (sortof like air and vac, but with gravity)

This commit is contained in:
Bryan Hoyle 2011-08-16 18:07:12 -04:00
parent e2df8e2c16
commit 161eb60cfa
5 changed files with 30 additions and 8 deletions

View File

@ -23,7 +23,7 @@
#define UI_WALLSTART 222 #define UI_WALLSTART 222
#define UI_ACTUALSTART 122 #define UI_ACTUALSTART 122
#define UI_WALLCOUNT 21 #define UI_WALLCOUNT 23
#define WL_WALLELEC 122 #define WL_WALLELEC 122
#define WL_EWALL 123 #define WL_EWALL 123
@ -47,6 +47,8 @@
#define SPC_COOL 238 #define SPC_COOL 238
#define SPC_VACUUM 239 #define SPC_VACUUM 239
#define SPC_WIND 241 #define SPC_WIND 241
#define SPC_PGRV 243
#define SPC_NGRV 244
#define WL_ALLOWGAS 140 #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(0x579777), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and solids, allows gasses"},
{PIXPACK(0x000000), PIXPACK(0x000000), -1, "Drag tool"}, {PIXPACK(0x000000), PIXPACK(0x000000), -1, "Drag tool"},
{PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, "Gravity wall"}, {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) #define CHANNELS ((int)(MAX_TEMP-73)/100+2)

View File

@ -856,6 +856,8 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
case SPC_COOL: case SPC_COOL:
case SPC_VACUUM: case SPC_VACUUM:
case SPC_WIND: case SPC_WIND:
case SPC_PGRV:
case SPC_NGRV:
for (j=1; j<15; j++) for (j=1; j<15; j++)
for (i=1; i<27; i++) for (i=1; i<27; i++)
vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; 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); drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255);
else if (b==SPC_WIND) else if (b==SPC_WIND)
drawtext(vid_buf, x+14-textwidth("WIND")/2, y+4, "WIND", c, c, c, 255); 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; break;
default: default:
for (j=1; j<15; j++) 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) void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry)
{ {
int i,j,c; 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) if (rx<=0)
xor_pixel(x, y, vid); xor_pixel(x, y, vid);

View File

@ -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++) 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) /*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++) 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) /*if (x-18<=0)
{ {

View File

@ -3220,7 +3220,7 @@ int main(int argc, char *argv[])
{ {
if (sdl_mod & (KMOD_CAPS)) if (sdl_mod & (KMOD_CAPS))
c = 0; 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); flood_parts(x, y, c, -1, -1);
if (c==SPC_HEAT || c==SPC_COOL) if (c==SPC_HEAT || c==SPC_COOL)
create_parts(x, y, bsx, bsy, c); create_parts(x, y, bsx, bsy, c);

View File

@ -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 t = tv & 0xFF;
int v = (tv >> 8) & 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; return -1;
if (t>=0 && t<PT_NUM && !ptypes[t].enabled) if (t>=0 && t<PT_NUM && !ptypes[t].enabled)
return -1; 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; 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) 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 (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; break;
if (wall == WL_ERASE) if (wall == WL_ERASE)
b = 0; 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 //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) if (rx==0&&ry==0)
{ {