Subversion Repositories spk

Rev

Rev 14 | Rev 35 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 31
Line 1367... Line 1367...
1367
	if ( !m_sDescription.Empty() )
1367
	if ( !m_sDescription.Empty() )
1368
		return m_sDescription;
1368
		return m_sDescription;
1369
	return this->GetShipName(lang);
1369
	return this->GetShipName(lang);
1370
}
1370
}
1371
 
1371
 
1372
bool CXspFile::StartExtractShip(CCatFile *catFile, CyString id, CProgressInfo *progress)
1372
bool CXspFile::StartExtractShip(CCatFile *catFile, CCatFile *secondCatFile, CyString id, CProgressInfo *progress)
1373
{
1373
{
1374
	id.RemoveChar('\r');
1374
	id.RemoveChar('\r');
1375
	while ( id.Right(1) == ";" )
1375
	while ( id.Right(1) == ";" )
1376
		id.Truncate((int)id.Length() - 1);
1376
		id.Truncate((int)id.Length() - 1);
1377
	m_sID = id.ToString();
1377
	m_sID = id.ToString();
1378
	m_sData = catFile->GetTShipsEntry(id).ToString();
1378
	m_sData = catFile->GetTShipsEntry(id).ToString();
1379
 
1379
 
1380
	// get scene files
1380
	// get scene files
1381
	if ( progress ) progress->UpdateStatus(IMPORTSHIP_SCENE);
1381
	if ( progress ) progress->UpdateStatus(IMPORTSHIP_SCENE);
1382
	if ( !this->ExtractSceneFiles(catFile) )
1382
	if ( !this->ExtractSceneFiles(catFile, secondCatFile) )
1383
		return false;
1383
		return false;
1384
 
1384
 
1385
	return true;
1385
	return true;
1386
}
1386
}
1387
 
1387
 
1388
bool CXspFile::StartExtractShip(CyString catFile, CyString id, CProgressInfo *progress)
1388
bool CXspFile::StartExtractShip(CyString catFile, CyString secondCatFile, CyString id, CProgressInfo *progress)
1389
{
1389
{
1390
	CCatFile cat;
1390
	CCatFile cat;
1391
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) != CATERR_NONE )
1391
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) != CATERR_NONE ) {
-
 
1392
		if ( !secondCatFile.Empty() ) { 
-
 
1393
			CCatFile secondCat;
-
 
1394
			if ( secondCat.Open(secondCatFile, "", CATREAD_CATDECRYPT, false) != CATERR_NONE ) {
-
 
1395
				return this->StartExtractShip(&cat, &secondCat, id, progress);
-
 
1396
			}
1392
		return this->StartExtractShip(&cat, id, progress);
1397
			return this->StartExtractShip(&cat, NULL, id, progress);
-
 
1398
		}
-
 
1399
	}
1393
 
1400
 
1394
	return false;
1401
	return false;
1395
}
1402
}
1396
 
1403
 
1397
bool CXspFile::ExtractShip(CCatFile *catFile, CyString id, CProgressInfo *progress)
1404
bool CXspFile::ExtractShip(CCatFile *catFile, CyString id, CProgressInfo *progress)
1398
{
1405
{
1399
	if ( !this->StartExtractShip(catFile, id, progress) )
1406
	if ( !this->StartExtractShip(catFile, NULL, id, progress) )
1400
		return false;
1407
		return false;
1401
 
1408
 
1402
	// read the scene file and get the files list
1409
	// read the scene file and get the files list
1403
	if ( !this->ProcessSceneFiles(catFile, progress) )
1410
	if ( !this->ProcessSceneFiles(catFile, NULL, progress) )
1404
		return false;
1411
		return false;
1405
 
1412
 
1406
	// pack all the ship files
1413
	// pack all the ship files
1407
	this->PackAllFiles();
1414
	this->PackAllFiles();
1408
 
1415
 
Line 1412... Line 1419...
1412
bool CXspFile::ExtractShip(CyString catFile, CyString id, CProgressInfo *progress)
1419
bool CXspFile::ExtractShip(CyString catFile, CyString id, CProgressInfo *progress)
1413
{
1420
{
1414
	CCatFile cat;
1421
	CCatFile cat;
1415
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
1422
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
1416
		return ExtractShip(&cat, id, progress);
1423
		return ExtractShip(&cat, id, progress);
1417
 
1424
 
1418
	return false;
1425
	return false;
1419
}
1426
}
1420
 
1427
 
1421
C_File *CXspFile::ExtractFileToPackage(CCatFile *catFile, CyString file, int type, CyString addAs)
1428
C_File *CXspFile::ExtractFileToPackage(CCatFile *catFile, CyString file, int type, CyString addAs)
1422
{
1429
{
Line 1435... Line 1442...
1435
		}
1442
		}
1436
 
1443
 
1437
		File.Remove();
1444
		File.Remove();
1438
	}
1445
	}
1439
	return NULL;
1446
	return NULL;
1440
}
1447
}
1441
 
1448
 
1442
bool CXspFile::ExtractSceneFiles(CCatFile *catFile)
1449
bool CXspFile::ExtractSceneFiles(CCatFile *catFile, CCatFile *secondCat)
1443
{
1450
{
1444
	m_pSceneFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 17) + ".pbd", FILETYPE_SHIPSCENE, CyString("objects\\") + m_sData.token(";", 17) + ".bod");
1451
	m_pSceneFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 17) + ".pbd", FILETYPE_SHIPSCENE, CyString("objects\\") + m_sData.token(";", 17) + ".bod");
1445
	if ( !m_pSceneFile )
-
 
1446
	{
-
 
1447
		m_pSceneFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 17) + ".bod", FILETYPE_SHIPSCENE);
1452
	if ( !m_pSceneFile ) m_pSceneFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 17) + ".bod", FILETYPE_SHIPSCENE);
-
 
1453
	if ( !m_pSceneFile && secondCat ) m_pSceneFile = this->ExtractFileToPackage(secondCat, CyString("objects\\") + m_sData.token(";", 17) + ".pbd", FILETYPE_SHIPSCENE, CyString("objects\\") + m_sData.token(";", 17) + ".bod");
-
 
1454
	if ( !m_pSceneFile && secondCat) m_pSceneFile = this->ExtractFileToPackage(secondCat, CyString("objects\\") + m_sData.token(";", 17) + ".bod", FILETYPE_SHIPSCENE);
-
 
1455
 
1448
		if ( !m_pSceneFile )
1456
	if ( !m_pSceneFile ) {
1449
			return false;
1457
		return false;
1450
	}
1458
	}
1451
 
1459
 
1452
	m_pCockpitFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 18) + ".pbd", FILETYPE_COCKPITSCENE, CyString("objects\\") + m_sData.token(";", 18) + ".bod");
1460
	m_pCockpitFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 18) + ".pbd", FILETYPE_COCKPITSCENE, CyString("objects\\") + m_sData.token(";", 18) + ".bod");
1453
	if ( !m_pCockpitFile )
1461
	if ( !m_pCockpitFile ) m_pCockpitFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 18) + ".bod", FILETYPE_COCKPITSCENE);
-
 
1462
	if ( !m_pCockpitFile && secondCat ) m_pCockpitFile = this->ExtractFileToPackage(secondCat, CyString("objects\\") + m_sData.token(";", 18) + ".pbd", FILETYPE_COCKPITSCENE, CyString("objects\\") + m_sData.token(";", 18) + ".bod");
1454
		m_pCockpitFile = this->ExtractFileToPackage(catFile, CyString("objects\\") + m_sData.token(";", 18) + ".bod", FILETYPE_COCKPITSCENE);
1463
	if ( !m_pCockpitFile && secondCat ) m_pCockpitFile = this->ExtractFileToPackage(secondCat, CyString("objects\\") + m_sData.token(";", 18) + ".bod", FILETYPE_COCKPITSCENE);
1455
	return true;
1464
	return true;
1456
}
1465
}
1457
 
1466
 
1458
bool CXspFile::ExtractSceneFiles(CyString catFile)
1467
bool CXspFile::ExtractSceneFiles(CyString catFile, CyString secondCatFile)
1459
{
1468
{
1460
	CCatFile cat;
1469
	CCatFile cat;
1461
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
1470
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE ) {
-
 
1471
		CCatFile secondCat;
-
 
1472
		if ( !secondCatFile.Empty() ) {
-
 
1473
			if ( cat.Open(secondCatFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE ) {
-
 
1474
				return ExtractSceneFiles(&cat, &secondCat);
-
 
1475
			}
-
 
1476
		}
1462
		return ExtractSceneFiles(&cat);
1477
		return ExtractSceneFiles(&cat, NULL);
1463
 
1478
	}
1464
	return false;
1479
	return false;
1465
}
1480
}
1466
 
1481
 
1467
CyStringList *CXspFile::ReadSceneModels()
1482
CyStringList *CXspFile::ReadSceneModels()
1468
{
1483
{
Line 1488... Line 1503...
1488
 
1503
 
1489
	if ( data && datasize )
1504
	if ( data && datasize )
1490
	{
1505
	{
1491
		if ( m_pSceneFile->CheckPackedExtension() )
1506
		if ( m_pSceneFile->CheckPackedExtension() )
1492
			data = UnPCKData(data, datasize, &datasize);
1507
			data = UnPCKData(data, datasize, &datasize);
1493
	}
1508
	}
1494
 
1509
 
1495
	if ( !data || !datasize )
1510
	if ( !data || !datasize )
1496
		return NULL;
1511
		return NULL;
1497
 
1512
 
1498
	CyStringList *lModels = new CyStringList;
1513
	CyStringList *lModels = new CyStringList;
Line 1512... Line 1527...
1512
				newline = true;
1527
				newline = true;
1513
			continue;
1528
			continue;
1514
		}
1529
		}
1515
 
1530
 
1516
		if ( newline )
1531
		if ( newline )
1517
		{
1532
		{
1518
			if ( c == ' ' || c == 9 || c == '\n' || c == '\r' )
1533
			if ( c == ' ' || c == 9 || c == '\n' || c == '\r' )
1519
				continue;
1534
				continue;
1520
 
1535
 
1521
			newline = false;
1536
			newline = false;
1522
 
1537
 
Line 1550... Line 1565...
1550
		delete data;
1565
		delete data;
1551
 
1566
 
1552
	return lModels;
1567
	return lModels;
1553
}
1568
}
1554
 
1569
 
1555
void CXspFile::ExtractDummies(CCatFile *catFile, CyStringList *sceneModels, bool add)
1570
void CXspFile::ExtractDummies(CCatFile *catFile, CCatFile *secondCat, CyStringList *sceneModels, bool add)
1556
{
1571
{
1557
	if ( !sceneModels ) return;
1572
	if ( !sceneModels ) return;
-
 
1573
 
-
 
1574
	bool extracted = false;
1558
	if ( catFile->ExtractFile("types/dummies.pck", "tmp") )
1575
	if ( catFile->ExtractFile("types/dummies.pck", "tmp") ) extracted = true;
-
 
1576
	else if ( secondCat && secondCat->ExtractFile("types/dummies.pck", "tmp") ) extracted = true;
1559
	{
1577
 
-
 
1578
	if ( extracted ) {
1560
		CFileIO File("tmp");
1579
		CFileIO File("tmp");
1561
		if ( File.Exists() )
1580
		if ( File.Exists() )
1562
		{
1581
		{
1563
			CyString section;
1582
			CyString section;
1564
			int secCount = 0;
1583
			int secCount = 0;
Line 1714... Line 1733...
1714
	delete [] data;
1733
	delete [] data;
1715
 
1734
 
1716
	return true;
1735
	return true;
1717
}
1736
}
1718
 
1737
 
1719
void CXspFile::ExtractTextures(CCatFile *catFile)
1738
void CXspFile::ExtractTextures(CCatFile *catFile, CCatFile *secondCatFile)
1720
{
1739
{
1721
	CyStringList lTextures;
1740
	CyStringList lTextures;
1722
 
1741
 
1723
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
1742
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
1724
	{
1743
	{
Line 1753... Line 1772...
1753
		this->GetTextureList(&lTextures, data, size);
1772
		this->GetTextureList(&lTextures, data, size);
1754
	}
1773
	}
1755
 
1774
 
1756
	for ( SStringList *node = lTextures.Head(); node; node = node->next )
1775
	for ( SStringList *node = lTextures.Head(); node; node = node->next )
1757
	{
1776
	{
1758
		if ( CFileIO(node->str).CheckFileExtension("dds") )
1777
		if ( CFileIO(node->str).CheckFileExtension("dds") ) {
1759
			this->ExtractFileToPackage(catFile, CyString(";dds\\";) + node->str, FILETYPE_SHIPOTHER);
1778
			if ( !this->ExtractFileToPackage(catFile, CyString(";dds\\";) + node->str, FILETYPE_SHIPOTHER) ) {
-
 
1779
				if ( secondCatFile ) this->ExtractFileToPackage(secondCatFile, CyString("dds\\") + node->str, FILETYPE_SHIPOTHER);
-
 
1780
			}
-
 
1781
		}
1760
		else
1782
		else {
1761
			this->ExtractFileToPackage(catFile, CyString(";textures\\";) + node->str, FILETYPE_SHIPOTHER);
1783
			if ( !this->ExtractFileToPackage(catFile, CyString(";textures\\";) + node->str, FILETYPE_SHIPOTHER) ) {
-
 
1784
				if ( secondCatFile ) this->ExtractFileToPackage(secondCatFile, CyString("textures\\") + node->str, FILETYPE_SHIPOTHER);
-
 
1785
			}
-
 
1786
		}
1762
	}
1787
	}
1763
}
1788
}
1764
 
1789
 
1765
bool CXspFile::AddTextFromFile(CyString file, int textId)
1790
bool CXspFile::AddTextFromFile(CyString file, int textId)
1766
{
1791
{
Line 1856... Line 1881...
1856
			if ( node->str.Empty() )
1881
			if ( node->str.Empty() )
1857
				node->remove = true;
1882
				node->remove = true;
1858
			else if ( node->str[0] == '/' )
1883
			else if ( node->str[0] == '/' )
1859
				node->remove = true;
1884
				node->remove = true;
1860
			else if ( !entries )
1885
			else if ( !entries )
1861
			{
1886
			{
1862
				entries = node->str.GetToken(";", 2, 2).ToInt();
1887
				entries = node->str.GetToken(";", 2, 2).ToInt();
1863
				node->remove = true;
1888
				node->remove = true;
1864
			}
1889
			}
1865
		}
1890
		}
1866
		lines->RemoveMarked();
1891
		lines->RemoveMarked();
1867
 
1892
 
1868
		// now get all the entries from TShips
1893
		// now get all the entries from TShips
1869
		for ( int i = 0; i < 6; i++ )
1894
		for ( int i = 0; i < 6; i++ )
1870
		{
1895
		{
1871
			int idx = m_sData.token(";", 32 + (i * 2));
1896
			int idx = m_sData.token(";", 32 + (i * 2));
1872
			if ( idx < lines->Count() && idx )
1897
			if ( idx < lines->Count() && idx )
Line 1881... Line 1906...
1881
			}
1906
			}
1882
		}
1907
		}
1883
 
1908
 
1884
		delete lines;
1909
		delete lines;
1885
		return true;
1910
		return true;
1886
	}
1911
	}
1887
	return false;
1912
	return false;
1888
}
1913
}
1889
 
1914
 
1890
bool CXspFile::ExtractCockpits(CCatFile *catFile)
1915
bool CXspFile::ExtractCockpits(CCatFile *catFile, CCatFile *secondCatFile)
1891
{
1916
{
1892
	if ( catFile->ExtractFile("types/TCockpits.pck", "tmp") )
1917
	bool extracted = catFile->ExtractFile("types/TCockpits.pck", "tmp");
-
 
1918
	if ( !extracted && secondCatFile ) extracted = secondCatFile->ExtractFile("types/TCockpits.pck", "tmp");
1893
	{
1919
 
-
 
1920
	if ( extracted ) {
1894
		bool ret = this->ImportCockpits("tmp");
1921
		bool ret = this->ImportCockpits("tmp");
1895
		CFileIO("tmp").Remove();
1922
		CFileIO("tmp").Remove();
1896
 
1923
 
1897
		return ret;
1924
		return ret;
1898
	}
1925
	}
1899
 
1926
 
1900
	return false;
1927
	return false;
1901
}
1928
}
1902
 
1929
 
1903
bool CXspFile::ExtractBodies(CCatFile *catFile, CyStringList *sceneModels)
1930
bool CXspFile::ExtractBodies(CCatFile *catFile, CCatFile *secondCatFile, CyStringList *sceneModels)
1904
{
1931
{
1905
	if ( !sceneModels ) return false;
1932
	if ( !sceneModels ) return false;
-
 
1933
 
1906
	if ( catFile->ExtractFile("types/Bodies.pck", "tmp") )
1934
	bool extracted = catFile->ExtractFile("types/Bodies.pck", "tmp");
-
 
1935
	if ( !extracted && secondCatFile ) extracted = secondCatFile->ExtractFile("types/Bodies.pck", "tmp");
1907
	{
1936
 
-
 
1937
	if ( extracted ) {
1908
		bool ret = this->ImportBodies(sceneModels, "tmp");
1938
		bool ret = this->ImportBodies(sceneModels, "tmp");
1909
		CFileIO("tmp").Remove();
1939
		CFileIO("tmp").Remove();
1910
 
1940
 
1911
		return ret;
1941
		return ret;
1912
	}
1942
	}
Line 2027... Line 2057...
2027
	}
2057
	}
2028
 
2058
 
2029
	return false;
2059
	return false;
2030
}
2060
}
2031
 
2061
 
2032
void CXspFile::ExtractTexts(CCatFile *catFile, int textId)
2062
void CXspFile::ExtractTexts(CCatFile *catFile, CCatFile *secondCatFile, int textId)
2033
{
2063
{
2034
	for ( CListNode<SInCatFile> *node = catFile->GetFiles()->Front(); node; node = node->next() )
2064
	for ( CListNode<SInCatFile> *node = catFile->GetFiles()->Front(); node; node = node->next() )
2035
	{
2065
	{
2036
		SInCatFile *f = node->Data();
2066
		SInCatFile *f = node->Data();
2037
		if ( !f->sFile.Left(2).Compare("t\\") && !f->sFile.Left(2).Compare("t/") )
2067
		if ( !f->sFile.Left(2).Compare("t\\") && !f->sFile.Left(2).Compare("t/") )
2038
			continue;
2068
			continue;
2039
 
2069
 
2040
		// extract the text file and read in the data
2070
		// extract the text file and read in the data
2041
		if ( catFile->ExtractFile(f->sFile, "tmp") )
2071
		bool extracted = catFile->ExtractFile(f->sFile, "tmp");
-
 
2072
		if ( !extracted && secondCatFile ) extracted = secondCatFile->ExtractFile(f->sFile, "tmp");
2042
		{
2073
		if ( extracted ) {
2043
			this->AddTextFromFile("tmp", textId);
2074
			this->AddTextFromFile("tmp", textId);
2044
			CFileIO("tmp").Remove();
2075
			CFileIO("tmp").Remove();
2045
		}
2076
		}
2046
	}
2077
	}
2047
}
2078
}
2048
 
2079
 
2049
bool CXspFile::ProcessSceneFileSection(int section, CCatFile *catFile, CyStringList *lModels, CProgressInfo *progress)
2080
bool CXspFile::ProcessSceneFileSection(int section, CCatFile *catFile, CCatFile *secondCatFile, CyStringList *lModels, CProgressInfo *progress)
2050
{
2081
{
2051
	if ( progress ) progress->UpdateStatus(section);
2082
	if ( progress ) progress->UpdateStatus(section);
2052
 
2083
 
2053
	switch ( section )
2084
	switch ( section )
2054
	{
2085
	{
Line 2067... Line 2098...
2067
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".pbb", FILETYPE_SHIPMODEL, CyString("objects\\") + node->str + ".bob") )
2098
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".pbb", FILETYPE_SHIPMODEL, CyString("objects\\") + node->str + ".bob") )
2068
						continue;
2099
						continue;
2069
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".pbd", FILETYPE_SHIPMODEL, CyString("objects\\") + node->str + ".bod") )
2100
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".pbd", FILETYPE_SHIPMODEL, CyString("objects\\") + node->str + ".bod") )
2070
						continue;
2101
						continue;
2071
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".bob", FILETYPE_SHIPMODEL) )
2102
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".bob", FILETYPE_SHIPMODEL) )
2072
						continue;
2103
						continue;
2073
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".bod", FILETYPE_SHIPMODEL) )
2104
					if ( this->ExtractFileToPackage(catFile, CyString("objects\\") + node->str + ".bod", FILETYPE_SHIPMODEL) )
2074
						continue;
2105
						continue;
-
 
2106
					if ( secondCatFile ) {
-
 
2107
						if ( this->ExtractFileToPackage(secondCatFile, CyString("objects\\") + node->str + ".pbb", FILETYPE_SHIPMODEL, CyString("objects\\") + node->str + ".bob") )
-
 
2108
							continue;
-
 
2109
						if ( this->ExtractFileToPackage(secondCatFile, CyString("objects\\") + node->str + ".pbd", FILETYPE_SHIPMODEL, CyString("objects\\") + node->str + ".bod") )
-
 
2110
							continue;
-
 
2111
						if ( this->ExtractFileToPackage(secondCatFile, CyString("objects\\") + node->str + ".bob", FILETYPE_SHIPMODEL) )
-
 
2112
							continue;
-
 
2113
						if ( this->ExtractFileToPackage(secondCatFile, CyString("objects\\") + node->str + ".bod", FILETYPE_SHIPMODEL) )
-
 
2114
							continue;
-
 
2115
					}
2075
				}
2116
				}
2076
			}
2117
			}
2077
			break;
2118
			break;
2078
 
2119
 
2079
		case IMPORTSHIP_DUMMIES:
2120
		case IMPORTSHIP_DUMMIES:
2080
			if ( !lModels ) return false;
2121
			if ( !lModels ) return false;
2081
			this->ExtractDummies(catFile, lModels, true);
2122
			this->ExtractDummies(catFile, secondCatFile, lModels, true);
2082
			break;
2123
			break;
2083
 
2124
 
2084
		// extract the textures
2125
		// extract the textures
2085
		case IMPORTSHIP_TEXTURES:
2126
		case IMPORTSHIP_TEXTURES:
2086
			this->ExtractTextures(catFile);
2127
			this->ExtractTextures(catFile, secondCatFile);
2087
			break;
2128
			break;
2088
 
2129
 
2089
		case IMPORTSHIP_TEXTS:
2130
		case IMPORTSHIP_TEXTS:
2090
			// extract the text file entries
2131
			// extract the text file entries
2091
			this->ExtractTexts(catFile, m_sData.token(";", 7));
2132
			this->ExtractTexts(catFile, secondCatFile, m_sData.token(";", 7));
2092
			break;
2133
			break;
2093
 
2134
 
2094
		case IMPORTSHIP_BODIES:
2135
		case IMPORTSHIP_BODIES:
2095
			// extract the bodies entries
2136
			// extract the bodies entries
2096
			if ( !lModels ) return false;
2137
			if ( !lModels ) return false;
2097
			this->ExtractBodies(catFile, lModels);
2138
			this->ExtractBodies(catFile, secondCatFile, lModels);
2098
			break;
2139
			break;
2099
 
2140
 
2100
		case IMPORTSHIP_COCKPITS:
2141
		case IMPORTSHIP_COCKPITS:
2101
			// extract the cockpit entries
2142
			// extract the cockpit entries
2102
			this->ExtractCockpits(catFile);
2143
			this->ExtractCockpits(catFile, secondCatFile);
2103
			break;
2144
			break;
2104
	}
2145
	}
2105
 
2146
 
2106
	return true;
2147
	return true;
2107
}
2148
}
2108
 
2149
 
2109
bool CXspFile::ProcessSceneFiles(CCatFile *catFile, CProgressInfo *progress)
2150
bool CXspFile::ProcessSceneFiles(CCatFile *catFile, CCatFile *secondCatFile, CProgressInfo *progress)
2110
{
2151
{
2111
	// now lets parse our files
2152
	// now lets parse our files
2112
	if ( progress ) progress->UpdateStatus(IMPORTSHIP_EXTRACTSCENE);
2153
	if ( progress ) progress->UpdateStatus(IMPORTSHIP_EXTRACTSCENE);
2113
	CyStringList *lModels = this->ReadSceneModels();
2154
	CyStringList *lModels = this->ReadSceneModels();
2114
	if ( !lModels )
2155
	if ( !lModels )
2115
		return false;
2156
		return false;
2116
 
2157
 
2117
	// extract componants, and add extra items to list
2158
	// extract componants, and add extra items to list
2118
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_COMPONANT, catFile, lModels, progress) )
2159
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_COMPONANT, catFile, secondCatFile, lModels, progress) )
2119
		return false;
2160
		return false;
2120
 
2161
 
2121
	//lets first find any model files
2162
	//lets first find any model files
2122
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_MODELS, catFile, lModels, progress) )
2163
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_MODELS, catFile, secondCatFile, lModels, progress) )
2123
		return false;
2164
		return false;
2124
 
2165
 
2125
	// extract the dummies
2166
	// extract the dummies
2126
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_DUMMIES, catFile, lModels, progress) )
2167
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_DUMMIES, catFile, secondCatFile, lModels, progress) )
2127
		return false;
2168
		return false;
2128
 
2169
 
2129
	// extract the textures
2170
	// extract the textures
2130
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_TEXTURES, catFile, lModels, progress) )
2171
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_TEXTURES, catFile, secondCatFile, lModels, progress) )
2131
		return false;
2172
		return false;
2132
 
2173
 
2133
	// extract the text file entries
2174
	// extract the text file entries
2134
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_TEXTS, catFile, lModels, progress) )
2175
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_TEXTS, catFile, secondCatFile, lModels, progress) )
2135
		return false;
2176
		return false;
2136
 
2177
 
2137
	// extract the bodies entries
2178
	// extract the bodies entries
2138
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_BODIES, catFile, lModels, progress) )
2179
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_BODIES, catFile, secondCatFile, lModels, progress) )
2139
		return false;
2180
		return false;
2140
 
2181
 
2141
	// extract the cockpit entries
2182
	// extract the cockpit entries
2142
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_COCKPITS, catFile, lModels, progress) )
2183
	if ( !this->ProcessSceneFileSection(IMPORTSHIP_COCKPITS, catFile, secondCatFile, lModels, progress) )
2143
		return false;
2184
		return false;
2144
 
2185
 
2145
	delete lModels;
2186
	delete lModels;
2146
 
2187
 
2147
	return true;
2188
	return true;
2148
}
2189
}
2149
 
2190
 
2150
bool CXspFile::ProcessSceneFiles(CyString catFile, CProgressInfo *progress)
2191
bool CXspFile::ProcessSceneFiles(CyString catFile, CyString secondCatFile, CProgressInfo *progress)
2151
{
2192
{
2152
	CCatFile cat;
2193
	CCatFile cat;
2153
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
2194
	if ( cat.Open(catFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE ) {
-
 
2195
		CCatFile secondCat;
-
 
2196
		if ( secondCat.Open(catFile, "", CATREAD_CATDECRYPT, false) == CATERR_NONE ) {
-
 
2197
			return ProcessSceneFiles(&cat, &secondCat, progress);
-
 
2198
		}
2154
		return ProcessSceneFiles(&cat, progress);
2199
		return ProcessSceneFiles(&cat, NULL, progress);
-
 
2200
	}
2155
 
2201
 
2156
	return false;
2202
	return false;
2157
}
2203
}
2158
 
2204
 
2159
void CXspFile::PackAllFiles()
2205
void CXspFile::PackAllFiles()