From 09c2ea82de295fab011bcddcc7c2bf0ba6dd72d7 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 24 Jul 2007 23:24:40 +0000 Subject: - Separated game type and features - Added feature constants for a 640x480 resolution and adlib - Added support for game with a 640x480 resolution. Woodruff now inits the screen before it segfaults svn-id: r28185 --- engines/gob/detection.cpp | 267 ++++++++++++++++++++++++++++++---------------- engines/gob/game.cpp | 15 +-- engines/gob/global.cpp | 2 +- engines/gob/gob.cpp | 257 ++++++++++++++++++++++++++++---------------- engines/gob/gob.h | 39 +++++-- engines/gob/inter.cpp | 2 +- engines/gob/inter_v1.cpp | 9 +- engines/gob/inter_v2.cpp | 13 +-- engines/gob/map.cpp | 2 +- engines/gob/video.cpp | 4 +- 10 files changed, 401 insertions(+), 209 deletions(-) (limited to 'engines/gob') diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 1c275185ca..a82041ce0e 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -34,7 +34,8 @@ namespace Gob { struct GOBGameDescription { Common::ADGameDescription desc; - uint32 features; + GameType gameType; + int32 features; const char *startTotBase; }; @@ -74,7 +75,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_EGA, + kGameTypeGob1, + kFeaturesEGA, "intro" }, { @@ -86,7 +88,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_EGA, + kGameTypeGob1, + kFeaturesEGA, "intro" }, { // Supplied by Theruler76 in bug report #1201233 @@ -98,7 +101,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1, + kGameTypeGob1, + kFeaturesNone, "intro" }, { // CD 1.000 version. @@ -110,7 +114,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.000 version. @@ -122,7 +127,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.000 version. @@ -134,7 +140,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.000 version. @@ -146,7 +153,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.000 version. @@ -158,7 +166,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.02 version. Multilingual @@ -170,7 +179,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.02 version. Multilingual @@ -182,7 +192,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.02 version. Multilingual @@ -194,7 +205,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.02 version. Multilingual @@ -206,7 +218,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { // CD 1.02 version. Multilingual @@ -218,7 +231,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { @@ -230,7 +244,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_DEMO }, - GF_GOB1, + kGameTypeGob1, + kFeaturesNone, "intro" }, { @@ -242,7 +257,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB1, + kGameTypeGob1, + kFeaturesNone, "intro" }, { // Supplied by paul66 in bug report #1652352 @@ -254,7 +270,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GF_GOB1, + kGameTypeGob1, + kFeaturesAdlib, "intro" }, { // Supplied by paul66 in bug report #1652352 @@ -266,7 +283,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GF_GOB1, + kGameTypeGob1, + kFeaturesAdlib, "intro" }, { // Supplied by paul66 in bug report #1652352 @@ -278,7 +296,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GF_GOB1, + kGameTypeGob1, + kFeaturesAdlib, "intro" }, { // Supplied by paul66 in bug report #1652352 @@ -290,7 +309,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GF_GOB1, + kGameTypeGob1, + kFeaturesAdlib, "intro" }, { // Supplied by paul66 in bug report #1652352 @@ -302,7 +322,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GF_GOB1, + kGameTypeGob1, + kFeaturesAdlib, "intro" }, { @@ -314,7 +335,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { // Supplied by arcepi in bug report #1659884 @@ -326,7 +348,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -338,7 +361,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { // Supplied by fac76 in bug report #1673397 @@ -354,7 +378,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -366,7 +391,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -378,7 +404,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -390,7 +417,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -402,7 +430,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesNone, "intro" }, { // Supplied by blackwhiteeagle in bug report #1605235 @@ -414,7 +443,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { // Supplied by bgk in bug report #1706861 @@ -426,7 +456,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAtariST, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesNone, "intro" }, { @@ -438,7 +469,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2 | GF_CD, + kGameTypeGob2, + kFeaturesCD, "intro" }, { @@ -450,7 +482,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2 | GF_CD, + kGameTypeGob2, + kFeaturesCD, "intro" }, { @@ -462,7 +495,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2 | GF_CD, + kGameTypeGob2, + kFeaturesCD, "intro" }, { @@ -474,7 +508,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2 | GF_CD, + kGameTypeGob2, + kFeaturesCD, "intro" }, { @@ -486,7 +521,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2 | GF_CD, + kGameTypeGob2, + kFeaturesCD, "intro" }, { @@ -498,7 +534,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2 | GF_CD, + kGameTypeGob2, + kFeaturesCD, "intro" }, { @@ -510,7 +547,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "usa" }, { @@ -522,7 +560,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -534,7 +573,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -546,7 +586,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "intro" }, { @@ -558,7 +599,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "intro" }, { // Supplied by cybot_tmin in bug report #1667743 @@ -570,7 +612,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "intro" }, { // Supplied by vampir_raziel in bug report #1658373 @@ -582,7 +625,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesNone, "intro" }, { // Supplied by vampir_raziel in bug report #1658373 @@ -594,7 +638,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesNone, "intro" }, { // Supplied by vampir_raziel in bug report #1658373 @@ -606,7 +651,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesNone, "intro" }, { // Supplied by vampir_raziel in bug report #1658373 @@ -618,7 +664,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesNone, "intro" }, { @@ -630,7 +677,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAtariST, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesNone, "intro" }, { @@ -642,7 +690,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "intro" }, { // Supplied by cartman_ on #scummvm @@ -654,7 +703,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "intro" }, { // Supplied by glorfindel in bugreport #1722142 @@ -666,7 +716,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "intro" }, { @@ -678,7 +729,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "show" }, { @@ -690,7 +742,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB2, + kGameTypeWeen, + kFeaturesAdlib, "show" }, { @@ -702,7 +755,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_BARGON, + kGameTypeBargon, + kFeaturesNone, "intro" }, { // Supplied by Trekky in the forums @@ -714,7 +768,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAtariST, Common::ADGF_NO_FLAGS }, - GF_BARGON, + kGameTypeBargon, + kFeaturesNone, "intro" }, { // Supplied by cesardark in bug #1681649 @@ -726,7 +781,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_BARGON, + kGameTypeBargon, + kFeaturesNone, "intro" }, { // Supplied by paul66 in bug #1692667 @@ -738,7 +794,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_BARGON, + kGameTypeBargon, + kFeaturesNone, "intro" }, { // Supplied by glorfindel in bugreport #1722142 @@ -750,7 +807,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_BARGON, + kGameTypeBargon, + kFeaturesNone, "intro" }, { @@ -762,7 +820,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { // Supplied by fac76 in bug report #1742716 @@ -778,7 +837,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -790,7 +850,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { // Supplied by paul66 in bug report #1652352 @@ -802,7 +863,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -814,7 +876,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { // Supplied by Paranoimia on #scummvm @@ -826,7 +889,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -838,7 +902,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -850,7 +915,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -862,7 +928,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesNone, "menu" }, { @@ -874,7 +941,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformAmiga, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesNone, "menu" }, { @@ -886,7 +954,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3 | GF_CD, + kGameTypeGob3, + kFeaturesCD, "intro" }, { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230 @@ -898,7 +967,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3 | GF_CD, + kGameTypeGob3, + kFeaturesCD, "intro" }, { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230 @@ -910,7 +980,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3 | GF_CD, + kGameTypeGob3, + kFeaturesCD, "intro" }, { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230 @@ -922,7 +993,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3 | GF_CD, + kGameTypeGob3, + kFeaturesCD, "intro" }, { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230 @@ -934,7 +1006,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3 | GF_CD, + kGameTypeGob3, + kFeaturesCD, "intro" }, { // Supplied by paul66 and noizert in bug reports #1652352 and #1691230 @@ -946,7 +1019,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3 | GF_CD, + kGameTypeGob3, + kFeaturesCD, "intro" }, { @@ -958,7 +1032,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -970,7 +1045,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -982,7 +1058,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -994,7 +1071,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_DEMO }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -1006,7 +1084,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_WOODRUFF, + kGameTypeNone, + kFeatures640 | kFeaturesAdlib, "intro" }, { @@ -1018,7 +1097,8 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_WOODRUFF, + kGameTypeNone, + kFeatures640 | kFeaturesAdlib, "intro" }, { @@ -1030,10 +1110,11 @@ static const GOBGameDescription gameDescriptions[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_WOODRUFF, + kGameTypeNone, + kFeatures640 | kFeaturesAdlib, "intro" }, - { AD_TABLE_END_MARKER, 0, NULL } + { AD_TABLE_END_MARKER, kGameTypeNone, kFeaturesNone, NULL } }; static const GOBGameDescription fallbackDescs[] = { @@ -1046,7 +1127,8 @@ static const GOBGameDescription fallbackDescs[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1, + kGameTypeGob1, + kFeaturesNone, "intro" }, { @@ -1058,7 +1140,8 @@ static const GOBGameDescription fallbackDescs[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB1 | GF_CD, + kGameTypeGob1, + kFeaturesCD, "intro" }, { @@ -1070,7 +1153,8 @@ static const GOBGameDescription fallbackDescs[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2, + kGameTypeGob2, + kFeaturesAdlib, "intro" }, { @@ -1082,7 +1166,8 @@ static const GOBGameDescription fallbackDescs[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB2 | GF_CD, + kGameTypeGob2, + kFeaturesCD, "intro" }, { @@ -1094,7 +1179,8 @@ static const GOBGameDescription fallbackDescs[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_BARGON, + kGameTypeBargon, + kFeaturesNone, "intro" }, { @@ -1106,7 +1192,8 @@ static const GOBGameDescription fallbackDescs[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3, + kGameTypeGob3, + kFeaturesAdlib, "intro" }, { @@ -1118,7 +1205,8 @@ static const GOBGameDescription fallbackDescs[] = { kPlatformPC, Common::ADGF_NO_FLAGS }, - GF_GOB3 | GF_CD, + kGameTypeGob3, + kFeaturesCD, "intro" }, }; @@ -1186,6 +1274,7 @@ bool GobEngine::detectGame() { strcat(_startTot0, "0.tot"); } + _gameType = gd->gameType; _features = gd->features; _language = gd->desc.language; _platform = gd->desc.platform; diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 795484ef0e..83c74626cd 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -315,11 +315,12 @@ void Game::evaluateScroll(int16 x, int16 y) { } int16 cursorRight = x + _vm->_draw->_cursorWidth; - int16 screenRight = _vm->_draw->_scrollOffsetX + 320; + int16 screenRight = _vm->_draw->_scrollOffsetX + _vm->_width; int16 cursorBottom = y + _vm->_draw->_cursorHeight; - int16 screenBottom = _vm->_draw->_scrollOffsetY + 200; + int16 screenBottom = _vm->_draw->_scrollOffsetY + _vm->_height; - if ((cursorRight >= 320) && (screenRight < _vm->_video->_surfWidth)) { + if ((cursorRight >= _vm->_width) && + (screenRight < _vm->_video->_surfWidth)) { uint16 off; off = MIN(_vm->_draw->_cursorWidth, @@ -328,8 +329,8 @@ void Game::evaluateScroll(int16 x, int16 y) { _vm->_draw->_scrollOffsetX += off; - _vm->_util->setMousePos(320 - _vm->_draw->_cursorWidth, y); - } else if ((cursorBottom >= (200 - _vm->_video->_splitHeight2)) && + _vm->_util->setMousePos(_vm->_width - _vm->_draw->_cursorWidth, y); + } else if ((cursorBottom >= (_vm->_height - _vm->_video->_splitHeight2)) && (screenBottom < _vm->_video->_surfHeight)) { uint16 off; @@ -339,7 +340,7 @@ void Game::evaluateScroll(int16 x, int16 y) { _vm->_draw->_scrollOffsetY += off; - _vm->_util->setMousePos(x, 200 - _vm->_video->_splitHeight2 - + _vm->_util->setMousePos(x, _vm->_height - _vm->_video->_splitHeight2 - _vm->_draw->_cursorHeight); } @@ -544,7 +545,7 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { int16 newPos = _curBackupPos - index - ((index >= 0) ? 1 : 0); // WORKAROUND: Some versions don't make the MOVEMENT menu item unselectable // in the dreamland screen, resulting in a crash when it's clicked. - if ((_vm->_features & GF_GOB2) && (index == -1) && (skipPlay == 7) && + if ((_vm->getGameType() == kGameTypeGob2) && (index == -1) && (skipPlay == 7) && !scumm_stricmp(_curTotFileArray[newPos], "gob06.tot")) return; diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp index ec2fa6b043..f3bc0611fd 100644 --- a/engines/gob/global.cpp +++ b/engines/gob/global.cpp @@ -112,7 +112,7 @@ Global::Global(GobEngine *vm) : _vm(vm) { _setAllPalette = false; _dontSetPalette = false; - _primarySurfDesc = new SurfaceDesc(0x13, 320, 200); + _primarySurfDesc = 0; _debugFlag = 0; _inVM = 0; diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 32caca31d8..faec700145 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -68,6 +68,16 @@ const Common::Language GobEngine::_gobToScummVMLang[] = { }; GobEngine::GobEngine(OSystem *syst) : Engine(syst) { + _vm = this; + + _snd = 0; _adlib = 0; _mult = 0; + _game = 0; _global = 0; _cdrom = 0; + _dataIO = 0; _goblin = 0; _imdPlayer = 0; + _init = 0; _inter = 0; _map = 0; + _palAnim = 0; _parse = 0; _scenery = 0; + _draw = 0; _util = 0; _video = 0; + _saveLoad = 0; + // Setup mixer if (!_mixer->isReady()) { warning("Sound initialization failed."); @@ -94,25 +104,7 @@ GobEngine::~GobEngine() { // Stop all mixer streams (except for the permanent ones). _vm->_mixer->stopAll(); - delete _snd; - delete _adlib; - delete _mult; - delete _game; - delete _global; - delete _cdrom; - delete _dataIO; - delete _goblin; - delete _imdPlayer; - delete _init; - delete _inter; - delete _map; - delete _palAnim; - delete _parse; - delete _scenery; - delete _draw; - delete _util; - delete _video; - delete _saveLoad; + deinitGameParts(); delete[] _startTot; delete[] _startTot0; } @@ -137,7 +129,7 @@ void GobEngine::validateLanguage() { } void GobEngine::validateVideoMode(int16 videoMode) { - if ((videoMode != 0x13) && (videoMode != 0x14)) + if ((videoMode != 0x13) && (videoMode != 0x14) && (videoMode != 0x18)) error("Video mode 0x%X is not supported!", videoMode); } @@ -148,82 +140,18 @@ int GobEngine::init() { return -1; } - _adlib = 0; - _saveLoad = 0; - _global = new Global(this); - _util = new Util(this); - _dataIO = new DataIO(this); - _palAnim = new PalAnim(this); - _imdPlayer = new ImdPlayer(this); - _cdrom = new CDROM(this); - _snd = new Snd(this); - if (_features & Gob::GF_GOB1) { - _init = new Init_v1(this); - _video = new Video_v1(this); - _inter = new Inter_v1(this); - _parse = new Parse_v1(this); - _mult = new Mult_v1(this); - _draw = new Draw_v1(this); - _game = new Game_v1(this); - _map = new Map_v1(this); - _goblin = new Goblin_v1(this); - _scenery = new Scenery_v1(this); - } else if (_features & Gob::GF_GOB2) { - _init = new Init_v2(this); - _video = new Video_v2(this); - _inter = new Inter_v2(this); - _parse = new Parse_v2(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _game = new Game_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()); - } else if (_features & Gob::GF_BARGON) { - _init = new Init_v2(this); - _video = new Video_v2(this); - _inter = new Inter_Bargon(this); - _parse = new Parse_v2(this); - _mult = new Mult_v2(this); - _draw = new Draw_Bargon(this); - _game = new Game_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()); - } else if (_features & Gob::GF_GOB3) { - _init = new Init_v3(this); - _video = new Video_v2(this); - _inter = new Inter_v3(this); - _parse = new Parse_v2(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _game = new Game_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()); - } else - error("GobEngine::init(): Unknown version of game engine"); - - _noMusic = MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL; - if (!_noMusic && !(_platform == Common::kPlatformAmiga) && - !(_platform == Common::kPlatformAtariST) && - (((_platform == Common::kPlatformMacintosh) && (_features & Gob::GF_GOB1)) || - (_features & Gob::GF_GOB2) || (_features & Gob::GF_GOB3))) - _adlib = new Adlib(this); - _vm = this; - - _map->init(); + if (!initGameParts()) { + GUIErrorMessage("GobEngine::init(): Unknown version of game engine"); + return -1; + } _system->beginGFXTransaction(); initCommonGFX(false); - _system->initSize(320, 200); + _system->initSize(_width, _height); _system->endGFXTransaction(); // On some systems it's not safe to run CD audio games from the CD. - if (_features & GF_CD) + if (isCD()) checkCD(); int cd_num = ConfMan.getInt("cdrom"); @@ -293,4 +221,153 @@ int GobEngine::init() { return 0; } +bool GobEngine::initGameParts() { + _adlib = 0; + _saveLoad = 0; + + _global = new Global(this); + _util = new Util(this); + _dataIO = new DataIO(this); + _palAnim = new PalAnim(this); + _imdPlayer = new ImdPlayer(this); + _cdrom = new CDROM(this); + _snd = new Snd(this); + + switch (_gameType) { + case kGameTypeGob1: + _init = new Init_v1(this); + _video = new Video_v1(this); + _inter = new Inter_v1(this); + _parse = new Parse_v1(this); + _mult = new Mult_v1(this); + _draw = new Draw_v1(this); + _game = new Game_v1(this); + _map = new Map_v1(this); + _goblin = new Goblin_v1(this); + _scenery = new Scenery_v1(this); + break; + + case kGameTypeGob2: + _init = new Init_v2(this); + _video = new Video_v2(this); + _inter = new Inter_v2(this); + _parse = new Parse_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _game = new Game_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 kGameTypeGob3: + _init = new Init_v3(this); + _video = new Video_v2(this); + _inter = new Inter_v3(this); + _parse = new Parse_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _game = new Game_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()); + break; + + case kGameTypeWoodruff: + _init = new Init_v3(this); + _video = new Video_v2(this); + _inter = new Inter_v3(this); + _parse = new Parse_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _game = new Game_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()); + break; + + case kGameTypeBargon: + _init = new Init_v2(this); + _video = new Video_v2(this); + _inter = new Inter_Bargon(this); + _parse = new Parse_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_Bargon(this); + _game = new Game_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 kGameTypeWeen: + _init = new Init_v2(this); + _video = new Video_v2(this); + _inter = new Inter_v2(this); + _parse = new Parse_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _game = new Game_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; + break; + } + + _noMusic = MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL; + if (!_noMusic && hasAdlib()) + _adlib = new Adlib(this); + + _map->init(); + + if (is640()) { + _video->_surfWidth = _width = 640; + _video->_surfHeight = _video->_splitHeight1 = _height = 480; + _global->_mouseMaxCol = 640; + _global->_mouseMaxRow = 480; + _mode = 0x18; + _global->_primarySurfDesc = new SurfaceDesc(0x18, 640, 480); + } else { + _video->_surfWidth = _width = 320; + _video->_surfHeight = _video->_splitHeight1 = _height = 200; + _global->_mouseMaxCol = 320; + _global->_mouseMaxRow = 200; + _mode = 0x14; + _global->_primarySurfDesc = new SurfaceDesc(0x14, 320, 200); + } + + return true; +} + +void GobEngine::deinitGameParts() { + delete _snd; _snd = 0; + delete _adlib; _adlib = 0; + delete _mult; _mult = 0; + delete _game; _game = 0; + delete _global; _global = 0; + delete _cdrom; _cdrom = 0; + delete _dataIO; _dataIO = 0; + delete _goblin; _goblin = 0; + delete _imdPlayer; _imdPlayer = 0; + delete _init; _init = 0; + delete _inter; _inter = 0; + delete _map; _map = 0; + delete _palAnim; _palAnim = 0; + delete _parse; _parse = 0; + delete _scenery; _scenery = 0; + delete _draw; _draw = 0; + delete _util; _util = 0; + delete _video; _video = 0; + delete _saveLoad; _saveLoad = 0; +} + } // End of namespace Gob diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 97ee312bff..8c9583c95d 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -78,14 +78,22 @@ class Adlib; #define VAR(var) READ_VAR_UINT32(var) #define VAR_ADDRESS(var) ((uint32 *) VARP((var) << 2)) -enum { - GF_GOB1 = 1 << 0, - GF_GOB2 = 1 << 1, - GF_GOB3 = 1 << 2, - GF_WOODRUFF = 1 << 3, - GF_BARGON = 1 << 4, - GF_CD = 1 << 5, - GF_EGA = 1 << 6 +enum GameType { + kGameTypeNone = 0, + kGameTypeGob1, + kGameTypeGob2, + kGameTypeGob3, + kGameTypeWoodruff, + kGameTypeBargon, + kGameTypeWeen +}; + +enum Features { + kFeaturesNone = 0, + kFeaturesCD = 1 << 0, + kFeaturesEGA = 1 << 1, + kFeaturesAdlib = 1 << 2, + kFeatures640 = 1 << 3 }; enum { @@ -165,6 +173,9 @@ protected: int go(); int init(); + bool initGameParts(); + void deinitGameParts(); + bool detectGame(); public: @@ -172,9 +183,15 @@ public: Common::RandomSource _rnd; + GameType _gameType; int32 _features; Common::Language _language; Common::Platform _platform; + + uint16 _width; + uint16 _height; + uint8 _mode; + char *_startTot; char *_startTot0; bool _copyProtection; @@ -211,6 +228,12 @@ public: void validateLanguage(); void validateVideoMode(int16 videoMode); + GameType getGameType() { return _gameType; } + bool isCD() { return (_features & kFeaturesCD) != 0; } + bool isEGA() { return (_features & kFeaturesEGA) != 0; } + bool is640() { return (_features & kFeatures640) != 0; } + bool hasAdlib() { return (_features & kFeaturesAdlib) != 0; } + GobEngine(OSystem *syst); virtual ~GobEngine(); }; diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index 1f529b7634..4da3746681 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -209,7 +209,7 @@ void Inter::funcBlock(int16 retFlag) { // WORKAROUND: // The EGA version of gob1 doesn't add a delay after showing // images between levels. We manually add it here. - if ((_vm->_features & GF_GOB1) && (_vm->_features & GF_EGA)) { + if ((_vm->getGameType() == kGameTypeGob1) && _vm->isEGA()) { int addr = _vm->_global->_inter_execPtr-_vm->_game->_totFileData; if ((startaddr == 0x18B4 && addr == 0x1A7F && // Zombie !strncmp(_vm->_game->_curTotFile, "avt005.tot", 10)) || diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index a3277047e7..0339cb7f44 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1136,13 +1136,13 @@ bool Inter_v1::o1_callSub(OpFuncParams ¶ms) { } // Skipping the copy protection screen in Gobliiins - if (!_vm->_copyProtection && (_vm->_features & GF_GOB1) && (offset == 3905) + if (!_vm->_copyProtection && (_vm->getGameType() == kGameTypeGob1) && (offset == 3905) && !scumm_stricmp(_vm->_game->_curTotFile, _vm->_startTot)) { debugC(2, kDebugGameFlow, "Skipping copy protection screen"); return false; } // Skipping the copy protection screen in Gobliins 2 - if (!_vm->_copyProtection && (_vm->_features & GF_GOB2) && (offset == 1746) + if (!_vm->_copyProtection && (_vm->getGameType() == kGameTypeGob2) && (offset == 1746) && !scumm_stricmp(_vm->_game->_curTotFile, _vm->_startTot0)) { debugC(2, kDebugGameFlow, "Skipping copy protection screen"); return false; @@ -1650,8 +1650,9 @@ bool Inter_v1::o1_keyFunc(OpFuncParams ¶ms) { // WORKAROUND for bug #1726130: Ween busy-waits in the intro for a counter // to become 5000. We deliberately slow down busy-waiting, so we shorten // the counting, too. - if (((_vm->_global->_inter_execPtr - _vm->_game->_totFileData) == 729) && - (VAR(59) < 4000) && !scumm_stricmp(_vm->_game->_curTotFile, "intro5.tot")) + if ((_vm->getGameType() == kGameTypeWeen) && (VAR(59) < 4000) && + ((_vm->_global->_inter_execPtr - _vm->_game->_totFileData) == 729) && + !scumm_stricmp(_vm->_game->_curTotFile, "intro5.tot")) WRITE_VAR(59, 4000); switch (cmd) { diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index bf103e68ef..9fe5904ff7 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1379,7 +1379,7 @@ void Inter_v2::o2_initScreen() { // Some versions require this if (videoMode == 0xD) - videoMode = 0x14; + videoMode = _vm->_mode; if ((videoMode == _vm->_global->_videoMode) && (width == -1)) return; @@ -1389,7 +1389,8 @@ void Inter_v2::o2_initScreen() { if (height > 0) _vm->_video->_surfHeight = height; - _vm->_video->_splitHeight1 = MIN(200, _vm->_video->_surfHeight - offY); + _vm->_video->_splitHeight1 = + MIN(_vm->_height, _vm->_video->_surfHeight - offY); _vm->_video->_splitHeight2 = offY; _vm->_video->_splitStart = _vm->_video->_surfHeight - offY; @@ -1425,13 +1426,13 @@ void Inter_v2::o2_scroll() { int16 curY; startX = CLIP((int) _vm->_parse->parseValExpr(), 0, - _vm->_video->_surfWidth - 320); + _vm->_video->_surfWidth - _vm->_width); startY = CLIP((int) _vm->_parse->parseValExpr(), 0, - _vm->_video->_surfHeight - 200); + _vm->_video->_surfHeight - _vm->_height); endX = CLIP((int) _vm->_parse->parseValExpr(), 0, - _vm->_video->_surfWidth - 320); + _vm->_video->_surfWidth - _vm->_width); endY = CLIP((int) _vm->_parse->parseValExpr(), 0, - _vm->_video->_surfHeight - 200); + _vm->_video->_surfHeight - _vm->_height); stepX = _vm->_parse->parseValExpr(); stepY = _vm->_parse->parseValExpr(); diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp index 3c1895d099..5485d66987 100644 --- a/engines/gob/map.cpp +++ b/engines/gob/map.cpp @@ -261,7 +261,7 @@ void Map::findNearestWalkable(int16 &gobDestX, int16 &gobDestY, int i; mapWidth = _screenWidth / _tilesWidth; - mapHeight = 200 / _tilesHeight; + mapHeight = _vm->_width / _tilesHeight; direction = 0; for (i = 1; i <= gobDestX; i++) diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 6f88a5a993..83cd436b8a 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -166,11 +166,11 @@ void Video::retrace(bool mouse) { if (_vm->_global->_primarySurfDesc) { g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + _scrollOffsetY * _surfWidth + _scrollOffsetX, _surfWidth, - 0, 0, 320, _splitHeight1); + 0, 0, _vm->_width, _splitHeight1); if (_splitHeight2 > 0) g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + _splitStart * _surfWidth, _surfWidth, 0, - 200 - _splitHeight2, 320, _splitHeight2); + _vm->_height - _splitHeight2, _vm->_width, _splitHeight2); g_system->updateScreen(); } } -- cgit v1.2.3