Subversion Repositories spk

Rev

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

Rev 212 Rev 216
Line 28... Line 28...
28
#define TSHIPPOS_CLASS		53
28
#define TSHIPPOS_CLASS		53
29
 
29
 
30
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
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};
31
 
31
 
32
int		 SPKEXPORT GetMaxShipyards ();
32
int		 SPKEXPORT GetMaxShipyards ();
33
Utils::String SPKEXPORT GetShipyardName (int s);
33
Utils::WString SPKEXPORT GetShipyardName (int s);
34
 
34
 
35
typedef struct STypesSection {
35
typedef struct STypesSection {
36
	Utils::String		sSection;
36
	Utils::WString		sSection;
37
	Utils::CStringList	lEntries;
37
	Utils::WStringList	lEntries;
38
} STypesSection2;
38
} STypesSection2;
39
 
39
 
40
typedef struct SComponentEntry {
40
typedef struct SComponentEntry {
41
	Utils::String		sSection;
41
	Utils::WString		sSection;
42
	Utils::CList<STypesSection> lEntries;
42
	Utils::CList<STypesSection> lEntries;
43
} SComponentEntry;
43
} SComponentEntry;
44
 
44
 
45
typedef struct SWeaponMask {
45
typedef struct SWeaponMask {
46
	int		iMask;
46
	int		iMask;
Line 48... Line 48...
48
} SWeaponMask;
48
} SWeaponMask;
49
 
49
 
50
typedef struct SText
50
typedef struct SText
51
{
51
{
52
	int		iId;
52
	int		iId;
53
	Utils::String sName;
53
	Utils::WString sName;
54
	Utils::String sDesc;
54
	Utils::WString sDesc;
55
} SText;
55
} SText;
56
 
56
 
57
typedef struct SDummy
57
typedef struct SDummy
58
{
58
{
59
	Utils::String	sSection;
59
	Utils::WString	sSection;
60
	Utils::String sData;
60
	Utils::WString sData;
61
} SDummy;
61
} SDummy;
62
 
62
 
63
typedef struct SComponent
63
typedef struct SComponent
64
{
64
{
65
	Utils::String sSection;
65
	Utils::WString sSection;
66
	Utils::String sSection2;
66
	Utils::WString sSection2;
67
	Utils::String sData;
67
	Utils::WString sData;
68
} SComponent;
68
} SComponent;
69
 
69
 
70
typedef struct SCockpit
70
typedef struct SCockpit
71
{
71
{
72
	Utils::String	   sCockpit;
72
	Utils::WString	   sCockpit;
73
	CLinkList<SWeaponMask> lWeaponMask;
73
	CLinkList<SWeaponMask> lWeaponMask;
74
	int				iIndex;
74
	int				iIndex;
75
} SCockpit;
75
} SCockpit;
76
 
76
 
77
using namespace SPK;
77
using namespace SPK;
Line 83... Line 83...
83
	~CXspFile () { this->Delete(); }
83
	~CXspFile () { this->Delete(); }
84
 
84
 
85
	static bool ReadAnimations(const Utils::WStringList& lIn, Utils::WStringList& lOut, int startRecord);
85
	static bool ReadAnimations(const Utils::WStringList& lIn, Utils::WStringList& lOut, int startRecord);
86
	static bool ReadAnimations(const Utils::CStringList& lIn, Utils::CStringList& lOut, int startRecord);
86
	static bool ReadAnimations(const Utils::CStringList& lIn, Utils::CStringList& lOut, int startRecord);
87
	static int GetAnimationType(const Utils::String &sType);
87
	static int GetAnimationType(const Utils::String &sType);
88
	static Utils::String TypesListToString(Utils::CList<STypesSection> &list, bool deleteAfter = false);
88
	static Utils::WString TypesListToString(Utils::CList<STypesSection> &list, bool deleteAfter = false);
89
 
89
 
90
	bool writeHeader(CFileIO &file, int iHeader, int iLength) const override;
90
	bool writeHeader(CFileIO &file, int iHeader, int iLength) const override;
91
 
91
 
92
	bool IsLanguageText () { return m_bLanguageText; }
92
	bool IsLanguageText () { return m_bLanguageText; }
93
	bool IsExistingShip () { return m_bExistingShip; }
93
	bool IsExistingShip () { return m_bExistingShip; }
Line 120... Line 120...
120
 
120
 
121
	void SetSceneFile ( C_File *f ) { m_pSceneFile = f; }
121
	void SetSceneFile ( C_File *f ) { m_pSceneFile = f; }
122
	void SetCockpitFile ( C_File *f ) { m_pCockpitFile = f; }
122
	void SetCockpitFile ( C_File *f ) { m_pCockpitFile = f; }
123
 
123
 
124
	void addAnimation(const Utils::CStringList &list);
124
	void addAnimation(const Utils::CStringList &list);
125
	void addAnimation(const Utils::String& data);
125
	void addAnimation(const Utils::WString& data);
126
	void addBodies(const Utils::String &data);
126
	void addBodies(const Utils::WString &data);
127
	void addBody(const Utils::String &section, const Utils::String &data);
127
	void addBody(const Utils::WString &section, const Utils::WString &data);
128
	void addCutData(const Utils::String& data);
128
	void addCutData(const Utils::WString& data);
129
	void AddText(int id, const Utils::String &name, const Utils::String &desc );
129
	void addText(int id, const Utils::WString &name, const Utils::WString &desc);
130
	void AddCockpit(const Utils::String &cockpit, int game, int mask = -1, int index = -1 );
130
	void addCockpit(const Utils::WString &cockpit, int game, int mask = -1, int index = -1 );
131
	void AddCockpitWeapon(const Utils::String &cockpit, int game, int mask);
131
	void addCockpitWeapon(const Utils::WString &cockpit, int game, int mask);
132
	void NewCockpit(const Utils::String &id, const Utils::String &scene, int mask );
132
	void NewCockpit(const Utils::String &id, const Utils::String &scene, int mask );
133
	void EditCockpit(const Utils::String &id, const Utils::String &cockpit);
133
	void EditCockpit(const Utils::String &id, const Utils::String &cockpit);
134
	void EditCockpit(const Utils::String &id, const Utils::String &scene, int mask);
134
	void EditCockpit(const Utils::String &id, const Utils::String &scene, int mask);
135
	Utils::String GetCockpitData(const Utils::String &id);
135
	Utils::String GetCockpitData(const Utils::String &id);
136
	SCockpit *FindCockpit(const Utils::String &id);
136
	SCockpit *FindCockpit(const Utils::String &id);
137
	void AddDummy(const Utils::String &section, const Utils::String &data );
137
	void addDummy(const Utils::WString &section, const Utils::WString &data );
138
	void AddComponent(const Utils::String &section, const Utils::String &section2, const Utils::String &data );
138
	void addComponent(const Utils::WString &section, const Utils::WString &section2, const Utils::WString &data);
139
	void AddWeaponMask(int game, int mask );
139
	void AddWeaponMask(int game, int mask );
140
	void AddMissileMask(int game, int mask );
140
	void AddMissileMask(int game, int mask );
141
	void RemoveText(int id);
141
	void RemoveText(int id);
142
	void ClearText() { m_lText.MemoryClear(); _changed(); }
142
	void ClearText() { m_lText.MemoryClear(); _changed(); }
143
 
143
 
144
	void AddShipyard ( int s ) { m_iShipyard |= s; _changed(); }
144
	void AddShipyard ( int s ) { m_iShipyard |= s; _changed(); }
145
	void RemoveShipyard ( int s ) { m_iShipyard &= ~(s); _changed(); }
145
	void RemoveShipyard ( int s ) { m_iShipyard &= ~(s); _changed(); }
146
	void SetShipyard(int s, bool b) { if ( b ) AddShipyard(s); else RemoveShipyard(s); }
146
	void SetShipyard(int s, bool b) { if ( b ) AddShipyard(s); else RemoveShipyard(s); }
147
	void ToggleShipyard(int s) { if ( this->IsShipyard(s) ) RemoveShipyard(s); else AddShipyard(s); }
147
	void ToggleShipyard(int s) { if ( this->IsShipyard(s) ) RemoveShipyard(s); else AddShipyard(s); }
148
 
148
 
149
	bool removeCutData(const Utils::String &cut);
149
	bool removeCutData(const Utils::WString &cut);
150
	bool removeCockpit(const Utils::String &cockpitid);
150
	bool removeCockpit(const Utils::WString &cockpitid);
151
	bool removeComponent(const Utils::String &section1, const Utils::String &section2, const Utils::String &data);
151
	bool removeComponent(const Utils::WString &section1, const Utils::WString &section2, const Utils::WString &data);
152
	bool removeDummy(const Utils::String &section, const Utils::String &data);
152
	bool removeDummy(const Utils::WString &section, const Utils::WString &data);
153
	bool removeBodies(const Utils::String &body);
153
	bool removeBodies(const Utils::WString &body);
154
	bool removeAnimation(const Utils::String &ani);
154
	bool removeAnimation(const Utils::WString &ani);
155
 
155
 
156
	bool IsSigned() { return false; }
156
	bool IsSigned() { return false; }
157
	bool IsValid ();
157
	bool IsValid ();
158
	bool IsShipyard(int s) { return (m_iShipyard & s) ? true : false; }
158
	bool IsShipyard(int s) { return (m_iShipyard & s) ? true : false; }
159
	bool AnyShipyards() { return (m_iShipyard > 0) ? true : false; }
159
	bool AnyShipyards() { return (m_iShipyard > 0) ? true : false; }
Line 165... Line 165...
165
	virtual BaseFileType type() const override { return BaseFileType::TYPE_XSP; }
165
	virtual BaseFileType type() const override { return BaseFileType::TYPE_XSP; }
166
 
166
 
167
	Utils::WString shipName(int lang);
167
	Utils::WString shipName(int lang);
168
	bool ConvertOld(const Utils::String &file);
168
	bool ConvertOld(const Utils::String &file);
169
 
169
 
170
	const Utils::CStringList &getAnimations() const { return _lAnimations; }
170
	const Utils::WStringList &getAnimations() const { return _lAnimations; }
171
	const Utils::CStringList &getCutData() const { return _lCutData; }
171
	const Utils::WStringList &getCutData() const { return _lCutData; }
172
	const Utils::CStringList &getBodies() const { return _lBodies; }
172
	const Utils::WStringList &getBodies() const { return _lBodies; }
173
	CLinkList<SWeaponMask> *GetLaserMasks() { return &m_lWeaponMasks; }
173
	CLinkList<SWeaponMask> *GetLaserMasks() { return &m_lWeaponMasks; }
174
	CLinkList<SWeaponMask> *GetMissileMasks() { return &m_lMissileMasks; }
174
	CLinkList<SWeaponMask> *GetMissileMasks() { return &m_lMissileMasks; }
175
	CLinkList<SText> *GetTexts() { return &m_lText; }
175
	CLinkList<SText> *GetTexts() { return &m_lText; }
176
	CLinkList<SDummy> *GetDummies() { return &m_lDummy; }
176
	CLinkList<SDummy> *GetDummies() { return &m_lDummy; }
177
	CLinkList<SComponent> *GetComponents() { return &m_lComponent; }
177
	CLinkList<SComponent> *GetComponents() { return &m_lComponent; }
Line 225... Line 225...
225
 
225
 
226
	bool getTextureList(Utils::WStringList &list, const unsigned char *olddata, size_t size) const;
226
	bool getTextureList(Utils::WStringList &list, const unsigned char *olddata, size_t size) const;
227
	bool addTextFromFile(const Utils::WString &file, int textId = -1);
227
	bool addTextFromFile(const Utils::WString &file, int textId = -1);
228
	bool importBodies(const Utils::CStringList &sceneModels, const Utils::String &filename);
228
	bool importBodies(const Utils::CStringList &sceneModels, const Utils::String &filename);
229
	bool ImportCockpits(const Utils::String &filename);
229
	bool ImportCockpits(const Utils::String &filename);
230
	Utils::String formatShipData(const Utils::CStringList &cockpits, int *text, int game);
230
	Utils::WString formatShipData(const Utils::WStringList &cockpits, int *text, int game);
231
 
231
 
232
	virtual bool loadPackageData(const Utils::WString &sFirst, const Utils::WString &sRest, const Utils::WString &sMainGame, Utils::WStringList &otherGames, Utils::WStringList &gameAddons, CProgressInfo *progress = NULL) override;
232
	virtual bool loadPackageData(const Utils::WString &sFirst, const Utils::WString &sRest, const Utils::WString &sMainGame, Utils::WStringList &otherGames, Utils::WStringList &gameAddons, CProgressInfo *progress = NULL) override;
233
	virtual bool GeneratePackagerScript(bool wildcard, Utils::WStringList *list, int game, const Utils::WStringList &gameAddons, bool datafile = false) override;
233
	virtual bool GeneratePackagerScript(bool wildcard, Utils::WStringList *list, int game, const Utils::WStringList &gameAddons, bool datafile = false) override;
234
	virtual void addGeneratedFiles(HZIP &hz);
234
	virtual void addGeneratedFiles(HZIP &hz);
235
 
235
 
236
protected:
236
protected:
237
	virtual void Delete ();
237
	virtual void Delete ();
238
	virtual void SetDefaults ();
238
	virtual void SetDefaults ();
239
	virtual bool _checkHeader(const Utils::WString &header) const override;
239
	virtual bool _checkHeader(const Utils::WString &header) const override;
240
	SCockpit *_findCockpit(const Utils::String &sID);
240
	SCockpit *_findCockpit(const Utils::WString &sID);
241
	void _addSection(Utils::CList<STypesSection> &list, const Utils::String &section, const Utils::String &data);
241
	void _addSection(Utils::CList<STypesSection> &list, const Utils::WString &section, const Utils::WString &data);
242
	void _addDataSection(Utils::CStringList& list, Utils::CList<STypesSection>& sectionList, bool bUseFirst);
242
	void _addDataSection(Utils::WStringList& list, Utils::CList<STypesSection>& sectionList, bool bUseFirst);
243
	bool _addTextFromFile(CFileIO &F, int textId = -1);
243
	bool _addTextFromFile(CFileIO &F, int textId = -1);
244
 
244
 
245
protected:
245
protected:
246
	C_File *m_pSceneFile, *m_pCockpitFile;
246
	C_File *m_pSceneFile, *m_pCockpitFile;
247
 
247
 
Line 250... Line 250...
250
	int m_iOrgDesc;
250
	int m_iOrgDesc;
251
 
251
 
252
	Utils::String m_sID;
252
	Utils::String m_sID;
253
	Utils::String m_sData;
253
	Utils::String m_sData;
254
 
254
 
255
	Utils::CStringList		_lCutData;
255
	Utils::WStringList		_lCutData;
256
	Utils::CStringList		_lBodies;
256
	Utils::WStringList		_lBodies;
257
	Utils::CStringList		_lAnimations;
257
	Utils::WStringList		_lAnimations;
258
	CLinkList<SCockpit>		m_lCockpit;
258
	CLinkList<SCockpit>		m_lCockpit;
259
	CLinkList<SText>		m_lText;
259
	CLinkList<SText>		m_lText;
260
	CLinkList<SComponent>	m_lComponent;
260
	CLinkList<SComponent>	m_lComponent;
261
	CLinkList<SDummy>		m_lDummy;
261
	CLinkList<SDummy>		m_lDummy;
262
	CLinkList<SWeaponMask>  m_lWeaponMasks;
262
	CLinkList<SWeaponMask>  m_lWeaponMasks;