File: pckeys.c

package info (click to toggle)
nethack 3.4.3-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,512 kB
  • ctags: 16,957
  • sloc: ansic: 196,792; cpp: 7,083; sh: 6,785; yacc: 2,005; lex: 377; makefile: 120; awk: 89; sed: 11
file content (88 lines) | stat: -rw-r--r-- 2,017 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*	SCCS Id: @(#)pckeys.c	 3.4	 1996/05/11		  */
/* Copyright (c) NetHack PC Development Team 1996                 */
/* NetHack may be freely redistributed.  See license for details. */

/*
 *  MSDOS tile-specific key handling.
 */

#include "hack.h"

#ifdef MSDOS
# ifdef USE_TILES
#include "wintty.h" 
#include "pcvideo.h"

boolean FDECL(pckeys, (unsigned char, unsigned char));

extern struct WinDesc *wins[MAXWIN];	/* from wintty.c */
extern boolean inmap;			/* from video.c */

#define SHIFT		(0x1 | 0x2)
#define CTRL		0x4
#define ALT		0x8

/*
 * Check for special interface manipulation keys.
 * Returns TRUE if the scan code triggered something.
 *
 */
boolean
pckeys(scancode, shift)
unsigned char scancode;
unsigned char shift;
{
   boolean opening_dialog;

   opening_dialog = pl_character[0] ? FALSE : TRUE;
#  ifdef SIMULATE_CURSOR
    switch(scancode) {
	case 0x3d:	/* F3 = toggle cursor type */
		HideCursor();
		cursor_type += 1;
		if (cursor_type >= NUM_CURSOR_TYPES) cursor_type = 0;
		DrawCursor();
		break;
#  endif
	case 0x74:	/* Control-right_arrow = scroll horizontal to right */
		if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
			vga_userpan(1);
		break;

	case 0x73:	/* Control-left_arrow = scroll horizontal to left */
		if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
			vga_userpan(0);
		break;
	case 0x3E:	/* F4 = toggle overview mode */
		if (iflags.tile_view && 
		    !opening_dialog
#ifdef REINCARNATION
				&& !Is_rogue_level(&u.uz)
#endif
							) {
			iflags.traditional_view = FALSE;
			vga_overview(iflags.over_view ? FALSE : TRUE);
			vga_refresh();
		}
		break;
	case 0x3F:	/* F5 = toggle traditional mode */
		if (iflags.tile_view &&
		    !opening_dialog
#ifdef REINCARNATION
				&& !Is_rogue_level(&u.uz)
#endif
							) {
			iflags.over_view = FALSE;
			vga_traditional(iflags.traditional_view ? FALSE : TRUE);
			vga_refresh();
		}
		break;
	default:
		return FALSE;
    }
    return TRUE;
}
# endif /* USE_TILES */
#endif /* MSDOS */

/*pckeys.c*/