Exemplo n.º 1
0
void AgiEngine::initialize() {
	memset(&opt, 0, sizeof(struct agi_options));
	opt.gamerun = GAMERUN_RUNGAME;
	opt.hires = true;

	// TODO: Some sound emulation modes do not fit our current music
	//       drivers, and I'm not sure what they are. For now, they might
	//       as well be called "PC Speaker" and "Not PC Speaker".

	switch (MidiDriver::detectMusicDriver(MDT_PCSPK)) {
	case MD_PCSPK:
		opt.soundemu = SOUND_EMU_PC;
		break;
	default:
		opt.soundemu = SOUND_EMU_NONE;
		break;
	}

	if (ConfMan.hasKey("render_mode"))
		opt.renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());

	_console = new Console(this);

	init_machine();

	game.color_fg = 15;
	game.color_bg = 0;

	*game.name = 0;

	game.sbuf = (uint8 *) calloc(_WIDTH, _HEIGHT);
	game.hires = (uint8 *) calloc(_WIDTH * 2, _HEIGHT);

	_sprites = new SpritesMan;
	_text = new TextMan;
	init_video();

	tick_timer = 0;
	_timer->installTimerProc(agi_timer_function_low, 10 * 1000, NULL);

	game.ver = -1;		/* Don't display the conf file warning */

	debugC(2, kDebugLevelMain, "Detect game");
	if (agi_detect_game() == err_OK) {
		game.state = STATE_LOADED;
		debugC(2, kDebugLevelMain, "game loaded");
	} else {
		report("Could not open AGI game");
	}

	debugC(2, kDebugLevelMain, "Init sound");
	init_sound();
	g_agi_music = new AGIMusic(_mixer);
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
	char *dir = ".";
	char *pdb = NULL;
	int ec;

	printf("agi2pdb v" VERSION " - Converting Sierra AGI files to PalmOS Database\n"
		"(C) Copyright 2001-2002 Stuart George & Thomas Akesson\n"
		"\n"
		"This program is free software; you can redistribute it and/or modify it\n"
		"under the terms of the GNU General Public License, version 2 or later,\n"
		"as published by the the Free Software Foundation.\n"
		"\n");

	if(argc>3 || (argc==2 && argv[1][1]=='?')) {
		printf("syntax:\n"
			"  agi2pdb {directory} {game.pdb}\n");
		return 0;
	}
	else if (argc>1){
		dir = argv[1];
		if (argc>2)
			pdb = argv[2];
	}

	ec = agi_detect_game (dir);

	if (ec == err_OK) {
		if (loader == &agi_v2)
			printf("AGI version 2 game detected.\n");
		else
			printf("AGI version 3 game detected.\n");


		if (pdb == NULL) {
			pdb = (char*) malloc(32);
			match_crc_name (game.crc, get_config_file(), pdb);
		}
		if (game.ver) {
			agi_init();
			convert2pdb (loader, pdb);
		}
		else {
			printf("Game version could not be determined.\n"
			"Make sure Sarien configuration file is available!\n");
		}
	}
	else {
		printf("No AGI game detected.\n");
		return 1;
	}
	return 0;
}