Some code improvements and small fixes

This commit is contained in:
zicodxx 2008-05-08 18:29:52 +00:00
parent 9709081498
commit e6ec09869e
7 changed files with 16 additions and 24 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20080508
--------
main/newmenu.c, main/multi.c, main/kconfig.c, main/gamecntl.c, arch/sdl/key.c, arch/include/key.h: Some code improvements and small fixes
20080507
--------
include/args.h, main/newmenu.c, main/multi.c, main/multi.h, main/inferno.c, main/menu.c, main/netdrv_udp.c, main/powerup.c, main/automap.c, main/gamecntl.c, misc/args.c, d2x.ini, ui/inputbox.c, ui/menubar.c, arch/sdl/digi_mixer.c, arch/sdl/jukebox.c, arch/sdl/key.c,arch/include/jukebox.h, arch/include/key.h: Return unicode characters in key_to_ascii for non-EN keyboard layouts; Fixed sound menu issue if not compiled with SDL_mixer; switched -ip_norelay to -ip_relay since it's not tested enough; Renamed jukebox_free() to jukebox_unload() to stay with naming-convention

View file

@ -57,6 +57,8 @@ extern unsigned char keyd_editor_mode;
// Time in seconds when last key was pressed...
extern volatile int keyd_time_when_last_pressed;
extern volatile int keyd_ascii;
//==========================================================================
// These are the "buffered" keypress routines. Use them by setting the
// "keyd_buffer_type" variable.
@ -69,7 +71,7 @@ extern int key_inkey(); // Gets key if one, other returns 0.
extern int key_inkey_time(fix *time); // Same as inkey, but returns the time the key was pressed down.
extern int key_peekkey(); // Same as inkey, but doesn't remove key from buffer.
extern unsigned char key_to_ascii();
extern unsigned char key_to_ascii(void);
extern void key_debug(); // Does an INT3

View file

@ -354,10 +354,10 @@ void key_buid_key_text(void)
{
}
unsigned char key_to_ascii()
unsigned char key_to_ascii(void)
{
static int last_ascii = 0;
if (last_ascii == keyd_ascii)
return 255;
@ -492,6 +492,7 @@ void key_flush()
key_data.keys[i].timehelddown = 0;
key_data.keys[i].counter = 0;
}
keyd_ascii=255;
}
int add_one(int n)

View file

@ -1873,7 +1873,7 @@ void FinalCheats(int key)
int i;
char *cryptstring;
key=key_to_ascii(key);
key=keyd_ascii;
for (i=0;i<15;i++)
CheatBuffer[i]=CheatBuffer[i+1];

View file

@ -1356,21 +1356,6 @@ fix LastReadTime = 0;
fix joy_axis[JOY_MAX_AXES];
fix Next_toggle_time[3]={0,0,0};
int allowed_to_toggle(int i)
{
//used for keeping tabs of when its ok to toggle headlight,primary,and secondary
if (Next_toggle_time[i] > GameTime)
if (Next_toggle_time[i] < GameTime + (F1_0/8)) // In case time is bogus, never wait > 1 second.
return 0;
Next_toggle_time[i] = GameTime + (F1_0/8);
return 1;
}
#ifdef D2X_KEYS
int d2x_joystick_ostate[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
#endif

View file

@ -1295,7 +1295,7 @@ void multi_message_input_sub()
break;
default:
{
int ascii = key_to_ascii(key);
int ascii = key_to_ascii();
if ((ascii < 255 ) && (ascii != 37)) {
if (multi_message_index < MAX_MESSAGE_LEN-2 ) {
Network_message[multi_message_index++] = ascii;

View file

@ -1287,7 +1287,7 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
item[choice].value--;
item[choice].text[item[choice].value] = 0;
} else {
ascii = key_to_ascii(k);
ascii = key_to_ascii();
if ((ascii < 255 ) && (item[choice].value < item[choice].text_len ))
{
int allowed;
@ -1312,7 +1312,7 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
}
else if ((item[choice].type!=NM_TYPE_INPUT) && (item[choice].type!=NM_TYPE_INPUT_MENU) )
{
ascii = key_to_ascii(k);
ascii = key_to_ascii();
if (ascii < 255 ) {
int choice1 = choice;
ascii = toupper(ascii);
@ -2131,8 +2131,8 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
break;
default:
if ( key > 0 ) {
int ascii = key_to_ascii(key);
{
int ascii = key_to_ascii();
if ( ascii < 255 ) {
int cc,cc1;
cc=cc1=citem+1;