#include <stdio.h>
#include <stdlib.h>
#include <allegro.h>

void Restart();
void Quit();

void Dead() {
	
	clear_to_color(screen, makecol(0, 0, 255));
	
	text_mode(-1);
	
	textout_centre(screen, font, "GAME OVER", SCREEN_W / 2, SCREEN_H / 2, makecol(255, 255, 255));
	
	textout_centre(screen, font, "You are dead, but Chuck give", SCREEN_W / 2, SCREEN_H / 2 + 15, makecol(255, 255, 255));
	textout_centre(screen, font, "you another chance", SCREEN_W / 2, SCREEN_H / 2 + 25, makecol(255, 255, 255));

	textout_centre(screen, font, "Press [R] to restart", SCREEN_W / 2, SCREEN_H / 2 + 50, makecol(255, 255, 255));
	textout_centre(screen, font, "Press [Q] to quit", SCREEN_W / 2, SCREEN_H / 2 + 65, makecol(255, 255, 255));		
	
	while (true) {
		
		if (key[KEY_R]) {
			
			atexit(Restart);
			exit(0);
			
		} else if (key[KEY_Q]) {
			
			atexit(Quit);
			exit(0);
			
		}
		
	}
	
}

void Restart() 
{
  allegro_exit();
	system("pokus.exe");
}

void Quit() 
{
  allegro_exit();
	system("menu.exe");
}

int main () {
	
	allegro_init();
	install_keyboard();
	set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 1024, 768, 0, 0);
	
	Dead();
	
}
END_OF_MAIN();
