Turn WIND into a tool

This commit is contained in:
jacksonmj 2011-05-11 21:29:35 +01:00 committed by Simon Robertshaw
parent 26dbf70709
commit cbfc73d8d6
5 changed files with 16 additions and 13 deletions

View File

@ -23,7 +23,7 @@
#define UI_WALLSTART 222
#define UI_ACTUALSTART 122
#define UI_WALLCOUNT 19
#define UI_WALLCOUNT 20
#define WL_WALLELEC 122
#define WL_EWALL 123
@ -45,6 +45,7 @@
#define SPC_HEAT 237
#define SPC_COOL 238
#define SPC_VACUUM 239
#define SPC_WIND 241
#define WL_ALLOWGAS 140
@ -197,7 +198,7 @@
#define PT_STAR 144
#define PT_FROG 145
#define PT_BRAN 146
#define PT_WIND 147
#define OLD_PT_WIND 147
#define PT_H2 148
#define PT_SOAP 149
#define PT_NUM 150
@ -529,7 +530,7 @@ static const part_type ptypes[PT_NUM] =
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"FROG", PIXPACK(0x00AA00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"WIND", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, 0.0f, 40, "Drag tool", ST_NONE, ST_NONE, NULL},
{"WIND", PIXPACK(0x101010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 100, SC_SPECIAL, 0.0f, 40, "", ST_NONE, ST_NONE, NULL},
{"H2", PIXPACK(0x5070FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.10f, 0.00f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 251, "Combines with O2 to make WATR", ST_GAS, TYPE_GAS, &update_H2},
{"SOAP", PIXPACK(0xF5F5DC), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Soap. Creates bubbles.", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE, &update_SOAP},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
@ -817,6 +818,7 @@ static wall_type wtypes[] =
{PIXPACK(0x00BBFF), PIXPACK(0x000000), -1, "Cools the targetted element."},
{PIXPACK(0x303030), PIXPACK(0x000000), -1, "Vacuum, reduces air pressure."},
{PIXPACK(0x579777), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and solids, allows gasses"},
{PIXPACK(0x000000), PIXPACK(0x000000), -1, "Drag tool"},
};
#define CHANNELS ((int)(MAX_TEMP-73.15f)/100+2)

View File

@ -562,6 +562,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
case SPC_HEAT:
case SPC_COOL:
case SPC_VACUUM:
case SPC_WIND:
for (j=1; j<15; j++)
for (i=1; i<27; i++)
vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc;
@ -582,6 +583,8 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255);
else if (b==SPC_VACUUM)
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);
break;
default:
for (j=1; j<15; j++)
@ -3757,7 +3760,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==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM)
if (t<PT_NUM||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM||t==SPC_WIND)
{
if (rx<=0)
xor_pixel(x, y, vid);

View File

@ -1718,7 +1718,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)
if (n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM&&n!=SPC_WIND)
{
/*if (x-18<=2)
{
@ -1755,7 +1755,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)
if (n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM||n==SPC_WIND)
{
/*if (x-18<=0)
{

View File

@ -2746,7 +2746,7 @@ int main(int argc, char *argv[])
bmap[j][i] = WL_FAN;
}
}
if (c == PT_WIND)
if (c == SPC_WIND)
{
for (j=-bsy; j<=bsy; j++)
for (i=-bsx; i<=bsx; i++)
@ -2766,7 +2766,7 @@ int main(int argc, char *argv[])
}
else//while mouse is held down, it draws lines between previous and current positions
{
if (c == PT_WIND)
if (c == SPC_WIND)
{
for (j=-bsy; j<=bsy; j++)
for (i=-bsx; i<=bsx; i++)
@ -2807,7 +2807,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!=PT_WIND)
if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE&&c!=SPC_WIND)
flood_parts(x, y, c, -1, -1);
if (c==SPC_HEAT || c==SPC_COOL)
create_parts(x, y, bsx, bsy, c);

View File

@ -2308,6 +2308,8 @@ int create_parts(int x, int y, int rx, int ry, int c)
int i, j, r, f = 0, u, v, oy, ox, b = 0, dw = 0, stemp = 0;//n;
int wall = c - 100;
if (c==SPC_WIND)
return 0;
for (r=UI_ACTUALSTART; r<=UI_ACTUALSTART+UI_WALLCOUNT; r++)
{
if (wall==r)
@ -2326,10 +2328,6 @@ int create_parts(int x, int y, int rx, int ry, int c)
b = WL_FANHELPER;
dw = 1;
}
if (c == PT_WIND)
{
return 1;
}
if (dw==1)
{
rx = rx/CELL;