From 86cd212d7f4946543777a346fe26fc1b2f207f13 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 16 Oct 2024 05:57:58 -0400 Subject: [PATCH 01/16] - fix isolated console mode (i.e. launching from explorer.exe) --- src/CMakeLists.txt | 2 +- src/common/platform/win32/i_main.cpp | 43 ++++++++++++++++---------- src/common/platform/win32/i_system.cpp | 2 ++ 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 987f53dc0..95b67a2d8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1361,7 +1361,7 @@ endif() if( MSVC ) option ( CONSOLE_MODE "Compile as a console application" OFF ) if ( CONSOLE_MODE ) - set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /ENTRY:wWinMainCRTStartup" ) + set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /ENTRY:wmainCRTStartup" ) else() set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:wWinMainCRTStartup" ) endif() diff --git a/src/common/platform/win32/i_main.cpp b/src/common/platform/win32/i_main.cpp index 64c74e808..aa1f6271e 100644 --- a/src/common/platform/win32/i_main.cpp +++ b/src/common/platform/win32/i_main.cpp @@ -45,6 +45,11 @@ #include #include +#include +#include +#include +#include + #ifdef _MSC_VER #pragma warning(disable:4244) #endif @@ -149,11 +154,22 @@ void I_SetIWADInfo() bool isConsoleApp() { - DWORD pids[2]; - DWORD num_pids = GetConsoleProcessList(pids, 2); - bool win32con_is_exclusive = (num_pids <= 1); + static bool alreadychecked = false; + static bool returnvalue; - return GetConsoleWindow() != NULL && !win32con_is_exclusive; + if (!alreadychecked) + { + DWORD pids[2]; + DWORD num_pids = GetConsoleProcessList(pids, 2); + bool win32con_is_exclusive = (num_pids <= 1); + + returnvalue = ((GetConsoleWindow() != NULL && !win32con_is_exclusive) || (GetStdHandle(STD_OUTPUT_HANDLE) != NULL)); + alreadychecked = true; + } + + //printf("isConsoleApp is %i\n", returnvalue); + + return returnvalue; } //========================================================================== @@ -183,19 +199,7 @@ int DoMain (HINSTANCE hInstance) if (isConsoleApp()) { StdOut = GetStdHandle(STD_OUTPUT_HANDLE); - BY_HANDLE_FILE_INFORMATION info; - - if (!GetFileInformationByHandle(StdOut, &info) && StdOut != nullptr) - { - SetConsoleCP(CP_UTF8); - SetConsoleOutputCP(CP_UTF8); - DWORD mode; - if (GetConsoleMode(StdOut, &mode)) - { - if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) - FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. - } - } + FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. } else if (Args->CheckParm("-stdout") || Args->CheckParm("-norun")) { @@ -514,6 +518,11 @@ CUSTOM_CVAR(Bool, disablecrashlog, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // //========================================================================== +int wmain() +{ + return wWinMain(GetModuleHandle(0), 0, GetCommandLineW(), SW_SHOW); +} + int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int nCmdShow) { g_hInst = hInstance; diff --git a/src/common/platform/win32/i_system.cpp b/src/common/platform/win32/i_system.cpp index 71a4ded12..caed820b0 100644 --- a/src/common/platform/win32/i_system.cpp +++ b/src/common/platform/win32/i_system.cpp @@ -102,6 +102,7 @@ // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- void DestroyCustomCursor(); +bool isConsoleApp(); // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -306,6 +307,7 @@ static void PrintToStdOut(const char *cpt, HANDLE StdOut) else break; } } + DWORD bytes_written; WriteFile(StdOut, printData.GetChars(), (DWORD)printData.Len(), &bytes_written, NULL); if (terminal) From e242330c9675b9ded87772529ded6313dff7e701 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 16 Oct 2024 06:01:24 -0400 Subject: [PATCH 02/16] - we don't need these includes anymore --- src/common/platform/win32/i_main.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/common/platform/win32/i_main.cpp b/src/common/platform/win32/i_main.cpp index aa1f6271e..0f7bec82c 100644 --- a/src/common/platform/win32/i_main.cpp +++ b/src/common/platform/win32/i_main.cpp @@ -45,11 +45,6 @@ #include #include -#include -#include -#include -#include - #ifdef _MSC_VER #pragma warning(disable:4244) #endif From 3af3b2e742c3958c3796cc204c3d93ad94bfb7b1 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 16 Oct 2024 06:03:26 -0400 Subject: [PATCH 03/16] - keep ENABLE_VIRTUAL_TERMINAL_PROCESSING mode in isolated console mode --- src/common/platform/win32/i_main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/platform/win32/i_main.cpp b/src/common/platform/win32/i_main.cpp index 0f7bec82c..ce2fabe60 100644 --- a/src/common/platform/win32/i_main.cpp +++ b/src/common/platform/win32/i_main.cpp @@ -194,7 +194,13 @@ int DoMain (HINSTANCE hInstance) if (isConsoleApp()) { StdOut = GetStdHandle(STD_OUTPUT_HANDLE); - FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. + + SetConsoleCP(CP_UTF8); + SetConsoleOutputCP(CP_UTF8); + DWORD mode; + + if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) + FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. } else if (Args->CheckParm("-stdout") || Args->CheckParm("-norun")) { From bf84d8152b840deb38e02b42699a6e578c7188bc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 16 Oct 2024 16:54:15 +0200 Subject: [PATCH 04/16] do not set console mode from an uninitialized variable. --- src/common/platform/win32/i_main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/platform/win32/i_main.cpp b/src/common/platform/win32/i_main.cpp index ce2fabe60..c68b5a7aa 100644 --- a/src/common/platform/win32/i_main.cpp +++ b/src/common/platform/win32/i_main.cpp @@ -197,10 +197,14 @@ int DoMain (HINSTANCE hInstance) SetConsoleCP(CP_UTF8); SetConsoleOutputCP(CP_UTF8); + DWORD mode; - if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) - FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. + if (GetConsoleMode(StdOut, &mode)) + { + if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) + FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. + } } else if (Args->CheckParm("-stdout") || Args->CheckParm("-norun")) { From 7baa25e993c813bb97972623efe2543f342b281c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Thu, 17 Oct 2024 16:25:47 -0300 Subject: [PATCH 05/16] allow getting checksum for current map --- src/g_dumpinfo.cpp | 62 +++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index 227b98f50..fcca4ed5b 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -141,30 +141,58 @@ CCMD (spray) CCMD (mapchecksum) { - MapData *map; - uint8_t cksum[16]; - - if (argv.argc() < 2) + if (argv.argc() == 1) + { //current map + const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum)); + + for (size_t i = 0; i < 16; ++i) + { + Printf("%02X", level.md5[i]); + } + + Printf(" // %s %s\n", wadname, level.MapName.GetChars()); + } + else if (argv.argc() < 2) { Printf("Usage: mapchecksum ...\n"); } - for (int i = 1; i < argv.argc(); ++i) + else { - map = P_OpenMapData(argv[i], true); - if (map == NULL) + MapData *map; + uint8_t cksum[16]; + + for (int i = 1; i < argv.argc(); ++i) { - Printf("Cannot load %s as a map\n", argv[i]); - } - else - { - map->GetChecksum(cksum); - const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)); - delete map; - for (size_t j = 0; j < sizeof(cksum); ++j) + if(argv[i] == "*") { - Printf("%02X", cksum[j]); + const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum)); + + for (size_t i = 0; i < 16; ++i) + { + Printf("%02X", level.md5[i]); + } + + Printf(" // %s %s\n", wadname, level.MapName.GetChars()); + } + else + { + map = P_OpenMapData(argv[i], true); + if (map == NULL) + { + Printf("Cannot load %s as a map\n", argv[i]); + } + else + { + map->GetChecksum(cksum); + const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)); + delete map; + for (size_t j = 0; j < sizeof(cksum); ++j) + { + Printf("%02X", cksum[j]); + } + Printf(" // %s %s\n", wadname, argv[i]); + } } - Printf(" // %s %s\n", wadname, argv[i]); } } } From 7a4a7146f5bb5664b535f1ac324faf22b73b78d3 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 17 Oct 2024 21:29:07 -0400 Subject: [PATCH 06/16] Revert "- Actor.GetSpecies() is a non-destructive function" This reverts commit ee5442c06b200163811ad23287ac98330201ecf0. --- src/rendering/hwrenderer/hw_entrypoint.cpp | 2 +- wadsrc/static/zscript/actors/actor.zs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rendering/hwrenderer/hw_entrypoint.cpp b/src/rendering/hwrenderer/hw_entrypoint.cpp index e55c041a6..bfa0d8b1c 100644 --- a/src/rendering/hwrenderer/hw_entrypoint.cpp +++ b/src/rendering/hwrenderer/hw_entrypoint.cpp @@ -362,7 +362,7 @@ sector_t* RenderView(player_t* player) // Draw all canvases that changed for (FCanvas* canvas : AllCanvases) { - if (canvas->Tex && canvas->Tex->CheckNeedsUpdate()) + if (canvas->Tex->CheckNeedsUpdate()) { screen->RenderTextureView(canvas->Tex, [=](IntRect& bounds) { diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 93a9b7da6..5c4dc376e 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -853,7 +853,7 @@ class Actor : Thinker native native bool LookForPlayers(bool allaround, LookExParams params = null); native bool TeleportMove(Vector3 pos, bool telefrag, bool modifyactor = true); native clearscope double DistanceBySpeed(Actor other, double speed) const; - native clearscope name GetSpecies(); + native name GetSpecies(); native void PlayActiveSound(); native void Howl(); native void DrawSplash (int count, double angle, int kind); From 48b23bdfae30ac7e8fbb818a15826376c8b67ef4 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 17 Oct 2024 23:45:09 -0400 Subject: [PATCH 07/16] - readd canvas check --- src/rendering/hwrenderer/hw_entrypoint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rendering/hwrenderer/hw_entrypoint.cpp b/src/rendering/hwrenderer/hw_entrypoint.cpp index bfa0d8b1c..e55c041a6 100644 --- a/src/rendering/hwrenderer/hw_entrypoint.cpp +++ b/src/rendering/hwrenderer/hw_entrypoint.cpp @@ -362,7 +362,7 @@ sector_t* RenderView(player_t* player) // Draw all canvases that changed for (FCanvas* canvas : AllCanvases) { - if (canvas->Tex->CheckNeedsUpdate()) + if (canvas->Tex && canvas->Tex->CheckNeedsUpdate()) { screen->RenderTextureView(canvas->Tex, [=](IntRect& bounds) { From ee16e47b11725b506f9cf2cd2b78147f73bb1fb7 Mon Sep 17 00:00:00 2001 From: dileepvr Date: Tue, 15 Oct 2024 21:29:21 -0600 Subject: [PATCH 08/16] FOV scales ortho up to 180 degrees One line change in r_utility.cpp affecting a custom field. Orthographic projection sees "more" of the sceen as fov increases, but only up to 180 degrees, after which it will have no effect. Orthographic projection has no meaning for fov since there is no Frustum. But since this is fundamental to the engine, I am reinterpreting it. Cherno wanted this too. I'll update the wiki if this gets in. --- src/rendering/r_utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index 3e40c3a0c..b7b6b452b 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -704,7 +704,7 @@ void FRenderViewpoint::SetViewAngle(const FViewWindow& viewWindow) HWAngles.Yaw = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees()); if (IsOrtho() && (camera->ViewPos->Offset.XY().Length() > 0.0)) - ScreenProj = 1.34396 / camera->ViewPos->Offset.Length(); // [DVR] Estimated. +/-1 should be top/bottom of screen. + ScreenProj = 1.34396 / camera->ViewPos->Offset.Length() / tan (FieldOfView.Radians()*0.5); // [DVR] Estimated. +/-1 should be top/bottom of screen. } From 131ce183dbfcdf1587f1bbf3c27fb7d0e4170970 Mon Sep 17 00:00:00 2001 From: dileepvr Date: Wed, 16 Oct 2024 07:46:32 -0600 Subject: [PATCH 09/16] Missed a line in RenderOrthoNoFog Tying up the fov fix. --- src/rendering/hwrenderer/scene/hw_bsp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rendering/hwrenderer/scene/hw_bsp.cpp b/src/rendering/hwrenderer/scene/hw_bsp.cpp index 0904a0207..82f90a3ba 100644 --- a/src/rendering/hwrenderer/scene/hw_bsp.cpp +++ b/src/rendering/hwrenderer/scene/hw_bsp.cpp @@ -990,7 +990,7 @@ void HWDrawInfo::RenderOrthoNoFog() double vxdbl = Viewpoint.camera->X(); double vydbl = Viewpoint.camera->Y(); double ext = Viewpoint.camera->ViewPos->Offset.Length() ? - 3.0 * Viewpoint.camera->ViewPos->Offset.Length() : 100.0; + 3.0 * Viewpoint.camera->ViewPos->Offset.Length() * tan (Viewpoint.FieldOfView.Radians()*0.5) : 100.0; FBoundingBox viewbox(vxdbl, vydbl, ext); for (unsigned int kk = 0; kk < Level->subsectors.Size(); kk++) From 6921bf18ce5aff984fe1abfdcef2c4de043e4de8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Oct 2024 13:11:48 +0200 Subject: [PATCH 10/16] do not open resource files from non-open file readers. --- src/common/filesystem/source/resourcefile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/filesystem/source/resourcefile.cpp b/src/common/filesystem/source/resourcefile.cpp index 81e2b7850..00a5234ca 100644 --- a/src/common/filesystem/source/resourcefile.cpp +++ b/src/common/filesystem/source/resourcefile.cpp @@ -162,6 +162,7 @@ static int nulPrintf(FSMessageLevel msg, const char* fmt, ...) FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileReader &file, bool containeronly, LumpFilterInfo* filter, FileSystemMessageFunc Printf, StringPool* sp) { + if (!file.isOpen()) return nullptr; if (Printf == nullptr) Printf = nulPrintf; for(auto func : funcs) { From b5fdd6deff2378a8a18fe68e69cbb277efe687f8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Oct 2024 13:13:11 +0200 Subject: [PATCH 11/16] fix bad string comparison. --- src/g_dumpinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index fcca4ed5b..99c4b6adf 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -163,7 +163,7 @@ CCMD (mapchecksum) for (int i = 1; i < argv.argc(); ++i) { - if(argv[i] == "*") + if(!strcmp(argv[i], "*")) { const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum)); From 769274656efb4131374dd431a0e79b6902cc9007 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Oct 2024 13:22:30 +0200 Subject: [PATCH 12/16] made FCommandLine::operator[] return a const char * and fixed two places where this triggered a compile error. --- src/common/console/c_commandline.cpp | 2 +- src/common/console/c_commandline.h | 2 +- src/common/rendering/r_videoscale.cpp | 2 +- src/gamedata/keysections.cpp | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/common/console/c_commandline.cpp b/src/common/console/c_commandline.cpp index 4f500ffe6..7fa9d1ff2 100644 --- a/src/common/console/c_commandline.cpp +++ b/src/common/console/c_commandline.cpp @@ -193,7 +193,7 @@ int FCommandLine::argc () return _argc; } -char *FCommandLine::operator[] (int i) +const char *FCommandLine::operator[] (int i) { if (_argv == NULL) { diff --git a/src/common/console/c_commandline.h b/src/common/console/c_commandline.h index dc5466df1..4886aa9c7 100644 --- a/src/common/console/c_commandline.h +++ b/src/common/console/c_commandline.h @@ -44,7 +44,7 @@ public: FCommandLine (const char *commandline, bool no_escapes = false); ~FCommandLine (); int argc (); - char *operator[] (int i); + const char *operator[] (int i); const char *args () { return cmd; } void Shift(); diff --git a/src/common/rendering/r_videoscale.cpp b/src/common/rendering/r_videoscale.cpp index 705fe905f..bfed3ec73 100644 --- a/src/common/rendering/r_videoscale.cpp +++ b/src/common/rendering/r_videoscale.cpp @@ -248,7 +248,7 @@ CCMD (vid_scaletoheight) } } -inline bool atob(char* I) +inline bool atob(const char* I) { if (stricmp (I, "true") == 0 || stricmp (I, "1") == 0) return true; diff --git a/src/gamedata/keysections.cpp b/src/gamedata/keysections.cpp index bcde05edd..25b71671b 100644 --- a/src/gamedata/keysections.cpp +++ b/src/gamedata/keysections.cpp @@ -100,12 +100,11 @@ CCMD (addkeysection) } // Limit the ini name to 32 chars - if (strlen (argv[2]) > 32) - argv[2][32] = 0; + FString name(argv[2], 32); for (unsigned i = 0; i < KeySections.Size(); i++) { - if (KeySections[i].mTitle.CompareNoCase(argv[2]) == 0) + if (KeySections[i].mTitle.CompareNoCase(name) == 0) { CurrentKeySection = i; return; From 3b07747af42940bffb138ad49f7c50c57bd82900 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 19 Oct 2024 10:17:01 -0400 Subject: [PATCH 13/16] Revert "- simplify and deconstruct logic for applying sector damage - also fixes voodoo doll sector damage in TNT MAP30" This reverts commit 3e33e31d1961f366229d5b4848fa29d2d797b8c3. Revert "Added MF9_FORCESECTORDAMAGE." This reverts commit 61bd3a739a0ca7509db46ddabbff1fc35bfd8908. --- src/playsim/actor.h | 1 - src/playsim/p_mobj.cpp | 6 +----- src/scripting/thingdef_data.cpp | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 708e06f4c..759d9d262 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -445,7 +445,6 @@ enum ActorFlag9 MF9_DECOUPLEDANIMATIONS = 0x00000010, // [RL0] Decouple model animations from states MF9_NOSECTORDAMAGE = 0x00000020, // [inkoalawetrust] Actor ignores any sector-based damage (i.e damaging floors, NOT crushers) MF9_ISPUFF = 0x00000040, // [AA] Set on actors by P_SpawnPuff - MF9_FORCESECTORDAMAGE = 0x00000080, // [inkoalawetrust] Actor ALWAYS takes hurt floor damage if there's any. Even if the floor doesn't have SECMF_HURTMONSTERS. }; // --- mobj.renderflags --- diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 32f650ca5..8d34e6c73 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -4436,11 +4436,7 @@ void AActor::Tick () if (ObjectFlags & OF_EuthanizeMe) return; } //[inkoalawetrust] Genericized level damage handling that makes sector, 3D floor, and TERRAIN flat damage affect monsters and other NPCs too. - bool afsdnope = !!(flags9 & MF9_NOSECTORDAMAGE); - bool afsdforce = !!(flags9 & MF9_FORCESECTORDAMAGE); - bool sfhurtmonsters = !!(Sector->MoreFlags & SECMF_HURTMONSTERS); - bool isplayer = (player != nullptr) && (this == player->mo); - if ((!afsdnope || afsdforce) && (isplayer || sfhurtmonsters || afsdforce)) + if (!(flags9 & MF9_NOSECTORDAMAGE) && (player || (player == nullptr && Sector->MoreFlags & SECMF_HURTMONSTERS))) { P_ActorOnSpecial3DFloor(this); P_ActorInSpecialSector(this,Sector); diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 90ba65f00..129c06b78 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -353,7 +353,6 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF9, DECOUPLEDANIMATIONS, AActor, flags9), DEFINE_FLAG(MF9, NOSECTORDAMAGE, AActor, flags9), DEFINE_PROTECTED_FLAG(MF9, ISPUFF, AActor, flags9), //[AA] was spawned by SpawnPuff - DEFINE_FLAG(MF9, FORCESECTORDAMAGE, AActor, flags9), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), From 5fb83d47621e9fb044de73bfc472245a7d4f58bd Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 19 Oct 2024 10:25:03 -0400 Subject: [PATCH 14/16] Revert "Added SECMF_HURTMONSTERS, SECMF_HARMINAIR and NOSECTORDAMAGE." This reverts commit 391f4965128f2f5e2c07d764d42f363c67d9ed1c. --- specs/udmf_zdoom.txt | 2 - src/gamedata/r_defs.h | 2 - src/maploader/udmf.cpp | 8 ---- src/namedef_custom.h | 2 - src/playsim/actor.h | 3 +- src/playsim/p_3dfloors.cpp | 18 ++++----- src/playsim/p_3dfloors.h | 3 +- src/playsim/p_mobj.cpp | 8 ---- src/playsim/p_spec.cpp | 65 +++++++++++++++++--------------- src/playsim/p_spec.h | 4 +- src/playsim/p_user.cpp | 9 +++++ src/scripting/thingdef_data.cpp | 1 - wadsrc/static/zscript/mapdata.zs | 8 ---- 13 files changed, 58 insertions(+), 75 deletions(-) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 9e4df5472..4f73fa9bd 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -307,8 +307,6 @@ Note: All fields default to false unless mentioned otherwise. leakiness = ; // Probability of leaking through radiation suit (0 = never, 256 = always), default = 0. damageterraineffect = ; // Will spawn a terrain splash when damage is inflicted. Default = false. damagehazard = ; // Changes damage model to Strife's delayed damage for the given sector. Default = false. - hurtmonsters = ; // Non-players like monsters and decorations are hurt by this sector in the same manner as player. Doesn't work with damagehazard. - harminair = ; // Actors in this sector are harmed by the damage effects of the floor even if they aren't touching it. floorterrain = ; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.' ceilingterrain = ; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.' floor_reflect = ; // reflectiveness of floor (OpenGL only, not functional on sloped sectors) diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index d6453b6f8..943893c66 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -504,8 +504,6 @@ enum SECMF_OVERLAPPING = 512, // floor and ceiling overlap and require special renderer action. SECMF_NOSKYWALLS = 1024, // Do not draw "sky walls" SECMF_LIFT = 2048, // For MBF monster AI - SECMF_HURTMONSTERS = 4096, // Monsters in this sector are hurt like players. - SECMF_HARMINAIR = 8192, // Actors in this sector are also hurt mid-air. }; enum diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index 1fd9869c3..9748e082f 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -1979,14 +1979,6 @@ public: Flag(sec->Flags, SECF_HAZARD, key); break; - case NAME_hurtmonsters: - Flag(sec->MoreFlags, SECMF_HURTMONSTERS, key); - break; - - case NAME_harminair: - Flag(sec->MoreFlags, SECMF_HARMINAIR, key); - break; - case NAME_floorterrain: sec->terrainnum[sector_t::floor] = P_FindTerrain(CheckString(key)); break; diff --git a/src/namedef_custom.h b/src/namedef_custom.h index dbf94dbaf..dd2e0066d 100644 --- a/src/namedef_custom.h +++ b/src/namedef_custom.h @@ -810,8 +810,6 @@ xx(damageinterval) xx(leakiness) xx(damageterraineffect) xx(damagehazard) -xx(hurtmonsters) -xx(harminair) xx(floorterrain) xx(ceilingterrain) xx(floor_reflect) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 759d9d262..d472decad 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -442,8 +442,7 @@ enum ActorFlag9 MF9_DOSHADOWBLOCK = 0x00000002, // [inkoalawetrust] Should the monster look for SHADOWBLOCK actors ? MF9_SHADOWBLOCK = 0x00000004, // [inkoalawetrust] Actors in the line of fire with this flag trigger the MF_SHADOW aiming penalty. MF9_SHADOWAIMVERT = 0x00000008, // [inkoalawetrust] Monster aim is also offset vertically when aiming at shadow actors. - MF9_DECOUPLEDANIMATIONS = 0x00000010, // [RL0] Decouple model animations from states - MF9_NOSECTORDAMAGE = 0x00000020, // [inkoalawetrust] Actor ignores any sector-based damage (i.e damaging floors, NOT crushers) + MF9_DECOUPLEDANIMATIONS = 0x00000010, // [RL0] Decouple model animations from states MF9_ISPUFF = 0x00000040, // [AA] Set on actors by P_SpawnPuff }; diff --git a/src/playsim/p_3dfloors.cpp b/src/playsim/p_3dfloors.cpp index 505bfa794..dd5a2bb0a 100644 --- a/src/playsim/p_3dfloors.cpp +++ b/src/playsim/p_3dfloors.cpp @@ -198,15 +198,15 @@ void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flags, int //========================================================================== // -// P_ActorOnSpecial3DFloor -// Checks to see if an actor is standing on or is inside a 3D floor (water) +// P_PlayerOnSpecial3DFloor +// Checks to see if a player is standing on or is inside a 3D floor (water) // and applies any specials.. // //========================================================================== -void P_ActorOnSpecial3DFloor(AActor* victim) +void P_PlayerOnSpecial3DFloor(player_t* player) { - for(auto rover : victim->Sector->e->XFloor.ffloors) + for(auto rover : player->mo->Sector->e->XFloor.ffloors) { if (!(rover->flags & FF_EXISTS)) continue; if (rover->flags & FF_FIX) continue; @@ -215,22 +215,22 @@ void P_ActorOnSpecial3DFloor(AActor* victim) if(rover->flags & FF_SOLID) { // Player must be on top of the floor to be affected... - if(victim->Z() != rover->top.plane->ZatPoint(victim)) continue; + if(player->mo->Z() != rover->top.plane->ZatPoint(player->mo)) continue; } else { //Water and DEATH FOG!!! heh if ((rover->flags & FF_NODAMAGE) || - victim->Z() > rover->top.plane->ZatPoint(victim) || - victim->Top() < rover->bottom.plane->ZatPoint(victim)) + player->mo->Z() > rover->top.plane->ZatPoint(player->mo) || + player->mo->Top() < rover->bottom.plane->ZatPoint(player->mo)) continue; } // Apply sector specials - P_ActorInSpecialSector(victim, rover->model); + P_PlayerInSpecialSector(player, rover->model); // Apply flat specials (using the ceiling!) - P_ActorOnSpecialFlat(victim, rover->model->GetTerrain(rover->top.isceiling)); + P_PlayerOnSpecialFlat(player, rover->model->GetTerrain(rover->top.isceiling)); break; } diff --git a/src/playsim/p_3dfloors.h b/src/playsim/p_3dfloors.h index 2dba7f713..05d222137 100644 --- a/src/playsim/p_3dfloors.h +++ b/src/playsim/p_3dfloors.h @@ -113,7 +113,8 @@ struct lightlist_t -void P_ActorOnSpecial3DFloor(AActor* victim); +class player_t; +void P_PlayerOnSpecial3DFloor(player_t* player); bool P_CheckFor3DFloorHit(AActor * mo, double z, bool trigger); bool P_CheckFor3DCeilingHit(AActor * mo, double z, bool trigger); diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 8d34e6c73..72251ec79 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -4435,14 +4435,6 @@ void AActor::Tick () // must have been removed if (ObjectFlags & OF_EuthanizeMe) return; } - //[inkoalawetrust] Genericized level damage handling that makes sector, 3D floor, and TERRAIN flat damage affect monsters and other NPCs too. - if (!(flags9 & MF9_NOSECTORDAMAGE) && (player || (player == nullptr && Sector->MoreFlags & SECMF_HURTMONSTERS))) - { - P_ActorOnSpecial3DFloor(this); - P_ActorInSpecialSector(this,Sector); - if (!isAbove(Sector->floorplane.ZatPoint(this)) || waterlevel) // Actor must be touching the floor for TERRAIN flats. - P_ActorOnSpecialFlat(this, P_GetThingFloorType(this)); - } if (tics != -1) { diff --git a/src/playsim/p_spec.cpp b/src/playsim/p_spec.cpp index 9c3fde6f4..ab52f285a 100644 --- a/src/playsim/p_spec.cpp +++ b/src/playsim/p_spec.cpp @@ -100,7 +100,7 @@ #include "c_console.h" #include "p_spec_thinkers.h" -static FRandom pr_actorinspecialsector ("ActorInSpecialSector"); +static FRandom pr_playerinspecialsector ("PlayerInSpecialSector"); EXTERN_CVAR(Bool, cl_predict_specials) EXTERN_CVAR(Bool, forcewater) @@ -419,18 +419,21 @@ bool P_PredictLine(line_t *line, AActor *mo, int side, int activationType) } // -// P_ActorInSpecialSector +// P_PlayerInSpecialSector // Called every tic frame -// that the actor origin is in a special sector +// that the player origin is in a special sector // -void P_ActorInSpecialSector (AActor *victim, sector_t * sector) +void P_PlayerInSpecialSector (player_t *player, sector_t * sector) { if (sector == NULL) - sector = victim->Sector; - - // Falling, not all the way down yet? - if (!(sector->MoreFlags & SECMF_HARMINAIR) && !victim->isAtZ(sector->LowestFloorAt(victim)) && !victim->waterlevel) - return; + { + // Falling, not all the way down yet? + sector = player->mo->Sector; + if (!player->mo->isAtZ(sector->LowestFloorAt(player->mo)) + && !player->mo->waterlevel) + { + return; + } // Has hit ground. @@ -441,7 +444,7 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) if (sector->damageinterval <= 0) sector->damageinterval = 32; // repair invalid damageinterval values - if (victim->player && sector->Flags & (SECF_EXIT1 | SECF_EXIT2)) + if (sector->Flags & (SECF_EXIT1 | SECF_EXIT2)) { for (int i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) @@ -460,7 +463,7 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) // different damage types yet, so that's not happening for now. // [MK] account for subclasses that may have "Full" protection (i.e.: prevent leaky damage) int ironfeet = 0; - for (auto i = victim->Inventory; i != NULL; i = i->Inventory) + for (auto i = player->mo->Inventory; i != NULL; i = i->Inventory) { if (i->IsKindOf(NAME_PowerIronFeet)) { @@ -472,28 +475,28 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) } } - if (victim->player && sector->Flags & SECF_ENDGODMODE) victim->player->cheats &= ~CF_GODMODE; - if ((ironfeet == 0 || (ironfeet < 2 && pr_actorinspecialsector() < sector->leakydamage))) + if (sector->Flags & SECF_ENDGODMODE) player->cheats &= ~CF_GODMODE; + if ((ironfeet == 0 || (ironfeet < 2 && pr_playerinspecialsector() < sector->leakydamage))) { - if (victim->player && sector->Flags & SECF_HAZARD) + if (sector->Flags & SECF_HAZARD) { - victim->player->hazardcount += sector->damageamount; - victim->player->hazardtype = sector->damagetype; - victim->player->hazardinterval = sector->damageinterval; + player->hazardcount += sector->damageamount; + player->hazardtype = sector->damagetype; + player->hazardinterval = sector->damageinterval; } else if (Level->time % sector->damageinterval == 0) { - if (!(victim->player && victim->player->cheats & (CF_GODMODE | CF_GODMODE2))) + if (!(player->cheats & (CF_GODMODE | CF_GODMODE2))) { - P_DamageMobj(victim, NULL, NULL, sector->damageamount, sector->damagetype); + P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype); } - if (victim->player && (sector->Flags & SECF_ENDLEVEL) && victim->player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) + if ((sector->Flags & SECF_ENDLEVEL) && player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) { Level->ExitLevel(0, false); } if (sector->Flags & SECF_DMGTERRAINFX) { - P_HitWater(victim, victim->Sector, victim->Pos(), false, true, true); + P_HitWater(player->mo, player->mo->Sector, player->mo->Pos(), false, true, true); } } } @@ -502,14 +505,14 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) { if (Level->time % sector->damageinterval == 0) { - P_GiveBody(victim, -sector->damageamount, 100); + P_GiveBody(player->mo, -sector->damageamount, 100); } } - if (victim->player && sector->isSecret()) + if (sector->isSecret()) { sector->ClearSecret(); - P_GiveSecret(Level, victim, true, true, sector->Index()); + P_GiveSecret(Level, player->mo, true, true, sector->Index()); } } @@ -648,13 +651,13 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, GiveSecret) //============================================================================ // -// P_ActorOnSpecialFlat +// P_PlayerOnSpecialFlat // //============================================================================ -void P_ActorOnSpecialFlat (AActor *victim, int floorType) +void P_PlayerOnSpecialFlat (player_t *player, int floorType) { - auto Level = victim->Level; + auto Level = player->mo->Level; if (Terrains[floorType].DamageAmount && !(Level->time % (Terrains[floorType].DamageTimeMask+1))) @@ -664,7 +667,7 @@ void P_ActorOnSpecialFlat (AActor *victim, int floorType) if (Terrains[floorType].AllowProtection) { auto pitype = PClass::FindActor(NAME_PowerIronFeet); - for (ironfeet = victim->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory) + for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory) { if (ironfeet->IsKindOf (pitype)) break; @@ -674,18 +677,20 @@ void P_ActorOnSpecialFlat (AActor *victim, int floorType) int damage = 0; if (ironfeet == NULL) { - damage = P_DamageMobj (victim, NULL, NULL, Terrains[floorType].DamageAmount, + damage = P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, Terrains[floorType].DamageMOD); } if (damage > 0 && Terrains[floorType].Splash != -1) { - S_Sound (victim, CHAN_AUTO, 0, + S_Sound (player->mo, CHAN_AUTO, 0, Splashes[Terrains[floorType].Splash].NormalSplashSound, 1, ATTN_IDLE); } } } + + // // P_UpdateSpecials // Animate planes, scroll walls, etc. diff --git a/src/playsim/p_spec.h b/src/playsim/p_spec.h index ebb5d93f9..cc7d990a9 100644 --- a/src/playsim/p_spec.h +++ b/src/playsim/p_spec.h @@ -90,8 +90,8 @@ bool P_ActivateLine (line_t *ld, AActor *mo, int side, int activationType, DVect bool P_TestActivateLine (line_t *ld, AActor *mo, int side, int activationType, DVector3 *optpos = NULL); bool P_PredictLine (line_t *ld, AActor *mo, int side, int activationType); -void P_ActorInSpecialSector (AActor *victim, sector_t * sector=NULL); -void P_ActorOnSpecialFlat (AActor *victim, int floorType); +void P_PlayerInSpecialSector (player_t *player, sector_t * sector=NULL); +void P_PlayerOnSpecialFlat (player_t *player, int floorType); void P_SectorDamage(FLevelLocals *Level, int tag, int amount, FName type, PClassActor *protectClass, int flags); void P_SetSectorFriction (FLevelLocals *level, int tag, int amount, bool alterFlag); double FrictionToMoveFactor(double friction); diff --git a/src/playsim/p_user.cpp b/src/playsim/p_user.cpp index a98a7c523..d3294ffd6 100644 --- a/src/playsim/p_user.cpp +++ b/src/playsim/p_user.cpp @@ -1204,6 +1204,15 @@ DEFINE_ACTION_FUNCTION(APlayerPawn, CheckMusicChange) void P_CheckEnvironment(player_t *player) { + P_PlayerOnSpecial3DFloor(player); + P_PlayerInSpecialSector(player); + + if (!player->mo->isAbove(player->mo->Sector->floorplane.ZatPoint(player->mo)) || + player->mo->waterlevel) + { + // Player must be touching the floor + P_PlayerOnSpecialFlat(player, P_GetThingFloorType(player->mo)); + } if (player->mo->Vel.Z <= -player->mo->FloatVar(NAME_FallingScreamMinSpeed) && player->mo->Vel.Z >= -player->mo->FloatVar(NAME_FallingScreamMaxSpeed) && player->mo->alternative == nullptr && player->mo->waterlevel == 0) diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 129c06b78..be7c299ed 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -351,7 +351,6 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF9, SHADOWBLOCK, AActor, flags9), DEFINE_FLAG(MF9, SHADOWAIMVERT, AActor, flags9), DEFINE_FLAG(MF9, DECOUPLEDANIMATIONS, AActor, flags9), - DEFINE_FLAG(MF9, NOSECTORDAMAGE, AActor, flags9), DEFINE_PROTECTED_FLAG(MF9, ISPUFF, AActor, flags9), //[AA] was spawned by SpawnPuff // Effect flags diff --git a/wadsrc/static/zscript/mapdata.zs b/wadsrc/static/zscript/mapdata.zs index 06a7bf3ea..5d45563eb 100644 --- a/wadsrc/static/zscript/mapdata.zs +++ b/wadsrc/static/zscript/mapdata.zs @@ -435,11 +435,6 @@ struct Sector native play SECMF_UNDERWATERMASK = 32+64, SECMF_DRAWN = 128, // sector has been drawn at least once SECMF_HIDDEN = 256, // Do not draw on textured automap - SECMF_OVERLAPPING = 512, // floor and ceiling overlap and require special renderer action. - SECMF_NOSKYWALLS = 1024, // Do not draw "sky walls" - SECMF_LIFT = 2048, // For MBF monster AI - SECMF_HURTMONSTERS = 4096, // Monsters in this sector are hurt like players. - SECMF_HARMINAIR = 8192, // Actors in this sector are also hurt mid-air. } native uint16 MoreFlags; @@ -457,9 +452,6 @@ struct Sector native play SECF_ENDLEVEL = 512, // ends level when health goes below 10 SECF_HAZARD = 1024, // Change to Strife's delayed damage handling. SECF_NOATTACK = 2048, // monsters cannot start attacks in this sector. - SECF_EXIT1 = 4096, - SECF_EXIT2 = 8192, - SECF_KILLMONSTERS = 16384,// Monsters in this sector are instantly killed. SECF_WASSECRET = 1 << 30, // a secret that was discovered SECF_SECRET = 1 << 31, // a secret sector From a45bf49616f93cdd0654107f6beb3ae65c011909 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Fri, 18 Oct 2024 21:36:16 +0800 Subject: [PATCH 15/16] Move no-mipmapping from actor renderflag/particle flag, to a material property in GLDEFS, where it makes more sense. The feature was introduced in the short-lived engine version of 4.13 which was deemed too broken and needed to be replaced with a newer version anyway, so might as well perform an API-breaking change at this point in time. Note that this currently only works for sprites (its primary targeted use case) -- walls, flats and models can be patched in later. --- src/common/textures/gametexture.h | 4 ++++ src/playsim/actor.h | 7 +++---- src/playsim/p_effect.h | 3 +-- src/r_data/gldefs.cpp | 14 ++++++++++++++ src/rendering/hwrenderer/scene/hw_drawstructs.h | 2 -- src/rendering/hwrenderer/scene/hw_sprites.cpp | 10 ++++++---- src/scripting/thingdef_data.cpp | 1 - wadsrc/static/zscript/constants.zs | 3 +-- 8 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/common/textures/gametexture.h b/src/common/textures/gametexture.h index 3eb3740a9..a55616e66 100644 --- a/src/common/textures/gametexture.h +++ b/src/common/textures/gametexture.h @@ -62,6 +62,7 @@ enum EGameTexFlags GTexf_OffsetsNotForFont = 512, // The offsets must be ignored when using this texture in a font. GTexf_NoTrim = 1024, // Don't perform trimming on this texture. GTexf_Seen = 2048, // Set to true when the texture is being used for rendering. Must be cleared manually if the check is needed. + GTexf_NoMipmap = 4096, // Disable mipmapping for this texture }; struct FMaterialLayers @@ -265,6 +266,9 @@ public: void SetGlowing(PalEntry color) { flags = (flags & ~GTexf_AutoGlowing) | GTexf_Glowing; GlowColor = color; } void SetDisableBrightmap() { flags |= GTexf_BrightmapChecked; Brightmap = nullptr; } + bool isNoMipmap() const { return !!(flags & GTexf_NoMipmap); } + void SetNoMipmap(bool set) { if (set) flags |= GTexf_NoMipmap; else flags &= ~GTexf_NoMipmap; } + bool isUserContent() const; int CheckRealHeight() { return xs_RoundToInt(Base->CheckRealHeight() / ScaleY); } void SetSize(int x, int y) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index d472decad..4fb96c952 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -502,10 +502,9 @@ enum ActorRenderFlag2 RF2_FLIPSPRITEOFFSETX = 0x0010, RF2_FLIPSPRITEOFFSETY = 0x0020, RF2_CAMFOLLOWSPLAYER = 0x0040, // Matches the cam's base position and angles to the main viewpoint. - RF2_NOMIPMAP = 0x0080, // [Nash] forces no mipmapping on sprites. Useful for tiny sprites that need to remain visually crisp - RF2_ISOMETRICSPRITES = 0x0100, - RF2_SQUAREPIXELS = 0x0200, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling - RF2_STRETCHPIXELS = 0x0400, // don't apply SQUAREPIXELS for ROLLSPRITES + RF2_ISOMETRICSPRITES = 0x0080, + RF2_SQUAREPIXELS = 0x0100, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling + RF2_STRETCHPIXELS = 0x0200, // don't apply SQUAREPIXELS for ROLLSPRITES }; // This translucency value produces the closest match to Heretic's TINTTAB. diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 4884739f2..735a87e81 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -69,8 +69,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, - SPF_NOMIPMAP = 1 << 14, - SPF_STRETCHPIXELS = 1 << 15, + SPF_STRETCHPIXELS = 1 << 14, }; class DVisualThinker; diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index 9b5be0e25..d92b9daf6 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -1270,6 +1270,7 @@ class GLDefsParser bool disable_fullbright_specified = false; bool thiswad = false; bool iwad = false; + bool no_mipmap = false; UserShaderDesc usershader; TArray texNameList; @@ -1319,6 +1320,10 @@ class GLDefsParser // only affects textures defined in the IWAD. iwad = true; } + else if (sc.Compare("nomipmap")) + { + no_mipmap = true; + } else if (sc.Compare("glossiness")) { sc.MustGetFloat(); @@ -1422,6 +1427,8 @@ class GLDefsParser if (!useme) return; } + tex->SetNoMipmap(no_mipmap); + FGameTexture **bindings[6] = { &mlay.Brightmap, @@ -1681,6 +1688,7 @@ class GLDefsParser bool disable_fullbright = false; bool thiswad = false; bool iwad = false; + bool no_mipmap = false; int maplump = -1; UserShaderDesc desc; desc.shaderType = SHADER_Default; @@ -1723,6 +1731,10 @@ class GLDefsParser if (!found) sc.ScriptError("Unknown material type '%s' specified\n", sc.String); } + else if (sc.Compare("nomipmap")) + { + no_mipmap = true; + } else if (sc.Compare("speed")) { sc.MustGetFloat(); @@ -1784,6 +1796,8 @@ class GLDefsParser return; } + tex->SetNoMipmap(no_mipmap); + int firstUserTexture; switch (desc.shaderType) { diff --git a/src/rendering/hwrenderer/scene/hw_drawstructs.h b/src/rendering/hwrenderer/scene/hw_drawstructs.h index b364128de..903806c67 100644 --- a/src/rendering/hwrenderer/scene/hw_drawstructs.h +++ b/src/rendering/hwrenderer/scene/hw_drawstructs.h @@ -393,8 +393,6 @@ public: TArray *lightlist; DRotator Angles; - bool nomipmap; // force the sprite to have no mipmaps (ensures tiny sprites in the distance stay crisp) - void SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent); void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight); bool CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp); diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 91125b750..cbca1a90d 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -224,7 +224,12 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent) state.SetFog(0, 0); } - int clampmode = nomipmap ? CLAMP_XY_NOMIP : CLAMP_XY; + int clampmode = CLAMP_XY; + + if (texture && texture->isNoMipmap()) + { + clampmode = CLAMP_XY_NOMIP; + } uint32_t spritetype = actor? uint32_t(actor->renderflags & RF_SPRITETYPEMASK) : 0; if (texture) state.SetMaterial(texture, UF_Sprite, (spritetype == RF_FACESPRITE) ? CTF_Expand : 0, clampmode, translation, OverrideShader); @@ -786,8 +791,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t return; } - nomipmap = (thing->renderflags2 & RF2_NOMIPMAP); - // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. if ((!r_debug_disable_vis_filter && !!(thing->RenderRequired & ~r_renderercaps)) || @@ -1420,7 +1423,6 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s actor = nullptr; this->particle = particle; fullbright = particle->flags & SPF_FULLBRIGHT; - nomipmap = particle->flags & SPF_NOMIPMAP; if (di->isFullbrightScene()) { diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index be7c299ed..dc7fcacc3 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -383,7 +383,6 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(RF2, FLIPSPRITEOFFSETX, AActor, renderflags2), DEFINE_FLAG(RF2, FLIPSPRITEOFFSETY, AActor, renderflags2), DEFINE_FLAG(RF2, CAMFOLLOWSPLAYER, AActor, renderflags2), - DEFINE_FLAG(RF2, NOMIPMAP, AActor, renderflags2), DEFINE_FLAG(RF2, ISOMETRICSPRITES, AActor, renderflags2), DEFINE_FLAG(RF2, SQUAREPIXELS, AActor, renderflags2), diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index 7ab58204f..5fcebf6e1 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -722,8 +722,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, - SPF_NOMIPMAP = 1 << 14, - SPF_STRETCHPIXELS = 1 << 15, + SPF_STRETCHPIXELS = 1 << 14, SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG }; From 689dc61fa8a58a5df0bcc3c9a785e93151351641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Sat, 19 Oct 2024 11:30:04 -0300 Subject: [PATCH 16/16] Fully revert #2479 --- src/playsim/actor.h | 2 +- src/playsim/p_enemy.cpp | 6 ------ src/playsim/p_spec.cpp | 1 + 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 4fb96c952..98e4d88b7 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -442,7 +442,7 @@ enum ActorFlag9 MF9_DOSHADOWBLOCK = 0x00000002, // [inkoalawetrust] Should the monster look for SHADOWBLOCK actors ? MF9_SHADOWBLOCK = 0x00000004, // [inkoalawetrust] Actors in the line of fire with this flag trigger the MF_SHADOW aiming penalty. MF9_SHADOWAIMVERT = 0x00000008, // [inkoalawetrust] Monster aim is also offset vertically when aiming at shadow actors. - MF9_DECOUPLEDANIMATIONS = 0x00000010, // [RL0] Decouple model animations from states + MF9_DECOUPLEDANIMATIONS = 0x00000010, // [RL0] Decouple model animations from states MF9_ISPUFF = 0x00000040, // [AA] Set on actors by P_SpawnPuff }; diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index 55f501488..f87c28654 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -464,12 +464,6 @@ static int P_IsUnderDamage(AActor* actor) dir |= cl->getDirection(); } // Q: consider crushing 3D floors too? - // [inkoalawetrust] Check for sectors that can harm the actor. - if (!(actor->flags9 & MF9_NOSECTORDAMAGE) && seclist->m_sector->damageamount > 0) - { - if (seclist->m_sector->MoreFlags & SECMF_HARMINAIR || actor->isAtZ(seclist->m_sector->LowestFloorAt(actor)) || actor->waterlevel) - return (actor->player || (actor->player == nullptr && seclist->m_sector->MoreFlags & SECMF_HURTMONSTERS)) ? -1 : 0; - } } return dir; } diff --git a/src/playsim/p_spec.cpp b/src/playsim/p_spec.cpp index ab52f285a..6ffc2d9af 100644 --- a/src/playsim/p_spec.cpp +++ b/src/playsim/p_spec.cpp @@ -434,6 +434,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector) { return; } + } // Has hit ground.