Save HalfVehicleSolidMask object state

After saving and restoring an object with a half vehicle solid mask, the
solid mask was fully solid.
install-platforms
Lukas Werling 2018-01-05 22:41:14 +01:00
parent 058e9addb4
commit 22c84edea7
2 changed files with 6 additions and 0 deletions

View File

@ -125,6 +125,7 @@ void C4Object::Default()
fOwnVertices=false; fOwnVertices=false;
Contents.Default(); Contents.Default();
SolidMask.Default(); SolidMask.Default();
HalfVehicleSolidMask=false;
PictureRect.Default(); PictureRect.Default();
Def=nullptr; Def=nullptr;
Info=nullptr; Info=nullptr;
@ -1071,6 +1072,7 @@ bool C4Object::ChangeDef(C4ID idNew)
if (!Def->Rotateable) { fix_r=rdir=Fix0; } if (!Def->Rotateable) { fix_r=rdir=Fix0; }
// Reset solid mask // Reset solid mask
SolidMask=Def->SolidMask; SolidMask=Def->SolidMask;
HalfVehicleSolidMask=false;
// Post change updates // Post change updates
UpdateGraphics(true); UpdateGraphics(true);
UpdateMass(); UpdateMass();
@ -2199,6 +2201,7 @@ void C4Object::CompileFunc(StdCompiler *pComp, C4ValueNumbers * numbers)
pComp->Value(mkParAdapt(Shape, &Def->Shape)); pComp->Value(mkParAdapt(Shape, &Def->Shape));
pComp->Value(mkNamingAdapt( fOwnVertices, "OwnVertices", false )); pComp->Value(mkNamingAdapt( fOwnVertices, "OwnVertices", false ));
pComp->Value(mkNamingAdapt( SolidMask, "SolidMask", Def->SolidMask )); pComp->Value(mkNamingAdapt( SolidMask, "SolidMask", Def->SolidMask ));
pComp->Value(mkNamingAdapt( HalfVehicleSolidMask, "HalfVehicleSolidMask", false ));
pComp->Value(mkNamingAdapt( PictureRect, "Picture" )); pComp->Value(mkNamingAdapt( PictureRect, "Picture" ));
pComp->Value(mkNamingAdapt( Mobile, "Mobile", false )); pComp->Value(mkNamingAdapt( Mobile, "Mobile", false ));
pComp->Value(mkNamingAdapt( OnFire, "OnFire", false )); pComp->Value(mkNamingAdapt( OnFire, "OnFire", false ));
@ -2469,6 +2472,7 @@ void C4Object::SetSolidMask(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt,
void C4Object::SetHalfVehicleSolidMask(bool set) void C4Object::SetHalfVehicleSolidMask(bool set)
{ {
if (!pSolidMaskData) return; if (!pSolidMaskData) return;
HalfVehicleSolidMask = set;
pSolidMaskData->SetHalfVehicle(set); pSolidMaskData->SetHalfVehicle(set);
} }
@ -4157,6 +4161,7 @@ void C4Object::UpdateSolidMask(bool fRestoreAttachedObjects)
else else
pSolidMaskData->Remove(false); pSolidMaskData->Remove(false);
pSolidMaskData->Put(true, nullptr, fRestoreAttachedObjects); pSolidMaskData->Put(true, nullptr, fRestoreAttachedObjects);
SetHalfVehicleSolidMask(HalfVehicleSolidMask);
} }
// Otherwise, remove and destroy mask // Otherwise, remove and destroy mask
else if (pSolidMaskData) else if (pSolidMaskData)

View File

@ -148,6 +148,7 @@ public:
C4Shape Shape; C4Shape Shape;
bool fOwnVertices; // if set, vertices aren't restored from def but from end of own vtx list bool fOwnVertices; // if set, vertices aren't restored from def but from end of own vtx list
C4TargetRect SolidMask; C4TargetRect SolidMask;
bool HalfVehicleSolidMask;
C4Rect PictureRect; C4Rect PictureRect;
C4NotifyingObjectList Contents; C4NotifyingObjectList Contents;
C4MaterialList *MaterialContents; // SyncClearance-NoSave // C4MaterialList *MaterialContents; // SyncClearance-NoSave //