Example #1
0
END_KEYBOARD_CB

START_KEYBOARD_CB( behind_view_cb )
{
    if ( release ) return;
    set_view_mode( plyr, BEHIND );
    setparam_view_mode( BEHIND );
}
Example #2
0
END_KEYBOARD_CB

START_KEYBOARD_CB( follow_view_cb )
{
    if ( release ) return;
    set_view_mode( plyr, FOLLOW );
    setparam_view_mode( FOLLOW );
}
Example #3
0
END_KEYBOARD_CB


START_KEYBOARD_CB( above_view_cb )
{
    if ( release ) return;
    set_view_mode( plyr, ABOVE );
    setparam_view_mode( ABOVE );
}
Example #4
0
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 ); */
}
Example #5
0
bool
Racing::keyPressEvent(SDLKey key)
{
	switch(key){
		case 'q':
			gameMgr->abortRace();
	    		set_game_mode( GAME_OVER );
	    		return true;
		case SDLK_ESCAPE: 
			set_game_mode( PAUSED );
			return true;	
		case '1':
    		set_view_mode( players[0], ABOVE );
    		setparam_view_mode( ABOVE );
			return true;
		case '2':
			set_view_mode( players[0], FOLLOW );
			setparam_view_mode( FOLLOW );
			return true;
		case '3':
			set_view_mode( players[0], BEHIND );
			setparam_view_mode( BEHIND );
			return true;	
		case 's':
    		screenshot();
			return true;
		case 'p':
			set_game_mode( PAUSED );
			return true;
		default:
			if(key==getparam_reset_key()){
				set_game_mode( RESET );
				return true;
			}
	}
		
	return false;
}
Example #6
0
END_KEYBOARD_CB

START_KEYBOARD_CB( switch_view_cb )
{
    if ( release ) return;
    int current_view = getparam_view_mode();
    if (current_view == TUXEYE)
        current_view = ABOVE;
    else
        current_view = TUXEYE;
    set_view_mode( plyr, current_view );
    setparam_view_mode( current_view );
    saveparamViewMode( current_view );
}
Example #7
0
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" );	
}
Example #8
0
void
resize(JNIEnv *env, jobject thiz, jint width, jint height) {
    cenv = env;

    mWidth = width;
    mHeight = height;

    nclass = (*cenv)->FindClass(cenv, classPathName);
    OnStartMusic = (*cenv)->GetStaticMethodID(cenv, nclass, "OnStartMusic", "(Ljava/lang/String;I)V");
    OnStopMusic = (*cenv)->GetStaticMethodID(cenv, nclass, "OnStopMusic", "()V");
    OnStartSound = (*cenv)->GetStaticMethodID(cenv, nclass, "OnStartSound", "(Ljava/lang/String;I)V");
    OnVolumeSound = (*cenv)->GetStaticMethodID(cenv, nclass, "OnVolumeSound", "(Ljava/lang/String;I)V");
    OnStopSound = (*cenv)->GetStaticMethodID(cenv, nclass, "OnStopSound", "(Ljava/lang/String;)V");

    soundEnabled = (*cenv)->GetStaticFieldID(cenv, nclass, "soundEnabled", "I");
    int snd = (*cenv)->GetStaticIntField(cenv, nclass, soundEnabled);
    
    videoQuality = (*cenv)->GetStaticFieldID(cenv, nclass, "videoQuality", "I");
    int vid = (*cenv)->GetStaticIntField(cenv, nclass, videoQuality);

    viewMode = (*cenv)->GetStaticFieldID(cenv, nclass, "viewMode", "I");
    int vim = (*cenv)->GetStaticIntField(cenv, nclass, viewMode);

    if (!initDone) {
        libtuxracer_main(0, NULL);
        setparam_x_resolution(mWidth);
        setparam_y_resolution(mHeight);
        setparam_music_enabled(snd);
        setparam_sound_enabled(snd);
        setparam_video_quality(vid);
        set_video_quality(vid);
        setparam_view_mode(vim);
        initDone = 1;
    } else {
        setparam_x_resolution(mWidth);
        setparam_y_resolution(mHeight);
    }

}