Merge remote-tracking branch 'gzdoom/master' into newmaster

This commit is contained in:
Major Cooke 2019-10-23 10:34:34 -05:00
commit d34e4d4379
10 changed files with 60 additions and 13 deletions

View file

@ -984,6 +984,7 @@ void D_ErrorCleanup ()
}
if (gamestate == GS_INTERMISSION) gamestate = GS_DEMOSCREEN;
insave = false;
ClearGlobalVMStack();
}
//==========================================================================

View file

@ -250,6 +250,7 @@ void FThinkerCollection::DestroyAllThinkers()
GC::FullGC();
if (error)
{
ClearGlobalVMStack();
I_Error("DestroyAllThinkers failed");
}
}

View file

@ -52,6 +52,7 @@
uint32_t Col2RGB8[65][256];
uint32_t *Col2RGB8_LessPrecision[65];
uint32_t Col2RGB8_Inverse[65][256];
uint32_t Col2RGB8_2[63][256]; // this array's second dimension is called up by pointer as Col2RGB8_LessPrecision[] elsewhere.
ColorTable32k RGB32k;
ColorTable256k RGB256k;
@ -344,7 +345,6 @@ static void BuildTransTable (const PalEntry *palette)
// create the swizzled palette with the lsb of red and blue forced to 0
// (for green, a 1 is okay since it never gets added into)
uint32_t Col2RGB8_2[63][256];
for (x = 1; x < 64; x++)
{
Col2RGB8_LessPrecision[x] = Col2RGB8_2[x-1];

View file

@ -7129,7 +7129,15 @@ FxExpression *FxStructMember::Resolve(FCompileContext &ctx)
{
// since this is a vector, all potential things that may get here are single float or an xy-vector.
auto locvar = static_cast<FxLocalVariable *>(classx);
locvar->RegOffset = int(membervar->Offset / 8);
if (!(locvar->Variable->VarFlags & VARF_Out))
{
locvar->RegOffset = int(membervar->Offset / 8);
}
else
{
locvar->RegOffset = int(membervar->Offset);
}
locvar->ValueType = membervar->Type;
classx = nullptr;
delete this;
@ -9039,6 +9047,14 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
else
{
ArgList[i]->RequestAddress(ctx, &writable);
if ((flag & VARF_Out) && !writable)
{
ScriptPosition.Message(MSG_ERROR, "Argument must be a modifiable value");
delete this;
return nullptr;
}
if (flag & VARF_Ref)ArgList[i]->ValueType = NewPointer(ArgList[i]->ValueType);
}
@ -11284,14 +11300,6 @@ FxExpression *FxLocalVariableDeclaration::Resolve(FCompileContext &ctx)
{
CHECKRESOLVED();
if (IsDynamicArray())
{
auto stackVar = new FxStackVariable(ValueType, StackOffset, ScriptPosition);
FArgumentList argsList;
clearExpr = new FxMemberFunctionCall(stackVar, "Clear", argsList, ScriptPosition);
SAFE_RESOLVE(clearExpr, ctx);
}
if (ctx.Block == nullptr)
{
ScriptPosition.Message(MSG_ERROR, "Variable declaration outside compound statement");
@ -11348,6 +11356,15 @@ FxExpression *FxLocalVariableDeclaration::Resolve(FCompileContext &ctx)
}
}
}
if (IsDynamicArray())
{
auto stackVar = new FxStackVariable(ValueType, StackOffset, ScriptPosition);
FArgumentList argsList;
clearExpr = new FxMemberFunctionCall(stackVar, "Clear", argsList, ScriptPosition);
SAFE_RESOLVE(clearExpr, ctx);
}
ctx.Block->LocalVars.Push(this);
return this;
}

View file

@ -2126,6 +2126,7 @@ class FxLocalVariableDeclaration : public FxExpression
friend class FxLocalVariable;
friend class FxStaticArrayVariable;
friend class FxLocalArrayDeclaration;
friend class FxStructMember;
FName Name;
FxExpression *Init;

View file

@ -884,9 +884,20 @@ void FFunctionBuildList::Build()
sfunc->NumArgs = 0;
// NumArgs for the VMFunction must be the amount of stack elements, which can differ from the amount of logical function arguments if vectors are in the list.
// For the VM a vector is 2 or 3 args, depending on size.
for (auto s : item.Func->Variants[0].Proto->ArgumentTypes)
auto funcVariant = item.Func->Variants[0];
for (unsigned int i = 0; i < funcVariant.Proto->ArgumentTypes.Size(); i++)
{
sfunc->NumArgs += s->GetRegCount();
auto argType = funcVariant.Proto->ArgumentTypes[i];
auto argFlags = funcVariant.ArgFlags[i];
if (argFlags & VARF_Out)
{
auto argPointer = NewPointer(argType);
sfunc->NumArgs += argPointer->GetRegCount();
}
else
{
sfunc->NumArgs += argType->GetRegCount();
}
}
if (dump != nullptr)

View file

@ -110,6 +110,8 @@ public:
void ThrowAbortException(EVMAbortException reason, const char *moreinfo, ...);
void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException reason, const char *moreinfo, ...);
void ClearGlobalVMStack();
struct VMReturn
{
void *Location;

View file

@ -715,6 +715,14 @@ void ThrowVMException(VMException *x)
#endif
void ClearGlobalVMStack()
{
while (GlobalVMStack.PopFrame() != nullptr)
{
}
}
ADD_STAT(VM)
{
double added = 0;

View file

@ -1394,6 +1394,12 @@ class LevelCompatibility native play
break;
}
case '63BDD083A98A48C04B8CD58AA857F77D': // Scythe MAP22
{
// Wall behind start creates HOM in software renderer due to weird sector
OffsetSectorPlane(236, Sector.Floor, -40);
}
case '1C795660D2BA9FC93DA584C593FD1DA3': // Scythe 2 MAP17
{
// Texture displays incorrectly in hardware renderer

View file

@ -1391,7 +1391,7 @@ object MinotaurFX3
flickerlight SERPENTBALL
{
color 1.0 0.95 0.5
size 588
size 88
secondarySize 96
chance 0.5
attenuate 1