~ubuntu-branches/debian/sid/astromenace/sid

« back to all changes in this revision

Viewing changes to .pc/07_percent_sign_profile_input_fix.patch/AstroMenaceSource/Menu/Menu_Profile.cpp

  • Committer: Package Import Robot
  • Author(s): Boris Pek, 1
  • Date: 2013-12-19 15:37:09 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20131219153709-vs62lyk7ts7o3rf5
Tags: 1.3.2+repack-2
Add patch debian/patches/fix_work_on_intel_videocards.patch:
Mesa developers have enabled GL_ARB_texture_storage for all drivers [1], so
i915 and i965 drivers now claim the support of this OpenGL extension, but
texture storage feature does not actually work there.
.
[1] http://lists.freedesktop.org/archives/mesa-dev/2013-June/041188.html
.
This patch is just workaround to make the game work on intel videocards with
new Mesa. But real problem should be fixed in Mesa.
(Closes: #718680)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/************************************************************************************
2
 
 
3
 
        AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
4
 
        Copyright © 2006-2012 Michael Kurinnoy, Viewizard
5
 
 
6
 
 
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.
11
 
 
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.
16
 
 
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/>.
19
 
 
20
 
 
21
 
        Web Site: http://www.viewizard.com/
22
 
        Project: http://sourceforge.net/projects/openastromenace/
23
 
        E-mail: viewizard@viewizard.com
24
 
 
25
 
*************************************************************************************/
26
 
 
27
 
 
28
 
#include "../Game.h"
29
 
 
30
 
 
31
 
// вот тут храним самый важный номер! - номер текущего профайла!!!
32
 
int     CurrentProfile=-1;
33
 
 
34
 
 
35
 
char NewProfileName[128] = "";
36
 
int Pos = 0;
37
 
float LastProfileNameTime = 0.0f;
38
 
float CurrentProfileNameTransp = 0.9f;
39
 
int     SoundOnProfileID = -1;
40
 
 
41
 
int SoundTaping = 0;
42
 
 
43
 
 
44
 
 
45
 
//------------------------------------------------------------------------------------
46
 
// создание новой записи
47
 
//------------------------------------------------------------------------------------
48
 
void NewRecord()
49
 
{
50
 
        // заносим в новый профайл (последний)
51
 
        int ProfileNum = -1;
52
 
        for (int i=4; i>=0; i--)
53
 
                if (!Setup.Profile[i].Used) ProfileNum = i;
54
 
 
55
 
 
56
 
        // выводим диалог - все заняты!
57
 
        if (ProfileNum == -1)
58
 
        {
59
 
                SetCurrentDialogBox(1);
60
 
                return;
61
 
        }
62
 
 
63
 
        if (strlen(NewProfileName)<=0) return;
64
 
 
65
 
 
66
 
        // пишем данные в профайл
67
 
 
68
 
        Setup.Profile[ProfileNum].Used = true;
69
 
        strcpy(Setup.Profile[ProfileNum].Name, NewProfileName);
70
 
 
71
 
        Setup.Profile[ProfileNum].NPCWeaponPenalty = 3;
72
 
        Setup.Profile[ProfileNum].NPCArmorPenalty = 2;
73
 
        Setup.Profile[ProfileNum].NPCTargetingSpeedPenalty = 2;
74
 
        Setup.Profile[ProfileNum].LimitedAmmo = 0;
75
 
        Setup.Profile[ProfileNum].DestroyableWeapon = 1;
76
 
        Setup.Profile[ProfileNum].WeaponTargetingMode = 0;
77
 
        Setup.Profile[ProfileNum].SpaceShipControlMode = 1;
78
 
 
79
 
 
80
 
        Setup.Profile[ProfileNum].Ship = 1;
81
 
        Setup.Profile[ProfileNum].ShipHullUpgrade = 1;
82
 
        Setup.Profile[ProfileNum].ShipHullCurrentStrength = 30;
83
 
 
84
 
        // сброс настроек оружия
85
 
        for (int i=0; i<6; i++)
86
 
        {
87
 
                Setup.Profile[ProfileNum].Weapon[i] = 0;
88
 
                Setup.Profile[ProfileNum].WeaponAmmo[i] = 0;
89
 
                Setup.Profile[ProfileNum].WeaponControl[i] = 0;
90
 
                Setup.Profile[ProfileNum].WeaponAltControl[i] = 0;
91
 
                Setup.Profile[ProfileNum].WeaponAltControlData[i] = 0;
92
 
                Setup.Profile[ProfileNum].WeaponSlotYAngle[i] = 0.0f;
93
 
        }
94
 
        // ставим 2 орудия первоначально
95
 
 
96
 
 
97
 
        Setup.Profile[ProfileNum].Weapon[2] = 1;
98
 
        Setup.Profile[ProfileNum].WeaponAmmo[2] = 3000;
99
 
        Setup.Profile[ProfileNum].WeaponControl[2] = 1;
100
 
        Setup.Profile[ProfileNum].Weapon[3] = 1;
101
 
        Setup.Profile[ProfileNum].WeaponAmmo[3] = 3000;
102
 
        Setup.Profile[ProfileNum].WeaponControl[3] = 1;
103
 
        Setup.Profile[ProfileNum].Weapon[4] = 16;
104
 
        Setup.Profile[ProfileNum].WeaponAmmo[4] = 200;
105
 
        Setup.Profile[ProfileNum].WeaponControl[4] = 2;
106
 
 
107
 
        Setup.Profile[ProfileNum].EngineSystem = 1;
108
 
        Setup.Profile[ProfileNum].TargetingSystem = 1;
109
 
        Setup.Profile[ProfileNum].AdvancedProtectionSystem = 1;
110
 
        Setup.Profile[ProfileNum].PowerSystem = 1;
111
 
        Setup.Profile[ProfileNum].TargetingMechanicSystem = 1;
112
 
 
113
 
        Setup.Profile[ProfileNum].Difficulty = 50;
114
 
 
115
 
        Setup.Profile[ProfileNum].PrimaryWeaponFireMode = 2;
116
 
        Setup.Profile[ProfileNum].SecondaryWeaponFireMode = 1;
117
 
 
118
 
 
119
 
        Setup.Profile[ProfileNum].Money = 200;
120
 
        Setup.Profile[ProfileNum].Experience = 0;
121
 
 
122
 
        // сброс настроек
123
 
        for (int i=0; i<100; i++)
124
 
        {
125
 
                Setup.Profile[ProfileNum].ByMissionExperience[i] = 0;
126
 
                Setup.Profile[ProfileNum].MissionReplayCount[i] = 0;
127
 
        }
128
 
 
129
 
 
130
 
        Setup.Profile[ProfileNum].OpenLevelNum = 0;// 1;
131
 
 
132
 
 
133
 
        // подготавливаем, для новой записи
134
 
        Pos = 0;
135
 
        for(int i=0; i<128; i++)
136
 
                NewProfileName[i] = 0;
137
 
 
138
 
 
139
 
        CurrentProfile = ProfileNum;
140
 
        Setup.LastProfile = CurrentProfile;
141
 
        // сразу ставим первую миссию все равно выбирать не из чего
142
 
        CurrentMission = 0;
143
 
        Setup.Profile[CurrentProfile].LastMission = CurrentMission;
144
 
        // ставим первый лист миссий
145
 
        StartMission = 0;
146
 
        EndMission = 4;
147
 
 
148
 
}
149
 
 
150
 
 
151
 
 
152
 
 
153
 
//------------------------------------------------------------------------------------
154
 
// создание дубликата записи
155
 
//------------------------------------------------------------------------------------
156
 
void DuplicateRecord()
157
 
{
158
 
        // запоминаем номер профайла, с которого копировать
159
 
        int BaseProfileNum = CurrentProfile;
160
 
 
161
 
        // заносим в новый профайл (последний)
162
 
        int ProfileNum = -1;
163
 
        for (int i=4; i>=0; i--)
164
 
                if (!Setup.Profile[i].Used) ProfileNum = i;
165
 
 
166
 
        // выводим диалог - все заняты!
167
 
        if (ProfileNum == -1)
168
 
        {
169
 
                SetCurrentDialogBox(1);
170
 
                return;
171
 
        }
172
 
 
173
 
 
174
 
        // пишем данные в профайл (дублируем)
175
 
 
176
 
        Setup.Profile[ProfileNum].Used = true;
177
 
        strcpy(Setup.Profile[ProfileNum].Name, Setup.Profile[BaseProfileNum].Name);
178
 
 
179
 
        Setup.Profile[ProfileNum].NPCWeaponPenalty = Setup.Profile[BaseProfileNum].NPCWeaponPenalty;
180
 
        Setup.Profile[ProfileNum].NPCArmorPenalty = Setup.Profile[BaseProfileNum].NPCArmorPenalty;
181
 
        Setup.Profile[ProfileNum].NPCTargetingSpeedPenalty = Setup.Profile[BaseProfileNum].NPCTargetingSpeedPenalty;
182
 
        Setup.Profile[ProfileNum].LimitedAmmo = Setup.Profile[BaseProfileNum].LimitedAmmo;
183
 
        Setup.Profile[ProfileNum].DestroyableWeapon = Setup.Profile[BaseProfileNum].DestroyableWeapon;
184
 
        Setup.Profile[ProfileNum].WeaponTargetingMode = Setup.Profile[BaseProfileNum].WeaponTargetingMode;
185
 
        Setup.Profile[ProfileNum].SpaceShipControlMode = Setup.Profile[BaseProfileNum].SpaceShipControlMode;
186
 
 
187
 
 
188
 
        Setup.Profile[ProfileNum].Ship = Setup.Profile[BaseProfileNum].Ship;
189
 
        Setup.Profile[ProfileNum].ShipHullUpgrade = Setup.Profile[BaseProfileNum].ShipHullUpgrade;
190
 
        Setup.Profile[ProfileNum].ShipHullCurrentStrength = Setup.Profile[BaseProfileNum].ShipHullCurrentStrength;
191
 
 
192
 
        // сброс настроек оружия
193
 
        for (int i=0; i<6; i++)
194
 
        {
195
 
                Setup.Profile[ProfileNum].Weapon[i] = Setup.Profile[BaseProfileNum].Weapon[i];
196
 
                Setup.Profile[ProfileNum].WeaponAmmo[i] = Setup.Profile[BaseProfileNum].WeaponAmmo[i];
197
 
                Setup.Profile[ProfileNum].WeaponControl[i] = Setup.Profile[BaseProfileNum].WeaponControl[i];
198
 
                Setup.Profile[ProfileNum].WeaponAltControl[i] = Setup.Profile[BaseProfileNum].WeaponAltControl[i];
199
 
                Setup.Profile[ProfileNum].WeaponAltControlData[i] = Setup.Profile[BaseProfileNum].WeaponAltControlData[i];
200
 
                Setup.Profile[ProfileNum].WeaponSlotYAngle[i] = Setup.Profile[BaseProfileNum].WeaponSlotYAngle[i];
201
 
        }
202
 
 
203
 
 
204
 
        Setup.Profile[ProfileNum].EngineSystem = Setup.Profile[BaseProfileNum].EngineSystem;
205
 
        Setup.Profile[ProfileNum].TargetingSystem = Setup.Profile[BaseProfileNum].TargetingSystem;
206
 
        Setup.Profile[ProfileNum].AdvancedProtectionSystem = Setup.Profile[BaseProfileNum].AdvancedProtectionSystem;
207
 
        Setup.Profile[ProfileNum].PowerSystem = Setup.Profile[BaseProfileNum].PowerSystem;
208
 
        Setup.Profile[ProfileNum].TargetingMechanicSystem = Setup.Profile[BaseProfileNum].TargetingMechanicSystem;
209
 
 
210
 
        Setup.Profile[ProfileNum].Difficulty = Setup.Profile[BaseProfileNum].Difficulty;
211
 
 
212
 
        Setup.Profile[ProfileNum].PrimaryWeaponFireMode = Setup.Profile[BaseProfileNum].PrimaryWeaponFireMode;
213
 
        Setup.Profile[ProfileNum].SecondaryWeaponFireMode = Setup.Profile[BaseProfileNum].SecondaryWeaponFireMode;
214
 
 
215
 
 
216
 
        Setup.Profile[ProfileNum].Money = Setup.Profile[BaseProfileNum].Money;
217
 
        Setup.Profile[ProfileNum].Experience = Setup.Profile[BaseProfileNum].Experience;
218
 
 
219
 
        for (int i=0; i<100; i++)
220
 
        {
221
 
                Setup.Profile[ProfileNum].ByMissionExperience[i] = Setup.Profile[BaseProfileNum].ByMissionExperience[i];
222
 
                Setup.Profile[ProfileNum].MissionReplayCount[i] = Setup.Profile[BaseProfileNum].MissionReplayCount[i];
223
 
        }
224
 
 
225
 
 
226
 
        Setup.Profile[ProfileNum].OpenLevelNum = Setup.Profile[BaseProfileNum].OpenLevelNum;
227
 
        Setup.Profile[ProfileNum].LastMission = Setup.Profile[BaseProfileNum].LastMission;
228
 
 
229
 
 
230
 
 
231
 
        CurrentProfile = ProfileNum;
232
 
        Setup.LastProfile = CurrentProfile;
233
 
        CurrentMission = Setup.Profile[CurrentProfile].LastMission;
234
 
        // ставим нужный лист миссий
235
 
        StartMission = 0;
236
 
        EndMission = 4;
237
 
        if (CurrentMission != -1)
238
 
        while (!(StartMission<=CurrentMission && CurrentMission<=EndMission))
239
 
        {
240
 
                StartMission += 5;
241
 
                EndMission += 5;
242
 
        }
243
 
 
244
 
}
245
 
 
246
 
 
247
 
 
248
 
 
249
 
//------------------------------------------------------------------------------------
250
 
// удаление записи
251
 
//------------------------------------------------------------------------------------
252
 
void DeleteRecord()
253
 
{
254
 
        if (CurrentProfile == -1) return;
255
 
 
256
 
 
257
 
        // проверяем, входит в таблицу рекордов или нет
258
 
        if (Setup.Profile[CurrentProfile].Experience != 0)
259
 
                AddTopScores(Setup.Profile[CurrentProfile].Experience, Setup.Profile[CurrentProfile].Name, false);
260
 
 
261
 
 
262
 
 
263
 
        // если это последняя запись...
264
 
        if (CurrentProfile == 4)
265
 
        {
266
 
                Setup.Profile[CurrentProfile].Used = false;
267
 
                CurrentProfile -= 1;
268
 
                goto exit;
269
 
        }
270
 
        // если после этой записи - ничего нет... тоже просто удаляем
271
 
        if (!Setup.Profile[CurrentProfile+1].Used)
272
 
        {
273
 
                Setup.Profile[CurrentProfile].Used = false;
274
 
                CurrentProfile -= 1;
275
 
                goto exit;
276
 
        }
277
 
 
278
 
 
279
 
 
280
 
        for (int i=CurrentProfile; i<4; i++)
281
 
        {
282
 
                memcpy(Setup.Profile+i, Setup.Profile+i+1, sizeof(GameProfile));
283
 
                Setup.Profile[i+1].Used = false;
284
 
 
285
 
        }
286
 
 
287
 
 
288
 
exit:
289
 
 
290
 
        // проверяем, текущий номер
291
 
        if (CurrentProfile == -1)
292
 
        if (Setup.Profile[0].Used) CurrentProfile = 0;
293
 
        Setup.LastProfile = CurrentProfile;
294
 
 
295
 
}
296
 
 
297
 
 
298
 
 
299
 
 
300
 
 
301
 
 
302
 
 
303
 
 
304
 
 
305
 
 
306
 
//------------------------------------------------------------------------------------
307
 
// ввод названия
308
 
//------------------------------------------------------------------------------------
309
 
void ProfileInputText()
310
 
{
311
 
 
312
 
        // пишем букву, если можем
313
 
        if (Pos < 127)
314
 
        if (vw_FontSize(NewProfileName)< 540)
315
 
        if (vw_GetCurrentKeyUnicode()) // если тут не ноль, а юникод - значит нажали
316
 
        {
317
 
                Uint16 NewChar = vw_GetCurrentKeyUnicode();
318
 
                vw_SetCurrentKeyUnicode(0); // сразу сбрасываем данные
319
 
                // делаем простое преобразование, без учета суррогатной пары
320
 
                char* str = NewProfileName + Pos;
321
 
                if (NewChar <= 0x7F)
322
 
                {
323
 
                        *str = (char)NewChar;
324
 
                        Pos++;
325
 
                }
326
 
                else if (NewChar <= 0x7FF)
327
 
                {
328
 
                        *str++ = (char)(0xC0 | (NewChar >> 6));
329
 
                        *str = (char)(0x80 | (NewChar & 0x3F));
330
 
                        Pos+=2;
331
 
                }
332
 
                else
333
 
                {
334
 
                        *str++ = (char)(0xE0 | (NewChar >> 12));
335
 
                        *str++ = (char)(0x80 | ((NewChar >> 6) & 0x3F));
336
 
                        *str = (char)(0x80 | (NewChar & 0x3F));
337
 
                        Pos+=3;
338
 
                }
339
 
 
340
 
                if (vw_FindSoundByNum(SoundTaping) != 0)
341
 
                        vw_FindSoundByNum(SoundTaping)->Stop(0.0f);
342
 
 
343
 
                SoundTaping = Audio_PlaySound2D(4,1.0f);
344
 
 
345
 
                vw_SetCurrentKeyUnicode(0);
346
 
        }
347
 
 
348
 
 
349
 
 
350
 
        // проверяем, может спец-код
351
 
        if (vw_GetKeys(SDLK_BACKSPACE))
352
 
        if (Pos>0)
353
 
        {
354
 
                // кривое решение на "пока", перебираем в поисках предпоследнего символа
355
 
                const char *ReversePoint = NewProfileName;
356
 
                const char *ReversePointPrevious = 0;
357
 
                while (strlen(ReversePoint) > 0)
358
 
                {
359
 
                        unsigned CurrentChar;
360
 
                        ReversePointPrevious = ReversePoint;
361
 
                        ReversePoint = utf8_to_utf32(ReversePoint, &CurrentChar);
362
 
                }
363
 
                while (ReversePointPrevious != ReversePoint)
364
 
                {
365
 
                        NewProfileName[Pos] = 0;
366
 
                        Pos--;
367
 
                        ReversePointPrevious++;
368
 
                }
369
 
                NewProfileName[Pos] = 0;
370
 
 
371
 
                if (vw_FindSoundByNum(SoundTaping) != 0)
372
 
                        vw_FindSoundByNum(SoundTaping)->Stop(0.0f);
373
 
                SoundTaping = Audio_PlaySound2D(4,1.0f);
374
 
 
375
 
                vw_SetKeys(SDLK_BACKSPACE, false);
376
 
        }
377
 
 
378
 
        // ввод названия
379
 
        if (vw_GetKeys(SDLK_KP_ENTER) || vw_GetKeys(SDLK_RETURN))
380
 
        if (Pos>0)
381
 
        {
382
 
                NewRecord();
383
 
                //Audio_PlayMenuSound(4,1.0f);
384
 
                vw_SetKeys(SDLK_KP_ENTER, false);
385
 
                vw_SetKeys(SDLK_RETURN, false);
386
 
        }
387
 
 
388
 
 
389
 
 
390
 
        int X1 = Setup.iAspectRatioWidth/2 - 372;
391
 
        int Y1 = 230;
392
 
 
393
 
        // находим положения ввода
394
 
        int Size = vw_FontSize(NewProfileName);
395
 
        RECT SrcRest, DstRest;
396
 
        SetRect(&SrcRest,0,0,2,2);
397
 
        SetRect(&DstRest,X1+Size+2,Y1-2,X1+26+Size,Y1+24);
398
 
        vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/whitepoint.tga"),
399
 
                true, CurrentProfileNameTransp*MenuContentTransp);
400
 
 
401
 
        float DeltaTime = vw_GetTime() - LastProfileNameTime;
402
 
        LastProfileNameTime = vw_GetTime();
403
 
        CurrentProfileNameTransp -= 2.0f*DeltaTime;
404
 
        if (CurrentProfileNameTransp < 0.2f) CurrentProfileNameTransp = 0.9f;
405
 
 
406
 
}
407
 
 
408
 
 
409
 
 
410
 
 
411
 
 
412
 
 
413
 
 
414
 
 
415
 
 
416
 
 
417
 
 
418
 
 
419
 
 
420
 
 
421
 
 
422
 
 
423
 
 
424
 
//------------------------------------------------------------------------------------
425
 
// выбор текущего профайла
426
 
//------------------------------------------------------------------------------------
427
 
void ProfileMenu()
428
 
{
429
 
 
430
 
        RECT SrcRest, DstRest;
431
 
        SetRect(&SrcRest,2,2,863-2,484-2);
432
 
        SetRect(&DstRest,Setup.iAspectRatioWidth/2-427,175-15,Setup.iAspectRatioWidth/2-427+863-4,175-15+484-4);
433
 
        vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/panel800_444_back.tga"), true, 0.9f*MenuContentTransp);
434
 
 
435
 
 
436
 
        int X1 = Setup.iAspectRatioWidth/2 - 372;
437
 
        int Y1 = 200;
438
 
        int Prir1 = 24;
439
 
 
440
 
        // надпись
441
 
        vw_DrawFont(X1, Y1, 0, 0, 1.0f, 1.0f,0.5f,0.0f, MenuContentTransp, vw_GetText("3_New_Pilot_Profile"));
442
 
 
443
 
 
444
 
        Y1 += 30;
445
 
        SetRect(&SrcRest,0,0,2,2);
446
 
        SetRect(&DstRest,X1-2,Y1-6,X1+2+590,Y1-2+30);
447
 
        vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, 0.2f*MenuContentTransp);
448
 
        SetRect(&DstRest,X1,Y1-4,X1+590,Y1-4+30);
449
 
        vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, 0.5f*MenuContentTransp);
450
 
        // кнопка, создания новой записи
451
 
        bool Off = false;
452
 
        if (strlen(NewProfileName)<=0) Off = true;
453
 
        if (DrawButton128_2(X1+616, Y1-6, vw_GetText("1_Create"), MenuContentTransp, Off))
454
 
        {
455
 
                NewRecord();
456
 
        }
457
 
 
458
 
        // ввод текста
459
 
        if (!isDialogBoxDrawing())
460
 
        if (MenuContentTransp == 1.0f) ProfileInputText();
461
 
 
462
 
        vw_DrawFont(X1, Y1, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, NewProfileName);
463
 
 
464
 
        Y1 += Prir1;
465
 
 
466
 
 
467
 
 
468
 
 
469
 
 
470
 
 
471
 
 
472
 
        // список для выбора записи
473
 
        Y1 += Prir1;
474
 
        vw_DrawFont(X1, Y1, 0, 0, 1.0f, 1.0f,0.5f,0.0f, MenuContentTransp, vw_GetText("3_Pilots_Profiles"));
475
 
        int Size = vw_FontSize(vw_GetText("3_Money"));
476
 
        float WScale = 0;
477
 
        if (Size > 70)
478
 
        {
479
 
                Size = 70;
480
 
                WScale = -70;
481
 
        }
482
 
        int SizeI = Setup.iAspectRatioWidth/2+2 + (130 - Size)/2;
483
 
        vw_DrawFont(SizeI, Y1, WScale, 0, 1.0f, 1.0f,0.5f,0.0f, MenuContentTransp, vw_GetText("3_Money"));
484
 
 
485
 
        Size = vw_FontSize(vw_GetText("3_Experience"));
486
 
        WScale = 0;
487
 
        if (Size > 100)
488
 
        {
489
 
                Size = 100;
490
 
                WScale = -100;
491
 
        }
492
 
        SizeI = Setup.iAspectRatioWidth/2+132 + (130 - Size)/2;
493
 
        vw_DrawFont(SizeI, Y1, WScale, 0, 1.0f, 1.0f,0.5f,0.0f, MenuContentTransp, vw_GetText("3_Experience"));
494
 
 
495
 
        Size = vw_FontSize(vw_GetText("3_Difficulty"));
496
 
        WScale = 0;
497
 
        if (Size > 100)
498
 
        {
499
 
                Size = 100;
500
 
                WScale = -100;
501
 
        }
502
 
        SizeI = Setup.iAspectRatioWidth/2+262 + (130 - Size)/2;
503
 
        vw_DrawFont(SizeI, Y1, WScale, 0, 1.0f, 1.0f,0.5f,0.0f, MenuContentTransp, vw_GetText("3_Difficulty"));
504
 
 
505
 
 
506
 
        Y1 += 30;
507
 
        SetRect(&SrcRest,0,0,2,2);
508
 
        SetRect(&DstRest,X1-2,Y1-6,X1+2+750,Y1-2+230);
509
 
        vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, 0.2f*MenuContentTransp);
510
 
        SetRect(&DstRest,X1,Y1-4,X1+750,Y1-4+230);
511
 
        vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, 0.5f*MenuContentTransp);
512
 
        Y1 += 230;
513
 
 
514
 
 
515
 
 
516
 
        int TMPSoundOnProfileID = -1;
517
 
        int TmpY = Y1-230+8;
518
 
        for (int i=0; i<5; i++)
519
 
        {
520
 
                if (Setup.Profile[i].Used)
521
 
                {
522
 
                        vw_DrawFont(X1+10, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%i.",i+1);
523
 
 
524
 
                        if (vw_FontSize(Setup.Profile[i].Name) > 300)
525
 
                        {
526
 
                                vw_DrawFont(X1+50, TmpY, 0, 300, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, Setup.Profile[i].Name);
527
 
                                vw_DrawFont(X1+50+310, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "...");
528
 
                        }
529
 
                        else
530
 
                                vw_DrawFont(X1+50, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, Setup.Profile[i].Name);
531
 
 
532
 
 
533
 
                        int Size = vw_FontSize("%i", Setup.Profile[i].Money);
534
 
                        int SizeI = Setup.iAspectRatioWidth/2+2 + (130 - Size)/2;
535
 
                        vw_DrawFont(SizeI, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%i", Setup.Profile[i].Money);
536
 
                        Size = vw_FontSize("%i", Setup.Profile[i].Experience);
537
 
                        SizeI = Setup.iAspectRatioWidth/2+132 + (130 - Size)/2;
538
 
                        vw_DrawFont(SizeI, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%i", Setup.Profile[i].Experience);
539
 
                        Size = vw_FontSize("%i%%", Setup.Profile[i].Difficulty);
540
 
                        SizeI = Setup.iAspectRatioWidth/2+262 + (130 - Size)/2;
541
 
                        vw_DrawFont(SizeI, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%i%%", Setup.Profile[i].Difficulty);
542
 
 
543
 
 
544
 
                        // работаем с клавиатурой
545
 
                        if ((MenuContentTransp >= 0.99f) && !isDialogBoxDrawing()) CurrentActiveMenuElement++;
546
 
                        bool InFocusByKeyboard = false;
547
 
                        if (CurrentKeyboardSelectMenuElement > 0)
548
 
                        {
549
 
                                if (CurrentKeyboardSelectMenuElement == CurrentActiveMenuElement)
550
 
                                {
551
 
                                        InFocusByKeyboard = true;
552
 
                                }
553
 
                        }
554
 
 
555
 
                        // проверяем, если стоим над записью
556
 
                        SetRect(&SrcRest,0,0,2,2);
557
 
                        SetRect(&DstRest,X1,Y1-233+46*i,X1+750,Y1-234+46+46*i);
558
 
                        if (!isDialogBoxDrawing())
559
 
                        if (vw_OnRect(&DstRest) || InFocusByKeyboard)
560
 
                        {
561
 
                                TMPSoundOnProfileID = i;
562
 
                                CurrentCursorStatus = 1;
563
 
                                // если только встали - нужно звуком это показать
564
 
                                if (SoundOnProfileID != i)
565
 
                                {
566
 
                                        SoundOnProfileID = i;
567
 
                                        // если задействуем клавиатуру - неиграем тут звук
568
 
                                        if (CurrentKeyboardSelectMenuElement == 0) Audio_PlaySound2D(5,1.0f);
569
 
                                }
570
 
 
571
 
                                if (vw_GetWindowLBMouse(true) || (InFocusByKeyboard && (vw_GetKeys(SDLK_KP_ENTER) || vw_GetKeys(SDLK_RETURN))))
572
 
                                {
573
 
                                        // если другой - нужно сбросить миссию...
574
 
                                        if (CurrentProfile != i) CurrentMission = Setup.Profile[i].LastMission;
575
 
                                        CurrentProfile = i;
576
 
                                        Setup.LastProfile = CurrentProfile;
577
 
                                        // играем звук выбора
578
 
                                        Audio_PlaySound2D(6,1.0f);
579
 
                                        if (InFocusByKeyboard)
580
 
                                        {
581
 
                                                vw_SetKeys(SDLK_KP_ENTER, false);
582
 
                                                vw_SetKeys(SDLK_RETURN, false);
583
 
                                        }
584
 
                                }
585
 
 
586
 
                                if (CurrentProfile != i)
587
 
                                {
588
 
                                        // переход по 2-му клику
589
 
                                        if (vw_GetWindowLBDoubleMouse(true))
590
 
                                        {
591
 
                                                CurrentProfile = i;
592
 
                                                Setup.LastProfile = CurrentProfile;
593
 
                                                // если другой - нужно сбросить миссию...
594
 
                                                CurrentMission = Setup.Profile[CurrentProfile].LastMission;
595
 
                                                ComBuffer = MISSION;
596
 
                                        }
597
 
 
598
 
 
599
 
                                        SetRect(&DstRest,X1+2,Y1-233+46*i,X1+748,Y1-235+46+46*i);
600
 
                                        if (CurrentProfile != i)
601
 
                                                vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/whitepoint.tga"), true, 0.1f*MenuContentTransp);
602
 
                                }
603
 
                                else
604
 
                                {
605
 
                                        // переход по 2-му клику
606
 
                                        if (vw_GetWindowLBDoubleMouse(true))
607
 
                                        {
608
 
                                                ComBuffer = MISSION;
609
 
                                        }
610
 
                                }
611
 
                        }
612
 
 
613
 
                }
614
 
                else
615
 
                {
616
 
                        float transp = 0.3f;
617
 
                        vw_DrawFont(X1+10, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, transp*MenuContentTransp, "%i.",i+1);
618
 
                        vw_DrawFont(X1+50, TmpY, 0, 0, 1.0f, 1.0f,1.0f,1.0f, transp*MenuContentTransp, vw_GetText("3_empty"));
619
 
                }
620
 
 
621
 
                TmpY += 46;
622
 
        }
623
 
        // если не стоим над профайлами - нужно сбросить флаг
624
 
        if (TMPSoundOnProfileID == -1) SoundOnProfileID = -1;
625
 
 
626
 
 
627
 
        // подсветка выбранного...
628
 
        if (CurrentProfile != -1)
629
 
        {
630
 
                SetRect(&SrcRest,0,0,2,2);
631
 
                SetRect(&DstRest,X1+2,Y1-233+46*CurrentProfile,X1+748,Y1-235+46+46*CurrentProfile);
632
 
                vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/whitepoint.tga"), true, 0.1f*MenuContentTransp);
633
 
        }
634
 
 
635
 
 
636
 
 
637
 
 
638
 
 
639
 
 
640
 
 
641
 
 
642
 
        Y1 += Prir1;
643
 
 
644
 
 
645
 
        // кнопка создания дубликата
646
 
        Off = true;
647
 
        if (CurrentProfile >= 0) Off = false;
648
 
        if (DrawButton200_2(X1+6, Y1-6, vw_GetText("1_Duplicate"), MenuContentTransp, Off))
649
 
        {
650
 
                DuplicateRecord();
651
 
        }
652
 
 
653
 
        // кнопка удаления записи
654
 
        Off = true;
655
 
        if (CurrentProfile >= 0) Off = false;
656
 
        if (DrawButton128_2(X1+240, Y1-6, vw_GetText("1_Delete"), MenuContentTransp, Off))
657
 
        {
658
 
                SetCurrentDialogBox(2);
659
 
        }
660
 
 
661
 
 
662
 
        // кнопка установки сложности
663
 
        Off = true;
664
 
        if (CurrentProfile >= 0) Off = false;
665
 
        if (DrawButton200_2(X1+544, Y1-6, vw_GetText("1_Difficulty"), MenuContentTransp, Off))
666
 
        {
667
 
                ComBuffer = DIFFICULTY;
668
 
        }
669
 
 
670
 
 
671
 
 
672
 
        int X = Setup.iAspectRatioWidth/2 - 284;
673
 
        int Y = 165+100*5;
674
 
        if (DrawButton256(X,Y, vw_GetText("1_MAIN_MENU"), MenuContentTransp, &Button10Transp, &LastButton10UpdateTime))
675
 
        {
676
 
                ComBuffer = MAIN_MENU;
677
 
        }
678
 
        Off = true;
679
 
        if (CurrentProfile >= 0) Off = false;
680
 
        X = Setup.iAspectRatioWidth/2 + 28;
681
 
        if (DrawButton256(X,Y, vw_GetText("1_NEXT"), MenuContentTransp, &Button11Transp, &LastButton11UpdateTime, Off))
682
 
        {
683
 
                ComBuffer = MISSION;
684
 
        }
685
 
 
686
 
 
687
 
 
688
 
 
689
 
 
690
 
}