Merge ../gzdoom

# Conflicts:
#	src/version.h
#	wadsrc/static/compatibility.txt
This commit is contained in:
Rachael Alexanderson 2017-05-31 09:08:13 -04:00
commit e72ae3f266
7 changed files with 113 additions and 22 deletions

View file

@ -324,7 +324,7 @@ void ADynamicLight::Tick()
if (scale == 0.f) scale = 1.f;
intensity = Sector->lightlevel * scale;
intensity = clamp<float>(intensity, 0.f, 255.f);
intensity = clamp<float>(intensity, 0.f, 1024.f);
m_currentRadius = intensity;
break;

View file

@ -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

View file

@ -334,6 +334,8 @@ xx(FRandom)
xx(Random2)
xx(RandomPick)
xx(FRandomPick)
xx(SetRandomSeed)
xx(BuiltinRandomSeed)
xx(GetClass)
xx(GetParentClass)
xx(GetClassName)

View file

@ -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;

View file

@ -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<VMValue> &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)

View file

@ -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

View file

@ -493,11 +493,6 @@ AB24AE6E2CB13CBDD04600A4D37F9189 // doom2.wad map02
setwalltexture 338 front bot STONE4
setwalltexture 339 front bot STONE4
}
5E8679670469F92E15CF4219B5B98FEF // doom2.wad map03
{
// unmarked secret
setsectorspecial 62 1024
}
CEC791136A83EEC4B91D39718BDF9D82 // doom2.wad map04
{
// missing textures
@ -526,21 +521,9 @@ CEC791136A83EEC4B91D39718BDF9D82 // doom2.wad map04
}
66C46385EB1A23D60839D1532522076B // doom2.wad map08
{
// missing texture
setwalltexture 101 back top BRICK7
}
6C620F43705BEC0ABBABBF46AC3E62D2 // doom2.wad map10
{
// unmarked secrets
setsectorspecial 25 1090
setsectorspecial 137 1024
setsectorspecial 176 1024
}
73D9E03CEE7BF1A97EFD2EAD86688EF8 // doom2.wad map11
{
// unmarked secrets
setsectorspecial 94 1024
setsectorspecial 138 1024
}
1A540BA717BF9EC85F8522594C352F2A // Doom II, map15
{
setsectorspecial 147 0