diff options
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/bcol.c | 34 | ||||
| -rw-r--r-- | src/elements/coal.c | 34 |
2 files changed, 66 insertions, 2 deletions
diff --git a/src/elements/bcol.c b/src/elements/bcol.c index de394bc..bc8713c 100644 --- a/src/elements/bcol.c +++ b/src/elements/bcol.c @@ -1,7 +1,7 @@ #include <element.h> int update_BCOL(UPDATE_FUNC_ARGS) { - int r, rx, ry; + int r, rx, ry, trade, temp; if (parts[i].life<=0) { create_part(i, x, y, PT_FIRE); return 1; @@ -32,5 +32,37 @@ int update_BCOL(UPDATE_FUNC_ARGS) { } } } + /*if(100-parts[i].life > parts[i].tmp2) + parts[i].tmp2 = 100-parts[i].life; + if(parts[i].tmp2 < 0) parts[i].tmp2 = 0; + for ( trade = 0; trade<4; 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>>8)>=NPART || !r) + continue; + if (((r&0xFF)==PT_COAL || (r&0xFF)==PT_BCOL)&&(parts[i].tmp2>parts[r>>8].tmp2)&&parts[i].tmp2>0)//diffusion + { + int temp = parts[i].tmp2 - parts[r>>8].tmp2; + if(temp < 10) + continue; + if (temp ==1) + { + parts[r>>8].tmp2 ++; + parts[i].tmp2 --; + } + else if (temp>0) + { + parts[r>>8].tmp2 += temp/2; + parts[i].tmp2 -= temp/2; + } + } + } + }*/ + if(parts[i].temp > parts[i].tmp2) + parts[i].tmp2 = parts[i].temp; return 0; } diff --git a/src/elements/coal.c b/src/elements/coal.c index 424a1a1..e111890 100644 --- a/src/elements/coal.c +++ b/src/elements/coal.c @@ -1,7 +1,7 @@ #include <element.h> int update_COAL(UPDATE_FUNC_ARGS) { - int r, rx, ry; + int r, rx, ry, trade, temp; if (parts[i].life<=0) { create_part(i, x, y, PT_FIRE); return 1; @@ -39,5 +39,37 @@ int update_COAL(UPDATE_FUNC_ARGS) { } } } + /*if(100-parts[i].life > parts[i].tmp2) + parts[i].tmp2 = 100-parts[i].life; + if(parts[i].tmp2 < 0) parts[i].tmp2 = 0; + for ( trade = 0; trade<4; 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>>8)>=NPART || !r) + continue; + if (((r&0xFF)==PT_COAL || (r&0xFF)==PT_BCOL)&&(parts[i].tmp2>parts[r>>8].tmp2)&&parts[i].tmp2>0)//diffusion + { + int temp = parts[i].tmp2 - parts[r>>8].tmp2; + if(temp < 10) + continue; + if (temp ==1) + { + parts[r>>8].tmp2 ++; + parts[i].tmp2 --; + } + else if (temp>0) + { + parts[r>>8].tmp2 += temp/2; + parts[i].tmp2 -= temp/2; + } + } + } + }*/ + if(parts[i].temp > parts[i].tmp2) + parts[i].tmp2 = parts[i].temp; return 0; } |
