From 647e29a31afc399d828574953f161b745de7031d Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Mon, 25 Jul 2011 19:33:19 +0100 Subject: [PATCH] Fix LIFE graphics in blob, nothing and fancy view And some small fixes for switchable element colours --- includes/powder.h | 10 +++---- src/graphics.c | 66 ++++++++++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 8651cd287..7e95ec248 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -460,8 +460,8 @@ static const part_type ptypes[PT_NUM] = {"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, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP}, {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", ST_NONE, TYPE_PART, &update_AMTR}, //Maybe TYPE_ENERGY? {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", ST_SOLID, TYPE_PART, &update_BCOL}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Solid. When activated, duplicates any particles it touches.", ST_NONE, TYPE_SOLID, &update_PCLN}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", ST_NONE, TYPE_SOLID, &update_HSWC}, + {"PCLN", PIXPACK(0x3B3B0A), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Solid. When activated, duplicates any particles it touches.", ST_NONE, TYPE_SOLID, &update_PCLN}, + {"HSWC", PIXPACK(0x3B0A0A), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", ST_NONE, TYPE_SOLID, &update_HSWC}, {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, &update_IRON}, {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT}, {"LIFE", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, @@ -483,7 +483,7 @@ static const part_type ptypes[PT_NUM] = {"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, 1, 100, SC_CRACKER2, 373.0f, 40, "Love...", ST_GAS, TYPE_SOLID, &update_MISC}, {"DEUT", 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, 1, 31, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE, &update_DEUT}, {"WARP", PIXPACK(0x000000), 0.8f, 0.00f * CFDS, 0.9f, 0.70f, -0.1f, 0.0f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, 1, SC_NUCLEAR, R_TEMP +273.15f, 100, "Displaces other elements.", ST_GAS, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_WARP}, - {"PUMP", PIXPACK(0x10103B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 1, 100, SC_POWERED, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", ST_SOLID, TYPE_SOLID, &update_PUMP}, + {"PUMP", PIXPACK(0x0A0A3B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 1, 100, SC_POWERED, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", ST_SOLID, TYPE_SOLID, &update_PUMP}, {"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 1, 1, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 100, "First fireworks made, activated by heat/neutrons.", ST_SOLID, TYPE_PART|PROP_LIFE_DEC, &update_FWRK}, {"PIPE", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, 273.15f, 0, "Moves elements around, read FAQ on website for help.", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_PIPE}, {"FRZZ", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 1, 50, SC_CRACKER2, 90.0f, 46, "FREEZE", ST_SOLID, TYPE_PART, &update_FRZZ}, @@ -539,8 +539,8 @@ static const part_type ptypes[PT_NUM] = {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Black hole (Requires newtonian gravity)", ST_SOLID, TYPE_SOLID, &update_NBHL}, {"WHOL", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "White hole (Requires newtonian gravity)", ST_SOLID, TYPE_SOLID, &update_NWHL}, {"MERC", PIXPACK(0x736B6D), 0.4f, 0.04f * CFDS, 0.94f, 0.80f, 0.0f, 0.3f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 91, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Mercury. Volume changes with temperature, Conductive.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTABSORB|PROP_LIFE_DEC, &update_MERC}, - {"PBCN", PIXPACK(0x3B4010), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN}, - {"GPMP", PIXPACK(0x103B3B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP}, + {"PBCN", PIXPACK(0x3B1D0A), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN}, + {"GPMP", PIXPACK(0x0A3B3B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP}, {"CLST", PIXPACK(0xE4A4A4), 0.7f, 0.02f * CFDS, 0.94f, 0.95f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Clay dust. Produces paste when mixed with water.", ST_SOLID, TYPE_PART, &update_CLST}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description }; diff --git a/src/graphics.c b/src/graphics.c index e91ad86fa..15050f1ee 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1776,7 +1776,7 @@ void draw_parts(pixel *vid) draw_line(vid , nx, ny+3, player2[11], player2[12], 100, 100, 255, s); draw_line(vid , player2[11], player2[12], player2[15], player2[16], 100, 100, 255, s); } - if (cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_GPMP && t!=PT_PBCN && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes + if (cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_GPMP && t!=PT_PBCN && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI && t!=PT_LIFE)//nothing display but show needed color changes { if (t==PT_PHOT) { @@ -1835,7 +1835,7 @@ void draw_parts(pixel *vid) t!=PT_PHOT && t!=PT_THDR && t!=PT_SMKE && t!=PT_LCRY && t!=PT_SWCH && t!=PT_PCLN && t!=PT_PUMP && t!=PT_HSWC && t!=PT_FILT && - t!=PT_GPMP && t!=PT_PBCN) + t!=PT_GPMP && t!=PT_PBCN && t!=PT_LIFE) { if (ptypes[parts[i].type].properties&TYPE_LIQUID) //special effects for liquids in fancy mode { @@ -2074,50 +2074,64 @@ void draw_parts(pixel *vid) } else if (t==PT_LIFE && parts[i].ctype>=0 && parts[i].ctype < NGOLALT) { + pixel pc; if (parts[i].ctype==NGT_LOTE)//colors for life states { if (parts[i].tmp==2) - blendpixel(vid, nx, ny, 255, 128, 0, 255); + pc = PIXRGB(255, 128, 0); else if (parts[i].tmp==1) - blendpixel(vid, nx, ny, 255, 255, 0, 255); + pc = PIXRGB(255, 255, 0); else - blendpixel(vid, nx, ny, 255, 0, 0, 255); + pc = PIXRGB(255, 0, 0); } else if (parts[i].ctype==NGT_FRG2)//colors for life states { if (parts[i].tmp==2) - blendpixel(vid, nx, ny, 0, 100, 50, 255); + pc = PIXRGB(0, 100, 50); else - blendpixel(vid, nx, ny, 0, 255, 90, 255); + pc = PIXRGB(0, 255, 90); } else if (parts[i].ctype==NGT_STAR)//colors for life states { if (parts[i].tmp==4) - blendpixel(vid, nx, ny, 0, 0, 128, 255); + pc = PIXRGB(0, 0, 128); else if (parts[i].tmp==3) - blendpixel(vid, nx, ny, 0, 0, 150, 255); + pc = PIXRGB(0, 0, 150); else if (parts[i].tmp==2) - blendpixel(vid, nx, ny, 0, 0, 190, 255); + pc = PIXRGB(0, 0, 190); else if (parts[i].tmp==1) - blendpixel(vid, nx, ny, 0, 0, 230, 255); + pc = PIXRGB(0, 0, 230); else - blendpixel(vid, nx, ny, 0, 0, 70, 255); + pc = PIXRGB(0, 0, 70); } else if (parts[i].ctype==NGT_FROG)//colors for life states { if (parts[i].tmp==2) - blendpixel(vid, nx, ny, 0, 100, 0, 255); + pc = PIXRGB(0, 100, 0); else - blendpixel(vid, nx, ny, 0, 255, 0, 255); + pc = PIXRGB(0, 255, 0); } else if (parts[i].ctype==NGT_BRAN)//colors for life states { if (parts[i].tmp==1) - blendpixel(vid, nx, ny, 150, 150, 0, 255); + pc = PIXRGB(150, 150, 0); else - blendpixel(vid, nx, ny, 255, 255, 0, 255); + pc = PIXRGB(255, 255, 0); } else { - blendpixel(vid, nx, ny, PIXR(gmenu[parts[i].ctype].colour), PIXG(gmenu[parts[i].ctype].colour), PIXB(gmenu[parts[i].ctype].colour), 255); + pc = gmenu[parts[i].ctype].colour; + } + blendpixel(vid, nx, ny, PIXR(pc), PIXG(pc), PIXB(pc), 255); + if (cmode==CM_BLOB) + { + blendpixel(vid, nx+1, ny, PIXR(pc), PIXG(pc), PIXB(pc), 223); + blendpixel(vid, nx-1, ny, PIXR(pc), PIXG(pc), PIXB(pc), 223); + blendpixel(vid, nx, ny+1, PIXR(pc), PIXG(pc), PIXB(pc), 223); + blendpixel(vid, nx, ny-1, PIXR(pc), PIXG(pc), PIXB(pc), 223); + + blendpixel(vid, nx+1, ny-1, PIXR(pc), PIXG(pc), PIXB(pc), 112); + blendpixel(vid, nx-1, ny-1, PIXR(pc), PIXG(pc), PIXB(pc), 112); + blendpixel(vid, nx+1, ny+1, PIXR(pc), PIXG(pc), PIXB(pc), 112); + blendpixel(vid, nx-1, ny+1, PIXR(pc), PIXG(pc), PIXB(pc), 112); } } else if (t==PT_DEUT) @@ -2879,15 +2893,15 @@ void draw_parts(pixel *vid) uint8 GR = 0x3B+((parts[i].life>10?10:parts[i].life)*19); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(10, GR, GR); if (cmode == CM_BLOB) { - blendpixel(vid, nx+1, ny, 10, GR/2, GR, 223); - blendpixel(vid, nx-1, ny, 10, GR/2, GR, 223); - blendpixel(vid, nx, ny+1, 10, GR/2, GR, 223); - blendpixel(vid, nx, ny-1, 10, GR/2, GR, 223); + blendpixel(vid, nx+1, ny, 10, GR, GR, 223); + blendpixel(vid, nx-1, ny, 10, GR, GR, 223); + blendpixel(vid, nx, ny+1, 10, GR, GR, 223); + blendpixel(vid, nx, ny-1, 10, GR, GR, 223); - blendpixel(vid, nx+1, ny-1, 10, GR/2, GR, 112); - blendpixel(vid, nx-1, ny-1, 10, GR/2, GR, 112); - blendpixel(vid, nx+1, ny+1, 10, GR/2, GR, 112); - blendpixel(vid, nx-1, ny+1, 10, GR/2, GR, 112); + blendpixel(vid, nx+1, ny-1, 10, GR, GR, 112); + blendpixel(vid, nx-1, ny-1, 10, GR, GR, 112); + blendpixel(vid, nx+1, ny+1, 10, GR, GR, 112); + blendpixel(vid, nx-1, ny+1, 10, GR, GR, 112); } } else if (t==PT_PLSM) @@ -3293,7 +3307,7 @@ void draw_parts(pixel *vid) } } //blob view! - 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 (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)&&t!=PT_LIFE) { if (t==PT_PHOT) { cg = 0;