mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-26 17:34:35 +02:00
Further function pointers.
This commit is contained in:
@@ -237,20 +237,26 @@ 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_FRZW(UPDATE_FUNC_ARGS);
|
||||
int update_FRZZ(UPDATE_FUNC_ARGS);
|
||||
int update_FSEP(UPDATE_FUNC_ARGS);
|
||||
int update_FUSE(UPDATE_FUNC_ARGS);
|
||||
int update_FIRW(UPDATE_FUNC_ARGS);
|
||||
int update_FWRK(UPDATE_FUNC_ARGS);
|
||||
int update_GLOW(UPDATE_FUNC_ARGS);
|
||||
int update_HSWC(UPDATE_FUNC_ARGS);
|
||||
int update_IRON(UPDATE_FUNC_ARGS);
|
||||
int update_ICEI(UPDATE_FUNC_ARGS);
|
||||
int update_ISZ(UPDATE_FUNC_ARGS);
|
||||
int update_LCRY(UPDATE_FUNC_ARGS);
|
||||
int update_NEUT(UPDATE_FUNC_ARGS);
|
||||
int update_PCLN(UPDATE_FUNC_ARGS);
|
||||
int update_PHOT(UPDATE_FUNC_ARGS);
|
||||
int update_PIPE(UPDATE_FUNC_ARGS);
|
||||
int update_PLNT(UPDATE_FUNC_ARGS);
|
||||
int update_PRTI(UPDATE_FUNC_ARGS);
|
||||
int update_PRTO(UPDATE_FUNC_ARGS);
|
||||
int update_PUMP(UPDATE_FUNC_ARGS);
|
||||
int update_RIME(UPDATE_FUNC_ARGS);
|
||||
int update_SHLD1(UPDATE_FUNC_ARGS);
|
||||
int update_SHLD2(UPDATE_FUNC_ARGS);
|
||||
@@ -367,12 +373,12 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure.", TYPE_GAS, NULL},
|
||||
{"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive.", TYPE_SOLID | PROP_NEUTPENETRATE, NULL},
|
||||
{"GOO", PIXPACK(0x804000), 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_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure.", TYPE_SOLID | PROP_NEUTPENETRATE, NULL},
|
||||
{"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air.", TYPE_SOLID, NULL},
|
||||
{"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air.", TYPE_SOLID, &update_ICEI},
|
||||
{"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable.", TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
|
||||
{"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water.", TYPE_SOLID, &update_SPRK},
|
||||
{"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f+273.15f, 46, "Light particles.", TYPE_PART, NULL},
|
||||
{"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f+273.15f, 46, "Light particles.", TYPE_PART, &update_ICEI},
|
||||
{"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},
|
||||
{"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, &update_NEUT},
|
||||
{"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 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, &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},
|
||||
@@ -408,7 +414,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", TYPE_SOLID, NULL},
|
||||
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity", TYPE_GAS|PROP_CONDUCTS, NULL},
|
||||
{"BTRY", PIXPACK(0x858505), 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, "Solid. Generates Electricity.", TYPE_SOLID, &update_BTRY},
|
||||
{"LCRY", PIXPACK(0x505050), 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, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", TYPE_SOLID, NULL},
|
||||
{"LCRY", PIXPACK(0x505050), 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, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", TYPE_SOLID, &update_LCRY},
|
||||
{"STKM", 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_STKM},
|
||||
{"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, &update_SWCH},
|
||||
{"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},
|
||||
@@ -429,7 +435,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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, &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},
|
||||
{"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, &update_HSWC},
|
||||
{"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|PROP_CONDUCTS, &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},
|
||||
@@ -451,11 +457,11 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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, &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, &update_WARP},
|
||||
{"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},
|
||||
{"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, &update_PUMP},
|
||||
{"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, &update_FWRK},
|
||||
{"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},
|
||||
{"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, &update_FRZW},
|
||||
{"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},
|
||||
{"BIZG", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "Bizarre gas", TYPE_GAS, NULL},
|
||||
@@ -652,7 +658,7 @@ static part_state pstates[PT_NUM] =
|
||||
// no transition (PT_NONE means kill part)
|
||||
#define NT -1
|
||||
// special transition - lava ctypes etc need extra code
|
||||
// TODO: use update_ELEM functions for special transitions, only use this table for the simple ones
|
||||
// TODO: use update_ELEM functions for special transitions, only use this table for the simple ones?
|
||||
#define ST PT_NUM
|
||||
static part_transition ptransitions[PT_NUM] =
|
||||
{
|
||||
|
35
src/elements/frzw.c
Normal file
35
src/elements/frzw.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_FRZW(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()%70)
|
||||
{
|
||||
parts[r>>8].type=PT_FRZW;
|
||||
}
|
||||
}
|
||||
if (parts[i].life==0&&13>rand()%2500)
|
||||
{
|
||||
parts[i].type=PT_ICEI;
|
||||
parts[i].ctype=PT_FRZW;
|
||||
parts[i].temp -= 200.0f;
|
||||
if (parts[i].temp<0)
|
||||
parts[i].temp = 0;
|
||||
}
|
||||
else if ((100-(parts[i].life))>rand()%50000)
|
||||
{
|
||||
parts[i].type=PT_ICEI;
|
||||
parts[i].ctype=PT_FRZW;
|
||||
parts[i].temp -= 200.0f;
|
||||
if (parts[i].temp<0)
|
||||
parts[i].temp = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
25
src/elements/hswc.c
Normal file
25
src/elements/hswc.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_HSWC(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life==10)
|
||||
{
|
||||
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_PUMP)
|
||||
{
|
||||
if (parts[r>>8].life<10&&parts[r>>8].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[r>>8].life==0)
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
37
src/elements/ice.c
Normal file
37
src/elements/ice.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_ICEI(UPDATE_FUNC_ARGS) { //currently used for snow as well
|
||||
int r;
|
||||
if (parts[i].ctype==PT_FRZW)
|
||||
{
|
||||
parts[i].temp -= 1.0f;
|
||||
if (parts[i].temp<0)
|
||||
parts[i].temp = 0;
|
||||
|
||||
}
|
||||
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_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000))
|
||||
{
|
||||
parts[i].type = PT_SLTW;
|
||||
parts[r>>8].type = PT_SLTW;
|
||||
}
|
||||
if (legacy_enable)
|
||||
{
|
||||
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
|
||||
{
|
||||
parts[i].type = PT_ICEI;
|
||||
parts[r>>8].type = PT_ICEI;
|
||||
}
|
||||
if (parts[i].type==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000))
|
||||
parts[i].type = PT_WATR;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
25
src/elements/lcry.c
Normal file
25
src/elements/lcry.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_LCRY(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life==10)
|
||||
{
|
||||
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_LCRY)
|
||||
{
|
||||
if (parts[r>>8].life<10&&parts[r>>8].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[r>>8].life==0)
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
98
src/elements/neut.c
Normal file
98
src/elements/neut.c
Normal file
@@ -0,0 +1,98 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_NEUT(UPDATE_FUNC_ARGS) {
|
||||
int r, fe;
|
||||
int rt = 3 + (int)pv[y/CELL][x/CELL];
|
||||
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_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW)
|
||||
{
|
||||
parts[i].vx *= 0.995;
|
||||
parts[i].vy *= 0.995;
|
||||
}
|
||||
if ((r&0xFF)==PT_PLUT && rt>(rand()%1000))
|
||||
{
|
||||
if (33>rand()%100)
|
||||
{
|
||||
create_part(r>>8, x+nx, y+ny, rand()%3 ? PT_LAVA : PT_URAN);
|
||||
parts[r>>8].temp = MAX_TEMP;
|
||||
if (parts[r>>8].type==PT_LAVA) {
|
||||
parts[r>>8].tmp = 100;
|
||||
parts[r>>8].ctype = PT_PLUT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
create_part(r>>8, x+nx, y+ny, PT_NEUT);
|
||||
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
|
||||
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
|
||||
}
|
||||
pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough
|
||||
fe ++;
|
||||
}
|
||||
if ((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000))
|
||||
{
|
||||
#ifdef SDEUT
|
||||
create_n_parts(parts[r>>8].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT);
|
||||
#else
|
||||
create_part(r>>8, x+nx, y+ny, PT_NEUT);
|
||||
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
|
||||
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
|
||||
if (parts[r>>8].life>0)
|
||||
{
|
||||
parts[r>>8].life --;
|
||||
parts[r>>8].temp += (parts[r>>8].life*17);
|
||||
pv[y/CELL][x/CELL] += 6.0f * CFDS;
|
||||
|
||||
}
|
||||
else
|
||||
parts[r>>8].type = PT_NONE;
|
||||
#endif
|
||||
}
|
||||
if ((r&0xFF)==PT_GUNP && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_DUST;
|
||||
if ((r&0xFF)==PT_DYST && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_YEST;
|
||||
if ((r&0xFF)==PT_YEST) {
|
||||
if (15>(rand()%100000)&&isplayer==0)
|
||||
parts[r>>8].type = PT_STKM;
|
||||
else
|
||||
parts[r>>8].type = PT_DYST;
|
||||
}
|
||||
|
||||
if ((r&0xFF)==PT_WATR && 15>(rand()%100))
|
||||
parts[r>>8].type = PT_DSTW;
|
||||
if ((r&0xFF)==PT_PLEX && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_GOO;
|
||||
if ((r&0xFF)==PT_NITR && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_DESL;
|
||||
if ((r&0xFF)==PT_PLNT && 5>(rand()%100))
|
||||
parts[r>>8].type = PT_WOOD;
|
||||
if ((r&0xFF)==PT_DESL && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_GAS;
|
||||
if ((r&0xFF)==PT_COAL && 5>(rand()%100))
|
||||
parts[r>>8].type = PT_WOOD;
|
||||
if ((r&0xFF)==PT_DUST && 5>(rand()%100))
|
||||
parts[r>>8].type = PT_FWRK;
|
||||
if ((r&0xFF)==PT_FWRK && 5>(rand()%100))
|
||||
parts[r>>8].ctype = PT_DUST;
|
||||
if ((r&0xFF)==PT_ACID && 5>(rand()%100))
|
||||
{
|
||||
parts[r>>8].type = PT_ISOZ;
|
||||
parts[r>>8].life = 0;
|
||||
}
|
||||
/*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM &&
|
||||
(ptypes[parts[r>>8].type-1].menusection==SC_LIQUID||
|
||||
ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE||
|
||||
ptypes[parts[r>>8].type-1].menusection==SC_GAS||
|
||||
ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000))
|
||||
parts[r>>8].type--;*/
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,6 +1,26 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_PCLN(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life==10)
|
||||
{
|
||||
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_PCLN)
|
||||
{
|
||||
if (parts[r>>8].life<10&&parts[r>>8].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[r>>8].life==0)
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!parts[i].ctype)
|
||||
for (nx=-1; nx<2; nx++)
|
||||
for (ny=-1; ny<2; ny++)
|
||||
|
40
src/elements/pump.c
Normal file
40
src/elements/pump.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <powder.h>
|
||||
|
||||
int update_PUMP(UPDATE_FUNC_ARGS) {
|
||||
int r;
|
||||
if (parts[i].life==10)
|
||||
{
|
||||
if (parts[i].temp>=256.0+273.15)
|
||||
parts[i].temp=256.0+273.15;
|
||||
if (parts[i].temp<= -256.0+273.15)
|
||||
parts[i].temp = -256.0+273.15;
|
||||
|
||||
if (pv[y/CELL][x/CELL]<(parts[i].temp-273.15))
|
||||
pv[y/CELL][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL]);
|
||||
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp-273.15))
|
||||
pv[y/CELL+1][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL]);
|
||||
if (x+CELL<XRES)
|
||||
{
|
||||
pv[y/CELL][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL+1]);
|
||||
if (y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+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_PUMP)
|
||||
{
|
||||
if (parts[r>>8].life<10&&parts[r>>8].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[r>>8].life==0)
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
223
src/powder.c
223
src/powder.c
@@ -1347,25 +1347,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
pv[y/CELL+1][x/CELL+1] += ptypes[t].hotair*(3.5f-pv[y/CELL+1][x/CELL+1]);
|
||||
}
|
||||
}
|
||||
else if (t==PT_PUMP && parts[i].life==10)
|
||||
{
|
||||
if (parts[i].temp>=256.0+273.15)
|
||||
parts[i].temp=256.0+273.15;
|
||||
if (parts[i].temp<= -256.0+273.15)
|
||||
parts[i].temp = -256.0+273.15;
|
||||
|
||||
if (pv[y/CELL][x/CELL]<(parts[i].temp-273.15))
|
||||
pv[y/CELL][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL]);
|
||||
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp-273.15))
|
||||
pv[y/CELL+1][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL]);
|
||||
if (x+CELL<XRES)
|
||||
{
|
||||
pv[y/CELL][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL+1]);
|
||||
if (y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (ptypes[t].hotair)
|
||||
{
|
||||
pv[y/CELL][x/CELL] += ptypes[t].hotair;
|
||||
if (y+CELL<YRES)
|
||||
@@ -1557,8 +1539,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
parts[i].type = PT_PQRT;
|
||||
}
|
||||
}
|
||||
if (t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f)
|
||||
t = parts[i].type = PT_SNOW;
|
||||
if (t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000))
|
||||
{
|
||||
t = PT_NEUT;
|
||||
@@ -1748,136 +1728,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
|
||||
fe = 0;
|
||||
|
||||
if (t==PT_ICEI || t==PT_SNOW)
|
||||
{
|
||||
if (parts[i].ctype==PT_FRZW)
|
||||
{
|
||||
parts[i].temp -= 1.0f;
|
||||
if (parts[i].temp<0)
|
||||
parts[i].temp = 0;
|
||||
|
||||
}
|
||||
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_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000))
|
||||
{
|
||||
t = parts[i].type = PT_SLTW;
|
||||
parts[r>>8].type = PT_SLTW;
|
||||
}
|
||||
if (legacy_enable)
|
||||
{
|
||||
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
|
||||
{
|
||||
t = parts[i].type = PT_ICEI;
|
||||
parts[r>>8].type = PT_ICEI;
|
||||
}
|
||||
if (t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000))
|
||||
t = parts[i].type = PT_WATR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t==PT_NEUT)
|
||||
{
|
||||
rt = 3 + (int)pv[y/CELL][x/CELL];
|
||||
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_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW)
|
||||
{
|
||||
parts[i].vx *= 0.995;
|
||||
parts[i].vy *= 0.995;
|
||||
}
|
||||
if ((r&0xFF)==PT_PLUT && rt>(rand()%1000))
|
||||
{
|
||||
if (33>rand()%100)
|
||||
{
|
||||
create_part(r>>8, x+nx, y+ny, rand()%3 ? PT_LAVA : PT_URAN);
|
||||
parts[r>>8].temp = MAX_TEMP;
|
||||
if (parts[r>>8].type==PT_LAVA) {
|
||||
parts[r>>8].tmp = 100;
|
||||
parts[r>>8].ctype = PT_PLUT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
create_part(r>>8, x+nx, y+ny, PT_NEUT);
|
||||
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
|
||||
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
|
||||
}
|
||||
pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough
|
||||
fe ++;
|
||||
}
|
||||
if ((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000))
|
||||
{
|
||||
#ifdef SDEUT
|
||||
create_n_parts(parts[r>>8].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT);
|
||||
#else
|
||||
create_part(r>>8, x+nx, y+ny, PT_NEUT);
|
||||
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
|
||||
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
|
||||
if (parts[r>>8].life>0)
|
||||
{
|
||||
parts[r>>8].life --;
|
||||
parts[r>>8].temp += (parts[r>>8].life*17);
|
||||
pv[y/CELL][x/CELL] += 6.0f * CFDS;
|
||||
|
||||
}
|
||||
else
|
||||
parts[r>>8].type = PT_NONE;
|
||||
#endif
|
||||
}
|
||||
if ((r&0xFF)==PT_GUNP && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_DUST;
|
||||
if ((r&0xFF)==PT_DYST && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_YEST;
|
||||
if ((r&0xFF)==PT_YEST) {
|
||||
if (15>(rand()%100000)&&isplayer==0)
|
||||
parts[r>>8].type = PT_STKM;
|
||||
else
|
||||
parts[r>>8].type = PT_DYST;
|
||||
}
|
||||
|
||||
if ((r&0xFF)==PT_WATR && 15>(rand()%100))
|
||||
parts[r>>8].type = PT_DSTW;
|
||||
if ((r&0xFF)==PT_PLEX && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_GOO;
|
||||
if ((r&0xFF)==PT_NITR && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_DESL;
|
||||
if ((r&0xFF)==PT_PLNT && 5>(rand()%100))
|
||||
parts[r>>8].type = PT_WOOD;
|
||||
if ((r&0xFF)==PT_DESL && 15>(rand()%1000))
|
||||
parts[r>>8].type = PT_GAS;
|
||||
if ((r&0xFF)==PT_COAL && 5>(rand()%100))
|
||||
parts[r>>8].type = PT_WOOD;
|
||||
if ((r&0xFF)==PT_DUST && 5>(rand()%100))
|
||||
parts[r>>8].type = PT_FWRK;
|
||||
if ((r&0xFF)==PT_FWRK && 5>(rand()%100))
|
||||
parts[r>>8].ctype = PT_DUST;
|
||||
if ((r&0xFF)==PT_ACID && 5>(rand()%100))
|
||||
{
|
||||
parts[r>>8].type = PT_ISOZ;
|
||||
parts[r>>8].life = 0;
|
||||
}
|
||||
/*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM &&
|
||||
(ptypes[parts[r>>8].type-1].menusection==SC_LIQUID||
|
||||
ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE||
|
||||
ptypes[parts[r>>8].type-1].menusection==SC_GAS||
|
||||
ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000))
|
||||
parts[r>>8].type--;*/
|
||||
}
|
||||
}
|
||||
else if (t==PT_PHOT)
|
||||
if (t==PT_PHOT)
|
||||
{
|
||||
rt = 3 + (int)pv[y/CELL][x/CELL];
|
||||
for (nx=0; nx<1; nx++)
|
||||
@@ -1945,76 +1796,6 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
ISLOLZ=1;
|
||||
else if (t==PT_GRAV)
|
||||
ISGRAV=1;
|
||||
else if (t==PT_FRZW)
|
||||
{
|
||||
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()%70)
|
||||
{
|
||||
parts[r>>8].type=PT_FRZW;
|
||||
}
|
||||
}
|
||||
if (parts[i].life==0&&13>rand()%2500)
|
||||
{
|
||||
t = parts[i].type=PT_ICEI;
|
||||
parts[i].ctype=PT_FRZW;
|
||||
parts[i].temp -= 200.0f;
|
||||
if (parts[i].temp<0)
|
||||
parts[i].temp = 0;
|
||||
}
|
||||
else if ((100-(parts[i].life))>rand()%50000)
|
||||
{
|
||||
t = parts[i].type=PT_ICEI;
|
||||
parts[i].ctype=PT_FRZW;
|
||||
parts[i].temp -= 200.0f;
|
||||
if (parts[i].temp<0)
|
||||
parts[i].temp = 0;
|
||||
}
|
||||
}
|
||||
else if (t==PT_LCRY&&parts[i].life==10)
|
||||
{
|
||||
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_LCRY)
|
||||
{
|
||||
if (parts[r>>8].life<10&&parts[r>>8].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[r>>8].life==0)
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((t==PT_PCLN||t==PT_HSWC||t==PT_PUMP)&&parts[i].life==10)
|
||||
{
|
||||
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)==t)
|
||||
{
|
||||
if (parts[r>>8].life<10&&parts[r>>8].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[r>>8].life==0)
|
||||
parts[r>>8].life = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)))
|
||||
{
|
||||
for (nx=-2; nx<3; nx++)
|
||||
|
Reference in New Issue
Block a user