Esempio n. 1
0
int FTextureManager::ReadTexture (FArchive &arc)
{
	int usetype;
	const char *name;

	name = arc.ReadName ();
	if (name != NULL)
	{
		usetype = arc.ReadCount ();
		return GetTexture (name, usetype).GetIndex();
	}
	else return -1;
}
Esempio n. 2
0
void DSpotState::Serialize(FArchive &arc)
{
	Super::Serialize(arc);
	if (arc.IsStoring())
	{
		arc.WriteCount(SpotLists.Size());
		for(unsigned i = 0; i < SpotLists.Size(); i++)
		{
			SpotLists[i]->Serialize(arc);
		}
	}
	else
	{
		unsigned c = arc.ReadCount();
		SpotLists.Resize(c);
		for(unsigned i = 0; i < SpotLists.Size(); i++)
		{
			SpotLists[i] = new FSpotList;
			SpotLists[i]->Serialize(arc);
		}
	}
}
Esempio n. 3
0
void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first)
{
	DWORD numInChain;
	DBaseDecal *fresh;
	DBaseDecal **firstptr = first;

	if (arc.IsLoading ())
	{
		numInChain = arc.ReadCount ();
		
		while (numInChain--)
		{
			arc << fresh;
			*firstptr = fresh;
			fresh->WallPrev = firstptr;
			firstptr = &fresh->WallNext;
		}
	}
	else
	{
		numInChain = 0;
		fresh = *firstptr;
		while (fresh != NULL)
		{
			fresh = fresh->WallNext;
			++numInChain;
		}
		arc.WriteCount (numInChain);
		fresh = *firstptr;
		while (numInChain--)
		{
			arc << fresh;
			fresh = fresh->WallNext;
		}
	}
}
Esempio n. 4
0
void DObject::SerializeUserVars(FArchive &arc)
{
#if 0
	PSymbolTable *symt;
	FName varname;
	DWORD count, j;
	int *varloc = NULL;

	symt = &GetClass()->Symbols;

	if (arc.IsStoring())
	{
		// Write all user variables.
		for (; symt != NULL; symt = symt->ParentSymbolTable)
		{
			for (unsigned i = 0; i < symt->Symbols.Size(); ++i)
			{
				PSymbol *sym = symt->Symbols[i];
				if (sym->SymbolType == SYM_Variable)
				{
					PSymbolVariable *var = static_cast<PSymbolVariable *>(sym);
					if (var->bUserVar)
					{
						count = var->ValueType.Type == VAL_Array ? var->ValueType.size : 1;
						varloc = (int *)(reinterpret_cast<BYTE *>(this) + var->offset);

						arc << var->SymbolName;
						arc.WriteCount(count);
						for (j = 0; j < count; ++j)
						{
							arc << varloc[j];
						}
					}
				}
			}
		}
		// Write terminator.
		varname = NAME_None;
		arc << varname;
	}
	else
	{
		// Read user variables until 'None' is encountered.
		arc << varname;
		while (varname != NAME_None)
		{
			PSymbol *sym = symt->FindSymbol(varname, true);
			DWORD wanted = 0;

			if (sym != NULL && sym->SymbolType == SYM_Variable)
			{
				PSymbolVariable *var = static_cast<PSymbolVariable *>(sym);

				if (var->bUserVar)
				{
					wanted = var->ValueType.Type == VAL_Array ? var->ValueType.size : 1;
					varloc = (int *)(reinterpret_cast<BYTE *>(this) + var->offset);
				}
			}
			count = arc.ReadCount();
			for (j = 0; j < MIN(wanted, count); ++j)
			{
				arc << varloc[j];
			}
			if (wanted < count)
			{
				// Ignore remaining values from archive.
				for (; j < count; ++j)
				{
					int foo;
					arc << foo;
				}
			}
			arc << varname;
		}
	}
#endif
}