| 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 |
CyString SPKEXPORT GetShipyardName (int s);
|
33 |
Utils::String SPKEXPORT GetShipyardName (int s);
|
| 34 |
|
34 |
|
| 35 |
typedef struct SWeaponMask {
|
35 |
typedef struct SWeaponMask {
|
| 36 |
int iMask;
|
36 |
int iMask;
|
| 37 |
int iGame;
|
37 |
int iGame;
|
| 38 |
} SWeaponMask;
|
38 |
} SWeaponMask;
|
| 39 |
|
39 |
|
| 40 |
typedef struct SText
|
40 |
typedef struct SText
|
| 41 |
{
|
41 |
{
|
| 42 |
int iId;
|
42 |
int iId;
|
| 43 |
CyString sName;
|
43 |
Utils::String sName;
|
| 44 |
CyString sDesc;
|
44 |
Utils::String sDesc;
|
| 45 |
} SText;
|
45 |
} SText;
|
| 46 |
|
46 |
|
| 47 |
typedef struct SDummy
|
47 |
typedef struct SDummy
|
| 48 |
{
|
48 |
{
|
| 49 |
CyString sSection;
|
49 |
Utils::String sSection;
|
| 50 |
CyString sData;
|
50 |
Utils::String sData;
|
| 51 |
} SDummy;
|
51 |
} SDummy;
|
| 52 |
|
52 |
|
| 53 |
typedef struct SComponent
|
53 |
typedef struct SComponent
|
| 54 |
{
|
54 |
{
|
| 55 |
CyString sSection;
|
55 |
Utils::String sSection;
|
| 56 |
CyString sSection2;
|
56 |
Utils::String sSection2;
|
| 57 |
CyString sData;
|
57 |
Utils::String sData;
|
| 58 |
} SComponent;
|
58 |
} SComponent;
|
| 59 |
|
59 |
|
| 60 |
typedef struct SCockpit
|
60 |
typedef struct SCockpit
|
| 61 |
{
|
61 |
{
|
| 62 |
CyString sCockpit;
|
62 |
Utils::String sCockpit;
|
| 63 |
CLinkList<SWeaponMask> lWeaponMask;
|
63 |
CLinkList<SWeaponMask> lWeaponMask;
|
| 64 |
int iIndex;
|
64 |
int iIndex;
|
| 65 |
} SCockpit;
|
65 |
} SCockpit;
|
| 66 |
|
66 |
|
| 67 |
using namespace SPK;
|
67 |
using namespace SPK;
|
| Line 71... |
Line 71... |
| 71 |
public:
|
71 |
public:
|
| 72 |
CXspFile ();
|
72 |
CXspFile ();
|
| 73 |
~CXspFile () { this->Delete(); }
|
73 |
~CXspFile () { this->Delete(); }
|
| 74 |
|
74 |
|
| 75 |
static bool ReadAnimations(CyStringList *lIn, CyStringList *lOut, int startRecord);
|
75 |
static bool ReadAnimations(CyStringList *lIn, CyStringList *lOut, int startRecord);
|
| 76 |
static int GetAnimationType(CyString type);
|
76 |
static int GetAnimationType(const Utils::String &sType);
|
| 77 |
|
77 |
|
| 78 |
virtual bool WriteHeader ( FILE *id, int, int );
|
78 |
virtual bool WriteHeader ( FILE *id, int, int );
|
| 79 |
|
79 |
|
| 80 |
bool IsLanguageText () { return m_bLanguageText; }
|
80 |
bool IsLanguageText () { return m_bLanguageText; }
|
| 81 |
bool IsExistingShip () { return m_bExistingShip; }
|
81 |
bool IsExistingShip () { return m_bExistingShip; }
|
| Line 83... |
Line 83... |
| 83 |
int GetOriginalDescription () { return m_iOrgDesc; }
|
83 |
int GetOriginalDescription () { return m_iOrgDesc; }
|
| 84 |
int GetShipyards () { return m_iShipyard; }
|
84 |
int GetShipyards () { return m_iShipyard; }
|
| 85 |
|
85 |
|
| 86 |
const Utils::String &GetShipID () const { return m_sID; }
|
86 |
const Utils::String &GetShipID () const { return m_sID; }
|
| 87 |
const Utils::String &GetShipData () const { return m_sData; }
|
87 |
const Utils::String &GetShipData () const { return m_sData; }
|
| 88 |
CyString GetX3ShipData();
|
88 |
Utils::String GetX3ShipData();
|
| 89 |
CyString GetTCShipData();
|
89 |
Utils::String GetTCShipData();
|
| 90 |
CyString GetShipFilename ()
|
90 |
Utils::String GetShipFilename ()
|
| 91 |
{
|
91 |
{
|
| 92 |
CyString s = m_sName + "-" + m_sAuthor;
|
92 |
Utils::String s = m_sName.ToString() + "-" + m_sAuthor.ToString();
|
| 93 |
s = s.Remove ( ' ' );
|
93 |
s = s.remove(' ');
|
| 94 |
s = s.Remove ( '\\' );
|
94 |
s = s.remove('\\');
|
| 95 |
s = s.Remove ( '/' );
|
95 |
s = s.remove('/');
|
| 96 |
return s;
|
96 |
return s;
|
| 97 |
}
|
97 |
}
|
| 98 |
|
98 |
|
| 99 |
SText *FindShipText(int lang);
|
99 |
SText *FindShipText(int lang);
|
| 100 |
CyString GetTextName(int lang);
|
100 |
Utils::String GetTextName(int lang);
|
| 101 |
CyString GetTextDescription(int lang);
|
101 |
Utils::String GetTextDescription(int lang);
|
| 102 |
|
102 |
|
| 103 |
void SetLanguageText ( bool b ) { m_bLanguageText = b; m_bChanged = true; }
|
103 |
void SetLanguageText ( bool b ) { m_bLanguageText = b; m_bChanged = true; }
|
| 104 |
void SetExistingShip ( bool b ) { m_bExistingShip = b; m_bChanged = true; }
|
104 |
void SetExistingShip ( bool b ) { m_bExistingShip = b; m_bChanged = true; }
|
| 105 |
void SetOriginalDescription ( int i ) { m_iOrgDesc = i; m_bChanged = true; }
|
105 |
void SetOriginalDescription ( int i ) { m_iOrgDesc = i; m_bChanged = true; }
|
| 106 |
void SetShipID (const Utils::String &sId ) { m_sID = sId; m_bChanged = true; }
|
106 |
void SetShipID (const Utils::String &sId ) { m_sID = sId; m_bChanged = true; }
|
| Line 108... |
Line 108... |
| 108 |
|
108 |
|
| 109 |
void SetSceneFile ( C_File *f ) { m_pSceneFile = f; }
|
109 |
void SetSceneFile ( C_File *f ) { m_pSceneFile = f; }
|
| 110 |
void SetCockpitFile ( C_File *f ) { m_pCockpitFile = f; }
|
110 |
void SetCockpitFile ( C_File *f ) { m_pCockpitFile = f; }
|
| 111 |
|
111 |
|
| 112 |
void AddAnimation(CyStringList *list);
|
112 |
void AddAnimation(CyStringList *list);
|
| 113 |
void AddAnimation(CyString data) { m_lAnimations.PushBack(data, true); m_bChanged = true; }
|
113 |
void AddAnimation(const Utils::String &data) { m_lAnimations.PushBack(CyString(data), true); m_bChanged = true; }
|
| 114 |
void AddBodies(CyString data);
|
114 |
void AddBodies(const Utils::String &data);
|
| 115 |
void AddBody(CyString section, CyString data);
|
115 |
void AddBody(const Utils::String §ion, const Utils::String &data);
|
| 116 |
void AddCutData(CyString data) { m_lCutData.PushBack(data, true); m_bChanged = true; }
|
116 |
void AddCutData(const Utils::String &data) { m_lCutData.PushBack(CyString(data), true); m_bChanged = true; }
|
| 117 |
void AddText ( int id, CyString name, CyString desc );
|
117 |
void AddText(int id, const Utils::String &name, const Utils::String &desc );
|
| 118 |
void AddCockpit ( CyString cockpit, int game, int mask = -1, int index = -1 );
|
118 |
void AddCockpit(const Utils::String &cockpit, int game, int mask = -1, int index = -1 );
|
| 119 |
void NewCockpit ( CyString id, CyString scene, int mask );
|
119 |
void NewCockpit(const Utils::String &id, const Utils::String &scene, int mask );
|
| 120 |
void EditCockpit ( CyString id, CyString cockpit);
|
120 |
void EditCockpit(const Utils::String &id, const Utils::String &cockpit);
|
| 121 |
void EditCockpit(CyString id, CyString scene, int mask);
|
121 |
void EditCockpit(const Utils::String &id, const Utils::String &scene, int mask);
|
| 122 |
CyString GetCockpitData(CyString id);
|
122 |
Utils::String GetCockpitData(const Utils::String &id);
|
| 123 |
SCockpit *FindCockpit(CyString id);
|
123 |
SCockpit *FindCockpit(const Utils::String &id);
|
| 124 |
void AddDummy ( CyString section, CyString data );
|
124 |
void AddDummy(const Utils::String §ion, const Utils::String &data );
|
| 125 |
void AddComponent ( CyString section, CyString section2, CyString data );
|
125 |
void AddComponent(const Utils::String §ion, const Utils::String §ion2, const Utils::String &data );
|
| 126 |
void AddWeaponMask ( int game, int mask );
|
126 |
void AddWeaponMask(int game, int mask );
|
| 127 |
void AddMissileMask ( int game, int mask );
|
127 |
void AddMissileMask(int game, int mask );
|
| 128 |
void RemoveText(int id);
|
128 |
void RemoveText(int id);
|
| 129 |
void ClearText() { m_lText.MemoryClear(); m_bChanged = true; }
|
129 |
void ClearText() { m_lText.MemoryClear(); m_bChanged = true; }
|
| 130 |
|
130 |
|
| 131 |
void AddShipyard ( int s ) { m_iShipyard |= s; m_bChanged = true; }
|
131 |
void AddShipyard ( int s ) { m_iShipyard |= s; m_bChanged = true; }
|
| 132 |
void RemoveShipyard ( int s ) { m_iShipyard &= ~(s); m_bChanged = true; }
|
132 |
void RemoveShipyard ( int s ) { m_iShipyard &= ~(s); m_bChanged = true; }
|
| 133 |
void SetShipyard(int s, bool b) { if ( b ) AddShipyard(s); else RemoveShipyard(s); }
|
133 |
void SetShipyard(int s, bool b) { if ( b ) AddShipyard(s); else RemoveShipyard(s); }
|
| 134 |
void ToggleShipyard(int s) { if ( this->IsShipyard(s) ) RemoveShipyard(s); else AddShipyard(s); }
|
134 |
void ToggleShipyard(int s) { if ( this->IsShipyard(s) ) RemoveShipyard(s); else AddShipyard(s); }
|
| 135 |
|
135 |
|
| 136 |
bool RemoveCutData(CyString cut);
|
136 |
bool RemoveCutData(const Utils::String &cut);
|
| 137 |
bool RemoveCockpit(CyString cockpitid);
|
137 |
bool RemoveCockpit(const Utils::String &cockpitid);
|
| 138 |
bool RemoveComponent(CyString section1, CyString section2, CyString data);
|
138 |
bool RemoveComponent(const Utils::String §ion1, const Utils::String §ion2, const Utils::String &data);
|
| 139 |
bool RemoveDummy(CyString section, CyString data);
|
139 |
bool RemoveDummy(const Utils::String §ion, const Utils::String &data);
|
| 140 |
bool RemoveBodies(CyString body);
|
140 |
bool RemoveBodies(const Utils::String &body);
|
| 141 |
bool RemoveAnimation(CyString ani);
|
141 |
bool RemoveAnimation(const Utils::String &ani);
|
| 142 |
|
142 |
|
| 143 |
bool IsSigned() { return false; }
|
143 |
bool IsSigned() { return false; }
|
| 144 |
bool IsValid ();
|
144 |
bool IsValid ();
|
| 145 |
bool IsShipyard(int s) { return (m_iShipyard & s) ? true : false; }
|
145 |
bool IsShipyard(int s) { return (m_iShipyard & s) ? true : false; }
|
| 146 |
bool AnyShipyards() { return (m_iShipyard > 0) ? true : false; }
|
146 |
bool AnyShipyards() { return (m_iShipyard > 0) ? true : false; }
|
| Line 148... |
Line 148... |
| 148 |
virtual Utils::String CreateValuesLine () const;
|
148 |
virtual Utils::String CreateValuesLine () const;
|
| 149 |
virtual bool ParseValueLine(const Utils::String &line);
|
149 |
virtual bool ParseValueLine(const Utils::String &line);
|
| 150 |
|
150 |
|
| 151 |
virtual int GetType () { return TYPE_XSP; }
|
151 |
virtual int GetType () { return TYPE_XSP; }
|
| 152 |
|
152 |
|
| 153 |
CyString GetShipName(int lang);
|
153 |
Utils::String GetShipName(int lang);
|
| 154 |
bool ConvertOld(CyString file);
|
154 |
bool ConvertOld(const Utils::String &file);
|
| 155 |
|
155 |
|
| 156 |
CyStringList *GetAnimations() { return &m_lAnimations; }
|
156 |
CyStringList *GetAnimations() { return &m_lAnimations; }
|
| 157 |
CyStringList *GetCutData() { return &m_lCutData; }
|
157 |
CyStringList *GetCutData() { return &m_lCutData; }
|
| 158 |
CyStringList *GetBodies() { return &m_lBodies; }
|
158 |
CyStringList *GetBodies() { return &m_lBodies; }
|
| 159 |
CLinkList<SWeaponMask> *GetLaserMasks() { return &m_lWeaponMasks; }
|
159 |
CLinkList<SWeaponMask> *GetLaserMasks() { return &m_lWeaponMasks; }
|
| Line 174... |
Line 174... |
| 174 |
bool AnyCockpits() { return !m_lCockpit.empty(); }
|
174 |
bool AnyCockpits() { return !m_lCockpit.empty(); }
|
| 175 |
bool AnyCutData() { return !m_lCutData.Empty(); }
|
175 |
bool AnyCutData() { return !m_lCutData.Empty(); }
|
| 176 |
bool AnyBodies() { return !m_lBodies.Empty(); }
|
176 |
bool AnyBodies() { return !m_lBodies.Empty(); }
|
| 177 |
bool AnyAnimations() { return !m_lAnimations.Empty(); }
|
177 |
bool AnyAnimations() { return !m_lAnimations.Empty(); }
|
| 178 |
|
178 |
|
| 179 |
CyString GetShipClass();
|
179 |
Utils::String GetShipClass();
|
| 180 |
bool UpdateSigned(bool updateFiles) { m_bSigned = false; return false; }
|
180 |
bool UpdateSigned(bool updateFiles) { m_bSigned = false; return false; }
|
| 181 |
|
181 |
|
| 182 |
// ship extraction
|
182 |
// ship extraction
|
| 183 |
bool startExtractShip(CVirtualFileSystem *pVfs, const Utils::String &sId, CProgressInfo *pProgress);
|
183 |
bool startExtractShip(CVirtualFileSystem *pVfs, const Utils::String &sId, CProgressInfo *pProgress);
|
| 184 |
bool extractShip(CVirtualFileSystem *pVfs, const Utils::String &sId, CProgressInfo *progress);
|
184 |
bool extractShip(CVirtualFileSystem *pVfs, const Utils::String &sId, CProgressInfo *progress);
|
| Line 198... |
Line 198... |
| 198 |
//TODO: convert this
|
198 |
//TODO: convert this
|
| 199 |
void ExtractTexts(CCatFile *catFile, CCatFile *secondCatFile, int textId);
|
199 |
void ExtractTexts(CCatFile *catFile, CCatFile *secondCatFile, int textId);
|
| 200 |
|
200 |
|
| 201 |
bool GetTextureList(CyStringList *list, const unsigned char *olddata, size_t size);
|
201 |
bool GetTextureList(CyStringList *list, const unsigned char *olddata, size_t size);
|
| 202 |
bool AddTextFromFile(FILE *id, int textId = -1);
|
202 |
bool AddTextFromFile(FILE *id, int textId = -1);
|
| 203 |
bool AddTextFromFile(CyString file, int textId = -1);
|
203 |
bool AddTextFromFile(const Utils::String &file, int textId = -1);
|
| 204 |
bool ImportBodies(CyStringList *sceneModels, CyString filename);
|
204 |
bool ImportBodies(CyStringList *sceneModels, const Utils::String &filename);
|
| 205 |
bool ImportCockpits(CyString filename);
|
205 |
bool ImportCockpits(const Utils::String &filename);
|
| 206 |
CyString FormatShipData(CyStringList *cockpits, int *text, int game);
|
206 |
Utils::String FormatShipData(CyStringList *cockpits, int *text, int game);
|
| 207 |
|
207 |
|
| 208 |
virtual bool LoadPackageData(const Utils::String &sFfirst, const Utils::String &sRest);
|
208 |
virtual bool LoadPackageData(const Utils::String &sFfirst, const Utils::String &sRest);
|
| 209 |
virtual bool GeneratePackagerScript(bool wildcard, CyStringList *list, bool datafile = false);
|
209 |
virtual bool GeneratePackagerScript(bool wildcard, CyStringList *list, bool datafile = false);
|
| 210 |
|
210 |
|
| 211 |
protected:
|
211 |
protected:
|