From bf6cdba0bbdfa2ee7874dbebe2e4974b8205596e Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Tue, 17 Mar 2015 18:07:50 +1300 Subject: [PATCH 01/38] Added -hashfiles command --- src/d_main.cpp | 26 +++++++++++++++++++++++++ src/doomstat.h | 1 + src/w_wad.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/src/d_main.cpp b/src/d_main.cpp index 5e21867bb..6491dc3e3 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -214,6 +214,7 @@ bool autostart; FString StoredWarp; bool advancedemo; FILE *debugfile; +FILE *hashfile; event_t events[MAXEVENTS]; int eventhead; int eventtail; @@ -2220,6 +2221,26 @@ void D_DoomMain (void) execLogfile(logfile); } + if (Args->CheckParm("-hashfiles")) + { + FString filename = "fileinfo.txt"; + Printf("Hashing loaded content to: %s\n", filename); + hashfile = fopen(filename, "w"); + if (hashfile) + { + fprintf(hashfile, "%s version %s (%s)\n", GAMENAME, GetVersionString(), GetGitHash()); +#ifdef __VERSION__ + fprintf(hashfile, "Compiler version: %s\n", __VERSION__); +#endif + fprintf(hashfile, "Command line:"); + for (int i = 0; i < Args->NumArgs(); ++i) + { + fprintf(hashfile, " %s", Args->GetArg(i)); + } + fprintf(hashfile, "\n"); + } + } + D_DoomInit(); PClass::StaticInit (); atterm(FinalGC); @@ -2289,6 +2310,11 @@ void D_DoomMain (void) pwads.Clear(); pwads.ShrinkToFit(); + if (hashfile) + { + Printf("Notice: File hashing is incredibly verbose. Expect loading files to take much longer then usual.\n"); + } + Printf ("W_Init: Init WADfiles.\n"); Wads.InitMultipleFiles (allwads); allwads.Clear(); diff --git a/src/doomstat.h b/src/doomstat.h index 565d15bd6..b1784530f 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -172,6 +172,7 @@ extern bool playeringame[/*MAXPLAYERS*/]; // File handling stuff. extern FILE* debugfile; +extern FILE* hashfile; // if true, load all graphics at level load extern bool precache; diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 9455817db..abbac5763 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -56,6 +56,7 @@ #include "doomerrors.h" #include "resourcefiles/resourcefile.h" #include "md5.h" +#include "doomstat.h" // MACROS ------------------------------------------------------------------ @@ -300,6 +301,56 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) AddFile(path, embedded); } } + + if (hashfile) + { + BYTE cksum[16]; + char cksumout[33]; + memset(cksumout, 0, sizeof(cksumout)); + + FileReader *reader = wadinfo; + + if (reader != NULL) + { + MD5Context md5; + reader->Seek(0, SEEK_SET); + md5.Update(reader, reader->GetLength()); + md5.Final(cksum); + + for (size_t j = 0; j < sizeof(cksum); ++j) + { + sprintf(cksumout + (j * 2), "%02X", cksum[j]); + } + + fprintf(hashfile, "file: %s, hash: %s, size: %d\n", filename, cksumout, reader->GetLength()); + } + + else + fprintf(hashfile, "file: %s, Directory structure\n", filename); + + for (DWORD i = 0; i < resfile->LumpCount(); i++) + { + FResourceLump *lump = resfile->GetLump(i); + + if (!(lump->Flags & LUMPF_EMBEDDED)) + { + reader = lump->NewReader(); + + MD5Context md5; + md5.Update(reader, lump->LumpSize); + md5.Final(cksum); + + for (size_t j = 0; j < sizeof(cksum); ++j) + { + sprintf(cksumout + (j * 2), "%02X", cksum[j]); + } + + fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %d\n", filename, lump->FullName ? lump->FullName : lump->Name, cksumout, lump->LumpSize); + + delete reader; + } + } + } return; } } From ffbcda206cda9c5d4c0b35b3e779558868be03b9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 21 Mar 2015 12:48:37 +0100 Subject: [PATCH 02/38] - allow oscillating for discretely defined animations as well, not just for ranged ones. - add random animations. --- src/textures/animations.cpp | 83 ++++++++++++++++++++++++------------- src/textures/textures.h | 11 ++--- 2 files changed, 61 insertions(+), 33 deletions(-) diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index 58ef7a5ca..446f6f35a 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -68,7 +68,7 @@ static FRandom pr_animatepictures ("AnimatePics"); // //========================================================================== -void FTextureManager::AddAnim (FAnimDef *anim) +FAnimDef *FTextureManager::AddAnim (FAnimDef *anim) { // Search for existing duplicate. for (unsigned int i = 0; i < mAnimations.Size(); ++i) @@ -78,11 +78,12 @@ void FTextureManager::AddAnim (FAnimDef *anim) // Found one! free (mAnimations[i]); mAnimations[i] = anim; - return; + return anim; } } // Didn't find one, so add it at the end. mAnimations.Push (anim); + return anim; } //========================================================================== @@ -94,7 +95,7 @@ void FTextureManager::AddAnim (FAnimDef *anim) // //========================================================================== -void FTextureManager::AddSimpleAnim (FTextureID picnum, int animcount, int animtype, DWORD speedmin, DWORD speedrange) +FAnimDef *FTextureManager::AddSimpleAnim (FTextureID picnum, int animcount, DWORD speedmin, DWORD speedrange) { if (AreTexturesCompatible(picnum, picnum + (animcount - 1))) { @@ -102,13 +103,15 @@ void FTextureManager::AddSimpleAnim (FTextureID picnum, int animcount, int animt anim->CurFrame = 0; anim->BasePic = picnum; anim->NumFrames = animcount; - anim->AnimType = animtype; + anim->AnimType = FAnimDef::ANIM_Forward; + anim->bDiscrete = false; anim->SwitchTime = 0; anim->Frames[0].SpeedMin = speedmin; anim->Frames[0].SpeedRange = speedrange; anim->Frames[0].FramePic = anim->BasePic; - AddAnim (anim); + return AddAnim (anim); } + return NULL; } //========================================================================== @@ -119,16 +122,17 @@ void FTextureManager::AddSimpleAnim (FTextureID picnum, int animcount, int animt // //========================================================================== -void FTextureManager::AddComplexAnim (FTextureID picnum, const TArray &frames) +FAnimDef *FTextureManager::AddComplexAnim (FTextureID picnum, const TArray &frames) { FAnimDef *anim = (FAnimDef *)M_Malloc (sizeof(FAnimDef) + (frames.Size()-1) * sizeof(frames[0])); anim->BasePic = picnum; anim->NumFrames = frames.Size(); anim->CurFrame = 0; - anim->AnimType = FAnimDef::ANIM_DiscreteFrames; + anim->AnimType = FAnimDef::ANIM_Forward; + anim->bDiscrete = true; anim->SwitchTime = 0; memcpy (&anim->Frames[0], &frames[0], frames.Size() * sizeof(frames[0])); - AddAnim (anim); + return AddAnim (anim); } //========================================================================== @@ -333,6 +337,8 @@ void FTextureManager::ParseAnim (FScanner &sc, int usetype) FTextureID picnum; int defined = 0; bool optional = false, missing = false; + FAnimDef *ani = NULL; + BYTE type = FAnimDef::ANIM_Forward; sc.MustGetString (); if (sc.Compare ("optional")) @@ -370,6 +376,22 @@ void FTextureManager::ParseAnim (FScanner &sc, int usetype) } continue; } + else if (sc.Compare ("Oscillate")) + { + if (type == FAnimDef::ANIM_Random) + { + sc.ScriptError ("You cannot use \"random\" and \"oscillate\" together in a single animation."); + } + type = FAnimDef::ANIM_OscillateUp; + } + else if (sc.Compare("Random")) + { + if (type == FAnimDef::ANIM_OscillateUp) + { + sc.ScriptError ("You cannot use \"random\" and \"oscillate\" together in a single animation."); + } + type = FAnimDef::ANIM_Random; + } else if (sc.Compare ("range")) { if (defined == 2) @@ -381,7 +403,7 @@ void FTextureManager::ParseAnim (FScanner &sc, int usetype) sc.ScriptError ("You can only use one \"range\" per animation."); } defined = 1; - ParseRangeAnim (sc, picnum, usetype, missing); + ani = ParseRangeAnim (sc, picnum, usetype, missing); } else if (sc.Compare ("pic")) { @@ -407,7 +429,12 @@ void FTextureManager::ParseAnim (FScanner &sc, int usetype) { sc.ScriptError ("Animation needs at least 2 frames"); } - AddComplexAnim (picnum, frames); + ani = AddComplexAnim (picnum, frames); + } + if (ani != NULL && type != FAnimDef::ANIM_Forward) + { + if (ani->AnimType == FAnimDef::ANIM_Backward && type == FAnimDef::ANIM_OscillateUp) ani->AnimType = FAnimDef::ANIM_OscillateDown; + else ani->AnimType = type; } } @@ -420,7 +447,7 @@ void FTextureManager::ParseAnim (FScanner &sc, int usetype) // //========================================================================== -void FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing) +FAnimDef *FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing) { int type; FTextureID framenum; @@ -432,7 +459,7 @@ void FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int usety if (framenum == picnum || !picnum.Exists()) { - return; // Animation is only one frame or does not exist + return NULL; // Animation is only one frame or does not exist } if (framenum < picnum) { @@ -440,18 +467,9 @@ void FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int usety Texture(framenum)->bNoDecals = Texture(picnum)->bNoDecals; swapvalues (framenum, picnum); } - if (sc.GetString()) - { - if (sc.Compare ("Oscillate")) - { - type = type == FAnimDef::ANIM_Forward ? FAnimDef::ANIM_OscillateUp : FAnimDef::ANIM_OscillateDown; - } - else - { - sc.UnGet (); - } - } - AddSimpleAnim (picnum, framenum - picnum + 1, type, min, max - min); + FAnimDef *ani = AddSimpleAnim (picnum, framenum - picnum + 1, min, max - min); + ani->AnimType = type; + return ani; } //========================================================================== @@ -691,7 +709,7 @@ void FTextureManager::FixAnimations () for (i = 0; i < mAnimations.Size(); ++i) { FAnimDef *anim = mAnimations[i]; - if (anim->AnimType == FAnimDef::ANIM_DiscreteFrames) + if (anim->bDiscrete) { if (Texture(anim->BasePic)->bNoRemap0) { @@ -830,7 +848,7 @@ FDoorAnimation *FTextureManager::FindAnimatedDoor (FTextureID picnum) void FAnimDef::SetSwitchTime (DWORD mstime) { - int speedframe = (AnimType == FAnimDef::ANIM_DiscreteFrames) ? CurFrame : 0; + int speedframe = bDiscrete ? CurFrame : 0; SwitchTime = mstime + Frames[speedframe].SpeedMin; if (Frames[speedframe].SpeedRange != 0) @@ -889,7 +907,6 @@ void FTextureManager::UpdateAnimations (DWORD mstime) { default: case FAnimDef::ANIM_Forward: - case FAnimDef::ANIM_DiscreteFrames: anim->CurFrame = (anim->CurFrame + 1) % anim->NumFrames; break; @@ -904,6 +921,16 @@ void FTextureManager::UpdateAnimations (DWORD mstime) } break; + case FAnimDef::ANIM_Random: + // select a random frame other than the current one + if (anim->NumFrames > 1) + { + WORD rndFrame = (WORD)pr_animatepictures(anim->NumFrames - 1); + if (rndFrame >= anim->CurFrame) rndFrame++; + anim->CurFrame = rndFrame; + } + break; + case FAnimDef::ANIM_OscillateUp: anim->CurFrame = anim->CurFrame + 1; if (anim->CurFrame >= anim->NumFrames - 1) @@ -923,7 +950,7 @@ void FTextureManager::UpdateAnimations (DWORD mstime) anim->SetSwitchTime (mstime); } - if (anim->AnimType == FAnimDef::ANIM_DiscreteFrames) + if (anim->bDiscrete) { SetTranslation (anim->BasePic, anim->Frames[anim->CurFrame].FramePic); } diff --git a/src/textures/textures.h b/src/textures/textures.h index cf3982fb3..aa8505d4e 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -64,6 +64,7 @@ struct FAnimDef WORD NumFrames; WORD CurFrame; BYTE AnimType; + bool bDiscrete; // taken out of AnimType to have better control DWORD SwitchTime; // Time to advance to next frame struct FAnimFrame { @@ -77,7 +78,7 @@ struct FAnimDef ANIM_Backward, ANIM_OscillateUp, ANIM_OscillateDown, - ANIM_DiscreteFrames + ANIM_Random }; void SetSwitchTime (DWORD mstime); @@ -423,14 +424,14 @@ private: void InitBuildTiles (); // Animation stuff - void AddAnim (FAnimDef *anim); + FAnimDef *AddAnim (FAnimDef *anim); void FixAnimations (); void InitAnimated (); void InitAnimDefs (); - void AddSimpleAnim (FTextureID picnum, int animcount, int animtype, DWORD speedmin, DWORD speedrange=0); - void AddComplexAnim (FTextureID picnum, const TArray &frames); + FAnimDef *AddSimpleAnim (FTextureID picnum, int animcount, DWORD speedmin, DWORD speedrange=0); + FAnimDef *AddComplexAnim (FTextureID picnum, const TArray &frames); void ParseAnim (FScanner &sc, int usetype); - void ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing); + FAnimDef *ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing); void ParsePicAnim (FScanner &sc, FTextureID picnum, int usetype, bool missing, TArray &frames); void ParseWarp(FScanner &sc); void ParseCameraTexture(FScanner &sc); From 7dbabb5ee79afbf91ea4117d35d3b7d7acab6945 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 21 Mar 2015 13:08:08 +0100 Subject: [PATCH 03/38] - missed a NULL pointer check. --- src/textures/animations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index 446f6f35a..684869cf0 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -468,7 +468,7 @@ FAnimDef *FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int swapvalues (framenum, picnum); } FAnimDef *ani = AddSimpleAnim (picnum, framenum - picnum + 1, min, max - min); - ani->AnimType = type; + if (ani != NULL) ani->AnimType = type; return ani; } From 86e1d3ed9aee3849fc464802605c06144830c042 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 23 Mar 2015 17:01:49 -0500 Subject: [PATCH 04/38] Improve default IWAD search paths for Unix - /usr/share/doom and /usr/share/games/doom are better default paths than /usr/local/share --- src/gameconfigfile.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 061c6a314..deb870774 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -138,7 +138,13 @@ FGameConfigFile::FGameConfigFile () SetValueForKey ("Path", "$PROGDIR", true); #else SetValueForKey ("Path", "~/" GAME_DIR, true); - SetValueForKey ("Path", SHARE_DIR, true); + // Arch Linux likes them in /usr/share/doom + // Debian likes them in /usr/share/games/doom + // I assume other distributions don't do anything radically different + SetValueForKey ("Path", "/usr/local/share/doom", true); + SetValueForKey ("Path", "/usr/local/share/games/doom", true); + SetValueForKey ("Path", "/usr/share/doom", true); + SetValueForKey ("Path", "/usr/share/games/doom", true); #endif } @@ -166,24 +172,24 @@ FGameConfigFile::FGameConfigFile () CreateSectionAtStart("Harmony.Autoload"); CreateSectionAtStart("UrbanBrawl.Autoload"); CreateSectionAtStart("Chex3.Autoload"); - CreateSectionAtStart("Chex1.Autoload"); + CreateSectionAtStart("Chex1.Autoload"); CreateSectionAtStart("Chex.Autoload"); CreateSectionAtStart("Strife.Autoload"); CreateSectionAtStart("HexenDK.Autoload"); CreateSectionAtStart("Hexen.Autoload"); - CreateSectionAtStart("HereticSR.Autoload"); + CreateSectionAtStart("HereticSR.Autoload"); CreateSectionAtStart("Heretic.Autoload"); CreateSectionAtStart("FreeDM.Autoload"); - CreateSectionAtStart("Freedoom2.Autoload"); + CreateSectionAtStart("Freedoom2.Autoload"); CreateSectionAtStart("Freedoom1.Autoload"); CreateSectionAtStart("Freedoom.Autoload"); CreateSectionAtStart("Plutonia.Autoload"); CreateSectionAtStart("TNT.Autoload"); - CreateSectionAtStart("Doom2BFG.Autoload"); + CreateSectionAtStart("Doom2BFG.Autoload"); CreateSectionAtStart("Doom2.Autoload"); - CreateSectionAtStart("DoomBFG.Autoload"); - CreateSectionAtStart("DoomU.Autoload"); - CreateSectionAtStart("Doom1.Autoload"); + CreateSectionAtStart("DoomBFG.Autoload"); + CreateSectionAtStart("DoomU.Autoload"); + CreateSectionAtStart("Doom1.Autoload"); CreateSectionAtStart("Doom.Autoload"); CreateSectionAtStart("Global.Autoload"); From 44f9f2bbd626c3dea4a51b2fb04ba497e678d0ee Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 23 Mar 2015 21:51:33 -0400 Subject: [PATCH 05/38] - Fixed: Default movedown bind was set to "insert" and not "ins". --- src/c_bind.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c_bind.cpp b/src/c_bind.cpp index 66ed14ca5..1a62469bc 100644 --- a/src/c_bind.cpp +++ b/src/c_bind.cpp @@ -130,7 +130,7 @@ static const FBinding DefBindings[] = static const FBinding DefRavenBindings[] = { { "pgup", "+moveup" }, - { "insert", "+movedown" }, + { "ins", "+movedown" }, { "home", "land" }, { "pgdn", "+lookup" }, { "del", "+lookdown" }, From b958e930cf69c7db47e257a66987a8b1d6899f16 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 23 Mar 2015 23:28:18 -0400 Subject: [PATCH 06/38] - Cleared developer warnings with modern (3.0+) versions of CMake. --- CMakeLists.txt | 23 ++++++++++++++--------- CreateLaunchers.cmake | 4 +++- gdtoa/CMakeLists.txt | 9 ++------- src/CMakeLists.txt | 11 +++-------- tools/updaterevision/CMakeLists.txt | 3 +-- 5 files changed, 23 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65e2d223f..c39a492e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required( VERSION 2.4 ) project(ZDoom) +if( COMMAND cmake_policy ) + cmake_policy( SET CMP0011 NEW ) + cmake_policy( SET CMP0054 NEW ) +endif( COMMAND cmake_policy ) + list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ) include( CreateLaunchers ) include( FindPackageHandleStandardArgs ) @@ -26,8 +31,6 @@ endif(CMAKE_CROSSCOMPILING) # Simplify pk3 building, add_pk3(filename srcdirectory) function( add_pk3 PK3_NAME PK3_DIR ) - get_target_property(ZIPDIR_EXE zipdir LOCATION) - # Generate target name. Just use "pk3" for main pk3 target. string( REPLACE "." "_" PK3_TARGET ${PK3_NAME} ) if( ${PK3_TARGET} STREQUAL "zdoom_pk3" ) @@ -36,20 +39,22 @@ function( add_pk3 PK3_NAME PK3_DIR ) if( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE ) add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} - COMMAND ${ZIPDIR_EXE} -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR} + COMMAND zipdir -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} $/${PK3_NAME} DEPENDS zipdir ) else( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE ) add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} - COMMAND ${ZIPDIR_EXE} -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR} + COMMAND zipdir -udf ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ${PK3_DIR} DEPENDS zipdir ) endif( NOT NO_GENERATOR_EXPRESSIONS AND NOT ZDOOM_OUTPUT_OLDSTYLE ) - # Touch the zipdir executable here so that the pk3s are forced to rebuild - # each time since their dependecy has "changed." - add_custom_target( ${PK3_TARGET} ALL - COMMAND ${CMAKE_COMMAND} -E touch ${ZIPDIR_EXE} - DEPENDS ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ) + if( NOT NO_GENERATOR_EXPRESSIONS ) + # Touch the zipdir executable here so that the pk3s are forced to + # rebuild each time since their dependecy has "changed." + add_custom_target( ${PK3_TARGET} ALL + COMMAND ${CMAKE_COMMAND} -E touch $ + DEPENDS ${ZDOOM_OUTPUT_DIR}/${PK3_NAME} ) + endif( NOT NO_GENERATOR_EXPRESSIONS ) endfunction( add_pk3 ) # Macro for building libraries without debugging information diff --git a/CreateLaunchers.cmake b/CreateLaunchers.cmake index 8acca1c17..83cc08b44 100644 --- a/CreateLaunchers.cmake +++ b/CreateLaunchers.cmake @@ -44,6 +44,8 @@ if(__create_launchers) endif() set(__create_launchers YES) +cmake_policy( SET CMP0026 OLD ) + include(CleanDirectoryList) # We must run the following at "include" time, not at function call time, @@ -184,7 +186,7 @@ macro(_launcher_process_args) set(USERFILE_ENV_COMMANDS) foreach(_arg "${RUNTIME_LIBRARIES_ENVIRONMENT}" ${ENVIRONMENT}) string(CONFIGURE - "@USERFILE_ENVIRONMENT@@LAUNCHER_LINESEP@@_arg@" + "${USERFILE_ENVIRONMENT}${LAUNCHER_LINESEP}${_arg}" USERFILE_ENVIRONMENT @ONLY) string(CONFIGURE diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index 9ec7c2f61..766795e13 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -19,18 +19,16 @@ if( NOT MSVC AND NOT APPLE ) if( NOT CMAKE_CROSSCOMPILING ) add_executable( arithchk arithchk.c ) endif( NOT CMAKE_CROSSCOMPILING ) - get_target_property( ARITHCHK_EXE arithchk LOCATION ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h - COMMAND ${ARITHCHK_EXE} >${CMAKE_CURRENT_BINARY_DIR}/arith.h + COMMAND arithchk >${CMAKE_CURRENT_BINARY_DIR}/arith.h DEPENDS arithchk ) if( NOT CMAKE_CROSSCOMPILING ) add_executable( qnan qnan.c arith.h ) set( CROSS_EXPORTS ${CROSS_EXPORTS} arithchk qnan PARENT_SCOPE ) endif( NOT CMAKE_CROSSCOMPILING ) - get_target_property( QNAN_EXE qnan LOCATION ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h - COMMAND ${QNAN_EXE} >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h + COMMAND qnan >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h DEPENDS qnan ) set( GEN_FP_FILES arith.h gd_qnan.h ) @@ -44,7 +42,4 @@ add_library( gdtoa misc.c ) target_link_libraries( gdtoa ) -if( GEN_FP_DEPS ) - add_dependencies( gdtoa ${GEN_FP_DEPS} ) -endif( GEN_FP_DEPS ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9a327bf3..ea8ebcb85 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -504,10 +504,8 @@ endif( BACKPATCH ) # Update gitinfo.h -get_target_property( UPDATEREVISION_EXE updaterevision LOCATION ) - add_custom_target( revision_check ALL - COMMAND ${UPDATEREVISION_EXE} src/gitinfo.h + COMMAND updaterevision src/gitinfo.h WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} DEPENDS updaterevision ) @@ -627,17 +625,14 @@ else( NO_ASM ) endif( X64 ) endif( NO_ASM ) -get_target_property( LEMON_EXE lemon LOCATION ) -get_target_property( RE2C_EXE re2c LOCATION ) - add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.h COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/xlat/xlat_parser.y . - COMMAND ${LEMON_EXE} xlat_parser.y + COMMAND lemon xlat_parser.y WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS lemon ${CMAKE_CURRENT_SOURCE_DIR}/xlat/xlat_parser.y ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h - COMMAND ${RE2C_EXE} --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re + COMMAND re2c --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re DEPENDS re2c ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/tools/updaterevision/CMakeLists.txt b/tools/updaterevision/CMakeLists.txt index 9e814a7d7..8837dd494 100644 --- a/tools/updaterevision/CMakeLists.txt +++ b/tools/updaterevision/CMakeLists.txt @@ -25,8 +25,7 @@ if( NOT CMAKE_CROSSCOMPILING ) endif( NOT CMAKE_CROSSCOMPILING ) if( MT_MERGE ) - get_target_property( UPDATEREVISION_EXE updaterevision LOCATION ) add_custom_command(TARGET updaterevision POST_BUILD - COMMAND mt -inputresource:${UPDATEREVISION_EXE} -manifest ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.txt -outputresource:${UPDATEREVISION_EXE} -nologo + COMMAND mt -inputresource:$ -manifest ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.txt -outputresource:$ -nologo COMMENT "Embedding trustinfo into updaterevision" ) endif( MT_MERGE ) From e29b8b2094c0aab57a63801bf2bb55a4e8205f4a Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Tue, 24 Mar 2015 00:02:25 -0400 Subject: [PATCH 07/38] - Fixed: QuakeEx ACS function didn't handle fixed->double conversion. --- src/p_acs.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 19d64d5ec..2bbbc944a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5700,10 +5700,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) case ACSF_QuakeEx: { return P_StartQuakeXYZ(activator, args[0], args[1], args[2], args[3], args[4], args[5], args[6], FBehavior::StaticLookupString(args[7]), - argCount > 8 && args[8] ? args[8] : 0, - argCount > 9 && args[9] ? args[9] : 1, - argCount > 10 && args[10] ? args[10] : 1, - argCount > 11 && args[11] ? args[11] : 1 ); + argCount > 8 ? args[8] : 0, + argCount > 9 ? FIXED2DBL(args[9]) : 1.0, + argCount > 10 ? FIXED2DBL(args[10]) : 1.0, + argCount > 11 ? FIXED2DBL(args[11]) : 1.0 ); } case ACSF_SetLineActivation: From 7b6d245444d13b99b277373c5d61b69184768a0e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 24 Mar 2015 09:22:51 +0100 Subject: [PATCH 08/38] - added NULL pointer checks to A_CheckStaff. --- src/g_hexen/a_clericstaff.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index ecce09d34..45551f55f 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -83,7 +83,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) { pmo->health = player->health = newLife; } - P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain")); + if (weapon != NULL) + { + FState * newstate = weapon->FindState("Drain"); + if (newstate != NULL) P_SetPsprite(player, ps_weapon, newstate); + } } if (weapon != NULL) { From 890fb39d25023aca7651c15f6ea46121ff842940 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Tue, 24 Mar 2015 18:28:59 -0400 Subject: [PATCH 09/38] - Apparently cmake_policy doesn't ignore unknown policies (which seems to defeat the purpose to me) so we must wrap them in code to detect if the policy is known. --- CMakeLists.txt | 8 ++++++-- CreateLaunchers.cmake | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c39a492e6..e3ee74d55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,12 @@ cmake_minimum_required( VERSION 2.4 ) project(ZDoom) if( COMMAND cmake_policy ) - cmake_policy( SET CMP0011 NEW ) - cmake_policy( SET CMP0054 NEW ) + if( POLICY CMP0011 ) + cmake_policy( SET CMP0011 NEW ) + endif( POLICY CMP0011 ) + if( POLICY CMP0054 ) + cmake_policy( SET CMP0054 NEW ) + endif( POLICY CMP0054 ) endif( COMMAND cmake_policy ) list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/CreateLaunchers.cmake b/CreateLaunchers.cmake index 83cc08b44..bd2b3e473 100644 --- a/CreateLaunchers.cmake +++ b/CreateLaunchers.cmake @@ -44,7 +44,9 @@ if(__create_launchers) endif() set(__create_launchers YES) -cmake_policy( SET CMP0026 OLD ) +if( POLICY CMP0026 ) + cmake_policy( SET CMP0026 OLD ) +endif( POLICY CMP0026 ) include(CleanDirectoryList) From f161c0c501622af829dbd505d5927b3370468f3d Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 25 Mar 2015 14:19:50 -0500 Subject: [PATCH 10/38] - Fixed: Projectile impacts never called P_DamageMobj when damage was 0 without the CAUSEPAIN flag. --- src/p_interaction.cpp | 12 ++++++------ src/p_map.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index d9d7971ca..7593b55b5 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -925,9 +925,9 @@ static inline bool MustForcePain(AActor *target, AActor *inflictor) (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS)); } -static inline bool isFakePain(AActor *target, AActor *inflictor) +static inline bool isFakePain(AActor *target, AActor *inflictor, int damage) { - return ((target->flags7 & MF7_ALLOWPAIN) || ((inflictor != NULL) && (inflictor->flags7 & MF7_CAUSEPAIN))); + return ((target->flags7 & MF7_ALLOWPAIN && damage > 0) || ((inflictor != NULL) && (inflictor->flags7 & MF7_CAUSEPAIN))); } @@ -956,7 +956,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } //Rather than unnecessarily call the function over and over again, let's be a little more efficient. - fakedPain = (isFakePain(target, inflictor)); + fakedPain = (isFakePain(target, inflictor, damage)); forcedPain = (MustForcePain(target, inflictor)); // Spectral targets only take damage from spectral projectiles. @@ -1453,8 +1453,8 @@ fakepain: //Needed so we can skip the rest of the above, but still obey the orig //CAUSEPAIN can always attempt to trigger the chances of pain. //ALLOWPAIN can do the same, only if the (unfiltered aka fake) damage is greater than 0. - if ((((target->flags7 & MF7_ALLOWPAIN) && (fakeDamage > 0)) - || ((inflictor != NULL) && (inflictor->flags7 & MF7_CAUSEPAIN)))) + if (((target->flags7 & MF7_ALLOWPAIN) && (fakeDamage > 0)) + || ((inflictor != NULL) && (inflictor->flags7 & MF7_CAUSEPAIN))) { holdDamage = damage; //Store the modified damage away after factors are taken into account. damage = fakeDamage; //Retrieve the original damage. @@ -1474,7 +1474,7 @@ fakepain: //Needed so we can skip the rest of the above, but still obey the orig } } - if ((((damage >= target->PainThreshold)) && (pr_damagemobj() < painchance)) + if ((((damage >= target->PainThreshold) || (fakedPain)) && (pr_damagemobj() < painchance)) || (inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN))) { dopain: diff --git a/src/p_map.cpp b/src/p_map.cpp index fa13274ef..8c6c24828 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1288,7 +1288,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) // Do damage damage = tm.thing->GetMissileDamage((tm.thing->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1); - if ((damage > 0) || (tm.thing->flags6 & MF6_FORCEPAIN)) + if ((damage > 0) || (tm.thing->flags6 & MF6_FORCEPAIN) || (tm.thing->flags7 & MF7_CAUSEPAIN)) { int newdam = P_DamageMobj(thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType); if (damage > 0) From d45d45583bcda1469ac7af07f68060a9a5cb161a Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 25 Mar 2015 14:27:12 -0500 Subject: [PATCH 11/38] Take PainThresholds into account. --- src/p_interaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 7593b55b5..ec3947cc0 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1474,7 +1474,7 @@ fakepain: //Needed so we can skip the rest of the above, but still obey the orig } } - if ((((damage >= target->PainThreshold) || (fakedPain)) && (pr_damagemobj() < painchance)) + if (((damage >= target->PainThreshold) && (pr_damagemobj() < painchance)) || (inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN))) { dopain: From d1a972ff3d25d54fd9432d362d5e8cf1f96e3f53 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 25 Mar 2015 20:33:24 +0100 Subject: [PATCH 12/38] - fixed: The recent ANIMDEFS extension missed adjusting the call to AddSimpleAnim for ANIMATED-defined animations. --- src/textures/animations.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index 684869cf0..ffff062c6 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -253,7 +253,8 @@ void FTextureManager::InitAnimated (void) } // Speed is stored as tics, but we want ms so scale accordingly. - AddSimpleAnim (pic1, pic2 - pic1 + 1, animtype, Scale (animspeed, 1000, 35)); + FAnimDef *adef = AddSimpleAnim (pic1, pic2 - pic1 + 1, Scale (animspeed, 1000, 35)); + if (adef != NULL) adef->AnimType = animtype; } } } From 66b090cd44df7626a71de4d5bcc15c8645e5eb8e Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Wed, 25 Mar 2015 22:25:00 +0100 Subject: [PATCH 13/38] - Improvements to some of the actor debug CCMDs. - 'monster' and 'items' can now filter the list if an argument is passed (like with 'kill'); - added 'countitems', which will show only the 'count items' in the current map, with the same filter parameter as 'monster' and 'items'. - reorganize the code to reduce the duplication. --- src/c_cmds.cpp | 78 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 5fc7f0fd8..778f25be1 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -889,21 +889,42 @@ CCMD(info) "the NOBLOCKMAP flag or have height/radius of 0.\n"); } -//----------------------------------------------------------------------------- -// -// -// -//----------------------------------------------------------------------------- -CCMD(monster) -{ - AActor * mo; +typedef bool (*ActorTypeChecker) (AActor *); - if (CheckCheatmode ()) return; +static bool IsActorAMonster(AActor *mo) +{ + return mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY); +} + +static bool IsActorAnItem(AActor *mo) +{ + return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL; +} + +static bool IsActorACountItem(AActor *mo) +{ + return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM; +} + +static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName) +{ + AActor *mo; + const PClass *FilterClass = NULL; + + if (FilterName != NULL) + { + FilterClass = PClass::FindClass(FilterName); + if (FilterClass == NULL || FilterClass->ActorInfo == NULL) + { + Printf("%s is not an actor class.\n", FilterName); + return; + } + } TThinkerIterator it; while ( (mo = it.Next()) ) { - if (mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY)) + if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo)) { Printf ("%s at (%d,%d,%d)\n", mo->GetClass()->TypeName.GetChars(), @@ -912,6 +933,18 @@ CCMD(monster) } } +//----------------------------------------------------------------------------- +// +// +// +//----------------------------------------------------------------------------- +CCMD(monster) +{ + if (CheckCheatmode ()) return; + + PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL); +} + //----------------------------------------------------------------------------- // // @@ -919,20 +952,21 @@ CCMD(monster) //----------------------------------------------------------------------------- CCMD(items) { - AActor * mo; - if (CheckCheatmode ()) return; - TThinkerIterator it; - while ( (mo = it.Next()) ) - { - if (mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL) - { - Printf ("%s at (%d,%d,%d)\n", - mo->GetClass()->TypeName.GetChars(), - mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS); - } - } + PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL); +} + +//----------------------------------------------------------------------------- +// +// +// +//----------------------------------------------------------------------------- +CCMD(countitems) +{ + if (CheckCheatmode ()) return; + + PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL); } //----------------------------------------------------------------------------- From 2c978bc6f72d738d6e06988c09af0e19e82963ee Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Thu, 26 Mar 2015 23:38:09 +1300 Subject: [PATCH 14/38] Change hashfiles filename string to a cstr - It seems some compilers don't like passing FNames to Printf, and this might as well be a cstr anyway. --- src/d_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 6491dc3e3..8b9e54680 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2223,7 +2223,7 @@ void D_DoomMain (void) if (Args->CheckParm("-hashfiles")) { - FString filename = "fileinfo.txt"; + const char *filename = "fileinfo.txt"; Printf("Hashing loaded content to: %s\n", filename); hashfile = fopen(filename, "w"); if (hashfile) From 32a55c9229d4604f4f931bfae73dde8ab36f7c65 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 26 Mar 2015 20:43:29 -0500 Subject: [PATCH 15/38] Revert "- Fixed: A_Die didn't consider missiles for the function." This reverts commit 5977cb04d9d24265b823168ccbb663e9ff9c65a2. - It breaks at least one mod (Complex Doom) and who knows how many others. Considering how long A_Die has been around, a random "fix" like this is probably not a good idea. [P.S. Missiles have health and can be damaged by P_DamageMob, so it's not like it never did anything on missiles.] --- src/p_enemy.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 55b49b65e..be0646d4b 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3203,10 +3203,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Die) ACTION_PARAM_START(1); ACTION_PARAM_NAME(damagetype, 0); - if (self->flags & MF_MISSILE) - P_ExplodeMissile(self, NULL, NULL); - else - P_DamageMobj (self, NULL, NULL, self->health, damagetype, DMG_FORCED); + P_DamageMobj (self, NULL, NULL, self->health, damagetype, DMG_FORCED); } // From 93c7f4b4b5cfa8baf1a8699b5201b41e045861f7 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 26 Mar 2015 21:46:14 -0500 Subject: [PATCH 16/38] Don't accelerate BOOM colormaped player sprites - Fixed: Player weapons ignored BOOM colormaps when accelerated. --- src/r_things.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/r_things.cpp b/src/r_things.cpp index 515364970..8e53fb6d1 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1359,6 +1359,11 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ { noaccel = true; } + // If drawing with a BOOM colormap, disable acceleration. + if (mybasecolormap == &NormalLight && NormalLight.Maps != realcolormaps) + { + noaccel = true; + } // If the main colormap has fixed lights, and this sprite is being drawn with that // colormap, disable acceleration so that the lights can remain fixed. if (!noaccel && realfixedcolormap == NULL && From ee9f64427c608ed3283caea97b46b6f2a83e6c61 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 26 Mar 2015 22:01:57 -0500 Subject: [PATCH 17/38] Add wad name to mapchecksum output --- src/compatibility.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index da4ab4945..fd309ec8b 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -595,12 +595,13 @@ CCMD (mapchecksum) else { map->GetChecksum(cksum); + const char *wadname = Wads.GetWadName(Wads.GetLumpFile(map->lumpnum)); delete map; for (size_t j = 0; j < sizeof(cksum); ++j) { Printf("%02X", cksum[j]); } - Printf(" // %s\n", argv[i]); + Printf(" // %s %s\n", wadname, argv[i]); } } } From 9cd6aae902ae9c571dd871c3d2907553bf58ae12 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 26 Mar 2015 22:02:10 -0500 Subject: [PATCH 18/38] Added Archvile ghosts compatibility flags for some more maps --- wadsrc/static/compatibility.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 152e55825..3a675f275 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -124,6 +124,14 @@ BA530202AF0BA0C6CBAE6A0C7076FB72 // Requiem map04 3CA5493FEFF2E27BFD4181E6C4A3C2BF // The Waterfront map01 CBDFEFAC579A62DE8F1B48CA4A09D381 // gather2.wad map05 and darkside.wad map01 C7A2FAFB0AFB2632C50AD625CDB50E51 // Reverie map18 +9E5724BC6135AA6F86EE54FD4D91F1E2 // Project X map14 +6DA6FCBA8089161BDEC6A1D3F6C8D60F // Eternal Doom map25 +01899825FFEAE016D39C02A7DA4B218F // Archie map01 +1D9F3AFDC2517C2E450491ED13896712 // Seej map01 +0AE745A3AB86D15FB2FB74489962C421 // 6pack2 map02 +2EA635C6B6AEC76B6BC77448DAB22F9A // Squadron 417 map21 +1E998262EE319B7D088E01DE782E6B41 // Mayhem 2013 map05 +A81E2734F735A82720D8E0F1442BA0C9 // Imp's [sic] are Ghost Gods map01 { corpsegibs vileghosts From 3463b878763c7fd036f263a0d9501773c2f8cc0a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 26 Mar 2015 23:19:05 -0500 Subject: [PATCH 19/38] Fixed: MUSINFO was not multiplayer-aware - Move MUSINFO change request out of FLevelLocals and into player_t. This allows the MusicChanger actors to change music for each player independantly. This is similar to PrBoom+, which switches depending on the displayplayer. The difference being, we don't actually track the music other players are listening to. (Which might not be a bad idea to implement at some point.) - Moved a few fields in player_t for better packing. --- src/d_player.h | 11 +++++++---- src/g_level.cpp | 4 +++- src/g_level.h | 1 - src/p_mobj.cpp | 3 ++- src/p_user.cpp | 36 +++++++++++++++++++++++++++++++++++- src/s_advsound.cpp | 43 ++++++++++--------------------------------- src/version.h | 2 +- 7 files changed, 58 insertions(+), 42 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index e5644e8cb..e27bf1087 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -443,10 +443,15 @@ public: FName LastDamageType; // [RH] For damage-specific pain and death sounds - //Added by MC: - TObjPtr Bot; + TObjPtr MUSINFOactor; // For MUSINFO purposes + SBYTE MUSINFOtics; bool settings_controller; // Player can control game settings. + SBYTE crouching; + SBYTE crouchdir; + + //Added by MC: + TObjPtr Bot; float BlendR; // [RH] Final blending values float BlendG; @@ -458,8 +463,6 @@ public: int MinPitch; // Viewpitch limits (negative is up, positive is down) int MaxPitch; - SBYTE crouching; - SBYTE crouchdir; fixed_t crouchfactor; fixed_t crouchoffset; fixed_t crouchviewdelta; diff --git a/src/g_level.cpp b/src/g_level.cpp index 60609050a..fd6d8049a 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1457,7 +1457,9 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) if (SaveVersion >= 3313) { - arc << level.nextmusic; + // This is a player property now + int nextmusic; + arc << nextmusic; } // Hub transitions must keep the current total time diff --git a/src/g_level.h b/src/g_level.h index 6e07b0c74..8a4702639 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -412,7 +412,6 @@ struct FLevelLocals int musicorder; int cdtrack; unsigned int cdid; - int nextmusic; // For MUSINFO purposes FTextureID skytexture1; FTextureID skytexture2; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 608ecb407..9102c0472 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4480,7 +4480,8 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) p->mo->ResetAirSupply(false); p->Uncrouch(); p->MinPitch = p->MaxPitch = 0; // will be filled in by PostBeginPlay()/netcode - + p->MUSINFOactor = NULL; + p->MUSINFOtics = -1; p->velx = p->vely = 0; // killough 10/98: initialize bobbing to 0. diff --git a/src/p_user.cpp b/src/p_user.cpp index 4d05d2660..6042d5662 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -309,7 +309,9 @@ player_t::player_t() ConversationNPC(0), ConversationPC(0), ConversationNPCAngle(0), - ConversationFaceTalker(0) + ConversationFaceTalker(0), + MUSINFOactor(0), + MUSINFOtics(-1) { memset (&cmd, 0, sizeof(cmd)); memset (frags, 0, sizeof(frags)); @@ -400,6 +402,8 @@ player_t &player_t::operator=(const player_t &p) ConversationPC = p.ConversationPC; ConversationNPCAngle = p.ConversationNPCAngle; ConversationFaceTalker = p.ConversationFaceTalker; + MUSINFOactor = p.MUSINFOactor; + MUSINFOtics = p.MUSINFOtics; return *this; } @@ -430,6 +434,7 @@ size_t player_t::FixPointers (const DObject *old, DObject *rep) if (*&PremorphWeapon == old) PremorphWeapon = static_cast(rep), changed++; if (*&ConversationNPC == old) ConversationNPC = replacement, changed++; if (*&ConversationPC == old) ConversationPC = replacement, changed++; + if (*&MUSINFOactor == old) MUSINFOactor = replacement, changed++; return changed; } @@ -443,6 +448,7 @@ size_t player_t::PropagateMark() GC::Mark(ReadyWeapon); GC::Mark(ConversationNPC); GC::Mark(ConversationPC); + GC::Mark(MUSINFOactor); GC::Mark(PremorphWeapon); if (PendingWeapon != WP_NOCHANGE) { @@ -2331,6 +2337,30 @@ void P_PlayerThink (player_t *player) player->crouchoffset = -FixedMul(player->mo->ViewHeight, (FRACUNIT - player->crouchfactor)); + // MUSINFO stuff + if (player->MUSINFOtics >= 0 && player->MUSINFOactor != NULL) + { + if (--player->MUSINFOtics < 0) + { + if (player - players == consoleplayer) + { + if (player->MUSINFOactor->args[0] != 0) + { + FName *music = level.info->MusicMap.CheckKey(player->MUSINFOactor->args[0]); + + if (music != NULL) + { + S_ChangeMusic(music->GetChars(), player->MUSINFOactor->args[1]); + } + } + else + { + S_ChangeMusic("*"); + } + } + DPrintf("MUSINFO change for player %d to %d\n", (int)(player - players), player->MUSINFOactor->args[0]); + } + } if (player->playerstate == PST_DEAD) { @@ -3105,6 +3135,10 @@ void player_t::Serialize (FArchive &arc) { userinfo.SkinChanged(skinname, CurrentPlayerClass); } + if (SaveVersion >= 4522) + { + arc << MUSINFOactor << MUSINFOtics; + } } diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index f7a40da9b..60a6730f6 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -2348,7 +2348,6 @@ class AMusicChanger : public ASectorAction DECLARE_CLASS (AMusicChanger, ASectorAction) public: virtual bool DoTriggerAction (AActor *triggerer, int activationType); - virtual void Tick(); virtual void PostBeginPlay(); }; @@ -2356,49 +2355,27 @@ IMPLEMENT_CLASS(AMusicChanger) bool AMusicChanger::DoTriggerAction (AActor *triggerer, int activationType) { - if (activationType & SECSPAC_Enter) + if (activationType & SECSPAC_Enter && triggerer->player != NULL) { - if (args[0] == 0 || level.info->MusicMap.CheckKey(args[0])) - { - level.nextmusic = args[0]; - reactiontime = 30; + if (triggerer->player->MUSINFOactor != this) + { + triggerer->player->MUSINFOactor = this; + triggerer->player->MUSINFOtics = 30; } } return Super::DoTriggerAction (triggerer, activationType); } -void AMusicChanger::Tick() -{ - Super::Tick(); - if (reactiontime > -1 && --reactiontime == 0) - { - // Is it our music that's queued for being played? - if (level.nextmusic == args[0]) - { - if (args[0] != 0) - { - FName *music = level.info->MusicMap.CheckKey(args[0]); - - if (music != NULL) - { - S_ChangeMusic(music->GetChars(), args[1]); - } - } - else - { - S_ChangeMusic("*"); - } - } - } - } - void AMusicChanger::PostBeginPlay() { // The music changer should consider itself activated if the player // spawns in its sector as well as if it enters the sector during a P_TryMove. Super::PostBeginPlay(); - if (players[consoleplayer].mo && players[consoleplayer].mo->Sector == this->Sector) + for (int i = 0; i < MAXPLAYERS; ++i) { - TriggerAction(players[consoleplayer].mo, SECSPAC_Enter); + if (playeringame[i] && players[i].mo && players[i].mo->Sector == this->Sector) + { + TriggerAction(players[i].mo, SECSPAC_Enter); + } } } diff --git a/src/version.h b/src/version.h index de33e93a7..7f6d9cedd 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4521 +#define SAVEVER 4522 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) From 5d27bf77426c9a0658e9da6e61019861bc22a0c7 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 27 Mar 2015 00:25:53 -0500 Subject: [PATCH 20/38] Add Windows 8+ related bits to the manifest --- src/win32/i_system.cpp | 39 +++++++++++++----------------------- src/win32/zdoom.exe.manifest | 19 ++++++++++++++++++ zdoom.vcproj | 20 ++++++++++-------- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 71cc42af0..2dabe7de9 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -561,37 +561,26 @@ void I_DetectOS(void) { if (info.dwMinorVersion == 0) { - if (info.wProductType == VER_NT_WORKSTATION) - { - osname = "Vista"; - } - else - { - osname = "Server 2008"; - } + osname = (info.wProductType == VER_NT_WORKSTATION) ? "Vista" : "Server 2008"; } else if (info.dwMinorVersion == 1) { - if (info.wProductType == VER_NT_WORKSTATION) - { - osname = "7"; - } - else - { - osname = "Server 2008 R2"; - } + osname = (info.wProductType == VER_NT_WORKSTATION) ? "7" : "Server 2008 R2"; } else if (info.dwMinorVersion == 2) { - // Microsoft broke this API for 8.1 so without jumping through hoops it won't be possible anymore to detect never versions aside from the build number, especially for older compilers. - if (info.wProductType == VER_NT_WORKSTATION) - { - osname = "8 (or higher)"; - } - else - { - osname = "Server 2012 (or higher)"; - } + // Starting with Windows 8.1, you need to specify in your manifest + // the highest version of Windows you support, which will also be the + // highest version of Windows this function returns. + osname = (info.wProductType == VER_NT_WORKSTATION) ? "8" : "Server 2012"; + } + else if (info.dwMinorVersion == 3) + { + osname = (info.wProductType == VER_NT_WORKSTATION) ? "8.1" : "Server 2012 R2"; + } + else if (info.dwMinorVersion == 4) + { + osname = (info.wProductType == VER_NT_WORKSTATION) ? "10 (or higher)" : "Server 10 (or higher)"; } } break; diff --git a/src/win32/zdoom.exe.manifest b/src/win32/zdoom.exe.manifest index 4aee7a96c..0d2074069 100644 --- a/src/win32/zdoom.exe.manifest +++ b/src/win32/zdoom.exe.manifest @@ -5,4 +5,23 @@ + + + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zdoom.vcproj b/zdoom.vcproj index 21aaccb8e..a6a94cafe 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -117,6 +117,7 @@ /> @@ -233,6 +234,7 @@ /> + + + + @@ -2632,14 +2644,6 @@ RelativePath=".\src\oplsynth\opl_mus_player.h" > - - - - From 66c3c93529bd9ba0290cb984bc29998a005755c9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 09:03:44 +0100 Subject: [PATCH 21/38] - call TakeSpecialDamage, even if damage is 0, just like it was in older versions. --- src/p_interaction.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index ec3947cc0..74278153d 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1129,8 +1129,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } } - if (damage > 0) - damage = target->TakeSpecialDamage (inflictor, source, damage, mod); + damage = target->TakeSpecialDamage (inflictor, source, damage, mod); } if (damage == -1 && target->player == NULL) //Make sure it's not a player, the pain has yet to be processed with cheats. { From c78fdae31d4f80e2733286090eae79daa5138951 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 09:25:26 +0100 Subject: [PATCH 22/38] - beautification of A_BFGSpray. Reordered checks so that only one 'spray != NULL' is needed, removed redundant thingToHit variable and reformatted slightly. --- src/g_doom/a_doomweaps.cpp | 63 +++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 05e1677c6..6dbf3d1ec 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -584,7 +584,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) int j; int damage; angle_t an; - AActor *thingToHit; AActor *linetarget; ACTION_PARAM_START(7); @@ -615,42 +614,42 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) // self->target is the originator (player) of the missile P_AimLineAttack(self->target, an, distance, &linetarget, vrange); - if (!linetarget) - continue; - - AActor *spray = Spawn(spraytype, linetarget->x, linetarget->y, - linetarget->z + (linetarget->height >> 2), ALLOW_REPLACE); - - if (spray) + if (linetarget != NULL) { - if (spray->flags6 & MF6_MTHRUSPECIES && spray->GetSpecies() == linetarget->GetSpecies()) + AActor *spray = Spawn(spraytype, linetarget->x, linetarget->y, + linetarget->z + (linetarget->height >> 2), ALLOW_REPLACE); + + int dmgFlags = 0; + FName dmgType = NAME_BFGSplash; + + if (spray != NULL) { - spray->Destroy(); // [MC] Remove it because technically, the spray isn't trying to "hit" them. - continue; + if (spray->flags6 & MF6_MTHRUSPECIES && spray->GetSpecies() == linetarget->GetSpecies()) + { + spray->Destroy(); // [MC] Remove it because technically, the spray isn't trying to "hit" them. + continue; + } + if (spray->flags5 & MF5_PUFFGETSOWNER) spray->target = self->target; + if (spray->flags3 & MF3_FOILINVUL) dmgFlags |= DMG_FOILINVUL; + if (spray->flags7 & MF7_FOILBUDDHA) dmgFlags |= DMG_FOILBUDDHA; + dmgType = spray->DamageType; } - if (spray->flags5 & MF5_PUFFGETSOWNER) - spray->target = self->target; - } - if (defdamage == 0) - { - damage = 0; - for (j = 0; j < damagecnt; ++j) - damage += (pr_bfgspray() & 7) + 1; - } - else - { - // if this is used, damagecnt will be ignored - damage = defdamage; - } + if (defdamage == 0) + { + damage = 0; + for (j = 0; j < damagecnt; ++j) + damage += (pr_bfgspray() & 7) + 1; + } + else + { + // if this is used, damagecnt will be ignored + damage = defdamage; + } - int dmgFlagPass = 0; - dmgFlagPass += (spray != NULL && (spray->flags3 & MF3_FOILINVUL)) ? DMG_FOILINVUL : 0; //[MC]Because the original foilinvul wasn't working. - dmgFlagPass += (spray != NULL && (spray->flags7 & MF7_FOILBUDDHA)) ? DMG_FOILBUDDHA : 0; - thingToHit = linetarget; - int newdam = P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash), - dmgFlagPass); - P_TraceBleed (newdam > 0 ? newdam : damage, thingToHit, self->target); + int newdam = P_DamageMobj(linetarget, self->target, self->target, damage, dmgType, dmgFlags); + P_TraceBleed(newdam > 0 ? newdam : damage, linetarget, self->target); + } } } From 602f541e31551ba29c060f7e1dfab9b71c42cf10 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 09:40:47 +0100 Subject: [PATCH 23/38] - use '|', not '+' to combine flags. There's probably going to be more of these coming... --- src/thingdef/thingdef_codeptr.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index fc577afcd..e1a2c7f6a 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5234,17 +5234,17 @@ static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageTy { int dmgFlags = 0; if (flags & DMSS_FOILINVUL) - dmgFlags += DMG_FOILINVUL; + dmgFlags |= DMG_FOILINVUL; if (flags & DMSS_FOILBUDDHA) - dmgFlags += DMG_FOILBUDDHA; - if ((flags & DMSS_KILL) || (flags & DMSS_NOFACTOR)) //Kill implies NoFactor - dmgFlags += DMG_NO_FACTOR; + dmgFlags |= DMG_FOILBUDDHA; + if (flags & (DMSS_KILL | DMSS_NOFACTOR)) //Kill implies NoFactor + dmgFlags |= DMG_NO_FACTOR; if (!(flags & DMSS_AFFECTARMOR) || (flags & DMSS_KILL)) //Kill overrides AffectArmor - dmgFlags += DMG_NO_ARMOR; + dmgFlags |= DMG_NO_ARMOR; if (flags & DMSS_KILL) //Kill adds the value of the damage done to it. Allows for more controlled extreme death types. amount += dmgtarget->health; if (flags & DMSS_NOPROTECT) //Ignore PowerProtection. - dmgFlags += DMG_NO_PROTECT; + dmgFlags |= DMG_NO_PROTECT; if (amount > 0) P_DamageMobj(dmgtarget, self, self, amount, DamageType, dmgFlags); //Should wind up passing them through just fine. @@ -5412,12 +5412,12 @@ static void DoKill(AActor *killtarget, AActor *self, FName damagetype, int flags speciespass = DoCheckSpecies(killtarget, species, (flags & KILS_EXSPECIES) ? true : false); if ((flags & KILS_EITHER) ? (filterpass || speciespass) : (filterpass && speciespass)) //Check this first. I think it'll save the engine a lot more time this way. { - int dmgFlags = DMG_NO_ARMOR + DMG_NO_FACTOR; + int dmgFlags = DMG_NO_ARMOR | DMG_NO_FACTOR; if (KILS_FOILINVUL) - dmgFlags += DMG_FOILINVUL; + dmgFlags |= DMG_FOILINVUL; if (KILS_FOILBUDDHA) - dmgFlags += DMG_FOILBUDDHA; + dmgFlags |= DMG_FOILBUDDHA; if ((killtarget->flags & MF_MISSILE) && (flags & KILS_KILLMISSILES)) @@ -5426,7 +5426,8 @@ static void DoKill(AActor *killtarget, AActor *self, FName damagetype, int flags //Check to see if it's invulnerable. Disregarded if foilinvul is on, but never works on a missile with NODAMAGE //since that's the whole point of it. if ((!(killtarget->flags2 & MF2_INVULNERABLE) || (flags & KILS_FOILINVUL)) && - (!(killtarget->flags2 & MF7_BUDDHA) || (flags & KILS_FOILBUDDHA)) && !(killtarget->flags5 & MF5_NODAMAGE)) + (!(killtarget->flags2 & MF7_BUDDHA) || (flags & KILS_FOILBUDDHA)) && + !(killtarget->flags5 & MF5_NODAMAGE)) { P_ExplodeMissile(killtarget, NULL, NULL); } From 19cea0f626ddc40b2ecebbbb7bfca6a5e2a39748 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 09:57:33 +0100 Subject: [PATCH 24/38] - fixed: DoCheckSpecies got an actor's species by directly reading the 'species' variable, bypassing initialization in GetSpecies. - cleaned up DoCheckSpecies and DoCheckFilter which both contained several redundant checks and renamed DoCheckFilter to DoCheckClass. --- src/thingdef/thingdef_codeptr.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index e1a2c7f6a..934f4cc4c 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5186,15 +5186,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) ref->Speed = speed; } -static bool DoCheckSpecies(AActor *mo, FName species, bool exclude) +static bool DoCheckSpecies(AActor *mo, FName filterSpecies, bool exclude) { - return (!(species) || mo->Species == NAME_None || (species && ((exclude) ? (mo->Species != species) : (mo->Species == species)))); + FName actorSpecies = mo->GetSpecies(); + if (filterSpecies == NAME_None) return true; + return exclude ? (actorSpecies != filterSpecies) : (actorSpecies == filterSpecies); } -static bool DoCheckFilter(AActor *mo, const PClass *filter, bool exclude) +static bool DoCheckClass(AActor *mo, const PClass *filterClass, bool exclude) { - const PClass *c1 = mo->GetClass(); - return (!(filter) || (filter == NULL) || (filter && ((exclude) ? (c1 != filter) : (c1 == filter)))); + const PClass *actorClass = mo->GetClass(); + if (filterClass == NULL) return true; + return exclude ? (actorClass != filterClass) : (actorClass == filterClass); } //=========================================================================== @@ -5228,8 +5231,8 @@ enum DMSS static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageType, int flags, const PClass *filter, FName species) { - bool filterpass = DoCheckFilter(dmgtarget, filter, (flags & DMSS_EXFILTER) ? true : false), - speciespass = DoCheckSpecies(dmgtarget, species, (flags & DMSS_EXSPECIES) ? true : false); + bool filterpass = DoCheckClass(dmgtarget, filter, !!(flags & DMSS_EXFILTER)), + speciespass = DoCheckSpecies(dmgtarget, species, !!(flags & DMSS_EXSPECIES)); if ((flags & DMSS_EITHER) ? (filterpass || speciespass) : (filterpass && speciespass)) { int dmgFlags = 0; @@ -5408,8 +5411,8 @@ enum KILS static void DoKill(AActor *killtarget, AActor *self, FName damagetype, int flags, const PClass *filter, FName species) { - bool filterpass = DoCheckFilter(killtarget, filter, (flags & KILS_EXFILTER) ? true : false), - speciespass = DoCheckSpecies(killtarget, species, (flags & KILS_EXSPECIES) ? true : false); + bool filterpass = DoCheckClass(killtarget, filter, !!(flags & KILS_EXFILTER)), + speciespass = DoCheckSpecies(killtarget, species, !!(flags & KILS_EXSPECIES)); if ((flags & KILS_EITHER) ? (filterpass || speciespass) : (filterpass && speciespass)) //Check this first. I think it'll save the engine a lot more time this way. { int dmgFlags = DMG_NO_ARMOR | DMG_NO_FACTOR; @@ -5569,8 +5572,8 @@ enum RMVF_flags static void DoRemove(AActor *removetarget, int flags, const PClass *filter, FName species) { - bool filterpass = DoCheckFilter(removetarget, filter, (flags & RMVF_EXFILTER) ? true : false), - speciespass = DoCheckSpecies(removetarget, species, (flags & RMVF_EXSPECIES) ? true : false); + bool filterpass = DoCheckClass(removetarget, filter, !!(flags & RMVF_EXFILTER)), + speciespass = DoCheckSpecies(removetarget, species, !!(flags & RMVF_EXSPECIES)); if ((flags & RMVF_EITHER) ? (filterpass || speciespass) : (filterpass && speciespass)) { if ((flags & RMVF_EVERYTHING)) From 375c0ac736e3e64b05891685502bfba12b637ae5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 10:10:22 +0100 Subject: [PATCH 25/38] - cleanup of damage flag handling in P_RailAttack. --- src/p_map.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 8c6c24828..f858b8a4a 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4243,13 +4243,16 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i P_SpawnPuff(source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, puffflags, hitactor); } - if (puffDefaults && puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN) - { - P_PoisonMobj(hitactor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType); - } int dmgFlagPass = DMG_INFLICTOR_IS_PUFF; - dmgFlagPass += (puffDefaults->flags3 & MF3_FOILINVUL) ? DMG_FOILINVUL : 0; //[MC]Because the original foilinvul check wasn't working. - dmgFlagPass += (puffDefaults->flags7 & MF7_FOILBUDDHA) ? DMG_FOILBUDDHA : 0; + if (puffDefaults != NULL) // is this even possible? + { + if (puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN) + { + P_PoisonMobj(hitactor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType); + } + if (puffDefaults->flags3 & MF3_FOILINVUL) dmgFlagPass |= DMG_FOILINVUL; + if (puffDefaults->flags7 & MF7_FOILBUDDHA) dmgFlagPass |= DMG_FOILBUDDHA; + } int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, damage, damagetype, dmgFlagPass); if (bleed) From c78b9235a87335d59f58094e124056e67d0a815a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 11:50:27 +0100 Subject: [PATCH 26/38] - DoSpecialDamage was formerly called for any damage value, removed check for 'damage > 0' to restore original behavior. --- src/p_interaction.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 74278153d..6e5fc3776 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1065,8 +1065,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } } - if (damage > 0) - damage = inflictor->DoSpecialDamage (target, damage, mod); + damage = inflictor->DoSpecialDamage (target, damage, mod); if ((damage == -1) && (target->player == NULL)) //This isn't meant for the player. { From ac7abca6f8ddd614d1363af3341e9b23194372f2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 11:55:11 +0100 Subject: [PATCH 27/38] - completely removed fakePain check in case DoSpecialDamage returns -1. This signifies a special case that should bypass anything that inflicting pain implies. --- src/p_interaction.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 6e5fc3776..032f5e162 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1066,11 +1066,8 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } } damage = inflictor->DoSpecialDamage (target, damage, mod); - - if ((damage == -1) && (target->player == NULL)) //This isn't meant for the player. + if (damage == -1) { - if (fakedPain) //Hold off ending the function before we can deal the pain chances. - goto fakepain; return -1; } } From 9d5e6d32c7d07f09286703d8d4c8b47ef0530e1d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 13:49:47 +0100 Subject: [PATCH 28/38] - review of P_DamageMobj: * decided that the pain threshold should always be checked against the actual damage, even if it's down to 0, for consistency. This also restores the original behavior of using actual damage for checking the pain threshold which was altered by the introduction of the ALLOWPAIN and CAUSEPAIN flags. * removed all newly added exceptions that excluded the player from checks for completely cancelled out damage. * if anything during damage modification causes negative damage, no pain handling whatsoever will be initiated. * made sure that TELEFRAG_DAMAGE will not be subjected to damage amount modification by protection items and any other kind of damage modification. --- src/p_interaction.cpp | 130 +++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 71 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 032f5e162..ed9635269 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -989,9 +989,11 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { if (fakedPain) { - invulpain = true; //This returns -1 later. - fakeDamage = damage; - goto fakepain; //The label is above the massive pile of checks. + // big mess here: What do we use for the pain threshold? + // We cannot run the various damage filters below so for consistency it needs to be 0. + damage = 0; + invulpain = true; + goto fakepain; } else return -1; @@ -1010,12 +1012,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } } - if ((fakedPain) && (damage < TELEFRAG_DAMAGE)) - { - //Intentionally do not jump to fakepain because the damage hasn't been dished out yet. - //Once it's dished out, THEN we can disregard damage factors affecting pain chances. - fakeDamage = damage; - } if (inflictor != NULL) { @@ -1035,16 +1031,15 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { target->velx = target->vely = target->velz = 0; } - if (!(flags & DMG_FORCED)) // DMG_FORCED skips all special damage checks + if (!(flags & DMG_FORCED) && damage < TELEFRAG_DAMAGE) // DMG_FORCED skips all special damage checks, TELEFRAG_DAMAGE may not be reduced at all { if (target->flags2 & MF2_DORMANT) { // Invulnerable, and won't wake up return -1; } - player = target->player; - if (player && damage > 1 && damage < TELEFRAG_DAMAGE) + if (player && damage > 1) { // Take half damage in trainer mode damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor)); @@ -1065,78 +1060,69 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } } + damage = inflictor->DoSpecialDamage (target, damage, mod); - if (damage == -1) + if (damage < 0) { return -1; } } - // Handle active damage modifiers (e.g. PowerDamage) - if (source != NULL) + + int olddam = damage; + + if (damage > 0 && source != NULL) { - int olddam = damage; - - if (source->Inventory != NULL) - { - source->Inventory->ModifyDamage(olddam, mod, damage, false); - } damage = FixedMul(damage, source->DamageMultiply); - - if (((source->flags7 & MF7_CAUSEPAIN) && (fakeDamage <= 0)) || (olddam != damage && damage <= 0)) - { // Still allow FORCEPAIN - if (forcedPain) - goto dopain; - else if (fakedPain) - goto fakepain; - - return -1; + + // Handle active damage modifiers (e.g. PowerDamage) + if (damage > 0 && source->Inventory != NULL) + { + source->Inventory->ModifyDamage(damage, mod, damage, false); } } // Handle passive damage modifiers (e.g. PowerProtection), provided they are not afflicted with protection penetrating powers. - if ((target->Inventory != NULL) && !(flags & DMG_NO_PROTECT)) + if (damage > 0 && (target->Inventory != NULL) && !(flags & DMG_NO_PROTECT)) { - int olddam = damage; - target->Inventory->ModifyDamage(olddam, mod, damage, true); - if ((olddam != damage && damage <= 0) && target->player == NULL) - { // Still allow FORCEPAIN and make sure we're still passing along fake damage to hit enemies for their pain states. - if (forcedPain) - goto dopain; - else if (fakedPain) - goto fakepain; - - return -1; - } + target->Inventory->ModifyDamage(damage, mod, damage, true); } - - if (!(flags & DMG_NO_FACTOR)) + if (damage > 0 && !(flags & DMG_NO_FACTOR)) { damage = FixedMul(damage, target->DamageFactor); if (damage > 0) { damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, mod, target->GetClass()->ActorInfo->DamageFactors); } - if (damage <= 0 && target->player == NULL) + } + + if (damage > 0) + { + damage = target->TakeSpecialDamage(inflictor, source, damage, mod); + } + + // '<0' is handled below. This only handles the case where damage gets reduced to 0. + if (damage == 0 && olddam > 0) + { { // Still allow FORCEPAIN if (forcedPain) + { goto dopain; + } else if (fakedPain) + { goto fakepain; - + } return -1; } } - damage = target->TakeSpecialDamage (inflictor, source, damage, mod); } - if (damage == -1 && target->player == NULL) //Make sure it's not a player, the pain has yet to be processed with cheats. + if (damage < 0) { - if (fakedPain) - goto fakepain; - + // any negative value means that something in the above chain has cancelled out all damage and all damage effects, including pain. return -1; } // Push the target unless the source's weapon's kickback is 0. // (i.e. Gauntlets/Chainsaw) - if (!(plrDontThrust) && inflictor && inflictor != target // [RH] Not if hurting own self + if (!plrDontThrust && inflictor && inflictor != target // [RH] Not if hurting own self && !(target->flags & MF_NOCLIP) && !(inflictor->flags2 & MF2_NODMGTHRUST) && !(flags & DMG_THRUSTLESS) @@ -1177,10 +1163,11 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { fltthrust = clamp((damage * 0.125 * kickback) / target->Mass, 0., fltthrust); } + thrust = FLOAT2FIXED(fltthrust); - // Don't apply ultra-small damage thrust. - if (thrust < FRACUNIT / 100) - thrust = 0; + + // Don't apply ultra-small damage thrust + if (thrust < FRACUNIT/100) thrust = 0; // make fall forwards sometimes if ((damage < 40) && (damage > target->health) @@ -1189,7 +1176,8 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // [RH] But only if not too fast and not flying && thrust < 10*FRACUNIT && !(target->flags & MF_NOGRAVITY) - && (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL))) + && (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL)) + ) { ang += ANG180; thrust *= 4; @@ -1225,8 +1213,22 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, if (damage < TELEFRAG_DAMAGE) { // Still allow telefragging :-( damage = (int)((float)damage * level.teamdamage); - if (damage <= 0) + if (damage < 0) + { return damage; + } + else if (damage == 0) + { + if (forcedPain) + { + goto dopain; + } + else if (fakedPain) + { + goto fakepain; + } + return -1; + } } } @@ -1263,7 +1265,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, else if ((((player->mo->flags7 & MF7_ALLOWPAIN) || (player->mo->flags5 & MF5_NODAMAGE)) || ((inflictor != NULL) && (inflictor->flags7 & MF7_CAUSEPAIN)))) { invulpain = true; - fakeDamage = damage; goto fakepain; } else @@ -1446,15 +1447,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, fakepain: //Needed so we can skip the rest of the above, but still obey the original rules. - //CAUSEPAIN can always attempt to trigger the chances of pain. - //ALLOWPAIN can do the same, only if the (unfiltered aka fake) damage is greater than 0. - if (((target->flags7 & MF7_ALLOWPAIN) && (fakeDamage > 0)) - || ((inflictor != NULL) && (inflictor->flags7 & MF7_CAUSEPAIN))) - { - holdDamage = damage; //Store the modified damage away after factors are taken into account. - damage = fakeDamage; //Retrieve the original damage. - } - if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) && (target->player != NULL || !G_SkillProperty(SKILLP_NoPain)) && !(target->flags & MF_SKULLFLY)) { @@ -1550,10 +1542,6 @@ dopain: { return -1; //NOW we return -1! } - else if (fakedPain) - { - return holdDamage; //This is the calculated damage after all is said and done. - } return damage; } From eb78c241406a7f84fc11ee799133a5a8c8a0a589 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 14:37:13 +0100 Subject: [PATCH 29/38] - small oversight: TakeSpecialDamage must be called if damage is 0 (to do the special death state checks) but it may not be called if damage is already -1, because that means that damage and pain have already been ruled out completely. --- src/p_interaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index ed9635269..3b5049ba6 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1094,7 +1094,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } } - if (damage > 0) + if (damage >= 0) { damage = target->TakeSpecialDamage(inflictor, source, damage, mod); } From 164d523ecae776ab272347f80829f9eb6f2e36c0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 16:58:21 +0100 Subject: [PATCH 30/38] - fixed incorrect flags word access. --- src/thingdef/thingdef_codeptr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 934f4cc4c..f6e3425bc 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5429,7 +5429,7 @@ static void DoKill(AActor *killtarget, AActor *self, FName damagetype, int flags //Check to see if it's invulnerable. Disregarded if foilinvul is on, but never works on a missile with NODAMAGE //since that's the whole point of it. if ((!(killtarget->flags2 & MF2_INVULNERABLE) || (flags & KILS_FOILINVUL)) && - (!(killtarget->flags2 & MF7_BUDDHA) || (flags & KILS_FOILBUDDHA)) && + (!(killtarget->flags7 & MF7_BUDDHA) || (flags & KILS_FOILBUDDHA)) && !(killtarget->flags5 & MF5_NODAMAGE)) { P_ExplodeMissile(killtarget, NULL, NULL); From 94a04f36e5a82fe829541ec80034a43fb7f5780e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 17:06:56 +0100 Subject: [PATCH 31/38] - fixed: Dormant monsters should not be telefraggable. --- src/p_interaction.cpp | 125 +++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 61 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 3b5049ba6..3b9d78710 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1031,87 +1031,90 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { target->velx = target->vely = target->velz = 0; } - if (!(flags & DMG_FORCED) && damage < TELEFRAG_DAMAGE) // DMG_FORCED skips all special damage checks, TELEFRAG_DAMAGE may not be reduced at all + if (!(flags & DMG_FORCED)) // DMG_FORCED skips all special damage checks, TELEFRAG_DAMAGE may not be reduced at all { if (target->flags2 & MF2_DORMANT) { // Invulnerable, and won't wake up return -1; } - player = target->player; - if (player && damage > 1) + if (damage < TELEFRAG_DAMAGE) // TELEFRAG_DAMAGE may not be reduced at all or it may not guarantee its effect. { - // Take half damage in trainer mode - damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor)); - } - // Special damage types - if (inflictor) - { - if (inflictor->flags4 & MF4_SPECTRAL) + player = target->player; + if (player && damage > 1) { - if (player != NULL) + // Take half damage in trainer mode + damage = FixedMul(damage, G_SkillProperty(SKILLP_DamageFactor)); + } + // Special damage types + if (inflictor) + { + if (inflictor->flags4 & MF4_SPECTRAL) { - if (!deathmatch && inflictor->FriendPlayer > 0) - return -1; + if (player != NULL) + { + if (!deathmatch && inflictor->FriendPlayer > 0) + return -1; + } + else if (target->flags4 & MF4_SPECTRAL) + { + if (inflictor->FriendPlayer == 0 && !target->IsHostile(inflictor)) + return -1; + } } - else if (target->flags4 & MF4_SPECTRAL) + + damage = inflictor->DoSpecialDamage(target, damage, mod); + if (damage < 0) { - if (inflictor->FriendPlayer == 0 && !target->IsHostile(inflictor)) - return -1; + return -1; } } - damage = inflictor->DoSpecialDamage (target, damage, mod); - if (damage < 0) + int olddam = damage; + + if (damage > 0 && source != NULL) { - return -1; - } - } + damage = FixedMul(damage, source->DamageMultiply); - int olddam = damage; - - if (damage > 0 && source != NULL) - { - damage = FixedMul(damage, source->DamageMultiply); - - // Handle active damage modifiers (e.g. PowerDamage) - if (damage > 0 && source->Inventory != NULL) - { - source->Inventory->ModifyDamage(damage, mod, damage, false); - } - } - // Handle passive damage modifiers (e.g. PowerProtection), provided they are not afflicted with protection penetrating powers. - if (damage > 0 && (target->Inventory != NULL) && !(flags & DMG_NO_PROTECT)) - { - target->Inventory->ModifyDamage(damage, mod, damage, true); - } - if (damage > 0 && !(flags & DMG_NO_FACTOR)) - { - damage = FixedMul(damage, target->DamageFactor); - if (damage > 0) - { - damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, mod, target->GetClass()->ActorInfo->DamageFactors); - } - } - - if (damage >= 0) - { - damage = target->TakeSpecialDamage(inflictor, source, damage, mod); - } - - // '<0' is handled below. This only handles the case where damage gets reduced to 0. - if (damage == 0 && olddam > 0) - { - { // Still allow FORCEPAIN - if (forcedPain) + // Handle active damage modifiers (e.g. PowerDamage) + if (damage > 0 && source->Inventory != NULL) { - goto dopain; + source->Inventory->ModifyDamage(damage, mod, damage, false); } - else if (fakedPain) + } + // Handle passive damage modifiers (e.g. PowerProtection), provided they are not afflicted with protection penetrating powers. + if (damage > 0 && (target->Inventory != NULL) && !(flags & DMG_NO_PROTECT)) + { + target->Inventory->ModifyDamage(damage, mod, damage, true); + } + if (damage > 0 && !(flags & DMG_NO_FACTOR)) + { + damage = FixedMul(damage, target->DamageFactor); + if (damage > 0) { - goto fakepain; + damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, mod, target->GetClass()->ActorInfo->DamageFactors); + } + } + + if (damage >= 0) + { + damage = target->TakeSpecialDamage(inflictor, source, damage, mod); + } + + // '<0' is handled below. This only handles the case where damage gets reduced to 0. + if (damage == 0 && olddam > 0) + { + { // Still allow FORCEPAIN + if (forcedPain) + { + goto dopain; + } + else if (fakedPain) + { + goto fakepain; + } + return -1; } - return -1; } } } From 15e0f19fdb489260409797bd2d2e095efe5e5d19 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 17:16:53 +0100 Subject: [PATCH 32/38] - fixed another flags mismatch. --- src/p_interaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 3b9d78710..a16069c7b 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1389,7 +1389,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, if (target->health <= 0) { //[MC]Buddha flag for monsters. - if ((target->flags7 & MF7_BUDDHA) && (damage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags3 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))) + if ((target->flags7 & MF7_BUDDHA) && (damage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))) { //FOILBUDDHA or Telefrag damage must kill it. target->health = 1; } From 25e5ac7e2aeef6bc55cceeea92c5ba5f680ecfcf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Mar 2015 18:29:57 +0100 Subject: [PATCH 33/38] - fixed: CheckForResurrection should check whether the active translation is actually a blood translation before resetting it, not assuming that GenericCrush is a single state with infinite duration. --- src/p_enemy.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index be0646d4b..540aa119e 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -44,6 +44,7 @@ #include "thingdef/thingdef.h" #include "d_dehacked.h" #include "g_level.h" +#include "r_data/r_translate.h" #include "teaminfo.h" #include "gi.h" @@ -2615,7 +2616,7 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) S_Sound(corpsehit, CHAN_BODY, "vile/raise", 1, ATTN_IDLE); info = corpsehit->GetDefault(); - if (corpsehit->state == corpsehit->FindState(NAME_GenericCrush)) + if (GetTranslationType(corpsehit->Translation) == TRANSLATION_Blood) { corpsehit->Translation = info->Translation; // Clean up bloodcolor translation from crushed corpses } From 267054071fa28e8a82473bafc9f6c32148ad9391 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 28 Mar 2015 12:13:47 +0200 Subject: [PATCH 34/38] Added missing render styles to info console command --- src/p_mobj.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 9102c0472..23fb9cf3c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6443,7 +6443,8 @@ void PrintMiscActorInfo(AActor *query) } } static const char * renderstyles[]= {"None", "Normal", "Fuzzy", "SoulTrans", - "OptFuzzy", "Stencil", "Translucent", "Add", "Shaded", "TranslucentStencil"}; + "OptFuzzy", "Stencil", "Translucent", "Add", "Shaded", "TranslucentStencil", + "Shadow", "Subtract", "AddStencil", "AddShaded"}; Printf("%s @ %p has the following flags:\n flags: %x", query->GetTag(), query, query->flags); for (flagi = 0; flagi <= 31; flagi++) From 3849cb86231ce24131a86e9c29795a8cf3706a3d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Mar 2015 13:02:45 +0200 Subject: [PATCH 35/38] - added precaching of textures via MAPINFO. --- src/g_level.h | 1 + src/g_mapinfo.cpp | 19 +++++++++++++++++++ src/textures/texturemanager.cpp | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/src/g_level.h b/src/g_level.h index 8a4702639..f94fefa42 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -336,6 +336,7 @@ struct level_info_t TArray specialactions; TArray PrecacheSounds; + TArray PrecacheTextures; level_info_t() { diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 6d49b9c17..306c3645a 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1065,6 +1065,25 @@ DEFINE_MAP_OPTION(PrecacheSounds, true) } while (parse.sc.CheckString(",")); } +DEFINE_MAP_OPTION(PrecacheTextures, true) +{ + parse.ParseAssign(); + + do + { + parse.sc.MustGetString(); + FTextureID tex = TexMan.CheckForTexture(parse.sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst); + if (!tex.isValid()) + { + parse.sc.ScriptMessage("Unknown texture \"%s\"", parse.sc.String); + } + else + { + info->PrecacheTextures.Push(tex); + } + } while (parse.sc.CheckString(",")); +} + DEFINE_MAP_OPTION(redirect, true) { parse.ParseAssign(); diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index b8256bc65..be0426e98 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1243,6 +1243,12 @@ void FTextureManager::PrecacheLevel (void) memset (hitlist, 0, cnt); screen->GetHitlist(hitlist); + + for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++) + { + hitlist[level.info->PrecacheTextures[i].GetIndex()] |= 1; + } + for (int i = cnt - 1; i >= 0; i--) { Renderer->PrecacheTexture(ByIndex(i), hitlist[i]); From 5f56fb5a16156a0e227ae9263eedba67141d0a51 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 30 Mar 2015 21:54:58 -0400 Subject: [PATCH 36/38] Changed the behavior of SetActorTeleFog. - Don't force "null" to resolve to no actor since "none" is already defined as NULL (via FindClass). (This change also applies to the decorate properties.) - Passing an empty actor name will keep the existing fog since there's otherwise no way set only one fog. Since "none" works to remove the fog, I see no reason not to have this option. --- src/p_acs.cpp | 39 ++++++++++------------------ src/thingdef/thingdef_properties.cpp | 4 +-- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2bbbc944a..8894bc936 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4767,25 +4767,19 @@ static void SetActorRoll(AActor *activator, int tid, int angle, bool interpolate } } -static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName telefogdest) +static void SetActorTeleFog(AActor *activator, int tid, FString telefogsrc, FString telefogdest) { - //Simply put, if it doesn't exist, it won't change. One can use "" in this scenario. - const PClass *check; + // Set the actor's telefog to the specified actor. Handle "" as "don't + // change" since "None" should work just fine for disabling the fog (given + // that it will resolve to NAME_None which is not a valid actor name). if (tid == 0) { if (activator != NULL) { - check = PClass::FindClass(telefogsrc); - if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null")) - activator->TeleFogSourceType = NULL; - else - activator->TeleFogSourceType = check; - - check = PClass::FindClass(telefogdest); - if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null")) - activator->TeleFogDestType = NULL; - else - activator->TeleFogDestType = check; + if (telefogsrc.IsNotEmpty()) + activator->TeleFogSourceType = PClass::FindClass(telefogsrc); + if (telefogdest.IsNotEmpty()) + activator->TeleFogDestType = PClass::FindClass(telefogdest); } } else @@ -4793,19 +4787,14 @@ static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName FActorIterator iterator(tid); AActor *actor; + const PClass * const src = telefogsrc.IsNotEmpty() ? PClass::FindClass(telefogsrc) : NULL; + const PClass * const dest = telefogdest.IsNotEmpty() ? PClass::FindClass(telefogdest) : NULL; while ((actor = iterator.Next())) { - check = PClass::FindClass(telefogsrc); - if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null")) - actor->TeleFogSourceType = NULL; - else - actor->TeleFogSourceType = check; - - check = PClass::FindClass(telefogdest); - if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null")) - actor->TeleFogDestType = NULL; - else - actor->TeleFogDestType = check; + if (telefogsrc.IsNotEmpty()) + actor->TeleFogSourceType = src; + if (telefogdest.IsNotEmpty()) + actor->TeleFogDestType = dest; } } } diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 677979276..33066828c 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1422,7 +1422,7 @@ DEFINE_PROPERTY(stamina, I, Actor) DEFINE_PROPERTY(telefogsourcetype, S, Actor) { PROP_STRING_PARM(str, 0); - if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) defaults->TeleFogSourceType = NULL; + if (!stricmp(str, "") || !stricmp(str, "none")) defaults->TeleFogSourceType = NULL; else defaults->TeleFogSourceType = FindClassTentative(str,"TeleportFog"); } @@ -1432,7 +1432,7 @@ DEFINE_PROPERTY(telefogsourcetype, S, Actor) DEFINE_PROPERTY(telefogdesttype, S, Actor) { PROP_STRING_PARM(str, 0); - if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) defaults->TeleFogDestType = NULL; + if (!stricmp(str, "") || !stricmp(str, "none")) defaults->TeleFogDestType = NULL; else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog"); } From 4d59190446c60aed6ed37394d9b06d0a3ac86a47 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 31 Mar 2015 09:24:16 +0200 Subject: [PATCH 37/38] - redit commit 5f56fb5a16156a0e227ae9263eedba67141d0a51 without altering the line endings throughout thingdef_codeptr.cpp. * Changed the behavior of SetActorTeleFog. - Don't force "null" to resolve to no actor since "none" is already defined as NULL (via FindClass). (This change also applies to the decorate properties.) - Passing an empty actor name will keep the existing fog since there's otherwise no way set only one fog. Since "none" works to remove the fog, I see no reason not to have this option. --- src/thingdef/thingdef_codeptr.cpp | 26 +++++--------------------- wadsrc/static/actors/actor.txt | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index f6e3425bc..cb59f8a1f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5726,33 +5726,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) // A_SetTeleFog // // Sets the teleport fog(s) for the calling actor. -// Takes a name of the classes for te source and destination. -// Can set both at the same time. Use "" to retain the previous fog without -// changing it. +// Takes a name of the classes for the source and destination. //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTeleFog) { ACTION_PARAM_START(2); - ACTION_PARAM_NAME(oldpos, 0); - ACTION_PARAM_NAME(newpos, 1); - const PClass *check = PClass::FindClass(oldpos); - if (check == NULL || !stricmp(oldpos, "none") || !stricmp(oldpos, "null")) - self->TeleFogSourceType = NULL; - else if (!stricmp(oldpos, "")) - { //Don't change it if it's just "" - } - else - self->TeleFogSourceType = check; + ACTION_PARAM_CLASS(oldpos, 0); + ACTION_PARAM_CLASS(newpos, 1); - check = PClass::FindClass(newpos); - if (check == NULL || !stricmp(newpos, "none") || !stricmp(newpos, "null")) - self->TeleFogDestType = NULL; - else if (!stricmp(newpos, "")) - { //Don't change it if it's just "" - } - else - self->TeleFogDestType = check; + self->TeleFogSourceType = oldpos; + self->TeleFogDestType = newpos; } //=========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index f84151d18..d85717ead 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -325,7 +325,7 @@ ACTOR Actor native //: Thinker action native A_GiveToSiblings(class itemtype, int amount = 0); action native A_TakeFromChildren(class itemtype, int amount = 0); action native A_TakeFromSiblings(class itemtype, int amount = 0); - action native A_SetTeleFog(name oldpos, name newpos); + action native A_SetTeleFog(class oldpos, class newpos); action native A_SwapTeleFog(); action native A_SetFloatBobPhase(int bob); action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT); From 5febac09944fc74c5ce8a72653547aa7835bd6b1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 31 Mar 2015 15:21:15 +0200 Subject: [PATCH 38/38] - removed incorrect multiplication from FraggleScript's PointToDist function. The problem was introduced by replacing a (fixed_t) type cast with FLOATTOFIXED without removing the value range adjustment. --- src/fragglescript/t_func.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 4825fe06b..0bddcd7fd 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1420,7 +1420,7 @@ void FParser::SF_PointToDist(void) double y = floatvalue(t_argv[3]) - floatvalue(t_argv[1]); t_return.type = svt_fixed; - t_return.value.f = FLOAT2FIXED(sqrt(x*x+y*y)*65536.f); + t_return.value.f = FLOAT2FIXED(sqrt(x*x+y*y)); } }