mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom into zscript
# Conflicts: # src/scripting/codegeneration/codegen.cpp
This commit is contained in:
commit
646f9b21c7
12 changed files with 65 additions and 60 deletions
|
@ -497,7 +497,7 @@ DFsSection *FParser::looping_section()
|
|||
if(!best || (current->start_index > best->start_index))
|
||||
best = current; // save it
|
||||
}
|
||||
current = current->next;
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -331,6 +331,10 @@ void FRandom::StaticReadRNGState(FSerializer &arc)
|
|||
FRandom *rng;
|
||||
|
||||
arc("rngseed", rngseed);
|
||||
|
||||
// Call StaticClearRandom in order to ensure that SFMT is initialized
|
||||
FRandom::StaticClearRandom ();
|
||||
|
||||
if (arc.BeginArray("rngs"))
|
||||
{
|
||||
int count = arc.ArraySize();
|
||||
|
|
|
@ -1617,7 +1617,7 @@ void FBehavior::StaticSerializeModuleStates (FSerializer &arc)
|
|||
{
|
||||
if (arc.isReading())
|
||||
{
|
||||
int modnum = arc.ArraySize();
|
||||
auto modnum = arc.ArraySize();
|
||||
if (modnum != StaticModules.Size())
|
||||
{
|
||||
I_Error("Level was saved with a different number of ACS modules. (Have %d, save has %d)", StaticModules.Size(), modnum);
|
||||
|
@ -2934,7 +2934,7 @@ void DACSThinker::Serialize(FSerializer &arc)
|
|||
if (arc.BeginArray("runningscripts"))
|
||||
{
|
||||
auto cnt = arc.ArraySize();
|
||||
for (int i = 0; i < cnt; i++)
|
||||
for (unsigned i = 0; i < cnt; i++)
|
||||
{
|
||||
SavingRunningscript srs;
|
||||
arc(nullptr, srs);
|
||||
|
|
|
@ -184,7 +184,7 @@ void DCeiling::Tick ()
|
|||
case DCeiling::ceilLowerAndCrush:
|
||||
if (m_CrushMode == ECrushMode::crushSlowdown)
|
||||
m_Speed = 1. / 8;
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -888,10 +888,10 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
// deep down in the deserializer or just a crash if the few insufficient safeguards were not triggered.
|
||||
BYTE chk[16] = { 0 };
|
||||
arc.Array("checksum", chk, 16);
|
||||
if (arc.GetSize("linedefs") != numlines ||
|
||||
arc.GetSize("sidedefs") != numsides ||
|
||||
arc.GetSize("sectors") != numsectors ||
|
||||
arc.GetSize("polyobjs") != po_NumPolyobjs ||
|
||||
if (arc.GetSize("linedefs") != (unsigned)numlines ||
|
||||
arc.GetSize("sidedefs") != (unsigned)numsides ||
|
||||
arc.GetSize("sectors") != (unsigned)numsectors ||
|
||||
arc.GetSize("polyobjs") != (unsigned)po_NumPolyobjs ||
|
||||
memcmp(chk, level.md5, 16))
|
||||
{
|
||||
I_Error("Savegame is from a different level");
|
||||
|
|
|
@ -392,7 +392,8 @@ int FZipLump::FillCache()
|
|||
int FZipLump::GetFileOffset()
|
||||
{
|
||||
if (Method != METHOD_STORED) return -1;
|
||||
if (Flags & LUMPFZIP_NEEDFILESTART) SetLumpAddress(); return Position;
|
||||
if (Flags & LUMPFZIP_NEEDFILESTART) SetLumpAddress();
|
||||
return Position;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -1556,7 +1556,7 @@ ExpEmit FxSizeAlign::Emit(VMFunctionBuilder *build)
|
|||
//==========================================================================
|
||||
|
||||
FxPreIncrDecr::FxPreIncrDecr(FxExpression *base, int token)
|
||||
: FxExpression(base->ScriptPosition), Base(base), Token(token)
|
||||
: FxExpression(base->ScriptPosition), Token(token), Base(base)
|
||||
{
|
||||
AddressRequested = false;
|
||||
AddressWritable = false;
|
||||
|
@ -1643,7 +1643,7 @@ ExpEmit FxPreIncrDecr::Emit(VMFunctionBuilder *build)
|
|||
//==========================================================================
|
||||
|
||||
FxPostIncrDecr::FxPostIncrDecr(FxExpression *base, int token)
|
||||
: FxExpression(base->ScriptPosition), Base(base), Token(token)
|
||||
: FxExpression(base->ScriptPosition), Token(token), Base(base)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1890,14 +1890,14 @@ bool FxBinary::ResolveLR(FCompileContext& ctx, bool castnumeric)
|
|||
}
|
||||
else if (left->IsNumeric() && right->IsNumeric())
|
||||
{
|
||||
if (left->ValueType->GetRegType() == REGT_INT && right->ValueType->GetRegType() == REGT_INT)
|
||||
{
|
||||
ValueType = TypeSInt32;
|
||||
}
|
||||
if (left->ValueType->GetRegType() == REGT_INT && right->ValueType->GetRegType() == REGT_INT)
|
||||
{
|
||||
ValueType = TypeSInt32;
|
||||
}
|
||||
else
|
||||
{
|
||||
ValueType = TypeFloat64;
|
||||
}
|
||||
{
|
||||
ValueType = TypeFloat64;
|
||||
}
|
||||
}
|
||||
else if (left->ValueType->GetRegType() == REGT_POINTER && left->ValueType == right->ValueType)
|
||||
{
|
||||
|
@ -3915,9 +3915,9 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
}
|
||||
}
|
||||
ScriptPosition.Message(MSG_DEBUGLOG, "Resolving name '%s' as member variable, index %d\n", Identifier.GetChars(), vsym->Offset);
|
||||
newex = new FxClassMember((new FxSelf(ScriptPosition))->Resolve(ctx), vsym, ScriptPosition);
|
||||
}
|
||||
ScriptPosition.Message(MSG_DEBUGLOG, "Resolving name '%s' as member variable, index %d\n", Identifier.GetChars(), vsym->Offset);
|
||||
newex = new FxClassMember((new FxSelf(ScriptPosition))->Resolve(ctx), vsym, ScriptPosition);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4816,28 +4816,28 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build)
|
|||
// If both functions are non-action or both are action, there is no need for special treatment.
|
||||
if (!OwnerIsSelf || (!!(Function->Variants[0].Flags & VARF_Action) == build->IsActionFunc))
|
||||
{
|
||||
// Emit code to pass implied parameters
|
||||
// Emit code to pass implied parameters
|
||||
if (Function->Variants[0].Flags & VARF_Method)
|
||||
{
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER, 0);
|
||||
count += 1;
|
||||
}
|
||||
{
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER, 0);
|
||||
count += 1;
|
||||
}
|
||||
if (Function->Variants[0].Flags & VARF_Action)
|
||||
{
|
||||
static_assert(NAP == 3, "This code needs to be updated if NAP changes");
|
||||
if (build->IsActionFunc)
|
||||
{
|
||||
static_assert(NAP == 3, "This code needs to be updated if NAP changes");
|
||||
if (build->IsActionFunc)
|
||||
{
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER, 1);
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
int null = build->GetConstantAddress(nullptr, ATAG_GENERIC);
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, null);
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, null);
|
||||
}
|
||||
count += 2;
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER, 1);
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
int null = build->GetConstantAddress(nullptr, ATAG_GENERIC);
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, null);
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, null);
|
||||
}
|
||||
count += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5869,18 +5869,18 @@ static bool VerifyJumpTarget(AActor *stateowner, FStateParamInfo *stateinfo, int
|
|||
|
||||
if (stateinfo->mCallingState != nullptr)
|
||||
{
|
||||
while (cls != RUNTIME_CLASS(AActor))
|
||||
while (cls != RUNTIME_CLASS(AActor))
|
||||
{
|
||||
// both calling and target state need to belong to the same class.
|
||||
if (cls->OwnsState(stateinfo->mCallingState))
|
||||
{
|
||||
// both calling and target state need to belong to the same class.
|
||||
if (cls->OwnsState(stateinfo->mCallingState))
|
||||
{
|
||||
return cls->OwnsState(stateinfo->mCallingState + index);
|
||||
}
|
||||
|
||||
// We can safely assume the ParentClass is of type PClassActor
|
||||
// since we stop when we see the Actor base class.
|
||||
cls = static_cast<PClassActor *>(cls->ParentClass);
|
||||
return cls->OwnsState(stateinfo->mCallingState + index);
|
||||
}
|
||||
|
||||
// We can safely assume the ParentClass is of type PClassActor
|
||||
// since we stop when we see the Actor base class.
|
||||
cls = static_cast<PClassActor *>(cls->ParentClass);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ void FSerializer::Close()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FSerializer::ArraySize()
|
||||
unsigned FSerializer::ArraySize()
|
||||
{
|
||||
if (r != nullptr && r->mObjects.Last().mObject->IsArray())
|
||||
{
|
||||
|
@ -710,7 +710,7 @@ FSerializer &FSerializer::Sprite(const char *key, int32_t &spritenum, int32_t *d
|
|||
{
|
||||
if (val->IsString())
|
||||
{
|
||||
int name = *reinterpret_cast<const int*>(val->GetString());
|
||||
uint32_t name = *reinterpret_cast<const uint32_t*>(val->GetString());
|
||||
for (auto hint = NumStdSprites; hint-- != 0; )
|
||||
{
|
||||
if (sprites[hint].dwName == name)
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
FWriter *w = nullptr;
|
||||
FReader *r = nullptr;
|
||||
|
||||
int ArraySize();
|
||||
unsigned ArraySize();
|
||||
void WriteKey(const char *key);
|
||||
void WriteObjects();
|
||||
|
||||
|
|
|
@ -145,8 +145,8 @@ HMISong::HMISong (FileReader &reader, EMidiDevice type, const char *args)
|
|||
MusHeader = new BYTE[len];
|
||||
SongLen = len;
|
||||
NumTracks = 0;
|
||||
if (reader.Read(MusHeader, len) != len)
|
||||
return;
|
||||
if (reader.Read(MusHeader, len) != len)
|
||||
return;
|
||||
|
||||
// Do some validation of the MIDI file
|
||||
if (memcmp(MusHeader, HMI_SONG_MAGIC, sizeof(HMI_SONG_MAGIC)) == 0)
|
||||
|
|
|
@ -114,10 +114,10 @@ MIDISong2::MIDISong2 (FileReader &reader, EMidiDevice type, const char *args)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
SongLen = reader.GetLength();
|
||||
SongLen = reader.GetLength();
|
||||
MusHeader = new BYTE[SongLen];
|
||||
if (reader.Read(MusHeader, SongLen) != SongLen)
|
||||
return;
|
||||
if (reader.Read(MusHeader, SongLen) != SongLen)
|
||||
return;
|
||||
|
||||
// Do some validation of the MIDI file
|
||||
if (MusHeader[4] != 0 || MusHeader[5] != 0 || MusHeader[6] != 0 || MusHeader[7] != 6)
|
||||
|
|
|
@ -117,10 +117,10 @@ XMISong::XMISong (FileReader &reader, EMidiDevice type, const char *args)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
SongLen = reader.GetLength();
|
||||
SongLen = reader.GetLength();
|
||||
MusHeader = new BYTE[SongLen];
|
||||
if (reader.Read(MusHeader, SongLen) != SongLen)
|
||||
return;
|
||||
if (reader.Read(MusHeader, SongLen) != SongLen)
|
||||
return;
|
||||
|
||||
// Find all the songs in this file.
|
||||
NumSongs = FindXMIDforms(MusHeader, SongLen, NULL);
|
||||
|
|
Loading…
Reference in a new issue