summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2010-12-29 21:15:40 (GMT)
committer Simon <simon@hardwired.org.uk>2010-12-29 21:15:40 (GMT)
commit3715925dd95c7433c4bfd3078089bcf05a16f813 (patch)
tree6e7c1ac2757738343f748fd51d4ab3ad5dcca3a9 /src
parent713034ed619378aa0abc6b38b69604e1aba8821c (diff)
parent5766f9aa7ee0f78adea5799322dce67506d9247d (diff)
downloadpowder-3715925dd95c7433c4bfd3078089bcf05a16f813.zip
powder-3715925dd95c7433c4bfd3078089bcf05a16f813.tar.gz
Merge branch 'master' of git://github.com/cracker64/The-Powder-Toy
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c27
-rw-r--r--src/interface.c8
-rw-r--r--src/main.c36
-rw-r--r--src/powder.c5
4 files changed, 68 insertions, 8 deletions
diff --git a/src/graphics.c b/src/graphics.c
index c68835a..7095af8 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++)
@@ -3323,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 8a0a1be..8f5735b 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' && !isplayer2))
{
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' && !isplayer2))
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 8b76216..ccea3ed 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)