C***   GETOBJ

       SUBROUTINE GETOBJ(OBJ)

C  ANALYSE AN OBJECT WORD.  SEE IF THE THING IS HERE, WHETHER WE'VE GOT A VERB
C  YET, AND SO ON.  OBJECT MUST BE HERE UNLESS VERB IS "FIND" OR "INVENT(ORY)"
C  (AND NO NEW VERB YET TO BE ANALYSED).  WATER, OIL AND WINE ARE ALSO
C  FUNNY, SINCE THEY ARE NEVER ACTUALLY DROPPED AT ANY LOCATION, BUT MIGHT
C  BE HERE INSIDE THE BOTTLE OR AS A FEATURE OF THE LOCATION.
C
C  HAS THREE POSSIBLE RETURN VALUES FOR 'OBJ':
C       VAL > 0 :: A POSITIVE OBJECT NUMBER
C       VAL = 0 :: OBJECT NOT FOUND HERE.  ERROR MESSAGE PRINTED.
C       VAL < 0 :: OBJECT WORD REALLY SOMETHING ELSE.  RETURN NEGATIVE
C                       VALUE OF SUBSTITUTED WORD.

       IMPLICIT INTEGER(A-Z)
      LOGICAL AT
       COMMON /DWFCOM/ DWARF,KNIFE,KNFLOC,DFLAG,DSEEN(6),DLOC(6),
     1  ODLOC(6),DWFMAX
       COMMON /LIQCOM/ BOTTLE,CASK,WATER,OIL,WINE,LIQTYP(5)
       COMMON /LOCCOM/ LOC,OLDLOC,OLDLC2,NEWLOC,MAXLOC
       COMMON /MNECOM/ BACK,CAVE,DPRSSN,ENTRNC,EXIT,GO,LOOK,NULL,
     1 AXE,BEAR,BOAT,BOOK,BOOK2,BOOTH,CARVNG,CHASM,CHASM2,DOOR,GNOME,
     2 GRATE,LAMP,PDOOR,PLANT,PLANT2,ROCKS,ROD,ROD2,SAFE,
     3 TDOOR,TDOOR2,TROLL,TROLL2,EMRALD,SPICES,
     4 FIND,YELL,INVENT,LEAVE,POUR,SAY,TAKE,THROW,
     5 KILLED,IWEST,PHUCE(2,4),TK(20)
      INTEGER*4 POINTS
       COMMON /OBJCOM/ PLAC(150),FIXD(150),WEIGHT(150),PROP(150),
     1          POINTS(150)
       COMMON /PLACOM/ ATLOC(250),LINK(300),PLACE(150),
     1          FIXED(150),MAXOBJ
      REAL*8 TXT
       COMMON /UTXCOM/ TXT(35,2),WDX
      REAL*8 VTXT,OTXT,IOTXT
       COMMON /WRDCOM/ VERBS(45),VTXT(45,2),VRBX,OBJS(45),OTXT(45,2),
     1  OBJX,IOBJS(15),IOTXT(15,2),IOBX,PREP,WORDS(45)
       LOGICAL ATHAND,BLIND,HERE,HOLDNG,PLURAL


       IF(HOLDNG(OBJ))RETURN
       IF(BLIND(0))GOTO 280
       IF(FIXED(OBJ).EQ.LOC.OR.ATHAND(OBJ))GOTO 290
       IF(.NOT.HERE(OBJ))GOTO 205
       K=335
       IF(PLURAL(OBJ))K=373
       OBJ=0
       CALL RSPEAK(K)
       RETURN

205     IF(OBJ.NE.GRATE)GOTO 210
       IF(LOC.EQ.1.OR.LOC.EQ.4.OR.LOC.EQ.7)OBJ=-DPRSSN
       IF(LOC.GT.9.AND.LOC.LT.15)OBJ=-ENTRNC
       IF(OBJ.EQ.GRATE)GOTO 280
       RETURN

210     IF(OBJ.NE.DWARF)GOTO 220
      L1=DWFMAX-1
       DO 212 I=1,L1
       IF(DLOC(I).EQ.LOC.AND.DFLAG.GE.2)GOTO 290
212     CONTINUE
       GOTO 280

220     IF(OBJ.EQ.LIQLOC(LOC).OR.
     1  (ATHAND(BOTTLE).AND.LIQ(BOTTLE).EQ.OBJ).OR.
     2  (ATHAND(CASK).AND.LIQ(CASK).EQ.OBJ))GOTO 290
       IF(OBJ.NE.PLANT.OR..NOT.AT(PLANT2).OR.PROP(PLANT2).EQ.0)GOTO 230
       OBJ=PLANT2
       GOTO 290

230     IF(OBJ.NE.ROCKS.OR..NOT.AT(CARVNG))GOTO 240
       OBJ=CARVNG
       GOTO 290

240     IF(OBJ.NE.ROD.OR..NOT.ATHAND(ROD2))GOTO 250
       OBJ=ROD2
       GOTO 290

250     IF(OBJ.NE.DOOR.OR..NOT.
     1  (AT(SAFE).OR.AT(TDOOR).OR.AT(TDOOR2).OR.AT(PDOOR)))
     2  GOTO 260
       OBJ=TDOOR
       IF(AT(TDOOR2))OBJ=TDOOR2
       IF(AT(PDOOR))OBJ=PDOOR
       IF(AT(SAFE))OBJ=SAFE
       GOTO 290

260     IF(OBJ.NE.BOOK.OR..NOT.ATHAND(BOOK2))GOTO 270
       OBJ=BOOK2
       GOTO 290

270     IF(VERBS(VRBX).EQ.FIND.OR.VERBS(VRBX).EQ.INVENT)GOTO 290

C  IT ISN'T HERE.  TELL HIM & RETURN.
280     OBJ=0
       CALL A5TOA1(TXT(WDX,1),TXT(WDX,2),' here.',TK,K)
       PRINT 282,(TK(I),I=1,K)
282     FORMAT(/' I see no ',20A1)

290     RETURN

       END
