mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 04:22:34 +02:00
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@ SOURCES := src/*.c
|
||||
|
||||
CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
|
||||
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
|
||||
LFLAGS := -lSDL -lm -lbz2
|
||||
LFLAGS := -B static -lSDL -lm -lbz2
|
||||
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
|
||||
MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2
|
||||
MFLAGS_SSE := -march=native -DX86 -DX86_SSE
|
||||
|
0
includes/font.h
Normal file → Executable file
0
includes/font.h
Normal file → Executable file
39
src/powder.c
39
src/powder.c
@@ -283,10 +283,7 @@ static int is_boundary(int pt, int x, int y)
|
||||
{
|
||||
if(!is_blocking(pt,x,y))
|
||||
return 0;
|
||||
if(is_blocking(pt,x,y-1)
|
||||
&& is_blocking(pt,x,y+1)
|
||||
&& is_blocking(pt,x-1,y)
|
||||
&& is_blocking(pt,x+1,y))
|
||||
if(is_blocking(pt,x,y-1) && is_blocking(pt,x,y+1) && is_blocking(pt,x-1,y) && is_blocking(pt,x+1,y))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -394,8 +391,7 @@ void kill_part(int i)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if(parts[i].type != PT_PHOT)
|
||||
{
|
||||
if(parts[i].type != PT_PHOT) {
|
||||
x = (int)(parts[i].x+0.5f);
|
||||
y = (int)(parts[i].y+0.5f);
|
||||
if(parts[i].type == PT_STKM)
|
||||
@@ -403,20 +399,20 @@ void kill_part(int i)
|
||||
death = 1;
|
||||
isplayer = 0;
|
||||
}
|
||||
else if(parts[i].type == PT_STKM2)
|
||||
if(parts[i].type == PT_STKM2)
|
||||
{
|
||||
death2 = 1;
|
||||
isplayer2 = 0;
|
||||
}
|
||||
else if(parts[i].type == PT_SPAWN)
|
||||
if(parts[i].type == PT_SPAWN)
|
||||
{
|
||||
ISSPAWN1 = 0;
|
||||
}
|
||||
else if(parts[i].type == PT_SPAWN2)
|
||||
if(parts[i].type == PT_SPAWN2)
|
||||
{
|
||||
ISSPAWN2 = 0;
|
||||
}
|
||||
else if(x>=0 && y>=0 && x<XRES && y<YRES)
|
||||
if(x>=0 && y>=0 && x<XRES && y<YRES)
|
||||
pmap[y][x] = 0;
|
||||
}
|
||||
|
||||
@@ -463,27 +459,28 @@ inline int create_part(int p, int x, int y, int t)
|
||||
}
|
||||
if(t==SPC_AIR)
|
||||
{
|
||||
if(y + CELL < YRES && x + CELL < XRES)
|
||||
pv[y/CELL][x/CELL] += 0.03f;
|
||||
/* if(x+CELL<XRES)
|
||||
if(y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL] += 0.03f;
|
||||
if(x+CELL<XRES)
|
||||
{
|
||||
pv[y/CELL][x/CELL+1] += 0.03f;
|
||||
if(y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL+1] += 0.03f;
|
||||
}*/
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if(t==SPC_VACUUM)
|
||||
{
|
||||
if (y + CELL < YRES && x + CELL < XRES)
|
||||
pv[y/CELL][x/CELL] -= 0.03f;
|
||||
/*if(y+CELL<YRES)
|
||||
if(y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL] -= 0.03f;
|
||||
if(x+CELL<XRES)
|
||||
{
|
||||
pv[y/CELL][x/CELL+1] -= 0.03f;
|
||||
if(y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL+1] -= 0.03f;
|
||||
}*/
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1123,17 +1120,23 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
{
|
||||
ISLOLZ = 0;
|
||||
for(ny=0;ny<YRES-4;ny++)
|
||||
{
|
||||
for(nx=0;nx<XRES-4;nx++)
|
||||
{
|
||||
r=pmap[ny][nx];
|
||||
if((r>>8)>=NPART || !r)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for(nx=9;nx<=XRES-18;nx++)
|
||||
{
|
||||
for(ny=9;ny<=YRES-7;ny++)
|
||||
@@ -1142,11 +1145,14 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
{
|
||||
for( nnx=0;nnx<9;nnx++)
|
||||
for( nny=0;nny<9;nny++)
|
||||
{
|
||||
if(ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
|
||||
{
|
||||
rt=pmap[ny+nny][nx+nnx];
|
||||
if((rt>>8)>=NPART)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(!rt&&lolzrule[nny][nnx]==1)
|
||||
create_part(-1,nx+nnx,ny+nny,PT_LOLZ);
|
||||
else if(!rt)
|
||||
@@ -1156,6 +1162,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
lolz[nx/9][ny/9]=0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user