diff --git a/includes/powder.h b/includes/powder.h index c888e6b91..cbab5a2e1 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -759,6 +759,7 @@ extern int portal_rx[8]; extern int portal_ry[8]; extern int wire_placed; +extern int force_stacking_check; extern playerst player; extern playerst player2; diff --git a/src/main.c b/src/main.c index b181182d2..967df060c 100644 --- a/src/main.c +++ b/src/main.c @@ -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 f7c2d9ba9..9fcb1f0bf 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)= 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 diff --git a/src/save.c b/src/save.c index 7e3c26bc7..9a1023581 100644 --- a/src/save.c +++ b/src/save.c @@ -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);