From 5fd6ccb97086d62e350eab63892240e006675035 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Feb 2016 20:53:52 +0100 Subject: [PATCH 1/9] - fixed incorrect #include. --- src/r_utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index bcba624e1..4f575910c 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -34,7 +34,7 @@ #include "doomstat.h" #include "m_random.h" #include "m_bbox.h" -#include "p_local.h" +#include "portal.h" #include "r_sky.h" #include "st_stuff.h" #include "c_cvars.h" From 6d8879f3028fbd59adde75e8d5fc269da29d4902 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Feb 2016 22:00:48 +0100 Subject: [PATCH 2/9] - missing #includes. --- src/g_strife/a_strifestuff.cpp | 1 + src/r_utility.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 724deaee2..1c1d5311d 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -20,6 +20,7 @@ #include "v_font.h" #include "farchive.h" #include "p_spec.h" +#include "portal.h" // Include all the other Strife stuff here to reduce compile time #include "a_acolyte.cpp" diff --git a/src/r_utility.cpp b/src/r_utility.cpp index 4f575910c..45760a5ce 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -57,6 +57,7 @@ #include "farchive.h" #include "r_utility.h" #include "d_player.h" +#include "portal.h" // EXTERNAL DATA DECLARATIONS ---------------------------------------------- From 42c6245a509cd25f2c56742dbd8c2c26656148da Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 17 Feb 2016 11:42:45 +0100 Subject: [PATCH 3/9] - restored A_CountdownArg to what it looked like before the scripting branch. The new version did not work as expected anymore. --- src/thingdef/thingdef_codeptr.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 4b9bb77de..fa2a336d4 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3269,35 +3269,29 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf) // A_CountdownArg // //=========================================================================== + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) { PARAM_ACTION_PROLOGUE; - PARAM_INT(argnum); - PARAM_STATE_OPT(state) { state = self->FindState(NAME_Death); } + PARAM_INT(cnt); + PARAM_STATE_OPT(state) { state = self->FindState(NAME_Death); } - if (argnum >= 0 && argnum < (int)countof(self->args)) + if (cnt<0 || cnt >= 5) return; + if (!self->args[cnt]--) { - if (!self->args[argnum]--) + if (self->flags&MF_MISSILE) { - if (self->flags & MF_MISSILE) - { - P_ExplodeMissile(self, NULL, NULL); - } - else if (self->flags & MF_SHOOTABLE) - { - P_DamageMobj(self, NULL, NULL, self->health, NAME_None, DMG_FORCED); - } - else - { - self->SetState(self->FindState(NAME_Death)); - } + P_ExplodeMissile(self, NULL, NULL); + } + else if (self->flags&MF_SHOOTABLE) + { + P_DamageMobj(self, NULL, NULL, self->health, NAME_None, DMG_FORCED); } else { self->SetState(state); } } - return 0; } //============================================================================ From f2125ea4206529095a5ee6e3c8650dd3fddaf3ed Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 17 Feb 2016 12:36:56 +0100 Subject: [PATCH 4/9] - this needs a return value... --- src/thingdef/thingdef_codeptr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index fa2a336d4..d9eba89ec 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3276,7 +3276,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) PARAM_INT(cnt); PARAM_STATE_OPT(state) { state = self->FindState(NAME_Death); } - if (cnt<0 || cnt >= 5) return; + if (cnt<0 || cnt >= 5) return 0; if (!self->args[cnt]--) { if (self->flags&MF_MISSILE) @@ -3292,6 +3292,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) self->SetState(state); } } + return 0; } //============================================================================ From ec88a30a004266520822d3d392fd5838e5073ede Mon Sep 17 00:00:00 2001 From: Gaerzi Date: Wed, 17 Feb 2016 16:08:40 +0100 Subject: [PATCH 5/9] fix duration according to vanilla --- wadsrc/static/actors/doom/revenant.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/doom/revenant.txt b/wadsrc/static/actors/doom/revenant.txt index ce072bec4..1a5045f34 100644 --- a/wadsrc/static/actors/doom/revenant.txt +++ b/wadsrc/static/actors/doom/revenant.txt @@ -31,7 +31,7 @@ ACTOR Revenant SKEL AABBCCDDEEFF 2 A_Chase Loop Melee: - SKEL G 1 A_FaceTarget + SKEL G 0 A_FaceTarget SKEL G 6 A_SkelWhoosh SKEL H 6 A_FaceTarget SKEL I 6 A_SkelFist From 4ccbc65f7b8d2ae5eca586bfe25f1db3ee2b4e13 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Wed, 17 Feb 2016 21:44:33 +0100 Subject: [PATCH 6/9] - Fixed mismatching Mancubus missile sequence. --- wadsrc/static/actors/doom/fatso.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/doom/fatso.txt b/wadsrc/static/actors/doom/fatso.txt index 0b3039325..88eaef39b 100644 --- a/wadsrc/static/actors/doom/fatso.txt +++ b/wadsrc/static/actors/doom/fatso.txt @@ -34,7 +34,7 @@ ACTOR Fatso FATT H 10 BRIGHT A_FatAttack2 FATT IG 5 A_FaceTarget FATT H 10 BRIGHT A_FatAttack3 - FATT IG 5 + FATT IG 5 A_FaceTarget Goto See Pain: FATT J 3 From db6f534df57273fdc9d7c9fda1f22f29216cdcd3 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Wed, 17 Feb 2016 21:53:23 +0100 Subject: [PATCH 7/9] - Fixed wrong Pain Elemental missile sequence. --- wadsrc/static/actors/doom/painelemental.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/actors/doom/painelemental.txt b/wadsrc/static/actors/doom/painelemental.txt index 5951afd6b..b8ef795a8 100644 --- a/wadsrc/static/actors/doom/painelemental.txt +++ b/wadsrc/static/actors/doom/painelemental.txt @@ -29,8 +29,8 @@ ACTOR PainElemental Missile: PAIN D 5 A_FaceTarget PAIN E 5 A_FaceTarget - PAIN F 4 BRIGHT A_FaceTarget - PAIN F 1 BRIGHT A_PainAttack + PAIN F 5 BRIGHT A_FaceTarget + PAIN A 0 BRIGHT A_PainAttack Goto See Pain: PAIN G 6 From f650bbfe1511e5c7151bd777ad59be4f5b68f1b9 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Thu, 18 Feb 2016 00:17:07 +0100 Subject: [PATCH 8/9] - Revert unneeded change to the frame letter. --- wadsrc/static/actors/doom/painelemental.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/doom/painelemental.txt b/wadsrc/static/actors/doom/painelemental.txt index b8ef795a8..ab0cd5cc9 100644 --- a/wadsrc/static/actors/doom/painelemental.txt +++ b/wadsrc/static/actors/doom/painelemental.txt @@ -30,7 +30,7 @@ ACTOR PainElemental PAIN D 5 A_FaceTarget PAIN E 5 A_FaceTarget PAIN F 5 BRIGHT A_FaceTarget - PAIN A 0 BRIGHT A_PainAttack + PAIN F 0 BRIGHT A_PainAttack Goto See Pain: PAIN G 6 From f338e5f1c4c48cc3e53035bc7a4b882248e68319 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Thu, 18 Feb 2016 22:09:05 +0100 Subject: [PATCH 9/9] - Apply the fast math flags for non-MSVC, too. Move the fast flags string creation in the main cmake file and use it where needed. --- CMakeLists.txt | 10 ++++++++++ dumb/CMakeLists.txt | 5 ++--- game-music-emu/CMakeLists.txt | 7 ++----- gdtoa/CMakeLists.txt | 5 ++++- src/CMakeLists.txt | 13 +++---------- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 006ebf476..22973e19a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,6 +188,16 @@ option(FORCE_INTERNAL_JPEG "Use internal jpeg") option(FORCE_INTERNAL_BZIP2 "Use internal bzip2") option(FORCE_INTERNAL_GME "Use internal gme" ON) +# Fast math flags, required by some subprojects +set( ZD_FASTMATH_FLAG "" ) +if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) + set( ZD_FASTMATH_FLAG "-ffast-math" ) +else() + if( MSVC ) + set( ZD_FASTMATH_FLAG "/fp:fast" ) + endif() +endif() + if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB ) message( STATUS "Using system zlib" ) else() diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index c8fa34bf7..8455e6d15 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -14,9 +14,8 @@ if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5") endif() -if( MSVC ) - set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast" ) -endif() +# Enable fast flag for dumb +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" ) CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS ) if( NOT ITOA_EXISTS ) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index f1d467bcc..3251b5c02 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -29,11 +29,8 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) endif() endif() -if( MSVC ) - set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast" ) -endif() - +# Enable fast flag for GME +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" ) # Default emulators to build (all of them! ;) if (NOT DEFINED USE_GME_AY) diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index 94ab9a691..c16542283 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -5,13 +5,16 @@ set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" ) # Disable warnings for << operator precedence (4554) and # unreferenced labels (4102) from VC if( MSVC ) - set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102 /fp:fast" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102" ) endif() if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" ) endif() +# Enable fast flag for gdtoa +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" ) + include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6e617c712..21fb48eec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,14 +35,6 @@ if( CMAKE_SIZEOF_VOID_P MATCHES "8" ) set( X64 64 ) endif() -if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) - set ( FASTMATH "-ffast-math" ) -else() - if ( MSVC ) - set ( FASTMATH "/fp:fast" ) - endif() -endif() - # You can either use "make install" on the FMOD distribution to put it # in standard system locations, or you can unpack the FMOD distribution # in the root of the zdoom tree. e.g.: @@ -866,6 +858,7 @@ set( NOT_COMPILED_SOURCE_FILES asm_x86_64/tmap3.s ) +# Enable fast math for some sources set( FASTMATH_SOURCES r_swrenderer.cpp r_3dfloors.cpp @@ -1203,12 +1196,12 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE zzautozend.cpp ) -set_source_files_properties( ${FASTMATH_SOURCES} PROPERTIES COMPILE_FLAGS ${FASTMATH} ) +set_source_files_properties( ${FASTMATH_SOURCES} PROPERTIES COMPILE_FLAGS ${ZD_FASTMATH_FLAG} ) set_source_files_properties( xlat/parse_xlat.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c" ) set_source_files_properties( sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h" ) set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE ) if ( WIN32 ) - set_source_files_properties( win32/fb_d3d9.cpp win32/fb_d3d9_wipe.cpp PROPERTIES COMPILE_FLAGS ${FASTMATH} ) + set_source_files_properties( win32/fb_d3d9.cpp win32/fb_d3d9_wipe.cpp PROPERTIES COMPILE_FLAGS ${ZD_FASTMATH_FLAG} ) endif()