diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-06-09 10:49:10 (GMT) |
|---|---|---|
| committer | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-06-09 11:37:52 (GMT) |
| commit | 601766a3a0a596ef125c5d59510649178281ca8e (patch) | |
| tree | be626a634ca2d3cbde62f00ef353576f8c538994 /src | |
| parent | 5d4c21d83b0a9120afe67e66aea9a421bc001307 (diff) | |
| download | powder-601766a3a0a596ef125c5d59510649178281ca8e.zip powder-601766a3a0a596ef125c5d59510649178281ca8e.tar.gz | |
Run stacking check less often
But force it to be run after loading a save so that really extreme
numbers of stacked particles form BHOL immediately
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 2 | ||||
| -rw-r--r-- | src/powder.c | 14 | ||||
| -rw-r--r-- | src/save.c | 1 |
3 files changed, 11 insertions, 6 deletions
@@ -1734,6 +1734,8 @@ int main(int argc, char *argv[]) bmap[cby][cbx] = cb_bmap[cby][cbx]; emap[cby][cbx] = cb_emap[cby][cbx]; } + + force_stacking_check = 1;//check for excessive stacking of particles next time update_particles is run } } #ifdef INTERNAL diff --git a/src/powder.c b/src/powder.c index f7c2d9b..9fcb1f0 100644 --- a/src/powder.c +++ b/src/powder.c @@ -29,6 +29,7 @@ int wire_placed = 0; int lighting_recreate = 0; +int force_stacking_check = 0;//whether to force a check for excessively stacked particles playerst player; playerst player2; @@ -1518,28 +1519,29 @@ void update_particles_i(pixel *vid, int start, int inc) if (sys_pause&&!framerender)//do nothing if paused return; - //if ((rand()%NPART)<NUM_PARTS*2) // run more often when more particles are on screen (since this is often due to excessive stacking) - if (1) + if (force_stacking_check || (rand()%10)==0) { + force_stacking_check = 0; excessive_stacking_found = 0; for (y=0; y<YRES; y++) { for (x=0; x<XRES; x++) { // Use a threshold, since some particle stacking can be normal (e.g. BIZR + FILT) - // Setting pmap_count[y][x] >= NPART means BHOL will form in that spot + // Setting pmap_count[y][x] > NPART means BHOL will form in that spot if (pmap_count[y][x]>5) { if (bmap[y/CELL][x/CELL]==WL_EHOLE) { - // Allow more stacking in E-hole, allow up to 1500 particles + // Allow more stacking in E-hole if (pmap_count[y][x]>1500) { pmap_count[y][x] = pmap_count[y][x] + NPART; excessive_stacking_found = 1; } } - else + // Random chance to turn into BHOL that increases with the amount of stacking, up to a threshold where it is certain to turn into BHOL + else if (pmap_count[y][x]>1500 || (rand()%1600)<=(pmap_count[y][x]+100)) { pmap_count[y][x] = pmap_count[y][x] + NPART; excessive_stacking_found = 1; @@ -1564,7 +1566,7 @@ void update_particles_i(pixel *vid, int start, int inc) { create_part(i, x, y, PT_NBHL); parts[i].temp = MAX_TEMP; - parts[i].tmp = pmap_count[y][x]-NPART; + parts[i].tmp = pmap_count[y][x]-NPART;//strength of grav field pmap_count[y][x] = NPART; } else @@ -54,6 +54,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char { return 1; } + force_stacking_check = 1;//check for excessive stacking of particles next time update_particles is run if(saveData[0] == 'O' && saveData[1] == 'P' && saveData[2] == 'S') { return parse_save_OPS(save, size, replace, x0, y0, bmap, vx, vy, pv, fvx, fvy, signs, partsptr, pmap); |
