| 33 | #endif |
| 34 | |
| 35 | int |
| 36 | main(void) |
| 37 | { |
| 38 | register int fd = -1; |
| 39 | int argc = 1; |
| 40 | boolean resuming = FALSE; /* assume new game */ |
| 41 | |
| 42 | early_init(); |
| 43 | windowprocs = mac_procs; |
| 44 | InitMac(); |
| 45 | |
| 46 | gh.hname = "Mac Hack"; |
| 47 | hackpid = getpid(); |
| 48 | |
| 49 | setrandom(); |
| 50 | initoptions(); |
| 51 | init_nhwindows(&argc, (char **) &gh.hname); |
| 52 | |
| 53 | /* |
| 54 | * It seems you really want to play. |
| 55 | */ |
| 56 | u.uhp = 1; /* prevent RIP on early quits */ |
| 57 | |
| 58 | finder_file_request(); |
| 59 | |
| 60 | dlb_init(); /* must be before newgame() */ |
| 61 | |
| 62 | /* |
| 63 | * Initialize the vision system. This must be before mklev() on a |
| 64 | * new game or before a level restore on a saved game. |
| 65 | */ |
| 66 | vision_init(); |
| 67 | |
| 68 | init_sound_disp_gamewindows(); |
| 69 | |
| 70 | set_playmode(); /* sets plname to "wizard" for wizard mode */ |
| 71 | /* strip role,race,&c suffix; calls askname() if plname[] is empty |
| 72 | or holds a generic user name like "player" or "games" */ |
| 73 | plnamesuffix(); |
| 74 | /* unlike Unix where the game might be invoked with a script |
| 75 | which forces a particular character name for each player |
| 76 | using a shared account, we always allow player to rename |
| 77 | the character during role/race/&c selection */ |
| 78 | iflags.renameallowed = TRUE; |
| 79 | |
| 80 | getlock(); |
| 81 | |
| 82 | /* |
| 83 | * First, try to find and restore a save file for specified character. |
| 84 | * We'll return here if new game player_selection() renames the hero. |
| 85 | */ |
| 86 | attempt_restore: |
| 87 | if ((fd = restore_saved_game()) >= 0) { |
| 88 | #ifdef NEWS |
| 89 | if (iflags.news) { |
| 90 | display_file(NEWS, FALSE); |
| 91 | iflags.news = FALSE; /* in case dorecover() fails */ |
| 92 | } |
no test coverage detected