当前位置: 首页>>代码示例>>C++>>正文


C++ FSerializer::isReading方法代码示例

本文整理汇总了C++中FSerializer::isReading方法的典型用法代码示例。如果您正苦于以下问题:C++ FSerializer::isReading方法的具体用法?C++ FSerializer::isReading怎么用?C++ FSerializer::isReading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FSerializer的用法示例。


在下文中一共展示了FSerializer::isReading方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: STAT_Serialize

void STAT_Serialize(FSerializer &arc)
{
	FString startlevel;
	int i = LevelData.Size();

	if (arc.BeginObject("statistics"))
	{
		if (arc.isReading())
		{
			arc("startlevel", startlevel);
			StartEpisode = NULL;
			for (unsigned int j = 0; j < AllEpisodes.Size(); j++)
			{
				if (!AllEpisodes[j].mEpisodeMap.CompareNoCase(startlevel))
				{
					StartEpisode = &AllEpisodes[j];
					break;
				}
			}
			LevelData.Resize(i);
		}
		else
		{
			if (StartEpisode != NULL) startlevel = StartEpisode->mEpisodeMap;
			arc("startlevel", startlevel);
		}
		arc("levels", LevelData);
		arc.EndObject();
	}
}
开发者ID:Jayman2000,项目名称:zdoom-pull,代码行数:30,代码来源:statistics.cpp

示例2: EndSerialize

void FGLInterface::EndSerialize(FSerializer &arc)
{
	if (arc.isReading())
	{
		gl_RecreateAllAttachedLights();
		gl_InitPortals();
	}
}
开发者ID:nashmuhandes,项目名称:GZDoom-GPL,代码行数:8,代码来源:gl_scene.cpp

示例3: Serialize

void FRemapTable::Serialize(FSerializer &arc)
{
	int n = NumEntries;

	arc("numentries", NumEntries);
	if (arc.isReading())
	{
		if (n != NumEntries)
		{
			Free();
			Alloc(NumEntries);
		}
	}
	arc.Array("remap", Remap, NumEntries);
	arc.Array("palette", Palette, NumEntries);
}
开发者ID:emileb,项目名称:gzdoom,代码行数:16,代码来源:r_translate.cpp

示例4: P_SerializeSounds

void P_SerializeSounds(FSerializer &arc)
{
	S_SerializeSounds(arc);
	DSeqNode::SerializeSequences (arc);
	const char *name = NULL;
	BYTE order;

	if (arc.isWriting())
	{
		order = S_GetMusic(&name);
	}
	arc.StringPtr("musicname", name)
		("musicorder", order);

	if (arc.isReading())
	{
		if (!S_ChangeMusic(name, order))
			if (level.cdtrack == 0 || !S_ChangeCDMusic(level.cdtrack, level.cdid))
				S_ChangeMusic(level.Music, level.musicorder);
	}
}
开发者ID:XaserAcheron,项目名称:zdoom,代码行数:21,代码来源:p_saveg.cpp

示例5: G_SerializeLevel

void G_SerializeLevel(FSerializer &arc, bool hubload)
{
	int i = level.totaltime;

	if (arc.isWriting())
	{
		arc.Array("checksum", level.md5, 16);
	}
	else
	{
		// prevent bad things from happening by doing a check on the size of level arrays and the map's entire checksum.
		// The old code happily tried to load savegames with any mismatch here, often causing meaningless errors
		// 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") != (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");
		}
	}
	arc("saveversion", SaveVersion);

	Renderer->StartSerialize(arc);
	if (arc.isReading())
	{
		DThinker::DestroyAllThinkers();
		interpolator.ClearInterpolations();
		arc.ReadObjects(hubload);
	}

	arc("level.flags", level.flags)
		("level.flags2", level.flags2)
		("level.fadeto", level.fadeto)
		("level.found_secrets", level.found_secrets)
		("level.found_items", level.found_items)
		("level.killed_monsters", level.killed_monsters)
		("level.total_secrets", level.total_secrets)
		("level.total_items", level.total_items)
		("level.total_monsters", level.total_monsters)
		("level.gravity", level.gravity)
		("level.aircontrol", level.aircontrol)
		("level.teamdamage", level.teamdamage)
		("level.maptime", level.maptime)
		("level.totaltime", i)
		("level.skytexture1", level.skytexture1)
		("level.skytexture2", level.skytexture2);

	// Hub transitions must keep the current total time
	if (!hubload)
		level.totaltime = i;

	if (arc.isReading())
	{
		sky1texture = level.skytexture1;
		sky2texture = level.skytexture2;
		R_InitSkyMap();
		G_AirControlChanged();
	}



	// fixme: This needs to ensure it reads from the correct place. Should be one once there's enough of this code converted to JSON

	FBehavior::StaticSerializeModuleStates(arc);
	// The order here is important: First world state, then portal state, then thinkers, and last polyobjects.
	arc.Array("linedefs", lines, &loadlines[0], numlines);
	arc.Array("sidedefs", sides, &loadsides[0], numsides);
	arc.Array("sectors", sectors, &loadsectors[0], numsectors);
	arc("zones", Zones);
	arc("lineportals", linePortals);
	arc("sectorportals", sectorPortals);
	if (arc.isReading()) P_CollectLinkedPortals();

	DThinker::SerializeThinkers(arc, !hubload);
	arc.Array("polyobjs", polyobjs, po_NumPolyobjs);
	arc("subsectors", subsectors);
	StatusBar->SerializeMessages(arc);
	AM_SerializeMarkers(arc);
	FRemapTable::StaticSerializeTranslations(arc);
	FCanvasTextureInfo::Serialize(arc);
	P_SerializePlayers(arc, hubload);
	P_SerializeSounds(arc);

	if (arc.isReading())
	{
		for (int i = 0; i < numsectors; i++)
		{
			P_Recalculate3DFloors(&sectors[i]);
		}
		for (int i = 0; i < MAXPLAYERS; ++i)
		{
			if (playeringame[i] && players[i].mo != NULL)
			{
				players[i].mo->SetupWeaponSlots();
			}
		}
//.........这里部分代码省略.........
开发者ID:XaserAcheron,项目名称:zdoom,代码行数:101,代码来源:p_saveg.cpp


注:本文中的FSerializer::isReading方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。