File: Game.h

package info (click to toggle)
astromenace 1.3.2%2Brepack-5
  • links: PTS, VCS
  • area: contrib
  • in suites: buster
  • size: 4,484 kB
  • sloc: cpp: 61,665; makefile: 26; sh: 19
file content (634 lines) | stat: -rwxr-xr-x 17,144 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
/************************************************************************************

	AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
	Copyright © 2006-2013 Michael Kurinnoy, Viewizard


	AstroMenace is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	AstroMenace is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with AstroMenace. If not, see <http://www.gnu.org/licenses/>.


	Web Site: http://www.viewizard.com/
	Project: http://sourceforge.net/projects/openastromenace/
	E-mail: viewizard@viewizard.com

*************************************************************************************/


#ifndef GAME_H
#define GAME_H


// ядро
#include "Core/Core.h"
// структуры
#include "Struct.h"



// скриптовый движок
#include "ScriptEngine/Script.h"
// эффекты
#include "GraphicFX/SpaceStars/SpaceStars.h"
#include "GraphicFX/GameLvlText/GameLvlText.h"
// модели и все объекты
#include "Object3D/Object3D.h"
#include "Object3D/SpaceShip/EarthSpaceFighter/EarthSpaceFighter.h"
#include "Object3D/SpaceShip/AlienSpaceFighter/AlienSpaceFighter.h"
#include "Object3D/SpaceShip/AlienSpaceMotherShip/AlienSpaceMotherShip.h"
#include "Object3D/SpaceShip/PirateShip/PirateShip.h"
#include "Object3D/GroundObject/Building/Building.h"
#include "Object3D/GroundObject/MilitaryBuilding/MilitaryBuilding.h"
#include "Object3D/GroundObject/Wheeled/Wheeled.h"
#include "Object3D/GroundObject/Tracked/Tracked.h"
#include "Object3D/SpaceObject/Asteroid/Asteroid.h"
#include "Object3D/SpaceObject/BigAsteroid/BigAsteroid.h"
#include "Object3D/SpaceObject/BasePart/BasePart.h"
#include "Object3D/SpaceObject/ShipPart/ShipPart.h"
#include "Object3D/SpaceObject/Planet/Planet.h"








//------------------------------------------------------------------------------------
// Main.cpp
//------------------------------------------------------------------------------------
extern GameSetup Setup;
extern eDevCaps *CAPS;
extern eGameStatus GameStatus;
extern SDL_Joystick *Joystick;
extern eParticleSystem2D *CursorParticleSystem2D;
extern CSpaceStars *psSpaceStatic;
extern VECTOR3D GamePoint;
extern VECTOR3D GameCameraMovement;

extern  sVideoModes *VideoModes;
extern  int VideoModesNum;
extern  sVideoModes CurrentVideoMode;

extern bool LoadedTypes[1000];
extern char ConfigFileName[MAX_PATH];
extern char ProgrammDir[MAX_PATH];
extern char ScreenshotDir[MAX_PATH];
extern char VFSFileNamePath1[MAX_PATH];
extern char VFSFileNamePath2[MAX_PATH];
extern char UserPath[MAX_PATH];
extern bool Quit;
extern bool CanQuit;
extern bool NeedReCreate;
extern bool SDL_MouseCurrentStatus[8];
extern int JoystickAxisX;
extern int JoystickAxisY;
extern bool JoysticButtons[100];

void SaveGameData();
void CodeXOR(char *Text, char *Key, int Count);

#ifdef fontconfig

struct sFontList
{
	char *FontTitle;
	char *FontFileName;
};
extern int FontQuantity;
extern sFontList *FontList;

#else

struct sFontList
{
	const char *FontTitle;
	const char *FontFileName;
};

// In order to change/add/delete font:
//
// 1. Edit AstroMenaceSource/Game.h file
// - change/add/delete lines in FontList list
// - correct FontQuantity variable value
//
// 2. Edit AstroMenaceSource/MainFS2VFS.cpp file (for bundled with game fonts only!)
// - change/add/delete lines in VFSFilesList list
// - correct VFSFilesListCount variable value
// - make sure, that you have all font files in RAW_VFS_DATA/FONT/ folder
//
// You can also use external (installed into your system) ttf fonts. For example:
/*
const int FontQuantity = 2;
const sFontList FontList[FontQuantity] =
{
{"Linux Biolinum", "DATA/FONT/LinBiolinumBold.ttf"},
{"Liberation Sans", "/usr/share/fonts/liberation-fonts/LiberationSans-Bold.ttf"},
};
*/
const int FontQuantity = 8;
const sFontList FontList[FontQuantity] =
{
{"Linux Biolinum", "DATA/FONT/LinBiolinumBold.ttf"},
{"Linux Libertine", "DATA/FONT/LinLibertineBold.ttf"},
{"Liberation Mono", "DATA/FONT/LiberationMono-Bold.ttf"},
{"Liberation Sans", "DATA/FONT/LiberationSans-Bold.ttf"},
{"Liberation Serif", "DATA/FONT/LiberationSerif-Bold.ttf"},
{"FreeFont Mono", "DATA/FONT/FreeMonoBold.ttf"},
{"FreeFont Sans", "DATA/FONT/FreeSansBold.ttf"},
{"FreeFont Serif", "DATA/FONT/FreeSerifBold.ttf"},
};

#endif //fontconfig




//------------------------------------------------------------------------------------
// MainFS2VFS.cpp
//------------------------------------------------------------------------------------
int ConvertFS2VFS(char RawDataDir[MAX_PATH]);




//------------------------------------------------------------------------------------
// Setup.cpp
//------------------------------------------------------------------------------------
bool LoadXMLSetupFile(bool NeedSafeMode);
void SaveXMLSetupFile();






//------------------------------------------------------------------------------------
// loop_proc.cpp
//------------------------------------------------------------------------------------
extern ScriptEngine *Script;

extern int ComBuffer;
extern int CurrentCursorStatus;
extern bool DrawGameCursor;

void Loop_Proc();
void CreateCursor();








//------------------------------------------------------------------------------------
// loop_audio.cpp
//------------------------------------------------------------------------------------
extern bool GameMainMusicSet;
extern char GameMainMusic[MAX_PATH];
extern bool GameBossMusicSet;
extern char GameBossMusic[MAX_PATH];
extern bool GameDeathMusicSet;
extern char GameDeathMusic[MAX_PATH];

int Audio_PlaySound2D(int SoundID, float fVol, bool Loop = false);
int Audio_PlayVoice(int VoiceID, float fVol, bool Loop = false);
void Audio_LoopProc();
bool InitAudio();
void StartMusicWithFade(int StartMusic, float FadeInTime, float FadeOutTime);
void Audio_SetSound2DMainVolume(float NewMainVolume);
void Audio_SetVoiceMainVolume(float NewMainVolume);




//------------------------------------------------------------------------------------
// loading.cpp
//------------------------------------------------------------------------------------
void LoadGameData(int LoadType);






//------------------------------------------------------------------------------------
// Camera.cpp, GameCamera.cpp, CameraMath.cpp
//------------------------------------------------------------------------------------
void GameCameraUpdate(float Time);
void InitGameCamera();
float GameCameraGetDeviation();
float GameCameraGetSpeed();
void GameCameraSetExplosion(VECTOR3D Location, float Power);






//------------------------------------------------------------------------------------
// SkyBox.cpp
//------------------------------------------------------------------------------------
void SkyBoxSetTexture(eTexture *nTexture, int Side);
void SkyBoxCreate(float nx, float ny, float nz, float nwidth, float nheight, float nlength);
void SkyBoxDraw(void);






//------------------------------------------------------------------------------------
// StarSystem.cpp
//------------------------------------------------------------------------------------
void StarSystemInit(int Num, VECTOR3D SetBaseRotation);
void StarSystemDraw(int DrawType); // 1- меню, 2- игра
void StarSystemDrawSecondLayer(int DrawType);
void StarSystemUpdate();
void StarSystemRelease();





//------------------------------------------------------------------------------------
// ShadowMap.cpp
//------------------------------------------------------------------------------------
bool ShadowMap_Init(int Width, int Height);
void ShadowMap_Release();
void ShadowMap_StartRenderToFBO(VECTOR3D FocusPointCorrection, float Distance, float fFarClip);
void ShadowMap_EndRenderToFBO();
void ShadowMap_StartFinalRender();
void ShadowMap_EndFinalRender();
float ShadowMap_Get_xPixelOffset();
float ShadowMap_Get_yPixelOffset();




//------------------------------------------------------------------------------------
// Button.cpp
//------------------------------------------------------------------------------------
extern int CurrentActiveMenuElement;
extern int CurrentKeyboardSelectMenuElement;

bool DrawButton384(int X, int Y, const char *Text, float Transp, float *ButTransp, float *Update);
bool DrawButton256(int X, int Y, const char *Text, float Transp, float *ButTransp, float *Update, bool Off=false);
bool DrawButton128_2(int X, int Y, const char *Text, float Transp, bool Off, bool SoundClick = true);
bool DrawButton200_2(int X, int Y, const char *Text, float Transp, bool Off);
void DrawCheckBox(int X, int Y, bool *CheckBoxStatus, const char *Text, float Transp);
bool DrawListUpButton(int X, int Y, float Transp, bool Off);
bool DrawListDownButton(int X, int Y, float Transp, bool Off);







//------------------------------------------------------------------------------------
// Menu.cpp
//------------------------------------------------------------------------------------
extern float Button1Transp;
extern float LastButton1UpdateTime;
extern float Button2Transp;
extern float LastButton2UpdateTime;
extern float Button3Transp;
extern float LastButton3UpdateTime;
extern float Button4Transp;
extern float LastButton4UpdateTime;
extern float Button5Transp;
extern float LastButton5UpdateTime;
extern float Button6Transp;
extern float LastButton6UpdateTime;
extern float Button7Transp;
extern float LastButton7UpdateTime;
extern float Button8Transp;
extern float LastButton8UpdateTime;
extern float Button9Transp;
extern float LastButton9UpdateTime;
extern float Button10Transp;
extern float LastButton10UpdateTime;
extern float Button11Transp;
extern float LastButton11UpdateTime;
extern float Button12Transp;
extern float LastButton12UpdateTime;
extern float Button13Transp;
extern float LastButton13UpdateTime;
extern float Button14Transp;
extern float LastButton14UpdateTime;
extern float MenuContentTransp;
extern float LastMenuOnOffUpdateTime;

void InitMenu();
void SetOptionsMenu(eGameStatus Menu);
void SetMenu(eGameStatus Menu);
void DrawMenu();
void DrawTransparent(RECT *DstRect, RECT *SrcRect, eTexture *Tex, eTexture *Tex2, bool Alpha, float Transp, float RotateAngle, int DrawCorner, float R, float G, float B);
void MainMenu();










//------------------------------------------------------------------------------------
// Menu_Credits.cpp
//------------------------------------------------------------------------------------
extern float CreditsCurrentPos;
extern float LastCreditsCurrentPosUpdateTime;

void CreditsMenu();









//------------------------------------------------------------------------------------
// Menu_Options.cpp
//------------------------------------------------------------------------------------
extern int Options_Width;
extern int Options_Height;
extern int Options_BPP;
extern int Options_VSync;
extern int Options_iAspectRatioWidth;

void OptionsMenu(float ContentTransp, float *ButtonTransp1, float *LastButtonUpdateTime1, float *ButtonTransp2, float *LastButtonUpdateTime2);
void SaveOptionsMenuTmpData();








//------------------------------------------------------------------------------------
// Menu_ConfControl.cpp
//------------------------------------------------------------------------------------
extern int NeedCheck;
extern int ButQuant;
extern float But[10];

void ConfControlMenu(float ContentTransp, float *ButtonTransp1, float *LastButtonUpdateTime1);
const char * MouseCodeName(char Num);
const char * JoystickCodeName(int Num);
void CheckMouseKeybJState();









//------------------------------------------------------------------------------------
// Menu_Interface.cpp
//------------------------------------------------------------------------------------
void CreateMenuLanguageEntryLinks();
void ReCreateMenuLanguageEntryLinks();
void CreateVoiceLanguageEntryLinks();
void ReCreateVoiceLanguageEntryLinks();
void InterfaceMenu(float ContentTransp, float *ButtonTransp1, float *LastButtonUpdateTime1);







//------------------------------------------------------------------------------------
// Menu_OptionsAdvMenu.cpp
//------------------------------------------------------------------------------------
extern int Options_TexturesCompressionType;
extern int Options_UseGLSL;
extern int Options_MSAA;
extern int Options_CSAA;
extern int Options_ShadowMap;
extern int Options_TexturesQuality;

void OptionsAdvMenu(float ContentTransp, float *ButtonTransp1, float *LastButtonUpdateTime1, float *ButtonTransp2, float *LastButtonUpdateTime2);
void SaveOptionsAdvMenuTmpData();







//------------------------------------------------------------------------------------
// Menu_Profile.cpp
//------------------------------------------------------------------------------------
extern int CurrentProfile;
extern char NewProfileName[128];
extern int NewProfileNamePos;

void ProfileMenu();
void DeleteRecord();








//------------------------------------------------------------------------------------
// Menu_Information.cpp
//------------------------------------------------------------------------------------
extern int CreateNum;

void InformationMenu();
void InformationDrawObject();
void CreateInfoObject();
void DestroyInfoObject();









//------------------------------------------------------------------------------------
// Menu_TopScores.cpp
//------------------------------------------------------------------------------------
extern char GameName[10][128];
extern int GameScore[10];

void TopScoresMenu();
void AddTopScores(int Score, char Name[128], bool Type);








//------------------------------------------------------------------------------------
// Menu_Difficulty.cpp
//------------------------------------------------------------------------------------
void DifficultyMenu();







//------------------------------------------------------------------------------------
// Menu_Mission.cpp
//------------------------------------------------------------------------------------
extern int CurrentMission;
extern int AllMission;
extern int StartMission;
extern int EndMission;

void MissionMenu();
char *GetMissionFileName();
void MissionsListRelease();
void MissionsListInit();








//------------------------------------------------------------------------------------
// Menu_Workshop.cpp
//------------------------------------------------------------------------------------
extern int CurrentWorkshop;
extern int NewWeaponControlType;
extern int NewWeaponControlTypeData;
extern int VoiceNeedMoreEnergy;
extern int VoiceAmmoOut;

void WorkshopMenu();
void WorkshopCreate();
void WorkshopDestroyData();
const char *GetWeaponIconName(int Num);










//------------------------------------------------------------------------------------
// game.cpp
//------------------------------------------------------------------------------------
extern CEarthSpaceFighter *PlayerFighter;

extern int GameNPCWeaponPenalty;
extern int GameNPCArmorPenalty;
extern int GameNPCTargetingSpeedPenalty;
extern int GameLimitedAmmo;
extern int GameDestroyableWeapon;
extern int GameWeaponTargetingMode;
extern int GameSpaceShipControlMode;
extern int GameEngineSystem;
extern int GameTargetingSystem;
extern int GameAdvancedProtectionSystem;
extern int GamePowerSystem;
extern int GameTargetingMechanicSystem;
extern int GameMenuStatus;
extern float GameContentTransp;
extern float GameButton1Transp;
extern float LastGameButton1UpdateTime;
extern bool NeedShowGameMenu;
extern bool NeedHideGameMenu;
extern bool GameMissionCompleteStatus;
extern float StarsTileStartTransparentLayer1;
extern float StarsTileEndTransparentLayer1;
extern float StarsTileStartTransparentLayer2;
extern float StarsTileEndTransparentLayer2;

void InitGame();
void DrawGame();
void ExitGame();
void RealExitGame();
void ExitGameWithSave();
void SetGameMissionComplete();









//------------------------------------------------------------------------------------
// Dialog.cpp
//------------------------------------------------------------------------------------
void SetCurrentDialogBox(int DialogBox);
bool isDialogBoxDrawing();
void DrawDialogBox();









//------------------------------------------------------------------------------------
// Game_Mission.cpp
//------------------------------------------------------------------------------------
void GameSetMissionTitleData(float ShowTime, int Num);
void GameDrawMissionTitle();
void GameSetMissionFailedData(float ShowTime);
void GameDrawMissionFailed();








//------------------------------------------------------------------------------------
// Game_WeaponSlot.cpp
//------------------------------------------------------------------------------------
void DrawGameWeaponSlots();












#endif // GAME_H