Ejemplo n.º 1
0
int main( int argc, char **argv ) {
#ifdef __PSP__
    callbacks_setup();
#endif

    // ****************************************************************
    printf ("\n----------- Extreme Tux Racer " VERSION " ----------------");
    printf ("\n----------- (C) 2010 Extreme Tuxracer Team  --------\n\n ");

    srand (time (NULL));
    InitConfig (argv[0]);
    InitGame (argc, argv);
    Winsys.Init ();
    InitOpenglExtensions ();
    // for checking the joystick and the OpgenGL version (the info is
    // written on the console):
    //	Winsys.PrintJoystickInfo ();
    //	PrintGLInfo ();

    // register loop functions
    splash_screen_register();
    regist_register ();
    intro_register();
    racing_register();
    game_over_register();
    paused_register();
    reset_register();
    game_type_select_register();
    RegisterGameConfig ();
    event_select_register();
    event_register ();
    RaceSelectRegister();
    credits_register();
    loading_register();
    RegisterKeyInfo ();
    RegisterToolFuncs ();
    NewPlayerRegister ();
    RegisterScoreFunctions ();
    RegisterTestFuncs ();

    // theses resources must or should be loaded before splashscreen starts
    Course.MakeStandardPolyhedrons ();
    Tex.LoadTextureList ();
    FT.LoadFontlist ();
    Winsys.SetFonttype ();
    Audio.Open ();
    Sound.LoadSoundList ();
    Music.LoadMusicList ();
    Music.SetVolume (param.music_volume);

    g_game.mode = NO_MODE;

    switch (g_game.argument) {
    case 0:
        Winsys.SetMode (SPLASH);
        break;
    case 4:
        g_game.toolmode = TUXSHAPE;
        Winsys.SetMode (TOOLS);
        break;
    case 9:
        Winsys.SetMode (OGLTEST);
        break;
    }

    Winsys.EventLoop ();
    return 0;
}
Ejemplo n.º 2
0
int main( int argc, char **argv ) 
{
    /* Print copyright notice */

    fprintf( stderr, 
         "Tux Rider World Challenge -- http://www.barlow-server.com\n"
         "a fork from:\n"
         "Tux Racer " VERSION " -- a Sunspire Studios Production "
	     "(http://www.sunspirestudios.com)\n"
	     "(c) 1999-2000 Jasmin F. Patry "
	     "<*****@*****.**>\n"
	     "\"Tux Racer\" is a trademark of Jasmin F. Patry\n"
	     "Tux Rider World Challenge comes with ABSOLUTELY NO WARRANTY. "
	     "This is free software,\nand you are welcome to redistribute "
	     "it under certain conditions.\n"
	     "See http://www.gnu.org/copyleft/gpl.html for details.\n\n" );

    /* Init the game clock */
    g_game.secs_since_start = 0;

    /* Seed the random number generator */
    srand( time(NULL) );


    /*
     * Set up the game configuration
     */

    /* Don't support multiplayer, yet... */
    g_game.num_players = 2;

    /* Create a Tcl interpreter */
    g_game.tcl_interp = Tcl_CreateInterp();

    if ( g_game.tcl_interp == NULL ) {
	handle_error( 1, "cannot create Tcl interpreter" ); 
    }

    /* Setup the configuration variables and read the ~/.tuxracer/options file */
    init_game_configuration();
    read_config_file();

    /* Set up the debugging modes */
    init_debug();

    /* Setup diagnostic log if requested */
    if ( getparam_write_diagnostic_log() ) {
	setup_diagnostic_log();
    }

    /*
     * Setup Tcl stdout and stderr channels to point to C stdout and stderr 
     * streams
     */
    setup_tcl_std_channels();


    /* 
     * Initialize rendering context, create window
     */
    winsys_init( &argc, argv, WINDOW_TITLE, WINDOW_TITLE );


    /* Ingore key-repeat messages */
    winsys_enable_key_repeat(0);


    /* Set up a function to clean up when program exits */
    winsys_atexit( cleanup );

    /* 
     * Initial OpenGL settings 
     */
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

    init_opengl_extensions();

    /* Print OpenGL debugging information if requested */
    if ( debug_mode_is_active( DEBUG_GL_INFO ) ) {
	print_debug( DEBUG_GL_INFO, 
		     "OpenGL information:" );
	print_gl_info();
    }


    /* 
     * Load the game data and initialize game state
     */
    register_game_config_callbacks( g_game.tcl_interp );
    register_course_load_tcl_callbacks( g_game.tcl_interp );
    register_key_frame_callbacks( g_game.tcl_interp );
    register_fog_callbacks( g_game.tcl_interp );
    register_course_light_callbacks( g_game.tcl_interp );
    register_particle_callbacks( g_game.tcl_interp );
    register_texture_callbacks( g_game.tcl_interp );
    register_font_callbacks( g_game.tcl_interp );
    register_sound_tcl_callbacks( g_game.tcl_interp );
    register_sound_data_tcl_callbacks( g_game.tcl_interp );
    register_course_manager_callbacks( g_game.tcl_interp );


    init_saved_games();
    load_tux();
    init_textures();
    init_fonts();
    init_audio_data();
    init_audio();
    init_ui_manager();
    init_course_manager();
    init_joystick();

    /* Read the tuxracer_init.tcl file */
    read_game_init_script();

    /* Need to set up an initial view position for select_course 
       (quadtree simplification)
    */
    
    //Player 0 = classic mode player ; Player 1 = Speed Only Mode Player
    
    g_game.player[0].view.pos = make_point( 0., 0., 0. );
    g_game.player[1].view.pos = make_point( 0., 0., 0. );
    

    /* Placeholder name until we give players way to enter name */
    g_game.player[0].name = "noname";
    g_game.player[1].name = "nonameSpeedOnly";
   

    init_preview();

    splash_screen_register();
    intro_register();
    racing_register();
    game_over_register();
    paused_register();
    reset_register();
    game_type_select_register();
    racing_mode_select_register();
    event_select_register();
    race_select_register();
    credits_register();
    loading_register();

    g_game.mode = NO_MODE;
    set_game_mode( SPLASH );

    g_game.difficulty = DIFFICULTY_LEVEL_NORMAL;

    init_keyboard();
    

    winsys_show_cursor( False );

    /* We use this to "prime" the GLUT loop */
    winsys_set_idle_func( main_loop );

    
    /* 
     * ...and off we go!
     */
    winsys_process_events();

    return 0;
}