2 Copyright (C) 2004-2011 Parallel Realities
3 Copyright (C) 2011-2015 Perpendicular Dimensions
4 Copyright (C) 2011-2015 Perpendicular Dimensions
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 ReplayData replayData;
35 MedalServer medalServer;
37 Entity defEnemy[MAX_ENEMIES];
38 Entity defItem[MAX_ITEMS];
40 Weapon weapon[MAX_WEAPONS];
46 "Blob Wars, Episode I - Metal Blob Solid (Version %.2f, Release %d)\n"
47 "Copyright (C) 2004-2011 Parallel Realities\n"
48 "Copyright (C) 2011-2015 Perpendicular Dimensions\n"
49 "Licensed under the GNU General Public License (GPL)\n"
59 "The Metal Blob Solid gameplay manual can be found in,\n"
63 "\t-map <filename> Play the specified map (use -listmaps to see maps)\n"
64 "\t-record <filename> Record a game and output to the specified file\n"
65 "\t-playback <filename> Playback the specified recording\n"
66 "\t-listmaps List the available maps for playing\n"
69 "\tblobwars -map data/grasslands1 -record replay.dat\n"
70 "\tblobwars -playback replay.dat\n"
72 "Additional Commands\n"
73 "\t-fullscreen Start the game in Full Screen mode\n"
74 "\t-window Start the game in Window mode\n"
75 "\t-mono Use mono sound output instead of stereo\n"
76 "\t-noaudio Disables audio\n"
77 "\t-version Display version number\n"
78 "\t--help This help\n"
91 "\tdata/arcticWastes\n"
92 "\tdata/assimilator\n"
98 "\tdata/finalBattle\n"
99 "\tdata/floodedTunnel1\n"
100 "\tdata/floodedTunnel2\n"
101 "\tdata/floodedTunnel3\n"
102 "\tdata/floodedTunnel4\n"
103 "\tdata/grasslands1\n"
104 "\tdata/grasslands2\n"
105 "\tdata/grasslands3\n"
109 "\tdata/spaceStation\n"
120 int main(int argc, char *argv[])
123 debug(("Not Using PAK...\n"));
128 if (PAKLOCATION[0] && chdir(PAKLOCATION))
130 perror("Could not chdir to '" PAKLOCATION "'");
136 config.engine = &engine;
140 bindtextdomain("blobwars", LOCALEDIR);
141 setlocale(LC_ALL, "");
142 setlocale(LC_NUMERIC, "C");
143 textdomain("blobwars");
147 bool showSprites = false;
150 int recordMode = REPLAY_MODE::NONE;
151 int requiredSection = SECTION_INTRO;
155 for (int i = 1 ; i < argc ; i++)
157 if (strcmp(argv[i], "-fullscreen") == 0) engine.fullScreen = true;
158 else if (strcmp(argv[i], "-window") == 0) engine.fullScreen = false;
159 else if (strcmp(argv[i], "-noaudio") == 0) engine.useAudio = 0;
160 else if (strcmp(argv[i], "-mono") == 0) engine.useAudio = 1;
161 else if (strcmp(argv[i], "-version") == 0) {showVersion(); exit(0);}
162 else if (strcmp(argv[i], "--help") == 0) showHelp();
163 else if (strcmp(argv[i], "-record") == 0) {recordMode = REPLAY_MODE::RECORD; strlcpy(replayData.filename, argv[++i], sizeof replayData.filename);}
164 else if (strcmp(argv[i], "-playback") == 0) {recordMode = REPLAY_MODE::PLAYBACK; strlcpy(replayData.filename, argv[++i], sizeof replayData.filename);}
165 else if (strcmp(argv[i], "-map") == 0) {if (argc > i + 1) {game.setMapName(argv[++i]); requiredSection = SECTION_GAME;}}
166 else if (strcmp(argv[i], "-listmaps") == 0) listMaps();
167 else if (strcmp(argv[i], "-credits") == 0) requiredSection = SECTION_CREDITS;
170 else if (strcmp(argv[i], "-showsprites") == 0) showSprites = true;
171 else if (strcmp(argv[i], "-hub") == 0) hub = true;
172 else if (strcmp(argv[i], "-randomscreens") == 0) graphics.takeRandomScreenShots = true;
173 else if (strcmp(argv[i], "-nomonsters") == 0) engine.devNoMonsters = true;
176 else {fprintf(stderr, "Unknown argument '%s'\n", argv[i]); showHelp();}
181 case REPLAY_MODE::NONE:
185 case REPLAY_MODE::RECORD:
186 requiredSection = SECTION_GAME;
187 strlcpy(replayData.header.map, game.mapName, sizeof replayData.header.map);
188 replayData.header.skill = game.skill = 3;
189 replayData.setMode(REPLAY_MODE::RECORD);
192 case REPLAY_MODE::PLAYBACK:
193 requiredSection = SECTION_GAME;
194 replayData.setMode(REPLAY_MODE::PLAYBACK);
195 replayData.header.time = 0;
196 game.setMapName(replayData.header.map);
197 game.skill = replayData.header.skill;
203 // seed the random using the one generated
204 // via the replay data
205 Math::pSeed = replayData.header.randomSeed;
207 player.setName("Player");
211 engine.allowQuit = true;
215 requiredSection = SECTION_HUB;
222 game.hasAquaLung = game.hasJetPack = true;
232 switch (requiredSection)
235 requiredSection = doIntro();
239 requiredSection = title();
243 requiredSection = doHub();
247 if (!game.continueFromCheckPoint)
249 checkStartCutscene();
252 requiredSection = doGame();
255 case SECTION_GAMEOVER:
256 requiredSection = gameover();
259 case SECTION_EASYOVER:
263 requiredSection = SECTION_TITLE;
266 case SECTION_CREDITS:
268 requiredSection = SECTION_TITLE;