Exemplo n.º 1
0
static void play_video(HINSTANCE hInstance, int videoId) {
    String movieFileStr;
    //	movieFileStr = DIR_MOVIE;
    if( videoId == 0 ) {
	movieFileStr += "INTRO.AVI";
    }
    else {
	movieFileStr += "MOVIE";
	movieFileStr += videoId;
	movieFileStr += ".AVI";
    }

    video.set_skip_on_fail();

    if( m.is_file_exist(movieFileStr) ) {
	//---------- play the movie now ---------//

	video.init();

	if( video.init_success ) {
	    video.play_until_end( movieFileStr, hInstance, 60 );
	}
	else {
	    // display a message box (note:sys.main_hwnd is not valid)
	    // MessageBox( NULL, "Cannot initialize ActiveMovie",
	    //   "Virtual U", MB_OK | MB_ICONWARNING | MB_DEFBUTTON1 | MB_TASKMODAL );
	}

	video.deinit();
    }
}
Exemplo n.º 2
0
void play_video(HINSTANCE hInstance, int videoId)
{
	String movieFileStr;
	movieFileStr = DIR_MOVIE;
	if( videoId == 0 )
	{
		movieFileStr += "intro.mpg";
	}
	else
	{
		movieFileStr += "movie";
		movieFileStr += videoId;
		movieFileStr += ".avi";
	}

	video.set_skip_on_fail();

	if( m.is_file_exist(movieFileStr) )
	{
		//---------- play the movie now ---------//

		video.init();

		if( video.init_success )
		{
			video.play_until_end( movieFileStr, hInstance, 60 );
		}

		video.deinit();
	}
}
Exemplo n.º 3
0
//---------- Begin of function main ----------//
//
// Compilation constants:
//
// DEBUG  - normal debugging
// DEBUG2 - shortest path searching and unit action debugging
// DEBUG3 - debugging some functions (e.g. Location::get_loc()) which
//          will cause major slowdown.
//
// Command line paramters:
// -join <named or ip address>
//   Begin the program by attempting to connect to the specified address.
// -host
//   Begin the program by hosting a multiplayer match
// -name <player name>
//   Set the name you wish to be known as.
//
// You cannot specify -join or -host more than once.
//
int main(int argc, char **argv)
{
#ifndef _MSC_VER
	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);
#endif

	const char *lobbyJoinCmdLine = "-join";
	const char *lobbyHostCmdLine = "-host";
	const char *lobbyNameCmdLine = "-name";
	char *join_host = NULL;
	int lobbied = 0;

	sys.set_config_dir();

	//try to read from CONFIG.DAT, moved to AM.CPP

	if( !config.load("CONFIG.DAT") )
	{
		new_config_dat_flag = 1;
		config.init();
	}

	//----- read command line arguments -----//

	for (int i = 0; i < argc; i++) {
		if (!strcmp(argv[i], lobbyJoinCmdLine)) {
			if (lobbied) {
				ERR("You cannot specify multiple -host or -join options.\n");
				return 1;
			}
			if (i >= argc - 1) {
				ERR("The %s switch requires a hostname parameter.\n", lobbyJoinCmdLine);
				return 1;
			}
			lobbied = 1;
			join_host = argv[i+1];
			i++;
		} else if (!strcmp(argv[i], lobbyHostCmdLine)) {
			if (lobbied) {
				ERR("You cannot specify multiple -host or -join options.\n");
				return 1;
			}
			lobbied = 1;
		} else if (!strcmp(argv[i], lobbyNameCmdLine)) {
			if (i >= argc - 1) {
				ERR("The %s switch requires a hostname parameter.\n", lobbyNameCmdLine);
				return 1;
			}
			strncpy(config.player_name, argv[i+1], config.PLAYER_NAME_LEN);
			config.player_name[config.PLAYER_NAME_LEN] = 0;
			i++;
		}
	}

#ifdef ENABLE_INTRO_VIDEO
	//----------- play movie ---------------//

	if (!sys.set_game_dir())
		return 1;

	if (!lobbied)
	{
		String movieFileStr;
		movieFileStr = DIR_MOVIE;
		movieFileStr += "INTRO.AVI";

		video.set_skip_on_fail();

		// ###### begin Gilbert 29/10 #####//
		if( !misc.is_file_exist("SKIPAVI.SYS") && misc.is_file_exist(movieFileStr) )
		// ###### end Gilbert 29/10 #####//
		{
			//---------- play the movie now ---------//

			video.init();

			if( video.init_success )
			{
				video.play_until_end( movieFileStr, hInstance, 60 );
			}
			else
			{
				// display a message box (note:sys.main_hwnd is not valid)
				// MessageBox( NULL, "Cannot initialize ActiveMovie",
				//   "Seven Kingdoms", MB_OK | MB_ICONWARNING | MB_DEFBUTTON1 | MB_TASKMODAL );
			}

			video.deinit();
		}
	}
#endif // ENABLE_INTRO_VIDEO

	if( !sys.init() )
		return FALSE;

	err.set_extra_handler( extra_error_handler );   // set extra error handler, save the game when a error happens

	if (!lobbied)
		game.main_menu();
#ifndef DISABLE_MULTI_PLAYER
	else
		game.multi_player_menu(lobbied, join_host);
#endif // DISABLE_MULTI_PLAYER

	sys.deinit();

	return 1;
}
Exemplo n.º 4
0
//---------- Begin of function WinMain ----------//
//¹ç
// WinMain - initialization, message loop
//
// Compilation constants:
//
// DEBUG  - normal debugging
// DEBUG2 - shortest path searching and unit action debugging
// DEBUG3 - debugging some functions (e.g. Location::get_loc()) which
//          will cause major slowdown.
//
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
						  LPSTR lpCmdLine, int nCmdShow)
{
	//try to read from CONFIG.DAT, moved to AM.CPP

	if( !config.load("CONFIG.DAT") )
	{
		new_config_dat_flag = 1;
		config.init();
   }

	//--------------------------------------//


#ifdef IMAGICMP
	static char lobbyLaunchCmdLine[] = "IM";
#else
	static char lobbyLaunchCmdLine[] = "-!lobby!";
#endif

#ifdef ENABLE_INTRO_VIDEO
	//----------- play movie ---------------//

	sys.set_game_dir();
	if( strstr(lpCmdLine, lobbyLaunchCmdLine) == NULL )	// skip if launch from lobby
	{
		String movieFileStr;
		movieFileStr = DIR_MOVIE;
		movieFileStr += "INTRO.AVI";

		video.set_skip_on_fail();

		// ###### begin Gilbert 29/10 #####//
		if( !m.is_file_exist("SKIPAVI.SYS") && m.is_file_exist(movieFileStr) )
		// ###### end Gilbert 29/10 #####//
		{
			//---------- play the movie now ---------//

			video.init();

			if( video.init_success )
			{
				video.play_until_end( movieFileStr, hInstance, 60 );
			}
			else
			{
				// display a message box (note:sys.main_hwnd is not valid)
				// MessageBox( NULL, "Cannot initialize ActiveMovie",
				//   "Seven Kingdoms", MB_OK | MB_ICONWARNING | MB_DEFBUTTON1 | MB_TASKMODAL );
			}

			video.deinit();
		}
	}
#endif // ENABLE_INTRO_VIDEO

   if( !sys.init(hInstance) )
      return FALSE;

   err.set_extra_handler( extra_error_handler );   // set extra error handler, save the game when a error happens

#ifdef DEMO
	game.demo_disp_logo();
   game.main_menu();
#else
	if( strstr(lpCmdLine, lobbyLaunchCmdLine) == NULL )
	   game.main_menu();
#ifndef DISABLE_MULTI_PLAYER
	else
		game.multi_player_menu(lpCmdLine);		// if detect launched from lobby
#endif // DISABLE_MULTI_PLAYER
#endif

   sys.deinit();

   return 1;
}