vocab_t obj = command->obj;
int spk = actspk[verb];
if (obj == 0 || obj == INTRANSITIVE) {
- if (ATDWRF(game.loc) > 0)
+ if (atdwrf(game.loc) > 0)
obj = DWARF;
if (HERE(SNAKE))obj = obj * NOBJECTS + SNAKE;
if (AT(DRAGON) && game.prop[DRAGON] == 0)obj = obj * NOBJECTS + DRAGON;
if (obj == DRAGON)spk = ALREADY_DEAD;
if (obj == TROLL)spk = ROCKY_TROLL;
if (obj == OGRE)spk = OGRE_DODGE;
- if (obj == OGRE && ATDWRF(game.loc) > 0) {
+ if (obj == OGRE && atdwrf(game.loc) > 0) {
rspeak(spk);
rspeak(KNIFE_THROWN);
DESTROY(OGRE);
game.prop[DRAGON] = 1;
game.prop[RUG] = 0;
int k = (object_descriptions[DRAGON].plac + object_descriptions[DRAGON].fixd) / 2;
- MOVE(DRAGON + NOBJECTS, -1);
- MOVE(RUG + NOBJECTS, 0);
- MOVE(DRAGON, k);
- MOVE(RUG, k);
- DROP(BLOOD, k);
+ move(DRAGON + NOBJECTS, -1);
+ move(RUG + NOBJECTS, 0);
+ move(DRAGON, k);
+ move(RUG, k);
+ drop(BLOOD, k);
for (obj = 1; obj <= NOBJECTS; obj++) {
if (game.place[obj] == object_descriptions[DRAGON].plac || game.place[obj] == object_descriptions[DRAGON].fixd)
- MOVE(obj, k);
+ move(obj, k);
}
game.loc = k;
return GO_MOVE;
* Look up foo in section 3 of vocab to determine which word we've got. Last
* word zips the eggs back to the giant room (unless already there). */
{
- int k = VOCAB(foo, 3);
+ int k = vocab(foo, 3);
int spk = NOTHING_HAPPENS;
if (game.foobar != 1 - k) {
if (game.foobar != 0 && game.loc == LOC_GIANTROOM)spk = START_OVER;
k = 2;
if (HERE(EGGS))k = 1;
if (game.loc == object_descriptions[EGGS].plac)k = 0;
- MOVE(EGGS, object_descriptions[EGGS].plac);
+ move(EGGS, object_descriptions[EGGS].plac);
pspeak(EGGS, look, k);
return GO_CLEAROBJ;
}
if (verb == LOCK)spk = HUH_MAN;
if (spk == PEARL_FALLS) {
DESTROY(CLAM);
- DROP(OYSTER, game.loc);
- DROP(PEARL, LOC_CULDESAC);
+ drop(OYSTER, game.loc);
+ drop(PEARL, LOC_CULDESAC);
}
rspeak(spk);
return GO_CLEAROBJ;
int spk = actspk[verb];
if (obj == MIRROR)spk = TOO_FAR;
if (obj == VASE && game.prop[VASE] == 0) {
- if (TOTING(VASE))DROP(VASE, game.loc);
+ if (TOTING(VASE))drop(VASE, game.loc);
game.prop[VASE] = 2;
game.fixed[VASE] = -1;
spk = BREAK_VASE;
return GO_CLEAROBJ;
}
-static int carry(token_t verb, token_t obj)
+static int vcarry(token_t verb, token_t obj)
/* Carry an object. Special cases for bird and cage (if bird in cage, can't
* take one without the other). Liquids also special, since they depend on
* status of bottle. Also various side effects, etc. */
/* Carry, no object given yet. OK if only one object present. */
if (game.atloc[game.loc] == 0 ||
game.link[game.atloc[game.loc]] != 0 ||
- ATDWRF(game.loc) > 0)
+ atdwrf(game.loc) > 0)
return GO_UNKNOWN;
obj = game.atloc[game.loc];
}
game.prop[BIRD] = BIRD_CAGED;
}
if ((obj == BIRD || obj == CAGE) && (game.prop[BIRD] == BIRD_CAGED || -1 - game.prop[BIRD] == 1))
- CARRY(BIRD + CAGE - obj, game.loc);
- CARRY(obj, game.loc);
+ carry(BIRD + CAGE - obj, game.loc);
+ carry(obj, game.loc);
if (obj == BOTTLE && LIQUID() != 0)
game.place[LIQUID()] = CARRIED;
if (GSTONE(obj) && game.prop[obj] != 0) {
return GO_CLEAROBJ;
}
game.prop[CHAIN] = 2;
- if (TOTING(CHAIN))DROP(CHAIN, game.loc);
+ if (TOTING(CHAIN))drop(CHAIN, game.loc);
game.fixed[CHAIN] = -1;
}
rspeak(spk);
int k = 2 - game.prop[RUG];
game.prop[RUG] = k;
if (k == 2) k = object_descriptions[SAPPH].plac;
- MOVE(RUG + NOBJECTS, k);
+ move(RUG + NOBJECTS, k);
}
}
} else if (obj == COINS && HERE(VEND)) {
DESTROY(COINS);
- DROP(BATTERY, game.loc);
+ drop(BATTERY, game.loc);
pspeak(BATTERY, look, FRESH_BATTERIES);
return GO_CLEAROBJ;
} else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == 0) {
return GO_CLEAROBJ;
} else if (obj == BEAR && AT(TROLL)) {
rspeak(TROLL_SCAMPERS);
- MOVE(TROLL, 0);
- MOVE(TROLL + NOBJECTS, 0);
- MOVE(TROLL2, object_descriptions[TROLL].plac);
- MOVE(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
- JUGGLE(CHASM);
+ move(TROLL, 0);
+ move(TROLL + NOBJECTS, 0);
+ move(TROLL2, object_descriptions[TROLL].plac);
+ move(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
+ juggle(CHASM);
game.prop[TROLL] = 2;
} else if (obj != VASE || game.loc == object_descriptions[PILLOW].plac) {
rspeak(OK_MAN);
if (obj == BOTTLE && k != 0)
game.place[k] = LOC_NOWHERE;
if (obj == CAGE && game.prop[BIRD] == BIRD_CAGED)
- DROP(BIRD, game.loc);
- DROP(obj, game.loc);
+ drop(BIRD, game.loc);
+ drop(obj, game.loc);
if (obj != BIRD) return GO_CLEAROBJ;
game.prop[BIRD] = BIRD_UNCAGED;
if (FOREST(game.loc))
if (AT(obj) ||
(LIQUID() == obj && AT(BOTTLE)) ||
obj == LIQLOC(game.loc) ||
- (obj == DWARF && ATDWRF(game.loc) > 0))
+ (obj == DWARF && atdwrf(game.loc) > 0))
spk = YOU_HAVEIT;
if (game.closed)spk = NEEDED_NEARBY;
if (TOTING(obj))spk = ALREADY_CARRYING;
static int quit(void)
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
{
- if (YES(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
+ if (yes(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
terminate(quitgame);
return GO_CLEAROBJ;
}
if (DARK(game.loc)) {
rspeak(NO_SEE, command.wd1, command.wd1x);
} else if (command.obj == OYSTER && !game.clshnt && game.closed) {
- game.clshnt = YES(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
+ game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
} else if (object_descriptions[command.obj].texts[0] == NULL || game.prop[command.obj] < 0) {
rspeak(actspk[command.verb]);
} else
spk = PECULIAR_NOTHING;
if (obj == URN && game.prop[URN] == 2) {
DESTROY(URN);
- DROP(AMBER, game.loc);
+ drop(AMBER, game.loc);
game.prop[AMBER] = 1;
--game.tally;
- DROP(CAVITY, game.loc);
+ drop(CAVITY, game.loc);
spk = URN_GENIES;
}
rspeak(spk);
b = command->wd2x;
command->wd1 = command->wd2;
}
- int wd = VOCAB(command->wd1, -1);
+ int wd = vocab(command->wd1, -1);
/* FIXME: Magic numbers */
if (wd == 62 || wd == 65 || wd == 71 || wd == 2025 || wd == 2034) {
/* FIXME: scribbles on the interpreter's command block */
static int throw_support(long spk)
{
rspeak(spk);
- DROP(AXE, game.loc);
+ drop(AXE, game.loc);
return GO_MOVE;
}
if (object_descriptions[command->obj].is_treasure && AT(TROLL)) {
spk = TROLL_SATISFIED;
/* Snarf a treasure for the troll. */
- DROP(command->obj, 0);
- MOVE(TROLL, 0);
- MOVE(TROLL + NOBJECTS, 0);
- DROP(TROLL2, object_descriptions[TROLL].plac);
- DROP(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
- JUGGLE(CHASM);
+ drop(command->obj, 0);
+ move(TROLL, 0);
+ move(TROLL + NOBJECTS, 0);
+ drop(TROLL2, object_descriptions[TROLL].plac);
+ drop(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
+ juggle(CHASM);
rspeak(spk);
return GO_CLEAROBJ;
}
if (command->obj != AXE)
return (discard(command->verb, command->obj, false));
else {
- int i = ATDWRF(game.loc);
+ int i = atdwrf(game.loc);
if (i <= 0) {
if (AT(DRAGON) && game.prop[DRAGON] == 0)
return throw_support(DRAGON_SCALES);
return throw_support(OGRE_DODGE);
else if (HERE(BEAR) && game.prop[BEAR] == 0) {
/* This'll teach him to throw the axe at the bear! */
- DROP(AXE, game.loc);
+ drop(AXE, game.loc);
game.fixed[AXE] = -1;
game.prop[AXE] = 1;
- JUGGLE(BEAR);
+ juggle(BEAR);
rspeak(AXE_LOST);
return GO_CLEAROBJ;
}
if (HERE(BIRD))
spk = FREE_FLY + MOD(game.prop[BIRD], 2);
if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
- DROP(JADE, game.loc);
+ drop(JADE, game.loc);
game.prop[JADE] = 0;
--game.tally;
spk = NECKLACE_FLY;
if (game.loc == LOC_COBBLE || game.loc == LOC_DEBRIS || game.loc == LOC_AWKWARD ||
game.loc == LOC_BIRD || game.loc == LOC_PITTOP)
command->obj = ENTRNC;
- } else if (command->obj == DWARF && ATDWRF(game.loc) > 0)
+ } else if (command->obj == DWARF && atdwrf(game.loc) > 0)
/* FALL THROUGH */;
else if ((LIQUID() == command->obj && HERE(BOTTLE)) || command->obj == LIQLOC(game.loc))
/* FALL THROUGH */;
/* Analyse an intransitive verb (ie, no object given yet). */
switch (command->verb - 1) {
case 0: /* CARRY */
- return carry(command->verb, INTRANSITIVE);
+ return vcarry(command->verb, INTRANSITIVE);
case 1: /* DROP */
return GO_UNKNOWN;
case 2: /* SAY */
/* Analyse a transitive verb. */
switch (command->verb - 1) {
case 0: /* CARRY */
- return carry(command->verb, command->obj);
+ return vcarry(command->verb, command->obj);
case 1: /* DROP */
return discard(command->verb, command->obj, false);
case 2: /* SAY */
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))
* described last, we'll drop them first. */
for (int i = NOBJECTS; i >= 1; i--) {
if (object_descriptions[i].fixd > 0) {
- DROP(i + NOBJECTS, object_descriptions[i].fixd);
- DROP(i, object_descriptions[i].plac);
+ drop(i + NOBJECTS, object_descriptions[i].fixd);
+ drop(i, object_descriptions[i].plac);
}
}
int k = NOBJECTS + 1 - i;
game.fixed[k] = object_descriptions[k].fixd;
if (object_descriptions[k].plac != 0 && object_descriptions[k].fixd <= 0)
- DROP(k, object_descriptions[k].plac);
+ drop(k, object_descriptions[k].plac);
}
/* Treasure props are initially -1, and are set to 0 the first time
game.bonus = 0;
game.clock1 = WARNTIME;
game.clock2 = FLASHTIME;
- game.conds = SETBIT(11);
+ game.conds = setbit(11);
game.saved = 0;
game.closng = false;
game.panic = false;
initialise();
/* Start-up, dwarf stuff */
- game.zzword = RNDVOC(3, 0);
+ game.zzword = rndvoc(3, 0);
game.newloc = LOC_START;
game.loc = LOC_START;
game.limit = GAMELIMIT;
if (!rfp) {
- game.novice = YES(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
+ game.novice = yes(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
if (game.novice)
game.limit = NOVICELIMIT;
} else {
// autogenerated, so don't charge user time for it.
--game.turns;
// here we reconfigure any global game state that uses random numbers
- game.zzword = RNDVOC(3, 0);
+ game.zzword = rndvoc(3, 0);
return true;
}
return false;
break;
return;
case 8: /* ogre */
- i = ATDWRF(game.loc);
+ i = atdwrf(game.loc);
if (i < 0) {
game.hintlc[hint] = 0;
return;
/* Fall through to hint display */
game.hintlc[hint] = 0;
- if (!YES(hints[hint].question, arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN]))
+ if (!yes(hints[hint].question, arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN]))
return;
rspeak(HINT_COST, hints[hint].penalty, hints[hint].penalty);
- game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], hints[hint].hint, arbitrary_messages[OK_MAN]);
+ game.hinted[hint] = yes(arbitrary_messages[WANT_HINT], hints[hint].hint, arbitrary_messages[OK_MAN]);
if (game.hinted[hint] && game.limit > WARNTIME)
game.limit += WARNTIME * hints[hint].penalty;
}
/* Do things in this order (chest move before robbery) so chest is listed
* last at the maze location. */
if (movechest) {
- MOVE(CHEST, game.chloc);
- MOVE(MESSAG, game.chloc2);
+ move(CHEST, game.chloc);
+ move(MESSAG, game.chloc2);
game.dloc[PIRATE] = game.chloc;
game.odloc[PIRATE] = game.chloc;
game.dseen[PIRATE] = false;
continue;
if (!(treasure == PYRAMID && (game.loc == object_descriptions[PYRAMID].plac || game.loc == object_descriptions[EMERALD].plac))) {
if (AT(treasure) && game.fixed[treasure] == 0)
- CARRY(treasure, game.loc);
+ carry(treasure, game.loc);
if (TOTING(treasure))
- DROP(treasure, game.chloc);
+ drop(treasure, game.chloc);
}
}
}
game.odloc[i] = game.dloc[i];
}
rspeak(DWARF_RAN);
- DROP(AXE, game.loc);
+ drop(AXE, game.loc);
return true;
}
* death and exit. */
rspeak(DEATH_CLOSING);
terminate(endgame);
- } else if (game.numdie == NDEATHS || !YES(query, yes_response, arbitrary_messages[OK_MAN]))
+ } else if (game.numdie == NDEATHS || !yes(query, yes_response, arbitrary_messages[OK_MAN]))
terminate(endgame);
else {
game.place[WATER] = game.place[OIL] = LOC_NOWHERE;
int i = NOBJECTS + 1 - j;
if (TOTING(i)) {
/* Always leave lamp where it's accessible aboveground */
- DROP(i, (i == LAMP) ? LOC_START : game.oldlc2);
+ drop(i, (i == LAMP) ? LOC_START : game.oldlc2);
}
}
game.loc = LOC_BUILDING;
* special travel if toting it), so he's forced to use the
* plover-passage to get it out. Having dropped it, go back and
* pretend he wasn't carrying it after all. */
- DROP(EMERALD, game.loc);
+ drop(EMERALD, game.loc);
do {
if (TRAVEL[kk] < 0)
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
if (game.prop[TROLL] == 1) {
pspeak(TROLL,look, 1);
game.prop[TROLL] = 0;
- MOVE(TROLL2, 0);
- MOVE(TROLL2 + NOBJECTS, 0);
- MOVE(TROLL, object_descriptions[TROLL].plac);
- MOVE(TROLL + NOBJECTS, object_descriptions[TROLL].fixd);
- JUGGLE(CHASM);
+ move(TROLL2, 0);
+ move(TROLL2 + NOBJECTS, 0);
+ move(TROLL, object_descriptions[TROLL].plac);
+ move(TROLL + NOBJECTS, object_descriptions[TROLL].fixd);
+ juggle(CHASM);
game.newloc = game.loc;
return true;
} else {
rspeak(BRIDGE_COLLAPSE);
game.prop[CHASM] = 1;
game.prop[TROLL] = 2;
- DROP(BEAR, game.newloc);
+ drop(BEAR, game.newloc);
game.fixed[BEAR] = -1;
game.prop[BEAR] = 3;
game.oldlc2 = game.newloc;
game.dseen[i] = false;
game.dloc[i] = 0;
}
- MOVE(TROLL, 0);
- MOVE(TROLL + NOBJECTS, 0);
- MOVE(TROLL2, object_descriptions[TROLL].plac);
- MOVE(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
- JUGGLE(CHASM);
+ move(TROLL, 0);
+ move(TROLL + NOBJECTS, 0);
+ move(TROLL2, object_descriptions[TROLL].plac);
+ move(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
+ juggle(CHASM);
if (game.prop[BEAR] != 3)DESTROY(BEAR);
game.prop[CHAIN] = 0;
game.fixed[CHAIN] = 0;
* objects he might be carrying (lest he have some which
* could cause trouble, such as the keys). We describe the
* flash of light and trundle back. */
- game.prop[BOTTLE] = PUT(BOTTLE, LOC_NE, EMPTY_BOTTLE);
- game.prop[PLANT] = PUT(PLANT, LOC_NE, 0);
- game.prop[OYSTER] = PUT(OYSTER, LOC_NE, 0);
- game.prop[LAMP] = PUT(LAMP, LOC_NE, 0);
- game.prop[ROD] = PUT(ROD, LOC_NE, 0);
- game.prop[DWARF] = PUT(DWARF, LOC_NE, 0);
+ game.prop[BOTTLE] = put(BOTTLE, LOC_NE, EMPTY_BOTTLE);
+ game.prop[PLANT] = put(PLANT, LOC_NE, 0);
+ game.prop[OYSTER] = put(OYSTER, LOC_NE, 0);
+ game.prop[LAMP] = put(LAMP, LOC_NE, 0);
+ game.prop[ROD] = put(ROD, LOC_NE, 0);
+ game.prop[DWARF] = put(DWARF, LOC_NE, 0);
game.loc = LOC_NE;
game.oldloc = LOC_NE;
game.newloc = LOC_NE;
/* Leave the grate with normal (non-negative) property.
* Reuse sign. */
- PUT(GRATE, LOC_SW, 0);
- PUT(SIGN, LOC_SW, 0);
+ put(GRATE, LOC_SW, 0);
+ put(SIGN, LOC_SW, 0);
game.prop[SIGN] = ENDGAME_SIGN;
- game.prop[SNAKE] = PUT(SNAKE, LOC_SW, 1);
- game.prop[BIRD] = PUT(BIRD, LOC_SW, 1);
- game.prop[CAGE] = PUT(CAGE, LOC_SW, 0);
- game.prop[ROD2] = PUT(ROD2, LOC_SW, 0);
- game.prop[PILLOW] = PUT(PILLOW, LOC_SW, 0);
+ game.prop[SNAKE] = put(SNAKE, LOC_SW, 1);
+ game.prop[BIRD] = put(BIRD, LOC_SW, 1);
+ game.prop[CAGE] = put(CAGE, LOC_SW, 0);
+ game.prop[ROD2] = put(ROD2, LOC_SW, 0);
+ game.prop[PILLOW] = put(PILLOW, LOC_SW, 0);
- game.prop[MIRROR] = PUT(MIRROR, LOC_NE, 0);
+ game.prop[MIRROR] = put(MIRROR, LOC_NE, 0);
game.fixed[MIRROR] = LOC_SW;
for (int i = 1; i <= NOBJECTS; i++) {
rspeak(REPLACE_BATTERIES);
game.prop[BATTERY] = DEAD_BATTERIES;
if (TOTING(BATTERY))
- DROP(BATTERY, game.loc);
+ drop(BATTERY, game.loc);
game.limit += BATTERYLIFE;
game.lmwarn = false;
} else if (game.limit == 0) {
} else
lampcheck();
- V1 = VOCAB(command.wd1, -1);
- V2 = VOCAB(command.wd2, -1);
+ V1 = vocab(command.wd1, -1);
+ V2 = vocab(command.wd2, -1);
if (V1 == ENTER && (V2 == STREAM || V2 == 1000 + WATER)) {
if (LIQLOC(game.loc) == WATER) {
rspeak(FEET_WET);
rspeak(GO_UNNEEDED);
}
Lookup:
- defn = VOCAB(command.wd1, -1);
+ defn = vocab(command.wd1, -1);
if (defn == -1) {
/* Gee, I don't understand. */
if (fallback_handler(rawbuf))
return (input);
}
-bool YES(const char* question, const char* yes_response, const char* no_response)
+bool yes(const char* question, const char* yes_response, const char* no_response)
/* Print message X, wait for yes/no answer. If yes, print Y and return true;
* if no, print Z and return false. */
{
/* Data structure routines */
-long VOCAB(long id, long init)
+long vocab(long id, long init)
/* Look up ID in the vocabulary (ATAB) and return its "definition" (KTAB), or
* -1 if not found. If INIT is positive, this is an initialisation call setting
* up a keyword variable, and not finding it constitutes a bug. It also means
BUG(RAN_OFF_END_OF_VOCABULARY_TABLE);
}
-void JUGGLE(long object)
+void juggle(long object)
/* Juggle an object by picking it up and putting it down again, the purpose
* being to get the object to the front of the chain of things at its loc. */
{
i = game.place[object];
j = game.fixed[object];
- MOVE(object, i);
- MOVE(object + NOBJECTS, j);
+ move(object, i);
+ move(object + NOBJECTS, j);
}
-void MOVE(long object, long where)
+void move(long object, long where)
/* Place any object anywhere by picking it up and dropping it. May
* already be toting, in which case the carry is a no-op. Mustn't
* pick up objects which are not at any loc, since carry wants to
else
from = game.place[object];
if (from != LOC_NOWHERE && from != CARRIED && !SPECIAL(from))
- CARRY(object, from);
- DROP(object, where);
+ carry(object, from);
+ drop(object, where);
}
-long PUT(long object, long where, long pval)
+long put(long object, long where, long pval)
/* PUT is the same as MOVE, except it returns a value used to set up the
* negated game.prop values for the repository objects. */
{
- MOVE(object, where);
+ move(object, where);
return (-1) - pval;;
}
-void CARRY(long object, long where)
+void carry(long object, long where)
/* Start toting an object, removing it from the list of things at its former
* location. Incr holdng unless it was already being toted. If object>NOBJECTS
* (moving "fixed" second loc), don't change game.place or game.holdng. */
game.link[temp] = game.link[object];
}
-void DROP(long object, long where)
+void drop(long object, long where)
/* Place an object at a given loc, prefixing it onto the game.atloc list. Decr
* game.holdng if the object was being toted. */
{
game.atloc[where] = object;
}
-long ATDWRF(long where)
+long atdwrf(long where)
/* Return the index of first dwarf at the given location, zero if no dwarf is
* there (or if dwarves not active yet), -1 if all dwarves are dead. Ignore
* the pirate (6th dwarf). */
/* Utility routines (SETBIT, TSTBIT, set_seed, get_next_lcg_value,
* randrange, RNDVOC) */
-long SETBIT(long bit)
+long setbit(long bit)
/* Returns 2**bit for use in constructing bit-masks. */
{
return (1 << bit);
}
-bool TSTBIT(long mask, int bit)
+bool tstbit(long mask, int bit)
/* Returns true if the specified bit is set in the mask. */
{
return (mask & (1 << bit)) != 0;
return range * get_next_lcg_value() / game.lcg_m;
}
-long RNDVOC(long second, long force)
+long rndvoc(long second, long force)
/* Searches the vocabulary ATAB for a word whose second character is
* char, and changes that word such that each of the other four
* characters is a random letter. If force is non-zero, it is used
}
}
-void DATIME(long* d, long* t)
+void datime(long* d, long* t)
{
struct timeval tv;
gettimeofday(&tv, NULL);
FILE *fp = NULL;
rspeak(SUSPEND_WARNING);
- if (!YES(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ;
+ if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ;
game.saved = game.saved + 5;
while (fp == NULL) {
linenoiseFree(name);
}
- DATIME(&i, &k);
+ datime(&i, &k);
k = i + 650 * k;
save.savetime = k;
save.mode = -1;
if (game.loc != 1 || game.abbrev[1] != 1) {
rspeak(RESUME_ABANDON);
- if (!YES(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ;
+ if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ;
}
while (fp == NULL) {
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
} else {
memcpy(&game, &save.game, sizeof(struct game_t));
- game.zzword = RNDVOC(3, game.zzword);
+ game.zzword = rndvoc(3, game.zzword);
}
return GO_TOP;
}