X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=33c445cc0c13f7cfd92d33c717257b68bb60ee0f;hb=e05f959974ec2802362d25b8305a26e58d14a753;hp=e3768d91af9f4567e3186f188b239e9ca7b6fd92;hpb=45820bc8cd6e01279d94703fd18b73f6848f09aa;p=open-adventure.git diff --git a/actions.c b/actions.c index e3768d9..33c445c 100644 --- a/actions.c +++ b/actions.c @@ -25,7 +25,7 @@ static int attack(struct command_t *command) 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; @@ -107,7 +107,7 @@ static int attack(struct command_t *command) spk = ALREADY_DEAD; break; } - } else if (obj == DRAGON && game.prop[DRAGON] == 0) { + } 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, @@ -121,9 +121,9 @@ static int attack(struct command_t *command) 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: Arithmentic on location values */ int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2; move(DRAGON + NOBJECTS, -1); move(RUG + NOBJECTS, 0); @@ -170,8 +170,8 @@ static int bigwords(token_t foo) } 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; + if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID) + game.prop[TROLL] = TROLL_PAIDONCE; k = 2; if (HERE(EGGS)) k = 1; @@ -224,23 +224,24 @@ static void blast(void) 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) @@ -284,7 +285,7 @@ static int vcarry(token_t verb, token_t obj) 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; @@ -354,21 +355,21 @@ static int chain(token_t verb) 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; @@ -376,7 +377,7 @@ static int chain(token_t verb) 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; @@ -410,8 +411,8 @@ static int discard(token_t verb, token_t obj, bool just_do_it) 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; @@ -419,6 +420,7 @@ static int discard(token_t verb, token_t obj, bool just_do_it) 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) @@ -431,7 +433,7 @@ static int discard(token_t verb, token_t obj, bool just_do_it) 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; @@ -485,13 +487,12 @@ static int drink(token_t verb, token_t obj) 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; } @@ -554,7 +555,7 @@ static int feed(token_t verb, token_t obj) 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; @@ -673,7 +674,7 @@ static int fly(token_t verb, token_t obj) { 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; @@ -689,12 +690,13 @@ static int fly(token_t verb, token_t obj) 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) @@ -1030,7 +1032,7 @@ static int throw (struct command_t *command) 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);