#include <allegro.h>
#include "data.h"

void vg_lselect_logic(void)
{
	if(key[KEY_ENTER])
	{
		ncds_stop_music();
		fade_out(4);
		vg_level = load_level("world.vgl");
		read_level_data(vg_level);
		vg_player.sprite.x = itofix(32);
		vg_player.sprite.y = itofix(184);
		vg_player.sprite.vx = itofix(0);
		vg_player.sprite.vy = itofix(0);
		vg_player.sprite.state = VG_CHARACTER_STAND_RIGHT;
		vg_player.sprite.active = 1;
		vg_player.score = 0;
		vg_player.lives = 5;
		vg_player.life = 100;
		vg_player.warp_time = 0;
		vg_player.warp_type = 0;
		vg_last_warp.dx = 32;
		vg_last_warp.dy = 184;
		vg_last_warp.ds = 0;
		vg_state = VG_STATE_GAME;
		vg_logic();
		vg_update();
		vg_draw();
		fade_in(vg_palette, 4);
		ncds_play_music("bgm.xm", 1);
		gametime_reset();
	}
}

void vg_lselect_render(void)
{
	blit(vg_image[VG_IMAGE_LSELECT], vg_screen, 0, 0, 0, 0, vg_screen->w, vg_screen->h);
}
