SHARE
TWEET

The code that reads the lod data....

a guest Dec 10th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool rmv2_file::readLodData(string strFileName)
  2. {
  3.    
  4.  
  5.  
  6.     for (int lod = 0; lod < m_File.FileHeader.LodsCount; lod++)
  7.     {
  8.        
  9.         for (int group = 0; group < m_File.PPLodHeaders[lod].GroupsCount; group++)
  10.         {
  11.             //uint32 uiMaterialId;      // 4 Bytes[UInt32] - ? // Looks like and ID or a flag, it's always 65 for the moment.
  12.             m_File.LodData[lod][group] = new _RMV2_Lod_Data;
  13.  
  14.             readBuffer(&m_File.LodData[lod][group]->Header, sizeof(_RMV2_Lod_Data_Header));
  15.  
  16.            
  17.             //**** read supplementary bones
  18.             for (int i = 0; i < m_File.LodData[lod][group]->Header.uiSupplementarBonesCount; i++)
  19.             {
  20.                 m_File.LodData[lod][group]->PSupplementaryBone_Data[i] = new _RMV2_SupplementaryBone_Data;
  21.                 readBuffer(m_File.LodData[lod][group]->PSupplementaryBone_Data[i], sizeof(_RMV2_SupplementaryBone_Data));
  22.             }
  23.  
  24.             // *****  read textures info
  25.             for (int i = 0; i < m_File.LodData[lod][group]->Header.uiTextureCount; i++)
  26.             {
  27.                 m_File.LodData[lod][group]->PTextureData[i] = new _RMV2_Texture_Data;
  28.                 readBuffer(m_File.LodData[lod][group]->PTextureData[i], sizeof(_RMV2_Texture_Data));
  29.             }
  30.            
  31.             //  jump over that "padding"           
  32.             seekBuffer(4, seek_direction::seek_forward);
  33.             if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::tiled_dirtmap)
  34.                 seekBuffer(16, seek_direction::seek_forward);  // file.seekg(16, ios_base::cur);
  35.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::decal
  36.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_decal
  37.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_skin_decal)
  38.                 seekBuffer(20, seek_direction::seek_forward); // file.seekg(20, ios_base::cur);
  39.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::dirtmap
  40.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_dirtmap
  41.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_skin_dirtmap)
  42.                 seekBuffer(32, seek_direction::seek_forward); // file.seekg(32, ios_base::cur);
  43.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::decal_dirtmap
  44.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_decal_dirtmap
  45.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_skin_decal_dirtmap)
  46.                 seekBuffer(52, seek_direction::seek_forward); // file.seekg(52, ios_base::cur);
  47.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::tree)
  48.                 seekBuffer(56, seek_direction::seek_forward); // file.seekg(56, ios_base::cur);
  49.             seekBuffer(4, seek_direction::seek_forward); // "alpha mode"
  50.            
  51.             //jump over vertices
  52.             //seekBuffer(vertex_size * m_File.LodData[lod][group]->Header.uiVerticesCount, seek_direction::seek_forward );
  53.             dword vertex_size = 0;
  54.             dword indice_size = 6;
  55.  
  56.             switch (m_File.LodData[lod][group]->Header.wVertexFormat)
  57.             {
  58.                 case vertex_format::default_format: vertex_size = 32;
  59.                     break;
  60.                 case vertex_format::weighted_format: vertex_size = 28;
  61.                     break;
  62.                 case vertex_format::cinematic_format: vertex_size = 32;
  63.            
  64.             }
  65.                
  66.             for (size_t k = 0; k < m_File.LodData[lod][group]->Header.uiIndicesCount/3; ++k)
  67.                 seekBuffer(6,  seek_direction::seek_forward);
  68.                
  69.             //for (size_t k = 0; k < m_File.LodData[lod][group]->Header.uiVerticesCount; ++k)
  70.             seekBuffer(vertex_size * m_File.LodData[lod][group]->Header.uiVerticesCount, seek_direction::seek_forward);
  71.             /*         
  72.             DWORD dwSeek = 0;
  73.             switch (m_File.LodData[lod][group]->Header.uiMaterialId)
  74.             {
  75.                 case 72:
  76.                     dwSeek = 60;
  77.                 break;
  78.  
  79.                 default:
  80.                     dwSeek = 8;
  81.             }
  82.  
  83.             seekBuffer(dwSeek, seek_direction::seek_forward);
  84.  
  85.             if (m_File.LodData[lod][group]->Header.wVertexFormat == 3)
  86.                 seekBuffer(32, seek_direction::seek_forward);*/
  87.  
  88.                
  89.         }
  90.     }
  91.     //26044
  92.    
  93.     return true;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top