本文整理汇总了C++中CDataReader类的典型用法代码示例。如果您正苦于以下问题:C++ CDataReader类的具体用法?C++ CDataReader怎么用?C++ CDataReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDataReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CRWSection_Texture::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
m_usFilterFlags = pDataReader->readUint16();
m_usUnknown1 = pDataReader->readUint16();
}
示例2:
void CRWSection_Clump::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
/*
todo
if (m_pParentNode == pDFFFile) // found first clump struct in the DFF file
{
setSectionHeaderSkipped(false);
pLatestClump = pClump;
m_pParentNode = pClump;
}
else
{
setSectionHeaderSkipped(true);
}
*/
m_uiAtomicallyLinkedObjectCount = pDataReader->readUint32();
//if ((uiRWVersionId >= 0x0C02FFFF || uiRWVersionId == 0x0400CFFF) ////////// && uiRWVersionId != 0x1003FFFF ////////)
if (m_uiSectionSize == 12)
{
m_uiLightCount = pDataReader->readUint32();
m_uiCameraCount = pDataReader->readUint32();
}
else
{
m_uiLightCount = 1;
m_uiCameraCount = 1;
}
}
示例3:
void CBMPFormat::unserializeVersion4(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
uint32 uiByteCount;
// read headers 1 & 2
CBMPFormat_Header1 *pHeader1 = pDataReader->readStruct<CBMPFormat_Header1>();
CBMPFormat_Header2_Version4 *pHeader2 = pDataReader->readStruct<CBMPFormat_Header2_Version4>();
// palette
m_bHasPalette = pHeader2->m_usBPP < 16;
if (m_bHasPalette)
{
uiByteCount = 4 * pHeader2->m_uiColoursUsed;
m_strPaletteData = pDataReader->readString(uiByteCount);
}
// raster data
uiByteCount = pHeader2->m_uiWidth * pHeader2->m_uiHeight * ((float32)pHeader2->m_usBPP / 8.0f);
m_strRasterData = pDataReader->readString(uiByteCount);
// copy from raw structs to wrapper structs
m_uiWidth = pHeader2->m_uiWidth;
m_uiHeight = pHeader2->m_uiHeight;
m_usColourPlaneCount = pHeader2->m_usPlaneCount;
m_usBPP = pHeader2->m_usBPP;
// clean up
delete pHeader1;
delete pHeader2;
}
示例4: getCOLVersion
void CCOLEntry::parseCollisionMeshVertices(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
eCOLVersion eCOLVersionValue = getCOLVersion() == nullptr ? COL_UNKNOWN : getCOLVersion()->getVersionId();
vector<TVertex>& vecVertices = getCollisionMeshVertices();
for (uint32 i = 0, j = getCollisionMeshVertexCount(); i < j; i++)
{
char szText1[500];
TVertex vertex;
if (eCOLVersionValue == COL_1)
{
vertex.m_x = pDataReader->readFloat32();
vertex.m_y = pDataReader->readFloat32();
vertex.m_z = pDataReader->readFloat32();
}
else
{
vertex.m_x = ((float32) pDataReader->readInt16()) / 128.0f;
vertex.m_y = ((float32) pDataReader->readInt16()) / 128.0f;
vertex.m_z = ((float32) pDataReader->readInt16()) / 128.0f;
}
vecVertices.push_back(vertex);
}
}
示例5:
void CDATLoaderFormat::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
pDataReader->readAndStoreLines();
while (pDataReader->iterateLines())
{
unserializeLine();
}
}
示例6: if
void CLocalizationFormat::unserializeLine(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
string strLine = *pDataReader->getActiveLine();
strLine = CStringUtility::trim(strLine, " ");
strLine = CStringUtility::trim(strLine, "\t");
if (strLine == "")
{
// blank line
return;
}
else if (strLine.c_str()[0] == '#')
{
// comment line
return;
}
else
{
// remove comment from end of line
string strComment = "";
size_t uiCommentPosition = strLine.find('#');
if (uiCommentPosition != string::npos)
{
strComment = strLine.substr(uiCommentPosition + 1);
strLine = strLine.substr(0, uiCommentPosition);
}
uint32 uiFirstCommaPosition = strLine.find(',');
if (uiFirstCommaPosition == string::npos)
{
// line does not have comma
return;
}
string strInternalName = strLine.substr(0, uiFirstCommaPosition);
string strLanguageText = strLine.substr(uiFirstCommaPosition + 1);
strInternalName = CStringUtility::trim(strInternalName, " ");
strInternalName = CStringUtility::trim(strInternalName, "\t");
strLanguageText = CStringUtility::trim(strLanguageText, " ");
strLanguageText = CStringUtility::trim(strLanguageText, "\t");
if (strLanguageText == "")
{
// line does not have language text set
return;
}
m_umapTranslatedText[strInternalName] = strLanguageText;
}
}
示例7:
void CLocalizationFormat::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
pDataReader->readAndStoreLines();
while (pDataReader->iterateLines())
{
unserializeLine();
}
pDataReader->resetLines();
}
示例8:
void CIDEEntry_2DFX_Ladder::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
CIDEEntry_2DFX::unserialize();
m_vecLadderStartPosition = pDataReader->readVector3D();
m_vecLadderEndPosition = pDataReader->readVector3D();
m_vecClimbDirectionPosition = pDataReader->readVector3D();
m_uiFlags = pDataReader->readTokenUint32();
}
示例9:
void CIDEEntry_2DFX_SpawnPoint::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
CIDEEntry_2DFX::unserialize();
m_vecFlags.m_x = pDataReader->readTokenUint32();
m_vecFlags.m_y = pDataReader->readTokenUint32();
m_vecFlags.m_z = pDataReader->readTokenUint32();
m_vecFlags.m_w = pDataReader->readTokenUint32();
}
示例10: getShadowMeshVertices
void CCOLEntry::parseShadowMeshVertices(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
vector<TVertex>& vecVertices = getShadowMeshVertices();
for (uint32 i = 0, j = getShadowMeshVertexCount(); i < j; i++)
{
TVertex vertex;
vertex.m_x = ((float32) pDataReader->readInt16()) / 128.0f;
vertex.m_y = ((float32) pDataReader->readInt16()) / 128.0f;
vertex.m_z = ((float32) pDataReader->readInt16()) / 128.0f;
vecVertices.push_back(vertex);
}
}
示例11:
void CIDEEntry_PATH_Node::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
if (getLatestPathGroup() == nullptr)
{
// path node found before path group
throw EXCEPTION_INVALID_DATA_ORDER;
}
switch (pDataReader->getLineTokens().size())
{
case 9:
CIDEEntry_PATH::unserialize();
setFormatType(0);
setFormatGames(GAME_FLAG_GTA_III | GAME_FLAG_GTA_VC);
m_uiNodeType = pDataReader->readTokenUint32();
m_uiNextNode = pDataReader->readTokenUint32();
m_uiIsCrossRoad = pDataReader->readTokenUint32();
m_vecPosition = pDataReader->readVector3D() / 16.0f;
m_fUnknown1 = pDataReader->readTokenFloat32();
m_uiLeftLaneCount = pDataReader->readTokenUint32();
m_uiRightLaneCount = pDataReader->readTokenUint32();
break;
}
getLatestPathGroup()->addEntry(this);
}
示例12:
void CIPLEntry_PICK::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
switch (pDataReader->getLineTokens().size())
{
case 4:
setFormatType(0);
setFormatGames(GAME_FLAG_GTA_SA);
m_uiWeaponId = pDataReader->readTokenUint32();
m_vecPosition = pDataReader->readTokenVector3D();
break;
default:
throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
}
}
示例13: 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;
}
示例14: getShadowMeshFaces
void CCOLEntry::parseShadowMeshFaces(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
vector<TFace>& vecFaces = getShadowMeshFaces();
for (uint32 i = 0, j = getShadowMeshFaceCount(); i < j; i++)
{
TFace face;
face.m_uiA = pDataReader->readUint16();
face.m_uiB = pDataReader->readUint16();
face.m_uiC = pDataReader->readUint16();
face.m_surface.m_ucMaterial = pDataReader->readUint8();
face.m_surface.m_ucFlag = 0;
face.m_surface.m_ucBrightness = 0;
face.m_surface.m_ucLight = pDataReader->readUint8();
vecFaces.push_back(face);
}
}
示例15:
void CIDEEntry_HIER::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
switch (pDataReader->getLineTokens().size())
{
case 3:
// GTA III, GTA VC, GTA SA
setFormatType(0);
setFormatGames(GAME_FLAG_GTA_III | GAME_FLAG_GTA_VC | GAME_FLAG_GTA_SA);
m_uiObjectId = pDataReader->readTokenUint32();
m_strModelName = pDataReader->readTokenString();
m_strTXDName = pDataReader->readTokenString();
break;
default:
throw EXCEPTION_UNKNOWN_FORMAT_TYPE;
}
}