From 446d1eb9c8533563c1ebd3be0b13422fd622b9e6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 7 Jun 2017 09:26:06 +0200 Subject: [PATCH 1/4] - we no longer support Windows 9x or NT 4 so its special code may just be removed entirely. --- src/win32/fb_ddraw.cpp | 13 ++---------- src/win32/i_mouse.cpp | 6 +----- src/win32/i_system.cpp | 43 ++++------------------------------------ src/win32/i_system.h | 9 --------- src/win32/win32video.cpp | 7 ------- 5 files changed, 7 insertions(+), 71 deletions(-) diff --git a/src/win32/fb_ddraw.cpp b/src/win32/fb_ddraw.cpp index 729bbaa916..813509bc06 100644 --- a/src/win32/fb_ddraw.cpp +++ b/src/win32/fb_ddraw.cpp @@ -87,7 +87,6 @@ extern IDirectDraw2 *DDraw; // PUBLIC DATA DEFINITIONS ------------------------------------------------- CVAR (Bool, vid_palettehack, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -CVAR (Bool, vid_attachedsurfaces, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, vid_noblitter, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Int, vid_displaybits, 8, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Float, rgamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) @@ -264,16 +263,8 @@ bool DDrawFB::CreateResources () } LOG3 ("Mode set to %d x %d x %d\n", Width, Height, bits); - if (vid_attachedsurfaces && OSPlatform == os_WinNT4) - { - if (!CreateSurfacesAttached ()) - return false; - } - else - { - if (!CreateSurfacesComplex ()) - return false; - } + if (!CreateSurfacesComplex ()) + return false; if (UseBlitter) { diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index 47faa6dc93..f091f5e8c9 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -1191,11 +1191,7 @@ void I_StartupMouse () { case 0: default: - if (OSPlatform == os_WinNT4) - { - new_mousemode = MM_Win32; - } - else if (MyRegisterRawInputDevices != NULL) + if (MyRegisterRawInputDevices != NULL) { new_mousemode = MM_RawInput; } diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 609be23016..a43492abf0 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -168,7 +168,6 @@ int (*I_GetTime) (bool saveMS); int (*I_WaitForTic) (int); void (*I_FreezeTime) (bool frozen); -os_t OSPlatform; bool gameisdead; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -542,24 +541,7 @@ void I_DetectOS(void) switch (info.dwPlatformId) { - case VER_PLATFORM_WIN32_WINDOWS: - OSPlatform = os_Win95; - if (info.dwMinorVersion < 10) - { - osname = "95"; - } - else if (info.dwMinorVersion < 90) - { - osname = "98"; - } - else - { - osname = "Me"; - } - break; - case VER_PLATFORM_WIN32_NT: - OSPlatform = info.dwMajorVersion < 5 ? os_WinNT4 : os_Win2k; osname = "NT"; if (info.dwMajorVersion == 5) { @@ -605,31 +587,14 @@ void I_DetectOS(void) break; default: - OSPlatform = os_unknown; osname = "Unknown OS"; break; } - if (OSPlatform == os_Win95) - { - if (!batchrun) Printf ("OS: Windows %s %lu.%lu.%lu %s\n", - osname, - info.dwMajorVersion, info.dwMinorVersion, - info.dwBuildNumber & 0xffff, info.szCSDVersion); - } - else - { - if (!batchrun) Printf ("OS: Windows %s (NT %lu.%lu) Build %lu\n %s\n", - osname, - info.dwMajorVersion, info.dwMinorVersion, - info.dwBuildNumber, info.szCSDVersion); - } - - if (OSPlatform == os_unknown) - { - if (!batchrun) Printf ("(Assuming Windows 2000)\n"); - OSPlatform = os_Win2k; - } + if (!batchrun) Printf ("OS: Windows %s (NT %lu.%lu) Build %lu\n %s\n", + osname, + info.dwMajorVersion, info.dwMinorVersion, + info.dwBuildNumber, info.szCSDVersion); } //========================================================================== diff --git a/src/win32/i_system.h b/src/win32/i_system.h index bf09f25abf..c83d3a2cc0 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -47,15 +47,6 @@ extern void SetLanguageIDs (); // [RH] Detects the OS the game is running under. void I_DetectOS (void); -typedef enum { - os_unknown, - os_Win95, - os_WinNT4, - os_Win2k -} os_t; - -extern os_t OSPlatform; - // Called by DoomMain. void I_Init (void); diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index 0546863cb6..5a26a876b6 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -325,13 +325,6 @@ void Win32Video::InitDDraw () } else { - if (OSPlatform == os_Win95) - { - // Windows 95 will let us use Mode X. If we didn't find any linear - // modes in the loop above, add the Mode X modes here. - AddMode (320, 200, 8, 200, 0); - AddMode (320, 240, 8, 240, 0); - } AddLowResModes (); } AddLetterboxModes (); From 78061f1cf70f294244fafd1cc8b25ac5ea8ac1f7 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 7 Jun 2017 03:54:52 -0400 Subject: [PATCH 2/4] - fixed: D3DFB::DoClear did not call Super::DoClear when vid_hw2d was false. --- src/win32/fb_d3d9.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 0ee7a585ab..d568ce60ff 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -2638,7 +2638,7 @@ void D3DFB::DoClear (int left, int top, int right, int bottom, int palcolor, uin { if (In2D < 2) { - //Super::Clear(left, top, right, bottom, palcolor, color); + Super::DoClear(left, top, right, bottom, palcolor, color); return; } if (!InScene) From 55df3a91ec63e929810e2e195ef468a88f1d88b9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 7 Jun 2017 22:40:54 +0200 Subject: [PATCH 3/4] - fixed: P_CheckMissileSpawn's setup for P_TryMove must be done in a way that allows detecting portal transitions. By setting the position before the call any portal lying between the actual spawn point and the check position would be skipped. --- src/p_mobj.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e36ff15881..43d5222135 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6718,6 +6718,8 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist) th->tics = 1; } + DVector3 newpos = th->Pos(); + if (maxdist > 0) { // move a little forward so an angle can be computed if it immediately explodes @@ -6731,7 +6733,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist) advance *= 0.5f; } while (advance.XY().LengthSquared() >= maxsquared); - th->SetXYZ(th->Pos() + advance); + newpos += advance; } FCheckPosition tm(!!(th->flags2 & MF2_RIP)); @@ -6755,7 +6757,9 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist) bool MBFGrenade = (!(th->flags & MF_MISSILE) || (th->BounceFlags & BOUNCE_MBF)); // killough 3/15/98: no dropoff (really = don't care for missiles) - if (!(P_TryMove (th, th->Pos(), false, NULL, tm, true))) + auto oldf2 = th->flags2; + th->flags2 &= ~MF2_MCROSS; // The following check is not supposed to activate missile triggers. + if (!(P_TryMove (th, newpos, false, NULL, tm, true))) { // [RH] Don't explode ripping missiles that spawn inside something if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP)) @@ -6778,6 +6782,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist) return false; } } + th->flags2 = oldf2; th->ClearInterpolation(); return true; } From 8b19ae98eabf43e693042cdc6fe5483a6aca2950 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 7 Jun 2017 22:42:19 +0200 Subject: [PATCH 4/4] - consolidated the two averageColor instances. --- src/gl/textures/gl_texture.cpp | 44 ------------------------- src/textures/texture.cpp | 59 ++++++++++++++++------------------ src/textures/textures.h | 1 + 3 files changed, 29 insertions(+), 75 deletions(-) diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index 76477c7384..b671edbf70 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -167,50 +167,6 @@ void gl_GenerateGlobalBrightmapFromColormap() } } -//=========================================================================== -// -// averageColor -// input is RGBA8 pixel format. -// The resulting RGB color can be scaled uniformly so that the highest -// component becomes one. -// -//=========================================================================== -static PalEntry averageColor(const uint32_t *data, int size, int maxout) -{ - int i; - unsigned int r, g, b; - - - - // First clear them. - r = g = b = 0; - if (size==0) - { - return PalEntry(255,255,255); - } - for(i = 0; i < size; i++) - { - r += BPART(data[i]); - g += GPART(data[i]); - b += RPART(data[i]); - } - - r = r/size; - g = g/size; - b = b/size; - - int maxv=MAX(MAX(r,g),b); - - if(maxv && maxout) - { - r = Scale(r, maxout, maxv); - g = Scale(g, maxout, maxv); - b = Scale(b, maxout, maxv); - } - return PalEntry(255,r,g,b); -} - - //========================================================================== // diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 2d7cc9486e..162d0ca437 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -848,40 +848,37 @@ void FTexture::SetScaledSize(int fitwidth, int fitheight) // //=========================================================================== -namespace +PalEntry FTexture::averageColor(const uint32_t *data, int size, int maxout) { - PalEntry averageColor(const uint32_t *data, int size, int maxout) + int i; + unsigned int r, g, b; + + // First clear them. + r = g = b = 0; + if (size == 0) { - int i; - unsigned int r, g, b; - - // First clear them. - r = g = b = 0; - if (size == 0) - { - return PalEntry(255, 255, 255); - } - for (i = 0; i < size; i++) - { - b += BPART(data[i]); - g += GPART(data[i]); - r += RPART(data[i]); - } - - r = r / size; - g = g / size; - b = b / size; - - int maxv = MAX(MAX(r, g), b); - - if (maxv && maxout) - { - r = Scale(r, maxout, maxv); - g = Scale(g, maxout, maxv); - b = Scale(b, maxout, maxv); - } - return PalEntry(255, r, g, b); + return PalEntry(255, 255, 255); } + for (i = 0; i < size; i++) + { + b += BPART(data[i]); + g += GPART(data[i]); + r += RPART(data[i]); + } + + r = r / size; + g = g / size; + b = b / size; + + int maxv = MAX(MAX(r, g), b); + + if (maxv && maxout) + { + r = ::Scale(r, maxout, maxv); + g = ::Scale(g, maxout, maxv); + b = ::Scale(b, maxout, maxv); + } + return PalEntry(255, r, g, b); } PalEntry FTexture::GetSkyCapColor(bool bottom) diff --git a/src/textures/textures.h b/src/textures/textures.h index 3c93b35df3..1c5a1ddf8b 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -307,6 +307,7 @@ public: void SetScaledSize(int fitwidth, int fitheight); PalEntry GetSkyCapColor(bool bottom); + static PalEntry averageColor(const uint32_t *data, int size, int maxout); virtual void HackHack (int newheight); // called by FMultipatchTexture to discover corrupt patches.