Subversion Repositories spk

Rev

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

Rev 102 Rev 108
Line 782... Line 782...
782
	{
782
	{
783
		list->PushBack("# Ship ID, the ship id to identify the ship as");
783
		list->PushBack("# Ship ID, the ship id to identify the ship as");
784
		list->PushBack(CyString("ShipID: ") + m_sID);
784
		list->PushBack(CyString("ShipID: ") + m_sID);
785
	}
785
	}
786
 
786
 
-
 
787
	if ( m_bExistingShip )
-
 
788
	{
-
 
789
		list->PushBack("# Existing Ship, replaces an existing ship in the game with ship package instead of creating a new entry");
-
 
790
		list->PushBack("ExistingShip");
-
 
791
		list->PushBack("");
-
 
792
	}
-
 
793
 
787
	if ( !m_sData.empty() )
794
	if ( !m_sData.empty() )
788
	{
795
	{
789
		list->PushBack("# Ship Data, the TShip data entry to add to the game (parts of this are adjusted and auto generated by the installer)");
796
		list->PushBack("# Ship Data, the TShip data entry to add to the game (parts of this are adjusted and auto generated by the installer)");
790
		list->PushBack(CyString("ShipData: ") + m_sData);
797
		list->PushBack(CyString("ShipData: ") + m_sData);
791
		list->PushBack("");
798
		list->PushBack("");
792
	}
799
	}
793
 
800
 
794
	if ( m_bExistingShip )
801
	if ( m_lText.size() ) {
-
 
802
		list->PushBack("# Ship Texts, the name/description of the ship in each language: <LANGID> <NAME>|<DESCRIPTION>");
-
 
803
		for(CListNode<SText> *node = m_lText.Front(); node; node = node->next()) {
-
 
804
			list->PushBack(CyString("ShipText: ") + (long)node->Data()->iId + " " + node->Data()->sName + "|" + node->Data()->sDesc);
-
 
805
		}
-
 
806
 
-
 
807
		list->PushBack("");
795
	{
808
	}
-
 
809
 
-
 
810
	if ( this->m_lWeaponMasks.size() ) {
-
 
811
		list->PushBack("# Weapon Masks, the weapons for each game: <GAME> <MASK>");
-
 
812
		for(CListNode<SWeaponMask> *node = m_lWeaponMasks.Front(); node; node = node->next()) {
-
 
813
			list->PushBack(CyString("WeaponMask: ") + (long)node->Data()->iGame + " " + (long)node->Data()->iMask);
-
 
814
		}
-
 
815
 
-
 
816
		list->PushBack("");
-
 
817
	}
-
 
818
 
-
 
819
	if ( this->m_lMissileMasks.size() ) {
-
 
820
		list->PushBack("# Missile Masks, the missiles for each game: <GAME> <MASK>");
-
 
821
		for(CListNode<SWeaponMask> *node = m_lMissileMasks.Front(); node; node = node->next()) {
-
 
822
			list->PushBack(CyString("WeaponMask: ") + (long)node->Data()->iGame + " " + (long)node->Data()->iMask);
-
 
823
		}
-
 
824
 
-
 
825
		list->PushBack("");
-
 
826
	}
-
 
827
 
-
 
828
	if ( this->m_lComponent.size() ) {
796
		list->PushBack("# Existing Ship, replaces an existing ship in the game with ship package instead of creating a new entry");
829
		list->PushBack("# Ship Components, each component used in the ships scene: <SECTION> <MODELENTRY> <VALUES>");
-
 
830
		for(CListNode<SComponent> *node = m_lComponent.Front(); node; node = node->next()) {
-
 
831
			list->PushBack(CyString("Component: ") + node->Data()->sSection + " " + node->Data()->sSection2 + " " + node->Data()->sData);
-
 
832
		}
-
 
833
		list->PushBack("");
-
 
834
	}
-
 
835
 
-
 
836
	if ( this->m_lDummy.size() ) {
-
 
837
		list->PushBack("# Ship Dummies, each dummy entry used in the ships scene: <SECTION> <VALUE>");
-
 
838
		for(CListNode<SDummy> *node = m_lDummy.Front(); node; node = node->next()) {
-
 
839
			list->PushBack(CyString("Dummy: ") + node->Data()->sSection + " " + node->Data()->sData);
-
 
840
		}
-
 
841
		list->PushBack("");
-
 
842
	}
-
 
843
 
-
 
844
	if ( this->m_lCockpit.size() ) {
-
 
845
		list->PushBack("# Cockpit entries, each cockpit value with thier weapons mask");
-
 
846
		for(CListNode<SCockpit> *node = m_lCockpit.Front(); node; node = node->next()) {
-
 
847
			list->PushBack(CyString("Cockpit: ") + node->Data()->sCockpit.token(";", 19) + " " + node->Data()->sCockpit);
-
 
848
			for(SWeaponMask *mask = node->Data()->lWeaponMask.First(); mask; mask = node->Data()->lWeaponMask.Next()) {
-
 
849
				list->PushBack(CyString("CockpitWeapon: ") + node->Data()->sCockpit.token(";", 19) + " " + (long)mask->iGame + " " + (long)mask->iMask);
-
 
850
			}
-
 
851
		}
-
 
852
 
-
 
853
		list->PushBack("");
-
 
854
	}
-
 
855
 
-
 
856
	if ( !this->m_lCutData.Empty() ) {
-
 
857
		list->PushBack("# Ship Cut Data");
-
 
858
		for(SStringList *str = m_lCutData.Head(); str; str = str->next) {
-
 
859
			list->PushBack(CyString("CutData: ") + str->str);
-
 
860
		}
-
 
861
		list->PushBack("");
-
 
862
	}
-
 
863
 
-
 
864
	if ( !this->m_lBodies.Empty() ) {
797
		list->PushBack("ExistingShip");
865
		list->PushBack("# Ship Bodies");
-
 
866
		for(SStringList *str = m_lBodies.Head(); str; str = str->next) {
-
 
867
			list->PushBack(CyString("Bodies: ") + str->str);
-
 
868
		}
-
 
869
		list->PushBack("");
-
 
870
	}
-
 
871
 
-
 
872
	if ( !this->m_lAnimations.Empty() ) {
-
 
873
		list->PushBack("# Ship Animations");
-
 
874
		for(SStringList *str = m_lAnimations.Head(); str; str = str->next) {
-
 
875
			list->PushBack(CyString("Animation: ") + str->str);
-
 
876
		}
798
		list->PushBack("");
877
		list->PushBack("");
799
	}
878
	}
800
 
879
 
801
	if ( !datafile )
880
	if ( !datafile )
802
	{
881
	{
Line 831... Line 910...
831
	}
910
	}
832
	else if ( sFirst.Compare("ExistingShip") )
911
	else if ( sFirst.Compare("ExistingShip") )
833
		m_bExistingShip = true;
912
		m_bExistingShip = true;
834
	else if ( sFirst.Compare("ShipID") )
913
	else if ( sFirst.Compare("ShipID") )
835
		m_sID = sRest;
914
		m_sID = sRest;
-
 
915
	else if ( sFirst.Compare("ShipText") )
-
 
916
		this->AddText(sRest.token(" ", 1).toLong(), sRest.tokens(" ", 2).token("|", 1), sRest.tokens(" ", 2).tokens("|", 2));
-
 
917
	else if ( sFirst.Compare("Component") )
-
 
918
		this->AddComponent(sRest.token(" ", 1), sRest.token(" ", 2), sRest.tokens(" ", 3));
-
 
919
	else if ( sFirst.Compare("Cockpit") )
-
 
920
		this->AddCockpit(sRest.tokens(" ", 2).replaceToken(";", 19, sRest.token(" ", 1)), 0);
-
 
921
	else if ( sFirst.Compare("CockpitWeapon") )
-
 
922
		this->AddCockpitWeapon(sRest.token(" ", 1), sRest.token(" ", 2), sRest.token(" ", 3));
-
 
923
	else if ( sFirst.Compare("WeaponMask") )
-
 
924
		this->AddWeaponMask(sRest.token(" ", 1), sRest.token(" ", 2));
-
 
925
	else if ( sFirst.Compare("MissileMask") )
-
 
926
		this->AddMissileMask(sRest.token(" ", 1), sRest.token(" ", 2));
-
 
927
	else if ( sFirst.Compare("Dummy") )
-
 
928
		this->AddDummy(sRest.token(" ", 1), sRest.token(" ", 2));
-
 
929
	else if ( sFirst.Compare("CutData") )
-
 
930
		this->AddCutData(sRest);
-
 
931
	else if ( sFirst.Compare("Animation") )
-
 
932
		this->AddAnimation(sRest);
-
 
933
	else if ( sFirst.Compare("Bodies") )
-
 
934
		this->AddBodies(sRest);
836
	else if ( !CBaseFile::LoadPackageData(sFirst, sRest, sMainGame, otherGames) )
935
	else if ( !CBaseFile::LoadPackageData(sFirst, sRest, sMainGame, otherGames) )
837
	{
936
	{
838
		return false;
937
		return false;
839
	}
938
	}
840
 
939
 
Line 1060... Line 1159...
1060
	m_lAnimations.RemoveMarked();
1159
	m_lAnimations.RemoveMarked();
1061
 
1160
 
1062
	return ret;
1161
	return ret;
1063
}
1162
}
1064
 
1163
 
1065
void CXspFile::AddCockpit(const Utils::String &cockpit, int game, int mask, int index)
1164
SCockpit *CXspFile::_findCockpit(const Utils::String &sID)
1066
{
1165
{
-
 
1166
	for ( CListNode<SCockpit> *node = m_lCockpit.Front(); node; node = node->next() ) {
-
 
1167
		Utils::String id = node->Data()->sCockpit.token(";", 19);
1067
	SCockpit *pCockpit = NULL;
1168
		if ( id.Compare(sID) )
-
 
1169
			return node->Data();
-
 
1170
	}
1068
 
1171
 
-
 
1172
	return NULL;
-
 
1173
}
-
 
1174
 
-
 
1175
void CXspFile::AddCockpitWeapon(const Utils::String &cockpit, int game, int mask)
-
 
1176
{
1069
	// first search for the cockpit entry
1177
	SCockpit *pCockpit = _findCockpit(cockpit);
-
 
1178
 
1070
	Utils::String cid = cockpit.token(";", 19);
1179
	// search if the game mask already exists
-
 
1180
	SWeaponMask *wm = NULL;
1071
	for ( CListNode<SCockpit> *node = m_lCockpit.Front(); node; node = node->next() )
1181
	for ( CListNode<SWeaponMask> *node = pCockpit->lWeaponMask.Front(); node; node = node->next() )
1072
	{
1182
	{
1073
		Utils::String id = node->Data()->sCockpit.token(";", 19);
1183
		if ( node->Data()->iGame == game )
1074
		if ( id.Compare(cid) )
-
 
1075
		{
1184
		{
1076
			pCockpit = node->Data();
1185
			wm = node->Data();
1077
			break;
1186
			break;
1078
		}
1187
		}
1079
	}
1188
	}
1080
 
1189
 
-
 
1190
	if ( !wm )
-
 
1191
	{
-
 
1192
		wm = new SWeaponMask;
-
 
1193
		pCockpit->lWeaponMask.push_back(wm);
-
 
1194
	}
-
 
1195
 
-
 
1196
	wm->iGame = game;
-
 
1197
	if ( mask == -1 )
-
 
1198
		wm->iMask = pCockpit->sCockpit.token(";", 9);
-
 
1199
	else
-
 
1200
		wm->iMask = mask;
-
 
1201
	_changed();
-
 
1202
}
-
 
1203
 
-
 
1204
void CXspFile::AddCockpit(const Utils::String &cockpit, int game, int mask, int index)
-
 
1205
{
-
 
1206
	Utils::String cid = cockpit.token(";", 19);
-
 
1207
	SCockpit *pCockpit = _findCockpit(cid);
-
 
1208
 
1081
	if ( !pCockpit )
1209
	if ( !pCockpit )
1082
	{
1210
	{
1083
		pCockpit = new SCockpit;
1211
		pCockpit = new SCockpit;
1084
		pCockpit->sCockpit = cockpit;
1212
		pCockpit->sCockpit = cockpit;
1085
		pCockpit->iIndex = index;
1213
		pCockpit->iIndex = index;
Line 1088... Line 1216...
1088
	if ( index != -1 )
1216
	if ( index != -1 )
1089
		pCockpit->iIndex = index;
1217
		pCockpit->iIndex = index;
1090
 
1218
 
1091
	// now add the game mask
1219
	// now add the game mask
1092
	if ( game > 0 )
1220
	if ( game > 0 )
1093
	{
-
 
1094
		// search if the game mask already exists
-
 
1095
		SWeaponMask *wm = NULL;
-
 
1096
		for ( CListNode<SWeaponMask> *node = pCockpit->lWeaponMask.Front(); node; node = node->next() )
-
 
1097
		{
-
 
1098
			if ( node->Data()->iGame == game )
-
 
1099
			{
-
 
1100
				wm = node->Data();
-
 
1101
				break;
-
 
1102
			}
-
 
1103
		}
-
 
1104
 
-
 
1105
		if ( !wm )
-
 
1106
		{
-
 
1107
			wm = new SWeaponMask;
-
 
1108
			pCockpit->lWeaponMask.push_back(wm);
1221
		AddCockpitWeapon(cid, game, mask);
1109
		}
-
 
1110
 
-
 
1111
		wm->iGame = game;
-
 
1112
		if ( mask == -1 )
-
 
1113
			wm->iMask = cockpit.token(";", 9);
-
 
1114
		else
-
 
1115
			wm->iMask = mask;
-
 
1116
	}
-
 
1117
	_changed();
1222
	_changed();
1118
}
1223
}
1119
 
1224
 
1120
void CXspFile::AddBody(const Utils::String &section, const Utils::String &data)
1225
void CXspFile::AddBody(const Utils::String &section, const Utils::String &data)
1121
{
1226
{
Line 2062... Line 2167...
2062
		SInCatFile *f = node->Data();
2167
		SInCatFile *f = node->Data();
2063
		if ( !f->sFile.Left(2).Compare("t\\") && !f->sFile.Left(2).Compare("t/") )
2168
		if ( !f->sFile.Left(2).Compare("t\\") && !f->sFile.Left(2).Compare("t/") )
2064
			continue;
2169
			continue;
2065
 
2170
 
2066
		// extract the text file and read in the data
2171
		// extract the text file and read in the data
2067
		bool extracted = catFile->ExtractFile(f->sFile, CPackages::GetTempDirectory() + "tmp.dat");
2172
		bool extracted = catFile->ExtractFile(f->sFile, CPackages::GetTempDirectory() + "/tmp.dat");
2068
		if ( !extracted && secondCatFile ) extracted = secondCatFile->ExtractFile(f->sFile, CPackages::GetTempDirectory() + "tmp.dat");
2173
		if ( !extracted && secondCatFile ) extracted = secondCatFile->ExtractFile(f->sFile, CPackages::GetTempDirectory() + "/tmp.dat");
2069
		if ( extracted ) {
2174
		if ( extracted ) {
2070
			this->AddTextFromFile(CPackages::tempDirectory() + "tmp.dat", textId);
2175
			this->AddTextFromFile(CPackages::tempDirectory() + "/tmp.dat", textId);
2071
			CFileIO::Remove(CPackages::tempDirectory() + "tmp.dat");
2176
			CFileIO::Remove(CPackages::tempDirectory() + "/tmp.dat");
2072
		}
2177
		}
2073
	}
2178
	}
2074
}
2179
}
2075
 
2180
 
2076
bool CXspFile::processSceneFileSection(int section, CVirtualFileSystem *pVfs, CyStringList *lModels, CProgressInfo *progress)
2181
bool CXspFile::processSceneFileSection(int section, CVirtualFileSystem *pVfs, CyStringList *lModels, CProgressInfo *progress)