summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-01-19 19:25:56 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-01-19 19:25:56 (GMT)
commit1b35811bd4fe026ff270c25f0aaf063e3eb45dd6 (patch)
tree01503f2d813fce196997283cacc05ff26999abea /src
parentff01973658fc72b107c820e7f9f738e1a872b261 (diff)
downloadpowder-1b35811bd4fe026ff270c25f0aaf063e3eb45dd6.zip
powder-1b35811bd4fe026ff270c25f0aaf063e3eb45dd6.tar.gz
revert all limit changes, a little too glitchy, can be done later when current limit is reached.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c32
-rw-r--r--src/interface.c2
-rw-r--r--src/main.c38
-rw-r--r--src/powder.c1699
4 files changed, 893 insertions, 878 deletions
diff --git a/src/graphics.c b/src/graphics.c
index ce6c561..286182a 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -447,7 +447,7 @@ void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswa
int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
{
int i, j, c;
- if(b>=UI_WALLSTART && b<=UI_WALLSTART+UI_WALLCOUNT)
+ if(b>=UI_WALLSTART)
{
b = b-100;
//x = (2+32*((b-22)/1));
@@ -1451,13 +1451,13 @@ void draw_parts(pixel *vid)
}
else
{
- cr = PIXR(ptypes[t].pcolors);
- cg = PIXG(ptypes[t].pcolors);
- cb = PIXB(ptypes[t].pcolors);
- blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ cr = PIXR(ptypes[t].pcolors);
+ cg = PIXG(ptypes[t].pcolors);
+ cb = PIXB(ptypes[t].pcolors);
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
- }
- else if(cmode==CM_GRAD)
+ }
+ else if(cmode==CM_GRAD)//forgot to put else, broke nothing view
{
float frequency = 0.05;
int q = parts[i].temp-40;
@@ -2073,7 +2073,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32);
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32);
}
- }
+ }
else if(t==PT_FILT)
{
int temp_bin = (int)((parts[i].temp-273.0f)*0.025f);
@@ -2901,8 +2901,8 @@ void render_signs(pixel *vid_buf)
}
if(strcmp(signs[i].text, "{t}")==0)
{
- if((pmap[signs[i].y][signs[i].x]>>PS)>0 && (pmap[signs[i].y][signs[i].x]>>PS)<NPART)
- sprintf(buff, "Temp: %4.2f", parts[pmap[signs[i].y][signs[i].x]>>PS].temp-273.15); //...tempirature
+ if((pmap[signs[i].y][signs[i].x]>>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)<NPART)
+ sprintf(buff, "Temp: %4.2f", parts[pmap[signs[i].y][signs[i].x]>>8].temp-273.15); //...tempirature
else
sprintf(buff, "Temp: 0.00"); //...tempirature
drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255);
@@ -3160,12 +3160,12 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
if(!(j%2) && !(i%2))
fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
break;
- case 4:
- for(j=0; j<CELL; j+=2)
- for(i=(j>>1)&1; i<CELL; i+=2)
- fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
- k++;
- break;
+ case 4:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
+ k++;
+ break;
case 6:
for(j=0; j<CELL; j+=2)
for(i=(j>>1)&1; i<CELL; i+=2)
diff --git a/src/interface.c b/src/interface.c
index 0e528ec..b37c3e9 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -1659,7 +1659,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255);
}
- else if(i==SC_WALL||(i==SC_SPECIAL&&h>=UI_WALLSTART&&h<=UI_WALLSTART+UI_WALLCOUNT))
+ else if(i==SC_WALL||(i==SC_SPECIAL&&h>=UI_WALLSTART))
{
drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-UI_WALLSTART].descs)-BARSIZE, sy-10, (char *)mwalls[h-UI_WALLSTART].descs, 255, 255, 255, 255);
}
diff --git a/src/main.c b/src/main.c
index 1e7a6c5..ba20752 100644
--- a/src/main.c
+++ b/src/main.c
@@ -496,7 +496,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);
- pmap[y][x] = (i<<PS)|1;
+ pmap[y][x] = (i<<8)|1;
}
else
fp[nf++] = i;
@@ -573,7 +573,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
if(pmap[y][x])
{
- k = pmap[y][x]>>PS;
+ k = pmap[y][x]>>8;
parts[k].type = j;
if(j == PT_PHOT)
parts[k].ctype = 0x3fffffff;
@@ -1249,7 +1249,7 @@ int main(int argc, char *argv[])
if(!sys_pause||framerender)
{
- update_air();
+ update_air();
}
#ifdef OpenGL
ClearScreen();
@@ -1701,7 +1701,7 @@ int main(int argc, char *argv[])
bsx = 1180;
if(bsx<0)
bsx = 0;
- if(bsy>1180)
+ if(bsy>1180)
bsy = 1180;
if(bsy<0)
bsy = 0;
@@ -1747,28 +1747,28 @@ int main(int argc, char *argv[])
}else{
cr = pmap[y/sdl_scale][x/sdl_scale];
}
- if(!((cr>>PS)>=NPART || !cr))
+ if(!((cr>>8)>=NPART || !cr))
{
#ifdef BETA
if(DEBUG_MODE)
{
- int tctype = parts[cr>>PS].ctype;
+ int tctype = parts[cr>>8].ctype;
if(tctype>=PT_NUM)
tctype = 0;
- sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
- //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, ptypes[parts[cr>>PS].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
+ sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
+ //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
} else
- sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
+ sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
#else
if(DEBUG_MODE)
{
- int tctype = parts[cr>>PS].ctype;
+ int tctype = parts[cr>>8].ctype;
if(tctype>=PT_NUM)
tctype = 0;
- sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d,tmp: %d", ptypes[cr&TYPE].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life,parts[cr>>PS].tmp);
- //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&TYPE].name, ptypes[parts[cr>>PS].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f, parts[cr>>PS].life);
+ sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d,tmp: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life,parts[cr>>8].tmp);
+ //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
} else {
- sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&TYPE].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>PS].temp-273.15f);
+ sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
}
#endif
}
@@ -2076,9 +2076,6 @@ int main(int argc, char *argv[])
memset(bmap, 0, sizeof(bmap));
memset(emap, 0, sizeof(emap));
memset(parts, 0, sizeof(particle)*NPART);
- memset(photons, 0,sizeof(photons));
- memset(wireless, 0, sizeof(wireless));
- memset(gol2, 0, sizeof(gol2));
for(i=0; i<NPART-1; i++)
parts[i].life = i+1;
parts[NPART-1].life = -1;
@@ -2135,7 +2132,10 @@ int main(int argc, char *argv[])
if(x>=19 && x<=35 && svf_last && svf_open && !bq){
//int tpval = sys_pause;
parse_save(svf_last, svf_lsize, 1, 0, 0);
- memset(wireless, 0, sizeof(wireless));
+ for(j= 0;j<99;j++){ //reset wifi on reload
+ wireless[j][0] = 0;
+ wireless[j][1] = 0;
+ }
//sys_pause = tpval;
}
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
@@ -2235,9 +2235,9 @@ int main(int argc, char *argv[])
{
int cr;
cr = pmap[y][x];
- if(!((cr>>PS)>=NPART || !cr))
+ if(!((cr>>8)>=NPART || !cr))
{
- c = sl = cr&TYPE;
+ c = sl = cr&0xFF;
}
else
{
diff --git a/src/powder.c b/src/powder.c
index c38b475..2d9a6d0 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -29,7 +29,7 @@ unsigned photons[YRES][XRES];
static int pn_junction_sprk(int x, int y, int pt)
{
unsigned r = pmap[y][x];
- if((r & TYPE) != pt)
+ if((r & 0xFF) != pt)
return 0;
r >>= 8;
if(parts[r].type != pt)
@@ -47,11 +47,11 @@ static void photoelectric_effect(int nx, int ny)
{
unsigned r = pmap[ny][nx];
- if((r&TYPE) == PT_PSCN) {
- if((pmap[ny][nx-1] & TYPE) == PT_NSCN ||
- (pmap[ny][nx+1] & TYPE) == PT_NSCN ||
- (pmap[ny-1][nx] & TYPE) == PT_NSCN ||
- (pmap[ny+1][nx] & TYPE) == PT_NSCN)
+ if((r&0xFF) == PT_PSCN) {
+ if((pmap[ny][nx-1] & 0xFF) == PT_NSCN ||
+ (pmap[ny][nx+1] & 0xFF) == PT_NSCN ||
+ (pmap[ny-1][nx] & 0xFF) == PT_NSCN ||
+ (pmap[ny+1][nx] & 0xFF) == PT_NSCN)
pn_junction_sprk(nx, ny, PT_PSCN);
}
}
@@ -69,30 +69,30 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr)
return 0;
r = pmap[ny][nx];
- if(r && (r>>PS)<NPART)
- r = (r&~TYPE) | parts[r>>PS].type;
+ if(r && (r>>8)<NPART)
+ r = (r&~0xFF) | parts[r>>8].type;
if(rr)
*rr = r;
- if((r&TYPE)==PT_VOID || (r&TYPE)==PT_BHOL)
+ if((r&0xFF)==PT_VOID || (r&0xFF)==PT_BHOL)
return 1;
if(pt==PT_PHOT&&(
- (r&TYPE)==PT_GLAS || (r&TYPE)==PT_PHOT ||
- (r&TYPE)==PT_CLNE || (r&TYPE)==PT_PCLN ||
- (r&TYPE)==PT_GLOW || (r&TYPE)==PT_WATR ||
- (r&TYPE)==PT_DSTW || (r&TYPE)==PT_SLTW ||
- (r&TYPE)==PT_ISOZ || (r&TYPE)==PT_ISZS ||
- (r&TYPE)==PT_FILT || (r&TYPE)==PT_INVIS ||
- (r&TYPE)==PT_QRTZ || (r&TYPE)==PT_PQRT ||
- ((r&TYPE)==PT_LCRY&&parts[r>>PS].life > 5)))
+ (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT ||
+ (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN ||
+ (r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR ||
+ (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW ||
+ (r&0xFF)==PT_ISOZ || (r&0xFF)==PT_ISZS ||
+ (r&0xFF)==PT_FILT || (r&0xFF)==PT_INVIS ||
+ (r&0xFF)==PT_QRTZ || (r&0xFF)==PT_PQRT ||
+ ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5)))
return 2;
if(pt==PT_STKM) //Stick man's head shouldn't collide
return 2;
if(pt==PT_STKM2) //Stick man's head shouldn't collide
return 2;
- if((pt==PT_BIZR||pt==PT_BIZRG)&&(r&TYPE)==PT_FILT)
+ 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;
@@ -107,19 +107,19 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr)
if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==WL_ALLOWSOLID)
return 0;
- if(r && (r&TYPE) < PT_NUM){
- if(ptypes[pt].properties&TYPE_ENERGY && ptypes[(r&TYPE)].properties&TYPE_ENERGY)
+ if(r && (r&0xFF) < PT_NUM){
+ if(ptypes[pt].properties&TYPE_ENERGY && ptypes[(r&0xFF)].properties&TYPE_ENERGY)
return 2;
- if(pt==PT_NEUT && ptypes[(r&TYPE)].properties&PROP_NEUTPASS)
+ if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPASS)
return 2;
- if(pt==PT_NEUT && ptypes[(r&TYPE)].properties&PROP_NEUTPENETRATE)
+ if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE)
return 1;
- if((r&TYPE)==PT_NEUT && ptypes[pt].properties&PROP_NEUTPENETRATE)
+ if((r&0xFF)==PT_NEUT && ptypes[pt].properties&PROP_NEUTPENETRATE)
return 0;
}
- if (r && ((r&TYPE) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&TYPE)].weight)))
+ if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight)))
return 0;
if(pt == PT_PHOT)
@@ -140,56 +140,56 @@ int try_move(int i, int x, int y, int nx, int ny)
e = eval_move(parts[i].type, nx, ny, &r);
- if((pmap[ny][nx]&TYPE)==PT_BOMB && parts[i].type==PT_BOMB && parts[i].tmp == 1)
+ if((pmap[ny][nx]&0xFF)==PT_BOMB && parts[i].type==PT_BOMB && parts[i].tmp == 1)
e = 2;
- if((pmap[ny][nx]&TYPE)==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
+ if((pmap[ny][nx]&0xFF)==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
return 1;
/* half-silvered mirror */
if(!e && parts[i].type==PT_PHOT &&
- (((r&TYPE)==PT_BMTL && rand()<RAND_MAX/2) ||
- (pmap[y][x]&TYPE)==PT_BMTL))
+ (((r&0xFF)==PT_BMTL && rand()<RAND_MAX/2) ||
+ (pmap[y][x]&0xFF)==PT_BMTL))
e = 2;
if(!e)
{
if(!legacy_enable && parts[i].type==PT_PHOT && r)
{
- if((r & TYPE) == PT_COAL || (r & TYPE) == PT_BCOL)
- parts[r>>PS].temp = parts[i].temp;
+ if((r & 0xFF) == PT_COAL || (r & 0xFF) == PT_BCOL)
+ parts[r>>8].temp = parts[i].temp;
- if((r & TYPE) < PT_NUM && ptypes[r&TYPE].hconduct)
- parts[i].temp = parts[r>>PS].temp = restrict_flt((parts[r>>PS].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP);
+ if((r & 0xFF) < PT_NUM && ptypes[r&0xFF].hconduct)
+ parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP);
}
return 0;
}
if(e == 2)
{
- if(parts[i].type == PT_PHOT && (r&TYPE)==PT_GLOW && !parts[r>>PS].life)
+ if(parts[i].type == PT_PHOT && (r&0xFF)==PT_GLOW && !parts[r>>8].life)
if(rand() < RAND_MAX/30)
{
- parts[r>>PS].life = 120;
+ parts[r>>8].life = 120;
create_gain_photon(i);
}
- if(parts[i].type == PT_PHOT && (r&TYPE)==PT_FILT)
+ if(parts[i].type == PT_PHOT && (r&0xFF)==PT_FILT)
{
- int temp_bin = (int)((parts[r>>PS].temp-273.0f)*0.025f);
+ 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;
}
- if(parts[i].type == PT_NEUT && (r&TYPE)==PT_GLAS) {
+ if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) {
if(rand() < RAND_MAX/10)
create_cherenkov_photon(i);
}
- if(parts[i].type == PT_PHOT && (r&TYPE)==PT_INVIS) {
+ if(parts[i].type == PT_PHOT && (r&0xFF)==PT_INVIS) {
parts[i].type = PT_NEUT;
parts[i].ctype = 0;
}
- if((parts[i].type==PT_BIZR||parts[i].type==PT_BIZRG) && (r&TYPE)==PT_FILT)
+ if((parts[i].type==PT_BIZR||parts[i].type==PT_BIZRG) && (r&0xFF)==PT_FILT)
{
- int temp_bin = (int)((parts[r>>PS].temp-273.0f)*0.025f);
+ 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;
@@ -197,7 +197,7 @@ int try_move(int i, int x, int y, int nx, int ny)
return 1;
}
- if((r&TYPE)==PT_VOID)
+ if((r&0xFF)==PT_VOID)
{
if(parts[i].type == PT_STKM)
{
@@ -212,7 +212,7 @@ int try_move(int i, int x, int y, int nx, int ny)
parts[i].type=PT_NONE;
return 0;
}
- if((r&TYPE)==PT_BHOL)
+ if((r&0xFF)==PT_BHOL)
{
if(parts[i].type == PT_STKM)
{
@@ -227,14 +227,14 @@ int try_move(int i, int x, int y, int nx, int ny)
parts[i].type=PT_NONE;
if(!legacy_enable)
{
- parts[r>>PS].temp = restrict_flt(parts[r>>PS].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f;
+ parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f;
}
return 0;
}
- if((pmap[ny][nx]&TYPE)==PT_CNCT)
+ if((pmap[ny][nx]&0xFF)==PT_CNCT)
return 0;
- if(parts[i].type==PT_CNCT && y<ny && (pmap[y+1][x]&TYPE)==PT_CNCT)
+ if(parts[i].type==PT_CNCT && y<ny && (pmap[y+1][x]&0xFF)==PT_CNCT)
return 0;
if(bmap[ny/CELL][nx/CELL]==WL_EHOLE && !emap[y/CELL][x/CELL])
@@ -242,13 +242,13 @@ int try_move(int i, int x, int y, int nx, int ny)
if((bmap[y/CELL][x/CELL]==WL_EHOLE && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=WL_EHOLE && !emap[ny/CELL][nx/CELL]))
return 0;
- if(r && (r>>PS)<NPART && ptypes[r&TYPE].falldown!=2 && bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID)
+ if(r && (r>>8)<NPART && ptypes[r&0xFF].falldown!=2 && bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID)
return 0;
if(parts[i].type == PT_PHOT)
return 1;
- e = r >>PS;
+ e = r >> 8;
if(r && e<NPART)
{
if(parts[e].type == PT_PHOT)
@@ -258,7 +258,7 @@ int try_move(int i, int x, int y, int nx, int ny)
parts[e].y += y-ny;
}
- pmap[ny][nx] = (i<<PS)|parts[i].type;
+ pmap[ny][nx] = (i<<8)|parts[i].type;
pmap[y][x] = r;
return 1;
@@ -281,7 +281,7 @@ static int is_blocking(int t, int x, int y)
if(t & REFRACT) {
if(x<0 || y<0 || x>=XRES || y>=YRES)
return 0;
- if((pmap[y][x] & TYPE) == PT_GLAS)
+ if((pmap[y][x] & 0xFF) == PT_GLAS)
return 1;
return 0;
}
@@ -422,12 +422,8 @@ void kill_part(int i)
{
ISSPAWN2 = 0;
}
- if (x>=0 && y>=0 && x<XRES && y<YRES) {
- if ((pmap[y][x]>>PS)==i)
- pmap[y][x] = 0;
- else if ((photons[y][x]>>PS)==i)
- photons[y][x] = 0;
- }
+ if(x>=0 && y>=0 && x<XRES && y<YRES)
+ pmap[y][x] = 0;
}
parts[i].type = PT_NONE;
@@ -488,29 +484,29 @@ inline int create_part(int p, int x, int y, int t)
if(t==SPC_HEAT||t==SPC_COOL)
{
- if((pmap[y][x]&TYPE)!=PT_NONE&&(pmap[y][x]&TYPE)<PT_NUM)
+ if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)<PT_NUM)
{
- if(t==SPC_HEAT&&parts[pmap[y][x]>>PS].temp<MAX_TEMP)
+ if(t==SPC_HEAT&&parts[pmap[y][x]>>8].temp<MAX_TEMP)
{
- if((pmap[y][x]&TYPE)==PT_PUMP) {
- parts[pmap[y][x]>>PS].temp = restrict_flt(parts[pmap[y][x]>>PS].temp + 0.1f, MIN_TEMP, MAX_TEMP);
+ if((pmap[y][x]&0xFF)==PT_PUMP) {
+ parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 0.1f, MIN_TEMP, MAX_TEMP);
} else if((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) {
- parts[pmap[y][x]>>PS].temp = restrict_flt(parts[pmap[y][x]>>PS].temp + 50.0f, MIN_TEMP, MAX_TEMP);
+ parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 50.0f, MIN_TEMP, MAX_TEMP);
} else {
- parts[pmap[y][x]>>PS].temp = restrict_flt(parts[pmap[y][x]>>PS].temp + 4.0f, MIN_TEMP, MAX_TEMP);
+ parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP);
}
}
- if(t==SPC_COOL&&parts[pmap[y][x]>>PS].temp>MIN_TEMP)
+ if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP)
{
- if((pmap[y][x]&TYPE)==PT_PUMP) {
- parts[pmap[y][x]>>PS].temp = restrict_flt(parts[pmap[y][x]>>PS].temp - 0.1f, MIN_TEMP, MAX_TEMP);
+ if((pmap[y][x]&0xFF)==PT_PUMP) {
+ parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 0.1f, MIN_TEMP, MAX_TEMP);
} else if((sdl_mod & (KMOD_SHIFT)) && (sdl_mod & (KMOD_CTRL))) {
- parts[pmap[y][x]>>PS].temp = restrict_flt(parts[pmap[y][x]>>PS].temp - 50.0f, MIN_TEMP, MAX_TEMP);
+ parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 50.0f, MIN_TEMP, MAX_TEMP);
} else {
- parts[pmap[y][x]>>PS].temp = restrict_flt(parts[pmap[y][x]>>PS].temp - 4.0f, MIN_TEMP, MAX_TEMP);
+ parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP);
}
}
- return pmap[y][x]>>PS;
+ return pmap[y][x]>>8;
}
else
{
@@ -546,30 +542,30 @@ inline int create_part(int p, int x, int y, int t)
if(t==PT_SPRK)
{
- if((pmap[y][x]&TYPE)!=PT_METL &&
- (pmap[y][x]&TYPE)!=PT_PSCN &&
- (pmap[y][x]&TYPE)!=PT_NSCN &&
- (pmap[y][x]&TYPE)!=PT_NTCT &&
- (pmap[y][x]&TYPE)!=PT_PTCT &&
- (pmap[y][x]&TYPE)!=PT_WATR &&
- (pmap[y][x]&TYPE)!=PT_SLTW &&
- (pmap[y][x]&TYPE)!=PT_BMTL &&
- (pmap[y][x]&TYPE)!=PT_RBDM &&
- (pmap[y][x]&TYPE)!=PT_LRBD &&
- (pmap[y][x]&TYPE)!=PT_ETRD &&
- (pmap[y][x]&TYPE)!=PT_BRMT &&
- (pmap[y][x]&TYPE)!=PT_NBLE &&
- (pmap[y][x]&TYPE)!=PT_IRON &&
- (pmap[y][x]&TYPE)!=PT_INST &&
- (pmap[y][x]&TYPE)!=PT_INWR)
+ if((pmap[y][x]&0xFF)!=PT_METL &&
+ (pmap[y][x]&0xFF)!=PT_PSCN &&
+ (pmap[y][x]&0xFF)!=PT_NSCN &&
+ (pmap[y][x]&0xFF)!=PT_NTCT &&
+ (pmap[y][x]&0xFF)!=PT_PTCT &&
+ (pmap[y][x]&0xFF)!=PT_WATR &&
+ (pmap[y][x]&0xFF)!=PT_SLTW &&
+ (pmap[y][x]&0xFF)!=PT_BMTL &&
+ (pmap[y][x]&0xFF)!=PT_RBDM &&
+ (pmap[y][x]&0xFF)!=PT_LRBD &&
+ (pmap[y][x]&0xFF)!=PT_ETRD &&
+ (pmap[y][x]&0xFF)!=PT_BRMT &&
+ (pmap[y][x]&0xFF)!=PT_NBLE &&
+ (pmap[y][x]&0xFF)!=PT_IRON &&
+ (pmap[y][x]&0xFF)!=PT_INST &&
+ (pmap[y][x]&0xFF)!=PT_INWR)
return -1;
- if(parts[pmap[y][x]>>PS].life!=0)
+ if(parts[pmap[y][x]>>8].life!=0)
return -1;
- parts[pmap[y][x]>>PS].type = PT_SPRK;
- parts[pmap[y][x]>>PS].life = 4;
- parts[pmap[y][x]>>PS].ctype = pmap[y][x]&TYPE;
- pmap[y][x] = (pmap[y][x]&~TYPE) | PT_SPRK;
- return pmap[y][x]>>PS;
+ parts[pmap[y][x]>>8].type = PT_SPRK;
+ parts[pmap[y][x]>>8].life = 4;
+ parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF;
+ pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK;
+ return pmap[y][x]>>8;
}
if(t==PT_SPAWN&&ISSPAWN1)
return -1;
@@ -579,7 +575,7 @@ inline int create_part(int p, int x, int y, int t)
{
if(pmap[y][x])
{
- if((pmap[y][x]&TYPE)!=PT_SPAWN&&(pmap[y][x]&TYPE)!=PT_SPAWN2)
+ if((pmap[y][x]&0xFF)!=PT_SPAWN&&(pmap[y][x]&0xFF)!=PT_SPAWN2)
{
if(t!=PT_STKM&&t!=PT_STKM2)
{
@@ -598,14 +594,14 @@ inline int create_part(int p, int x, int y, int t)
{
if(pmap[y][x])
{
- if(((pmap[y][x]&TYPE)==PT_CLNE||(pmap[y][x]&TYPE)==PT_BCLN||(pmap[y][x]&TYPE)==PT_PCLN)&&(t!=PT_CLNE&&t!=PT_PCLN&&t!=PT_BCLN&&t!=PT_STKM&&t!=PT_STKM2))
+ if(((pmap[y][x]&0xFF)==PT_CLNE||(pmap[y][x]&0xFF)==PT_BCLN||(pmap[y][x]&0xFF)==PT_PCLN)&&(t!=PT_CLNE&&t!=PT_PCLN&&t!=PT_BCLN&&t!=PT_STKM&&t!=PT_STKM2))
{
- parts[pmap[y][x]>>PS].ctype = t;
+ parts[pmap[y][x]>>8].ctype = t;
}
return -1;
- }
- if(photons[y][x] && t==PT_PHOT)
- return -1;
+ }
+ if(photons[y][x] && t==PT_PHOT)
+ return -1;
if(pfree == -1)
return -1;
i = pfree;
@@ -715,117 +711,129 @@ inline int create_part(int p, int x, int y, int t)
if(t==PT_BIZR||t==PT_BIZRG)
parts[i].ctype = 0x47FFFF;
if(t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP
- pmap[y][x] = t|(i<<PS);
+ pmap[y][x] = t|(i<<8);
if(t==PT_PHOT)
- photons[y][x] = t|(i<<PS);
+ photons[y][x] = t|(i<<8);
else if(t==PT_STKM)
{
if(isplayer==0)
{
- if(pmap[y][x]&TYPE==PT_SPAWN)
- {
- parts[pmap[y][x]>>PS].type = PT_STKM;
- parts[pmap[y][x]>>PS].vx = 0;
- parts[pmap[y][x]>>PS].vy = 0;
- parts[pmap[y][x]>>PS].life = 100;
- parts[pmap[y][x]>>PS].ctype = 0;
- parts[pmap[y][x]>>PS].temp = ptypes[t].heat;
-
- }
- else
- {
- parts[i].x = (float)x;
- parts[i].y = (float)y;
- parts[i].type = PT_STKM;
- parts[i].vx = 0;
- parts[i].vy = 0;
- parts[i].life = 100;
- parts[i].ctype = 0;
- parts[i].temp = ptypes[t].heat;
- }
-
-
-
+ if(pmap[y][x]&0xFF==PT_SPAWN)
+ {
+ parts[pmap[y][x]>>8].type = PT_STKM;
+ parts[pmap[y][x]>>8].vx = 0;
+ parts[pmap[y][x]>>8].vy = 0;
+ parts[pmap[y][x]>>8].life = 100;
+ parts[pmap[y][x]>>8].ctype = 0;
+ parts[pmap[y][x]>>8].temp = ptypes[t].heat;
+
+ }
+ else
+ {
+ parts[i].x = (float)x;
+ parts[i].y = (float)y;
+ parts[i].type = PT_STKM;
+ parts[i].vx = 0;
+ parts[i].vy = 0;
+ parts[i].life = 100;
+ parts[i].ctype = 0;
+ parts[i].temp = ptypes[t].heat;
+ }
+
+
+
player[3] = x-1; //Setting legs positions
player[4] = y+6;
player[5] = x-1;
player[6] = y+6;
-
+
player[7] = x-3;
player[8] = y+12;
player[9] = x-3;
player[10] = y+12;
-
+
player[11] = x+1;
player[12] = y+6;
player[13] = x+1;
player[14] = y+6;
-
+
player[15] = x+3;
player[16] = y+12;
player[17] = x+3;
player[18] = y+12;
-
+
isplayer = 1;
}
+ else
+ {
+ return -1;
+ }
//kill_part(playerspawn);
create_part(-1,x,y,PT_SPAWN);
ISSPAWN1 = 1;
}
- else if(t==PT_STKM2)
+ if(t==PT_STKM2)
{
if(isplayer2==0)
{
- if(pmap[y][x]&TYPE==PT_SPAWN2)
- {
- parts[pmap[y][x]>>PS].type = PT_STKM2;
- parts[pmap[y][x]>>PS].vx = 0;
- parts[pmap[y][x]>>PS].vy = 0;
- parts[pmap[y][x]>>PS].life = 100;
- parts[pmap[y][x]>>PS].ctype = 0;
- parts[pmap[y][x]>>PS].temp = ptypes[t].heat;
-
- }
- else
- {
- parts[i].x = (float)x;
- parts[i].y = (float)y;
- parts[i].type = PT_STKM2;
- parts[i].vx = 0;
- parts[i].vy = 0;
- parts[i].life = 100;
- parts[i].ctype = 0;
- parts[i].temp = ptypes[t].heat;
- }
-
-
-
+ if(pmap[y][x]&0xFF==PT_SPAWN2)
+ {
+ parts[pmap[y][x]>>8].type = PT_STKM2;
+ parts[pmap[y][x]>>8].vx = 0;
+ parts[pmap[y][x]>>8].vy = 0;
+ parts[pmap[y][x]>>8].life = 100;
+ parts[pmap[y][x]>>8].ctype = 0;
+ parts[pmap[y][x]>>8].temp = ptypes[t].heat;
+
+ }
+ else
+ {
+ parts[i].x = (float)x;
+ parts[i].y = (float)y;
+ parts[i].type = PT_STKM2;
+ parts[i].vx = 0;
+ parts[i].vy = 0;
+ parts[i].life = 100;
+ parts[i].ctype = 0;
+ parts[i].temp = ptypes[t].heat;
+ }
+
+
+
player2[3] = x-1; //Setting legs positions
player2[4] = y+6;
player2[5] = x-1;
player2[6] = y+6;
-
+
player2[7] = x-3;
player2[8] = y+12;
player2[9] = x-3;
player2[10] = y+12;
-
+
player2[11] = x+1;
player2[12] = y+6;
player2[13] = x+1;
player2[14] = y+6;
-
+
player2[15] = x+3;
player2[16] = y+12;
player2[17] = x+3;
player2[18] = y+12;
-
+
isplayer2 = 1;
}
+ else
+ {
+ return -1;
+ }
//kill_part(player2spawn);
create_part(-1,x,y,PT_SPAWN2);
ISSPAWN2 = 1;
}
+ if(t==PT_BIZR||t==PT_BIZRG)
+ parts[i].ctype = 0x47FFFF;
+ if(t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP
+ pmap[y][x] = t|(i<<8);
return i;
}
@@ -855,7 +863,7 @@ static void create_gain_photon(int pp)
if(nx<0 || ny<0 || nx>=XRES || ny>=YRES)
return;
- if((pmap[ny][nx] & TYPE) != PT_GLOW)
+ if((pmap[ny][nx] & 0xFF) != PT_GLOW)
return;
pfree = parts[i].life;
@@ -866,9 +874,8 @@ static void create_gain_photon(int pp)
parts[i].y = yy;
parts[i].vx = parts[pp].vx;
parts[i].vy = parts[pp].vy;
- parts[i].temp = parts[pmap[ny][nx] >>PS].temp;
+ parts[i].temp = parts[pmap[ny][nx] >> 8].temp;
parts[i].tmp = 0;
- photons[ny][nx] = PT_PHOT|(i<<PS);
temp_bin = (int)((parts[i].temp-273.0f)*0.25f);
if(temp_bin < 0) temp_bin = 0;
@@ -887,7 +894,7 @@ static void create_cherenkov_photon(int pp)
nx = (int)(parts[pp].x + 0.5f);
ny = (int)(parts[pp].y + 0.5f);
- if((pmap[ny][nx] & TYPE) != PT_GLAS)
+ if((pmap[ny][nx] & 0xFF) != PT_GLAS)
return;
if(hypotf(parts[pp].vx, parts[pp].vy) < 1.44f)
@@ -902,9 +909,8 @@ static void create_cherenkov_photon(int pp)
parts[i].life = 680;
parts[i].x = parts[pp].x;
parts[i].y = parts[pp].y;
- parts[i].temp = parts[pmap[ny][nx] >>PS].temp;
+ parts[i].temp = parts[pmap[ny][nx] >> 8].temp;
parts[i].tmp = 0;
- photons[ny][nx] = PT_PHOT|(i<<PS);
if(lr) {
parts[i].vx = parts[pp].vx - 2.5f*parts[pp].vy;
@@ -936,15 +942,17 @@ inline void delete_part(int x, int y)
i = pmap[y][x];
}
- if(!i || (i>>PS)>=NPART)
+ if(!i || (i>>8)>=NPART)
return;
- if((parts[i>>PS].type==SLALT)||SLALT==0)
+ if((parts[i>>8].type==SLALT)||SLALT==0)
{
- kill_part(i>>PS);
+ kill_part(i>>8);
+ pmap[y][x] = 0;
}
- else if(ptypes[parts[i>>PS].type].menusection==SEC)
+ else if(ptypes[parts[i>>8].type].menusection==SEC)
{
- kill_part(i>>PS);
+ kill_part(i>>8);
+ pmap[y][x] = 0;
}
else
return;
@@ -1059,17 +1067,17 @@ inline int parts_avg(int ci, int ni,int t)
if(t==PT_INSL)//to keep electronics working
{
int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)];
- if((pmr>>PS) < NPART && pmr)
- return parts[pmr>>PS].type;
+ if((pmr>>8) < NPART && pmr)
+ return parts[pmr>>8].type;
else
return PT_NONE;
}
else
{
int pmr2 = pmap[(int)((parts[ci].y + parts[ni].y)/2+0.5f)][(int)((parts[ci].x + parts[ni].x)/2+0.5f)];//seems to be more accurate.
- if((pmr2>>PS) < NPART && pmr2)
+ if((pmr2>>8) < NPART && pmr2)
{
- if(parts[pmr2>>PS].type==t)
+ if(parts[pmr2>>8].type==t)
return t;
}
else
@@ -1169,13 +1177,13 @@ void update_particles_i(pixel *vid, int start, int inc)
for(nx=0;nx<XRES-4;nx++)
{
r=pmap[ny][nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
{
continue;
}
- else if((ny<9||nx<9||ny>YRES-7||nx>XRES-10)&&parts[r>>PS].type==PT_LOVE)
- parts[r>>PS].type = PT_NONE;
- else if(parts[r>>PS].type==PT_LOVE)
+ else if((ny<9||nx<9||ny>YRES-7||nx>XRES-10)&&parts[r>>8].type==PT_LOVE)
+ parts[r>>8].type = PT_NONE;
+ else if(parts[r>>8].type==PT_LOVE)
{
love[nx/9][ny/9] = 1;
}
@@ -1194,7 +1202,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
{
rt=pmap[ny+nny][nx+nnx];
- if((rt>>PS)>=NPART)
+ if((rt>>8)>=NPART)
{
continue;
}
@@ -1202,8 +1210,8 @@ void update_particles_i(pixel *vid, int start, int inc)
create_part(-1,nx+nnx,ny+nny,PT_LOVE);
else if(!rt)
continue;
- else if(parts[rt>>PS].type==PT_LOVE&&loverule[nnx][nny]==0)
- parts[rt>>PS].type=PT_NONE;
+ else if(parts[rt>>8].type==PT_LOVE&&loverule[nnx][nny]==0)
+ parts[rt>>8].type=PT_NONE;
}
}
@@ -1220,13 +1228,13 @@ void update_particles_i(pixel *vid, int start, int inc)
for(nx=0;nx<XRES-4;nx++)
{
r=pmap[ny][nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
{
continue;
}
- else if((ny<9||nx<9||ny>YRES-7||nx>XRES-10)&&parts[r>>PS].type==PT_LOLZ)
- parts[r>>PS].type = PT_NONE;
- else if(parts[r>>PS].type==PT_LOLZ)
+ else if((ny<9||nx<9||ny>YRES-7||nx>XRES-10)&&parts[r>>8].type==PT_LOLZ)
+ parts[r>>8].type = PT_NONE;
+ else if(parts[r>>8].type==PT_LOLZ)
{
lolz[nx/9][ny/9] = 1;
}
@@ -1245,7 +1253,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
{
rt=pmap[ny+nny][nx+nnx];
- if((rt>>PS)>=NPART)
+ if((rt>>8)>=NPART)
{
continue;
}
@@ -1253,8 +1261,8 @@ void update_particles_i(pixel *vid, int start, int inc)
create_part(-1,nx+nnx,ny+nny,PT_LOLZ);
else if(!rt)
continue;
- else if(parts[rt>>PS].type==PT_LOLZ&&lolzrule[nny][nnx]==0)
- parts[rt>>PS].type=PT_NONE;
+ else if(parts[rt>>8].type==PT_LOLZ&&lolzrule[nny][nnx]==0)
+ parts[rt>>8].type=PT_NONE;
}
}
@@ -1272,16 +1280,16 @@ void update_particles_i(pixel *vid, int start, int inc)
for(ny=CELL;ny<YRES-CELL;ny++)
{
r = pmap[ny][nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
{
gol[nx][ny] = 0;
continue;
}
else
for( golnum=1;golnum<NGOL;golnum++)
- if(parts[r>>PS].type==goltype[golnum-1])
+ if(parts[r>>8].type==goltype[golnum-1])
{
- if(parts[r>>PS].tmp == grule[golnum][9]-1) {
+ if(parts[r>>8].tmp == grule[golnum][9]-1) {
gol[nx][ny] = golnum;
for( nnx=-1;nnx<2;nnx++)
for( nny=-1;nny<2;nny++)//it will count itself as its own neighbor, which is needed, but will have 1 extra for delete check
@@ -1290,9 +1298,9 @@ void update_particles_i(pixel *vid, int start, int inc)
gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][0] ++;
}
} else {
- parts[r>>PS].tmp --;
- if(parts[r>>PS].tmp<=0)
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].tmp --;
+ if(parts[r>>8].tmp<=0)
+ parts[r>>8].type = PT_NONE;
}
}
}
@@ -1301,7 +1309,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
r = pmap[ny][nx];
int neighbors = gol2[nx][ny][0];
- if(neighbors==0 || (r>>PS)>=NPART || !(ptypes[r&TYPE].properties&PROP_LIFE || !(r&TYPE)))
+ if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART)
continue;
for( golnum = 1;golnum<NGOL;golnum++)
for( goldelete = 0;goldelete<9;goldelete++)
@@ -1312,11 +1320,11 @@ void update_particles_i(pixel *vid, int start, int inc)
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
- if(parts[r>>PS].tmp==grule[golnum][9]-1)
- parts[r>>PS].tmp --;
+ if(parts[r>>8].tmp==grule[golnum][9]-1)
+ parts[r>>8].tmp --;
}
- if(parts[r>>PS].tmp<=0)
- parts[r>>PS].type = PT_NONE;
+ if(parts[r>>8].tmp<=0)
+ parts[r>>8].type = PT_NONE;
}
gol2[nx][ny][0] = 0;
for( z = 1;z<NGOL;z++)
@@ -1612,7 +1620,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if(!pmap[y+ny][x+nx])
a = 1;
- if((pmap[y+ny][x+nx]&TYPE)!=t)
+ if((pmap[y+ny][x+nx]&0xFF)!=t)
nt = 1;
}
if(legacy_enable)
@@ -1632,10 +1640,10 @@ void update_particles_i(pixel *vid, int start, int inc)
if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f)
t = parts[i].type = PT_OIL;
if(t==PT_DESL && pv[y/CELL][x/CELL]>5.0f)
- { // Only way I know to make it
- t = parts[i].type = PT_FIRE; // combust under pressure.
- parts[i].life = rand()%50+120;
- }
+ {
+ t = parts[i].type = PT_FIRE;
+ parts[i].life = rand()%50+120;
+ }
if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f)
t = parts[i].type = PT_OIL;
if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f)
@@ -1644,21 +1652,21 @@ void update_particles_i(pixel *vid, int start, int inc)
t = parts[i].type = PT_BRMT;
if(t==PT_BRCK && pv[y/CELL][x/CELL]>8.8f)
t = parts[i].type = PT_STNE;
- if(t==PT_PIPE && pv[y/CELL][x/CELL]>10.0f)
+ if(t==PT_PIPE && pv[y/CELL][x/CELL]>10.0f)
t = parts[i].type = PT_BRMT;
- if(t==PT_PSTE && pv[y/CELL][x/CELL]>0.5f)
+ if(t==PT_PSTE && pv[y/CELL][x/CELL]>0.5f)
t = parts[i].type = PT_PSTS;
- if(t==PT_PSTS && pv[y/CELL][x/CELL]<0.5f)
+ if(t==PT_PSTS && pv[y/CELL][x/CELL]<0.5f)
t = parts[i].type = PT_PSTE;
- if(t==PT_SHLD1 && pv[y/CELL][x/CELL]>7.0f)
+ if(t==PT_SHLD1 && pv[y/CELL][x/CELL]>7.0f)
t = parts[i].type = PT_NONE;
- if(t==PT_SHLD2 && pv[y/CELL][x/CELL]>15.0f)
+ if(t==PT_SHLD2 && pv[y/CELL][x/CELL]>15.0f)
t = parts[i].type = PT_NONE;
- if(t==PT_SHLD3 && pv[y/CELL][x/CELL]>25.0f)
+ if(t==PT_SHLD3 && pv[y/CELL][x/CELL]>25.0f)
t = parts[i].type = PT_NONE;
- if(t==PT_SHLD4 && pv[y/CELL][x/CELL]>40.0f)
+ if(t==PT_SHLD4 && pv[y/CELL][x/CELL]>40.0f)
t = parts[i].type = PT_NONE;
- if(t==PT_WIFI && pv[y/CELL][x/CELL]>15.0f)
+ if(t==PT_WIFI && pv[y/CELL][x/CELL]>15.0f)
t = parts[i].type = PT_BRMT;
//if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f)
// t = parts[i].type = PT_BGLA;
@@ -1671,7 +1679,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].type = PT_BGLA;
}
}
- if(t==PT_QRTZ)
+ if(t==PT_QRTZ)
{
parts[i].pavg[0] = parts[i].pavg[1];
parts[i].pavg[1] = pv[y/CELL][x/CELL];
@@ -1687,20 +1695,20 @@ void update_particles_i(pixel *vid, int start, int inc)
t = PT_NEUT;
create_part(i, x, y, t);
}
- if((t==PT_ISOZ||t==PT_ISZS) && 1>rand()%200 && ((int)(-4.0f*(pv[y/CELL][x/CELL])))>(rand()%1000))
+ if((t==PT_ISOZ||t==PT_ISZS) && 1>rand()%200 && ((int)(-4.0f*(pv[y/CELL][x/CELL])))>(rand()%1000))
{
t = PT_PHOT;
- rr = (rand()%228+128)/127.0f;
- rrr = (rand()%360)*3.14159f/180.0f;
- parts[i].life = 680;
- parts[i].ctype = 0x3FFFFFFF;
- parts[i].vx = rr*cosf(rrr);
- parts[i].vy = rr*sinf(rrr);
+ rr = (rand()%228+128)/127.0f;
+ rrr = (rand()%360)*3.14159f/180.0f;
+ parts[i].life = 680;
+ parts[i].ctype = 0x3FFFFFFF;
+ parts[i].vx = rr*cosf(rrr);
+ parts[i].vy = rr*sinf(rrr);
create_part(i, x, y, t);
}
- if(t==PT_PSTE)
- if(parts[i].temp>747.0f)
- t = parts[i].type = PT_BRCK;
+ if(t==PT_PSTE)
+ if(parts[i].temp>747.0f)
+ t = parts[i].type = PT_BRCK;
if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1)
{
nearp = nearest_part(i, PT_ETRD);
@@ -1732,12 +1740,12 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>PS].type].hconduct>0&&!(parts[r>>PS].type==PT_HSWC&&parts[r>>PS].life!=10)&&!(parts[r>>PS].type==PT_BRAY&&parts[i].type==PT_FILT)&&!(parts[i].type==PT_BRAY&&parts[r>>PS].type==PT_FILT)&&!(parts[i].type==PT_PHOT&&parts[r>>PS].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>PS].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>PS].type==PT_FILT)&&!(parts[r>>PS].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>PS].type==PT_BIZRG&&parts[i].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[r>>8].type==PT_BRAY&&parts[i].type==PT_FILT)&&!(parts[i].type==PT_BRAY&&parts[r>>8].type==PT_FILT)&&!(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>>PS].temp;
+ c_heat += parts[r>>8].temp;
}
}
}
@@ -1750,11 +1758,11 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>PS].type].hconduct>0&&!(parts[r>>PS].type==PT_HSWC&&parts[r>>PS].life!=10)&&!(parts[r>>PS].type==PT_BRAY&&parts[i].type==PT_FILT)&&!(parts[i].type==PT_BRAY&&parts[r>>PS].type==PT_FILT)&&!(parts[i].type==PT_PHOT&&parts[r>>PS].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>PS].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>PS].type==PT_FILT)&&!(parts[r>>PS].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>PS].type==PT_BIZRG&&parts[i].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[r>>8].type==PT_BRAY&&parts[i].type==PT_FILT)&&!(parts[i].type==PT_BRAY&&parts[r>>8].type==PT_FILT)&&!(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>>PS].temp = parts[i].temp;
+ parts[r>>8].temp = parts[i].temp;
}
}
}
@@ -1762,11 +1770,11 @@ void update_particles_i(pixel *vid, int start, int inc)
if(y-2 >= 0 && y-2 < YRES && ptypes[t].properties&TYPE_LIQUID){
float swappage;
r = pmap[y-2][x];
- if(!((r>>PS)>=NPART || !r || parts[i].type != (r&TYPE))){
- if(parts[i].temp>parts[r>>PS].temp){
+ if(!((r>>8)>=NPART || !r || parts[i].type != (r&0xFF))){
+ if(parts[i].temp>parts[r>>8].temp){
swappage = parts[i].temp;
- parts[i].temp = parts[r>>PS].temp;
- parts[r>>PS].temp = swappage;
+ parts[i].temp = parts[r>>8].temp;
+ parts[r>>8].temp = swappage;
}
}
}
@@ -1932,16 +1940,16 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((ptypes[r&TYPE].properties&PROP_CONDUCTS) && parts[r>>PS].life==0 && !((r&TYPE)==PT_WATR||(r&TYPE)==PT_SLTW) && parts[r>>PS].ctype!=PT_SPRK)
+ if((ptypes[r&0xFF].properties&PROP_CONDUCTS) && parts[r>>8].life==0 && !((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && parts[r>>8].ctype!=PT_SPRK)
{
t = parts[i].type = PT_NONE;
- parts[r>>PS].ctype = parts[r>>PS].type;
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 4;
+ parts[r>>8].ctype = parts[r>>8].type;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
}
- else if((r&TYPE)!=PT_CLNE&&(r&TYPE)!=PT_THDR&&(r&TYPE)!=PT_SPRK&&(r&TYPE)!=PT_DMND&&(r&TYPE)!=PT_FIRE&&(r&TYPE)!=PT_NEUT&&(r&TYPE)!=PT_PHOT&&(r&TYPE))
+ else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF))
{
pv[y/CELL][x/CELL] += 100.0f;
if(legacy_enable&&1>(rand()%200))
@@ -1971,21 +1979,21 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_SALT || (r&TYPE)==PT_SLTW) && 1>(rand()%1000))
+ if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000))
{
t = parts[i].type = PT_SLTW;
- parts[r>>PS].type = PT_SLTW;
+ parts[r>>8].type = PT_SLTW;
}
if(legacy_enable)
{
- if(((r&TYPE)==PT_WATR || (r&TYPE)==PT_DSTW) && 1>(rand()%1000))
+ if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
{
t = parts[i].type = PT_ICEI;
- parts[r>>PS].type = PT_ICEI;
+ parts[r>>8].type = PT_ICEI;
}
- if(t==PT_SNOW && ((r&TYPE)==PT_WATR || (r&TYPE)==PT_DSTW) && 15>(rand()%1000))
+ if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000))
t = parts[i].type = PT_WATR;
}
}
@@ -1998,13 +2006,13 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt =parts[r>>PS].type;
+ rt =parts[r>>8].type;
if((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
{
- parts[r>>PS].type=PT_BMTL;
- parts[r>>PS].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
+ parts[r>>8].type=PT_BMTL;
+ parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
}
}
} else if(parts[i].tmp==1 && 1>rand()%1000) {
@@ -2019,13 +2027,13 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((((r&TYPE) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
- ((r&TYPE) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
- ((r&TYPE) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
- ((r&TYPE) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
- ((r&TYPE) == PT_LO2))&&
+ if((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
+ ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
+ ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
+ ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
+ ((r&0xFF) == PT_LO2))&&
(!(parts[i].life))
)
{
@@ -2040,14 +2048,14 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE) == PT_DSTW && 30>(rand()/(RAND_MAX/1000))) ||
- ((r&TYPE) == PT_SLTW && 30>(rand()/(RAND_MAX/1000))) ||
- ((r&TYPE) == PT_WATR && 30>(rand()/(RAND_MAX/1000))))
+ if(((r&0xFF) == PT_DSTW && 30>(rand()/(RAND_MAX/1000))) ||
+ ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/1000))) ||
+ ((r&0xFF) == PT_WATR && 30>(rand()/(RAND_MAX/1000))))
{
- parts[r>>PS].type=PT_O2;
- //parts[r>>PS].tmp=(rand()/(RAND_MAX/10))+20;
+ parts[r>>8].type=PT_O2;
+ //parts[r>>8].tmp=(rand()/(RAND_MAX/10))+20;
}
}
}
@@ -2078,9 +2086,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_FIRE || (r&TYPE)==PT_PLSM) && 1>(rand()%500))
+ if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
{
if(parts[i].life>100) {
parts[i].life = 99;
@@ -2106,9 +2114,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_FIRE || (r&TYPE)==PT_PLSM) && 1>(rand()%500))
+ if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
{
if(parts[i].life>100) {
parts[i].life = 99;
@@ -2122,17 +2130,17 @@ void update_particles_i(pixel *vid, int start, int inc)
for(ny=-1; ny<2; ny++){
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)){
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_SPRK){
- int destroy = (parts[r>>PS].ctype==PT_PSCN)?1:0;
- int nostop = (parts[r>>PS].ctype==PT_INST)?1:0;
+ if((r&0xFF)==PT_SPRK){
+ int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
+ int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
for (docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
if(!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)){
break;
}
r = pmap[y+nyi+nyy][x+nxi+nxx];
- if(!((r>>PS)>=NPART)) {
+ if(!((r>>8)>=NPART)) {
if(!r){
int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
if(nr!=-1){
@@ -2143,36 +2151,36 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[nr].ctype = colored;
}
} else if(!destroy) {
- if(parts[r>>PS].type==PT_BRAY&&parts[r>>PS].tmp==0){
+ if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0){
if(nyy!=0 || nxx!=0){
- parts[r>>PS].type = PT_BRAY;
- parts[r>>PS].life = 1020;
- parts[r>>PS].tmp = 1;
- if(!parts[r>>PS].ctype)
- parts[r>>PS].ctype = colored;
+ parts[r>>8].type = PT_BRAY;
+ parts[r>>8].life = 1020;
+ parts[r>>8].tmp = 1;
+ if(!parts[r>>8].ctype)
+ parts[r>>8].ctype = colored;
}
docontinue = 0;
- } else if(parts[r>>PS].type==PT_BRAY&&parts[r>>PS].tmp==1){
- parts[r>>PS].life = 1020;
+ } else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
+ parts[r>>8].life = 1020;
//docontinue = 1;
}
- else if(parts[r>>PS].type==PT_FILT){
- colored = parts[r>>PS].ctype;
- }else if(parts[r>>PS].type!=PT_INWR && parts[r>>PS].type!=PT_ARAY && parts[r>>PS].type!=PT_WIFI && !(parts[r>>PS].type==PT_SWCH && parts[r>>PS].life>=10)) {
+ else if(parts[r>>8].type==PT_FILT){
+ colored = parts[r>>8].ctype;
+ }else if(parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY && parts[r>>8].type!=PT_WIFI && !(parts[r>>8].type==PT_SWCH && parts[r>>8].life>=10)) {
if(nyy!=0 || nxx!=0){
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
}
- if(!(nostop && (ptypes[parts[r>>PS].ctype].properties&PROP_CONDUCTS))){
+ if(!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))){
docontinue = 0;
} else {
docontinue = 1;
}
}
} else if(destroy) {
- if(parts[r>>PS].type==PT_BRAY){
- parts[r>>PS].life = 1;
+ if(parts[r>>8].type==PT_BRAY){
+ parts[r>>8].life = 1;
docontinue = 1;
- } else if(parts[r>>PS].type==PT_INWR || parts[r>>PS].type==PT_ARAY || parts[r>>PS].type==PT_WIFI || parts[r>>PS].type==PT_FILT || (parts[r>>PS].type==PT_SWCH && parts[r>>PS].life>=10)) {
+ } else if(parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI || parts[r>>8].type==PT_FILT || (parts[r>>8].type==PT_SWCH && parts[r>>8].life>=10)) {
docontinue = 1;
} else {
docontinue = 0;
@@ -2219,9 +2227,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))
+ if((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))
{
if(parts[i].life>40) {
parts[i].life = 39;
@@ -2252,9 +2260,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
+ if(((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
{
if(parts[i].life>40) {
parts[i].life = 39;
@@ -2270,9 +2278,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_SPRK && parts[r>>PS].ctype==PT_METL && parts_avg(i, r>>PS,PT_INSL)!=PT_INSL)
+ if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && parts_avg(i, r>>8,PT_INSL)!=PT_INSL)
{
parts[i].temp = 473.0f;
}
@@ -2286,38 +2294,38 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_WATR && 1>(rand()%250))
+ if((r&0xFF)==PT_WATR && 1>(rand()%250))
{
t = parts[i].type = PT_PLNT;
- parts[r>>PS].type = PT_PLNT;
- parts[r>>PS].life = 0;
+ parts[r>>8].type = PT_PLNT;
+ parts[r>>8].life = 0;
}
- else if((r&TYPE)==PT_LAVA && 1>(rand()%250))
+ else if((r&0xFF)==PT_LAVA && 1>(rand()%250))
{
parts[i].life = 4;
t = parts[i].type = PT_FIRE;
}
- else if((r&TYPE)==PT_SMKE && (1>rand()%250))
+ else if((r&0xFF)==PT_SMKE && (1>rand()%250))
{
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].type = PT_NONE;
parts[i].life = rand()%60 + 60;
}
- else if((r&TYPE)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
+ else if((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
{
int nnx = rand()%3 -1;
int nny = rand()%3 -1;
if(x+nx+nnx>=0 && y+ny+nny>0 &&
x+nx+nnx<XRES && y+ny+nny<YRES && (nnx || nny))
{
- if((pmap[y+ny+nny][x+nx+nnx]>>PS)>=NPART||pmap[y+ny+nny][x+nx+nnx])
+ if((pmap[y+ny+nny][x+nx+nnx]>>8)>=NPART||pmap[y+ny+nny][x+nx+nnx])
continue;
if(create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE))
- parts[pmap[y+ny+nny][x+nx+nnx]>>PS].temp = parts[i].temp;
+ parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp;
}
}
- //if(t==PT_SNOW && (r&TYPE)==PT_WATR && 15>(rand()%1000))
+ //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
//t = parts[i].type = PT_WATR;
}
if(parts[i].life==2)
@@ -2328,7 +2336,7 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if(!r)
create_part(-1,x+nx,y+ny,PT_O2);
@@ -2344,14 +2352,14 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if(1>rand()%15)
parts[i].type=PT_PLNT;
else if(!r)
{
create_part(-1,x+nx,y+ny,PT_VINE);
- parts[pmap[y+ny][x+nx]>>PS].temp = parts[i].temp;
+ parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
parts[i].type=PT_PLNT;
}
}
@@ -2363,9 +2371,9 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_FIRE || (r&TYPE)==PT_PLSM || (r&TYPE)==PT_LAVA))
+ if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA))
{
if(1>(rand()%500)) {
t = parts[i].type = PT_LAVA;
@@ -2380,7 +2388,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].tmp = 20;
}
}
- //if(t==PT_SNOW && (r&TYPE)==PT_WATR && 15>(rand()%1000))
+ //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
//t = parts[i].type = PT_WATR;
}
}
@@ -2392,34 +2400,34 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_FIRE || (r&TYPE)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
+ if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
{
t = parts[i].type = PT_WTRV;
}
- else if((r&TYPE)==PT_SALT && 1>(rand()%250))
+ else if((r&0xFF)==PT_SALT && 1>(rand()%250))
{
t = parts[i].type = PT_SLTW;
- parts[r>>PS].type = PT_SLTW;
+ parts[r>>8].type = PT_SLTW;
}
- if((((r&TYPE)==PT_WATR||(r&TYPE)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500))
+ if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500))
{
t = parts[i].type = PT_WATR;
}
- if(((r&TYPE)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500))
+ if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500))
{
t = parts[i].type = PT_SLTW;
}
- if(((r&TYPE)==PT_RBDM||(r&TYPE)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500))
+ if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500))
{
parts[i].life = 4;
t = parts[i].type = PT_FIRE;
}
- if(((r&TYPE)==PT_CNCT&&t==PT_WATR) && 1>(rand()%500))
+ if(((r&0xFF)==PT_CNCT&&t==PT_WATR) && 1>(rand()%500))
{
t = parts[i].type = PT_PSTE;
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].type = PT_NONE;
}
}
}
@@ -2431,20 +2439,20 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_FIRE || (r&TYPE)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
+ if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
{
t = parts[i].type = PT_SALT;
- parts[r>>PS].type = PT_WTRV;
+ parts[r>>8].type = PT_WTRV;
}
- else if((r&TYPE)==PT_SALT && 1>(rand()%10000))
+ else if((r&0xFF)==PT_SALT && 1>(rand()%10000))
{
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].type = PT_NONE;
}
- if((r&TYPE)==PT_PLNT&&5>(rand()%1000))
- parts[r>>PS].type = PT_NONE;
- if(((r&TYPE)==PT_RBDM||(r&TYPE)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
+ if((r&0xFF)==PT_PLNT&&5>(rand()%1000))
+ parts[r>>8].type = PT_NONE;
+ if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
{
parts[i].life = 4;
t = parts[i].type = PT_FIRE;
@@ -2460,25 +2468,25 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(((r&TYPE)==PT_WATR||(r&TYPE)==PT_DSTW||(r&TYPE)==PT_SLTW) && 1>(rand()%1000) && legacy_enable)
+ if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable)
{
t = parts[i].type = PT_WATR;
- parts[r>>PS].type = PT_WATR;
+ parts[r>>8].type = PT_WATR;
}
- if(((r&TYPE)==PT_RBDM||(r&TYPE)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
+ if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
{
parts[i].life = 4;
t = parts[i].type = PT_FIRE;
}
- if(((r&TYPE)==PT_ICEI || (r&TYPE)==PT_SNOW) && 1>(rand()%1000) && legacy_enable)
+ if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable)
{
t = parts[i].type = PT_WATR;
if(1>(rand()%1000))
- parts[r>>PS].type = PT_WATR;
+ parts[r>>8].type = PT_WATR;
}
}
}
@@ -2490,9 +2498,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_DYST && 1>(rand()%30) && !legacy_enable)
+ if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable)
{
t = parts[i].type = PT_DYST;
}
@@ -2505,24 +2513,24 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)!=PT_ACID)
+ if((r&0xFF)!=PT_ACID)
{
- if ((r&TYPE)==PT_PLEX || (r&TYPE)==PT_NITR || (r&TYPE)==PT_GUNP || (r&TYPE)==PT_RBDM || (r&TYPE)==PT_LRBD)
+ if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD)
{
t = parts[i].type = PT_FIRE;
parts[i].life = 4;
- parts[r>>PS].type = PT_FIRE;
- parts[r>>PS].life = 4;
+ parts[r>>8].type = PT_FIRE;
+ parts[r>>8].life = 4;
}
- else if(((r&TYPE)!=PT_CLNE && (r&TYPE)!=PT_PCLN && ptypes[parts[r>>PS].type].hardness>(rand()%1000))&&parts[i].life>=50)
+ else if(((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50)
{
- if(parts_avg(i, r>>PS,PT_GLAS)!= PT_GLAS)
- {
- parts[i].life--;
- parts[r>>PS].type = PT_NONE;
- }
+ if(parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS)
+ {
+ parts[i].life--;
+ parts[r>>8].type = PT_NONE;
+ }
}
else if (parts[i].life<=50)
{
@@ -2541,90 +2549,87 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_WATR || (r&TYPE)==PT_ICEI || (r&TYPE)==PT_SNOW)
+ if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW)
{
parts[i].vx *= 0.995;
parts[i].vy *= 0.995;
}
- if((r&TYPE)==PT_PLUT && rt>(rand()%1000))
+ if((r&0xFF)==PT_PLUT && rt>(rand()%1000))
{
if(33>rand()%100)
{
- create_part(r>>PS, x+nx, y+ny, rand()%3 ? PT_LAVA : PT_URAN);
- parts[r>>PS].temp = MAX_TEMP;
- if(parts[r>>PS].type==PT_LAVA){
- parts[r>>PS].tmp = 100;
- parts[r>>PS].ctype = PT_PLUT;
+ create_part(r>>8, x+nx, y+ny, rand()%3 ? PT_LAVA : PT_URAN);
+ parts[r>>8].temp = MAX_TEMP;
+ if(parts[r>>8].type==PT_LAVA){
+ parts[r>>8].tmp = 100;
+ parts[r>>8].ctype = PT_PLUT;
}
}
else
{
- create_part(r>>PS, x+nx, y+ny, PT_NEUT);
- parts[r>>PS].vx = 0.25f*parts[r>>PS].vx + parts[i].vx;
- parts[r>>PS].vy = 0.25f*parts[r>>PS].vy + parts[i].vy;
+ create_part(r>>8, x+nx, y+ny, PT_NEUT);
+ parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
+ parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
}
pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough
fe ++;
}
- if((r&TYPE)==PT_DEUT && (rt+1)>(rand()%1000))
+ if((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000))
{
#ifdef SDEUT
- create_n_parts(parts[r>>PS].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT);
+ create_n_parts(parts[r>>8].life, x+nx, y+ny, parts[i].vx, parts[i].vy, PT_NEUT);
#else
- create_part(r>>PS, x+nx, y+ny, PT_NEUT);
- parts[r>>PS].vx = 0.25f*parts[r>>PS].vx + parts[i].vx;
- parts[r>>PS].vy = 0.25f*parts[r>>PS].vy + parts[i].vy;
- if(parts[r>>PS].life>0)
+ create_part(r>>8, x+nx, y+ny, PT_NEUT);
+ parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
+ parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
+ if(parts[r>>8].life>0)
{
- parts[r>>PS].life --;
- parts[r>>PS].temp += (parts[r>>PS].life*17);
+ parts[r>>8].life --;
+ parts[r>>8].temp += (parts[r>>8].life*17);
pv[y/CELL][x/CELL] += 6.0f * CFDS;
}
else
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].type = PT_NONE;
#endif
}
- if((r&TYPE)==PT_GUNP && 15>(rand()%1000))
- parts[r>>PS].type = PT_DUST;
- if((r&TYPE)==PT_DYST && 15>(rand()%1000))
- parts[r>>PS].type = PT_YEST;
- if((r&TYPE)==PT_YEST) {
- if(15>(rand()%100000)&&isplayer==0)
- parts[r>>PS].type = PT_STKM;
- else
- parts[r>>PS].type = PT_DYST;
+ if((r&0xFF)==PT_GUNP && 15>(rand()%1000))
+ parts[r>>8].type = PT_DUST;
+ if((r&0xFF)==PT_DYST && 15>(rand()%1000))
+ parts[r>>8].type = PT_YEST;
+ if((r&0xFF)==PT_YEST) {
+ parts[r>>8].type = PT_DYST;
}
- if((r&TYPE)==PT_WATR && 15>(rand()%100))
- parts[r>>PS].type = PT_DSTW;
- if((r&TYPE)==PT_PLEX && 15>(rand()%1000))
- parts[r>>PS].type = PT_GOO;
- if((r&TYPE)==PT_NITR && 15>(rand()%1000))
- parts[r>>PS].type = PT_DESL;
- if((r&TYPE)==PT_PLNT && 5>(rand()%100))
- parts[r>>PS].type = PT_WOOD;
- if((r&TYPE)==PT_DESL && 15>(rand()%1000))
- parts[r>>PS].type = PT_GAS;
- if((r&TYPE)==PT_COAL && 5>(rand()%100))
- parts[r>>PS].type = PT_WOOD;
- if((r&TYPE)==PT_DUST && 5>(rand()%100))
- parts[r>>PS].type = PT_FWRK;
- if((r&TYPE)==PT_FWRK && 5>(rand()%100))
- parts[r>>PS].ctype = PT_DUST;
- if((r&TYPE)==PT_ACID && 5>(rand()%100))
+ if((r&0xFF)==PT_WATR && 15>(rand()%100))
+ parts[r>>8].type = PT_DSTW;
+ if((r&0xFF)==PT_PLEX && 15>(rand()%1000))
+ parts[r>>8].type = PT_GOO;
+ if((r&0xFF)==PT_NITR && 15>(rand()%1000))
+ parts[r>>8].type = PT_DESL;
+ if((r&0xFF)==PT_PLNT && 5>(rand()%100))
+ parts[r>>8].type = PT_WOOD;
+ if((r&0xFF)==PT_DESL && 15>(rand()%1000))
+ parts[r>>8].type = PT_GAS;
+ if((r&0xFF)==PT_COAL && 5>(rand()%100))
+ parts[r>>8].type = PT_WOOD;
+ if((r&0xFF)==PT_DUST && 5>(rand()%100))
+ parts[r>>8].type = PT_FWRK;
+ if((r&0xFF)==PT_FWRK && 5>(rand()%100))
+ parts[r>>8].ctype = PT_DUST;
+ if((r&0xFF)==PT_ACID && 5>(rand()%100))
{
- parts[r>>PS].type = PT_ISOZ;
- parts[r>>PS].life = 0;
+ parts[r>>8].type = PT_ISOZ;
+ parts[r>>8].life = 0;
}
- /*if(parts[r>>PS].type>1 && parts[r>>PS].type!=PT_NEUT && parts[r>>PS].type-1!=PT_NEUT && parts[r>>PS].type-1!=PT_STKM &&
- (ptypes[parts[r>>PS].type-1].menusection==SC_LIQUID||
- ptypes[parts[r>>PS].type-1].menusection==SC_EXPLOSIVE||
- ptypes[parts[r>>PS].type-1].menusection==SC_GAS||
- ptypes[parts[r>>PS].type-1].menusection==SC_POWDERS) && 15>(rand()%1000))
- parts[r>>PS].type--;*/
+ /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM &&
+ (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID||
+ ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE||
+ ptypes[parts[r>>8].type-1].menusection==SC_GAS||
+ ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000))
+ parts[r>>8].type--;*/
}
}
else if(t==PT_PHOT)
@@ -2636,9 +2641,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_WATR || (r&TYPE)==PT_ICEI || (r&TYPE)==PT_SNOW)
+ if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW)
{
parts[i].vx *= 0.995;
parts[i].vy *= 0.995;
@@ -2650,32 +2655,32 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((r&TYPE)==PT_ISOZ && 5>(rand()%2000))
+ if((r&0xFF)==PT_ISOZ && 5>(rand()%2000))
{
parts[i].vx *= 0.90;
parts[i].vy *= 0.90;
- parts[r>>PS].type = PT_PHOT;
+ parts[r>>8].type = PT_PHOT;
rrr = (rand()%360)*3.14159f/180.0f;
rr = (rand()%128+128)/127.0f;
- parts[r>>PS].life = 680;
- parts[r>>PS].ctype = 0x3FFFFFFF;
- parts[r>>PS].vx = rr*cosf(rrr);
- parts[r>>PS].vy = rr*sinf(rrr);
+ parts[r>>8].life = 680;
+ parts[r>>8].ctype = 0x3FFFFFFF;
+ parts[r>>8].vx = rr*cosf(rrr);
+ parts[r>>8].vy = rr*sinf(rrr);
pv[y/CELL][x/CELL] -= 15.0f * CFDS;
}
- if((r&TYPE)==PT_ISZS && 5>(rand()%2000))
+ if((r&0xFF)==PT_ISZS && 5>(rand()%2000))
{
parts[i].vx *= 0.90;
parts[i].vy *= 0.90;
- parts[r>>PS].type = PT_PHOT;
+ parts[r>>8].type = PT_PHOT;
rr = (rand()%228+128)/127.0f;
rrr = (rand()%360)*3.14159f/180.0f;
- parts[r>>PS].life = 680;
- parts[r>>PS].ctype = 0x3FFFFFFF;
- parts[r>>PS].vx = rr*cosf(rrr);
- parts[r>>PS].vy = rr*sinf(rrr);
+ parts[r>>8].life = 680;
+ parts[r>>8].ctype = 0x3FFFFFFF;
+ parts[r>>8].vx = rr*cosf(rrr);
+ parts[r>>8].vy = rr*sinf(rrr);
pv[y/CELL][x/CELL] -= 15.0f * CFDS;
}
}
@@ -2687,13 +2692,13 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_WATR&&5>(rand()%2000))
+ if(parts[r>>8].type==PT_WATR&&5>(rand()%2000))
{
t = parts[i].type = PT_NONE;
- parts[r>>PS].type = PT_DEUT;
- parts[r>>PS].life = 10;
+ parts[r>>8].type = PT_DEUT;
+ parts[r>>8].life = 10;
}
}
}
@@ -2721,12 +2726,12 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r || parts[i].temp>374.0f)
+ if((r>>8)>=NPART || !r || parts[i].temp>374.0f)
continue;
- if(parts[r>>PS].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
+ if(parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
{
parts[i].life++;
- parts[r>>PS].type=PT_NONE;
+ parts[r>>8].type=PT_NONE;
}
}
}
@@ -2736,7 +2741,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
@@ -2754,20 +2759,20 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==t&&(parts[i].life>parts[r>>PS].life)&&parts[i].life>0)//diffusion
+ if(parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{
- int temp = parts[i].life - parts[r>>PS].life;
+ int temp = parts[i].life - parts[r>>8].life;
if(temp ==1)
{
- parts[r>>PS].life ++;
+ parts[r>>8].life ++;
parts[i].life --;
trade = 9;
}
else if(temp>0)
{
- parts[r>>PS].life += temp/2;
+ parts[r>>8].life += temp/2;
parts[i].life -= temp/2;
trade = 9;
}
@@ -2779,9 +2784,9 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_FIRE&&parts[i].life>0)
+ if(parts[r>>8].type==PT_FIRE&&parts[i].life>0)
{
if(parts[i].life<=2)
parts[i].life --;
@@ -2794,7 +2799,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID))
continue;
@@ -2816,13 +2821,13 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(pstates[parts[r>>PS].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>PS].type==PT_CLNE||parts[r>>PS].type==PT_PCLN))
+ if(pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN))
{
t = parts[i].type = PT_RIME;
}
- if(parts[r>>PS].type==PT_SPRK)
+ if(parts[r>>8].type==PT_SPRK)
{
parts[i].life += rand()%20;
}
@@ -2838,18 +2843,18 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
if(rt==PT_SPRK)
{
t = parts[i].type = PT_FOG;
parts[i].life = rand()%50 + 60;
}
- else if(rt==PT_FOG&&parts[r>>PS].life>0)
+ else if(rt==PT_FOG&&parts[r>>8].life>0)
{
t = parts[i].type = PT_FOG;
- parts[i].life = parts[r>>PS].life;
+ parts[i].life = parts[r>>8].life;
}
}
}
@@ -2865,14 +2870,14 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r || (parts[i].life >=maxlife))
+ if((r>>8)>=NPART || !r || (parts[i].life >=maxlife))
continue;
- if(parts[r>>PS].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
+ if(parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
{
- if((parts[i].life + parts[r>>PS].life + 1) <= maxlife)
+ if((parts[i].life + parts[r>>8].life + 1) <= maxlife)
{
- parts[i].life += parts[r>>PS].life + 1;
- parts[r>>PS].type=PT_NONE;
+ parts[i].life += parts[r>>8].life + 1;
+ parts[r>>8].type=PT_NONE;
}
}
}
@@ -2883,7 +2888,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || (parts[i].life<=maxlife))
+ if((r>>8)>=NPART || (parts[i].life<=maxlife))
continue;
if((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
@@ -2892,8 +2897,8 @@ void update_particles_i(pixel *vid, int start, int inc)
{
create_part(-1,x+nx,y+ny,PT_DEUT);
parts[i].life--;
- parts[pmap[y+ny][x+nx]>>PS].temp = parts[i].temp;
- parts[pmap[y+ny][x+nx]>>PS].life = 0;
+ parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
+ parts[pmap[y+ny][x+nx]>>8].life = 0;
}
}
for( trade = 0; trade<4;trade ++)
@@ -2903,19 +2908,19 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==t&&(parts[i].life>parts[r>>PS].life)&&parts[i].life>0)//diffusion
+ if(parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{
- int temp = parts[i].life - parts[r>>PS].life;
+ int temp = parts[i].life - parts[r>>8].life;
if(temp ==1)
{
- parts[r>>PS].life ++;
+ parts[r>>8].life ++;
parts[i].life --;
}
else if(temp>0)
{
- parts[r>>PS].life += temp/2;
+ parts[r>>8].life += temp/2;
parts[i].life -= temp/2;
}
}
@@ -2931,14 +2936,14 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type!=PT_WARP&&parts[r>>PS].type!=PT_STKM&&parts[r>>PS].type!=PT_DMND&&parts[r>>PS].type!=PT_CLNE&&parts[r>>PS].type!=PT_BCLN&&parts[r>>PS].type!=PT_PCLN&&(10>=rand()%200))
+ if(parts[r>>8].type!=PT_WARP&&parts[r>>8].type!=PT_STKM&&parts[r>>8].type!=PT_DMND&&parts[r>>8].type!=PT_CLNE&&parts[r>>8].type!=PT_BCLN&&parts[r>>8].type!=PT_PCLN&&(10>=rand()%200))
{
- parts[i].x = parts[r>>PS].x;
- parts[i].y = parts[r>>PS].y;
- parts[r>>PS].x = x;
- parts[r>>PS].y = y;
+ parts[i].x = parts[r>>8].x;
+ parts[i].y = parts[r>>8].y;
+ parts[r>>8].x = x;
+ parts[r>>8].y = y;
parts[i].life += 4;
trade = 5;
}
@@ -2952,14 +2957,14 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if((parts[r>>PS].temp<100 && parts[r>>PS].type!=PT_C5)||parts[r>>PS].type==PT_HFLM)
+ if((parts[r>>8].temp<100 && parts[r>>8].type!=PT_C5)||parts[r>>8].type==PT_HFLM)
{
if(1>rand()%6)
{
t = parts[i].type = PT_HFLM;
- parts[r>>PS].temp = parts[i].temp = 0;
+ parts[r>>8].temp = parts[i].temp = 0;
parts[i].life = rand()%150+50;
pv[y/CELL][x/CELL] += 1.5;
}
@@ -2975,9 +2980,9 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type!=PT_NONE && parts[r>>PS].type!=PT_BOMB){
+ if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB){
parts[i].type = PT_NONE;
goto killed;
}
@@ -2988,9 +2993,9 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES)
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type!=PT_NONE && parts[r>>PS].type!=PT_BOMB && parts[r>>PS].type!=PT_DMND && parts[r>>PS].type!=PT_CLNE && parts[r>>PS].type!=PT_PCLN && parts[r>>PS].type!=PT_BCLN){
+ if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB && parts[r>>8].type!=PT_DMND && parts[r>>8].type!=PT_CLNE && parts[r>>8].type!=PT_PCLN && parts[r>>8].type!=PT_BCLN){
int rad = 8;
int nxi;
int nxj;
@@ -3010,7 +3015,7 @@ void update_particles_i(pixel *vid, int start, int inc)
for(nxj=-rad; nxj<=rad; nxj++)
for(nxi=-rad; nxi<=rad; nxi++)
if((pow(nxi,2))/(pow(rad,2))+(pow(nxj,2))/(pow(rad,2))<=1)
- if((pmap[y+nxj][x+nxi]&TYPE)!=PT_DMND && (pmap[y+nxj][x+nxi]&TYPE)!=PT_CLNE && (pmap[y+nxj][x+nxi]&TYPE)!=PT_PCLN && (pmap[y+nxj][x+nxi]&TYPE)!=PT_BCLN){
+ if((pmap[y+nxj][x+nxi]&0xFF)!=PT_DMND && (pmap[y+nxj][x+nxi]&0xFF)!=PT_CLNE && (pmap[y+nxj][x+nxi]&0xFF)!=PT_PCLN && (pmap[y+nxj][x+nxi]&0xFF)!=PT_BCLN){
delete_part(x+nxi, y+nxj);
pv[(y+nxj)/CELL][(x+nxi)/CELL] += 0.1f;
nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
@@ -3034,11 +3039,11 @@ void update_particles_i(pixel *vid, int start, int inc)
{
create_part(-1, x , y-1 , PT_FWRK);
r = pmap[y-1][x];
- if((r&TYPE)==PT_FWRK)
+ if((r&0xFF)==PT_FWRK)
{
- parts[r>>PS].vy = rand()%8-22;
- parts[r>>PS].vx = rand()%20-rand()%20;
- parts[r>>PS].life=rand()%15+25;
+ parts[r>>8].vy = rand()%8-22;
+ parts[r>>8].vx = rand()%20-rand()%20;
+ parts[r>>8].life=rand()%15+25;
t=parts[i].type=PT_NONE;
}
}
@@ -3064,15 +3069,15 @@ void update_particles_i(pixel *vid, int start, int inc)
create_part(-1, x+nx, y+ny , PT_DUST);
pv[y/CELL][x/CELL] += 2.00f*CFDS;
a= pmap[y+ny][x+nx];
- if(parts[a>>PS].type==PT_DUST)
+ if(parts[a>>8].type==PT_DUST)
{
- parts[a>>PS].vy = -(rand()%10-1);
- parts[a>>PS].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
- parts[a>>PS].life= rand()%37+18;
- parts[a>>PS].tmp=q;
- parts[a>>PS].flags=w;
- parts[a>>PS].ctype=e;
- parts[a>>PS].temp= rand()%20+6000;
+ parts[a>>8].vy = -(rand()%10-1);
+ parts[a>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
+ parts[a>>8].life= rand()%37+18;
+ parts[a>>8].tmp=q;
+ parts[a>>8].flags=w;
+ parts[a>>8].ctype=e;
+ parts[a>>8].temp= rand()%20+6000;
}
}
}
@@ -3088,27 +3093,27 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
if(rt==PT_SPRK)
{
- if(parts[r>>PS].ctype==PT_PSCN)
+ if(parts[r>>8].ctype==PT_PSCN)
{
parts[i].life = 10;
}
- else if(parts[r>>PS].ctype==PT_NSCN)
+ else if(parts[r>>8].ctype==PT_NSCN)
{
parts[i].life = 9;
}
}
if(rt==PT_LCRY)
{
- if(parts[i].life==10&&parts[r>>PS].life<10&&parts[r>>PS].life>0)
+ if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
{
parts[i].life = 9;
}
- else if(parts[i].life==0&&parts[r>>PS].life==10)
+ else if(parts[i].life==0&&parts[r>>8].life==10)
{
parts[i].life = 10;
}
@@ -3144,7 +3149,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART )
+ if((r>>8)>=NPART )
continue;
if(!r)
create_part(-1,x+nx,y+ny,PT_BRCK);
@@ -3160,7 +3165,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if(!r&&!parts[i].life)
parts[i].life=50;
@@ -3184,12 +3189,12 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_PIPE&&parts[r>>PS].ctype==1)
+ if(parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1)
{
- parts[r>>PS].ctype = (((ctype)%3)+2);//reverse
- parts[r>>PS].life = 6;
+ parts[r>>8].ctype = (((ctype)%3)+2);//reverse
+ parts[r>>8].life = 6;
}
}
}
@@ -3200,32 +3205,32 @@ void update_particles_i(pixel *vid, int start, int inc)
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
else if(!r&&parts[i].tmp!=0)
{
if(create_part(-1,x+nx,y+ny,parts[i].tmp))
{
- parts[pmap[y+ny][x+nx]>>PS].temp = parts[i].temp;//pipe saves temp and life now
- parts[pmap[y+ny][x+nx]>>PS].life = parts[i].flags;
+ 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;
}
else if(!r)
continue;
- else if(parts[i].tmp == 0 && (ptypes[parts[r>>PS].type].falldown!= 0 || pstates[parts[r>>PS].type].state == ST_GAS))
+ 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>>PS].type;
- parts[i].temp = parts[r>>PS].temp;
- parts[i].flags = parts[r>>PS].life;
- parts[r>>PS].type = PT_NONE;
+ 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>>PS].type==PT_PIPE && parts[r>>PS].ctype!=(((ctype)%3)+2) && parts[r>>PS].tmp==0&&parts[i].tmp>0)
+ 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>>PS].tmp = parts[i].tmp;
- parts[r>>PS].temp = parts[i].temp;
- parts[r>>PS].flags = parts[i].flags;
+ 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;
}
}
@@ -3241,12 +3246,12 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_WATR&&5>rand()%100)
+ if(parts[r>>8].type==PT_WATR&&5>rand()%100)
{
- parts[r>>PS].type=PT_FRZW;
- parts[r>>PS].life = 100;
+ parts[r>>8].type=PT_FRZW;
+ parts[r>>8].life = 100;
t = parts[i].type = PT_NONE;
}
@@ -3260,11 +3265,11 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_WATR&&5>rand()%70)
+ if(parts[r>>8].type==PT_WATR&&5>rand()%70)
{
- parts[r>>PS].type=PT_FRZW;
+ parts[r>>8].type=PT_FRZW;
}
}
if(parts[i].life==0&&13>rand()%2500)
@@ -3292,12 +3297,12 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny) && abs(nx)+abs(ny)<4)
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- else if(parts[r>>PS].type==PT_SPRK&&(parts[r>>PS].ctype==PT_PSCN)&&(parts[r>>PS].life>=3)&&parts[i].life==0&&parts_avg(i,r>>PS,PT_INSL)!=PT_INSL)
+ else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life==0&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
{
flood_parts(x,y,PT_SPRK,PT_INST,-1);//spark the wire
- //parts[r>>PS].type=parts[r>>PS].ctype;
+ //parts[r>>8].type=parts[r>>8].ctype;
}
}
}
@@ -3315,19 +3320,19 @@ void update_particles_i(pixel *vid, int start, int inc)
{
count ++;
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_SPRK || (parts[r>>PS].type!=PT_PRTI && parts[r>>PS].type!=PT_PRTO && (ptypes[parts[r>>PS].type].falldown!= 0 || pstates[parts[r>>PS].type].state == ST_GAS)))
+ if(parts[r>>8].type==PT_SPRK || (parts[r>>8].type!=PT_PRTI && parts[r>>8].type!=PT_PRTO && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS)))
for( nnx=0;nnx<80;nnx++)
if(!portal[parts[i].tmp][count-1][nnx])
{
- portal[parts[i].tmp][count-1][nnx] = parts[r>>PS].type;
- portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>PS].temp;
- portalctype[parts[i].tmp][count-1][nnx] = parts[r>>PS].ctype;
- if(parts[r>>PS].type==PT_SPRK)
- parts[r>>PS].type = parts[r>>PS].ctype;
+ portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
+ portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp;
+ portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype;
+ if(parts[r>>8].type==PT_SPRK)
+ parts[r>>8].type = parts[r>>8].ctype;
else
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].type = PT_NONE;
break;
}
}
@@ -3346,7 +3351,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
count ++;
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || r)
+ if((r>>8)>=NPART || r)
continue;
if(!r)
{
@@ -3374,8 +3379,8 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(portal[parts[i].tmp][randomness-1][nnx])
{
create_part(-1,x+nx,y+ny,portal[parts[i].tmp][randomness-1][nnx]);
- parts[pmap[y+ny][x+nx]>>PS].temp = portaltemp[parts[i].tmp][randomness-1][nnx];
- parts[pmap[y+ny][x+nx]>>PS].ctype = portalctype[parts[i].tmp][randomness-1][nnx];
+ parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[parts[i].tmp][randomness-1][nnx];
+ parts[pmap[y+ny][x+nx]>>8].ctype = portalctype[parts[i].tmp][randomness-1][nnx];
portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
portalctype[parts[i].tmp][randomness-1][nnx] = 0;
@@ -3397,29 +3402,29 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_NSCN&&parts[r>>PS].life==0 && wireless[parts[i].tmp][0])
+ if(parts[r>>8].type==PT_NSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].ctype = PT_NSCN;
- parts[r>>PS].life = 4;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].ctype = PT_NSCN;
+ parts[r>>8].life = 4;
}
- else if(parts[r>>PS].type==PT_PSCN&&parts[r>>PS].life==0 && wireless[parts[i].tmp][0])
+ else if(parts[r>>8].type==PT_PSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].ctype = PT_PSCN;
- parts[r>>PS].life = 4;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].ctype = PT_PSCN;
+ parts[r>>8].life = 4;
}
- else if(parts[r>>PS].type==PT_INWR&&parts[r>>PS].life==0 && wireless[parts[i].tmp][0])
+ else if(parts[r>>8].type==PT_INWR&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].ctype = PT_INWR;
- parts[r>>PS].life = 4;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].ctype = PT_INWR;
+ parts[r>>8].life = 4;
}
- else if(parts[r>>PS].type==PT_SPRK && parts[r>>PS].ctype!=PT_NSCN && parts[r>>PS].life>=3 && !wireless[parts[i].tmp][0])
+ else if(parts[r>>8].type==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3 && !wireless[parts[i].tmp][0])
{
- //parts[r>>PS].type = parts[r>>PS].ctype;
+ //parts[r>>8].type = parts[r>>8].ctype;
wireless[parts[i].tmp][0] = 1;
wireless[parts[i].tmp][1] = 1;
ISWIRE = 1;
@@ -3434,27 +3439,27 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
if(rt==PT_SPRK)
{
- if(parts[r>>PS].ctype==PT_PSCN)
+ if(parts[r>>8].ctype==PT_PSCN)
{
parts[i].life = 10;
}
- else if(parts[r>>PS].ctype==PT_NSCN)
+ else if(parts[r>>8].ctype==PT_NSCN)
{
parts[i].life = 9;
}
}
if(rt==PT_PCLN)
{
- if(parts[i].life==10&&parts[r>>PS].life<10&&parts[r>>PS].life>0)
+ if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
{
parts[i].life = 9;
}
- else if(parts[i].life==0&&parts[r>>PS].life==10)
+ else if(parts[i].life==0&&parts[r>>8].life==10)
{
parts[i].life = 10;
}
@@ -3469,27 +3474,27 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
if(rt==PT_SPRK)
{
- if(parts[r>>PS].ctype==PT_PSCN)
+ if(parts[r>>8].ctype==PT_PSCN)
{
parts[i].life = 10;
}
- else if(parts[r>>PS].ctype==PT_NSCN)
+ else if(parts[r>>8].ctype==PT_NSCN)
{
parts[i].life = 9;
}
}
if(rt==PT_HSWC)
{
- if(parts[i].life==10&&parts[r>>PS].life<10&&parts[r>>PS].life>0)
+ if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
{
parts[i].life = 9;
}
- else if(parts[i].life==0&&parts[r>>PS].life==10)
+ else if(parts[i].life==0&&parts[r>>8].life==10)
{
parts[i].life = 10;
}
@@ -3504,27 +3509,27 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
if(rt==PT_SPRK)
{
- if(parts[r>>PS].ctype==PT_PSCN)
+ if(parts[r>>8].ctype==PT_PSCN)
{
parts[i].life = 10;
}
- else if(parts[r>>PS].ctype==PT_NSCN)
+ else if(parts[r>>8].ctype==PT_NSCN)
{
parts[i].life = 9;
}
}
if(rt==PT_PUMP)
{
- if(parts[i].life==10&&parts[r>>PS].life<10&&parts[r>>PS].life>0)
+ if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
{
parts[i].life = 9;
}
- else if(parts[i].life==0&&parts[r>>PS].life==10)
+ else if(parts[i].life==0&&parts[r>>8].life==10)
{
parts[i].life = 10;
}
@@ -3539,9 +3544,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- else if(parts[r>>PS].type==PT_SPRK&&parts[i].life==0)
+ else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for( nnx=-1;nnx<2;nnx++)
for( nny=-1;nny<2;nny++)
{
@@ -3553,10 +3558,10 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
- //parts[pmap[y+ny+nny][x+nx+nnx]>>PS].life=7;
+ //parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
- else if(parts[r>>PS].type==PT_SHLD3&&4>rand()%10)
+ else if(parts[r>>8].type==PT_SHLD3&&4>rand()%10)
{
t = parts[i].type=PT_SHLD2;
parts[i].life = 7;
@@ -3571,13 +3576,13 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if(!r && parts[i].life>0)
create_part(-1,x+nx,y+ny,PT_SHLD1);
if(!r)
continue;
- else if(parts[r>>PS].type==PT_SPRK&&parts[i].life==0)
+ else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for( nnx=-1;nnx<2;nnx++)
for( nny=-1;nny<2;nny++)
{
@@ -3589,10 +3594,10 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
- parts[pmap[y+ny+nny][x+nx+nnx]>>PS].life=7;
+ parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
- else if(parts[r>>PS].type==PT_SHLD4&&4>rand()%10)
+ else if(parts[r>>8].type==PT_SHLD4&&4>rand()%10)
{
t = parts[i].type=PT_SHLD3;
parts[i].life = 7;
@@ -3607,26 +3612,26 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if(!r)
{
if(1>rand()%2500)
{
create_part(-1,x+nx,y+ny,PT_SHLD1);
- parts[pmap[y+ny][x+nx]>>PS].life=7;
+ parts[pmap[y+ny][x+nx]>>8].life=7;
t = parts[i].type = PT_SHLD2;
}
else
continue;
}
- if(parts[r>>PS].type==PT_SHLD1 && parts[i].life>3)
+ if(parts[r>>8].type==PT_SHLD1 && parts[i].life>3)
{
- parts[r>>PS].type = PT_SHLD2;
- parts[r>>PS].life=7;
+ parts[r>>8].type = PT_SHLD2;
+ parts[r>>8].life=7;
}
- else if(parts[r>>PS].type==PT_SPRK&&parts[i].life==0)
+ else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for( nnx=-1;nnx<2;nnx++)
for( nny=-1;nny<2;nny++)
{
@@ -3638,7 +3643,7 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
- parts[pmap[y+ny+nny][x+nx+nnx]>>PS].life=7;
+ parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
}
@@ -3651,33 +3656,33 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART)
+ if((r>>8)>=NPART)
continue;
if(!r)
{
if(1>rand()%5500)
{
create_part(-1,x+nx,y+ny,PT_SHLD1);
- parts[pmap[y+ny][x+nx]>>PS].life=7;
+ parts[pmap[y+ny][x+nx]>>8].life=7;
t = parts[i].type = PT_SHLD2;
}
else
continue;
}
- if(parts[r>>PS].type==PT_SHLD2 && parts[i].life>3)
+ if(parts[r>>8].type==PT_SHLD2 && parts[i].life>3)
{
- parts[r>>PS].type = PT_SHLD3;
- parts[r>>PS].life = 7;
+ parts[r>>8].type = PT_SHLD3;
+ parts[r>>8].life = 7;
}
- else if(parts[r>>PS].type==PT_SPRK&&parts[i].life==0)
+ else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for( nnx=-1;nnx<2;nnx++)
for( nny=-1;nny<2;nny++)
{
if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
- parts[pmap[y+ny+nny][x+nx+nnx]>>PS].life=7;
+ parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
}
@@ -3690,10 +3695,10 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
- if((r&TYPE)!=PT_AMTR && (r&TYPE)!=PT_DMND && (r&TYPE)!=PT_CLNE && (r&TYPE)!=PT_PCLN && (r&TYPE)!=PT_NONE && (r&TYPE)!=PT_PHOT && (r&TYPE)!=PT_VOID && (r&TYPE)!=PT_BHOL && (r&TYPE)!=PT_PRTI && (r&TYPE)!=PT_PRTO)
+ rt = parts[r>>8].type;
+ if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO)
{
t = parts[i].life++;
if(parts[i].life==3)
@@ -3702,9 +3707,9 @@ void update_particles_i(pixel *vid, int start, int inc)
kill_part(i);
goto killed;
}
- parts[r>>PS].life = 0;
- parts[r>>PS].type = PT_NONE;
- kill_part(r>>PS);
+ parts[r>>8].life = 0;
+ parts[r>>8].type = PT_NONE;
+ kill_part(r>>8);
if(2>(rand()/(RAND_MAX/100)))
create_part(-1, x+nx, y+ny, PT_PHOT);
pv[y/CELL][x/CELL] -= 5.0f;
@@ -3720,31 +3725,31 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type!=PT_DMND&&33>=rand()/(RAND_MAX/100)+1)
+ if(parts[r>>8].type!=PT_DMND&&33>=rand()/(RAND_MAX/100)+1)
{
- if(parts[r>>PS].type==PT_SING && parts[r>>PS].life >10)
+ if(parts[r>>8].type==PT_SING && parts[r>>8].life >10)
{
- if(parts[i].life+parts[r>>PS].life > 255)
+ if(parts[i].life+parts[r>>8].life > 255)
continue;
- parts[i].life += parts[r>>PS].life;
+ parts[i].life += parts[r>>8].life;
}
else
{
if(parts[i].life+3 > 255)
{
- if(parts[r>>PS].type!=PT_SING && 1>rand()%100)
+ if(parts[r>>8].type!=PT_SING && 1>rand()%100)
{
- parts[r>>PS].type = PT_SING;
- parts[r>>PS].life = rand()%50+60;
+ parts[r>>8].type = PT_SING;
+ parts[r>>8].life = rand()%50+60;
}
continue;
}
parts[i].life += 3;
}
- parts[i].temp = restrict_flt(parts[r>>PS].temp+parts[i].temp, MIN_TEMP, MAX_TEMP);
- parts[r>>PS].type=PT_NONE;
+ parts[i].temp = restrict_flt(parts[r>>8].temp+parts[i].temp, MIN_TEMP, MAX_TEMP);
+ parts[r>>8].type=PT_NONE;
}
}
}
@@ -3756,15 +3761,15 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_WATR && 1>rand()%30)
+ if(parts[r>>8].type==PT_WATR && 1>rand()%30)
{
- parts[r>>PS].type = PT_FOG;
+ parts[r>>8].type = PT_FOG;
}
- if(parts[r>>PS].type==PT_O2 && 1>rand()%9)
+ if(parts[r>>8].type==PT_O2 && 1>rand()%9)
{
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].type = PT_NONE;
t = parts[i].type = PT_WATR;
pv[y/CELL][x/CELL] += 4.0;
}
@@ -3778,9 +3783,9 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR)
{
parts[i].tmp = 1;
@@ -3794,7 +3799,7 @@ void update_particles_i(pixel *vid, int start, int inc)
} else {
float newVel = parts[i].life/25;
parts[i].flags = parts[i].flags&0xFFFFFFFE;
- if((pmap[(int)(ly-newVel)][(int)lx]&TYPE)==PT_NONE && ly-newVel>0) {
+ if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE && ly-newVel>0) {
parts[i].vy = -newVel;
ly-=newVel;
iy-=newVel;
@@ -3810,14 +3815,14 @@ void update_particles_i(pixel *vid, int start, int inc)
int tmul = rand()%7;
create_part(-1, x+nx, y+ny, PT_FIRW);
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>PS].type==PT_FIRW) {
- parts[r>>PS].vx = (rand()%3-1)*tmul;
- parts[r>>PS].vy = (rand()%3-1)*tmul;
- parts[r>>PS].tmp = col;
- parts[r>>PS].life = rand()%100+100;
- parts[r>>PS].temp = 6000.0f;
+ if(parts[r>>8].type==PT_FIRW) {
+ parts[r>>8].vx = (rand()%3-1)*tmul;
+ parts[r>>8].vy = (rand()%3-1)*tmul;
+ parts[r>>8].tmp = col;
+ parts[r>>8].life = rand()%100+100;
+ parts[r>>8].temp = 6000.0f;
}
}
}
@@ -3841,16 +3846,16 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
- if(parts_avg(i,r>>PS,PT_INSL) != PT_INSL)
+ rt = parts[r>>8].type;
+ if(parts_avg(i,r>>8,PT_INSL) != PT_INSL)
{
- if((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>PS].life==0 && abs(nx)+abs(ny) < 4)
+ if((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && abs(nx)+abs(ny) < 4)
{
- parts[r>>PS].life = 4;
- parts[r>>PS].ctype = rt;
- parts[r>>PS].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
}
}
}
@@ -3863,32 +3868,32 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
- if(parts[r>>PS].type == PT_SWCH&&parts_avg(i,r>>PS,PT_INSL)!=PT_INSL)
+ if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
{
- if(parts[i].life==10&&parts[r>>PS].life<10&&parts[r>>PS].life>0)
+ if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
{
parts[i].life = 9;
}
- else if(parts[i].life==0&&parts[r>>PS].life==10)
+ else if(parts[i].life==0&&parts[r>>8].life==10)
{
parts[i].life = 10;
}
}
- else if(parts[r>>PS].type == PT_SPRK && parts[r>>PS].ctype==PT_SWCH && parts[i].life<10 && parts[i].life>0 &&parts_avg(i,r>>PS,PT_INSL)!=PT_INSL)
+ else if(parts[r>>8].type == PT_SPRK && parts[r>>8].ctype==PT_SWCH && parts[i].life<10 && parts[i].life>0 &&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
{
- parts[r>>PS].type = parts[r>>PS].ctype;
- parts[r>>PS].life = 9;
+ parts[r>>8].type = parts[r>>8].ctype;
+ parts[r>>8].life = 9;
}
}
- if(parts[i].life==10 && (!(pmap[y-1][x-1]&TYPE) && ((pmap[y-1][x]&TYPE)==PT_BRAY&&parts[pmap[y-1][x]>>PS].tmp==2) && !(pmap[y-1][x+1]&TYPE) && ((pmap[y][x+1]&TYPE)==PT_BRAY&&parts[pmap[y][x+1]>>PS].tmp==2)))
+ if(parts[i].life==10 && (!(pmap[y-1][x-1]&0xFF) && ((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) && !(pmap[y-1][x+1]&0xFF) && ((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2)))
{
parts[i].life = 9;
}
- else if(parts[i].life<=5 && (!(pmap[y-1][x-1]&TYPE) && (((pmap[y-1][x]&TYPE)==PT_BRAY&&parts[pmap[y-1][x]>>PS].tmp==2) || ((pmap[y+1][x]&TYPE)==PT_BRAY&&parts[pmap[y+1][x]>>PS].tmp==2)) && !(pmap[y-1][x+1]&TYPE) && (((pmap[y][x+1]&TYPE)==PT_BRAY&&parts[pmap[y][x+1]>>PS].tmp==2) || ((pmap[y][x-1]&TYPE)==PT_BRAY&&parts[pmap[y][x-1]>>PS].tmp==2))))
+ else if(parts[i].life<=5 && (!(pmap[y-1][x-1]&0xFF) && (((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) || ((pmap[y+1][x]&0xFF)==PT_BRAY&&parts[pmap[y+1][x]>>8].tmp==2)) && !(pmap[y-1][x+1]&0xFF) && (((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2) || ((pmap[y][x-1]&0xFF)==PT_BRAY&&parts[pmap[y][x-1]>>8].tmp==2))))
{
parts[i].life = 14;
}
@@ -3906,19 +3911,19 @@ void update_particles_i(pixel *vid, int start, int inc)
x+nx<XRES && y+ny<YRES && (nx || ny))
{
r = pmap[y+ny][x+nx];
- if((r>>PS)>=NPART || !r)
+ if((r>>8)>=NPART || !r)
continue;
if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=WL_STREAM)
continue;
- rt = parts[r>>PS].type;
+ rt = parts[r>>8].type;
if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) &&
!(t==PT_PHOT && rt==PT_INSL) &&
- (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR && rt!=PT_QRTZ)) && !(rt==PT_SPNG && parts[r>>PS].life>0) &&
+ (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR && rt!=PT_QRTZ)) && !(rt==PT_SPNG && parts[r>>8].life>0) &&
ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000))
{
- parts[r>>PS].type = PT_FIRE;
- parts[r>>PS].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2);
- parts[r>>PS].life = rand()%80+180;
+ parts[r>>8].type = PT_FIRE;
+ parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2);
+ parts[r>>8].life = rand()%80+180;
if(ptypes[rt].explosive)
pv[y/CELL][x/CELL] += 0.25f * CFDS;
continue;
@@ -3932,10 +3937,10 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if(t!=PT_LAVA || parts[i].life>0)
{
- parts[r>>PS].ctype = (parts[r>>PS].type==PT_BRMT)?PT_BMTL:parts[r>>PS].type;
- parts[r>>PS].ctype = (parts[r>>PS].ctype==PT_SAND)?PT_GLAS:parts[r>>PS].ctype;
- parts[r>>PS].type = PT_LAVA;
- parts[r>>PS].life = rand()%120+240;
+ parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type;
+ parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype;
+ parts[r>>8].type = PT_LAVA;
+ parts[r>>8].life = rand()%120+240;
}
else
{
@@ -3947,7 +3952,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW))
{
- parts[r>>PS].type = PT_WATR;
+ parts[r>>8].type = PT_WATR;
if(t==PT_FIRE)
{
parts[i].x = lx;
@@ -3964,7 +3969,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW))
{
- kill_part(r>>PS);
+ kill_part(r>>8);
if(t==PT_FIRE)
{
parts[i].x = lx;
@@ -3984,99 +3989,99 @@ void update_particles_i(pixel *vid, int start, int inc)
//Check if there is a SWCH that is currently covered with SPRK
//If so check if the current SPRK is covering a NSCN
//If so turn the SPRK that covers the SWCH back into SWCH and turn it off
- if(rt==PT_SPRK && parts[r>>PS].ctype == PT_SWCH && t==PT_SPRK)
+ if(rt==PT_SPRK && parts[r>>8].ctype == PT_SWCH && t==PT_SPRK)
{
- pavg = parts_avg(r>>PS, i,PT_INSL);
+ pavg = parts_avg(r>>8, i,PT_INSL);
if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL)
{
- parts[r>>PS].type = PT_SWCH;
- parts[r>>PS].ctype = PT_NONE;
- parts[r>>PS].life = 9;
+ parts[r>>8].type = PT_SWCH;
+ parts[r>>8].ctype = PT_NONE;
+ parts[r>>8].life = 9;
}
}
- pavg = parts_avg(i, r>>PS,PT_INSL);
+ pavg = parts_avg(i, r>>8,PT_INSL);
if(rt==PT_SWCH && t==PT_SPRK)
{
- pavg = parts_avg(r>>PS, i,PT_INSL);
- if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL && parts[r>>PS].life<10)
- parts[r>>PS].life = 10;
+ pavg = parts_avg(r>>8, i,PT_INSL);
+ if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL && parts[r>>8].life<10)
+ parts[r>>8].life = 10;
if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL)
- parts[r>>PS].life = 9;
- if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>PS].life == 10&&pavg != PT_INSL)
+ parts[r>>8].life = 9;
+ if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL)
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].ctype = PT_SWCH;
- parts[r>>PS].life = 4;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].ctype = PT_SWCH;
+ parts[r>>8].life = 4;
}
}
- pavg = parts_avg(i, r>>PS,PT_INSL);
+ pavg = parts_avg(i, r>>8,PT_INSL);
if(pavg != PT_INSL)
{
- if(t==PT_SPRK && (ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>PS].life==0 &&
- (parts[i].life<3 || ((r>>PS)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
+ if(t==PT_SPRK && (ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 &&
+ (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{
if(!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN))&&!(parts[i].ctype==PT_INST&&rt!=PT_NSCN) )
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 4;
- parts[r>>PS].ctype = rt;
- if(parts[r>>PS].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR))
- parts[r>>PS].temp = parts[r>>PS].temp+10.0f;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
+ if(parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR))
+ parts[r>>8].temp = parts[r>>8].temp+10.0f;
}
}
- if(t==PT_SPRK && rt==PT_NTCT && parts[r>>PS].life==0 &&
- (parts[i].life<3 || ((r>>PS)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
+ if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 &&
+ (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{
- if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_NTCT||(parts[i].ctype==PT_PSCN&&parts[r>>PS].temp>373.0f))&&pavg != PT_INSL)
+ if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_NTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp>373.0f))&&pavg != PT_INSL)
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 4;
- parts[r>>PS].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
}
}
- if(t==PT_SPRK && rt==PT_PTCT && parts[r>>PS].life==0 &&
- (parts[i].life<3 || ((r>>PS)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
+ if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 &&
+ (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{
- if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_PTCT||(parts[i].ctype==PT_PSCN&&parts[r>>PS].temp<373.0f))&&pavg != PT_INSL)
+ if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_PTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp<373.0f))&&pavg != PT_INSL)
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 4;
- parts[r>>PS].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
}
}
- if(t==PT_SPRK && rt==PT_INWR && parts[r>>PS].life==0 &&
- (parts[i].life<3 || ((r>>PS)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
+ if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 &&
+ (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{
if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_INWR||parts[i].ctype==PT_PSCN)&&pavg != PT_INSL)
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 4;
- parts[r>>PS].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
}
}
- if(t==PT_SPRK && rt==PT_QRTZ && parts[r>>PS].life==0 &&
- (parts[i].life<3 || ((r>>PS)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
+ if(t==PT_SPRK && rt==PT_QRTZ && parts[r>>8].life==0 &&
+ (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
{
- if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_METL||parts[i].ctype==PT_PSCN||parts[i].ctype==PT_QRTZ)&&pavg != PT_INSL && (parts[r>>PS].temp<173.15||pv[(y+ny)/CELL][(x+nx)/CELL]>8))
+ if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_METL||parts[i].ctype==PT_PSCN||parts[i].ctype==PT_QRTZ)&&pavg != PT_INSL && (parts[r>>8].temp<173.15||pv[(y+ny)/CELL][(x+nx)/CELL]>8))
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 4;
- parts[r>>PS].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
}
}
- if(t==PT_SPRK && rt==PT_WATR && parts[r>>PS].life==0 &&
- (parts[i].life<2 || ((r>>PS)<i && parts[i].life<3)) && abs(nx)+abs(ny)<4)
+ if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 &&
+ (parts[i].life<2 || ((r>>8)<i && parts[i].life<3)) && abs(nx)+abs(ny)<4)
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 6;
- parts[r>>PS].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 6;
+ parts[r>>8].ctype = rt;
}
- if(t==PT_SPRK && rt==PT_SLTW && parts[r>>PS].life==0 &&
- (parts[i].life<2 || ((r>>PS)<i && parts[i].life<3)) && abs(nx)+abs(ny)<4)
+ if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 &&
+ (parts[i].life<2 || ((r>>8)<i && parts[i].life<3)) && abs(nx)+abs(ny)<4)
{
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 5;
- parts[r>>PS].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 5;
+ parts[r>>8].ctype = rt;
}
if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5)
{
@@ -4085,9 +4090,9 @@ void update_particles_i(pixel *vid, int start, int inc)
t = parts[i].type = PT_ETRD;
parts[i].ctype = PT_NONE;
parts[i].life = 20;
- parts[r>>PS].type = PT_SPRK;
- parts[r>>PS].life = 4;
- parts[r>>PS].ctype = rt;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
}
}
@@ -4119,6 +4124,11 @@ killed:
if((parts[i].temp<309.6f) && (parts[i].temp>=243))
parts[i].temp += 1;
+ if (isplayer) { //Already a stickman in the simulation
+ death = 1;
+ parts[i].type = PT_NONE;
+ }
+
//Death
if(parts[i].life<1 || death == 1 || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
@@ -4178,10 +4188,10 @@ killed:
player[26] = 0;
//Go left
- if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_GAS)
+ if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_LIQUID
- && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE) != PT_LNTG)
+ if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player[8]-1)][(int)(player[7])])
{
@@ -4216,10 +4226,10 @@ killed:
}
//Go right
- if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_GAS)
+ if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_LIQUID
- && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE) != PT_LNTG)
+ if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player[8]-1)][(int)(player[7])])
{
@@ -4255,7 +4265,7 @@ killed:
}
//Jump
- if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&TYPE].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&TYPE].state != ST_GAS))
+ if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS))
{
if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])])
{
@@ -4275,25 +4285,25 @@ killed:
for(nx = -2; nx <= 2; nx++)
for(ny = 0; ny>=-2; ny--)
{
- if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>PS)>=NPART)
+ if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART)
continue;
- if(ptypes[pmap[ny+y][nx+x]&TYPE].falldown!=0 || (pmap[ny+y][nx+x]&TYPE) == PT_NEUT || (pmap[ny+y][nx+x]&TYPE) == PT_PHOT)
+ if(ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT)
{
- player[2] = pmap[ny+y][nx+x]&TYPE; //Current element
+ player[2] = pmap[ny+y][nx+x]&0xFF; //Current element
}
- if((pmap[ny+y][nx+x]&TYPE) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
+ if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if(parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
- kill_part(pmap[ny+y][nx+x]>>PS);
+ kill_part(pmap[ny+y][nx+x]>>8);
}
- if((pmap[ny+y][nx+x]&TYPE) == PT_NEUT)
+ if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
- kill_part(pmap[ny+y][nx+x]>>PS);
+ kill_part(pmap[ny+y][nx+x]>>8);
}
if(bmap[(ny+y)/CELL][(nx+x)/CELL]==WL_FAN)
player[2] = SPC_AIR;
@@ -4308,9 +4318,9 @@ killed:
{
ny -= 2*(rand()%2)+1;
r = pmap[ny][nx];
- if(!((r>>PS)>=NPART))
+ if(!((r>>8)>=NPART))
{
- if(pstates[r&TYPE].state == ST_SOLID)
+ if(pstates[r&0xFF].state == ST_SOLID)
{
create_part(-1, nx, ny, PT_SPRK);
}
@@ -4322,20 +4332,20 @@ killed:
create_part(-1, nx, ny, player[2]);
r = pmap[ny][nx];
- if( ((r>>PS) < NPART) && (r>>PS)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR)
- parts[r>>PS].vx = parts[r>>PS].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01);
- if(((r>>PS) < NPART) && (r>>PS)>=0 && player[2] == PT_PHOT)
+ if( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR)
+ parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01);
+ if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT)
{
int random = abs(rand()%3-1)*3;
if (random==0)
{
- parts[r>>PS].life = 0;
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].life = 0;
+ parts[r>>8].type = PT_NONE;
}
else
{
- parts[r>>PS].vy = 0;
- parts[r>>PS].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
+ parts[r>>8].vy = 0;
+ parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
}
}
@@ -4372,11 +4382,11 @@ killed:
for(nx = -3; nx <= 3; nx++)
{
r = pmap[(int)(player[16]-2)][(int)(player[15]+nx)];
- if(r && pstates[r&TYPE].state != ST_GAS && pstates[r&TYPE].state != ST_LIQUID)
+ if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player[15] -= nx;
r = pmap[(int)(player[8]-2)][(int)(player[7]+nx)];
- if(r && pstates[r&TYPE].state != ST_GAS && pstates[r&TYPE].state != ST_LIQUID)
+ if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player[7] -= nx;
}
@@ -4386,9 +4396,9 @@ killed:
r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
//For left leg
- if (r && (r&TYPE)!=PT_STKM)
+ if (r && (r&0xFF)!=PT_STKM)
{
- if(pstates[r&TYPE].state == ST_LIQUID || (r&TYPE) == PT_LNTG) //Liquid checks //Liquid checks
+ if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks //Liquid checks
{
if(parts[i].y<(player[8]-10))
parts[i].vy = 1*dt;
@@ -4399,7 +4409,7 @@ killed:
}
else
{
- if(pstates[r&TYPE].state != ST_GAS)
+ if(pstates[r&0xFF].state != ST_GAS)
{
player[8] += ny-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
@@ -4411,9 +4421,9 @@ killed:
r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)];
//For right leg
- if (r && (r&TYPE)!=PT_STKM)
+ if (r && (r&0xFF)!=PT_STKM)
{
- if(pstates[r&TYPE].state == ST_LIQUID || (r&TYPE) == PT_LNTG)
+ if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
{
if(parts[i].y<(player[16]-10))
parts[i].vy = 1*dt;
@@ -4424,7 +4434,7 @@ killed:
}
else
{
- if(pstates[r&TYPE].state != ST_GAS)
+ if(pstates[r&0xFF].state != ST_GAS)
{
player[16] += ny-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
@@ -4457,45 +4467,45 @@ killed:
//If legs touch something
r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)];
- if((r&TYPE)==PT_SPRK && r && (r>>PS)<NPART) //If on charge
+ if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
- if (r>0 && (r>>PS)<NPART) //If hot or cold
+ if (r>0 && (r>>8)<NPART) //If hot or cold
{
- if(parts[r>>PS].temp>=323 || parts[r>>PS].temp<=243)
+ if(parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
{
parts[i].life -= 2;
player[26] -= 1;
}
}
- if ((r&TYPE)==PT_ACID) //If on acid
+ if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
- if ((r&TYPE)==PT_PLUT) //If on plut
+ if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)];
- if((r&TYPE)==PT_SPRK && r && (r>>PS)<NPART) //If on charge
+ if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
- if(r>0 && (r>>PS)<NPART) //If hot or cold
+ if(r>0 && (r>>8)<NPART) //If hot or cold
{
- if(parts[r>>PS].temp>=323 || parts[r>>PS].temp<=243)
+ if(parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
{
parts[i].life -= 2;
player[22] -= 1;
}
}
- if ((r&TYPE)==PT_ACID) //If on acid
+ if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
- if ((r&TYPE)==PT_PLUT) //If on plut
+ if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
isplayer = 1;
@@ -4509,6 +4519,11 @@ killed:
if((parts[i].temp<309.6f) && (parts[i].temp>=243))
parts[i].temp += 1;
+ if (isplayer2) { //Already a stickman2 in the simulation
+ death2 = 1;
+ parts[i].type = PT_NONE;
+ }
+
//Death
if(parts[i].life<1 || death2 == 1 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
@@ -4520,7 +4535,7 @@ killed:
create_part(-1, x+2, y+r, player2[2]);
}
kill_part(i); //Kill him
- goto killed;
+ continue;
}
parts[i].vy += -0.7*dt; //Head up!
@@ -4568,10 +4583,10 @@ killed:
player2[26] = 0;
//Go left
- if (((int)(player2[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_GAS)
+ if (((int)(player2[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_LIQUID
- && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE) != PT_LNTG)
+ if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
{
@@ -4606,10 +4621,10 @@ killed:
}
//Go right
- if (((int)(player2[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_GAS)
+ if (((int)(player2[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
- if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE].state != ST_LIQUID
- && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&TYPE) != PT_LNTG)
+ if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
+ && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
{
@@ -4645,7 +4660,7 @@ killed:
}
//Jump
- if (((int)(player2[0])&0x04) == 0x04 && (pstates[pmap[(int)(player2[8]-0.5)][(int)(player2[7])]&TYPE].state != ST_GAS || pstates[pmap[(int)(player2[16]-0.5)][(int)(player2[15])]&TYPE].state != ST_GAS))
+ if (((int)(player2[0])&0x04) == 0x04 && (pstates[pmap[(int)(player2[8]-0.5)][(int)(player2[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player2[16]-0.5)][(int)(player2[15])]&0xFF].state != ST_GAS))
{
if (pmap[(int)(player2[8]-0.5)][(int)(player2[7])] || pmap[(int)(player2[16]-0.5)][(int)(player2[15])])
{
@@ -4665,25 +4680,25 @@ killed:
for(nx = -2; nx <= 2; nx++)
for(ny = 0; ny>=-2; ny--)
{
- if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>PS)>=NPART)
+ if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART)
continue;
- if(ptypes[pmap[ny+y][nx+x]&TYPE].falldown!=0 || (pmap[ny+y][nx+x]&TYPE) == PT_NEUT || (pmap[ny+y][nx+x]&TYPE) == PT_PHOT)
+ if(ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT)
{
- player2[2] = pmap[ny+y][nx+x]&TYPE; //Current element
+ player2[2] = pmap[ny+y][nx+x]&0xFF; //Current element
}
- if((pmap[ny+y][nx+x]&TYPE) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
+ if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if(parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
- kill_part(pmap[ny+y][nx+x]>>PS);
+ kill_part(pmap[ny+y][nx+x]>>8);
}
- if((pmap[ny+y][nx+x]&TYPE) == PT_NEUT)
+ if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
- kill_part(pmap[ny+y][nx+x]>>PS);
+ kill_part(pmap[ny+y][nx+x]>>8);
}
if(bmap[(ny+y)/CELL][(nx+x)/CELL]==WL_FAN)
player2[2] = SPC_AIR;
@@ -4698,9 +4713,9 @@ killed:
{
ny -= 2*(rand()%2)+1;
r = pmap[ny][nx];
- if(!((r>>PS)>=NPART))
+ if(!((r>>8)>=NPART))
{
- if(pstates[r&TYPE].state == ST_SOLID)
+ if(pstates[r&0xFF].state == ST_SOLID)
{
create_part(-1, nx, ny, PT_SPRK);
}
@@ -4712,20 +4727,20 @@ killed:
create_part(-1, nx, ny, player2[2]);
r = pmap[ny][nx];
- if( ((r>>PS) < NPART) && (r>>PS)>=0 && player2[2] != PT_PHOT && player2[2] != SPC_AIR)
- parts[r>>PS].vx = parts[r>>PS].vx + 5*((((int)player2[1])&0x02) == 0x02) - 5*(((int)(player2[1])&0x01) == 0x01);
- if(((r>>PS) < NPART) && (r>>PS)>=0 && player2[2] == PT_PHOT)
+ if( ((r>>8) < NPART) && (r>>8)>=0 && player2[2] != PT_PHOT && player2[2] != SPC_AIR)
+ parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player2[1])&0x02) == 0x02) - 5*(((int)(player2[1])&0x01) == 0x01);
+ if(((r>>8) < NPART) && (r>>8)>=0 && player2[2] == PT_PHOT)
{
int random = abs(rand()%3-1)*3;
if (random==0)
{
- parts[r>>PS].life = 0;
- parts[r>>PS].type = PT_NONE;
+ parts[r>>8].life = 0;
+ parts[r>>8].type = PT_NONE;
}
else
{
- parts[r>>PS].vy = 0;
- parts[r>>PS].vx = (((((int)player2[1])&0x02) == 0x02) - (((int)(player2[1])&0x01) == 0x01))*random;
+ parts[r>>8].vy = 0;
+ parts[r>>8].vx = (((((int)player2[1])&0x02) == 0x02) - (((int)(player2[1])&0x01) == 0x01))*random;
}
}
@@ -4762,11 +4777,11 @@ killed:
for(nx = -3; nx <= 3; nx++)
{
r = pmap[(int)(player2[16]-2)][(int)(player2[15]+nx)];
- if(r && pstates[r&TYPE].state != ST_GAS && pstates[r&TYPE].state != ST_LIQUID)
+ if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player2[15] -= nx;
r = pmap[(int)(player2[8]-2)][(int)(player2[7]+nx)];
- if(r && pstates[r&TYPE].state != ST_GAS && pstates[r&TYPE].state != ST_LIQUID)
+ if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID)
player2[7] -= nx;
}
@@ -4776,9 +4791,9 @@ killed:
r = pmap[(int)(player2[8]+ny)][(int)(player2[7]+0.5)]; //This is to make coding more pleasant :-)
//For left leg
- if (r && (r&TYPE)!=PT_STKM2)
+ if (r && (r&0xFF)!=PT_STKM2)
{
- if(pstates[r&TYPE].state == ST_LIQUID || (r&TYPE) == PT_LNTG) //Liquid checks //Liquid checks
+ if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks //Liquid checks
{
if(parts[i].y<(player2[8]-10))
parts[i].vy = 1*dt;
@@ -4789,7 +4804,7 @@ killed:
}
else
{
- if(pstates[r&TYPE].state != ST_GAS)
+ if(pstates[r&0xFF].state != ST_GAS)
{
player2[8] += ny-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
@@ -4801,9 +4816,9 @@ killed:
r = pmap[(int)(player2[16]+ny)][(int)(player2[15]+0.5)];
//For right leg
- if (r && (r&TYPE)!=PT_STKM2)
+ if (r && (r&0xFF)!=PT_STKM2)
{
- if(pstates[r&TYPE].state == ST_LIQUID || (r&TYPE) == PT_LNTG)
+ if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
{
if(parts[i].y<(player2[16]-10))
parts[i].vy = 1*dt;
@@ -4814,7 +4829,7 @@ killed:
}
else
{
- if(pstates[r&TYPE].state != ST_GAS)
+ if(pstates[r&0xFF].state != ST_GAS)
{
player2[16] += ny-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
@@ -4847,45 +4862,45 @@ killed:
//If legs touch something
r = pmap[(int)(player2[8]+0.5)][(int)(player2[7]+0.5)];
- if((r&TYPE)==PT_SPRK && r && (r>>PS)<NPART) //If on charge
+ if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
- if (r>0 && (r>>PS)<NPART) //If hot or cold
+ if (r>0 && (r>>8)<NPART) //If hot or cold
{
- if(parts[r>>PS].temp>=323 || parts[r>>PS].temp<=243)
+ if(parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
{
parts[i].life -= 2;
player2[26] -= 1;
}
}
- if ((r&TYPE)==PT_ACID) //If on acid
+ if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
- if ((r&TYPE)==PT_PLUT) //If on plut
+ if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
r = pmap[(int)(player2[16]+0.5)][(int)(player2[15]+0.5)];
- if((r&TYPE)==PT_SPRK && r && (r>>PS)<NPART) //If on charge
+ if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
- if(r>0 && (r>>PS)<NPART) //If hot or cold
+ if(r>0 && (r>>8)<NPART) //If hot or cold
{
- if(parts[r>>PS].temp>=323 || parts[r>>PS].temp<=243)
+ if(parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
{
parts[i].life -= 2;
player2[22] -= 1;
}
}
- if ((r&TYPE)==PT_ACID) //If on acid
+ if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
- if ((r&TYPE)==PT_PLUT) //If on plut
+ if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
isplayer2 = 1;
@@ -4917,13 +4932,13 @@ killed:
if(x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES &&
pmap[y+ny][x+nx] &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_CLNE &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_BCLN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_PCLN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_STKM &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_STKM2 &&
- (pmap[y+ny][x+nx]&TYPE)!=0xFF)
- parts[i].ctype = pmap[y+ny][x+nx]&TYPE;
+ (pmap[y+ny][x+nx]&0xFF)!=PT_CLNE &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_BCLN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_PCLN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_STKM &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_STKM2 &&
+ (pmap[y+ny][x+nx]&0xFF)!=0xFF)
+ parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
}
else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
@@ -4939,13 +4954,13 @@ killed:
if(x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES &&
pmap[y+ny][x+nx] &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_CLNE &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_BCLN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_PCLN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_STKM &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_STKM2 &&
- (pmap[y+ny][x+nx]&TYPE)!=0xFF)
- parts[i].ctype = pmap[y+ny][x+nx]&TYPE;
+ (pmap[y+ny][x+nx]&0xFF)!=PT_CLNE &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_BCLN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_PCLN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_STKM &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_STKM2 &&
+ (pmap[y+ny][x+nx]&0xFF)!=0xFF)
+ parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
}
else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
@@ -4960,16 +4975,16 @@ killed:
if(x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES &&
pmap[y+ny][x+nx] &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_CLNE &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_PCLN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_BCLN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_SPRK &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_NSCN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_PSCN &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_STKM &&
- (pmap[y+ny][x+nx]&TYPE)!=PT_STKM2 &&
- (pmap[y+ny][x+nx]&TYPE)!=0xFF)
- parts[i].ctype = pmap[y+ny][x+nx]&TYPE;
+ (pmap[y+ny][x+nx]&0xFF)!=PT_CLNE &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_PCLN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_BCLN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_SPRK &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_NSCN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_PSCN &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_STKM &&
+ (pmap[y+ny][x+nx]&0xFF)!=PT_STKM2 &&
+ (pmap[y+ny][x+nx]&0xFF)!=0xFF)
+ parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
if(parts[i].ctype && parts[i].life==10) {
if(parts[i].ctype==PT_PHOT) {
for(nx=-1; nx<2; nx++) {
@@ -5023,15 +5038,15 @@ killed:
}
if(parts[i].type == PT_PHOT) {
- rt = pmap[ny][nx] & TYPE;
+ rt = pmap[ny][nx] & 0xFF;
if(rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN) {
- lt = pmap[ny][nx] >>PS;
+ lt = pmap[ny][nx] >> 8;
if(!parts[lt].ctype)
parts[lt].ctype = PT_PHOT;
}
- lt = pmap[y][x] & TYPE;
+ lt = pmap[y][x] & 0xFF;
r = eval_move(PT_PHOT, nx, ny, NULL);
@@ -5147,7 +5162,7 @@ killed:
s = 1;
break;
}
- if((pmap[y][j]&TYPE)!=t || (bmap[y/CELL][j/CELL] && bmap[y/CELL][j/CELL]!=WL_STREAM))
+ if((pmap[y][j]&255)!=t || (bmap[y/CELL][j/CELL] && bmap[y/CELL][j/CELL]!=WL_STREAM))
break;
}
if(parts[i].vy>0)
@@ -5162,7 +5177,7 @@ killed:
parts[i].y += j-y;
break;
}
- if((pmap[j][x]&TYPE)!=t || (bmap[j/CELL][x/CELL] && bmap[j/CELL][x/CELL]!=WL_STREAM))
+ if((pmap[j][x]&255)!=t || (bmap[j/CELL][x/CELL] && bmap[j/CELL][x/CELL]!=WL_STREAM))
{
s = 0;
break;
@@ -5194,22 +5209,22 @@ killed:
r = pmap[ny][nx];
/* this should be replaced with a particle type attribute ("photwl" or something) */
- if((r & TYPE) == PT_PSCN) parts[i].ctype = 0x00000000;
- if((r & TYPE) == PT_NSCN) parts[i].ctype = 0x00000000;
- if((r & TYPE) == PT_SPRK) parts[i].ctype = 0x00000000;
- if((r & TYPE) == PT_COAL) parts[i].ctype = 0x00000000;
- if((r & TYPE) == PT_BCOL) parts[i].ctype = 0x00000000;
- if((r & TYPE) == PT_PLEX) parts[i].ctype &= 0x1F00003E;
- if((r & TYPE) == PT_NITR) parts[i].ctype &= 0x0007C000;
- if((r & TYPE) == PT_NBLE) parts[i].ctype &= 0x3FFF8000;
- if((r & TYPE) == PT_LAVA) parts[i].ctype &= 0x3FF00000;
- if((r & TYPE) == PT_ACID) parts[i].ctype &= 0x1FE001FE;
- if((r & TYPE) == PT_DUST) parts[i].ctype &= 0x3FFFFFC0;
- if((r & TYPE) == PT_SNOW) parts[i].ctype &= 0x03FFFFFF;
- if((r & TYPE) == PT_GOO) parts[i].ctype &= 0x3FFAAA00;
- if((r & TYPE) == PT_PLNT) parts[i].ctype &= 0x0007C000;
- if((r & TYPE) == PT_PLUT) parts[i].ctype &= 0x001FCE00;
- if((r & TYPE) == PT_URAN) parts[i].ctype &= 0x003FC000;
+ if((r & 0xFF) == PT_PSCN) parts[i].ctype = 0x00000000;
+ if((r & 0xFF) == PT_NSCN) parts[i].ctype = 0x00000000;
+ if((r & 0xFF) == PT_SPRK) parts[i].ctype = 0x00000000;
+ if((r & 0xFF) == PT_COAL) parts[i].ctype = 0x00000000;
+ if((r & 0xFF) == PT_BCOL) parts[i].ctype = 0x00000000;
+ if((r & 0xFF) == PT_PLEX) parts[i].ctype &= 0x1F00003E;
+ if((r & 0xFF) == PT_NITR) parts[i].ctype &= 0x0007C000;
+ if((r & 0xFF) == PT_NBLE) parts[i].ctype &= 0x3FFF8000;
+ if((r & 0xFF) == PT_LAVA) parts[i].ctype &= 0x3FF00000;
+ if((r & 0xFF) == PT_ACID) parts[i].ctype &= 0x1FE001FE;
+ if((r & 0xFF) == PT_DUST) parts[i].ctype &= 0x3FFFFFC0;
+ if((r & 0xFF) == PT_SNOW) parts[i].ctype &= 0x03FFFFFF;
+ if((r & 0xFF) == PT_GOO) parts[i].ctype &= 0x3FFAAA00;
+ if((r & 0xFF) == PT_PLNT) parts[i].ctype &= 0x0007C000;
+ if((r & 0xFF) == PT_PLUT) parts[i].ctype &= 0x001FCE00;
+ if((r & 0xFF) == PT_URAN) parts[i].ctype &= 0x003FC000;
if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) {
dp = nrx*parts[i].vx + nry*parts[i].vy;
@@ -5299,11 +5314,11 @@ void update_particles(pixel *vid)
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);
if(x>=0 && y>=0 && x<XRES && y<YRES && t!=PT_PHOT) {
- if(t!=PT_NEUT || (pmap[y][x]&TYPE)!=PT_GLAS)
- pmap[y][x] = t|(i<<PS);
+ if(t!=PT_NEUT || (pmap[y][x]&0xFF)!=PT_GLAS)
+ pmap[y][x] = t|(i<<8);
}
if(t==PT_PHOT)
- photons[y][x] = t|(i<<PS);
+ photons[y][x] = t|(i<<8);
NUM_PARTS ++;
}
else
@@ -5883,10 +5898,10 @@ void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert)
{
if(area_x + cx<XRES&&area_y + cy<YRES)
{
- if((rtpmap[cy][cx]>>PS)<=NPART&&rtpmap[cy][cx])
+ if((rtpmap[cy][cx]>>8)<=NPART&&rtpmap[cy][cx])
{
- parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>PS].x = area_x +cx;
- parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>PS].y = area_y +cy;
+ parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>8].x = area_x +cx;
+ parts[rtpmap[(int)(cy+0.5f)][(int)(cx+0.5f)]>>8].y = area_y +cy;
}
bmap[(area_y+cy)/CELL][(area_x+cx)/CELL] = rtbmap[cy/CELL][cx/CELL];
fvy[(area_y+cy)/CELL][(area_x+cx)/CELL] = tfvy[cy/CELL][cx/CELL];
@@ -5936,7 +5951,7 @@ int flood_parts(int x, int y, int c, int cm, int bm)
int x1, x2, dy = (c<PT_NUM)?1:CELL;
int co = c, wall;
if(cm==PT_INST&&co==PT_SPRK)
- if((pmap[y][x]&TYPE)==PT_SPRK)
+ if((pmap[y][x]&0xFF)==PT_SPRK)
return 0;
if(c>=UI_WALLSTART&&c<=UI_WALLSTART+UI_WALLCOUNT)
{
@@ -5946,7 +5961,7 @@ int flood_parts(int x, int y, int c, int cm, int bm)
{
if(c==0)
{
- cm = pmap[y][x]&TYPE;
+ cm = pmap[y][x]&0xFF;
if(!cm)
return 0;
if(REPLACE_MODE && cm!=SLALT)
@@ -5969,14 +5984,14 @@ int flood_parts(int x, int y, int c, int cm, int bm)
bm = 0;
}
- if(((pmap[y][x]&TYPE)!=cm || bmap[y/CELL][x/CELL]!=bm )||( (sdl_mod & (KMOD_CAPS)) && cm!=SLALT))
+ if(((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm )||( (sdl_mod & (KMOD_CAPS)) && cm!=SLALT))
return 1;
// go left as far as possible
x1 = x2 = x;
while(x1>=CELL)
{
- if((pmap[y][x1-1]&TYPE)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm)
+ if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm)
{
break;
}
@@ -5984,7 +5999,7 @@ int flood_parts(int x, int y, int c, int cm, int bm)
}
while(x2<XRES-CELL)
{
- if((pmap[y][x2+1]&TYPE)!=cm || bmap[y/CELL][(x2+1)/CELL]!=bm)
+ if((pmap[y][x2+1]&0xFF)!=cm || bmap[y/CELL][(x2+1)/CELL]!=bm)
{
break;
}
@@ -6001,31 +6016,31 @@ int flood_parts(int x, int y, int c, int cm, int bm)
if(cm==PT_INST&&co==PT_SPRK)//wire crossing for INST
{
if(y>=CELL+dy && x1==x2 &&
- ((pmap[y-1][x1-1]&TYPE)==PT_INST||(pmap[y-1][x1-1]&TYPE)==PT_SPRK) && ((pmap[y-1][x1]&TYPE)==PT_INST||(pmap[y-1][x1]&TYPE)==PT_SPRK) && ((pmap[y-1][x1+1]&TYPE)==PT_INST || (pmap[y-1][x1+1]&TYPE)==PT_SPRK) &&
- (pmap[y-2][x1-1]&TYPE)!=PT_INST && ((pmap[y-2][x1]&TYPE)==PT_INST ||(pmap[y-2][x1]&TYPE)==PT_SPRK) && (pmap[y-2][x1+1]&TYPE)!=PT_INST)
+ ((pmap[y-1][x1-1]&0xFF)==PT_INST||(pmap[y-1][x1-1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1]&0xFF)==PT_INST||(pmap[y-1][x1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1+1]&0xFF)==PT_INST || (pmap[y-1][x1+1]&0xFF)==PT_SPRK) &&
+ (pmap[y-2][x1-1]&0xFF)!=PT_INST && ((pmap[y-2][x1]&0xFF)==PT_INST ||(pmap[y-2][x1]&0xFF)==PT_SPRK) && (pmap[y-2][x1+1]&0xFF)!=PT_INST)
flood_parts(x1, y-2, co, cm, bm);
else if(y>=CELL+dy)
for(x=x1; x<=x2; x++)
- if((pmap[y-1][x]&TYPE)!=PT_SPRK)
+ if((pmap[y-1][x]&0xFF)!=PT_SPRK)
{
if(x==x1 || x==x2 || y>=YRES-CELL-1 ||
- (pmap[y-1][x-1]&TYPE)==PT_INST || (pmap[y-1][x+1]&TYPE)==PT_INST ||
- (pmap[y+1][x-1]&TYPE)==PT_INST || ((pmap[y+1][x]&TYPE)!=PT_INST&&(pmap[y+1][x]&TYPE)!=PT_SPRK) || (pmap[y+1][x+1]&TYPE)==PT_INST)
+ (pmap[y-1][x-1]&0xFF)==PT_INST || (pmap[y-1][x+1]&0xFF)==PT_INST ||
+ (pmap[y+1][x-1]&0xFF)==PT_INST || ((pmap[y+1][x]&0xFF)!=PT_INST&&(pmap[y+1][x]&0xFF)!=PT_SPRK) || (pmap[y+1][x+1]&0xFF)==PT_INST)
flood_parts(x, y-dy, co, cm, bm);
}
if(y<YRES-CELL-dy && x1==x2 &&
- ((pmap[y+1][x1-1]&TYPE)==PT_INST||(pmap[y+1][x1-1]&TYPE)==PT_SPRK) && ((pmap[y+1][x1]&TYPE)==PT_INST||(pmap[y+1][x1]&TYPE)==PT_SPRK) && ((pmap[y+1][x1+1]&TYPE)==PT_INST || (pmap[y+1][x1+1]&TYPE)==PT_SPRK) &&
- (pmap[y+2][x1-1]&TYPE)!=PT_INST && ((pmap[y+2][x1]&TYPE)==PT_INST ||(pmap[y+2][x1]&TYPE)==PT_SPRK) && (pmap[y+2][x1+1]&TYPE)!=PT_INST)
+ ((pmap[y+1][x1-1]&0xFF)==PT_INST||(pmap[y+1][x1-1]&0xFF)==PT_SPRK) && ((pmap[y+1][x1]&0xFF)==PT_INST||(pmap[y+1][x1]&0xFF)==PT_SPRK) && ((pmap[y+1][x1+1]&0xFF)==PT_INST || (pmap[y+1][x1+1]&0xFF)==PT_SPRK) &&
+ (pmap[y+2][x1-1]&0xFF)!=PT_INST && ((pmap[y+2][x1]&0xFF)==PT_INST ||(pmap[y+2][x1]&0xFF)==PT_SPRK) && (pmap[y+2][x1+1]&0xFF)!=PT_INST)
flood_parts(x1, y+2, co, cm, bm);
else if(y<YRES-CELL-dy)
for(x=x1; x<=x2; x++)
- if((pmap[y+1][x]&TYPE)!=PT_SPRK)
+ if((pmap[y+1][x]&0xFF)!=PT_SPRK)
{
if(x==x1 || x==x2 || y<0 ||
- (pmap[y+1][x-1]&TYPE)==PT_INST || (pmap[y+1][x+1]&TYPE)==PT_INST ||
- (pmap[y-1][x-1]&TYPE)==PT_INST || ((pmap[y-1][x]&TYPE)!=PT_INST&&(pmap[y-1][x]&TYPE)!=PT_SPRK) || (pmap[y-1][x+1]&TYPE)==PT_INST)
+ (pmap[y+1][x-1]&0xFF)==PT_INST || (pmap[y+1][x+1]&0xFF)==PT_INST ||
+ (pmap[y-1][x-1]&0xFF)==PT_INST || ((pmap[y-1][x]&0xFF)!=PT_INST&&(pmap[y-1][x]&0xFF)!=PT_SPRK) || (pmap[y-1][x+1]&0xFF)==PT_INST)
flood_parts(x, y+dy, co, cm, bm);
}
@@ -6034,12 +6049,12 @@ int flood_parts(int x, int y, int c, int cm, int bm)
{
if(y>=CELL+dy)
for(x=x1; x<=x2; x++)
- if((pmap[y-dy][x]&TYPE)==cm && bmap[(y-dy)/CELL][x/CELL]==bm)
+ if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm)
if(!flood_parts(x, y-dy, co, cm, bm))
return 0;
if(y<YRES-CELL-dy)
for(x=x1; x<=x2; x++)
- if((pmap[y+dy][x]&TYPE)==cm && bmap[(y+dy)/CELL][x/CELL]==bm)
+ if((pmap[y+dy][x]&0xFF)==cm && bmap[(y+dy)/CELL][x/CELL]==bm)
if(!flood_parts(x, y+dy, co, cm, bm))
return 0;
}
@@ -6143,7 +6158,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
if((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(rx,2))+(pow(j,2))/(pow(ry,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=ry*rx))
if(!REPLACE_MODE)
create_part(-2, x+i, y+j, c);
- else if((pmap[y+j][x+i]&TYPE)==SLALT&&SLALT!=0)
+ else if((pmap[y+j][x+i]&0xFF)==SLALT&&SLALT!=0)
create_part(-2, x+i, y+j, c);
return 1;
}
@@ -6168,7 +6183,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
{
if(rx==0&&ry==0)
{
- if((pmap[y][x]&TYPE)==SLALT || SLALT==0)
+ if((pmap[y][x]&0xFF)==SLALT || SLALT==0)
{
if((pmap[y][x]))
{
@@ -6183,7 +6198,7 @@ int create_parts(int x, int y, int rx, int ry, int c)
for(i=-rx; i<=rx; i++)
if((CURRENT_BRUSH==CIRCLE_BRUSH && (pow(i,2))/(pow(rx,2))+(pow(j,2))/(pow(ry,2))<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=ry*rx))
{
- if((pmap[y+j][x+i]&TYPE)!=SLALT&&SLALT!=0)
+ if((pmap[y+j][x+i]&0xFF)!=SLALT&&SLALT!=0)
continue;
if((pmap[y+j][x+i]))
{