1
/************************************************************************************
3
AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
4
Copyright © 2006-2012 Michael Kurinnoy, Viewizard
7
AstroMenace is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
12
AstroMenace is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with AstroMenace. If not, see <http://www.gnu.org/licenses/>.
21
Web Site: http://www.viewizard.com/
22
Project: http://sourceforge.net/projects/openastromenace/
23
E-mail: viewizard@viewizard.com
25
*************************************************************************************/
33
//-----------------------------------------------------------------------------
34
// задаем базовые настройки
35
//-----------------------------------------------------------------------------
38
// базовые настройки, устанавливаем всегда - кто там знает, что в xml файле есть
39
// всегда устанавливаем текущее разрешение рабочего стола
41
// устанавливаем номер билда
42
Setup.BuildVersion = GAME_BUILD;
44
Setup.MenuLanguage = 1; // en by default
45
Setup.VoiceLanguage = 1; // en by default
51
Setup.fAspectRatioWidth = 1228.0f;
52
Setup.fAspectRatioHeight = 768.0f;
53
Setup.iAspectRatioWidth = 1228;
54
Setup.iAspectRatioHeight = 768;
56
Setup.CameraModeWithStandardAspectRatio = 0;
58
Setup.TextureFilteringMode = 2;
59
Setup.TexturesQuality = 3;
62
Setup.VisualEffectsQuality = 0;
63
Setup.AnisotropyLevel = 1;
64
Setup.TexturesCompression = 1;
65
Setup.UseGLSL = false;
67
Setup.MaxPointLights = 3;
69
Setup.Music_check = true;
72
Setup.Sound_check = true;
75
Setup.ShowFPS = false;
76
Setup.GameWeaponInfoType = 1;
77
Setup.GameSpeed = 1.5f;
78
Setup.LoadingHint = 0;
81
Setup.KeyboardDecreaseGameSpeed = SDLK_F5;
82
Setup.KeyboardResetGameSpeed = SDLK_F6;
83
Setup.KeyboardIncreaseGameSpeed = SDLK_F7;
84
Setup.KeyboardGameWeaponInfoType = SDLK_F8;
85
Setup.KeyboardPrimaryWeaponFireMode = SDLK_F9;
86
Setup.KeyboardSecondaryWeaponFireMode = SDLK_F10;
88
Setup.KeyBoardLeft = SDLK_LEFT;
89
Setup.KeyBoardRight = SDLK_RIGHT;
90
Setup.KeyBoardUp = SDLK_UP;
91
Setup.KeyBoardDown = SDLK_DOWN;
92
Setup.KeyBoardPrimary = SDLK_LCTRL;
93
Setup.KeyBoardSecondary = SDLK_SPACE;
94
Setup.MousePrimary = SDL_BUTTON_LEFT;
95
Setup.MouseSecondary = SDL_BUTTON_RIGHT;
96
Setup.JoystickPrimary = 0;
97
Setup.JoystickSecondary = 1;
98
Setup.JoystickNum = 0;
100
Setup.ControlSensivity = 5;
101
Setup.MouseControl = true;
102
Setup.LastProfile = -1;
103
Setup.MenuScript = 0;
106
strcpy(Setup.TopScores[0].Name, "Viewizard");
107
Setup.TopScores[0].Score = 100000;
108
strcpy(Setup.TopScores[1].Name, "Alex");
109
Setup.TopScores[1].Score = 90000;
110
strcpy(Setup.TopScores[2].Name, "Michael");
111
Setup.TopScores[2].Score = 80000;
112
strcpy(Setup.TopScores[3].Name, "Jeffrey");
113
Setup.TopScores[3].Score = 70000;
114
strcpy(Setup.TopScores[4].Name, "Christopher Hughson");
115
Setup.TopScores[4].Score = 60000;
116
strcpy(Setup.TopScores[5].Name, "Becky");
117
Setup.TopScores[5].Score = 40000;
118
strcpy(Setup.TopScores[6].Name, "Greg");
119
Setup.TopScores[6].Score = 20000;
120
strcpy(Setup.TopScores[7].Name, "Jay Coleman");
121
Setup.TopScores[7].Score = 10000;
122
strcpy(Setup.TopScores[8].Name, "Kelvin");
123
Setup.TopScores[8].Score = 5000;
124
strcpy(Setup.TopScores[9].Name, "Stephan Gregory");
125
Setup.TopScores[9].Score = 1000;
128
for(int i=0; i<5; i++)
129
Setup.Profile[i].Used = false;
131
// сбрасываем хинты в тру, чтобы показывать
132
for(int i=0; i<10; i++)
133
Setup.NeedShowHint[i] = true;
136
// всегда включен по умолчанию, если что железо само поймет что ему надо
137
Setup.VBOCoreMode = 1;
138
Setup.VAOCoreMode = 1;
139
Setup.FBOCoreMode = 1;
140
// по умолчанию всегда меньше 128 метров
141
Setup.EqualOrMore128MBVideoRAM = false;
142
// по умолчанию генерируем в видео карте (после иниц. окна поставим правильное), по крайней мере в виндовс немного быстрее
143
Setup.HardwareMipMapGeneration = true;
159
//-----------------------------------------------------------------------------
160
// записываем файл с настройками
161
//-----------------------------------------------------------------------------
162
void SaveXMLSetupFile()
164
cXMLDocument *XMLdoc = new cXMLDocument;
166
cXMLEntry *RootXMLEntry = XMLdoc->AddEntry(0, "AstroMenaceSettings");
168
XMLdoc->AddComment(RootXMLEntry, " AstroMenace game Settings ");
172
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "GAME_BUILD"), "value", GAME_BUILD);
173
switch (Setup.MenuLanguage)
175
case 1: XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MenuLanguage"), "value", "en"); break;
176
case 2: XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MenuLanguage"), "value", "de"); break;
177
case 3: XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MenuLanguage"), "value", "ru"); break;
179
switch (Setup.VoiceLanguage)
181
case 1: XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VoiceLanguage"), "value", "en"); break;
182
case 2: XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VoiceLanguage"), "value", "de"); break;
183
case 3: XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VoiceLanguage"), "value", "ru"); break;
185
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "FontNumber"), "value", Setup.FontNumber);
188
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "Width"), "value", Setup.Width);
189
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "Height"), "value", Setup.Height);
190
XMLdoc->AddComment(RootXMLEntry, " Windows (BPP = 0) or Full Screen (BPP = 16 or 32) ");
191
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "BPP"), "value", Setup.BPP);
192
XMLdoc->AddComment(RootXMLEntry, " Aspect Ratio must be 4:3 or 16:10 ");
193
if (Setup.iAspectRatioWidth == 1024)
194
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "AspectRatio"), "value", "4:3");
196
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "AspectRatio"), "value", "16:10");
197
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "CameraModeWithStandardAspectRatio"), "value", Setup.CameraModeWithStandardAspectRatio);
199
XMLdoc->AddComment(RootXMLEntry, " Don't change this setting unless you know what you are doing ");
200
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VBOCoreMode"), "value", Setup.VBOCoreMode);
201
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VAOCoreMode"), "value", Setup.VAOCoreMode);
202
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "FBOCoreMode"), "value", Setup.FBOCoreMode);
203
XMLdoc->AddComment(RootXMLEntry, " If your video card have 128+ MB VRAM on board - turn it on ");
204
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "EqualOrMore128MBVideoRAM"), "value", Setup.EqualOrMore128MBVideoRAM);
205
XMLdoc->AddComment(RootXMLEntry, " Don't change this setting unless you know what you are doing ");
206
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "HardwareMipMapGeneration"), "value", Setup.HardwareMipMapGeneration);
209
XMLdoc->AddComment(RootXMLEntry, " Common settings ");
210
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "TextureFilteringMode"), "value", Setup.TextureFilteringMode);
211
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "TexturesQuality"), "value", Setup.TexturesQuality);
212
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MSAA"), "value", Setup.MSAA);
213
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "CSAA"), "value", Setup.CSAA);
214
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VisualEffectsQuality"), "value", Setup.VisualEffectsQuality);
215
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "AnisotropyLevel"), "value", Setup.AnisotropyLevel);
216
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "TexturesCompression"), "value", Setup.TexturesCompression);
217
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "UseGLSL"), "value", Setup.UseGLSL);
218
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "ShadowMap"), "value", Setup.ShadowMap);
219
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MaxPointLights"), "value", Setup.MaxPointLights);
220
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MusicSw"), "value", Setup.MusicSw);
221
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "SoundSw"), "value", Setup.SoundSw);
222
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VoiceSw"), "value", Setup.VoiceSw);
223
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "VSync"), "value", Setup.VSync);
224
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "Brightness"), "value", Setup.Brightness);
225
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "ShowFPS"), "value", Setup.ShowFPS);
226
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "GameWeaponInfoType"), "value", Setup.GameWeaponInfoType);
227
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "GameSpeed"), "value", Setup.GameSpeed);
228
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "LoadingHint"), "value", Setup.LoadingHint);
231
XMLdoc->AddComment(RootXMLEntry, " Control settings ");
232
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyboardDecreaseGameSpeed"), "value", vw_KeyboardCodeName(Setup.KeyboardDecreaseGameSpeed));
233
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyboardResetGameSpeed"), "value", vw_KeyboardCodeName(Setup.KeyboardResetGameSpeed));
234
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyboardIncreaseGameSpeed"), "value", vw_KeyboardCodeName(Setup.KeyboardIncreaseGameSpeed));
235
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyboardGameWeaponInfoType"), "value", vw_KeyboardCodeName(Setup.KeyboardGameWeaponInfoType));
236
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyboardPrimaryWeaponFireMode"), "value", vw_KeyboardCodeName(Setup.KeyboardPrimaryWeaponFireMode));
237
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyboardSecondaryWeaponFireMode"), "value", vw_KeyboardCodeName(Setup.KeyboardSecondaryWeaponFireMode));
239
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyBoardLeft"), "value", vw_KeyboardCodeName(Setup.KeyBoardLeft));
240
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyBoardRight"), "value", vw_KeyboardCodeName(Setup.KeyBoardRight));
241
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyBoardUp"), "value", vw_KeyboardCodeName(Setup.KeyBoardUp));
242
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyBoardDown"), "value", vw_KeyboardCodeName(Setup.KeyBoardDown));
243
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyBoardPrimary"), "value", vw_KeyboardCodeName(Setup.KeyBoardPrimary));
244
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "KeyBoardSecondary"), "value", vw_KeyboardCodeName(Setup.KeyBoardSecondary));
245
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MousePrimary"), "value", Setup.MousePrimary);
246
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MouseSecondary"), "value", Setup.MouseSecondary);
247
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "JoystickPrimary"), "value", Setup.JoystickPrimary);
248
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "JoystickSecondary"), "value", Setup.JoystickSecondary);
249
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "JoystickNum"), "value", Setup.JoystickNum);
250
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "ControlSensivity"), "value", Setup.ControlSensivity);
251
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MouseControl"), "value", Setup.MouseControl);
252
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "LastProfile"), "value", Setup.LastProfile);
253
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, "MenuScript"), "value", Setup.MenuScript);
255
for(int i=0; i<10; i++)
258
sprintf(Name, "HintStatus%i", i+1);
259
XMLdoc->AddEntryAttribute(XMLdoc->AddEntry(RootXMLEntry, Name), "value", Setup.NeedShowHint[i]);
269
// упаковка таблицы рекордов
270
int TopScoresDataSize = sizeof(sTopScores)*10;
271
unsigned char *TopScoresData = new unsigned char[TopScoresDataSize];
272
memcpy(TopScoresData, Setup.TopScores, TopScoresDataSize);
274
// сразу архивируем Хаффманом
277
vw_DATAtoHAFF(&dstVFS, (BYTE *)TopScoresData, &dsizeVFS, TopScoresDataSize);
278
delete [] TopScoresData;
279
TopScoresDataSize = dsizeVFS;
280
TopScoresData = (unsigned char *)dstVFS;
282
unsigned char *TopScoresDataXORCode = new unsigned char[TopScoresDataSize*3];
283
char *TopScoresResultString = new char[TopScoresDataSize*4+1];
290
for (int i=0; i < TopScoresDataSize; i++)
293
k2 = TopScoresDataSize + i*2;
294
TopScoresDataXORCode[k1] = 97 + (unsigned char)vw_iRandNum(25);
295
TopScoresDataXORCode[k2] = 0;
296
TopScoresDataXORCode[k2+1] = TopScoresData[i]^TopScoresDataXORCode[k1];
297
// в первую - десятки, во вторую - еденицы
298
TopScoresDataXORCode[k2] = 97 + (unsigned char)(TopScoresDataXORCode[k2+1]/10.0f);
299
TopScoresDataXORCode[k2+1] = 97 + (TopScoresDataXORCode[k2+1] - (TopScoresDataXORCode[k2]-97)*10);
302
// чтобы разбить на блоки вставляем пробел
303
// тогда красиво отображаться будет (если врапинг выставлен в редакторе)
306
for (int i=0; i < TopScoresDataSize*3; i++)
308
TopScoresResultString[k] = TopScoresDataXORCode[i];
313
TopScoresResultString[k] = 0x20;
318
TopScoresResultString[k] = 0;
321
XMLdoc->AddEntryContent(XMLdoc->AddEntry(RootXMLEntry, "TopScores"), TopScoresResultString);
323
if (TopScoresResultString != 0) delete [] TopScoresResultString;
324
if (TopScoresData != 0) delete [] TopScoresData;
325
if (TopScoresDataXORCode != 0) delete [] TopScoresDataXORCode;
330
// упаковка профайлов
333
int ProfileDataSize = sizeof(GameProfile)*5;
334
unsigned char *ProfileData = new unsigned char[ProfileDataSize];
335
memcpy(ProfileData, Setup.Profile, ProfileDataSize);
337
// сразу архивируем Хаффманом
340
vw_DATAtoHAFF(&dstVFS, (BYTE *)ProfileData, &dsizeVFS, ProfileDataSize);
341
delete [] ProfileData;
342
ProfileDataSize = dsizeVFS;
343
ProfileData = (unsigned char *)dstVFS;
345
unsigned char *ProfileDataXORCode = new unsigned char[ProfileDataSize*3];
346
char *ResultString = new char[ProfileDataSize*4+1];
352
for (int i=0; i < ProfileDataSize; i++)
355
k2 = ProfileDataSize + i*2;
356
ProfileDataXORCode[k1] = 97 + (unsigned char)vw_iRandNum(25);
357
ProfileDataXORCode[k2] = 0;
358
ProfileDataXORCode[k2+1] = ProfileData[i]^ProfileDataXORCode[k1];
359
// в первую - десятки, во вторую - еденицы
360
ProfileDataXORCode[k2] = 97 + (unsigned char)(ProfileDataXORCode[k2+1]/10.0f);
361
ProfileDataXORCode[k2+1] = 97 + (ProfileDataXORCode[k2+1] - (ProfileDataXORCode[k2]-97)*10);
362
//fprintf(stderr, "--%i %i %i %i\n", ProfileDataXORCode[k], ProfileDataXORCode[k+1],ProfileDataXORCode[k+2],ProfileDataXORCode[k+3]);
366
// чтобы разбить на блоки вставляем пробел
367
// тогда красиво отображаться будет (если врапинг выставлен в редакторе)
370
for (int i=0; i < ProfileDataSize*3; i++)
372
ResultString[k] = ProfileDataXORCode[i];
377
ResultString[k] = 0x20;
384
XMLdoc->AddEntryContent(XMLdoc->AddEntry(RootXMLEntry, "PilotsProfiles"), ResultString);
386
if (ResultString != 0) delete [] ResultString;
387
if (ProfileData != 0) delete [] ProfileData;
388
if (ProfileDataXORCode != 0) delete [] ProfileDataXORCode;
394
XMLdoc->Save(DatFileName);
410
//-----------------------------------------------------------------------------
411
// считываем файл с настройками
412
//-----------------------------------------------------------------------------
413
bool LoadXMLSetupFile(bool NeedSafeMode)
415
cXMLDocument *XMLdoc = new cXMLDocument;
417
// устанавливаем базовые настройки
422
if (!XMLdoc->Load(DatFileName))
431
// берем первый элемент в скрипте
432
cXMLEntry *RootXMLEntry = XMLdoc->RootXMLEntry;
436
// дополнительная проверка на содержимое конфигурационного файла
437
if (RootXMLEntry == 0)
439
fprintf(stderr, "Game configuration file corrupted: %s\n", DatFileName);
440
// файл поврежден, надо завершить работу с ним
442
// сохранить дефолтные настройки, перезаписав файл
444
// и сказать игре что это "первый запуск"
447
if (strcmp("AstroMenaceSettings", RootXMLEntry->Name))
449
fprintf(stderr, "Game configuration file corrupted: %s\n", DatFileName);
450
// файл поврежден, надо завершить работу с ним
452
// сохранить дефолтные настройки, перезаписав файл
454
// и сказать игре что это "первый запуск"
461
// если установлен NeedSafeMode, не грузим часть данных
462
if (NeedSafeMode) goto LoadProfiles;
465
if (XMLdoc->FindEntryByName(RootXMLEntry, "MenuLanguage") != 0)
467
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MenuLanguage"), "value") != 0)
469
if (!strcmp(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MenuLanguage"), "value"), "en")) Setup.MenuLanguage = 1;
471
if (!strcmp(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MenuLanguage"), "value"), "de")) Setup.MenuLanguage = 2;
473
if (!strcmp(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MenuLanguage"), "value"), "ru")) Setup.MenuLanguage = 3;
476
if (XMLdoc->FindEntryByName(RootXMLEntry, "VoiceLanguage") != 0)
478
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VoiceLanguage"), "value") != 0)
480
if (!strcmp(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VoiceLanguage"), "value"), "en")) Setup.VoiceLanguage = 1;
482
if (!strcmp(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VoiceLanguage"), "value"), "de")) Setup.VoiceLanguage = 2;
484
if (!strcmp(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VoiceLanguage"), "value"), "ru")) Setup.VoiceLanguage = 3;
487
if (XMLdoc->FindEntryByName(RootXMLEntry, "FontNumber") != 0)
488
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "FontNumber"), "value") != 0)
489
Setup.FontNumber = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "FontNumber"), "value");
491
if (XMLdoc->FindEntryByName(RootXMLEntry, "Width") != 0)
492
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "Width"), "value") != 0)
493
Setup.Width = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "Width"), "value");
494
if (XMLdoc->FindEntryByName(RootXMLEntry, "Height") != 0)
495
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "Height"), "value") != 0)
496
Setup.Height = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "Height"), "value");
497
if (XMLdoc->FindEntryByName(RootXMLEntry, "BPP") != 0)
498
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "BPP"), "value") != 0)
499
Setup.BPP = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "BPP"), "value");
501
if (XMLdoc->FindEntryByName(RootXMLEntry, "AspectRatio") != 0)
503
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "AspectRatio"), "value") != 0)
505
if (!strcmp(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "AspectRatio"), "value"), "16:10"))
507
Setup.fAspectRatioWidth = 1228.0f;
508
Setup.fAspectRatioHeight = 768.0f;
509
Setup.iAspectRatioWidth = 1228;
510
Setup.iAspectRatioHeight = 768;
514
Setup.fAspectRatioWidth = 1024.0f;
515
Setup.fAspectRatioHeight = 768.0f;
516
Setup.iAspectRatioWidth = 1024;
517
Setup.iAspectRatioHeight = 768;
521
if (XMLdoc->FindEntryByName(RootXMLEntry, "CameraModeWithStandardAspectRatio") != 0)
522
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "CameraModeWithStandardAspectRatio"), "value") != 0)
523
Setup.CameraModeWithStandardAspectRatio = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "CameraModeWithStandardAspectRatio"), "value");
525
if (XMLdoc->FindEntryByName(RootXMLEntry, "VBOCoreMode") != 0)
526
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VBOCoreMode"), "value") != 0)
527
Setup.VBOCoreMode = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VBOCoreMode"), "value");
528
if (XMLdoc->FindEntryByName(RootXMLEntry, "VAOCoreMode") != 0)
529
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VAOCoreMode"), "value") != 0)
530
Setup.VAOCoreMode = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VAOCoreMode"), "value");
531
if (XMLdoc->FindEntryByName(RootXMLEntry, "FBOCoreMode") != 0)
532
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "FBOCoreMode"), "value") != 0)
533
Setup.FBOCoreMode = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "FBOCoreMode"), "value");
534
if (XMLdoc->FindEntryByName(RootXMLEntry, "EqualOrMore128MBVideoRAM") != 0)
535
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "EqualOrMore128MBVideoRAM"), "value") != 0)
536
Setup.EqualOrMore128MBVideoRAM = XMLdoc->bGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "EqualOrMore128MBVideoRAM"), "value");
537
if (XMLdoc->FindEntryByName(RootXMLEntry, "HardwareMipMapGeneration") != 0)
538
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "HardwareMipMapGeneration"), "value") != 0)
539
Setup.HardwareMipMapGeneration = XMLdoc->bGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "HardwareMipMapGeneration"), "value");
541
if (XMLdoc->FindEntryByName(RootXMLEntry, "TextureFilteringMode") != 0)
542
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "TextureFilteringMode"), "value") != 0)
543
Setup.TextureFilteringMode = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "TextureFilteringMode"), "value");
544
if (XMLdoc->FindEntryByName(RootXMLEntry, "TexturesQuality") != 0)
545
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "TexturesQuality"), "value") != 0)
546
Setup.TexturesQuality = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "TexturesQuality"), "value");
547
if (XMLdoc->FindEntryByName(RootXMLEntry, "MSAA") != 0)
548
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MSAA"), "value") != 0)
549
Setup.MSAA = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MSAA"), "value");
550
if (XMLdoc->FindEntryByName(RootXMLEntry, "CSAA") != 0)
551
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "CSAA"), "value") != 0)
552
Setup.CSAA = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "CSAA"), "value");
553
if (XMLdoc->FindEntryByName(RootXMLEntry, "VisualEffectsQuality") != 0)
554
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VisualEffectsQuality"), "value") != 0)
555
Setup.VisualEffectsQuality = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VisualEffectsQuality"), "value");
556
if (XMLdoc->FindEntryByName(RootXMLEntry, "AnisotropyLevel") != 0)
557
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "AnisotropyLevel"), "value") != 0)
558
Setup.AnisotropyLevel = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "AnisotropyLevel"), "value");
559
if (XMLdoc->FindEntryByName(RootXMLEntry, "TexturesCompression") != 0)
560
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "TexturesCompression"), "value") != 0)
561
Setup.TexturesCompression = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "TexturesCompression"), "value");
562
if (XMLdoc->FindEntryByName(RootXMLEntry, "UseGLSL") != 0)
563
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "UseGLSL"), "value") != 0)
564
Setup.UseGLSL = XMLdoc->bGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "UseGLSL"), "value");
565
if (XMLdoc->FindEntryByName(RootXMLEntry, "ShadowMap") != 0)
566
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "ShadowMap"), "value") != 0)
567
Setup.ShadowMap = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "ShadowMap"), "value");
568
if (XMLdoc->FindEntryByName(RootXMLEntry, "MaxPointLights") != 0)
569
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MaxPointLights"), "value") != 0)
570
Setup.MaxPointLights = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MaxPointLights"), "value");
571
if (XMLdoc->FindEntryByName(RootXMLEntry, "MusicSw") != 0)
572
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MusicSw"), "value") != 0)
573
Setup.MusicSw = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MusicSw"), "value");
574
if (XMLdoc->FindEntryByName(RootXMLEntry, "SoundSw") != 0)
575
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "SoundSw"), "value") != 0)
576
Setup.SoundSw = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "SoundSw"), "value");
577
if (XMLdoc->FindEntryByName(RootXMLEntry, "VoiceSw") != 0)
578
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VoiceSw"), "value") != 0)
579
Setup.VoiceSw = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VoiceSw"), "value");
580
if (XMLdoc->FindEntryByName(RootXMLEntry, "VSync") != 0)
581
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VSync"), "value") != 0)
582
Setup.VSync = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "VSync"), "value");
583
if (XMLdoc->FindEntryByName(RootXMLEntry, "Brightness") != 0)
584
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "Brightness"), "value") != 0)
585
Setup.Brightness = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "Brightness"), "value");
586
if (XMLdoc->FindEntryByName(RootXMLEntry, "ShowFPS") != 0)
587
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "ShowFPS"), "value") != 0)
588
Setup.ShowFPS = XMLdoc->bGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "ShowFPS"), "value");
589
if (XMLdoc->FindEntryByName(RootXMLEntry, "GameWeaponInfoType") != 0)
590
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "GameWeaponInfoType"), "value") != 0)
591
Setup.GameWeaponInfoType = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "GameWeaponInfoType"), "value");
592
if (XMLdoc->FindEntryByName(RootXMLEntry, "GameSpeed") != 0)
593
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "GameSpeed"), "value") != 0)
594
Setup.GameSpeed = XMLdoc->fGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "GameSpeed"), "value");
595
if (XMLdoc->FindEntryByName(RootXMLEntry, "LoadingHint") != 0)
596
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "LoadingHint"), "value") != 0)
597
Setup.LoadingHint = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "LoadingHint"), "value");
601
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardDecreaseGameSpeed") != 0)
602
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardDecreaseGameSpeed"), "value") != 0)
603
Setup.KeyboardDecreaseGameSpeed = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardDecreaseGameSpeed"), "value"));
604
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardResetGameSpeed") != 0)
605
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardResetGameSpeed"), "value") != 0)
606
Setup.KeyboardResetGameSpeed = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardResetGameSpeed"), "value"));
607
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardIncreaseGameSpeed") != 0)
608
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardIncreaseGameSpeed"), "value") != 0)
609
Setup.KeyboardIncreaseGameSpeed = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardIncreaseGameSpeed"), "value"));
610
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardGameWeaponInfoType") != 0)
611
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardGameWeaponInfoType"), "value") != 0)
612
Setup.KeyboardGameWeaponInfoType = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardGameWeaponInfoType"), "value"));
613
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardPrimaryWeaponFireMode") != 0)
614
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardPrimaryWeaponFireMode"), "value") != 0)
615
Setup.KeyboardPrimaryWeaponFireMode = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardPrimaryWeaponFireMode"), "value"));
616
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardSecondaryWeaponFireMode") != 0)
617
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardSecondaryWeaponFireMode"), "value") != 0)
618
Setup.KeyboardSecondaryWeaponFireMode = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyboardSecondaryWeaponFireMode"), "value"));
621
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardLeft") != 0)
622
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardLeft"), "value") != 0)
623
Setup.KeyBoardLeft = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardLeft"), "value"));
624
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardRight") != 0)
625
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardRight"), "value") != 0)
626
Setup.KeyBoardRight = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardRight"), "value"));
627
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardUp") != 0)
628
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardUp"), "value") != 0)
629
Setup.KeyBoardUp = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardUp"), "value"));
630
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardDown") != 0)
631
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardDown"), "value") != 0)
632
Setup.KeyBoardDown = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardDown"), "value"));
633
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardPrimary") != 0)
634
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardPrimary"), "value") != 0)
635
Setup.KeyBoardPrimary = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardPrimary"), "value"));
636
if (XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardSecondary") != 0)
637
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardSecondary"), "value") != 0)
638
Setup.KeyBoardSecondary = vw_KeyboardNameCode(XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "KeyBoardSecondary"), "value"));
640
if (XMLdoc->FindEntryByName(RootXMLEntry, "MousePrimary") != 0)
641
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MousePrimary"), "value") != 0)
642
Setup.MousePrimary = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MousePrimary"), "value");
643
if (XMLdoc->FindEntryByName(RootXMLEntry, "MouseSecondary") != 0)
644
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MouseSecondary"), "value") != 0)
645
Setup.MouseSecondary = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MouseSecondary"), "value");
646
if (XMLdoc->FindEntryByName(RootXMLEntry, "JoystickPrimary") != 0)
647
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "JoystickPrimary"), "value") != 0)
648
Setup.JoystickPrimary = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "JoystickPrimary"), "value");
649
if (XMLdoc->FindEntryByName(RootXMLEntry, "JoystickSecondary") != 0)
650
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "JoystickSecondary"), "value") != 0)
651
Setup.JoystickSecondary = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "JoystickSecondary"), "value");
652
if (XMLdoc->FindEntryByName(RootXMLEntry, "JoystickNum") != 0)
653
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "JoystickNum"), "value") != 0)
654
Setup.JoystickNum = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "JoystickNum"), "value");
655
if (XMLdoc->FindEntryByName(RootXMLEntry, "ControlSensivity") != 0)
656
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "ControlSensivity"), "value") != 0)
657
Setup.ControlSensivity = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "ControlSensivity"), "value");
658
if (XMLdoc->FindEntryByName(RootXMLEntry, "MouseControl") != 0)
659
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MouseControl"), "value") != 0)
660
Setup.MouseControl = XMLdoc->bGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MouseControl"), "value");
661
if (XMLdoc->FindEntryByName(RootXMLEntry, "LastProfile") != 0)
662
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "LastProfile"), "value") != 0)
663
Setup.LastProfile = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "LastProfile"), "value");
664
if (XMLdoc->FindEntryByName(RootXMLEntry, "MenuScript") != 0)
665
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MenuScript"), "value") != 0)
666
Setup.MenuScript = XMLdoc->iGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, "MenuScript"), "value");
669
for(int i=0; i<10; i++)
672
sprintf(Name, "HintStatus%i", i+1);
673
if (XMLdoc->FindEntryByName(RootXMLEntry, Name) != 0)
674
if (XMLdoc->GetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, Name), "value") != 0)
675
Setup.NeedShowHint[i] = XMLdoc->bGetEntryAttribute(XMLdoc->FindEntryByName(RootXMLEntry, Name), "value");
682
// заполняем таблицу рекордов
685
if ((XMLdoc->FindEntryByName(RootXMLEntry, "TopScores") != 0) && (XMLdoc->FindEntryByName(RootXMLEntry, "TopScores")->Content != 0))
688
int TopScoresDataSize = strlen(XMLdoc->FindEntryByName(RootXMLEntry, "TopScores")->Content);
689
unsigned char *TopScoresData = new unsigned char[TopScoresDataSize+1];
690
unsigned char *TopScoresDataXORCode = new unsigned char[TopScoresDataSize+1];
691
char *TopScoresResultString = new char[TopScoresDataSize+1];
693
strcpy(TopScoresResultString, XMLdoc->FindEntryByName(RootXMLEntry, "TopScores")->Content);
695
// первый цикл, восстанавливаем правильную последовательность, убираем все лишние элементы
697
for (int i=0; i<TopScoresDataSize; i++)
699
// берем только нужные символы
700
if (TopScoresResultString[i] >= 97 && TopScoresResultString[i] <= 97+26)
702
TopScoresDataXORCode[k] = TopScoresResultString[i];
706
// находим правильное значение, т.к. загружали использую длину строки (!!!)
707
TopScoresDataSize = k/3;
709
// второй цикл, восстанавливаем последовательность структуры
712
for (int i=0; i<TopScoresDataSize; i++)
715
k2 = TopScoresDataSize + i*2;
717
unsigned char XORhash = TopScoresDataXORCode[k1];
718
unsigned char XORdata = ((TopScoresDataXORCode[k2]-97)*10) + (TopScoresDataXORCode[k2+1]-97);
720
TopScoresData[i] = XORdata^XORhash;
723
// третий цикл, распаковка Хаффмана
726
vw_HAFFtoDATA(sizeof(sTopScores)*10, &dstVFS, (BYTE *)TopScoresData, &dsizeVFS, TopScoresDataSize);
727
delete [] TopScoresData;
728
TopScoresDataSize = dsizeVFS;
729
TopScoresData = (unsigned char *)dstVFS;
731
// переносим данные в структуру
732
memcpy(Setup.TopScores, TopScoresData, TopScoresDataSize);
734
if (TopScoresResultString != 0) delete [] TopScoresResultString;
735
if (TopScoresData != 0) delete [] TopScoresData;
736
if (TopScoresDataXORCode != 0) delete [] TopScoresDataXORCode;
746
// загрузка профайлов пилотов
749
if ((XMLdoc->FindEntryByName(RootXMLEntry, "PilotsProfiles") != 0) && (XMLdoc->FindEntryByName(RootXMLEntry, "PilotsProfiles")->Content != 0))
751
int ProfileDataSize = strlen(XMLdoc->FindEntryByName(RootXMLEntry, "PilotsProfiles")->Content);
752
unsigned char *ProfileData = new unsigned char[ProfileDataSize+1];
753
unsigned char *ProfileDataXORCode = new unsigned char[ProfileDataSize+1];
754
char *ResultString = new char[ProfileDataSize+1];
756
strcpy(ResultString, XMLdoc->FindEntryByName(RootXMLEntry, "PilotsProfiles")->Content);
758
// первый цикл, восстанавливаем правильную последовательность, убираем все лишние элементы
760
for (unsigned int i=0; i<strlen(ResultString); i++)
762
// берем только нужные символы
763
if (ResultString[i] >= 97 && ResultString[i] <= 97+26)
765
ProfileDataXORCode[k] = ResultString[i];
769
// находим правильное значение, т.к. загружали используя длину строки (!!!)
770
ProfileDataSize = k/3;
772
// второй цикл, восстанавливаем последовательность структуры
775
for (int i=0; i<ProfileDataSize; i++)
778
k2 = ProfileDataSize + i*2;
780
unsigned char XORhash = ProfileDataXORCode[k1];
781
unsigned char XORdata = ((ProfileDataXORCode[k2]-97)*10) + (ProfileDataXORCode[k2+1]-97);
783
ProfileData[i] = XORdata^XORhash;
786
// третий цикл, распаковка Хаффмана
789
vw_HAFFtoDATA(sizeof(GameProfile)*5, &dstVFS, (BYTE *)ProfileData, &dsizeVFS, ProfileDataSize);
790
delete [] ProfileData;
791
ProfileDataSize = dsizeVFS;
792
ProfileData = (unsigned char *)dstVFS;
794
// переносим данные в структуру
795
memcpy(Setup.Profile, ProfileData, ProfileDataSize);
797
if (ResultString != 0) delete [] ResultString;
798
if (ProfileData != 0) delete [] ProfileData;
799
if (ProfileDataXORCode != 0) delete [] ProfileDataXORCode;
809
// делаем изменения, проверки и т.п.
812
if (Setup.KeyBoardUp == 0) Setup.KeyBoardUp = SDLK_UP;
813
if (Setup.KeyBoardDown == 0) Setup.KeyBoardDown = SDLK_DOWN;
814
if (Setup.KeyBoardLeft == 0) Setup.KeyBoardLeft = SDLK_LEFT;
815
if (Setup.KeyBoardRight == 0) Setup.KeyBoardRight = SDLK_RIGHT;
816
if (Setup.KeyBoardPrimary == 0) Setup.KeyBoardPrimary = SDLK_LCTRL;
817
if (Setup.KeyBoardSecondary == 0) Setup.KeyBoardSecondary = SDLK_SPACE;
818
if (Setup.MousePrimary == 0) Setup.MousePrimary = SDL_BUTTON_LEFT;
819
if (Setup.MouseSecondary == 0) Setup.MouseSecondary = SDL_BUTTON_RIGHT;
820
if (Setup.JoystickPrimary == -1) Setup.JoystickPrimary = 0;
821
if (Setup.JoystickSecondary == -1) Setup.JoystickSecondary = 1;
823
CurrentProfile = Setup.LastProfile;
824
if (CurrentProfile != -1) CurrentMission = Setup.Profile[Setup.LastProfile].LastMission;