On Mon, 03 Jan 2005 12:04:29 +0000, <email deleted> wrote:
> Dear NetHack win32 developers,
>
> This bug does not affect the win32 binaries that you distribute but it
> does affect NetHack 3.4.3 if I build it from source. The difference may
> be due to different compilers or whatever. I'm using mingw32-gcc v3.2
>
> I don't quite understand what's going on (I never was much good at
> win32 programming), but it appears that the WM_KEYDOWN message for
> AltGr-4 is being translated into a WM_CHAR message with a wParam of
> 128. I don't understand why that should be, but anyway. The problem
> then occurs when NetHack casts wParam to char which, since char is
> signed, gives -128. onListChar() then passes -128 to isdigit() which
> causes the crash. The fix appears to be to simply drop the cast:
Also
> <email deleted>
> Newsgroups: rec.games.roguelike.nethack
> Subject: Changing tile set for item list?
> Date: 1 Jan 2005 20:03:08 -0800
> <email deleted>
>
> I'm using the windows interface for Nethack 3.4, and I've successfully
> changed the tileset used by changing defaults.nh. The only problem is,
> the item list (i.e. The list that comes up when I press "i") still uses
> the old tiles. Is there any way to change the list so it uses the new
> tiles? I've searched the guidebook to no avail. I'm debating if it is
> even possible.
>
> Thanks for the help,
> -Zmann
trunk patch:
- menu: display custom tiles if map is not ASCII
- menu: display '-'/'+'/'#' in place of a tile if map is ASCII
- fix isdigit() crash on AltGr-4 with mingw
It looks kinda weird with huge tiles (e.g. absurd96) but that could
be just me. Comments/suggestions are welcome.
-<Someone>
trunk and branch:
Do not limit role selection list by race/gender/alignment. The default.nh
selection will still be honored but the list itself will include every
possible role.
Some interface tweaks for main trunk:
- improved calculation of the size of the menu window
- made auto-arrange windows on/off option (it was reset automatically
which was unintuitive and in some cases annoying, IMO)
- set correct checkmark on "Lock Windows" menu item on startup
- redraw message window on resizing (it does not update properly otherwise)
- fixed copy/paste error in read registry settings function
The number_pad option can now optionally hold a value
{0,1, 2 } for {off, on, DOS-mode} but plain number_pad and
!number_pad in config files still work as before.
When number_pad:2 is set, iflags.num_pad_mode is set to 1
which triggers the following behaviour:
> '5', M('5') and M('0') are mapped in rhack()
>in cmd.c, only when they are entered as a command. When used as a
>number, like in the 'n' command, no mapping takes place. '0' is
>already mapped to 'i' by the core. The
>only difference [<Someone>] left in (deliberately) is when you press Ctrl-0;
>this used to map to C('i'), which is an invalid command; now
>keep it '0' (which is interpreted as 'i' by the core.)
What's in it:
some MessageBox tidbits:
- Let all MessageBoxes display an icon
- Introduced NHMessageBox to have messageboxes display a consistent title
- Change icon in mswin_display_file from MB_ICONERROR to MB_ICONEXCLAMATION
for non-fatal error
And to solve #U355: NetHackW won't run on Win2K OS:
- Avoid a crash when closing the main window while the splash screen is
displayed.
- Make sure NetHack starts normal when closed minimized
- Center the splash screen on the screen, not on the parent window
(which may be off-screen)
What's new in it:
- Show copyright banner in textbox in splash screen instead of over the picture
- Show news in splash screen only if iflags.news (solves W341-6)
- show complete version information in splash screen when it is used as about box)
[Also reverse the numkey patch in main trunk]
- My "various Windows refinements" patch from yesterday went into 3.4.x correctly
- My "NumberPad" patch went into 3.4.x, but should be backed out
- My "various Windows refinements" patch from last week was for 3.5.0, but is incomplete; you can safely ignore that.
- I'll make a new "various Windows refinements" patch for 3.5.0 tonight.
mapping the 5 and 0 to '5' and '0' respectively
when NumLock is off, to make entering numbers easier. The core will map '5' and
'0' to 'g' and 'i' respectively. This solves W341-5.
Note: I changed nhdefkey.c and mhmain.c, so both the tty and the windows
interface will show new behaviour. I deliberately did not change nh340key.dll.
Note: Maybe the same change should be made to the MSDOS port.
Note: The behaviour of getobj is a little bit strange: It doesn't use
yn_question's facility for returning a number, but handles that itself. The
net effect of this is that if you type d55$ (to drop 55 zorkmids,) only the
first '5' is shown
(2 troublesome bands removed
and will follow later)
Here's the new patch with the Windows improvements; this should apply to the
3.4.2 tree. Note the changed filename in the diff lines.
What's in it:
> some MessageBox tidbits:
> - Let all MessageBoxes display an icon
> - Introduced NHMessageBox to have messageboxes display a consistent title
> - Change icon in mswin_display_file from MB_ICONERROR to MB_ICONEXCLAMATION
> for non-fatal error
>
> And to solve #U355: NetHackW won't run on Win2K OS:
> - Avoid a crash when closing the main window while the splash screen is
> displayed.
> - Make sure NetHack starts normal when closed minimized
> - Center the splash screen on the screen, not on the parent window (which may
> be off-screen)
What's new in it:
- Show copyright banner in textbox in splash screen instead of over the picture
- Show news in splash screen only if iflags.news (solves W341-6)
- show complete version information in splash screen when it is used as about
box
-better handling of "more" prompt for messages that would have scrolled off the window
-support perm_invent
-menu option to add/remove windows captions
- Show splash on "Help - About" with all version information
- Show splash with news on startup (if show_splash is on of course).
I made another small patch to the splash screen. Because the greenish background colour always seemed a little odd to me, I decided
to make it transparent. Doing that, I found the following:
- The splash picture was a 24-bit bitmap, although it had less than 256 colours. That makes the size of the final executable about
200K larger than necessary. I changed it to a 256-colour bitmap. I also changed the background colour to the default tile background
colour, for consistency. The new bitmap is attached here. My excuses if the large file means a problem to anyone.
- In Microsoft's documentation (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_2y9g.asp) is is
stated that on Windows 95/98 "TransparentBlt contains a memory leak that can exhaust system resources." It is recommended to use
different code to draw transparent bitmaps, to be precise: the alternative code that is already in nhapply_image_transparent(). I'm
almost convinced that this is the cause for Betabug B08008 reported bij <Someone>. Can anyone confirm he is using 95/98? I decided
for the easy way out and removed the code that uses TransparentBlt completely. I see not much reason to use it if it is a) buggy and
b) we have an alternative that works perfectly. This is attached as trans.patch.
- The rest of the patch only changes the BitBlt() in mhsplash.c to a nhapply_image_transparent().
This patch is an improvement for menu/text dialogs.
This is a code carried over from Windows CE port. It changes
text and menu windows from "system popup" to plain "child"
windows of the main nethack window. Nethack main window can
now be resized/moved/minimized when menu/text window is up.
Menu/text windows will always stay inside the main window and
move along with it.
<Someone>
> Questions are being appended in the message window, some showing
> up on the same line. This is really noticeable with the
> end-of-game disclosure questions. Questions should always be
> presented on a new line.
At end of game is probably the only place, since then more than one
question is asked in the same turn. Anyhow, here's the patch, in
mswproc.c [...]
- No checkboxes in menu if menu is PICK_NONE. mhmenu.c
- About box changed to splash screen. This last thing is open
for discussion, as the splash screen currently does not give
exactly the ame information as the about box (or the v command).
Maybe the splash should be enhanced? Anyway, it looks better than
the About-box. I didn't remove the About-box code and resource yet
until this discussion is had. mhmain.c
<Someone>
> Below is the result of your feedback form. It was submitted by
> <email deleted> on Tuesday, June 4, 2002 at 21:04:54
> After alt-Q or F)ile, Q)uitting, it is still possible to F)ile, S)ave your
> game. By doing this after you are shown your inventory [fully identified] and
> attributes (It must be done before the last "Do you want to view your %1"
> dialog is answered--usually conduct), which means you can know what you are
> holding-- although it won't be officially identified. But you can use it to
> avoid putting on, say, an amulet of strangulation by mistake.
Two things:
1. This patch causes the window placement of the main window to be
written to the registry, and to be restored upon the next start
of the program. I had to move the creation of the main window to init_nhwindows,
as the registry is not read until then.
2. Implement support for wc_popup_dialog (or rather, support for not having
popup windows.) It asks getlin questions and get_ext_cmd on the
message window, much like the TTY port does it.
The get_ext_cmd procedure is almost but not quite the same as the
one for TTY, and I think it is better: It autocompletes the extended
command you type, but if you keep on typing it doesn't add those letters
after the completed command, but just keeps track of how many (correct)
characters you typed. If you type a different character than the
autocompleted command has, it shows you what you typed again. If you
press backspace, it deletes the characters you typed, and if autocompletion
is no longer possible, it removes the autocompleted part. The effect
of this is that you can type as many letters as you want when typing
an extended command, as long as it is enough to identify one command;
and you only have to delete the characters you actually typed if you made
a mistake. I think autocompletion is a lot less obtrusive this way.
Some notes about the patch:
- Both mswin_getlin and mswin_get_ext_cmd now have two versions, with
and without a popup.
- yn_question was changed so that it displays a caret, which is a lot
nicer IMHO.
- I had to implement a new NetHack Windows Message parameter,
"MSNH_MSG_CARET", to make it possible to show and hide the caret in
the message window. Normally the caret is created and destroyed by the
window that owns it, but in NetHack the input focus is always on the
main window, while the caret is in the message window, which happens
to be the only one that knows how large the caret should be.
- mswin_putstr_ex's last parameter changed from boolean to int; the
semantics are enhanced so that a negative last parameter means "delete
that many characters from the input line". The string to be deleted is
passed in as well, although it is currently not used.
- A rather large chunk of code finds out where the last string that was
displayed on the message window ended. This is necessary to place the
caret at the right spot. The caret is always positioned there, even if
it is hidden or non-existing.
- mswin_get_nh_event was changed to actually process and empty the
message queue, and called from mswin_putstr_ex to make sure the
message window is updated before the next step is done. Without this,
the caret is positioned before the last message is painted, which
makes its x-position after the last character of the previous line.
This band adds handling for the "5" key in the numeric keypad. This is
called VK_CLEAR in the VK_ constants. Using this band, and with
NumLock off, doing 5 will send NetHack the letter 'g'. Doing SHIFT-5 will
send 'G'. Without this band and with NumLock off, 5 does nothing. With
NumLock on, 5 sends 5.
This patch disables ALT-H in NetHack mode. Before patch: ALT-H in NetHack
mode brings down the Help menu in the menu bar. After patch: ALT-H does
nothing in NetHack mode. In both cases, in Windows mode, ALT-H brings
down the Help menu in the menu bar. I can easily write a patch to have
ALT-H in NetHack mode act the same as '?'.
Explanation:
return 0: this window proc has processed this event.
return DefWindowProc(): process using default window proc.
ALT-H is the only key for which DefWindowProc() does something special AND
reaches the else.
part 2 touches only port files
Makes Borland happy with current sources.
Fixes bug in WM_PAINT handling in rip/splash code.
Fixes getline() bug (H0009)
Tidies up source.
Fixes up copyright notices.
Adds TODO docs for Borland. (Removes "TODO" note)
Small changes to defaults formatting.
Fixes ALT key on Graphical Port non NetHack mode.
Hilites pet in Graphical Port text mode.
Also Implements windowcolors for status and message window in graphical port.
On graphical port,
tested to see it actually works.
Tested on platforms Makefile MSC/BCC Graphical/Console, MSC IDE for
compile and run and performing hilite pet in graphical text, not
displaying rawio, alt key.
This patch implements Michael's idea to have a "NetHack mode" for
keypresses. It only does the Alt-keys now, but it should be easy
to extend to pressing space in dialogs; I left that out as we still
have to agree on a new dialog look.
The setting that you choose from the menu is stored in the registry.
Reading and writing the registry is done on init_nhwindows and
exit_nhwindows; there also is a menu item to delete the registry
settings (which makes sure they are not stored again this session.)
This provides a framework for future registry settings.
Also,
Alt-tab should show the app title when a menu or text window is up.
I left the app title as it was, although I still favour "Graphical
Version" or "With Graphics"; Anyway, that's only one resource string.
Addresses <Someone>'s point that ALT-F4 in game-over, still brings up the
save/quit/cancel dialog box. This makes ALT-F4 equivalent to quitting
without any further disclosure/windows, but makes sure the game exits
properly so it will save the bones and the record file. I also cleaned
up the mhrip.c to use macros for all magic numbers.
accelerators).
[...]
- added F4/F5 functionality - same as in MSDOS port
F4 toggles between fitting the tiled display to the screen
and full size (compresses the tiles to fit / uncompresses).
F5 alternates between ascii and tiles.
- added support for wc_vary_msgcount
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)
also corrects a cut-and-paste error that I made in options.c
The following options can be set in the game now:
WC_HILITE_PET
WC_ALIGN_MESSAGE
WC_ALIGN_STATUS
WC_SCROLL_MARGIN
WC_MAP_MODE
WC_FONT_MESSAGE
WC_FONT_STATUS
WC_FONT_MENU
WC_FONT_TEXT
WC_FONTSIZ_MESSAGE
WC_FONTSIZ_STATUS
WC_FONTSIZ_MENU
WC_FONTSIZ_TEXT
- added support for new options
- fixed couple of typos in options.c
- added sunken edge around message window
- added capability to replace font in the font table (if we will want to
change font sizes dynamically later)
Add absent prototypes to some core routines.
Also add some port function() to function(void) in some win32 routines.
Also updates the Borland C Makefile for win32.
The following fixes several bugs:
1) Mismatch between docs and game in definition of what '+' resolved in
favor of docs...
2) When game needs to be recovered a message box is shown. This is a very
deprecated fix. It pretty much answers just the conditions that require
this (a yn question to an erroneous winid), and is not useful for other
purposes.
3) The score file is written.
Apparently, " is part of an accented character in US(international) keyboard
layout (additional character specific to the language of an origin - for
example, left and right double quotation marks). The code did not handle it
too well since it maps to 2 ASCII characters instead of one (one of them is
so called "dead" character). We can ignore the dead character as a
workaround for this problem. The patch is attached.
<Someone>.
- B1026 [confirmed] win32: setting multiple options
- bugfix: menu: set focus to the item and make it visible when it is
selected with accelerator key.
- increased menu font size by 1 point
- layout the main window on WM_MOVE message so the menu windows stays with
the main window (it was not changing the location before)
- got rid of WinCE specific define (ARM)
- handle all keyboard input via WM_KEYDOWN instead WM_CHAR
Files affected: config1.h mhmsg.h mhmain.c mhmenu.c mswproc.c resource.h
winhack.rc
Notes:
That overrides Yitzhak's mhmenu patch - I don't like the menu prompt on the
title bar since it can be null and in most cases it is. It looks much better
as a header column in the list and is displayed only if present.
I moved ARM-related (processor) defines to wceconf.h You cannot undef ARM
before windows.h is processed - ARM version won't compile.
.rc files are generated by IDE - you cannot edit them directly or your
changes will be gone next time the file is saved. If anything needs to be
added to winhack.rc file manually it has to be marked by the following
defines or via menu option View->Resource Includes:
#define APSTUDIO_READONLY_SYMBOLS
...
#undef APSTUDIO_READONLY_SYMBOLS
[...]
One of them deals with the patch you just sent, that changes the name but
does so more extensively, particularly, also in the Save dialog in
mhmain.c. Another is one of the changes to winhack.rc to make it compile
under Borland.
This also (beyond patches I sent): fixes no Options prompt bug, and fixes
up the menu bar (which I broke in one of my patches).
Tested on msc/bcc tty/win makefiles and vc ide.
- 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.
Fixes:
- menu shortcuts implemented
- most windows close on space (except for menus with
PICK_ANY style)
- "hilite_pet" option is implemented
- map scrolling is improved somewhat (it now scrolls if
the char is within 5 spaces from the edge of the map -
configurable by #define CLIPAROUND_MARGIN)
- added 3 winhack-specific options:
win32_map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8
|ascii16x8|ascii7x12|ascii8x12|ascii15x12
|ascii12x16|ascii10x18|fit_to_screen]=20
win32_align_status:[left|top|right|bottom]
win32_align_message:[left|top|right|bottom]
Note: aligning status window to left or right edge of the screen does
not look good.