diff --git a/includes/defines.h b/includes/defines.h index 68cc60039..0dbb62e21 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -108,7 +108,9 @@ typedef struct stamp stamp; int MSIGN; int CGOL; int ISGOL; +int ISLOVE; int GSPEED; +int love[XRES/9][YRES/9]; int gol[XRES][YRES]; int gol2[XRES][YRES][NGOL]; extern sign signs[MAXSIGNS]; diff --git a/includes/powder.h b/includes/powder.h index 15848ff04..0909ab57f 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -5,7 +5,8 @@ #include "defines.h" #include "interface.h" -#define CM_COUNT 7 +#define CM_COUNT 8//todo: switch cmode==0, ect. with cmode==CM_VEL +#define CM_NOTHING 7 #define CM_FANCY 6 #define CM_HEAT 5 #define CM_BLOB 4 @@ -131,7 +132,10 @@ #define PT_CRAC 90 #define PT_RIME 91 #define PT_FOG 92 -#define PT_NUM 93 +#define PT_BCLN 93 +#define PT_LOVE 94 +#define PT_WTF 95 +#define PT_NUM 96 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -313,8 +317,12 @@ static const part_type ptypes[PT_NUM] = {"LLIF", PIXPACK(0x505050), 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, "Long Life! (5/345)", TYPE_SOLID}, {"STAN", PIXPACK(0x5000FF), 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, "Stains! (235678/3678)", TYPE_SOLID}, {"CRAC", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "cracker64 - Spongey, Made by himself",TYPE_SOLID}, - {"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 100, "from FOG",TYPE_SOLID}, - {"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 100, "hmmm",TYPE_GAS}, + {"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_SOLIDS, 243.15f, 100, "Not quite Ice",TYPE_SOLID}, + {"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_GAS, 243.15f, 100, "Not quite Steam",TYPE_GAS}, + {"BCLN", PIXPACK(0xFFD040), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", TYPE_SOLID}, + {"LOVE", PIXPACK(0xFF30FF), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 373.0f, 40, "Love...", TYPE_SOLID}, + {"WTF", PIXPACK(0x00153F), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "WTF for catelite", TYPE_LIQUID}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description }; @@ -344,7 +352,7 @@ static part_state pstates[PT_NUM] = /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_RIME, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -412,8 +420,11 @@ static part_state pstates[PT_NUM] = /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* Crac */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 22730.0f}, - /* RIME */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* RIME */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.15f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FOG */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LOVE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WTF */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static int grule[NGOL][9] = { @@ -432,6 +443,18 @@ static int grule[NGOL][9] = {0,0,0,2,2,3,0,0,0},//LLIF {0,0,1,3,0,1,3,3,3},//STAN }; +static int loverule[9][9] = +{ + {0,0,1,1,0,0,0,0,0}, + {0,1,0,0,1,1,0,0,0}, + {1,0,0,0,0,0,1,0,0}, + {1,0,0,0,0,0,0,1,0}, + {0,1,0,0,0,0,0,0,1}, + {1,0,0,0,0,0,0,1,0}, + {1,0,0,0,0,0,1,0,0}, + {0,1,0,0,1,1,0,0,0}, + {0,0,1,1,0,0,0,0,0}, +}; extern int isplayer; extern float player[27]; diff --git a/src/graphics.c b/src/graphics.c index 8836b526d..999040903 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -21,7 +21,7 @@ #include -unsigned cmode = 3; +unsigned cmode = CM_FIRE; SDL_Surface *sdl_scrn; int sdl_scale = 1; @@ -1107,7 +1107,7 @@ void draw_air(pixel *vid) int x, y, i, j; pixel c; - if(cmode == 2) + if(cmode == CM_PERS) return; for(y=0; y=700&&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) + { + x = nx/CELL; + y = ny/CELL; + cr = 20; + cg = 20; + cb = 20; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = PIXR(ptypes[t].pcolors) + parts[i].life*1; + cg = PIXG(ptypes[t].pcolors) + parts[i].life*2; + cb = PIXB(ptypes[t].pcolors) + parts[i].life*4; + if(cr>=255) + cr = 255; + if(cg>=255) + cg = 255; + if(cb>=255) + cb = 255; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + + } + } else if(t==PT_ACID) { @@ -1401,7 +1437,7 @@ void draw_parts(pixel *vid) cr = PIXR(ptypes[t].pcolors)/s; cg = PIXG(ptypes[t].pcolors)/s; cb = PIXB(ptypes[t].pcolors)/s; - if(cmode==6) { + if(cmode==CM_FANCY) { for(x=-1; x<=1; x++) { for(y=-1; y<=1; y++) @@ -1416,7 +1452,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx, ny, cr, cg, cb, 255); } - if(cmode==4) + if(cmode==CM_BLOB) { blendpixel(vid, nx+1, ny, cr, cg, cb, 223); blendpixel(vid, nx-1, ny, cr, cg, cb, 223); @@ -1429,7 +1465,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); } } - else if(t==PT_OIL&&cmode == 6) + else if(t==PT_OIL&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1444,7 +1480,7 @@ void draw_parts(pixel *vid) } else if(t==PT_NEUT) { - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; cg = 8; @@ -1473,7 +1509,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_PLUT&&cmode == 6) + } else if(t==PT_PLUT&&cmode == CM_FANCY) { int tempx; int tempy; @@ -1493,7 +1529,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); } } - } else if(t==PT_URAN&&cmode == 6) + } else if(t==PT_URAN&&cmode == CM_FANCY) { int tempx; int tempy; @@ -1513,7 +1549,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); } } - } else if(t==PT_SLTW&&cmode == 6) + } else if(t==PT_SLTW&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1528,7 +1564,7 @@ void draw_parts(pixel *vid) } else if(t==PT_PHOT) { - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { cg = 0; cb = 0; @@ -1595,7 +1631,7 @@ void draw_parts(pixel *vid) y = ny; blendpixel(vid,x,y,17,217,24,255); } - else if(t==PT_LNTG&&cmode == 6) + else if(t==PT_LNTG&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1610,7 +1646,7 @@ void draw_parts(pixel *vid) } else if(t==PT_SMKE) { - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { x = nx/CELL; y = ny/CELL; @@ -1643,7 +1679,7 @@ void draw_parts(pixel *vid) } } } - else if(t==PT_WATR&&cmode == 6) + else if(t==PT_WATR&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1656,7 +1692,7 @@ void draw_parts(pixel *vid) } } - } else if(t==PT_DSTW&&cmode == 6) + } else if(t==PT_DSTW&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1669,7 +1705,7 @@ void draw_parts(pixel *vid) } } } - else if(t==PT_NITR&&cmode == 6) + else if(t==PT_NITR&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1683,7 +1719,7 @@ void draw_parts(pixel *vid) } } - else if(t==PT_LRBD&&cmode == 6) + else if(t==PT_LRBD&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1698,7 +1734,7 @@ void draw_parts(pixel *vid) } - else if(t==PT_NBLE&&cmode == 6) + else if(t==PT_NBLE&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1714,7 +1750,7 @@ void draw_parts(pixel *vid) } } - else if(t==PT_GAS&&cmode == 6) + else if(t==PT_GAS&&cmode == CM_FANCY) { for(x=-1; x<=1; x++) { @@ -1732,7 +1768,7 @@ void draw_parts(pixel *vid) } else if(t==PT_WTRV) { - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { x = nx/CELL; y = ny/CELL; @@ -1767,7 +1803,7 @@ void draw_parts(pixel *vid) } else if(t==PT_THDR) { - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; cg = 16; @@ -1812,7 +1848,7 @@ void draw_parts(pixel *vid) fr = 2 * pv[ny/CELL][nx/CELL]; } vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { x = nx/CELL; y = ny/CELL; @@ -1826,7 +1862,7 @@ void draw_parts(pixel *vid) if(fr > 255) fr = 255; fire_r[y][x] = fr; } - if(cmode == 4) { + if(cmode == CM_BLOB) { uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); @@ -1846,7 +1882,7 @@ void draw_parts(pixel *vid) { uint8 GR = 0x50+(parts[i].life*10); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, GR); - if(cmode == 4) { + if(cmode == CM_BLOB) { blendpixel(vid, nx+1, ny, GR, GR, GR, 223); blendpixel(vid, nx-1, ny, GR, GR, GR, 223); blendpixel(vid, nx, ny+1, GR, GR, GR, 223); @@ -1862,7 +1898,7 @@ void draw_parts(pixel *vid) { uint8 GR = 0x3B+(parts[i].life*19); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, 10); - if(cmode == 4) { + if(cmode == CM_BLOB) { blendpixel(vid, nx+1, ny, GR, GR, 10, 223); blendpixel(vid, nx-1, ny, GR, GR, 10, 223); blendpixel(vid, nx, ny+1, GR, GR, 10, 223); @@ -1878,7 +1914,7 @@ void draw_parts(pixel *vid) { uint8 GR = 0x3B+(parts[i].life*19); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, 10, 10); - if(cmode == 4) { + if(cmode == CM_BLOB) { blendpixel(vid, nx+1, ny, GR, 10, 10, 223); blendpixel(vid, nx-1, ny, GR, 10, 10, 223); blendpixel(vid, nx, ny+1, GR, 10, 10, 223); @@ -1897,7 +1933,7 @@ void draw_parts(pixel *vid) uint8 R = plasma_data[caddress]; uint8 G = plasma_data[caddress+1]; uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { cr = R/8; cg = G/8; @@ -1936,7 +1972,7 @@ void draw_parts(pixel *vid) uint8 R = hflm_data[caddress]; uint8 G = hflm_data[caddress+1]; uint8 B = hflm_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { cr = R/8; cg = G/8; @@ -1975,7 +2011,7 @@ void draw_parts(pixel *vid) uint8 R = firw_data[caddress]; uint8 G = firw_data[caddress+1]; uint8 B = firw_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { cr = R/2; cg = G/2; @@ -2015,7 +2051,7 @@ void draw_parts(pixel *vid) uint8 R = flm_data[caddress]; uint8 G = flm_data[caddress+1]; uint8 B = flm_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { cr = R/8; cg = G/8; @@ -2103,7 +2139,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny, cr, cg, cb, 64); blendpixel(vid, nx, ny+1, cr, cg, cb, 64); blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { cr /= 32; cg /= 32; @@ -2124,7 +2160,7 @@ void draw_parts(pixel *vid) else if(t==PT_LAVA || t==PT_SPRK) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4 || cmode==6) + if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) { if(t == PT_LAVA) { @@ -2193,7 +2229,7 @@ void draw_parts(pixel *vid) //blendpixel(vid, nx+1, ny, R, G, B, 255); } } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3)) + if(cmode == CM_BLOB&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3)) { if(t==PT_PHOT) { cg = 0; diff --git a/src/interface.c b/src/interface.c index 7fae8544b..8f0a5590e 100644 --- a/src/interface.c +++ b/src/interface.c @@ -528,29 +528,29 @@ void draw_svf_ui(pixel *vid_buf) switch(cmode) { - case 0: + case CM_VEL: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); break; - case 1: + case CM_PRESS: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); break; - case 2: + case CM_PERS: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); break; - case 3: + case CM_FIRE: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); break; - case 4: + case CM_BLOB: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); break; - case 5: + case CM_HEAT: drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); break; - case 6: + case CM_FANCY: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); - case 7: + case CM_NOTHING: drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255); break; } @@ -1741,39 +1741,39 @@ void set_cmode(int cm) { cmode = cm; itc = 51; - if(cmode==4) + if(cmode==CM_BLOB) { memset(fire_r, 0, sizeof(fire_r)); memset(fire_g, 0, sizeof(fire_g)); memset(fire_b, 0, sizeof(fire_b)); strcpy(itc_msg, "Blob Display"); } - else if(cmode==5) + else if(cmode==CM_HEAT) { strcpy(itc_msg, "Heat Display"); } - else if(cmode==6) + else if(cmode==CM_FANCY) { memset(fire_r, 0, sizeof(fire_r)); memset(fire_g, 0, sizeof(fire_g)); memset(fire_b, 0, sizeof(fire_b)); strcpy(itc_msg, "Fancy Display"); } - else if(cmode==3) + else if(cmode==CM_FIRE) { memset(fire_r, 0, sizeof(fire_r)); memset(fire_g, 0, sizeof(fire_g)); memset(fire_b, 0, sizeof(fire_b)); strcpy(itc_msg, "Fire Display"); } - else if(cmode==2) + else if(cmode==CM_PERS) { memset(fire_bg, 0, XRES*YRES*PIXELSIZE); strcpy(itc_msg, "Persistent Display"); } - else if(cmode==1) + else if(cmode==CM_PRESS) strcpy(itc_msg, "Pressure Display"); - else if(cmode==7) + else if(cmode==CM_NOTHING) strcpy(itc_msg, "Cracker Display"); else strcpy(itc_msg, "Velocity Display"); diff --git a/src/main.c b/src/main.c index 8bb917a92..1ce25ba65 100644 --- a/src/main.c +++ b/src/main.c @@ -530,6 +530,8 @@ int parse_save(void *save, int size, int replace, int x0, int y0) else if(i < nf) { parts[fp[i]].type = j; + if(j == PT_COAL) + parts[fp[i]].tmp = 50; if(j == PT_PHOT) parts[fp[i]].ctype = 0x3fffffff; parts[fp[i]].x = (float)x; @@ -1123,11 +1125,11 @@ int main(int argc, char *argv[]) #ifdef OpenGL ClearScreen(); #else - if(cmode==0 || cmode==1) + if(cmode==CM_VEL || cmode==CM_PRESS) { draw_air(vid_buf); } - else if(cmode==2) + else if(cmode==CM_PERS) { memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); @@ -1140,7 +1142,7 @@ int main(int argc, char *argv[]) update_particles(vid_buf); draw_parts(vid_buf); - if(cmode==2) + if(cmode==CM_PERS) { if(!fire_fc) { @@ -1152,7 +1154,7 @@ int main(int argc, char *argv[]) } fire_fc = (fire_fc+1) % 3; } - if(cmode==3||cmode==4||cmode==6) + if(cmode==CM_FIRE||cmode==CM_BLOB||cmode==CM_FANCY) render_fire(vid_buf); render_signs(vid_buf); @@ -1240,35 +1242,35 @@ int main(int argc, char *argv[]) } if(sdl_key=='1') { - set_cmode(0); + set_cmode(CM_VEL); } if(sdl_key=='2') { - set_cmode(1); + set_cmode(CM_PRESS); } if(sdl_key=='3') { - set_cmode(2); + set_cmode(CM_PERS); } if(sdl_key=='4') { - set_cmode(3); + set_cmode(CM_FIRE); } if(sdl_key=='5') { - set_cmode(4); + set_cmode(CM_BLOB); } if(sdl_key=='6') { - set_cmode(5); + set_cmode(CM_HEAT); } if(sdl_key=='7') { - set_cmode(6); + set_cmode(CM_FANCY); } - if(sdl_key=='8') + if(sdl_key=='8') { - set_cmode(7); + set_cmode(CM_NOTHING); } if(sdl_key==SDLK_LEFTBRACKET) { if(sdl_zoom_trig==1) @@ -1349,7 +1351,7 @@ int main(int argc, char *argv[]) } else if(sdl_key=='c') { - set_cmode((cmode+1) % 8); + set_cmode((cmode+1) % CM_COUNT); if(it > 50) it = 50; } @@ -1786,9 +1788,9 @@ int main(int argc, char *argv[]) if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 8); + set_cmode((cmode+1) % CM_COUNT); if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+7) % 8); + set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT); save_presets(0); } if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) diff --git a/src/powder.c b/src/powder.c index fa9f02b3c..714ebcd3b 100644 --- a/src/powder.c +++ b/src/powder.c @@ -830,6 +830,49 @@ void update_particles_i(pixel *vid, int start, int inc) int starti = (start*-1); if(sys_pause&&!framerender) return; + + if(ISLOVE==1) + { + for(ny=4;ny>8)>=NPART || !r) + { + continue; + } + if(parts[r>>8].type==PT_LOVE) + { + love[nx/9][ny/9] = 1; + } + + } + } + for(nx=0;nx<=XRES-4;nx++) + { + for(ny=0;ny<=YRES-4;ny++) + { + if(love[nx/9][ny/9]==1) + { + for(int nnx=0;nnx<9;nnx++) + for(int nny=0;nny<9;nny++) + { + rt=pmap[ny+nny][nx+nnx]; + if((rt>>8)>=NPART) + { + continue; + } + if(!rt&&loverule[nnx][nny]==1) + create_part(-1,nx+nnx,ny+nny,PT_LOVE); + if(parts[rt>>8].type==PT_LOVE&&loverule[nnx][nny]==0) + parts[rt>>8].type=PT_NONE; + } + } + love[nx/9][ny/9]=0; + } + } + } if(ISGOL==1&&CGOL>=GSPEED)//GSPEED is frames per generation { for(nx=4;nx1.0f) { @@ -1901,16 +1944,18 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].temp -= 50.0f; ISGOL=1; } + else if(t==PT_LOVE) + ISLOVE=1; else if(t==PT_CRAC) { - if(pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3) - { + if(pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3) + { for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r || parts[i].temp>374.0f) + if((r>>8)>=NPART || !r || parts[i].temp>374.0f) continue; if(parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1) { @@ -1963,7 +2008,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - for(nx=-1; nx<2; nx++) + for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && x+nx=374) - for(nx=-1; nx<2; nx++) + if(parts[i].temp>=374) + for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && x+nx=373.15) + t = parts[i].type = PT_WTRV; for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && @@ -2008,8 +2055,6 @@ void update_particles_i(pixel *vid, int start, int inc) if(pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN)) { t = parts[i].type = PT_RIME; - parts[i].vx = 0; - parts[i].vy = 0; } if(parts[r>>8].type==PT_SPRK) { @@ -2019,6 +2064,8 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_RIME) { + parts[i].vx = 0; + parts[i].vy = 0; for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && @@ -2040,6 +2087,76 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_WTF) + { + int maxlife = ((10000/(parts[i].temp + 1))-1); + if((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1)) + maxlife ++; + if(parts[i].life < maxlife) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r || (parts[i].life >=maxlife)) + continue; + if(parts[r>>8].type==PT_WTF&&33>=rand()/(RAND_MAX/100)+1) + { + if((parts[i].life + parts[r>>8].life + 1) <= maxlife) + { + parts[i].life += parts[r>>8].life + 1; + parts[r>>8].type=PT_NONE; + } + } + } + } + else + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || (parts[i].life<=maxlife)) + continue; + if((bmap[(y+ny)/CELL][(x+nx)/CELL]==8||bmap[(y+ny)/CELL][(x+nx)/CELL]==7||bmap[(y+ny)/CELL][(x+nx)/CELL]==2||bmap[(y+ny)/CELL][(x+nx)/CELL]==1|| + bmap[(y+ny)/CELL][(x+nx)/CELL]==9||bmap[(y+ny)/CELL][(x+nx)/CELL]==10||bmap[(y+ny)/CELL][(x+nx)/CELL]==13)) + continue; + if((!r)&&parts[i].life>=1)//if nothing then create wtf + { + create_part(-1,x+nx,y+ny,PT_WTF); + parts[i].life--; + parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp; + } + } + for(int trade = 0; trade<9;trade ++) + { + nx = rand()%5-2; + ny = rand()%5-2; + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0&&!((r>>8)>=NPART || !r))//diffusion + { + int temp = parts[i].life - parts[r>>8].life; + if(temp ==1) + { + parts[r>>8].life ++; + parts[i].life --; + trade = 9; + } + else if(temp>0) + { + parts[r>>8].life += temp/2; + parts[i].life -= temp/2; + trade = 9; + } + } + } + } + } else if(t==PT_LCRY) { for(nx=-1; nx<2; nx++) @@ -2900,6 +3017,27 @@ killed: create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } + } + if(t==PT_BCLN) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx