summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-29 14:44:12 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-29 14:44:12 (GMT)
commit25b95e211e5c38e29798bfb6be9c5656d9a408d7 (patch)
treeb8e275239da97b546612ee6dedb487a4a0092197 /src
parent761ea03882fd779cc77ac7cb49ff59bbfe94b51e (diff)
downloadpowder-25b95e211e5c38e29798bfb6be9c5656d9a408d7.zip
powder-25b95e211e5c38e29798bfb6be9c5656d9a408d7.tar.gz
new display, Life, shows life in a grayscale gradient, will ONLY show up in debug mode, on shift-1, fix filt floodfill, portal has bigger storage, other fixes.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c34
-rw-r--r--src/interface.c8
-rw-r--r--src/main.c36
-rw-r--r--src/powder.c5
4 files changed, 74 insertions, 9 deletions
diff --git a/src/graphics.c b/src/graphics.c
index a2e73e6..a22cf58 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1478,6 +1478,31 @@ void draw_parts(pixel *vid)
cb = 0;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
+ else if(cmode==CM_LIFE)
+ {
+ float frequency = 0.4;
+ int q;
+ if(!(parts[i].life<5))
+ q = sqrt(parts[i].life);
+ else
+ q = parts[i].life;
+ cr = sin(frequency*q) * 100 + 128;
+ cg = sin(frequency*q) * 100 + 128;
+ cb = sin(frequency*q) * 100 + 128;
+ if(cr>=255)
+ cr = 255;
+ if(cg>=255)
+ cg = 255;
+ if(cb>=255)
+ cb = 255;
+ if(cr<=0)
+ cr = 0;
+ if(cg<=0)
+ cg = 0;
+ if(cb<=0)
+ cb = 0;
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ }
else if(t==PT_MWAX&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
@@ -2400,7 +2425,8 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32);
}
}
- else if(t==PT_BOMB){
+ else if(t==PT_BOMB)
+ {
if(parts[i].tmp==0){
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);
@@ -2425,6 +2451,8 @@ void draw_parts(pixel *vid)
addpixel(vid, nx, ny-newx, cr, cg, cb, gradv);
gradv = gradv/1.1f;
}
+ } else {
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
}
else if(parts[i].tmp==1){
@@ -2442,6 +2470,8 @@ void draw_parts(pixel *vid)
addpixel(vid, nx, ny-newx, cr, cg, cb, gradv);
gradv = gradv/1.5f;
}
+ } else {
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
}
else {
@@ -3318,7 +3348,7 @@ void sdl_open(void)
SDL_WM_SetCaption("The Powder Toy", "Powder Toy");
sdl_seticon();
SDL_EnableUNICODE(1);
- //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
}
#ifdef OpenGL
diff --git a/src/interface.c b/src/interface.c
index f58b2a4..fef6445 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -562,6 +562,9 @@ void draw_svf_ui(pixel *vid_buf)
case CM_GRAD:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD3", 255, 50, 255, 255);
break;
+ case CM_LIFE:
+ drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 255, 50, 255, 255);
+ break;
}
drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
@@ -1857,6 +1860,11 @@ void set_cmode(int cm)
strcpy(itc_msg, "Alternate Velocity Display");
else if(cmode==CM_GRAD)
strcpy(itc_msg, "Heat Gradient Display");
+ else if(cmode==CM_LIFE)
+ if(DEBUG_MODE)
+ strcpy(itc_msg, "Life Display");
+ else
+ set_cmode(CM_CRACK);
else
strcpy(itc_msg, "Velocity Display");
}
diff --git a/src/main.c b/src/main.c
index 050469d..42a3d75 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1357,7 +1357,7 @@ int main(int argc, char *argv[])
free(load_data);
}
}
- if(sdl_key=='s' && (sdl_mod & (KMOD_CTRL)))
+ if(sdl_key=='s' && (sdl_mod & (KMOD_CTRL)) || (sdl_key=='s' && !player2))
{
if(it > 50)
it = 50;
@@ -1403,6 +1403,10 @@ int main(int argc, char *argv[])
{
set_cmode(CM_CRACK);
}
+ if(sdl_key=='1'&& (sdl_mod & (KMOD_SHIFT)) && DEBUG_MODE)
+ {
+ set_cmode(CM_LIFE);
+ }
if(sdl_key==SDLK_TAB)
{
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
@@ -1487,7 +1491,7 @@ int main(int argc, char *argv[])
bsy = 0;
}
}
- if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)))
+ if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)) || (sdl_key=='d' && !player2))
DEBUG_MODE = !DEBUG_MODE;
if(sdl_key=='i')
{
@@ -1586,10 +1590,32 @@ int main(int argc, char *argv[])
}
}
#ifdef INTERNAL
+ int counterthing;
if(sdl_key=='v')
- vs = !vs;
+ {
+ if(sdl_mod & (KMOD_SHIFT)){
+ if(vs>=1)
+ vs = 0;
+ else
+ vs = 2;
+ }
+ else{
+ if(vs>=1)
+ vs = 0;
+ else
+ vs = 1;
+ }
+ counterthing = 0;
+ }
if(vs)
- dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
+ {
+ if(counterthing+1>=vs)
+ {
+ dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
+ counterthing = 0;
+ }
+ counterthing = (counterthing+1)%3;
+ }
#endif
if(sdl_wheel)
@@ -2122,7 +2148,7 @@ int main(int argc, char *argv[])
{
if(sdl_mod & (KMOD_CAPS))
c = 0;
- if(c!=WL_STREAM&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE)
+ if(c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE)
flood_parts(x, y, c, -1, -1);
lx = x;
ly = y;
diff --git a/src/powder.c b/src/powder.c
index 2c7944e..8e7a4ea 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -986,6 +986,7 @@ inline int parts_avg(int ci, int ni,int t)
else
return PT_NONE;
}
+ return PT_NONE;
}
@@ -3165,7 +3166,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if((r>>8)>=NPART || !r)
continue;
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<8;nnx++)
+ for( nnx=0;nnx<80;nnx++)
if(!portal[parts[i].tmp][count-1][nnx])
{
portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
@@ -3196,7 +3197,7 @@ void update_particles_i(pixel *vid, int start, int inc)
continue;
if(!r)
{
- for( nnx =0 ;nnx<8;nnx++)
+ for( nnx =0 ;nnx<80;nnx++)
{
int randomness = count + rand()%3-1;
if(randomness<1)