summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Hoyle <starfoxprime@gmail.com>2011-08-16 18:39:50 (GMT)
committer Bryan Hoyle <starfoxprime@gmail.com>2011-08-16 18:39:50 (GMT)
commite55e52c4604cafcfadde2ac7a1d893631f321871 (patch)
treecb851246e8b10959b33f86356140d8807080af38
parente7ce51d420d30ee6ab82df8e7dbbe791401f33e9 (diff)
downloadpowder-e55e52c4604cafcfadde2ac7a1d893631f321871.zip
powder-e55e52c4604cafcfadde2ac7a1d893631f321871.tar.gz
added gbmb which is an element that makes large amounts of gravity when it hits a particle
-rw-r--r--includes/powder.h8
-rw-r--r--src/elements/gbmb.c20
-rw-r--r--src/graphics.c15
-rw-r--r--src/powder.c3
4 files changed, 43 insertions, 3 deletions
diff --git a/includes/powder.h b/includes/powder.h
index a533f31..002d799 100644
--- a/includes/powder.h
+++ b/includes/powder.h
@@ -197,7 +197,8 @@
#define PT_GPMP 154
#define PT_CLST 155
#define PT_WIRE 156
-#define PT_NUM 157
+#define PT_GBMB 157
+#define PT_NUM 158
#define R_TEMP 22
#define MAX_TEMP 9999
@@ -313,6 +314,7 @@ int update_GPMP(UPDATE_FUNC_ARGS);
int update_CLST(UPDATE_FUNC_ARGS);
int update_DLAY(UPDATE_FUNC_ARGS);
int update_WIRE(UPDATE_FUNC_ARGS);
+int update_GBMB(UPDATE_FUNC_ARGS);
int update_MISC(UPDATE_FUNC_ARGS);
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
@@ -546,7 +548,8 @@ static const part_type ptypes[PT_NUM] =
{"PBCN", PIXPACK(0x3B1D0A), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_POWERED, R_TEMP+0.0f +273.15f, 251, "Powered breakable clone", ST_NONE, TYPE_SOLID, &update_PBCN},
{"GPMP", PIXPACK(0x0A3B3B), 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_POWERED, 0.0f +273.15f, 0, "Changes gravity to its temp when activated. (use HEAT/COOL).", ST_NONE, TYPE_SOLID, &update_GPMP},
{"CLST", PIXPACK(0xE4A4A4), 0.7f, 0.02f * CFDS, 0.94f, 0.95f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Clay dust. Produces paste when mixed with water.", ST_SOLID, TYPE_PART, &update_CLST},
- {"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}
+ {"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},
+ {"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},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description
};
@@ -719,6 +722,7 @@ static part_transition ptransitions[PT_NUM] =
/* GPMP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* CLST */ {IPL, NT, IPH, NT, ITL, NT, 1256.0f, PT_LAVA},
/* WIRE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT, PT_WIRE},
+ /* GBMB */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
};
#undef IPL
#undef IPH
diff --git a/src/elements/gbmb.c b/src/elements/gbmb.c
new file mode 100644
index 0000000..20582af
--- /dev/null
+++ b/src/elements/gbmb.c
@@ -0,0 +1,20 @@
+#include <element.h>
+int update_GBMB(UPDATE_FUNC_ARGS) {
+ int rx,ry,r;
+ for (rx=-2; rx<3; rx++)
+ for (ry=-2; ry<3; ry++){
+ r = pmap[y+ry][x+rx];
+ if(r)
+ if((r&0xFF)!=PT_BOMB&&
+ (r&0xFF)!=PT_GBMB&&
+ (r&0xFF)!=PT_CLNE&&
+ (r&0xFF)!=PT_PCLN&&
+ !parts[i].tmp){
+ parts[i].life=100;
+ parts[i].tmp = 1;
+ }
+ }
+ if(parts[i].life>1)
+ gravmap[y/CELL][x/CELL] = -20;
+return 0;
+}
diff --git a/src/graphics.c b/src/graphics.c
index 14367ae..481d891 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -3247,6 +3247,21 @@ void draw_parts(pixel *vid)
}
}
+ else if (t==PT_GBMB)
+ {
+ x = nx/CELL;
+ y = ny/CELL;
+ if (parts[i].tmp==1) {
+ fire_r[y][x] = (int)((float)parts[i].life/100.0 * 25);
+ fire_g[y][x] = (int)((float)parts[i].life/100.0 * 50);
+ fire_b[y][x] = (int)((float)parts[i].life/100.0 * 255);
+ }
+
+ else {
+ blendpixel(vid, nx, ny, 255, 255, 255, 255);
+ }
+
+ }
else if (ptypes[t].properties&PROP_HOT_GLOW && parts[i].temp>(ptransitions[t].thv-800.0f))
{
float frequency = 3.1415/(2*ptransitions[t].thv-(ptransitions[t].thv-800.0f));
diff --git a/src/powder.c b/src/powder.c
index 595132b..37690f9 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -364,7 +364,8 @@ int try_move(int i, int x, int y, int nx, int ny)
parts[e].y += y-ny;
pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type;
}
-
+ if(parts[i].type==PT_GBMB&&parts[i].tmp==1)
+ return 0;
return 1;
}