From dc318fa14aa15d6db3588981544b5f563977f9fb Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sat, 11 Dec 2010 23:31:08 -0500 Subject: [PATCH] more small changes/fixes. Generation count for GoL in debug, resets with 'r'. --- includes/defines.h | 1 + includes/powder.h | 34 +++++++++++------------ src/graphics.c | 20 ++++++++++++++ src/main.c | 8 +++--- src/powder.c | 67 ++++++++++++++++++++++++++++++++-------------- 5 files changed, 90 insertions(+), 40 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index fb52c2e97..0b0a67961 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -137,6 +137,7 @@ int CURRENT_BRUSH; int GRID_MODE; int VINE_MODE; int DEBUG_MODE; +int GENERATION; extern sign signs[MAXSIGNS]; extern stamp stamps[STAMP_MAX]; extern int stamp_count; diff --git a/includes/powder.h b/includes/powder.h index 589932c44..e9b4d4823 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -6,8 +6,8 @@ #include "interface.h" #define CM_COUNT 10 -#define CM_GRAD 9 -#define CM_CRACK 8 +#define CM_CRACK 9 +#define CM_GRAD 8 #define CM_NOTHING 7 #define CM_FANCY 6 #define CM_HEAT 5 @@ -150,9 +150,9 @@ #define PT_FRZZ 100 #define PT_FRZW 101 #define PT_GRAV 102 -#define PT_A_A 103 -#define PT_A_AG 104 -#define PT_A_AS 105 +#define PT_BIZR 103 +#define PT_BIZRG 104 +#define PT_BIZRS 105 #define PT_INST 106 #define PT_ISOZ 107 #define PT_ISZS 108 @@ -164,8 +164,8 @@ #define PT_VINE 114 #define PT_INVIS 115 #define PT_EQUALVEL 116//all particles equal their velocities -#define PT_INST2 117 -#define PT_INST3 118 +#define PT_INST2 117//blank element, replace with something new, has to be here for numbering +#define PT_INST3 118//blank same as above #define PT_SHLD1 119 #define PT_SHLD2 120 #define PT_SHLD3 121 @@ -369,9 +369,9 @@ static const part_type ptypes[PT_NUM] = {"FRZZ", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_CRACKER2, 90.0f, 46, "FREEZE", TYPE_PART}, {"FRZW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_CRACKER2, 120.0f, 29, "FREEZE WATER", TYPE_LIQUID}, {"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Changes colour based on velocity.", TYPE_PART}, - {"@_@", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP+0.0f +273.15f, 29, "@_@, contradicts the normal state changes.", TYPE_LIQUID}, - {"@_@G", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "@_@ gas", TYPE_GAS}, - {"@_@S", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER2, R_TEMP+300.0f+273.15f, 251, "@_@ solid", TYPE_SOLID}, + {"BIZR", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP+0.0f +273.15f, 29, "Bizarre... contradicts the normal state changes.", TYPE_LIQUID}, + {"BIZG", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "Bizarre gas", TYPE_GAS}, + {"BIZS", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER2, R_TEMP+300.0f+273.15f, 251, "Bizarre solid", TYPE_SOLID}, {"INST", PIXPACK(0x404039), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls, is now also a battery, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS}, {"ISOZ", PIXPACK(0xAA30D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE}, {"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID}, @@ -392,8 +392,8 @@ static const part_type ptypes[PT_NUM] = {"LOLZ", PIXPACK(0x569212), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_CRACKER2, 373.0f, 40, "Lolz", TYPE_SOLID}, {"WIFI", PIXPACK(0x40A060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 0, "Wireless transmitter, color coded.", TYPE_SOLID}, {"FILT", PIXPACK(0x000056), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID}, - {"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID}, - {"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID} + {"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID}, + {"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID} //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description }; @@ -503,9 +503,9 @@ static part_state pstates[PT_NUM] = /* FRZZ */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FRZW */ {ST_LIQUID, PT_ICEI, 53.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GRAV */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* @_@ */ {ST_LIQUID, PT_A_AG, 100.0f, PT_NONE, 0.0f, PT_A_AS, 400.0f, PT_NONE, 0.0f}, - /* @_@g */ {ST_GAS , PT_A_AG, 100.0f, PT_A_A , 273.0f, PT_A_AS, 400.0f, PT_NONE, 0.0f}, - /* @_@s */ {ST_SOLID, PT_A_AG, 100.0f, PT_A_A , 273.0f, PT_A_AS, 400.0f, PT_NONE, 0.0f}, + /* BIZR */ {ST_LIQUID, PT_BIZRG, 100.0f, PT_NONE, 0.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f}, + /* BIZRG*/ {ST_GAS , PT_BIZRG, 100.0f, PT_BIZR , 273.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f}, + /* BIZRS*/ {ST_SOLID, PT_BIZRG, 100.0f, PT_BIZR , 273.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f}, /* INST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ISOZ */ {ST_LIQUID, PT_ISZS, 160.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ISZS */ {ST_SOLID, PT_NONE, 0.0f, PT_ISOZ, 300.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -526,8 +526,8 @@ static part_state pstates[PT_NUM] = /* LOlZ */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WIFI */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FILT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ARAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f} + /* ARAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f} }; static int grule[NGOL][9] = diff --git a/src/graphics.c b/src/graphics.c index 90a143868..8dfea36be 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1605,6 +1605,26 @@ void draw_parts(pixel *vid) } } } + else if((t==PT_BIZR||t==PT_BIZRG)&&parts[i].ctype) + { + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } else if(t==PT_PIPE) { if(parts[i].ctype==2) diff --git a/src/main.c b/src/main.c index fd153df6e..e45c80525 100644 --- a/src/main.c +++ b/src/main.c @@ -1371,11 +1371,11 @@ int main(int argc, char *argv[]) } if(sdl_key=='9') { - set_cmode(CM_CRACK); + set_cmode(CM_GRAD); } if(sdl_key=='0') { - set_cmode(CM_GRAD); + set_cmode(CM_CRACK); } if(sdl_key==SDLK_TAB) { @@ -1463,6 +1463,8 @@ int main(int argc, char *argv[]) } if(sdl_key=='d') DEBUG_MODE = !DEBUG_MODE; + if(sdl_key=='r') + GENERATION = 0; if(sdl_key=='i') { int nx, ny; @@ -2264,7 +2266,7 @@ int main(int argc, char *argv[]) sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS); #else if(DEBUG_MODE) - sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS); + sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION); else sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB); #endif diff --git a/src/powder.c b/src/powder.c index 3734fa9d8..f03755be3 100644 --- a/src/powder.c +++ b/src/powder.c @@ -83,7 +83,8 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(pt==PT_STKM) //Stick man's head shouldn't collide return 2; - + if((pt==PT_BIZR||pt==PT_BIZRG)&&(r&0xFF)==PT_FILT) + return 2; if(bmap[ny/CELL][nx/CELL]==WL_ALLOWGAS && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) return 0; if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==WL_ALLOWLIQUID) @@ -169,6 +170,13 @@ int try_move(int i, int x, int y, int nx, int ny) if(rand() < RAND_MAX/10) create_cherenkov_photon(i); } + if((parts[i].type==PT_BIZR||parts[i].type==PT_BIZRG) && (r&0xFF)==PT_FILT) + { + int temp_bin = (int)((parts[r>>8].temp-273.0f)*0.025f); + if(temp_bin < 0) temp_bin = 0; + if(temp_bin > 25) temp_bin = 25; + parts[i].ctype = 0x1F << temp_bin; + } return 1; } @@ -1026,6 +1034,7 @@ void update_particles_i(pixel *vid, int start, int inc) } if(ISGOL==1&&CGOL>=GSPEED)//GSPEED is frames per generation { + int createdsomething = 0; for(nx=4;nx=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2) { - create_part(-1,nx,ny,golnum+77); + if(create_part(-1,nx,ny,golnum+77)) + createdsomething = 1; } else if(neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2))//subtract 1 because it counted itself parts[pmap[ny][nx]>>8].type = PT_NONE; @@ -1104,6 +1114,8 @@ void update_particles_i(pixel *vid, int start, int inc) for( z = 1;z>8)>=NPART || !r) continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)) + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>8].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZRG&&parts[i].type==PT_FILT)) { h_count++; c_heat += parts[r>>8].temp; @@ -1467,7 +1479,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)) + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>8].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZRG&&parts[i].type==PT_FILT)) { parts[r>>8].temp = parts[i].temp; } @@ -1542,7 +1554,7 @@ void update_particles_i(pixel *vid, int start, int inc) else { t = parts[i].type = pstates[t].gas; - if(t!=PT_A_AS) + if(t!=PT_BIZRS) pv[y/CELL][x/CELL] += 0.50f; if(t==PT_FIRE) parts[i].life = rand()%50+120; @@ -2120,7 +2132,7 @@ void update_particles_i(pixel *vid, int start, int inc) } else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) { - parts[r>>8].type = PT_SLTW; + parts[r>>8].type = PT_NONE; } if((r&0xFF)==PT_PLNT&&5>(rand()%1000)) parts[r>>8].type = PT_NONE; @@ -2329,12 +2341,12 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].vx *= 0.90; parts[i].vy *= 0.90; parts[r>>8].type = PT_PHOT; - rrr = (rand()%8) * 0.78540f; + rrr = (rand()%360)*3.14159f/180.0f; rr = (rand()%128+128)/127.0f; parts[r>>8].life = 680; parts[r>>8].ctype = 0x3FFFFFFF; - parts[r>>8].vx = rr*cosf(a); - parts[r>>8].vy = rr*sinf(a); + parts[r>>8].vx = rr*cosf(rrr); + parts[r>>8].vy = rr*sinf(rrr); pv[y/CELL][x/CELL] -= 15.0f * CFDS; } if((r&0xFF)==PT_ISZS && 5>(rand()%2000)) @@ -2343,11 +2355,11 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].vy *= 0.90; parts[r>>8].type = PT_PHOT; rr = (rand()%228+128)/127.0f; - rrr = (rand()%8) * 0.78540f; + rrr = (rand()%360)*3.14159f/180.0f; parts[r>>8].life = 680; parts[r>>8].ctype = 0x3FFFFFFF; - parts[r>>8].vx = rr*cosf(a); - parts[r>>8].vy = rr*sinf(a); + parts[r>>8].vx = rr*cosf(rrr); + parts[r>>8].vy = rr*sinf(rrr); pv[y/CELL][x/CELL] -= 15.0f * CFDS; } } @@ -2355,7 +2367,7 @@ void update_particles_i(pixel *vid, int start, int inc) else if(t==PT_MORT) { create_part(-1, x, y-1, PT_SMKE); } - else if(t==PT_GOL||t==PT_HLIF||t==PT_ASIM||t==PT_2x2||t==PT_DANI||t==PT_AMOE||t==PT_MOVE||t==PT_PGOL||t==PT_DMOE||t==PT_34||t==PT_LLIF||t==PT_STAN) + else if(t>77&&t<77+NGOL) { if(parts[i].temp>0) parts[i].temp -= 50.0f; @@ -2780,7 +2792,11 @@ void update_particles_i(pixel *vid, int start, int inc) continue; else if(!r&&parts[i].tmp!=0) { - create_part(-1,x+nx,y+ny,parts[i].tmp); + if(create_part(-1,x+nx,y+ny,parts[i].tmp)) + { + parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;//pipe saves temp and life now + parts[pmap[y+ny][x+nx]>>8].life = parts[i].flags; + } parts[i].tmp = 0; continue; } @@ -2789,11 +2805,15 @@ void update_particles_i(pixel *vid, int start, int inc) else if(parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS)) { parts[i].tmp = parts[r>>8].type; + parts[i].temp = parts[r>>8].temp; + parts[i].flags = parts[r>>8].life; parts[r>>8].type = PT_NONE; } else if(parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0) { parts[r>>8].tmp = parts[i].tmp; + parts[r>>8].temp = parts[i].temp; + parts[r>>8].flags = parts[i].flags; parts[i].tmp = 0; } } @@ -4040,7 +4060,14 @@ killed: } } } - } else { + } + else if(parts[i].ctype>77&&parts[i].ctype<77+NGOL) { + for(nx=-1; nx<2; nx++) { + for(ny=-1; ny<2; ny++) { + create_part(-1, x+nx, y+ny, parts[i].ctype); + } + } + }else { create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } } @@ -4177,8 +4204,8 @@ killed: else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) { s = 0; - if(!rt || nt) - rt = 50; + if(!rt || nt) //nt is if there is an something else besides the current particle type, around the particle + rt = 30;//slight less water lag, although it changes how it moves a lot else rt = 10; for(j=x+r; j>=0 && j>=x-rt && j