15 printf("Initialising...\n");
17 for (int i = 1; i <= NOBJECTS; i++) {
18 game.place[i] = LOC_NOWHERE;
20 game.link[i + NOBJECTS] = game.link[i] = 0;
23 for (int i = 1; i <= NLOCATIONS; i++) {
25 if (!(locations[i].description.big == 0 || tkey[i] == 0)) {
27 if (T_TERMINATE(travel[k]))
28 conditions[i] |= (1 << COND_FORCED);
33 /* Set up the game.atloc and game.link arrays.
34 * We'll use the DROP subroutine, which prefaces new objects on the
35 * lists. Since we want things in the other order, we'll run the
36 * loop backwards. If the object is in two locs, we drop it twice.
37 * This also sets up "game.place" and "fixed" as copies of "PLAC" and
38 * "FIXD". Also, since two-placed objects are typically best
39 * described last, we'll drop them first. */
40 for (int i = NOBJECTS; i >= 1; i--) {
41 if (objects[i].fixd > 0) {
42 drop(i + NOBJECTS, objects[i].fixd);
43 drop(i, objects[i].plac);
47 for (int i = 1; i <= NOBJECTS; i++) {
48 int k = NOBJECTS + 1 - i;
49 game.fixed[k] = objects[k].fixd;
50 if (objects[k].plac != 0 && objects[k].fixd <= 0)
51 drop(k, objects[k].plac);
54 /* Treasure props are initially -1, and are set to 0 the first time
55 * they are described. game.tally keeps track of how many are
56 * not yet found, so we know when to close the cave. */
58 for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
59 if (objects[treasure].is_treasure) {
60 if (objects[treasure].inventory != 0)
61 game.prop[treasure] = -1;
62 game.tally = game.tally - game.prop[treasure];
66 /* Clear the hint stuff. game.hintlc[i] is how long he's been at LOC
67 * with cond bit i. game.hinted[i] is true iff hint i has been
69 for (int i = 0; i < NHINTS; i++) {
70 game.hinted[i] = false;
74 /* Initialise the dwarves. game.dloc is loc of dwarves,
75 * hard-wired in. game.odloc is prior loc of each dwarf,
76 * initially garbage. DALTLC is alternate initial loc for dwarf,
77 * in case one of them starts out on top of the adventurer. (No
78 * 2 of the 5 initial locs are adjacent.) game.dseen is true if
79 * dwarf has seen him. game.dflag controls the level of
80 * activation of all this:
81 * 0 No dwarf stuff yet (wait until reaches Hall Of Mists)
82 * 1 Reached Hall Of Mists, but hasn't met first dwarf
83 * 2 Met first dwarf, others start moving, no knives thrown yet
84 * 3 A knife has been thrown (first set always misses)
85 * 3+ Dwarves are mad (increases their accuracy)
86 * Sixth dwarf is special (the pirate). He always starts at his
87 * chest's eventual location inside the maze. This loc is saved
88 * in game.chloc for ref. the dead end in the other maze has its
89 * loc stored in game.chloc2. */
90 game.chloc = LOC_DEADEND12;
91 game.chloc2 = LOC_DEADEND13;
92 for (int i = 1; i <= NDWARVES; i++) {
93 game.dseen[i] = false;
96 game.dloc[1] = LOC_KINGHALL;
97 game.dloc[2] = LOC_WESTBANK;
98 game.dloc[3] = LOC_Y2;
99 game.dloc[4] = LOC_ALIKE3;
100 game.dloc[5] = LOC_COMPLEX;
101 game.dloc[6] = game.chloc;
115 game.clock1 = WARNTIME;
116 game.clock2 = FLASHTIME;
117 game.conds = setbit(11);