Subversion Repositories spk

Rev

Rev 218 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 218 Rev 248
Line 5... Line 5...
5
#include "ShipData.h"
5
#include "ShipData.h"
6
#include "VirtualFileSystem.h"
6
#include "VirtualFileSystem.h"
7
 
7
 
8
class CCatFile;
8
class CCatFile;
9
 
9
 
10
#define SHIPYARD_NONE		  0
10
enum class ShipyardRace
-
 
11
{
-
 
12
	None			= 0,
11
#define SHIPYARD_ARGON		  1
13
	Argon			= 1,
12
#define SHIPYARD_BORON		  2
14
	Boron			= 2,
13
#define SHIPYARD_PARANID	  4
15
	Paranid			= 4,
14
#define SHIPYARD_SPLIT		  8
16
	Split			= 8,
15
#define SHIPYARD_TELADI		 16
17
	Teladi			= 16,
16
#define SHIPYARD_PIRATES	 32
18
	Pirates			= 32,
17
#define SHIPYARD_FRIEND		 64
19
	Friend			= 64,
18
#define SHIPYARD_XENON		128
20
	Xenon			= 128,
19
#define SHIPYARD_TERRAN		256
21
	Terran			= 256,
20
#define SHIPYARD_ATF		512
22
	ATF				= 512,
21
#define SHIPYARD_YAKI		1024
23
	Yaki			= 1024,
-
 
24
	Goner			= 2048,
-
 
25
	Max				= 2048,
22
 
26
};
23
#define SHIPYARD_MAX	SHIPYARD_TERRAN
-
 
24
 
27
 
25
enum {TAT_NONE, TAT_SINGLE, TAT_3};
28
enum {TAT_NONE, TAT_SINGLE, TAT_3};
26
 
29
 
27
#define TSHIPPOS_CLASS		53
30
#define TSHIPPOS_CLASS		53
28
 
31
 
29
enum {IMPORTSHIP_NONE, IMPORTSHIP_SCENE, IMPORTSHIP_EXTRACTSCENE, IMPORTSHIP_DUMMIES, IMPORTSHIP_COMPONANT, IMPORTSHIP_MODELS, IMPORTSHIP_TEXTURES, IMPORTSHIP_TEXTS, IMPORTSHIP_BODIES, IMPORTSHIP_COCKPITS, IMPORTSHIP_PACK, IMPORTSHIP_DONE};
32
enum {IMPORTSHIP_NONE, IMPORTSHIP_SCENE, IMPORTSHIP_EXTRACTSCENE, IMPORTSHIP_DUMMIES, IMPORTSHIP_COMPONANT, IMPORTSHIP_MODELS, IMPORTSHIP_TEXTURES, IMPORTSHIP_TEXTS, IMPORTSHIP_BODIES, IMPORTSHIP_COCKPITS, IMPORTSHIP_PACK, IMPORTSHIP_DONE};
30
 
33
 
31
int		 SPKEXPORT GetMaxShipyards ();
34
unsigned long  SPKEXPORT GetMaxShipyards ();
32
Utils::WString SPKEXPORT GetShipyardName (int s);
35
Utils::WString SPKEXPORT GetShipyardName (ShipyardRace s);
33
 
36
 
34
typedef struct STypesSection {
37
typedef struct STypesSection {
35
	Utils::WString		sSection;
38
	Utils::WString		sSection;
36
	Utils::WStringList	lEntries;
39
	Utils::WStringList	lEntries;
37
} STypesSection2;
40
} STypesSection2;
38
 
41
 
Line 43... Line 46...
43
 
46
 
44
typedef struct SWeaponMask {
47
typedef struct SWeaponMask {
45
	int		iMask;
48
	int		iMask;
46
	int		iGame;
49
	int		iGame;
47
} SWeaponMask;
50
} SWeaponMask;
48
 
51
 
49
typedef struct SText
52
typedef struct SText
50
{
53
{
51
	int		iId;
54
	int		iId;
52
	Utils::WString sName;
55
	Utils::WString sName;
53
	Utils::WString sDesc;
56
	Utils::WString sDesc;
Line 89... Line 92...
89
 
92
 
90
	bool IsLanguageText () { return m_bLanguageText; }
93
	bool IsLanguageText () { return m_bLanguageText; }
91
	bool IsExistingShip () { return m_bExistingShip; }
94
	bool IsExistingShip () { return m_bExistingShip; }
92
 
95
 
93
	int  GetOriginalDescription () { return m_iOrgDesc; }
96
	int  GetOriginalDescription () { return m_iOrgDesc; }
94
	int  GetShipyards () { return m_iShipyard; }
97
	unsigned long shipyards () const { return _iShipyard; }
95
 
98
 
96
	const Utils::WString &shipID () const { return m_sID; }
99
	const Utils::WString &shipID () const { return m_sID; }
97
	const Utils::WString &shipData () const { return m_sData; }
100
	const Utils::WString &shipData () const { return m_sData; }
98
	Utils::WString getX3ShipData() const;
101
	Utils::WString getX3ShipData() const;
99
	Utils::WString getTCShipData() const;
102
	Utils::WString getTCShipData() const;
Line 137... Line 140...
137
	void AddWeaponMask(int game, int mask );
140
	void AddWeaponMask(int game, int mask );
138
	void AddMissileMask(int game, int mask );
141
	void AddMissileMask(int game, int mask );
139
	void RemoveText(int id);
142
	void RemoveText(int id);
140
	void ClearText() { m_lText.MemoryClear(); _changed(); }
143
	void ClearText() { m_lText.MemoryClear(); _changed(); }
141
 
144
 
142
	void AddShipyard ( int s ) { m_iShipyard |= s; _changed(); }
145
	void addShipyard(ShipyardRace s) { _iShipyard |= static_cast<unsigned long>(s); _changed(); }
143
	void RemoveShipyard ( int s ) { m_iShipyard &amp;= ~(s); _changed(); }
146
	void removeShipyard(ShipyardRace s) { _iShipyard &amp;= ~(static_cast<unsigned long>(s)); _changed(); }
144
	void SetShipyard(int s, bool b) { if ( b ) AddShipyard(s); else RemoveShipyard(s); }
147
	void setShipyard(ShipyardRace s, bool b) { if ( b ) addShipyard(s); else removeShipyard(s); }
145
	void ToggleShipyard(int s) { if ( this->IsShipyard(s) ) RemoveShipyard(s); else AddShipyard(s); }
148
	void toggleShipyard(ShipyardRace s) { if ( this->isShipyard(s) ) removeShipyard(s); else addShipyard(s); }
146
 
149
 
147
	bool removeCutData(const Utils::WString &cut);
150
	bool removeCutData(const Utils::WString &cut);
148
	bool removeCockpit(const Utils::WString &cockpitid);
151
	bool removeCockpit(const Utils::WString &cockpitid);
149
	bool removeComponent(const Utils::WString &section1, const Utils::WString &section2, const Utils::WString &data);
152
	bool removeComponent(const Utils::WString &section1, const Utils::WString &section2, const Utils::WString &data);
150
	bool removeDummy(const Utils::WString &section, const Utils::WString &data);
153
	bool removeDummy(const Utils::WString &section, const Utils::WString &data);
151
	bool removeBodies(const Utils::WString &body);
154
	bool removeBodies(const Utils::WString &body);
152
	bool removeAnimation(const Utils::WString &ani);
155
	bool removeAnimation(const Utils::WString &ani);
153
 
156
 
154
	bool IsSigned() { return false; }
157
	bool IsSigned() { return false; }
155
	bool IsValid ();
158
	bool IsValid ();
156
	bool IsShipyard(int s) { return (m_iShipyard &amp; s) ? true : false; }
159
	bool isShipyard(ShipyardRace s) const { return (_iShipyard & static_cast&lt;unsigned long>;(s)) ? true : false; }
157
	bool AnyShipyards() { return (m_iShipyard > 0) ? true : false; }
160
	bool anyShipyards() const { return (_iShipyard > 0) ? true : false; }
158
	void AdjustCockpits();
161
	void AdjustCockpits();
159
	virtual Utils::WString createValuesLine() const override;
162
	virtual Utils::WString createValuesLine() const override;
160
	virtual bool parseValueLine(const Utils::WString &line) override;
163
	virtual bool parseValueLine(const Utils::WString &line) override;
161
 
164
 
162
	virtual int GetType () { return TYPE_XSP; }
165
	virtual int GetType () { return TYPE_XSP; }
Line 215... Line 218...
215
	bool processSceneFileSection(int section, CVirtualFileSystem *pVfs, Utils::WStringList &lModels, CProgressInfo *progress);
218
	bool processSceneFileSection(int section, CVirtualFileSystem *pVfs, Utils::WStringList &lModels, CProgressInfo *progress);
216
	bool processSceneFiles(CVirtualFileSystem *pVfs, CProgressInfo *progress);
219
	bool processSceneFiles(CVirtualFileSystem *pVfs, CProgressInfo *progress);
217
 
220
 
218
	void PackAllFiles();
221
	void PackAllFiles();
219
	bool readSceneModels(Utils::WStringList& out);
222
	bool readSceneModels(Utils::WStringList& out);
-
 
223
 
-
 
224
	void completeFile() override;
220
 
225
 
221
	//TODO: convert this
226
	//TODO: convert this
222
	void ExtractTexts(CCatFile *catFile, CCatFile *secondCatFile, int textId);
227
	void ExtractTexts(CCatFile *catFile, CCatFile *secondCatFile, int textId);
223
 
228
 
224
	bool getTextureList(Utils::WStringList &list, const unsigned char *olddata, size_t size) const;
229
	bool getTextureList(Utils::WStringList &list, const unsigned char *olddata, size_t size) const;
Line 258... Line 263...
258
	CLinkList<SComponent>	m_lComponent;
263
	CLinkList<SComponent>	m_lComponent;
259
	CLinkList<SDummy>		m_lDummy;
264
	CLinkList<SDummy>		m_lDummy;
260
	CLinkList<SWeaponMask>  m_lWeaponMasks;
265
	CLinkList<SWeaponMask>  m_lWeaponMasks;
261
	CLinkList<SWeaponMask>  m_lMissileMasks;
266
	CLinkList<SWeaponMask>  m_lMissileMasks;
262
 
267
 
263
	int m_iShipyard;
268
	unsigned long _iShipyard;
264
};
269
};
265
 
270
 
266
#endif //_XSPFILE_H__
271
#endif //_XSPFILE_H__
267
 
272