-extern void score(long);
-
-/* vocabulary items */
-extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
- BIRD, BLOOD, BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST,
- CLAM, COINS, DOOR, DPRSSN, DRAGON, DWARF, EGGS,
- EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOD, GRATE, HINT, INVENT,
- JADE, KEYS, KNIFE, LAMP, LOCK, LOOK, MAGZIN, MESSAG, MIRROR, NUGGET, NUL,
- OGRE, OIL, OYSTER, PANIC, PEARL, PILLOW, PLANT, PLANT2, PYRAM,
- RESER, ROD, ROD2, RUBY, RUG, SAPPH, SAY, SCORE, SECT, SIGN, SNAKE,
- STEPS, STICK, STREAM, THROW, TRIDNT, TROLL, TROLL2,
- URN, VASE, VEND, VOLCAN, WATER;
-/* evrything else */
-extern long I, J, K, L, MAXDIE, SPK, V1, V2, VRSION, WD1, WD1X, WD2, WD2X;
+extern long score(enum termination);
+extern void terminate(enum termination) __attribute__((noreturn));
+extern int savefile(FILE *, long);
+extern int suspend(void);
+extern int resume(void);
+extern int restore(FILE *);
+
+/*
+ * MOD(N,M) = Arithmetic modulus
+ * AT(OBJ) = true if on either side of two-placed object
+ * CNDBIT(L,N) = true if COND(L) has bit n set (bit 0 is units bit)
+ * DARK(LOC) = true if location "LOC" is dark
+ * FORCED(LOC) = true if LOC moves without asking for input (COND=2)
+ * FOREST(LOC) = true if LOC is part of the forest
+ * GSTONE(OBJ) = true if OBJ is a gemstone
+ * HERE(OBJ) = true if the OBJ is at "LOC" (or is being carried)
+ * LIQUID() = object number of liquid in bottle
+ * LIQLOC(LOC) = object number of liquid (if any) at LOC
+ * PCT(N) = true N% of the time (N integer from 0 to 100)
+ * TOTING(OBJ) = true if the OBJ is being carried */
+
+#define DESTROY(N) move(N, LOC_NOWHERE)
+#define MOD(N,M) ((N) % (M))
+#define TOTING(OBJ) (game.place[OBJ] == CARRIED)
+#define AT(OBJ) (game.place[OBJ] == game.loc || game.fixed[OBJ] == game.loc)
+#define HERE(OBJ) (AT(OBJ) || TOTING(OBJ))
+#define LIQ2(PBOTL) ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL))
+#define LIQUID() (LIQ2(game.prop[BOTTLE]<0 ? -1-game.prop[BOTTLE] : game.prop[BOTTLE]))
+#define LIQLOC(LOC) (LIQ2((MOD(conditions[LOC]/2*2,8)-5)*MOD(conditions[LOC]/4,2)+1))
+#define CNDBIT(L,N) (tstbit(conditions[L],N))
+#define FORCED(LOC) CNDBIT(LOC, COND_FORCED)
+#define DARK(DUMMY) ((!tstbit(conditions[game.loc],COND_LIT)) && (game.prop[LAMP] == LAMP_DARK || !HERE(LAMP)))
+#define PCT(N) (randrange(100) < (N))
+#define GSTONE(OBJ) ((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
+#define FOREST(LOC) CNDBIT(LOC, COND_FOREST)
+#define SPECIAL(LOC) ((LOC) > SPECIALBASE)
+#define OUTSID(LOC) (CNDBIT(LOC, COND_ABOVE) || FOREST(LOC))
+
+#define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC))
+
+enum speechpart {unknown, intransitive, transitive};
+
+struct command_t {
+ enum speechpart part;
+ vocab_t verb;
+ vocab_t obj;
+ token_t wd1, wd1x;
+ token_t wd2, wd2x;
+};
+
+void initialise(void);
+int action(struct command_t *command);
+
+/* Phase codes for action returns.
+ * These were at one time FORTRAN line numbers.
+ * The values don't matter, but perturb their order at your peril.
+ */
+#define GO_TERMINATE 2
+#define GO_MOVE 8
+#define GO_TOP 2000
+#define GO_CLEAROBJ 2012
+#define GO_CHECKHINT 2600
+#define GO_CHECKFOO 2607
+#define GO_DIRECTION 2620
+#define GO_LOOKUP 2630
+#define GO_WORD2 2800
+#define GO_SPECIALS 1900
+#define GO_UNKNOWN 8000
+#define GO_ACTION 40000
+#define GO_DWARFWAKE 19000
+
+/* Special object statuses in game.place - can also be a location number (> 0) */
+#define CARRIED -1 /* Player is toting it */
+
+/* hack to ignore GCC Unused Result */
+#define IGNORE(r) do{if (r){}}while(0)
+
+/*
+ * FIXME: These constants should be replaced by strings, at their usage sites.
+ * They are sixbit-packed representations of vocabulary words. This, and code
+ * left in misc.c, is the only place left in the runtime that knows about
+ * word packing.
+ */
+#define WORD_CATCH 301200308
+#define WORD_GO 715
+#define WORD_POUR 16152118
+#define WORD_BACK 2010311
+#define WORD_CAVE 3012205
+#define WORD_DPRSSN 405161805
+#define WORD_ENTER 514200518
+#define WORD_ENTRNC 514201801
+#define WORD_LOOK 12151511
+#define WORD_NUL 14211212
+#define WORD_STREAM 1920180501
+#define WORD_FIND 6091404
+#define WORD_INVENT 914220514
+#define WORD_LOCK 12150311
+#define WORD_SAY 190125
+#define WORD_THROW 2008181523
+#define WORD_WEST 23051920
+#define WORD_YES 250519
+#define WORD_YINIT 25
+
+/* end */