diff options
| author | Simon <simon@hardwired.org.uk> | 2011-04-04 15:26:29 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2011-04-04 15:26:29 (GMT) |
| commit | 050f71fbabba071a804d4c5a191999517c2e04ef (patch) | |
| tree | f3a439d4ddadb808cc26d17749fec79c7767efc5 | |
| parent | a1b13080391d95db588fe90a1813d60bd6d00d50 (diff) | |
| parent | db406494bd32d46cfff71cf387c682c1e32d9601 (diff) | |
| download | powder-050f71fbabba071a804d4c5a191999517c2e04ef.zip powder-050f71fbabba071a804d4c5a191999517c2e04ef.tar.gz | |
Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
| -rw-r--r-- | includes/powder.h | 8 | ||||
| -rw-r--r-- | src/elements/O2.c | 21 | ||||
| -rw-r--r-- | src/elements/h2.c | 20 |
3 files changed, 46 insertions, 3 deletions
diff --git a/includes/powder.h b/includes/powder.h index b4b0d52..892b052 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -198,7 +198,8 @@ #define PT_FROG 145 #define PT_BRAN 146 #define PT_WIND 147 -#define PT_NUM 148 +#define PT_H2 148 +#define PT_NUM 149 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -299,6 +300,7 @@ int update_WIFI(UPDATE_FUNC_ARGS); int update_WTRV(UPDATE_FUNC_ARGS); int update_YEST(UPDATE_FUNC_ARGS); int update_O2(UPDATE_FUNC_ARGS); +int update_H2(UPDATE_FUNC_ARGS); int update_MISC(UPDATE_FUNC_ARGS); int update_legacy_PYRO(UPDATE_FUNC_ARGS); @@ -520,6 +522,7 @@ static const part_type ptypes[PT_NUM] = {"FROG", PIXPACK(0x00AA00), 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, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, {"BRAN", PIXPACK(0xCCCC00), 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, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, {"WIND", PIXPACK(0x000000), 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, 0.0f, 40, "Drag tool", ST_NONE, ST_NONE, NULL}, + {"H2", PIXPACK(0x5070FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.10f, 0.00f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 251, "Combines with O2 to make WATR", ST_GAS, TYPE_GAS, &update_H2}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description }; @@ -682,7 +685,8 @@ static part_transition ptransitions[PT_NUM] = /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, - /* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, + /* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, + /* H2 */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, }; #undef IPL #undef IPH diff --git a/src/elements/O2.c b/src/elements/O2.c index 1413d0a..4c019d3 100644 --- a/src/elements/O2.c +++ b/src/elements/O2.c @@ -2,7 +2,7 @@ int update_O2(UPDATE_FUNC_ARGS) { - int r,rx,ry; + int r,rx,ry,n,nx,ny; 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)) @@ -17,7 +17,26 @@ int update_O2(UPDATE_FUNC_ARGS) parts[r>>8].temp+=(rand()/(RAND_MAX/100)); parts[i].tmp++; } + } + + if(pv[y\CELL][x\CELL] > 8.0f) + { + 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_H2) + if(50<(rand()/(RAND_MAX/100))) + part_change_type(i,x,y,PT_WATR) + part_change_type(r,rx,rx,PT_WATR) + } + } + + if(parts[i].tmp>=50) { create_part(i,x,y,PT_FIRE); diff --git a/src/elements/h2.c b/src/elements/h2.c new file mode 100644 index 0000000..8e83ecd --- /dev/null +++ b/src/elements/h2.c @@ -0,0 +1,20 @@ +#include <element.h> + +int update_H2(UPDATE_FUNC_ARGS) +{ + int r,rx,ry,rt; + 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]; + rt = (r&0xFF); + if ((r>>8)>=NPART || !r) + continue; + if(pv[y\CELL][x\CELL] > 8.0f && rt == PT_DESL) + { + part_change_type(r,nx,ny,PT_WATR) + part_change_type(i,x,y,PT_OIL) + } + } +} |
