obj = DWARF;
if (HERE(SNAKE))
obj = obj * NOBJECTS + SNAKE;
- if (AT(DRAGON) && game.prop[DRAGON] == 0)
+ if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS)
obj = obj * NOBJECTS + DRAGON;
if (AT(TROLL))
obj = obj * NOBJECTS + TROLL;
}
}
spk = (dwarves > 1) ? OGRE_PANIC1 : OGRE_PANIC2;
- } else if (obj == BEAR)
- /* FIXME: Arithmetic on message numbers */
- spk = BEAR_HANDS + (game.prop[BEAR] + 1) / 2;
- else if (obj == DRAGON && game.prop[DRAGON] == 0) {
+ } else if (obj == BEAR) {
+ switch (game.prop[BEAR]) {
+ case UNTAMED_BEAR:
+ spk = BEAR_HANDS;
+ break;
+ case SITTING_BEAR:
+ spk = BEAR_CONFUSED;
+ break;
+ case CONTENTED_BEAR:
+ spk = BEAR_CONFUSED;
+ break;
+ case BEAR_DEAD:
+ spk = ALREADY_DEAD;
+ break;
+ }
+ } else 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,
command->wd1 = token_to_packed("N");
return GO_CHECKFOO;
}
- pspeak(DRAGON, look, 3);
- game.prop[DRAGON] = 1;
- game.prop[RUG] = 0;
+ state_change(DRAGON, DRAGON_DEAD);
+ game.prop[RUG] = RUG_FLOOR;
+ /* FIXME: Arithmetic on location values */
int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
move(DRAGON + NOBJECTS, -1);
move(RUG + NOBJECTS, 0);
} 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] == 0)
- game.prop[TROLL] = 1;
- k = 2;
+ 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 = 1;
+ k = EGGS_VANISHED;
if (game.loc == objects[EGGS].plac)
- k = 0;
+ k = EGGS_HERE;
move(EGGS, objects[EGGS].plac);
pspeak(EGGS, look, k);
return GO_CLEAROBJ;
static int vbreak(token_t verb, token_t obj)
/* Break. Only works for mirror in repository and, of course, the vase. */
{
- int spk = actions[verb].message;
- if (obj == MIRROR)
- spk = TOO_FAR;
- if (obj == VASE && game.prop[VASE] == 0) {
- if (TOTING(VASE))
- drop(VASE, game.loc);
- game.prop[VASE] = 2;
- game.fixed[VASE] = -1;
- spk = BREAK_VASE;
- } else {
- if (obj == MIRROR && game.closed) {
+ if (obj == MIRROR) {
+ if (game.closed) {
rspeak(BREAK_MIRROR);
return GO_DWARFWAKE;
+ } else {
+ rspeak(TOO_FAR);
+ return GO_CLEAROBJ;
}
}
- rspeak(spk);
- return GO_CLEAROBJ;
+ if (obj == VASE && game.prop[VASE] == VASE_WHOLE) {
+ if (TOTING(VASE))
+ drop(VASE, game.loc);
+ state_change(VASE, VASE_BROKEN);
+ game.fixed[VASE] = -1;
+ return GO_CLEAROBJ;
+ }
+ rspeak(actions[verb].message);
+ return (GO_CLEAROBJ);
}
static int brief(void)
spk = DOUGHNUT_HOLES;
if (obj == BLOOD)
spk = FEW_DROPS;
- if (obj == RUG && game.prop[RUG] == 2)
+ if (obj == RUG && game.prop[RUG] == RUG_HOVER)
spk = RUG_HOVERS;
if (obj == SIGN)
spk = HAND_PASSTHROUGH;
spk = CHAIN_UNLOCKED;
if (game.prop[BEAR] == UNTAMED_BEAR)
spk = BEAR_BLOCKS;
- if (game.prop[CHAIN] == 0)
+ if (game.prop[CHAIN] == CHAIN_HEAP)
spk = ALREADY_UNLOCKED;
if (spk != CHAIN_UNLOCKED) {
rspeak(spk);
return GO_CLEAROBJ;
}
- game.prop[CHAIN] = 0;
- game.fixed[CHAIN] = 0;
+ game.prop[CHAIN] = CHAIN_HEAP;
+ game.fixed[CHAIN] = CHAIN_HEAP;
if (game.prop[BEAR] != BEAR_DEAD)
game.prop[BEAR] = CONTENTED_BEAR;
/* FIXME: Arithmetic on state numbers */
game.fixed[BEAR] = 2 - game.prop[BEAR];
} else {
spk = CHAIN_LOCKED;
- if (game.prop[CHAIN] != 0)
+ if (game.prop[CHAIN] != CHAIN_HEAP)
spk = ALREADY_LOCKED;
if (game.loc != objects[CHAIN].plac)
spk = NO_LOCKSITE;
rspeak(spk);
return GO_CLEAROBJ;
}
- game.prop[CHAIN] = 2;
+ game.prop[CHAIN] = CHAIN_FIXED;
if (TOTING(CHAIN))
drop(CHAIN, game.loc);
game.fixed[CHAIN] = -1;
rspeak(GEM_FITS);
game.prop[obj] = 1;
game.prop[CAVITY] = CAVITY_FULL;
- if (HERE(RUG) && ((obj == EMERALD && game.prop[RUG] != 2) || (obj == RUBY &&
- game.prop[RUG] == 2))) {
+ if (HERE(RUG) && ((obj == EMERALD && game.prop[RUG] != RUG_HOVER) || (obj == RUBY &&
+ game.prop[RUG] == RUG_HOVER))) {
spk = RUG_RISES;
if (TOTING(RUG))
spk = RUG_WIGGLES;
spk = RUG_SETTLES;
rspeak(spk);
if (spk != RUG_WIGGLES) {
+ /* FIXME: Arithmetic on state numbers */
int k = 2 - game.prop[RUG];
game.prop[RUG] = k;
if (k == 2)
drop(BATTERY, game.loc);
pspeak(BATTERY, look, FRESH_BATTERIES);
return GO_CLEAROBJ;
- } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == 0) {
+ } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
rspeak(BIRD_BURNT);
DESTROY(BIRD);
return GO_CLEAROBJ;
move(TROLL2, objects[TROLL].plac);
move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
juggle(CHASM);
- game.prop[TROLL] = 2;
+ game.prop[TROLL] = TROLL_GONE;
} else if (obj != VASE || game.loc == objects[PILLOW].plac) {
rspeak(OK_MAN);
} else {
- game.prop[VASE] = 2;
+ game.prop[VASE] = VASE_BROKEN;
if (AT(PILLOW))
- game.prop[VASE] = 0;
+ game.prop[VASE] = VASE_WHOLE;
pspeak(VASE, look, game.prop[VASE] + 1);
- if (game.prop[VASE] != 0)
+ if (game.prop[VASE] != VASE_WHOLE)
game.fixed[VASE] = -1;
}
}
game.place[WATER] = LOC_NOWHERE;
spk = BOTTLE_EMPTY;
}
+ rspeak(spk);
} else {
DESTROY(BLOOD);
- game.prop[DRAGON] = 2;
+ state_change(DRAGON, DRAGON_BLOODLESS);
game.blooded = true;
- spk = HEAD_BUZZES;
}
- rspeak(spk);
return GO_CLEAROBJ;
}
static int extinguish(token_t verb, int obj)
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
{
- int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
obj = LAMP;
- if (HERE(URN) && game.prop[URN] == 2)
- obj = obj * NOBJECTS + URN;
- if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
+ if (HERE(URN) && game.prop[URN] == URN_LIT)
+ obj = URN;
+ if (obj == INTRANSITIVE ||
+ HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT &&
+ HERE(URN) && game.prop[URN] == URN_LIT)
return GO_UNKNOWN;
}
if (obj == URN) {
- game.prop[URN] = game.prop[URN] / 2;
- spk = URN_DARK;
+ if (game.prop[URN] != URN_EMPTY) {
+ state_change(URN, URN_DARK);
+ } else {
+ pspeak(URN, change, URN_DARK);
+ }
+
} else if (obj == LAMP) {
state_change(LAMP, LAMP_DARK);
- spk = DARK(game.loc) ? PITCH_DARK : NO_MESSAGE;
- } else if (obj == DRAGON || obj == VOLCANO)
- spk = BEYOND_POWER;
- rspeak(spk);
+ rspeak(DARK(game.loc) ? PITCH_DARK : NO_MESSAGE);
+ } else if (obj == DRAGON || obj == VOLCANO) {
+ rspeak(BEYOND_POWER);
+
+ } else {
+ rspeak(actions[verb].message);
+ }
return GO_CLEAROBJ;
}
return GO_CLEAROBJ;
} else if (obj == SNAKE || obj == DRAGON || obj == TROLL) {
spk = NOTHING_EDIBLE;
- if (obj == DRAGON && game.prop[DRAGON] != 0)
+ if (obj == DRAGON && game.prop[DRAGON] != DRAGON_BARS)
spk = RIDICULOUS_ATTEMPT;
if (obj == TROLL)
spk = TROLL_VICES;
return GO_CLEAROBJ;
}
rspeak(SHATTER_VASE);
- game.prop[VASE] = 2;
+ game.prop[VASE] = VASE_BROKEN;
game.fixed[VASE] = -1;
return (discard(verb, obj, true));
} else if (obj == URN) {
{
int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
- if (game.prop[RUG] != 2)
+ if (game.prop[RUG] != RUG_HOVER)
spk = RUG_NOTHING2;
if (!HERE(RUG))
spk = FLAP_ARMS;
return GO_CLEAROBJ;
}
spk = RUG_NOTHING1;
- if (game.prop[RUG] != 2) {
+ if (game.prop[RUG] != RUG_HOVER) {
rspeak(spk);
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)
static int light(token_t verb, token_t obj)
/* Light. Applicable only to lamp and urn. */
{
- int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
obj = LAMP;
- if (HERE(URN) && game.prop[URN] == 1)
- obj = obj * NOBJECTS + URN;
- if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
+ if (HERE(URN) && game.prop[URN] == URN_DARK)
+ obj = URN;
+ if (obj == INTRANSITIVE ||
+ HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 &&
+ HERE(URN) && game.prop[URN] == URN_DARK)
return GO_UNKNOWN;
}
if (obj == URN) {
- if (game.prop[URN] == 0) {
- rspeak(URN_EMPTY);
- } else {
- game.prop[URN] = 2;
- rspeak(URN_LIT);
- }
+ state_change(URN, game.prop[URN] == URN_EMPTY ? URN_EMPTY : URN_LIT);
return GO_CLEAROBJ;
} else {
if (obj != LAMP) {
- rspeak(spk);
+ rspeak(actions[verb].message);
return GO_CLEAROBJ;
}
- spk = LAMP_OUT;
if (game.limit < 0) {
- rspeak(spk);
+ rspeak(LAMP_OUT);
return GO_CLEAROBJ;
}
state_change(LAMP, LAMP_BRIGHT);
obj = DOOR;
if (AT(GRATE))
obj = GRATE;
- if (obj != 0 && HERE(CHAIN))
- return GO_UNKNOWN;
if (HERE(CHAIN))
obj = CHAIN;
if (obj == 0 || obj == INTRANSITIVE) {
game.prop[PLANT2] = game.prop[PLANT];
return GO_MOVE;
} else {
- game.prop[DOOR] = 0;
- if (obj == OIL)
- game.prop[DOOR] = 1;
- spk = RUSTED_HINGES + game.prop[DOOR];
- rspeak(spk);
+ state_change(DOOR, (obj == OIL) ? DOOR_UNRUSTED : DOOR_RUSTED);
return GO_CLEAROBJ;
}
}
char word1[6];
packed_to_token(command->wd1, word1);
int wd = (int) get_vocab_id(word1);
- /* FIXME: Magic numbers */
- if (wd == 62 || wd == 65 || wd == 71 || wd == 2025 || wd == 2034) {
+ /* FIXME: magic numbers */
+ if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == ACTION_WORD(GIANTWORDS) || wd == ACTION_WORD(PART)) {
/* FIXME: scribbles on the interpreter's command block */
wordclear(&command->wd2);
return GO_LOOKUP;
else {
int i = atdwrf(game.loc);
if (i <= 0) {
- if (AT(DRAGON) && game.prop[DRAGON] == 0)
+ if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS)
return throw_support(DRAGON_SCALES);
if (AT(TROLL))
return throw_support(TROLL_RETURNS);
rspeak(spk);
return GO_CLEAROBJ;
}
- /* FIXME: Arithemetic on proprty values */
+ /* 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) {