summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-04-25 19:41:45 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-04-25 19:41:45 (GMT)
commitb26648e6aeb80f22c70e7ab551a3417bcdae8c6b (patch)
treee1fce618b2d4b45a6b6b36495fddba919bf28c25 /src/elements
parent24f59050204017c641749c59a69e40d53074c028 (diff)
downloadpowder-b26648e6aeb80f22c70e7ab551a3417bcdae8c6b.zip
powder-b26648e6aeb80f22c70e7ab551a3417bcdae8c6b.tar.gz
Fix pause with gravity and test deuterium improvements
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/neut.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/src/elements/neut.c b/src/elements/neut.c
index c91c98b..789a033 100644
--- a/src/elements/neut.c
+++ b/src/elements/neut.c
@@ -1,5 +1,49 @@
#include <element.h>
+#if defined(WIN32) && !defined(__GNUC__)
+_inline int create_n_parts(int n, int x, int y, float vx, float vy, int t)
+#else
+inline int create_n_parts(int n, int x, int y, float vx, float vy, int t)//testing a new deut create part
+#endif
+{
+ int i, c;
+ n = (n/50);
+ if (n<1) {
+ n = 1;
+ }
+ if (n>340) {
+ n = 340;
+ }
+ if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM)
+ return -1;
+
+ for (c=0; c<n; c++) {
+ float r = (rand()%128+128)/127.0f;
+ float a = (rand()%360)*M_PI/180.0f;
+ if (pfree == -1)
+ return -1;
+ i = pfree;
+ pfree = parts[i].life;
+
+ parts[i].x = (float)x;
+ parts[i].y = (float)y;
+ parts[i].type = t;
+ parts[i].life = rand()%480+480;
+ parts[i].vx = r*cosf(a);
+ parts[i].vy = r*sinf(a);
+ parts[i].ctype = 0;
+ parts[i].temp += (n*170);
+ parts[i].tmp = 0;
+ if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT && t!=PT_NEUT && !pmap[y][x])
+ pmap[y][x] = t|(i<<8);
+ else if ((t==PT_PHOT||t==PT_NEUT) && !photons[y][x])
+ photons[y][x] = t|(i<<8);
+
+ pv[y/CELL][x/CELL] += 6.0f * CFDS;
+ }
+ return 0;
+}
+
int update_NEUT(UPDATE_FUNC_ARGS) {
int r, rx, ry, rt;
int pressureFactor = 3 + (int)pv[y/CELL][x/CELL];
@@ -35,11 +79,15 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough
update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
}
- else if ((r&0xFF)==PT_DEUT && (pressureFactor+1)>(rand()%1000))
- {
#ifdef SDEUT
+ else if ((r&0xFF)==PT_DEUT && (pressureFactor+1+(parts[i].life/100))>(rand()%1000))
+ {
create_n_parts(parts[r>>8].life, x+rx, y+ry, parts[i].vx, parts[i].vy, PT_NEUT);
+ kill_part(r>>8);
+ }
#else
+ else if ((r&0xFF)==PT_DEUT && (pressureFactor+1)>(rand()%1000))
+ {
create_part(r>>8, x+rx, y+ry, PT_NEUT);
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
@@ -51,8 +99,8 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
}
else
kill_part(r>>8);
-#endif
}
+#endif
else if ((r&0xFF)==PT_GUNP && 15>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_DUST);
else if ((r&0xFF)==PT_DYST && 15>(rand()%1000))