expand mouse_support to three values rather than boolean

On Windows only:
   0 = turn off mouse_support
   1 = turn on mouse_support and turn off QuickEdit mode
   2 = turn on mouse_support and leave QuickEdit mode untouched

More generally, but not implemented anywhere:
   0 = turn off mouse_support
   1 = turn on mouse_support and make supporting O/S adjustments
       (O/S adjustments not implented beyond Windows as yet)
   2 = turn on mouse_support and do not make OS adjustments
       (unimplemented as yet so behaves as 1)
This commit is contained in:
nhmall
2018-11-27 22:15:34 -05:00
parent 554ec17c8b
commit d18bf800ae
3 changed files with 80 additions and 11 deletions

View File

@@ -166,11 +166,6 @@ static struct Bool_Opt {
{ "menu_overlay", (boolean *) 0, FALSE, SET_IN_FILE },
#endif
{ "monpolycontrol", &iflags.mon_polycontrol, FALSE, SET_IN_WIZGAME },
#ifdef CURSES_GRAPHICS
{ "mouse_support", &iflags.wc_mouse_support, FALSE, DISP_IN_GAME }, /*WC*/
#else
{ "mouse_support", &iflags.wc_mouse_support, TRUE, DISP_IN_GAME }, /*WC*/
#endif
#ifdef NEWS
{ "news", &iflags.news, TRUE, DISP_IN_GAME },
#else
@@ -342,6 +337,7 @@ static struct Comp_Opt {
#endif
{ "name", "your character's name (e.g., name:Merlin-W)", PL_NSIZ,
DISP_IN_GAME },
{ "mouse_support", "game receives click info from mouse", 0, SET_IN_GAME },
{ "number_pad", "use the number pad for movement", 1, SET_IN_GAME },
{ "objects", "the symbols to use for objects", MAXOCLASSES, SET_IN_FILE },
{ "packorder", "the inventory order of the items in your pack",
@@ -2209,6 +2205,35 @@ boolean tinitial, tfrom_file;
return retval;
}
fullname = "mouse_support";
if (match_optname(opts, fullname, 13, TRUE)) {
boolean compat = (strlen(opts) <= 13);
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, (compat || !initial));
if (!op) {
if (compat || negated || initial) {
/* for backwards compatibility, "mouse_support" without a
value is a synonym for mouse_support:1 */
iflags.wc_mouse_support = !negated;
}
} else if (negated) {
bad_negation(fullname, TRUE);
return FALSE;
} else {
int mode = atoi(op);
if (mode < 0 || mode > 2 || (mode == 0 && *op != '0')) {
config_error_add("Illegal %s parameter '%s'", fullname, op);
return FALSE;
} else { /* mode > 0 */
iflags.wc_mouse_support = mode;
}
}
return retval;
}
fullname = "number_pad";
if (match_optname(opts, fullname, 10, TRUE)) {
boolean compat = (strlen(opts) <= 10);
@@ -5496,6 +5521,25 @@ char *buf;
#endif
} else if (!strcmp(optname, "name")) {
Sprintf(buf, "%s", plname);
} else if (!strcmp(optname, "mouse_support")) {
#ifdef WIN32
#define MOUSEFIX1 ", QuickEdit off"
#define MOUSEFIX2 ", QuickEdit unchanged"
#else
#define MOUSEFIX1 ", O/S adjusted"
#define MOUSEFIX2 ", O/S unchanged"
#endif
int ms = iflags.wc_mouse_support;
static const char *mousemodes[] = {
"0=off",
"1=on" MOUSEFIX1,
"2=on" MOUSEFIX2,
};
if (ms >= 0 && ms < SIZE(mousemodes));
Strcpy(buf, mousemodes[ms]);
#undef MOUSEFIX1
#undef MOUSEFIX2
} else if (!strcmp(optname, "number_pad")) {
static const char *numpadmodes[] = {
"0=off", "1=on", "2=on, MSDOS compatible",