#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
+#include <stdarg.h>
#include "common.h"
#include "newdb.h"
#define GAMELIMIT 330 /* base limit of turns */
#define NOVICELIMIT 1000 /* limit of turns for novice */
#define WARNTIME 30 /* late game starts at game.limit-this */
+#define FLASHTIME 50 /*turns from first warning till blinding flash */
#define PANICTIME 15 /* time left after closing */
#define BATTERYLIFE 2500 /* turn limit increment from batteries */
struct game_t {
unsigned long lcg_a, lcg_c, lcg_m, lcg_x;
- long abbnum;
+ long abbnum; /* How often to print non-abbreviated descriptions */
long blklin;
long bonus;
long chloc;
long chloc2;
- long clock1;
- long clock2;
+ long clock1; /* # turns from finding last treasure till closing */
+ long clock2; /* # turns from first warning till blinding flash */
bool clshnt; /* has player read the clue in the endgame? */
bool closed; /* whether we're all the way closed */
bool closng; /* whether it's closing time yet */
- long conds;
+ long conds; /* min value for cond(loc) if loc has any hints */
long detail;
long dflag;
long dkill;
long dtotal;
- long foobar;
- long holdng;
- long iwest;
- long knfloc;
- long limit;
+ long foobar; /* current progress in saying "FEE FIE FOE FOO". */
+ long holdng; /* number of objects being carried */
+ long iwest; /* How many times he's said "west" instead of "w" */
+ long knfloc; /* 0 if no knife here, loc if knife , -1 after caveat */
+ long limit; /* lifetime of lamp (not set here) */
bool lmwarn; /* has player been warned about lamp going dim? */
long loc;
long newloc;
bool novice; /* asked for instructions at start-up? */
- long numdie;
+ long numdie; /* number of times killed so far */
long oldloc;
long oldlc2;
long oldobj;
bool panic; /* has player found out he's trapped in the cave? */
- long saved;
+ long saved; /* point penalty for saves */
long tally;
long thresh;
long trndex;
- long trnluz;
- long turns;
+ long trnluz; /* # points lost so far due to number of turns used */
+ long turns; /* how many commands he's given (ignores yes/no) */
bool wzdark; /* whether the loc he's leaving was dark */
long zzword;
bool blooded; /* has player drunk of dragon's blood? */
extern bool GETIN(FILE *, token_t*, token_t*, token_t*, token_t*);
extern void echo_input(FILE*, char*, char*);
extern char* get_input(void);
-extern bool YES(const char*, const char*, const char*);
+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 void JUGGLE(long);
-extern void MOVE(long, long);
-extern long PUT(long, long, long);
-extern void CARRY(long, long);
-extern void DROP(long, long);
-extern long ATDWRF(long);
-extern long SETBIT(long);
-extern bool TSTBIT(long, int);
-extern long RNDVOC(long, long);
+extern long vocab(long, long);
+extern void juggle(long);
+extern void move(long, long);
+extern long put(long, long, long);
+extern void carry(long, long);
+extern void drop(long, long);
+extern long atdwrf(long);
+extern long setbit(long);
+extern bool tstbit(long, int);
+extern long rndvoc(long, long);
extern bool MAPLIN(FILE *);
-extern void DATIME(long*, long*);
+extern void datime(long*, long*);
enum termination {endgame, quitgame, scoregame};
* 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 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 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 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 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 VOCWRD(LETTRS,SECT) (VOCAB(MAKEWD(LETTRS),SECT))
+#define VOCWRD(LETTRS,SECT) (vocab(MAKEWD(LETTRS),SECT))
#define SPECIAL(LOC) ((LOC) > SPECIALBASE)
#define OUTSID(LOC) (CNDBIT(LOC, COND_ABOVE) || FOREST(LOC))