This commit is contained in:
Felix Wallin 2010-12-20 14:34:55 +01:00
parent cb6597f9e1
commit 14b4dfef87
8 changed files with 2580 additions and 2587 deletions

View File

@ -2,7 +2,7 @@ SOURCES := src/*.c
CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
LFLAGS := -B static -lSDL -lm -lbz2 LFLAGS := -lSDL -lm -lbz2
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2 MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2
MFLAGS_SSE := -march=native -DX86 -DX86_SSE MFLAGS_SSE := -march=native -DX86 -DX86_SSE

0
includes/font.h Executable file → Normal file
View File

View File

@ -283,7 +283,10 @@ static int is_boundary(int pt, int x, int y)
{ {
if(!is_blocking(pt,x,y)) if(!is_blocking(pt,x,y))
return 0; 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 0;
return 1; return 1;
} }
@ -391,7 +394,8 @@ void kill_part(int i)
{ {
int x, y; int x, y;
if(parts[i].type != PT_PHOT) { if(parts[i].type != PT_PHOT)
{
x = (int)(parts[i].x+0.5f); x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f); y = (int)(parts[i].y+0.5f);
if(parts[i].type == PT_STKM) if(parts[i].type == PT_STKM)
@ -399,20 +403,20 @@ void kill_part(int i)
death = 1; death = 1;
isplayer = 0; isplayer = 0;
} }
if(parts[i].type == PT_STKM2) else if(parts[i].type == PT_STKM2)
{ {
death2 = 1; death2 = 1;
isplayer2 = 0; isplayer2 = 0;
} }
if(parts[i].type == PT_SPAWN) else if(parts[i].type == PT_SPAWN)
{ {
ISSPAWN1 = 0; ISSPAWN1 = 0;
} }
if(parts[i].type == PT_SPAWN2) else if(parts[i].type == PT_SPAWN2)
{ {
ISSPAWN2 = 0; ISSPAWN2 = 0;
} }
if(x>=0 && y>=0 && x<XRES && y<YRES) else if(x>=0 && y>=0 && x<XRES && y<YRES)
pmap[y][x] = 0; pmap[y][x] = 0;
} }
@ -459,28 +463,27 @@ inline int create_part(int p, int x, int y, int t)
} }
if(t==SPC_AIR) if(t==SPC_AIR)
{ {
if(y + CELL < YRES && x + CELL < XRES)
pv[y/CELL][x/CELL] += 0.03f; pv[y/CELL][x/CELL] += 0.03f;
if(y+CELL<YRES) /* if(x+CELL<XRES)
pv[y/CELL+1][x/CELL] += 0.03f;
if(x+CELL<XRES)
{ {
pv[y/CELL][x/CELL+1] += 0.03f; pv[y/CELL][x/CELL+1] += 0.03f;
if(y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] += 0.03f; pv[y/CELL+1][x/CELL+1] += 0.03f;
} }*/
return -1; return -1;
} }
if(t==SPC_VACUUM) if(t==SPC_VACUUM)
{ {
if (y + CELL < YRES && x + CELL < XRES)
pv[y/CELL][x/CELL] -= 0.03f; pv[y/CELL][x/CELL] -= 0.03f;
if(y+CELL<YRES) /*if(y+CELL<YRES)
pv[y/CELL+1][x/CELL] -= 0.03f; pv[y/CELL+1][x/CELL] -= 0.03f;
if(x+CELL<XRES) if(x+CELL<XRES)
{ {
pv[y/CELL][x/CELL+1] -= 0.03f; pv[y/CELL][x/CELL+1] -= 0.03f;
if(y+CELL<YRES) if(y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] -= 0.03f; pv[y/CELL+1][x/CELL+1] -= 0.03f;
} }*/
return -1; return -1;
} }
@ -1120,23 +1123,17 @@ void update_particles_i(pixel *vid, int start, int inc)
{ {
ISLOLZ = 0; ISLOLZ = 0;
for(ny=0; ny<YRES-4; ny++) for(ny=0; ny<YRES-4; ny++)
{
for(nx=0; nx<XRES-4; nx++) for(nx=0; nx<XRES-4; nx++)
{ {
r=pmap[ny][nx]; r=pmap[ny][nx];
if((r>>8)>=NPART || !r) if((r>>8)>=NPART || !r)
{
continue; continue;
}
else if((ny<9||nx<9||ny>YRES-7||nx>XRES-10)&&parts[r>>8].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; parts[r>>8].type = PT_NONE;
else if(parts[r>>8].type==PT_LOLZ) else if(parts[r>>8].type==PT_LOLZ)
{
lolz[nx/9][ny/9] = 1; lolz[nx/9][ny/9] = 1;
}
} }
}
for(nx=9; nx<=XRES-18; nx++) for(nx=9; nx<=XRES-18; nx++)
{ {
for(ny=9; ny<=YRES-7; ny++) for(ny=9; ny<=YRES-7; ny++)
@ -1145,14 +1142,11 @@ void update_particles_i(pixel *vid, int start, int inc)
{ {
for( nnx=0; nnx<9; nnx++) for( nnx=0; nnx<9; nnx++)
for( nny=0; nny<9; nny++) for( nny=0; nny<9; nny++)
{
if(ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES) if(ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
{ {
rt=pmap[ny+nny][nx+nnx]; rt=pmap[ny+nny][nx+nnx];
if((rt>>8)>=NPART) if((rt>>8)>=NPART)
{
continue; continue;
}
if(!rt&&lolzrule[nny][nnx]==1) if(!rt&&lolzrule[nny][nnx]==1)
create_part(-1,nx+nnx,ny+nny,PT_LOLZ); create_part(-1,nx+nnx,ny+nny,PT_LOLZ);
else if(!rt) else if(!rt)
@ -1162,7 +1156,6 @@ void update_particles_i(pixel *vid, int start, int inc)
} }
} }
}
lolz[nx/9][ny/9]=0; lolz[nx/9][ny/9]=0;
} }
} }