-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
main.cpp
106 lines (81 loc) · 2.79 KB
/
main.cpp
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
/*
Dune II - The Maker
Author : Stefan Hendriks
Contact: [email protected]
Website: http://dune2themaker.fundynamic.com
2001 - 2022 (c) code by Stefan Hendriks
*/
#include "d2tmc.h"
#include "gameobjects/particles/cParticle.h"
#include "gameobjects/projectiles/bullet.h"
#include "gamestates/cSelectYourNextConquestState.h"
#include "map/cMapEditor.h"
#include "map/cRandomMapGenerator.h"
#include "player/cPlayer.h"
#include "utils/cLog.h"
#include <string>
#include <iostream>
int iRest = 1; // default rest value
// the ultimate game variable(s)
cGame game;
cStructureUtils structureUtils;
cMap map;
cRandomMapGenerator randomMapGenerator;
cAbstractStructure * structure[MAX_STRUCTURES];
cUnit unit[MAX_UNITS]; // units in the game (max MAX_UNITS amount)
cMapCamera * mapCamera;
cPlayer players[MAX_PLAYERS]; // player is
cParticle particle[MAX_PARTICLES];
cBullet bullet[MAX_BULLETS];
cRegion world[MAX_REGIONS];
cDrawManager * drawManager = nullptr;
cAllegroDrawer * allegroDrawer = nullptr;
// Structs of all kinds of objects (*info)
s_StructureInfo sStructureInfo[MAX_STRUCTURETYPES];
s_UnitInfo sUnitInfo[MAX_UNITTYPES];
s_UpgradeInfo sUpgradeInfo[MAX_UPGRADETYPES];
s_SpecialInfo sSpecialInfo[MAX_SPECIALTYPES];
s_BulletInfo sBulletInfo[MAX_BULLET_TYPES];
s_ParticleInfo sParticleInfo[MAX_PARTICLE_TYPES];
// palette
PALETTE general_palette;
// bitmap(s)
BITMAP *bmp_screen;
BITMAP *bmp_backgroundMentat;
BITMAP *bmp_throttle;
BITMAP *bmp_winlose;
BITMAP *bmp_fadeout;
// datafile(s)
DATAFILE *gfxdata; // graphics (terrain, units, structures)
DATAFILE *gfxinter; // interface graphics
DATAFILE *gfxworld; // world/pieces graphics
DATAFILE *gfxmentat; // mentat graphics
// FONT stuff
ALFONT_FONT *game_font; // arrakeen.fon
ALFONT_FONT *bene_font; // benegesserit font.
ALFONT_FONT *small_font; // small font.
/** Allegro specific timer creation starts here **/
volatile int allegro_timerSecond = 0;
volatile int allegro_timerGlobal = 0;
volatile int allegro_timerUnits = 0;
/**
Entry point of the game
*/
int main(int argc, char **argv) {
game.setGameFilename("game.ini");
if (game.handleArguments(argc, argv) < 0) {
return 0;
}
try {
if (game.setupGame()) {
game.run();
}
game.shutdown();
} catch (std::runtime_error &e) {
cLogger::getInstance()->log(LOG_ERROR, eLogComponent::COMP_NONE, "Unknown", fmt::format("Error: {}", e.what()));
std::cerr << fmt::format("Error: {}\n\n", e.what());
}
std::cout << fmt::format("Thank you for playing Dune 2 - The Maker\n");
return 0;
}
END_OF_MAIN()