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); }
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90); // unk_3178A 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); }
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_scroll_in_page(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_scroll_in_page(false, index_ptr, stringList, listDisplayHeight); break; case 'O': index_ptr = menu_scroll_in_page(true, index_ptr, stringList, listDisplayHeight); break; case 'I': if (showPrevious == true) { menu_scroll_page(false, ref index_ptr, stringList, listDisplayHeight, endY, endX, startY, startX, colors.foreground, colors.prompt, listDisplayWidth); } break; case 'Q': if (showNext == true) { menu_scroll_page(true, ref index_ptr, stringList, listDisplayHeight, endY, endX, startY, startX, colors.foreground, colors.prompt, listDisplayWidth); } break; } } else { switch (input_key) { case 'P': menu_scroll_page(false, ref index_ptr, stringList, listDisplayHeight, endY, endX, startY, startX, colors.foreground, colors.prompt, listDisplayWidth); break; case 'N': menu_scroll_page(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 char displayInput(out bool specialKeyPressed, bool useOverlay, byte accept_ctrlkeys, 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 (accept_ctrlkeys != 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 == ',') { 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 == '.') { 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 (alpha_number_input.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 (accept_ctrlkeys != 0 && number_input.MemberOf(input_key) == true) { if (input_key == 'W') { input_key = '7'; } else { input_key = keypad_ctrl_codes[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); }