static int fill(token_t, token_t);
-static void state_change(long obj, long state)
-{
- game.prop[obj] = state;
- pspeak(obj, change, state, true);
-}
-
static int attack(struct command_t *command)
/* Attack. Assume target if unambiguous. "Throw" also links here.
* Attackable objects fall into two categories: enemies (snake,
vocab_t verb = command->verb;
vocab_t obj = command->obj;
- long spk = actions[verb].message;
if (obj == NO_OBJECT ||
obj == INTRANSITIVE) {
int changes = 0;
}
if (changes >= 2)
return GO_UNKNOWN;
-
}
+
if (obj == BIRD) {
if (game.closed) {
rspeak(UNHAPPY_BIRD);
- return GO_CLEAROBJ;
+ } else {
+ DESTROY(BIRD);
+ rspeak(BIRD_DEAD);
}
- DESTROY(BIRD);
- spk = BIRD_DEAD;
- } else if (obj == VEND) {
+ return GO_CLEAROBJ;
+ }
+ if (obj == VEND) {
state_change(VEND,
game.prop[VEND] == VEND_BLOCKS ? VEND_UNBLOCKS : VEND_BLOCKS);
return GO_CLEAROBJ;
}
- if (obj == NO_OBJECT)
- spk = NO_TARGET;
- if (obj == CLAM ||
- obj == OYSTER)
- spk = SHELL_IMPERVIOUS;
- if (obj == SNAKE)
- spk = SNAKE_WARNING;
- if (obj == DWARF)
- spk = BARE_HANDS_QUERY;
- if (obj == DWARF && game.closed)
- return GO_DWARFWAKE;
- 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) {
- rspeak(spk);
- rspeak(KNIFE_THROWN);
- DESTROY(OGRE);
- int dwarves = 0;
- for (int i = 1; i < PIRATE; i++) {
- if (game.dloc[i] == game.loc) {
- ++dwarves;
- game.dloc[i] = LOC_LONGWEST;
- game.dseen[i] = false;
- }
- }
- spk = (dwarves > 1) ?
- OGRE_PANIC1 :
- OGRE_PANIC2;
- } else if (obj == BEAR) {
+ if (obj == BEAR) {
switch (game.prop[BEAR]) {
case UNTAMED_BEAR:
- spk = BEAR_HANDS;
+ rspeak(BEAR_HANDS);
break;
case SITTING_BEAR:
- spk = BEAR_CONFUSED;
+ rspeak(BEAR_CONFUSED);
break;
case CONTENTED_BEAR:
- spk = BEAR_CONFUSED;
+ rspeak(BEAR_CONFUSED);
break;
case BEAR_DEAD:
- spk = ALREADY_DEAD;
+ rspeak(ALREADY_DEAD);
break;
}
- } else if (obj == DRAGON && game.prop[DRAGON] == DRAGON_BARS) {
+ return GO_CLEAROBJ;
+ }
+ if (obj == DRAGON && game.prop[DRAGON] == DRAGON_BARS) {
/* Fun stuff for dragon. If he insists on attacking it, win!
* Set game.prop to dead, move dragon to central loc (still
* fixed), move rug there (not fixed), and move him there,
return GO_MOVE;
}
- rspeak(spk);
- return GO_CLEAROBJ;
-}
+ if (obj == OGRE) {
+ rspeak(OGRE_DODGE);
+ if (atdwrf(game.loc) == 0)
+ return GO_CLEAROBJ;
-static int bigwords(token_t foo)
-/* FEE FIE FOE FOO (AND FUM). Advance to next state if given in proper order.
- * Look up foo in special section of vocab to determine which word we've got.
- * Last word zips the eggs back to the giant room (unless already there). */
-{
- char word[TOKLEN + 1];
- packed_to_token(foo, word);
- int k = (int) get_special_vocab_id(word);
- if (game.foobar != 1 - k) {
- if (game.foobar != 0 && game.loc == LOC_GIANTROOM) {
- rspeak( START_OVER);
- } else {
- rspeak(NOTHING_HAPPENS);
+ rspeak(KNIFE_THROWN);
+ DESTROY(OGRE);
+ int dwarves = 0;
+ for (int i = 1; i < PIRATE; i++) {
+ if (game.dloc[i] == game.loc) {
+ ++dwarves;
+ game.dloc[i] = LOC_LONGWEST;
+ game.dseen[i] = false;
+ }
}
+ rspeak((dwarves > 1) ?
+ OGRE_PANIC1 :
+ OGRE_PANIC2);
return GO_CLEAROBJ;
- } else {
- game.foobar = k;
- if (k != 4) {
- rspeak(OK_MAN);
- return GO_CLEAROBJ;
- }
- game.foobar = 0;
- if (game.place[EGGS] == objects[EGGS].plac ||
- (TOTING(EGGS) && game.loc == objects[EGGS].plac)) {
- rspeak(NOTHING_HAPPENS);
- return GO_CLEAROBJ;
- } else {
- /* Bring back troll if we steal the eggs back from him before
- * crossing. */
- if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
- game.prop[TROLL] = TROLL_PAIDONCE;
- k = EGGS_DONE;
- if (HERE(EGGS))
- k = EGGS_VANISHED;
- if (game.loc == objects[EGGS].plac)
- k = EGGS_HERE;
- move(EGGS, objects[EGGS].plac);
- pspeak(EGGS, look, k, true);
- return GO_CLEAROBJ;
+ }
+
+ switch (obj) {
+ case NO_OBJECT:
+ rspeak(NO_TARGET);
+ break;
+ case CLAM:
+ case OYSTER:
+ rspeak(SHELL_IMPERVIOUS);
+ break;
+ case SNAKE:
+ rspeak(SNAKE_WARNING);
+ break;
+ case DWARF:
+ if (game.closed) {
+ return GO_DWARFWAKE;
}
+ rspeak(BARE_HANDS_QUERY);
+ break;
+ case DRAGON:
+ rspeak(ALREADY_DEAD);
+ break;
+ case TROLL:
+ rspeak(ROCKY_TROLL);
+ break;
+ default:
+ speak(actions[verb].message);
}
+ return GO_CLEAROBJ;
}
-static int bivalve(token_t verb, token_t obj)
-/* Clam/oyster actions */
+static int bigwords(long id)
+/* FEE FIE FOE FOO (AND FUM). Advance to next state if given in proper order.
+ * Look up foo in special section of vocab to determine which word we've got.
+ * Last word zips the eggs back to the giant room (unless already there). */
{
- bool is_oyster = (obj == OYSTER);
- if (verb == LOCK) {
- rspeak(HUH_MAN);
- return GO_CLEAROBJ;
- }
- if (!TOTING(TRIDENT)) {
- rspeak(is_oyster ?
- OYSTER_OPENER :
- CLAM_OPENER);
- return GO_CLEAROBJ;
+ if ((game.foobar == WORD_EMPTY && id == ACTION_WORD(FEE)) ||
+ (game.foobar == ACTION_WORD(FEE) && id == ACTION_WORD(FIE)) ||
+ (game.foobar == ACTION_WORD(FIE) && id == ACTION_WORD(FOE)) ||
+ (game.foobar == ACTION_WORD(FOE) && id == ACTION_WORD(FOO)) ||
+ (game.foobar == ACTION_WORD(FOE) && id == ACTION_WORD(FUM)))
+ {
+ game.foobar = id;
+ if ((id != ACTION_WORD(FOO)) && (id != ACTION_WORD(FUM))) {
+ rspeak(OK_MAN);
+ return GO_CLEAROBJ;
+ }
+ game.foobar = WORD_EMPTY;
+ if (game.place[EGGS] == objects[EGGS].plac ||
+ (TOTING(EGGS) && game.loc == objects[EGGS].plac)) {
+ rspeak(NOTHING_HAPPENS);
+ return GO_CLEAROBJ;
+ } else {
+ /* Bring back troll if we steal the eggs back from him before
+ * crossing. */
+ if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
+ game.prop[TROLL] = TROLL_PAIDONCE;
+ int k = EGGS_DONE;
+ if (HERE(EGGS))
+ k = EGGS_VANISHED;
+ if (game.loc == objects[EGGS].plac)
+ k = EGGS_HERE;
+ move(EGGS, objects[EGGS].plac);
+ pspeak(EGGS, look, k, true);
+ return GO_CLEAROBJ;
+ }
+ }
+ else
+ {
+ if (game.loc == LOC_GIANTROOM) {
+ rspeak(START_OVER);
+ } else {
+ /* This is new begavior in Open Adventure - sounds better when
+ * player isn't in the Giant Room. */
+ rspeak(WELL_POINTLESS);
+ }
+ game.foobar = WORD_EMPTY;
+ return GO_CLEAROBJ;
}
- if (TOTING(obj)) {
- rspeak( is_oyster ?
- DROP_OYSTER :
- DROP_CLAM);
- return GO_CLEAROBJ;
- }
-
- if (!is_oyster) {
- DESTROY(CLAM);
- drop(OYSTER, game.loc);
- drop(PEARL, LOC_CULDESAC);
- }
- rspeak(is_oyster ?
- OYSTER_OPENS :
- PEARL_FALLS);
- return GO_CLEAROBJ;
}
static void blast(void)
if (TOTING(VASE))
drop(VASE, game.loc);
state_change(VASE, VASE_BROKEN);
- game.fixed[VASE] = -1;
+ game.fixed[VASE] = IS_FIXED;
return GO_CLEAROBJ;
}
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return (GO_CLEAROBJ);
}
* take one without the other). Liquids also special, since they depend on
* status of bottle. Also various side effects, etc. */
{
- int spk;
if (obj == INTRANSITIVE) {
/* Carry, no object given yet. OK if only one object present. */
if (game.atloc[game.loc] == 0 ||
rspeak(ALREADY_CARRYING);
return GO_CLEAROBJ;
}
- spk = YOU_JOKING;
- if (obj == PLANT && game.prop[PLANT] <= 0)
- spk = DEEP_ROOTS;
- if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR)
- spk = BEAR_CHAINED;
- if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR)
- spk = STILL_LOCKED;
- if (obj == URN)
- spk = URN_NOBUDGE;
- if (obj == CAVITY)
- spk = DOUGHNUT_HOLES;
- if (obj == BLOOD)
- spk = FEW_DROPS;
- if (obj == RUG && game.prop[RUG] == RUG_HOVER)
- spk = RUG_HOVERS;
- if (obj == SIGN)
- spk = HAND_PASSTHROUGH;
+
if (obj == MESSAG) {
rspeak(REMOVE_MESSAGE);
DESTROY(MESSAG);
return GO_CLEAROBJ;
}
- if (game.fixed[obj] != 0) {
- rspeak(spk);
+
+ if (game.fixed[obj] != IS_FREE) {
+ /* Next guard tests whether plant is tiny or stashed */
+ if (obj == PLANT && game.prop[PLANT] <= PLANT_THIRSTY) {
+ rspeak(DEEP_ROOTS);
+ return GO_CLEAROBJ;
+ }
+ if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR) {
+ rspeak(BEAR_CHAINED);
+ return GO_CLEAROBJ;
+ }
+ if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR) {
+ rspeak(STILL_LOCKED);
+ return GO_CLEAROBJ;
+ }
+ if (obj == URN) {
+ rspeak(URN_NOBUDGE);
+ return GO_CLEAROBJ;
+ }
+ if (obj == CAVITY) {
+ rspeak(DOUGHNUT_HOLES);
+ return GO_CLEAROBJ;
+ }
+ if (obj == BLOOD) {
+ rspeak(FEW_DROPS);
+ return GO_CLEAROBJ;
+ }
+ if (obj == RUG && game.prop[RUG] == RUG_HOVER) {
+ rspeak(RUG_HOVERS);
+ return GO_CLEAROBJ;
+ }
+ if (obj == SIGN) {
+ rspeak(HAND_PASSTHROUGH);
+ return GO_CLEAROBJ;
+ }
+ rspeak(YOU_JOKING);
return GO_CLEAROBJ;
}
+
if (obj == WATER ||
obj == OIL) {
if (!HERE(BOTTLE) ||
LIQUID() != obj) {
- if (TOTING(BOTTLE) && game.prop[BOTTLE] == EMPTY_BOTTLE)
- return (fill(verb, BOTTLE));
- else {
- if (game.prop[BOTTLE] != EMPTY_BOTTLE)
- spk = BOTTLE_FULL;
- if (!TOTING(BOTTLE))
- spk = NO_CONTAINER;
- rspeak(spk);
+ if (TOTING(BOTTLE)) {
+ if (game.prop[BOTTLE] == EMPTY_BOTTLE) {
+ return (fill(verb, BOTTLE));
+ } else if (game.prop[BOTTLE] != EMPTY_BOTTLE)
+ rspeak(BOTTLE_FULL);
return GO_CLEAROBJ;
}
+ rspeak(NO_CONTAINER);
+ return GO_CLEAROBJ;
}
obj = BOTTLE;
}
- spk = CARRY_LIMIT;
if (game.holdng >= INVLIMIT) {
- rspeak(spk);
+ rspeak(CARRY_LIMIT);
return GO_CLEAROBJ;
- } else if (obj == BIRD && game.prop[BIRD] != BIRD_CAGED && -1 - game.prop[BIRD] != BIRD_CAGED) {
+
+ }
+
+ if (obj == BIRD && game.prop[BIRD] != BIRD_CAGED && STASHED(BIRD) != BIRD_CAGED) {
if (game.prop[BIRD] == BIRD_FOREST_UNCAGED) {
DESTROY(BIRD);
rspeak(BIRD_CRAP);
return GO_CLEAROBJ;
}
- if (!TOTING(CAGE))
- spk = CANNOT_CARRY;
- if (TOTING(ROD))
- spk = BIRD_EVADES;
- if (spk == CANNOT_CARRY ||
- spk == BIRD_EVADES) {
- rspeak(spk);
+ if (!TOTING(CAGE)) {
+ rspeak(CANNOT_CARRY);
+ return GO_CLEAROBJ;
+ }
+ if (TOTING(ROD)) {
+ rspeak(BIRD_EVADES);
return GO_CLEAROBJ;
}
game.prop[BIRD] = BIRD_CAGED;
}
- /* FIXME: Arithmetic on state numbers */
if ((obj == BIRD ||
obj == CAGE) &&
- (game.prop[BIRD] == BIRD_CAGED ||
- -1 - game.prop[BIRD] == 1))
+ (game.prop[BIRD] == BIRD_CAGED || STASHED(BIRD) == BIRD_CAGED))
+ /* expression maps BIRD to CAGE and CAGE to BIRD */
carry(BIRD + CAGE - obj, game.loc);
carry(obj, game.loc);
- if (obj == BOTTLE && LIQUID() != 0)
+ if (obj == BOTTLE && LIQUID() != NO_OBJECT)
game.place[LIQUID()] = CARRIED;
- if (GSTONE(obj) && game.prop[obj] != 0) {
- game.prop[obj] = STATE_GROUND;
+ if (GSTONE(obj) && game.prop[obj] != STATE_FOUND) {
+ game.prop[obj] = STATE_FOUND;
game.prop[CAVITY] = CAVITY_EMPTY;
}
rspeak(OK_MAN);
return GO_CLEAROBJ;
}
game.prop[CHAIN] = CHAIN_HEAP;
- game.fixed[CHAIN] = CHAIN_HEAP;
+ game.fixed[CHAIN] = IS_FREE;
if (game.prop[BEAR] != BEAR_DEAD)
game.prop[BEAR] = CONTENTED_BEAR;
switch (game.prop[BEAR]) {
case BEAR_DEAD:
- game.fixed[BEAR] = -1;
+ game.fixed[BEAR] = IS_FIXED;
break;
default:
- game.fixed[BEAR] = 0;
+ game.fixed[BEAR] = IS_FREE;
}
rspeak(CHAIN_UNLOCKED);
return GO_CLEAROBJ;
if (TOTING(CHAIN))
drop(CHAIN, game.loc);
- game.fixed[CHAIN] = -1;
+ game.fixed[CHAIN] = IS_FIXED;
rspeak(CHAIN_LOCKED);
return GO_CLEAROBJ;
* bird (might attack snake or dragon) and cage (might contain bird) and vase.
* Drop coins at vending machine for extra batteries. */
{
- int spk = actions[verb].message;
if (!just_do_it) {
if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))
obj = ROD2;
if (!TOTING(obj)) {
- rspeak(spk);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
if (obj == BIRD && HERE(SNAKE)) {
} else if ((GSTONE(obj) && AT(CAVITY) && game.prop[CAVITY] != CAVITY_FULL)) {
rspeak(GEM_FITS);
- game.prop[obj] = 1;
+ game.prop[obj] = STATE_IN_CAVITY;
game.prop[CAVITY] = CAVITY_FULL;
if (HERE(RUG) && ((obj == EMERALD && game.prop[RUG] != RUG_HOVER) ||
(obj == RUBY && game.prop[RUG] == RUG_HOVER))) {
- spk = RUG_RISES;
+ int spk = RUG_RISES;
if (TOTING(RUG))
spk = RUG_WIGGLES;
if (obj == RUBY)
rspeak(spk);
if (spk != RUG_WIGGLES) {
/* FIXME: Arithmetic on state numbers */
- int k = 2 - game.prop[RUG];
+ int k = (game.prop[RUG] == RUG_HOVER) ? RUG_FLOOR : RUG_HOVER;
game.prop[RUG] = k;
- if (k == 2)
+ if (k == RUG_HOVER)
k = objects[SAPPH].plac;
move(RUG + NOBJECTS, k);
}
game.loc == objects[PILLOW].plac) {
rspeak(OK_MAN);
} else {
- game.prop[VASE] = VASE_BROKEN;
- if (AT(PILLOW))
- game.prop[VASE] = VASE_WHOLE;
- pspeak(VASE, look, game.prop[VASE] + 1, true);
+ state_change(VASE, AT(PILLOW)
+ ? VASE_WHOLE
+ : VASE_DROPPED);
if (game.prop[VASE] != VASE_WHOLE)
- game.fixed[VASE] = -1;
+ game.fixed[VASE] = IS_FIXED;
}
}
int k = LIQUID();
if (k == obj)
obj = BOTTLE;
- if (obj == BOTTLE && k != 0)
+ if (obj == BOTTLE && k != NO_OBJECT)
game.place[k] = LOC_NOWHERE;
if (obj == CAGE && game.prop[BIRD] == BIRD_CAGED)
drop(BIRD, game.loc);
return GO_CLEAROBJ;
}
if (LIQUID() == WATER && HERE(BOTTLE)) {
- game.prop[BOTTLE] = EMPTY_BOTTLE;
game.place[WATER] = LOC_NOWHERE;
- rspeak(BOTTLE_EMPTY);
+ state_change(BOTTLE, EMPTY_BOTTLE);
return GO_CLEAROBJ;
}
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
rspeak(LOST_APPETITE);
return GO_CLEAROBJ;
}
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
return GO_CLEAROBJ;
}
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
/* Feed. If bird, no seed. Snake, dragon, troll: quip. If dwarf, make him
* mad. Bear, special. */
{
- int spk = actions[verb].message;
- if (obj == BIRD) {
+ switch (obj) {
+ case BIRD:
rspeak(BIRD_PINING);
- return GO_CLEAROBJ;
- } else if (obj == SNAKE ||
- obj == DRAGON ||
- obj == TROLL) {
- spk = NOTHING_EDIBLE;
- if (obj == DRAGON && game.prop[DRAGON] != DRAGON_BARS)
- spk = RIDICULOUS_ATTEMPT;
- if (obj == TROLL)
- spk = TROLL_VICES;
- if (obj == SNAKE && !game.closed && HERE(BIRD)) {
+ break;
+ case DRAGON:
+ if (game.prop[DRAGON] != DRAGON_BARS)
+ rspeak(RIDICULOUS_ATTEMPT);
+ else
+ rspeak(NOTHING_EDIBLE);
+ break;
+ case SNAKE:
+ if (!game.closed && HERE(BIRD)) {
DESTROY(BIRD);
- spk = BIRD_DEVOURED;
- }
- } else if (obj == DWARF) {
+ rspeak(BIRD_DEVOURED);
+ } else
+ rspeak(NOTHING_EDIBLE);
+ break;
+ case TROLL:
+ rspeak(TROLL_VICES);
+ break;
+ case DWARF:
if (HERE(FOOD)) {
game.dflag += 2;
- spk = REALLY_MAD;
+ rspeak(REALLY_MAD);
+ } else
+ speak(actions[verb].message);
+ break;
+ case BEAR:
+ if (game.prop[BEAR] == BEAR_DEAD) {
+ rspeak(RIDICULOUS_ATTEMPT);
+ break;
}
- } else if (obj == BEAR) {
- if (game.prop[BEAR] == UNTAMED_BEAR)
- spk = NOTHING_EDIBLE;
- if (game.prop[BEAR] == BEAR_DEAD)
- spk = RIDICULOUS_ATTEMPT;
- if (HERE(FOOD)) {
- DESTROY(FOOD);
- game.prop[BEAR] = SITTING_BEAR;
- game.fixed[AXE] = 0;
- game.prop[AXE] = 0;
- spk = BEAR_TAMED;
+ if (game.prop[BEAR] == UNTAMED_BEAR) {
+ if (HERE(FOOD)) {
+ DESTROY(FOOD);
+ game.fixed[AXE] = IS_FREE;
+ game.prop[AXE] = AXE_HERE;
+ state_change(BEAR, SITTING_BEAR);
+ } else
+ rspeak(NOTHING_EDIBLE);
+ break;
}
- } else if (obj == OGRE) {
+ speak(actions[verb].message);
+ break;
+ case OGRE:
if (HERE(FOOD))
- spk = OGRE_FULL;
- } else {
- spk = AM_GAME;
+ rspeak(OGRE_FULL);
+ else
+ speak(actions[verb].message);
+ break;
+ default:
+ rspeak(AM_GAME);
}
- rspeak(spk);
return GO_CLEAROBJ;
}
}
rspeak(SHATTER_VASE);
game.prop[VASE] = VASE_BROKEN;
- game.fixed[VASE] = -1;
- return (discard(verb, obj, true));
+ game.fixed[VASE] = IS_FIXED;
+ return (discard(verb, VASE, true));
}
if (obj == URN) {
return GO_CLEAROBJ;
}
if (obj != NO_OBJECT && obj != BOTTLE) {
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
if (obj == NO_OBJECT && !HERE(BOTTLE))
return GO_CLEAROBJ;
}
- game.prop[BOTTLE] = (LIQLOC(game.loc) == OIL) ? OIL_BOTTLE : WATER_BOTTLE;
+ state_change(BOTTLE, (LIQLOC(game.loc) == OIL)
+ ? OIL_BOTTLE
+ : WATER_BOTTLE);
if (TOTING(BOTTLE))
game.place[LIQUID()] = CARRIED;
- if (LIQUID() == OIL)
- rspeak(BOTTLED_OIL);
- else
- rspeak(BOTTLED_WATER);
return GO_CLEAROBJ;
}
}
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
}
if (obj != RUG) {
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
if (game.prop[RUG] != RUG_HOVER) {
}
game.oldlc2 = game.oldloc;
game.oldloc = game.loc;
- /* FIXME: Arithmetic on location values */
- game.newloc = game.place[RUG] + game.fixed[RUG] - game.loc;
- if (game.prop[SAPPH] >= 0) {
- rspeak(RUG_RETURNS);
- } else {
+ if (game.prop[SAPPH] == STATE_NOTFOUND) {
+ game.newloc = game.place[SAPPH];
rspeak(RUG_GOES);
+ } else {
+ game.newloc = LOC_CLIFF;
+ rspeak(RUG_RETURNS);
}
return GO_TERMINATE;
}
return GO_CLEAROBJ;
} else {
if (obj != LAMP) {
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
if (game.limit < 0) {
}
static int listen(void)
-/* Listen. Intransitive only. Print stuff based on objsnd/locsnd. */
+/* Listen. Intransitive only. Print stuff based on object sound proprties. */
{
long sound = locations[game.loc].sound;
if (sound != SILENT) {
long packed_zzword = token_to_packed(game.zzword);
pspeak(i, hear, mi, true, packed_zzword);
rspeak(NO_MESSAGE);
- /* FIXME: Magic number, sensitive to bird state logic */
- if (i == BIRD && game.prop[i] == 5)
+ if (i == BIRD && mi == BIRD_ENDSTATE)
DESTROY(BIRD);
return GO_CLEAROBJ;
}
switch (obj) {
case CLAM:
+ if (verb == LOCK)
+ rspeak(HUH_MAN);
+ else if (!TOTING(TRIDENT))
+ rspeak(OYSTER_OPENER);
+ else {
+ DESTROY(CLAM);
+ drop(OYSTER, game.loc);
+ drop(PEARL, LOC_CULDESAC);
+ rspeak(PEARL_FALLS);
+ }
+ return GO_CLEAROBJ;
case OYSTER:
- return bivalve(verb, obj);
+ if (verb == LOCK)
+ rspeak(HUH_MAN);
+ else
+ rspeak(OYSTER_OPENER);
+
+ return GO_CLEAROBJ;
case DOOR:
rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR);
break;
rspeak(CANNOT_UNLOCK);
break;
default:
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
}
return GO_CLEAROBJ;
if (obj == NO_OBJECT)
return GO_UNKNOWN;
if (!TOTING(obj)) {
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
}
}
if (!AT(DOOR)) {
if (obj == WATER) {
- /* cycle through the three plant states */
- state_change(PLANT, MOD(game.prop[PLANT] + 1, 3));
- game.prop[PLANT2] = game.prop[PLANT];
- return GO_MOVE;
+ /* cycle through the three plant states */
+ state_change(PLANT, MOD(game.prop[PLANT] + 1, 3));
+ game.prop[PLANT2] = game.prop[PLANT];
+ return GO_MOVE;
} else {
rspeak(SHAKING_LEAVES);
return GO_CLEAROBJ;
- }
+ }
} else {
state_change(DOOR, (obj == OIL) ?
DOOR_UNRUSTED :
game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
} else if (objects[command.obj].texts[0] == NULL ||
game.prop[command.obj] < 0) {
- rspeak(actions[command.verb].message);
+ speak(actions[command.verb].message);
} else
pspeak(command.obj, study, game.prop[command.obj], true);
return GO_CLEAROBJ;
rspeak(NOTHING_HAPPENS);
return GO_CLEAROBJ;
} else {
- /* FIXME: Arithmetic on state numbers */
- pspeak(RESER, look, game.prop[RESER] + 1, true);
- game.prop[RESER] = 1 - game.prop[RESER];
+ state_change(RESER,
+ game.prop[RESER] == WATERS_PARTED ? WATERS_UNPARTED : WATERS_PARTED);
if (AT(RESER))
return GO_CLEAROBJ;
else {
} else if (obj != LAMP) {
rspeak(PECULIAR_NOTHING);
} else {
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
}
return GO_CLEAROBJ;
}
char word1[TOKLEN + 1];
packed_to_token(command->wd1, word1);
int wd = (int) get_vocab_id(word1);
- /* FIXME: magic numbers */
if (wd == MOTION_WORD(XYZZY) ||
wd == MOTION_WORD(PLUGH) ||
wd == MOTION_WORD(PLOVER) ||
- wd == ACTION_WORD(GIANTWORDS) ||
+ wd == ACTION_WORD(FEE) ||
+ wd == ACTION_WORD(FIE) ||
+ wd == ACTION_WORD(FOE) ||
+ wd == ACTION_WORD(FOO) ||
+ wd == ACTION_WORD(FUM) ||
wd == ACTION_WORD(PART)) {
/* FIXME: scribbles on the interpreter's command block */
wordclear(&command->wd2);
* (Only way to do so!) Axe also special for dragon, bear, and
* troll. Treasures special for troll. */
{
- if (TOTING(ROD2) && command->obj == ROD && !TOTING(ROD))
- command->obj = ROD2;
if (!TOTING(command->obj)) {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
if (objects[command->obj].is_treasure && AT(TROLL)) {
else if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
/* This'll teach him to throw the axe at the bear! */
drop(AXE, game.loc);
- game.fixed[AXE] = -1;
+ game.fixed[AXE] = IS_FIXED;
juggle(BEAR);
state_change(AXE, AXE_LOST);
return GO_CLEAROBJ;
{
if (obj != DWARF ||
!game.closed) {
- rspeak(actions[verb].message);
+ speak(actions[verb].message);
return GO_CLEAROBJ;
} else {
rspeak(PROD_DWARF);
(!HERE(BIRD) &&
(game.closng ||
!AT(FISSURE)))) {
- rspeak(((!TOTING(obj)) && (obj != ROD ||
+ speak(((!TOTING(obj)) && (obj != ROD ||
!TOTING(ROD2))) ?
- ARENT_CARRYING :
+ arbitrary_messages[ARENT_CARRYING] :
actions[verb].message);
return GO_CLEAROBJ;
}
if (game.prop[BIRD] == BIRD_UNCAGED && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
drop(JADE, game.loc);
- game.prop[JADE] = 0;
+ game.prop[JADE] = STATE_FOUND;
--game.tally;
rspeak(NECKLACE_FLY);
return GO_CLEAROBJ;
CAGE_FLY :
FREE_FLY);
- /* FIXME: Arithemetic on property values */
- game.prop[FISSURE] = 1 - game.prop[FISSURE];
- pspeak(FISSURE, look, 2 - game.prop[FISSURE], true);
+ state_change(FISSURE,
+ game.prop[FISSURE] == BRIDGED ? UNBRIDGED : BRIDGED);
return GO_CLEAROBJ;
}
}
return GO_WORD2;
if (command->verb == SAY)
command->obj = command->wd2;
- if (command->obj == 0 ||
+ if (command->obj == NO_OBJECT ||
command->obj == INTRANSITIVE) {
/* Analyse an intransitive verb (ie, no object given yet). */
switch (command->verb) {
case TAME:
return GO_UNKNOWN;
case GO: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case ATTACK:
case SCORE:
score(scoregame);
return GO_CLEAROBJ;
- case GIANTWORDS:
- return bigwords(command->wd1);
+ case FEE:
+ case FIE:
+ case FOE:
+ case FOO:
+ case FUM:
+ return bigwords(command->id1);
case BRIEF:
return brief();
case READ:
case WAVE:
return wave(command->verb, command->obj);
case TAME: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case GO: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case ATTACK:
case THROW:
return throw (command);
case QUIT: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case FIND:
blast();
return GO_CLEAROBJ;
case SCORE: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
- case GIANTWORDS: {
- rspeak(actions[command->verb].message);
+ case FEE:
+ case FIE:
+ case FOE:
+ case FOO:
+ case FUM: {
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case BRIEF: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case READ:
case WAKE:
return wake(command->verb, command->obj);
case SAVE: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case RESUME: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case FLY:
return fly(command->verb, command->obj);
case LISTEN: {
- rspeak(actions[command->verb].message);
+ speak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case PART: