本文整理汇总了C++中CDataReader::setSeek方法的典型用法代码示例。如果您正苦于以下问题:C++ CDataReader::setSeek方法的具体用法?C++ CDataReader::setSeek怎么用?C++ CDataReader::setSeek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDataReader
的用法示例。
在下文中一共展示了CDataReader::setSeek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
uint8 CBMPFormat::detectBMPVersion(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
uint8 uiBMPVersion = 0;
pDataReader->setPeek(true);
string strHeader = pDataReader->readString(2);
if (strHeader.c_str()[0] == '\0' && strHeader.c_str()[1] == '\0')
{
// BMP version 1.x
uiBMPVersion = 1;
}
else if (strHeader.c_str()[0] == 'B' && strHeader.c_str()[1] == 'M')
{
// BMP version 2.x, 3.x or 4.x
pDataReader->setSeek(12);
switch (pDataReader->readUint32())
{
case 12: // BMP version 2.x
uiBMPVersion = 2;
break;
case 40: // BMP version 3.x
uiBMPVersion = 3;
break;
case 108: // BMP version 4.x
uiBMPVersion = 4;
}
}
pDataReader->setPeek(false);
pDataReader->setSeek(0);
return uiBMPVersion;
}
示例2: getCOLVersion
uint32 CCOLEntry::calculateShadowMeshVertexCount(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
eCOLVersion eCOLVersionValue = getCOLVersion() == nullptr ? COL_UNKNOWN : getCOLVersion()->getVersionId();
//CDebugger::log("getHeaderStartOffset(): " + CStringUtility::toString(getHeaderStartOffset()));
//CDebugger::log("getShadowMeshFacesOffset(): " + CStringUtility::toString(getShadowMeshFacesOffset()));
//CDebugger::log("getShadowMeshFaceCount(): " + CStringUtility::toString(getShadowMeshFaceCount()));
//CDebugger::log("getCOLVersion(): " + CStringUtility::toString(getCOLVersion()));
pDataReader->setSeek(getHeaderStartOffset() + 4 + getShadowMeshFacesOffset());
string strShadowMeshFacesData = pDataReader->readString(getShadowMeshFaceCount() * (eCOLVersionValue == 1 ? 16 : 8)); // 12 or 6 = sizeof(TVertex)
//CDebugger::log("part 2 -- strShadowMeshFacesData.length(): " + CStringUtility::toString(strShadowMeshFacesData.length()));
uint32 uiSeek = 0;
uint32 uiHighestVertexIndex = 0;
if (getShadowMeshFaceCount() == 0)
{
return 0;
}
if (eCOLVersionValue == COL_1)
{
// COL 1
for (uint32 i = 0, j = getShadowMeshFaceCount(); i < j; i++)
{
for (uint8 i2 = 0; i2 < 3; i2++)
{
uint32 uiVertexIndex = CStringUtility::unpackUint32(strShadowMeshFacesData.substr(uiSeek, 4), false);
if (uiVertexIndex > uiHighestVertexIndex)
{
uiHighestVertexIndex = uiVertexIndex;
}
uiSeek += 4; // 4 is sizeof(uint32)
}
uiSeek += 4; // 4 is sizeof(TSurface)
}
}
else
{
// COL 2, 3 & 4
for (uint32 i = 0, j = getShadowMeshFaceCount(); i < j; i++)
{
for (uint8 i2 = 0; i2 < 3; i2++)
{
uint32 uiVertexIndex = CStringUtility::unpackUint16(strShadowMeshFacesData.substr(uiSeek, 2), false);
if (uiVertexIndex > uiHighestVertexIndex)
{
uiHighestVertexIndex = uiVertexIndex;
}
uiSeek += 2; // 2 is sizeof(uint16)
}
uiSeek += 2; // 1 byte for material, 1 byte for light
}
}
return uiHighestVertexIndex + 1;
}
示例3:
eDATPathFormat CDATPathFormat::detectPathsFormat(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
eDATPathFormat eDATPathFormatValue;
uint32 uiPreviousSeek = pDataReader->getSeek();
pDataReader->setPeek(true);
if (CStringUtility::unpackUint32(pDataReader->readString(4), false) == 0xFFFFFFFF && pDataReader->readString(4) == "FM92")
{
eDATPathFormatValue = DAT_PATH_FASTMAN92;
}
else
{
eDATPathFormatValue = DAT_PATH_DEFAULT;
}
pDataReader->setSeek(uiPreviousSeek);
pDataReader->setPeek(false);
return eDATPathFormatValue;
}