Better photons for persistent display, ability to toggle gravity view (ctrl+g)

This commit is contained in:
Simon Robertshaw 2011-06-27 14:01:07 +01:00
parent 43b75ea058
commit 36ee81fc6b
5 changed files with 42 additions and 15 deletions

View File

@ -176,6 +176,8 @@ extern int zoom_en;
extern int zoom_x, zoom_y;
extern int zoom_wx, zoom_wy;
extern int drawgrav_enable;
void menu_count(void);
void get_sign_pos(int i, int *x0, int *y0, int *w, int *h);

View File

@ -2587,6 +2587,16 @@ void draw_parts(pixel *vid)
cr = cr>255?255:cr;
cg = cg>255?255:cg;
cb = cb>255?255:cb;
if(cmode == CM_PERS){
if(parts[i].pavg[0] && parts[i].pavg[1])
{
draw_line(vid, nx, ny, parts[i].pavg[0], parts[i].pavg[1], cr, cg, cb, XRES+BARSIZE);
}
else
{
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr, cg, cb);
}
} else {
blendpixel(vid, nx, ny, cr, cg, cb, 192);
blendpixel(vid, nx+1, ny, cr, cg, cb, 96);
blendpixel(vid, nx-1, ny, cr, cg, cb, 96);
@ -2598,6 +2608,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32);
}
}
}
//Life can be 11 too, so don't just check for 10
else if (t==PT_SWCH && parts[i].life >= 10)
{

View File

@ -78,6 +78,8 @@ int zoom_wx=0, zoom_wy=0;
unsigned char ZFACTOR = 256/ZSIZE_D;
unsigned char ZSIZE = ZSIZE_D;
int drawgrav_enable = 0;
void menu_count(void)//puts the number of elements in each section into .itemcount
{
int i=0;

View File

@ -1804,7 +1804,7 @@ int main(int argc, char *argv[])
if (bsy<0)
bsy = 0;
if(ngrav_enable)
if(ngrav_enable && drawgrav_enable)
draw_grav(vid_buf);
draw_walls(vid_buf);
update_particles(vid_buf); //update everything
@ -2223,12 +2223,19 @@ int main(int argc, char *argv[])
}
}
if (sdl_key=='g')
{
if(sdl_mod & (KMOD_CTRL))
{
drawgrav_enable =! drawgrav_enable;
}
else
{
if (sdl_mod & (KMOD_SHIFT))
GRID_MODE = (GRID_MODE+9)%10;
else
GRID_MODE = (GRID_MODE+1)%10;
}
}
if (sdl_key=='m')
{
if(sl!=sr)

View File

@ -769,10 +769,15 @@ inline int create_part(int p, int x, int y, int t)//the function for creating a
{
parts[i].pavg[1] = pv[y/CELL][x/CELL];
}
if (t==PT_QRTZ)
else if (t==PT_QRTZ)
{
parts[i].pavg[1] = pv[y/CELL][x/CELL];
}
else
{
parts[i].pavg[0] = 0.0f;
parts[i].pavg[1] = 0.0f;
}
if (t!=PT_STKM&&t!=PT_STKM2)//set everything to default values first, except for stickman.
{
parts[i].x = (float)x;