From 9a179651ee9826f4c0b7df6c57aa75d8101baf5e Mon Sep 17 00:00:00 2001 From: Jacob1 Date: Thu, 24 May 2012 13:13:28 -0400 Subject: [PATCH] energy type particles automatically go into photons, not pmap --- src/elementdata.c | 4 ++-- src/powder.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/elementdata.c b/src/elementdata.c index 28211274b..6cf8096b8 100644 --- a/src/elementdata.c +++ b/src/elementdata.c @@ -79,8 +79,8 @@ 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_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}, + {"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}, + {"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}, {"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, 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, &update_NBLE, NULL}, diff --git a/src/powder.c b/src/powder.c index e3e8c182b..a1187b1a6 100644 --- a/src/powder.c +++ b/src/powder.c @@ -176,6 +176,7 @@ void init_can_move() //whol eats anar can_move[PT_ANAR][PT_WHOL] = 1; can_move[PT_ANAR][PT_NWHL] = 1; + can_move[PT_THDR][PT_THDR] = 2; } /* @@ -257,7 +258,7 @@ int try_move(int i, int x, int y, int nx, int ny) if (!e) //if no movement { - if (parts[i].type!=PT_NEUT && parts[i].type!=PT_PHOT && parts[i].type!=PT_ELEC) + if (!(ptypes[parts[i].type].properties & TYPE_ENERGY)) return 0; if (!legacy_enable && parts[i].type==PT_PHOT && r)//PHOT heat conduction { @@ -271,7 +272,7 @@ int try_move(int i, int x, int y, int nx, int ny) if (!parts[r>>8].ctype) parts[r>>8].ctype = parts[i].type; } - if ((r&0xFF)==PT_PRTI && (parts[i].type==PT_PHOT || parts[i].type==PT_NEUT || parts[i].type==PT_ELEC)) + if ((r&0xFF)==PT_PRTI && (ptypes[parts[i].type].properties & TYPE_ENERGY)) { int nnx, count; for (count=0; count<8; count++) @@ -427,7 +428,7 @@ int do_move(int i, int x, int y, float nxf, float nyf) kill_part(i); return -1; } - if (t==PT_PHOT||t==PT_NEUT||t==PT_ELEC) + if (ptypes[t].properties & TYPE_ENERGY) photons[ny][nx] = t|(i<<8); else if (t) pmap[ny][nx] = t|(i<<8); @@ -678,7 +679,7 @@ inline void part_change_type(int i, int x, int y, int t)//changes the type of pa } parts[i].type = t; - if (t==PT_PHOT || t==PT_NEUT || t==PT_ELEC) + if (ptypes[t].properties & TYPE_ENERGY) { photons[y][x] = t|(i<<8); if ((pmap[y][x]>>8)==i) @@ -845,7 +846,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a } return -1; } - if (photons[y][x] && (t==PT_PHOT||t==PT_NEUT||t==PT_ELEC)) + if (photons[y][x] && (ptypes[t].properties & TYPE_ENERGY)) return -1; if (pfree == -1) return -1; @@ -1106,7 +1107,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a if (t==PT_BIZR||t==PT_BIZRG||t==PT_BIZRS) parts[i].ctype = 0x47FFFF; //and finally set the pmap/photon maps to the newly created particle - if (t==PT_PHOT||t==PT_NEUT||t==PT_ELEC) + if (ptypes[t].properties & TYPE_ENERGY) photons[y][x] = t|(i<<8); else if (t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH) pmap[y][x] = t|(i<<8); @@ -2351,7 +2352,7 @@ killed: stagnant = parts[i].flags & FLAG_STAGNANT; parts[i].flags &= ~FLAG_STAGNANT; - if ((t==PT_PHOT||t==PT_NEUT||t==PT_ELEC)) { + if (ptypes[t].properties & TYPE_ENERGY) { if (t == PT_PHOT) { if (parts[i].flags&FLAG_SKIPMOVE) { @@ -2752,7 +2753,7 @@ void update_particles(pixel *vid)//doesn't update the particles themselves, but y = (int)(parts[i].y+0.5f); if (x>=0 && y>=0 && x