From 355dcf50d2292b7505696ffbb85be4daa27a7930 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 2 Sep 2012 21:44:19 +0100 Subject: [PATCH] WOOD and PLNT turn grey when hot, bluish when cold --- includes/powder.h | 3 +++ src/elementdata.c | 4 ++-- src/elements/plnt.c | 19 +++++++++++++++++++ src/elements/wood.c | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/elements/wood.c diff --git a/includes/powder.h b/includes/powder.h index bc9925819..00d9d6858 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -352,6 +352,8 @@ int graphics_EXOT(GRAPHICS_FUNC_ARGS); int graphics_WARP(GRAPHICS_FUNC_ARGS); int graphics_EMBR(GRAPHICS_FUNC_ARGS); int graphics_BRCK(GRAPHICS_FUNC_ARGS); +int graphics_WOOD(GRAPHICS_FUNC_ARGS); +int graphics_PLNT(GRAPHICS_FUNC_ARGS); void TRON_init_graphics(); @@ -439,6 +441,7 @@ int update_VINE(UPDATE_FUNC_ARGS); int update_WARP(UPDATE_FUNC_ARGS); int update_WATR(UPDATE_FUNC_ARGS); int update_WIFI(UPDATE_FUNC_ARGS); +int update_WOOD(UPDATE_FUNC_ARGS); int update_WTRV(UPDATE_FUNC_ARGS); int update_YEST(UPDATE_FUNC_ARGS); int update_SOAP(UPDATE_FUNC_ARGS); diff --git a/src/elementdata.c b/src/elementdata.c index 2bf00fa2e..7c226c0c4 100644 --- a/src/elementdata.c +++ b/src/elementdata.c @@ -48,10 +48,10 @@ part_type ptypes[PT_NUM] = {"METL", PIXPACK(0x404060), 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_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable.", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, NULL, NULL}, {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water.", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_SPRK, &graphics_SPRK}, {"SNOW", 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_POWDERS, R_TEMP-30.0f+273.15f, 46, "Light particles.", ST_SOLID, TYPE_PART|PROP_LIFE_DEC, &update_ICEI, NULL}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, NULL, NULL}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_WOOD, &graphics_WOOD}, {"NEUT", PIXPACK(0x20E0FF), 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_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", ST_GAS, TYPE_ENERGY|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_NEUT, &graphics_NEUT}, {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", ST_SOLID, TYPE_PART|PROP_NEUTPENETRATE|PROP_RADIOACTIVE, &update_PLUT, NULL}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", ST_SOLID, TYPE_SOLID|PROP_NEUTPENETRATE|PROP_LIFE_DEC, &update_PLNT, NULL}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", ST_SOLID, TYPE_SOLID|PROP_NEUTPENETRATE|PROP_LIFE_DEC, &update_PLNT, &graphics_PLNT}, {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", ST_LIQUID, TYPE_LIQUID|PROP_DEADLY, &update_ACID, &graphics_ACID}, {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", ST_SOLID, TYPE_SOLID, NULL, NULL}, {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", ST_GAS, TYPE_GAS, &update_WTRV, NULL}, diff --git a/src/elements/plnt.c b/src/elements/plnt.c index 8fff1a6f2..3bdfeac6b 100644 --- a/src/elements/plnt.c +++ b/src/elements/plnt.c @@ -66,5 +66,24 @@ int update_PLNT(UPDATE_FUNC_ARGS) { } parts[i].life = 0; } + if (parts[i].temp > 400 && parts[i].temp > parts[i].tmp2) + parts[i].tmp2 = (int)parts[i].temp; + return 0; +} + +int graphics_PLNT(GRAPHICS_FUNC_ARGS) +{ + float maxtemp = fmax(cpart->tmp2,cpart->temp); + if (maxtemp > 300) + { + *colr += (int)restrict_flt((maxtemp-300)/5,0,58); + *colg -= (int)restrict_flt((maxtemp-300)/2,0,102); + *colb += (int)restrict_flt((maxtemp-300)/5,0,70); + } + if (maxtemp < 273) + { + *colg += (int)restrict_flt((273-maxtemp)/4,0,255); + *colb += (int)restrict_flt((273-maxtemp)/1.5,0,255); + } return 0; } diff --git a/src/elements/wood.c b/src/elements/wood.c new file mode 100644 index 000000000..e5fec9a5f --- /dev/null +++ b/src/elements/wood.c @@ -0,0 +1,40 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +int update_WOOD(UPDATE_FUNC_ARGS) { + if (parts[i].temp > 550 && parts[i].temp > parts[i].tmp) + parts[i].tmp = (int)parts[i].temp; + return 0; +} + +int graphics_WOOD(GRAPHICS_FUNC_ARGS) +{ + float maxtemp = fmax(cpart->tmp,cpart->temp); + if (maxtemp > 400) + { + *colr -= (int)restrict_flt((maxtemp-400)/3,0,172); + *colg -= (int)restrict_flt((maxtemp-400)/4,0,140); + *colb -= (int)restrict_flt((maxtemp-400)/20,0,44); + } + if (maxtemp < 273) + { + *colr -= (int)restrict_flt((273-maxtemp)/5,0,40); + *colg += (int)restrict_flt((273-maxtemp)/4,0,40); + *colb += (int)restrict_flt((273-maxtemp)/1.5,0,150); + } + return 0; +}