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; } }
void CIDEEntry_PATH_Group::unserialize(void) { CDataReader *pDataReader = CDataReader::getInstance(); switch (pDataReader->getLineTokens().size()) { case 3: CIDEEntry_PATH::unserialize(); setFormatType(0); setFormatGames(GAME_FLAG_GTA_III | GAME_FLAG_GTA_VC); m_strGroupType = pDataReader->readTokenString(); m_uiObjectId = pDataReader->readTokenUint32(); m_strModelName = pDataReader->readTokenUint32(); break; } setLatestPathGroup(this); }
void CIDEEntry_ANIM::unserialize(void) { CDataReader *pDataReader = CDataReader::getInstance(); switch (pDataReader->getLineTokens().size()) { case 6: // GTA SA setFormatType(0); setFormatGames(GAME_FLAG_GTA_SA); m_uiObjectId = pDataReader->readTokenUint32(); m_strModelName = pDataReader->readTokenString(); m_strTXDName = pDataReader->readTokenString(); m_strAnimationName = pDataReader->readTokenString(); m_fDrawDistance = pDataReader->readTokenFloat32(); m_uiFlags = pDataReader->readTokenUint32(); break; case 16: // GTA IV setFormatType(1); setFormatGames(GAME_FLAG_GTA_IV); m_strModelName = pDataReader->readTokenString(); m_strTXDName = pDataReader->readTokenString(); m_strAnimationName = pDataReader->readTokenString(); m_fDrawDistance = pDataReader->readTokenFloat32(); m_uiFlags = pDataReader->readTokenUint32(); m_uiUnknown1 = pDataReader->readTokenUint32(); m_vecBoundingBoxLowerLeftCorner = pDataReader->readVector3D(); m_vecBoundingBoxUpperRightCorner = pDataReader->readVector3D(); m_vecBoundingSphereCenterPosition = pDataReader->readVector3D(); m_fBoundingSphereRadius = pDataReader->readTokenFloat32(); m_strLODModel = pDataReader->readTokenString(); break; default: throw EXCEPTION_UNKNOWN_FORMAT_TYPE; } }
void CIDEEntry_TOBJ::unserialize(void) { CDataReader *pDataReader = CDataReader::getInstance(); switch (pDataReader->getLineTokens().size()) { case 4: // Type 0: GTA III, VC, 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(); m_uiUnknown2 = pDataReader->readTokenUint32(); break; case 8: // Type 1: GTA III, VC, SA setFormatType(1); 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(); m_uiClumpCount = pDataReader->readTokenUint32(); m_vecDrawDistances = { pDataReader->readTokenFloat32() }; m_uiFlags = pDataReader->readTokenUint32(); m_uiTimeOn = pDataReader->readTokenUint32(); m_uiTimeOff = pDataReader->readTokenUint32(); break; case 9: // Type 2: GTA III, VC, SA setFormatType(2); 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(); m_uiClumpCount = pDataReader->readTokenUint32(); m_vecDrawDistances = { pDataReader->readTokenFloat32(), pDataReader->readTokenFloat32() }; m_uiFlags = pDataReader->readTokenUint32(); m_uiTimeOn = pDataReader->readTokenUint32(); m_uiTimeOff = pDataReader->readTokenUint32(); break; case 10: // Type 3: GTA III, VC, SA setFormatType(3); 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(); m_uiClumpCount = pDataReader->readTokenUint32(); m_vecDrawDistances = { pDataReader->readTokenFloat32(), pDataReader->readTokenFloat32(), pDataReader->readTokenFloat32() }; m_uiFlags = pDataReader->readTokenUint32(); m_uiTimeOn = pDataReader->readTokenUint32(); m_uiTimeOff = pDataReader->readTokenUint32(); break; case 7: // Type 4: GTA SA setFormatType(4); setFormatGames(GAME_FLAG_GTA_SA); m_uiObjectId = pDataReader->readTokenUint32(); m_strModelName = pDataReader->readTokenString(); m_strTXDName = pDataReader->readTokenString(); m_vecDrawDistances = { pDataReader->readTokenFloat32() }; m_uiFlags = pDataReader->readTokenUint32(); m_uiTimeOn = pDataReader->readTokenUint32(); m_uiTimeOff = pDataReader->readTokenUint32(); break; case 17: // TOBJ - type 5: GTA IV [type 1 for GTA IV] setFormatType(5); setFormatGames(GAME_FLAG_GTA_IV); m_strModelName = pDataReader->readTokenString(); m_strTXDName = pDataReader->readTokenString(); m_vecDrawDistances.push_back(pDataReader->readTokenFloat32()); m_uiFlags = pDataReader->readTokenUint32(); m_uiUnknown2 = pDataReader->readTokenUint32(); m_vecBoundingBoxLowerLeftCorner = pDataReader->readVector3D(); m_vecBoundingBoxUpperRightCorner = pDataReader->readVector3D(); m_vecBoundingSphereCenterPosition = pDataReader->readVector3D(); m_fBoundingSphereRadius = pDataReader->readTokenFloat32(); m_strLODModel = pDataReader->readTokenString(); m_uiNightFlags = pDataReader->readTokenUint32(); break; default: { uint32 uiLineTokenCount = pDataReader->getLineTokenCount(); uint32 uiTokenIndex = 4; // starting at 1, so it can be compared directly with line token count setFormatType(6); setTokenCount(uiLineTokenCount); // first 4 tokens m_uiObjectId = pDataReader->readTokenUint32(); m_strModelName = pDataReader->readTokenString(); m_strTXDName = pDataReader->readTokenString(); m_uiClumpCount = pDataReader->readTokenUint32(); // draw distances if (uiLineTokenCount < (uiTokenIndex + m_uiClumpCount)) { throw EXCEPTION_UNKNOWN_FORMAT_TYPE; } m_vecDrawDistances.resize(m_uiClumpCount); for (uint32 i = 0; i < m_uiClumpCount; i++) { m_vecDrawDistances[i] = pDataReader->readTokenFloat32();; } uiTokenIndex += m_uiClumpCount; // flags if (uiLineTokenCount < (uiTokenIndex + 1)) { throw EXCEPTION_UNKNOWN_FORMAT_TYPE; } m_uiFlags = pDataReader->readTokenUint32(); uiTokenIndex++; if (uiLineTokenCount >= (uiTokenIndex + 1)) { // time on - optional m_uiTimeOn = pDataReader->readTokenUint32(); uiTokenIndex++; if (uiLineTokenCount >= (uiTokenIndex + 1)) { // time off - optional m_uiTimeOff = pDataReader->readTokenUint32(); uiTokenIndex++; } } break; } } }
void CIDEEntry_PEDS::unserialize(void) { CDataReader *pDataReader = CDataReader::getInstance(); uint32 uiLineTokenCount = pDataReader->getLineTokens().size(); bool bMatchFound = false; if (uiLineTokenCount == 7 || uiLineTokenCount == 11 || uiLineTokenCount == 15) { // GTA III, GTA VC, GTA SA bMatchFound = true; 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(); m_strDefaultPedType = pDataReader->readTokenString(); m_strBehaviour = pDataReader->readTokenString(); m_strAnimationGroup = pDataReader->readTokenString(); m_uiCarsCanDrive = pDataReader->readTokenUint32(); if (uiLineTokenCount == 11 || uiLineTokenCount == 15) { // GTA VC, GTA SA setFormatType(1); setFormatGames(GAME_FLAG_GTA_VC | GAME_FLAG_GTA_SA); m_strAnimationFile = pDataReader->readTokenString(); m_vecPreferredRadioStations.m_x = pDataReader->readTokenUint32(); m_vecPreferredRadioStations.m_y = pDataReader->readTokenUint32(); if (uiLineTokenCount == 15) { // GTA SA setFormatType(2); setFormatGames(GAME_FLAG_GTA_SA); m_strVoiceArchive = pDataReader->readTokenString(); m_strVoices[0] = pDataReader->readTokenString(); m_strVoices[1] = pDataReader->readTokenString(); } } } if (uiLineTokenCount == 16) { // GTA IV bMatchFound = true; setFormatType(3); setFormatGames(GAME_FLAG_GTA_IV); m_strModelName = pDataReader->readTokenString(); m_strProps = pDataReader->readTokenString(); m_strDefaultPedType = pDataReader->readTokenString(); m_strAnimationGroup = pDataReader->readTokenString(); m_strGestureGroup = pDataReader->readTokenString(); m_strGesturePhoneGroup = pDataReader->readTokenString(); m_strFacialGroup = pDataReader->readTokenString(); m_strVisemeGroup = pDataReader->readTokenString(); m_strFlags = pDataReader->readTokenString(); m_strAnimationFile = pDataReader->readTokenString(); m_strBlendShapeFile = pDataReader->readTokenString(); m_vecPreferredRadioStations.m_x = pDataReader->readTokenUint32(); m_vecPreferredRadioStations.m_y = pDataReader->readTokenUint32(); m_strAudioType = pDataReader->readTokenString(); m_strFirstVoice = pDataReader->readTokenString(); m_strLastVoice = pDataReader->readTokenString(); } if (!bMatchFound) { throw EXCEPTION_UNKNOWN_FORMAT_TYPE; } }