Пример #1
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;
}
Пример #2
0
int run_game() {
	int i, ec = err_OK;

	if (opt.renderMode == Common::kRenderCGA)
		opt.hires = 0;

	for (i = 0; i < MAX_DIRS; i++)
		memset(&game.ev_keyp[i], 0, sizeof(struct agi_event));

	/* Execute the game */
	do {
		debugC(2, kDebugLevelMain, "game loop");
		debugC(2, kDebugLevelMain, "game.ver = 0x%x", game.ver);

		if (agi_init() != err_OK)
			break;
		if (ec == err_RestartGame)
			setflag(F_restart_game, true);

		setvar(V_computer, 0);	/* IBM PC (4 = Atari ST) */
		setvar(V_soundgen, 1);	/* IBM PC SOUND */
		setvar(V_monitor, 0x3);	/* EGA monitor */
		setvar(V_max_input_chars, 38);
		game.input_mode = INPUT_NONE;
		game.input_enabled = 0;
		game.has_prompt = 0;

		game.state = STATE_RUNNING;
		ec = play_game();
		game.state = STATE_LOADED;
		agi_deinit();
	} while (ec == err_RestartGame);

	delete menu;
	menu = 0;

	release_image_stack();

	return ec;
}