diff --git a/src/common/menu/menudef.cpp b/src/common/menu/menudef.cpp index ad02001e0..d0066900b 100644 --- a/src/common/menu/menudef.cpp +++ b/src/common/menu/menudef.cpp @@ -511,20 +511,33 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s } else if (args[i]->isIntCompatible()) { - char *endp; - int v = (int)strtoll(sc.String, &endp, 0); - if (*endp != 0) + int v; + + if (sc.Compare("true")) { - // special check for font color ranges. - v = V_FindFontColor(sc.String); - if (v == CR_UNTRANSLATED && !sc.Compare("untranslated")) + v = 1; + } + else if (sc.Compare("false")) + { + v = 0; + } + else + { + char *endp; + v = (int)strtoll(sc.String, &endp, 0); + if (*endp != 0) { - // todo: check other data types that may get used. - sc.ScriptError("Integer expected, got %s", sc.String); + // special check for font color ranges. + v = V_FindFontColor(sc.String); + if (v == CR_UNTRANSLATED && !sc.Compare("untranslated")) + { + // todo: check other data types that may get used. + sc.ScriptError("Integer expected, got %s", sc.String); + } } } - if (args[i] == TypeBool) v = !!v; - params.Push(v); + if (args[i] == TypeBool) v = !!v; + params.Push(v); } else if (args[i]->isFloat()) { @@ -1114,19 +1127,32 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc, int i } else if (args[i]->isIntCompatible()) { - char *endp; - int v = (int)strtoll(sc.String, &endp, 0); - if (*endp != 0) + int v; + + if (sc.Compare("true")) { - // special check for font color ranges. - v = V_FindFontColor(sc.String); - if (v == CR_UNTRANSLATED && !sc.Compare("untranslated")) + v = 1; + } + else if (sc.Compare("false")) + { + v = 0; + } + else + { + char *endp; + v = (int)strtoll(sc.String, &endp, 0); + if (*endp != 0) { - // todo: check other data types that may get used. - sc.ScriptError("Integer expected, got %s", sc.String); + // special check for font color ranges. + v = V_FindFontColor(sc.String); + if (v == CR_UNTRANSLATED && !sc.Compare("untranslated")) + { + // todo: check other data types that may get used. + sc.ScriptError("Integer expected, got %s", sc.String); + } + // Color ranges need to be marked for option menu items to support an older feature where a boolean number could be passed instead. + v |= 0x12340000; } - // Color ranges need to be marked for option menu items to support an older feature where a boolean number could be passed instead. - v |= 0x12340000; } if (args[i] == TypeBool) v = !!v; params.Push(v); @@ -1403,16 +1429,29 @@ static void ParseImageScrollerBody(FScanner& sc, DImageScrollerDescriptor* desc) } else if (args[i]->isIntCompatible()) { - char* endp; - int v = (int)strtoll(sc.String, &endp, 0); - if (*endp != 0) + int v; + + if (sc.Compare("true")) { - // special check for font color ranges. - v = V_FindFontColor(sc.String); - if (v == CR_UNTRANSLATED && !sc.Compare("untranslated")) + v = 1; + } + else if (sc.Compare("false")) + { + v = 0; + } + else + { + char* endp; + v = (int)strtoll(sc.String, &endp, 0); + if (*endp != 0) { - // todo: check other data types that may get used. - sc.ScriptError("Integer expected, got %s", sc.String); + // special check for font color ranges. + v = V_FindFontColor(sc.String); + if (v == CR_UNTRANSLATED && !sc.Compare("untranslated")) + { + // todo: check other data types that may get used. + sc.ScriptError("Integer expected, got %s", sc.String); + } } } if (args[i] == TypeBool) v = !!v;