| 45 | } |
| 46 | |
| 47 | staticfn void |
| 48 | moveloop_preamble(boolean resuming) |
| 49 | { |
| 50 | /* if a save file created in normal mode is now being restored in |
| 51 | explore mode, treat it as normal restore followed by 'X' command |
| 52 | to use up the save file and require confirmation for explore mode */ |
| 53 | if (resuming && iflags.deferred_X) |
| 54 | (void) enter_explore_mode(); |
| 55 | |
| 56 | /* side-effects from the real world */ |
| 57 | flags.moonphase = phase_of_the_moon(); |
| 58 | if (flags.moonphase == FULL_MOON) { |
| 59 | You("are lucky! Full moon tonight."); |
| 60 | change_luck(1); |
| 61 | } else if (flags.moonphase == NEW_MOON) { |
| 62 | pline("Be careful! New moon tonight."); |
| 63 | } |
| 64 | flags.friday13 = friday_13th(); |
| 65 | if (flags.friday13) { |
| 66 | pline("Watch out! Bad things can happen on Friday the 13th."); |
| 67 | change_luck(-1); |
| 68 | } |
| 69 | |
| 70 | if (!resuming) { /* new game */ |
| 71 | program_state.beyond_savefile_load = 1; /* for TTY_PERM_INVENT */ |
| 72 | svc.context.rndencode = rnd(9000); |
| 73 | set_wear((struct obj *) 0); /* for side-effects of starting gear */ |
| 74 | reset_justpicked(gi.invent); |
| 75 | (void) pickup(1); /* autopickup at initial location */ |
| 76 | /* only matters if someday a character is able to start with |
| 77 | clairvoyance (wizard with cornuthaum perhaps?); without this, |
| 78 | first "random" occurrence would always kick in on turn 1 */ |
| 79 | svc.context.seer_turn = (long) rnd(30); |
| 80 | /* give hero initial movement points; new game only--for restore, |
| 81 | pending movement points were included in the save file */ |
| 82 | u.umovement = NORMAL_SPEED; |
| 83 | initrack(); |
| 84 | } |
| 85 | disp.botlx = TRUE; /* for STATUS_HILITES */ |
| 86 | if (resuming) { /* restoring old game */ |
| 87 | read_engr_at(u.ux, u.uy); /* subset of pickup() */ |
| 88 | fix_shop_damage(); |
| 89 | } |
| 90 | |
| 91 | encumber_msg(); /* in case they auto-picked up something */ |
| 92 | if (gd.defer_see_monsters) { |
| 93 | gd.defer_see_monsters = FALSE; |
| 94 | see_monsters(); |
| 95 | } |
| 96 | |
| 97 | u.uz0.dlevel = u.uz.dlevel; |
| 98 | svc.context.move = 0; |
| 99 | |
| 100 | /* finish processing "--debug:fuzzer" from the command line */ |
| 101 | if (iflags.fuzzerpending) { |
| 102 | iflags.debug_fuzzer = fuzzer_impossible_panic; |
| 103 | iflags.fuzzerpending = FALSE; |
| 104 | } |
no test coverage detected