mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 05:30:23 +02:00
Added specific element erase, right click on element in menu, then right click on eraser, the one to be erased will have a light blue box around it. works for walls too.
changed some wall code because it looks like someone just put random numbers in. fixed a wall bug
This commit is contained in:
24
air.c
24
air.c
@@ -54,15 +54,15 @@ void update_air(void)
|
|||||||
vy[y][x] *= VLOSS;
|
vy[y][x] *= VLOSS;
|
||||||
vx[y][x] += dx*TSTEPV;
|
vx[y][x] += dx*TSTEPV;
|
||||||
vy[y][x] += dy*TSTEPV;
|
vy[y][x] += dy*TSTEPV;
|
||||||
if(bmap[y][x]==1 || bmap[y][x+1]==1 ||
|
if(bmap[y][x]==11 || bmap[y][x+1]==11 ||
|
||||||
bmap[y][x]==8 || bmap[y][x+1]==8 ||
|
bmap[y][x]==2 || bmap[y][x+1]==2 ||
|
||||||
(bmap[y][x]==7 && !emap[y][x]) ||
|
(bmap[y][x]==3 && !emap[y][x]) ||
|
||||||
(bmap[y][x+1]==7 && !emap[y][x+1]))
|
(bmap[y][x+1]==3 && !emap[y][x+1]))
|
||||||
vx[y][x] = 0;
|
vx[y][x] = 0;
|
||||||
if(bmap[y][x]==1 || bmap[y+1][x]==1 ||
|
if(bmap[y][x]==11 || bmap[y+1][x]==11 ||
|
||||||
bmap[y][x]==8 || bmap[y+1][x]==8 ||
|
bmap[y][x]==2 || bmap[y+1][x]==2 ||
|
||||||
(bmap[y][x]==7 && !emap[y][x]) ||
|
(bmap[y][x]==3 && !emap[y][x]) ||
|
||||||
(bmap[y+1][x]==7 && !emap[y+1][x]))
|
(bmap[y+1][x]==3 && !emap[y+1][x]))
|
||||||
vy[y][x] = 0;
|
vy[y][x] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,9 +76,9 @@ void update_air(void)
|
|||||||
for(i=-1; i<2; i++)
|
for(i=-1; i<2; i++)
|
||||||
if(y+j>0 && y+j<YRES/CELL-1 &&
|
if(y+j>0 && y+j<YRES/CELL-1 &&
|
||||||
x+i>0 && x+i<XRES/CELL-1 &&
|
x+i>0 && x+i<XRES/CELL-1 &&
|
||||||
bmap[y+j][x+i]!=1 &&
|
bmap[y+j][x+i]!=11 &&
|
||||||
bmap[y+j][x+i]!=8 &&
|
bmap[y+j][x+i]!=2 &&
|
||||||
(bmap[y+j][x+i]!=7 || emap[y+j][x+i]))
|
(bmap[y+j][x+i]!=8 || emap[y+j][x+i]))
|
||||||
{
|
{
|
||||||
f = kernel[i+1+(j+1)*3];
|
f = kernel[i+1+(j+1)*3];
|
||||||
dx += vx[y+j][x+i]*f;
|
dx += vx[y+j][x+i]*f;
|
||||||
@@ -118,7 +118,7 @@ void update_air(void)
|
|||||||
dy += VADV*tx*ty*vy[j+1][i+1];
|
dy += VADV*tx*ty*vy[j+1][i+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bmap[y][x] == 4)
|
if(bmap[y][x] == 7)
|
||||||
{
|
{
|
||||||
dx += fvx[y][x];
|
dx += fvx[y][x];
|
||||||
dy += fvy[y][x];
|
dy += fvy[y][x];
|
||||||
|
@@ -66,6 +66,8 @@ typedef unsigned char uint8;
|
|||||||
|
|
||||||
extern int amd;
|
extern int amd;
|
||||||
|
|
||||||
|
unsigned int PSR;
|
||||||
|
|
||||||
extern int FPSB;
|
extern int FPSB;
|
||||||
|
|
||||||
extern int legacy_enable;
|
extern int legacy_enable;
|
||||||
|
22
interface.c
22
interface.c
@@ -1291,7 +1291,7 @@ void menu_ui(pixel *vid_buf, int i, int *sl, int *sr)
|
|||||||
else if(n==*sr)
|
else if(n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(n = 0; n<PT_NUM; n++)
|
for(n = 0; n<PT_NUM; n++)
|
||||||
@@ -1400,7 +1400,7 @@ void menu_ui(pixel *vid_buf, int i, int *sl, int *sr)
|
|||||||
//drawtext(vid_buf, XRES+2, (12*i)+2, msections[i].icon, 255, 255, 255, 255);
|
//drawtext(vid_buf, XRES+2, (12*i)+2, msections[i].icon, 255, 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my)
|
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *psr,int b, int bq, int mx, int my)
|
||||||
{
|
{
|
||||||
int h,x,y,n=0,height,width,sy,rows=0;
|
int h,x,y,n=0,height,width,sy,rows=0;
|
||||||
mx /= sdl_scale;
|
mx /= sdl_scale;
|
||||||
@@ -1436,6 +1436,10 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
else if(n==*sr)
|
else if(n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
||||||
|
}
|
||||||
|
else if(n==*psr)
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1464,6 +1468,10 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
else if(n==*sr)
|
else if(n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
||||||
|
}
|
||||||
|
else if(n==*psr)
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1489,6 +1497,10 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
else if(n==*sr)
|
else if(n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
||||||
|
}
|
||||||
|
else if(n==*psr)
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1517,6 +1529,10 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
else if(n==*sr)
|
else if(n==*sr)
|
||||||
{
|
{
|
||||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255);
|
||||||
|
}
|
||||||
|
else if(n==*psr)
|
||||||
|
{
|
||||||
|
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1541,6 +1557,8 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
|||||||
}
|
}
|
||||||
if(b==4&&h!=-1)
|
if(b==4&&h!=-1)
|
||||||
{
|
{
|
||||||
|
PSR = *sr;
|
||||||
|
*psr = *sr;
|
||||||
*sr = h;
|
*sr = h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -158,7 +158,7 @@ int save_name_ui(pixel *vid_buf);
|
|||||||
|
|
||||||
void menu_ui(pixel *vid_buf, int i, int *sl, int *sr);
|
void menu_ui(pixel *vid_buf, int i, int *sl, int *sr);
|
||||||
|
|
||||||
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my);
|
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr,int *psr,int b, int bq, int mx, int my);
|
||||||
|
|
||||||
int sdl_poll(void);
|
int sdl_poll(void);
|
||||||
|
|
||||||
|
16
main.c
16
main.c
@@ -247,7 +247,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
|
|||||||
d[p++] = bmap[y][x];
|
d[p++] = bmap[y][x];
|
||||||
for(y=by0; y<by0+bh; y++)
|
for(y=by0; y<by0+bh; y++)
|
||||||
for(x=bx0; x<bx0+bw; x++)
|
for(x=bx0; x<bx0+bw; x++)
|
||||||
if(bmap[y][x]==4)
|
if(bmap[y][x]==7)
|
||||||
{
|
{
|
||||||
i = (int)(fvx[y][x]*64.0f+127.5f);
|
i = (int)(fvx[y][x]*64.0f+127.5f);
|
||||||
if(i<0) i=0;
|
if(i<0) i=0;
|
||||||
@@ -256,7 +256,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
|
|||||||
}
|
}
|
||||||
for(y=by0; y<by0+bh; y++)
|
for(y=by0; y<by0+bh; y++)
|
||||||
for(x=bx0; x<bx0+bw; x++)
|
for(x=bx0; x<bx0+bw; x++)
|
||||||
if(bmap[y][x]==4)
|
if(bmap[y][x]==7)
|
||||||
{
|
{
|
||||||
i = (int)(fvy[y][x]*64.0f+127.5f);
|
i = (int)(fvy[y][x]*64.0f+127.5f);
|
||||||
if(i<0) i=0;
|
if(i<0) i=0;
|
||||||
@@ -958,7 +958,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef INTERNAL
|
#ifdef INTERNAL
|
||||||
int vs = 0;
|
int vs = 0;
|
||||||
#endif
|
#endif
|
||||||
int x, y, b = 0, sl=1, sr=0, su=0, c, lb = 0, lx = 0, ly = 0, lm = 0;//, tx, ty;
|
int x, y, b = 0, sl=1, sr=0,su=0,psr=0, c, lb = 0, lx = 0, ly = 0, lm = 0;//, tx, ty;
|
||||||
int da = 0, db = 0, it = 2047, mx, my, bs = 2;
|
int da = 0, db = 0, it = 2047, mx, my, bs = 2;
|
||||||
float nfvx, nfvy;
|
float nfvx, nfvy;
|
||||||
int load_mode=0, load_w=0, load_h=0, load_x=0, load_y=0, load_size=0;
|
int load_mode=0, load_w=0, load_h=0, load_x=0, load_y=0, load_size=0;
|
||||||
@@ -1074,7 +1074,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
for(i=1; i<XRES/CELL; i++)
|
for(i=1; i<XRES/CELL; i++)
|
||||||
{
|
{
|
||||||
if(bmap[j][i]==1 || bmap[j][i]==8 || (bmap[j][i]==7 && !emap[j][i]))
|
if(bmap[j][i]==11 || bmap[j][i]==2 || (bmap[j][i]==3 && !emap[j][i]))
|
||||||
{
|
{
|
||||||
vx[j][i] = 0.0f;
|
vx[j][i] = 0.0f;
|
||||||
vx[j][i-1] = 0.0f;
|
vx[j][i-1] = 0.0f;
|
||||||
@@ -1345,7 +1345,7 @@ int main(int argc, char *argv[])
|
|||||||
active_menu = i;
|
active_menu = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu_ui_v3(vid_buf, active_menu, &sl, &sr, b, bq, x, y);
|
menu_ui_v3(vid_buf, active_menu, &sl, &sr, &psr, b, bq, x, y);
|
||||||
|
|
||||||
if(zoom_en && x>=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy
|
if(zoom_en && x>=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy
|
||||||
&& x<sdl_scale*(zoom_wx+ZFACTOR*ZSIZE)
|
&& x<sdl_scale*(zoom_wx+ZFACTOR*ZSIZE)
|
||||||
@@ -1730,7 +1730,7 @@ int main(int argc, char *argv[])
|
|||||||
if(lm == 1)
|
if(lm == 1)
|
||||||
{
|
{
|
||||||
xor_line(lx, ly, x, y, vid_buf);
|
xor_line(lx, ly, x, y, vid_buf);
|
||||||
if(c==127 && lx>=0 && ly>=0 && lx<XRES && ly<YRES && bmap[ly/CELL][lx/CELL]==4)
|
if(c==127 && lx>=0 && ly>=0 && lx<XRES && ly<YRES && bmap[ly/CELL][lx/CELL]==7)
|
||||||
{
|
{
|
||||||
nfvx = (x-lx)*0.005f;
|
nfvx = (x-lx)*0.005f;
|
||||||
nfvy = (y-ly)*0.005f;
|
nfvy = (y-ly)*0.005f;
|
||||||
@@ -1741,7 +1741,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
fvx[j][i] = nfvx;
|
fvx[j][i] = nfvx;
|
||||||
fvy[j][i] = nfvy;
|
fvy[j][i] = nfvy;
|
||||||
bmap[j][i] = 4;
|
bmap[j][i] = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1845,7 +1845,7 @@ int main(int argc, char *argv[])
|
|||||||
su = c;
|
su = c;
|
||||||
if(lm == 1)
|
if(lm == 1)
|
||||||
{
|
{
|
||||||
if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4)
|
if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=7)
|
||||||
create_line(lx, ly, x, y, bs, c);
|
create_line(lx, ly, x, y, bs, c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
203
powder.c
203
powder.c
@@ -59,30 +59,30 @@ int try_move(int i, int x, int y, int nx, int ny)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL])
|
if(bmap[ny/CELL][nx/CELL]==15 && !emap[y/CELL][x/CELL])
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE)
|
if(bmap[ny/CELL][nx/CELL]==20 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL]))
|
if((bmap[y/CELL][x/CELL]==15 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=15 && !emap[ny/CELL][nx/CELL]))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3)
|
if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==8)
|
||||||
return 0;
|
return 0;
|
||||||
if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL])
|
if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==3 && !emap[ny/CELL][nx/CELL])
|
||||||
return 0;
|
return 0;
|
||||||
if(r && (r>>8)<NPART && ptypes[r&0xFF].falldown!=2 && bmap[y/CELL][x/CELL]==3)
|
if(r && (r>>8)<NPART && ptypes[r&0xFF].falldown!=2 && bmap[y/CELL][x/CELL]==8)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(bmap[ny/CELL][nx/CELL]==9)
|
if(bmap[ny/CELL][nx/CELL]==12)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(ptypes[parts[i].type].falldown!=1 && bmap[ny/CELL][nx/CELL]==10)
|
if(ptypes[parts[i].type].falldown!=1 && bmap[ny/CELL][nx/CELL]==13)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (r && ((r&0xFF) >= PT_NUM || !can_move[parts[i].type][(r&0xFF)]))
|
if (r && ((r&0xFF) >= PT_NUM || !can_move[parts[i].type][(r&0xFF)]))
|
||||||
@@ -326,15 +326,20 @@ inline void delete_part(int x, int y)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
if(x<0 || y<0 || x>=XRES || y>=YRES)
|
if(x<0 || y<0 || x>=XRES || y>=YRES)
|
||||||
return;
|
return;
|
||||||
i = pmap[y][x];
|
i = pmap[y][x];
|
||||||
if(!i || (i>>8)>=NPART)
|
if(!i || (i>>8)>=NPART)
|
||||||
return;
|
return;
|
||||||
|
if((parts[i>>8].type==PSR)||PSR==0||PSR==130)
|
||||||
kill_part(i>>8);
|
{
|
||||||
pmap[y][x] = 0; // just in case
|
kill_part(i>>8);
|
||||||
|
pmap[y][x] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -343,7 +348,7 @@ _inline int is_wire(int x, int y)
|
|||||||
inline int is_wire(int x, int y)
|
inline int is_wire(int x, int y)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12;
|
return bmap[y][x]==4 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==2 || bmap[y][x]==14 || bmap[y][x]==15;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -352,7 +357,7 @@ _inline int is_wire_off(int x, int y)
|
|||||||
inline int is_wire_off(int x, int y)
|
inline int is_wire_off(int x, int y)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8;
|
return (bmap[y][x]==4 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==2 || bmap[y][x]==14 || bmap[y][x]==15) && emap[y][x]<8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_emap(int x, int y)
|
void set_emap(int x, int y)
|
||||||
@@ -508,14 +513,14 @@ void update_particles_i(pixel *vid, int start, int inc)
|
|||||||
|
|
||||||
|
|
||||||
if(x<0 || y<0 || x>=XRES || y>=YRES ||
|
if(x<0 || y<0 || x>=XRES || y>=YRES ||
|
||||||
((bmap[y/CELL][x/CELL]==1 ||
|
((bmap[y/CELL][x/CELL]==11 ||
|
||||||
bmap[y/CELL][x/CELL]==8 ||
|
bmap[y/CELL][x/CELL]==2 ||
|
||||||
bmap[y/CELL][x/CELL]==9 ||
|
bmap[y/CELL][x/CELL]==12 ||
|
||||||
(bmap[y/CELL][x/CELL]==2) ||
|
(bmap[y/CELL][x/CELL]==9) ||
|
||||||
(bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) ||
|
(bmap[y/CELL][x/CELL]==8 && ptypes[t].falldown!=2) ||
|
||||||
(bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) ||
|
(bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=1) ||
|
||||||
(bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) ||
|
(bmap[y/CELL][x/CELL]==4 && (t==PT_METL || t==PT_SPRK)) ||
|
||||||
(bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM)))
|
(bmap[y/CELL][x/CELL]==3 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM)))
|
||||||
{
|
{
|
||||||
kill_part(i);
|
kill_part(i);
|
||||||
continue;
|
continue;
|
||||||
@@ -858,14 +863,14 @@ void update_particles_i(pixel *vid, int start, int inc)
|
|||||||
t = PT_SPRK;
|
t = PT_SPRK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(bmap[ny][nx]==6 || bmap[ny][nx]==7 || bmap[ny][nx]==3 || bmap[ny][nx]==8 || bmap[ny][nx]==11 || bmap[ny][nx]==12)
|
else if(bmap[ny][nx]==4 || bmap[ny][nx]==3 || bmap[ny][nx]==8 || bmap[ny][nx]==2 || bmap[ny][nx]==14 || bmap[ny][nx]==15)
|
||||||
set_emap(nx, ny);
|
set_emap(nx, ny);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nx = x/CELL;
|
nx = x/CELL;
|
||||||
ny = y/CELL;
|
ny = y/CELL;
|
||||||
if(bmap[ny][nx]==6 && emap[ny][nx]<8)
|
if(bmap[ny][nx]==4 && emap[ny][nx]<8)
|
||||||
set_emap(nx, ny);
|
set_emap(nx, ny);
|
||||||
|
|
||||||
fe = 0;
|
fe = 0;
|
||||||
@@ -1647,9 +1652,9 @@ player[23] = 1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Charge detector wall if foot inside
|
//Charge detector wall if foot inside
|
||||||
if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6)
|
if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==4)
|
||||||
set_emap((int)player[7]/CELL, (int)player[8]/CELL);
|
set_emap((int)player[7]/CELL, (int)player[8]/CELL);
|
||||||
if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6)
|
if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==4)
|
||||||
set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL);
|
set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL);
|
||||||
|
|
||||||
//Searching for particles near head
|
//Searching for particles near head
|
||||||
@@ -1676,7 +1681,7 @@ player[23] = 1;
|
|||||||
parts[i].life -= (102-parts[i].life)/2;
|
parts[i].life -= (102-parts[i].life)/2;
|
||||||
kill_part(pmap[ny+y][nx+x]>>8);
|
kill_part(pmap[ny+y][nx+x]>>8);
|
||||||
}
|
}
|
||||||
if(bmap[(ny+y)/CELL][(nx+x)/CELL]==4)
|
if(bmap[(ny+y)/CELL][(nx+x)/CELL]==7)
|
||||||
player[2] = SPC_AIR;
|
player[2] = SPC_AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1935,6 +1940,7 @@ player[23] = 1;
|
|||||||
if(5>=rand()%8)
|
if(5>=rand()%8)
|
||||||
{
|
{
|
||||||
create_part(-1, x+nx, y+ny , PT_DUST);
|
create_part(-1, x+nx, y+ny , PT_DUST);
|
||||||
|
pv[y/CELL][x/CELL] += 2.00f*CFDS;
|
||||||
a= pmap[y+ny][x+nx];
|
a= pmap[y+ny][x+nx];
|
||||||
if(parts[a>>8].type==PT_DUST)
|
if(parts[a>>8].type==PT_DUST)
|
||||||
{
|
{
|
||||||
@@ -2427,18 +2433,18 @@ void update_particles(pixel *vid)
|
|||||||
{
|
{
|
||||||
for(x=0; x<XRES/CELL; x++)
|
for(x=0; x<XRES/CELL; x++)
|
||||||
{
|
{
|
||||||
if(bmap[y][x]==1)
|
if(bmap[y][x]==11)
|
||||||
for(j=0; j<CELL; j++)
|
for(j=0; j<CELL; j++)
|
||||||
for(i=0; i<CELL; i++)
|
for(i=0; i<CELL; i++)
|
||||||
{
|
{
|
||||||
pmap[y*CELL+j][x*CELL+i] = 0x7FFFFFFF;
|
pmap[y*CELL+j][x*CELL+i] = 0x7FFFFFFF;
|
||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==2)
|
if(bmap[y][x]==9)
|
||||||
for(j=0; j<CELL; j+=2)
|
for(j=0; j<CELL; j+=2)
|
||||||
for(i=(j>>1)&1; i<CELL; i+=2)
|
for(i=(j>>1)&1; i<CELL; i+=2)
|
||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
||||||
if(bmap[y][x]==3)
|
if(bmap[y][x]==8)
|
||||||
{
|
{
|
||||||
for(j=0; j<CELL; j++)
|
for(j=0; j<CELL; j++)
|
||||||
for(i=0; i<CELL; i++)
|
for(i=0; i<CELL; i++)
|
||||||
@@ -2458,11 +2464,11 @@ void update_particles(pixel *vid)
|
|||||||
fire_b[y][x] = cb;
|
fire_b[y][x] = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==4)
|
if(bmap[y][x]==7)
|
||||||
for(j=0; j<CELL; j+=2)
|
for(j=0; j<CELL; j+=2)
|
||||||
for(i=(j>>1)&1; i<CELL; i+=2)
|
for(i=(j>>1)&1; i<CELL; i+=2)
|
||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x8080FF);
|
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x8080FF);
|
||||||
if(bmap[y][x]==6)
|
if(bmap[y][x]==4)
|
||||||
{
|
{
|
||||||
for(j=0; j<CELL; j+=2)
|
for(j=0; j<CELL; j+=2)
|
||||||
for(i=(j>>1)&1; i<CELL; i+=2)
|
for(i=(j>>1)&1; i<CELL; i+=2)
|
||||||
@@ -2483,7 +2489,7 @@ void update_particles(pixel *vid)
|
|||||||
fire_b[y][x] = cb;
|
fire_b[y][x] = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==7)
|
if(bmap[y][x]==3)
|
||||||
{
|
{
|
||||||
if(emap[y][x])
|
if(emap[y][x])
|
||||||
{
|
{
|
||||||
@@ -2513,7 +2519,7 @@ void update_particles(pixel *vid)
|
|||||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x808080);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==8)
|
if(bmap[y][x]==2)
|
||||||
{
|
{
|
||||||
for(j=0; j<CELL; j++)
|
for(j=0; j<CELL; j++)
|
||||||
for(i=0; i<CELL; i++)
|
for(i=0; i<CELL; i++)
|
||||||
@@ -2538,7 +2544,7 @@ void update_particles(pixel *vid)
|
|||||||
fire_b[y][x] = cb;
|
fire_b[y][x] = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==11)
|
if(bmap[y][x]==14)
|
||||||
{
|
{
|
||||||
for(j=0; j<CELL; j++)
|
for(j=0; j<CELL; j++)
|
||||||
for(i=0; i<CELL; i++)
|
for(i=0; i<CELL; i++)
|
||||||
@@ -2562,7 +2568,7 @@ void update_particles(pixel *vid)
|
|||||||
fire_b[y][x] = cb;
|
fire_b[y][x] = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==9)
|
if(bmap[y][x]==12)
|
||||||
{
|
{
|
||||||
for(j=0; j<CELL; j+=2)
|
for(j=0; j<CELL; j+=2)
|
||||||
{
|
{
|
||||||
@@ -2572,7 +2578,7 @@ void update_particles(pixel *vid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==13)
|
if(bmap[y][x]==20)
|
||||||
{
|
{
|
||||||
for(j=0; j<CELL; j+=2)
|
for(j=0; j<CELL; j+=2)
|
||||||
{
|
{
|
||||||
@@ -2582,7 +2588,7 @@ void update_particles(pixel *vid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==10)
|
if(bmap[y][x]==13)
|
||||||
{
|
{
|
||||||
for(j=0; j<CELL; j+=2)
|
for(j=0; j<CELL; j+=2)
|
||||||
{
|
{
|
||||||
@@ -2592,7 +2598,7 @@ void update_particles(pixel *vid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bmap[y][x]==12)
|
if(bmap[y][x]==15)
|
||||||
{
|
{
|
||||||
if(emap[y][x])
|
if(emap[y][x])
|
||||||
{
|
{
|
||||||
@@ -2774,8 +2780,8 @@ int flood_parts(int x, int y, int c, int cm, int bm)
|
|||||||
|
|
||||||
int create_parts(int x, int y, int r, int c)
|
int create_parts(int x, int y, int r, int c)
|
||||||
{
|
{
|
||||||
int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n;
|
int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0, q=0; //n;
|
||||||
|
|
||||||
if(c == 125)
|
if(c == 125)
|
||||||
{
|
{
|
||||||
i = x / CELL;
|
i = x / CELL;
|
||||||
@@ -2790,76 +2796,110 @@ int create_parts(int x, int y, int r, int c)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//LOLOLOLOLLOLOLOLO
|
//LOLOLOLOLLOLOLOLO
|
||||||
if(c == 127)
|
if(c == 122)
|
||||||
{
|
|
||||||
b = 4;
|
|
||||||
dw = 1;
|
|
||||||
}
|
|
||||||
if(c == 122)
|
|
||||||
{
|
|
||||||
b = 8;
|
|
||||||
dw = 1;
|
|
||||||
}
|
|
||||||
if(c == 123)
|
|
||||||
{
|
|
||||||
b = 7;
|
|
||||||
dw = 1;
|
|
||||||
}
|
|
||||||
if(c == 124)
|
|
||||||
{
|
|
||||||
b = 6;
|
|
||||||
dw = 1;
|
|
||||||
}
|
|
||||||
if(c == 128)
|
|
||||||
{
|
|
||||||
b = 3;
|
|
||||||
dw = 1;
|
|
||||||
}
|
|
||||||
if(c == 129)
|
|
||||||
{
|
{
|
||||||
b = 2;
|
b = 2;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
if(c == 130)
|
if(c == 123)
|
||||||
{
|
{
|
||||||
b = 0;
|
b = 3;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
if(c == 131)
|
if(c == 124)
|
||||||
{
|
{
|
||||||
b = 1;
|
b = 4;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
if(c == 132)
|
if(c == 127)
|
||||||
|
{
|
||||||
|
b = 7;
|
||||||
|
dw = 1;
|
||||||
|
}
|
||||||
|
if(c == 128)
|
||||||
|
{
|
||||||
|
b = 8;
|
||||||
|
dw = 1;
|
||||||
|
}
|
||||||
|
if(c == 129)
|
||||||
{
|
{
|
||||||
b = 9;
|
b = 9;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
if(c == 133)
|
if(c == 131)
|
||||||
{
|
|
||||||
b = 10;
|
|
||||||
dw = 1;
|
|
||||||
}
|
|
||||||
if(c == 134)
|
|
||||||
{
|
{
|
||||||
b = 11;
|
b = 11;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
if(c == 135)
|
if(c == 132)
|
||||||
{
|
{
|
||||||
b = 12;
|
b = 12;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
if(c == 140)
|
if(c == 133)
|
||||||
{
|
{
|
||||||
b = 13;
|
b = 13;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
|
if(c == 134)
|
||||||
|
{
|
||||||
|
b = 14;
|
||||||
|
dw = 1;
|
||||||
|
}
|
||||||
|
if(c == 135)
|
||||||
|
{
|
||||||
|
b = 15;
|
||||||
|
dw = 1;
|
||||||
|
}
|
||||||
|
if(c == 140)
|
||||||
|
{
|
||||||
|
b = 20;
|
||||||
|
dw = 1;
|
||||||
|
}
|
||||||
if(c == 255)
|
if(c == 255)
|
||||||
{
|
{
|
||||||
b = 255;
|
b = 255;
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
|
if(c==130)
|
||||||
|
{
|
||||||
|
if(PSR!=130&&(PSR>121&&PSR<141))
|
||||||
|
{
|
||||||
|
r = r/CELL;
|
||||||
|
x = x/CELL;
|
||||||
|
y = y/CELL;
|
||||||
|
x -= r/2;
|
||||||
|
y -= r/2;
|
||||||
|
for (ox=x; ox<=x+r; ox++)
|
||||||
|
{
|
||||||
|
for (oy=y; oy<=y+r; oy++)
|
||||||
|
{
|
||||||
|
if(ox>=0&&ox<XRES/CELL&&oy>=0&&oy<YRES/CELL)
|
||||||
|
{
|
||||||
|
i = ox;
|
||||||
|
j = oy;
|
||||||
|
for(q=122;q<141;q++)
|
||||||
|
{
|
||||||
|
if(bmap[j][i]==q-120)
|
||||||
|
{
|
||||||
|
if(q==PSR)
|
||||||
|
{
|
||||||
|
bmap[j][i]=0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b=0;
|
||||||
|
dw=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(dw==1)
|
if(dw==1)
|
||||||
{
|
{
|
||||||
r = r/CELL;
|
r = r/CELL;
|
||||||
@@ -2880,12 +2920,13 @@ int create_parts(int x, int y, int r, int c)
|
|||||||
fvx[j][i] = 0.0f;
|
fvx[j][i] = 0.0f;
|
||||||
fvy[j][i] = 0.0f;
|
fvy[j][i] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bmap[j][i] = b;
|
bmap[j][i] = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM)
|
if(c == SPC_AIR || c == SPC_HEAT || c == SPC_COOL || c == SPC_VACUUM)
|
||||||
{
|
{
|
||||||
for(j=-r; j<=r; j++)
|
for(j=-r; j<=r; j++)
|
||||||
|
Reference in New Issue
Block a user