From 7d1af25b46eb28e9d154a68f92ab3143a4091e08 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 14 Sep 2018 11:10:49 +0300 Subject: [PATCH 1/7] Fixed code generation of infinite for loop https://forum.zdoom.org/viewtopic.php?t=62023 --- src/scripting/backend/codegen.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index c8fcb1f09..d6fc442c6 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -10291,9 +10291,14 @@ FxWhileLoop::~FxWhileLoop() FxExpression *FxWhileLoop::DoResolve(FCompileContext &ctx) { CHECKRESOLVED(); - SAFE_RESOLVE(Condition, ctx); + SAFE_RESOLVE_OPT(Condition, ctx); SAFE_RESOLVE_OPT(Code, ctx); + if (Condition == nullptr) + { + Condition = new FxConstant(true, ScriptPosition); + } + if (Condition->ValueType != TypeBool) { Condition = new FxBoolCast(Condition); From 7885a22cadb27d31c5f1966181c29b264d4742a7 Mon Sep 17 00:00:00 2001 From: ZippeyKeys12 Date: Fri, 14 Sep 2018 21:57:07 -0500 Subject: [PATCH 2/7] Add NewGame to EventHandler https://forum.zdoom.org/viewtopic.php?t=61908 --- src/events.cpp | 22 ++++++++++++++++++++++ src/events.h | 6 ++++++ src/g_level.cpp | 4 ++++ wadsrc/static/zscript/events.txt | 3 +++ 4 files changed, 35 insertions(+) diff --git a/src/events.cpp b/src/events.cpp index 91e66b82b..1baa9b1d3 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -515,6 +515,14 @@ bool E_CheckReplacement( PClassActor *replacee, PClassActor **replacement ) return final; } +void E_NewGame() +{ + for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) + { + handler->NewGame(); + } +} + // normal event loopers (non-special, argument-less) DEFINE_EVENT_LOOPER(RenderFrame) DEFINE_EVENT_LOOPER(WorldLightning) @@ -668,6 +676,8 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, NetworkProcess); DEFINE_EMPTY_HANDLER(DStaticEventHandler, CheckReplacement); +DEFINE_EMPTY_HANDLER(DStaticEventHandler, NewGame) + // =========================================== // // Event handlers @@ -1154,6 +1164,18 @@ void DStaticEventHandler::CheckReplacement( PClassActor *replacee, PClassActor * } } +void DStaticEventHandler::NewGame() +{ + IFVIRTUAL(DStaticEventHandler, NewGame) + { + // don't create excessive DObjects if not going to be processed anyway + if (func == DStaticEventHandler_NewGame_VMPtr) + return; + VMValue params[1] = { (DStaticEventHandler*)this }; + VMCall(func, params, 1, nullptr, 0); + } +} + // void DStaticEventHandler::OnDestroy() { diff --git a/src/events.h b/src/events.h index 54d975566..456db6c10 100755 --- a/src/events.h +++ b/src/events.h @@ -72,6 +72,9 @@ void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manu // called when looking up the replacement for an actor class bool E_CheckReplacement(PClassActor* replacee, PClassActor** replacement); +// called on new game +void E_NewGame(); + // send networked event. unified function. bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3, bool manual); @@ -172,6 +175,9 @@ public: // void CheckReplacement(PClassActor* replacee, PClassActor** replacement, bool* final); + + // + void NewGame(); }; class DEventHandler : public DStaticEventHandler { diff --git a/src/g_level.cpp b/src/g_level.cpp index 86567ea84..36843919b 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -527,6 +527,10 @@ void G_InitNew (const char *mapname, bool bTitleLevel) gamestate = GS_LEVEL; } G_DoLoadLevel (0, false); + if(!savegamerestore) + { + E_NewGame(); + } } // diff --git a/wadsrc/static/zscript/events.txt b/wadsrc/static/zscript/events.txt index 9a908f060..d2d8ed324 100755 --- a/wadsrc/static/zscript/events.txt +++ b/wadsrc/static/zscript/events.txt @@ -339,6 +339,9 @@ class StaticEventHandler : Object native play version("2.4") // virtual native void CheckReplacement(ReplaceEvent e); + // + virtual native void NewGame(); + // this value will be queried on Register() to decide the relative order of this handler to every other. // this is most useful in UI systems. // default is 0. From 60f82d1eb9f89d56c8b3ccaf656062fe5d1ec90e Mon Sep 17 00:00:00 2001 From: ZippeyKeys12 Date: Fri, 14 Sep 2018 21:59:25 -0500 Subject: [PATCH 3/7] Make StatusScreen::End virtual https://forum.zdoom.org/viewtopic.php?t=59419 --- wadsrc/static/zscript/statscreen/statscreen.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/statscreen/statscreen.txt b/wadsrc/static/zscript/statscreen/statscreen.txt index 2dcb2de72..a8d8e25ed 100644 --- a/wadsrc/static/zscript/statscreen/statscreen.txt +++ b/wadsrc/static/zscript/statscreen/statscreen.txt @@ -400,7 +400,7 @@ class StatusScreen abstract play version("2.5") // //==================================================================== - void End () + virtual void End () { CurState = LeavingIntermission; From c988a0b3a49a365237b6e2aadfab6ed297d02b86 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Fri, 7 Sep 2018 11:19:20 -0500 Subject: [PATCH 4/7] Allow LineAttack's LAF_NOINTERACT to fill FTranslatedLineTarget's information. - Originally when the flag was made, LineAttack was not yet exported. This can now be benefitted directly from ZScript. --- src/p_map.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index dacc7ae8b..a44d37c72 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4754,11 +4754,18 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, // We must pass the unreplaced puff type here puff = P_SpawnPuff(t1, pufftype, bleedpos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 2, puffFlags | PF_HITTHING, trace.Actor); - - if (nointeract) - { - return puff; - } + } + if (victim != NULL) + { + victim->linetarget = trace.Actor; + victim->attackAngleFromSource = trace.SrcAngleFromTarget; + // With arbitrary portals this cannot be calculated so using the actual attack angle is the only option. + victim->angleFromSource = trace.unlinked ? victim->attackAngleFromSource : t1->AngleTo(trace.Actor); + victim->unlinked = trace.unlinked; + } + if (nointeract) + { + return puff; } // Allow puffs to inflict poison damage, so that hitscans can poison, too. @@ -4833,14 +4840,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, P_TraceBleed(newdam > 0 ? newdam : damage, trace.HitPos, trace.Actor, trace.SrcAngleFromTarget, pitch); } } - if (victim != NULL) - { - victim->linetarget = trace.Actor; - victim->attackAngleFromSource = trace.SrcAngleFromTarget; - // With arbitrary portals this cannot be calculated so using the actual attack angle is the only option. - victim->angleFromSource = trace.unlinked? victim->attackAngleFromSource : t1->AngleTo(trace.Actor); - victim->unlinked = trace.unlinked; - } + } if (trace.Crossed3DWater || trace.CrossedWater) { From 1210e1a951cca43e3328f44415d882c462e33008 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Thu, 13 Sep 2018 09:42:34 -0500 Subject: [PATCH 5/7] Added DMG_EXPLOSION flag. - This allows modders to determine if damage is caused by an actual explosion, assigned by P_RadiusAttack and BlastActor for +TOUCHY actors. --- src/p_local.h | 1 + src/p_map.cpp | 4 ++-- wadsrc/static/zscript/constants.txt | 1 + wadsrc/static/zscript/hexen/blastradius.txt | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 08c128847..d1a81a992 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -453,6 +453,7 @@ enum EDmgFlags DMG_NO_PROTECT = 256, DMG_USEANGLE = 512, DMG_NO_PAIN = 1024, + DMG_EXPLOSION = 2048, }; diff --git a/src/p_map.cpp b/src/p_map.cpp index a44d37c72..58c0bb706 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -6177,7 +6177,7 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom { //[MC] Don't count actors saved by buddha if already at 1 health. int prehealth = thing->health; - newdam = P_DamageMobj(thing, bombspot, bombsource, damage, bombmod); + newdam = P_DamageMobj(thing, bombspot, bombsource, damage, bombmod, DMG_EXPLOSION); if (thing->health < prehealth) count++; } else if (thing->player == NULL && (!(flags & RADF_NOIMPACTDAMAGE) && !(thing->flags7 & MF7_DONTTHRUST))) @@ -6229,7 +6229,7 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom { // OK to damage; target is in direct path //[MC] Don't count actors saved by buddha if already at 1 health. int prehealth = thing->health; - int newdam = P_DamageMobj(thing, bombspot, bombsource, damage, bombmod); + int newdam = P_DamageMobj(thing, bombspot, bombsource, damage, bombmod, DMG_EXPLOSION); P_TraceBleed(newdam > 0 ? newdam : damage, thing, bombspot); if (thing->health < prehealth) count++; } diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index 156763a27..dc394a0d2 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -939,6 +939,7 @@ enum EDmgFlags DMG_NO_PROTECT = 256, DMG_USEANGLE = 512, DMG_NO_PAIN = 1024, + DMG_EXPLOSION = 2048, } enum EReplace diff --git a/wadsrc/static/zscript/hexen/blastradius.txt b/wadsrc/static/zscript/hexen/blastradius.txt index 3dd355b7c..0f5094892 100644 --- a/wadsrc/static/zscript/hexen/blastradius.txt +++ b/wadsrc/static/zscript/hexen/blastradius.txt @@ -89,7 +89,7 @@ extend class Actor if (victim.bTouchy) { // Touchy objects die when blasted victim.bArmed = false; // Disarm - victim.DamageMobj(self, self, victim.health, 'Melee', DMG_FORCED); + victim.DamageMobj(self, self, victim.health, 'Melee', DMG_FORCED|DMG_EXPLOSION); } } From 74d939c0d28480a96084549f8c72aaefe02ca9b2 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 15 Sep 2018 08:16:02 -0400 Subject: [PATCH 6/7] - archive 'multiplayer' flag in savegames. https://forum.zdoom.org/viewtopic.php?f=2&t=61980 --- src/p_saveg.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 3eb98b808..fcb075e0f 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -942,6 +942,8 @@ void G_SerializeLevel(FSerializer &arc, bool hubload) arc.ReadObjects(hubload); } + arc("multiplayer", multiplayer); + arc("level.flags", level.flags) ("level.flags2", level.flags2) ("level.fadeto", level.fadeto) From 58c6614c03f17aa6192539c98ce63e67da355d36 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 15 Sep 2018 22:57:22 +0100 Subject: [PATCH 7/7] silent few warnings --- src/hwrenderer/utility/hw_clock.cpp | 2 +- src/v_framebuffer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hwrenderer/utility/hw_clock.cpp b/src/hwrenderer/utility/hw_clock.cpp index 40c61924b..a34b1fdb1 100644 --- a/src/hwrenderer/utility/hw_clock.cpp +++ b/src/hwrenderer/utility/hw_clock.cpp @@ -169,7 +169,7 @@ void CheckBench() AppendRenderTimes(compose); AppendLightStats(compose); //AppendMissingTextureStats(compose); - compose.AppendFormat("%llu fps\n\n", screen->GetLastFPS()); + compose.AppendFormat("%llu fps\n\n", (unsigned long long)screen->GetLastFPS()); FILE *f = fopen("benchmarks.txt", "at"); if (f != NULL) diff --git a/src/v_framebuffer.cpp b/src/v_framebuffer.cpp index 0b1338d37..b4a5807f9 100644 --- a/src/v_framebuffer.cpp +++ b/src/v_framebuffer.cpp @@ -227,7 +227,7 @@ void DFrameBuffer::DrawRateStuff () int textScale = active_con_scale(); - chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", howlong, LastCount); + chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", (unsigned long long)howlong, (unsigned long long)LastCount); rate_x = Width / textScale - ConFont->StringWidth(&fpsbuff[0]); Clear (rate_x * textScale, 0, Width, ConFont->GetHeight() * textScale, GPalette.BlackIndex, 0); DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0],