// MTE MK1 (la Churrera) v5.0
// Copyleft 2010-2014, 2020 by the Mojon Twins

// You can change this function as fit

void title_screen (void) {
	// Poner teclado por defecto, cargamos las teclas
	_gp_gen = def_keys;
	copy_keys();
	
	blackout ();
	
	if (score > hiscore) { 
		hiscore = score; 
		update_records(); 
		show_records(); 
	}
	bonus_time = 0; next_bonus = 5;
	next_extra_life = 5000;
	musica_contador = 0;
	musica_id = 0;
	#ifdef MODE_128K
		get_resource (TITLE_BIN, BASE_SUPERBUFF);
	#else		
		unpack ((unsigned int) (s_title), BASE_SUPERBUFF);
	#endif
			
	cpc_ShowTileMap (1);
	// Do a simple 0 start/1 redefine menu
	// AY_PLAY_MUSIC (0); // Ya está puesta en la intro al final
	aux1 = 18000;
	while (1) {
		if (cpc_TestKey (KEY_AUX3)) { _gp_gen = def_keys; break; }
		if (cpc_TestKey (KEY_AUX4)) { _gp_gen = def_keys_joy; break; }
		if (cpc_TestKey (KEY_AUX1) || aux1 == 0) { 
			if (vueltas_intro == 0) intro(); else show_records(); 
			aux1 = 18000;
			vueltas_intro--;
			unpack ((unsigned int) (s_title), BASE_SUPERBUFF);
			cpc_ShowTileMap (1);
		}
		aux1--;
	}	
	// music_fade_out();
	// espera_activa(60);
	AY_STOP_SOUND ();
	
	copy_keys();
	aux1 = 0;
}
