1 /*	SCCS Id: @(#)pckeys.c	 3.4	 1996/05/11		  */
2 /* Copyright (c) NetHack PC Development Team 1996                 */
3 /* NetHack may be freely redistributed.  See license for details. */
4 
5 /*
6  *  MSDOS tile-specific key handling.
7  */
8 
9 #include "hack.h"
10 
11 #ifdef MSDOS
12 # ifdef USE_TILES
13 #include "wintty.h"
14 #include "pcvideo.h"
15 
16 boolean FDECL(pckeys, (unsigned char, unsigned char));
17 
18 extern struct WinDesc *wins[MAXWIN];	/* from wintty.c */
19 extern boolean inmap;			/* from video.c */
20 
21 #define SHIFT		(0x1 | 0x2)
22 #define CTRL		0x4
23 #define ALT		0x8
24 
25 /*
26  * Check for special interface manipulation keys.
27  * Returns TRUE if the scan code triggered something.
28  *
29  */
30 boolean
pckeys(scancode,shift)31 pckeys(scancode, shift)
32 unsigned char scancode;
33 unsigned char shift;
34 {
35    boolean opening_dialog;
36 
37    opening_dialog = pl_character[0] ? FALSE : TRUE;
38 #  ifdef SIMULATE_CURSOR
39     switch(scancode) {
40 	case 0x3d:	/* F3 = toggle cursor type */
41 		HideCursor();
42 		cursor_type += 1;
43 		if (cursor_type >= NUM_CURSOR_TYPES) cursor_type = 0;
44 		DrawCursor();
45 		break;
46 #  endif
47 	case 0x74:	/* Control-right_arrow = scroll horizontal to right */
48 		if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
49 			vga_userpan(1);
50 		break;
51 
52 	case 0x73:	/* Control-left_arrow = scroll horizontal to left */
53 		if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
54 			vga_userpan(0);
55 		break;
56 	case 0x3E:	/* F4 = toggle overview mode */
57 		if (iflags.tile_view &&
58 		    !opening_dialog
59 #ifdef REINCARNATION
60 				&& !Is_rogue_level(&u.uz)
61 #endif
62 							) {
63 			iflags.traditional_view = FALSE;
64 			vga_overview(iflags.over_view ? FALSE : TRUE);
65 			vga_refresh();
66 		}
67 		break;
68 	case 0x3F:	/* F5 = toggle traditional mode */
69 		if (iflags.tile_view &&
70 		    !opening_dialog
71 #ifdef REINCARNATION
72 				&& !Is_rogue_level(&u.uz)
73 #endif
74 							) {
75 			iflags.over_view = FALSE;
76 			vga_traditional(iflags.traditional_view ? FALSE : TRUE);
77 			vga_refresh();
78 		}
79 		break;
80 	default:
81 		return FALSE;
82     }
83     return TRUE;
84 }
85 # endif /* USE_TILES */
86 #endif /* MSDOS */
87 
88 /*pckeys.c*/
89