Yet more action handlers.
This commit is contained in:
parent
08ed2af230
commit
f47745a7c4
1 changed files with 179 additions and 169 deletions
100
actions1.c
100
actions1.c
|
@ -140,6 +140,29 @@ static int drink(token_t obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int eat(token_t obj)
|
||||||
|
/* Eat. Intransitive: assume food if present, else ask what. Transitive: food
|
||||||
|
* ok, some things lose appetite, rest are ridiculous. */
|
||||||
|
{
|
||||||
|
if (obj == INTRANSITIVE) {
|
||||||
|
if (!HERE(FOOD))
|
||||||
|
return(8000);
|
||||||
|
DSTROY(FOOD);
|
||||||
|
SPK=72;
|
||||||
|
return(2011);
|
||||||
|
} else {
|
||||||
|
if (obj == FOOD) {
|
||||||
|
DSTROY(FOOD);
|
||||||
|
SPK=72;
|
||||||
|
return(2011);
|
||||||
|
}
|
||||||
|
if (obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj ==
|
||||||
|
DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj ==
|
||||||
|
OGRE)SPK=71;
|
||||||
|
return(2011);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int extinguish(int obj)
|
static int extinguish(int obj)
|
||||||
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
|
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
|
||||||
{
|
{
|
||||||
|
@ -179,6 +202,28 @@ static int find(token_t obj)
|
||||||
return(2011);
|
return(2011);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int fly(token_t obj)
|
||||||
|
/* Fly. Snide remarks unless hovering rug is here. */
|
||||||
|
{
|
||||||
|
if (obj == INTRANSITIVE) {
|
||||||
|
if (game.prop[RUG] != 2)SPK=224;
|
||||||
|
if (!HERE(RUG))SPK=225;
|
||||||
|
if (SPK/2 == 112) return(2011);
|
||||||
|
obj=RUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj != RUG) return(2011);
|
||||||
|
SPK=223;
|
||||||
|
if (game.prop[RUG] != 2) return(2011);
|
||||||
|
game.oldlc2=game.oldloc;
|
||||||
|
game.oldloc=game.loc;
|
||||||
|
game.newloc=game.place[RUG]+game.fixed[RUG]-game.loc;
|
||||||
|
SPK=226;
|
||||||
|
if (game.prop[SAPPH] >= 0)SPK=227;
|
||||||
|
RSPEAK(SPK);
|
||||||
|
return(2);
|
||||||
|
}
|
||||||
|
|
||||||
static int inven(token_t obj)
|
static int inven(token_t obj)
|
||||||
/* Inventory. If object, treat same as find. Else report on current burden. */
|
/* Inventory. If object, treat same as find. Else report on current burden. */
|
||||||
{
|
{
|
||||||
|
@ -346,17 +391,16 @@ static int say(void)
|
||||||
/* SAY. Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).) Magic words override. */
|
/* SAY. Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).) Magic words override. */
|
||||||
{
|
{
|
||||||
/* FIXME: ugly use of globals */
|
/* FIXME: ugly use of globals */
|
||||||
SETPRM(1,WD2,WD2X);
|
SETPRM(1,WD2,WD2X); if (WD2 <= 0)SETPRM(1,WD1,WD1X);
|
||||||
if(WD2 <= 0)SETPRM(1,WD1,WD1X);
|
|
||||||
if (WD2 > 0)WD1=WD2;
|
if (WD2 > 0)WD1=WD2;
|
||||||
I=VOCAB(WD1,-1);
|
int wd=VOCAB(WD1,-1);
|
||||||
if(I == 62 || I == 65 || I == 71 || I == 2025 || I == 2034) goto L9035;
|
if (wd == 62 || wd == 65 || wd == 71 || wd == 2025 || wd == 2034) {
|
||||||
|
WD2=0;
|
||||||
|
return(2630);
|
||||||
|
}
|
||||||
RSPEAK(258);
|
RSPEAK(258);
|
||||||
return(2012);
|
return(2012);
|
||||||
|
|
||||||
L9035: WD2=0;
|
|
||||||
//obj=0;
|
|
||||||
return(2630);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vscore(void)
|
static int vscore(void)
|
||||||
|
@ -543,10 +587,6 @@ L5190: if((verb == FIND || verb == INVENT) && WD2 <= 0) goto L5010;
|
||||||
return(2012);
|
return(2012);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Routines for performing the various action verbs */
|
|
||||||
|
|
||||||
/* Statement numbers in this section are 8000 for intransitive verbs, 9000 for
|
/* Statement numbers in this section are 8000 for intransitive verbs, 9000 for
|
||||||
* transitive, plus ten times the verb number. Many intransitive verbs use the
|
* transitive, plus ten times the verb number. Many intransitive verbs use the
|
||||||
* transitive code, and some verbs use code for other verbs, as noted below. */
|
* transitive code, and some verbs use code for other verbs, as noted below. */
|
||||||
|
@ -566,21 +606,8 @@ L9080: return extinguish(obj);
|
||||||
L9090: return wave(obj);
|
L9090: return wave(obj);
|
||||||
L9120: return attack(input, verb, obj);
|
L9120: return attack(input, verb, obj);
|
||||||
L9130: return pour(obj);
|
L9130: return pour(obj);
|
||||||
|
L8140: return eat(INTRANSITIVE);
|
||||||
/* Eat. Intransitive: assume food if present, else ask what. Transitive: food
|
L9140: return eat(obj);
|
||||||
* ok, some things lose appetite, rest are ridiculous. */
|
|
||||||
|
|
||||||
L8140: if(!HERE(FOOD)) return(8000);
|
|
||||||
L8142: DSTROY(FOOD);
|
|
||||||
SPK=72;
|
|
||||||
return(2011);
|
|
||||||
|
|
||||||
L9140: if(obj == FOOD) goto L8142;
|
|
||||||
if(obj == BIRD || obj == SNAKE || obj == CLAM || obj == OYSTER || obj ==
|
|
||||||
DWARF || obj == DRAGON || obj == TROLL || obj == BEAR || obj ==
|
|
||||||
OGRE)SPK=71;
|
|
||||||
return(2011);
|
|
||||||
|
|
||||||
L9150: return drink(obj);
|
L9150: return drink(obj);
|
||||||
L9160: return rub(obj);
|
L9160: return rub(obj);
|
||||||
L9170: return throw(input, verb, obj);
|
L9170: return throw(input, verb, obj);
|
||||||
|
@ -611,7 +638,6 @@ L9275: game.clshnt=YES(input,192,193,54);
|
||||||
return(2012);
|
return(2012);
|
||||||
|
|
||||||
L9280: return vbreak(obj);
|
L9280: return vbreak(obj);
|
||||||
|
|
||||||
L9290: return wake(obj);
|
L9290: return wake(obj);
|
||||||
|
|
||||||
/* Suspend. Offer to save things in a file, but charging some points (so
|
/* Suspend. Offer to save things in a file, but charging some points (so
|
||||||
|
@ -681,24 +707,8 @@ L8312: SETPRM(1,K/10,MOD(K,10));
|
||||||
L8318: RSPEAK(270);
|
L8318: RSPEAK(270);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
/* Fly. Snide remarks unless hovering rug is here. */
|
L8320: return fly(INTRANSITIVE);
|
||||||
|
L9320: return fly(obj);
|
||||||
L8320: if(game.prop[RUG] != 2)SPK=224;
|
|
||||||
if(!HERE(RUG))SPK=225;
|
|
||||||
if(SPK/2 == 112) return(2011);
|
|
||||||
obj=RUG;
|
|
||||||
|
|
||||||
L9320: if(obj != RUG) return(2011);
|
|
||||||
SPK=223;
|
|
||||||
if(game.prop[RUG] != 2) return(2011);
|
|
||||||
game.oldlc2=game.oldloc;
|
|
||||||
game.oldloc=game.loc;
|
|
||||||
game.newloc=game.place[RUG]+game.fixed[RUG]-game.loc;
|
|
||||||
SPK=226;
|
|
||||||
if(game.prop[SAPPH] >= 0)SPK=227;
|
|
||||||
RSPEAK(SPK);
|
|
||||||
return(2);
|
|
||||||
|
|
||||||
L8330: return listen();
|
L8330: return listen();
|
||||||
|
|
||||||
/* Z'ZZZ (word gets recomputed at startup; different each game). */
|
/* Z'ZZZ (word gets recomputed at startup; different each game). */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue