From ac30b268e932cd9893cbbaccd3ea9b9dd0d8fecf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Mar 2017 09:30:33 +0100 Subject: [PATCH 01/14] - fixed: ListMenuItemStaticText used the wrong default color. --- wadsrc/static/zscript/menu/listmenuitems.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/menu/listmenuitems.txt b/wadsrc/static/zscript/menu/listmenuitems.txt index c1bafeaf9..91d78f0a8 100644 --- a/wadsrc/static/zscript/menu/listmenuitems.txt +++ b/wadsrc/static/zscript/menu/listmenuitems.txt @@ -119,7 +119,7 @@ class ListMenuItemStaticText : ListMenuItem int mColor; bool mCentered; - void Init(ListMenuDescriptor desc, double x, double y, String text, int color = Font.CR_UNTRANSLATED) + void Init(ListMenuDescriptor desc, double x, double y, String text, int color = -1) { Super.Init(x, y); mText = text; From 2f420d65cdd32ffb5345be9eb8095ceee885834a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Mar 2017 10:03:42 +0100 Subject: [PATCH 02/14] - fixed: A_FireProjectile was still using the inverted pitch from A_FireCustomMissile it was supposed to correct. --- src/p_actionfunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 2556c3b24..e4dd44766 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -1898,7 +1898,7 @@ DEFINE_ACTION_FUNCTION(AStateProvider, A_FireProjectile) // Temporarily adjusts the pitch DAngle saved_player_pitch = self->Angles.Pitch; - self->Angles.Pitch -= pitch; + self->Angles.Pitch += pitch; AActor * misl=P_SpawnPlayerMissile (self, ofs.X, ofs.Y, spawnheight, ti, shootangle, &t, NULL, false, (flags & FPF_NOAUTOAIM) != 0); self->Angles.Pitch = saved_player_pitch; From 7a61f1a7791638f68d45bf277e1db7a167764f32 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Mar 2017 19:55:56 +0100 Subject: [PATCH 03/14] - fixed processing of parameter-less ZScript properties. --- src/scripting/zscript/zcc_compile.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index f18c3230f..f42a00e82 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -1783,14 +1783,23 @@ void ZCCCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *prop ZCC_ExprConstant one; unsigned parmcount = 1; ZCC_TreeNode *x = property->Values; - while (x->SiblingNext != property->Values) + if (x == nullptr) { - x = x->SiblingNext; - parmcount++; + parmcount = 0; + } + else + { + while (x->SiblingNext != property->Values) + { + x = x->SiblingNext; + parmcount++; + } } if (parmcount == 0 && prop->Variables.Size() == 1 && prop->Variables[0]->Type == TypeBool) { // allow boolean properties to have the parameter omitted + memset(&one, 0, sizeof(one)); + one.SourceName = property->SourceName; // This may not be null! one.Operation = PEX_ConstValue; one.NodeType = AST_ExprConstant; one.Type = TypeBool; From 8e43b822afdc49fa6556def5f0d2b6d83fe6c377 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Mar 2017 21:22:11 +0100 Subject: [PATCH 04/14] - fixed another error in DispatchScriptProperty. That AST's data organization is really messed up... :( --- src/scripting/zscript/zcc_compile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index f42a00e82..f855a71b2 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -1808,7 +1808,7 @@ void ZCCCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *prop } else if (parmcount != prop->Variables.Size()) { - Error(x, "Argument count mismatch: Got %u, expected %u", parmcount, prop->Variables.Size()); + Error(x == nullptr? property : x, "Argument count mismatch: Got %u, expected %u", parmcount, prop->Variables.Size()); return; } From dd2b9dc7c1253db102ddcd8efad20ebf0af96833 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Mar 2017 23:02:59 +0100 Subject: [PATCH 05/14] - fixed bad menu size calculation, this was particularly visible in Hexen's skill menu. --- wadsrc/static/zscript/menu/listmenuitems.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/menu/listmenuitems.txt b/wadsrc/static/zscript/menu/listmenuitems.txt index 91d78f0a8..ee9be6044 100644 --- a/wadsrc/static/zscript/menu/listmenuitems.txt +++ b/wadsrc/static/zscript/menu/listmenuitems.txt @@ -267,7 +267,7 @@ class ListMenuItemTextItem : ListMenuItemSelectable override int GetWidth() { - return min(1, mFont.StringWidth(StringTable.Localize(mText))); + return max(1, mFont.StringWidth(StringTable.Localize(mText))); } } From 84f3048242ef615f19c86726c614123c1cbaf1c0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Mar 2017 10:05:35 +0100 Subject: [PATCH 06/14] - restored a line of accidentally deleted code in the animated door thinker. --- src/p_doors.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_doors.cpp b/src/p_doors.cpp index 05c93a898..f09fd7f9b 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -615,6 +615,7 @@ void DAnimatedDoor::Tick () } m_Timer = m_Delay; + m_Status = Waiting; } else { From aa1365749b7c0d13baaaf8793c2e9420ea9ca823 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Mar 2017 11:13:52 +0100 Subject: [PATCH 07/14] - fixed: P_RailAttack must send DMG_PLAYERATTACK if the attack originates from a player. --- src/p_map.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 73cda449c..c8fe36f66 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5135,7 +5135,8 @@ void P_RailAttack(FRailParams *p) if (puffDefaults->flags3 & MF3_FOILINVUL) dmgFlagPass |= DMG_FOILINVUL; if (puffDefaults->flags7 & MF7_FOILBUDDHA) dmgFlagPass |= DMG_FOILBUDDHA; } - int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, p->damage, damagetype, dmgFlagPass|DMG_USEANGLE, hitangle); + // [RK] If the attack source is a player, send the DMG_PLAYERATTACK flag. + int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, p->damage, damagetype, dmgFlagPass | DMG_USEANGLE | (source->player ? DMG_PLAYERATTACK : 0), hitangle); if (bleed) { From e919e986052d4589deef1665ecfddd68c7efc096 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Mar 2017 13:50:33 +0100 Subject: [PATCH 08/14] - fixed: When vr_quadbuffering is on and context creation fails, first retry without it before falling back on the compatibility handler. --- src/win32/win32gliface.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 48de9e8e0..01845e845 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -712,6 +712,7 @@ bool Win32GLVideo::SetupPixelFormat(int multisample) if (myWglChoosePixelFormatARB) { + again: attributes[0] = WGL_RED_BITS_ARB; //bits attributes[1] = 8; attributes[2] = WGL_GREEN_BITS_ARB; //bits @@ -767,6 +768,12 @@ bool Win32GLVideo::SetupPixelFormat(int multisample) if (numFormats == 0) { + if (vr_enable_quadbuffered) + { + Printf("R_OPENGL: No valid pixel formats found for VR quadbuffering. Retrying without this feature\n"); + vr_enable_quadbuffered = false; + goto again; + } Printf("R_OPENGL: No valid pixel formats found. Retrying in compatibility mode\n"); goto oldmethod; } From a2f6ac1bb315efce7d011b19002a6abacc658478 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Mar 2017 10:36:41 +0100 Subject: [PATCH 09/14] - added a GetRenderStyle function to Actor, so that the internal render style can be retrieved in a format suitable for scripting. --- src/p_actionfunctions.cpp | 14 +++++++++++++- wadsrc/static/zscript/actor.txt | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index e4dd44766..a74a848e9 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -6851,4 +6851,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetMugshotState) if (self->CheckLocalView(consoleplayer)) StatusBar->SetMugShotState(name); return 0; -} \ No newline at end of file +} + +// This needs to account for the fact that internally renderstyles are stored as a series of operations, +// but the script side only cares about symbolic constants. +DEFINE_ACTION_FUNCTION(AActor, GetRenderStyle) +{ + PARAM_SELF_PROLOGUE(AActor); + for(unsigned i=0;iRenderStyle == LegacyRenderStyles[i]) ACTION_RETURN_INT(i); + } + ACTION_RETURN_INT(-1); // no symbolic constant exists to handle this style. +} diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 31d91c668..f10183874 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -449,6 +449,7 @@ class Actor : Thinker native native void ChangeTid(int newtid); native static int FindUniqueTid(int start = 0, int limit = 0); native void SetShade(color col); + native clearscope int GetRenderStyle() const; native clearscope string GetTag(string defstr = "") const; native void SetTag(string defstr = ""); From 5327deee43ddbd171b47716df615ee214ea6a011 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 19 Mar 2017 11:14:04 +0200 Subject: [PATCH 10/14] Fixed crash caused by global sound precaching This is a part of a4710bcdb0a40e477ce53aa4df36ec90d1402358 from master branch https://mantis.zdoom.org/view.php?id=454 --- src/s_sound.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 544149ca3..eac0093a7 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -491,14 +491,14 @@ void S_PrecacheLevel () actor->MarkPrecacheSounds(); } } - for (auto i : gameinfo.PrecachedSounds) + for (auto snd : gameinfo.PrecachedSounds) { - level.info->PrecacheSounds[i].MarkUsed(); + FSoundID(snd).MarkUsed(); } // Precache all extra sounds requested by this map. - for (i = 0; i < level.info->PrecacheSounds.Size(); ++i) + for (auto snd : level.info->PrecacheSounds) { - level.info->PrecacheSounds[i].MarkUsed(); + FSoundID(snd).MarkUsed(); } // Don't unload sounds that are playing right now. for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) From c237af2b020bebbb0b65c45adf5c9bc389bcc438 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Mar 2017 18:38:16 +0100 Subject: [PATCH 11/14] - made a few adjustments to the clean factor calculation so that on large screens the smaller factor gets preferred. Without such tweaking the menu scale tends to get a bit too large on some screen sizes. --- src/v_video.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/v_video.cpp b/src/v_video.cpp index d993204a2..4e2dbb5f5 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1394,6 +1394,12 @@ void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int real int cheight; int cx1, cy1, cx2, cy2; + // For larger screems always use at least a 16:9 ratio for clean factor calculation, even if the actual ratio is narrower. + if (realwidth > 1280 && (double)realwidth / realheight < 16./9) + { + realheight = realwidth * 9 / 16; + } + ratio = ActiveRatio(realwidth, realheight); if (AspectTallerThanWide(ratio)) { @@ -1411,7 +1417,7 @@ void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int real cy1 = MAX(cheight / designheight, 1); cx2 = MAX(realwidth / designwidth, 1); cy2 = MAX(realheight / designheight, 1); - if (abs(cx1 - cy1) <= abs(cx2 - cy2) || cx1 >= 4) + if (abs(cx1 - cy1) <= abs(cx2 - cy2) || MAX(cx1, cx2) >= 4) { // e.g. 640x360 looks better with this. *cleanx = cx1; *cleany = cy1; From 97ce83d2d89d5f36aed05b4b1abd93afac5a1239 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Mar 2017 19:49:52 +0100 Subject: [PATCH 12/14] - let SBARINFO always read ST_X and ST_Y from the wrapper because it just too liberally changes these values in unpredictable ways. --- src/g_statusbar/sbarinfo.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/g_statusbar/sbarinfo.cpp b/src/g_statusbar/sbarinfo.cpp index b718e2703..5a3df7794 100644 --- a/src/g_statusbar/sbarinfo.cpp +++ b/src/g_statusbar/sbarinfo.cpp @@ -1035,7 +1035,6 @@ public: { // Calculate cleanX and cleanY wrapper->ScreenSizeChanged(); } - wrapper->GetCoords(ST_X, ST_Y); int hud = STBAR_NORMAL; if(state == HUD_StatusBar) { @@ -1225,8 +1224,10 @@ public: if(!fullScreenOffsets) { double tmp = 0; - dx += ST_X; - dy += ST_Y - (Scaled ? script->resH : 200) + script->height; + int stX, stY; + wrapper->GetCoords(stX, stY); + dx += stX; + dy += stY - (Scaled ? script->resH : 200) + script->height; w = forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth; h = forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight; double dcx = clip[0] == 0 ? 0 : dx + clip[0] - texture->GetScaledLeftOffsetDouble(); @@ -1451,8 +1452,10 @@ public: if(!fullScreenOffsets) { - rx += ST_X; - ry += ST_Y - (Scaled ? script->resH : 200) + script->height; + int stX, stY; + wrapper->GetCoords(stX, stY); + rx += stX; + ry += stY - (Scaled ? script->resH : 200) + script->height; if(Scaled) screen->VirtualToRealCoords(rx, ry, rw, rh, script->resW, script->resH, true); else @@ -1520,7 +1523,6 @@ public: player_t *CPlayer = nullptr; DBaseStatusBar *wrapper; bool Scaled; - int ST_X, ST_Y; private: SBarInfo *script; From 244bb0f96f2744fa8b938beac3412a034c133f60 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Mar 2017 20:09:54 +0100 Subject: [PATCH 13/14] - Version 2.4 --- src/version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/version.h b/src/version.h index 4f8f76fab..ca5360e1d 100644 --- a/src/version.h +++ b/src/version.h @@ -46,12 +46,12 @@ const char *GetVersionString(); #ifdef GIT_DESCRIPTION #define VERSIONSTR GIT_DESCRIPTION #else -#define VERSIONSTR "2.3pre" +#define VERSIONSTR "2.4.0" #endif // The version as seen in the Windows resource -#define RC_FILEVERSION 2,3,9999,0 -#define RC_PRODUCTVERSION 2,3,9999,0 +#define RC_FILEVERSION 2,4,0,0 +#define RC_PRODUCTVERSION 2,4,0,0 #define RC_PRODUCTVERSION2 VERSIONSTR // These are for content versioning. The current state is '2.4'. #define VER_MAJOR 2 From 5c286dceb02207f72f97b1f9e792746bb7e22fb3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Mar 2017 21:36:18 +0100 Subject: [PATCH 14/14] - fixed: FxAssign used the wrong value type for emitting the store operation. It used the expression's value type, but needs to use the variable's, which can be different when the assignment is synthesized from a builtin function. # Conflicts: # src/scripting/backend/vmbuilder.cpp --- src/scripting/backend/codegen.cpp | 2 +- src/scripting/backend/vmbuilder.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 0ea6517da..dcb978e91 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -2514,7 +2514,7 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build) if (IsBitWrite == -1) { - build->Emit(ValueType->GetStoreOp(), pointer.RegNum, result.RegNum, build->GetConstantInt(0)); + build->Emit(Base->ValueType->GetStoreOp(), pointer.RegNum, result.RegNum, build->GetConstantInt(0)); } else { diff --git a/src/scripting/backend/vmbuilder.cpp b/src/scripting/backend/vmbuilder.cpp index 308410922..4ed4f5c4e 100644 --- a/src/scripting/backend/vmbuilder.cpp +++ b/src/scripting/backend/vmbuilder.cpp @@ -570,7 +570,6 @@ size_t VMFunctionBuilder::Emit(int opcode, int opa, int opb, int opc) assert(opb >= 0); assert(opc >= 0); - // The following were just asserts, meaning this would silently create broken code if there was an overflow // if this happened in a release build. Not good. // These are critical errors that need to be reported to the user.