Add origin-shifting (Shift+cursors) and source-shifting (Ctrl+cursors) to Net.

(Adding modifier+cursors handling has had minor knock-on effects on the other
puzzles, so that they can continue to ignore modifiers.)

(An unfortunate side effect of this is some artifacts in exterior barrier
drawing; notably, a disconnected corner can now appear at the corner of the
grid under some circumstances. I haven't found a satisfactory way round
this yet.)

[originally from svn r5844]
This commit is contained in:
Jacob Nevins
2005-05-26 13:40:38 +00:00
parent a1be37343c
commit 865e8ad6ca
13 changed files with 208 additions and 122 deletions

View File

@ -1221,31 +1221,35 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
case WM_KEYDOWN:
{
int key = -1;
BYTE keystate[256];
int r = GetKeyboardState(keystate);
int shift = (r && (keystate[VK_SHIFT] & 0x80)) ? MOD_SHFT : 0;
int ctrl = (r && (keystate[VK_CONTROL] & 0x80)) ? MOD_CTRL : 0;
switch (wParam) {
case VK_LEFT:
if (!(lParam & 0x01000000))
key = MOD_NUM_KEYPAD | '4';
else
key = CURSOR_LEFT;
else
key = shift | ctrl | CURSOR_LEFT;
break;
case VK_RIGHT:
if (!(lParam & 0x01000000))
key = MOD_NUM_KEYPAD | '6';
else
key = CURSOR_RIGHT;
else
key = shift | ctrl | CURSOR_RIGHT;
break;
case VK_UP:
if (!(lParam & 0x01000000))
key = MOD_NUM_KEYPAD | '8';
else
key = CURSOR_UP;
else
key = shift | ctrl | CURSOR_UP;
break;
case VK_DOWN:
if (!(lParam & 0x01000000))
key = MOD_NUM_KEYPAD | '2';
else
key = CURSOR_DOWN;
else
key = shift | ctrl | CURSOR_DOWN;
break;
/*
* Diagonal keys on the numeric keypad.