summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-11-30 19:43:42 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-11-30 19:43:42 (GMT)
commit491016eaf4b5f3065c43c0a142a0a0ebc2c3de63 (patch)
treec037a08df7314ead03baabd3b458de903280406f /src
parentbb16ffa2bbef12d8a8b1c151b3d987e272420675 (diff)
downloadpowder-491016eaf4b5f3065c43c0a142a0a0ebc2c3de63.zip
powder-491016eaf4b5f3065c43c0a142a0a0ebc2c3de63.tar.gz
Fixed love crash on mac, added adjustable grid mode, hit 'g', goes up to 9.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c11
-rw-r--r--src/main.c4
-rw-r--r--src/powder.c14
3 files changed, 24 insertions, 5 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 81bc756..30c807a 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1304,6 +1304,17 @@ void draw_parts(pixel *vid)
int cr, cg, cb;
float fr, fg, fb;
float pt = R_TEMP;
+ if(GRID_MODE)
+ {
+ for(ny=0;ny<YRES;ny++)
+ for(nx=0;nx<XRES;nx++)
+ {
+ if(ny%(4*GRID_MODE)==0)
+ blendpixel(vid, nx, ny, 100, 100, 100, 80);
+ if(nx%(4*GRID_MODE)==0)
+ blendpixel(vid, nx, ny, 100, 100, 100, 80);
+ }
+ }
for(i = 0; i<NPART; i++) {
#ifdef OpenGL
if(cmode == CM_FANCY) //If fancy mode
diff --git a/src/main.c b/src/main.c
index ebb39ba..41f4945 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1393,6 +1393,8 @@ int main(int argc, char *argv[])
}
if(sdl_key==SDLK_INSERT)
REPLACE_MODE = !REPLACE_MODE;
+ if(sdl_key=='g')
+ GRID_MODE = (GRID_MODE+1)%10;
if(sdl_key==SDLK_SPACE)
sys_pause = !sys_pause;
if(sdl_key=='h')
@@ -2165,6 +2167,8 @@ int main(int argc, char *argv[])
sprintf(uitext, "Cracker's V%d FPS:%d Parts:%d REPLACE MODE", SAVE_VERSION, FPS,NUM_PARTS);
else if(sdl_mod&(KMOD_CAPS))
sprintf(uitext, "Cracker's V%d FPS:%d Parts:%d CAPS LOCK ON", SAVE_VERSION, FPS, NUM_PARTS);
+ else if(GRID_MODE)
+ sprintf(uitext, "Cracker's V%d FPS:%d Parts:%d Grid:%d", SAVE_VERSION, FPS, NUM_PARTS,GRID_MODE);
else
sprintf(uitext, "Cracker's V%d FPS:%d Parts:%d", SAVE_VERSION, FPS, NUM_PARTS);
//printf("%s\n", uitext);
diff --git a/src/powder.c b/src/powder.c
index 32dc3a9..43ef467 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -922,25 +922,27 @@ void update_particles_i(pixel *vid, int start, int inc)
if(ISLOVE==1)
{
ISLOVE = 0;
- for(ny=4;ny<YRES-4;ny++)
+ for(ny=0;ny<YRES-4;ny++)
{
- for(nx=4;nx<XRES-4;nx++)
+ for(nx=0;nx<XRES-4;nx++)
{
r=pmap[ny][nx];
if((r>>8)>=NPART || !r)
{
continue;
}
- if(parts[r>>8].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;
}
}
}
- for(nx=0;nx<=XRES-4;nx++)
+ for(nx=9;nx<=XRES-18;nx++)
{
- for(ny=0;ny<=YRES-4;ny++)
+ for(ny=9;ny<=YRES-7;ny++)
{
if(love[nx/9][ny/9]==1)
{
@@ -956,6 +958,8 @@ void update_particles_i(pixel *vid, int start, int inc)
}
if(!rt&&loverule[nnx][nny]==1)
create_part(-1,nx+nnx,ny+nny,PT_LOVE);
+ else if(!rt)
+ continue;
else if(parts[rt>>8].type==PT_LOVE&&loverule[nnx][nny]==0)
parts[rt>>8].type=PT_NONE;