void FTextureManager::WriteTexture (FArchive &arc, int picnum) { FTexture *pic; if (picnum < 0) { arc.WriteName(NULL); return; } else if ((size_t)picnum >= Textures.Size()) { pic = Textures[0].Texture; } else { pic = Textures[picnum].Texture; } if(strncmp(pic->Name, FONT_CHAR_NAME, 6) != 0) arc.WriteName (pic->Name); else { FString cname; cname.Format("%s:%s", static_cast<FFontTexture*>(pic)->SourceFont->GetName(), pic->Name+6); arc.WriteName (cname); } arc.WriteCount (pic->UseType); }
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); } } }
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; } } }
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 }