From 8b20bfd764308fddc1280b8a9d030e77503d0b0c Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 9 Jun 2012 11:08:11 +0100 Subject: [PATCH] Make THDR TYPE_ENERGY again, so it goes in photon map Will simplify checking for excessive stacking --- src/elementdata.c | 2 +- src/elements/firw.c | 2 ++ src/elements/ligh.c | 4 ++-- src/elements/neut.c | 4 ++-- src/elements/thdr.c | 2 +- src/graphics.c | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/elementdata.c b/src/elementdata.c index 68fa3e3c4..459b9b146 100644 --- a/src/elementdata.c +++ b/src/elementdata.c @@ -79,7 +79,7 @@ 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, 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 | PROP_SPARKSETTLE, &update_GLAS, NULL}, {"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, 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, NULL}, {"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, 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, 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, 1, SC_EXPLOSIVE, 9000.0f +273.15f, 1, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", ST_NONE, TYPE_PART, &update_THDR, &graphics_THDR}, + {"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, 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, &graphics_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, 1, SC_GAS, 10000.0f +273.15f, 5, "Plasma, extremely hot.", ST_NONE, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_PYRO, &graphics_PLSM}, {"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, 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, 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, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", ST_SOLID, TYPE_SOLID, NULL, NULL}, diff --git a/src/elements/firw.c b/src/elements/firw.c index 5bb8f3d88..52a783fd8 100644 --- a/src/elements/firw.c +++ b/src/elements/firw.c @@ -23,6 +23,8 @@ int update_FIRW(UPDATE_FUNC_ARGS) { if (x+rx>=0 && y+ry>0 && x+rx>8].type; diff --git a/src/elements/ligh.c b/src/elements/ligh.c index 146ba1fcb..61bf8f70e 100644 --- a/src/elements/ligh.c +++ b/src/elements/ligh.c @@ -27,7 +27,7 @@ int LIGH_nearest_part(int ci, int max_d) int cy = (int)parts[ci].y; for (i=0; i<=parts_lastActiveIndex; i++) { - if (parts[i].type && !parts[i].life && i!=ci && parts[i].type!=PT_LIGH && parts[i].type!=PT_THDR && parts[i].type!=PT_NEUT && parts[i].type!=PT_PHOT) + if (parts[i].type && i!=ci && parts[i].type!=PT_LIGH && !(ptypes[parts[i].type].properties&TYPE_ENERGY)) { ndistance = abs(cx-parts[i].x)+abs(cy-parts[i].y);// Faster but less accurate Older: sqrt(pow(cx-parts[i].x, 2)+pow(cy-parts[i].y, 2)); if (ndistance>8].life==0) { diff --git a/src/elements/neut.c b/src/elements/neut.c index e3593f57a..bbaa3bd96 100644 --- a/src/elements/neut.c +++ b/src/elements/neut.c @@ -51,9 +51,9 @@ int create_n_parts(int n, int x, int y, float vx, float vy, float temp, int t)// parts[i].ctype = 0; parts[i].temp = temp; parts[i].tmp = 0; - if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT && t!=PT_NEUT && !pmap[y][x]) + if (t!=PT_STKM&&t!=PT_STKM2 && !(ptypes[t].properties&TYPE_ENERGY) && !pmap[y][x]) pmap[y][x] = t|(i<<8); - else if ((t==PT_PHOT||t==PT_NEUT) && !photons[y][x]) + else if ((ptypes[t].properties&TYPE_ENERGY) && !photons[y][x]) photons[y][x] = t|(i<<8); pv[y/CELL][x/CELL] += 6.0f * CFDS; diff --git a/src/elements/thdr.c b/src/elements/thdr.c index f1aafa3c8..d400ecb38 100644 --- a/src/elements/thdr.c +++ b/src/elements/thdr.c @@ -31,7 +31,7 @@ int update_THDR(UPDATE_FUNC_ARGS) { part_change_type(r>>8,x+rx,y+ry,PT_SPRK); parts[r>>8].life = 4; } - else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&!(ptypes[r&0xFF].properties&TYPE_ENERGY)&&(r&0xFF)) { pv[y/CELL][x/CELL] += 100.0f; if (legacy_enable&&1>(rand()%200)) diff --git a/src/graphics.c b/src/graphics.c index c82a20a95..0f3a47450 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1808,7 +1808,7 @@ void render_parts(pixel *vid) #endif - if(photons[ny][nx]&0xFF && !(ptypes[t].properties & TYPE_ENERGY) && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH) + if((photons[ny][nx]&0xFF) && !(ptypes[t].properties & TYPE_ENERGY) && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH) continue; //Defaults