More function pointers.
This commit is contained in:
parent
b661418d7e
commit
f3ded5f08c
@ -223,13 +223,35 @@
|
||||
|
||||
#define UPDATE_FUNC_ARGS int i, int x, int y, int nx, int ny, float lx, float ly
|
||||
|
||||
int update_ACID(UPDATE_FUNC_ARGS);
|
||||
int update_ARAY(UPDATE_FUNC_ARGS);
|
||||
int update_BCOL(UPDATE_FUNC_ARGS);
|
||||
int update_BMTL(UPDATE_FUNC_ARGS);
|
||||
int update_COAL(UPDATE_FUNC_ARGS);
|
||||
int update_DEUT(UPDATE_FUNC_ARGS);
|
||||
int update_DSTW(UPDATE_FUNC_ARGS);
|
||||
int update_FOG(UPDATE_FUNC_ARGS);
|
||||
int update_FRZZ(UPDATE_FUNC_ARGS);
|
||||
int update_FSEP(UPDATE_FUNC_ARGS);
|
||||
int update_FUSE(UPDATE_FUNC_ARGS);
|
||||
int update_GLOW(UPDATE_FUNC_ARGS);
|
||||
int update_IRON(UPDATE_FUNC_ARGS);
|
||||
int update_PCLN(UPDATE_FUNC_ARGS);
|
||||
int update_PHOT(UPDATE_FUNC_ARGS);
|
||||
int update_PSTE(UPDATE_FUNC_ARGS);
|
||||
int update_PIPE(UPDATE_FUNC_ARGS);
|
||||
int update_PLNT(UPDATE_FUNC_ARGS);
|
||||
int update_RIME(UPDATE_FUNC_ARGS);
|
||||
int update_SLTW(UPDATE_FUNC_ARGS);
|
||||
int update_SPAWN(UPDATE_FUNC_ARGS);
|
||||
int update_SPAWN2(UPDATE_FUNC_ARGS);
|
||||
int update_SPNG(UPDATE_FUNC_ARGS);
|
||||
int update_STKM(UPDATE_FUNC_ARGS);
|
||||
int update_STKM2(UPDATE_FUNC_ARGS);
|
||||
int update_THDR(UPDATE_FUNC_ARGS);
|
||||
int update_THRM(UPDATE_FUNC_ARGS);
|
||||
int update_VINE(UPDATE_FUNC_ARGS);
|
||||
int update_WATR(UPDATE_FUNC_ARGS);
|
||||
int update_WTRV(UPDATE_FUNC_ARGS);
|
||||
|
||||
|
||||
struct particle
|
||||
@ -313,7 +335,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins Description
|
||||
{"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles.", 0, NULL},
|
||||
{"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", TYPE_PART, NULL},
|
||||
{"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, NULL},
|
||||
{"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, &update_WATR},
|
||||
{"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable.", TYPE_LIQUID, NULL},
|
||||
{"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air.", TYPE_GAS, NULL},
|
||||
{"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable.", TYPE_PART, NULL},
|
||||
@ -331,16 +353,16 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable.", TYPE_SOLID, NULL},
|
||||
{"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, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", TYPE_ENERGY, NULL},
|
||||
{"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, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", TYPE_PART|PROP_NEUTPENETRATE|PROP_RADIOACTIVE, 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, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", TYPE_SOLID, NULL},
|
||||
{"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, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", TYPE_LIQUID, 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, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", TYPE_SOLID, &update_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, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", TYPE_LIQUID, &update_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, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", TYPE_SOLID, 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, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", TYPE_GAS, 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, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", TYPE_GAS, &update_WTRV},
|
||||
{"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", TYPE_PART, NULL},
|
||||
{"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity.", TYPE_LIQUID|PROP_NEUTPENETRATE, NULL},
|
||||
{"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity.", TYPE_LIQUID|PROP_NEUTPENETRATE, &update_DSTW},
|
||||
{"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water.", TYPE_PART, NULL},
|
||||
{"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, NULL},
|
||||
{"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, &update_SLTW},
|
||||
{"DMND", PIXPACK(0xCCFFFF), 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_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable.", TYPE_SOLID, NULL}, //ief015 - Added diamond. Because concrete blocks are kinda pointless.
|
||||
{"BMTL", PIXPACK(0x505070), 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal.", TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
|
||||
{"BMTL", PIXPACK(0x505070), 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal.", TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, &update_BMTL},
|
||||
{"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal.", TYPE_PART|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
|
||||
{"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines.", TYPE_ENERGY, &update_PHOT},
|
||||
{"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure.", TYPE_PART | PROP_RADIOACTIVE, NULL},
|
||||
@ -370,24 +392,24 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)", TYPE_SOLID, NULL},
|
||||
{"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke", TYPE_GAS, NULL},
|
||||
{"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures", TYPE_LIQUID, NULL},
|
||||
{"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly.", TYPE_SOLID, NULL},
|
||||
{"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly.", TYPE_SOLID, &update_COAL},
|
||||
{"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire", TYPE_LIQUID, NULL},
|
||||
{"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily.", TYPE_GAS, NULL},
|
||||
{"INWR", PIXPACK(0x544141), 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, "Insulated Wire. Doesn't conduct to metal or semiconductors.", TYPE_SOLID, NULL},
|
||||
{"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", TYPE_PART, NULL},
|
||||
{"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", TYPE_PART, NULL},
|
||||
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature.", TYPE_PART, NULL},
|
||||
{"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", TYPE_LIQUID, NULL},
|
||||
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature.", TYPE_PART, &update_THRM},
|
||||
{"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", TYPE_LIQUID, &update_GLOW},
|
||||
{"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", TYPE_SOLID|PROP_HOT_GLOW, NULL},
|
||||
{"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", TYPE_GAS, NULL},
|
||||
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", TYPE_PART, NULL},
|
||||
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", TYPE_SOLID, NULL},
|
||||
{"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, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", TYPE_PART, NULL},
|
||||
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", TYPE_SOLID, &update_FUSE},
|
||||
{"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, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", 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, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", TYPE_PART, NULL}, //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, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", TYPE_PART, NULL},
|
||||
{"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, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", 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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches.", 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, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", TYPE_SOLID, NULL},
|
||||
{"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, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR", TYPE_SOLID, NULL},
|
||||
{"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, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR", TYPE_SOLID, &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, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", TYPE_PART, NULL},
|
||||
{"GOL ", 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, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"HLIF", PIXPACK(0xFF0000), 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_LIFE, 9000.0f, 40, "High Life! B36/S23", TYPE_SOLID|PROP_LIFE, NULL},
|
||||
@ -401,17 +423,17 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"34 ", PIXPACK(0x500050), 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_LIFE, 9000.0f, 40, "34! B34/S34)", TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"LLIF", PIXPACK(0x505050), 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_LIFE, 9000.0f, 40, "Long Life! B345/S5", TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"STAN", PIXPACK(0x5000FF), 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_LIFE, 9000.0f, 40, "Stains! B3678/S235678", TYPE_SOLID|PROP_LIFE, NULL},
|
||||
{"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.",TYPE_SOLID, NULL},
|
||||
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_CRACKER2, 243.15f, 100, "Not quite Ice",TYPE_SOLID, NULL},
|
||||
{"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_CRACKER2, 243.15f, 100, "Not quite Steam",TYPE_GAS, NULL},
|
||||
{"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.",TYPE_SOLID, &update_SPNG},
|
||||
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_CRACKER2, 243.15f, 100, "Not quite Ice",TYPE_SOLID, &update_FOG},
|
||||
{"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_CRACKER2, 243.15f, 100, "Not quite Steam",TYPE_GAS, &update_RIME},
|
||||
{"BCLN", PIXPACK(0xFFD040), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", TYPE_SOLID, NULL},
|
||||
{"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, 100, SC_CRACKER2, 373.0f, 40, "Love...", TYPE_SOLID, NULL},
|
||||
{"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, 31, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", TYPE_LIQUID|PROP_NEUTPENETRATE, NULL},
|
||||
{"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, 31, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", 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, SC_NUCLEAR, R_TEMP +273.15f, 100, "Displaces other elements.",TYPE_GAS, NULL},
|
||||
{"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, 100, SC_ELEC, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", TYPE_SOLID, NULL},
|
||||
{"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, 97, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 100, "First fireworks made, activated by heat/neutrons.", TYPE_PART, NULL},
|
||||
{"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, 100, SC_SOLIDS, 273.15f, 0, "Moves elements around, read FAQ on website for help.", TYPE_SOLID, NULL},
|
||||
{"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, 50, SC_CRACKER2, 90.0f, 46, "FREEZE", TYPE_PART, NULL},
|
||||
{"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, 100, SC_SOLIDS, 273.15f, 0, "Moves elements around, read FAQ on website for help.", TYPE_SOLID, &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, 50, SC_CRACKER2, 90.0f, 46, "FREEZE", TYPE_PART, &update_FRZZ},
|
||||
{"FRZW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_CRACKER2, 120.0f, 29, "FREEZE WATER", TYPE_LIQUID, NULL},
|
||||
{"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Changes colour based on velocity.", TYPE_PART, NULL},
|
||||
{"BIZR", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP+0.0f +273.15f, 29, "Bizarre... contradicts the normal state changes.", TYPE_LIQUID, NULL},
|
||||
@ -422,10 +444,10 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID, NULL},
|
||||
{"PRTI", PIXPACK(0xEB5917), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal IN. Things go in here. Alter temperature for channels", TYPE_SOLID, NULL},
|
||||
{"PRTO", PIXPACK(0x0020EB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal OUT. Things come out here. Alter temperature for channels", TYPE_SOLID, NULL},
|
||||
{"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", TYPE_LIQUID, &update_PSTE},
|
||||
{"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", TYPE_LIQUID, NULL},
|
||||
{"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Solid form of PSTE, temporary", TYPE_SOLID, NULL},
|
||||
{"ANAR", PIXPACK(0xFFFFEE), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite gravity", TYPE_PART, NULL},
|
||||
{"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID, NULL},
|
||||
{"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID, &update_VINE},
|
||||
{"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID | PROP_NEUTPASS, NULL},
|
||||
{"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER2, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART, NULL},
|
||||
{"SPWN2", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0, &update_SPAWN2},
|
||||
@ -437,7 +459,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"LOLZ", PIXPACK(0x569212), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_CRACKER2, 373.0f, 40, "Lolz", TYPE_SOLID, NULL},
|
||||
{"WIFI", PIXPACK(0x40A060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 2, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 0, "Wireless transmitter, color coded.", TYPE_SOLID, NULL},
|
||||
{"FILT", PIXPACK(0x000056), 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID, NULL},
|
||||
{"ARAY", PIXPACK(0xFFBB00), 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, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL},
|
||||
{"ARAY", PIXPACK(0xFFBB00), 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, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, &update_ARAY},
|
||||
{"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL},
|
||||
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, &update_STKM2},
|
||||
{"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", TYPE_PART, NULL},
|
||||
|
39
src/elements/acid.c
Normal file
39
src/elements/acid.c
Normal file
@ -0,0 +1,39 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_ACID(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_ACID)
|
||||
{
|
||||
if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD)
|
||||
{
|
||||
parts[i].type = PT_FIRE;
|
||||
parts[i].life = 4;
|
||||
parts[r>>8].type = PT_FIRE;
|
||||
parts[r>>8].life = 4;
|
||||
}
|
||||
else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50)
|
||||
{
|
||||
if (parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS)
|
||||
{
|
||||
parts[i].life--;
|
||||
parts[r>>8].type = PT_NONE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (parts[i].life<=50)
|
||||
{
|
||||
parts[i].life = 0;
|
||||
parts[i].type = PT_NONE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
76
src/elements/aray.c
Normal file
76
src/elements/aray.c
Normal file
@ -0,0 +1,76 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_ARAY(UPDATE_FUNC_ARGS) {
|
||||
int r, nxx, nyy, docontinue, nxi, nyi;
|
||||
if (parts[i].life==0) {
|
||||
int colored =0;
|
||||
for (nx=-1; nx<2; nx++) {
|
||||
for (ny=-1; ny<2; ny++) {
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) {
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SPRK) {
|
||||
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
|
||||
int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
|
||||
for (docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
|
||||
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
|
||||
break;
|
||||
}
|
||||
r = pmap[y+nyi+nyy][x+nxi+nxx];
|
||||
if (!((r>>8)>=NPART)) {
|
||||
if (!r) {
|
||||
int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
|
||||
if (nr!=-1) {
|
||||
if (destroy) {
|
||||
parts[nr].tmp = 2;
|
||||
parts[nr].life = 2;
|
||||
} else
|
||||
parts[nr].ctype = colored;
|
||||
}
|
||||
} else if (!destroy) {
|
||||
if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0) {
|
||||
if (nyy!=0 || nxx!=0) {
|
||||
parts[r>>8].type = PT_BRAY;
|
||||
parts[r>>8].life = 1020;
|
||||
parts[r>>8].tmp = 1;
|
||||
if (!parts[r>>8].ctype)
|
||||
parts[r>>8].ctype = colored;
|
||||
}
|
||||
docontinue = 0;
|
||||
} else if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1) {
|
||||
parts[r>>8].life = 1020;
|
||||
//docontinue = 1;
|
||||
}
|
||||
else if (parts[r>>8].type==PT_FILT) {
|
||||
colored = parts[r>>8].ctype;
|
||||
} else if (parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY && parts[r>>8].type!=PT_WIFI) {
|
||||
if (nyy!=0 || nxx!=0) {
|
||||
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
|
||||
}
|
||||
if (!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) {
|
||||
docontinue = 0;
|
||||
} else {
|
||||
docontinue = 1;
|
||||
}
|
||||
}
|
||||
} else if (destroy) {
|
||||
if (parts[r>>8].type==PT_BRAY) {
|
||||
parts[r>>8].life = 1;
|
||||
docontinue = 1;
|
||||
} else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI) {
|
||||
docontinue = 1;
|
||||
} else {
|
||||
docontinue = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//parts[i].life = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
31
src/elements/bcol.c
Normal file
31
src/elements/bcol.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_BCOL(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life<=0) {
|
||||
parts[i].type = PT_NONE;
|
||||
kill_part(i);
|
||||
create_part(-1, x, y, PT_FIRE);
|
||||
return 1;
|
||||
} else if (parts[i].life < 100) {
|
||||
parts[i].life--;
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
|
||||
}
|
||||
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
|
||||
{
|
||||
if (parts[i].life>100) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
26
src/elements/bmtl.c
Normal file
26
src/elements/bmtl.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_BMTL(UPDATE_FUNC_ARGS) {
|
||||
int r, rt;
|
||||
if (parts[i].tmp>1) {
|
||||
parts[i].tmp--;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
rt =parts[r>>8].type;
|
||||
if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
|
||||
{
|
||||
parts[r>>8].type=PT_BMTL;
|
||||
parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
|
||||
}
|
||||
}
|
||||
} else if (parts[i].tmp==1 && 1>rand()%1000) {
|
||||
parts[i].tmp = 0;
|
||||
parts[i].type = PT_BRMT;
|
||||
}
|
||||
return 0;
|
||||
}
|
40
src/elements/coal.c
Normal file
40
src/elements/coal.c
Normal file
@ -0,0 +1,40 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_COAL(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life<=0) {
|
||||
parts[i].type = PT_NONE;
|
||||
kill_part(i);
|
||||
create_part(-1, x, y, PT_FIRE);
|
||||
return 1;
|
||||
} else if (parts[i].life < 100) {
|
||||
parts[i].life--;
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
|
||||
}
|
||||
if ((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40)
|
||||
parts[i].tmp=39;
|
||||
else if (parts[i].tmp<40&&parts[i].tmp>0)
|
||||
parts[i].tmp--;
|
||||
else if (parts[i].tmp<=0) {
|
||||
parts[i].type = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_BCOL);
|
||||
return 1;
|
||||
}
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
|
||||
{
|
||||
if (parts[i].life>100) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
72
src/elements/deut.c
Normal file
72
src/elements/deut.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_DEUT(UPDATE_FUNC_ARGS) {
|
||||
int r, trade;
|
||||
int maxlife = ((10000/(parts[i].temp + 1))-1);
|
||||
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
|
||||
maxlife ++;
|
||||
if (parts[i].life < maxlife)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r || (parts[i].life >=maxlife))
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
|
||||
{
|
||||
if ((parts[i].life + parts[r>>8].life + 1) <= maxlife)
|
||||
{
|
||||
parts[i].life += parts[r>>8].life + 1;
|
||||
parts[r>>8].type=PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || (parts[i].life<=maxlife))
|
||||
continue;
|
||||
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
|
||||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
|
||||
continue;
|
||||
if ((!r)&&parts[i].life>=1)//if nothing then create deut
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_DEUT);
|
||||
parts[i].life--;
|
||||
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
|
||||
parts[pmap[y+ny][x+nx]>>8].life = 0;
|
||||
}
|
||||
}
|
||||
for ( trade = 0; trade<4; trade ++)
|
||||
{
|
||||
nx = rand()%5-2;
|
||||
ny = rand()%5-2;
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_DEUT&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
|
||||
{
|
||||
int temp = parts[i].life - parts[r>>8].life;
|
||||
if (temp ==1)
|
||||
{
|
||||
parts[r>>8].life ++;
|
||||
parts[i].life --;
|
||||
}
|
||||
else if (temp>0)
|
||||
{
|
||||
parts[r>>8].life += temp/2;
|
||||
parts[i].life -= temp/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
37
src/elements/dstw.c
Normal file
37
src/elements/dstw.c
Normal file
@ -0,0 +1,37 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_DSTW(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
|
||||
{
|
||||
parts[i].type = PT_WTRV;
|
||||
}
|
||||
else if ((r&0xFF)==PT_SALT && 1>(rand()%250))
|
||||
{
|
||||
parts[i].type = PT_SLTW;
|
||||
parts[r>>8].type = PT_SLTW;
|
||||
}
|
||||
if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && 1>(rand()%500))
|
||||
{
|
||||
parts[i].type = PT_WATR;
|
||||
}
|
||||
if ((r&0xFF)==PT_SLTW && 1>(rand()%500))
|
||||
{
|
||||
parts[i].type = PT_SLTW;
|
||||
}
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||parts[i].temp>12.0f) && 1>(rand()%500))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
parts[i].type = PT_FIRE;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
25
src/elements/fog.c
Normal file
25
src/elements/fog.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_FOG(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].temp>=373.15)
|
||||
parts[i].type = PT_WTRV;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN))
|
||||
{
|
||||
parts[i].type = PT_RIME;
|
||||
}
|
||||
if (parts[r>>8].type==PT_SPRK)
|
||||
{
|
||||
parts[i].life += rand()%20;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
22
src/elements/frzz.c
Normal file
22
src/elements/frzz.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_FRZZ(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_WATR&&5>rand()%100)
|
||||
{
|
||||
parts[r>>8].type=PT_FRZW;
|
||||
parts[r>>8].life = 100;
|
||||
parts[i].type = PT_NONE;
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
36
src/elements/fsep.c
Normal file
36
src/elements/fsep.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_FSEP(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life<=0) {
|
||||
//t = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
return 1;
|
||||
} else if (parts[i].life < 40) {
|
||||
parts[i].life--;
|
||||
if ((rand()%10)==0) {
|
||||
r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
}
|
||||
}
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
|
||||
{
|
||||
if (parts[i].life>40) {
|
||||
parts[i].life = 39;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
46
src/elements/fuse.c
Normal file
46
src/elements/fuse.c
Normal file
@ -0,0 +1,46 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_FUSE(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life<=0) {
|
||||
//t = parts[i].life = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
return 1;
|
||||
} else if (parts[i].life < 40) {
|
||||
parts[i].life--;
|
||||
if ((rand()%100)==0) {
|
||||
r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
}
|
||||
}
|
||||
if ((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40)
|
||||
parts[i].tmp=39;
|
||||
else if (parts[i].tmp<40&&parts[i].tmp>0)
|
||||
parts[i].tmp--;
|
||||
else if (parts[i].tmp<=0) {
|
||||
//t = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_FSEP);
|
||||
return 1;
|
||||
}
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))
|
||||
{
|
||||
if (parts[i].life>40) {
|
||||
parts[i].life = 39;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
21
src/elements/glow.c
Normal file
21
src/elements/glow.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_GLOW(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_WATR&&5>(rand()%2000))
|
||||
{
|
||||
parts[i].type = PT_NONE;
|
||||
parts[r>>8].type = PT_DEUT;
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
25
src/elements/iron.c
Normal file
25
src/elements/iron.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_IRON(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
|
||||
((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
|
||||
((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
|
||||
((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
|
||||
((r&0xFF) == PT_LO2))&&
|
||||
(!(parts[i].life))
|
||||
)
|
||||
{
|
||||
parts[i].type=PT_BMTL;
|
||||
parts[i].tmp=(rand()/(RAND_MAX/10))+20;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -2,4 +2,5 @@
|
||||
|
||||
int update_(UPDATE_FUNC_ARGS) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -39,4 +39,5 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
121
src/elements/pipe.c
Normal file
121
src/elements/pipe.c
Normal file
@ -0,0 +1,121 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_PIPE(UPDATE_FUNC_ARGS) {
|
||||
int r, trade, q, ctype;
|
||||
if (!parts[i].ctype && parts[i].life<=10)
|
||||
{
|
||||
if (parts[i].temp<272.15)
|
||||
{
|
||||
if (parts[i].temp>173.25&&parts[i].temp<273.15)
|
||||
{
|
||||
parts[i].ctype = 2;
|
||||
parts[i].life = 0;
|
||||
}
|
||||
if (parts[i].temp>73.25&&parts[i].temp<=173.15)
|
||||
{
|
||||
parts[i].ctype = 3;
|
||||
parts[i].life = 0;
|
||||
}
|
||||
if (parts[i].temp>=0&&parts[i].temp<=73.15)
|
||||
{
|
||||
parts[i].ctype = 4;
|
||||
parts[i].life = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART )
|
||||
continue;
|
||||
if (!r)
|
||||
create_part(-1,x+nx,y+ny,PT_BRCK);
|
||||
}
|
||||
if (parts[i].life==1)
|
||||
parts[i].ctype = 1;
|
||||
}
|
||||
}
|
||||
if (parts[i].ctype==1)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if (!r&&!parts[i].life)
|
||||
parts[i].life=50;
|
||||
}
|
||||
if (parts[i].life==2)
|
||||
{
|
||||
parts[i].ctype = 2;
|
||||
parts[i].life = 6;
|
||||
}
|
||||
}
|
||||
if (parts[i].ctype>1)
|
||||
for ( q = 0; q<3; q++)
|
||||
for ( ctype = 2; ctype<5; ctype++)
|
||||
{
|
||||
if (parts[i].ctype==ctype)
|
||||
{
|
||||
if (parts[i].life==3)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1)
|
||||
{
|
||||
parts[r>>8].ctype = (((ctype)%3)+2);//reverse
|
||||
parts[r>>8].life = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nx = rand()%3-1;
|
||||
ny = rand()%3-1;
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
else if (!r&&parts[i].tmp!=0)
|
||||
{
|
||||
if (create_part(-1,x+nx,y+ny,parts[i].tmp))
|
||||
{
|
||||
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;//pipe saves temp and life now
|
||||
parts[pmap[y+ny][x+nx]>>8].life = parts[i].flags;
|
||||
}
|
||||
parts[i].tmp = 0;
|
||||
continue;
|
||||
}
|
||||
else if (!r)
|
||||
continue;
|
||||
else if (parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))
|
||||
{
|
||||
parts[i].tmp = parts[r>>8].type;
|
||||
parts[i].temp = parts[r>>8].temp;
|
||||
parts[i].flags = parts[r>>8].life;
|
||||
parts[r>>8].type = PT_NONE;
|
||||
}
|
||||
else if (parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
|
||||
{
|
||||
parts[r>>8].tmp = parts[i].tmp;
|
||||
parts[r>>8].temp = parts[i].temp;
|
||||
parts[r>>8].flags = parts[i].flags;
|
||||
parts[i].tmp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
61
src/elements/plnt.c
Normal file
61
src/elements/plnt.c
Normal file
@ -0,0 +1,61 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_PLNT(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_WATR && 1>(rand()%250))
|
||||
{
|
||||
parts[i].type = PT_PLNT;
|
||||
parts[r>>8].type = PT_PLNT;
|
||||
parts[r>>8].life = 0;
|
||||
}
|
||||
else if ((r&0xFF)==PT_LAVA && 1>(rand()%250))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
parts[i].type = PT_FIRE;
|
||||
}
|
||||
else if ((r&0xFF)==PT_SMKE && (1>rand()%250))
|
||||
{
|
||||
parts[r>>8].type = PT_NONE;
|
||||
parts[i].life = rand()%60 + 60;
|
||||
}
|
||||
else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
|
||||
{
|
||||
int nnx = rand()%3 -1;
|
||||
int nny = rand()%3 -1;
|
||||
if (x+nx+nnx>=0 && y+ny+nny>0 &&
|
||||
x+nx+nnx<XRES && y+ny+nny<YRES && (nnx || nny))
|
||||
{
|
||||
if ((pmap[y+ny+nny][x+nx+nnx]>>8)>=NPART||pmap[y+ny+nny][x+nx+nnx])
|
||||
continue;
|
||||
if (create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE))
|
||||
parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp;
|
||||
}
|
||||
}
|
||||
//if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
|
||||
//t = parts[i].type = PT_WATR;
|
||||
}
|
||||
if (parts[i].life==2)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if (!r)
|
||||
create_part(-1,x+nx,y+ny,PT_O2);
|
||||
}
|
||||
parts[i].life = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_PSTE(UPDATE_FUNC_ARGS) {
|
||||
if (parts[i].temp>747.0f)
|
||||
parts[i].type = PT_BRCK;
|
||||
return 0;
|
||||
}
|
28
src/elements/rime.c
Normal file
28
src/elements/rime.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_RIME(UPDATE_FUNC_ARGS) {
|
||||
int r, rt;
|
||||
parts[i].vx = 0;
|
||||
parts[i].vy = 0;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
rt = parts[r>>8].type;
|
||||
if (rt==PT_SPRK)
|
||||
{
|
||||
parts[i].type = PT_FOG;
|
||||
parts[i].life = rand()%50 + 60;
|
||||
}
|
||||
else if (rt==PT_FOG&&parts[r>>8].life>0)
|
||||
{
|
||||
parts[i].type = PT_FOG;
|
||||
parts[i].life = parts[r>>8].life;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
32
src/elements/sltw.c
Normal file
32
src/elements/sltw.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_SLTW(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
|
||||
{
|
||||
parts[i].type = PT_SALT;
|
||||
parts[r>>8].type = PT_WTRV;
|
||||
}
|
||||
else if ((r&0xFF)==PT_SALT && 1>(rand()%10000))
|
||||
{
|
||||
parts[r>>8].type = PT_NONE;
|
||||
}
|
||||
if ((r&0xFF)==PT_PLNT&&5>(rand()%1000))
|
||||
parts[r>>8].type = PT_NONE;
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && parts[i].temp>12.0f && 1>(rand()%500))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
parts[i].type = PT_FIRE;
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
97
src/elements/spng.c
Normal file
97
src/elements/spng.c
Normal file
@ -0,0 +1,97 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_SPNG(UPDATE_FUNC_ARGS) {
|
||||
int r, trade;
|
||||
if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r || parts[i].temp>374.0f)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
|
||||
{
|
||||
parts[i].life++;
|
||||
parts[r>>8].type=PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
|
||||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
|
||||
continue;
|
||||
if ((!r)&&parts[i].life>=1)//if nothing then create water
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_WATR);
|
||||
parts[i].life--;
|
||||
}
|
||||
}
|
||||
for ( trade = 0; trade<9; trade ++)
|
||||
{
|
||||
nx = rand()%5-2;
|
||||
ny = rand()%5-2;
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_SPNG&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
|
||||
{
|
||||
int temp = parts[i].life - parts[r>>8].life;
|
||||
if (temp ==1)
|
||||
{
|
||||
parts[r>>8].life ++;
|
||||
parts[i].life --;
|
||||
trade = 9;
|
||||
}
|
||||
else if (temp>0)
|
||||
{
|
||||
parts[r>>8].life += temp/2;
|
||||
parts[i].life -= temp/2;
|
||||
trade = 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_FIRE&&parts[i].life>0)
|
||||
{
|
||||
if (parts[i].life<=2)
|
||||
parts[i].life --;
|
||||
parts[i].life -= parts[i].life/3;
|
||||
}
|
||||
}
|
||||
if (parts[i].temp>=374)
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID))
|
||||
continue;
|
||||
if ((!r)&&parts[i].life>=1)//if nothing then create steam
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_WTRV);
|
||||
parts[i].life--;
|
||||
parts[i].temp -= 40.0f;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -400,4 +400,5 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
||||
parts[i].life -= 1;
|
||||
|
||||
isplayer = 1;
|
||||
return 0;
|
||||
}
|
||||
|
35
src/elements/thdr.c
Normal file
35
src/elements/thdr.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_THDR(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT || (r&0xFF)==PT_NBLE || (r&0xFF)==PT_INWR) && parts[r>>8].ctype!=PT_SPRK)
|
||||
{
|
||||
parts[i].type = PT_NONE;
|
||||
parts[r>>8].ctype = parts[r>>8].type;
|
||||
parts[r>>8].type = 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))
|
||||
{
|
||||
pv[y/CELL][x/CELL] += 100.0f;
|
||||
if (legacy_enable&&1>(rand()%200))
|
||||
{
|
||||
parts[i].life = rand()%50+120;
|
||||
parts[i].type = PT_FIRE;
|
||||
}
|
||||
else
|
||||
{
|
||||
parts[i].type = PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
31
src/elements/thrm.c
Normal file
31
src/elements/thrm.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_THRM(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA))
|
||||
{
|
||||
if (1>(rand()%500)) {
|
||||
parts[i].type = PT_LAVA;
|
||||
parts[i].ctype = PT_BMTL;
|
||||
parts[i].temp = 3500.0f;
|
||||
pv[y/CELL][x/CELL] += 50.0f;
|
||||
} else {
|
||||
parts[i].type = PT_LAVA;
|
||||
parts[i].life = 400;
|
||||
parts[i].ctype = PT_THRM;
|
||||
parts[i].temp = 3500.0f;
|
||||
parts[i].tmp = 20;
|
||||
}
|
||||
}
|
||||
//if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
|
||||
//t = parts[i].type = PT_WATR;
|
||||
}
|
||||
return 0;
|
||||
}
|
23
src/elements/vine.c
Normal file
23
src/elements/vine.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_VINE(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
nx=(rand()%3)-1;
|
||||
ny=(rand()%3)-1;
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
return 1;
|
||||
if (1>rand()%15)
|
||||
parts[i].type=PT_PLNT;
|
||||
else if (!r)
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_VINE);
|
||||
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
|
||||
parts[i].type=PT_PLNT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
34
src/elements/watr.c
Normal file
34
src/elements/watr.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_WATR(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
|
||||
{
|
||||
parts[i].type = PT_WTRV;
|
||||
}
|
||||
else if ((r&0xFF)==PT_SALT && 1>(rand()%250))
|
||||
{
|
||||
parts[i].type = PT_SLTW;
|
||||
parts[r>>8].type = PT_SLTW;
|
||||
}
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||parts[i].temp>12.0f) && 1>(rand()%500))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
parts[i].type = PT_FIRE;
|
||||
}
|
||||
if ((r&0xFF)==PT_CNCT && 1>(rand()%500))
|
||||
{
|
||||
parts[i].type = PT_PSTE;
|
||||
parts[r>>8].type = PT_NONE;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
33
src/elements/wtrv.c
Normal file
33
src/elements/wtrv.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_WTRV(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable)
|
||||
{
|
||||
parts[i].type = PT_WATR;
|
||||
parts[r>>8].type = PT_WATR;
|
||||
}
|
||||
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && parts[i].temp>12.0f && 1>(rand()%500))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
parts[i].type = PT_FIRE;
|
||||
|
||||
}
|
||||
if (((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable)
|
||||
{
|
||||
parts[i].type = PT_WATR;
|
||||
if (1>(rand()%1000))
|
||||
parts[r>>8].type = PT_WATR;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
893
src/powder.c
893
src/powder.c
@ -1876,39 +1876,8 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
set_emap(nx, ny);
|
||||
|
||||
fe = 0;
|
||||
if (t==PT_THDR)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT || (r&0xFF)==PT_NBLE || (r&0xFF)==PT_INWR) && parts[r>>8].ctype!=PT_SPRK)
|
||||
{
|
||||
t = parts[i].type = PT_NONE;
|
||||
parts[r>>8].ctype = parts[r>>8].type;
|
||||
parts[r>>8].type = 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))
|
||||
{
|
||||
pv[y/CELL][x/CELL] += 100.0f;
|
||||
if (legacy_enable&&1>(rand()%200))
|
||||
{
|
||||
parts[i].life = rand()%50+120;
|
||||
t = parts[i].type = PT_FIRE;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = parts[i].type = PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_ICEI || t==PT_SNOW)
|
||||
|
||||
if (t==PT_ICEI || t==PT_SNOW)
|
||||
{
|
||||
if (parts[i].ctype==PT_FRZW)
|
||||
{
|
||||
@ -1942,50 +1911,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_BMTL) {
|
||||
if (parts[i].tmp>1) {
|
||||
parts[i].tmp--;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
rt =parts[r>>8].type;
|
||||
if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
|
||||
{
|
||||
parts[r>>8].type=PT_BMTL;
|
||||
parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
|
||||
}
|
||||
}
|
||||
} else if (parts[i].tmp==1 && 1>rand()%1000) {
|
||||
parts[i].tmp = 0;
|
||||
t = parts[i].type = PT_BRMT;
|
||||
}
|
||||
}
|
||||
|
||||
else if (t==PT_IRON) {
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
|
||||
((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
|
||||
((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
|
||||
((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
|
||||
((r&0xFF) == PT_LO2))&&
|
||||
(!(parts[i].life))
|
||||
)
|
||||
{
|
||||
parts[i].type=PT_BMTL;
|
||||
parts[i].tmp=(rand()/(RAND_MAX/10))+20;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((t==PT_SPRK||parts[i].type==PT_SPRK) && parts[i].ctype==PT_IRON) {
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
@ -2003,217 +1928,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_COAL)
|
||||
{
|
||||
if (parts[i].life<=0) {
|
||||
t = PT_NONE;
|
||||
kill_part(i);
|
||||
create_part(-1, x, y, PT_FIRE);
|
||||
goto killed;
|
||||
} else if (parts[i].life < 100) {
|
||||
parts[i].life--;
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
|
||||
}
|
||||
if ((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40)
|
||||
parts[i].tmp=39;
|
||||
else if (parts[i].tmp<40&&parts[i].tmp>0)
|
||||
parts[i].tmp--;
|
||||
else if (parts[i].tmp<=0) {
|
||||
t = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_BCOL);
|
||||
goto killed;
|
||||
}
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
|
||||
{
|
||||
if (parts[i].life>100) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_BCOL)
|
||||
{
|
||||
if (parts[i].life<=0) {
|
||||
t = PT_NONE;
|
||||
kill_part(i);
|
||||
create_part(-1, x, y, PT_FIRE);
|
||||
goto killed;
|
||||
} else if (parts[i].life < 100) {
|
||||
parts[i].life--;
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
|
||||
}
|
||||
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
|
||||
{
|
||||
if (parts[i].life>100) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_ARAY && parts[i].life==0) {
|
||||
int colored =0;
|
||||
for (nx=-1; nx<2; nx++) {
|
||||
for (ny=-1; ny<2; ny++) {
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) {
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SPRK) {
|
||||
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
|
||||
int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
|
||||
for (docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
|
||||
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
|
||||
break;
|
||||
}
|
||||
r = pmap[y+nyi+nyy][x+nxi+nxx];
|
||||
if (!((r>>8)>=NPART)) {
|
||||
if (!r) {
|
||||
int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
|
||||
if (nr!=-1) {
|
||||
if (destroy) {
|
||||
parts[nr].tmp = 2;
|
||||
parts[nr].life = 2;
|
||||
} else
|
||||
parts[nr].ctype = colored;
|
||||
}
|
||||
} else if (!destroy) {
|
||||
if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0) {
|
||||
if (nyy!=0 || nxx!=0) {
|
||||
parts[r>>8].type = PT_BRAY;
|
||||
parts[r>>8].life = 1020;
|
||||
parts[r>>8].tmp = 1;
|
||||
if (!parts[r>>8].ctype)
|
||||
parts[r>>8].ctype = colored;
|
||||
}
|
||||
docontinue = 0;
|
||||
} else if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1) {
|
||||
parts[r>>8].life = 1020;
|
||||
//docontinue = 1;
|
||||
}
|
||||
else if (parts[r>>8].type==PT_FILT) {
|
||||
colored = parts[r>>8].ctype;
|
||||
} else if (parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY && parts[r>>8].type!=PT_WIFI) {
|
||||
if (nyy!=0 || nxx!=0) {
|
||||
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
|
||||
}
|
||||
if (!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) {
|
||||
docontinue = 0;
|
||||
} else {
|
||||
docontinue = 1;
|
||||
}
|
||||
}
|
||||
} else if (destroy) {
|
||||
if (parts[r>>8].type==PT_BRAY) {
|
||||
parts[r>>8].life = 1;
|
||||
docontinue = 1;
|
||||
} else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI) {
|
||||
docontinue = 1;
|
||||
} else {
|
||||
docontinue = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//parts[i].life = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_FUSE)
|
||||
{
|
||||
if (parts[i].life<=0) {
|
||||
//t = parts[i].life = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
goto killed;
|
||||
} else if (parts[i].life < 40) {
|
||||
parts[i].life--;
|
||||
if ((rand()%100)==0) {
|
||||
r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
}
|
||||
}
|
||||
if ((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40)
|
||||
parts[i].tmp=39;
|
||||
else if (parts[i].tmp<40&&parts[i].tmp>0)
|
||||
parts[i].tmp--;
|
||||
else if (parts[i].tmp<=0) {
|
||||
//t = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_FSEP);
|
||||
goto killed;
|
||||
}
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))
|
||||
{
|
||||
if (parts[i].life>40) {
|
||||
parts[i].life = 39;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_FSEP)
|
||||
{
|
||||
if (parts[i].life<=0) {
|
||||
//t = PT_NONE;
|
||||
kill_part(i);
|
||||
r = create_part(-1, x, y, PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
goto killed;
|
||||
} else if (parts[i].life < 40) {
|
||||
parts[i].life--;
|
||||
if ((rand()%10)==0) {
|
||||
r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
|
||||
if (r!=-1)
|
||||
parts[r].life = 50;
|
||||
}
|
||||
}
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
|
||||
{
|
||||
if (parts[i].life>40) {
|
||||
parts[i].life = 39;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_NTCT||t==PT_PTCT||t==PT_INWR)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
@ -2230,210 +1944,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_PLNT)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_WATR && 1>(rand()%250))
|
||||
{
|
||||
t = parts[i].type = PT_PLNT;
|
||||
parts[r>>8].type = PT_PLNT;
|
||||
parts[r>>8].life = 0;
|
||||
}
|
||||
else if ((r&0xFF)==PT_LAVA && 1>(rand()%250))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
t = parts[i].type = PT_FIRE;
|
||||
}
|
||||
else if ((r&0xFF)==PT_SMKE && (1>rand()%250))
|
||||
{
|
||||
parts[r>>8].type = PT_NONE;
|
||||
parts[i].life = rand()%60 + 60;
|
||||
}
|
||||
else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
|
||||
{
|
||||
int nnx = rand()%3 -1;
|
||||
int nny = rand()%3 -1;
|
||||
if (x+nx+nnx>=0 && y+ny+nny>0 &&
|
||||
x+nx+nnx<XRES && y+ny+nny<YRES && (nnx || nny))
|
||||
{
|
||||
if ((pmap[y+ny+nny][x+nx+nnx]>>8)>=NPART||pmap[y+ny+nny][x+nx+nnx])
|
||||
continue;
|
||||
if (create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE))
|
||||
parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp;
|
||||
}
|
||||
}
|
||||
//if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
|
||||
//t = parts[i].type = PT_WATR;
|
||||
}
|
||||
if (parts[i].life==2)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if (!r)
|
||||
create_part(-1,x+nx,y+ny,PT_O2);
|
||||
}
|
||||
parts[i].life = 0;
|
||||
}
|
||||
}
|
||||
else if (t==PT_VINE)
|
||||
{
|
||||
nx=(rand()%3)-1;
|
||||
ny=(rand()%3)-1;
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if (1>rand()%15)
|
||||
parts[i].type=PT_PLNT;
|
||||
else if (!r)
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_VINE);
|
||||
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
|
||||
parts[i].type=PT_PLNT;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_THRM)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA))
|
||||
{
|
||||
if (1>(rand()%500)) {
|
||||
t = parts[i].type = PT_LAVA;
|
||||
parts[i].ctype = PT_BMTL;
|
||||
pt = parts[i].temp = 3500.0f;
|
||||
pv[y/CELL][x/CELL] += 50.0f;
|
||||
} else {
|
||||
t = parts[i].type = PT_LAVA;
|
||||
parts[i].life = 400;
|
||||
parts[i].ctype = PT_THRM;
|
||||
pt = parts[i].temp = 3500.0f;
|
||||
parts[i].tmp = 20;
|
||||
}
|
||||
}
|
||||
//if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
|
||||
//t = parts[i].type = PT_WATR;
|
||||
}
|
||||
}
|
||||
else if (t==PT_WATR||t==PT_DSTW)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
|
||||
{
|
||||
t = parts[i].type = PT_WTRV;
|
||||
}
|
||||
else if ((r&0xFF)==PT_SALT && 1>(rand()%250))
|
||||
{
|
||||
t = parts[i].type = PT_SLTW;
|
||||
parts[r>>8].type = PT_SLTW;
|
||||
}
|
||||
if ((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500))
|
||||
{
|
||||
t = parts[i].type = PT_WATR;
|
||||
}
|
||||
if (((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500))
|
||||
{
|
||||
t = parts[i].type = PT_SLTW;
|
||||
}
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
t = parts[i].type = PT_FIRE;
|
||||
}
|
||||
if (((r&0xFF)==PT_CNCT&&t==PT_WATR) && 1>(rand()%500))
|
||||
{
|
||||
t = parts[i].type = PT_PSTE;
|
||||
parts[r>>8].type = PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_SLTW)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
|
||||
{
|
||||
t = parts[i].type = PT_SALT;
|
||||
parts[r>>8].type = PT_WTRV;
|
||||
}
|
||||
else if ((r&0xFF)==PT_SALT && 1>(rand()%10000))
|
||||
{
|
||||
parts[r>>8].type = PT_NONE;
|
||||
}
|
||||
if ((r&0xFF)==PT_PLNT&&5>(rand()%1000))
|
||||
parts[r>>8].type = PT_NONE;
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
t = parts[i].type = PT_FIRE;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_WTRV)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable)
|
||||
{
|
||||
t = parts[i].type = PT_WATR;
|
||||
parts[r>>8].type = PT_WATR;
|
||||
}
|
||||
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
|
||||
{
|
||||
parts[i].life = 4;
|
||||
t = parts[i].type = PT_FIRE;
|
||||
|
||||
}
|
||||
if (((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable)
|
||||
{
|
||||
t = parts[i].type = PT_WATR;
|
||||
if (1>(rand()%1000))
|
||||
parts[r>>8].type = PT_WATR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_YEST)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
@ -2450,40 +1960,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_ACID)
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_ACID)
|
||||
{
|
||||
if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD)
|
||||
{
|
||||
t = parts[i].type = PT_FIRE;
|
||||
parts[i].life = 4;
|
||||
parts[r>>8].type = PT_FIRE;
|
||||
parts[r>>8].life = 4;
|
||||
}
|
||||
else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50)
|
||||
{
|
||||
if (parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS)
|
||||
{
|
||||
parts[i].life--;
|
||||
parts[r>>8].type = PT_NONE;
|
||||
}
|
||||
}
|
||||
else if (parts[i].life<=50)
|
||||
{
|
||||
parts[i].life = 0;
|
||||
t = parts[i].type = PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_NEUT)
|
||||
{
|
||||
rt = 3 + (int)pv[y/CELL][x/CELL];
|
||||
@ -2632,23 +2108,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_GLOW)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_WATR&&5>(rand()%2000))
|
||||
{
|
||||
t = parts[i].type = PT_NONE;
|
||||
parts[r>>8].type = PT_DEUT;
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_MORT) {
|
||||
create_part(-1, x, y-1, PT_SMKE);
|
||||
}
|
||||
@ -2664,216 +2123,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
ISLOLZ=1;
|
||||
else if (t==PT_GRAV)
|
||||
ISGRAV=1;
|
||||
else if (t==PT_SPNG)
|
||||
{
|
||||
if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r || parts[i].temp>374.0f)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
|
||||
{
|
||||
parts[i].life++;
|
||||
parts[r>>8].type=PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
|
||||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
|
||||
continue;
|
||||
if ((!r)&&parts[i].life>=1)//if nothing then create water
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_WATR);
|
||||
parts[i].life--;
|
||||
}
|
||||
}
|
||||
for ( trade = 0; trade<9; trade ++)
|
||||
{
|
||||
nx = rand()%5-2;
|
||||
ny = rand()%5-2;
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
|
||||
{
|
||||
int temp = parts[i].life - parts[r>>8].life;
|
||||
if (temp ==1)
|
||||
{
|
||||
parts[r>>8].life ++;
|
||||
parts[i].life --;
|
||||
trade = 9;
|
||||
}
|
||||
else if (temp>0)
|
||||
{
|
||||
parts[r>>8].life += temp/2;
|
||||
parts[i].life -= temp/2;
|
||||
trade = 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_FIRE&&parts[i].life>0)
|
||||
{
|
||||
if (parts[i].life<=2)
|
||||
parts[i].life --;
|
||||
parts[i].life -= parts[i].life/3;
|
||||
}
|
||||
}
|
||||
if (parts[i].temp>=374)
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID))
|
||||
continue;
|
||||
if ((!r)&&parts[i].life>=1)//if nothing then create steam
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_WTRV);
|
||||
parts[i].life--;
|
||||
parts[i].temp -= 40.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_FOG)
|
||||
{
|
||||
if (parts[i].temp>=373.15)
|
||||
t = parts[i].type = PT_WTRV;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN))
|
||||
{
|
||||
t = parts[i].type = PT_RIME;
|
||||
}
|
||||
if (parts[r>>8].type==PT_SPRK)
|
||||
{
|
||||
parts[i].life += rand()%20;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_RIME)
|
||||
{
|
||||
parts[i].vx = 0;
|
||||
parts[i].vy = 0;
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
rt = parts[r>>8].type;
|
||||
if (rt==PT_SPRK)
|
||||
{
|
||||
t = parts[i].type = PT_FOG;
|
||||
parts[i].life = rand()%50 + 60;
|
||||
}
|
||||
else if (rt==PT_FOG&&parts[r>>8].life>0)
|
||||
{
|
||||
t = parts[i].type = PT_FOG;
|
||||
parts[i].life = parts[r>>8].life;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_DEUT)
|
||||
{
|
||||
int maxlife = ((10000/(parts[i].temp + 1))-1);
|
||||
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
|
||||
maxlife ++;
|
||||
if (parts[i].life < maxlife)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r || (parts[i].life >=maxlife))
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
|
||||
{
|
||||
if ((parts[i].life + parts[r>>8].life + 1) <= maxlife)
|
||||
{
|
||||
parts[i].life += parts[r>>8].life + 1;
|
||||
parts[r>>8].type=PT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || (parts[i].life<=maxlife))
|
||||
continue;
|
||||
if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
|
||||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
|
||||
continue;
|
||||
if ((!r)&&parts[i].life>=1)//if nothing then create deut
|
||||
{
|
||||
create_part(-1,x+nx,y+ny,PT_DEUT);
|
||||
parts[i].life--;
|
||||
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
|
||||
parts[pmap[y+ny][x+nx]>>8].life = 0;
|
||||
}
|
||||
}
|
||||
for ( trade = 0; trade<4; trade ++)
|
||||
{
|
||||
nx = rand()%5-2;
|
||||
ny = rand()%5-2;
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
|
||||
{
|
||||
int temp = parts[i].life - parts[r>>8].life;
|
||||
if (temp ==1)
|
||||
{
|
||||
parts[r>>8].life ++;
|
||||
parts[i].life --;
|
||||
}
|
||||
else if (temp>0)
|
||||
{
|
||||
parts[r>>8].life += temp/2;
|
||||
parts[i].life -= temp/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (t==PT_WARP)
|
||||
{
|
||||
for ( trade = 0; trade<5; trade ++)
|
||||
@ -3067,143 +2317,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_PIPE)
|
||||
{
|
||||
if (!parts[i].ctype && parts[i].life<=10)
|
||||
{
|
||||
if (parts[i].temp<272.15)
|
||||
{
|
||||
if (parts[i].temp>173.25&&parts[i].temp<273.15)
|
||||
{
|
||||
parts[i].ctype = 2;
|
||||
parts[i].life = 0;
|
||||
}
|
||||
if (parts[i].temp>73.25&&parts[i].temp<=173.15)
|
||||
{
|
||||
parts[i].ctype = 3;
|
||||
parts[i].life = 0;
|
||||
}
|
||||
if (parts[i].temp>=0&&parts[i].temp<=73.15)
|
||||
{
|
||||
parts[i].ctype = 4;
|
||||
parts[i].life = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
for (ny=-2; ny<3; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART )
|
||||
continue;
|
||||
if (!r)
|
||||
create_part(-1,x+nx,y+ny,PT_BRCK);
|
||||
}
|
||||
if (parts[i].life==1)
|
||||
parts[i].ctype = 1;
|
||||
}
|
||||
}
|
||||
if (parts[i].ctype==1)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
if (!r&&!parts[i].life)
|
||||
parts[i].life=50;
|
||||
}
|
||||
if (parts[i].life==2)
|
||||
{
|
||||
parts[i].ctype = 2;
|
||||
parts[i].life = 6;
|
||||
}
|
||||
}
|
||||
if (parts[i].ctype>1)
|
||||
for ( q = 0; q<3; q++)
|
||||
for ( ctype = 2; ctype<5; ctype++)
|
||||
{
|
||||
if (parts[i].ctype==ctype)
|
||||
{
|
||||
if (parts[i].life==3)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1)
|
||||
{
|
||||
parts[r>>8].ctype = (((ctype)%3)+2);//reverse
|
||||
parts[r>>8].life = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nx = rand()%3-1;
|
||||
ny = rand()%3-1;
|
||||
if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART)
|
||||
continue;
|
||||
else if (!r&&parts[i].tmp!=0)
|
||||
{
|
||||
if (create_part(-1,x+nx,y+ny,parts[i].tmp))
|
||||
{
|
||||
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;//pipe saves temp and life now
|
||||
parts[pmap[y+ny][x+nx]>>8].life = parts[i].flags;
|
||||
}
|
||||
parts[i].tmp = 0;
|
||||
continue;
|
||||
}
|
||||
else if (!r)
|
||||
continue;
|
||||
else if (parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))
|
||||
{
|
||||
parts[i].tmp = parts[r>>8].type;
|
||||
parts[i].temp = parts[r>>8].temp;
|
||||
parts[i].flags = parts[r>>8].life;
|
||||
parts[r>>8].type = PT_NONE;
|
||||
}
|
||||
else if (parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
|
||||
{
|
||||
parts[r>>8].tmp = parts[i].tmp;
|
||||
parts[r>>8].temp = parts[i].temp;
|
||||
parts[r>>8].flags = parts[i].flags;
|
||||
parts[i].tmp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_FRZZ)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
if (x+nx>=0 && y+ny>0 &&
|
||||
x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||
{
|
||||
r = pmap[y+ny][x+nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if (parts[r>>8].type==PT_WATR&&5>rand()%100)
|
||||
{
|
||||
parts[r>>8].type=PT_FRZW;
|
||||
parts[r>>8].life = 100;
|
||||
t = parts[i].type = PT_NONE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (t==PT_FRZW)
|
||||
{
|
||||
for (nx=-1; nx<2; nx++)
|
||||
|
Loading…
Reference in New Issue
Block a user