From fd6f6c5406c3af9bcb679e5381800b8708ba3d8a Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 24 Feb 2011 17:11:05 +0000 Subject: [PATCH] WIND from cracker! --- includes/powder.h | 7 +++++-- src/main.c | 17 +++++++++++++++-- src/powder.c | 4 ++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index a8bd6bfad..581c8da4a 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -196,7 +196,8 @@ #define PT_STAR 144 #define PT_FROG 145 #define PT_BRAN 146 -#define PT_NUM 147 +#define PT_WIND 147 +#define PT_NUM 148 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -437,7 +438,7 @@ static const part_type ptypes[PT_NUM] = {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremely high temperature.", ST_SOLID, TYPE_PART, &update_THRM}, {"GLOW", PIXPACK(0x445464), 0.3f, 0.02f * CFDS, 0.98f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW, NULL}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL}, {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW}, {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", ST_SOLID, TYPE_SOLID, &update_FUSE}, {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP}, @@ -516,6 +517,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}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description }; @@ -678,6 +680,7 @@ static part_transition ptransitions[PT_NUM] = /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, + /* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, }; #undef IPL #undef IPH diff --git a/src/main.c b/src/main.c index bb99db692..6de200af7 100644 --- a/src/main.c +++ b/src/main.c @@ -2432,7 +2432,20 @@ int main(int argc, char *argv[]) } else { - create_line(lx, ly, x, y, bsx, bsy, c); + if (c == PT_WIND) + { + for (j=-bsy; j<=bsy; j++) + for (i=-bsx; i<=bsx; i++) + if ((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(bsx,2))+(pow(j,2))/(pow(bsy,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=bsy*bsx)) + { + vx[(y+j)/CELL][(x+i)/CELL] += (x-lx)*0.01f; + vy[(y+j)/CELL][(x+i)/CELL] += (y-ly)*0.01f; + } + } + else + { + create_line(lx, ly, x, y, bsx, bsy, c); + } lx = x; ly = y; } @@ -2457,7 +2470,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) + if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&c!=PT_WIND&&!REPLACE_MODE) 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 b2751c5a3..55c12337e 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2864,6 +2864,10 @@ 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;