From 585366f8720256019d8da801717e8e56f9de00d7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jul 2015 09:08:15 +0200 Subject: [PATCH 1/5] - fixed signedness warning. --- src/p_tags.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_tags.cpp b/src/p_tags.cpp index 99796e269..15528378b 100644 --- a/src/p_tags.cpp +++ b/src/p_tags.cpp @@ -98,7 +98,7 @@ void FTagManager::AddSectorTag(int sector, int tag) void FTagManager::RemoveSectorTags(int sect) { - if (startForSector.Size() > sect) + if (startForSector.Size() > (unsigned int)sect) { int start = startForSector[sect]; if (start >= 0) From b5033d29401d4f53d8ee5216d82ecec3c7b5d3a4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jul 2015 09:11:08 +0200 Subject: [PATCH 2/5] - fixed a bad check from pull request #325. --- src/g_mapinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 5a39d7dbb..49493667e 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -318,7 +318,7 @@ FString level_info_t::LookupLevelName() checkstring[0] = '\0'; } thename = strstr (lookedup, checkstring); - if (thename == NULL || thename == lookedup) + if (thename == NULL) { thename = lookedup; } From 19d15d7fc8c9b0aef52db971a24e421aebfd8e31 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jul 2015 09:25:04 +0200 Subject: [PATCH 3/5] - fixed: Levels could be exited multiple times, triggering special exit actions for each one. --- src/g_level.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/g_level.cpp b/src/g_level.cpp index 713205f6f..899f96d4f 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -533,6 +533,10 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill Printf (TEXTCOLOR_RED "Unloading scripts cannot exit the level again.\n"); return; } + if (gameaction == ga_completed) // do not exit multiple times. + { + return; + } if (levelname == NULL || *levelname == 0) { From 1e4bec25c530f197baa730046bb3e6a536bcaf4e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jul 2015 10:15:12 +0200 Subject: [PATCH 4/5] - fixed the distance check for unblocking overlapping monsters. It tested for half the radius as distance threshold when it should have used the full radius --- src/p_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index d5745523c..fca43c120 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1064,8 +1064,8 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) { unblocking = true; } - else if (abs(thing->x - tm.thing->x) < (thing->radius+tm.thing->radius)/2 && - abs(thing->y - tm.thing->y) < (thing->radius+tm.thing->radius)/2) + else if (abs(thing->x - tm.thing->x) < (thing->radius+tm.thing->radius) && + abs(thing->y - tm.thing->y) < (thing->radius+tm.thing->radius)) { fixed_t newdist = P_AproxDistance(thing->x - tm.x, thing->y - tm.y); From c677dd37f5ee02d126244f1d15f5854b64edb885 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jul 2015 12:53:58 +0200 Subject: [PATCH 5/5] - changed I_PrintStr so that it doesn't add everything to the RichEdit control right away. The RichEdit control can become quite slow with large amounts of text being added constantly. Since anything that gets added while the game is running can't be seen anyway unless a fatal error is produced, it buffers the text locally now, without any processing, and only adds it to the RichEdit control in case a fatal error causes the control to be displayed again. --- src/win32/i_main.cpp | 5 +++++ src/win32/i_system.cpp | 30 +++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index ea167428f..8b6521ad5 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -106,6 +106,7 @@ LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); void CreateCrashLog (char *custominfo, DWORD customsize, HWND richedit); void DisplayCrashLog (); extern BYTE *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info); +void I_FlushBufferedConsoleStuff(); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -128,6 +129,7 @@ HANDLE MainThread; DWORD MainThreadID; HANDLE StdOut; bool FancyStdOut, AttachedStdOut; +bool ConWindowHidden; // The main window HWND Window; @@ -644,6 +646,7 @@ void I_SetWndProc() SetWindowLongPtr (Window, GWLP_USERDATA, 1); SetWindowLongPtr (Window, GWLP_WNDPROC, (WLONG_PTR)WndProc); ShowWindow (ConWindow, SW_HIDE); + ConWindowHidden = true; ShowWindow (GameTitleWindow, SW_HIDE); I_InitInput (Window); } @@ -675,8 +678,10 @@ void RestoreConView() SetWindowLongPtr (Window, GWLP_WNDPROC, (WLONG_PTR)LConProc); ShowWindow (ConWindow, SW_SHOW); + ConWindowHidden = false; ShowWindow (GameTitleWindow, SW_SHOW); I_ShutdownInput (); // Make sure the mouse pointer is available. + I_FlushBufferedConsoleStuff(); // Make sure the progress bar isn't visible. if (StartScreen != NULL) { diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 1d2bae8e1..6d8fb8595 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -132,6 +132,7 @@ extern bool FancyStdOut; extern HINSTANCE g_hInst; extern FILE *Logfile; extern bool NativeMouse; +extern bool ConWindowHidden; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -912,12 +913,11 @@ void ToEditControl(HWND edit, const char *buf, wchar_t *wbuf, int bpos) // //========================================================================== -void I_PrintStr(const char *cp) +static void DoPrintStr(const char *cp, HWND edit, HANDLE StdOut) { - if (ConWindow == NULL && StdOut == NULL) + if (edit == NULL && StdOut == NULL) return; - HWND edit = ConWindow; char buf[256]; wchar_t wbuf[countof(buf)]; int bpos = 0; @@ -1049,6 +1049,30 @@ void I_PrintStr(const char *cp) } } +static TArray bufferedConsoleStuff; + +void I_PrintStr(const char *cp) +{ + if (ConWindowHidden) + { + bufferedConsoleStuff.Push(cp); + DoPrintStr(cp, NULL, StdOut); + } + else + { + DoPrintStr(cp, ConWindow, StdOut); + } +} + +void I_FlushBufferedConsoleStuff() +{ + for (unsigned i = 0; i < bufferedConsoleStuff.Size(); i++) + { + DoPrintStr(bufferedConsoleStuff[i], ConWindow, NULL); + } + bufferedConsoleStuff.Clear(); +} + //========================================================================== // // SetQueryIWAD