16 printf("Initialising...\n");
18 for (int i = 1; i <= NOBJECTS; i++) {
19 game.place[i] = LOC_NOWHERE;
21 game.link[i + NOBJECTS] = game.link[i] = 0;
24 for (int i = 1; i <= NLOCATIONS; i++) {
26 if (!(locations[i].description.big == 0 || KEY[i] == 0)) {
28 if (MOD(labs(TRAVEL[k]), 1000) == 1)
29 conditions[i] |= (1 << COND_FORCED);
34 /* Set up the game.atloc and game.link arrays.
35 * We'll use the DROP subroutine, which prefaces new objects on the
36 * lists. Since we want things in the other order, we'll run the
37 * loop backwards. If the object is in two locs, we drop it twice.
38 * This also sets up "game.place" and "fixed" as copies of "PLAC" and
39 * "FIXD". Also, since two-placed objects are typically best
40 * described last, we'll drop them first. */
41 for (int i = NOBJECTS; i >= 1; i--) {
42 if (object_descriptions[i].fixd > 0) {
43 DROP(i + NOBJECTS, object_descriptions[i].fixd);
44 DROP(i, object_descriptions[i].plac);
48 for (int i = 1; i <= NOBJECTS; i++) {
49 int k = NOBJECTS + 1 - i;
50 game.fixed[k] = object_descriptions[k].fixd;
51 if (object_descriptions[k].plac != 0 && object_descriptions[k].fixd <= 0)
52 DROP(k, object_descriptions[k].plac);
55 /* Treasure props are initially -1, and are set to 0 the first time
56 * they are described. game.tally keeps track of how many are
57 * not yet found, so we know when to close the cave. */
59 for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
60 if (object_descriptions[treasure].is_treasure) {
61 if (object_descriptions[treasure].inventory != 0)
62 game.prop[treasure] = -1;
63 game.tally = game.tally - game.prop[treasure];
67 /* Clear the hint stuff. game.hintlc[i] is how long he's been at LOC
68 * with cond bit i. game.hinted[i] is true iff hint i has been
70 for (int i = 0; i < NHINTS; i++) {
71 game.hinted[i] = false;
75 /* Define some handy mnemonics. These correspond to object numbers. */
76 AXE = VOCWRD(WORD_AXE, 1);
77 BATTERY = VOCWRD(WORD_BATTERY, 1);
78 BEAR = VOCWRD(WORD_BEAR, 1);
79 BIRD = VOCWRD(WORD_BIRD, 1);
80 BLOOD = VOCWRD(WORD_BLOOD, 1);
81 BOTTLE = VOCWRD(WORD_BOTTLE, 1);
82 CAGE = VOCWRD(WORD_CAGE, 1);
83 CAVITY = VOCWRD(WORD_CAVITY, 1);
84 CHASM = VOCWRD(WORD_CHASM, 1);
85 CLAM = VOCWRD(WORD_CLAM, 1);
86 DOOR = VOCWRD(WORD_DOOR, 1);
87 DRAGON = VOCWRD(WORD_DRAGON, 1);
88 DWARF = VOCWRD(WORD_DWARF, 1);
89 FISSURE = VOCWRD(WORD_FISSURE, 1);
90 FOOD = VOCWRD(WORD_FOOD, 1);
91 GRATE = VOCWRD(WORD_GRATE, 1);
92 KEYS = VOCWRD(WORD_KEYS, 1);
93 KNIFE = VOCWRD(WORD_KNIFE, 1);
94 LAMP = VOCWRD(WORD_LAMP, 1);
95 MAGAZINE = VOCWRD(WORD_MAGAZINE, 1);
96 MESSAG = VOCWRD(WORD_MESSAG, 1);
97 MIRROR = VOCWRD(WORD_MIRROR, 1);
98 OGRE = VOCWRD(WORD_OGRE, 1);
99 OIL = VOCWRD(WORD_OIL, 1);
100 OYSTER = VOCWRD(WORD_OYSTER, 1);
101 PILLOW = VOCWRD(WORD_PILLOW, 1);
102 PLANT = VOCWRD(WORD_PLANT, 1);
104 RESER = VOCWRD(WORD_RESER, 1);
105 ROD = VOCWRD(WORD_ROD, 1);
107 SIGN = VOCWRD(WORD_SIGN, 1);
108 SNAKE = VOCWRD(WORD_SNAKE, 1);
109 STEPS = VOCWRD(WORD_STEPS, 1);
110 TROLL = VOCWRD(WORD_TROLL, 1);
112 URN = VOCWRD(WORD_URN, 1);
113 VEND = VOCWRD(WORD_VEND, 1);
114 VOLCANO = VOCWRD(WORD_VOLCANO, 1);
115 WATER = VOCWRD(WORD_WATER, 1);
117 /* Vocabulary for treasures */
118 AMBER = VOCWRD(WORD_AMBER, 1);
119 CHAIN = VOCWRD(WORD_CHAIN, 1);
120 CHEST = VOCWRD(WORD_CHEST, 1);
121 COINS = VOCWRD(WORD_COINS, 1);
122 EGGS = VOCWRD(WORD_EGGS, 1);
123 EMERALD = VOCWRD(WORD_EMERALD, 1);
124 JADE = VOCWRD(WORD_JADE, 1);
125 NUGGET = VOCWRD(WORD_NUGGET, 1);
126 PEARL = VOCWRD(WORD_PEARL, 1);
127 PYRAMID = VOCWRD(WORD_PYRAMID, 1);
128 RUBY = VOCWRD(WORD_RUBY, 1);
129 RUG = VOCWRD(WORD_RUG, 1);
130 SAPPH = VOCWRD(WORD_SAPPH, 1);
131 TRIDENT = VOCWRD(WORD_TRIDENT, 1);
132 VASE = VOCWRD(WORD_VASE, 1);
134 /* These are motion-verb numbers. */
135 BACK = VOCWRD(WORD_BACK, 0);
136 CAVE = VOCWRD(WORD_CAVE, 0);
137 DPRSSN = VOCWRD(WORD_DPRSSN, 0);
138 ENTER = VOCWRD(WORD_ENTER, 0);
139 ENTRNC = VOCWRD(WORD_ENTRNC, 0);
140 LOOK = VOCWRD(WORD_LOOK, 0);
141 NUL = VOCWRD(WORD_NUL, 0);
142 STREAM = VOCWRD(WORD_STREAM, 0);
144 /* And some action verbs. */
145 FIND = VOCWRD(WORD_FIND, 2);
146 INVENT = VOCWRD(WORD_INVENT, 2);
147 LOCK = VOCWRD(WORD_LOCK, 2);
148 SAY = VOCWRD(WORD_SAY, 2);
149 THROW = VOCWRD(WORD_THROW, 2);
151 /* Initialise the dwarves. game.dloc is loc of dwarves,
152 * hard-wired in. game.odloc is prior loc of each dwarf,
153 * initially garbage. DALTLC is alternate initial loc for dwarf,
154 * in case one of them starts out on top of the adventurer. (No
155 * 2 of the 5 initial locs are adjacent.) game.dseen is true if
156 * dwarf has seen him. game.dflag controls the level of
157 * activation of all this:
158 * 0 No dwarf stuff yet (wait until reaches Hall Of Mists)
159 * 1 Reached Hall Of Mists, but hasn't met first dwarf
160 * 2 Met first dwarf, others start moving, no knives thrown yet
161 * 3 A knife has been thrown (first set always misses)
162 * 3+ Dwarves are mad (increases their accuracy)
163 * Sixth dwarf is special (the pirate). He always starts at his
164 * chest's eventual location inside the maze. This loc is saved
165 * in game.chloc for ref. the dead end in the other maze has its
166 * loc stored in game.chloc2. */
167 game.chloc = LOC_DEADEND12;
168 game.chloc2 = LOC_DEADEND13;
169 for (int i = 1; i <= NDWARVES; i++) {
170 game.dseen[i] = false;
173 game.dloc[1] = LOC_KINGHALL;
174 game.dloc[2] = LOC_WESTBANK;
175 game.dloc[3] = LOC_Y2;
176 game.dloc[4] = LOC_ALIKE3;
177 game.dloc[5] = LOC_COMPLEX;
178 game.dloc[6] = game.chloc;
192 game.clock1 = WARNTIME;
193 game.clock2 = FLASHTIME;
194 game.conds = SETBIT(11);