Source:Hack 1.0/def.objclass.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to def.objclass.h from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/def.objclass.h#line123]], for example.

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

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

1.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
2.    
3.    /* definition of a class of objects */
4.    
5.    struct objclass {
6.    	char *oc_name;		/* actual name */
7.    	char *oc_descr;		/* description when name unknown */
8.    	char *oc_uname;		/* called by user */
9.    	Bitfield(oc_name_known,1);
10.   	Bitfield(oc_merge,1);	/* merge otherwise equal objects */
11.   	char oc_olet;
12.   	schar oc_prob;		/* probability for mkobj() */
13.   	schar oc_delay;		/* delay when using such an object */
14.   	uchar oc_weight;
15.   	schar oc_oc1, oc_oc2;
16.   	int oc_oi;
17.   #define	nutrition	oc_oi	/* for foods */
18.   #define	a_ac		oc_oc1	/* for armors */
19.   #define	a_can		oc_oc2	/* for armors */
20.   #define bits		oc_oc1	/* for wands and rings */
21.   				/* wands */
22.   #define		NODIR		1
23.   #define		IMMEDIATE	2
24.   #define		RAY		4
25.   				/* rings */
26.   #define		SPEC		1	/* +n is meaningful */
27.   #define	wldam		oc_oc1	/* for weapons */
28.   #define	wsdam		oc_oc2	/* for weapons */
29.   #define	g_val		oc_oi	/* for gems: value on exit */
30.   };
31.   
32.   extern struct objclass objects[];
33.   
34.   /* definitions of all object-symbols */
35.   
36.   #define	ILLOBJ_SYM	'\\'
37.   #define	AMULET_SYM	'"'
38.   #define	FOOD_SYM	'%'
39.   #define	WEAPON_SYM	')'
40.   #define	TOOL_SYM	'('
41.   #define	BALL_SYM	'0'
42.   #define	CHAIN_SYM	'_'
43.   #define	ROCK_SYM	'`'
44.   #define	ARMOR_SYM	'['
45.   #define	POTION_SYM	'!'
46.   #define	SCROLL_SYM	'?'
47.   #define	WAND_SYM	'/'
48.   #define	RING_SYM	'='
49.   #define	GEM_SYM		'*'
50.   /* Other places with explicit knowledge of object symbols:
51.    * ....shk.c:	char shtypes[] = "=/)%?![";
52.    * mklev.c:	"=/)%?![<>"
53.    * hack.mkobj.c:	char mkobjstr[] = "))[[!!!!????%%%%/=**";
54.    * hack.apply.c:   otmp = getobj("0#%", "put in");
55.    * hack.eat.c:     otmp = getobj("%", "eat");
56.    * hack.invent.c:          if(index("!%?[)=*(0/\"", sym)){
57.    * hack.invent.c:    || index("%?!*",otmp->olet))){
58.    */