Fix a few things in stamps browser

Incorrect number of stamps per page, pause button visible, and one page
too many when stamp_count is an integer multiple of per_page.

Using GRID_X/Y since those are the values used in the rest of stamp_ui
This commit is contained in:
jacksonmj 2011-11-12 04:55:20 +08:00 committed by Simon Robertshaw
parent 05fbb92420
commit 5b9faa39c0
2 changed files with 4 additions and 5 deletions

View File

@ -86,8 +86,6 @@ extern unsigned char ZSIZE;
#define CATALOGUE_S 6 #define CATALOGUE_S 6
#define CATALOGUE_Z 3 #define CATALOGUE_Z 3
#define STAMP_X 4
#define STAMP_Y 4
#define STAMP_MAX 240 #define STAMP_MAX 240
#define NGOL 25 #define NGOL 25

View File

@ -1429,9 +1429,10 @@ fail:
int stamp_ui(pixel *vid_buf) int stamp_ui(pixel *vid_buf)
{ {
int b=1,bq,mx,my,d=-1,i,j,k,x,gx,gy,y,w,h,r=-1,stamp_page=0,per_page=STAMP_X*STAMP_Y,page_count; int b=1,bq,mx,my,d=-1,i,j,k,x,gx,gy,y,w,h,r=-1,stamp_page=0,per_page=GRID_X*GRID_Y,page_count;
char page_info[64]; char page_info[64];
page_count = ceil((float)stamp_count/(float)per_page); // stamp_count-1 to avoid an extra page when there are per_page stamps on each page
page_count = (stamp_count-1)/per_page+1;
while (!sdl_poll()) while (!sdl_poll())
{ {
@ -1447,7 +1448,7 @@ int stamp_ui(pixel *vid_buf)
mx /= sdl_scale; mx /= sdl_scale;
my /= sdl_scale; my /= sdl_scale;
clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); clearrect(vid_buf, -1, -1, XRES+BARSIZE+1, YRES+MENUSIZE+1);
k = stamp_page*per_page;//0; k = stamp_page*per_page;//0;
r = -1; r = -1;
d = -1; d = -1;