2005-07-01 10:04:46 +04:00
|
|
|
/* $NetBSD: command4.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */
|
1995-03-21 18:03:38 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1995-03-21 18:03:38 +03:00
|
|
|
* Copyright (c) 1983, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 13:36:50 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-03-21 12:45:37 +03:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
1997-10-10 15:39:08 +04:00
|
|
|
#include <sys/cdefs.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
#ifndef lint
|
1995-03-21 18:03:38 +03:00
|
|
|
#if 0
|
1997-01-07 14:56:32 +03:00
|
|
|
static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95";
|
1995-03-21 18:03:38 +03:00
|
|
|
#else
|
2005-07-01 10:04:46 +04:00
|
|
|
__RCSID("$NetBSD: command4.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
|
1995-03-21 18:03:38 +03:00
|
|
|
#endif
|
1997-10-11 06:06:55 +04:00
|
|
|
#endif /* not lint */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-01-07 14:56:32 +03:00
|
|
|
#include "extern.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-10 15:39:08 +04:00
|
|
|
int
|
2005-07-01 10:04:46 +04:00
|
|
|
take(unsigned int from[])
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1997-10-11 06:06:55 +04:00
|
|
|
int firstnumber, heavy, bulky, value;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
firstnumber = wordnumber;
|
1997-10-11 06:06:55 +04:00
|
|
|
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == OFF) {
|
1993-03-21 12:45:37 +03:00
|
|
|
wordnumber++;
|
|
|
|
wordvalue[wordnumber] = TAKEOFF;
|
2000-09-25 23:37:58 +04:00
|
|
|
wordtype[wordnumber] = VERB;
|
1997-10-11 06:06:55 +04:00
|
|
|
return (cypher());
|
|
|
|
} else {
|
2000-09-22 12:19:21 +04:00
|
|
|
wordnumber++;
|
2005-07-01 10:04:46 +04:00
|
|
|
while (wordnumber <= wordcount && wordtype[wordnumber] ==
|
|
|
|
OBJECT) {
|
1993-03-21 12:45:37 +03:00
|
|
|
value = wordvalue[wordnumber];
|
|
|
|
printf("%s:\n", objsht[value]);
|
|
|
|
heavy = (carrying + objwt[value]) <= WEIGHT;
|
|
|
|
bulky = (encumber + objcumber[value]) <= CUMBER;
|
2005-07-01 10:04:46 +04:00
|
|
|
if ((testbit(from, value) || wiz || tempwiz) &&
|
|
|
|
heavy && bulky && !testbit(inven, value)) {
|
1997-10-11 06:06:55 +04:00
|
|
|
setbit(inven, value);
|
1993-03-21 12:45:37 +03:00
|
|
|
carrying += objwt[value];
|
|
|
|
encumber += objcumber[value];
|
1997-10-10 15:39:08 +04:00
|
|
|
ourtime++;
|
1997-10-11 06:06:55 +04:00
|
|
|
if (testbit(from, value))
|
1993-03-21 12:45:37 +03:00
|
|
|
printf("Taken.\n");
|
|
|
|
else
|
|
|
|
printf("Zap! Taken from thin air.\n");
|
1997-10-11 06:06:55 +04:00
|
|
|
clearbit(from, value);
|
1993-03-21 12:45:37 +03:00
|
|
|
if (value == MEDALION)
|
|
|
|
win--;
|
2000-09-18 03:04:17 +04:00
|
|
|
} else if (testbit(inven, value))
|
2000-09-25 18:08:08 +04:00
|
|
|
printf("You're already holding %s%s.\n",
|
|
|
|
A_OR_AN_OR_BLANK(value),
|
2000-09-23 23:23:57 +04:00
|
|
|
objsht[value]);
|
2000-09-22 16:37:32 +04:00
|
|
|
else if (!testbit(from, value))
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("I don't see any %s around here.\n",
|
|
|
|
objsht[value]);
|
2000-09-18 03:04:17 +04:00
|
|
|
else if (!heavy)
|
2000-09-25 18:08:08 +04:00
|
|
|
printf("The %s %stoo heavy.\n", objsht[value],
|
|
|
|
IS_OR_ARE(value));
|
2000-09-18 03:04:17 +04:00
|
|
|
else
|
2000-09-25 18:08:08 +04:00
|
|
|
printf("The %s %stoo cumbersome to hold.\n",
|
|
|
|
objsht[value], IS_OR_ARE(value));
|
2005-07-01 10:04:46 +04:00
|
|
|
if (wordnumber < wordcount - 1 &&
|
|
|
|
wordvalue[++wordnumber] == AND)
|
1993-03-21 12:45:37 +03:00
|
|
|
wordnumber++;
|
|
|
|
else
|
1997-10-11 06:06:55 +04:00
|
|
|
return (firstnumber);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
}
|
1997-10-11 06:06:55 +04:00
|
|
|
/* special cases with their own return()'s */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS)
|
1997-10-11 06:06:55 +04:00
|
|
|
switch (wordvalue[wordnumber]) {
|
|
|
|
|
|
|
|
case SWORD:
|
|
|
|
if (testbit(from, SWORD)) {
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
|
|
|
}
|
|
|
|
if (testbit(from, TWO_HANDED)) {
|
|
|
|
wordvalue[wordnumber] = TWO_HANDED;
|
1993-03-21 12:45:37 +03:00
|
|
|
wordtype[wordnumber--] = OBJECT;
|
1997-10-11 06:06:55 +04:00
|
|
|
return (take(from));
|
|
|
|
}
|
|
|
|
wordvalue[wordnumber] = BROAD;
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-11 06:06:55 +04:00
|
|
|
case BODY:
|
|
|
|
if (testbit(from, MAID)) {
|
|
|
|
wordvalue[wordnumber] = MAID;
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
2000-09-18 03:04:17 +04:00
|
|
|
} else if (testbit(from, DEADWOOD)) {
|
|
|
|
wordvalue[wordnumber] = DEADWOOD;
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
|
|
|
} else if (testbit(from, DEADNATIVE)) {
|
|
|
|
wordvalue[wordnumber] = DEADNATIVE;
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
|
|
|
} else {
|
|
|
|
if (testbit(from, DEADGOD)) {
|
|
|
|
wordvalue[wordnumber] = DEADGOD;
|
1993-03-21 12:45:37 +03:00
|
|
|
wordtype[wordnumber--] = OBJECT;
|
1997-10-11 06:06:55 +04:00
|
|
|
return (take(from));
|
2000-09-18 03:04:17 +04:00
|
|
|
} else {
|
|
|
|
wordvalue[wordnumber] = DEADTIME;
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
|
|
|
}
|
|
|
|
}
|
1997-10-11 06:06:55 +04:00
|
|
|
break;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-11 06:06:55 +04:00
|
|
|
case AMULET:
|
|
|
|
if (testbit(location[position].objects, AMULET)) {
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("The amulet is warm to the touch, and ");
|
|
|
|
puts("its beauty catches your breath.");
|
|
|
|
printf("A mist falls over your eyes, but ");
|
|
|
|
puts("then it is gone. Sounds seem clearer");
|
|
|
|
printf("and sharper but far away as if in a ");
|
|
|
|
puts("dream. The sound of purling water");
|
|
|
|
printf("reaches you from afar. The mist ");
|
|
|
|
printf("falls again, and your heart leaps in ");
|
|
|
|
puts("horror.");
|
|
|
|
printf("The gold freezes your hands and ");
|
|
|
|
puts("fathomless darkness engulfs your soul.");
|
1997-10-11 06:06:55 +04:00
|
|
|
}
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-11 06:06:55 +04:00
|
|
|
case MEDALION:
|
|
|
|
if (testbit(location[position].objects, MEDALION)) {
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("The medallion is warm, and it ");
|
|
|
|
printf("rekindles your spirit with the ");
|
|
|
|
puts("warmth of life.");
|
|
|
|
printf("Your amulet begins to glow as the ");
|
|
|
|
printf("medallion is brought near to it, ");
|
|
|
|
printf("and together\nthey radiate.\n");
|
1997-10-11 06:06:55 +04:00
|
|
|
}
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
|
|
|
|
|
|
|
case TALISMAN:
|
|
|
|
if (testbit(location[position].objects, TALISMAN)) {
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("The talisman is cold to the touch, ");
|
|
|
|
puts("and it sends a chill down your spine.");
|
1997-10-11 06:06:55 +04:00
|
|
|
}
|
|
|
|
wordtype[wordnumber--] = OBJECT;
|
|
|
|
return (take(from));
|
|
|
|
|
|
|
|
case NORMGOD:
|
2005-07-01 10:04:46 +04:00
|
|
|
if (testbit(location[position].objects, BATHGOD) &&
|
|
|
|
(testbit(wear, AMULET) || testbit(inven, AMULET))) {
|
|
|
|
printf("She offers a delicate hand, and you ");
|
|
|
|
puts("help her out of the sparkling springs.");
|
|
|
|
printf("Water droplets like liquid silver ");
|
|
|
|
printf("bedew her golden skin, but when ");
|
|
|
|
puts("they part");
|
|
|
|
printf("from her, they fall as teardrops. ");
|
|
|
|
puts("She wraps a single cloth around her and");
|
|
|
|
printf("ties it at the waist. Around her ");
|
|
|
|
puts("neck hangs a golden amulet.");
|
|
|
|
printf("She bids you to follow her, and ");
|
|
|
|
puts("walks away.");
|
1997-10-11 06:06:55 +04:00
|
|
|
pleasure++;
|
|
|
|
followgod = ourtime;
|
|
|
|
clearbit(location[position].objects, BATHGOD);
|
|
|
|
} else
|
2005-07-01 10:04:46 +04:00
|
|
|
if (!testbit(location[position].objects,
|
|
|
|
BATHGOD)) {
|
|
|
|
printf("You're in no position to ");
|
|
|
|
puts("take her.");
|
|
|
|
} else
|
1993-03-21 12:45:37 +03:00
|
|
|
puts("She moves away from you.");
|
1997-10-11 06:06:55 +04:00
|
|
|
break;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-11 06:06:55 +04:00
|
|
|
default:
|
|
|
|
puts("It doesn't seem to work.");
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
puts("You've got to be kidding.");
|
1997-10-11 06:06:55 +04:00
|
|
|
return (firstnumber);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-10 15:39:08 +04:00
|
|
|
int
|
2005-07-01 10:04:46 +04:00
|
|
|
throw(const char *name)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1999-09-18 23:38:46 +04:00
|
|
|
unsigned int n;
|
1997-10-11 06:06:55 +04:00
|
|
|
int deposit = 0;
|
|
|
|
int first, value;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
first = wordnumber;
|
1997-10-11 06:06:55 +04:00
|
|
|
if (drop(name) != -1) {
|
|
|
|
switch (wordvalue[wordnumber]) {
|
|
|
|
|
|
|
|
case AHEAD:
|
|
|
|
deposit = ahead;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BACK:
|
|
|
|
deposit = back;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LEFT:
|
|
|
|
deposit = left;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIGHT:
|
|
|
|
deposit = right;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UP:
|
2005-07-01 10:04:46 +04:00
|
|
|
deposit = location[position].up *
|
|
|
|
(location[position].access || position == FINAL);
|
1997-10-11 06:06:55 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DOWN:
|
|
|
|
deposit = location[position].down;
|
|
|
|
break;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
2000-09-22 12:19:21 +04:00
|
|
|
wordnumber = first + 1;
|
1997-10-11 06:06:55 +04:00
|
|
|
while (wordnumber <= wordcount) {
|
1993-03-21 12:45:37 +03:00
|
|
|
value = wordvalue[wordnumber];
|
2005-07-01 10:04:46 +04:00
|
|
|
if (deposit &&
|
|
|
|
testbit(location[position].objects, value)) {
|
1997-10-11 06:06:55 +04:00
|
|
|
clearbit(location[position].objects, value);
|
1993-03-21 12:45:37 +03:00
|
|
|
if (value != GRENADE)
|
2005-07-01 10:04:46 +04:00
|
|
|
setbit(location[deposit].objects,
|
|
|
|
value);
|
1997-10-11 06:06:55 +04:00
|
|
|
else {
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("A thundering explosion ");
|
|
|
|
printf("nearby sends up a cloud of ");
|
|
|
|
puts("smoke and shrapnel.");
|
1997-10-11 06:06:55 +04:00
|
|
|
for (n = 0; n < NUMOFWORDS; n++)
|
2005-07-01 10:04:46 +04:00
|
|
|
location[deposit].objects[n] =
|
|
|
|
0;
|
1997-10-11 06:06:55 +04:00
|
|
|
setbit(location[deposit].objects, CHAR);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
if (value == ROPE && position == FINAL)
|
|
|
|
location[position].access = 1;
|
1997-10-11 06:06:55 +04:00
|
|
|
switch (deposit) {
|
|
|
|
case 189:
|
|
|
|
case 231:
|
|
|
|
puts("The stone door is unhinged.");
|
|
|
|
location[189].north = 231;
|
|
|
|
location[231].south = 189;
|
|
|
|
break;
|
|
|
|
case 30:
|
|
|
|
puts("The wooden door is blown open.");
|
|
|
|
location[30].west = 25;
|
|
|
|
break;
|
|
|
|
case 31:
|
|
|
|
puts("The door is not damaged.");
|
|
|
|
}
|
|
|
|
} else
|
2005-07-01 10:04:46 +04:00
|
|
|
if (value == GRENADE &&
|
|
|
|
testbit(location[position].objects,
|
|
|
|
value)) {
|
|
|
|
printf("You are blown into shreds ");
|
|
|
|
puts("when your grenade explodes.");
|
1997-10-11 06:06:55 +04:00
|
|
|
die();
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
2005-07-01 10:04:46 +04:00
|
|
|
if (wordnumber < wordcount - 1 &&
|
|
|
|
wordvalue[++wordnumber] == AND)
|
1993-03-21 12:45:37 +03:00
|
|
|
wordnumber++;
|
1997-10-11 06:06:55 +04:00
|
|
|
else
|
|
|
|
return (first);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-11 06:06:55 +04:00
|
|
|
return (first);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-11 06:06:55 +04:00
|
|
|
return (first);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-10 15:39:08 +04:00
|
|
|
int
|
2005-07-01 10:04:46 +04:00
|
|
|
drop(const char *name)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1997-10-11 06:06:55 +04:00
|
|
|
|
|
|
|
int firstnumber, value;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
firstnumber = wordnumber;
|
2000-09-22 12:19:21 +04:00
|
|
|
wordnumber++;
|
2005-07-01 10:04:46 +04:00
|
|
|
while (wordnumber <= wordcount &&
|
|
|
|
(wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) {
|
1993-03-21 12:45:37 +03:00
|
|
|
value = wordvalue[wordnumber];
|
2000-09-24 13:39:56 +04:00
|
|
|
if (value == BODY) { /* special case */
|
|
|
|
wordtype[wordnumber] = OBJECT;
|
2005-07-01 10:04:46 +04:00
|
|
|
if (testbit(inven, MAID) ||
|
|
|
|
testbit(location[position].objects, MAID))
|
2000-09-24 13:39:56 +04:00
|
|
|
value = MAID;
|
2005-07-01 10:04:46 +04:00
|
|
|
else if (testbit(inven, DEADWOOD) ||
|
|
|
|
testbit(location[position].objects, DEADWOOD))
|
2000-09-24 13:39:56 +04:00
|
|
|
value = DEADWOOD;
|
2005-07-01 10:04:46 +04:00
|
|
|
else if (testbit(inven, DEADGOD) ||
|
|
|
|
testbit(location[position].objects, DEADGOD))
|
2000-09-24 13:39:56 +04:00
|
|
|
value = DEADGOD;
|
2005-07-01 10:04:46 +04:00
|
|
|
else if (testbit(inven, DEADTIME) ||
|
|
|
|
testbit(location[position].objects, DEADTIME))
|
2000-09-24 13:39:56 +04:00
|
|
|
value = DEADTIME;
|
2005-07-01 10:04:46 +04:00
|
|
|
else if (testbit(inven, DEADNATIVE) ||
|
|
|
|
testbit(location[position].objects, DEADNATIVE))
|
2000-09-24 13:39:56 +04:00
|
|
|
value = DEADNATIVE;
|
|
|
|
}
|
|
|
|
if (wordtype[wordnumber] == NOUNS && value == DOOR) {
|
|
|
|
if (*name == 'K')
|
|
|
|
puts("You hurt your foot.");
|
1993-03-21 12:45:37 +03:00
|
|
|
else
|
2000-09-24 13:39:56 +04:00
|
|
|
puts("You're not holding a door.");
|
|
|
|
} else if (objsht[value] == NULL) {
|
1993-03-21 12:45:37 +03:00
|
|
|
if (*name == 'K')
|
2000-09-24 13:39:56 +04:00
|
|
|
puts("That's not for kicking!");
|
1993-03-21 12:45:37 +03:00
|
|
|
else
|
2000-09-24 13:39:56 +04:00
|
|
|
puts("You don't have that.");
|
1997-10-11 06:06:55 +04:00
|
|
|
} else {
|
2000-09-24 13:39:56 +04:00
|
|
|
printf("%s:\n", objsht[value]);
|
|
|
|
if (testbit(inven, value)) {
|
|
|
|
clearbit(inven, value);
|
|
|
|
carrying -= objwt[value];
|
|
|
|
encumber -= objcumber[value];
|
|
|
|
if (value == BOMB) {
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("The bomb explodes. A ");
|
|
|
|
printf("blinding white light and ");
|
|
|
|
printf("immense concussion ");
|
|
|
|
puts("obliterate us.");
|
2000-09-24 13:39:56 +04:00
|
|
|
die();
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
2005-07-01 10:04:46 +04:00
|
|
|
if (value != AMULET && value != MEDALION &&
|
|
|
|
value != TALISMAN)
|
|
|
|
setbit(location[position].objects,
|
|
|
|
value);
|
2000-09-24 13:39:56 +04:00
|
|
|
else
|
|
|
|
tempwiz = 0;
|
|
|
|
ourtime++;
|
|
|
|
if (*name == 'K')
|
|
|
|
puts("Drop kicked.");
|
|
|
|
else
|
|
|
|
printf("%s.\n", name);
|
|
|
|
} else {
|
|
|
|
if (*name != 'K') {
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("You aren't holding the %s.\n",
|
|
|
|
objsht[value]);
|
|
|
|
if (testbit(location[position].objects,
|
|
|
|
value)) {
|
2000-09-24 13:39:56 +04:00
|
|
|
if (*name == 'T')
|
|
|
|
puts("Kicked instead.");
|
|
|
|
else if (*name == 'G')
|
|
|
|
puts("Given anyway.");
|
|
|
|
}
|
2005-07-01 10:04:46 +04:00
|
|
|
} else if (testbit(location[position].objects,
|
|
|
|
value))
|
2000-09-24 13:39:56 +04:00
|
|
|
puts("Kicked.");
|
|
|
|
else if (testbit(wear, value))
|
|
|
|
puts("Not while it's being worn.");
|
|
|
|
else
|
|
|
|
puts("Not found.");
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
2005-07-01 10:04:46 +04:00
|
|
|
if (wordnumber < wordcount - 1 &&
|
|
|
|
wordvalue[++wordnumber] == AND)
|
1993-03-21 12:45:37 +03:00
|
|
|
wordnumber++;
|
|
|
|
else
|
1997-10-11 06:06:55 +04:00
|
|
|
return (firstnumber);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
puts("Do what?");
|
1997-10-11 06:06:55 +04:00
|
|
|
return (-1);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-10 15:39:08 +04:00
|
|
|
int
|
2005-07-01 10:04:46 +04:00
|
|
|
takeoff(void)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
wordnumber = take(wear);
|
1997-10-11 06:06:55 +04:00
|
|
|
return (drop("Dropped"));
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-10 15:39:08 +04:00
|
|
|
int
|
2005-07-01 10:04:46 +04:00
|
|
|
puton(void)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
wordnumber = take(location[position].objects);
|
1997-10-11 06:06:55 +04:00
|
|
|
return (wearit());
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1997-10-10 15:39:08 +04:00
|
|
|
int
|
2005-07-01 10:04:46 +04:00
|
|
|
eat(void)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1997-10-11 06:06:55 +04:00
|
|
|
int firstnumber, value;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
firstnumber = wordnumber;
|
2000-09-22 12:19:21 +04:00
|
|
|
wordnumber++;
|
1997-10-11 06:06:55 +04:00
|
|
|
while (wordnumber <= wordcount) {
|
1993-03-21 12:45:37 +03:00
|
|
|
value = wordvalue[wordnumber];
|
2000-09-24 13:46:03 +04:00
|
|
|
if (wordtype[wordnumber] != OBJECT || objsht[value] == NULL)
|
|
|
|
value = -2;
|
1997-10-11 06:06:55 +04:00
|
|
|
switch (value) {
|
|
|
|
|
2000-09-24 13:46:03 +04:00
|
|
|
case -2:
|
|
|
|
puts("You can't eat that!");
|
|
|
|
return (firstnumber);
|
|
|
|
|
1997-10-11 06:06:55 +04:00
|
|
|
case -1:
|
|
|
|
puts("Eat what?");
|
|
|
|
return (firstnumber);
|
|
|
|
|
|
|
|
default:
|
2000-09-25 18:08:08 +04:00
|
|
|
printf("You can't eat %s%s!\n",
|
|
|
|
A_OR_AN_OR_BLANK(value), objsht[value]);
|
1997-10-11 06:06:55 +04:00
|
|
|
return (firstnumber);
|
|
|
|
|
|
|
|
case PAPAYAS:
|
|
|
|
case PINEAPPLE:
|
|
|
|
case KIWI:
|
|
|
|
case COCONUTS: /* eatable things */
|
|
|
|
case MANGO:
|
|
|
|
|
|
|
|
printf("%s:\n", objsht[value]);
|
|
|
|
if (testbit(inven, value) &&
|
|
|
|
ourtime > ate - CYCLE &&
|
|
|
|
testbit(inven, KNIFE)) {
|
|
|
|
clearbit(inven, value);
|
|
|
|
carrying -= objwt[value];
|
|
|
|
encumber -= objcumber[value];
|
|
|
|
ate = max(ourtime, ate) + CYCLE / 3;
|
|
|
|
snooze += CYCLE / 10;
|
|
|
|
ourtime++;
|
2005-07-01 10:04:46 +04:00
|
|
|
printf("Eaten. You can explore a little ");
|
|
|
|
puts("longer now.");
|
|
|
|
} else if (!testbit(inven, value)) {
|
|
|
|
printf("You aren't holding the %s.\n",
|
|
|
|
objsht[value]);
|
|
|
|
} else if (!testbit(inven, KNIFE))
|
2000-09-18 03:04:17 +04:00
|
|
|
puts("You need a knife.");
|
|
|
|
else
|
2000-09-24 13:46:03 +04:00
|
|
|
puts("You're stuffed.");
|
2005-07-01 10:04:46 +04:00
|
|
|
if (wordnumber < wordcount - 1 &&
|
|
|
|
wordvalue[++wordnumber] == AND)
|
1997-10-11 06:06:55 +04:00
|
|
|
wordnumber++;
|
|
|
|
else
|
|
|
|
return (firstnumber);
|
|
|
|
} /* end switch */
|
|
|
|
} /* end while */
|
|
|
|
return (firstnumber);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|