示例#1
0
文件: gob.cpp 项目: 86400/scummvm
GobEngine::~GobEngine() {
	deinitGameParts();

	delete _console;
}
示例#2
0
文件: gob.cpp 项目: 86400/scummvm
Common::Error GobEngine::initGameParts() {
	_resourceSizeWorkaround = false;

	// just detect some devices some of which will be always there if the music is not disabled
	_noMusic = MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB)) == MT_NULL ? true : false;

	_endiannessMethod = kEndiannessMethodSystem;

	_global    = new Global(this);
	_util      = new Util(this);
	_dataIO    = new DataIO();
	_palAnim   = new PalAnim(this);
	_vidPlayer = new VideoPlayer(this);
	_sound     = new Sound(this);
	_game      = new Game(this);

	switch (_gameType) {
	case kGameTypeGob1:
		_init     = new Init_v1(this);
		_video    = new Video_v1(this);
		_inter    = new Inter_v1(this);
		_mult     = new Mult_v1(this);
		_draw     = new Draw_v1(this);
		_map      = new Map_v1(this);
		_goblin   = new Goblin_v1(this);
		_scenery  = new Scenery_v1(this);

		// WORKAROUND: The EGA version of Gobliiins claims a few resources are
		//             larger than they actually are. The original happily reads
		//             past the resource structure boundary, but we don't.
		//             To make sure we don't throw an error like we normally do
		//             (which leads to these resources not loading), we enable
		//             this workaround that automatically fixes the resources
		//             sizes.
		//
		//             This glitch is visible in levels
		//             - 03 (ICIGCAA)
		//             - 09 (ICVGCGT)
		//             - 16 (TCVQRPM)
		//             - 20 (NNGWTTO)
		//             See also ScummVM bug report #7162.
		if (isEGA())
			_resourceSizeWorkaround = true;
		break;

	case kGameTypeGeisha:
		_init     = new Init_Geisha(this);
		_video    = new Video_v1(this);
		_inter    = new Inter_Geisha(this);
		_mult     = new Mult_v1(this);
		_draw     = new Draw_v1(this);
		_map      = new Map_v1(this);
		_goblin   = new Goblin_v1(this);
		_scenery  = new Scenery_v1(this);
		_saveLoad = new SaveLoad_Geisha(this, _targetName.c_str());

		_endiannessMethod = kEndiannessMethodAltFile;
		break;

	case kGameTypeFascination:
		_init     = new Init_Fascination(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_Fascination(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_Fascination(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_Fascination(this, _targetName.c_str());
		break;

	case kGameTypeWeen:
	case kGameTypeGob2:
	case kGameTypeCrousti:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
		break;

	case kGameTypeBargon:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_Bargon(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_Bargon(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
		break;

	case kGameTypeLittleRed:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_LittleRed(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);

		// WORKAROUND: Little Red Riding Hood has a small resource size glitch in the
		//             screen where Little Red needs to find the animals' homes.
		_resourceSizeWorkaround = true;
		break;

	case kGameTypeAJWorld:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_AJWorld(this, _targetName.c_str());
		break;

	case kGameTypeGob3:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v3(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v3(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeGob3);
		break;

	case kGameTypeInca2:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_Inca2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v3(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_Inca2(this, _targetName.c_str());
		break;

	case kGameTypeLostInTime:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v3(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v3(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeLost);
		break;

	case kGameTypeWoodruff:
		_init     = new Init_v4(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v4(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v4(this, _targetName.c_str());
		break;

	case kGameTypeDynasty:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v5(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad(this);
		break;

	case kGameTypeUrban:
		_init     = new Init_v6(this);
		_video    = new Video_v6(this);
		_inter    = new Inter_v6(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v6(this, _targetName.c_str());
		break;

	case kGameTypePlaytoons:
	case kGameTypeBambou:
		_init     = new Init_v2(this);
		_video    = new Video_v6(this);
		_inter    = new Inter_Playtoons(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_Playtoons(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_Playtoons(this, _targetName.c_str());
		break;

	case kGameTypeAdibou2:
	case kGameTypeAdi2:
	case kGameTypeAdi4:
		_init     = new Init_v7(this);
		_video    = new Video_v6(this);
		_inter    = new Inter_v7(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v7(this, _targetName.c_str());
		break;

	case kGameTypeAdibou1:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
		break;

	case kGameTypeAbracadabra:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_preGob   = new OnceUpon::Abracadabra(this);
		break;

	case kGameTypeBabaYaga:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_preGob   = new OnceUpon::BabaYaga(this);
		break;

	default:
		deinitGameParts();
		return Common::kUnsupportedGameidError;
	}

	// Setup mixer
	syncSoundSettings();

	if (_inter)
		_inter->setupOpcodes();

	return Common::kNoError;
}
示例#3
0
bool GobEngine::initGameParts() {
	// just detect some devices some of which will be always there if the music is not disabled
	_noMusic = MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB)) == MT_NULL ? true : false;
	_saveLoad = 0;

	_global    = new Global(this);
	_util      = new Util(this);
	_dataIO    = new DataIO();
	_palAnim   = new PalAnim(this);
	_vidPlayer = new VideoPlayer(this);
	_sound     = new Sound(this);
	_game      = new Game(this);

	switch (_gameType) {
	case kGameTypeGeisha:
	case kGameTypeGob1:
		_init     = new Init_v1(this);
		_video    = new Video_v1(this);
		_inter    = new Inter_v1(this);
		_mult     = new Mult_v1(this);
		_draw     = new Draw_v1(this);
		_map      = new Map_v1(this);
		_goblin   = new Goblin_v1(this);
		_scenery  = new Scenery_v1(this);
		break;

	case kGameTypeFascination:
		_init     = new Init_Fascination(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_Fascination(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_Fascination(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_Fascination(this, _targetName.c_str());
		break;

	case kGameTypeWeen:
	case kGameTypeGob2:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
		break;

	case kGameTypeBargon:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_Bargon(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_Bargon(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
		break;

	case kGameTypeGob3:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v3(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v3(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeGob3);
		break;

	case kGameTypeInca2:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_Inca2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v3(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_Inca2(this, _targetName.c_str());
		break;

	case kGameTypeLostInTime:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v3(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v3(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeLost);
		break;

	case kGameTypeWoodruff:
		_init     = new Init_v4(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v4(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v4(this, _targetName.c_str());
		break;

	case kGameTypeDynasty:
		_init     = new Init_v3(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v5(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad(this);
		break;

	case kGameTypeUrban:
		_init     = new Init_v6(this);
		_video    = new Video_v6(this);
		_inter    = new Inter_v6(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v6(this, _targetName.c_str());
		break;

	case kGameTypePlaytoons:
	case kGameTypeBambou:
		_init     = new Init_v2(this);
		_video    = new Video_v6(this);
		_inter    = new Inter_Playtoons(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_Playtoons(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_Playtoons(this, _targetName.c_str());
		break;

	case kGameTypeAdibou2:
	case kGameTypeAdi2:
	case kGameTypeAdi4:
		_init     = new Init_v2(this);
		_video    = new Video_v6(this);
		_inter    = new Inter_v7(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v4(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v7(this, _targetName.c_str());
		break;

	case kGameTypeAdibou1:
		_init     = new Init_v2(this);
		_video    = new Video_v2(this);
		_inter    = new Inter_v2(this);
		_mult     = new Mult_v2(this);
		_draw     = new Draw_v2(this);
		_map      = new Map_v2(this);
		_goblin   = new Goblin_v2(this);
		_scenery  = new Scenery_v2(this);
		_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
		break;
	default:
		deinitGameParts();
		return false;
	}

	_inter->setupOpcodes();

	return true;
}