kbd_mode option
This commit is contained in:
parent
063458c1b0
commit
7d0a9c6d0f
|
@ -45,6 +45,10 @@ OFF = Off
|
|||
SELECT_GAME_MENU = Select game to play\n\n
|
||||
SELECT_THEME_MENU = Select theme\n\n
|
||||
|
||||
KBD_MODE_NORMAL = Normal
|
||||
KBD_MODE_SMART = Smart
|
||||
KBD_MODE_INVERSE = Inverse
|
||||
|
||||
SETTINGS_MENU = \
|
||||
Volume\n\
|
||||
<a:/vol--><<</a><a:/vol-><</a> <a:/mtoggle>%d%%</a> <a:/vol+>></a><a:/vol++>>></a>\n\
|
||||
|
@ -60,6 +64,7 @@ Font scaling: <a:/fs--><<</a>%d<a:/fs++>>></a>\n\
|
|||
Refs highlighting: <a:/hl>%s</a>\n\
|
||||
Motion mode: <a:/motion>%s</a>\n\
|
||||
Mouse filter: <a:/filter>%s</a>\n\
|
||||
Keyboard mode: <a:/kbd>%s</a>\n\
|
||||
\n\
|
||||
Language: <a:/lang--><<</a>%s<a:/lang++>>></a>\n\
|
||||
Custom game themes: <a:/owntheme>%s</a>\n\
|
||||
|
|
|
@ -46,6 +46,10 @@ BACK_MENU = <a:/main>Назад</a>
|
|||
ON = Да
|
||||
OFF = Нет
|
||||
|
||||
KBD_MODE_NORMAL = Обычное
|
||||
KBD_MODE_SMART = Умное
|
||||
KBD_MODE_INVERSE = Обратное
|
||||
|
||||
SETTINGS_MENU = \
|
||||
Громкость\n\
|
||||
<a:/vol--><<</a><a:/vol-><</a> <a:/mtoggle>%d%%</a> <a:/vol+>></a><a:/vol++>>></a>\n\
|
||||
|
@ -60,6 +64,7 @@ SETTINGS_MENU = \
|
|||
Подсветка ссылок: <a:/hl>%s</a>\n\
|
||||
Режим прокрутки: <a:/motion>%s</a>\n\
|
||||
Фильтр мышки: <a:/filter>%s</a>\n\
|
||||
Режим клавиатуры: <a:/kbd>%s</a>\n\
|
||||
\n\
|
||||
Язык: <a:/lang--><<</a>%s<a:/lang++>>></a>\n\
|
||||
Собственные темы игр: <a:/owntheme>%s</a>\n\
|
||||
|
|
|
@ -18,6 +18,7 @@ int opt_click = 1;
|
|||
int opt_music = 1;
|
||||
int opt_autosave = 1;
|
||||
int opt_filter = 1;
|
||||
int opt_kbd = KBD_SMART;
|
||||
|
||||
char *opt_game = NULL;
|
||||
char *opt_theme = NULL;
|
||||
|
@ -38,6 +39,7 @@ static struct parser cfg_parser[] = {
|
|||
{ "filter", parse_int, &opt_filter },
|
||||
{ "owntheme", parse_int, &opt_owntheme },
|
||||
{ "lang", parse_string, &opt_lang },
|
||||
{ "kbd", parse_int, &opt_kbd },
|
||||
{ NULL, },
|
||||
};
|
||||
|
||||
|
@ -68,11 +70,11 @@ int cfg_save(void)
|
|||
fprintf(fp, "fs = %d\nhl = %d\nhz = %d\nvol = %d\nautosave = %d\n\
|
||||
game = %s\nfscale = %d\nmotion = %d\n\
|
||||
click = %d\nmusic = %d\ntheme = %s\n\
|
||||
filter = %d\nowntheme = %d\nlang = %s",
|
||||
filter = %d\nowntheme = %d\nlang = %s\nkbd = %d",
|
||||
opt_fs, opt_hl, opt_hz, opt_vol, opt_autosave,
|
||||
curgame_dir?curgame_dir:"", opt_fsize, opt_motion,
|
||||
opt_click, opt_music, curtheme_dir?curtheme_dir:DEFAULT_THEME,
|
||||
opt_filter, opt_owntheme, opt_lang);
|
||||
opt_filter, opt_owntheme, opt_lang, opt_kbd);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
#define FONT_SZ(v) ((v) * (1.0f + ((0.1f * opt_fsize))))
|
||||
|
||||
#define KBD_NORMAL 0
|
||||
#define KBD_SMART 1
|
||||
#define KBD_INVERSE 2
|
||||
#define KBD_MAX 3
|
||||
|
||||
extern int opt_fsize;
|
||||
extern int opt_fs;
|
||||
extern int opt_owntheme;
|
||||
|
@ -14,6 +19,8 @@ extern int opt_click;
|
|||
extern int opt_music;
|
||||
extern int opt_autosave;
|
||||
extern int opt_filter;
|
||||
extern int opt_kbd;
|
||||
|
||||
extern char *opt_game;
|
||||
extern char *opt_theme;
|
||||
extern char *opt_lang;
|
||||
|
|
|
@ -1827,22 +1827,23 @@ int game_loop(void)
|
|||
menu_toggle();
|
||||
} else if (!is_key(&ev, "tab")) {
|
||||
select_frame(shift_pressed);
|
||||
} else if (!is_key(&ev, "up")) {
|
||||
if (menu_shown || (!alt_pressed && !shift_pressed)) {
|
||||
if (select_ref(1, 0)) {
|
||||
game_scroll_up(1);
|
||||
select_ref(0, 1);
|
||||
} else if (!is_key(&ev, "up") || !is_key(&ev, "down")) {
|
||||
int lm;
|
||||
int prev = !is_key(&ev, "up");
|
||||
|
||||
if (opt_kbd == KBD_INVERSE)
|
||||
lm = (alt_pressed || shift_pressed);
|
||||
else
|
||||
lm = (!alt_pressed && !shift_pressed);
|
||||
|
||||
if (menu_shown || lm) {
|
||||
if (select_ref(prev, 0)) {
|
||||
if (opt_kbd == KBD_SMART)
|
||||
(prev)?game_scroll_up(1):game_scroll_down(1);
|
||||
select_ref(!prev, 1);
|
||||
}
|
||||
} else
|
||||
game_scroll_up(1);
|
||||
} else if (!is_key(&ev, "down")) {
|
||||
if (menu_shown || (!alt_pressed && !shift_pressed)) {
|
||||
if (select_ref(0, 0)) {
|
||||
game_scroll_down(1);
|
||||
select_ref(1, 1);
|
||||
}
|
||||
} else
|
||||
game_scroll_down(1);
|
||||
(prev)?game_scroll_up(1):game_scroll_down(1);
|
||||
} else if (!is_key(&ev, "left")) {
|
||||
select_ref(1, 0);
|
||||
} else if (!is_key(&ev, "right")) {
|
||||
|
|
|
@ -38,6 +38,10 @@ char *QUIT_MENU = NULL;
|
|||
char *ON = NULL;
|
||||
char *OFF = NULL;
|
||||
|
||||
char *KBD_MODE_NORMAL = NULL;
|
||||
char *KBD_MODE_SMART = NULL;
|
||||
char *KBD_MODE_INVERSE = NULL;
|
||||
|
||||
static char menu_buff[4096];
|
||||
|
||||
static char *slot_name(const char *path)
|
||||
|
@ -178,9 +182,10 @@ char *game_menu_gen(void)
|
|||
} else if (cur_menu == menu_about) {
|
||||
snprintf(menu_buff, sizeof(menu_buff), ABOUT_MENU, VERSION);
|
||||
} else if (cur_menu == menu_settings) {
|
||||
char *kbd [KBD_MAX] = { KBD_MODE_NORMAL, KBD_MODE_SMART, KBD_MODE_INVERSE };
|
||||
snprintf(menu_buff, sizeof(menu_buff), SETTINGS_MENU,
|
||||
snd_vol_to_pcn(snd_volume_mus(-1)), snd_hz(), opt_music?ON:OFF, opt_click?ON:OFF,
|
||||
opt_fs?ON:OFF, opt_fsize, opt_hl?ON:OFF, opt_motion?ON:OFF, opt_filter?ON:OFF,
|
||||
opt_fs?ON:OFF, opt_fsize, opt_hl?ON:OFF, opt_motion?ON:OFF, opt_filter?ON:OFF, kbd[opt_kbd],
|
||||
langs[cur_lang].name, opt_owntheme?ON:OFF, opt_autosave?ON:OFF);
|
||||
} else if (cur_menu == menu_askquit) {
|
||||
snprintf(menu_buff, sizeof(menu_buff), QUIT_MENU);
|
||||
|
@ -221,6 +226,11 @@ int game_menu_act(const char *a)
|
|||
if (!strcmp(a, "/autosave")) {
|
||||
opt_autosave ^= 1;
|
||||
game_menu_box(1, game_menu_gen());
|
||||
} else if (!strcmp(a, "/kbd")) {
|
||||
opt_kbd += 1;
|
||||
if (opt_kbd == KBD_MAX)
|
||||
opt_kbd = 0;
|
||||
game_menu_box(1, game_menu_gen());
|
||||
} else if (!strcmp(a, "/owntheme")) {
|
||||
opt_owntheme ^= 1;
|
||||
if (game_own_theme)
|
||||
|
@ -460,6 +470,9 @@ static void lang_free(void)
|
|||
FREE(QUIT_MENU);
|
||||
FREE(ON);
|
||||
FREE(OFF);
|
||||
FREE(KBD_MODE_NORMAL);
|
||||
FREE(KBD_MODE_SMART);
|
||||
FREE(KBD_MODE_INVERSE);
|
||||
}
|
||||
|
||||
static int lang_ok(void)
|
||||
|
@ -469,7 +482,7 @@ static int lang_ok(void)
|
|||
MAIN_MENU && ABOUT_MENU && BACK_MENU && SETTINGS_MENU &&
|
||||
CUSTOM_THEME_MENU && OWN_THEME_MENU && SELECT_GAME_MENU && SELECT_THEME_MENU &&
|
||||
SAVED_MENU && NOGAMES_MENU && NOTHEMES_MENU && QUIT_MENU &&
|
||||
ON && OFF)
|
||||
ON && OFF && KBD_MODE_NORMAL && KBD_MODE_SMART && KBD_MODE_INVERSE)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
@ -497,6 +510,9 @@ struct parser lang_parser[] = {
|
|||
{ "QUIT_MENU", parse_esc_string, &QUIT_MENU },
|
||||
{ "ON", parse_esc_string, &ON },
|
||||
{ "OFF", parse_esc_string, &OFF },
|
||||
{ "KBD_MODE_NORMAL", parse_esc_string, &KBD_MODE_NORMAL },
|
||||
{ "KBD_MODE_SMART", parse_esc_string, &KBD_MODE_SMART },
|
||||
{ "KBD_MODE_INVERSE", parse_esc_string, &KBD_MODE_INVERSE },
|
||||
{ NULL, },
|
||||
};
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ scr.w = 800
|
|||
scr.h = 480
|
||||
scr.gfx.bg = bg.png
|
||||
scr.col.bg = white
|
||||
scr.gfx.cursor.x = 0
|
||||
scr.gfx.cursor.y = 0
|
||||
scr.gfx.cursor.x = 1
|
||||
scr.gfx.cursor.y = 1
|
||||
scr.gfx.cursor.normal = cursor.png
|
||||
scr.gfx.cursor.use = cursor-use.png
|
||||
scr.gfx.pad = 16
|
||||
|
|
Loading…
Reference in a new issue