Show
Ignore:
Timestamp:
08/19/07 12:46:27 (1 year ago)
Author:
ajps
Message:

First stages of new game command interface thing. Seems to work OK on Windows and Linux, will have broken mac, ros, etc.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main-win.c

    r529 r538  
    661661}; 
    662662 
     663#include "game-cmd.h" 
     664 
     665static game_command cmd = { CMD_NULL, 0 }; 
     666 
    663667#if 0 
    664668/* 
     
    29462950        /* Next arg */ 
    29472951        p = strchr(s, ' '); 
    2948  
     2952         
    29492953        /* Tokenize */ 
    29502954        if (p) *p = '\0'; 
     
    29562960        validate_file(savefile); 
    29572961 
    2958         /* Game in progress */ 
    2959         game_in_progress = TRUE; 
    2960  
    2961         Term_fresh(); 
    2962  
    2963         /* Play game */ 
    2964         play_game(FALSE); 
    2965  
    2966         /* Quit */ 
    2967         quit(NULL); 
     2962        /* Set the command now so that we skip the "Open File" prompt. */ 
     2963        cmd.command = CMD_LOADFILE; 
    29682964} 
    29692965 
     
    31593155                        else 
    31603156                        { 
    3161                                 game_in_progress = TRUE; 
    3162                                 Term_flush(); 
    3163                                 play_game(TRUE); 
    3164                                 quit(NULL); 
     3157                                /* We'll return NEWGAME to the game. */ 
     3158                                cmd.command = CMD_NEWGAME; 
    31653159                        } 
    31663160                        break; 
     
    31943188                                        /* Load 'savefile' */ 
    31953189                                        validate_file(savefile); 
    3196                                         game_in_progress = TRUE; 
    3197                                         Term_flush(); 
    3198                                         play_game(FALSE); 
    3199                                         quit(NULL); 
     3190 
     3191                                        /* We'll return NEWGAME to the game. */ 
     3192                                        cmd.command = CMD_LOADFILE; 
    32003193                                } 
    32013194                        } 
     
    45544547 
    45554548        exit(0); 
     4549} 
     4550 
     4551 
     4552static game_command get_init_cmd() 
     4553{ 
     4554        MSG msg; 
     4555 
     4556        /* Prompt the user */ 
     4557        prt("[Choose 'New' or 'Open' from the 'File' menu]", 23, 17); 
     4558        Term_fresh(); 
     4559 
     4560        /* Process messages forever */ 
     4561        while (cmd.command == CMD_NULL && GetMessage(&msg, NULL, 0, 0)) 
     4562        { 
     4563                TranslateMessage(&msg); 
     4564                DispatchMessage(&msg); 
     4565        } 
     4566 
     4567        /* Bit of a hack, we'll do this when we leave the INIT context in future. */ 
     4568        game_in_progress = TRUE; 
     4569 
     4570        return cmd; 
    45564571} 
    45574572 
     
    47094724        WNDCLASS wc; 
    47104725        HDC hdc; 
    4711         MSG msg; 
    47124726 
    47134727        /* Unused parameter */ 
     
    48434857        ANGBAND_SYS = "win"; 
    48444858 
    4845         /* Initialize */ 
    4846         init_angband(); 
    4847  
    4848         /* We are now initialized */ 
    4849         initialized = TRUE; 
    4850  
    48514859#ifdef USE_SAVER 
    48524860        if (screensaver) 
     
    48704878        check_for_save_file(lpCmdLine); 
    48714879 
    4872         /* Prompt the user */ 
    4873         prt("[Choose 'New' or 'Open' from the 'File' menu]", 23, 17)
    4874         Term_fresh(); 
    4875  
    4876         /* Process messages forever */ 
    4877         while (GetMessage(&msg, NULL, 0, 0)) 
    4878         { 
    4879                 TranslateMessage(&msg); 
    4880                DispatchMessage(&msg); 
    4881         } 
     4880        /* Set command hook */ 
     4881        get_game_command = get_init_cmd
     4882 
     4883        /* Set up the display handlers and things. */ 
     4884        init_display(); 
     4885 
     4886        initialized = TRUE; 
     4887 
     4888        /* Play the game */ 
     4889        play_game(); 
    48824890 
    48834891        /* Paranoia */