Fixed possible overflows in Jukebox Path; Menu GUI improvements: Correct inputbox scaling for font widths, a little performance boost when determinating string-part to show in inputbox, make it possible to flip over from first/last menu entry to last/first even if it's a ScrollBox, Scrolling via Maousebutton now works with delay; Made reading for Piggy data always break up in loops when reached end of file instead of provoking possible error if *data-count < max-data-count*

This commit is contained in:
zicodxx 2008-11-01 01:19:52 +00:00
parent 3caa0e41a8
commit 4b0041d815
5 changed files with 41 additions and 14 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20081101
--------
main/config.c, main/menu.c, main/newmenu.c, main/piggy.c: Fixed possible overflows in Jukebox Path; Menu GUI improvements: Correct inputbox scaling for font widths, a little performance boost when determinating string-part to show in inputbox, make it possible to flip over from first/last menu entry to last/first even if it's a ScrollBox, Scrolling via Maousebutton now works with delay; Made reading for Piggy data always break up in loops when reached end of file instead of provoking possible error if *data-count < max-data-count*
20081031
--------
arch/include/key.h, arch/sdl/key.c, main/game.c, main/kmatrix.c, main/multi.c, main/multi.h, main/newmenu.c, main/scores.c, ui/inputbox.c, main/menubar.c: Always use printable UNICODE characters for the key_handler and included routine to assign key symbols to UNICODE so we get an equivalent of a Key-Released state which we need for the Keyboard buffer; Removed the shifted_ascii_value field from key_props and stored all usable characters in seperate rows; Improves Text input and makes keyboard mapping independent from keyboard layout without breaking any compability

View file

@ -64,7 +64,7 @@ static char *TrackerServerStr="TrackerServer";
int ReadConfigFile()
{
PHYSFS_file *infile;
char line[80], *token, *value, *ptr;
char line[PATH_MAX+50], *token, *value, *ptr;
// set defaults
GameCfg.DigiVolume = 8;
@ -101,7 +101,7 @@ int ReadConfigFile()
while (!PHYSFS_eof(infile))
{
memset(line, 0, 80);
memset(line, 0, PATH_MAX+50);
PHYSFSX_gets(infile, line);
ptr = &(line[0]);
while (isspace(*ptr))

View file

@ -728,7 +728,7 @@ void do_sound_menu()
#ifdef USE_SDLMIXER
m[nitems].type = NM_TYPE_RADIO; m[nitems].text="jukebox enabled in game"; m[nitems].value=GameCfg.JukeboxOn; m[nitems].group = 0; nitems++;
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text="path to music for jukebox:";
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.JukeboxPath; m[nitems++].text_len = PATH_MAX;
m[nitems].type = NM_TYPE_INPUT; m[nitems].text = GameCfg.JukeboxPath; m[nitems++].text_len = NM_MAX_TEXT_LEN-1;
#endif
m[nitems].type = NM_TYPE_CHECK; m[nitems].text=TXT_REVERSE_STEREO; m[nitems++].value=GameCfg.ReverseStereo;

View file

@ -304,9 +304,12 @@ void update_cursor( newmenu_item *item, int ScrollOffset)
Assert(item->type==NM_TYPE_INPUT_MENU || item->type==NM_TYPE_INPUT);
gr_get_string_size(" ", &w, &h, &aw );
// even with variable char widths and a box that goes over the whole screen, we maybe never get more than 75 chars on the line
if (strlen(text)>75)
text+=strlen(text)-75;
while( *text ) {
gr_get_string_size(text, &w, &h, &aw );
if ( w > item->w-10 )
if ( w > item->w-FSPACX(10) )
text++;
else
break;
@ -321,16 +324,18 @@ void update_cursor( newmenu_item *item, int ScrollOffset)
gr_setcolor( BM_XRGB(0,0,0) );
gr_rect( x, y, x+FSPACX(7), y+h );
}
}
void nm_string_inputbox( int w, int x, int y, char * text, int current )
{
int w1,h1,aw;
// even with variable char widths and a box that goes over the whole screen, we maybe never get more than 75 chars on the line
if (strlen(text)>75)
text+=strlen(text)-75;
while( *text ) {
gr_get_string_size(text, &w1, &h1, &aw );
if ( w1 > w-10 )
if ( w1 > w-FSPACX(10) )
text++;
else
break;
@ -851,7 +856,11 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
LastScrollCheck=-1;
if (choice<0)
{ choice=0; break; }
{
choice=nitems-1;
ScrollOffset = nitems-MaxOnMenu;
break;
}
if (choice-4<ScrollOffset && ScrollOffset > 0)
{
@ -877,14 +886,18 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
case KEY_PAD2:
if (all_text) break;
do {
choice++;
choice++;
if (IsScrollBox)
{
LastScrollCheck=-1;
if (choice==nitems)
{ choice--; break; }
{
choice=0;
ScrollOffset=0;
break;
}
if (choice+4>=MaxOnMenu+ScrollOffset && ScrollOffset < nitems-MaxOnMenu)
{
@ -894,7 +907,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
else
{
if (choice < 0 ) choice=nitems-1;
if (choice >= nitems ) choice=0;
if (choice >= nitems ) choice=0;
}
} while ( item[choice].type==NM_TYPE_TEXT );
@ -1054,15 +1067,21 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
// check possible scrollbar stuff first
if (IsScrollBox) {
int arrow_width, arrow_height, aw;
int arrow_width, arrow_height, aw, ScrollAllow=0, time=timer_get_fixed_seconds();
static fix ScrollTime=0;
if (ScrollTime + F1_0/5 < time || time < ScrollTime)
{
ScrollTime = time;
ScrollAllow = 1;
}
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-(((int)LINE_SPACING)*ScrollOffset);
x1 = x2 - arrow_width;
y2 = y1 + arrow_height;
if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2)) ) {
if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2)) && ScrollAllow) {
choice--;
LastScrollCheck=-1;
if (choice-4<ScrollOffset && ScrollOffset > 0)
@ -1077,7 +1096,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
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)) ) {
if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2)) && ScrollAllow) {
choice++;
LastScrollCheck=-1;
if (choice+4>=MaxOnMenu+ScrollOffset && ScrollOffset < nitems-MaxOnMenu)

View file

@ -436,7 +436,11 @@ int properties_init()
{
properties_read_cmp( Piggy_fp ); // Note connection to above if!!!
for (i = 0; i < MAX_BITMAP_FILES; i++)
{
GameBitmapXlat[i] = cfile_read_short(Piggy_fp);
if (PHYSFS_eof(Piggy_fp))
break;
}
retval = 0; // don't run gamedata_read_tbl
}
else