SVN r446 (trunk)

This commit is contained in:
Randy Heit 2007-01-09 04:40:58 +00:00
parent dbb9baf909
commit 82ba0fb189
11 changed files with 298 additions and 107 deletions

View file

@ -1,3 +1,17 @@
January 8, 2007
- Added escape code support to the echo CCMD, so you can use colors with it.
- Changed the color scheme for the startup log to light text on a dark
background and added color support to it.
- When a fatal error occurs, the log window is now scrolled so the final
lines are guaranteed to be visible.
- Fixed: ShowErrorPane() crashed if it was called before the main window was
created.
- Removed the game title banner for the ENDOOM display and replaced it with a
short prompt at the bottom of the window.
- Halved the number of times the Strife startup screen updates the progress
bar so that it spends less time drawing and gets done loading faster.
- Fixed: The quad FBD3D draws to the screen was one pixel too tall.
January 7, 2007 (Changes by Graf Zahl) January 7, 2007 (Changes by Graf Zahl)
- Fixed: Sorting of files in Zips was broken. - Fixed: Sorting of files in Zips was broken.
- Ported GZDoom's deep water splash code so that splashes are handled properly - Ported GZDoom's deep water splash code so that splashes are handled properly

View file

@ -1805,6 +1805,7 @@ CCMD (echo)
int last = argv.argc()-1; int last = argv.argc()-1;
for (int i = 1; i <= last; ++i) for (int i = 1; i <= last; ++i)
{ {
strbin (argv[i]);
Printf ("%s%s", argv[i], i!=last ? " " : "\n"); Printf ("%s%s", argv[i], i!=last ? " " : "\n");
} }
} }

View file

@ -55,6 +55,8 @@
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
#define DEFAULT_LOG_COLOR PalEntry(223,223,223)
// TYPES ------------------------------------------------------------------- // TYPES -------------------------------------------------------------------
// This structure is used by BuildTranslations() to hold color information. // This structure is used by BuildTranslations() to hold color information.
@ -121,6 +123,7 @@ struct TempColorInfo
{ {
FName Name; FName Name;
unsigned int ParmInfo; unsigned int ParmInfo;
PalEntry LogColor;
}; };
// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
@ -162,6 +165,7 @@ static const BYTE myislower[256] =
static TArray<TranslationParm> TranslationParms[2]; static TArray<TranslationParm> TranslationParms[2];
static TArray<TranslationMap> TranslationLookup; static TArray<TranslationMap> TranslationLookup;
static TArray<PalEntry> TranslationColors;
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
@ -1598,6 +1602,7 @@ void V_InitFontColors ()
int c, parmchoice; int c, parmchoice;
TempParmInfo info; TempParmInfo info;
TempColorInfo cinfo; TempColorInfo cinfo;
PalEntry logcolor;
unsigned int i, j; unsigned int i, j;
int k, index; int k, index;
@ -1610,6 +1615,8 @@ void V_InitFontColors ()
{ {
names.Clear(); names.Clear();
logcolor = DEFAULT_LOG_COLOR;
// Everything until the '{' is considered a valid name for the // Everything until the '{' is considered a valid name for the
// color range. // color range.
names.Push (sc_String); names.Push (sc_String);
@ -1641,6 +1648,11 @@ void V_InitFontColors ()
info.ParmLen[0] = info.StartParm[1] - info.StartParm[0]; info.ParmLen[0] = info.StartParm[1] - info.StartParm[0];
tparm.RangeEnd = tparm.RangeStart = -1; tparm.RangeEnd = tparm.RangeStart = -1;
} }
else if (SC_Compare ("Flat:"))
{
SC_MustGetString();
logcolor = V_GetColor (NULL, sc_String);
}
else else
{ {
// Get first color // Get first color
@ -1731,12 +1743,14 @@ void V_InitFontColors ()
if (colorinfo[j].Name == names[i]) if (colorinfo[j].Name == names[i])
{ {
colorinfo[j].ParmInfo = cinfo.ParmInfo; colorinfo[j].ParmInfo = cinfo.ParmInfo;
colorinfo[j].LogColor = logcolor;
break; break;
} }
} }
if (j == colorinfo.Size()) if (j == colorinfo.Size())
{ {
cinfo.Name = names[i]; cinfo.Name = names[i];
cinfo.LogColor = logcolor;
colorinfo.Push (cinfo); colorinfo.Push (cinfo);
} }
} }
@ -1761,6 +1775,7 @@ void V_InitFontColors ()
TranslationParms[k].Push (parms[pinfo->StartParm[k] + j]); TranslationParms[k].Push (parms[pinfo->StartParm[k] + j]);
} }
} }
TranslationColors.Push (colorinfo[i].LogColor);
pinfo->Index = index++; pinfo->Index = index++;
} }
tmap.Number = pinfo->Index; tmap.Number = pinfo->Index;
@ -1820,6 +1835,77 @@ EColorRange V_FindFontColor (FName name)
return CR_UNTRANSLATED; return CR_UNTRANSLATED;
} }
//==========================================================================
//
// V_LogColorFromColorRange
//
// Returns the color to use for text in the startup/error log window.
//
//==========================================================================
PalEntry V_LogColorFromColorRange (EColorRange range)
{
if (range < 0 || range >= TranslationColors.Size())
{ // Return default color
return DEFAULT_LOG_COLOR;
}
return TranslationColors[range];
}
//==========================================================================
//
// V_ParseFontColor
//
// Given a pointer to a color identifier (presumably just after a color
// escape character), return the color it identifies and advances
// color_value to just past it.
//
//==========================================================================
EColorRange V_ParseFontColor (const BYTE *&color_value, int normalcolor, int boldcolor)
{
const BYTE *ch = color_value;
int newcolor = *ch++;
if (newcolor == '-') // Normal
{
newcolor = normalcolor;
}
else if (newcolor == '+') // Bold
{
newcolor = boldcolor;
}
else if (newcolor == '[') // Named
{
const BYTE *namestart = ch;
while (*ch != ']' && *ch != '\0')
{
ch++;
}
FName rangename((const char *)namestart, int(ch - namestart), true);
if (*ch != '\0')
{
ch++;
}
newcolor = V_FindFontColor (rangename);
}
else if (newcolor >= 'A' && newcolor < NUM_TEXT_COLORS + 'A') // Standard, uppercase
{
newcolor -= 'A';
}
else if (newcolor >= 'a' && newcolor < NUM_TEXT_COLORS + 'a') // Standard, lowercase
{
newcolor -= 'a';
}
else // Incomplete!
{
color_value = ch - (*ch == '\0');
return CR_UNDEFINED;
}
color_value = ch;
return EColorRange(newcolor);
}
//========================================================================== //==========================================================================
// //
// V_InitFonts // V_InitFonts

View file

@ -152,6 +152,8 @@ extern FFont *SmallFont, *SmallFont2, *BigFont, *ConFont;
void V_InitFonts(); void V_InitFonts();
EColorRange V_FindFontColor (FName name); EColorRange V_FindFontColor (FName name);
FFont * V_GetFont(const char *); PalEntry V_LogColorFromColorRange (EColorRange range);
EColorRange V_ParseFontColor (const BYTE *&color_value, int normalcolor, int boldcolor);
FFont *V_GetFont(const char *);
#endif //__V_FONT_H__ #endif //__V_FONT_H__

View file

@ -200,47 +200,11 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st
if (c == TEXTCOLOR_ESCAPE) if (c == TEXTCOLOR_ESCAPE)
{ {
int newcolor = *ch++; EColorRange newcolor = V_ParseFontColor (ch, normalcolor, boldcolor);
if (newcolor != CR_UNDEFINED)
if (newcolor == '\0')
{ {
return; range = Font->GetColorTranslation (newcolor);
} }
else if (newcolor == '-') // Normal
{
newcolor = normalcolor;
}
else if (newcolor == '+') // Bold
{
newcolor = boldcolor;
}
else if (newcolor == '[') // Named
{
const BYTE *namestart = ch;
while (*ch != ']' && *ch != '\0')
{
ch++;
}
FName rangename((const char *)namestart, int(ch - namestart), true);
if (*ch != '\0')
{
ch++;
}
newcolor = V_FindFontColor (rangename);
}
else if (newcolor >= 'A' && newcolor < NUM_TEXT_COLORS + 'A') // Standard, uppercase
{
newcolor -= 'A';
}
else if (newcolor >= 'a' && newcolor < NUM_TEXT_COLORS + 'a') // Standard, lowercase
{
newcolor -= 'a';
}
else // Incomplete!
{
continue;
}
range = Font->GetColorTranslation ((EColorRange)newcolor);
continue; continue;
} }

View file

@ -387,7 +387,7 @@ bool D3DFB::Reset ()
// //
// DoOffByOneCheck // DoOffByOneCheck
// //
// Since NVidia hardware has an off-by-one error in the pixel shader. // NVidia hardware has an off-by-one error in the pixel shader.
// On a Geforce 7950GT and a 6200, I have witnessed it skip palette entry // On a Geforce 7950GT and a 6200, I have witnessed it skip palette entry
// 240. I have a report that an FX card skips in a totally different spot. // 240. I have a report that an FX card skips in a totally different spot.
// So rather than try and correct it in the shader, we detect it here and // So rather than try and correct it in the shader, we detect it here and
@ -622,7 +622,7 @@ bool D3DFB::CreateVertexes ()
{ {
float top = (TrueHeight - Height) * 0.5f - 0.5f; float top = (TrueHeight - Height) * 0.5f - 0.5f;
float right = float(Width) - 0.5f; float right = float(Width) - 0.5f;
float bot = float(Height) + top + 1.f; float bot = float(Height) + top;
float texright = float(Width) / float(FBWidth); float texright = float(Width) / float(FBWidth);
float texbot = float(Height) / float(FBHeight); float texbot = float(Height) / float(FBHeight);
FBVERTEX verts[4] = FBVERTEX verts[4] =

View file

@ -3013,10 +3013,9 @@ static void SaveReport (HANDLE file)
void DisplayCrashLog () void DisplayCrashLog ()
{ {
HINSTANCE riched;
HANDLE file; HANDLE file;
if (NumFiles == 0 || (riched = LoadLibrary ("riched20.dll")) == NULL) if (NumFiles == 0)
{ {
char ohPoo[] = char ohPoo[] =
GAMENAME" crashed but was unable to produce\n" GAMENAME" crashed but was unable to produce\n"
@ -3051,7 +3050,6 @@ void DisplayCrashLog ()
SaveReport (file); SaveReport (file);
CloseHandle (file); CloseHandle (file);
} }
FreeLibrary (riched);
if (uxtheme != NULL) if (uxtheme != NULL)
{ {
FreeLibrary (uxtheme); FreeLibrary (uxtheme);

View file

@ -40,6 +40,7 @@
#include <mmsystem.h> #include <mmsystem.h>
#include <objbase.h> #include <objbase.h>
#include <commctrl.h> #include <commctrl.h>
#include <richedit.h>
//#include <wtsapi32.h> //#include <wtsapi32.h>
#define NOTIFY_FOR_THIS_SESSION 0 #define NOTIFY_FOR_THIS_SESSION 0
@ -126,6 +127,7 @@ HWND ErrorPane, ProgressBar, NetStartPane, StartupScreen;
HFONT GameTitleFont; HFONT GameTitleFont;
LONG GameTitleFontHeight; LONG GameTitleFontHeight;
LONG DefaultGUIFontHeight;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -372,7 +374,7 @@ void LayoutMainWindow (HWND hWnd, HWND pane)
errorpaneheight = LayoutErrorPane (pane, w); errorpaneheight = LayoutErrorPane (pane, w);
SetWindowPos (pane, HWND_TOP, 0, 0, w, errorpaneheight, 0); SetWindowPos (pane, HWND_TOP, 0, 0, w, errorpaneheight, 0);
} }
if (DoomStartupInfo != NULL) if (DoomStartupInfo != NULL && GameTitleWindow != NULL)
{ {
bannerheight = GameTitleFontHeight + 5; bannerheight = GameTitleFontHeight + 5;
MoveWindow (GameTitleWindow, 0, errorpaneheight, w, bannerheight, TRUE); MoveWindow (GameTitleWindow, 0, errorpaneheight, w, bannerheight, TRUE);
@ -430,8 +432,8 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
LOGFONT lf; LOGFONT lf;
TEXTMETRIC tm; TEXTMETRIC tm;
HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
HFONT font;
DRAWITEMSTRUCT *drawitem; DRAWITEMSTRUCT *drawitem;
CHARFORMAT2 format;
switch (msg) switch (msg)
{ {
@ -446,28 +448,50 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
strcpy (lf.lfFaceName, "Trebuchet MS"); strcpy (lf.lfFaceName, "Trebuchet MS");
GameTitleFont = CreateFontIndirect (&lf); GameTitleFont = CreateFontIndirect (&lf);
font = GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT); oldfont = SelectObject (hdc, GetStockObject (DEFAULT_GUI_FONT));
oldfont = SelectObject (hdc, font); GetTextMetrics (hdc, &tm);
DefaultGUIFontHeight = tm.tmHeight;
if (GameTitleFont == NULL)
{
GameTitleFontHeight = DefaultGUIFontHeight;
}
else
{
SelectObject (hdc, GameTitleFont);
GetTextMetrics (hdc, &tm); GetTextMetrics (hdc, &tm);
SelectObject (hdc, oldfont);
ReleaseDC (hWnd, hdc);
GameTitleFontHeight = tm.tmHeight; GameTitleFontHeight = tm.tmHeight;
}
SelectObject (hdc, oldfont);
// Create log read-only edit control // Create log read-only edit control
view = CreateWindowEx (WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE, "EDIT", NULL, view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, RICHEDIT_CLASS, NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CHILD | WS_VISIBLE | WS_VSCROLL |
ES_LEFT | ES_MULTILINE | WS_CLIPSIBLINGS, ES_LEFT | ES_MULTILINE | WS_CLIPSIBLINGS,
0, 0, 0, 0, 0, 0, 0, 0,
hWnd, NULL, inst, NULL); hWnd, NULL, inst, NULL);
HRESULT hr;
hr = GetLastError();
if (view == NULL) if (view == NULL)
{ {
ReleaseDC (hWnd, hdc);
return -1; return -1;
} }
SendMessage (view, WM_SETFONT, (WPARAM)GetStockObject (DEFAULT_GUI_FONT), FALSE);
SendMessage (view, EM_SETREADONLY, TRUE, 0); SendMessage (view, EM_SETREADONLY, TRUE, 0);
SendMessage (view, EM_SETLIMITTEXT, 0, 0); SendMessage (view, EM_EXLIMITTEXT, 0, 0x7FFFFFFE);
SendMessage (view, EM_SETBKGNDCOLOR, 0, RGB(70,70,70));
// Setup default font for the log.
//SendMessage (view, WM_SETFONT, (WPARAM)GetStockObject (DEFAULT_GUI_FONT), FALSE);
format.cbSize = sizeof(format);
format.dwMask = CFM_BOLD | CFM_COLOR | CFM_FACE | CFM_SIZE;
format.dwEffects = 0;
format.yHeight = 200;
format.crTextColor = RGB(223,223,223);
format.bPitchAndFamily = FF_SWISS | VARIABLE_PITCH;
strcpy (format.szFaceName, "Bitstream Vera Sans"); // At least I have it. :p
SendMessage (view, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format);
ConWindow = view; ConWindow = view;
ReleaseDC (hWnd, hdc);
view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW, 0, 0, 0, 0, hWnd, NULL, inst, NULL); view = CreateWindowEx (WS_EX_NOPARENTNOTIFY, "STATIC", NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_OWNERDRAW, 0, 0, 0, 0, hWnd, NULL, inst, NULL);
if (view == NULL) if (view == NULL)
@ -528,6 +552,19 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
StretchDIBits (drawitem->hDC, rect.left, rect.bottom - 1, rect.right - rect.left, rect.top - rect.bottom, StretchDIBits (drawitem->hDC, rect.left, rect.bottom - 1, rect.right - rect.left, rect.top - rect.bottom,
0, 0, StartupBitmap->bmiHeader.biWidth, StartupBitmap->bmiHeader.biHeight, 0, 0, StartupBitmap->bmiHeader.biWidth, StartupBitmap->bmiHeader.biHeight,
ST_Util_BitsForBitmap(StartupBitmap), StartupBitmap, DIB_RGB_COLORS, SRCCOPY); ST_Util_BitsForBitmap(StartupBitmap), StartupBitmap, DIB_RGB_COLORS, SRCCOPY);
// If the title banner is gone, then this is an ENDOOM screen, so draw a short prompt
// where the command prompt would have been in DOS.
if (GameTitleWindow == NULL)
{
static const char QuitText[] = "Press any key or click anywhere in the window to quit.";
SetTextColor (drawitem->hDC, RGB(240,240,240));
SetBkMode (drawitem->hDC, TRANSPARENT);
oldfont = SelectObject (drawitem->hDC, (HFONT)GetStockObject (DEFAULT_GUI_FONT));
TextOut (drawitem->hDC, 3, drawitem->rcItem.bottom - DefaultGUIFontHeight - 3, QuitText, countof(QuitText)-1);
SelectObject (drawitem->hDC, oldfont);
}
} }
} }
return FALSE; return FALSE;
@ -536,9 +573,6 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
PostQuitMessage (0); PostQuitMessage (0);
break; break;
case WM_CTLCOLORSTATIC:
return (LRESULT)GetStockObject (WHITE_BRUSH);
case WM_DESTROY: case WM_DESTROY:
if (GameTitleFont != NULL) if (GameTitleFont != NULL)
{ {
@ -660,10 +694,21 @@ void RestoreConView()
void ShowErrorPane(const char *text) void ShowErrorPane(const char *text)
{ {
// Ensure that the network pane is hidden. if (Window != NULL)
ST_NetDone(); {
ST_NetDone(); // Ensure that the network pane is hidden.
ErrorPane = CreateDialogParam (g_hInst, MAKEINTRESOURCE(IDD_ERRORPANE), Window, ErrorPaneProc, (LPARAM)text); ErrorPane = CreateDialogParam (g_hInst, MAKEINTRESOURCE(IDD_ERRORPANE), Window, ErrorPaneProc, (LPARAM)text);
}
POINT zero = { 0, 0 };
SetWindowText (Window, "Fatal Error - " WINDOW_TITLE);
// Make sure the last line of the log window is visible.
SendMessage (ConWindow, EM_LINESCROLL, 0, SendMessage (ConWindow, EM_GETLINECOUNT, 0, 0));
// The above line scrolled everything off the screen. Pretend to move the scroll
// bar thumb, which clamps to not show any extra lines if it doesn't need to.
SendMessage (ConWindow, EM_SCROLL, SB_PAGEDOWN, 0);
if (ErrorPane == NULL) if (ErrorPane == NULL)
{ {
@ -675,8 +720,6 @@ void ShowErrorPane(const char *text)
BOOL bRet; BOOL bRet;
MSG msg; MSG msg;
SetWindowText (Window, "Fatal Error - " WINDOW_TITLE);
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
{ {
if (bRet == -1) if (bRet == -1)
@ -944,8 +987,6 @@ void DoomSpecificInfo (char *buffer)
*buffer++ = '\0'; *buffer++ = '\0';
} }
extern FILE *Logfile;
// Here is how the error logging system works. // Here is how the error logging system works.
// //
// To catch exceptions that occur in secondary threads, CatchAllExceptions is // To catch exceptions that occur in secondary threads, CatchAllExceptions is
@ -1078,7 +1119,17 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
{ {
g_hInst = hInstance; g_hInst = hInstance;
InitCommonControls (); // Be pretty under XP InitCommonControls (); // Load some needed controls and be pretty under XP
if (NULL == LoadLibrary ("riched20.dll"))
{
// Technically, it isn't really Internet Explorer that is needed, but this
// is an example of a specific program that will provide riched20.dll.
// But considering how extra stuff needs to be installed to make Windows 95
// useable with pretty much any recent software, the chances are high that
// the user already has riched20.dll installed.
I_FatalError ("Sorry, you need to install Internet Explorer 3 or higher to play ZDoom on Windows 95.");
}
#if !defined(__GNUC__) && defined(_DEBUG) #if !defined(__GNUC__) && defined(_DEBUG)
if (__argc == 2 && strcmp (__argv[1], "TestCrash") == 0) if (__argc == 2 && strcmp (__argv[1], "TestCrash") == 0)

View file

@ -35,6 +35,7 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <richedit.h>
#define USE_WINDOWS_DWORD #define USE_WINDOWS_DWORD
#include "hardware.h" #include "hardware.h"
@ -60,6 +61,7 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "templates.h" #include "templates.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "v_font.h"
#include "stats.h" #include "stats.h"
@ -573,61 +575,79 @@ void I_PrintStr (const char *cp)
HWND edit = ConWindow; HWND edit = ConWindow;
char buf[256]; char buf[256];
int bpos = 0; int bpos = 0;
INTBOOL visible = GetWindowLongPtr (ConWindow, GWL_STYLE) & WS_VISIBLE; CHARRANGE selection;
CHARRANGE endselection;
LONG lines_before, lines_after;
CHARFORMAT format;
int maxsel, selstart, selend, numlines1, numlines2; // Store the current selection and set it to the end so we can append text.
SendMessage (edit, EM_EXGETSEL, 0, (LPARAM)&selection);
endselection.cpMax = endselection.cpMin = GetWindowTextLength (edit);
SendMessage (edit, EM_EXSETSEL, 0, (LPARAM)&endselection);
if (visible) // GetWindowTextLength and EM_EXSETSEL can disagree on where the end of
{ // the text is. Find out what EM_EXSETSEL thought it was and use that later.
SendMessage (edit, WM_SETREDRAW, FALSE, 0); SendMessage (edit, EM_EXGETSEL, 0, (LPARAM)&endselection);
}
numlines1 = SendMessage (edit, EM_GETLINECOUNT, 0, 0); // Remember how many lines there were before we added text.
maxsel = SendMessage (edit, WM_GETTEXTLENGTH, 0, 0); lines_before = SendMessage (edit, EM_GETLINECOUNT, 0, 0);
SendMessage (edit, EM_GETSEL, (WPARAM)&selstart, (LPARAM)&selend);
SendMessage (edit, EM_SETSEL, maxsel, maxsel);
while (*cp != 0) while (*cp != 0)
{ {
if (*cp == 28) // 28 is the escape code for a color change.
{ // Skip color changes if ((*cp == 28 && bpos != 0) || bpos == 255)
if (*++cp != 0)
cp++;
continue;
}
if (bpos < 253)
{
// Stupid edit controls need CR-LF pairs
if (*cp == '\n')
{
buf[bpos++] = '\r';
}
}
else
{ {
buf[bpos] = 0; buf[bpos] = 0;
SendMessage (edit, EM_REPLACESEL, FALSE, (LPARAM)buf); SendMessage (edit, EM_REPLACESEL, FALSE, (LPARAM)buf);
newLine = buf[bpos-1] == '\n'; newLine = buf[bpos-1] == '\n';
bpos = 0; bpos = 0;
} }
if (*cp != 28)
{
buf[bpos++] = *cp++; buf[bpos++] = *cp++;
} }
else
{
const BYTE *color_id = (const BYTE *)cp + 1;
EColorRange range = V_ParseFontColor (color_id, CR_UNTRANSLATED, CR_YELLOW);
cp = (const char *)color_id;
if (range != CR_UNDEFINED)
{
// Change the color of future text added to the control.
PalEntry color = V_LogColorFromColorRange (range);
// GDI uses BGR colors, but color is RGB, so swap the R and the B.
swap (color.r, color.b);
// Change the color.
format.cbSize = sizeof(format);
format.dwMask = CFM_COLOR;
format.crTextColor = color;
SendMessage (edit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&format);
}
}
}
if (bpos != 0) if (bpos != 0)
{ {
buf[bpos] = 0; buf[bpos] = 0;
SendMessage (edit, EM_REPLACESEL, FALSE, (LPARAM)buf); SendMessage (edit, EM_REPLACESEL, FALSE, (LPARAM)buf);
newLine = buf[bpos-1] == '\n'; newLine = buf[bpos-1] == '\n';
} }
SendMessage (edit, EM_SETSEL, selstart, selend);
numlines2 = SendMessage (edit, EM_GETLINECOUNT, 0, 0); // If the old selection was at the end of the text, keep it at the end and
if (numlines2 > numlines1) // scroll. Don't scroll if the selection is anywhere else.
if (selection.cpMin == endselection.cpMin && selection.cpMax == endselection.cpMax)
{ {
SendMessage (edit, EM_LINESCROLL, 0, numlines2 - numlines1); selection.cpMax = selection.cpMin = GetWindowTextLength (edit);
lines_after = SendMessage (edit, EM_GETLINECOUNT, 0, 0);
if (lines_after > lines_before)
{
SendMessage (edit, EM_LINESCROLL, 0, lines_after - lines_before);
} }
if (visible) }
{ // Restore the previous selection.
SendMessage (edit, WM_SETREDRAW, TRUE, 0); SendMessage (edit, EM_EXSETSEL, 0, (LPARAM)&selection);
// Give the edit control a chance to redraw itself.
I_GetEvent (); I_GetEvent ();
}
} }
EXTERN_CVAR (Bool, queryiwad); EXTERN_CVAR (Bool, queryiwad);

View file

@ -109,6 +109,7 @@
// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
void RestoreConView(); void RestoreConView();
void LayoutMainWindow (HWND hWnd, HWND pane);
bool ST_Util_CreateStartupWindow (); bool ST_Util_CreateStartupWindow ();
void ST_Util_SizeWindowForBitmap (int scale); void ST_Util_SizeWindowForBitmap (int scale);
@ -157,7 +158,6 @@ static void ST_Strife_DrawStuff (int old_laser, int new_laser);
extern HINSTANCE g_hInst; extern HINSTANCE g_hInst;
extern HWND Window, ConWindow, ProgressBar, NetStartPane, StartupScreen, GameTitleWindow; extern HWND Window, ConWindow, ProgressBar, NetStartPane, StartupScreen, GameTitleWindow;
extern void LayoutMainWindow (HWND hWnd, HWND pane);
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -915,7 +915,7 @@ static void ST_Strife_Progress()
{ {
CurPos++; CurPos++;
notch_pos = (CurPos * (ST_LASERSPACE_WIDTH - ST_LASER_WIDTH)) / MaxPos; notch_pos = (CurPos * (ST_LASERSPACE_WIDTH - ST_LASER_WIDTH)) / MaxPos;
if (notch_pos != NotchPos) if (notch_pos != NotchPos && !(notch_pos & 1))
{ // Time to update. { // Time to update.
ST_Strife_DrawStuff (NotchPos, notch_pos); ST_Strife_DrawStuff (NotchPos, notch_pos);
NotchPos = notch_pos; NotchPos = notch_pos;
@ -946,7 +946,7 @@ static void ST_Strife_DrawStuff (int old_laser, int new_laser)
ST_LASERSPACE_X + new_laser, ST_LASERSPACE_Y, ST_LASER_WIDTH, ST_LASER_HEIGHT); ST_LASERSPACE_X + new_laser, ST_LASERSPACE_Y, ST_LASER_WIDTH, ST_LASER_HEIGHT);
// The bot jumps up and down like crazy. // The bot jumps up and down like crazy.
y = MAX(0, new_laser % 5 - 2); y = MAX(0, (new_laser >> 1) % 5 - 2);
if (y > 0) if (y > 0)
{ {
ST_Util_ClearBlock (StartupBitmap, 0xF0, ST_BOT_X, ST_BOT_Y, ST_BOT_WIDTH, y); ST_Util_ClearBlock (StartupBitmap, 0xF0, ST_BOT_X, ST_BOT_Y, ST_BOT_WIDTH, y);
@ -959,7 +959,7 @@ static void ST_Strife_DrawStuff (int old_laser, int new_laser)
// The peasant desperately runs in place, trying to get away from the laser. // The peasant desperately runs in place, trying to get away from the laser.
// Yet, despite all his limb flailing, he never manages to get anywhere. // Yet, despite all his limb flailing, he never manages to get anywhere.
ST_Util_DrawBlock (StartupBitmap, StrifeStartupPics[PEASANT_INDEX + (new_laser & 3)], ST_Util_DrawBlock (StartupBitmap, StrifeStartupPics[PEASANT_INDEX + ((new_laser >> 1) & 3)],
ST_PEASANT_X, ST_PEASANT_Y, ST_PEASANT_WIDTH, ST_PEASANT_HEIGHT); ST_PEASANT_X, ST_PEASANT_Y, ST_PEASANT_WIDTH, ST_PEASANT_HEIGHT);
} }
@ -970,6 +970,7 @@ static void ST_Strife_DrawStuff (int old_laser, int new_laser)
// Shows an ENDOOM text screen // Shows an ENDOOM text screen
// //
//========================================================================== //==========================================================================
void ST_Endoom() void ST_Endoom()
{ {
if (showendoom == 0) exit(0); if (showendoom == 0) exit(0);
@ -1018,6 +1019,13 @@ void ST_Endoom()
ST_Util_DrawTextScreen (StartupBitmap, endoom_screen, font); ST_Util_DrawTextScreen (StartupBitmap, endoom_screen, font);
ST_Util_FreeFont (font); ST_Util_FreeFont (font);
// Make the title banner go away.
if (GameTitleWindow != NULL)
{
DestroyWindow (GameTitleWindow);
GameTitleWindow = NULL;
}
ST_Util_SizeWindowForBitmap (1); ST_Util_SizeWindowForBitmap (1);
LayoutMainWindow (Window, NULL); LayoutMainWindow (Window, NULL);
InvalidateRect (StartupScreen, NULL, TRUE); InvalidateRect (StartupScreen, NULL, TRUE);
@ -1076,7 +1084,14 @@ void ST_Util_SizeWindowForBitmap (int scale)
int w, h, cx, cy, x, y; int w, h, cx, cy, x, y;
RECT rect; RECT rect;
if (GameTitleWindow != NULL)
{
GetClientRect (GameTitleWindow, &rect); GetClientRect (GameTitleWindow, &rect);
}
else
{
rect.bottom = 0;
}
w = StartupBitmap->bmiHeader.biWidth * scale + GetSystemMetrics (SM_CXSIZEFRAME)*2; w = StartupBitmap->bmiHeader.biWidth * scale + GetSystemMetrics (SM_CXSIZEFRAME)*2;
h = StartupBitmap->bmiHeader.biHeight * scale + rect.bottom h = StartupBitmap->bmiHeader.biHeight * scale + rect.bottom
+ GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYCAPTION); + GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYCAPTION);

View file

@ -4,6 +4,8 @@ Brick
Console: Console:
#470000 #A35C5C 0 127 #470000 #A35C5C 0 127
#800000 #FFFEFE 128 256 #800000 #FFFEFE 128 256
Flat:
#CC3333
} }
Tan Tan
@ -12,6 +14,8 @@ Tan
Console: Console:
#332B13 #998B79 0 127 #332B13 #998B79 0 127
#998B79 #FFFFFF 128 256 #998B79 #FFFFFF 128 256
Flat:
#D2B48C
} }
Gray Grey Gray Grey
@ -20,6 +24,8 @@ Gray Grey
Console: Console:
#272727 #8B8B8B 0 127 #272727 #8B8B8B 0 127
#505050 #FFFFFF 128 256 #505050 #FFFFFF 128 256
Flat:
#CCCCCC
} }
Green Green
@ -28,6 +34,8 @@ Green
Console: Console:
#000000 #007F00 0 127 #000000 #007F00 0 127
#00FF00 #FEFFFE 128 256 #00FF00 #FEFFFE 128 256
Flat:
#00CC00
} }
Brown Brown
@ -36,6 +44,8 @@ Brown
Console: Console:
#000000 #7F4000 0 127 #000000 #7F4000 0 127
#432F1F #FFE7CF 128 256 #432F1F #FFE7CF 128 256
Flat:
#996633
} }
Gold Gold
@ -44,6 +54,8 @@ Gold
Console: Console:
#000000 #7FC040 0 127 #000000 #7FC040 0 127
#DFBF00 #DFFFFE 128 256 #DFBF00 #DFFFFE 128 256
Flat:
#FFCC00
} }
Red Red
@ -52,6 +64,8 @@ Red
Console: Console:
#000000 #7F0000 0 127 #000000 #7F0000 0 127
#FF0000 #FFFEFE 128 256 #FF0000 #FFFEFE 128 256
Flat:
#DD0000
} }
Blue Blue
@ -60,6 +74,8 @@ Blue
Console: Console:
#000000 #00007F 0 127 #000000 #00007F 0 127
#4040FF #DEDEFF 128 256 #4040FF #DEDEFF 128 256
Flat:
#9999FF
} }
Orange Orange
@ -68,6 +84,8 @@ Orange
Console: Console:
#200000 #904000 0 127 #200000 #904000 0 127
#FF7F00 #FFFEFE 128 256 #FF7F00 #FFFEFE 128 256
Flat:
#FFAA00
} }
// This is designed to match the white Heretic/Hexen font. // This is designed to match the white Heretic/Hexen font.
@ -78,6 +96,8 @@ White
Console: Console:
#000000 #7F7F7F 0 127 #000000 #7F7F7F 0 127
#808080 #FFFFFF 128 256 #808080 #FFFFFF 128 256
Flat:
#DFDFDF
} }
// This is designed to match the yellow Hexen font, which has a // This is designed to match the yellow Hexen font, which has a
@ -90,6 +110,8 @@ Yellow
Console: Console:
#000000 #7F7F00 0 127 #000000 #7F7F00 0 127
#FFFF00 #FFFFFF 128 256 #FFFF00 #FFFFFF 128 256
Flat:
#EEEE33
} }
Untranslated Untranslated
@ -102,6 +124,8 @@ Black
Console: Console:
#000000 #323232 0 127 #000000 #323232 0 127
#0A0A0A #505050 128 256 #0A0A0A #505050 128 256
Flat:
#000000
} }
LightBlue "Light Blue" LightBlue "Light Blue"
@ -110,6 +134,8 @@ LightBlue "Light Blue"
Console: Console:
#00003C #5050FF 0 127 #00003C #5050FF 0 127
#8080FF #FFFFFF 128 256 #8080FF #FFFFFF 128 256
Flat:
#33EEFF
} }
Cream Cream
@ -118,6 +144,8 @@ Cream
Console: Console:
#2B230F #BF7B4B 0 127 #2B230F #BF7B4B 0 127
#FFB383 #FFFFFF 128 256 #FFB383 #FFFFFF 128 256
Flat:
#FFCC99
} }
Olive Olive
@ -126,6 +154,8 @@ Olive
Console: Console:
#373F27 #7B7F63 0 127 #373F27 #7B7F63 0 127
#676B4F #D1D8A8 128 256 #676B4F #D1D8A8 128 256
Flat:
#D1D8A8
} }
DarkGreen "Dark Green" DarkGreen "Dark Green"
@ -134,6 +164,8 @@ DarkGreen "Dark Green"
Console: Console:
#000000 #005800 0 127 #000000 #005800 0 127
#008C00 #DCFFDC 128 256 #008C00 #DCFFDC 128 256
Flat:
#008C00
} }
DarkRed "Dark Red" DarkRed "Dark Red"
@ -142,6 +174,8 @@ DarkRed "Dark Red"
Console: Console:
#000000 #730000 0 127 #000000 #730000 0 127
#800000 #FFDCDC 128 255 #800000 #FFDCDC 128 255
Flat:
#800000
} }
DarkBrown "Dark Brown" DarkBrown "Dark Brown"
@ -150,6 +184,8 @@ DarkBrown "Dark Brown"
Console: Console:
#2B230F #773000 0 127 #2B230F #773000 0 127
#735743 #F7BD58 128 256 #735743 #F7BD58 128 256
Flat:
#663333
} }
Purple Purple
@ -158,6 +194,8 @@ Purple
Console: Console:
#000000 #9F009B 0 127 #000000 #9F009B 0 127
#FF00FF #FFFFFF 128 256 #FF00FF #FFFFFF 128 256
Flat:
#9966CC
} }
DarkGray DarkGrey "Dark Gray" "Dark Grey" DarkGray DarkGrey "Dark Gray" "Dark Grey"
@ -166,4 +204,6 @@ DarkGray DarkGrey "Dark Gray" "Dark Grey"
Console: Console:
#000000 #646464 0 127 #000000 #646464 0 127
#404040 #B4B4B4 128 256 #404040 #B4B4B4 128 256
Flat:
#808080
} }