Added diffusion code for tmp2 in EXOT starting at >100 so that electron patterns won't cause abrupt fission reactions. Also, rearranged air generation line that depends on tmp already so that it doesn't abruptly switch on past 5000 and then violenly explode, but slowly increments instead.

This commit is contained in:
Catelite 2012-06-06 11:11:05 -04:00 committed by Simon Robertshaw
parent c07afe4c89
commit f77f1ab485
2 changed files with 39 additions and 8 deletions

View File

@ -16,7 +16,8 @@
#include <element.h> #include <element.h>
int update_EXOT(UPDATE_FUNC_ARGS) { int update_EXOT(UPDATE_FUNC_ARGS) {
int r, rt, rx, ry, nb, rrx, rry; int r, rt, rx, ry, nb, rrx, rry, trade, tym, t;
t = parts[i].type;
for (rx=-2; rx<=2; rx++) for (rx=-2; rx<=2; rx++)
for (ry=-2; ry<=2; ry++) for (ry=-2; ry<=2; ry++)
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) { if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) {
@ -28,7 +29,7 @@ int update_EXOT(UPDATE_FUNC_ARGS) {
if (parts[r>>8].tmp2>2000) if (parts[r>>8].tmp2>2000)
if (1>rand()%100) if (1>rand()%100)
{ {
parts[i].tmp2 += 50; parts[i].tmp2 += 100;
} }
} }
} }
@ -38,19 +39,49 @@ int update_EXOT(UPDATE_FUNC_ARGS) {
parts[i].tmp = 250; parts[i].tmp = 250;
if (parts[i].tmp2<1) if (parts[i].tmp2<1)
parts[i].tmp2 = 1; parts[i].tmp2 = 1;
else if (parts[i].tmp2>2500) else if (parts[i].tmp2>6000)
{ {
parts[i].tmp2 = 2500; parts[i].tmp2 = 6000;
part_change_type(i, x, y, PT_WARP); part_change_type(i, x, y, PT_WARP);
parts[i].temp = 10000; parts[i].temp = 10000;
} }
else else
pv[y/CELL][x/CELL] += (parts[i].tmp2/2000) * CFDS; pv[y/CELL][x/CELL] += (parts[i].tmp2*CFDS)/40000;
if (pv[y/CELL][x/CELL]>200 && parts[i].temp>9000 && parts[i].tmp2>200) if (pv[y/CELL][x/CELL]>200 && parts[i].temp>9000 && parts[i].tmp2>200)
{ {
part_change_type(i, x, y, PT_WARP); part_change_type(i, x, y, PT_WARP);
parts[i].tmp2 = 2500; parts[i].tmp2 = 6000;
} }
if (parts[i].tmp2>100)
{
for ( trade = 0; trade<9; trade ++)
{
rx = rand()%5-2;
ry = rand()%5-2;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if (!r)
continue;
if ((r&0xFF)==t && (parts[i].tmp2>parts[r>>8].tmp2) && parts[r>>8].tmp2>=0 )//diffusion
{
tym = parts[i].tmp2 - parts[r>>8].tmp2;
if (tym ==1)
{
parts[r>>8].tmp2 ++;
parts[i].tmp2 --;
break;
}
if (tym>0)
{
parts[r>>8].tmp2 += tym/2;
parts[i].tmp2 -= tym/2;
break;
}
}
}
}
}
return 0; return 0;
} }
int graphics_EXOT(GRAPHICS_FUNC_ARGS) int graphics_EXOT(GRAPHICS_FUNC_ARGS)

View File

@ -21,8 +21,8 @@ int update_WARP(UPDATE_FUNC_ARGS) {
if (parts[i].tmp2>2000) if (parts[i].tmp2>2000)
{ {
parts[i].temp = 10000; parts[i].temp = 10000;
pv[y/CELL][x/CELL] += (parts[i].tmp2/2000) * CFDS; pv[y/CELL][x/CELL] += (parts[i].tmp2/5000) * CFDS;
if (2>rand()%1000) if (2>rand()%100)
create_part(-3, x, y, PT_ELEC); create_part(-3, x, y, PT_ELEC);
} }
for ( trade = 0; trade<5; trade ++) for ( trade = 0; trade<5; trade ++)