Subversion Repositories spk

Rev

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

Rev 68 Rev 94
Line 47... Line 47...
47
 
47
 
48
		void parseCommandArguments(array<System::String ^> ^args);
48
		void parseCommandArguments(array<System::String ^> ^args);
49
 
49
 
50
		int GetHighestGame()
50
		int GetHighestGame()
51
		{
51
		{
52
			int highest = 1;
-
 
53
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
54
			{
-
 
55
				if ( gd->iGame > highest )
-
 
56
					highest = gd->iGame;
-
 
57
			}
-
 
58
			return highest;
52
			return _pGameDir->highestGame();
59
		}
53
		}
60
 
54
 
61
		void ModMerge()
55
		void ModMerge()
62
		{
56
		{
63
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
57
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
64
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
58
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
65
			merge->TopMost = true;
59
			merge->TopMost = true;
66
			if ( !m_pGameDir->empty() )
60
			if ( !_pGameDir->isEmpty() ) 
67
				merge->SetGameDir(-1, _US(m_pGameDir->Front()->Data()->dir));
61
				merge->SetGameDir(-1, _US(_pGameDir->first()));
68
			merge->ShowDialog(this);
62
			merge->ShowDialog(this);
69
		}
63
		}
70
 
64
 
71
		void ModDiffDialog()
65
		void ModDiffDialog()
72
		{
66
		{
73
			ModDiff ^diff = gcnew ModDiff(m_pGameDir, m_pPackages);
67
			ModDiff ^diff = gcnew ModDiff(_pGameDir, m_pPackages);
74
			diff->ShowDialog(this);
68
			diff->ShowDialog(this);
75
		}
69
		}
76
 
70
 
77
		void OpenArchive()
71
		void OpenArchive()
78
		{
72
		{
Line 90... Line 84...
90
				this->backgroundWorker1->RunWorkerAsync();
84
				this->backgroundWorker1->RunWorkerAsync();
91
				m_pWait->ShowDialog(this);
85
				m_pWait->ShowDialog(this);
92
			}
86
			}
93
		}
87
		}
94
 
88
 
95
		CyStringList *FindLasersList(int game)
-
 
96
		{
-
 
97
			// return the list
-
 
98
			if ( game < m_pLasers->size() )
-
 
99
			{
-
 
100
				if ( !m_pLasers->Get(game)->Empty() )
-
 
101
					return m_pLasers->Get(game);
-
 
102
			}
-
 
103
 
-
 
104
			// other wise create the list we need
-
 
105
			// first we need to create entries for the ones we are not using
-
 
106
			while ( m_pLasers->size() < game )
-
 
107
				m_pLasers->push_back(new CyStringList);
-
 
108
 
-
 
109
			CyStringList *list = new CyStringList;
-
 
110
			m_pLasers->push_back(list);
-
 
111
 
-
 
112
			return list;
-
 
113
		}
-
 
114
 
-
 
115
		CyStringList *GetLasers(int game)
-
 
116
		{
-
 
117
			CyStringList *list = FindLasersList(game);
-
 
118
			if ( !list ) return NULL;
-
 
119
 
-
 
120
			if ( list->Empty() )
-
 
121
			{
-
 
122
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
123
				{
-
 
124
					if ( gd->iGame != game )
-
 
125
						continue;
-
 
126
					int e = m_pPackages->ExtractGameFile("types\\TLaser.pck", m_pPackages->GetTempDirectory() + "/TLaser.txt", gd->dir);
-
 
127
					if ( e )
-
 
128
					{
-
 
129
						CFileIO File((e == -1) ? "TLaser.txt" : m_pPackages->GetTempDirectory() + "/TLaser.txt");
-
 
130
						CyStringList *lines = File.ReadLinesStr();
-
 
131
						if ( lines )
-
 
132
						{
-
 
133
							int itemsRemaining = -1;
-
 
134
							for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
135
							{
-
 
136
								str->str.RemoveChar('\r');
-
 
137
								str->str.RemoveChar(9);
-
 
138
								str->str.RemoveFirstSpace();
-
 
139
 
-
 
140
								if ( str->str.Empty() )
-
 
141
									continue;
-
 
142
								if ( str->str[0] == '/' )
-
 
143
									continue;
-
 
144
 
-
 
145
								if ( itemsRemaining == -1 )
-
 
146
									itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
147
								else
-
 
148
								{
-
 
149
									list->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
-
 
150
									--itemsRemaining;
-
 
151
								}
-
 
152
							}
-
 
153
 
-
 
154
							delete lines;
-
 
155
							return list;
-
 
156
						}
-
 
157
					}
-
 
158
				}
-
 
159
			}
-
 
160
 
-
 
161
			return list;
-
 
162
		}
-
 
163
 
-
 
164
		CyStringList *GetMissiles(int game)
-
 
165
		{
-
 
166
			// return the list
-
 
167
			if ( game < m_pMissiles->size() )
-
 
168
			{
-
 
169
				if ( !m_pMissiles->Get(game)->Empty() )
-
 
170
					return m_pMissiles->Get(game);
-
 
171
			}
-
 
172
 
-
 
173
			// other wise create the list we need
-
 
174
			// first we need to create entries for the ones we are not using
-
 
175
			while ( m_pMissiles->size() < game )
-
 
176
				m_pMissiles->push_back(new CyStringList);
-
 
177
 
-
 
178
			CyStringList *list = new CyStringList;
-
 
179
			m_pMissiles->push_back(list);
-
 
180
 
-
 
181
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
182
			{
-
 
183
				if ( gd->iGame != game )
-
 
184
					continue;
-
 
185
				int e = m_pPackages->ExtractGameFile("types\\TMissiles.pck", m_pPackages->GetTempDirectory() + "/TMissiles.txt", gd->dir);
-
 
186
				if ( e )
-
 
187
				{
-
 
188
					CFileIO File((e == -1) ? "TMissiles.txt" : m_pPackages->GetTempDirectory() + "/TMissiles.txt");
-
 
189
					CyStringList *lines = File.ReadLinesStr();
-
 
190
					if ( lines )
-
 
191
					{
-
 
192
						int itemsRemaining = -1;
-
 
193
						for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
194
						{
-
 
195
							str->str.RemoveChar('\r');
-
 
196
							str->str.RemoveChar(9);
-
 
197
							str->str.RemoveFirstSpace();
-
 
198
 
-
 
199
							if ( str->str.Empty() )
-
 
200
								continue;
-
 
201
							if ( str->str[0] == '/' )
-
 
202
								continue;
-
 
203
 
-
 
204
							if ( itemsRemaining == -1 )
-
 
205
								itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
206
							else
-
 
207
							{
-
 
208
								list->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
-
 
209
								--itemsRemaining;
-
 
210
							}
-
 
211
						}
-
 
212
 
-
 
213
						delete lines;
-
 
214
						return list;
-
 
215
					}
-
 
216
				}
-
 
217
			}
-
 
218
 
-
 
219
			return list;
-
 
220
		}
-
 
221
 
-
 
222
		CyStringList *GetShields()
-
 
223
		{
-
 
224
			if ( !m_pShields )
-
 
225
			{
-
 
226
				bool found = false;
-
 
227
				for ( int game = 2; game >= 0; game-- )
-
 
228
				{
-
 
229
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
230
					{
-
 
231
						if ( gd->iGame != game )
-
 
232
							continue;
-
 
233
						if ( m_pPackages->ExtractGameFile("types\\TShields.pck", m_pPackages->GetTempDirectory() + "/TShields.txt", gd->dir) )
-
 
234
						{
-
 
235
							if ( !m_pShields )
-
 
236
								m_pShields = new CyStringList;
-
 
237
 
-
 
238
							CFileIO File(m_pPackages->GetTempDirectory() + "/TShields.txt");
-
 
239
							CyStringList *lines = File.ReadLinesStr();
-
 
240
							if ( lines )
-
 
241
							{
-
 
242
								int itemsRemaining = -1;
-
 
243
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
244
								{
-
 
245
									str->str.RemoveChar('\r');
-
 
246
									str->str.RemoveChar(9);
-
 
247
									str->str.RemoveFirstSpace();
-
 
248
 
-
 
249
									if ( str->str.Empty() )
-
 
250
										continue;
-
 
251
									if ( str->str[0] == '/' )
-
 
252
										continue;
-
 
253
 
-
 
254
									if ( itemsRemaining == -1 )
-
 
255
										itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
256
									else
-
 
257
									{
-
 
258
										m_pShields->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
-
 
259
										--itemsRemaining;
-
 
260
									}
-
 
261
								}
-
 
262
 
-
 
263
								delete lines;
-
 
264
								found = true;
-
 
265
								break;
-
 
266
							}
-
 
267
						}
-
 
268
					}
-
 
269
 
-
 
270
					if ( found )
-
 
271
						break;
-
 
272
				}
-
 
273
			}
-
 
274
 
-
 
275
			return m_pShields;
-
 
276
		}
-
 
277
 
-
 
278
		CyStringList *GetCockpits(int game)
-
 
279
		{
-
 
280
			// return the list
-
 
281
			if ( game < m_pCockpits->size() )
-
 
282
			{
-
 
283
				if ( !m_pCockpits->Get(game)->Empty() )
-
 
284
					return m_pCockpits->Get(game);
-
 
285
			}
-
 
286
 
-
 
287
			// other wise create the list we need
-
 
288
			// first we need to create entries for the ones we are not using
-
 
289
			while ( m_pCockpits->size() < game )
-
 
290
				m_pCockpits->push_back(new CyStringList);
-
 
291
 
-
 
292
			CyStringList *list = new CyStringList;
-
 
293
			m_pCockpits->push_back(list);
-
 
294
 
-
 
295
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
296
			{
-
 
297
				if ( gd->iGame != game )
-
 
298
					continue;
-
 
299
				if ( m_pPackages->ExtractGameFile("types\\TCockpits.pck", m_pPackages->GetTempDirectory() + "/TCockpits.txt", gd->dir) )
-
 
300
				{
-
 
301
					CFileIO File(m_pPackages->GetTempDirectory() + "/TCockpits.txt");
-
 
302
					CyStringList *lines = File.ReadLinesStr();
-
 
303
					if ( lines )
-
 
304
					{
-
 
305
						int itemsRemaining = -1;
-
 
306
						for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
307
						{
-
 
308
							str->str.RemoveChar('\r');
-
 
309
							str->str.RemoveChar(9);
-
 
310
							str->str.RemoveFirstSpace();
-
 
311
 
-
 
312
							if ( str->str.Empty() )
-
 
313
								continue;
-
 
314
							if ( str->str[0] == '/' )
-
 
315
								continue;
-
 
316
 
-
 
317
							if ( itemsRemaining == -1 )
-
 
318
								itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
319
							else
-
 
320
							{
-
 
321
								list->PushBack(str->str, str->str.GetToken(";", 19, 19));
-
 
322
								--itemsRemaining;
-
 
323
							}
-
 
324
						}
-
 
325
 
-
 
326
						delete lines;
-
 
327
						File.remove();
-
 
328
						return list;
-
 
329
					}
-
 
330
					File.remove();
-
 
331
				}
-
 
332
			}
-
 
333
			return list;
-
 
334
		}
-
 
335
 
-
 
336
		CyStringList *GetComponentSections()
-
 
337
		{
-
 
338
			// need to load data
-
 
339
			if ( !m_pComponents )
-
 
340
			{
-
 
341
				bool found = false;
-
 
342
				for ( int game = 2; game >= 0; game-- )
-
 
343
				{
-
 
344
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
345
					{
-
 
346
						if ( gd->iGame != game )
-
 
347
							continue;
-
 
348
						if ( m_pPackages->ExtractGameFile("types\\Components.pck", m_pPackages->GetTempDirectory() + "/components.txt", gd->dir) )
-
 
349
						{
-
 
350
							if ( !m_pComponents )
-
 
351
								m_pComponents = new CyStringList;
-
 
352
							CFileIO File(m_pPackages->GetTempDirectory() + "/components.txt");
-
 
353
							CyStringList *lines = File.ReadLinesStr();
-
 
354
							if ( lines )
-
 
355
							{
-
 
356
								int sectionRemaining = 0;
-
 
357
								int itemsRemaining = 0;
-
 
358
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
359
								{
-
 
360
									str->str.RemoveChar('\r');
-
 
361
									str->str.RemoveChar(9);
-
 
362
									str->str.RemoveFirstSpace();
-
 
363
 
-
 
364
									if ( str->str.Empty() )
-
 
365
										continue;
-
 
366
									if ( str->str[0] == '/' )
-
 
367
										continue;
-
 
368
 
-
 
369
									if ( itemsRemaining )
-
 
370
										--itemsRemaining;
-
 
371
									else if ( !sectionRemaining )
-
 
372
									{
-
 
373
										sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
374
										CyString sec = str->str.GetToken(";", 1, 1);
-
 
375
										if ( !sec.Empty() )
-
 
376
											m_pComponents->PushBack(sec);
-
 
377
									}
-
 
378
									else if ( !itemsRemaining )
-
 
379
									{
-
 
380
										itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
381
										--sectionRemaining;
-
 
382
									}
-
 
383
								}
-
 
384
 
-
 
385
								delete lines;
-
 
386
								found = true;
-
 
387
								break;
-
 
388
							}
-
 
389
						}
-
 
390
					}
-
 
391
 
-
 
392
					if ( found )
-
 
393
						break;
-
 
394
				}
-
 
395
 
-
 
396
				// still empty
-
 
397
				if ( !m_pComponents )
-
 
398
					m_pComponents = new CyStringList;
-
 
399
				if ( m_pComponents->Empty() )
-
 
400
				{
-
 
401
					m_pComponents->PushBack("SCTYPE_LASER");
-
 
402
					m_pComponents->PushBack("SCTYPE_COCKPIT");
-
 
403
					m_pComponents->PushBack("SCTYPE_DOCKING");
-
 
404
				}
-
 
405
			}
-
 
406
			return m_pComponents;
-
 
407
		}
-
 
408
		
-
 
409
		CyStringList *GetDummySections()
-
 
410
		{
-
 
411
			if ( !m_pDummies )
-
 
412
			{
-
 
413
				bool found = false;
-
 
414
				for ( int game = 2; game >= 0; game-- )
-
 
415
				{
-
 
416
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
417
					{
-
 
418
						if ( gd->iGame != game )
-
 
419
							continue;
-
 
420
						if ( m_pPackages->ExtractGameFile("types\\Dummies.pck", m_pPackages->GetTempDirectory() + "/Dummies.txt", gd->dir) )
-
 
421
						{
-
 
422
							if ( !m_pDummies )
-
 
423
								m_pDummies = new CyStringList;
-
 
424
							CFileIO File(m_pPackages->GetTempDirectory() + "/Dummies.txt");
-
 
425
							CyStringList *lines = File.ReadLinesStr();
-
 
426
							if ( lines )
-
 
427
							{
-
 
428
								int sectionRemaining = 0;
-
 
429
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
430
								{
-
 
431
									str->str.RemoveChar('\r');
-
 
432
									str->str.RemoveChar(9);
-
 
433
									str->str.RemoveFirstSpace();
-
 
434
 
-
 
435
									if ( str->str.Empty() )
-
 
436
										continue;
-
 
437
									if ( str->str[0] == '/' )
-
 
438
										continue;
-
 
439
 
-
 
440
									if ( !sectionRemaining )
-
 
441
									{
-
 
442
										sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
443
										CyString sec = str->str.GetToken(";", 1, 1);
-
 
444
										if ( !sec.Empty() )
-
 
445
											m_pDummies->PushBack(sec);
-
 
446
									}
-
 
447
									else
-
 
448
										--sectionRemaining;
-
 
449
								}
-
 
450
 
-
 
451
								delete lines;
-
 
452
								found = true;
-
 
453
								break;
-
 
454
							}
-
 
455
						}
-
 
456
					}
-
 
457
 
-
 
458
					if ( found )
-
 
459
						break;
-
 
460
				}
-
 
461
				// still empty
-
 
462
				if ( !m_pDummies )
-
 
463
					m_pDummies = new CyStringList;
-
 
464
				if ( m_pDummies->Empty() )
-
 
465
				{
-
 
466
					m_pDummies->PushBack("SDTYPE_ANIMATED");
-
 
467
					m_pDummies->PushBack("SDTYPE_DOCK");
-
 
468
					m_pDummies->PushBack("SDTYPE_DOORWAY");
-
 
469
					m_pDummies->PushBack("SDTYPE_GUN");
-
 
470
					m_pDummies->PushBack("SDTYPE_CONNTECTION");
-
 
471
				}
-
 
472
			}
-
 
473
			return m_pDummies;
-
 
474
		}
-
 
475
 
-
 
476
		CyStringList *GetBodiesSections()
-
 
477
		{
-
 
478
			if ( !m_pBodies )
-
 
479
			{
-
 
480
				bool found = false;
-
 
481
				for ( int game = 2; game >= 0; game-- )
-
 
482
				{
-
 
483
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
484
					{
-
 
485
						if ( gd->iGame != game )
-
 
486
							continue;
-
 
487
						if ( m_pPackages->ExtractGameFile("types\\Bodies.pck", m_pPackages->GetTempDirectory() + "/Bodies.txt", gd->dir) )
-
 
488
						{
-
 
489
							if ( !m_pBodies )
-
 
490
								m_pBodies = new CyStringList;
-
 
491
							CFileIO File(m_pPackages->GetTempDirectory() + "/Bodies.txt");
-
 
492
							CyStringList *lines = File.ReadLinesStr();
-
 
493
							if ( lines )
-
 
494
							{
-
 
495
								int sectionRemaining = 0;
-
 
496
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
497
								{
-
 
498
									str->str.RemoveChar('\r');
-
 
499
									str->str.RemoveChar(9);
-
 
500
									str->str.RemoveFirstSpace();
-
 
501
 
-
 
502
									if ( str->str.Empty() )
-
 
503
										continue;
-
 
504
									if ( str->str[0] == '/' )
-
 
505
										continue;
-
 
506
 
-
 
507
									if ( !sectionRemaining )
-
 
508
									{
-
 
509
										sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
510
										CyString sec = str->str.GetToken(";", 1, 1);
-
 
511
										if ( !sec.Empty() )
-
 
512
											m_pBodies->PushBack(sec);
-
 
513
									}
-
 
514
									else
-
 
515
									{
-
 
516
										sectionRemaining -= (str->str.NumToken(";") - 1);
-
 
517
									}
-
 
518
								}
-
 
519
 
-
 
520
								delete lines;
-
 
521
								found = true;
-
 
522
								break;
-
 
523
							}
-
 
524
						}
-
 
525
					}
-
 
526
 
-
 
527
					if ( found )
-
 
528
						break;
-
 
529
				}
-
 
530
				// still empty
-
 
531
				if ( !m_pBodies )
-
 
532
					m_pBodies = new CyStringList;
-
 
533
				if ( m_pBodies->Empty() )
-
 
534
				{
-
 
535
					m_pBodies->PushBack("SBTYPE_2D");
-
 
536
					m_pBodies->PushBack("SBTYPE_FACECAMERA");
-
 
537
					m_pBodies->PushBack("SBTYPE_2D2");
-
 
538
					m_pBodies->PushBack("SBTYPE_2DY");
-
 
539
					m_pBodies->PushBack("SBTYPE_LOGO");
-
 
540
					m_pBodies->PushBack("SBTYPE_FC");
-
 
541
					m_pBodies->PushBack("SBTYPE_TURRET");
-
 
542
					m_pBodies->PushBack("SBTYPE_JET");
-
 
543
					m_pBodies->PushBack("SBTYPE_RADAR");
-
 
544
					m_pBodies->PushBack("SBTYPE_CONTAINER");
-
 
545
					m_pBodies->PushBack("SBTYPE_DISPLAY");
-
 
546
					m_pBodies->PushBack("SBTYPE_DOCKPOINT");
-
 
547
					m_pBodies->PushBack("SBTYPE_SMALLJET");
-
 
548
				}
-
 
549
			}
-
 
550
			return m_pBodies;
-
 
551
		}
-
 
552
 
-
 
553
		String ^ParseText(int game, String ^text)
89
		String ^ParseText(int game, String ^text)
554
		{
90
		{
555
			String ^t = text;
91
			String ^t = text;
556
 
92
 
557
			bool found = true;
93
			bool found = true;
Line 580... Line 116...
580
				}
116
				}
581
			}
117
			}
582
			return t;
118
			return t;
583
		}
119
		}
584
 
120
 
585
		SGameDir *findGameDir(int iGame)
121
		CGameDirectories *gameDirectories()
586
		{
122
		{
587
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
-
 
588
				if ( gd->iGame == iGame ) return gd;
123
			return _pGameDir;
589
			}
124
		}
590
 
125
 
591
			return NULL;
126
		void LoadText()
-
 
127
		{
-
 
128
			this->LoadText(false, false);
592
		}
129
		}
593
 
130
 
594
		String ^FindText(int game, int page, int id)
131
		String ^FindText(int game, int page, int id)
595
		{
132
		{
596
			this->LoadText(false, false);
133
			this->LoadText(false, false);
597
 
134
 
598
			String ^text;
-
 
599
			if ( game == -1 ) {
-
 
600
				for ( int game = (GAME_MAX - 1); game >= 0; game-- ) {
135
			Utils::String text = _pGameDir->findText(game, 44, page, id);
601
					SGameDir *gd = findGameDir(game - 1);
-
 
602
					if ( !gd ) continue;
136
			if ( !text.empty() ) {
603
					if ( gd->pVfs->textExists(44, page, id) ) {
-
 
604
						text = ParseText(game, SystemStringFromCyString(gd->pVfs->findText(44, page, id)));
-
 
605
						break;
-
 
606
					}
-
 
607
				}
-
 
608
			}
-
 
609
			else
-
 
610
			{
-
 
611
				SGameDir *gd = findGameDir(game);
137
				return ParseText(game, _US(text));
612
				if ( gd ) {
-
 
613
					if ( gd->pVfs->textExists(44, page, id) ) {
-
 
614
						text = ParseText(game, SystemStringFromCyString(gd->pVfs->findText(44, page, id)));
-
 
615
					}
-
 
616
				}
-
 
617
			}
138
			}
618
 
139
 
619
			return text;
140
			return nullptr;
620
		}
141
		}
621
 
142
 
622
		void UpdateStatus()
143
		void UpdateStatus()
623
		{
144
		{
624
			bool e = (this->tabControl1->HasChildren) ? true : false;
145
			bool e = (this->tabControl1->HasChildren) ? true : false;
Line 698... Line 219...
698
			{
219
			{
699
				delete components;
220
				delete components;
700
			}
221
			}
701
			delete m_pLoadedList;
222
			delete m_pLoadedList;
702
			delete m_pPackages;
223
			delete m_pPackages;
703
			m_pGameDir->MemoryClear();
-
 
704
			delete m_pGameDir;
-
 
705
 
-
 
706
			for ( CyStringList *list = m_pLasers->First(); list; list = m_pLasers->Next() )
-
 
707
				delete list;
-
 
708
			for ( CyStringList *list = m_pMissiles->First(); list; list = m_pMissiles->Next() )
-
 
709
				delete list;
-
 
710
			for ( CyStringList *list = m_pCockpits->First(); list; list = m_pCockpits->Next() )
-
 
711
				delete list;
-
 
712
			delete m_pLasers;
-
 
713
			delete m_pMissiles;
-
 
714
			delete m_pCockpits;
-
 
715
			if ( m_pShields )
-
 
716
				delete m_pShields;
-
 
717
			if ( m_pComponents )
-
 
718
				delete m_pComponents;
-
 
719
			if ( m_pDummies )
-
 
720
				delete m_pDummies;
-
 
721
			if ( m_pBodies )
-
 
722
				delete m_pBodies;
-
 
723
			delete m_settings;
224
			delete m_settings;
724
		}
225
		}
725
 
226
 
726
	protected: 
227
	protected: 
727
		bool			 m_bAutoClose;
228
		bool			 m_bAutoClose;
728
		int				 m_iLocX;
229
		int				 m_iLocX;
729
		int				 m_iLocY;
230
		int				 m_iLocY;
730
		CLinkList<CyStringList> *m_pLasers;
-
 
731
		CLinkList<CyStringList> *m_pMissiles;
-
 
732
		CLinkList<CyStringList> *m_pCockpits;
-
 
733
		CyStringList	*m_pShields;
-
 
734
		CyStringList	*m_pLoadedList;
231
		CyStringList	*m_pLoadedList;
735
		CPackages *m_pPackages;
232
		CPackages *m_pPackages;
736
		CLinkList<SGameDir>	*m_pGameDir;
233
		SPK::CGameDirectories	*_pGameDir;
737
		CyStringList	*m_pComponents;
-
 
738
		CyStringList	*m_pDummies;
-
 
739
		CyStringList	*m_pBodies;
-
 
-
 
234
 
740
		SSettings		*m_settings;
235
		SSettings		*m_settings;
741
		bool			 m_bTextLoaded;
236
		bool			 m_bTextLoaded;
742
		String			^m_sConvertFile;
237
		String			^m_sConvertFile;
743
		Waiting			^m_pWait;
238
		Waiting			^m_pWait;
744
		CBaseFile		*m_pConverted;
239
		CBaseFile		*m_pConverted;
Line 870... Line 365...
870
			}
365
			}
871
		}
366
		}
872
 
367
 
873
		void OpenOptionsMenu()
368
		void OpenOptionsMenu()
874
		{
369
		{
875
			 Options ^opt = gcnew Options(this->imageListGames, m_pGameDir, m_pPackages, m_settings);
370
			 Options ^opt = gcnew Options(this->imageListGames, _pGameDir, m_pPackages, m_settings);
876
			 if ( opt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
371
			 if ( opt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
877
			 {
372
			 {
878
				 m_settings->bGenerateUpdate = opt->GetGenerateUpdate();
373
				 m_settings->bGenerateUpdate = opt->GetGenerateUpdate();
879
			 }
374
			 }
880
 
375
 
Line 1661... Line 1156...
1661
			if ( this->WindowState == FormWindowState::Maximized )
1156
			if ( this->WindowState == FormWindowState::Maximized )
1662
				lines.PushBack("CreatorMax:");
1157
				lines.PushBack("CreatorMax:");
1663
 
1158
 
1664
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1159
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1665
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
1160
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
1666
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
1161
			_pGameDir->writeData(&lines);
1667
				lines.PushBack(CyString("GameDir:") + gd->dir + ";" + CyString::Number(gd->iGame) + " " + gd->name + ((gd->bLoad) ? ";1" : ";0"));
-
 
1668
			if ( m_settings->bGenerateUpdate )
1162
			if ( m_settings->bGenerateUpdate )
1669
				lines.PushBack("GenerateUpdate:");
1163
				lines.PushBack("GenerateUpdate:");
1670
 
1164
 
1671
			Config.WriteFile(&lines);
1165
			Config.WriteFile(&lines);
1672
		}
1166
		}
Line 1697... Line 1191...
1697
						else if ( start.Compare("CreatorMax") )
1191
						else if ( start.Compare("CreatorMax") )
1698
							this->WindowState = FormWindowState::Maximized;
1192
							this->WindowState = FormWindowState::Maximized;
1699
						else if ( start.Compare("GenerateUpdate") )
1193
						else if ( start.Compare("GenerateUpdate") )
1700
							m_settings->bGenerateUpdate = true;
1194
							m_settings->bGenerateUpdate = true;
1701
						else if ( start.Compare("GameDir") )
1195
						else if ( start.Compare("GameDir") )
1702
						{
-
 
1703
							SGameDir *gd = new SGameDir;
-
 
1704
							gd->dir = rest.GetToken(";", 1, 1).ToString();
-
 
1705
							gd->name = rest.GetToken(";", 2, 2).ToString();
-
 
1706
							gd->iGame = gd->name.token(" ", 1).toLong();
-
 
1707
							gd->name = gd->name.tokens(" ", 2);
-
 
1708
 
-
 
1709
							SGameExe *exe = m_pPackages->GetGameExe()->GetGame(gd->iGame);
-
 
1710
 
-
 
1711
							gd->bLoad = rest.GetToken(";", 3, 3).ToBool();
-
 
1712
							gd->pVfs = new CVirtualFileSystem();
-
 
1713
							gd->pVfs->setLanguage(44);
-
 
1714
							gd->pVfs->LoadFilesystem(gd->dir);
-
 
1715
							if ( exe ) {
-
 
1716
								gd->pVfs->SetAddon(exe->sAddon);
-
 
1717
							}
-
 
1718
							m_pGameDir->push_back(gd);
1196
							_pGameDir->parse(rest.ToString(), m_pPackages);
1719
						}
-
 
1720
					}
1197
					}
1721
 
1198
 
1722
					delete lines;
1199
					delete lines;
1723
				}
1200
				}
1724
			}
1201
			}
Line 1729... Line 1206...
1729
		{
1206
		{
1730
			if ( m_bTextLoaded && !reload )
1207
			if ( m_bTextLoaded && !reload )
1731
				return;
1208
				return;
1732
			m_bTextLoaded = true;
1209
			m_bTextLoaded = true;
1733
 
1210
 
1734
			if ( m_pGameDir->empty() )
1211
			if ( _pGameDir->isEmpty() ) return;
1735
				return;
-
 
1736
 
1212
 
1737
			Creator::LoadText ^load = gcnew Creator::LoadText(m_pGameDir, m_pPackages);
1213
			Creator::LoadText ^load = gcnew Creator::LoadText(_pGameDir, m_pPackages);
1738
			if ( center )
1214
			if ( center )
1739
				load->StartPosition = Windows::Forms::FormStartPosition::CenterScreen;
1215
				load->StartPosition = Windows::Forms::FormStartPosition::CenterScreen;
1740
			
1216
			
1741
			load->ShowDialog(this);
1217
			load->ShowDialog(this);
1742
		}
1218
		}