Source:NetHack 3.2.0/drawing.c

From NetHackWiki
(Redirected from NetHack 3.2.0/drawing.c)
Jump to navigation Jump to search

Below is the full text to drawing.c from the source code of NetHack 3.2.0.

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

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.    /*	SCCS Id: @(#)drawing.c	3.2	94/09/16	*/
2.    /* Copyright (c) NetHack Development Team 1992.			  */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #include "hack.h"
6.    #include "termcap.h"
7.    
8.    /* Relevent header information in rm.h and objclass.h. */
9.    
10.   #ifdef C
11.   #undef C
12.   #endif
13.   
14.   #ifdef TEXTCOLOR
15.   #define C(n) n
16.   #else
17.   #define C(n)
18.   #endif
19.   
20.   #define g_FILLER(symbol) 0
21.   
22.   uchar oc_syms[MAXOCLASSES] = DUMMY; /* the current object  display symbols */
23.   uchar showsyms[MAXPCHARS]  = DUMMY; /* the current feature display symbols */
24.   uchar monsyms[MAXMCLASSES] = DUMMY; /* the current monster display symbols */
25.   
26.   /* Default object class symbols.  See objclass.h. */
27.   const char def_oc_syms[MAXOCLASSES] = {
28.   /* 0*/	'\0',		/* placeholder for the "random class" */
29.   	ILLOBJ_SYM,
30.   	WEAPON_SYM,
31.   	ARMOR_SYM,
32.   	RING_SYM,
33.   /* 5*/	AMULET_SYM,
34.   	TOOL_SYM,
35.   	FOOD_SYM,
36.   	POTION_SYM,
37.   	SCROLL_SYM,
38.   /*10*/	SPBOOK_SYM,
39.   	WAND_SYM,
40.   	GOLD_SYM,
41.   	GEM_SYM,
42.   	ROCK_SYM,
43.   /*15*/	BALL_SYM,
44.   	CHAIN_SYM,
45.   	VENOM_SYM
46.   };
47.   
48.   /* Object descriptions.  Used in do_look(). */
49.   const char *objexplain[] = {	/* these match def_oc_syms, above */
50.   /* 0*/	0,
51.   	"strange object",
52.   	"weapon",
53.   	"suit or piece of armor",
54.   	"ring",
55.   /* 5*/	"amulet",
56.   	"useful item (pick-axe, key, lamp...)",
57.   	"piece of food",
58.   	"potion",
59.   	"scroll",
60.   /*10*/	"spell book",
61.   	"wand",
62.   	"pile of coins",
63.   	"gem or rock",
64.   	"boulder or statue",
65.   /*15*/	"iron ball",
66.   	"iron chain",
67.   	"splash of venom"
68.   };
69.   
70.   /* Object class names.  Used in object_detect(). */
71.   const char *oclass_names[] = {
72.   /* 0*/	0,
73.   	"illegal objects",
74.   	"weapons",
75.   	"armor",
76.   	"rings",
77.   /* 5*/	"amulets",
78.   	"tools",
79.   	"food",
80.   	"potions",
81.   	"scrolls",
82.   /*10*/	"spell books",
83.   	"wands",
84.   	"coins",
85.   	"rocks",
86.   	"large stones",
87.   /*15*/	"iron balls",
88.   	"chains",
89.   	"venoms"
90.   };
91.   
92.   /* Default monster class symbols.  See monsym.h. */
93.   const char def_monsyms[MAXMCLASSES] = {
94.   	'\0',		/* holder */
95.   	DEF_ANT,
96.   	DEF_BLOB,
97.   	DEF_COCKATRICE,
98.   	DEF_DOG,
99.   	DEF_EYE,
100.  	DEF_FELINE,
101.  	DEF_GREMLIN,
102.  	DEF_HUMANOID,
103.  	DEF_IMP,
104.  	DEF_JELLY,		/* 10 */
105.  	DEF_KOBOLD,
106.  	DEF_LEPRECHAUN,
107.  	DEF_MIMIC,
108.  	DEF_NYMPH,
109.  	DEF_ORC,
110.  	DEF_PIERCER,
111.  	DEF_QUADRUPED,
112.  	DEF_RODENT,
113.  	DEF_SPIDER,
114.  	DEF_TRAPPER,		/* 20 */
115.  	DEF_UNICORN,
116.  	DEF_VORTEX,
117.  	DEF_WORM,
118.  	DEF_XAN,
119.  	DEF_LIGHT,
120.  	DEF_ZRUTY,
121.  	DEF_ANGEL,
122.  	DEF_BAT,
123.  	DEF_CENTAUR,
124.  	DEF_DRAGON,		/* 30 */
125.  	DEF_ELEMENTAL,
126.  	DEF_FUNGUS,
127.  	DEF_GNOME,
128.  	DEF_GIANT,
129.  	DEF_STALKER,
130.  	DEF_JABBERWOCK,
131.  	DEF_KOP,
132.  	DEF_LICH,
133.  	DEF_MUMMY,
134.  	DEF_NAGA,		/* 40 */
135.  	DEF_OGRE,
136.  	DEF_PUDDING,
137.  	DEF_QUANTMECH,
138.  	DEF_RUSTMONST,
139.  	DEF_SNAKE,
140.  	DEF_TROLL,
141.  	DEF_UMBER,
142.  	DEF_VAMPIRE,
143.  	DEF_WRAITH,
144.  	DEF_XORN,		/* 50 */
145.  	DEF_YETI,
146.  	DEF_ZOMBIE,
147.  	DEF_HUMAN,
148.  	DEF_GHOST,
149.  	DEF_GOLEM,
150.  	DEF_DEMON,
151.  	DEF_EEL,
152.  	DEF_LIZARD,
153.  	DEF_WORM_TAIL,
154.  	DEF_MIMIC_DEF,		/* 60 */
155.  };
156.  
157.  /* The explanations below are also used when the user gives a string
158.   * for blessed genocide, so no text should wholy contain any later
159.   * text.  They should also always contain obvious names (eg. cat/feline).
160.   */
161.  const char *monexplain[MAXMCLASSES] = {
162.      0,
163.      "ant or other insect",	"blob",			"cockatrice",
164.      "dog or other canine",	"eye or sphere",	"cat or other feline",
165.      "gremlin",			"humanoid",		"imp or minor demon",
166.      "jelly",			"kobold",		"leprechaun",
167.      "mimic",			"nymph",		"orc",
168.      "piercer",			"quadruped",		"rodent",
169.      "spider",			"trapper or lurker above", "unicorn",
170.      "vortex",		"worm", "xan or other mythical/fantastic insect",
171.      "light",			"zruty",
172.  
173.      "angelic being",		"bat",			"centaur",
174.      "dragon",			"elemental",		"fungus or mold",
175.      "gnome",			"giant humanoid",	"invisible stalker",
176.      "jabberwock",		"Keystone Kop",		"lich",
177.      "mummy",			"naga",			"ogre",
178.      "pudding or ooze",		"quantum mechanic",	"rust monster",
179.      "snake",			"troll",		"umber hulk",
180.      "vampire",			"wraith",		"xorn",
181.      "yeti, ape or other large beast", "zombie",
182.  
183.      "human or elf",		"ghost",		"golem",
184.      "major demon",		"sea monster",		"lizard",
185.      "long worm tail",		"mimic"
186.  };
187.  
188.  /*
189.   *  Default screen symbols with explanations and colors.
190.   *  Note:  {ibm|dec|mac}_graphics[] arrays also depend on this symbol order.
191.   */
192.  const struct symdef defsyms[MAXPCHARS] = {
193.  /* 0*/	{' ', "dark part of a room",C(NO_COLOR)},	/* stone */
194.  	{'|', "wall",		C(CLR_GRAY)},	/* vwall */
195.  	{'-', "wall",		C(CLR_GRAY)},	/* hwall */
196.  	{'-', "wall",		C(CLR_GRAY)},	/* tlcorn */
197.  	{'-', "wall",		C(CLR_GRAY)},	/* trcorn */
198.  	{'-', "wall",		C(CLR_GRAY)},	/* blcorn */
199.  	{'-', "wall",		C(CLR_GRAY)},	/* brcorn */
200.  	{'-', "wall",		C(CLR_GRAY)},	/* crwall */
201.  	{'-', "wall",		C(CLR_GRAY)},	/* tuwall */
202.  	{'-', "wall",		C(CLR_GRAY)},	/* tdwall */
203.  /*10*/	{'|', "wall",		C(CLR_GRAY)},	/* tlwall */
204.  	{'|', "wall",		C(CLR_GRAY)},	/* trwall */
205.  	{'.', "doorway",	C(CLR_GRAY)},	/* ndoor */
206.  	{'-', "open door",	C(CLR_BROWN)},	/* vodoor */
207.  	{'|', "open door",	C(CLR_BROWN)},	/* hodoor */
208.  	{'+', "closed door",	C(CLR_BROWN)},	/* vcdoor */
209.  	{'+', "closed door",	C(CLR_BROWN)},	/* hcdoor */
210.  	{'.', "floor of a room",C(CLR_GRAY)},	/* room */
211.  	{'#', "corridor",	C(CLR_GRAY)},	/* dark corr */
212.  	{'#', "lit corridor",	C(CLR_GRAY)},	/* lit corr */
213.  /*20*/	{'<', "staircase up",	C(CLR_GRAY)},	/* upstair */
214.  	{'>', "staircase down",	C(CLR_GRAY)},	/* dnstair */
215.  	{'<', "ladder up",	C(CLR_BROWN)},	/* upladder */
216.  	{'>', "ladder down",	C(CLR_BROWN)},	/* dnladder */
217.  	{'_', "altar",		C(CLR_GRAY)},	/* altar */
218.  	{'\\', "opulent throne",C(HI_GOLD)},	/* throne */
219.  #ifdef SINKS
220.  	{'#', "sink",		C(CLR_GRAY)},	/* sink */
221.  #else
222.  	{'#', "",		C(CLR_GRAY)},	/* sink */
223.  #endif
224.  	{'{', "fountain",	C(CLR_BLUE)},	/* fountain */
225.  	{'}', "water",		C(CLR_BLUE)},	/* pool */
226.  	{'.', "ice",		C(CLR_CYAN)},	/* ice */
227.  /*30*/	{'}', "molten lava",	C(CLR_RED)},	/* lava */
228.  	{'.', "lowered drawbridge",C(CLR_BROWN)},	/* vodbridge */
229.  	{'.', "lowered drawbridge",C(CLR_BROWN)},	/* hodbridge */
230.  	{'#', "raised drawbridge",C(CLR_BROWN)},/* vcdbridge */
231.  	{'#', "raised drawbridge",C(CLR_BROWN)},/* hcdbridge */
232.  	{' ', "air",		C(CLR_CYAN)},	/* open air */
233.  	{'#', "cloud",		C(CLR_GRAY)},	/* [part of] a cloud */
234.  	{'}', "water",		C(CLR_BLUE)},	/* under water */
235.  	{'^', "arrow trap",	C(HI_METAL)},	/* trap */
236.  	{'^', "dart trap",	C(HI_METAL)},	/* trap */
237.  /*40*/	{'^', "falling rock trap",C(CLR_GRAY)},	/* trap */
238.  	{'^', "squeaky board",	C(CLR_BROWN)},	/* trap */
239.  	{'^', "bear trap",	C(HI_METAL)},	/* trap */
240.  	{'^', "land mine",	C(CLR_RED)},	/* trap */
241.  	{'^', "rolling boulder trap",	C(CLR_GRAY)},	/* trap */
242.  	{'^', "sleeping gas trap",C(HI_ZAP)},	/* trap */
243.  	{'^', "rust trap",	C(CLR_BLUE)},	/* trap */
244.  	{'^', "fire trap",	C(CLR_ORANGE)},	/* trap */
245.  	{'^', "pit",		C(CLR_BLACK)},	/* trap */
246.  	{'^', "spiked pit",	C(CLR_BLACK)},	/* trap */
247.  /*50*/	{'^', "hole",	C(CLR_BROWN)},	/* trap */
248.  	{'^', "trap door",	C(CLR_BROWN)},	/* trap */
249.  	{'^', "teleportation trap", C(CLR_MAGENTA)},	/* trap */
250.  	{'^', "level teleporter", C(CLR_MAGENTA)},	/* trap */
251.  	{'^', "magic portal",	C(CLR_BRIGHT_MAGENTA)},	/* trap */
252.  	{'"', "web",		C(CLR_GRAY)},	/* web */
253.  	{'^', "statue trap",	C(CLR_GRAY)},	/* trap */
254.  	{'^', "magic trap",	C(HI_ZAP)},	/* trap */
255.  	{'^', "anti-magic trap field", C(HI_ZAP)},	/* trap */
256.  	{'^', "polymorph trap",	C(CLR_BRIGHT_GREEN)},	/* trap */
257.  /*60*/	{'|', "wall",		C(CLR_GRAY)},	/* vbeam */
258.  	{'-', "wall",		C(CLR_GRAY)},	/* hbeam */
259.  	{'\\',"wall",		C(CLR_GRAY)},	/* lslant */
260.  	{'/', "wall",		C(CLR_GRAY)},	/* rslant */
261.  	{'*', "",		C(CLR_WHITE)},	/* dig beam */
262.  	{'!', "",		C(CLR_WHITE)},	/* camera flash beam */
263.  	{')', "",		C(HI_WOOD)},	/* boomerang open left */
264.  	{'(', "",		C(HI_WOOD)},	/* boomerang open right */
265.  	{'0', "",		C(HI_ZAP)},	/* 4 magic shield symbols */
266.  	{'#', "",		C(HI_ZAP)},
267.  /*70*/	{'@', "",		C(HI_ZAP)},
268.  	{'*', "",		C(HI_ZAP)},
269.  	{'/', "",		C(CLR_GREEN)},	/* swallow top left	*/
270.  	{'-', "",		C(CLR_GREEN)},	/* swallow top center	*/
271.  	{'\\', "",		C(CLR_GREEN)},	/* swallow top right	*/
272.  	{'|', "",		C(CLR_GREEN)},	/* swallow middle left	*/
273.  	{'|', "",		C(CLR_GREEN)},	/* swallow middle right	*/
274.  	{'\\', "",		C(CLR_GREEN)},	/* swallow bottom left	*/
275.  	{'-', "",		C(CLR_GREEN)},	/* swallow bottom center*/
276.  	{'/', "",		C(CLR_GREEN)},	/* swallow bottom right	*/
277.  /*80*/	{'/', "",		C(CLR_ORANGE)},	/* explosion top left     */
278.  	{'-', "",		C(CLR_ORANGE)},	/* explosion top center   */
279.  	{'\\', "",		C(CLR_ORANGE)},	/* explosion top right    */
280.  	{'|', "",		C(CLR_ORANGE)},	/* explosion middle left  */
281.  	{' ', "",		C(CLR_ORANGE)},	/* explosion middle center*/
282.  	{'|', "",		C(CLR_ORANGE)},	/* explosion middle right */
283.  	{'\\', "",		C(CLR_ORANGE)},	/* explosion bottom left  */
284.  	{'-', "",		C(CLR_ORANGE)},	/* explosion bottom center*/
285.  	{'/', "",		C(CLR_ORANGE)},	/* explosion bottom right */
286.  /*
287.   *  Note: Additions to this array should be reflected in the
288.   *	  {ibm,dec,mac}_graphics[] arrays below.
289.   */
290.  };
291.  
292.  #undef C
293.  
294.  #ifdef ASCIIGRAPH
295.  
296.  #ifdef PC9800
297.  void NDECL((*ibmgraphics_mode_callback)) = 0;	/* set in tty_start_screen() */
298.  #endif /* PC9800 */
299.  
300.  static uchar ibm_graphics[MAXPCHARS] = {
301.  /* 0*/	g_FILLER(S_stone),
302.  	0xb3,	/* S_vwall:	meta-3, vertical rule */
303.  	0xc4,	/* S_hwall:	meta-D, horizontal rule */
304.  	0xda,	/* S_tlcorn:	meta-Z, top left corner */
305.  	0xbf,	/* S_trcorn:	meta-?, top right corner */
306.  	0xc0,	/* S_blcorn:	meta-@, bottom left */
307.  	0xd9,	/* S_brcorn:	meta-Y, bottom right */
308.  	0xc5,	/* S_crwall:	meta-E, cross */
309.  	0xc1,	/* S_tuwall:	meta-A, T up */
310.  	0xc2,	/* S_tdwall:	meta-B, T down */
311.  /*10*/	0xb4,	/* S_tlwall:	meta-4, T left */
312.  	0xc3,	/* S_trwall:	meta-C, T right */
313.  	0xfa,	/* S_ndoor:	meta-z, centered dot */
314.  	0xfe,	/* S_vodoor:	meta-~, small centered square */
315.  	0xfe,	/* S_hodoor:	meta-~, small centered square */
316.  	g_FILLER(S_vcdoor),
317.  	g_FILLER(S_hcdoor),
318.  	0xfa,	/* S_room:	meta-z, centered dot */
319.  	0xb0,	/* S_corr:	meta-0, light shading */
320.  	0xb1,	/* S_litcorr:	meta-1, medium shading */
321.  /*20*/	g_FILLER(S_upstair),
322.  	g_FILLER(S_dnstair),
323.  	g_FILLER(S_upladder),
324.  	g_FILLER(S_dnladder),
325.  	g_FILLER(S_altar),
326.  	g_FILLER(S_throne),
327.  	g_FILLER(S_sink),
328.  	0xf4,	/* S_fountain:	meta-t, integral top half */
329.  	0xf7,	/* S_pool:	meta-w, approx. equals */
330.  	0xfa,	/* S_ice:	meta-z, centered dot */
331.  /*30*/	0xf7,	/* S_lava:	meta-w, approx. equals */
332.  	0xfa,	/* S_vodbridge:	meta-z, centered dot */
333.  	0xfa,	/* S_hodbridge:	meta-z, centered dot */
334.  	g_FILLER(S_vcdbridge),
335.  	g_FILLER(S_hcdbridge),
336.  	g_FILLER(S_air),
337.  	g_FILLER(S_cloud),
338.  	0xf7,	/* S_water:	meta-w, approx. equals */
339.  	g_FILLER(S_arrow_trap),
340.  	g_FILLER(S_dart_trap),
341.  /*40*/	g_FILLER(S_falling_rock_trap),
342.  	g_FILLER(S_squeaky_board),
343.  	g_FILLER(S_bear_trap),
344.  	g_FILLER(S_land_mine),
345.  	g_FILLER(S_rolling_boulder_trap),
346.  	g_FILLER(S_sleeping_gas_trap),
347.  	g_FILLER(S_rust_trap),
348.  	g_FILLER(S_fire_trap),
349.  	g_FILLER(S_pit),
350.  	g_FILLER(S_spiked_pit),
351.  /*50*/  g_FILLER(S_hole),
352.  	g_FILLER(S_trap_door),
353.  	g_FILLER(S_teleportation_trap),
354.  	g_FILLER(S_level_teleporter),
355.  	g_FILLER(S_magic_portal),
356.  	g_FILLER(S_web),
357.  	g_FILLER(S_statue_trap),
358.  	g_FILLER(S_magic_trap),
359.  	g_FILLER(S_anti_magic_trap),
360.  	g_FILLER(S_polymorph_trap),
361.  /*60*/	0xb3,	/* S_vbeam:	meta-3, vertical rule */
362.  	0xc4,	/* S_hbeam:	meta-D, horizontal rule */
363.  	g_FILLER(S_lslant),
364.  	g_FILLER(S_rslant),
365.  	g_FILLER(S_digbeam),
366.  	g_FILLER(S_flashbeam),
367.  	g_FILLER(S_boomleft),
368.  	g_FILLER(S_boomright),
369.  	g_FILLER(S_ss1),
370.  	g_FILLER(S_ss2),
371.  /*70*/	g_FILLER(S_ss3),
372.  	g_FILLER(S_ss4),
373.  	g_FILLER(S_sw_tl),
374.  	g_FILLER(S_sw_tc),
375.  	g_FILLER(S_sw_tr),
376.  	0xb3,	/* S_sw_ml:	meta-3, vertical rule */
377.  	0xb3,	/* S_sw_mr:	meta-3, vertical rule */
378.  	g_FILLER(S_sw_bl),
379.  	g_FILLER(S_sw_bc),
380.  	g_FILLER(S_sw_br),
381.  /*80*/	g_FILLER(S_explode1),
382.  	g_FILLER(S_explode2),
383.  	g_FILLER(S_explode3),
384.  	0xb3,	/* S_explode4:	meta-3, vertical rule */
385.  	g_FILLER(S_explode5),
386.  	0xb3,	/* S_explode6:	meta-3, vertical rule */
387.  	g_FILLER(S_explode7),
388.  	g_FILLER(S_explode8),
389.  	g_FILLER(S_explode9)
390.  };
391.  #endif  /* ASCIIGRAPH */
392.  
393.  #ifdef TERMLIB
394.  void NDECL((*decgraphics_mode_callback)) = 0;  /* set in tty_start_screen() */
395.  
396.  static uchar dec_graphics[MAXPCHARS] = {
397.  /* 0*/	g_FILLER(S_stone),
398.  	0xf8,	/* S_vwall:	meta-x, vertical rule */
399.  	0xf1,	/* S_hwall:	meta-q, horizontal rule */
400.  	0xec,	/* S_tlcorn:	meta-l, top left corner */
401.  	0xeb,	/* S_trcorn:	meta-k, top right corner */
402.  	0xed,	/* S_blcorn:	meta-m, bottom left */
403.  	0xea,	/* S_brcorn:	meta-j, bottom right */
404.  	0xee,	/* S_crwall:	meta-n, cross */
405.  	0xf6,	/* S_tuwall:	meta-v, T up */
406.  	0xf7,	/* S_tdwall:	meta-w, T down */
407.  /*10*/	0xf5,	/* S_tlwall:	meta-u, T left */
408.  	0xf4,	/* S_trwall:	meta-t, T right */
409.  	0xfe,	/* S_ndoor:	meta-~, centered dot */
410.  	0xe1,	/* S_vodoor:	meta-a, solid block */
411.  	0xe1,	/* S_hodoor:	meta-a, solid block */
412.  	g_FILLER(S_vcdoor),
413.  	g_FILLER(S_hcdoor),
414.  	0xfe,	/* S_room:	meta-~, centered dot */
415.  	g_FILLER(S_corr),
416.  	g_FILLER(S_litcorr),
417.  /*20*/	g_FILLER(S_upstair),
418.  	g_FILLER(S_dnstair),
419.  	g_FILLER(S_upladder),
420.  	g_FILLER(S_dnladder),
421.  	g_FILLER(S_altar),	/* 0xc3, \E)3: meta-C, dagger */
422.  	g_FILLER(S_throne),
423.  	g_FILLER(S_sink),
424.  	g_FILLER(S_fountain),	/* 0xdb, \E)3: meta-[, integral top half */
425.  	0xe0,	/* S_pool:	meta-\, diamond */
426.  	0xfe,	/* S_ice:	meta-~, centered dot */
427.  /*30*/	0xe0,	/* S_lava:	meta-\, diamond */
428.  	0xfe,	/* S_vodbridge:	meta-~, centered dot */
429.  	0xfe,	/* S_hodbridge:	meta-~, centered dot */
430.  	g_FILLER(S_vcdbridge),
431.  	g_FILLER(S_hcdbridge),
432.  	g_FILLER(S_air),
433.  	g_FILLER(S_cloud),
434.  	0xe0,	/* S_water:	meta-\, diamond */
435.  	g_FILLER(S_arrow_trap),
436.  	g_FILLER(S_dart_trap),
437.  /*40*/	g_FILLER(S_falling_rock_trap),
438.  	g_FILLER(S_squeaky_board),
439.  	g_FILLER(S_bear_trap),
440.  	g_FILLER(S_land_mine),
441.  	g_FILLER(S_rolling_boulder_trap),
442.  	g_FILLER(S_sleeping_gas_trap),
443.  	g_FILLER(S_rust_trap),
444.  	g_FILLER(S_fire_trap),
445.  	g_FILLER(S_pit),
446.  	g_FILLER(S_spiked_pit),
447.  /*50*/	g_FILLER(S_hole),
448.  	g_FILLER(S_trap_door),
449.  	g_FILLER(S_teleportation_trap),
450.  	g_FILLER(S_level_teleporter),
451.  	g_FILLER(S_magic_portal),
452.  	g_FILLER(S_web),	/* 0xbd, \E)3: meta-=, int'l currency */
453.  	g_FILLER(S_statue_trap),
454.  	g_FILLER(S_magic_trap),
455.  	g_FILLER(S_anti_magic_trap),
456.  	g_FILLER(S_polymorph_trap),
457.  /*60*/	0xf8,	/* S_vbeam:	meta-x, vertical rule */
458.  	0xf1,	/* S_hbeam:	meta-q, horizontal rule */
459.  	g_FILLER(S_lslant),
460.  	g_FILLER(S_rslant),
461.  	g_FILLER(S_digbeam),
462.  	g_FILLER(S_flashbeam),
463.  	g_FILLER(S_boomleft),
464.  	g_FILLER(S_boomright),
465.  	g_FILLER(S_ss1),
466.  	g_FILLER(S_ss2),
467.  /*70*/	g_FILLER(S_ss3),
468.  	g_FILLER(S_ss4),
469.  	g_FILLER(S_sw_tl),
470.  	0xef,	/* S_sw_tc:	meta-o, high horizontal line */
471.  	g_FILLER(S_sw_tr),
472.  	0xf8,	/* S_sw_ml:	meta-x, vertical rule */
473.  	0xf8,	/* S_sw_mr:	meta-x, vertical rule */
474.  	g_FILLER(S_sw_bl),
475.  	0xf3,	/* S_sw_bc:	meta-s, low horizontal line */
476.  	g_FILLER(S_sw_br),
477.  /*80*/	g_FILLER(S_explode1),
478.  	0xef,	/* S_explode2:	meta-o, high horizontal line */
479.  	g_FILLER(S_explode3),
480.  	0xf8,	/* S_explode4:	meta-x, vertical rule */
481.  	g_FILLER(S_explode5),
482.  	0xf8,	/* S_explode6:	meta-x, vertical rule */
483.  	g_FILLER(S_explode7),
484.  	0xf3,	/* S_explode8:	meta-s, low horizontal line */
485.  	g_FILLER(S_explode9)
486.  };
487.  #endif  /* TERMLIB */
488.  
489.  #ifdef MAC_GRAPHICS_ENV
490.  static uchar mac_graphics[MAXPCHARS] = {
491.  /* 0*/	g_FILLER(S_stone),
492.  	0xba,	/* S_vwall */
493.  	0xcd,	/* S_hwall */
494.  	0xc9,	/* S_tlcorn */
495.  	0xbb,	/* S_trcorn */
496.  	0xc8,	/* S_blcorn */
497.  	0xbc,	/* S_brcorn */
498.  	0xce,	/* S_crwall */
499.  	0xca,	/* S_tuwall */
500.  	0xcb,	/* S_tdwall */
501.  /*10*/	0xb9,	/* S_tlwall */
502.  	0xcc,	/* S_trwall */
503.  	0xb0,	/* S_ndoor */
504.  	0xee,	/* S_vodoor */
505.  	0xee,	/* S_hodoor */
506.  	0xef,	/* S_vcdoor */
507.  	0xef,	/* S_hcdoor */
508.  	g_FILLER(S_Room),
509.  	0xB0,	/* S_corr */
510.  	g_FILLER(S_litcorr),
511.  /*20*/	g_FILLER(S_upstair),
512.  	g_FILLER(S_dnstair),
513.  	g_FILLER(S_upladder),
514.  	g_FILLER(S_dnladder),
515.  	g_FILLER(S_altar),
516.  	g_FILLER(S_throne),
517.  	g_FILLER(S_sink),
518.  	g_FILLER(S_fountain),
519.  	0xe0,	/* S_pool */
520.  	g_FILLER(S_ice),
521.  /*30*/	g_FILLER(S_lava),
522.  	g_FILLER(S_vodbridge),
523.  	g_FILLER(S_hodbridge),
524.  	g_FILLER(S_vcdbridge),
525.  	g_FILLER(S_hcdbridge),
526.  	g_FILLER(S_air),
527.  	g_FILLER(S_cloud),
528.  	g_FILLER(S_water),
529.  	g_FILLER(S_arrow_trap),
530.  	g_FILLER(S_dart_trap),
531.  /*40*/	g_FILLER(S_falling_rock_trap),
532.  	g_FILLER(S_squeaky_board),
533.  	g_FILLER(S_bear_trap),
534.  	g_FILLER(S_land_mine),
535.  	g_FILLER(S_rolling_boulder_trap),
536.  	g_FILLER(S_sleeping_gas_trap),
537.  	g_FILLER(S_rust_trap),
538.  	g_FILLER(S_fire_trap),
539.  	g_FILLER(S_pit),
540.  	g_FILLER(S_spiked_pit),
541.  /*50*/	g_FILLER(S_hole),
542.  	g_FILLER(S_trap_door),
543.  	g_FILLER(S_teleportation_trap),
544.  	g_FILLER(S_level_teleporter),
545.  	g_FILLER(S_magic_portal),
546.  	g_FILLER(S_web),
547.  	g_FILLER(S_statue_trap),
548.  	g_FILLER(S_magic_trap),
549.  	g_FILLER(S_anti_magic_trap),
550.  	g_FILLER(S_polymorph_trap),
551.  /*60*/	g_FILLER(S_vbeam),
552.  	g_FILLER(S_hbeam),
553.  	g_FILLER(S_lslant),
554.  	g_FILLER(S_rslant),
555.  	g_FILLER(S_digbeam),
556.  	g_FILLER(S_flashbeam),
557.  	g_FILLER(S_boomleft),
558.  	g_FILLER(S_boomright),
559.  	g_FILLER(S_ss1),
560.  	g_FILLER(S_ss2),
561.  /*70*/	g_FILLER(S_ss3),
562.  	g_FILLER(S_ss4),
563.  	g_FILLER(S_sw_tl),
564.  	g_FILLER(S_sw_tc),
565.  	g_FILLER(S_sw_tr),
566.  	g_FILLER(S_sw_ml),
567.  	g_FILLER(S_sw_mr),
568.  	g_FILLER(S_sw_bl),
569.  	g_FILLER(S_sw_bc),
570.  	g_FILLER(S_sw_br),
571.  /*80*/	g_FILLER(S_explode1),
572.  	g_FILLER(S_explode2),
573.  	g_FILLER(S_explode3),
574.  	g_FILLER(S_explode4),
575.  	g_FILLER(S_explode5),
576.  	g_FILLER(S_explode6),
577.  	g_FILLER(S_explode7),
578.  	g_FILLER(S_explode8),
579.  	g_FILLER(S_explode9)
580.  };
581.  #endif	/* MAC_GRAPHICS_ENV */
582.  
583.  #ifdef PC9800
584.  void NDECL((*ascgraphics_mode_callback)) = 0;	/* set in tty_start_screen() */
585.  #endif
586.  
587.  /*
588.   * Convert the given character to an object class.  If the character is not
589.   * recognized, then MAXOCLASSES is returned.  Used in invent.c, options.c,
590.   * pickup.c, sp_lev.c, and lev_main.c.
591.   */
592.  int
593.  def_char_to_objclass(ch)
594.      char ch;
595.  {
596.      int i;
597.      for (i = 1; i < MAXOCLASSES; i++)
598.  	if (ch == def_oc_syms[i]) break;
599.      return i;
600.  }
601.  
602.  /*
603.   * Convert a character into a monster class.  This returns the _first_
604.   * match made.  If there are are no matches, return MAXMCLASSES.
605.   */
606.  int
607.  def_char_to_monclass(ch)
608.      char ch;
609.  {
610.      int i;
611.      for (i = 1; i < MAXMCLASSES; i++)
612.  	if (def_monsyms[i] == ch) break;
613.      return i;
614.  }
615.  
616.  void
617.  assign_graphics(graph_chars, glth, maxlen, offset)
618.  register uchar *graph_chars;
619.  int glth, maxlen, offset;
620.  {
621.      register int i;
622.  
623.      for (i = 0; i < maxlen; i++)
624.  	showsyms[i+offset] = (((i < glth) && graph_chars[i]) ?
625.  		       graph_chars[i] : defsyms[i+offset].sym);
626.  }
627.  
628.  void
629.  switch_graphics(gr_set_flag)
630.  int gr_set_flag;
631.  {
632.      switch (gr_set_flag) {
633.  	default:
634.  	case ASCII_GRAPHICS:
635.  	    assign_graphics((uchar *)0, 0, MAXPCHARS, 0);
636.  #ifdef PC9800
637.  	    if (ascgraphics_mode_callback) (*ascgraphics_mode_callback)();
638.  #endif
639.  	    break;
640.  #ifdef ASCIIGRAPH
641.  	case IBM_GRAPHICS:
642.  /*
643.   * Use the nice IBM Extended ASCII line-drawing characters (codepage 437).
644.   *
645.   * OS/2 defaults to a multilingual character set (codepage 850, corresponding
646.   * to the ISO 8859 character set.  We should probably do a VioSetCp() call to
647.   * set the codepage to 437.
648.   */
649.  	    flags.IBMgraphics = TRUE;
650.  	    flags.DECgraphics = FALSE;
651.  	    assign_graphics(ibm_graphics, SIZE(ibm_graphics), MAXPCHARS, 0);
652.  #ifdef PC9800
653.  	    if (ibmgraphics_mode_callback) (*ibmgraphics_mode_callback)();
654.  #endif
655.  	    break;
656.  #endif /* ASCIIGRAPH */
657.  #ifdef TERMLIB
658.  	case DEC_GRAPHICS:
659.  /*
660.   * Use the VT100 line drawing character set.
661.   */
662.  	    flags.DECgraphics = TRUE;
663.  	    flags.IBMgraphics = FALSE;
664.  	    assign_graphics(dec_graphics, SIZE(dec_graphics), MAXPCHARS, 0);
665.  	    if (decgraphics_mode_callback) (*decgraphics_mode_callback)();
666.  	    break;
667.  #endif /* TERMLIB */
668.  #ifdef MAC_GRAPHICS_ENV
669.  	case MAC_GRAPHICS:
670.  	    assign_graphics(mac_graphics, SIZE(mac_graphics), MAXPCHARS, 0);
671.  	    break;
672.  #endif
673.  	}
674.      return;
675.  }
676.  
677.  
678.  #ifdef REINCARNATION
679.  
680.  /*
681.   * saved display symbols for objects & features.
682.   */
683.  static uchar save_oc_syms[MAXOCLASSES] = DUMMY;
684.  static uchar save_showsyms[MAXPCHARS]  = DUMMY;
685.  static uchar save_monsyms[MAXPCHARS]   = DUMMY;
686.  
687.  static const uchar r_oc_syms[MAXOCLASSES] = {
688.  /* 0*/	'\0',
689.  	ILLOBJ_SYM,
690.  	WEAPON_SYM,
691.  	']',			/* armor */
692.  	RING_SYM,
693.  /* 5*/	',',			/* amulet */
694.  	TOOL_SYM,
695.  	':',			/* food */
696.  	POTION_SYM,
697.  	SCROLL_SYM,
698.  /*10*/	SPBOOK_SYM,
699.  	WAND_SYM,
700.  	GEM_SYM,		/* gold -- yes it's the same as gems */
701.  	GEM_SYM,
702.  	ROCK_SYM,
703.  /*15*/	BALL_SYM,
704.  	CHAIN_SYM,
705.  	VENOM_SYM
706.  };
707.  
708.  # ifdef ASCIIGRAPH
709.  static const uchar IBM_r_oc_syms[MAXOCLASSES] = {	/* a la EPYX Rogue */
710.  /* 0*/	'\0',
711.  	ILLOBJ_SYM,
712.  	0x18,			/* weapon: up arrow */
713.  /*	0x0a, */ ARMOR_SYM,	/* armor:  Vert rect with o */
714.  /*	0x09, */ RING_SYM,	/* ring:   circle with arrow */
715.  /* 5*/	0x0c,			/* amulet: "female" symbol */
716.  	TOOL_SYM,
717.  	0x05,			/* food:   club (as in cards) */
718.  	0xad,			/* potion: upside down '!' */
719.  	0x0e,			/* scroll: musical note */
720.  /*10*/	SPBOOK_SYM,
721.  	0xe7,			/* wand:   greek tau */
722.  	0x0f,			/* gold:   yes it's the same as gems */
723.  	0x0f,			/* gems:   fancy '*' */
724.  	ROCK_SYM,
725.  /*15*/	BALL_SYM,
726.  	CHAIN_SYM,
727.  	VENOM_SYM
728.  };
729.  # endif /* ASCIIGRAPH */
730.  
731.  void
732.  assign_rogue_graphics(is_rlevel)
733.  boolean is_rlevel;
734.  {
735.      /* Adjust graphics display characters on Rogue levels */
736.  
737.      if (is_rlevel) {
738.  	register int i;
739.  
740.  	(void) memcpy((genericptr_t)save_showsyms,
741.  		      (genericptr_t)showsyms, sizeof showsyms);
742.  	(void) memcpy((genericptr_t)save_oc_syms,
743.  		      (genericptr_t)oc_syms, sizeof oc_syms);
744.  	(void) memcpy((genericptr_t)save_monsyms,
745.  		      (genericptr_t)monsyms, sizeof monsyms);
746.  
747.  	/* Use a loop: char != uchar on some machines. */
748.  	for (i = 0; i < MAXMCLASSES; i++)
749.  	    monsyms[i] = def_monsyms[i];
750.  	for (i = 0; i < MAXPCHARS; i++)
751.  	    showsyms[i] = defsyms[i].sym;
752.  
753.  /*
754.   * Some day if these rogue showsyms get much more extensive than this,
755.   * we may want to create r_showsyms, and IBM_r_showsyms arrays to hold
756.   * all of this info and to simply initialize it via a for() loop like r_oc_syms.
757.   */
758.  
759.  # ifdef ASCIIGRAPH
760.  	if (!flags.IBMgraphics
761.  #  if defined(USE_TILES) && defined(MSDOS)
762.  		|| flags.grmode
763.  #  endif
764.  				) {
765.  # endif
766.  	    showsyms[S_vodoor]  = showsyms[S_hodoor]  = showsyms[S_ndoor] = '+';
767.  	    showsyms[S_upstair] = showsyms[S_dnstair] = '%';
768.  # ifdef ASCIIGRAPH
769.  	} else {
770.  	    /* a la EPYX Rogue */
771.  	    showsyms[S_vwall]   = 0xba; /* all walls now use	*/
772.  	    showsyms[S_hwall]   = 0xcd; /* double line graphics	*/
773.  	    showsyms[S_tlcorn]  = 0xc9;
774.  	    showsyms[S_trcorn]  = 0xbb;
775.  	    showsyms[S_blcorn]  = 0xc8;
776.  	    showsyms[S_brcorn]  = 0xbc;
777.  	    showsyms[S_crwall]  = 0xce;
778.  	    showsyms[S_tuwall]  = 0xca;
779.  	    showsyms[S_tdwall]  = 0xcb;
780.  	    showsyms[S_tlwall]  = 0xb9;
781.  	    showsyms[S_trwall]  = 0xcc;
782.  	    showsyms[S_ndoor]   = 0xce;
783.  	    showsyms[S_vodoor]  = 0xce;
784.  	    showsyms[S_hodoor]  = 0xce;
785.  	    showsyms[S_corr]    = 0xb1;
786.  	    showsyms[S_litcorr] = 0xb2;
787.  	    showsyms[S_upstair] = 0xf0; /* Greek Xi */
788.  	    showsyms[S_dnstair] = 0xf0;
789.  	    showsyms[S_arrow_trap] = 0x04; /* diamond (cards) */
790.  	    showsyms[S_dart_trap] = 0x04;
791.  	    showsyms[S_falling_rock_trap] = 0x04;
792.  	    showsyms[S_squeaky_board] = 0x04;
793.  	    showsyms[S_bear_trap] = 0x04;
794.  	    showsyms[S_land_mine] = 0x04;
795.  	    showsyms[S_rolling_boulder_trap] = 0x04;
796.  	    showsyms[S_sleeping_gas_trap] = 0x04;
797.  	    showsyms[S_rust_trap] = 0x04;
798.  	    showsyms[S_fire_trap] = 0x04;
799.  	    showsyms[S_pit] = 0x04;
800.  	    showsyms[S_spiked_pit] = 0x04;
801.  	    showsyms[S_hole] = 0x04;
802.  	    showsyms[S_trap_door] = 0x04;
803.  	    showsyms[S_teleportation_trap] = 0x04;
804.  	    showsyms[S_level_teleporter] = 0x04;
805.  	    showsyms[S_magic_portal] = 0x04;
806.  	    showsyms[S_web] = 0x04;
807.  	    showsyms[S_statue_trap] = 0x04;
808.  	    showsyms[S_magic_trap] = 0x04;
809.  	    showsyms[S_anti_magic_trap] = 0x04;
810.  	    showsyms[S_polymorph_trap] = 0x04;
811.  	}
812.  #endif /* ASCIIGRAPH */
813.  
814.  	for (i = 0; i < MAXOCLASSES; i++) {
815.  #ifdef ASCIIGRAPH
816.  	    if (flags.IBMgraphics
817.  # if defined(USE_TILES) && defined(MSDOS)
818.  		&& !flags.grmode
819.  # endif
820.  		)
821.  		oc_syms[i] = IBM_r_oc_syms[i];
822.  	    else
823.  #endif /* ASCIIGRAPH */
824.  		oc_syms[i] = r_oc_syms[i];
825.  	}
826.  
827.      } else {
828.  	(void) memcpy((genericptr_t)showsyms,
829.  		      (genericptr_t)save_showsyms, sizeof showsyms);
830.  	(void) memcpy((genericptr_t)oc_syms,
831.  		      (genericptr_t)save_oc_syms, sizeof oc_syms);
832.  	(void) memcpy((genericptr_t)monsyms,
833.  		      (genericptr_t)save_monsyms, sizeof monsyms);
834.      }
835.  }
836.  #endif /* REINCARNATION */
837.  
838.  /*drawing.c*/