vocab_t verb = command->verb;
vocab_t obj = command->obj;
- if (obj == INTRANSITIVE) {
- return GO_UNKNOWN;
- }
long spk = actions[verb].message;
if (obj == NO_OBJECT || obj == INTRANSITIVE) {
int changes = 0;
static int bivalve(token_t verb, token_t obj)
/* Clam/oyster actions */
{
- int spk;
bool is_oyster = (obj == OYSTER);
- spk = is_oyster ? OYSTER_OPENS : PEARL_FALLS;
- if (TOTING(obj))
- spk = is_oyster ? DROP_OYSTER : DROP_CLAM;
- if (!TOTING(TRIDENT))
- spk = is_oyster ? OYSTER_OPENER : CLAM_OPENER;
- if (verb == LOCK)
- spk = HUH_MAN;
- if (spk == PEARL_FALLS) {
+ if (verb == LOCK) {
+ rspeak(HUH_MAN);
+ return GO_CLEAROBJ;
+ }
+ if (!TOTING(TRIDENT)) {
+ rspeak(is_oyster ? OYSTER_OPENER : CLAM_OPENER);
+ 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(spk);
+ rspeak(is_oyster ? OYSTER_OPENS : PEARL_FALLS);
return GO_CLEAROBJ;
}
/* Eat. Intransitive: assume food if present, else ask what. Transitive: food
* ok, some things lose appetite, rest are ridiculous. */
{
- int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (!HERE(FOOD))
return GO_UNKNOWN;
DESTROY(FOOD);
- spk = THANKS_DELICIOUS;
- } else {
- if (obj == FOOD) {
- DESTROY(FOOD);
- spk = THANKS_DELICIOUS;
- }
- if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj ==
- DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj ==
- OGRE)
- spk = LOST_APPETITE;
+ rspeak(THANKS_DELICIOUS);
+ return GO_CLEAROBJ;
}
- rspeak(spk);
+ if (obj == FOOD) {
+ DESTROY(FOOD);
+ rspeak(THANKS_DELICIOUS);
+ return GO_CLEAROBJ;
+ }
+ if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj ==
+ DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj ==
+ OGRE) {
+ rspeak(LOST_APPETITE);
+ return GO_CLEAROBJ;
+ }
+ rspeak(actions[verb].message);
return GO_CLEAROBJ;
}
static int fly(token_t verb, token_t obj)
/* Fly. Snide remarks unless hovering rug is here. */
{
- int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
- if (game.prop[RUG] != RUG_HOVER)
- spk = RUG_NOTHING2;
- if (!HERE(RUG))
- spk = FLAP_ARMS;
- if (spk == RUG_NOTHING2 || spk == FLAP_ARMS) {
- rspeak(spk);
+ if (!HERE(RUG)) {
+ rspeak(FLAP_ARMS);
+ return GO_CLEAROBJ;
+ }
+ if (game.prop[RUG] != RUG_HOVER) {
+ rspeak(RUG_NOTHING2);
return GO_CLEAROBJ;
}
obj = RUG;
}
if (obj != RUG) {
- rspeak(spk);
+ rspeak(actions[verb].message);
return GO_CLEAROBJ;
}
- spk = RUG_NOTHING1;
if (game.prop[RUG] != RUG_HOVER) {
- rspeak(spk);
+ rspeak(RUG_NOTHING1);
return GO_CLEAROBJ;
}
game.oldlc2 = game.oldloc;
game.oldloc = game.loc;
/* FIXME: Arithmetic on location values */
game.newloc = game.place[RUG] + game.fixed[RUG] - game.loc;
- spk = RUG_GOES;
- if (game.prop[SAPPH] >= 0)
- spk = RUG_RETURNS;
- rspeak(spk);
+
+ if (game.prop[SAPPH] >= 0) {
+ rspeak(RUG_RETURNS);
+ } else {
+ rspeak(RUG_GOES);
+ }
return GO_TERMINATE;
}
static int listen(void)
/* Listen. Intransitive only. Print stuff based on objsnd/locsnd. */
{
- long k;
- int spk = ALL_SILENT;
- k = locations[game.loc].sound;
- if (k != SILENT) {
- rspeak(k);
- if (locations[game.loc].loud)
- return GO_CLEAROBJ;
- else
- spk = NO_MESSAGE;
+ long sound = locations[game.loc].sound;
+ if (sound != SILENT) {
+ rspeak(sound);
+ if (!locations[game.loc].loud)
+ rspeak(NO_MESSAGE);
+ return GO_CLEAROBJ;
}
for (int i = 1; i <= NOBJECTS; i++) {
if (!HERE(i) || objects[i].sounds[0] == NULL || game.prop[i] < 0)
mi += 3 * game.blooded;
long packed_zzword = token_to_packed(game.zzword);
pspeak(i, hear, mi, true, packed_zzword);
- spk = NO_MESSAGE;
+ rspeak(NO_MESSAGE);
/* FIXME: Magic number, sensitive to bird state logic */
if (i == BIRD && game.prop[i] == 5)
DESTROY(BIRD);
+ return GO_CLEAROBJ;
}
- rspeak(spk);
+ rspeak(ALL_SILENT);
return GO_CLEAROBJ;
}
static int lock(token_t verb, token_t obj)
/* Lock, unlock, no object given. Assume various things if present. */
{
- int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
- spk = NOTHING_LOCKED;
if (HERE(CLAM))
obj = CLAM;
if (HERE(OYSTER))
if (HERE(CHAIN))
obj = CHAIN;
if (obj == NO_OBJECT || obj == INTRANSITIVE) {
- rspeak(spk);
+ rspeak(NOTHING_LOCKED);
return GO_CLEAROBJ;
}
}
/* Lock, unlock object. Special stuff for opening clam/oyster
* and for chain. */
+ int spk = actions[verb].message;
if (obj == CLAM || obj == OYSTER)
return bivalve(verb, obj);
if (obj == DOOR)
- spk = RUSTY_DOOR;
- if (obj == DOOR && game.prop[DOOR] == DOOR_UNRUSTED)
- spk = OK_MAN;
+ spk = (game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR;
if (obj == CAGE)
spk = NO_LOCK;
if (obj == KEYS)
/* Pour. If no object, or object is bottle, assume contents of bottle.
* special tests for pouring water or oil on plant or rusty door. */
{
- int spk = actions[verb].message;
if (obj == BOTTLE || obj == NO_OBJECT)
obj = LIQUID();
if (obj == NO_OBJECT)
return GO_UNKNOWN;
if (!TOTING(obj)) {
- rspeak(spk);
+ rspeak(actions[verb].message);
return GO_CLEAROBJ;
}
- spk = CANT_POUR;
+
if (obj != OIL && obj != WATER) {
- rspeak(spk);
+ rspeak(CANT_POUR);
return GO_CLEAROBJ;
}
if (HERE(URN) && game.prop[URN] == URN_EMPTY)
return fill(verb, URN);
game.prop[BOTTLE] = EMPTY_BOTTLE;
game.place[obj] = LOC_NOWHERE;
- spk = GROUND_WET;
if (!(AT(PLANT) || AT(DOOR))) {
- rspeak(spk);
+ rspeak(GROUND_WET);
return GO_CLEAROBJ;
}
if (!AT(DOOR)) {
- spk = SHAKING_LEAVES;
if (obj != WATER) {
- rspeak(spk);
+ rspeak(SHAKING_LEAVES);
return GO_CLEAROBJ;
}
pspeak(PLANT, look, game.prop[PLANT] + 3, true);
static int wave(token_t verb, token_t obj)
/* Wave. No effect unless waving rod at fissure or at bird. */
{
- int spk = actions[verb].message;
- if ((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2)))
- spk = ARENT_CARRYING;
if (obj != ROD ||
!TOTING(obj) ||
(!HERE(BIRD) && (game.closng || !AT(FISSURE)))) {
- rspeak(spk);
+ rspeak(((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2))) ? ARENT_CARRYING : actions[verb].message);
return GO_CLEAROBJ;
}
- /* FIXME: Arithemetic on property values */
- if (HERE(BIRD))
- spk = FREE_FLY + MOD(game.prop[BIRD], 2);
- if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
+
+ if (game.prop[BIRD] == BIRD_UNCAGED && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
drop(JADE, game.loc);
game.prop[JADE] = 0;
--game.tally;
- spk = NECKLACE_FLY;
- rspeak(spk);
+ rspeak(NECKLACE_FLY);
return GO_CLEAROBJ;
} else {
if (game.closed) {
- rspeak(spk);
+ rspeak((game.prop[BIRD] == BIRD_CAGED) ? CAGE_FLY : FREE_FLY);
return GO_DWARFWAKE;
}
if (game.closng || !AT(FISSURE)) {
- rspeak(spk);
+ rspeak((game.prop[BIRD] == BIRD_CAGED) ? CAGE_FLY : FREE_FLY);
return GO_CLEAROBJ;
}
if (HERE(BIRD))
- rspeak(spk);
+ rspeak((game.prop[BIRD] == BIRD_CAGED) ? CAGE_FLY : FREE_FLY);
+
+ /* FIXME: Arithemetic on property values */
game.prop[FISSURE] = 1 - game.prop[FISSURE];
pspeak(FISSURE, look, 2 - game.prop[FISSURE], true);
return GO_CLEAROBJ;
* unless verb is "say", which snarfs arbitrary second word.
*/
{
- token_t spk = actions[command->verb].message;
-
if (command->part == unknown) {
/* Analyse an object word. See if the thing is here, whether
* we've got a verb yet, and so on. Object must be here
/* FALL THROUGH */;
} else if (command->obj == KNIFE && game.knfloc == game.loc) {
game.knfloc = -1;
- spk = KNIVES_VANISH;
- rspeak(spk);
+ rspeak(KNIVES_VANISH);
return GO_CLEAROBJ;
} else if (command->obj == ROD && HERE(ROD2)) {
command->obj = ROD2;
case TAME:
return GO_UNKNOWN;
case GO: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case ATTACK:
case WAVE:
return wave(command->verb, command->obj);
case TAME: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case GO: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case ATTACK:
case THROW:
return throw (command);
case QUIT: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case FIND:
blast();
return GO_CLEAROBJ;
case SCORE: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case GIANTWORDS: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case BRIEF: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case READ:
case WAKE:
return wake(command->verb, command->obj);
case SAVE: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case RESUME: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case FLY:
return fly(command->verb, command->obj);
case LISTEN: {
- rspeak(spk);
+ rspeak(actions[command->verb].message);
return GO_CLEAROBJ;
}
case PART: