internal static void CMD_HorizontalMenu() { bool useOverlay; bool var_3B; ovr008.vm_LoadCmdSets(2); ushort loc = gbl.cmd_opps[1].Word; byte string_count = (byte)ovr008.vm_GetCmdValue(2); gbl.ecl_offset--; ovr008.vm_LoadCmdSets(string_count); MenuColorSet colors; if (string_count == 1) { var_3B = true; colors = new MenuColorSet(15, 15, 13); if (gbl.unk_1D972[1] == "PRESS BUTTON OR RETURN TO CONTINUE.") { gbl.unk_1D972[1] = "PRESS <ENTER>/<RETURN> TO CONTINUE"; } } else { colors = new MenuColorSet(1, 15, 15); var_3B = false; colors = gbl.defaultMenuColors; } if (gbl.spriteChanged == false || gbl.byte_1EE8D == false) { useOverlay = false; } else { useOverlay = true; } string text = string.Empty; for (int i = 1; i < string_count; i++) { text += "~" + gbl.unk_1D972[i] + " "; } text += "~" + gbl.unk_1D972[string_count]; byte menu_selected = (byte)ovr008.sub_317AA(useOverlay, var_3B, colors, text, ""); ovr008.vm_SetMemoryValue(menu_selected, loc); ovr027.ClearPromptAreaNoUpdate(); }
internal static char displayInput(out bool specialKeyPressed, bool useOverlay, byte arg_6, MenuColorSet colors, string displayInputString, string displayExtraString) { int highlistCount; gbl.displayInput_specialKeyPressed = false; bool var_8F = (colors.foreground != 0) || (colors.highlight != 0); HighlightSet highlights = BuildInputKeys(displayInputString, out highlistCount); if (gbl.menuSelectedWord >= highlistCount) { gbl.menuSelectedWord = 0; } char input_key = '\0'; specialKeyPressed = false; bool stopLoop = false; var timeStart = DateTime.Now; var timeCursorOn = timeStart.AddMilliseconds(300); var timeCursorOff = timeCursorOn.AddMilliseconds(500); if (displayExtraString.Length != 0) { seg041.displayString(displayExtraString, 0, colors.prompt, 0x18, 0); } int displayInputXOffset = displayExtraString.Length; display_highlighed_text(gbl.menuSelectedWord, colors.highlight, displayInputString, displayInputXOffset, colors.foreground, highlights); if (gbl.game_state == GameState.WildernessMap && gbl.bigpic_block_id == 0x79 && gbl.lastDaxBlockId != 0x50) { MapCursor.SetPosition(gbl.area_ptr.current_city); MapCursor.Draw(); MapCursor.Restore(); } do { if (gbl.game_state == GameState.WildernessMap && gbl.bigpic_block_id == 0x79 && gbl.lastDaxBlockId != 0x50 && DateTime.Now >= timeCursorOn) { MapCursor.Draw(); timeCursorOn = timeCursorOff.AddMilliseconds(300); } if ((gbl.area_ptr.picture_fade != 0 || useOverlay == true) && gbl.byte_1D556.curFrame > 0) { ovr030.DrawMaybeOverlayed(gbl.byte_1D556.CurrentPicture(), useOverlay, 3, 3); int delay = gbl.byte_1D556.CurrentDelay() * 100; if ((DateTime.Now.Subtract(timeStart).TotalMilliseconds) >= delay || gbl.area_ptr.picture_fade != 0) { gbl.byte_1D556.NextFrame(); timeStart = DateTime.Now; } } if (gbl.displayInputSecondsToWait > 0 && DateTime.Now.Subtract(timeStart).TotalSeconds >= gbl.displayInputSecondsToWait) { input_key = gbl.displayInputTimeoutValue; stopLoop = true; } else if (seg049.KEYPRESSED() == true) { input_key = (char)seg043.GetInputKey(); if (input_key == 0) { input_key = (char)seg043.GetInputKey(); if (arg_6 != 0) { specialKeyPressed = true; stopLoop = true; } } else if (input_key == 0x1B) { stopLoop = true; input_key = '\0'; } else if (input_key == 13) { if (var_8F) { if (highlights[gbl.menuSelectedWord].start != -1) { input_key = displayInputString[highlights[gbl.menuSelectedWord].start]; } else { input_key = '\r'; } stopLoop = true; } } else if (input_key == 0x2C) { if (gbl.menuSelectedWord == 0) { gbl.menuSelectedWord = highlistCount - 1; } else { gbl.menuSelectedWord--; } display_highlighed_text(gbl.menuSelectedWord, colors.highlight, displayInputString, displayInputXOffset, colors.foreground, highlights); } else if (input_key == 0x2E) { gbl.menuSelectedWord++; if (gbl.menuSelectedWord >= highlistCount) { gbl.menuSelectedWord = 0; } display_highlighed_text(gbl.menuSelectedWord, colors.highlight, displayInputString, displayInputXOffset, colors.foreground, highlights); } else { input_key = char.ToUpper(input_key); if (unk_6C398.MemberOf(input_key) == true) { if (input_key == 0x20) { stopLoop = true; } else { for (int var_62 = 0; var_62 < displayInputString.Length; var_62++) { if (displayInputString[var_62] == input_key) { stopLoop = true; int var_61 = 0; while (highlights[var_61].start != var_62) { var_61++; } gbl.menuSelectedWord = var_61; display_highlighed_text(gbl.menuSelectedWord, colors.highlight, displayInputString, displayInputXOffset, colors.foreground, highlights); } } } } if (arg_6 != 0 && unk_6C3B8.MemberOf(input_key) == true) { if (input_key == 'W') { input_key = '7'; } else { input_key = (char)unk_18AE0[input_key - 0x31]; } specialKeyPressed = true; stopLoop = true; } } } if (gbl.game_state == GameState.WildernessMap && gbl.bigpic_block_id == 0x79 && gbl.lastDaxBlockId != 0x50 && DateTime.Now >= timeCursorOff) { MapCursor.Restore(); timeCursorOff = timeCursorOn.AddMilliseconds(500); } System.Threading.Thread.Sleep(20); } while (stopLoop == false); gbl.area_ptr.picture_fade = 0; if (gbl.game_state == GameState.WildernessMap && gbl.bigpic_block_id == 0x79 && gbl.lastDaxBlockId != 0x50) { MapCursor.Restore(); } gbl.displayInput_specialKeyPressed = specialKeyPressed; return input_key; }
internal static char displayInput(bool useOverlay, byte arg_6, MenuColorSet colors, string displayInputString, string displayExtraString) { bool dummyBool; return displayInput(out dummyBool, useOverlay, arg_6, colors, displayInputString, displayExtraString); }
internal static char yes_no(MenuColorSet colors, string inputString) { char inputKey; gbl.menuSelectedWord = 2; do { inputKey = displayInput(false, 0, colors, "Yes No", inputString); } while (inputKey != 'N' && inputKey != 'Y'); return inputKey; }
internal static char sl_select_item(out MenuItem result_ptr, ref int index_ptr, ref bool redrawMenuItems, bool showExit, List<MenuItem> stringList, int endY, int endX, int startY, int startX, MenuColorSet colors, string inputString, string extraTextString) { char ret_val = '\0'; /* Simeon */ result_ptr = null; /*Simeon*/ if (stringList == null) { index_ptr = 0; result_ptr = null; return '\0'; } gbl.menuSelectedWord = 1; int listDisplayWidth = (endX - startX) + 1; int listDisplayHeight = (short)((endY - startY) + 1); int listCount = stringList.Count; if (listCount <= listDisplayHeight) { gbl.menuScreenIndex = 0; } if (gbl.menuScreenIndex > index_ptr) { gbl.menuScreenIndex = index_ptr; redrawMenuItems = true; } if (gbl.menuScreenIndex > listCount) { gbl.menuScreenIndex = 0; redrawMenuItems = true; } index_ptr++; index_ptr = menu_sub_6CDCA(false, index_ptr, stringList, listDisplayHeight); if (redrawMenuItems == true) { sub_6C897(gbl.menuScreenIndex, endY, endX, startY, startX, stringList, colors.foreground, colors.prompt, listDisplayWidth); } redrawMenuItems = false; bool loop_end = false; while (loop_end == false) { ListItemHighlighted(index_ptr, stringList, startY, startX, colors.highlight); string displayString = inputString; bool showNext = false; bool showPrevious = false; if ((listCount - listDisplayHeight) > gbl.menuScreenIndex) { displayString += " Next"; showNext = true; } if (gbl.menuScreenIndex > 0) { displayString += " Prev"; showPrevious = true; } if (showExit == true) { displayString += " Exit"; } bool speical_key; char input_key = displayInput(out speical_key, false, 1, colors, displayString, extraTextString); ListItemNormal(index_ptr, stringList, startY, startX, colors.foreground, colors.prompt); if (speical_key == true) { switch (input_key) { case 'G': index_ptr = menu_sub_6CDCA(false, index_ptr, stringList, listDisplayHeight); break; case 'O': index_ptr = menu_sub_6CDCA(true, index_ptr, stringList, listDisplayHeight); break; case 'I': if (showPrevious == true) { menu_sub_6CD38(false, ref index_ptr, stringList, listDisplayHeight, endY, endX, startY, startX, colors.foreground, colors.prompt, listDisplayWidth); } break; case 'Q': if (showNext == true) { menu_sub_6CD38(true, ref index_ptr, stringList, listDisplayHeight, endY, endX, startY, startX, colors.foreground, colors.prompt, listDisplayWidth); } break; } } else { switch (input_key) { case 'P': menu_sub_6CD38(false, ref index_ptr, stringList, listDisplayHeight, endY, endX, startY, startX, colors.foreground, colors.prompt, listDisplayWidth); break; case 'N': menu_sub_6CD38(true, ref index_ptr, stringList, listDisplayHeight, endY, endX, startY, startX, colors.foreground, colors.prompt, listDisplayWidth); break; case (char)0x1B: case '\0': case 'E': result_ptr = null; ret_val = '\0'; loop_end = true; break; default: result_ptr = getStringListEntry(stringList, index_ptr); ret_val = input_key; loop_end = true; break; } } } return ret_val; }
internal static int sub_317AA(bool useOverlay, bool acceptReturn, MenuColorSet colors, string displayString, string extraString) { char key_pressed; int ret_val; string menu_keys = buildMenuStrings(ref displayString); do { bool special_key_pressed; key_pressed = ovr027.displayInput(out special_key_pressed, useOverlay, 1, colors, displayString, extraString); if (special_key_pressed == true) { ovr020.scroll_team_list(key_pressed); ovr025.PartySummary(gbl.SelectedPlayer); key_pressed = '\0'; } } while (validkeys.MemberOf(key_pressed) == false && (key_pressed != '\r' || acceptReturn == false)); if (key_pressed == '\r') { ret_val = 0; } else { int var_154 = 0; while (var_154 < menu_keys.Length && menu_keys[var_154] != key_pressed) { var_154++; } if (var_154 < menu_keys.Length) { ret_val = var_154; } else { ret_val = -1; } } return ret_val; }