streamline defsym.h
Condense the setup of PCHAR/PCHAR2 and OBJCLASS/OBJCLASS2 (last one renamed from OBJCLASS7) so that it's easier to see the variations at once on an ordinary size terminal/window. Revise some of the indentation and other spacing, also to try to enhance readability a little. Unrelated: remove a trailing space that crept in with a recent pull request.
This commit is contained in:
+44
-50
@@ -63,31 +63,26 @@
|
|||||||
|
|
||||||
#if defined(PCHAR_S_ENUM)
|
#if defined(PCHAR_S_ENUM)
|
||||||
/* sym.h */
|
/* sym.h */
|
||||||
#define PCHAR(idx, ch, sym, desc, clr) \
|
#define PCHAR(idx, ch, sym, desc, clr) sym = idx,
|
||||||
sym = idx,
|
|
||||||
#define PCHAR2(idx, ch, sym, tilenm, desc, clr) \
|
|
||||||
sym = idx,
|
|
||||||
|
|
||||||
#elif defined(PCHAR_PARSE)
|
#elif defined(PCHAR_PARSE)
|
||||||
/* symbols.c */
|
/* symbols.c */
|
||||||
#define PCHAR(idx, ch, sym, desc, clr) \
|
#define PCHAR(idx, ch, sym, desc, clr) { SYM_PCHAR, sym, #sym },
|
||||||
{ SYM_PCHAR, sym, #sym },
|
|
||||||
#define PCHAR2(idx, ch, sym, tilenm, desc, clr) \
|
|
||||||
{ SYM_PCHAR, sym, #sym },
|
|
||||||
|
|
||||||
#elif defined(PCHAR_DRAWING)
|
#elif defined(PCHAR_DRAWING)
|
||||||
/* drawing.c */
|
/* drawing.c */
|
||||||
#define PCHAR(idx, ch, sym, desc, clr) \
|
#define PCHAR(idx, ch, sym, desc, clr) { ch, desc, clr },
|
||||||
{ ch, desc, clr },
|
|
||||||
#define PCHAR2(idx, ch, sym, tilenm, desc, clr) \
|
|
||||||
{ ch, desc, clr },
|
|
||||||
|
|
||||||
#elif defined(PCHAR_TILES)
|
#elif defined(PCHAR_TILES)
|
||||||
/* win/share/tilemap.c */
|
/* win/share/tilemap.c */
|
||||||
#define PCHAR(idx, ch, sym, desc, clr) \
|
#define PCHAR(idx, ch, sym, desc, clr) { sym, desc, desc },
|
||||||
{ sym, desc, desc },
|
#endif
|
||||||
#define PCHAR2(idx, ch, sym, tilenm, desc, clr) \
|
|
||||||
{ sym, tilenm, desc },
|
/* PCHAR with extra arg */
|
||||||
|
#if defined(PCHAR_TILES)
|
||||||
|
#define PCHAR2(idx, ch, sym, tilenm, desc, clr) { sym, tilenm, desc },
|
||||||
|
#else
|
||||||
|
#define PCHAR2(idx, ch, sym, tilenm, desc, clr) PCHAR(idx, ch, sym, desc, clr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PCHAR2( 0, ' ', S_stone, "dark part of a room", "stone", CLR(NO_COLOR))
|
PCHAR2( 0, ' ', S_stone, "dark part of a room", "stone", CLR(NO_COLOR))
|
||||||
@@ -95,10 +90,10 @@
|
|||||||
PCHAR2( 2, '-', S_hwall, "horizontal wall", "wall", CLR(CLR_GRAY))
|
PCHAR2( 2, '-', S_hwall, "horizontal wall", "wall", CLR(CLR_GRAY))
|
||||||
PCHAR2( 3, '-', S_tlcorn, "top left corner wall", "wall", CLR(CLR_GRAY))
|
PCHAR2( 3, '-', S_tlcorn, "top left corner wall", "wall", CLR(CLR_GRAY))
|
||||||
PCHAR2( 4, '-', S_trcorn, "top right corner wall", "wall", CLR(CLR_GRAY))
|
PCHAR2( 4, '-', S_trcorn, "top right corner wall", "wall", CLR(CLR_GRAY))
|
||||||
PCHAR2( 5, '-', S_blcorn,
|
PCHAR2( 5, '-', S_blcorn, "bottom left corner wall",
|
||||||
"bottom left corner wall", "wall", CLR(CLR_GRAY))
|
"wall", CLR(CLR_GRAY))
|
||||||
PCHAR2( 6, '-', S_brcorn,
|
PCHAR2( 6, '-', S_brcorn, "bottom right corner wall",
|
||||||
"bottom right corner wall", "wall", CLR(CLR_GRAY))
|
"wall", CLR(CLR_GRAY))
|
||||||
PCHAR2( 7, '-', S_crwall, "cross wall", "wall", CLR(CLR_GRAY))
|
PCHAR2( 7, '-', S_crwall, "cross wall", "wall", CLR(CLR_GRAY))
|
||||||
PCHAR2( 8, '-', S_tuwall, "tuwall", "wall", CLR(CLR_GRAY))
|
PCHAR2( 8, '-', S_tuwall, "tuwall", "wall", CLR(CLR_GRAY))
|
||||||
PCHAR2( 9, '-', S_tdwall, "tdwall", "wall", CLR(CLR_GRAY))
|
PCHAR2( 9, '-', S_tdwall, "tdwall", "wall", CLR(CLR_GRAY))
|
||||||
@@ -106,14 +101,14 @@
|
|||||||
PCHAR2(11, '|', S_trwall, "trwall", "wall", CLR(CLR_GRAY))
|
PCHAR2(11, '|', S_trwall, "trwall", "wall", CLR(CLR_GRAY))
|
||||||
/* start cmap A */
|
/* start cmap A */
|
||||||
PCHAR2(12, '.', S_ndoor, "no door", "doorway", CLR(CLR_GRAY))
|
PCHAR2(12, '.', S_ndoor, "no door", "doorway", CLR(CLR_GRAY))
|
||||||
PCHAR2(13, '-', S_vodoor,
|
PCHAR2(13, '-', S_vodoor, "vertical open door",
|
||||||
"vertical open door", "open door", CLR(CLR_BROWN))
|
"open door", CLR(CLR_BROWN))
|
||||||
PCHAR2(14, '|', S_hodoor,
|
PCHAR2(14, '|', S_hodoor, "horizontal open door",
|
||||||
"horizontal open door", "open door", CLR(CLR_BROWN))
|
"open door", CLR(CLR_BROWN))
|
||||||
PCHAR2(15, '+', S_vcdoor,
|
PCHAR2(15, '+', S_vcdoor, "vertical closed door",
|
||||||
"vertical closed door", "closed door", CLR(CLR_BROWN))
|
"closed door", CLR(CLR_BROWN))
|
||||||
PCHAR2(16, '+', S_hcdoor,
|
PCHAR2(16, '+', S_hcdoor, "horizontal closed door",
|
||||||
"horizontal closed door", "closed door", CLR(CLR_BROWN))
|
"closed door", CLR(CLR_BROWN))
|
||||||
PCHAR( 17, '#', S_bars, "iron bars", CLR(HI_METAL))
|
PCHAR( 17, '#', S_bars, "iron bars", CLR(HI_METAL))
|
||||||
PCHAR( 18, '#', S_tree, "tree", CLR(CLR_GREEN))
|
PCHAR( 18, '#', S_tree, "tree", CLR(CLR_GREEN))
|
||||||
PCHAR( 19, '.', S_room, "floor of a room", CLR(CLR_GRAY))
|
PCHAR( 19, '.', S_room, "floor of a room", CLR(CLR_GRAY))
|
||||||
@@ -261,13 +256,11 @@
|
|||||||
|
|
||||||
#if defined(MONSYMS_S_ENUM)
|
#if defined(MONSYMS_S_ENUM)
|
||||||
/* sym.h */
|
/* sym.h */
|
||||||
#define MONSYM(idx, ch, basename, sym, desc) \
|
#define MONSYM(idx, ch, basename, sym, desc) sym = idx,
|
||||||
sym = idx,
|
|
||||||
|
|
||||||
#elif defined(MONSYMS_DEFCHAR_ENUM)
|
#elif defined(MONSYMS_DEFCHAR_ENUM)
|
||||||
/* sym.h */
|
/* sym.h */
|
||||||
#define MONSYM(idx, ch, basename, sym, desc) \
|
#define MONSYM(idx, ch, basename, sym, desc) DEF_##basename = ch,
|
||||||
DEF_##basename = ch,
|
|
||||||
|
|
||||||
#elif defined(MONSYMS_PARSE)
|
#elif defined(MONSYMS_PARSE)
|
||||||
/* symbols.c */
|
/* symbols.c */
|
||||||
@@ -276,8 +269,7 @@
|
|||||||
|
|
||||||
#elif defined(MONSYMS_DRAWING)
|
#elif defined(MONSYMS_DRAWING)
|
||||||
/* drawing.c */
|
/* drawing.c */
|
||||||
#define MONSYM(idx, ch, basename, sym, desc) \
|
#define MONSYM(idx, ch, basename, sym, desc) { DEF_##basename, "", desc },
|
||||||
{ DEF_##basename, "", desc },
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MONSYM( 1, 'a', ANT, S_ANT, "ant or other insect")
|
MONSYM( 1, 'a', ANT, S_ANT, "ant or other insect")
|
||||||
@@ -354,8 +346,8 @@
|
|||||||
MONSYM(60, ']', MIMIC_DEF, S_MIMIC_DEF, "mimic")
|
MONSYM(60, ']', MIMIC_DEF, S_MIMIC_DEF, "mimic")
|
||||||
|
|
||||||
#undef MONSYM
|
#undef MONSYM
|
||||||
#endif /* MONSYMS_S_ENUM || MONSYMS_DEFCHAR_ENUM || MONSYMS_PARSE */
|
#endif /* MONSYMS_S_ENUM || MONSYMS_DEFCHAR_ENUM || MONSYMS_PARSE
|
||||||
/* || MONSYMS_DRAWING */
|
* || MONSYMS_DRAWING */
|
||||||
|
|
||||||
#if defined(OBJCLASS_S_ENUM) || defined(OBJCLASS_DEFCHAR_ENUM) \
|
#if defined(OBJCLASS_S_ENUM) || defined(OBJCLASS_DEFCHAR_ENUM) \
|
||||||
|| defined(OBJCLASS_CLASS_ENUM) || defined(OBJCLASS_PARSE) \
|
|| defined(OBJCLASS_CLASS_ENUM) || defined(OBJCLASS_PARSE) \
|
||||||
@@ -371,7 +363,7 @@
|
|||||||
name: used in object_detect()
|
name: used in object_detect()
|
||||||
explain: used in do_look()
|
explain: used in do_look()
|
||||||
|
|
||||||
OBJCLASS7(idx, ch, basename, sname, sym, name, explain)
|
OBJCLASS2(idx, ch, basename, sname, sym, name, explain)
|
||||||
idx: index used in enum
|
idx: index used in enum
|
||||||
ch: default character
|
ch: default character
|
||||||
basename: unadorned base name of objclass, used
|
basename: unadorned base name of objclass, used
|
||||||
@@ -387,36 +379,38 @@
|
|||||||
/* objclass.h */
|
/* objclass.h */
|
||||||
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
||||||
basename##_CLASS = idx,
|
basename##_CLASS = idx,
|
||||||
#define OBJCLASS7(idx, ch, basename, sname, sym, name, explain) \
|
|
||||||
basename##_CLASS = idx,
|
|
||||||
|
|
||||||
#elif defined(OBJCLASS_DEFCHAR_ENUM)
|
#elif defined(OBJCLASS_DEFCHAR_ENUM)
|
||||||
/* objclass.h */
|
/* objclass.h */
|
||||||
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
||||||
basename##_SYM = ch,
|
basename##_SYM = ch,
|
||||||
#define OBJCLASS7(idx, ch, basename, sname, sym, name, explain) \
|
|
||||||
sname = ch,
|
|
||||||
|
|
||||||
#elif defined(OBJCLASS_S_ENUM)
|
#elif defined(OBJCLASS_S_ENUM)
|
||||||
/* objclass.h */
|
/* objclass.h */
|
||||||
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
||||||
sym = idx,
|
sym = idx,
|
||||||
#define OBJCLASS7(idx, ch, basename, sname, sym, name, explain) \
|
|
||||||
sym = idx,
|
|
||||||
|
|
||||||
#elif defined(OBJCLASS_PARSE)
|
#elif defined(OBJCLASS_PARSE)
|
||||||
/* symbols.c */
|
/* symbols.c */
|
||||||
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
||||||
{ SYM_OC, sym + SYM_OFF_O, #sym },
|
{ SYM_OC, sym + SYM_OFF_O, #sym },
|
||||||
#define OBJCLASS7(idx, ch, basename, sname, sym, name, explain) \
|
|
||||||
{ SYM_OC, sym + SYM_OFF_O, #sym },
|
|
||||||
|
|
||||||
#elif defined(OBJCLASS_DRAWING)
|
#elif defined(OBJCLASS_DRAWING)
|
||||||
/* drawing.c */
|
/* drawing.c */
|
||||||
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
#define OBJCLASS(idx, ch, basename, sym, name, explain) \
|
||||||
{ basename##_SYM, name, explain },
|
{ basename##_SYM, name, explain },
|
||||||
#define OBJCLASS7(idx, ch, basename, sname, sym, name, explain) \
|
#endif
|
||||||
|
|
||||||
|
/* OBJCLASS with extra arg */
|
||||||
|
#if defined(OBJCLASS_DEFCHAR_ENUM)
|
||||||
|
#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \
|
||||||
|
sname = ch,
|
||||||
|
#elif defined(OBJCLASS_DRAWING)
|
||||||
|
#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \
|
||||||
{ sname, name, explain },
|
{ sname, name, explain },
|
||||||
|
#else
|
||||||
|
#define OBJCLASS2(idx, ch, basename, sname, sym, name, explain) \
|
||||||
|
OBJCLASS(idx, ch, basename, sym, name, explain)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OBJCLASS( 1, ']', ILLOBJ, S_strange_obj, "illegal objects",
|
OBJCLASS( 1, ']', ILLOBJ, S_strange_obj, "illegal objects",
|
||||||
@@ -432,7 +426,7 @@
|
|||||||
OBJCLASS( 9, '?', SCROLL, S_scroll, "scrolls", "scroll")
|
OBJCLASS( 9, '?', SCROLL, S_scroll, "scrolls", "scroll")
|
||||||
OBJCLASS(10, '+', SPBOOK, S_book, "spellbooks", "spellbook")
|
OBJCLASS(10, '+', SPBOOK, S_book, "spellbooks", "spellbook")
|
||||||
OBJCLASS(11, '/', WAND, S_wand, "wands", "wand")
|
OBJCLASS(11, '/', WAND, S_wand, "wands", "wand")
|
||||||
OBJCLASS7(12, '$', COIN, GOLD_SYM, S_coin, "coins", "pile of coins")
|
OBJCLASS2(12, '$', COIN, GOLD_SYM, S_coin, "coins", "pile of coins")
|
||||||
OBJCLASS(13, '*', GEM, S_gem, "rocks", "gem or rock")
|
OBJCLASS(13, '*', GEM, S_gem, "rocks", "gem or rock")
|
||||||
OBJCLASS(14, '`', ROCK, S_rock, "large stones", "boulder or statue")
|
OBJCLASS(14, '`', ROCK, S_rock, "large stones", "boulder or statue")
|
||||||
OBJCLASS(15, '0', BALL, S_ball, "iron balls", "iron ball")
|
OBJCLASS(15, '0', BALL, S_ball, "iron balls", "iron ball")
|
||||||
@@ -440,9 +434,9 @@
|
|||||||
OBJCLASS(17, '.', VENOM, S_venom, "venoms", "splash of venom")
|
OBJCLASS(17, '.', VENOM, S_venom, "venoms", "splash of venom")
|
||||||
|
|
||||||
#undef OBJCLASS
|
#undef OBJCLASS
|
||||||
#undef OBJCLASS7
|
#undef OBJCLASS2
|
||||||
#endif /* OBJCLASS_S_ENUM || OBJCLASS_DEFCHAR_ENUM || OBJCLASS_CLASS_ENUM */
|
#endif /* OBJCLASS_S_ENUM || OBJCLASS_DEFCHAR_ENUM || OBJCLASS_CLASS_ENUM
|
||||||
/* || OBJCLASS_PARSE || OBJCLASS_DRAWING */
|
* || OBJCLASS_PARSE || OBJCLASS_DRAWING */
|
||||||
|
|
||||||
#undef CLR
|
#undef CLR
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user