Added FRAY - Force-ray and RPEL - Repeller

This commit is contained in:
Simon Robertshaw 2012-02-25 10:26:02 +00:00
parent 1c4bce1f22
commit f6696282e1
5 changed files with 75 additions and 13 deletions

View File

@ -36,24 +36,27 @@ typedef struct menu_wall menu_wall;
#define SC_WALL 0 #define SC_WALL 0
#define SC_ELEC 1 #define SC_ELEC 1
#define SC_POWERED 2 #define SC_POWERED 2
#define SC_EXPLOSIVE 3 #define SC_FORCE 3
#define SC_GAS 4 #define SC_EXPLOSIVE 4
#define SC_LIQUID 5 #define SC_GAS 5
#define SC_POWDERS 6 #define SC_LIQUID 6
#define SC_SOLIDS 7 #define SC_POWDERS 7
#define SC_NUCLEAR 8 #define SC_SOLIDS 8
#define SC_SPECIAL 9 #define SC_NUCLEAR 9
#define SC_LIFE 10 #define SC_SPECIAL 10
#define SC_TOOL 11 #define SC_LIFE 11
#define SC_TOOL 12
#define SC_CRACKER 13 #define SC_CRACKER 13
#define SC_CRACKER2 14 #define SC_CRACKER2 14
#define SC_TOTAL 12 #define SC_TOTAL 13
static menu_section msections[] = //doshow does not do anything currently. static menu_section msections[] = //doshow does not do anything currently.
{ {
{"\xC1", "Walls", 0, 1}, {"\xC1", "Walls", 0, 1},
{"\xC2", "Electronics", 0, 1}, {"\xC2", "Electronics", 0, 1},
{"\xD6", "Powered Materials", 0, 1}, {"\xD6", "Powered Materials", 0, 1},
{">", "Force", 0, 1},
{"\xC3", "Explosives", 0, 1}, {"\xC3", "Explosives", 0, 1},
{"\xC5", "Gasses", 0, 1}, {"\xC5", "Gasses", 0, 1},
{"\xC4", "Liquids", 0, 1}, {"\xC4", "Liquids", 0, 1},

View File

@ -214,7 +214,9 @@
#define PT_WIRE 156 #define PT_WIRE 156
#define PT_GBMB 157 #define PT_GBMB 157
#define PT_FIGH 158 #define PT_FIGH 158
#define PT_NUM 159 #define PT_FRAY 159
#define PT_REPL 160
#define PT_NUM 161
#define R_TEMP 22 #define R_TEMP 22
#define MAX_TEMP 9999 #define MAX_TEMP 9999
@ -432,6 +434,8 @@ int update_ACEL(UPDATE_FUNC_ARGS);
int update_DCEL(UPDATE_FUNC_ARGS); int update_DCEL(UPDATE_FUNC_ARGS);
int update_BANG(UPDATE_FUNC_ARGS); int update_BANG(UPDATE_FUNC_ARGS);
int update_IGNT(UPDATE_FUNC_ARGS); int update_IGNT(UPDATE_FUNC_ARGS);
int update_FRAY(UPDATE_FUNC_ARGS);
int update_REPL(UPDATE_FUNC_ARGS);
int update_MISC(UPDATE_FUNC_ARGS); int update_MISC(UPDATE_FUNC_ARGS);
int update_legacy_PYRO(UPDATE_FUNC_ARGS); int update_legacy_PYRO(UPDATE_FUNC_ARGS);

View File

@ -147,8 +147,8 @@ part_type ptypes[PT_NUM] =
{"EMP", PIXPACK(0x66AAFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 3, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 121, "Breaks activated electronics.", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_EMP, &graphics_EMP}, {"EMP", PIXPACK(0x66AAFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 3, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 121, "Breaks activated electronics.", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_EMP, &graphics_EMP},
{"BREL", PIXPACK(0x707060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.18f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken electronics", ST_SOLID, TYPE_PART|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, NULL, NULL}, {"BREL", PIXPACK(0x707060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.18f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken electronics", ST_SOLID, TYPE_PART|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW, NULL, NULL},
{"ELEC", PIXPACK(0xDFEFFF), 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, -1, SC_NUCLEAR, R_TEMP+200.0f+273.15f, 251, "Electrons", ST_GAS, TYPE_ENERGY|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_ELEC, &graphics_ELEC}, {"ELEC", PIXPACK(0xDFEFFF), 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, -1, SC_NUCLEAR, R_TEMP+200.0f+273.15f, 251, "Electrons", ST_GAS, TYPE_ENERGY|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_ELEC, &graphics_ELEC},
{"ACEL", PIXPACK(0x0099CC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Accelerator", ST_NONE, TYPE_SOLID, &update_ACEL, &graphics_ACEL}, {"ACEL", PIXPACK(0x0099CC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_FORCE, R_TEMP+0.0f +273.15f, 251, "Accelerator", ST_NONE, TYPE_SOLID, &update_ACEL, &graphics_ACEL},
{"DCEL", PIXPACK(0x99CC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Decelerator", ST_NONE, TYPE_SOLID, &update_DCEL, &graphics_DCEL}, {"DCEL", PIXPACK(0x99CC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_FORCE, R_TEMP+0.0f +273.15f, 251, "Decelerator", ST_NONE, TYPE_SOLID, &update_DCEL, &graphics_DCEL},
{"TNT", PIXPACK(0xC05050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Explosive.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_BANG, NULL}, {"TNT", PIXPACK(0xC05050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Explosive.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_BANG, NULL},
{"IGNC", PIXPACK(0xC0B050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Ignition cord.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE | PROP_SPARKSETTLE | PROP_LIFE_KILL, &update_IGNT, NULL}, {"IGNC", PIXPACK(0xC0B050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Ignition cord.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE | PROP_SPARKSETTLE | PROP_LIFE_KILL, &update_IGNT, NULL},
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL, NULL}, {"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL, NULL},
@ -169,6 +169,8 @@ part_type ptypes[PT_NUM] =
{"WIRE", PIXPACK(0xFFCC00), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 250, "WireWorld wires.",ST_SOLID,TYPE_SOLID,&update_WIRE, &graphics_WIRE}, {"WIRE", PIXPACK(0xFFCC00), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 250, "WireWorld wires.",ST_SOLID,TYPE_SOLID,&update_WIRE, &graphics_WIRE},
{"GBMB", PIXPACK(0x1144BB), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Sticks to first object it touches then produces strong gravity push.", ST_NONE, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_GBMB, &graphics_GBMB}, {"GBMB", PIXPACK(0x1144BB), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Sticks to first object it touches then produces strong gravity push.", ST_NONE, TYPE_PART|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_GBMB, &graphics_GBMB},
{"FIGH", 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, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Fighter. Tries to kill stickmen.", ST_NONE, 0, &update_FIGH, &graphics_FIGH}, {"FIGH", 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, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Fighter. Tries to kill stickmen.", ST_NONE, 0, &update_FIGH, &graphics_FIGH},
{"FRAY", PIXPACK(0x00BBFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_FORCE, 20.0f+0.0f +273.15f, 0, "Force Emitter. Push or pull objects based on temp value, use like ARAY", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_FRAY, NULL},
{"RPEL", PIXPACK(0x99CC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_FORCE, 20.0f+0.0f +273.15f, 0, "Repel or attract particles based on temp value.", ST_NONE, TYPE_SOLID, &update_REPL, NULL},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description
}; };
@ -343,6 +345,8 @@ part_transition ptransitions[PT_NUM] =
/* WIRE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* WIRE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GBMB */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GBMB */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* FIGH */ {IPL, NT, IPH, NT, ITL, NT, 620.0f, PT_FIRE}, /* FIGH */ {IPL, NT, IPH, NT, ITL, NT, 620.0f, PT_FIRE},
/* FRAY */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* REPL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
}; };
#undef IPL #undef IPL
#undef IPH #undef IPH

29
src/elements/fray.c Normal file
View File

@ -0,0 +1,29 @@
#include <element.h>
int update_FRAY(UPDATE_FUNC_ARGS) {
int r, nxx, nyy, docontinue, len, nxi, nyi, rx, ry, nr, ry1, rx1;
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 && (rx || ry))
{
r = pmap[y+ry][x+rx];
if (!r)
continue;
if ((r&0xFF)==PT_SPRK) {
for (docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1, len = 0; docontinue; nyy+=nyi, nxx+=nxi, len++) {
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0) || len>10) {
break;
}
r = pmap[y+nyi+nyy][x+nxi+nxx];
if (!r)
r = photons[y+nyi+nyy][x+nxi+nxx];
if (r && !(ptypes[r&0xFF].properties & TYPE_SOLID)){
parts[r>>8].vx += nxi*((parts[i].temp-273.15)/10.0f);
parts[r>>8].vy += nyi*((parts[i].temp-273.15)/10.0f);
}
}
}
}
return 0;
}

22
src/elements/repl.c Normal file
View File

@ -0,0 +1,22 @@
#include <element.h>
int update_REPL(UPDATE_FUNC_ARGS) {
int r, rx, ry, ri;
for(ri = 0; ri <= 10; ri++)
{
rx = (rand()%20)-10;
ry = (rand()%20)-10;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if (!r)
r = photons[y+ry][x+rx];
if (r && !(ptypes[r&0xFF].properties & TYPE_SOLID)){
parts[r>>8].vx += isign(rx)*((parts[i].temp-273.15)/10.0f);
parts[r>>8].vy += isign(ry)*((parts[i].temp-273.15)/10.0f);
}
}
}
return 0;
}