- added counting to the menu window. I changed the way it works in the TTY
port though  ("you hear the rumble of distant thunder..." :)  The count
applies to the currently selected item instead of being aplied to the item
to be selected  (in other words a12 instead of 12a). It works better this
way in the graphical port since there is a notion of current menu item.
 I also notes that the count is ignored for PICK_ONE menu - is this by
design?

- somebode mention that text is not scrollable by default - this is fixed.

- fixed player selection dialog to use initXXXX options

-----------------------
B1028 [reported] win32: popup window is too short
The text in the popup window's top line "What do you want to
call the ..." is cut off. Could the window be bigger, so you
can read the entire line?

Fixed.

---------------------
B1027 [reported] win32: select via traditional class char
In a shop (and perhaps elsewhere), I can autoselect a class of
items to drop: a for all types, b for coins, c for weapons, ...,
A for every item, B for blessed items, ... I like the new
possibilities, but I would like to be able to use the old way of
using ! for potions, ) for weapons, etc., as well.

Fixed.

---------------------
B1026 [reported] win32: setting multiple options

I want to set packorder and pickup_types. The first comes up
first, and I type in the order. Then comes the second, without
any hint what is asked of me. A little explanation here would
be appropriate, like "pick up what things automatically?" or
somesuch. When more than one option is set where extra input
is required, some explanation is useful.

Looking into. Apparently something  end_menu() call is ignored by nethackw.

---------------------
B1025 [reported] win32: menu navigation
I press O. Now, when I press "a" to turn on "autodig", not only
is the mark set at "a", but there also appears a dotted
rectangle around option "A" (capitalized). Shouldn't this
rectangle also appear at "a"? Pressing "a" repeatedly toggles
the checkmark, but the rectangle switches between "A" and "a".
My CAPS LOCK is not set. The same goes for B, C, D, ... N,
by the way. Pressing "A" works the other way around: the first
press checks "A" and "rectangles" "a", the next unchecks "A"
and rectangles "A" as well.

Fixed.

---------------------
B1024 [reported] win32: no text in final window
After I clicked away the last screen with information
(challenges, I believe it was), I got an empty text screen, as
big as my screen, without any content. It looked like the text
screens that appear on the right, only it was larger and had
only a large OK button over the full width of the window, and
no cancel button. Why this window?

Fixed. The program did not set window text for RIP window.

---------------------
B1010 [known issue] win32: cosmetic
When I get my list of spells, the columns aren't properly
aligned: if the spell name is longer, the rest of the line
shifts right.

Fixed. Fixed-pitch font is used for menu window.

---------------------
B1004 [reported] win32: numeric keyboard Del/.-key
The Del/.-key on my numeric keyboard doesn't make me rest a turn

Fixed. Added rest on Del.

---------------------
B1003 [reported] win32: focus
When the window has the focus, the window bar isn't highlighted.

This is by design. Menu and text widnows are popup and the main
window is disabled when they are up.
This commit is contained in:
nethack.allison
2002-01-25 07:19:21 +00:00
parent f73a1879c9
commit 7f7c1ff26b
14 changed files with 749 additions and 387 deletions
+5 -4
View File
@@ -251,10 +251,11 @@ mhcmd.c mhcmd.h mhdlg.c mhdlg.h mhfont.c
mhfont.h mhinput.c mhinput.h mhmain.c mhmain.h mhfont.h mhinput.c mhinput.h mhmain.c mhmain.h
mhmap.c mhmap.h mhmenu.c mhmenu.h mhmsg.h mhmap.c mhmap.h mhmenu.c mhmenu.h mhmsg.h
mhmsgwnd.c mhmsgwnd.h mhrip.c mhrip.h mhstatus.c mhmsgwnd.c mhmsgwnd.h mhrip.c mhrip.h mhstatus.c
mhstatus.h mhtext.c mhtext.h mnsel.uu mnunsel.uu mhstatus.h mhtext.c mhtext.h mnsel.uu mnselcnt.uu
mswproc.c nethack.dsw nethackw.dsp petmark.uu recover.dsp mnunsel.uu mswproc.c nethack.dsw nethackw.dsp petmark.uu
resource.h tile2bmp.c tile2bmp.dsp tilemap.dsp tiles.dsp recover.dsp resource.h tile2bmp.c tile2bmp.dsp tilemap.dsp
tiles.mak winhack.c winhack.h winhack.rc winMS.h tiles.dsp tiles.mak winhack.c winhack.h winhack.rc
winMS.h
+13 -1
View File
@@ -1,4 +1,4 @@
@REM SCCS Id: @(#)nhsetup.bat 2002/01/21 @REM SCCS Id: @(#)nhsetup.bat 2002/01/25
@REM Copyright (c) NetHack PC Development Team 1993, 1996, 2002 @REM Copyright (c) NetHack PC Development Team 1993, 1996, 2002
@REM NetHack may be freely redistributed. See license for details. @REM NetHack may be freely redistributed. See license for details.
@REM Win32 setup batch file, see Install.nt for details @REM Win32 setup batch file, see Install.nt for details
@@ -96,6 +96,18 @@ copy .\mnunsel.bmp ..\..\win\win32
:hasmnuns2 :hasmnuns2
if NOT exist ..\..\win\win32\mnunsel.bmp set err_nouu=Y if NOT exist ..\..\win\win32\mnunsel.bmp set err_nouu=Y
if exist ..\..\win\win32\mnselcnt.bmp goto hasmnselcnt2
if exist .\mnselcnt.bmp goto hasmnselcnt1
if exist ..\..\win\win32\mnselcnt.uu uudecode ..\..\win\win32\mnselcnt.uu >nul
if exist .\mnselcnt.bmp goto hasmnselcnt1
echo Error - No UUDECODE utility to decode ..\..\win\win32\mnselcnt.uu
goto hasmnselcnt2
:hasmnselcnt1
echo copy .\mnselcnt.bmp ..\..\win\win32
copy .\mnselcnt.bmp ..\..\win\win32
:hasmnselcnt2
if NOT exist ..\..\win\win32\mnselcnt.bmp set err_nouu=Y
if exist ..\..\win\win32\petmark.bmp goto haspm2 if exist ..\..\win\win32\petmark.bmp goto haspm2
if exist .\petmark.bmp goto haspm1 if exist .\petmark.bmp goto haspm1
if exist ..\..\win\win32\petmark.uu uudecode ..\..\win\win32\petmark.uu >nul if exist ..\..\win\win32\petmark.uu uudecode ..\..\win\win32\petmark.uu >nul
+109 -52
View File
@@ -50,9 +50,11 @@ int mswin_getlin_window (
BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
struct getlin_data* data; struct getlin_data* data;
RECT main_rt, dlg_rt; RECT main_rt, text_rt, dlg_rt, edit_rt;
SIZE dlg_sz; SIZE dlg_sz;
TCHAR wbuf[BUFSZ]; TCHAR wbuf[BUFSZ];
HDC hdc;
HWND control;
switch (message) switch (message)
{ {
@@ -61,12 +63,18 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
SetWindowText(hWnd, NH_A2W(data->question, wbuf, sizeof(wbuf))); SetWindowText(hWnd, NH_A2W(data->question, wbuf, sizeof(wbuf)));
SetWindowLong(hWnd, GWL_USERDATA, lParam); SetWindowLong(hWnd, GWL_USERDATA, lParam);
/* center dialog in the main window */ /* get title text width */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt); SetRect(&text_rt, 0, 0, 100, 50);
GetWindowRect(hWnd, &dlg_rt); hdc = GetWindowDC(hWnd);
dlg_sz.cx = dlg_rt.right - dlg_rt.left; DrawText(hdc, wbuf, _tcslen(wbuf), &text_rt,
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top; DT_CALCRECT | DT_SINGLELINE | DT_NOPREFIX | DT_LEFT | DT_VCENTER );
ReleaseDC(hWnd, hdc);
/* center dialog in the main window */
GetWindowRect(hWnd, &dlg_rt);
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
dlg_sz.cx = max(dlg_rt.right-dlg_rt.left, text_rt.right-text_rt.left );
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
dlg_rt.left = (main_rt.left+main_rt.right-dlg_sz.cx)/2; dlg_rt.left = (main_rt.left+main_rt.right-dlg_sz.cx)/2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx; dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top+main_rt.bottom-dlg_sz.cy)/2; dlg_rt.top = (main_rt.top+main_rt.bottom-dlg_sz.cy)/2;
@@ -78,6 +86,36 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
dlg_sz.cy, dlg_sz.cy,
TRUE ); TRUE );
/* change layout of controls */
GetClientRect(hWnd, &dlg_rt);
control = GetDlgItem(hWnd, IDC_GETLIN_EDIT);
GetWindowRect(control, &edit_rt);
MoveWindow( control,
0,
0,
dlg_rt.right - dlg_rt.left,
edit_rt.bottom - edit_rt.top,
TRUE );
control = GetDlgItem(hWnd, IDOK);
GetWindowRect(control, &text_rt);
MoveWindow( control,
0,
edit_rt.bottom - edit_rt.top,
(dlg_rt.right-dlg_rt.left)/2,
text_rt.bottom - text_rt.top,
TRUE );
control = GetDlgItem(hWnd, IDCANCEL);
GetWindowRect(control, &text_rt);
MoveWindow( control,
(dlg_rt.right-dlg_rt.left)/2,
edit_rt.bottom - edit_rt.top,
(dlg_rt.right-dlg_rt.left)/2,
text_rt.bottom - text_rt.top,
TRUE );
/* set focus to the edit control */ /* set focus to the edit control */
SetFocus(GetDlgItem(hWnd, IDC_GETLIN_EDIT)); SetFocus(GetDlgItem(hWnd, IDC_GETLIN_EDIT));
@@ -401,20 +439,44 @@ void plselInitDialog(HWND hWnd)
plselAdjustLists(hWnd, -1); plselAdjustLists(hWnd, -1);
/* intialize roles list */ /* intialize roles list */
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_CHECKED); if( flags.initrole<0 ) {
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), FALSE); CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_SETCURSEL, (WPARAM)flags.initrole, 0);
}
/* intialize races list */ /* intialize races list */
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_CHECKED); if( flags.initrace<0 || !validrace(flags.initrole, flags.initrace) ) {
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), FALSE); CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_SETCURSEL, (WPARAM)flags.initrace, 0);
}
/* intialize genders list */ /* intialize genders list */
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_CHECKED); if( flags.initgend<0 || !validgend(flags.initrole, flags.initrace, flags.initgend)) {
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), FALSE); CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_SETCURSEL, (WPARAM)flags.initgend, 0);
}
/* intialize alignments list */ /* intialize alignments list */
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_CHECKED); if( flags.initalign<0 || !validalign(flags.initrole, flags.initrace, flags.initalign) ) {
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), FALSE); CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_SETCURSEL, (WPARAM)flags.initalign, 0);
}
} }
/* adjust role/race/alignment/gender list - filter out /* adjust role/race/alignment/gender list - filter out
@@ -424,10 +486,8 @@ void plselInitDialog(HWND hWnd)
*/ */
void plselAdjustLists(HWND hWnd, int changed_sel) void plselAdjustLists(HWND hWnd, int changed_sel)
{ {
HWND control_role; HWND control_role, control_race, control_gender, control_align;
HWND control_race; int initrole, initrace, initgend, initalign;
HWND control_gender;
HWND control_align;
int i; int i;
int ind; int ind;
int valid_opt; int valid_opt;
@@ -441,16 +501,16 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* get current selections */ /* get current selections */
ind = SendMessage(control_role, CB_GETCURSEL, 0, 0); ind = SendMessage(control_role, CB_GETCURSEL, 0, 0);
flags.initrole = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_role, CB_GETITEMDATA, ind, 0); initrole = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_role, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_race, CB_GETCURSEL, 0, 0); ind = SendMessage(control_race, CB_GETCURSEL, 0, 0);
flags.initrace = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_race, CB_GETITEMDATA, ind, 0); initrace = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_race, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0); ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0);
flags.initgend = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_gender, CB_GETITEMDATA, ind, 0); initgend = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_align, CB_GETCURSEL, 0, 0); ind = SendMessage(control_align, CB_GETCURSEL, 0, 0);
flags.initalign = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_align, CB_GETITEMDATA, ind, 0); initalign = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_align, CB_GETITEMDATA, ind, 0);
/* intialize roles list */ /* intialize roles list */
if( changed_sel==-1 ) { if( changed_sel==-1 ) {
@@ -459,11 +519,14 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* reset content and populate the list */ /* reset content and populate the list */
SendMessage(control_role, CB_RESETCONTENT, 0, 0); SendMessage(control_role, CB_RESETCONTENT, 0, 0);
for (i = 0; roles[i].name.m; i++) { for (i = 0; roles[i].name.m; i++) {
if (ok_role(i, flags.initrace, flags.initgend, if (ok_role(i, initrace, initgend, initalign)) {
flags.initalign)) { if (initgend>=0 && flags.female && roles[i].name.f)
ind = SendMessage(control_role, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(roles[i].name.m, wbuf, sizeof(wbuf)) ); ind = SendMessage(control_role, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(roles[i].name.f, wbuf, sizeof(wbuf)) );
else
ind = SendMessage(control_role, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(roles[i].name.m, wbuf, sizeof(wbuf)) );
SendMessage(control_role, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i ); SendMessage(control_role, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initrole ) { if( i==initrole ) {
SendMessage(control_role, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 ); SendMessage(control_role, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
valid_opt = 1; valid_opt = 1;
} }
@@ -473,10 +536,10 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* set selection to the previously selected role /* set selection to the previously selected role
if it is still valid */ if it is still valid */
if( !valid_opt ) { if( !valid_opt ) {
flags.initrole = ROLE_NONE; initrole = ROLE_NONE;
flags.initrace = ROLE_NONE; initrace = ROLE_NONE;
flags.initgend = ROLE_NONE; initgend = ROLE_NONE;
flags.initalign = ROLE_NONE; initalign = ROLE_NONE;
SendMessage(control_role, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 ); SendMessage(control_role, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
} }
@@ -491,10 +554,10 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* reset content and populate the list */ /* reset content and populate the list */
SendMessage(control_race, CB_RESETCONTENT, 0, 0); SendMessage(control_race, CB_RESETCONTENT, 0, 0);
for (i = 0; races[i].noun; i++) for (i = 0; races[i].noun; i++)
if (ok_race(flags.initrole, i, ROLE_NONE, ROLE_NONE)) { if (ok_race(initrole, i, ROLE_NONE, ROLE_NONE)) {
ind = SendMessage(control_race, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(races[i].noun, wbuf, sizeof(wbuf)) ); ind = SendMessage(control_race, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(races[i].noun, wbuf, sizeof(wbuf)) );
SendMessage(control_race, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i ); SendMessage(control_race, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initrace ) { if( i==initrace ) {
SendMessage(control_race, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 ); SendMessage(control_race, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
valid_opt = 1; valid_opt = 1;
} }
@@ -503,9 +566,9 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* set selection to the previously selected race /* set selection to the previously selected race
if it is still valid */ if it is still valid */
if( !valid_opt ) { if( !valid_opt ) {
flags.initrace = ROLE_NONE; initrace = ROLE_NONE;
flags.initgend = ROLE_NONE; initgend = ROLE_NONE;
flags.initalign = ROLE_NONE; initalign = ROLE_NONE;
SendMessage(control_race, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 ); SendMessage(control_race, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
} }
@@ -520,11 +583,10 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* reset content and populate the list */ /* reset content and populate the list */
SendMessage(control_gender, CB_RESETCONTENT, 0, 0); SendMessage(control_gender, CB_RESETCONTENT, 0, 0);
for (i = 0; i < ROLE_GENDERS; i++) for (i = 0; i < ROLE_GENDERS; i++)
if (ok_gend(flags.initrole, flags.initrace, i, if (ok_gend(initrole, initrace, i, ROLE_NONE)) {
ROLE_NONE)) {
ind = SendMessage(control_gender, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(genders[i].adj, wbuf, sizeof(wbuf)) ); ind = SendMessage(control_gender, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(genders[i].adj, wbuf, sizeof(wbuf)) );
SendMessage(control_gender, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i ); SendMessage(control_gender, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initgend ) { if( i==initgend ) {
SendMessage(control_gender, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 ); SendMessage(control_gender, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
} }
} }
@@ -532,8 +594,8 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* set selection to the previously selected gender /* set selection to the previously selected gender
if it is still valid */ if it is still valid */
if( !valid_opt ) { if( !valid_opt ) {
flags.initgend = ROLE_NONE; initgend = ROLE_NONE;
flags.initalign = ROLE_NONE; initalign = ROLE_NONE;
SendMessage(control_gender, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 ); SendMessage(control_gender, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
} }
@@ -548,11 +610,10 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* reset content and populate the list */ /* reset content and populate the list */
SendMessage(control_align, CB_RESETCONTENT, 0, 0); SendMessage(control_align, CB_RESETCONTENT, 0, 0);
for (i = 0; i < ROLE_ALIGNS; i++) for (i = 0; i < ROLE_ALIGNS; i++)
if (ok_align(flags.initrole, flags.initrace, if (ok_align(initrole, initrace, initgend, i)) {
flags.initgend, i)) {
ind = SendMessage(control_align, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(aligns[i].adj, wbuf, sizeof(wbuf)) ); ind = SendMessage(control_align, CB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(aligns[i].adj, wbuf, sizeof(wbuf)) );
SendMessage(control_align, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i ); SendMessage(control_align, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
if( i==flags.initalign ) { if( i==initalign ) {
SendMessage(control_align, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 ); SendMessage(control_align, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
valid_opt = 1; valid_opt = 1;
} }
@@ -561,7 +622,7 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
/* set selection to the previously selected alignment /* set selection to the previously selected alignment
if it is still valid */ if it is still valid */
if( !valid_opt ) { if( !valid_opt ) {
flags.initalign = ROLE_NONE; initalign = ROLE_NONE;
SendMessage(control_align, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 ); SendMessage(control_align, CB_SETCURSEL, (WPARAM)-1, (LPARAM)0 );
} }
} }
@@ -604,8 +665,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
/* check the role */ /* check the role */
if( flags.initrole==ROLE_RANDOM ) { if( flags.initrole==ROLE_RANDOM ) {
flags.initrole = pick_role(flags.initrace, flags.initgend, flags.initrole = pick_role(flags.initrace, flags.initgend, flags.initalign, PICK_RANDOM);
flags.initalign, PICK_RANDOM);
if (flags.initrole < 0) { if (flags.initrole < 0) {
MessageBox(hWnd, TEXT("Incompatible role!"), TEXT("STOP"), MB_OK); MessageBox(hWnd, TEXT("Incompatible role!"), TEXT("STOP"), MB_OK);
return FALSE; return FALSE;
@@ -617,8 +677,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
if (flags.initrace==ROLE_RANDOM || !validrace(flags.initrole, flags.initrace)) { if (flags.initrace==ROLE_RANDOM || !validrace(flags.initrole, flags.initrace)) {
/* pre-selected race not valid */ /* pre-selected race not valid */
if (flags.initrace == ROLE_RANDOM) { if (flags.initrace == ROLE_RANDOM) {
flags.initrace = pick_race(flags.initrole, flags.initgend, flags.initrace = pick_race(flags.initrole, flags.initgend, flags.initalign, PICK_RANDOM);
flags.initalign, PICK_RANDOM);
} }
if (flags.initrace < 0) { if (flags.initrace < 0) {
@@ -634,8 +693,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
!validgend(flags.initrole, flags.initrace, flags.initgend)) { !validgend(flags.initrole, flags.initrace, flags.initgend)) {
/* pre-selected gender not valid */ /* pre-selected gender not valid */
if (flags.initgend == ROLE_RANDOM) { if (flags.initgend == ROLE_RANDOM) {
flags.initgend = pick_gend(flags.initrole, flags.initrace, flags.initgend = pick_gend(flags.initrole, flags.initrace, flags.initalign, PICK_RANDOM);
flags.initalign, PICK_RANDOM);
} }
if (flags.initgend < 0) { if (flags.initgend < 0) {
@@ -650,8 +708,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
!validalign(flags.initrole, flags.initrace, flags.initalign)) { !validalign(flags.initrole, flags.initrace, flags.initalign)) {
/* pre-selected alignment not valid */ /* pre-selected alignment not valid */
if (flags.initalign == ROLE_RANDOM) { if (flags.initalign == ROLE_RANDOM) {
flags.initalign = pick_align(flags.initrole, flags.initrace, flags.initalign = pick_align(flags.initrole, flags.initrace, flags.initgend, PICK_RANDOM);
flags.initgend, PICK_RANDOM);
} else { } else {
MessageBox(hWnd, TEXT("Incompatible alignment!"), TEXT("STOP"), MB_OK); MessageBox(hWnd, TEXT("Incompatible alignment!"), TEXT("STOP"), MB_OK);
return FALSE; return FALSE;
+1 -1
View File
@@ -67,7 +67,7 @@ HGDIOBJ mswin_create_font(int win_type, int attr, HDC hdc)
lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision
lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
lgfnt.lfQuality = DEFAULT_QUALITY; // output quality lgfnt.lfQuality = DEFAULT_QUALITY; // output quality
lgfnt.lfPitchAndFamily = VARIABLE_PITCH; // pitch and family lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family
/* lgfnt.lfFaceName */ /* lgfnt.lfFaceName */
break; break;
+6 -2
View File
@@ -142,6 +142,10 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
case VK_NEXT: case VK_NEXT:
NHEVENT_KBD('3') NHEVENT_KBD('3')
return 0; return 0;
case VK_DELETE:
NHEVENT_KBD('.')
return 0;
} }
return 1; return 1;
} break; } break;
@@ -165,8 +169,8 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
case WM_SETFOCUS: case WM_SETFOCUS:
/* if there is a menu window out there - /* if there is a menu window out there -
transfer input focus to it */ transfer input focus to it */
if( IsWindow( GetNHApp()->hMenuWnd ) ) { if( IsWindow( GetNHApp()->hPopupWnd ) ) {
SetFocus( GetNHApp()->hMenuWnd ); SetFocus( GetNHApp()->hPopupWnd );
} }
break; break;
+561 -284
View File
File diff suppressed because it is too large Load Diff
+1 -20
View File
@@ -13,24 +13,5 @@ HWND mswin_init_RIP_window ()
void mswin_display_RIP_window (HWND hWnd) void mswin_display_RIP_window (HWND hWnd)
{ {
MSG msg; mswin_display_text_window (hWnd);
RECT rt;
GetNHApp()->hMenuWnd = hWnd;
GetWindowRect(GetNHApp()->hMainWnd, &rt);
MoveWindow(hWnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, FALSE);
ShowWindow(hWnd, SW_SHOW);
SetFocus(hWnd);
while( IsWindow(hWnd) &&
GetMessage(&msg, NULL, 0, 0)!=0 ) {
if( !IsDialogMessage(hWnd, &msg) ) {
if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
GetNHApp()->hMenuWnd = NULL;
} }
+32 -6
View File
@@ -13,7 +13,10 @@ typedef struct mswin_nethack_text_window {
TCHAR* window_text; TCHAR* window_text;
} NHTextWindow, *PNHTextWindow; } NHTextWindow, *PNHTextWindow;
BOOL CALLBACK TextWndProc(HWND, UINT, WPARAM, LPARAM); static WNDPROC editControlWndProc = 0;
BOOL CALLBACK NHTextWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK NHEditHookWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam); static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void LayoutText(HWND hwnd); static void LayoutText(HWND hwnd);
@@ -25,7 +28,7 @@ HWND mswin_init_text_window () {
GetNHApp()->hApp, GetNHApp()->hApp,
MAKEINTRESOURCE(IDD_NHTEXT), MAKEINTRESOURCE(IDD_NHTEXT),
GetNHApp()->hMainWnd, GetNHApp()->hMainWnd,
TextWndProc NHTextWndProc
); );
if( !ret ) panic("Cannot create text window"); if( !ret ) panic("Cannot create text window");
@@ -52,13 +55,12 @@ void mswin_display_text_window (HWND hWnd)
SetWindowText(GetDlgItem(hWnd, IDC_TEXT_CONTROL), data->window_text); SetWindowText(GetDlgItem(hWnd, IDC_TEXT_CONTROL), data->window_text);
} }
GetNHApp()->hMenuWnd = hWnd; GetNHApp()->hPopupWnd = hWnd;
mapWnd = mswin_hwnd_from_winid(WIN_MAP); mapWnd = mswin_hwnd_from_winid(WIN_MAP);
if( !IsWindow(mapWnd) ) mapWnd = GetNHApp()->hMainWnd; if( !IsWindow(mapWnd) ) mapWnd = GetNHApp()->hMainWnd;
GetWindowRect(mapWnd, &rt); GetWindowRect(mapWnd, &rt);
MoveWindow(hWnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE); MoveWindow(hWnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
ShowWindow(hWnd, SW_SHOW); ShowWindow(hWnd, SW_SHOW);
SetFocus(hWnd);
while( IsWindow(hWnd) && while( IsWindow(hWnd) &&
GetMessage(&msg, NULL, 0, 0)!=0 ) { GetMessage(&msg, NULL, 0, 0)!=0 ) {
@@ -70,10 +72,10 @@ void mswin_display_text_window (HWND hWnd)
} }
} }
GetNHApp()->hMenuWnd = NULL; GetNHApp()->hPopupWnd = NULL;
} }
BOOL CALLBACK TextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HWND control; HWND control;
HDC hdc; HDC hdc;
@@ -93,6 +95,10 @@ BOOL CALLBACK TextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
SendMessage(control, WM_SETFONT, (WPARAM)mswin_create_font(NHW_TEXT, ATR_NONE, hdc), 0); SendMessage(control, WM_SETFONT, (WPARAM)mswin_create_font(NHW_TEXT, ATR_NONE, hdc), 0);
ReleaseDC(control, hdc); ReleaseDC(control, hdc);
/* subclass edit control */
editControlWndProc = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
SetWindowLong(control, GWL_WNDPROC, (LONG)NHEditHookWndProc);
SetFocus(control); SetFocus(control);
return FALSE; return FALSE;
@@ -187,3 +193,23 @@ void LayoutText(HWND hWnd)
MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE ); MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE );
MoveWindow(btn_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE ); MoveWindow(btn_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE );
} }
/* Edit box hook */
LRESULT CALLBACK NHEditHookWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
/* close on space */
case WM_KEYDOWN:
if( wParam==VK_SPACE ) {
PostMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(IDOK, 0), 0);
}
break;
}
if( editControlWndProc )
return CallWindowProc(editControlWndProc, hWnd, message, wParam, lParam);
else
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
begin 600 mnselcnt.bmp
M0DWV`````````'8````H````$````!`````!``0``````(``````````````
M````````````````````@```@````("``(````"``(``@(```,#`P`"`@(``
M``#_``#_````__\`_P```/\`_P#__P``____````````````````````````
M________``#_______\``/_P__\/_P``_P````#_``#_\/__#_\``/_P__\/
M_P``__#__P__``#_\/__#_\``/\`````_P``__#__P__``#_______\``/__
5_____P``````````````````````
`
end
-5
View File
@@ -126,11 +126,6 @@ void mswin_player_selection(void)
logDebug("mswin_player_selection()\n"); logDebug("mswin_player_selection()\n");
/* select a role */ /* select a role */
flags.initalign = -1; /* reset */
flags.initgend = -1;
flags.initrace = -1;
flags.initrole = -1;
if( mswin_player_selection_window( &nRole ) == IDCANCEL ) { if( mswin_player_selection_window( &nRole ) == IDCANCEL ) {
clearlocks(); clearlocks();
mswin_exit_nhwindows(0); mswin_exit_nhwindows(0);
+2 -1
View File
@@ -23,6 +23,7 @@
#define IDD_EXTCMD 139 #define IDD_EXTCMD 139
#define IDD_PLAYER_SELECTOR 141 #define IDD_PLAYER_SELECTOR 141
#define IDB_PETMARK 143 #define IDB_PETMARK 143
#define IDB_MENU_SEL_COUNT 144
#define IDC_TEXT_VIEW 1000 #define IDC_TEXT_VIEW 1000
#define IDC_TEXT_CONTROL 1000 #define IDC_TEXT_CONTROL 1000
#define IDC_CMD_MOVE_NW 1001 #define IDC_CMD_MOVE_NW 1001
@@ -133,7 +134,7 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 144 #define _APS_NEXT_RESOURCE_VALUE 145
#define _APS_NEXT_COMMAND_VALUE 32793 #define _APS_NEXT_COMMAND_VALUE 32793
#define _APS_NEXT_CONTROL_VALUE 1331 #define _APS_NEXT_CONTROL_VALUE 1331
#define _APS_NEXT_SYMED_VALUE 110 #define _APS_NEXT_SYMED_VALUE 110
+1 -1
View File
@@ -38,7 +38,7 @@ typedef struct mswin_nhwindow_app {
HINSTANCE hApp; HINSTANCE hApp;
HWND hMainWnd; HWND hMainWnd;
HACCEL hAccelTable; HACCEL hAccelTable;
HWND hMenuWnd; /* menu window in the selection process */ HWND hPopupWnd; /* current popup window */
MSNHWinData windowlist[MAXWINDOWS]; MSNHWinData windowlist[MAXWINDOWS];
+1 -1
View File
@@ -51,7 +51,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
_nethack_app.hApp = hInstance; _nethack_app.hApp = hInstance;
_nethack_app.hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINHACK); _nethack_app.hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINHACK);
_nethack_app.hMainWnd = NULL; _nethack_app.hMainWnd = NULL;
_nethack_app.hMenuWnd = NULL; _nethack_app.hPopupWnd = NULL;
_nethack_app.bmpTiles = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TILES)); _nethack_app.bmpTiles = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TILES));
if( _nethack_app.bmpTiles==NULL ) panic("cannot load tiles bitmap"); if( _nethack_app.bmpTiles==NULL ) panic("cannot load tiles bitmap");
_nethack_app.bmpPetMark = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PETMARK)); _nethack_app.bmpPetMark = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PETMARK));
+3 -4
View File
@@ -108,10 +108,8 @@ BEGIN
END END
IDD_NHTEXT DIALOGEX 0, 0, 172, 178 IDD_NHTEXT DIALOGEX 0, 0, 172, 178
STYLE DS_SETFOREGROUND | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | STYLE DS_SETFOREGROUND | WS_POPUP | WS_THICKFRAME
WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_STATICEDGE EXSTYLE WS_EX_STATICEDGE
CAPTION "Text"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,54,163,50,14 DEFPUSHBUTTON "OK",IDOK,54,163,50,14
@@ -122,7 +120,7 @@ END
IDD_MENU DIALOGEX 0, 0, 187, 153 IDD_MENU DIALOGEX 0, 0, 187, 153
STYLE WS_POPUP | WS_CLIPSIBLINGS | WS_THICKFRAME STYLE WS_POPUP | WS_CLIPSIBLINGS | WS_THICKFRAME
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT | WS_EX_STATICEDGE EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT | WS_EX_STATICEDGE
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,7,132,50,14,BS_FLAT DEFPUSHBUTTON "OK",IDOK,7,132,50,14,BS_FLAT
PUSHBUTTON "Cancel",IDCANCEL,130,132,50,14,BS_FLAT PUSHBUTTON "Cancel",IDCANCEL,130,132,50,14,BS_FLAT
@@ -222,6 +220,7 @@ IDB_TILES BITMAP DISCARDABLE "tiles.bmp"
IDB_MENU_SEL BITMAP DISCARDABLE "mnsel.bmp" IDB_MENU_SEL BITMAP DISCARDABLE "mnsel.bmp"
IDB_MENU_UNSEL BITMAP DISCARDABLE "mnunsel.bmp" IDB_MENU_UNSEL BITMAP DISCARDABLE "mnunsel.bmp"
IDB_PETMARK BITMAP DISCARDABLE "petmark.bmp" IDB_PETMARK BITMAP DISCARDABLE "petmark.bmp"
IDB_MENU_SEL_COUNT BITMAP DISCARDABLE "mnselcnt.bmp"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //