Cast LINE_SPACING to integer for menu Scrollbox usages - fixing scrolling issues with non-integer-scaled font sizes

This commit is contained in:
zicodxx 2008-10-29 11:50:15 +00:00
parent 8fcd6690e8
commit a23ee70d37
2 changed files with 7 additions and 6 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
2d/font.c, main/gamefont.c, main/gamefont.h, main/menu.c: Scale fonts by float values and filter them if texture filtering is on; Another fix for the code flow in change_res() as the check for minimal custom resolution always failed
main/collide.c: Yet another check for collide sounds as FixedStep is not necessarily true if the actual collision happens
main/newmenu.c: Cast LINE_SPACING to integer for menu Scrollbox usages - fixing scrolling issues with non-integer-scaled font sizes
20081028
--------

View file

@ -1059,7 +1059,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
if (ScrollOffset != 0) {
gr_get_string_size(UP_ARROW_MARKER, &arrow_width, &arrow_height, &aw);
x2 = grd_curcanv->cv_bitmap.bm_x + item[ScrollOffset].x-FSPACX(13);
y1 = grd_curcanv->cv_bitmap.bm_y + item[ScrollOffset].y-(LINE_SPACING*ScrollOffset);
y1 = grd_curcanv->cv_bitmap.bm_y + item[ScrollOffset].y-(((int)LINE_SPACING)*ScrollOffset);
x1 = x2 - arrow_width;
y2 = y1 + arrow_height;
if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2)) ) {
@ -1074,7 +1074,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
if (ScrollOffset+MaxDisplayable<nitems) {
gr_get_string_size(DOWN_ARROW_MARKER, &arrow_width, &arrow_height, &aw);
x2 = grd_curcanv->cv_bitmap.bm_x + item[ScrollOffset+MaxDisplayable-1].x-FSPACX(13);
y1 = grd_curcanv->cv_bitmap.bm_y + item[ScrollOffset+MaxDisplayable-1].y-(LINE_SPACING*ScrollOffset);
y1 = grd_curcanv->cv_bitmap.bm_y + item[ScrollOffset+MaxDisplayable-1].y-(((int)LINE_SPACING)*ScrollOffset);
x1 = x2 - arrow_width;
y2 = y1 + arrow_height;
if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2)) ) {
@ -1283,12 +1283,12 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
gr_set_current_canvas(menu_canvas);
for (i=ScrollOffset; i<MaxDisplayable+ScrollOffset; i++ )
{
item[i].y-=(LINE_SPACING*ScrollOffset);
item[i].y-=(((int)LINE_SPACING)*ScrollOffset);
draw_item( &item[i], (i==choice && !all_text),TinyMode );
#ifdef NEWMENU_MOUSE
newmenu_show_cursor();
#endif
item[i].y+=(LINE_SPACING*ScrollOffset);
item[i].y+=(((int)LINE_SPACING)*ScrollOffset);
if (i==choice && (item[i].type==NM_TYPE_INPUT || (item[i].type==NM_TYPE_INPUT_MENU && item[i].group)))
update_cursor( &item[i],ScrollOffset);
@ -1300,7 +1300,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
LastScrollCheck=ScrollOffset;
gr_set_curfont(MEDIUM2_FONT);
sy=item[ScrollOffset].y-(LINE_SPACING*ScrollOffset);
sy=item[ScrollOffset].y-(((int)LINE_SPACING)*ScrollOffset);
sx=item[ScrollOffset].x-FSPACX(11);
@ -1309,7 +1309,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
else
nm_rstring( FSPACX(11), sx, sy, " " );
sy=item[ScrollOffset+MaxDisplayable-1].y-(LINE_SPACING*ScrollOffset);
sy=item[ScrollOffset+MaxDisplayable-1].y-(((int)LINE_SPACING)*ScrollOffset);
sx=item[ScrollOffset+MaxDisplayable-1].x-FSPACX(11);
if (ScrollOffset+MaxDisplayable<nitems)