Powered Breakable clone, Gravity Pump, New menu section for powered elements (needs icon)
This commit is contained in:
parent
3fe82bf525
commit
437f13f424
@ -20,23 +20,25 @@ struct menu_wall
|
||||
typedef struct menu_wall menu_wall;
|
||||
|
||||
#define SC_WALL 0
|
||||
#define SC_SPECIAL 8
|
||||
#define SC_POWDERS 5
|
||||
#define SC_SOLIDS 6
|
||||
#define SC_ELEC 1
|
||||
#define SC_EXPLOSIVE 2
|
||||
#define SC_GAS 3
|
||||
#define SC_LIQUID 4
|
||||
#define SC_NUCLEAR 7
|
||||
#define SC_LIFE 9
|
||||
#define SC_CRACKER 12
|
||||
#define SC_CRACKER2 13
|
||||
#define SC_TOTAL 10
|
||||
#define SC_POWERED 2
|
||||
#define SC_EXPLOSIVE 3
|
||||
#define SC_GAS 4
|
||||
#define SC_LIQUID 5
|
||||
#define SC_POWDERS 6
|
||||
#define SC_SOLIDS 7
|
||||
#define SC_NUCLEAR 8
|
||||
#define SC_SPECIAL 9
|
||||
#define SC_LIFE 10
|
||||
#define SC_CRACKER 13
|
||||
#define SC_CRACKER2 14
|
||||
#define SC_TOTAL 11
|
||||
|
||||
static menu_section msections[] = //doshow does not do anything currently.
|
||||
{
|
||||
{"\xC1", "Walls", 0, 1},
|
||||
{"\xC2", "Electronics", 0, 1},
|
||||
{"\xC2", "Powered Materials", 0, 1},
|
||||
{"\xC3", "Explosives", 0, 1},
|
||||
{"\xC5", "Gasses", 0, 1},
|
||||
{"\xC4", "Liquids", 0, 1},
|
||||
|
@ -205,7 +205,9 @@
|
||||
#define PT_NBHL 150
|
||||
#define PT_NWHL 151
|
||||
#define PT_MERC 152
|
||||
#define PT_NUM 153
|
||||
#define PT_PBCN 153
|
||||
#define PT_GPMP 154
|
||||
#define PT_NUM 155
|
||||
|
||||
#define R_TEMP 22
|
||||
#define MAX_TEMP 9999
|
||||
@ -316,6 +318,8 @@ int update_H2(UPDATE_FUNC_ARGS);
|
||||
int update_NBHL(UPDATE_FUNC_ARGS);
|
||||
int update_NWHL(UPDATE_FUNC_ARGS);
|
||||
int update_MERC(UPDATE_FUNC_ARGS);
|
||||
int update_PBCN(UPDATE_FUNC_ARGS);
|
||||
int update_GPMP(UPDATE_FUNC_ARGS);
|
||||
|
||||
int update_MISC(UPDATE_FUNC_ARGS);
|
||||
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
|
||||
@ -445,7 +449,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.", ST_SOLID, TYPE_SOLID, NULL},
|
||||
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
|
||||
{"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.", ST_SOLID, 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)", ST_SOLID, TYPE_SOLID, &update_LCRY},
|
||||
{"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_POWERED, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", ST_SOLID, 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!", ST_NONE, 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)", ST_SOLID, 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", ST_SOLID, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, NULL},
|
||||
@ -465,8 +469,8 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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.", ST_SOLID, 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", ST_NONE, TYPE_PART, &update_AMTR}, //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", ST_SOLID, 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 activated, duplicates any particles it touches.", ST_NONE, 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", ST_NONE, TYPE_SOLID, &update_HSWC},
|
||||
{"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_POWERED, R_TEMP+0.0f +273.15f, 251, "Solid. When activated, duplicates any particles it touches.", ST_NONE, 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_POWERED, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", ST_NONE, 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, &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.", ST_NONE, TYPE_PART, &update_MORT},
|
||||
{"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", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
@ -488,7 +492,7 @@ 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...", ST_GAS, TYPE_SOLID, &update_MISC},
|
||||
{"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.", ST_LIQUID, 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.", ST_GAS, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &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).", ST_SOLID, TYPE_SOLID, &update_PUMP},
|
||||
{"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_POWERED, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", ST_SOLID, 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.", ST_SOLID, TYPE_PART|PROP_LIFE_DEC, &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.", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &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", ST_SOLID, TYPE_PART, &update_FRZZ},
|
||||
@ -522,7 +526,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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!", ST_NONE, 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.", ST_NONE, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_BOMB},
|
||||
{"C-5", PIXPACK(0x2050E0), 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_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_C5},
|
||||
{"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 86, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Singularity", ST_SOLID, TYPE_PART|PROP_LIFE_DEC, &update_SING},
|
||||
{"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 86, SC_POWERED, R_TEMP+0.0f +273.15f, 70, "Singularity", ST_SOLID, TYPE_PART|PROP_LIFE_DEC, &update_SING},
|
||||
{"QRTZ", PIXPACK(0xAADDDD), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW|PROP_LIFE_DEC, &update_QRTZ},
|
||||
{"PQRT", PIXPACK(0x88BBBB), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.27f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 3, "Broken quartz.", ST_SOLID, TYPE_PART| PROP_HOT_GLOW, &update_QRTZ},
|
||||
{"SEED", PIXPACK(0xFBEC7D), 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, "B2/S", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||
@ -544,6 +548,9 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"BHOL", PIXPACK(0x202020), 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, "Black hole (Requires newtonian gravity)", ST_SOLID, TYPE_SOLID, &update_NBHL},
|
||||
{"WHOL", PIXPACK(0xFFFFFF), 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, "White hole (Requires newtonian gravity)", ST_SOLID, TYPE_SOLID, &update_NWHL},
|
||||
{"MERC", PIXPACK(0x736B6D), 0.4f, 0.04f * CFDS, 0.94f, 0.80f, 0.0f, 0.3f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 91, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Mercury. Volume changes with temperature, Conductive.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTABSORB|PROP_LIFE_DEC, &update_MERC},
|
||||
{"PBCN", PIXPACK(0x3B4010), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN},
|
||||
{"GPMP", PIXPACK(0x103B3B), 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_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP},
|
||||
|
||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
||||
};
|
||||
|
||||
@ -712,6 +719,8 @@ static part_transition ptransitions[PT_NUM] =
|
||||
/* NBHL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
/* NWHL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
/* MERC */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
/* PBCN */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
/* GPMP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
|
||||
};
|
||||
#undef IPL
|
||||
#undef IPH
|
||||
|
@ -23,7 +23,8 @@ int update_BCLN(UPDATE_FUNC_ARGS) {
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM &&
|
||||
(r&0xFF)!=PT_STKM2 && (r&0xFF)<PT_NUM)
|
||||
(r&0xFF)!=PT_STKM2 && (r&0xFF)!=PT_PBCN &&
|
||||
(r&0xFF)<PT_NUM)
|
||||
parts[i].ctype = r&0xFF;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ int update_CLNE(UPDATE_FUNC_ARGS) {
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM &&
|
||||
(r&0xFF)!=PT_STKM2 && (r&0xFF)<PT_NUM)
|
||||
(r&0xFF)!=PT_PBCN && (r&0xFF)!=PT_STKM2 &&
|
||||
(r&0xFF)<PT_NUM)
|
||||
parts[i].ctype = r&0xFF;
|
||||
}
|
||||
}
|
||||
|
34
src/elements/gpmp.c
Normal file
34
src/elements/gpmp.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include <element.h>
|
||||
|
||||
int update_GPMP(UPDATE_FUNC_ARGS) {
|
||||
int r, rx, ry;
|
||||
if (parts[i].life>0 && parts[i].life!=10)
|
||||
parts[i].life--;
|
||||
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;
|
||||
|
||||
gravmap[y/CELL][x/CELL] = 0.2f*(parts[i].temp-273.15);
|
||||
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp-273.15))
|
||||
gravmap[y/CELL+1][x/CELL] += 0.1f*((parts[i].temp-273.15)-gravmap[y/CELL+1][x/CELL]);
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_GPMP)
|
||||
{
|
||||
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;
|
||||
}
|
82
src/elements/pbcn.c
Normal file
82
src/elements/pbcn.c
Normal file
@ -0,0 +1,82 @@
|
||||
#include <element.h>
|
||||
|
||||
int update_PBCN(UPDATE_FUNC_ARGS) {
|
||||
int r, rx, ry;
|
||||
if (parts[i].life>0 && parts[i].life!=10)
|
||||
parts[i].life--;
|
||||
if (!parts[i].tmp && pv[y/CELL][x/CELL]>4.0f)
|
||||
parts[i].tmp = rand()%40+80;
|
||||
if (parts[i].tmp)
|
||||
{
|
||||
float advection = 0.1f;
|
||||
parts[i].vx += advection*vx[y/CELL][x/CELL];
|
||||
parts[i].vy += advection*vy[y/CELL][x/CELL];
|
||||
parts[i].tmp--;
|
||||
if(!parts[i].tmp){
|
||||
kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SPRK)
|
||||
{
|
||||
if (parts[r>>8].ctype==PT_PSCN)
|
||||
parts[i].life = 10;
|
||||
else if (parts[r>>8].ctype==PT_NSCN)
|
||||
parts[i].life = 9;
|
||||
}
|
||||
if ((r&0xFF)==PT_PBCN)
|
||||
{
|
||||
if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[i].life==0&&parts[r>>8].life==10)
|
||||
parts[i].life = 10;
|
||||
}
|
||||
}
|
||||
if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
|
||||
{
|
||||
r = photons[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r || (r>>8)>=NPART)
|
||||
continue;
|
||||
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_SPRK &&
|
||||
(r&0xFF)!=PT_NSCN && (r&0xFF)!=PT_PSCN &&
|
||||
(r&0xFF)!=PT_STKM && (r&0xFF)!=PT_STKM2 &&
|
||||
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
|
||||
parts[i].ctype = r&0xFF;
|
||||
}
|
||||
if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) {
|
||||
if (parts[i].ctype==PT_PHOT) {//create photons a different way
|
||||
for (rx=-1; rx<2; rx++) {
|
||||
for (ry=-1; ry<2; ry++) {
|
||||
int r = create_part(-1, x+rx, y+ry, parts[i].ctype);
|
||||
if (r!=-1) {
|
||||
parts[r].vx = rx*3;
|
||||
parts[r].vy = ry*3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ptypes[parts[i].ctype].properties&PROP_LIFE) {//create life a different way
|
||||
for (rx=-1; rx<2; rx++) {
|
||||
for (ry=-1; ry<2; ry++) {
|
||||
create_part(-1, x+rx, y+ry, parts[i].ctype);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -40,7 +40,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
|
||||
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_SPRK &&
|
||||
(r&0xFF)!=PT_NSCN && (r&0xFF)!=PT_PSCN &&
|
||||
(r&0xFF)!=PT_STKM && (r&0xFF)!=PT_STKM2 &&
|
||||
(r&0xFF)<PT_NUM)
|
||||
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
|
||||
parts[i].ctype = r&0xFF;
|
||||
}
|
||||
if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) {
|
||||
|
@ -3,6 +3,8 @@
|
||||
int update_PHOT(UPDATE_FUNC_ARGS) {
|
||||
int r, rt, rx, ry;
|
||||
float rr, rrr;
|
||||
parts[i].pavg[0] = x;
|
||||
parts[i].pavg[1] = y;
|
||||
if (!parts[i].ctype) {
|
||||
kill_part(i);
|
||||
return 1;
|
||||
@ -37,12 +39,12 @@ int update_PHOT(UPDATE_FUNC_ARGS) {
|
||||
pv[y/CELL][x/CELL] -= 15.0f * CFDS;
|
||||
}
|
||||
}
|
||||
r = pmap[y][x];
|
||||
rt = r&0xFF;
|
||||
if (rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN) {
|
||||
//r = pmap[y][x];
|
||||
//rt = r&0xFF;
|
||||
/*if (rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN || rt==PT_PBCN) {
|
||||
if (!parts[r>>8].ctype)
|
||||
parts[r>>8].ctype = PT_PHOT;
|
||||
}
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
|
||||
parts[r>>8].life = 9;
|
||||
}
|
||||
}
|
||||
else if ((ct==PT_PSCN||ct==PT_NSCN) && (rt==PT_PUMP||rt==PT_HSWC||(rt==PT_LCRY&&abs(rx)<2&&abs(ry)<2)))
|
||||
else if ((ct==PT_PSCN||ct==PT_NSCN) && (rt==PT_PUMP||rt==PT_GPMP||rt==PT_HSWC||(rt==PT_LCRY&&abs(rx)<2&&abs(ry)<2))) // PROP_PTOGGLE, Maybe? We seem to use 2 different methods for handling actived elements, this one seems better
|
||||
{
|
||||
if (ct==PT_PSCN) parts[r>>8].life = 10;
|
||||
else if (ct==PT_NSCN && parts[r>>8].life>=10) parts[r>>8].life = 9;
|
||||
|
@ -1757,7 +1757,7 @@ void draw_parts(pixel *vid)
|
||||
|
||||
isplayer2 = 1; //It's a secret. Tssss...
|
||||
}
|
||||
if (cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
|
||||
if (cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_GPMP && t!=PT_PBCN && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
|
||||
{
|
||||
if (t==PT_PHOT)
|
||||
{
|
||||
@ -1815,7 +1815,8 @@ void draw_parts(pixel *vid)
|
||||
t!=PT_NEUT && t!=PT_LAVA && t!=PT_BOMB &&
|
||||
t!=PT_PHOT && t!=PT_THDR && t!=PT_SMKE &&
|
||||
t!=PT_LCRY && t!=PT_SWCH && t!=PT_PCLN &&
|
||||
t!=PT_PUMP && t!=PT_HSWC && t!=PT_FILT)
|
||||
t!=PT_PUMP && t!=PT_HSWC && t!=PT_FILT &&
|
||||
t!=PT_GPMP && t!=PT_PBCN)
|
||||
{
|
||||
if (ptypes[parts[i].type].properties&TYPE_LIQUID) //special effects for liquids in fancy mode
|
||||
{
|
||||
@ -2791,6 +2792,22 @@ void draw_parts(pixel *vid)
|
||||
blendpixel(vid, nx-1, ny+1, GR, GR, 10, 112);
|
||||
}
|
||||
}
|
||||
else if (t==PT_PBCN)
|
||||
{
|
||||
uint8 GR = 0x3B+((parts[i].life>10?10:parts[i].life)*19);
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR/2, 10);
|
||||
if (cmode == CM_BLOB) {
|
||||
blendpixel(vid, nx+1, ny, GR, GR/2, 10, 223);
|
||||
blendpixel(vid, nx-1, ny, GR, GR/2, 10, 223);
|
||||
blendpixel(vid, nx, ny+1, GR, GR/2, 10, 223);
|
||||
blendpixel(vid, nx, ny-1, GR, GR/2, 10, 223);
|
||||
|
||||
blendpixel(vid, nx+1, ny-1, GR, GR/2, 10, 112);
|
||||
blendpixel(vid, nx-1, ny-1, GR, GR/2, 10, 112);
|
||||
blendpixel(vid, nx+1, ny+1, GR, GR/2, 10, 112);
|
||||
blendpixel(vid, nx-1, ny+1, GR, GR/2, 10, 112);
|
||||
}
|
||||
}
|
||||
else if (t==PT_HSWC)
|
||||
{
|
||||
uint8 GR = 0x3B+((parts[i].life>10?10:parts[i].life)*19);
|
||||
@ -2823,6 +2840,22 @@ void draw_parts(pixel *vid)
|
||||
blendpixel(vid, nx-1, ny+1, 10, 10, GR, 112);
|
||||
}
|
||||
}
|
||||
else if (t==PT_GPMP)
|
||||
{
|
||||
uint8 GR = 0x3B+((parts[i].life>10?10:parts[i].life)*19);
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(10, GR, GR);
|
||||
if (cmode == CM_BLOB) {
|
||||
blendpixel(vid, nx+1, ny, 10, GR/2, GR, 223);
|
||||
blendpixel(vid, nx-1, ny, 10, GR/2, GR, 223);
|
||||
blendpixel(vid, nx, ny+1, 10, GR/2, GR, 223);
|
||||
blendpixel(vid, nx, ny-1, 10, GR/2, GR, 223);
|
||||
|
||||
blendpixel(vid, nx+1, ny-1, 10, GR/2, GR, 112);
|
||||
blendpixel(vid, nx-1, ny-1, 10, GR/2, GR, 112);
|
||||
blendpixel(vid, nx+1, ny+1, 10, GR/2, GR, 112);
|
||||
blendpixel(vid, nx-1, ny+1, 10, GR/2, GR, 112);
|
||||
}
|
||||
}
|
||||
else if (t==PT_PLSM)
|
||||
{
|
||||
float ttemp = (float)parts[i].life;
|
||||
|
17
src/powder.c
17
src/powder.c
@ -215,7 +215,7 @@ int try_move(int i, int x, int y, int nx, int ny)
|
||||
if ((r & 0xFF) < PT_NUM && ptypes[r&0xFF].hconduct)
|
||||
parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP);
|
||||
}
|
||||
if (parts[i].type==PT_NEUT && ((r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || (r&0xFF)==PT_BCLN)) {
|
||||
if (parts[i].type==PT_NEUT && ((r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || (r&0xFF)==PT_BCLN || (r&0xFF)==PT_PBCN)) {
|
||||
if (!parts[r>>8].ctype)
|
||||
parts[r>>8].ctype = PT_NEUT;
|
||||
}
|
||||
@ -652,7 +652,7 @@ inline int create_part(int p, int x, int y, int t)//the function for creating a
|
||||
{
|
||||
if (t==SPC_HEAT&&parts[pmap[y][x]>>8].temp<MAX_TEMP)
|
||||
{
|
||||
if ((pmap[y][x]&0xFF)==PT_PUMP) {
|
||||
if ((pmap[y][x]&0xFF)==PT_PUMP || (pmap[y][x]&0xFF)==PT_GPMP) {
|
||||
parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 0.1f, MIN_TEMP, MAX_TEMP);
|
||||
} else if ((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) {
|
||||
parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 50.0f, MIN_TEMP, MAX_TEMP);
|
||||
@ -662,7 +662,7 @@ inline int create_part(int p, int x, int y, int t)//the function for creating a
|
||||
}
|
||||
if (t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP)
|
||||
{
|
||||
if ((pmap[y][x]&0xFF)==PT_PUMP) {
|
||||
if ((pmap[y][x]&0xFF)==PT_PUMP || (pmap[y][x]&0xFF)==PT_GPMP) {
|
||||
parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 0.1f, MIN_TEMP, MAX_TEMP);
|
||||
} else if ((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) {
|
||||
parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 50.0f, MIN_TEMP, MAX_TEMP);
|
||||
@ -741,7 +741,16 @@ inline int create_part(int p, int x, int y, int t)//the function for creating a
|
||||
{
|
||||
if (pmap[y][x])
|
||||
{
|
||||
if (((pmap[y][x]&0xFF)==PT_CLNE||(pmap[y][x]&0xFF)==PT_BCLN||((pmap[y][x]&0xFF)==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN))&&(t!=PT_CLNE&&t!=PT_PCLN&&t!=PT_BCLN&&t!=PT_STKM&&t!=PT_STKM2))
|
||||
if ((
|
||||
(pmap[y][x]&0xFF)==PT_CLNE||
|
||||
(pmap[y][x]&0xFF)==PT_BCLN||
|
||||
((pmap[y][x]&0xFF)==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN)||
|
||||
((pmap[y][x]&0xFF)==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
|
||||
)&&(
|
||||
t!=PT_CLNE&&t!=PT_PCLN&&
|
||||
t!=PT_BCLN&&t!=PT_STKM&&
|
||||
t!=PT_STKM2&&t!=PT_PBCN)
|
||||
)
|
||||
{
|
||||
parts[pmap[y][x]>>8].ctype = t;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user