1 /* NetHack 3.7 drawing.c $NHDT-Date: 1596498163 2020/08/03 23:42:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ */
2 /* Copyright (c) NetHack Development Team 1992. */
3 /* NetHack may be freely redistributed. See license for details. */
12 extern const struct symparse loadsyms
[];
13 extern const struct class_sym def_oc_syms
[MAXOCLASSES
];
14 extern const struct class_sym def_monsyms
[MAXMCLASSES
];
15 extern const uchar def_r_oc_syms
[MAXOCLASSES
];
17 /* Relevant header information in rm.h, objclass.h, sym.h, defsym.h. */
19 /* Default object class symbols. See objclass.h.
20 * {symbol, name, explain}
21 * name: used in object_detect().
22 * explain: used in do_look().
24 const struct class_sym def_oc_syms
[MAXOCLASSES
] = {
25 { '\0', "", "" }, /* placeholder for the "random class" */
26 #define OBJCLASS_DRAWING
28 #undef OBJCLASS_DRAWING
31 /* Default monster class symbols. See sym.h and defsym.h. */
32 const struct class_sym def_monsyms
[MAXMCLASSES
] = {
34 #define MONSYMS_DRAWING
36 #undef MONSYMS_DRAWING
39 const struct symdef def_warnsyms
[WARNCOUNT
] = {
41 { '0', "unknown creature causing you worry", CLR_WHITE
},
43 { '1', "unknown creature causing you concern", CLR_RED
},
45 { '2', "unknown creature causing you anxiety", CLR_RED
},
47 { '3', "unknown creature causing you disquiet", CLR_RED
},
49 { '4', "unknown creature causing you alarm", CLR_MAGENTA
},
51 { '5', "unknown creature causing you dread", CLR_BRIGHT_MAGENTA
},
55 * Default screen symbols with explanations and colors.
57 * If adding to or removing from this list, please note that,
58 * for builds with tile support, there is an array called altlabels[] in
59 * win/share/tilemap.c that requires the same number of elements as
60 * this, in the same order. It is used for tile name matching when
61 * parsing other.txt because some of the useful tile names don't exist
62 * within NetHack itself.
64 const struct symdef defsyms
[MAXPCHARS
+ 1] = {
71 /* default rogue level symbols */
72 const uchar def_r_oc_syms
[MAXOCLASSES
] = {
73 /* 0*/ '\0', ILLOBJ_SYM
, WEAPON_SYM
, ']', /* armor */
75 /* 5*/ ',', /* amulet */
76 TOOL_SYM
, ':', /* food */
77 POTION_SYM
, SCROLL_SYM
,
78 /*10*/ SPBOOK_SYM
, WAND_SYM
,
79 GEM_SYM
, /* gold -- yes it's the same as gems */
81 /*15*/ BALL_SYM
, CHAIN_SYM
, VENOM_SYM
85 * Convert the given character to an object class. If the character is not
86 * recognized, then MAXOCLASSES is returned. Used in detect.c, invent.c,
87 * objnam.c, options.c, pickup.c, sp_lev.c, lev_main.c, and tilemap.c.
90 def_char_to_objclass(char ch
)
94 for (i
= 1; i
< MAXOCLASSES
; i
++)
95 if (ch
== def_oc_syms
[i
].sym
)
101 * Convert a character into a monster class. This returns the _first_
102 * match made. If there are no matches, return MAXMCLASSES.
103 * Used in detect.c, options.c, read.c, sp_lev.c, and lev_main.c
106 def_char_to_monclass(char ch
)
110 for (i
= 1; i
< MAXMCLASSES
; i
++)
111 if (ch
== def_monsyms
[i
].sym
)
116 /* does 'ch' represent a furniture character? returns index into defsyms[] */
118 def_char_is_furniture(char ch
)
120 /* note: these refer to defsyms[] order which is much different from
121 levl[][].typ order but both keep furniture in a contiguous block */
122 static const char first_furniture
[] = "stair", /* "staircase up" */
123 last_furniture
[] = "fountain";
125 boolean furniture
= FALSE
;
127 for (i
= 0; i
< MAXPCHARS
; ++i
) {
129 if (!strncmp(defsyms
[i
].explanation
, first_furniture
, 5))
133 if (defsyms
[i
].sym
== (uchar
) ch
)
135 if (!strcmp(defsyms
[i
].explanation
, last_furniture
))
136 break; /* reached last furniture */