mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
fixed issue with missing objects
This commit is contained in:
parent
c35795a9f3
commit
7b127e20df
2 changed files with 33 additions and 22 deletions
|
@ -169,7 +169,7 @@ struct LGB_GROUP
|
||||||
parent = parentStruct;
|
parent = parentStruct;
|
||||||
header = *reinterpret_cast<LGB_GROUP_HEADER*>(buf + offset);
|
header = *reinterpret_cast<LGB_GROUP_HEADER*>(buf + offset);
|
||||||
name = std::string( buf + offset + header.groupNameOffset );
|
name = std::string( buf + offset + header.groupNameOffset );
|
||||||
entries.resize( header.entryCount );
|
//entries.resize( header.entryCount );
|
||||||
//std::cout << name << std::endl;
|
//std::cout << name << std::endl;
|
||||||
auto entriesOffset = offset + header.entriesOffset;
|
auto entriesOffset = offset + header.entriesOffset;
|
||||||
for( auto i = 0; i < header.entryCount; ++i )
|
for( auto i = 0; i < header.entryCount; ++i )
|
||||||
|
@ -179,19 +179,20 @@ struct LGB_GROUP
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto type = *reinterpret_cast<LgbEntryType*>(buf + entryOffset);
|
auto type = *reinterpret_cast<LgbEntryType*>(buf + entryOffset);
|
||||||
LGB_MODEL_ENTRY* entry;
|
|
||||||
if( type == LgbEntryType::BgParts )
|
if( type == LgbEntryType::BgParts )
|
||||||
{
|
{
|
||||||
entries[i] = std::make_shared<LGB_BGPARTS_ENTRY>( buf, entryOffset );
|
entries.push_back(std::make_shared<LGB_BGPARTS_ENTRY>( buf, entryOffset ));
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
else if( type == LgbEntryType::Gimmick )
|
else if( type == LgbEntryType::Gimmick )
|
||||||
{
|
{
|
||||||
entries[i] = std::make_shared<LGB_GIMMICK_ENTRY>( buf, entryOffset );
|
//entries[i] = std::make_shared<LGB_GIMMICK_ENTRY>( buf, entryOffset );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entries[i] = nullptr;
|
//entries[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -303,7 +303,7 @@ int main( int argc, char* argv[] )
|
||||||
index.index[1] + max_index + 1,
|
index.index[1] + max_index + 1,
|
||||||
index.index[2] + max_index + 1 );
|
index.index[2] + max_index + 1 );
|
||||||
}
|
}
|
||||||
//std::cout << std::to_string( index.unknown[0] )<< " " << std::to_string( index.unknown[1] )<< " " << std::to_string( index.unknown[2]) << std::endl;
|
// std::cout << std::to_string( index.unknown[0] )<< " " << std::to_string( index.unknown[1] )<< " " << std::to_string( index.unknown[2]) << std::endl;
|
||||||
}
|
}
|
||||||
max_index += entry.data.vertices.size() + entry.data.vertices_i16.size();
|
max_index += entry.data.vertices.size() + entry.data.vertices_i16.size();
|
||||||
}
|
}
|
||||||
|
@ -315,34 +315,42 @@ int main( int argc, char* argv[] )
|
||||||
pushVerts( pcbFiles[fileName], fileName );
|
pushVerts( pcbFiles[fileName], fileName );
|
||||||
}
|
}
|
||||||
std::cout << "Writing obj file " << "\n";
|
std::cout << "Writing obj file " << "\n";
|
||||||
std::cout << bgLgb.groups.size() << " entries " << "\n";
|
std::cout << bgLgb.groups.size() << " groups " << "\n";
|
||||||
|
uint32_t totalGroups = 0;
|
||||||
|
uint32_t totalGroupEntries = 0;
|
||||||
for( const auto& group : bgLgb.groups )
|
for( const auto& group : bgLgb.groups )
|
||||||
{
|
{
|
||||||
|
//std::cout << "\t" << group.name << " Size " << group.header.entryCount << "\n";
|
||||||
|
totalGroups++;
|
||||||
for( const auto pEntry : group.entries )
|
for( const auto pEntry : group.entries )
|
||||||
{
|
{
|
||||||
if( !pEntry )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
auto pBgParts = dynamic_cast<LGB_BGPARTS_ENTRY*>(pEntry.get());
|
auto pBgParts = dynamic_cast<LGB_BGPARTS_ENTRY*>(pEntry.get());
|
||||||
if( pBgParts && pBgParts->collisionFileName.empty() )
|
|
||||||
|
auto& fileName = pBgParts->collisionFileName;
|
||||||
|
if( pBgParts )
|
||||||
{
|
{
|
||||||
pBgParts->collisionFileName = pBgParts->modelFileName;
|
if ( fileName.empty() )
|
||||||
boost::replace_all( pBgParts->collisionFileName, "bgparts", "collision" );
|
fileName = pBgParts->modelFileName;
|
||||||
boost::replace_all( pBgParts->collisionFileName, ".mdl", ".pcb" );
|
boost::replace_all( fileName, "bgparts", "collision" );
|
||||||
//std::cout << pBgParts->collisionFileName << " renamed\n";
|
boost::replace_all( fileName, ".mdl", ".pcb" );
|
||||||
}
|
}
|
||||||
if( !pBgParts || pBgParts->collisionFileName.empty() )
|
|
||||||
//|| std::find( stringList.begin(), stringList.end(), pBgParts->collisionFileName ) != stringList.end() )
|
if( !pBgParts || fileName.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto it = pcbFiles.find( pBgParts->collisionFileName );
|
{
|
||||||
|
const auto& it = pcbFiles.find( fileName );
|
||||||
if( it == pcbFiles.end() )
|
if( it == pcbFiles.end() )
|
||||||
{
|
{
|
||||||
loadPcbFile( pBgParts->collisionFileName );
|
loadPcbFile( fileName );
|
||||||
//std::cout << "\t\tLoaded PCB File " << pBgParts->collisionFileName << "\n";
|
//std::cout << "\t\tLoaded PCB File " << pBgParts->collisionFileName << "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
const auto& it = pcbFiles.find( fileName );
|
||||||
if( it != pcbFiles.end() )
|
if( it != pcbFiles.end() )
|
||||||
{
|
{
|
||||||
|
totalGroupEntries++;
|
||||||
|
|
||||||
//std::cout << pBgParts->collisionFileName << "\n";
|
//std::cout << pBgParts->collisionFileName << "\n";
|
||||||
|
|
||||||
const auto* scale = &pBgParts->header.scale;
|
const auto* scale = &pBgParts->header.scale;
|
||||||
|
@ -350,10 +358,12 @@ int main( int argc, char* argv[] )
|
||||||
const auto* translation = &pBgParts->header.translation;
|
const auto* translation = &pBgParts->header.translation;
|
||||||
|
|
||||||
const auto& pcb_file = it->second;
|
const auto& pcb_file = it->second;
|
||||||
pushVerts( pcb_file, pBgParts->collisionFileName, scale, rotation, translation );
|
pushVerts( pcb_file, fileName, scale, rotation, translation );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << "\n\nLoaded " << pcbFiles.size() << " PCB Files \n";
|
||||||
|
std::cout << "Total Groups " << totalGroups << " Total entries " << totalGroupEntries << "\n";
|
||||||
}
|
}
|
||||||
std::cout << "Finished exporting " << zoneName << " in " <<
|
std::cout << "Finished exporting " << zoneName << " in " <<
|
||||||
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now() - startTime).count() << " seconds\n";
|
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now() - startTime).count() << " seconds\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue