void textmode(int mode) { union REGS regs; int mode_to_set = mode; if (mode == LASTMODE) mode = mode_to_set = txinfo.currmode; if (mode == C4350) /* * just set mode 3 and load 8x8 font, idea taken * (and code translated from Assembler to C) * form Csaba Biegels stdvga.asm */ mode_to_set = 0x03; regs.h.ah = 0x00; /* set mode */ regs.h.al = mode_to_set; int86(0x10, ®s, ®s); if (mode == C80 || mode == BW80 || mode == C4350) { if (isEGA()) { /* * enable cursor size emulation, see Ralf Browns * interrupt list */ regs.h.ah = 0x12; regs.h.bl = 0x34; regs.h.al = 0x00; /* 0: enable (1: disable) */ int86(0x10, ®s, ®s); } } if (mode == C4350) { if (!isEGA()) return; /* load 8x8 font */ regs.x.ax = 0x1112; regs.x.bx = 0; int86(0x10, ®s, ®s); } /* _setcursortype(_NORMALCURSOR); */ /* reinitialize txinfo structure to take into account new mode */ gppconio_init(); #if 0 /* * For mode C4350 the screen is not cleared on my OAK-VGA. * Should we clear it here? TURBOC doesn't so we don't bother either. */ clrscr(); #endif }
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; }