diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index c84d605ec..91aa62486 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -290,7 +290,7 @@ static const struct pad { {'h', 'H', C('h')}, /* 4 */ {'g', 'g', 'g'}, /* 5 */ {'l', 'L', C('l')}, /* 6 */ - {'p', 'P', C('p')}, /* + */ + {'+', 'P', C('p')}, /* + */ {'b', 'B', C('b')}, /* 1 */ {'j', 'J', C('j')}, /* 2 */ {'n', 'N', C('n')}, /* 3 */ @@ -304,7 +304,7 @@ static const struct pad { {'4', M('4'), '4'}, /* 4 */ {'g', 'G', 'g'}, /* 5 */ {'6', M('6'), '6'}, /* 6 */ - {'p', 'P', C('p')}, /* + */ + {'+', 'P', C('p')}, /* + */ {'1', M('1'), '1'}, /* 1 */ {'2', M('2'), '2'}, /* 2 */ {'3', M('3'), '3'}, /* 3 */ diff --git a/sys/winnt/winnt.cnf b/sys/winnt/winnt.cnf index 88e3a46e6..275abc469 100644 --- a/sys/winnt/winnt.cnf +++ b/sys/winnt/winnt.cnf @@ -28,7 +28,7 @@ OPTIONS=IBMGraphics # General options. You might also set "silent" so as not to attract # the boss's attention. # -OPTIONS=time,noshowexp,number_pad,lit_corridor,rest_on_space +OPTIONS=time,noshowexp,number_pad,lit_corridor,rest_on_space,toptenwin # # If you want to get rid of "use #quit to quit..." use: #OPTIONS=suppress_alert:3.3.1 diff --git a/win/win32/mhmain.c b/win/win32/mhmain.c index 35db3c509..5140481c2 100644 --- a/win/win32/mhmain.c +++ b/win/win32/mhmain.c @@ -103,7 +103,7 @@ keypad[KEY_LAST][3] = { {'h', 'H', C('h')}, /* 4 */ {'g', 'g', 'g'}, /* 5 */ {'l', 'L', C('l')}, /* 6 */ - {'p', 'P', C('p')}, /* + */ + {'+', 'P', C('p')}, /* + */ {'b', 'B', C('b')}, /* 1 */ {'j', 'J', C('j')}, /* 2 */ {'n', 'N', C('n')}, /* 3 */ @@ -118,7 +118,7 @@ numpad[KEY_LAST][3] = { {'4', M('4'), '4'}, /* 4 */ {'g', 'G', 'g'}, /* 5 */ {'6', M('6'), '6'}, /* 6 */ - {'p', 'P', C('p')}, /* + */ + {'+', 'P', C('p')}, /* + */ {'1', M('1'), '1'}, /* 1 */ {'2', M('2'), '2'}, /* 2 */ {'3', M('3'), '3'}, /* 3 */ diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 3f64005af..f1d60d1be 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -141,14 +141,10 @@ void mswin_askname(void) { logDebug("mswin_askname()\n"); -#ifdef _DEBUG - strcpy(plname, "wizard"); -#else - if( mswin_getlin_window("who are you?", plname, PL_NSIZ)==IDCANCEL ) { + if( mswin_getlin_window("Who are you?", plname, PL_NSIZ)==IDCANCEL ) { bail("bye-bye"); /* not reached */ } -#endif } @@ -167,8 +163,6 @@ void mswin_get_nh_event(void) void mswin_exit_nhwindows(const char *str) { logDebug("mswin_exit_nhwindows(%s)\n", str); - - terminate(EXIT_SUCCESS); } /* Prepare the window to be suspended. */ @@ -447,6 +441,13 @@ void mswin_putstr(winid wid, int attr, const char *text) WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data ); } } + else + { + // build text to display later in message box + GetNHApp()->saved_text = realloc(GetNHApp()->saved_text, strlen(text) + + strlen(GetNHApp()->saved_text) + 1); + strcat(GetNHApp()->saved_text, text); + } } /* Display the file named str. Complain about missing files @@ -854,6 +855,22 @@ char mswin_yn_function(const char *question, const char *choices, logDebug("mswin_yn_function(%s, %s, %d)\n", question, choices, def); + if (WIN_MESSAGE == WIN_ERR && choices == ynchars) { + char *text = realloc(strdup(GetNHApp()->saved_text), strlen(question) + + strlen(GetNHApp()->saved_text) + 1); + DWORD box_result; + strcat(text, question); + box_result = MessageBox(NULL, + NH_W2A(text, message, sizeof(message)), + TEXT("NetHack for Windows"), + MB_YESNOCANCEL | + ((def == 'y') ? MB_DEFBUTTON1 : + (def == 'n') ? MB_DEFBUTTON2 : MB_DEFBUTTON3)); + free(text); + GetNHApp()->saved_text = strdup(TEXT("")); + return box_result == IDYES ? 'y' : box_result == IDNO ? 'n' : '\033'; + } + if (choices) { char *cb, choicebuf[QBUFSZ]; Strcpy(choicebuf, choices); diff --git a/win/win32/winMS.h b/win/win32/winMS.h index a895138c0..8a47f5af3 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -54,6 +54,8 @@ typedef struct mswin_nhwindow_app { int winStatusAlign; /* alignment of the status window */ int winMessageAlign; /* alignment of the status window */ + + char* saved_text; } NHWinApp, *PNHWinApp; extern PNHWinApp GetNHApp(); diff --git a/win/win32/winhack.c b/win/win32/winhack.c index ac40bee19..87c84dfeb 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -62,6 +62,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, _nethack_app.winStatusAlign = NHWND_ALIGN_BOTTOM; _nethack_app.winMessageAlign = NHWND_ALIGN_TOP; _nethack_app.mapCliparoundMargin = DEF_CLIPAROUND_MARGIN; + _nethack_app.saved_text = strdup(TEXT("")); // init controls ZeroMemory(&InitCtrls, sizeof(InitCtrls)); @@ -75,10 +76,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, return FALSE; } -#ifdef _DEBUG - wizard = TRUE; -#endif - /* get command line parameters */ p = _tcstok(GetCommandLine(), TEXT(" ")); for( argc=0; p && argc