diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-11 20:02:58 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-11 20:02:58 (GMT) |
| commit | d7fa0b139e5a91c3b1d406e63cae4a6ad79d0cd0 (patch) | |
| tree | 754ebce0c56f03fe4a8f7e0278584d40c008e2c0 /src | |
| parent | de6203e049a148e16737e76c124fc59d0ed1a862 (diff) | |
| download | powder-d7fa0b139e5a91c3b1d406e63cae4a6ad79d0cd0.zip powder-d7fa0b139e5a91c3b1d406e63cae4a6ad79d0cd0.tar.gz | |
New element: Titanium, absorbs some neutrons, acts as a solid wall to air. Move blockair filling into update_particles so it can be used by elements
Diffstat (limited to 'src')
| -rw-r--r-- | src/air.c | 13 | ||||
| -rw-r--r-- | src/elementdata.c | 6 | ||||
| -rw-r--r-- | src/elements/neut.c | 5 | ||||
| -rw-r--r-- | src/elements/ttan.c | 22 | ||||
| -rw-r--r-- | src/powder.c | 7 |
5 files changed, 39 insertions, 14 deletions
@@ -57,11 +57,7 @@ void update_airh(void) { int x, y, i, j; float odh, dh, dx, dy, f, tx, ty; - for (y=0; y<YRES/CELL; y++) - for (x=0; x<XRES/CELL; x++) - { - bmap_blockairh[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_GRAV || (bmap[y][x]==WL_EWALL && !emap[y][x])); - } + for (i=0; i<YRES/CELL; i++) //reduces pressure/velocity on the edges every frame { hv[i][0] = 295.15f; @@ -138,12 +134,7 @@ void update_air(void) { int x, y, i, j; float dp, dx, dy, f, tx, ty; - - for (y=0; y<YRES/CELL; y++) - for (x=0; x<XRES/CELL; x++) - { - bmap_blockair[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || (bmap[y][x]==WL_EWALL && !emap[y][x])); - } + if (airMode != 4) { //airMode 4 is no air/pressure update for (i=0; i<YRES/CELL; i++) //reduces pressure/velocity on the edges every frame diff --git a/src/elementdata.c b/src/elementdata.c index a82599e..8f0fdd9 100644 --- a/src/elementdata.c +++ b/src/elementdata.c @@ -173,9 +173,9 @@ part_type ptypes[PT_NUM] = {"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}, {"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}, - {"GEL", PIXPACK(0xFF9900), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 35, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Gel. A liquid with variable viscosity and heat conductivity", ST_LIQUID, TYPE_LIQUID|PROP_LIFE_DEC|PROP_NEUTPENETRATE, &update_GEL, &graphics_GEL}, + {"GEL", PIXPACK(0xFF9900), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 35, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Gel. A liquid with variable viscosity and heat conductivity", ST_LIQUID, TYPE_LIQUID|PROP_LIFE_DEC|PROP_NEUTPENETRATE, &update_GEL, &graphics_GEL}, {"TRON", 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, 1, 100, SC_SPECIAL, 0.0f, 40, "Smart particles, Travels in straight lines and avoids obstacles. Grows with time.", ST_NONE, TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_TRON, &graphics_TRON}, - /*FREE*/{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL, NULL}, + {"TTAN", PIXPACK(0x909090), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Titanium, Higher melting temperature than other metals, blocks all air pressure", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, &update_TTAN, NULL}, /*FREE*/{"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, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL, NULL}, /*FREE*/{"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, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL, NULL}, /*FREE*/{"WIND", PIXPACK(0x101010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_SPECIAL, 0.0f, 40, "", ST_NONE, ST_NONE, NULL, NULL}, @@ -351,7 +351,7 @@ part_transition ptransitions[PT_NUM] = /* BOYL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GEL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* TRON */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, - /*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, + /* TTAN */ {IPL, NT, IPH, NT, ITL, NT, 1941.0f,PT_LAVA}, /*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /*FREE*//* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* WIND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, diff --git a/src/elements/neut.c b/src/elements/neut.c index 21e0b90..658195a 100644 --- a/src/elements/neut.c +++ b/src/elements/neut.c @@ -138,6 +138,11 @@ int update_NEUT(UPDATE_FUNC_ARGS) { parts[r>>8].ctype = PT_DUST; else if ((r&0xFF)==PT_ACID && 5>(rand()%100)) create_part(r>>8, x+rx, y+ry, PT_ISOZ); + else if ((r&0xFF)==PT_TTAN && 5>(rand()%100)) + { + kill_part(i); + return 1; + } /*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|| diff --git a/src/elements/ttan.c b/src/elements/ttan.c new file mode 100644 index 0000000..82d2897 --- /dev/null +++ b/src/elements/ttan.c @@ -0,0 +1,22 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <element.h> + +int update_TTAN(UPDATE_FUNC_ARGS) { + bmap_blockair[y/CELL][x/CELL] = 1; + bmap_blockairh[y/CELL][x/CELL] = 1; + return 0; +} diff --git a/src/powder.c b/src/powder.c index 9b4d101..3d5ed42 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2778,6 +2778,13 @@ void update_particles(pixel *vid)//doesn't update the particles themselves, but } } } + + for (y=0; y<YRES/CELL; y++) + for (x=0; x<XRES/CELL; x++) + { + bmap_blockair[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || (bmap[y][x]==WL_EWALL && !emap[y][x])); + bmap_blockairh[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_GRAV || (bmap[y][x]==WL_EWALL && !emap[y][x])); + } update_particles_i(vid, 0, 1); |
