From a9c0765fe1dd934310835778d9c80cde3e4faf83 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 20 Apr 2020 12:49:18 +0300 Subject: [PATCH 01/23] - fixed potential crash on intermission cast screen --- src/intermission/intermission.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index a06feac8f..1efaa6acc 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -848,20 +848,20 @@ bool DIntermissionController::Responder (event_t *ev) { const char *cmd = Bindings.GetBind (ev->data1); - if (cmd != NULL && - (!stricmp(cmd, "toggleconsole") || - !stricmp(cmd, "screenshot"))) + if (cmd != nullptr) { - return false; - } - - // The following is needed to be able to enter main menu with a controller, - // by pressing buttons that are usually assigned to this action, Start and Back by default - if (!stricmp(cmd, "menu_main") || !stricmp(cmd, "pause")) - { - M_StartControlPanel(true); - M_SetMenu(NAME_Mainmenu, -1); - return true; + if (!stricmp(cmd, "toggleconsole") || !stricmp(cmd, "screenshot")) + { + return false; + } + // The following is needed to be able to enter main menu with a controller, + // by pressing buttons that are usually assigned to this action, Start and Back by default + else if (!stricmp(cmd, "menu_main") || !stricmp(cmd, "pause")) + { + M_StartControlPanel(true); + M_SetMenu(NAME_Mainmenu, -1); + return true; + } } } From c37dcc6eb4151137c2f2fead6c9f3b7eaf403552 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 20 Apr 2020 13:32:02 +0300 Subject: [PATCH 02/23] - added validation of game skill when changing a level --- src/g_level.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index bd3d86855..875ade355 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -634,8 +634,7 @@ void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags, nextlevel = levelname; } - if (nextSkill != -1) - NextSkill = nextSkill; + NextSkill = (unsigned)nextSkill < AllSkills.Size() ? nextSkill : -1; if (inflags & CHANGELEVEL_NOINTERMISSION) { From 426f40dd521c2fa8c99921edb66a1960328e11db Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 20 Apr 2020 15:08:33 +0300 Subject: [PATCH 03/23] - fixed crash when loading saved game that has no music --- src/sound/s_doomsound.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/sound/s_doomsound.cpp b/src/sound/s_doomsound.cpp index 4887f8e5c..371a70d4d 100644 --- a/src/sound/s_doomsound.cpp +++ b/src/sound/s_doomsound.cpp @@ -118,15 +118,6 @@ public: static FString LookupMusic(const char* musicname, int& order) { - if (strnicmp(musicname, ",CD,", 4) == 0) - { - static bool warned = false; - if (!warned) - Printf(TEXTCOLOR_RED "CD Audio no longer supported\n"); - warned = true; - return ""; - } - // allow specifying "*" as a placeholder to play the level's default music. if (musicname != nullptr && !strcmp(musicname, "*")) { @@ -146,6 +137,16 @@ static FString LookupMusic(const char* musicname, int& order) // got nothing, return nothing. return ""; } + + if (strnicmp(musicname, ",CD,", 4) == 0) + { + static bool warned = false; + if (!warned) + Printf(TEXTCOLOR_RED "CD Audio no longer supported\n"); + warned = true; + return ""; + } + if (*musicname == '/') musicname++; FString DEH_Music; From 62d4bbbe65f706fd0dd034db133783de3e6d20a3 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 21 Apr 2020 10:07:24 +0300 Subject: [PATCH 04/23] - restored Wads.GetNumLumps() scripted function https://forum.zdoom.org/viewtopic.php?t=68300 --- src/scripting/vmthunks.cpp | 2 +- wadsrc/static/zscript/base.zs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 02394188f..a55abc5e6 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -3005,7 +3005,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_AltHUD, GetLatency, Net_GetLatency) // //========================================================================== -DEFINE_ACTION_FUNCTION(_Wads, GetNumEntries) +DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps) { PARAM_PROLOGUE; ACTION_RETURN_INT(fileSystem.GetNumEntries()); diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 976d1b63d..a1800f9fd 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -879,7 +879,7 @@ struct Wads native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace); native static string ReadLump(int lump); - native static int GetNumEntries(); + native static int GetNumLumps(); native static string GetLumpName(int lump); native static string GetLumpFullName(int lump); native static int GetLumpNamespace(int lump); From 8c1db978b89ed23a6e5f3c7c10ac2382e2085882 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 21 Apr 2020 09:41:22 -0400 Subject: [PATCH 05/23] - fixed: hwrenderer materials were nullptr checked but the pointers were not always properly initialized --- src/common/textures/hw_material.h | 2 +- src/rendering/hwrenderer/scene/hw_renderstate.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/textures/hw_material.h b/src/common/textures/hw_material.h index f6311c962..ee752c1f4 100644 --- a/src/common/textures/hw_material.h +++ b/src/common/textures/hw_material.h @@ -47,7 +47,7 @@ class FMaterial bool TrimBorders(uint16_t *rect); public: - FTexture *tex; + FTexture *tex = nullptr; FTexture *sourcetex; // in case of redirection this is different from tex. FMaterial(FTexture *tex, bool forceexpand); diff --git a/src/rendering/hwrenderer/scene/hw_renderstate.h b/src/rendering/hwrenderer/scene/hw_renderstate.h index 6ec91b6c3..c20898169 100644 --- a/src/rendering/hwrenderer/scene/hw_renderstate.h +++ b/src/rendering/hwrenderer/scene/hw_renderstate.h @@ -90,7 +90,7 @@ struct FStateVec4 struct FMaterialState { - FMaterial *mMaterial; + FMaterial *mMaterial = nullptr; int mClampMode; int mTranslation; int mOverrideShader; From 1cf8c2f63e26f0175e8853743bcbbc0e8de118ce Mon Sep 17 00:00:00 2001 From: SanyaWaffles Date: Fri, 24 Apr 2020 01:16:35 -0400 Subject: [PATCH 06/23] Fix keybinds part 1 of whatever --- src/common/console/c_bind.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/console/c_bind.cpp b/src/common/console/c_bind.cpp index 609f2bf86..d941008db 100644 --- a/src/common/console/c_bind.cpp +++ b/src/common/console/c_bind.cpp @@ -59,11 +59,11 @@ const char *KeyNames[NUM_KEYS] = nullptr, "Escape", "1", "2", "3", "4", "5", "6", //00 "7", "8", "9", "0", "-", "=", "Backspace","Tab", //08 "Q", "W", "E", "R", "T", "Y", "U", "I", //10 - "O", "P", "[", "]", "Enter", "LCtrl", "A", "S", //18 + "O", "P", "[", "]", "Enter", "Ctrl", "A", "S", //18 "D", "F", "G", "H", "J", "K", "L", ";", //20 - "'", "`", "LShift", "\\", "Z", "X", "C", "V", //28 + "'", "`", "Shift", "\\", "Z", "X", "C", "V", //28 "B", "N", "M", ",", ".", "/", "RShift", "KP*", //30 - "LAlt", "Space", "CapsLock", "F1", "F2", "F3", "F4", "F5", //38 + "Alt", "Space", "CapsLock", "F1", "F2", "F3", "F4", "F5", //38 "F6", "F7", "F8", "F9", "F10", "NumLock", "Scroll", "KP7", //40 "KP8", "KP9", "KP-", "KP4", "KP5", "KP6", "KP+", "KP1", //48 "KP2", "KP3", "KP0", "KP.", nullptr, nullptr, "OEM102", "F11", //50 From 6a604f35cb38738df5b7d2c02a8f9ce91576a6b0 Mon Sep 17 00:00:00 2001 From: SanyaWaffles Date: Fri, 24 Apr 2020 03:38:52 -0400 Subject: [PATCH 07/23] A much smarter DEFBINDS fix. Check if the lump is in the range of an IWAD, if so, override the settings... if not, don't override the settings. https://forum.zdoom.org/viewtopic.php?f=2&t=68292 --- src/common/console/c_bind.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/console/c_bind.cpp b/src/common/console/c_bind.cpp index d941008db..d80447475 100644 --- a/src/common/console/c_bind.cpp +++ b/src/common/console/c_bind.cpp @@ -723,7 +723,13 @@ void C_SetDefaultKeys(const char* baseconfig) lastlump = 0; while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1) { - ReadBindings(lump, false); + // [SW] - We need to check to see the origin of the DEFBINDS... if it + // Comes from an IWAD/IPK3/IPK7 allow it to override the users settings... + // If it comes from a user mod however, don't. + if (fileSystem.GetFileContainer(lump) > fileSystem.GetMaxIwadNum()) + ReadBindings(lump, false); + else + ReadBindings(lump, true); } } From 994550fb006c11f68d7fd62de462010000b2456e Mon Sep 17 00:00:00 2001 From: SanyaWaffles Date: Fri, 24 Apr 2020 03:56:57 -0400 Subject: [PATCH 08/23] Add the check to the other loop per Graf's request. --- src/common/console/c_bind.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/console/c_bind.cpp b/src/common/console/c_bind.cpp index d80447475..7dcabf96c 100644 --- a/src/common/console/c_bind.cpp +++ b/src/common/console/c_bind.cpp @@ -717,7 +717,13 @@ void C_SetDefaultKeys(const char* baseconfig) while ((lump = fileSystem.FindLumpFullName(baseconfig, &lastlump)) != -1) { if (fileSystem.GetFileContainer(lump) > 0) break; - ReadBindings(lump, true); + // [SW] - We need to check to see the origin of the DEFBINDS... if it + // Comes from an IWAD/IPK3/IPK7 allow it to override the users settings... + // If it comes from a user mod however, don't. + if (fileSystem.GetFileContainer(lump) > fileSystem.GetMaxIwadNum()) + ReadBindings(lump, false); + else + ReadBindings(lump, true); } lastlump = 0; From 573b2958c66cdc03a489c1d0205b2caca0b0c3f6 Mon Sep 17 00:00:00 2001 From: PaulyB <43163391+3saster@users.noreply.github.com> Date: Fri, 24 Apr 2020 19:16:06 -0700 Subject: [PATCH 09/23] Added MTF_NOCOUNT to spawn flags --- src/doomdata.h | 1 + src/playsim/p_mobj.cpp | 13 +++++++++++++ wadsrc/static/zscript/constants.zs | 1 + 3 files changed, 15 insertions(+) diff --git a/src/doomdata.h b/src/doomdata.h index 572ebb61e..d52d82389 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -418,6 +418,7 @@ enum EMapThingFlags MTF_SECRET = 0x080000, // Secret pickup MTF_NOINFIGHTING = 0x100000, + MTF_NOCOUNT = 0x200000, // Removes COUNTKILL/COUNTITEM // BOOM and DOOM compatible versions of some of the above diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index de0ff1b6b..0f6f32e9d 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -4664,6 +4664,19 @@ void AActor::HandleSpawnFlags () Level->total_secrets++; } } + if (SpawnFlags & MTF_NOCOUNT) + { + if (flags & MF_COUNTKILL) + { + flags &= ~MF_COUNTKILL; + Level->total_monsters--; + } + if (flags & MF_COUNTITEM) + { + flags &= ~MF_COUNTITEM; + Level->total_items--; + } + } } DEFINE_ACTION_FUNCTION(AActor, HandleSpawnFlags) diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index 02e6d4fce..725044afe 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -997,6 +997,7 @@ enum EMapThingFlags MTF_SECRET = 0x080000, // Secret pickup MTF_NOINFIGHTING = 0x100000, + MTF_NOCOUNT = 0x200000, // Removes COUNTKILL/COUNTITEM }; enum ESkillProperty From 3377486b8e38b11d308b7a79a10dfd57e3a4004a Mon Sep 17 00:00:00 2001 From: Skepticist Date: Sun, 26 Apr 2020 23:34:57 -0700 Subject: [PATCH 10/23] Added a number of maps that can make use of the MTF_NOCOUNT flag All but the Hell Revealed case are thanks to Skepticist from Doomworld --- wadsrc/static/zscript/level_compatibility.zs | 151 +++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/wadsrc/static/zscript/level_compatibility.zs b/wadsrc/static/zscript/level_compatibility.zs index 44fb88e71..ee81f4d7a 100644 --- a/wadsrc/static/zscript/level_compatibility.zs +++ b/wadsrc/static/zscript/level_compatibility.zs @@ -1040,6 +1040,20 @@ class LevelCompatibility : LevelPostProcessor ClearSectorTags(214); break; } + case '9A4615498C3451413F1CD3D15099ACC7': // Eternal Doom map05 + { + // an imp and two cyberdemons are located at the softlock area + SetThingFlags(272, GetThingFlags (272) | MTF_NOCOUNT); + SetThingFlags(273, GetThingFlags (273) | MTF_NOCOUNT); + SetThingFlags(274, GetThingFlags (274) | MTF_NOCOUNT); + break; + } + case '8B55842D5A509902738040AF10B4E787': // Eternal Doom map10 + { + // soulsphere at the end of the level is there merely to replicate the start of the next map + SetThingFlags(548, GetThingFlags (548) | MTF_NOCOUNT); + break; + } case 'DCE862393CAAA6FF1294FB7056B53057': // UAC Ultra map07 { @@ -1488,6 +1502,16 @@ class LevelCompatibility : LevelPostProcessor SetLineFlags(2040, Line.ML_REPEAT_SPECIAL); break; } + case '145C4DFCF843F2B92C73036BA0E1D98A': // Hell Revealed MAP26 + { + // The 4 archviles that produce the ghost monsters cannot be killed + // Make them not count so they still produce ghosts while allowing 100% kills. + SetThingFlags(320, GetThingFlags (320) | MTF_NOCOUNT); + SetThingFlags(347, GetThingFlags (347) | MTF_NOCOUNT); + SetThingFlags(495, GetThingFlags (495) | MTF_NOCOUNT); + SetThingFlags(496, GetThingFlags (496) | MTF_NOCOUNT); + break; + } case '0E379EEBEB189F294ED122BC60D10A68': // Hellbound MAP29 { @@ -1948,6 +1972,133 @@ class LevelCompatibility : LevelPostProcessor SetSectorSpecial(240, 0); break; } + + case '1497894956B3C8EBE8A240B7FDD99C6A': // Memento Mori 2 MAP25 + { + // an imp is used for the lift activation and cannot be killed + SetThingFlags(51, GetThingFlags (51) | MTF_NOCOUNT); + break; + } + + case '51960F3E9D46449E98DBC7D97F49DB23': // Shotgun Symphony E1M1 + { + // harmless cyberdemon included for the 'story' sake + SetThingFlags(158, GetThingFlags (158) | MTF_NOCOUNT); + break; + } + + case '60D362BAE16B4C10A1DCEE442C878CAE': // 50 Shades of Graytall MAP06 + { + // there are four invisibility spheres used for decoration + SetThingFlags(144, GetThingFlags (144) | MTF_NOCOUNT); + SetThingFlags(145, GetThingFlags (145) | MTF_NOCOUNT); + SetThingFlags(194, GetThingFlags (194) | MTF_NOCOUNT); + SetThingFlags(195, GetThingFlags (195) | MTF_NOCOUNT); + break; + } + + case 'C104E740CC3F70BCFD5D2EA8E833318D': // 50 Monsters MAP29 + { + // there are two invisibility spheres used for decoration + SetThingFlags(111, GetThingFlags (111) | MTF_NOCOUNT); + SetThingFlags(112, GetThingFlags (112) | MTF_NOCOUNT); + break; + } + + case '76393C84102480A4C75A4674C9C3217A': // Deadly Standards 2 E2M8 + { + // 923 lost souls are used as environmental hazard + for (int i = 267; i < 275; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 482; i < 491; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 510; i < 522; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 880; i < 1510; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 1622; i < 1660; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + + for (int i = 1682; i < 1820; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 1847; i < 1875; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 2110; i < 2114; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 2243; i < 2293; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + + SetThingFlags(493, GetThingFlags (493) | MTF_NOCOUNT); + SetThingFlags(573, GetThingFlags (573) | MTF_NOCOUNT); + SetThingFlags(613, GetThingFlags (613) | MTF_NOCOUNT); + SetThingFlags(614, GetThingFlags (614) | MTF_NOCOUNT); + SetThingFlags(1679, GetThingFlags (1679) | MTF_NOCOUNT); + SetThingFlags(1680, GetThingFlags (1680) | MTF_NOCOUNT); + break; + } + + case '42B4D294A60BE4E3500AF150291CF6D4': // Hell Ground MAP05 + { + // 5 cyberdemons are located at the 'pain end' sector + for (int i = 523; i < 528; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + break; + } + + case '0C0513A9821F26F3D7997E3B0359A318': // Mayhem 1500 MAP06 + { + // there's an archvile behind the bossbrain at the very end that can't be killed + SetThingFlags(61, GetThingFlags (61) | MTF_NOCOUNT); + break; + } + + case '00641DA23DDE998F6725BC5896A0DBC2': // 20 Years of Doom E1M8 + { + // 32 lost souls are located at the 'pain end' sector + for (int i = 1965; i < 1975; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 2189; i < 2202; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 2311; i < 2320; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + break; + } + + case 'EEBDD9CA280F6FF06C30AF2BEE85BF5F': // 2002ad10.wad E3M3 + { + // swarm of cacodemons at the end meant to be pseudo-endless and not killed + for (int i = 467; i < 547; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + break; + } + + case '988DFF5BB7073B857DEE3957A91C8518': // Speed of Doom MAP14 + { + // you can get only one of the soulspheres, the other, depending on your choice, becomes unavailable + SetThingFlags(1044, GetThingFlags (1044) | MTF_NOCOUNT); + SetThingFlags(1045, GetThingFlags (1045) | MTF_NOCOUNT); + break; + } + + case '361734AC5D78E872A05335C83E4F6DB8': // inf-lutz.wad E3M8 + { + // there is a trap with 10 cyberdemons at the end of the map, you are not meant to kill them + for (int i = 541; i < 546; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + for (int i = 638; i < 643; i++) + SetThingFlags (i, GetThingFlags (i) | MTF_NOCOUNT); + break; + } + + case '8F844B272E7235E82EA78AD2A2EB2D4A': // Serenity E3M7 + { + // two spheres can't be obtained and thus should not count towards 100% items + SetThingFlags(443, GetThingFlags (443) | MTF_NOCOUNT); + SetThingFlags(444, GetThingFlags (444) | MTF_NOCOUNT); + // one secret is unobtainable + SetSectorSpecial (97, 0); + break; + } } } } From 8d1451689b51ce992b9787e6bb4136268a264bc0 Mon Sep 17 00:00:00 2001 From: PaulyB <43163391+3saster@users.noreply.github.com> Date: Mon, 27 Apr 2020 00:35:07 -0700 Subject: [PATCH 11/23] Exposed MTF_NOCOUNT to UDMF --- src/common/engine/namedef.h | 1 + src/maploader/udmf.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/common/engine/namedef.h b/src/common/engine/namedef.h index 5cafc87ce..7d7cff000 100644 --- a/src/common/engine/namedef.h +++ b/src/common/engine/namedef.h @@ -462,6 +462,7 @@ xx(Friend) xx(Strifeally) xx(Standing) xx(Countsecret) +xx(NoCount) xx(Score) xx(Roll) xx(Scale) diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index 5a059be0b..febaae945 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -637,6 +637,10 @@ public: Flag(th->flags, MTF_SECRET, key); break; + case NAME_NoCount: + Flag(th->flags, MTF_NOCOUNT, key); + break; + case NAME_Floatbobphase: CHECK_N(Zd | Zdt) th->FloatbobPhase = CheckInt(key); From 66bac4561501a6fa8de40940e86239ecfe806034 Mon Sep 17 00:00:00 2001 From: PaulyB <43163391+3saster@users.noreply.github.com> Date: Mon, 27 Apr 2020 11:25:41 -0700 Subject: [PATCH 12/23] Properly namespaced UDMF flag --- src/maploader/udmf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index febaae945..e4428263a 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -638,6 +638,7 @@ public: break; case NAME_NoCount: + CHECK_N(Zd | Zdt) Flag(th->flags, MTF_NOCOUNT, key); break; From 2adf1c6a6b8b6459d031f019f3103ede11178b73 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 29 Apr 2020 07:57:17 +0200 Subject: [PATCH 13/23] - fixed ZScript compiler crash with dereferencing null pointers --- src/common/scripting/backend/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index aaef459a6..8368220d3 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -6362,7 +6362,7 @@ FxExpression *FxMemberIdentifier::Resolve(FCompileContext& ctx) if (Object->ValueType->isRealPointer()) { auto ptype = Object->ValueType->toPointer()->PointedType; - if (ptype->isContainer()) + if (ptype && ptype->isContainer()) { auto ret = ResolveMember(ctx, ctx.Class, Object, static_cast(ptype)); delete this; From f65a97322e9debe2c9c155c4b7dd75a32809c6dc Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Tue, 31 Mar 2020 19:30:27 +0800 Subject: [PATCH 14/23] Add an alpha parameter to StatusBar.DrawBar --- wadsrc/static/zscript/ui/statusbar/statusbar.zs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wadsrc/static/zscript/ui/statusbar/statusbar.zs b/wadsrc/static/zscript/ui/statusbar/statusbar.zs index 131649a2f..4944104d8 100644 --- a/wadsrc/static/zscript/ui/statusbar/statusbar.zs +++ b/wadsrc/static/zscript/ui/statusbar/statusbar.zs @@ -1019,7 +1019,7 @@ class BaseStatusBar native ui // //============================================================================ - void DrawBar(String ongfx, String offgfx, double curval, double maxval, Vector2 position, int border, int vertical, int flags = 0) + void DrawBar(String ongfx, String offgfx, double curval, double maxval, Vector2 position, int border, int vertical, int flags = 0, double alpha = 1.0) { let ontex = TexMan.CheckForTexture(ongfx, TexMan.TYPE_MiscPatch); if (!ontex.IsValid()) return; @@ -1050,17 +1050,17 @@ class BaseStatusBar native ui for(int i = 0; i < 4; i++) Clip[i] += border; //Draw the whole foreground - DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP); + DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP, alpha); SetClipRect(position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3], flags); } if (offtex.IsValid() && TexMan.GetScaledSize(offtex) == texsize) DrawTexture(offtex, position, flags | DI_ITEM_LEFT_TOP); - else Fill(color(255,0,0,0), position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3]); + else Fill(color(int(255*alpha),0,0,0), position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3]); - if (border == 0) + if (border == 0) { SetClipRect(position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3], flags); - DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP); + DrawTexture(ontex, position, flags | DI_ITEM_LEFT_TOP, alpha); } // restore the previous clipping rectangle screen.SetClipRect(cx, cy, cw, ch); From d563b0339c236e3867500343123b5e4b825f369d Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Wed, 1 Apr 2020 01:45:28 +0800 Subject: [PATCH 15/23] Apply alpha to the background texture in DrawBar --- wadsrc/static/zscript/ui/statusbar/statusbar.zs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/ui/statusbar/statusbar.zs b/wadsrc/static/zscript/ui/statusbar/statusbar.zs index 4944104d8..c2ed4c6d9 100644 --- a/wadsrc/static/zscript/ui/statusbar/statusbar.zs +++ b/wadsrc/static/zscript/ui/statusbar/statusbar.zs @@ -1054,7 +1054,7 @@ class BaseStatusBar native ui SetClipRect(position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3], flags); } - if (offtex.IsValid() && TexMan.GetScaledSize(offtex) == texsize) DrawTexture(offtex, position, flags | DI_ITEM_LEFT_TOP); + if (offtex.IsValid() && TexMan.GetScaledSize(offtex) == texsize) DrawTexture(offtex, position, flags | DI_ITEM_LEFT_TOP, alpha); else Fill(color(int(255*alpha),0,0,0), position.X + Clip[0], position.Y + Clip[1], texsize.X - Clip[0] - Clip[2], texsize.Y - Clip[1] - Clip[3]); if (border == 0) From 6b70cad6e1fc8d161e893f4e118f4e20d14e1622 Mon Sep 17 00:00:00 2001 From: arookas Date: Tue, 24 Mar 2020 23:21:26 -0400 Subject: [PATCH 16/23] Add option to invert mouse x --- src/d_main.cpp | 6 +++++- src/g_game.cpp | 1 + wadsrc/static/menudef.txt | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 163c9824f..bf2eb02df 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -171,6 +171,7 @@ EXTERN_CVAR (Bool, freelook) EXTERN_CVAR (Float, m_pitch) EXTERN_CVAR (Float, m_yaw) EXTERN_CVAR (Bool, invertmouse) +EXTERN_CVAR (Bool, invertmousex) EXTERN_CVAR (Bool, lookstrafe) EXTERN_CVAR (Int, screenblocks) EXTERN_CVAR (Bool, sv_cheats) @@ -449,7 +450,10 @@ void D_PostEvent (const event_t *ev) } if (!buttonMap.ButtonDown(Button_Strafe) && !lookstrafe) { - G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0), true); + int turn = int(ev->x * m_yaw * mouse_sensitivity * 8.0); + if (invertmousex) + turn = -turn; + G_AddViewAngle (turn, true); events[eventhead].x = 0; } if ((events[eventhead].x | events[eventhead].y) == 0) diff --git a/src/g_game.cpp b/src/g_game.cpp index 0bf781260..b29f67d6b 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -202,6 +202,7 @@ int lookspeed[2] = {450, 512}; CVAR (Bool, cl_run, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always run? CVAR (Bool, invertmouse, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Invert mouse look down/up? +CVAR (Bool, invertmousex, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Invert mouse look left/right? CVAR (Bool, freelook, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always mlook? CVAR (Bool, lookstrafe, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always strafe with mouse? CVAR (Float, m_pitch, 1.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Mouse speeds diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index b59af595f..e7803545e 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -734,6 +734,7 @@ OptionMenu "MouseOptions" protected Slider "$MOUSEMNU_STRAFESPEED", "m_side", 0, 2.5, 0.1 StaticText "" Option "$MOUSEMNU_ALWAYSMOUSELOOK", "freelook", "OnOff" + Option "$MOUSEMNU_INVERTMOUSEX", "invertmousex", "OnOff" Option "$MOUSEMNU_INVERTMOUSE", "invertmouse", "OnOff" Option "$MOUSEMNU_LOOKSPRING", "lookspring", "OnOff" Option "$MOUSEMNU_LOOKSTRAFE", "lookstrafe", "OnOff" From 4b4ff8dd0e55178be233ab97d04bcaa28a425e63 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 30 Apr 2020 12:55:09 +0600 Subject: [PATCH 17/23] Fix bouncing missiles not dealing damage when hitting top/bottom (#1068) * Fix bouncing missiles not dealing damage when hitting top/bottom --- src/playsim/p_local.h | 1 + src/playsim/p_map.cpp | 84 +++++++++++++++++---------- src/playsim/p_mobj.cpp | 1 + wadsrc/static/zscript/actors/actor.zs | 1 + 4 files changed, 55 insertions(+), 32 deletions(-) diff --git a/src/playsim/p_local.h b/src/playsim/p_local.h index 0c7bb1bc7..2a031b689 100644 --- a/src/playsim/p_local.h +++ b/src/playsim/p_local.h @@ -246,6 +246,7 @@ extern TArray portalhit; int P_TestMobjLocation (AActor *mobj); int P_TestMobjZ (AActor *mobj, bool quick=true, AActor **pOnmobj = NULL); bool P_CheckPosition(AActor *thing, const DVector2 &pos, bool actorsonly = false); +void P_DoMissileDamage(AActor* inflictor, AActor* target); bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, bool actorsonly = false); AActor *P_CheckOnmobj (AActor *thing); void P_FakeZMovement (AActor *mo); diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index ae0eecef0..ac7b817d5 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -1230,6 +1230,57 @@ static bool CanAttackHurt(AActor *victim, AActor *shooter) return true; } +//========================================================================== +// +// P_DoMissileDamage +// Handle damaging/poisoning enemies from missiles. +// target is the target to be dealt damage to. +// inflictor is the actor dealing the damage. +// +//========================================================================== + +void P_DoMissileDamage(AActor* inflictor, AActor* target) +{ + // Do poisoning (if using new style poison) + if (inflictor->PoisonDamage > 0 && inflictor->PoisonDuration != INT_MIN) + { + P_PoisonMobj(target, inflictor, inflictor->target, inflictor->PoisonDamage, inflictor->PoisonDuration, inflictor->PoisonPeriod, inflictor->PoisonDamageType); + } + + // Do damage + int damage = inflictor->GetMissileDamage((inflictor->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1); + if ((damage > 0) || (inflictor->flags6 & MF6_FORCEPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) + { + int newdam = P_DamageMobj(target, inflictor, inflictor->target, damage, inflictor->DamageType); + if (damage > 0) + { + if ((inflictor->flags5 & MF5_BLOODSPLATTER) && + !(target->flags & MF_NOBLOOD) && + !(target->flags2 & MF2_REFLECTIVE) && + !(target->flags2 & (MF2_INVULNERABLE | MF2_DORMANT)) && + !(inflictor->flags3 & MF3_BLOODLESSIMPACT) && + (pr_checkthing() < 192)) + { + P_BloodSplatter(inflictor->Pos(), target, inflictor->AngleTo(target)); + } + if (!(inflictor->flags3 & MF3_BLOODLESSIMPACT)) + { + P_TraceBleed(newdam > 0 ? newdam : damage, target, inflictor); + } + } + } + else + { + P_GiveBody(target, -damage); + } +} +DEFINE_ACTION_FUNCTION(AActor, DoMissileDamage) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_OBJECT_NOT_NULL(target, AActor); + P_DoMissileDamage(self, target); + return 0; +} //========================================================================== // // PIT_CheckThing @@ -1555,38 +1606,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch } } - // Do poisoning (if using new style poison) - if (tm.thing->PoisonDamage > 0 && tm.thing->PoisonDuration != INT_MIN) - { - P_PoisonMobj(thing, tm.thing, tm.thing->target, tm.thing->PoisonDamage, tm.thing->PoisonDuration, tm.thing->PoisonPeriod, tm.thing->PoisonDamageType); - } - - // Do damage - damage = tm.thing->GetMissileDamage((tm.thing->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1); - 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) - { - if ((tm.thing->flags5 & MF5_BLOODSPLATTER) && - !(thing->flags & MF_NOBLOOD) && - !(thing->flags2 & MF2_REFLECTIVE) && - !(thing->flags2 & (MF2_INVULNERABLE | MF2_DORMANT)) && - !(tm.thing->flags3 & MF3_BLOODLESSIMPACT) && - (pr_checkthing() < 192)) - { - P_BloodSplatter(tm.thing->Pos(), thing, tm.thing->AngleTo(thing)); - } - if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT)) - { - P_TraceBleed(newdam > 0 ? newdam : damage, thing, tm.thing); - } - } - } - else - { - P_GiveBody(thing, -damage); - } + P_DoMissileDamage(tm.thing, thing); if ((thing->flags7 & MF7_THRUREFLECT) && (thing->flags2 & MF2_REFLECTIVE) && (tm.thing->flags & MF_MISSILE)) { diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 0f6f32e9d..c98bc9c7b 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -3976,6 +3976,7 @@ void AActor::Tick () // to be in line with the case when an actor's side is hit. if (!res && (flags & MF_MISSILE)) { + P_DoMissileDamage(this, onmo); P_ExplodeMissile(this, nullptr, onmo); } } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 0b3841a19..27a929fdd 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -759,6 +759,7 @@ class Actor : Thinker native native void GiveSecret(bool printmsg = true, bool playsound = true); native clearscope double GetCameraHeight() const; native clearscope double GetGravity() const; + native void DoMissileDamage(Actor target); //========================================================================== // From 331f3d85d61fb52c571afbdb9f76a8da8a834ca4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 30 Apr 2020 16:26:12 +0300 Subject: [PATCH 18/23] - fixed secondary ammo display in strife status bar https://forum.zdoom.org/viewtopic.php?t=68315 --- wadsrc/static/zscript/ui/statusbar/strife_sbar.zs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs b/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs index 79fc0ada4..912effbb4 100644 --- a/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs +++ b/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs @@ -353,8 +353,8 @@ class StrifeStatusBar : BaseStatusBar if (ammo2 != NULL && ammo1!=ammo2) { // Draw secondary ammo just above the primary ammo - DrawString(mGrnFont, FormatNumber(ammo1.Amount, 3), (-23, -48)); - DrawInventoryIcon(ammo1, (-14, -55)); + DrawString(mGrnFont, FormatNumber(ammo2.Amount, 3), (-23, -48)); + DrawInventoryIcon(ammo2, (-14, -55)); } } From a528290b5c6e1bae4179756adb56beeedc1cfa22 Mon Sep 17 00:00:00 2001 From: PaulyB <43163391+3saster@users.noreply.github.com> Date: Sat, 2 May 2020 23:22:44 -0700 Subject: [PATCH 19/23] Fix single top level filter folder not being read I have no idea why the missing comma broke it in this particular way... --- 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 bf2eb02df..eee2b3647 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -186,7 +186,7 @@ extern bool insave; extern TDeletingArray LightDefaults; const char* iwad_folders[13] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/" }; -const char* iwad_reserved[12] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo" "maps/" }; +const char* iwad_reserved[12] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo", "maps/" }; CUSTOM_CVAR(Float, i_timescale, 1.0f, CVAR_NOINITCALL) From 50e0353668738c54e7f3e6bbaf6bf3f399e368fb Mon Sep 17 00:00:00 2001 From: Nemrtvi <26684396+Nemrtvi@users.noreply.github.com> Date: Wed, 6 May 2020 10:55:44 +0200 Subject: [PATCH 20/23] =?UTF-8?q?Revised=20Serbian=20characters=20=D0=8B/?= =?UTF-8?q?=D0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filter/doom.id/fonts/bigfont/0402.lmp | Bin 281 -> 301 bytes .../filter/doom.id/fonts/bigfont/040B.lmp | Bin 279 -> 297 bytes .../filter/doom.id/fonts/bigupper/0402.lmp | Bin 376 -> 404 bytes .../filter/doom.id/fonts/bigupper/040B.lmp | Bin 368 -> 397 bytes .../filter/doom.id/fonts/bigupper/0452.lmp | Bin 281 -> 301 bytes .../filter/doom.id/fonts/bigupper/045B.lmp | Bin 279 -> 297 bytes 6 files changed, 0 insertions(+), 0 deletions(-) diff --git a/wadsrc_extra/static/filter/doom.id/fonts/bigfont/0402.lmp b/wadsrc_extra/static/filter/doom.id/fonts/bigfont/0402.lmp index a00a09d09988ad747ef8e578264644a5d6582d23..e159c4c17faf44240992bdb8e1e3cd16c17e9905 100644 GIT binary patch literal 301 zcmYk0%MHRX3_y)k3Wp+b<<2l18%0qS5-Acw9Ks5$zzVFu3ar2itiS-}IpOE(RnBwl zcqyG|Y{0-4j&OoAT;K{fxWfaUAQO=VtY8h&~m zHhzS)+;Kl)eBg`W+hXXAt`06U^toXE#DIwG5fAU7T1yDOM>KP-`s8#6Jp|*1P%1O7 Qk?StgmfR=REu9+U3uSm*X#fBK literal 281 zcmYL@!3hE}5Je-p=CUC6o6o5Ru+Y+z!q%57Hq*5Y{3>Rz(f4WX7$4h!z1&P zm1h6wIYT`o6jn!gySTPbq2UF z3FkWGFD!ek1piyH*rjePE~WW7CXv|J4ubI93+=1Omj|Xm2Z%I8qWo{i z_STF>;{Xs`gma&9+X=RnlhK@neSg5je4*-vd6)g!3Gd;n3RAt0 IBX#-77m@{5{{R30 diff --git a/wadsrc_extra/static/filter/doom.id/fonts/bigupper/0402.lmp b/wadsrc_extra/static/filter/doom.id/fonts/bigupper/0402.lmp index 4f72414a26a931d8cd3dcc9177d4c6449f546c1a..23ca1421525be18a0f18e97e991f00f703e200e1 100644 GIT binary patch literal 404 zcmZ9GJx&BM426Tx{y?+Mb{v93aDj&E3sR6^{>Xa#vv{rg@T!CJ{t)&iPLxib+)wz079Cwx<$rL`%1| z&K{cUu%ajz&%I%2vq38cZ6X_*L|-w2LD=PtB S6^h=uS;tcN)V96uHtiRG%7Cu` literal 376 zcmZ9I%?$z}5QQ=E_hjP9A}qoZ7Fh%wHe@%RIPBRXEW#oz!Xhlf4%Rp0E(a(1;N|5F z1MJjRaaG^~uAm1ua0d_Y1TXLgA26ROwFd`q1U2YD57Z+6YGCEsF6Td`JMp$TiyGtD z2E|@VDaJ^IC5>K{5(Ve1v!)7@7r3l7TI=Fj%bi3a(A295(+p9$6=s+u9wJgQ*A_38 w`0a z9`I53?sPwUGa2d#GI$4{;0v6=1zf>5_yND5-x+fNPv9B601w{42RH%KmAfhYx zBAZ)oDy2p1@Ay>1oT|ncL%^eJZdMKAz4LCFWy=ZW++wZ$%Q?r+5JbY(YXi2uCcacP zV=0R=r(v~@HmlvL5jMrm3acr)b#I%JqF_E%yAf5aj7fP0ZT5mIWQKisgl&%F`hj~i LB_22Q>~E?!ga>`U literal 368 zcmZ9G%?$z}5QXvJ>UwY!ORxxw@U&#Z0uF@iMlW;lY!Mb=5f)()7GVeYV1HtqTx7mDn;QYaD}em3a;P^uHXs|AQJzisUCdC@p1Pj zE2@a-6E^5uumfjs0Ry;#8@Pi9c!C#rgK|c+2DH#rAr9uK8mLmOWwfzp!KtL3L~U#h zte=Fn4eBq9IGlL*J2ANBW(-cD@i}4Dw#yj|;iOaEXAzfsVb2GMqEz*Q$UL8%NRN40 NV5yBCE9WUad;xMwS-JoK diff --git a/wadsrc_extra/static/filter/doom.id/fonts/bigupper/045B.lmp b/wadsrc_extra/static/filter/doom.id/fonts/bigupper/045B.lmp index 4687f235651967ee302bc14ac820c00e08d12673..cd1b9de37475c79ea0c97281d63db0e87a639e98 100644 GIT binary patch literal 297 zcmYL@%?ScA5JpFER}Xs-3$PxK8$t*%fd!AT1zWHMTd)NiumM}J0WT8YB&;U9FyEK? z+sGgypR(sQaDWq>;R08GWLuzuZagjCSXcmpuBRsPcJJjx)G|ihW`AsJH+DJuo&Uu}y UVhYX&72OJvLedTUzKtRL0`J*fzyJUM literal 279 zcmYL^;RymU422`=c|Q(a%D=*ua)!|Ap@>2za0ORz1y^tZS8xRf@R!urYpa1TJRW%o zSx`enpRhzU2&x=NY%1U|TsE#X;EjJ4{Sxs$Q5kSs$J77P_i1 K)%!S7mruT~;8^ Date: Mon, 30 Mar 2020 14:27:36 +0300 Subject: [PATCH 21/23] Add optional direction parameters for SprayDecal and its A_SprayDecal zscript counterpart --- src/playsim/a_decals.cpp | 21 +++++++++++++++------ src/playsim/a_sharedglobal.h | 2 +- src/playsim/p_actionfunctions.cpp | 5 ++++- wadsrc/static/zscript/actors/actor.zs | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index fc712a5d8..1eb5a588e 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -830,14 +830,23 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl // //---------------------------------------------------------------------------- -void SprayDecal(AActor *shooter, const char *name, double distance) +void SprayDecal(AActor *shooter, const char *name, double distance, double DirX, double DirY, double DirZ) { FTraceResults trace; - - DAngle ang = shooter->Angles.Yaw; - DAngle pitch = shooter->Angles.Pitch; - double c = pitch.Cos(); - DVector3 vec(c * ang.Cos(), c * ang.Sin(), -pitch.Sin()); + DVector3 vec; + //use new behavior only if directional vector not equal to zero vector + if (DirX != 0 || DirY != 0 || DirZ != 0) + { + vec = DVector3(DirX, DirY, DirZ); + } + + else + { + DAngle ang = shooter->Angles.Yaw; + DAngle pitch = shooter->Angles.Pitch; + double c = pitch.Cos(); + vec = DVector3(c * ang.Cos(), c * ang.Sin(), -pitch.Sin()); + } if (Trace(shooter->PosPlusZ(shooter->Height / 2), shooter->Sector, vec, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky)) { diff --git a/src/playsim/a_sharedglobal.h b/src/playsim/a_sharedglobal.h index 9396b10a8..1246255ea 100644 --- a/src/playsim/a_sharedglobal.h +++ b/src/playsim/a_sharedglobal.h @@ -12,7 +12,7 @@ class DBaseDecal; struct SpreadInfo; DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent); -void SprayDecal(AActor *shooter, const char *name,double distance = 172.); +void SprayDecal(AActor *shooter, const char *name,double distance = 172., double DirX = 0., double DirY = 0., double DirZ = 0.); class DBaseDecal : public DThinker { diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 78dce5852..047aed2a5 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -4917,7 +4917,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal) PARAM_SELF_PROLOGUE(AActor); PARAM_STRING(name); PARAM_FLOAT(dist); - SprayDecal(self, name, dist); + PARAM_FLOAT(DirX); + PARAM_FLOAT(DirY); + PARAM_FLOAT(DirZ); + SprayDecal(self, name, dist, DirX, DirY, DirZ); return 0; } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 27a929fdd..28dd0b295 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -1157,7 +1157,7 @@ class Actor : Thinker native native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_SetTranslation(name transname); native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false); - native void A_SprayDecal(String name, double dist = 172); + native void A_SprayDecal(String name, double dist = 172, double DirX = 0, double DirY = 0, double DirZ = 0); native void A_SetMugshotState(String name); native void CopyBloodColor(Actor other); From 0e9ca3c850668441b1175955e2c8570802bc2d22 Mon Sep 17 00:00:00 2001 From: Mekboss Date: Mon, 30 Mar 2020 18:52:27 +0300 Subject: [PATCH 22/23] Replace function variables to DVector3 --- src/playsim/a_decals.cpp | 6 +++--- src/playsim/a_sharedglobal.h | 2 +- src/playsim/p_actionfunctions.cpp | 2 +- wadsrc/static/zscript/actors/actor.zs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index 1eb5a588e..03fd79ebd 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -830,14 +830,14 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl // //---------------------------------------------------------------------------- -void SprayDecal(AActor *shooter, const char *name, double distance, double DirX, double DirY, double DirZ) +void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 Dir) { FTraceResults trace; DVector3 vec; //use new behavior only if directional vector not equal to zero vector - if (DirX != 0 || DirY != 0 || DirZ != 0) + if (!Dir.isZero() ) { - vec = DVector3(DirX, DirY, DirZ); + vec = Dir; } else diff --git a/src/playsim/a_sharedglobal.h b/src/playsim/a_sharedglobal.h index 1246255ea..0ca4673b9 100644 --- a/src/playsim/a_sharedglobal.h +++ b/src/playsim/a_sharedglobal.h @@ -12,7 +12,7 @@ class DBaseDecal; struct SpreadInfo; DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent); -void SprayDecal(AActor *shooter, const char *name,double distance = 172., double DirX = 0., double DirY = 0., double DirZ = 0.); +void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 Dir = (0, 0, 0) ); class DBaseDecal : public DThinker { diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 047aed2a5..c1a2015af 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -4920,7 +4920,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal) PARAM_FLOAT(DirX); PARAM_FLOAT(DirY); PARAM_FLOAT(DirZ); - SprayDecal(self, name, dist, DirX, DirY, DirZ); + SprayDecal(self, name, dist, DVector3(DirX, DirY, DirZ) ); return 0; } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 28dd0b295..02aaab205 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -1157,7 +1157,7 @@ class Actor : Thinker native native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_SetTranslation(name transname); native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false); - native void A_SprayDecal(String name, double dist = 172, double DirX = 0, double DirY = 0, double DirZ = 0); + native void A_SprayDecal(String name, double dist = 172, vector3 Dir = (0, 0, 0) ); native void A_SetMugshotState(String name); native void CopyBloodColor(Actor other); From 4807f4240b7e972c05ca47770f83619cde9a8bbf Mon Sep 17 00:00:00 2001 From: Mekboss Date: Tue, 7 Apr 2020 23:11:49 +0300 Subject: [PATCH 23/23] Fix MSVS compile bug and add offset parameter for SprayDecal --- src/playsim/a_decals.cpp | 31 ++++++++++++++++++--------- src/playsim/a_sharedglobal.h | 2 +- src/playsim/p_actionfunctions.cpp | 11 ++++++---- wadsrc/static/zscript/actors/actor.zs | 2 +- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index 03fd79ebd..b9e54d25a 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -830,25 +830,36 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl // //---------------------------------------------------------------------------- -void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 Dir) +void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 offset, DVector3 direction) { + //just in case + if (!shooter) + return; + FTraceResults trace; - DVector3 vec; - //use new behavior only if directional vector not equal to zero vector - if (!Dir.isZero() ) - { - vec = Dir; - } - + DVector3 off(0, 0, 0), dir(0, 0, 0); + + //use vanilla offset only if "custom" equal to zero + if (offset.isZero() ) + off = shooter->PosPlusZ(shooter->Height / 2); + else + off = shooter->Pos() + offset; + + //same for direction + if (direction.isZero() ) { DAngle ang = shooter->Angles.Yaw; DAngle pitch = shooter->Angles.Pitch; double c = pitch.Cos(); - vec = DVector3(c * ang.Cos(), c * ang.Sin(), -pitch.Sin()); + dir = DVector3(c * ang.Cos(), c * ang.Sin(), -pitch.Sin()); } + + else + dir = direction; - if (Trace(shooter->PosPlusZ(shooter->Height / 2), shooter->Sector, vec, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky)) + + if (Trace(off, shooter->Sector, dir, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky)) { if (trace.HitType == TRACE_HitWall) { diff --git a/src/playsim/a_sharedglobal.h b/src/playsim/a_sharedglobal.h index 0ca4673b9..955d8d900 100644 --- a/src/playsim/a_sharedglobal.h +++ b/src/playsim/a_sharedglobal.h @@ -12,7 +12,7 @@ class DBaseDecal; struct SpreadInfo; DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent); -void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 Dir = (0, 0, 0) ); +void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 offset = DVector3(0., 0., 0.), DVector3 direction = DVector3(0., 0., 0.) ); class DBaseDecal : public DThinker { diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index c1a2015af..5983e77a9 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -4917,10 +4917,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal) PARAM_SELF_PROLOGUE(AActor); PARAM_STRING(name); PARAM_FLOAT(dist); - PARAM_FLOAT(DirX); - PARAM_FLOAT(DirY); - PARAM_FLOAT(DirZ); - SprayDecal(self, name, dist, DVector3(DirX, DirY, DirZ) ); + PARAM_FLOAT(offset_x); + PARAM_FLOAT(offset_y); + PARAM_FLOAT(offset_z); + PARAM_FLOAT(direction_x); + PARAM_FLOAT(direction_y); + PARAM_FLOAT(direction_z); + SprayDecal(self, name, dist, DVector3(offset_x, offset_y, offset_z), DVector3(direction_x, direction_y, direction_z) ); return 0; } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 02aaab205..b80415cbd 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -1157,7 +1157,7 @@ class Actor : Thinker native native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_SetTranslation(name transname); native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false); - native void A_SprayDecal(String name, double dist = 172, vector3 Dir = (0, 0, 0) ); + native void A_SprayDecal(String name, double dist = 172, vector3 offset = (0, 0, 0), vector3 direction = (0, 0, 0) ); native void A_SetMugshotState(String name); native void CopyBloodColor(Actor other);