From d7fa0b139e5a91c3b1d406e63cae4a6ad79d0cd0 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Fri, 11 May 2012 21:02:58 +0100 Subject: [PATCH] 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 --- includes/air.h | 2 ++ includes/powder.h | 2 ++ src/air.c | 13 ++----------- src/elementdata.c | 6 +++--- src/elements/neut.c | 5 +++++ src/elements/ttan.c | 22 ++++++++++++++++++++++ src/powder.c | 7 +++++++ 7 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 src/elements/ttan.c diff --git a/includes/air.h b/includes/air.h index 47bf501c0..1395d2c54 100644 --- a/includes/air.h +++ b/includes/air.h @@ -21,6 +21,8 @@ extern float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; extern float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; extern float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; +extern unsigned char bmap_blockair[YRES/CELL][XRES/CELL]; +extern unsigned char bmap_blockairh[YRES/CELL][XRES/CELL]; extern float cb_vx[YRES/CELL][XRES/CELL]; extern float cb_vy[YRES/CELL][XRES/CELL]; diff --git a/includes/powder.h b/includes/powder.h index c798f43a2..92310c144 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -219,6 +219,7 @@ #define PT_BOYL 141 #define PT_GEL 142 #define PT_TRON 143 +#define PT_TTAN 144 #define OLD_PT_WIND 147 #define PT_H2 148 @@ -464,6 +465,7 @@ int update_IGNT(UPDATE_FUNC_ARGS); int update_FRAY(UPDATE_FUNC_ARGS); int update_REPL(UPDATE_FUNC_ARGS); int update_TRON(UPDATE_FUNC_ARGS); +int update_TTAN(UPDATE_FUNC_ARGS); int update_MISC(UPDATE_FUNC_ARGS); int update_legacy_PYRO(UPDATE_FUNC_ARGS); diff --git a/src/air.c b/src/air.c index 4f2455e05..eb7f47ffc 100644 --- a/src/air.c +++ b/src/air.c @@ -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>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 000000000..82d2897c2 --- /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 . + */ + +#include + +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 9b4d10191..3d5ed421b 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