- added map scrolling:

Ctrl-left_arrow    - scroll left
  Ctrl-right_arrow  - scroll right
  Ctrl-up_arrow    - scroll up
  Ctrl-down_arrow    - scroll down
  Ctrl-home    - scroll to upper left corner
  Ctrl-end    - scroll to lower right corner
  Ctrl-PgUp    - scroll one page up (vertical)
  Ctrl-PgDown    - scroll one page down (vertical)

- F3/F4 keys switch between tiles / fit-to-screen ASCII mode (Yitzhak's
suggestion)
This commit is contained in:
nethack.allison
2002-02-13 20:09:52 +00:00
parent 38e91a320d
commit 4565a1d0bd

View File

@@ -162,35 +162,129 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
switch (wParam)
{
case VK_LEFT:
NHEVENT_KBD(KEYTABLE(KEY_W));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window one line left */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_HSCROLL,
MAKEWPARAM(SB_LINEUP, 0),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_W));
}
return 0;
case VK_RIGHT:
NHEVENT_KBD(KEYTABLE(KEY_E));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window one line right */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_HSCROLL,
MAKEWPARAM(SB_LINEDOWN, 0),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_E));
}
return 0;
case VK_UP:
NHEVENT_KBD(KEYTABLE(KEY_N));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window one line up */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_VSCROLL,
MAKEWPARAM(SB_LINEUP, 0),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_N));
}
return 0;
case VK_DOWN:
NHEVENT_KBD(KEYTABLE(KEY_S));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window one line down */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_VSCROLL,
MAKEWPARAM(SB_LINEDOWN, 0),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_S));
}
return 0;
case VK_HOME:
NHEVENT_KBD(KEYTABLE(KEY_NW));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window to upper left corner */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_VSCROLL,
MAKEWPARAM(SB_THUMBTRACK, 0),
(LPARAM)NULL
);
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_HSCROLL,
MAKEWPARAM(SB_THUMBTRACK, 0),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_NW));
}
return 0;
case VK_END:
NHEVENT_KBD(KEYTABLE(KEY_SW));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window to lower right corner */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_VSCROLL,
MAKEWPARAM(SB_THUMBTRACK, ROWNO),
(LPARAM)NULL
);
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_HSCROLL,
MAKEWPARAM(SB_THUMBTRACK, COLNO),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_SW));
}
return 0;
case VK_PRIOR:
NHEVENT_KBD(KEYTABLE(KEY_NE));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window one page up */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_VSCROLL,
MAKEWPARAM(SB_PAGEUP, 0),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_NE));
}
return 0;
case VK_NEXT:
NHEVENT_KBD(KEYTABLE(KEY_SE));
if( GetKeyState(VK_CONTROL)&0x80 ) {
/* scroll map window one page down */
SendMessage(
mswin_hwnd_from_winid(WIN_MAP),
WM_VSCROLL,
MAKEWPARAM(SB_PAGEDOWN, 0),
(LPARAM)NULL
);
} else {
NHEVENT_KBD(KEYTABLE(KEY_SE));
}
return 0;
case VK_DECIMAL:
@@ -211,6 +305,14 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
NHEVENT_KBD(KEYTABLE(KEY_PLUS));
return 0;
case VK_F3:
mswin_select_map_mode(MAP_MODE_TILES);
return 0;
case VK_F4:
mswin_select_map_mode(MAP_MODE_ASCII_FIT_TO_SCREEN);
return 0;
default: {
WORD c;
BYTE kbd_state[256];