From 0111ec451a3a3d67055d67c9b3de6fa3d8814f31 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 14 Nov 2016 15:52:49 +0100 Subject: [PATCH 01/12] Revert "Fixed: A_SetInventory with an amount of 0 was not truly eliminating the actor." This reverts commit 02435b46a0af7287a542a0887ec7ac7aa828f742. --- src/p_actionfunctions.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index b9cfd7fe0e..73cade49a4 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -2665,12 +2665,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetInventory) } else if (amount <= 0) { - // Remove it all. - if (item) - { - item->DepleteOrDestroy(); - res = true; - } + //Remove it all. + res = (mobj->TakeInventory(itemtype, item->Amount, true, false)); ACTION_RETURN_BOOL(res); } else if (amount < item->Amount) From f2ec266eec6cff1ee1353eda952989533acf2e43 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Tue, 15 Nov 2016 11:38:03 -0600 Subject: [PATCH 02/12] Fixed: Actors with NOINTERACTION shouldn't waste time continuously applying NOBLOCKMAP if it has it already and not moving. --- src/p_mobj.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3e20118784..2183f8cb9c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3373,11 +3373,14 @@ void AActor::Tick () } } - UnlinkFromWorld (); - flags |= MF_NOBLOCKMAP; - SetXYZ(Vec3Offset(Vel)); - CheckPortalTransition(false); - LinkToWorld (); + if (!Vel.isZero() || !(flags & MF_NOBLOCKMAP)) + { + UnlinkFromWorld(); + flags |= MF_NOBLOCKMAP; + SetXYZ(Vec3Offset(Vel)); + CheckPortalTransition(false); + LinkToWorld(); + } } else { From 3b240b73e9585b963a76f77c00ec617fe1a4bd1b Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 19 Nov 2016 12:40:08 +0200 Subject: [PATCH 03/12] Fixed endianness issue with saved games See http://forum.zdoom.org/viewtopic.php?t=54272 --- src/resourcefiles/file_zip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resourcefiles/file_zip.cpp b/src/resourcefiles/file_zip.cpp index 8713fe554a..8011d56cfe 100644 --- a/src/resourcefiles/file_zip.cpp +++ b/src/resourcefiles/file_zip.cpp @@ -577,7 +577,7 @@ bool WriteZip(const char *filename, TArray &filenames, TArray Date: Sat, 19 Nov 2016 12:41:01 +0200 Subject: [PATCH 04/12] Fixed compilation warnings in Cocoa backend --- src/posix/cocoa/i_input.mm | 2 +- src/posix/cocoa/i_joystick.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/posix/cocoa/i_input.mm b/src/posix/cocoa/i_input.mm index 3bbf42a9ad..7032806158 100644 --- a/src/posix/cocoa/i_input.mm +++ b/src/posix/cocoa/i_input.mm @@ -526,7 +526,7 @@ void ProcessMouseMoveInGame(NSEvent* theEvent) lastX = x; lastY = y; - if (0 != event.x | 0 != event.y) + if (0 != event.x || 0 != event.y) { event.type = EV_Mouse; diff --git a/src/posix/cocoa/i_joystick.cpp b/src/posix/cocoa/i_joystick.cpp index c4bcc85c3e..747cc14226 100644 --- a/src/posix/cocoa/i_joystick.cpp +++ b/src/posix/cocoa/i_joystick.cpp @@ -1018,7 +1018,7 @@ IOKitJoystickManager::~IOKitJoystickManager() if (0 != notification) { IOObjectRelease(notification); - notification = NULL; + notification = 0; } } } From c28bcca3f3504b97fa791be56b83e1f679cfbb5b Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 19 Nov 2016 12:44:35 +0200 Subject: [PATCH 05/12] Print unknown if release information is unavailable on macOS At least 10.4 Tiger doesn't support required sysctl name --- src/posix/cocoa/i_main.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posix/cocoa/i_main.mm b/src/posix/cocoa/i_main.mm index d8f0e74cf8..851e72e484 100644 --- a/src/posix/cocoa/i_main.mm +++ b/src/posix/cocoa/i_main.mm @@ -156,7 +156,7 @@ static void I_DetectOS() case 12: name = "macOS Sierra"; break; } - char release[16] = {}; + char release[16] = "unknown"; size_t size = sizeof release - 1; sysctlbyname("kern.osversion", release, &size, nullptr, 0); From 789315bb4a7a2a5701b40c4ee004336395bd452f Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Tue, 22 Nov 2016 21:22:39 -0500 Subject: [PATCH 06/12] - Fixed build with MinGW-w64 (TDM-GCC 5.1). Note that the resulting binary will crash under -O3 until the alignment violation is taken care of in FRemapTable::Alloc. - It appears that CMake added native support for building rc files with MinGW at some point so removed manual rc compiling code. --- src/CMakeLists.txt | 10 +----- src/i_module.cpp | 2 +- src/v_video.cpp | 2 +- src/win32/i_crash.cpp | 48 ----------------------------- src/win32/i_keyboard.cpp | 5 +++ src/win32/i_rawps2.cpp | 2 +- src/win32/i_specialpaths.cpp | 1 + src/win32/i_xinput.cpp | 11 +++++++ tools/updaterevision/CMakeLists.txt | 17 +++------- 9 files changed, 26 insertions(+), 72 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 04e6087ead..7d532ca9cf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -728,15 +728,7 @@ if( WIN32 ) set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ) set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} ) - if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) - # CMake is not set up to compile and link rc files with GCC. :( - add_custom_command( OUTPUT zdoom-rc.o - COMMAND windres -o zdoom-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zdoom.rc - DEPENDS win32/zdoom.rc ) - set( SYSTEM_SOURCES ${SYSTEM_SOURCES} zdoom-rc.o ) - else() - set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc ) - endif() + set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc ) elseif( APPLE ) if( OSX_COCOA_BACKEND ) set( SYSTEM_SOURCES_DIR posix posix/cocoa ) diff --git a/src/i_module.cpp b/src/i_module.cpp index 1ed40310fa..a82963ec5f 100644 --- a/src/i_module.cpp +++ b/src/i_module.cpp @@ -97,5 +97,5 @@ bool FModule::Open(const char* lib) void *FModule::GetSym(const char* name) { - return GetProcAddress((HMODULE)handle, name); + return (void *)GetProcAddress((HMODULE)handle, name); } diff --git a/src/v_video.cpp b/src/v_video.cpp index 37cfdd4801..32e1a54d39 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -72,7 +72,7 @@ FRenderer *Renderer; IMPLEMENT_ABSTRACT_CLASS (DCanvas) IMPLEMENT_ABSTRACT_CLASS (DFrameBuffer) -#if defined(_DEBUG) && defined(_M_IX86) +#if defined(_DEBUG) && defined(_M_IX86) && !defined(__MINGW32__) #define DBGBREAK { __asm int 3 } #else #define DBGBREAK diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index d4804ec0e9..4a0a1b1606 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -75,54 +75,6 @@ #include #include -#if defined(_WIN64) && defined(__GNUC__) -struct KNONVOLATILE_CONTEXT_POINTERS { - union { - PDWORD64 IntegerContext[16]; - struct { - PDWORD64 Rax; - PDWORD64 Rcx; - PDWORD64 Rdx; - PDWORD64 Rbx; - PDWORD64 Rsp; - PDWORD64 Rbp; - PDWORD64 Rsi; - PDWORD64 Rdi; - PDWORD64 R8; - PDWORD64 R9; - PDWORD64 R10; - PDWORD64 R11; - PDWORD64 R12; - PDWORD64 R13; - PDWORD64 R14; - PDWORD64 R15; - }; - }; -}; -typedef -EXCEPTION_DISPOSITION -NTAPI -EXCEPTION_ROUTINE ( - struct _EXCEPTION_RECORD *ExceptionRecord, - PVOID EstablisherFrame, - struct _CONTEXT *ContextRecord, - PVOID DispatcherContext - ); -NTSYSAPI -EXCEPTION_ROUTINE * -NTAPI -RtlVirtualUnwind ( - DWORD HandlerType, - DWORD64 ImageBase, - DWORD64 ControlPc, - PRUNTIME_FUNCTION FunctionEntry, - PCONTEXT ContextRecord, - PVOID *HandlerData, - PDWORD64 EstablisherFrame, - KNONVOLATILE_CONTEXT_POINTERS *ContextPointers - ); -#endif - // MACROS ------------------------------------------------------------------ #define REMOTE_HOST "localhost" diff --git a/src/win32/i_keyboard.cpp b/src/win32/i_keyboard.cpp index cdcf9d8d85..e62942e8d3 100644 --- a/src/win32/i_keyboard.cpp +++ b/src/win32/i_keyboard.cpp @@ -21,6 +21,11 @@ #define DINPUT_BUFFERSIZE 32 +// MinGW-w64 (TDM5.1 - 2016/11/21) +#ifndef DIK_PREVTRACK +#define DIK_PREVTRACK DIK_CIRCUMFLEX +#endif + // TYPES ------------------------------------------------------------------- class FDInputKeyboard : public FKeyboard diff --git a/src/win32/i_rawps2.cpp b/src/win32/i_rawps2.cpp index 50de1d0f45..940ef4bb1a 100644 --- a/src/win32/i_rawps2.cpp +++ b/src/win32/i_rawps2.cpp @@ -389,7 +389,7 @@ bool FRawPS2Controller::ProcessInput(RAWHID *raw, int code) { // w32api has an incompatible definition of bRawData. // (But the version that comes with MinGW64 is fine.) -#if defined(__GNUC__) && !defined(_WIN64) +#if defined(__GNUC__) && !defined(__MINGW64_VERSION_MAJOR) BYTE *rawdata = &raw->bRawData; #else BYTE *rawdata = raw->bRawData; diff --git a/src/win32/i_specialpaths.cpp b/src/win32/i_specialpaths.cpp index 6d4890ea9d..745c12f12a 100644 --- a/src/win32/i_specialpaths.cpp +++ b/src/win32/i_specialpaths.cpp @@ -33,6 +33,7 @@ ** */ +#define _WIN32_WINNT 0x0601 #include #include #include diff --git a/src/win32/i_xinput.cpp b/src/win32/i_xinput.cpp index 1180f9f32c..22c2dd7142 100644 --- a/src/win32/i_xinput.cpp +++ b/src/win32/i_xinput.cpp @@ -33,6 +33,17 @@ #define XUSER_MAX_COUNT 4 #endif +// MinGW +#ifndef XINPUT_DLL +#define XINPUT_DLL_A "xinput1_3.dll" +#define XINPUT_DLL_W L"xinput1_3.dll" +#ifdef UNICODE + #define XINPUT_DLL XINPUT_DLL_W +#else + #define XINPUT_DLL XINPUT_DLL_A +#endif +#endif + // TYPES ------------------------------------------------------------------- typedef DWORD (WINAPI *XInputGetStateType)(DWORD index, XINPUT_STATE *state); diff --git a/tools/updaterevision/CMakeLists.txt b/tools/updaterevision/CMakeLists.txt index 22890472a5..db99ab812e 100644 --- a/tools/updaterevision/CMakeLists.txt +++ b/tools/updaterevision/CMakeLists.txt @@ -1,19 +1,12 @@ cmake_minimum_required( VERSION 2.8.7 ) if( WIN32 ) - if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE OR ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) - add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o - COMMAND windres -o ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o -i ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.rc - DEPENDS trustinfo.rc ) - set( TRUSTINFO trustinfo.o ) + if( MSVC_VERSION GREATER 1399 ) + # VC 8+ adds a manifest automatically to the executable. We need to + # merge ours with it. + set( MT_MERGE ON ) else() - if( MSVC_VERSION GREATER 1399 ) - # VC 8+ adds a manifest automatically to the executable. We need to - # merge ours with it. - set( MT_MERGE ON ) - else( MSVC_VERSION GREATER 1399 ) - set( TRUSTINFO trustinfo.rc ) - endif( MSVC_VERSION GREATER 1399 ) + set( TRUSTINFO trustinfo.rc ) endif() else( WIN32 ) set( TRUSTINFO "" ) From 649c96261a8ad72996b19ff84c39d074ef46cd5b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 23 Nov 2016 10:13:17 +0100 Subject: [PATCH 07/12] - clarified error messages for bogus conversation scripts. --- src/p_conversation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 0bc2b98a87..41c8733752 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -252,7 +252,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc if ((type == 1 && !isbinary) || (type == 2 && isbinary)) { - DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum)); return false; } @@ -272,7 +272,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc // is exactly 1516 bytes long. if (numnodes % 1516 != 0) { - DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum)); return false; } numnodes /= 1516; @@ -282,7 +282,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc // And the teaser version has 1488-byte entries. if (numnodes % 1488 != 0) { - DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum)); return false; } numnodes /= 1488; From 0489b6e7c5075bad5c83b9b2961c9f629ec11197 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Wed, 23 Nov 2016 10:19:52 +0100 Subject: [PATCH 08/12] - Fixed missing newlines to the conversation error message. --- src/p_conversation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 41c8733752..0208e64775 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -252,7 +252,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc if ((type == 1 && !isbinary) || (type == 2 && isbinary)) { - DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum)); return false; } @@ -272,7 +272,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc // is exactly 1516 bytes long. if (numnodes % 1516 != 0) { - DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum)); return false; } numnodes /= 1516; @@ -282,7 +282,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc // And the teaser version has 1488-byte entries. if (numnodes % 1488 != 0) { - DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.", Wads.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum)); return false; } numnodes /= 1488; From 6ae266c76eb191f5a607b721cccc7a1b3567f1a0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 23 Nov 2016 14:27:08 +0100 Subject: [PATCH 09/12] - fixed: The check for identical floor planes on an opening should never allow it to be narrowed down. This can cause problems in rare situations where a sloped plane is checked outside its sector boundaries. --- src/p_map.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 5cc9bdf72c..d102307bcc 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -839,9 +839,11 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec // If the floor planes on both sides match we should recalculate open.bottom at the actual position we are checking // This is to avoid bumpy movement when crossing a linedef with the same slope on both sides. + // This should never narrow down the opening, though, only widen it. if (open.frontfloorplane == open.backfloorplane && open.bottom > LINEOPEN_MIN) { - open.bottom = open.frontfloorplane.ZatPoint(cres.Position); + auto newopen = open.frontfloorplane.ZatPoint(cres.Position); + if (newopen < open.bottom) open.bottom = newopen; } if (rail && From 5b059971f0eceb38f9883d19b37b0adcd4360e67 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 23 Nov 2016 14:32:18 +0100 Subject: [PATCH 10/12] - fixed: P_SpawnMapThing forced gravity instead of disabling it when being given Gravity = 0 from UDMF. --- src/p_mobj.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 2183f8cb9c..62da260492 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5063,7 +5063,11 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase; if (mthing->Gravity < 0) mobj->Gravity = -mthing->Gravity; else if (mthing->Gravity > 0) mobj->Gravity *= mthing->Gravity; - else mobj->flags &= ~MF_NOGRAVITY; + else + { + mobj->flags |= MF_NOGRAVITY; + mobj->Gravity = 0; + } // For Hexen floatbob 'compatibility' we do not really want to alter the floorz. if (mobj->specialf1 == 0 || !(mobj->flags2 & MF2_FLOATBOB) || !(ib_compatflags & BCOMPATF_FLOATBOB)) From e138a3ffbc916ac2c9390c4f339e9154e07222a7 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 23 Nov 2016 12:15:58 +0200 Subject: [PATCH 11/12] Fixed infinite recursion with self-referencing multipatch textures See http://forum.zdoom.org/viewtopic.php?t=54355 --- src/textures/multipatchtexture.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 88d8815a6f..de3dd2f131 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -1334,6 +1334,7 @@ void FMultiPatchTexture::ResolvePatches() { if (Inits[i].HasLine) Inits[i].sc.Message(MSG_WARNING, "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars()); else Printf(TEXTCOLOR_YELLOW "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars()); + continue; } else { From 9bd19c2d2e48556018458348fe07d2a4ea4f557e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 23 Nov 2016 14:38:45 +0100 Subject: [PATCH 12/12] - ensure that the MAPINFO parser never mixes HexenHack parsing with the new format. --- src/g_mapinfo.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index bc04704740..7bfb690e79 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1508,10 +1508,18 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo) if (sc.CheckNumber()) { // MAPNAME is a number; assume a Hexen wad - char maptemp[8]; - mysnprintf (maptemp, countof(maptemp), "MAP%02d", sc.Number); - mapname = maptemp; - HexenHack = true; + if (format_type == FMT_New) + { + mapname = sc.String; + } + else + { + char maptemp[8]; + mysnprintf(maptemp, countof(maptemp), "MAP%02d", sc.Number); + mapname = maptemp; + HexenHack = true; + format_type = FMT_Old; + } } else {