diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 8e6718ec5..2780451d3 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -198,6 +198,8 @@ clairvoyance would show trap instead of a monster on/in that trap, which was intentional, but when clairvoyance finished the monster wasn't shown nurse corpse/tin chance to convey poison resistance when eaten was not honored make tame vampires be more aggressive when shifted to bat/fog/wolf form +a stale gold symbol could be displayed on the status line following a switch + to a new symset, as observed and reported for Windows RogueEpyx symset Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/botl.c b/src/botl.c index 5d1fe2bcb..aa5d64f48 100644 --- a/src/botl.c +++ b/src/botl.c @@ -698,6 +698,7 @@ int fld, idx, idx_p; boolean *valsetlist; { static int oldrndencode = 0; + static nhsym oldgoldsym = 0; int pc, chg, color = NO_COLOR; unsigned anytype; boolean updated = FALSE, reset; @@ -719,10 +720,28 @@ boolean *valsetlist; * so $:0 has already been encoded and cached by the window * port. Without this hack, gold's \G sequence won't be * recognized and ends up being displayed as-is for 'update_all'. + * + * Also, even if context.rndencode hasn't changed and the + * gold amount itself hasn't changed, the glyph portion of the + * encoding may have changed if a new symset was put into + * effect. + * + * \GXXXXNNNN:25 + * XXXX = the context.rndencode portion + * NNNN = the glyph portion + * 25 = the gold amount + * */ - if (context.rndencode != oldrndencode && fld == BL_GOLD) { - chg = 2; - oldrndencode = context.rndencode; + + if (fld == BL_GOLD) { + if (context.rndencode != oldrndencode && fld == BL_GOLD) { + chg = 2; + oldrndencode = context.rndencode; + } + if (oldgoldsym != showsyms[COIN_CLASS + SYM_OFF_O]) { + chg = 2; + oldgoldsym = showsyms[COIN_CLASS + SYM_OFF_O]; + } } reset = FALSE; diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 730232fae..3001afdd8 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -15,7 +15,6 @@ #include "color.h" #include "patchlevel.h" -//#define NHMAP_FONT_NAME TEXT("Terminal") #define NHMAP_FONT_NAME TEXT("Terminal") #define MAXWINDOWTEXT 255 diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index 4007ee177..6573f32da 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -863,9 +863,11 @@ SetMenuListType(HWND hWnd, int how) SendMessage(control, WM_SETFONT, (WPARAM) fnt, (LPARAM) 0); /* add column to the list view */ + MonitorInfo monitorInfo; + win10_monitor_info(hWnd, &monitorInfo); ZeroMemory(&lvcol, sizeof(lvcol)); lvcol.mask = LVCF_WIDTH | LVCF_TEXT; - lvcol.cx = GetSystemMetrics(SM_CXFULLSCREEN); + lvcol.cx = monitorInfo.width; lvcol.pszText = NH_A2W(data->menu.prompt, wbuf, BUFSZ); ListView_InsertColumn(control, 0, &lvcol); diff --git a/win/win32/mhrip.c b/win/win32/mhrip.c index f8da73dae..ed826704b 100644 --- a/win/win32/mhrip.c +++ b/win/win32/mhrip.c @@ -2,6 +2,7 @@ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ +#include "win10.h" #include "winMS.h" #include "resource.h" #include "mhrip.h" @@ -25,6 +26,14 @@ typedef struct mswin_nethack_text_window { HANDLE rip_bmp; TCHAR *window_text; TCHAR *rip_text; + int x; + int y; + int width; + int height; + int graveX; + int graveY; + int graveHeight; + int graveWidth; } NHRIPWindow, *PNHRIPWindow; INT_PTR CALLBACK NHRIPWndProc(HWND, UINT, WPARAM, LPARAM); @@ -62,9 +71,21 @@ mswin_display_RIP_window(HWND hWnd) RECT textrect; HDC hdc; HFONT OldFont; + MonitorInfo monitorInfo; + + win10_monitor_info(hWnd, &monitorInfo); data = (PNHRIPWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); + data->x = (int)(RIP_OFFSET_X * monitorInfo.scale); + data->y = (int)(RIP_OFFSET_Y * monitorInfo.scale); + data->width = (int)(RIP_WIDTH * monitorInfo.scale); + data->height = (int)(RIP_HEIGHT * monitorInfo.scale); + data->graveX = (int)(RIP_GRAVE_X * monitorInfo.scale); + data->graveY = (int)(RIP_GRAVE_Y * monitorInfo.scale); + data->graveWidth = (int)(RIP_GRAVE_WIDTH * monitorInfo.scale); + data->graveHeight = (int)(RIP_GRAVE_HEIGHT * monitorInfo.scale); + GetNHApp()->hPopupWnd = hWnd; mapWnd = mswin_hwnd_from_winid(WIN_MAP); if (!IsWindow(mapWnd)) @@ -73,9 +94,9 @@ mswin_display_RIP_window(HWND hWnd) GetWindowRect(hWnd, &riprt); GetClientRect(hWnd, &clientrect); textrect = clientrect; - textrect.top += RIP_OFFSET_Y; - textrect.left += RIP_OFFSET_X; - textrect.right -= RIP_OFFSET_X; + textrect.top += data->y; + textrect.left += data->x; + textrect.right -= data->x; if (data->window_text) { hdc = GetDC(hWnd); OldFont = SelectObject(hdc, mswin_get_font(NHW_TEXT, 0, hdc, FALSE)); @@ -84,17 +105,17 @@ mswin_display_RIP_window(HWND hWnd) SelectObject(hdc, OldFont); ReleaseDC(hWnd, hdc); } - if (textrect.right - textrect.left > RIP_WIDTH) - clientrect.right = textrect.right + RIP_OFFSET_X - clientrect.right; + if (textrect.right - textrect.left > data->width) + clientrect.right = textrect.right + data->y - clientrect.right; else clientrect.right = - textrect.left + 2 * RIP_OFFSET_X + RIP_WIDTH - clientrect.right; + textrect.left + 2 * data->x + data->width - clientrect.right; clientrect.bottom = - textrect.bottom + RIP_HEIGHT + RIP_OFFSET_Y - clientrect.bottom; + textrect.bottom + data->height + data->y - clientrect.bottom; GetWindowRect(GetDlgItem(hWnd, IDOK), &textrect); textrect.right -= textrect.left; textrect.bottom -= textrect.top; - clientrect.bottom += textrect.bottom + RIP_OFFSET_Y; + clientrect.bottom += textrect.bottom + data->y; riprt.right -= riprt.left; riprt.bottom -= riprt.top; riprt.right += clientrect.right; @@ -106,7 +127,7 @@ mswin_display_RIP_window(HWND hWnd) GetClientRect(hWnd, &clientrect); MoveWindow(GetDlgItem(hWnd, IDOK), (clientrect.right - clientrect.left - textrect.right) / 2, - clientrect.bottom - textrect.bottom - RIP_OFFSET_Y, + clientrect.bottom - textrect.bottom - data->y, textrect.right, textrect.bottom, TRUE); ShowWindow(hWnd, SW_SHOW); @@ -158,9 +179,9 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) SetBkMode(hdc, TRANSPARENT); GetClientRect(hWnd, &clientrect); textrect = clientrect; - textrect.top += RIP_OFFSET_Y; - textrect.left += RIP_OFFSET_X; - textrect.right -= RIP_OFFSET_X; + textrect.top += data->y; + textrect.left += data->x; + textrect.right -= data->x; if (data->window_text) { DrawText(hdc, data->window_text, strlen(data->window_text), &textrect, DT_LEFT | DT_NOPREFIX | DT_CALCRECT); @@ -169,15 +190,16 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } OldBitmap = SelectObject(hdcBitmap, GetNHApp()->bmpRip); SetBkMode(hdc, OPAQUE); - bitmap_offset = (textrect.right - textrect.left - RIP_WIDTH) / 2; - BitBlt(hdc, textrect.left + bitmap_offset, textrect.bottom, RIP_WIDTH, - RIP_HEIGHT, hdcBitmap, 0, 0, SRCCOPY); + bitmap_offset = (textrect.right - textrect.left - data->width) / 2; + StretchBlt(hdc, textrect.left + bitmap_offset, textrect.bottom, + data->width, data->height, + hdcBitmap, 0, 0, RIP_WIDTH, RIP_HEIGHT, SRCCOPY); SetBkMode(hdc, TRANSPARENT); if (data->rip_text) { - textrect.left += RIP_GRAVE_X + bitmap_offset; - textrect.top = textrect.bottom + RIP_GRAVE_Y; - textrect.right = textrect.left + RIP_GRAVE_WIDTH; - textrect.bottom = textrect.top + RIP_GRAVE_HEIGHT; + textrect.left += data->graveX + bitmap_offset; + textrect.top = textrect.bottom + data->graveY; + textrect.right = textrect.left + data->graveWidth; + textrect.bottom = textrect.top + data->graveHeight; DrawText(hdc, data->rip_text, strlen(data->rip_text), &textrect, DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_WORDBREAK); }