X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=actions.c;h=b866007c00cc59ebcf447e6f81e729529c5c8a95;hp=43a570e2d74ae3b249f1dc59fa6fc253ffde4f71;hb=f815299a2a97656b0f4ea0793c2207c2437888f6;hpb=ab79fc78144cd1433c6e8276ab133067be28083e diff --git a/actions.c b/actions.c index 43a570e..b866007 100644 --- a/actions.c +++ b/actions.c @@ -123,7 +123,7 @@ static int attack(struct command_t *command) } state_change(DRAGON, DRAGON_DEAD); game.prop[RUG] = RUG_FLOOR; - /* FIXME: Arithmentic on location values */ + /* FIXME: Arithmetic on location values */ int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2; move(DRAGON + NOBJECTS, -1); move(RUG + NOBJECTS, 0); @@ -172,11 +172,11 @@ static int bigwords(token_t foo) * crossing. */ if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID) game.prop[TROLL] = TROLL_PAIDONCE; - k = 2; + 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; @@ -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) @@ -443,15 +444,15 @@ static int discard(token_t verb, token_t obj, bool just_do_it) 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; } } @@ -604,7 +605,7 @@ int fill(token_t verb, token_t obj) 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) { @@ -887,11 +888,7 @@ static int pour(token_t verb, token_t obj) 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; } } @@ -1085,7 +1082,7 @@ static int wave(token_t verb, token_t obj) 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) {