From 977d5988c5e6a3671bee53286b9721eb26794cde Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 May 2017 09:27:50 +0200 Subject: [PATCH 1/6] - fixed weapon sprite light calculation for low light levels. --- src/gl/scene/gl_weapon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gl/scene/gl_weapon.cpp b/src/gl/scene/gl_weapon.cpp index 23610fb01a..dcdf260efd 100644 --- a/src/gl/scene/gl_weapon.cpp +++ b/src/gl/scene/gl_weapon.cpp @@ -244,7 +244,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep) } else { - fakesec = gl_FakeFlat(viewsector, &fs, in_area, false); + fakesec = gl_FakeFlat(viewsector, &fs, in_area, false); // calculate light level for weapon sprites lightlevel = gl_ClampLight(fakesec->lightlevel); @@ -282,7 +282,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep) lightlevel = gl_CalcLightLevel(lightlevel, getExtraLight(), true); - if (glset.lightmode == 8) + if (glset.lightmode == 8 || lightlevel < 92) { // Korshun: the way based on max possible light level for sector like in software renderer. float min_L = 36.0 / 31.0 - ((lightlevel / 255.0) * (63.0 / 31.0)); // Lightlevel in range 0-63 From afa2888acb3618ec9713d0f60aee1acd3faa7cc1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 May 2017 10:41:43 +0200 Subject: [PATCH 2/6] - fixed size clamping of sector lights to use 1024 as maximum, not 255 as inherited from ZDoomGL. --- src/g_shared/a_dynlight.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_shared/a_dynlight.cpp b/src/g_shared/a_dynlight.cpp index 90e81d281f..b3cac45ae0 100644 --- a/src/g_shared/a_dynlight.cpp +++ b/src/g_shared/a_dynlight.cpp @@ -324,7 +324,7 @@ void ADynamicLight::Tick() if (scale == 0.f) scale = 1.f; intensity = Sector->lightlevel * scale; - intensity = clamp(intensity, 0.f, 255.f); + intensity = clamp(intensity, 0.f, 1024.f); m_currentRadius = intensity; break; From 1465102ba0abb5ed6524d2743ac7768e917721b2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 May 2017 11:33:57 +0200 Subject: [PATCH 3/6] - added SetRandomSeed function for ZScript. This uses the same RNG syntax as the other random functions. --- src/namedef.h | 2 + src/scripting/backend/codegen.cpp | 85 +++++++++++++++++++++++++++++++ src/scripting/backend/codegen.h | 21 ++++++++ 3 files changed, 108 insertions(+) diff --git a/src/namedef.h b/src/namedef.h index db492c1b27..a22a5de5f0 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -334,6 +334,8 @@ xx(FRandom) xx(Random2) xx(RandomPick) xx(FRandomPick) +xx(SetRandomSeed) +xx(BuiltinRandomSeed) xx(GetClass) xx(GetParentClass) xx(GetClassName) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index f088bc2430..0613b91bde 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -5906,6 +5906,82 @@ ExpEmit FxRandom2::Emit(VMFunctionBuilder *build) return out; } +//========================================================================== +// +// +// +//========================================================================== +FxRandomSeed::FxRandomSeed(FRandom * r, FxExpression *s, const FScriptPosition &pos, bool nowarn) + : FxExpression(EFX_Random, pos) +{ + EmitTail = false; + seed = new FxIntCast(s, nowarn); + rng = r; + ValueType = TypeVoid; +} + +//========================================================================== +// +// +// +//========================================================================== + +FxRandomSeed::~FxRandomSeed() +{ + SAFE_DELETE(seed); +} + +//========================================================================== +// +// +// +//========================================================================== + +FxExpression *FxRandomSeed::Resolve(FCompileContext &ctx) +{ + CHECKRESOLVED(); + RESOLVE(seed, ctx); + return this; +}; + + +//========================================================================== +// +// +// +//========================================================================== + +int BuiltinRandomSeed(VMValue *param, TArray &defaultparam, int numparam, VMReturn *ret, int numret) +{ + PARAM_PROLOGUE; + PARAM_POINTER(rng, FRandom) + PARAM_INT(seed); + rng->Init(seed); + return 0; +} + +ExpEmit FxRandomSeed::Emit(VMFunctionBuilder *build) +{ + // Call DecoRandom to generate a random number. + VMFunction *callfunc; + PSymbol *sym = FindBuiltinFunction(NAME_BuiltinRandomSeed, BuiltinRandomSeed); + + assert(sym->IsKindOf(RUNTIME_CLASS(PSymbolVMFunction))); + assert(((PSymbolVMFunction *)sym)->Function != nullptr); + callfunc = ((PSymbolVMFunction *)sym)->Function; + + if (build->FramePointer.Fixed) EmitTail = false; // do not tail call if the stack is in use + int opcode = (EmitTail ? OP_TAIL_K : OP_CALL_K); + + build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(rng)); + EmitParameter(build, seed, ScriptPosition); + build->Emit(opcode, build->GetConstantAddress(callfunc), 2, 1); + + ExpEmit call; + if (EmitTail) call.Final = true; + return call; +} + //========================================================================== // // @@ -7537,6 +7613,7 @@ FxFunctionCall::FxFunctionCall(FName methodname, FName rngname, FArgumentList &a case NAME_RandomPick: case NAME_FRandomPick: case NAME_Random2: + case NAME_SetRandomSeed: RNG = FRandom::StaticFindRNG(rngname.GetChars()); break; @@ -7790,6 +7867,14 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx) } break; + case NAME_SetRandomSeed: + if (CheckArgSize(NAME_Random, ArgList, 1, 1, ScriptPosition)) + { + func = new FxRandomSeed(RNG, ArgList[0], ScriptPosition, ctx.FromDecorate); + ArgList[0] = nullptr; + } + break; + case NAME_Random: // allow calling Random without arguments to default to (0, 255) if (ArgList.Size() == 0) diff --git a/src/scripting/backend/codegen.h b/src/scripting/backend/codegen.h index 004b1f2289..2121eff7a4 100644 --- a/src/scripting/backend/codegen.h +++ b/src/scripting/backend/codegen.h @@ -1321,6 +1321,27 @@ public: }; +//========================================================================== +// +// +// +//========================================================================== + +class FxRandomSeed : public FxExpression +{ +protected: + bool EmitTail; + FRandom *rng; + FxExpression *seed; + +public: + + FxRandomSeed(FRandom *, FxExpression *mi, const FScriptPosition &pos, bool nowarn); + ~FxRandomSeed(); + FxExpression *Resolve(FCompileContext&); + ExpEmit Emit(VMFunctionBuilder *build); +}; + //========================================================================== // // FxMemberBase From d8d4723ae1cb067ab8e9424c9b500284a11f5656 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 May 2017 11:52:51 +0200 Subject: [PATCH 4/6] - removed PCD_GetActorZ double check. --- src/p_acs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 8565bc42ab..fa62ac2c12 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -9537,7 +9537,7 @@ scriptwait: } else { - STACK(1) = DoubleToACS(pcd == PCD_GETACTORX ? actor->X() : pcd == PCD_GETACTORY ? actor->Y() : actor->Z()); + STACK(1) = DoubleToACS(pcd == PCD_GETACTORX ? actor->X() : actor->Y()); } } break; From 1bd3098dec63600e34c4c8d001552f40949704c8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 May 2017 12:52:38 +0200 Subject: [PATCH 5/6] - Now we are at 3.2pre. --- src/version.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/version.h b/src/version.h index c806944a1f..65fe44015f 100644 --- a/src/version.h +++ b/src/version.h @@ -48,16 +48,16 @@ const char *GetVersionString(); #ifdef GIT_DESCRIPTION #define VERSIONSTR GIT_DESCRIPTION #else -#define VERSIONSTR "2.5pre" +#define VERSIONSTR "3.2pre" #endif // The version as seen in the Windows resource -#define RC_FILEVERSION 2,4,9999,0 -#define RC_PRODUCTVERSION 2,4,9999,0 +#define RC_FILEVERSION 3,1,9999,0 +#define RC_PRODUCTVERSION 3,1,9999,0 #define RC_PRODUCTVERSION2 VERSIONSTR // These are for content versioning. The current state is '2.4'. -#define VER_MAJOR 2 -#define VER_MINOR 5 +#define VER_MAJOR 3 +#define VER_MINOR 2 #define VER_REVISION 0 // Version identifier for network games. From 907d1e005644fb146131f6eee46d14e0d535dcdd Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 31 May 2017 08:46:15 -0400 Subject: [PATCH 6/6] - Several compatibility fixes for Doom2's first map cluster. Fixes missing textures as well as incorrect sector tagging causing glitches when opening doors or triggering an ambush. --- wadsrc/static/compatibility.txt | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 621c4920e9..8fc64f3bff 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -484,6 +484,46 @@ F6EE16F770AD309D608EA0B1F1E249FC // Ultimate Doom, e4m3 setsectorspecial 263 0 setsectorspecial 264 0 } +AB24AE6E2CB13CBDD04600A4D37F9189 // doom2.wad map02 +1EC0AF1E3985650F0C9000319C599D0C // doom2bfg.wad map02 +{ + // missing textures + setwalltexture 327 front bot STONE4 + setwalltexture 328 front bot STONE4 + setwalltexture 338 front bot STONE4 + setwalltexture 339 front bot STONE4 +} +CEC791136A83EEC4B91D39718BDF9D82 // doom2.wad map04 +{ + // missing textures + setwalltexture 456 back top SUPPORT3 + setwalltexture 108 front top STONE + setwalltexture 109 front top STONE + setwalltexture 110 front top STONE + setwalltexture 111 front top STONE + setwalltexture 127 front top STONE + setwalltexture 128 front top STONE + // remove erroneous blue keycard pickup ambush sector tags (nearby viewing windows, and the lights) + setsectortag 19 0 + setsectortag 20 0 + setsectortag 23 0 + setsectortag 28 0 + setsectortag 33 0 + setsectortag 34 0 + setsectortag 83 0 + setsectortag 85 0 +} +9E061AD7FBCD7FAD968C976CB4AA3B9D // doom2.wad map05 +{ + // fix bug with opening westmost door in door hallway - incorrect sector tagging - see doomwiki.org for more info + setsectortag 4 0 + setsectortag 153 0 +} +66C46385EB1A23D60839D1532522076B // doom2.wad map08 +{ + // missing texture + setwalltexture 101 back top BRICK7 +} 1A540BA717BF9EC85F8522594C352F2A // Doom II, map15 { setsectorspecial 147 0