X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=dd68f8e0016f1fc77440189708d25a6d0b6a5eb4;hb=b8d86b840dad2c5e9e5412acc06c5b7a6b532dab;hp=0f17bea4d6a38ae45e30e9e9c3454bda71785433;hpb=8675c4facd154b9eaa370c6d46b99473287552c7;p=open-adventure.git diff --git a/actions.c b/actions.c index 0f17bea..dd68f8e 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; @@ -93,9 +93,21 @@ static int attack(struct command_t *command) } 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) { + 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, @@ -109,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); @@ -272,7 +284,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; @@ -398,8 +410,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; @@ -407,6 +419,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) @@ -419,7 +432,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; @@ -473,13 +486,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; } @@ -542,7 +554,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; @@ -661,7 +673,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; @@ -677,12 +689,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) @@ -967,7 +980,7 @@ static int say(struct command_t *command) packed_to_token(command->wd1, word1); int wd = (int) get_vocab_id(word1); /* FIXME: magic numbers */ - if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == 2000 + GIANTWORDS || wd == 2000 + PART) { + 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; @@ -1018,7 +1031,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);