Changeset 1402

Show
Ignore:
Timestamp:
05/17/09 20:46:30 (16 months ago)
Author:
ajps
Message:

Change to quickstart to show the quickstarted character when giving the choice of quickstarting or not. Allows for a more educated choice by the player, and should save me 2 keystrokes every five or ten minutes I'm playing.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/ui-birth.c

    r1401 r1402  
    4646{ 
    4747        BIRTH_BACK = -1, 
    48         BIRTH_METHOD_CHOICE = 0, 
     48        BIRTH_RESET = 0, 
     49        BIRTH_QUICKSTART, 
    4950        BIRTH_SEX_CHOICE, 
    5051        BIRTH_RACE_CHOICE, 
     
    8384 * Quickstart? screen. 
    8485 * ------------------------------------------------------------------------ */ 
    85 static enum birth_stage quickstart_question(void) 
    86 { 
    87         char ch; 
     86static 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]"; 
    8889        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(); 
    105108                 
    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')) 
    110115                { 
    111116                        cmd_insert(CMD_QUIT); 
    112117                        next = BIRTH_COMPLETE; 
    113118                } 
    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') 
    119120                { 
    120121                        next = BIRTH_NAME_CHOICE; 
    121122                } 
    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); 
    127136 
    128137        return next; 
    129138} 
    130  
    131139 
    132140/* ------------------------------------------------------------------------ 
     
    405413        ui_event_data cx; 
    406414 
    407         enum birth_stage next = BIRTH_METHOD_CHOICE; 
     415        enum birth_stage next = BIRTH_RESET; 
    408416         
    409417        /* Print the question currently being asked. */ 
     
    413421        current_menu->cmd_keys = "?=*\r\n\x18";  /* ?, ,= *, \n, <ctl-X> */ 
    414422 
    415         while (next == BIRTH_METHOD_CHOICE) 
     423        while (next == BIRTH_RESET) 
    416424        { 
    417425                /* Display the menu, wait for a selection of some sort to be made. */ 
     
    770778        if (ke.key == 'S' || ke.key == 's') 
    771779        { 
    772                 cmd_insert(CMD_BIRTH_RESET, TRUE); 
    773                 next = BIRTH_METHOD_CHOICE; 
     780                next = BIRTH_RESET; 
    774781        } 
    775782        else if (ke.key == KTRL('X')) 
     
    818825errr get_birth_command(bool wait) 
    819826{ 
    820         static enum birth_stage current_stage = BIRTH_METHOD_CHOICE; 
     827        static enum birth_stage current_stage = BIRTH_RESET; 
    821828        static enum birth_stage prev; 
    822         static enum birth_stage roller = BIRTH_METHOD_CHOICE; 
     829        static enum birth_stage roller = BIRTH_RESET; 
    823830        enum birth_stage next = current_stage; 
    824831 
    825832        switch (current_stage) 
    826833        { 
    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; 
    831838                         
    832839                        if (quickstart_allowed) 
    833                                 next = quickstart_question(); 
     840                                next = BIRTH_QUICKSTART; 
    834841                        else 
    835842                                next = BIRTH_SEX_CHOICE; 
    836843 
     844                        break; 
     845                } 
     846 
     847                case BIRTH_QUICKSTART: 
     848                { 
     849                        display_player(0); 
     850                        next = get_quickstart_command(); 
    837851                        break; 
    838852                } 
     
    875889                                next = current_stage - 1; 
    876890 
     891                        /* Make sure that the character gets reset before quickstarting */ 
     892                        if (next == BIRTH_QUICKSTART)  
     893                                next = BIRTH_RESET; 
     894 
    877895                        break; 
    878896                }