Add access to the local saving features

This commit is contained in:
Simon Robertshaw 2011-06-14 15:13:27 +01:00
parent 14abcf5fc2
commit 2dd04b917d
3 changed files with 87 additions and 43 deletions

View File

@ -197,7 +197,7 @@ void ui_richtext_settext(char *text, ui_richtext *ed);
void ui_richtext_process(int mx, int my, int mb, int mbq, ui_richtext *ed);
void draw_svf_ui(pixel *vid_buf);
void draw_svf_ui(pixel *vid_buf, int alternate);
void error_ui(pixel *vid_buf, int err, char *txt);

View File

@ -617,13 +617,19 @@ void ui_richtext_process(int mx, int my, int mb, int mbq, ui_richtext *ed)
}
}
void draw_svf_ui(pixel *vid_buf)// all the buttons at the bottom
void draw_svf_ui(pixel *vid_buf, int alternate)// all the buttons at the bottom
{
int c;
//the open browser button
if(alternate)
{
fillrect(vid_buf, 0, YRES+(MENUSIZE-16)-1, 18, 16, 255, 255, 255, 255);
drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 0, 0, 0, 255);
} else {
drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255);
drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255);
}
// the reload button
c = svf_open ? 255 : 128;
@ -631,6 +637,12 @@ void draw_svf_ui(pixel *vid_buf)// all the buttons at the bottom
drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255);
// the save sim button
if(alternate)
{
fillrect(vid_buf, 36, YRES+(MENUSIZE-16)-1, 152, 16, 255, 255, 255, 255);
drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", 0, 0, 0, 255);
drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[save to disk]", 0, 0, 0, 255);
} else {
c = svf_login ? 255 : 128;
drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255);
if (svf_open)
@ -640,6 +652,7 @@ void draw_svf_ui(pixel *vid_buf)// all the buttons at the bottom
drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255);
if (svf_open && svf_own)
drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255);
}
c = (svf_login && svf_open) ? 255 : 128;
@ -700,7 +713,7 @@ void draw_svf_ui(pixel *vid_buf)// all the buttons at the bottom
}
else*/
{
drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); //TODO: More suitable icon
drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xCF", 255, 255, 255, 255);
drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
}

View File

@ -1851,7 +1851,7 @@ int main(int argc, char *argv[])
memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE);//clear menu areas
clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES);
draw_svf_ui(vid_buf);
draw_svf_ui(vid_buf, sdl_mod & (KMOD_LCTRL|KMOD_RCTRL));
if (http_ver_check)
{
@ -2663,7 +2663,15 @@ int main(int argc, char *argv[])
if (da < 51)
da ++;
}
else if (x>=37*sdl_scale && x<=187*sdl_scale && svf_login)
else if (x>=37*sdl_scale && x<=187*sdl_scale)
{
if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
{
db = 277;
if (da < 51)
da ++;
}
else if(svf_login)
{
db = 259;
if (svf_open && svf_own && x<=55*sdl_scale)
@ -2671,6 +2679,7 @@ int main(int argc, char *argv[])
if (da < 51)
da ++;
}
}
else if (x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale))
{
db = svf_login ? 261 : 260;
@ -2687,6 +2696,9 @@ int main(int argc, char *argv[])
}
else if (x>=sdl_scale && x<=17*sdl_scale)
{
if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
db = 276;
else
db = 262;
if (da < 51)
da ++;
@ -2879,6 +2891,18 @@ int main(int argc, char *argv[])
http_session_check = NULL;
}
}
if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
{
if (x>=37 && x<=187)
{
save_filename_ui(vid_buf);
}
if (x>=1 && x<=17)
{
catalogue_ui(vid_buf);
}
} else {
if (x>=37 && x<=187 && svf_login)
{
if (!svf_open || !svf_own || x>51)
@ -2906,6 +2930,7 @@ int main(int argc, char *argv[])
memset(fire_g, 0, sizeof(fire_g));
memset(fire_b, 0, sizeof(fire_b));
}
}
if (x>=19 && x<=35 && svf_last && svf_open && !bq) {
//int tpval = sys_pause;
parse_save(svf_last, svf_lsize, 1, 0, 0, bmap, fvx, fvy, signs, parts, pmap);
@ -3214,6 +3239,12 @@ int main(int argc, char *argv[])
case 275:
drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5);
break;
case 276:
drawtext(vid_buf, 16, YRES-24, "Open a simulation from your hard drive.", 255, 255, 255, da*5);
break;
case 277:
drawtext(vid_buf, 16, YRES-24, "Save the simulation to your hard drive.", 255, 255, 255, da*5);
break;
default:
drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5);
}