Fandom

Wikihack

Source:NetHack 3.1.0/objclass.h

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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

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

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)objclass.h	3.1	92/10/18	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef OBJCLASS_H
6.    #define OBJCLASS_H
7.    
8.    /* definition of a class of objects */
9.    
10.   struct objclass {
11.   	short	oc_name_idx;		/* index of actual name */
12.   	short	oc_descr_idx;		/* description when name unknown */
13.   	char *	oc_uname;		/* called by user */
14.   	Bitfield(oc_name_known,1);
15.   	Bitfield(oc_merge,1);	/* merge otherwise equal objects */
16.   	Bitfield(oc_uses_known,1); /* obj->known affects full decription */
17.   				/* otherwise, obj->dknown and obj->bknown */
18.   				/* tell all, and obj->known should always */
19.   				/* be set for proper merging behavior */
20.   	Bitfield(oc_magic,1);	/* inherently magical object */
21.   	Bitfield(oc_charged,1);	/* may have +n or (n) charges */
22.   	Bitfield(oc_unique,1);	/* special one-of-a-kind object */
23.   	Bitfield(oc_big,1);
24.   #define oc_bimanual	oc_big	/* for weapons */
25.   #define oc_bulky	oc_big	/* for armor */
26.   
27.   	Bitfield(oc_dir,2);
28.   #define	NODIR		1
29.   #define	IMMEDIATE	2
30.   #define	RAY		3
31.   
32.   	Bitfield(oc_material,5);
33.   #define LIQUID		1	/* currently only for venom */
34.   #define WAX		2
35.   #define VEGGY		3	/* foodstuffs */
36.   #define FLESH		4	/*   ditto    */
37.   #define PAPER		5
38.   #define CLOTH		6
39.   #define LEATHER		7
40.   #define WOOD		8
41.   #define BONE		9
42.   #define DRAGON_HIDE	10	/* not leather! */
43.   #define IRON		11	/* Fe - includes steel */
44.   #define METAL		12	/* Sn, &c. */
45.   #define COPPER		13	/* Cu - includes brass */
46.   #define SILVER		14	/* Ag */
47.   #define GOLD		15	/* Au */
48.   #define PLATINUM	16	/* Pt */
49.   #define MITHRIL		17
50.   #define PLASTIC		18
51.   #define GLASS		19
52.   #define GEMSTONE	20
53.   #define MINERAL		21
54.   
55.   #define is_organic(otmp)	(objects[otmp->otyp].oc_material <= WOOD)
56.   #define is_metallic(otmp)	(objects[otmp->otyp].oc_material >= IRON && \
57.   				 objects[otmp->otyp].oc_material <= PLATINUM)
58.   #define is_corrodeable(otmp)	(objects[otmp->otyp].oc_material == COPPER)
59.   #define is_rustprone(otmp)	(objects[otmp->otyp].oc_material == IRON)
60.   
61.   	uchar	oc_oprop;		/* property (invis, &c.) conveyed */
62.   	char	oc_class;		/* object class */
63.   	schar	oc_delay;		/* delay when using such an object */
64.   #ifdef TEXTCOLOR
65.   	uchar	oc_color;		/* display color of the object */
66.   #endif /* TEXTCOLOR */
67.   	short	oc_prob;		/* probability, used in mkobj() */
68.   	unsigned short	oc_weight;	/* encumbrance (1 cn = 0.1 lb.) */
69.   	short	oc_cost;		/* base cost in shops */
70.   /* Check the AD&D rules!  The FIRST is small monster damage. */
71.   /* for weapons, and tools, rocks, and gems useful as weapons */
72.   	schar	oc_wsdam, oc_wldam;	/* max small/large monster damage */
73.   	schar	oc_oc1, oc_oc2;
74.   #define	oc_hitbon	oc_oc1		/* weapons: "to hit" bonus */
75.   #define w_propellor	oc_oc2		/* weapons: negative value = bow */
76.   #define WP_BOW		1
77.   #define WP_SLING	2
78.   #define WP_CROSSBOW	3
79.   
80.   #define	a_ac		oc_oc1	/* armor class, used in ARM_BONUS in do.c */
81.   #define	a_can		oc_oc2		/* armor: used in mhitu.c */
82.   #define oc_level	oc_oc2		/* books: spell level */
83.   
84.   	unsigned short	oc_nutrition;	/* food value */
85.   };
86.   
87.   struct objdescr {
88.   	const char *oc_name;		/* actual name */
89.   	const char *oc_descr;		/* description when name unknown */
90.   };
91.   
92.   extern struct objclass NEARDATA objects[];
93.   extern struct objdescr NEARDATA obj_descr[];
94.   
95.   /*
96.    * All objects have a class. Make sure that all classes have a corresponding
97.    * symbol below.
98.    */
99.   #define	RANDOM_CLASS	 0	/* used for generating random objects */
100.  #define	ILLOBJ_CLASS	 1
101.  #define	WEAPON_CLASS	 2
102.  #define	ARMOR_CLASS	 3
103.  #define	RING_CLASS	 4
104.  #define	AMULET_CLASS	 5
105.  #define	TOOL_CLASS	 6
106.  #define	FOOD_CLASS	 7
107.  #define	POTION_CLASS	 8
108.  #define	SCROLL_CLASS	 9
109.  #define	SPBOOK_CLASS	10	/* actually SPELL-book */
110.  #define	WAND_CLASS	11
111.  #define	GOLD_CLASS	12
112.  #define	GEM_CLASS	13
113.  #define	ROCK_CLASS	14
114.  #define	BALL_CLASS	15
115.  #define	CHAIN_CLASS	16
116.  #define	VENOM_CLASS	17
117.  #define MAXOCLASSES     18
118.  
119.  #define ALLOW_COUNT	(MAXOCLASSES+1)	/* Can be used in the object class */
120.  #define ALL_CLASSES	(MAXOCLASSES+2)	/* input to getobj().		   */
121.  #define ALLOW_NONE	(MAXOCLASSES+3)	/*				   */
122.  
123.  #if 0	/* moved to decl.h so that makedefs.c won't see them */
124.  extern const char def_oc_syms[MAXOCLASSES];	/* default class symbols */
125.  extern uchar oc_syms[MAXOCLASSES];		/* current class symbols */
126.  #endif
127.  
128.  /* Default definitions of all object-symbols (must match classes above). */
129.  
130.  #define	ILLOBJ_SYM	']'	/* should be same as S_MIMIC_DEF      */
131.  #define	WEAPON_SYM	')'
132.  #define	ARMOR_SYM	'['
133.  #define	RING_SYM	'='
134.  #define	AMULET_SYM	'"'
135.  #define	TOOL_SYM	'('
136.  #define	FOOD_SYM	'%'
137.  #define	POTION_SYM	'!'
138.  #define	SCROLL_SYM	'?'
139.  #define	SPBOOK_SYM	'+'
140.  #define	WAND_SYM	'/'
141.  #define	GOLD_SYM	'$'
142.  #define	GEM_SYM		'*'
143.  #define	ROCK_SYM	'`'
144.  #define	BALL_SYM	'0'
145.  #define	CHAIN_SYM	'_'
146.  #define	VENOM_SYM	'.'
147.  
148.  #ifdef TUTTI_FRUTTI
149.  struct fruit {
150.  	char fname[PL_FSIZ];
151.  	int fid;
152.  	struct fruit *nextf;
153.  };
154.  #define newfruit() (struct fruit *)alloc(sizeof(struct fruit))
155.  #define dealloc_fruit(rind) free((genericptr_t) (rind))
156.  #endif
157.  
158.  #define OBJ_NAME(obj)  (obj_descr[(obj).oc_name_idx].oc_name)
159.  #define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr)
160.  #endif /* OBJCLASS_H */

Also on Fandom

Random Wiki