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


C++ IDataStream::ReadInt32方法代码示例

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


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

示例1: Load

void WBCompEldMesh::Load(const IDataStream& Stream) {
  XTRACE_FUNCTION;

  ASSERT(m_Mesh);

  const uint Version = Stream.ReadUInt32();

  if (Version >= VERSION_MESHNAME) {
    const SimpleString MeshName = Stream.ReadString();
    if (MeshName != m_MeshName) {
      SetMesh(MeshName);
    }
  }

  if (Version >= VERSION_TEXTURENAME) {
    const SimpleString TextureName = Stream.ReadString();
    if (TextureName != m_TextureName) {
      SetTexture(TextureName);
    }
  }

  if (Version >= VERSION_MESHSCALE) {
    Stream.Read(sizeof(Vector), &m_Mesh->m_Scale);
  }

  if (Version >= VERSION_HIDDEN) {
    m_Hidden = Stream.ReadBool();
  }

  if (Version >= VERSION_ANIMATION) {
    const int AnimationIndex = Stream.ReadInt32();
    const float AnimationTime = Stream.ReadFloat();
    const int AnimationEndBehavior = Stream.ReadInt32();
    const float AnimationPlayRate =
        (Version >= VERSION_ANIMRATE) ? Stream.ReadFloat() : 1.0f;

    if (m_Mesh->IsAnimated()) {
      WB_MAKE_EVENT(SetAnim, GetEntity());
      WB_SET_AUTO(SetAnim, Int, AnimationIndex, AnimationIndex);
      WB_SET_AUTO(SetAnim, Float, AnimationTime, AnimationTime);
      WB_SET_AUTO(SetAnim, Int, AnimationEndBehavior, AnimationEndBehavior);
      WB_SET_AUTO(SetAnim, Float, AnimationPlayRate, AnimationPlayRate);
      WB_QUEUE_EVENT(GetEventManager(), SetAnim, GetEntity());
    }
  }
}
开发者ID:ptitSeb,项目名称:Eldritch,代码行数:46,代码来源:wbcompeldmesh.cpp

示例2: Load

void WBCompEldHands::Load( const IDataStream& Stream )
{
	XTRACE_FUNCTION;

	const uint Version = Stream.ReadUInt32();

	if( Version >= VERSION_HIDEHANDSREFS )
	{
		m_HideHandsRefs = Stream.ReadInt32();
	}
}
开发者ID:MinorKeyGames,项目名称:Eldritch,代码行数:11,代码来源:wbcompeldhands.cpp

示例3: Load

void EldritchRoom::Load( const IDataStream& Stream )
{
	const uint Version = Stream.ReadUInt32();

	if( Version >= VERSION_ROOMSCALARS )
	{
		m_RoomScalarX = Stream.ReadUInt32();
		m_RoomScalarY = Stream.ReadUInt32();
		m_RoomScalarZ = Stream.ReadUInt32();
	}

	if( Version >= VERSION_VOXELS )
	{
		const uint NumVoxels = Stream.ReadUInt32();
		m_VoxelMap.Resize( NumVoxels );
		Stream.Read( m_VoxelMap.MemorySize(), m_VoxelMap.GetData() );
	}

	if( Version >= VERSION_SPAWNERS )
	{
		const uint NumSpawners = Stream.ReadUInt32();
		m_Spawners.Clear();
		m_Spawners.Reserve( NumSpawners );
		for( uint SpawnerIndex = 0; SpawnerIndex < NumSpawners; ++SpawnerIndex )
		{
			SSpawner& Spawner = m_Spawners.PushBack();
			Spawner.m_SpawnerDef = Stream.ReadString();
			Spawner.m_Location = Stream.ReadInt32();

			if( Version >= VERSION_SPAWNER_ORIENTATION )
			{
				Spawner.m_Orientation = Stream.ReadUInt8();
			}
		}
	}
}
开发者ID:MinorKeyGames,项目名称:Eldritch,代码行数:36,代码来源:eldritchroom.cpp

示例4: Load

void ConfigManager::Load( const IDataStream& Stream )
{
	uint Pos = Stream.GetPos();
	if( 'FCCD' == Stream.ReadUInt32() )
	{
		uint NumContexts = Stream.ReadUInt32();
		for( uint ContextIndex = 0; ContextIndex < NumContexts; ++ContextIndex )
		{
			HashedString ContextKey( Stream.ReadUInt32() );
			uint NumVars = Stream.ReadUInt32();

			VarMap& VarMap = GetInstance()->m_Vars[ ContextKey ];

			for( uint VarIndex = 0; VarIndex < NumVars; ++VarIndex )
			{
				ConfigVar ConfigVar;
				HashedString Key( Stream.ReadUInt32() );
				ConfigVar.m_Type = ( ConfigVar::EVarType )Stream.ReadUInt8();

				switch( ConfigVar.m_Type )
				{
				case ConfigVar::EVT_Bool:
					ConfigVar.m_Bool = ( Stream.ReadUInt8() != 0 );
					break;
				case ConfigVar::EVT_Int:
					ConfigVar.m_Int = Stream.ReadInt32();
					break;
				case ConfigVar::EVT_Float:
					ConfigVar.m_Float = Stream.ReadFloat();
					break;
				case ConfigVar::EVT_String:
					{
						uint Length = Stream.ReadUInt32();

						char* pString = AllocateString( Length + 1 );
						Stream.Read( Length, pString );
						pString[ Length ] = '\0';
						StringManager::AddString( StringManager::ESL_Permanent, pString );

						ConfigVar.m_String = pString;
						ConfigVar.m_Hash = Stream.ReadUInt32();

						if( ReverseHash::IsEnabled() )
						{
							ReverseHash::RegisterHash( ConfigVar.m_Hash, ConfigVar.m_String );
						}
					}
					break;
				default:
					WARNDESC( "Bad config var type" );
					break;
				}

				VarMap.Insert( Key, ConfigVar );
			}
		}

	}
	else
	{
		Stream.SetPos( Pos );
		ConfigParser::Parse( Stream );
	}
}
开发者ID:Johnicholas,项目名称:EldritchCopy,代码行数:64,代码来源:configmanager.cpp


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