Subversion Repositories spk

Rev

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

Rev 41 Rev 42
Line 1496... Line 1496...
1496
 
1496
 
1497
	if ( deleteData )
1497
	if ( deleteData )
1498
		delete data;
1498
		delete data;
1499
 
1499
 
1500
	return lModels;
1500
	return lModels;
-
 
1501
}
-
 
1502
 
-
 
1503
void CXspFile::extractCutData(CVirtualFileSystem *pVfs, CyStringList *sceneModels, bool add)
-
 
1504
{
-
 
1505
	std::vector<int> cuts;
-
 
1506
	for ( CListNode<SDummy> *node = m_lDummy.Front(); node; node = node->next() ) {
-
 
1507
		Utils::String data = node->Data()->sData;
-
 
1508
		int states = data.token(";", 3);
-
 
1509
		for ( int i = 0; i < states; i++ ) {
-
 
1510
			int cutid = data.token(";", (i * 2) + 5);
-
 
1511
			if ( !cutid ) continue;
-
 
1512
			cuts.push_back(cutid);
-
 
1513
		}
-
 
1514
	}
-
 
1515
 
-
 
1516
	if ( cuts.empty() ) return;
-
 
1517
 
-
 
1518
	if ( !pVfs->ExtractGameFile("types/CutData.pck", "tmp") ) return;
-
 
1519
	
-
 
1520
	CFileIO File("tmp");
-
 
1521
	if ( !File.Exists() ) return;
-
 
1522
	
-
 
1523
	CyStringList *lines = File.ReadLinesStr();
-
 
1524
	int count = -1;
-
 
1525
	for ( SStringList *node = lines->Head(); node; node = node->next ) {
-
 
1526
		Utils::String line = node->str.ToString();
-
 
1527
		line.removeChar('\r');
-
 
1528
		line.removeChar(' ');
-
 
1529
		line.removeFirstSpace();
-
 
1530
		if ( line[0] == '/' ) continue;
-
 
1531
		if ( count == -1 ) count = line.token(";", 1);
-
 
1532
		else {
-
 
1533
			int max;
-
 
1534
			Utils::String *words = line.tokenise(";", &max);
-
 
1535
			if ( words && max ) {
-
 
1536
				for ( int i = 0; i < max; i += 2 ) {
-
 
1537
					int cutid = words[i];
-
 
1538
					if ( !cutid ) continue;
-
 
1539
					for ( std::vector<int>::iterator itr = cuts.begin(); itr != cuts.end(); itr++ ) {
-
 
1540
						if ( (*itr) == cutid ) {
-
 
1541
							this->AddCutData(words[i] + ";" + words[i + 1] + ";");
-
 
1542
							if ( add ) {
-
 
1543
								sceneModels->PushBack(CyString(words[i + 1]));
-
 
1544
							}
-
 
1545
							break;
-
 
1546
						}
-
 
1547
					}
-
 
1548
				}
-
 
1549
				CLEANSPLIT(words, max);
-
 
1550
			}
-
 
1551
		}
-
 
1552
	}
1501
}
1553
}
1502
 
1554
 
1503
void CXspFile::extractDummies(CVirtualFileSystem *pVfs, CyStringList *sceneModels, bool add)
1555
void CXspFile::extractDummies(CVirtualFileSystem *pVfs, CyStringList *sceneModels, bool add)
1504
{
1556
{
1505
	if ( !sceneModels ) return;
1557
	if ( !sceneModels ) return;
Line 1955... Line 2007...
1955
			if ( pos != -1 )
2007
			if ( pos != -1 )
1956
			{
2008
			{
1957
				int endpos = line.findPos("\"", pos + 5);
2009
				int endpos = line.findPos("\"", pos + 5);
1958
				if ( endpos != -1 )
2010
				if ( endpos != -1 )
1959
					lang = line.mid(pos + 5, endpos - (pos + 4));
2011
					lang = line.mid(pos + 5, endpos - (pos + 4));
1960
			}
2012
			}
1961
		}
2013
		}
1962
	}
2014
	}
1963
 
2015
 
1964
	// incase we only found the shipname
2016
	// incase we only found the shipname
1965
	if ( !shipName.empty() )
2017
	if ( !shipName.empty() )
1966
		added = true;
2018
		added = true;
Line 2025... Line 2077...
2025
			break;
2077
			break;
2026
 
2078
 
2027
		case IMPORTSHIP_DUMMIES:
2079
		case IMPORTSHIP_DUMMIES:
2028
			if ( !lModels ) return false;
2080
			if ( !lModels ) return false;
2029
			this->extractDummies(pVfs, lModels, true);
2081
			this->extractDummies(pVfs, lModels, true);
-
 
2082
			this->extractCutData(pVfs, lModels, true);
2030
			break;
2083
			break;
2031
 
2084
 
2032
		// extract the textures
2085
		// extract the textures
2033
		case IMPORTSHIP_TEXTURES:
2086
		case IMPORTSHIP_TEXTURES:
2034
			this->extractTextures(pVfs);
2087
			this->extractTextures(pVfs);
Line 2107... Line 2160...
2107
			if ( f->CheckFileExt("bod") )
2160
			if ( f->CheckFileExt("bod") )
2108
			{
2161
			{
2109
				if ( f->PCKFile() )
2162
				if ( f->PCKFile() )
2110
					f->ChangeFileExt("pbd");
2163
					f->ChangeFileExt("pbd");
2111
			}	
2164
			}	
-
 
2165
 
2112
			else if ( f->CheckFileExt("bob") )
2166
			else */if ( f->CheckFileExt("bob") )
2113
			{
2167
			{
2114
				if ( f->PCKFile() )
2168
				if ( f->PCKFile() )
2115
					f->ChangeFileExt("pbb");
2169
					f->ChangeFileExt("pbb");
2116
			}*/
2170
			}
2117
		}
2171
		}
2118
	}
2172
	}
2119
}
2173
}
2120
 
2174
 
2121
void CXspFile::AdjustCockpits()
2175
void CXspFile::AdjustCockpits()