Exemplo n.º 1
0
//Inputs the player's name, without putting up the background screen
RegisterPlayer()
{
	int i,j;
	char filename[14];
	int allow_abort_flag = 1;

	if ( Players[Player_num].callsign[0] == 0 )	{
		//---------------------------------------------------------------------
		// Set default config options in case there is no config file
		// kc_keyboard, kc_joystick, kc_mouse are statically defined.
		Config_joystick_sensitivity = 8;
		Config_control_type =CONTROL_NONE;
		for (i=0; i<CONTROL_MAX_TYPES; i++ )
			for (j=0; j<MAX_CONTROLS; j++ )
				kconfig_settings[i][j] = default_kconfig_settings[i][j];
		kc_set_controls();
		//----------------------------------------------------------------

		// Read the last player's name from config file, not lastplr.txt
		strncpy( Players[Player_num].callsign, config_last_player, CALLSIGN_LEN );

		if (config_last_player[0]==0)
			allow_abort_flag = 0;
	}

do_menu_again:
	;

	if (!newmenu_get_filename( TXT_SELECT_PILOT, "*.plr", filename, allow_abort_flag ))	{
		return 0;		// They hit Esc in file selector
	}

	if ( filename[0] == '<' )	{
		// They selected 'create new pilot'
		if (!MakeNewPlayerFile(allow_abort_flag))
			//return 0;		// They hit Esc during enter name stage
			goto do_menu_again;
	} else {
		strncpy(Players[Player_num].callsign,filename, CALLSIGN_LEN);
	}

	read_player_file();

	Auto_leveling_on = Default_leveling_on;

	WriteConfigFile();		// Update lastplr

	return 1;
}
Exemplo n.º 2
0
//Inputs the player's name, without putting up the background screen
int RegisterPlayer()
{
	char filename[14];
	int allow_abort_flag = 1;

        if ( Players[Player_num].callsign[0] == 0 )     {
		// Read the last player's name from config file, not lastplr.txt
		strncpy( Players[Player_num].callsign, GameCfg.LastPlayer, CALLSIGN_LEN );

		if (GameCfg.LastPlayer[0]==0)
			allow_abort_flag = 0;
        }

do_menu_again:
	;

	if (!newmenu_get_filename( TXT_SELECT_PILOT, ".plr", filename, allow_abort_flag ))	{
		goto do_menu_again;		// They hit Esc in file selector
	}

	if ( filename[0] == '<' )	{
		// They selected 'create new pilot'
		if (!MakeNewPlayerFile(allow_abort_flag))
			//return 0;		// They hit Esc during enter name stage
			goto do_menu_again;
	} else {
		strncpy(Players[Player_num].callsign,filename, CALLSIGN_LEN);
		strlwr(Players[Player_num].callsign);
	}

	read_player_file();

	WriteConfigFile();		// Update lastplr

        return 1;
}