コード例 #1
0
ファイル: racing.c プロジェクト: LeifAndersen/TuxRider
void racing_init(void) 
{
    player_data_t *plyr = get_player_data( local_player() );
    
    winsys_set_display_func( main_loop );
    winsys_set_idle_func( main_loop );
    winsys_set_reshape_func( reshape );
    winsys_set_mouse_func( NULL );
    winsys_set_motion_func( NULL );
    winsys_set_passive_motion_func( NULL );
    winsys_set_mouse_func( NULL );
    
    /* Initialize view */
    if ( getparam_view_mode() < 0 || 
        getparam_view_mode() >= NUM_VIEW_MODES ) 
    {
        setparam_view_mode( ABOVE );
    }
    set_view_mode( plyr, (view_mode_t)getparam_view_mode() );
    
    /* We need to reset controls here since callbacks won't have been
     called in paused mode. This results in duplication between this
     code and init_physical_simulation.  Oh well. */
    left_turn = right_turn = paddling = False;
    trick_modifier = False;
    charging = False;
    plyr->control.turn_fact = 0.0;
    plyr->control.turn_animation = 0.0;
    plyr->control.is_braking = False;
    plyr->control.is_paddling = False;
    plyr->control.jumping = False;
    plyr->control.jump_charging = False;
    
#ifdef __APPLE__
    plyr->control.is_flying=False;
    plyr->control.fly_total_time=0;
#endif
    
    /* Set last_terrain to a value not used below */
    last_terrain = 0;
    
    if ( g_game.prev_mode != PAUSED ) {
        init_physical_simulation();
    }
    
    last_terrain = 0;
    
    g_game.race_aborted = False;
#ifdef __APPLE__
    g_game.race_time_over = False;
#endif
    
    play_music( "racing" );
    /* play_sound( "start_race", 0 ); */
}
コード例 #2
0
ファイル: racing.cpp プロジェクト: gonium/fc-extremetuxracer
Racing::Racing()
{
	m_rightTurn = false;
	m_leftTurn = false;
	m_trickModifier = false;
	m_paddling = false;
	m_charging = false;
	m_braking = false;
	
    // Initialize view
    if ( getparam_view_mode() < 0 || 
		getparam_view_mode() >= NUM_VIEW_MODES ) 
    {
		setparam_view_mode( ABOVE );
    }
    set_view_mode( players[0], (view_mode_t)getparam_view_mode() );

    // We need to reset controls here since callbacks won't have been
    //   called in paused mode. This results in duplication between this
    //   code and init_physical_simulation.  Oh well. 

    players[0].control.turn_fact = 0.0;
    players[0].control.turn_animation = 0.0;
    players[0].control.is_braking = false;
    players[0].control.is_paddling = false;
    players[0].control.jumping = false;
    players[0].control.jump_charging = false;
	players[0].max_speed = 0;

    // Set last_terrain to a value not used below
    m_lastTerrain = 0;
    
    if ( GameMode::prevmode != PAUSED ) {
		init_physical_simulation();
    }

    gameMgr->abortRace(false);
	
	init_snow(players[0].view.pos);
		
    play_music( "racing" );	
}