Fixes (from <Someone>)
- visual feedback after a prompt: append an empty line to the message window when clear_nhwindow(WIN_MESSAGE) is called. Filter out empty lines in the buffer except for the active slot. - append ellipses to the status line text if the text is truncated - get rid of message boxes at the end of the game (ignore empty lines in raw_print as Yitzhak suggested)
This commit is contained in:
@@ -196,11 +196,19 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr)lParam;
|
||||
SCROLLINFO si;
|
||||
char* p;
|
||||
|
||||
/* append text to the end of the array */
|
||||
memmove(&data->window_text[0],
|
||||
&data->window_text[1],
|
||||
(MSG_LINES-1)*sizeof(data->window_text[0]));
|
||||
/* check if the string is empty */
|
||||
for(p = data->window_text[MSG_LINES-1].text; *p && isspace(*p); p++);
|
||||
|
||||
if( *p ) {
|
||||
/* last string is not empty - scroll up */
|
||||
memmove(&data->window_text[0],
|
||||
&data->window_text[1],
|
||||
(MSG_LINES-1)*sizeof(data->window_text[0]));
|
||||
}
|
||||
|
||||
/* append new text to the end of the array */
|
||||
data->window_text[MSG_LINES-1].attr = msg_data->attr;
|
||||
strncpy(data->window_text[MSG_LINES-1].text, msg_data->text, MAXWINDOWTEXT);
|
||||
|
||||
@@ -220,6 +228,13 @@ void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case MSNH_MSG_CLEAR_WINDOW:
|
||||
{
|
||||
MSNHMsgPutstr data;
|
||||
|
||||
/* append an empty line to the message window (send message to itself) */
|
||||
data.attr = ATR_NONE;
|
||||
data.text = " ";
|
||||
onMSNHCommand(hWnd, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data);
|
||||
|
||||
InvalidateRect(hWnd, NULL, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
||||
int i;
|
||||
SIZE sz;
|
||||
HGDIOBJ oldFont;
|
||||
TCHAR wbuf[255];
|
||||
TCHAR wbuf[BUFSZ];
|
||||
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
GetClientRect(hWnd, &rt);
|
||||
@@ -115,8 +115,8 @@ LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
||||
|
||||
for(i=0; i<NHSW_LINES; i++ ) {
|
||||
GetTextExtentPoint32(hdc, NH_A2W(data->window_text[i], wbuf, sizeof(wbuf)), strlen(data->window_text[i]), &sz);
|
||||
OemToChar(data->window_text[i], wbuf);
|
||||
DrawText(hdc, wbuf, strlen(data->window_text[i]), &rt, DT_LEFT);
|
||||
NH_A2W(data->window_text[i], wbuf, BUFSZ);
|
||||
DrawText(hdc, wbuf, strlen(data->window_text[i]), &rt, DT_LEFT | DT_END_ELLIPSIS);
|
||||
rt.top += sz.cy;
|
||||
}
|
||||
|
||||
|
||||
@@ -734,7 +734,8 @@ void mswin_raw_print(const char *str)
|
||||
{
|
||||
TCHAR wbuf[255];
|
||||
logDebug("mswin_raw_print(%s)\n", str);
|
||||
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
|
||||
if( str && *str )
|
||||
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -746,7 +747,8 @@ void mswin_raw_print_bold(const char *str)
|
||||
{
|
||||
TCHAR wbuf[255];
|
||||
logDebug("mswin_raw_print_bold(%s)\n", str);
|
||||
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
|
||||
if( str && *str )
|
||||
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user