Merge branch 'master' of git://github.com/cracker64/The-Powder-Toy

This commit is contained in:
Simon 2010-12-29 21:15:40 +00:00
commit 3715925dd9
5 changed files with 73 additions and 12 deletions

View File

@ -5,8 +5,9 @@
#include "defines.h" #include "defines.h"
#include "interface.h" #include "interface.h"
#define CM_COUNT 10 #define CM_COUNT 11
#define CM_CRACK 9 #define CM_CRACK 10
#define CM_LIFE 9
#define CM_GRAD 8 #define CM_GRAD 8
#define CM_NOTHING 7 #define CM_NOTHING 7
#define CM_FANCY 6 #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},
{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]; int portal[MAX_TEMP/100][8][80];
float portaltemp[MAX_TEMP/100][8][8]; float portaltemp[MAX_TEMP/100][8][80];
int wireless[MAX_TEMP/100][2]; int wireless[MAX_TEMP/100][2];
extern int isplayer; extern int isplayer;

View File

@ -1478,6 +1478,31 @@ void draw_parts(pixel *vid)
cb = 0; cb = 0;
blendpixel(vid, nx, ny, cr, cg, cb, 255); 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) else if(t==PT_MWAX&&cmode == CM_FANCY)
{ {
for(x=-1; x<=1; x++) for(x=-1; x<=1; x++)
@ -3323,7 +3348,7 @@ void sdl_open(void)
SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); SDL_WM_SetCaption("The Powder Toy", "Powder Toy");
sdl_seticon(); sdl_seticon();
SDL_EnableUNICODE(1); 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 #ifdef OpenGL

View File

@ -562,6 +562,9 @@ void draw_svf_ui(pixel *vid_buf)
case CM_GRAD: case CM_GRAD:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD3", 255, 50, 255, 255); drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD3", 255, 50, 255, 255);
break; 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); 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"); strcpy(itc_msg, "Alternate Velocity Display");
else if(cmode==CM_GRAD) else if(cmode==CM_GRAD)
strcpy(itc_msg, "Heat Gradient Display"); 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 else
strcpy(itc_msg, "Velocity Display"); strcpy(itc_msg, "Velocity Display");
} }

View File

@ -1357,7 +1357,7 @@ int main(int argc, char *argv[])
free(load_data); free(load_data);
} }
} }
if(sdl_key=='s' && (sdl_mod & (KMOD_CTRL))) if(sdl_key=='s' && (sdl_mod & (KMOD_CTRL)) || (sdl_key=='s' && !isplayer2))
{ {
if(it > 50) if(it > 50)
it = 50; it = 50;
@ -1403,6 +1403,10 @@ int main(int argc, char *argv[])
{ {
set_cmode(CM_CRACK); set_cmode(CM_CRACK);
} }
if(sdl_key=='1'&& (sdl_mod & (KMOD_SHIFT)) && DEBUG_MODE)
{
set_cmode(CM_LIFE);
}
if(sdl_key==SDLK_TAB) if(sdl_key==SDLK_TAB)
{ {
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ; CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
@ -1487,7 +1491,7 @@ int main(int argc, char *argv[])
bsy = 0; bsy = 0;
} }
} }
if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL))) if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)) || (sdl_key=='d' && !isplayer2))
DEBUG_MODE = !DEBUG_MODE; DEBUG_MODE = !DEBUG_MODE;
if(sdl_key=='i') if(sdl_key=='i')
{ {
@ -1586,10 +1590,32 @@ int main(int argc, char *argv[])
} }
} }
#ifdef INTERNAL #ifdef INTERNAL
int counterthing;
if(sdl_key=='v') 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) if(vs)
{
if(counterthing+1>=vs)
{
dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
counterthing = 0;
}
counterthing = (counterthing+1)%3;
}
#endif #endif
if(sdl_wheel) if(sdl_wheel)
@ -2122,7 +2148,7 @@ int main(int argc, char *argv[])
{ {
if(sdl_mod & (KMOD_CAPS)) if(sdl_mod & (KMOD_CAPS))
c = 0; 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); flood_parts(x, y, c, -1, -1);
lx = x; lx = x;
ly = y; ly = y;

View File

@ -986,6 +986,7 @@ inline int parts_avg(int ci, int ni,int t)
else else
return PT_NONE; 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) if((r>>8)>=NPART || !r)
continue; 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))) 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]) if(!portal[parts[i].tmp][count-1][nnx])
{ {
portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type; 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; continue;
if(!r) if(!r)
{ {
for( nnx =0 ;nnx<8;nnx++) for( nnx =0 ;nnx<80;nnx++)
{ {
int randomness = count + rand()%3-1; int randomness = count + rand()%3-1;
if(randomness<1) if(randomness<1)