diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a7400ce1..eae0702f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,15 @@ function( add_pk3 PK3_NAME PK3_DIR ) SOURCES ${PK3_SRCS}) # Phase 3: Assign source files to a nice folder structure in the IDE assort_pk3_source_folder("Source Files" ${PK3_DIR}) + # Phase 4: Add the resulting PK3 to the install target. + if( WIN32 ) + set( INSTALL_PK3_PATH . CACHE STRING "Directory where zdoom.pk3 will be placed during install." ) + else() + set( INSTALL_PK3_PATH share/games/doom CACHE STRING "Directory where zdoom.pk3 will be placed during install." ) + endif() + install(FILES "${PROJECT_BINARY_DIR}/${PK3_NAME}" + DESTINATION ${INSTALL_PK3_PATH} + COMPONENT "Game resources") endfunction() # Macro for building libraries without debugging information @@ -252,6 +261,7 @@ if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB ) message( STATUS "Using system zlib, includes found at ${ZLIB_INCLUDE_DIR}" ) else() message( STATUS "Using internal zlib" ) + set( SKIP_INSTALL_ALL TRUE ) # Avoid installing zlib alongside zdoom add_subdirectory( zlib ) set( ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zlib ) set( ZLIB_LIBRARIES z ) @@ -295,6 +305,16 @@ if( NOT CMAKE_CROSSCOMPILING ) endif() endif() +# Install the entire docs directory in the distributed zip package +if( WIN32 ) + set( INSTALL_DOCS_PATH docs CACHE STRING "Directory where the documentation will be placed during install." ) +else() + set( INSTALL_DOCS_PATH share/doc/${ZDOOM_EXE_NAME} CACHE STRING "Directory where the zdoom documentation will be placed during install." ) +endif() +install(DIRECTORY docs/ + DESTINATION ${INSTALL_DOCS_PATH} + COMPONENT "Documentation") + add_subdirectory( lzma ) add_subdirectory( tools ) add_subdirectory( dumb ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6bddd64bb..4e88aa3a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1564,6 +1564,15 @@ if( APPLE ) endif() endif() +if( WIN32 ) + set( INSTALL_PATH . CACHE STRING "Directory where the zdoom executable will be placed during install." ) +else() + set( INSTALL_PATH bin CACHE STRING "Directory where the zdoom executable will be placed during install." ) +endif() +install(TARGETS zdoom + DESTINATION ${INSTALL_PATH} + COMPONENT "Game executable") + source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+") source_group("Assembly Files\\x86_64" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_x86_64/.+") source_group("Audio Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/.+") diff --git a/src/g_game.cpp b/src/g_game.cpp index 48bda24f5..b0c8775fc 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1655,9 +1655,10 @@ static void G_QueueBody (AActor *body) // // G_DoReborn // +EXTERN_CVAR(Bool, sv_singleplayerrespawn) void G_DoReborn (int playernum, bool freshbot) { - if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN)) + if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn) { if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars())) { // Load game from the last point it was saved diff --git a/src/g_level.cpp b/src/g_level.cpp index 119cde378..d3a8c4015 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -526,6 +526,8 @@ static bool unloading; // //========================================================================== +EXTERN_CVAR(Bool, sv_singleplayerrespawn) + void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill) { level_info_t *nextinfo = NULL; @@ -634,7 +636,7 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill // If this is co-op, respawn any dead players now so they can // keep their inventory on the next map. - if ((multiplayer || level.flags2 & LEVEL2_ALLOWRESPAWN) && !deathmatch && player->playerstate == PST_DEAD) + if ((multiplayer || level.flags2 & LEVEL2_ALLOWRESPAWN || sv_singleplayerrespawn) && !deathmatch && player->playerstate == PST_DEAD) { // Copied from the end of P_DeathThink [[ player->cls = NULL; // Force a new class if the player is using a random class diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 8f926ea77..3e2011878 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1,4 +1,4 @@ -// Emacs style mode select -*- C++ -*- +// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // $Id:$ @@ -4495,6 +4495,7 @@ void AActor::AdjustFloorClip () // Most of the player structure stays unchanged between levels. // EXTERN_CVAR (Bool, chasedemo) +EXTERN_CVAR(Bool, sv_singleplayerrespawn) extern bool demonew; @@ -4682,7 +4683,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) { // Give all cards in death match mode. p->mo->GiveDeathmatchInventory (); } - else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) && state == PST_REBORN && oldactor != NULL) + else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn) && state == PST_REBORN && oldactor != NULL) { // Special inventory handling for respawning in coop p->mo->FilterCoopRespawnInventory (oldactor); } diff --git a/src/p_user.cpp b/src/p_user.cpp index e48712042..b7bd4c2ec 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -65,6 +65,9 @@ static FRandom pr_skullpop ("SkullPop"); // [RH] # of ticks to complete a turn180 #define TURN180_TICKS ((TICRATE / 4) + 1) +// [SP] Allows respawn in single player +CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_LATCH) + // Variables for prediction CVAR (Bool, cl_noprediction, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, cl_predict_specials, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) @@ -2211,7 +2214,9 @@ void P_DeathThink (player_t *player) if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && player->Bot == NULL)) { player->cls = NULL; // Force a new class if the player is using a random class - player->playerstate = (multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) ? PST_REBORN : PST_ENTER; + player->playerstate = + (multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn) + ? PST_REBORN : PST_ENTER; if (player->mo->special1 > 2) { player->mo->special1 = 0; diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 2e26fe729..f00a60201 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -192,6 +192,7 @@ protected: int UseType = TEX_Null; bool Silent = false; bool HasLine = false; + bool UseOffsets = false; FScriptPosition sc; }; @@ -297,8 +298,6 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl Printf ("Texture %s is left without any patches\n", Name.GetChars()); } - CheckForHacks (); - DefinitionLump = deflumpnum; } @@ -1142,11 +1141,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, TexInit &init) } else if (sc.Compare("useoffsets")) { - if (part.Texture != NULL) - { - part.OriginX -= part.Texture->LeftOffset; - part.OriginY -= part.Texture->TopOffset; - } + init.UseOffsets = true; } } } @@ -1324,6 +1319,29 @@ void FMultiPatchTexture::ResolvePatches() for (int i = 0; i < NumParts; i++) { FTextureID texno = TexMan.CheckForTexture(Inits[i].TexName, Inits[i].UseType); + if (texno == id) // we found ourselves. Try looking for another one with the same name which is not a multipatch texture itself. + { + TArray list; + TexMan.ListTextures(Inits[i].TexName, list, true); + for (int i = list.Size() - 1; i >= 0; i--) + { + if (list[i] != id && !TexMan[list[i]]->bMultiPatch) + { + texno = list[i]; + break; + } + } + if (texno == id) + { + if (Inits[i].HasLine) Inits[i].sc.Message(MSG_WARNING, "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars()); + else Printf(TEXTCOLOR_YELLOW "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars()); + } + else + { + // If it could be resolved, just print a developer warning. + DPrintf(DMSG_WARNING, "Resolved self-referencing texture by picking an older entry for %s\n", Inits[i].TexName.GetChars()); + } + } if (!texno.isValid()) { @@ -1338,6 +1356,11 @@ void FMultiPatchTexture::ResolvePatches() Parts[i].Texture = TexMan[texno]; bComplex |= Parts[i].Texture->bComplex; Parts[i].Texture->bKeepAround = true; + if (Inits[i].UseOffsets) + { + Parts[i].OriginX -= Parts[i].Texture->LeftOffset; + Parts[i].OriginY -= Parts[i].Texture->TopOffset; + } } } for (int i = 0; i < NumParts; i++) @@ -1353,6 +1376,8 @@ void FMultiPatchTexture::ResolvePatches() delete[] Inits; Inits = nullptr; + CheckForHacks(); + // If this texture is just a wrapper around a single patch, we can simply // forward GetPixels() and GetColumn() calls to that patch. diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index bc0eaffa3..760437db9 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -615,8 +615,6 @@ namespace PalEntry FTexture::GetSkyCapColor(bool bottom) { PalEntry col; - int w; - int h; if (!bSWSkyColorDone) { diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 07ed71a3b..aa760c221 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -267,7 +267,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF // //========================================================================== -int FTextureManager::ListTextures (const char *name, TArray &list) +int FTextureManager::ListTextures (const char *name, TArray &list, bool listall) { int i; @@ -293,11 +293,14 @@ int FTextureManager::ListTextures (const char *name, TArray &list) // NULL textures must be ignored. if (tex->UseType!=FTexture::TEX_Null) { - unsigned int j; - for(j = 0; j < list.Size(); j++) + unsigned int j = list.Size(); + if (!listall) { - // Check for overriding definitions from newer WADs - if (Textures[list[j].GetIndex()].Texture->UseType == tex->UseType) break; + for (j = 0; j < list.Size(); j++) + { + // Check for overriding definitions from newer WADs + if (Textures[list[j].GetIndex()].Texture->UseType == tex->UseType) break; + } } if (j==list.Size()) list.Push(FTextureID(i)); } diff --git a/src/textures/textures.h b/src/textures/textures.h index 978974045..c6c59fd59 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -412,7 +412,7 @@ public: FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny); FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0); - int ListTextures (const char *name, TArray &list); + int ListTextures (const char *name, TArray &list, bool listall = false); void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false); void AddTexturesLumps (int lump1, int lump2, int patcheslump);