X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=aa6e6dac4ad6a1c482fba14fccf9ce07d61ddb6f;hb=dc6a5751ed04ff15103c9852c8dc7427298b6945;hp=4f802b6f6a273de40a0d1191ffcdca0feca4af22;hpb=a02b3879998e78555852f4a81a19e80694e38cdc;p=open-adventure.git diff --git a/actions.c b/actions.c index 4f802b6..aa6e6da 100644 --- a/actions.c +++ b/actions.c @@ -129,17 +129,18 @@ static int bigwords(long foo) if (game.place[EGGS]==PLAC[EGGS] || (TOTING(EGGS) && game.loc==PLAC[EGGS])) { RSPEAK(spk); return GO_CLEAROBJ; + } else { + /* Bring back troll if we steal the eggs back from him before + * crossing. */ + if (game.place[EGGS]==0 && game.place[TROLL]==0 && game.prop[TROLL]==0) + game.prop[TROLL]=1; + k=2; + if (HERE(EGGS))k=1; + if (game.loc == PLAC[EGGS])k=0; + MOVE(EGGS,PLAC[EGGS]); + PSPEAK(EGGS,k); + return GO_CLEAROBJ; } - /* Bring back troll if we steal the eggs back from him before - * crossing. */ - if (game.place[EGGS]==0 && game.place[TROLL]==0 && game.prop[TROLL]==0) - game.prop[TROLL]=1; - k=2; - if (HERE(EGGS))k=1; - if (game.loc == PLAC[EGGS])k=0; - MOVE(EGGS,PLAC[EGGS]); - PSPEAK(EGGS,k); - return GO_CLEAROBJ; } } @@ -176,6 +177,7 @@ static int blast(void) game.bonus=135; RSPEAK(game.bonus); score(0); + return GO_CLEAROBJ; /* pacify compiler - we never get here */ } static int vbreak(token_t verb, token_t obj) @@ -233,9 +235,9 @@ static int carry(token_t verb, token_t obj) if (obj == RUG && game.prop[RUG] == 2)spk=222; if (obj == SIGN)spk=196; if (obj == MESSAG) { - spk=190; - return GO_CLEAROBJ; + RSPEAK(190); DSTROY(MESSAG); + return GO_CLEAROBJ; } if (game.fixed[obj] != 0) { RSPEAK(spk); @@ -392,13 +394,11 @@ static int drink(token_t verb, token_t obj) return(8000); if (obj != BLOOD) { if (obj != 0 && obj != WATER)spk=110; - if (spk == 110 || LIQUID() != WATER || !HERE(BOTTLE)) { - RSPEAK(spk); - return GO_CLEAROBJ; + if (spk != 110 && LIQUID() == WATER && HERE(BOTTLE)) { + game.prop[BOTTLE]=1; + game.place[WATER]=0; + spk=74; } - game.prop[BOTTLE]=1; - game.place[WATER]=0; - spk=74; } else { DSTROY(BLOOD); game.prop[DRAGON]=2; @@ -470,57 +470,39 @@ static int feed(token_t verb, token_t obj) RSPEAK(100); return GO_CLEAROBJ; } - - if (!(obj != SNAKE && obj != DRAGON && obj != TROLL)) { - int spk=102; + else if (obj == SNAKE || obj == DRAGON || obj == TROLL) { + spk=102; if (obj == DRAGON && game.prop[DRAGON] != 0)spk=110; if (obj == TROLL)spk=182; - if (obj != SNAKE || game.closed || !HERE(BIRD)) - { - RSPEAK(spk); - return GO_CLEAROBJ; + if (obj == SNAKE && !game.closed && HERE(BIRD)) { + DSTROY(BIRD); + game.prop[BIRD]=0; + spk = 101; } - DSTROY(BIRD); - game.prop[BIRD]=0; - RSPEAK(101); - return GO_CLEAROBJ; } - - if (obj == DWARF) { - if (!HERE(FOOD)) - { - RSPEAK(spk); - return GO_CLEAROBJ; + else if (obj == DWARF) { + if (HERE(FOOD)) { + game.dflag += 2; + spk = 103; } - game.dflag=game.dflag+2; - RSPEAK(103); - return GO_CLEAROBJ; } - - if (obj == BEAR) { + else if (obj == BEAR) { if (game.prop[BEAR] == 0)spk=102; if (game.prop[BEAR] == 3)spk=110; - if (!HERE(FOOD)) { - RSPEAK(spk); - return GO_CLEAROBJ; + if (HERE(FOOD)) { + DSTROY(FOOD); + game.prop[BEAR]=1; + game.fixed[AXE]=0; + game.prop[AXE]=0; + spk=168; } - DSTROY(FOOD); - game.prop[BEAR]=1; - game.fixed[AXE]=0; - game.prop[AXE]=0; - spk=168; - RSPEAK(spk); - return GO_CLEAROBJ; } - - if (obj == OGRE) { + else if (obj == OGRE) { if (HERE(FOOD)) spk=202; - RSPEAK(spk); - return GO_CLEAROBJ; + } else { + spk=14; } - - spk=14; RSPEAK(spk); return GO_CLEAROBJ; } @@ -713,7 +695,6 @@ static int listen(void) static int lock(token_t verb, token_t obj) /* Lock, unlock, no object given. Assume various things if present. */ { - int k; int spk = ACTSPK[verb]; if (obj == INTRANSITIVE) { spk=28; @@ -1008,7 +989,6 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj) * unless verb is "say", which snarfs arbitrary second word. */ { - int kk; token_t spk=ACTSPK[verb]; if (part == unknown) @@ -1073,12 +1053,12 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj) if (verb == SAY)obj=WD2; if (obj == 0) { /* Analyse an intransitive verb (ie, no object given yet). */ - switch (verb-1) { - case 0: /* CARRY */ return carry(verb, INTRANSITIVE); + switch (verb-1) { + case 0: /* CARRY */ return carry(verb, INTRANSITIVE); case 1: /* DROP */ return(8000); case 2: /* SAY */ return(8000); case 3: /* UNLOC */ return lock(verb, INTRANSITIVE); - case 4: /* NOTHI */ {RSPEAK(54); return(20012);} + case 4: /* NOTHI */ {RSPEAK(54); return(GO_CLEAROBJ);} case 5: /* LOCK */ return lock(verb, INTRANSITIVE); case 6: /* LIGHT */ return light(verb, INTRANSITIVE); case 7: /* EXTIN */ return extinguish(verb, INTRANSITIVE); @@ -1119,7 +1099,7 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj) case 1: /* DROP */ return discard(verb, obj, false); case 2: /* SAY */ return say(); case 3: /* UNLOC */ return lock(verb, obj); - case 4: /* NOTHI */ {RSPEAK(54); return(20012);} + case 4: /* NOTHI */ {RSPEAK(54); return(GO_CLEAROBJ);} case 5: /* LOCK */ return lock(verb, obj); case 6: /* LIGHT */ return light(verb, obj); case 7: /* EXTI */ return extinguish(verb, obj);