From 941d89042a4b53b9efe7b540452d61fca843f9a7 Mon Sep 17 00:00:00 2001 From: Jonathan Russell Date: Thu, 3 Aug 2017 01:20:55 +0100 Subject: [PATCH 01/10] - externalise DCanvas::DrawLine to ZScript --- src/v_draw.cpp | 14 ++++++++++++++ wadsrc/static/zscript/base.txt | 1 + 2 files changed, 15 insertions(+) diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 2377e8f7d..9b78c5054 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -958,6 +958,20 @@ void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t re #endif } +DEFINE_ACTION_FUNCTION(_Screen, DrawLine) +{ + PARAM_PROLOGUE; + PARAM_INT(x0); + PARAM_INT(y0); + PARAM_INT(x1); + PARAM_INT(y1); + PARAM_INT(color); + PARAM_INT_DEF(palcol); + if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); + screen->DrawLine(x0, y0, x1, y1, palcol, color); + return 0; +} + void DCanvas::DrawPixel(int x, int y, int palColor, uint32_t realcolor) { #ifndef NO_SWRENDER diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index b2fd9c6c8..f8c713453 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -167,6 +167,7 @@ struct Screen native native static vararg void DrawTexture(TextureID tex, bool animate, double x, double y, ...); native static vararg void DrawChar(Font font, int normalcolor, double x, double y, int character, ...); native static vararg void DrawText(Font font, int normalcolor, double x, double y, String text, ...); + native static void DrawLine(int x0, int y0, int x1, int y1, Color color, int palcolor = -1); native static void DrawFrame(int x, int y, int w, int h); native static Vector2, Vector2 VirtualToRealCoords(Vector2 pos, Vector2 size, Vector2 vsize, bool vbottom=false, bool handleaspect=true); native static double GetAspectRatio(); From 03640a16ea4a172a51a33475e879d419b58ddb2a Mon Sep 17 00:00:00 2001 From: Jonathan Russell Date: Thu, 3 Aug 2017 02:09:48 +0100 Subject: [PATCH 02/10] - removed ZScript DrawLine palcolor arg --- src/v_draw.cpp | 3 +-- wadsrc/static/zscript/base.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 9b78c5054..accded557 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -966,9 +966,8 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawLine) PARAM_INT(x1); PARAM_INT(y1); PARAM_INT(color); - PARAM_INT_DEF(palcol); if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); - screen->DrawLine(x0, y0, x1, y1, palcol, color); + screen->DrawLine(x0, y0, x1, y1, -1, color); return 0; } diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index f8c713453..9c21916c5 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -167,7 +167,7 @@ struct Screen native native static vararg void DrawTexture(TextureID tex, bool animate, double x, double y, ...); native static vararg void DrawChar(Font font, int normalcolor, double x, double y, int character, ...); native static vararg void DrawText(Font font, int normalcolor, double x, double y, String text, ...); - native static void DrawLine(int x0, int y0, int x1, int y1, Color color, int palcolor = -1); + native static void DrawLine(int x0, int y0, int x1, int y1, Color color); native static void DrawFrame(int x, int y, int w, int h); native static Vector2, Vector2 VirtualToRealCoords(Vector2 pos, Vector2 size, Vector2 vsize, bool vbottom=false, bool handleaspect=true); native static double GetAspectRatio(); From 90c734a39f9125fb9aa4f185a02e02f22d272081 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 19 Dec 2017 18:07:29 +0200 Subject: [PATCH 03/10] Fixed VM abort when drawing from ZScript happens during 0 game tic https://forum.zdoom.org/viewtopic.php?t=58523 https://forum.zdoom.org/viewtopic.php?t=58780 --- src/d_main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d_main.cpp b/src/d_main.cpp index 6247a5339..656a2ca3b 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -797,7 +797,13 @@ void D_Display () case GS_LEVEL: case GS_TITLELEVEL: if (!gametic) + { + if (!screen->HasBegun2D()) + { + screen->Begin2D(false); + } break; + } if (StatusBar != NULL) { From 0e2aee7d5e7d899561911a9d0382d6169f102f1f Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 20 Dec 2017 03:21:50 -0500 Subject: [PATCH 04/10] - whitelist reset2saved in menudef --- src/c_dispatch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 1bca9051b..7b4062874 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -191,6 +191,7 @@ static const char *MenuDefCommands[] = { "snd_reset", "reset2defaults", + "reset2saved", "menuconsole", "clearnodecache", "am_restorecolors", From b9a23989355ab62b19798332215399b16ec66177 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 21 Dec 2017 18:00:13 -0500 Subject: [PATCH 05/10] - added 'undocolorpic' to c_dispatch whitelist --- src/c_dispatch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 7b4062874..2ab57ab7e 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -195,6 +195,7 @@ static const char *MenuDefCommands[] = "menuconsole", "clearnodecache", "am_restorecolors", + "undocolorpic", "special", "puke", "fpuke", From d50ba4954aacf398bf259a4e41b9323d565edc0a Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 23 Dec 2017 15:27:32 +0200 Subject: [PATCH 06/10] Fixed potential crash when calling undefined function in ZScript The following code which uses explicit class specifier led to a crash: class C { void F() { Object.Undefined(); } } --- src/scripting/backend/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 564240203..d504282d1 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8091,7 +8091,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx) { bool error; PFunction *afd = FindClassMemberFunction(ccls, ctx.Class, MethodName, ScriptPosition, &error); - if ((afd->Variants[0].Flags & VARF_Method) && (afd->Variants[0].Flags & VARF_Virtual)) + if ((nullptr != afd) && (afd->Variants[0].Flags & VARF_Method) && (afd->Variants[0].Flags & VARF_Virtual)) { staticonly = false; novirtual = true; From bfaa09c429c50e3423bddc398affa9446abe7088 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 23 Dec 2017 15:48:28 +0200 Subject: [PATCH 07/10] Fixed crash after restart CCMD --- src/am_map.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 540461441..2d80b59a0 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -109,7 +109,10 @@ CUSTOM_CVAR (Int, am_emptyspacemargin, 0, CVAR_ARCHIVE) self = 90; } - AM_NewResolution(); + if (nullptr != StatusBar) + { + AM_NewResolution(); + } } //============================================================================= From a11e9ca4dc44c6b767490119afa7b0393a398606 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 24 Dec 2017 10:33:29 +0200 Subject: [PATCH 08/10] Apply compatibility flags to all map format UDMF maps were no affected by settings in compatibility.txt --- src/p_setup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index ea8b69649..b87bf6b87 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3815,8 +3815,6 @@ void P_SetupLevel (const char *lumpname, int position) P_LoadThings (map); else P_LoadThings2 (map); // [RH] Load Hexen-style things - - SetCompatibilityParams(); } else { @@ -3825,6 +3823,8 @@ void P_SetupLevel (const char *lumpname, int position) times[0].Unclock(); } + SetCompatibilityParams(); + times[6].Clock(); P_LoopSidedefs (true); times[6].Unclock(); From 563a80ff839b879dcdfbe4dcc6f16f3e68243f25 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 24 Dec 2017 10:37:22 +0200 Subject: [PATCH 09/10] Added compatibility settings for Hanging Gardens Six trees spawned below arches blocking player's path to red keycard https://www.doomworld.com/idgames/levels/doom2/Ports/g-i/hgarden --- wadsrc/static/compatibility.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index f76ffebf6..245c45052 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -833,3 +833,14 @@ CA3773ED313E8899311F3DD0CA195A68 // e3m6 { polyobj } + +3D8ED20BF5CAAE6D6AE0E10999C75084 // hgarden.pk3 map01 +{ + // spawn trees on top of arches + setthingz 399 168 + setthingz 400 168 + setthingz 401 168 + setthingz 402 168 + setthingz 403 168 + setthingz 404 168 +} From aacdc3546caa90adf9acf59fe07393d85d428003 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 24 Dec 2017 11:00:02 +0200 Subject: [PATCH 10/10] Fixed take ammo cheat https://forum.zdoom.org/viewtopic.php?t=58854 --- wadsrc/static/zscript/shared/player_cheat.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/shared/player_cheat.txt b/wadsrc/static/zscript/shared/player_cheat.txt index 15bad043c..949c89a3c 100644 --- a/wadsrc/static/zscript/shared/player_cheat.txt +++ b/wadsrc/static/zscript/shared/player_cheat.txt @@ -272,7 +272,7 @@ extend class PlayerPawn if (type != null && type is deletetype) { let pack = FindInventory(type); - if (pack) pack.Destroy(); + if (pack) pack.DepleteOrDestroy(); } } }