xref: /netbsd/games/hack/def.obj.h (revision c51c4568)
1*c51c4568Sdholland /*	$NetBSD: def.obj.h,v 1.6 2011/08/06 20:18:26 dholland Exp $	*/
23ea4a95cSchristos 
302ded532Smycroft /*
41c7f94e5Sjsm  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
51c7f94e5Sjsm  * Amsterdam
61c7f94e5Sjsm  * All rights reserved.
71c7f94e5Sjsm  *
81c7f94e5Sjsm  * Redistribution and use in source and binary forms, with or without
91c7f94e5Sjsm  * modification, are permitted provided that the following conditions are
101c7f94e5Sjsm  * met:
111c7f94e5Sjsm  *
121c7f94e5Sjsm  * - Redistributions of source code must retain the above copyright notice,
131c7f94e5Sjsm  * this list of conditions and the following disclaimer.
141c7f94e5Sjsm  *
151c7f94e5Sjsm  * - Redistributions in binary form must reproduce the above copyright
161c7f94e5Sjsm  * notice, this list of conditions and the following disclaimer in the
171c7f94e5Sjsm  * documentation and/or other materials provided with the distribution.
181c7f94e5Sjsm  *
191c7f94e5Sjsm  * - Neither the name of the Stichting Centrum voor Wiskunde en
201c7f94e5Sjsm  * Informatica, nor the names of its contributors may be used to endorse or
211c7f94e5Sjsm  * promote products derived from this software without specific prior
221c7f94e5Sjsm  * written permission.
231c7f94e5Sjsm  *
241c7f94e5Sjsm  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
251c7f94e5Sjsm  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
261c7f94e5Sjsm  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
271c7f94e5Sjsm  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
281c7f94e5Sjsm  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
291c7f94e5Sjsm  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
301c7f94e5Sjsm  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
311c7f94e5Sjsm  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
321c7f94e5Sjsm  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
331c7f94e5Sjsm  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
341c7f94e5Sjsm  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3502ded532Smycroft  */
361c7f94e5Sjsm 
371c7f94e5Sjsm /*
381c7f94e5Sjsm  * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
391c7f94e5Sjsm  * All rights reserved.
401c7f94e5Sjsm  *
411c7f94e5Sjsm  * Redistribution and use in source and binary forms, with or without
421c7f94e5Sjsm  * modification, are permitted provided that the following conditions
431c7f94e5Sjsm  * are met:
441c7f94e5Sjsm  * 1. Redistributions of source code must retain the above copyright
451c7f94e5Sjsm  *    notice, this list of conditions and the following disclaimer.
461c7f94e5Sjsm  * 2. Redistributions in binary form must reproduce the above copyright
471c7f94e5Sjsm  *    notice, this list of conditions and the following disclaimer in the
481c7f94e5Sjsm  *    documentation and/or other materials provided with the distribution.
491c7f94e5Sjsm  * 3. The name of the author may not be used to endorse or promote products
501c7f94e5Sjsm  *    derived from this software without specific prior written permission.
511c7f94e5Sjsm  *
521c7f94e5Sjsm  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
531c7f94e5Sjsm  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
541c7f94e5Sjsm  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
551c7f94e5Sjsm  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
561c7f94e5Sjsm  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
571c7f94e5Sjsm  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
581c7f94e5Sjsm  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
591c7f94e5Sjsm  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
601c7f94e5Sjsm  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
611c7f94e5Sjsm  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
621c7f94e5Sjsm  */
631c7f94e5Sjsm 
643ea4a95cSchristos #ifndef _DEF_OBJ_H_
653ea4a95cSchristos #define _DEF_OBJ_H_
6661f28255Scgd struct obj {
6761f28255Scgd 	struct obj *nobj;
6861f28255Scgd 	unsigned o_id;
6961f28255Scgd 	unsigned o_cnt_id;		/* id of container object is in */
7061f28255Scgd 	xchar ox,oy;
7161f28255Scgd 	xchar odx,ody;
7261f28255Scgd 	uchar otyp;
7361f28255Scgd 	uchar owt;
7461f28255Scgd 	uchar quan;		/* use oextra for tmp gold objects */
7561f28255Scgd 	schar spe;		/* quality of weapon, armor or ring (+ or -)
7661f28255Scgd 				   number of charges for wand ( >= -1 )
7761f28255Scgd 				   special for uball and amulet %% BAH */
7861f28255Scgd 	char olet;
7961f28255Scgd 	char invlet;
8061f28255Scgd 	Bitfield(oinvis,1);	/* not yet implemented */
8161f28255Scgd 	Bitfield(odispl,1);
8261f28255Scgd 	Bitfield(known,1);	/* exact nature known */
8361f28255Scgd 	Bitfield(dknown,1);	/* color or text known */
8461f28255Scgd 	Bitfield(cursed,1);
8561f28255Scgd 	Bitfield(unpaid,1);	/* on some bill */
8661f28255Scgd 	Bitfield(rustfree,1);
8761f28255Scgd 	Bitfield(onamelth,6);
8861f28255Scgd 	long age;		/* creation date */
8961f28255Scgd 	long owornmask;
9061f28255Scgd #define	W_ARM	01L
9161f28255Scgd #define	W_ARM2	02L
9261f28255Scgd #define	W_ARMH	04L
9361f28255Scgd #define	W_ARMS	010L
9461f28255Scgd #define	W_ARMG	020L
9561f28255Scgd #define	W_ARMOR		(W_ARM | W_ARM2 | W_ARMH | W_ARMS | W_ARMG)
9661f28255Scgd #define	W_RINGL	010000L	/* make W_RINGL = RING_LEFT (see uprop) */
9761f28255Scgd #define	W_RINGR	020000L
9861f28255Scgd #define	W_RING		(W_RINGL | W_RINGR)
9961f28255Scgd #define	W_WEP	01000L
10061f28255Scgd #define	W_BALL	02000L
10161f28255Scgd #define	W_CHAIN	04000L
10261f28255Scgd 	long oextra[1];		/* used for name of ordinary objects - length
10361f28255Scgd 				   is flexible; amount for tmp gold objects */
10461f28255Scgd };
10561f28255Scgd 
10661f28255Scgd extern struct obj *fobj;
10761f28255Scgd 
108*c51c4568Sdholland #define newobj(xl)	((struct obj *) alloc((xl) + sizeof(struct obj)))
10961f28255Scgd #define	ONAME(otmp)	((char *) otmp->oextra)
11061f28255Scgd #define	OGOLD(otmp)	(otmp->oextra[0])
1113ea4a95cSchristos #endif /* _DEF_OBJ_H_ */
112