xref: /netbsd-src/games/hack/def.objclass.h (revision cbc660deeeb9a72aad2194c6ce4c3156d7c1d036)
1*cbc660deSdholland /*	$NetBSD: def.objclass.h,v 1.7 2011/08/06 19:23:38 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_OBJCLASS_H_
653ea4a95cSchristos #define _DEF_OBJCLASS_H_
6661f28255Scgd /* definition of a class of objects */
6761f28255Scgd 
6861f28255Scgd struct objclass {
69ab8b6343Sjsm 	const char *oc_name;		/* actual name */
70ab8b6343Sjsm 	const char *oc_descr;		/* description when name unknown */
7161f28255Scgd 	char *oc_uname;		/* called by user */
7261f28255Scgd 	Bitfield(oc_name_known,1);
7361f28255Scgd 	Bitfield(oc_merge,1);	/* merge otherwise equal objects */
7461f28255Scgd 	char oc_olet;
7561f28255Scgd 	schar oc_prob;		/* probability for mkobj() */
7661f28255Scgd 	schar oc_delay;		/* delay when using such an object */
7761f28255Scgd 	uchar oc_weight;
7861f28255Scgd 	schar oc_oc1, oc_oc2;
7961f28255Scgd 	int oc_oi;
8061f28255Scgd #define	nutrition	oc_oi	/* for foods */
8161f28255Scgd #define	a_ac		oc_oc1	/* for armors - only used in ARM_BONUS */
8261f28255Scgd #define ARM_BONUS(obj)	((10 - objects[obj->otyp].a_ac) + obj->spe)
8361f28255Scgd #define	a_can		oc_oc2	/* for armors */
8461f28255Scgd #define bits		oc_oc1	/* for wands and rings */
8561f28255Scgd 				/* wands */
8661f28255Scgd #define		NODIR		1
8761f28255Scgd #define		IMMEDIATE	2
8861f28255Scgd #define		RAY		4
8961f28255Scgd 				/* rings */
9061f28255Scgd #define		SPEC		1	/* +n is meaningful */
9161f28255Scgd #define	wldam		oc_oc1	/* for weapons and PICK_AXE */
9261f28255Scgd #define	wsdam		oc_oc2	/* for weapons and PICK_AXE */
9361f28255Scgd #define	g_val		oc_oi	/* for gems: value on exit */
9461f28255Scgd };
9561f28255Scgd 
9661f28255Scgd extern struct objclass objects[];
9761f28255Scgd 
9861f28255Scgd /* definitions of all object-symbols */
9961f28255Scgd 
10061f28255Scgd #define	ILLOBJ_SYM	'\\'
10161f28255Scgd #define	AMULET_SYM	'"'
10261f28255Scgd #define	FOOD_SYM	'%'
10361f28255Scgd #define	WEAPON_SYM	')'
10461f28255Scgd #define	TOOL_SYM	'('
10561f28255Scgd #define	BALL_SYM	'0'
10661f28255Scgd #define	CHAIN_SYM	'_'
10761f28255Scgd #define	ROCK_SYM	'`'
10861f28255Scgd #define	ARMOR_SYM	'['
10961f28255Scgd #define	POTION_SYM	'!'
11061f28255Scgd #define	SCROLL_SYM	'?'
11161f28255Scgd #define	WAND_SYM	'/'
11261f28255Scgd #define	RING_SYM	'='
11361f28255Scgd #define	GEM_SYM		'*'
11461f28255Scgd /* Other places with explicit knowledge of object symbols:
11561f28255Scgd  * ....shk.c:	char shtypes[] = "=/)%?![";
11661f28255Scgd  * mklev.c:	"=/)%?![<>"
11761f28255Scgd  * hack.mkobj.c:	char mkobjstr[] = "))[[!!!!????%%%%/=**";
11861f28255Scgd  * hack.apply.c:   otmp = getobj("0#%", "put in");
11961f28255Scgd  * hack.eat.c:     otmp = getobj("%", "eat");
120*cbc660deSdholland  * hack.invent.c:          if(strchr("!%?[)=*(0/\"", sym)){
121*cbc660deSdholland  * hack.invent.c:    || strchr("%?!*",otmp->olet))){
12261f28255Scgd  */
1233ea4a95cSchristos #endif /* _DEF_OBJCLASS_H_ */
124