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

« back to all changes in this revision

Viewing changes to AstroMenaceSource/Menu/Menu.cpp

  • Committer: Package Import Robot
  • Author(s): Boris Pek
  • Date: 2013-04-09 02:04:25 UTC
  • Revision ID: package-import@ubuntu.com-20130409020425-a7fl9xk4diamw6di
Tags: upstream-1.3.1+repack
Import upstream version 1.3.1+repack

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
//------------------------------------------------------------------------------------
 
33
// переменные
 
34
//------------------------------------------------------------------------------------
 
35
 
 
36
eParticleSystem *psSpace = 0;
 
37
 
 
38
float LastMenuUpdateTime = 0.0f;
 
39
float MenuContentTransp = 0.0f;
 
40
float LastMenuOnOffUpdateTime = 0.0f;
 
41
float MenuBlackTransp = 0.0f;
 
42
bool NeedOnMenu = false;// если нужно выйти из черного
 
43
bool NeedOffMenu = false;// если нужно выйти из черного
 
44
bool NeedShowMenu = false;
 
45
bool NeedHideMenu = false;
 
46
eGameStatus NextMenu;
 
47
eGameStatus PrevMenu = MAIN_MENU;
 
48
 
 
49
float Button1Transp = 1.0f;
 
50
float LastButton1UpdateTime = 0.0f;
 
51
float Button2Transp = 1.0f;
 
52
float LastButton2UpdateTime = 0.0f;
 
53
float Button3Transp = 1.0f;
 
54
float LastButton3UpdateTime = 0.0f;
 
55
float Button4Transp = 1.0f;
 
56
float LastButton4UpdateTime = 0.0f;
 
57
float Button5Transp = 1.0f;
 
58
float LastButton5UpdateTime = 0.0f;
 
59
float Button6Transp = 1.0f;
 
60
float LastButton6UpdateTime = 0.0f;
 
61
float Button7Transp = 1.0f;
 
62
float LastButton7UpdateTime = 0.0f;
 
63
float Button8Transp = 1.0f;
 
64
float LastButton8UpdateTime = 0.0f;
 
65
float Button9Transp = 1.0f;
 
66
float LastButton9UpdateTime = 0.0f;
 
67
float Button10Transp = 1.0f;
 
68
float LastButton10UpdateTime = 0.0f;
 
69
float Button11Transp = 1.0f;
 
70
float LastButton11UpdateTime = 0.0f;
 
71
float Button12Transp = 1.0f;
 
72
float LastButton12UpdateTime = 0.0f;
 
73
float Button13Transp = 1.0f;
 
74
float LastButton13UpdateTime = 0.0f;
 
75
float Button14Transp = 1.0f;
 
76
float LastButton14UpdateTime = 0.0f;
 
77
 
 
78
 
 
79
// для прорисовки подложки с тайловой анимацией
 
80
extern float StarsTileUpdateTime;
 
81
extern float StarsTileUpdateTime2;
 
82
 
 
83
 
 
84
 
 
85
 
 
86
 
 
87
 
 
88
//------------------------------------------------------------------------------------
 
89
// инициализация меню
 
90
//------------------------------------------------------------------------------------
 
91
void InitMenu()
 
92
{
 
93
        CreateCursor();
 
94
 
 
95
        // установка курсора на центр
 
96
        // получаем размер клиентской области
 
97
        int W, H;
 
98
        vw_GetViewport(0, 0, &W, &H);
 
99
        float AWw = W*1.0f;
 
100
        float AHw = H*1.0f;
 
101
        float ARWidth;
 
102
        float ARHeight;
 
103
        vw_GetAspectWH(&ARWidth, &ARHeight);
 
104
        // установка мышки, чтобы не учитывать перемещения в меню
 
105
        SDL_WarpMouse((int)((512.0f+256.0f)/(ARWidth/AWw)), (int)(384.0f/(ARHeight/AHw)));
 
106
 
 
107
 
 
108
 
 
109
        Button1Transp = 1.0f;
 
110
        LastButton1UpdateTime = 0.0f;
 
111
        Button2Transp = 1.0f;
 
112
        LastButton2UpdateTime = 0.0f;
 
113
        Button3Transp = 1.0f;
 
114
        LastButton3UpdateTime = 0.0f;
 
115
        Button4Transp = 1.0f;
 
116
        LastButton4UpdateTime = 0.0f;
 
117
        Button5Transp = 1.0f;
 
118
        LastButton5UpdateTime = 0.0f;
 
119
        Button6Transp = 1.0f;
 
120
        LastButton6UpdateTime = 0.0f;
 
121
        Button7Transp = 1.0f;
 
122
        LastButton7UpdateTime = 0.0f;
 
123
        Button8Transp = 1.0f;
 
124
        LastButton8UpdateTime = 0.0f;
 
125
        Button9Transp = 1.0f;
 
126
        LastButton9UpdateTime = 0.0f;
 
127
        Button10Transp = 1.0f;
 
128
        LastButton10UpdateTime = 0.0f;
 
129
        Button11Transp = 1.0f;
 
130
        LastButton11UpdateTime = 0.0f;
 
131
        Button12Transp = 1.0f;
 
132
        LastButton12UpdateTime = 0.0f;
 
133
        Button13Transp = 1.0f;
 
134
        LastButton13UpdateTime = 0.0f;
 
135
        Button14Transp = 1.0f;
 
136
        LastButton14UpdateTime = 0.0f;
 
137
        LastMenuUpdateTime = 0.0f;
 
138
        MenuContentTransp = 0.0f;
 
139
 
 
140
 
 
141
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
142
        // иним камеру, всегда до работы со скриптом (!!!)
 
143
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
144
        vw_ResizeScene(45.0f, Setup.fAspectRatioWidth/Setup.fAspectRatioHeight, 1.0f, 2000.0f);
 
145
        InitGameCamera();
 
146
        vw_SetCameraLocation(VECTOR3D(-50,30,-50));
 
147
        vw_SetCameraMoveAroundPoint(VECTOR3D(0,0,0), 0.0f, VECTOR3D(0.0f, 0.0f, 0.0f));
 
148
 
 
149
 
 
150
        if (Script != 0){delete Script; Script = 0;}
 
151
        Script = new ScriptEngine;
 
152
 
 
153
        if (Setup.MenuScript > 2) Setup.MenuScript = 0;
 
154
        switch (Setup.MenuScript)
 
155
        {
 
156
                case 0: Script->RunScript("DATA/SCRIPT/menu1.xml", vw_GetTime()); break;
 
157
                case 1: Script->RunScript("DATA/SCRIPT/menu2.xml", vw_GetTime()); break;
 
158
                case 2: Script->RunScript("DATA/SCRIPT/menu3.xml", vw_GetTime()); break;
 
159
                // на всякий случай
 
160
                default: Script->RunScript("DATA/SCRIPT/menu1.xml", vw_GetTime()); break;
 
161
        }
 
162
        Setup.MenuScript ++;
 
163
 
 
164
        // немного прокручиваем скрипт
 
165
        float Time1 = vw_GetTime();
 
166
        Script->StartTime = Time1-30;
 
167
        Script->TimeLastOp = Time1-30;
 
168
        for (float i=Time1-30; i<Time1;i+=1.0f)
 
169
        {
 
170
                UpdateAllObject3D(i);
 
171
                Script->Update(i);
 
172
        }
 
173
        Script->StartTime = Time1;
 
174
        Script->TimeLastOp = Time1;
 
175
 
 
176
 
 
177
 
 
178
        // активные частицы космоса
 
179
        psSpace = 0;
 
180
        if (psSpace==0) psSpace = new eParticleSystem;
 
181
        psSpace->ColorStart.r = 0.80f;
 
182
        psSpace->ColorStart.g = 0.80f;
 
183
        psSpace->ColorStart.b = 1.00f;
 
184
        psSpace->ColorEnd.r = 0.70f;
 
185
        psSpace->ColorEnd.g = 0.70f;
 
186
        psSpace->ColorEnd.b = 1.00f;
 
187
        psSpace->AlphaStart = 1.00f;
 
188
        psSpace->AlphaEnd   = 0.00f;
 
189
        psSpace->SizeStart = 0.10f;
 
190
        psSpace->SizeVar = 0.05f;
 
191
        psSpace->SizeEnd = 0.30f;
 
192
        psSpace->Speed      = 4.00f;
 
193
        psSpace->SpeedVar   = 8.00f;
 
194
        psSpace->Theta      = 0.00f;
 
195
        psSpace->Life       = 10.00f;
 
196
        psSpace->LifeVar    = 0.00f;
 
197
        psSpace->CreationType = 1;
 
198
        psSpace->CreationSize = VECTOR3D(2.0f,50.0f,30.0f);
 
199
        psSpace->ParticlesPerSec = 140;
 
200
        psSpace->Texture[0] = vw_FindTextureByName("DATA/GFX/flare3.tga");
 
201
        psSpace->Direction = VECTOR3D(1.0f, 0.0f, 0.0f);
 
202
        psSpace->Resize = 0.1f;
 
203
        psSpace->SetStartLocation(VECTOR3D(-50,10,-20));
 
204
 
 
205
        // немного "прокручиваем", чтобы сразу по появлению было заполнено
 
206
        float Time = psSpace->TimeLastUpdate;
 
207
        for (float i=Time; i<Time+20;i+=1.0f)
 
208
        {
 
209
                psSpace->Update(i);
 
210
        }
 
211
        psSpace->TimeLastUpdate = Time;
 
212
 
 
213
 
 
214
        LastMenuUpdateTime = vw_GetTime();
 
215
        NeedShowMenu = true;
 
216
        NeedHideMenu = false;
 
217
        LastMenuOnOffUpdateTime = vw_GetTime();
 
218
        MenuBlackTransp = 1.0f;
 
219
        NeedOnMenu = true;
 
220
        // подстраховка, если не укажем меню, перейдем в основное
 
221
        GameStatus = MAIN_MENU;
 
222
 
 
223
        DrawGameCursor = true;
 
224
 
 
225
        StarsTileUpdateTime = vw_GetTime();
 
226
        StarsTileUpdateTime2 = vw_GetTime();
 
227
}
 
228
 
 
229
 
 
230
 
 
231
 
 
232
 
 
233
 
 
234
 
 
235
 
 
236
 
 
237
//------------------------------------------------------------------------------------
 
238
// установка меню
 
239
//------------------------------------------------------------------------------------
 
240
void SetMenu(eGameStatus Menu)
 
241
{
 
242
        Audio_PlaySound2D(3,1.0f);
 
243
 
 
244
        switch (Menu)
 
245
        {
 
246
                case INTERFACE:
 
247
                        Options_FontNumber = Setup.FontNumber;
 
248
                        break;
 
249
 
 
250
 
 
251
                case OPTIONS:
 
252
                        Options_Width = Setup.Width;
 
253
                        Options_Height = Setup.Height;
 
254
                        Options_BPP = Setup.BPP;
 
255
                        Options_VSync = Setup.VSync;
 
256
                        Options_iAspectRatioWidth = Setup.iAspectRatioWidth;
 
257
                        break;
 
258
 
 
259
                case OPTIONS_ADVANCED:
 
260
                        Options_TexturesCompression = Setup.TexturesCompression;
 
261
                        Options_UseGLSL = Setup.UseGLSL;
 
262
                        Options_MSAA = Setup.MSAA;
 
263
                        Options_CSAA = Setup.CSAA;
 
264
                        Options_TexturesQuality = Setup.TexturesQuality;
 
265
                        Options_ShadowMap = Setup.ShadowMap;
 
266
                        break;
 
267
 
 
268
                case CONFCONTROL:
 
269
                        if (Setup.KeyBoardUp == 0) Setup.KeyBoardUp = SDLK_UP;
 
270
                        if (Setup.KeyBoardDown == 0) Setup.KeyBoardDown = SDLK_DOWN;
 
271
                        if (Setup.KeyBoardLeft == 0) Setup.KeyBoardLeft = SDLK_LEFT;
 
272
                        if (Setup.KeyBoardRight == 0) Setup.KeyBoardRight = SDLK_RIGHT;
 
273
                        if (Setup.KeyBoardPrimary == 0) Setup.KeyBoardPrimary = SDLK_LCTRL;
 
274
                        if (Setup.KeyBoardSecondary == 0) Setup.KeyBoardSecondary = SDLK_SPACE;
 
275
                        if (Setup.MousePrimary == 0) Setup.MousePrimary = SDL_BUTTON_LEFT;
 
276
                        if (Setup.MouseSecondary == 0) Setup.MouseSecondary = SDL_BUTTON_RIGHT;
 
277
                        if (Setup.JoystickPrimary == -1) Setup.JoystickPrimary = 0;
 
278
                        if (Setup.JoystickSecondary == -1) Setup.JoystickSecondary = 1;
 
279
                        break;
 
280
 
 
281
                case TOP_SCORES:
 
282
                        // копируем исходные данные
 
283
                        for (int i=0; i<10; i++)
 
284
                        {
 
285
                                strcpy(GameName[i], Setup.TopScores[i].Name);
 
286
                                GameScore[i] = Setup.TopScores[i].Score;
 
287
                        }
 
288
 
 
289
                        // проверяем профайлы
 
290
                        for (int j=0; j<5; j++)
 
291
                        if (Setup.Profile[j].Used)
 
292
                        {
 
293
                                AddTopScores(Setup.Profile[j].Experience, Setup.Profile[j].Name, true);
 
294
                        }
 
295
                        break;
 
296
 
 
297
                case MISSION:
 
298
                        // ставим нужный лист миссий
 
299
                        StartMission = 0;
 
300
                        EndMission = 4;
 
301
                        if (CurrentMission != -1)
 
302
                        while (!(StartMission<=CurrentMission && CurrentMission<=EndMission))
 
303
                        {
 
304
                                StartMission += 5;
 
305
                                EndMission += 5;
 
306
                        }
 
307
                        break;
 
308
 
 
309
                case CREDITS:
 
310
                        CreditsCurrentPos = 0.0f;
 
311
                        LastCreditsCurrentPosUpdateTime = vw_GetTime();
 
312
                        break;
 
313
 
 
314
                default:
 
315
                        break;
 
316
 
 
317
        }
 
318
 
 
319
        NextMenu = Menu;
 
320
 
 
321
        // прячем текущее меню
 
322
        NeedShowMenu = false;
 
323
        NeedHideMenu = true;
 
324
        LastMenuUpdateTime = vw_GetTime();
 
325
 
 
326
 
 
327
 
 
328
}
 
329
 
 
330
 
 
331
 
 
332
void SetMenu2(eGameStatus Menu)
 
333
{
 
334
 
 
335
        switch (Menu)
 
336
        {
 
337
                case INFORMATION:
 
338
                        CreateInfoObject();
 
339
                        break;
 
340
                default:
 
341
                        break;
 
342
        }
 
343
 
 
344
 
 
345
        switch (GameStatus)
 
346
        {
 
347
                case INFORMATION:
 
348
                        CreateNum = 1;
 
349
                        break;
 
350
                case WORKSHOP:
 
351
                        WorkshopDestroyData();
 
352
                        VoiceNeedMoreEnergy = 0;
 
353
                        VoiceAmmoOut = 0;
 
354
                        break;
 
355
                case MISSION:
 
356
                        // ставим нужный лист миссий
 
357
                        StartMission = 0;
 
358
                        EndMission = 4;
 
359
                        if (CurrentMission != -1)
 
360
                        while (!(StartMission<=CurrentMission && CurrentMission<=EndMission))
 
361
                        {
 
362
                                StartMission += 5;
 
363
                                EndMission += 5;
 
364
                        }
 
365
                        break;
 
366
                default:
 
367
                        break;
 
368
        }
 
369
 
 
370
 
 
371
 
 
372
        PrevMenu = GameStatus;
 
373
        GameStatus = Menu;
 
374
 
 
375
        float Time = vw_GetTime();
 
376
        Button1Transp = 1.0f;
 
377
        LastButton1UpdateTime = Time;
 
378
        Button2Transp = 1.0f;
 
379
        LastButton2UpdateTime = Time;
 
380
        Button3Transp = 1.0f;
 
381
        LastButton3UpdateTime = Time;
 
382
        Button4Transp = 1.0f;
 
383
        LastButton4UpdateTime = Time;
 
384
        Button5Transp = 1.0f;
 
385
        LastButton5UpdateTime = Time;
 
386
        Button6Transp = 1.0f;
 
387
        LastButton6UpdateTime = Time;
 
388
        Button7Transp = 1.0f;
 
389
        LastButton7UpdateTime = Time;
 
390
        Button8Transp = 1.0f;
 
391
        LastButton8UpdateTime = Time;
 
392
        Button9Transp = 1.0f;
 
393
        LastButton9UpdateTime = Time;
 
394
        Button10Transp = 1.0f;
 
395
        LastButton10UpdateTime = Time;
 
396
        Button11Transp = 1.0f;
 
397
        LastButton11UpdateTime = Time;
 
398
        Button12Transp = 1.0f;
 
399
        LastButton12UpdateTime = Time;
 
400
        Button13Transp = 1.0f;
 
401
        LastButton13UpdateTime = Time;
 
402
        Button14Transp = 1.0f;
 
403
        LastButton14UpdateTime = Time;
 
404
}
 
405
 
 
406
 
 
407
 
 
408
 
 
409
 
 
410
 
 
411
//------------------------------------------------------------------------------------
 
412
// прорисовка меню
 
413
//------------------------------------------------------------------------------------
 
414
void DrawMenu()
 
415
{
 
416
 
 
417
        // делаем плавное появление меню
 
418
        if (NeedShowMenu)
 
419
        {
 
420
                MenuContentTransp = 2.4f*(vw_GetTime()-LastMenuUpdateTime);
 
421
                if (MenuContentTransp >= 1.0f)
 
422
                {
 
423
                        MenuContentTransp = 1.0f;
 
424
                        NeedShowMenu = false;
 
425
                        LastMenuUpdateTime = vw_GetTime();
 
426
 
 
427
                        // выводим подсказку, если нужно
 
428
                        if (GameStatus == PROFILE)
 
429
                                if (Setup.NeedShowHint[0]) SetCurrentDialogBox(9);
 
430
                        if (GameStatus == WORKSHOP)
 
431
                        {
 
432
                                if (CurrentWorkshop == 1)
 
433
                                        if (Setup.NeedShowHint[1]) SetCurrentDialogBox(10);
 
434
                                if (CurrentWorkshop == 2)
 
435
                                        if (Setup.NeedShowHint[2]) SetCurrentDialogBox(11);
 
436
                                if (CurrentWorkshop == 3)
 
437
                                        if (Setup.NeedShowHint[3]) SetCurrentDialogBox(12);
 
438
                        }
 
439
                        if (GameStatus == MISSION)
 
440
                        {
 
441
                                // проверяем, если в одном из профайлов уже открыли 3 миссии - выводим хинт с пожертвованием
 
442
                                bool NeedShowDonate = false;
 
443
                                for (int i=0; i<5; i++)
 
444
                                {
 
445
                                        if (Setup.Profile[i].Used)
 
446
                                                if (Setup.Profile[i].ByMissionExperience[2] > 0) NeedShowDonate = true;
 
447
                                }
 
448
 
 
449
                                if (NeedShowDonate)
 
450
                                        if (Setup.NeedShowHint[6]) SetCurrentDialogBox(15);
 
451
                        }
 
452
 
 
453
                }
 
454
        }
 
455
 
 
456
        // делаем полавное угасание меню
 
457
        if (NeedHideMenu)
 
458
        {
 
459
                MenuContentTransp = 1.0f - 2.4f*(vw_GetTime() - LastMenuUpdateTime);
 
460
                if (MenuContentTransp <= 0.0f)
 
461
                {
 
462
                        MenuContentTransp = 0.0f;
 
463
                        SetMenu2(NextMenu);
 
464
                        LastMenuUpdateTime = vw_GetTime();
 
465
                        NeedShowMenu = true;
 
466
                        NeedHideMenu = false;
 
467
                }
 
468
        }
 
469
 
 
470
 
 
471
        vw_SetCameraMoveAroundPoint(VECTOR3D(0,0,0), 0.0f, VECTOR3D(0.0f, 0.0f, 0.0f));
 
472
        vw_CameraLookAt();
 
473
 
 
474
 
 
475
 
 
476
 
 
477
        // всегда первым рисуем скайбокс и "далекое" окружение
 
478
        StarSystemUpdate();
 
479
        StarSystemDraw(1);
 
480
 
 
481
 
 
482
 
 
483
 
 
484
        // рисуем название игры, чтобы звезды и корабли пролетали перед ним
 
485
        vw_Start2DMode(-1,1);
 
486
        // надпись AstroMenace
 
487
        RECT SrcRest, DstRest;
 
488
        SetRect(&SrcRest,0,0,863,128 );
 
489
        int StartX = (Setup.iAspectRatioWidth - 863)/2;
 
490
        SetRect(&DstRest,StartX,10,StartX+863,10+128);
 
491
 
 
492
        if (GameStatus != WORKSHOP &&
 
493
                GameStatus != INFORMATION &&
 
494
                GameStatus != INTERFACE &&
 
495
                GameStatus != OPTIONS &&
 
496
                GameStatus != CONFCONTROL &&
 
497
                GameStatus != OPTIONS_ADVANCED)
 
498
        {
 
499
                vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/astromenace.tga"),
 
500
                        true, MenuContentTransp, 0.0f, RI_UL_CORNER, 1.0f, 1.0f, 1.0f);
 
501
        }
 
502
 
 
503
        vw_End2DMode();
 
504
 
 
505
 
 
506
 
 
507
        // рисуем все 3д объекты
 
508
        DrawAllObject3D(1);
 
509
 
 
510
 
 
511
 
 
512
        // после полной прорисовки делаем обновление данных
 
513
        UpdateAllObject3D(vw_GetTime());
 
514
        vw_UpdateAllParticleSystems(vw_GetTime());
 
515
 
 
516
 
 
517
 
 
518
 
 
519
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
520
        // работаем со скриптом, пока он есть
 
521
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
522
        if (Script != 0)
 
523
        if (!Script->Update(vw_GetTime()))
 
524
        {
 
525
                // удаляем скрипт
 
526
                delete Script; Script = 0;
 
527
        }
 
528
 
 
529
 
 
530
 
 
531
 
 
532
 
 
533
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
534
        // переходим в 2д режим для прорисовки всех 2д частей
 
535
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
536
        vw_Start2DMode(-1,1);
 
537
 
 
538
 
 
539
 
 
540
 
 
541
        switch(GameStatus)
 
542
        {
 
543
                case MAIN_MENU:         MainMenu(); break;
 
544
                case TOP_SCORES:        TopScoresMenu(); break;
 
545
                case INTERFACE:         InterfaceMenu(); break;
 
546
                case OPTIONS:           OptionsMenu(); break;
 
547
                case OPTIONS_ADVANCED: OptionsAdvMenu(); break;
 
548
                case INFORMATION:       InformationMenu(); break;
 
549
                case CREDITS:           CreditsMenu(); break;
 
550
                case CONFCONTROL:       ConfControlMenu(); break;
 
551
                case PROFILE:           ProfileMenu(); break;
 
552
                case DIFFICULTY:        DifficultyMenu(); break;
 
553
                case MISSION:           MissionMenu(); break;
 
554
                case WORKSHOP:          WorkshopMenu(); break;
 
555
 
 
556
                default:
 
557
                        break;
 
558
        }
 
559
 
 
560
 
 
561
 
 
562
 
 
563
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
564
        // последнее - вывод версии и копирайта
 
565
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
566
 
 
567
        // Version
 
568
        vw_DrawFont(6, 740, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.99f, "%s %s %s %i", vw_GetText("11_Version"), GAME_VERSION, vw_GetText("11_build"), GAME_BUILD);
 
569
 
 
570
        // Copyright
 
571
        int CSize = vw_FontSize("%s © 2007-2012, Viewizard", vw_GetText("11_Copyright"));
 
572
        vw_DrawFont(Setup.iAspectRatioWidth-7-CSize, 740, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.99f, "%s © 2007-2012, Viewizard", vw_GetText("11_Copyright"));
 
573
 
 
574
 
 
575
 
 
576
 
 
577
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
578
        // завершение прорисовки
 
579
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
580
        vw_End2DMode();
 
581
 
 
582
 
 
583
        // если нужно - рисуем в окошке еще одном
 
584
        switch(GameStatus)
 
585
        {
 
586
                case MAIN_MENU:         break;
 
587
                case TOP_SCORES:        break;
 
588
                case OPTIONS:           break;
 
589
                case CREDITS:           break;
 
590
 
 
591
                case INFORMATION:       InformationDrawObject(); break;
 
592
 
 
593
                default:
 
594
                        break;
 
595
        }
 
596
 
 
597
 
 
598
 
 
599
 
 
600
        // черное затемнение, если нужно
 
601
        if (NeedOnMenu)
 
602
        {
 
603
                MenuBlackTransp = 1.0f - 2.4f*(vw_GetTime() - LastMenuOnOffUpdateTime);
 
604
                if (MenuBlackTransp <= 0.0f)
 
605
                {
 
606
                        MenuBlackTransp = 0.0f;
 
607
                        NeedOnMenu = false;
 
608
                        LastMenuOnOffUpdateTime = vw_GetTime();
 
609
                }
 
610
 
 
611
                vw_Start2DMode(-1,1);
 
612
 
 
613
                RECT SrcRest, DstRest;
 
614
                SetRect(&SrcRest,0,0,2,2);
 
615
                SetRect(&DstRest,0,0,Setup.iAspectRatioWidth,768);
 
616
                vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, MenuBlackTransp);
 
617
 
 
618
                vw_End2DMode();
 
619
        }
 
620
 
 
621
        // черное затемнение, если нужно
 
622
        if (NeedOffMenu)
 
623
        {
 
624
                MenuBlackTransp = 2.4f*(vw_GetTime() - LastMenuOnOffUpdateTime);
 
625
                if (MenuBlackTransp >= 1.0f)
 
626
                {
 
627
                        MenuBlackTransp = 1.0f;
 
628
                        NeedOffMenu = false;
 
629
                        LastMenuOnOffUpdateTime = vw_GetTime();
 
630
                        // переход на игру
 
631
                        WorkshopDestroyData();
 
632
                        ComBuffer = GAME;
 
633
                }
 
634
 
 
635
                vw_Start2DMode(-1,1);
 
636
 
 
637
                RECT SrcRest, DstRest;
 
638
                SetRect(&SrcRest,0,0,2,2);
 
639
                SetRect(&DstRest,0,0,Setup.iAspectRatioWidth,768);
 
640
                vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/blackpoint.tga"), true, MenuBlackTransp);
 
641
 
 
642
                vw_End2DMode();
 
643
        }
 
644
 
 
645
}
 
646
 
 
647
 
 
648
 
 
649
 
 
650
 
 
651
 
 
652
 
 
653
 
 
654
 
 
655
 
 
656
 
 
657
 
 
658
//------------------------------------------------------------------------------------
 
659
// прорисовка основного меню
 
660
//------------------------------------------------------------------------------------
 
661
void MainMenu()
 
662
{
 
663
 
 
664
        int Prir = 100;
 
665
        int X = (Setup.iAspectRatioWidth - 384)/2;
 
666
        int Y = 165;
 
667
 
 
668
        if (DrawButton384(X,Y, vw_GetText("1_START_GAME"), MenuContentTransp, &Button1Transp, &LastButton1UpdateTime))
 
669
        {
 
670
                ComBuffer = PROFILE;
 
671
        }
 
672
 
 
673
 
 
674
 
 
675
 
 
676
 
 
677
        Y = Y+Prir;
 
678
        if (DrawButton384(X,Y, vw_GetText("1_TOP_SCORES"), MenuContentTransp, &Button2Transp, &LastButton2UpdateTime)) ComBuffer = TOP_SCORES;
 
679
 
 
680
        Y = Y+Prir;
 
681
        if (DrawButton384(X,Y, vw_GetText("1_OPTIONS"), MenuContentTransp, &Button3Transp, &LastButton3UpdateTime)) ComBuffer = OPTIONS;
 
682
 
 
683
        Y = Y+Prir;
 
684
        if (DrawButton384(X,Y, vw_GetText("1_INFORMATION"), MenuContentTransp, &Button4Transp, &LastButton4UpdateTime)) ComBuffer = INFORMATION;
 
685
 
 
686
        Y = Y+Prir;
 
687
        if (DrawButton384(X,Y, vw_GetText("1_CREDITS"), MenuContentTransp, &Button5Transp, &LastButton5UpdateTime)) ComBuffer = CREDITS;
 
688
 
 
689
        Y = Y+Prir;
 
690
        if (DrawButton384(X,Y, vw_GetText("1_QUIT"), MenuContentTransp, &Button6Transp, &LastButton6UpdateTime))SetCurrentDialogBox(0);
 
691
 
 
692
}
 
693
 
 
694
 
 
695
 
 
696