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.

This commit is contained in:
Cracker64 2010-12-29 09:44:12 -05:00
parent 761ea03882
commit 25b95e211e
5 changed files with 79 additions and 13 deletions

View File

@ -5,8 +5,9 @@
#include "defines.h"
#include "interface.h"
#define CM_COUNT 10
#define CM_CRACK 9
#define CM_COUNT 11
#define CM_CRACK 10
#define CM_LIFE 9
#define CM_GRAD 8
#define CM_NOTHING 7
#define CM_FANCY 6
@ -582,8 +583,8 @@ static int lolzrule[9][9] =
{0,1,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0},
};
int portal[MAX_TEMP/100][8][8];
float portaltemp[MAX_TEMP/100][8][8];
int portal[MAX_TEMP/100][8][80];
float portaltemp[MAX_TEMP/100][8][80];
int wireless[MAX_TEMP/100][2];
extern int isplayer;

View File

@ -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

View File

@ -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");
}

View File

@ -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;

View File

@ -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)