No need to tease with excluded options
[open-adventure.git] / advent.h
index 77c8079e6160ead8a349ae39d268f8ba9e975fe4..e89b2ad3b00b156b0103ff5ec224a6ef7e382790 100644 (file)
--- a/advent.h
+++ b/advent.h
@@ -1,20 +1,22 @@
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <stdbool.h>
 
 #include "common.h"
 
 #define LINESIZE       100
 #include <stdbool.h>
 
 #include "common.h"
 
 #define LINESIZE       100
-#define NDWARVES       6
+#define NDWARVES       6               /* number of dwarves */
 #define PIRATE         NDWARVES        /* must be NDWARVES-1 when zero-origin */
 #define DALTLC         LOC_NUGGET      /* alternate dwarf location */
 #define PIRATE         NDWARVES        /* must be NDWARVES-1 when zero-origin */
 #define DALTLC         LOC_NUGGET      /* alternate dwarf location */
-#define MINTRS         50
-#define MAXTRS         79
-#define MAXPARMS       25
-#define INVLIMIT       7
+#define MINTRS         50              /* index of lowest reasure */
+#define MAXTRS         79              /* index of highest reasure */
+#define MAXPARMS       25              /* Max parameters for speak() */
+#define INVLIMIT       7               /* inverntory limit (# of objects) */
 #define INTRANSITIVE   -1              /* illegal object number */
 #define SPECIALBASE    300             /* base number of special rooms */
 #define WARNTIME       30              /* late game starts at game.limit-this */
 #define PANICTIME      15              /* time left after closing */
 #define INTRANSITIVE   -1              /* illegal object number */
 #define SPECIALBASE    300             /* base number of special rooms */
 #define WARNTIME       30              /* late game starts at game.limit-this */
 #define PANICTIME      15              /* time left after closing */
+#define BATTERYLIFE    2500            /* turn limit increment from batteries */
 
 typedef long token_t;  /* word token - someday this will be char[TOKLEN+1] */
 typedef long vocab_t;  /* index into a vocabulary array */
 
 typedef long token_t;  /* word token - someday this will be char[TOKLEN+1] */
 typedef long vocab_t;  /* index into a vocabulary array */
@@ -83,6 +85,7 @@ extern bool oldstyle, editline, prompt;
 /* b is not needed for POSIX but harmless */
 #define READ_MODE "rb"
 #define WRITE_MODE "wb"
 /* b is not needed for POSIX but harmless */
 #define READ_MODE "rb"
 #define WRITE_MODE "wb"
+extern void* xmalloc(size_t size);
 extern char* xstrdup(const char*);
 extern void packed_to_token(long, char token[]);
 extern void speak(const char*);
 extern char* xstrdup(const char*);
 extern void packed_to_token(long, char token[]);
 extern void speak(const char*);
@@ -90,7 +93,9 @@ extern void PSPEAK(vocab_t,int);
 extern void RSPEAK(vocab_t);
 extern void SETPRM(long,long,long);
 extern bool GETIN(FILE *,token_t*,token_t*,token_t*,token_t*);
 extern void RSPEAK(vocab_t);
 extern void SETPRM(long,long,long);
 extern bool GETIN(FILE *,token_t*,token_t*,token_t*,token_t*);
-extern long YES(FILE *,vocab_t,vocab_t,vocab_t);
+extern void echo_input(FILE*, char*, char*);
+extern char* get_input(void);
+extern bool YES(const char*, const char*, const char*);
 extern long GETTXT(bool,bool,bool);
 extern token_t MAKEWD(long);
 extern long VOCAB(long,long);
 extern long GETTXT(bool,bool,bool);
 extern token_t MAKEWD(long);
 extern long VOCAB(long,long);
@@ -103,7 +108,6 @@ extern long ATDWRF(long);
 extern long SETBIT(long);
 extern bool TSTBIT(long,int);
 extern long RNDVOC(long,long);
 extern long SETBIT(long);
 extern bool TSTBIT(long,int);
 extern long RNDVOC(long,long);
-extern void BUG(long) __attribute__((noreturn));
 extern bool MAPLIN(FILE *);
 extern void DATIME(long*, long*);
 
 extern bool MAPLIN(FILE *);
 extern void DATIME(long*, long*);
 
@@ -114,8 +118,8 @@ extern unsigned long get_next_lcg_value(void);
 extern long randrange(long);
 extern long score(enum termination);
 extern void terminate(enum termination) __attribute__((noreturn));
 extern long randrange(long);
 extern long score(enum termination);
 extern void terminate(enum termination) __attribute__((noreturn));
-extern int suspend(FILE *);
-extern int resume(FILE *);
+extern int suspend(void);
+extern int resume(void);
 extern int restore(FILE *);
 
 /*
 extern int restore(FILE *);
 
 /*
@@ -144,7 +148,7 @@ extern int restore(FILE *);
 #define FORCED(LOC)    (COND[LOC] == 2)
 #define DARK(DUMMY)    ((!CNDBIT(game.loc,LIGHT)) && (game.prop[LAMP] == 0 || !HERE(LAMP)))
 #define PCT(N)         (randrange(100) < (N))
 #define FORCED(LOC)    (COND[LOC] == 2)
 #define DARK(DUMMY)    ((!CNDBIT(game.loc,LIGHT)) && (game.prop[LAMP] == 0 || !HERE(LAMP)))
 #define PCT(N)         (randrange(100) < (N))
-#define GSTONE(OBJ)    ((OBJ) == EMRALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
+#define GSTONE(OBJ)    ((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
 #define FOREST(LOC)    ((LOC) >= LOC_FOREST1 && (LOC) <= LOC_FOREST22)
 #define VOCWRD(LETTRS,SECT)    (VOCAB(MAKEWD(LETTRS),SECT))
 #define SPECIAL(LOC)   ((LOC) > SPECIALBASE)
 #define FOREST(LOC)    ((LOC) >= LOC_FOREST1 && (LOC) <= LOC_FOREST22)
 #define VOCWRD(LETTRS,SECT)    (VOCAB(MAKEWD(LETTRS),SECT))
 #define SPECIAL(LOC)   ((LOC) > SPECIALBASE)
@@ -159,15 +163,15 @@ extern int restore(FILE *);
 #define INDEEP(LOC)    ((LOC) >= LOC_MISTHALL && !OUTSID(LOC) && (LOC) != LOC_FOOF1)
 
 /* vocabulary items */ 
 #define INDEEP(LOC)    ((LOC) >= LOC_MISTHALL && !OUTSID(LOC) && (LOC) != LOC_FOOF1)
 
 /* vocabulary items */ 
-extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
+extern long AMBER, ATTACK, AXE, BACK, BATTERY, BEAR,
    BIRD, BLOOD, BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST,
    CLAM, COINS, DOOR, DPRSSN, DRAGON, DWARF, EGGS,
    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,
+   EMERALD, ENTER, ENTRNC, FIND, FISSURE, FOOD, GRATE, HINT, INVENT,
+   JADE, KEYS, KNIFE, LAMP, LOCK, LOOK, MAGAZINE, MESSAG, MIRROR, NUGGET, NUL,
+   OGRE, OIL, OYSTER, PANIC, PEARL, PILLOW, PLANT, PLANT2, PYRAMID,
    RESER, ROD, ROD2, RUBY, RUG, SAPPH, SAY, SIGN, SNAKE,
    RESER, ROD, ROD2, RUBY, RUG, SAPPH, SAY, SIGN, SNAKE,
-   STEPS, STICK, STREAM, THROW, TRIDNT, TROLL, TROLL2,
-   URN, VASE, VEND, VOLCAN, WATER;
+   STEPS, STICK, STREAM, THROW, TRIDENT, TROLL, TROLL2,
+   URN, VASE, VEND, VOLCANO, WATER;
 
 enum speechpart {unknown, intransitive, transitive};
 
 
 enum speechpart {unknown, intransitive, transitive};
 
@@ -184,7 +188,6 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj);
 #define GO_CLEAROBJ    2012
 #define GO_CHECKHINT   2600
 #define GO_CHECKFOO    2607
 #define GO_CLEAROBJ    2012
 #define GO_CHECKHINT   2600
 #define GO_CHECKFOO    2607
-#define GO_CLOSEJUMP   2610
 #define GO_DIRECTION   2620
 #define GO_LOOKUP      2630
 #define GO_WORD2       2800
 #define GO_DIRECTION   2620
 #define GO_LOOKUP      2630
 #define GO_WORD2       2800