2010-10-02 17:04:20 +00:00
|
|
|
/* --------------------------------------------------------------------
|
|
|
|
EXTREME TUXRACER
|
|
|
|
|
|
|
|
Copyright (C) 1999-2001 Jasmin F. Patry (Tuxracer)
|
|
|
|
Copyright (C) 2010 Extreme Tuxracer Team
|
|
|
|
|
|
|
|
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.
|
|
|
|
---------------------------------------------------------------------*/
|
|
|
|
|
2013-06-23 22:44:40 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <etr_config.h>
|
|
|
|
#endif
|
|
|
|
|
2010-10-02 17:04:20 +00:00
|
|
|
#include "bh.h"
|
2021-04-28 18:18:44 +00:00
|
|
|
#include "depot.h"
|
2010-10-02 17:04:20 +00:00
|
|
|
#include "textures.h"
|
|
|
|
#include "ogl.h"
|
|
|
|
#include "splash_screen.h"
|
|
|
|
#include "audio.h"
|
|
|
|
#include "font.h"
|
2010-11-02 09:59:18 +00:00
|
|
|
#include "tools.h"
|
2010-12-13 19:12:08 +00:00
|
|
|
#include "ogl_test.h"
|
2013-06-11 17:49:59 +00:00
|
|
|
#include "winsys.h"
|
2013-05-09 10:44:25 +00:00
|
|
|
#include <iostream>
|
2013-06-11 17:49:59 +00:00
|
|
|
#include <ctime>
|
2016-01-14 16:13:07 +00:00
|
|
|
#include <cstring>
|
2010-10-02 17:04:20 +00:00
|
|
|
|
|
|
|
TGameData g_game;
|
|
|
|
|
2014-01-18 09:55:13 +00:00
|
|
|
void InitGame(int argc, char **argv) {
|
2010-11-02 09:59:18 +00:00
|
|
|
g_game.toolmode = NONE;
|
2010-11-05 16:34:25 +00:00
|
|
|
g_game.argument = 0;
|
2010-11-18 15:23:16 +00:00
|
|
|
if (argc == 4) {
|
2016-01-14 16:13:07 +00:00
|
|
|
if (std::strcmp("--char", argv[1]) == 0)
|
|
|
|
g_game.argument = 4;
|
2013-10-02 19:37:38 +00:00
|
|
|
Tools.SetParameter(argv[2], argv[3]);
|
2010-12-13 19:12:08 +00:00
|
|
|
} else if (argc == 2) {
|
2016-01-14 16:13:07 +00:00
|
|
|
if (std::strcmp(argv[1], "9") == 0)
|
|
|
|
g_game.argument = 9;
|
2010-12-13 19:12:08 +00:00
|
|
|
}
|
2010-11-18 15:23:16 +00:00
|
|
|
|
2014-07-13 19:05:24 +00:00
|
|
|
g_game.player = nullptr;
|
2010-11-24 11:18:46 +00:00
|
|
|
g_game.start_player = 0;
|
2014-07-13 19:05:24 +00:00
|
|
|
g_game.course = nullptr;
|
2013-11-27 17:11:54 +00:00
|
|
|
g_game.mirrorred = false;
|
2014-07-13 19:05:24 +00:00
|
|
|
g_game.character = nullptr;
|
2010-10-02 17:04:20 +00:00
|
|
|
g_game.location_id = 0;
|
|
|
|
g_game.light_id = 0;
|
|
|
|
g_game.snow_id = 0;
|
2013-04-30 13:37:31 +00:00
|
|
|
g_game.cup = 0;
|
2010-10-24 10:10:56 +00:00
|
|
|
g_game.theme_id = 0;
|
2013-12-03 21:08:46 +00:00
|
|
|
g_game.force_treemap = false;
|
2010-10-02 17:04:20 +00:00
|
|
|
g_game.treesize = 3;
|
|
|
|
g_game.treevar = 3;
|
|
|
|
}
|
|
|
|
|
2013-11-02 10:02:19 +00:00
|
|
|
int main(int argc, char **argv) {
|
2016-01-18 16:55:59 +00:00
|
|
|
std::cout << "\n----------- Extreme Tux Racer " ETR_VERSION_STRING " ----------------";
|
2020-02-26 22:13:30 +00:00
|
|
|
std::cout << "\n----------- (C) 2010-2020 Extreme Tuxracer Team --------\n\n";
|
2010-10-02 17:04:20 +00:00
|
|
|
|
2021-04-28 18:18:44 +00:00
|
|
|
DepotInit(argv[0]);
|
|
|
|
|
2016-01-19 16:16:09 +00:00
|
|
|
std::srand(std::time(nullptr));
|
2013-12-03 21:08:46 +00:00
|
|
|
InitConfig();
|
2013-11-02 10:02:19 +00:00
|
|
|
InitGame(argc, argv);
|
2014-01-18 09:55:13 +00:00
|
|
|
Winsys.Init();
|
|
|
|
InitOpenglExtensions();
|
2016-01-14 16:13:07 +00:00
|
|
|
|
|
|
|
// For checking the joystick and the OpgenGL version (the info is written on the console):
|
|
|
|
//Winsys.PrintJoystickInfo();
|
|
|
|
//PrintGLInfo ();
|
2013-06-11 18:07:30 +00:00
|
|
|
|
|
|
|
// theses resources must or should be loaded before splashscreen starts
|
2014-07-12 19:00:57 +00:00
|
|
|
if (!Tex.LoadTextureList()) {
|
|
|
|
Winsys.Quit();
|
|
|
|
return -1;
|
|
|
|
}
|
2014-01-18 09:55:13 +00:00
|
|
|
FT.LoadFontlist();
|
2013-11-30 18:02:01 +00:00
|
|
|
FT.SetFontFromSettings();
|
2014-01-18 09:55:13 +00:00
|
|
|
Music.LoadMusicList();
|
|
|
|
Music.SetVolume(param.music_volume);
|
2010-10-02 17:04:20 +00:00
|
|
|
|
2010-11-02 09:59:18 +00:00
|
|
|
switch (g_game.argument) {
|
2013-08-15 14:21:01 +00:00
|
|
|
case 0:
|
|
|
|
State::manager.Run(SplashScreen);
|
|
|
|
break;
|
2013-05-23 17:59:58 +00:00
|
|
|
case 4:
|
2013-06-11 18:07:30 +00:00
|
|
|
g_game.toolmode = TUXSHAPE;
|
|
|
|
State::manager.Run(Tools);
|
2010-11-02 09:59:18 +00:00
|
|
|
break;
|
2013-08-15 14:21:01 +00:00
|
|
|
case 9:
|
|
|
|
State::manager.Run(OglTest);
|
|
|
|
break;
|
2010-11-02 09:59:18 +00:00
|
|
|
}
|
2010-10-02 17:04:20 +00:00
|
|
|
|
2013-05-01 17:12:19 +00:00
|
|
|
Winsys.Quit();
|
|
|
|
|
2013-08-15 14:21:01 +00:00
|
|
|
return 0;
|
2013-05-23 17:59:58 +00:00
|
|
|
}
|