Esempio n. 1
0
void play_cb(int button, int mouse_x, int mouse_y, widget_bounding_box_t bb, input_type_t input_type, widget_t* widget)
{
	start_race();
}
Esempio n. 2
0
//simple demo:
int main (int argc, char *argv[])
{
	//issue
	printf("\n     -=[ Hello, and welcome to RollCageX version %s ]=-\n\n%s\n", VERSION, ISSUE);
	//end

	if (argc != 1)
		printf("(Passing arguments - not supported)\n\n");

	//check if program was called with another pwd (got '/' in "name")
	if (char *s = strrchr(argv[0], '/'))
	{
		*s='\0'; //modify string to end at last slash
		printf("(changing pwd: %s)\n", argv[0]);
		chdir (argv[0]);
	}

	printlog(0, "Loading...\n");

	load_conf ("data/internal.conf", (char *)&internal, internal_index);

	if (!graphics_init())
		return -1;

	//TODO: there should be menus here, but menu/osd system is not implemented yet... also:
	//on failure, rcx should not just terminate but instead abort the race and warn the user
	
	//MENU: welcome to rcx, please select profile or create a new profile
	Profile *prof = Profile_Load ("data/profiles/default");
	if (!prof)
		return -1; //GOTO: profile menu

	if (!physics_init())
	{
		//menu: warn and quit!
		graphics_quit();
		return -1;
	}

	//MENU: select race type
	// - assuming 2P free roam -
	//MENU: P1: select theme/car
	Car_Template *venom_template = Car_Template::Load("data/teams/Nemesis/cars/Venom");
	if (!venom_template)
		return -1; //GOTO: car selection menu

	//MENU: P2: select theme/car
	Car_Template *reaper_template = Car_Template::Load("data/teams/Vostok/cars/Reaper");
	if (!reaper_template)
		return -1; //GOTO: car selection

	//MENU: select world/track
	if (!load_track((char *)"data/worlds/Sandbox/tracks/Box"))
		return -1; //GOTO: track selection menu

	//TMP: load box for online spawning
	box = Object_Template::Load("data/objects/misc/box");
	sphere = Object_Template::Load("data/objects/misc/sphere");
	funbox = Object_Template::Load("data/objects/misc/funbox");
	if (!box || !sphere || !funbox)
		return -1;

	//spawn car
	Venom = venom_template->Spawn(track.start[0]-4, track.start[1], track.start[2]);
	prof->car = Venom;
	camera.car = Venom;

	//lets spawn another car:
	Reaper = reaper_template->Spawn(track.start[0]+4, track.start[1], track.start[2]);

	//MENU: race configured, start?
	start_race();

	//race done, remove all objects...
	Object::Destroy_All();

	//MENU: race done, replay, play again, quit?
	// - assuming quit -
	
	//remove loaded data (not all data, only "racetime" - for this race)
	Racetime_Data::Destroy_All();

	//MENU: back to main menu here
	// - assuming player wants to log out -
	physics_quit();
	Profile_Remove_All(); //should only be one active profile right now, but any case, remove all

	//MENU: select profile
	// - assumes player wants to quit -
	graphics_quit();
	
	//some basic info (until menu for printing it)
	print_info();

	printf("\nBye!\n\n");
	return 0;
}