- Timestamp:
- 05/17/09 20:46:30 (16 months ago)
- Files:
-
- 1 modified
-
trunk/src/ui-birth.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ui-birth.c
r1401 r1402 46 46 { 47 47 BIRTH_BACK = -1, 48 BIRTH_METHOD_CHOICE = 0, 48 BIRTH_RESET = 0, 49 BIRTH_QUICKSTART, 49 50 BIRTH_SEX_CHOICE, 50 51 BIRTH_RACE_CHOICE, … … 83 84 * Quickstart? screen. 84 85 * ------------------------------------------------------------------------ */ 85 static enum birth_stage quickstart_question(void)86 { 87 c har ch;86 static enum birth_stage get_quickstart_command(void) 87 { 88 const char *prompt = "['Y' to use this character, 'N' to start afresh, 'C' to change name]"; 88 89 ui_event_data ke; 89 enum birth_stage next = BIRTH_METHOD_CHOICE; 90 91 Term_clear(); 92 93 /* Prompt */ 94 while (next == BIRTH_METHOD_CHOICE) 95 { 96 put_str("Quick-start character based on previous one (y/n)? ", 2, 2); 97 98 /* Buttons */ 99 button_kill_all(); 100 button_add("[Exit]", KTRL('X')); 101 button_add("[ESC]", ESCAPE); 102 button_add("[y]", 'y'); 103 button_add("[n]", 'n'); 104 button_add("[Help]", '?'); 90 91 enum birth_stage next = BIRTH_QUICKSTART; 92 93 /* Prompt for it */ 94 prt("New character based on previous one:", 0, 0); 95 prt(prompt, Term->hgt - 1, Term->wid / 2 - strlen(prompt) / 2); 96 97 /* Buttons */ 98 button_kill_all(); 99 button_add("[Y]", 'y'); 100 button_add("[N]", 'n'); 101 button_add("[C]", 'c'); 102 redraw_stuff(); 103 104 do 105 { 106 /* Get a key */ 107 ke = inkey_ex(); 105 108 106 ke = inkey_ex(); 107 ch = ke.key; 108 109 if (ch == KTRL('X')) 109 if (ke.key == 'N' || ke.key == 'n') 110 { 111 cmd_insert(CMD_BIRTH_RESET, TRUE); 112 next = BIRTH_SEX_CHOICE; 113 } 114 else if (ke.key == KTRL('X')) 110 115 { 111 116 cmd_insert(CMD_QUIT); 112 117 next = BIRTH_COMPLETE; 113 118 } 114 else if (strchr("Nn\r\n", ch)) 115 { 116 next = BIRTH_SEX_CHOICE; 117 } 118 else if (strchr("Yy", ch)) 119 else if (ke.key == 'C' || ke.key == 'c') 119 120 { 120 121 next = BIRTH_NAME_CHOICE; 121 122 } 122 else if (ch == '?') 123 (void)show_file("birth.hlp", NULL, 0, 0); 124 else 125 bell("Illegal answer!"); 126 } 123 else if (ke.key == 'Y' || ke.key == 'y') 124 { 125 cmd_insert(CMD_ACCEPT_CHARACTER); 126 next = BIRTH_COMPLETE; 127 } 128 } while (next == BIRTH_QUICKSTART); 129 130 /* Buttons */ 131 button_kill_all(); 132 redraw_stuff(); 133 134 /* Clear prompt */ 135 clear_from(23); 127 136 128 137 return next; 129 138 } 130 131 139 132 140 /* ------------------------------------------------------------------------ … … 405 413 ui_event_data cx; 406 414 407 enum birth_stage next = BIRTH_ METHOD_CHOICE;415 enum birth_stage next = BIRTH_RESET; 408 416 409 417 /* Print the question currently being asked. */ … … 413 421 current_menu->cmd_keys = "?=*\r\n\x18"; /* ?, ,= *, \n, <ctl-X> */ 414 422 415 while (next == BIRTH_ METHOD_CHOICE)423 while (next == BIRTH_RESET) 416 424 { 417 425 /* Display the menu, wait for a selection of some sort to be made. */ … … 770 778 if (ke.key == 'S' || ke.key == 's') 771 779 { 772 cmd_insert(CMD_BIRTH_RESET, TRUE); 773 next = BIRTH_METHOD_CHOICE; 780 next = BIRTH_RESET; 774 781 } 775 782 else if (ke.key == KTRL('X')) … … 818 825 errr get_birth_command(bool wait) 819 826 { 820 static enum birth_stage current_stage = BIRTH_ METHOD_CHOICE;827 static enum birth_stage current_stage = BIRTH_RESET; 821 828 static enum birth_stage prev; 822 static enum birth_stage roller = BIRTH_ METHOD_CHOICE;829 static enum birth_stage roller = BIRTH_RESET; 823 830 enum birth_stage next = current_stage; 824 831 825 832 switch (current_stage) 826 833 { 827 case BIRTH_ METHOD_CHOICE:828 { 829 cmd_insert(CMD_BIRTH_RESET );830 roller = BIRTH_ METHOD_CHOICE;834 case BIRTH_RESET: 835 { 836 cmd_insert(CMD_BIRTH_RESET, TRUE); 837 roller = BIRTH_RESET; 831 838 832 839 if (quickstart_allowed) 833 next = quickstart_question();840 next = BIRTH_QUICKSTART; 834 841 else 835 842 next = BIRTH_SEX_CHOICE; 836 843 844 break; 845 } 846 847 case BIRTH_QUICKSTART: 848 { 849 display_player(0); 850 next = get_quickstart_command(); 837 851 break; 838 852 } … … 875 889 next = current_stage - 1; 876 890 891 /* Make sure that the character gets reset before quickstarting */ 892 if (next == BIRTH_QUICKSTART) 893 next = BIRTH_RESET; 894 877 895 break; 878 896 }
