-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
136 lines (111 loc) · 3.71 KB
/
Copy pathMain.cpp
File metadata and controls
136 lines (111 loc) · 3.71 KB
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
/*
This file is part of "Avanor, the Land of Mystery" roguelike game
Home page: http://www.avanor.com/
Copyright (C) 2000-2003 Vadim Gaidukevich
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <cctype>
#include <cstdlib>
#include "engine/global.h"
#include "game/game.h"
#include "helpers/hiscore.h"
#include "helpers/manual.h"
const char* logo_text[] = {
MSG_CYAN
" .oooooo oo oo .oooooo oo oo .oooo. ooooooo. ",
" dP' 88 88 88 dP' 88 88b 88 dP' `Yb 88 `Yb",
"d8 88 88 88 d8 88 88Yb 88 88 88 88 88",
"88 88 Y8 8Y 88 88 88 Yb 88 88 88 88 88",
"88ooooo88 Yb dY 88ooooo88 88 Yb 88 88 88 88oooodP ",
"88 88 Yb dY 88 88 88 Yb88 88 88 88 Yb ",
"88 88 YbdY 88 88 88 Y88 `8b d8' 88 Yb ",
"88 88 YY 88 88 88 88 `Y8bd8P 88 Yb",
MSG_WHITE,
" T h e L a n d o f M y s t e r y",
"",
MSG_GREEN
" version " GAME_VERSION "\n",
MSG_YELLOW,
" (c) 2000 - 2006 by Vadim Gaidukevich",
"",
MSG_YELLOW
" http://www.avanor.com",
"",
"",
" "
MSG_LIGHTGRAY "[" MSG_WHITE "R" MSG_LIGHTGRAY "] - Restore game "
MSG_LIGHTGRAY "[" MSG_WHITE "N" MSG_LIGHTGRAY "] - New game "
MSG_LIGHTGRAY "[" MSG_WHITE "?" MSG_LIGHTGRAY "] - read Manual "
MSG_LIGHTGRAY "[" MSG_WHITE "Esc" MSG_LIGHTGRAY "] - Exit",
};
void ShowLogo()
{
int logo_height = sizeof(logo_text) / sizeof(char*), logo_width = 0, i;
for (i = 0; i < logo_height; i++)
if (x_strlen(logo_text[i]) > logo_width) {
logo_width = x_strlen(logo_text[i]);
}
int shift_x = (size_x - logo_width) / 2;
int shift_y = (size_y - logo_height) / 2;
vClrScr();
for (i = 0; i < logo_height; i++) {
vGotoXY(shift_x, i + shift_y);
vPutS(logo_text[i]);
}
vRefresh();
}
XGame Game;
int main(int argc, char* argv[])
{
vRandSeed(static_cast<unsigned long>(time(nullptr)));
vInit();
vClrScr();
vHideCursor();
ShowLogo();
if (argc > 1 && strcmp(argv[1], "-test") == 0) {
if (argc > 2) {
vRandSeed(atoi(argv[2]));
}
Game.Create('T');
Game.RunWithoutHero();
} else if (argc > 1 && strcmp(argv[1], "-demo") == 0) {
Game.Create('D');
Game.RunDemo();
} else {
if (argc > 1 && strcmp(argv[1], "-god") == 0) {
Game.isGodMode = true;
} else {
Game.isGodMode = false;
}
char ch;
while (true) {
ch = toupper(vGetch());
if (ch == '?') {
XManual man;
man.Run();
ShowLogo();
}
if (ch == KEY_ESC || ch == 'Z') {
vFinit();
return 0;
}
if (ch == 'R' || ch == 'N') {
break;
}
}
Game.Create(ch);
Game.Run();
}
vFinit();
return 0;
}