Source:NetHack 2.3e/objclass.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to objclass.h from the source code of NetHack 2.3e.

Warning! This is the source code from an old release. For newer releases, see Source code

Screenshots and source code from Hack are used under the CWI license.

1.    /*	SCCS Id: @(#)objclass.h	2.3	88/01/24
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    
4.    /* definition of a class of objects */
5.    
6.    struct objclass {
7.    	char *oc_name;		/* actual name */
8.    	char *oc_descr;		/* description when name unknown */
9.    	char *oc_uname;		/* called by user */
10.   	Bitfield(oc_name_known,1);
11.   	Bitfield(oc_merge,1);	/* merge otherwise equal objects */
12.   	char oc_olet;
13.   	schar oc_prob;		/* probability for mkobj() */
14.   	schar oc_delay;		/* delay when using such an object */
15.   	uchar oc_weight;
16.   	schar oc_oc1, oc_oc2;
17.   	int oc_oi;
18.   #define	nutrition	oc_oi	/* for foods */
19.   #define	a_ac		oc_oc1	/* for armors - only used in ARM_BONUS */
20.   #define ARM_BONUS(obj)	((10 - objects[obj->otyp].a_ac) + obj->spe)
21.   #define	a_can		oc_oc2	/* for armors */
22.   #define bits		oc_oc1	/* for wands and rings */
23.   				/* wands */
24.   #define		NODIR		1
25.   #define		IMMEDIATE	2
26.   #define		RAY		4
27.   				/* rings */
28.   #define		SPEC		1	/* +n is meaningful */
29.     /* Check the AD&D rules!  The FIRST is small monster damage. */
30.   #define	wsdam		oc_oc1	/* for weapons and PICK_AXE */
31.   #define	wldam		oc_oc2	/* for weapons and PICK_AXE */
32.   
33.   #define	g_val		oc_oi	/* for gems: value on exit */
34.   
35.   #ifdef SPELLS
36.   #define spl_lev		oc_oi	/* for books: spell level */
37.   #endif
38.   };
39.   
40.   extern struct objclass objects[];
41.   
42.   /* definitions of all object-symbols */
43.   
44.   #define	RANDOM_SYM	'\0'	/* used for generating random objects */
45.   #define	ILLOBJ_SYM	'\\'
46.   #define	AMULET_SYM	'"'
47.   #define	FOOD_SYM	'%'
48.   #define	WEAPON_SYM	')'
49.   #define	TOOL_SYM	'('
50.   #define	BALL_SYM	'0'
51.   #define	CHAIN_SYM	'_'
52.   #define	ROCK_SYM	'`'
53.   #define	ARMOR_SYM	'['
54.   #define	POTION_SYM	'!'
55.   #define	SCROLL_SYM	'?'
56.   #define	WAND_SYM	'/'
57.   #define	RING_SYM	'='
58.   #define	GEM_SYM		'*'
59.   #define	GOLD_SYM	'$'
60.   #ifdef SPELLS
61.   #define	SPBOOK_SYM	'+'	/* actually SPELL-book */
62.   #endif
63.   /* Other places with explicit knowledge of object symbols:
64.    * mklev.c:	"=/)%?![<>+"	(used for calculating Amulet apperances)
65.    * mkobj.c:	char mkobjstr[] = "))[[!!!!????%%%%/=**+";
66.    * apply.c:   otmp = getobj("0#%", "put in");
67.    * eat.c:     otmp = getobj("%", "eat");
68.    * invent.c:          if(index("!%?[)=*(0/+\"", sym)){
69.    * invent.c:    || index("%?!*+",otmp->olet))){
70.    */