summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-07-01 10:32:10 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-07-01 10:32:10 (GMT)
commit25a2b52b64a3cbe52f4d9d1b2f39360a29b92c62 (patch)
treefc6a05e396b73e196c9826401bcfd9ea59d8a4d0
parent00ed0f559abd509812c38dde0eb7b265f806e894 (diff)
downloadpowder-25a2b52b64a3cbe52f4d9d1b2f39360a29b92c62.zip
powder-25a2b52b64a3cbe52f4d9d1b2f39360a29b92c62.tar.gz
Savask experimental heat transfer
-rw-r--r--includes/defines.h1
-rw-r--r--includes/powder.h4
-rw-r--r--src/powder.c21
3 files changed, 23 insertions, 3 deletions
diff --git a/includes/defines.h b/includes/defines.h
index 1294ad7..76f9c07 100644
--- a/includes/defines.h
+++ b/includes/defines.h
@@ -120,6 +120,7 @@ typedef unsigned int pixel;
#endif
#define SDEUT
+//#define REALHEAT
typedef unsigned char uint8;
diff --git a/includes/powder.h b/includes/powder.h
index 014f3be..d3e4660 100644
--- a/includes/powder.h
+++ b/includes/powder.h
@@ -443,8 +443,8 @@ static const part_type ptypes[PT_NUM] =
{"GLAS", PIXPACK(0x404040), 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_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", ST_SOLID, TYPE_SOLID | PROP_NEUTPASS | PROP_HOT_GLOW, &update_GLAS},
{"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 100C)", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, &update_NPTCT},
{"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", ST_SOLID, TYPE_PART | PROP_HOT_GLOW, NULL},
- {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_EXPLOSIVE, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", ST_NONE, TYPE_ENERGY, &update_THDR},
- {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot.", ST_NONE, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_PYRO},
+ {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_EXPLOSIVE, 9000.0f +273.15f, 1, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", ST_NONE, TYPE_ENERGY, &update_THDR},
+ {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 10000.0f +273.15f, 5, "Plasma, extremely hot.", ST_NONE, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_PYRO},
{"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", ST_NONE, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", ST_SOLID, TYPE_SOLID, NULL},
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
diff --git a/src/powder.c b/src/powder.c
index 5b81890..3acad8e 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1684,8 +1684,15 @@ void update_particles_i(pixel *vid, int start, int inc)
//heat transfer code
h_count = 0;
+#ifdef REALHEAT
+ if (t&&(t!=PT_HSWC||parts[i].life==10))
+ {
+ float c_Cm = 0.0f;
+#else
if (t&&(t!=PT_HSWC||parts[i].life==10)&&ptypes[t].hconduct>(rand()%250))
{
+ float c_Cm = 0.0f;
+#endif
if (aheat_enable)
{
c_heat = (hv[y/CELL][x/CELL]-parts[i].temp)*0.04;
@@ -1705,12 +1712,24 @@ void update_particles_i(pixel *vid, int start, int inc)
&&(rt!=PT_FILT||(t!=PT_BRAY&&t!=PT_PHOT&&t!=PT_BIZR&&t!=PT_BIZRG)))
{
surround_hconduct[j] = r>>8;
+#ifdef REALHEAT
+ c_heat += parts[r>>8].temp*96.645/ptypes[rt].hconduct*fabs(ptypes[rt].weight);
+ c_Cm += 96.645/ptypes[rt].hconduct*fabs(ptypes[rt].weight);
+#else
c_heat += parts[r>>8].temp;
+#endif
h_count++;
}
}
-
+#ifdef REALHEAT
+ if (t == PT_PHOT)
+ pt = (c_heat+parts[i].temp*96.645)/(c_Cm+96.645);
+ else
+ pt = (c_heat+parts[i].temp*96.645/ptypes[t].hconduct*fabs(ptypes[t].weight))/(c_Cm+96.645/ptypes[t].hconduct*fabs(ptypes[t].weight));
+
+#else
pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1);
+#endif
for (j=0; j<8; j++)
{
parts[surround_hconduct[j]].temp = pt;