Source:NetHack 5.0.0/include/sym.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to sym.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/sym.h#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. /* NetHack	5.0	sym.h	$NHDT-Date: $ $NHDT-Branch: $ $NHDT-Revision: $ */
2. /*      Copyright (c) 2016 by Pasi Kallinen              */
3. /* NetHack may be freely redistributed.  See license for details. */
4. 
5. #ifndef SYM_H
6. #define SYM_H
7. 
8. /*
9.  * Default characters for monsters.
10.  */
11. /* clang-format off */
12. enum mon_defchars {
13. #define MONSYMS_DEFCHAR_ENUM
14. #include "defsym.h"
15. #undef MONSYMS_DEFCHAR_ENUM
16. };
17. /* clang-format on */
18. 
19. enum mon_syms {
20. #define MONSYMS_S_ENUM
21. #include "defsym.h"
22. #undef MONSYMS_S_ENUM
23. 
24.     MAXMCLASSES  /* number of monster classes */
25. };
26. 
27. #ifndef MAKEDEFS_C
28. /* Default characters for dungeon surroundings and furniture */
29. enum cmap_symbols {
30. #define PCHAR_S_ENUM
31. #include "defsym.h"
32. #undef PCHAR_S_ENUM
33.     MAXPCHARS
34. };
35. 
36. /*
37.  * special symbol set handling types ( for invoking callbacks, etc.)
38.  * Must match the order of the known_handlers strings
39.  * in drawing.c
40.  */
41. 
42. enum symset_handling_types {
43.     H_UNK = 0,
44.     H_IBM = 1,
45.     H_DEC = 2,
46.     H_CURS = 3,
47.     H_MAC = 4, /* obsolete; needed so that the listing of available
48.                 * symsets by 'O' can skip it for !MAC_GRAPHICS_ENV */
49.     H_UTF8 = 5
50. };
51. 
52. struct symdef {
53.     uchar sym;
54.     const char *explanation;
55.     uchar color;
56. };
57. 
58. enum symparse_range {
59.     SYM_INVALID = 0,
60.     SYM_CONTROL = 1, /* start/finish markers */
61.     SYM_PCHAR = 2,   /* index into showsyms  */
62.     SYM_OC = 3,      /* index into oc_syms   */
63.     SYM_MON = 4,     /* index into monsyms   */
64.     SYM_OTH = 5      /* misc                 */
65. };
66. 
67. struct symparse {
68.     enum symparse_range range;
69.     int idx;
70.     const char *name;
71. };
72. 
73. /* linked list of symsets and their characteristics */
74. struct symsetentry {
75.     struct symsetentry *next; /* next in list                         */
76.     char *name;               /* ptr to symset name                   */
77.     char *desc;               /* ptr to description                   */
78.     int idx;                  /* an index value                       */
79.     enum symset_handling_types handling;      /* known handlers value */
80.     Bitfield(nocolor, 1);     /* don't use color if set               */
81.     Bitfield(primary, 1);     /* restricted for use as primary set    */
82.     Bitfield(rogue, 1);       /* restricted for use as rogue lev set  */
83.     Bitfield(explicitly, 1);  /* explicit symset set                  */
84.                               /* 4 free bits */
85. };
86. 
87. /*
88.  *
89.  */
90. 
91. #define MAXDCHARS (S_water - S_stone + 1) /* mapped dungeon characters */
92. #define MAXTCHARS (TRAPNUM - 1) /* trap chars */
93. #define MAXECHARS (S_expl_br - S_vbeam + 1) /* mapped effects characters */
94. #define MAXEXPCHARS 9 /* number of explosion characters */
95. 
96. #define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom)
97. 
98. #define is_cmap_trap(i) ((i) >= S_arrow_trap && (i) < S_arrow_trap + MAXTCHARS)
99. #define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge)
100. #define is_cmap_door(i) ((i) >= S_vodoor && (i) <= S_hcdoor)
101. #define is_cmap_wall(i) ((i) >= S_stone && (i) <= S_trwall)
102. #define is_cmap_room(i) ((i) >= S_room && (i) <= S_darkroom)
103. #define is_cmap_corr(i) ((i) >= S_corr && (i) <= S_litcorr)
104. #define is_cmap_furniture(i) ((i) >= S_upstair && (i) <= S_fountain)
105. #define is_cmap_water(i) ((i) == S_pool || (i) == S_water)
106. #define is_cmap_lava(i) ((i) == S_lava || (i) == S_lavawall)
107. #define is_cmap_stairs(i) ((i) >= S_upstair && (i) <= S_brdnladder)
108. #define is_cmap_engraving(i) ((i) == S_engroom || (i) == S_engrcorr)
109. 
110. /* misc symbol definitions */
111. enum misc_symbols {
112.         SYM_NOTHING = 0,
113.         SYM_UNEXPLORED = 1,
114.         SYM_BOULDER = 2,
115.         SYM_INVISIBLE = 3,
116.         SYM_PET_OVERRIDE = 4,
117.         SYM_HERO_OVERRIDE = 5,
118.         MAXOTHER
119. };
120. 
121. /*
122.  * Graphics sets for display symbols
123.  */
124. #define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */
125. enum graphics_sets {
126.         PRIMARYSET = 0,       /* primary graphics set        */
127.         ROGUESET = 1,         /* rogue graphics set          */
128.         NUM_GRAPHICS,
129.         UNICODESET = NUM_GRAPHICS
130. };
131. 
132. enum do_customizations {
133.        do_custom_none,
134.        do_custom_colors,
135.        do_custom_symbols
136. };
137. 
138. enum customization_types { custom_none, custom_symbols,
139.     custom_ureps, custom_nhcolor,  custom_count };
140. 
141. struct custom_symbol {
142.     const struct symparse *symparse;
143.     unsigned char val;
144. };
145. struct custom_urep {
146.     int glyphidx;
147.     struct unicode_representation u;
148. };
149. struct custom_nhcolor {
150.     int glyphidx;
151.     uint32 nhcolor;
152. };
153. union customization_content {
154.     struct custom_symbol sym;
155.     struct custom_urep urep;
156.     struct custom_nhcolor ccolor;
157. };
158. struct customization_detail {
159.     union customization_content content;
160.     struct customization_detail *next;
161. };
162. 
163. 
164. /* one set per symset_name */
165. struct symset_customization {
166.     const char *customization_name;
167.     int count;
168.     enum customization_types custtype;
169.     struct customization_detail *details;
170.     struct customization_detail *details_end;
171. };
172. 
173. extern const struct symdef defsyms[MAXPCHARS + 1]; /* defaults */
174. #define WARNCOUNT 6 /* number of different warning levels */
175. extern const struct symdef def_warnsyms[WARNCOUNT];
176. #define SYMHANDLING(ht) (gs.symset[gc.currentgraphics].handling == (ht))
177. 
178. #endif /* !MAKEDEFS_C */
179. #endif /* SYM_H */
180.