diff options
author | Filippos Karapetis | 2008-12-21 15:59:05 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-12-21 15:59:05 +0000 |
commit | d0f4f97ea9d8ded6280c2c023a55febecabef5d2 (patch) | |
tree | 17d9fb42b1a80ba38270bf11b03bfa35b03c6daf /engines/saga | |
parent | e11c17a005a1efb1be077ceb856c48446e11d95c (diff) | |
download | scummvm-rg350-d0f4f97ea9d8ded6280c2c023a55febecabef5d2.tar.gz scummvm-rg350-d0f4f97ea9d8ded6280c2c023a55febecabef5d2.tar.bz2 scummvm-rg350-d0f4f97ea9d8ded6280c2c023a55febecabef5d2.zip |
Cleaned up the mess with game IDs and game types: removed game types, reduced the game IDs and added game features where necessary
svn-id: r35467
Diffstat (limited to 'engines/saga')
28 files changed, 299 insertions, 360 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp index 067511d3be..f53eff6288 100644 --- a/engines/saga/actor.cpp +++ b/engines/saga/actor.cpp @@ -128,7 +128,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { // Load ITE actor strings. (IHNM actor strings are loaded by // loadGlobalResources() instead.) - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { _vm->_resource->loadResource(_actorContext, _vm->getResourceDescription()->actorsStringsResourceId, stringsPointer, stringsLength); @@ -136,7 +136,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { free(stringsPointer); } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { _actorsCount = ITE_ACTORCOUNT; _actors = (ActorData **)malloc(_actorsCount * sizeof(*_actors)); for (i = 0; i < _actorsCount; i++) { @@ -244,7 +244,7 @@ void Actor::loadFrameList(int frameListResourceId, ActorFrameSequence *&framesPo for (int orient = 0; orient < ACTOR_DIRECTIONS_COUNT; orient++) { // Load all four orientations framesPointer[i].directions[orient].frameIndex = readS.readUint16(); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { framesPointer[i].directions[orient].frameCount = readS.readSint16(); } else { framesPointer[i].directions[orient].frameCount = readS.readByte(); @@ -272,7 +272,7 @@ bool Actor::loadActorResources(ActorData *actor) { // It's normal for some actors to have no frames //warning("Frame List ID = 0 for actor index %d", actor->_index); - //if (_vm->getGameType() == GType_ITE) + //if (_vm->getGameId() == GID_ITE) return true; } @@ -313,7 +313,7 @@ void Actor::loadActorSpriteList(ActorData *actor) { _vm->_sprite->loadList(resourceId, actor->_spriteList); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (actor->_flags & kExtended) { while ((lastFrame >= actor->_spriteList.spriteCount)) { resourceId++; @@ -612,7 +612,7 @@ ActorData *Actor::getActor(uint16 actorId) { void Actor::setProtagState(int state) { _protagState = state; - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if (!_protagonist->_shareFrames) free(_protagonist->_frames); @@ -624,7 +624,7 @@ void Actor::setProtagState(int state) { int Actor::getFrameType(ActorFrameTypes frameType) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { switch (frameType) { case kFrameStand: return kFrameITEStand; @@ -678,7 +678,7 @@ ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) { if ((actor->_facingDirection < kDirUp) || (actor->_facingDirection > kDirUpLeft)) error("Actor::getActorFrameRange Wrong direction 0x%X actorId 0x%X", actor->_facingDirection, actorId); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (frameType >= actor->_framesCount) { warning("Actor::getActorFrameRange Wrong frameType 0x%X (%d) actorId 0x%X", frameType, actor->_framesCount, actorId); return &def; @@ -689,7 +689,7 @@ ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) { return &actor->_frames[frameType].directions[fourDirection]; } - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { // It is normal for some actors to have no frames for a given frameType // These are mainly actors with no frames at all (e.g. narrators or immovable actors) // Examples are AM and the boy when he is talking to Benny via the computer screen. @@ -819,12 +819,12 @@ void Actor::handleSpeech(int msec) { width = _activeSpeech.speechBox.width(); height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1; - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if (height > _vm->_scene->getHeight(true) / 2 && width < _vm->getDisplayWidth() - 20) { width = _vm->getDisplayWidth() - 20; height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1; } - } else if (_vm->getGameType() == GType_ITE) { + } else if (_vm->getGameId() == GID_ITE) { if (height > 40 && width < _vm->getDisplayWidth() - 100) { width = _vm->getDisplayWidth() - 100; height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1; @@ -875,9 +875,9 @@ bool Actor::calcScreenPosition(CommonObjectData *commonObjectData) { if (middle <= beginSlope) { commonObjectData->_screenScale = 256; - } else if (_vm->getGameType() == GType_IHNM && (objectTypeId(commonObjectData->_id) & kGameObjectObject)) { + } else if (_vm->getGameId() == GID_IHNM && (objectTypeId(commonObjectData->_id) & kGameObjectObject)) { commonObjectData->_screenScale = 256; - } else if (_vm->getGameType() == GType_IHNM && (commonObjectData->_flags & kNoScale)) { + } else if (_vm->getGameId() == GID_IHNM && (commonObjectData->_flags & kNoScale)) { commonObjectData->_screenScale = 256; } else if (middle >= endSlope) { commonObjectData->_screenScale = 1; @@ -940,7 +940,7 @@ uint16 Actor::hitTest(const Point &testPoint, bool skipProtagonist) { } if (_vm->_sprite->hitTest(*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, testPoint)) { result = drawObject->_id; - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) return result; // in ITE, return the first result found (read above) } } @@ -956,7 +956,7 @@ void Actor::createDrawOrderList() { if (_vm->_scene->getFlags() & kSceneFlagISO) { compareFunction = &tileCommonObjectCompare; } else { - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) compareFunction = &commonObjectCompare; else compareFunction = &commonObjectCompareIHNM; @@ -1068,8 +1068,8 @@ void Actor::drawActors() { void Actor::drawSpeech(void) { if (!isSpeaking() || !_activeSpeech.playing || _vm->_script->_skipSpeeches - || (!_vm->_subtitlesEnabled && (_vm->getFeatures() & GF_CD_FX)) - || (!_vm->_subtitlesEnabled && (_vm->getGameType() == GType_IHNM))) + || (!_vm->_subtitlesEnabled && _vm->getGameId() == GID_ITE && !(_vm->getFeatures() & GF_ITE_FLOPPY)) + || (!_vm->_subtitlesEnabled && (_vm->getGameId() == GID_IHNM))) return; Point textPoint; @@ -1093,9 +1093,9 @@ void Actor::drawSpeech(void) { textPoint.x = CLIP(actor->_screenPosition.x - width / 2, 10, _vm->getDisplayWidth() - 10 - width); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) textPoint.y = CLIP(actor->_screenPosition.y - 58, 10, _vm->_scene->getHeight(true) - 10 - height); - else if (_vm->getGameType() == GType_IHNM) + else if (_vm->getGameId() == GID_IHNM) textPoint.y = 10; // CLIP(actor->_screenPosition.y - 160, 10, _vm->_scene->getHeight(true) - 10 - height); _vm->_font->textDraw(kKnownFontScript, outputString, textPoint, @@ -1132,7 +1132,7 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, dist = MIN(actor->_screenPosition.x - 10, _vm->getDisplayWidth() - 10 - actor->_screenPosition.x); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) dist = CLIP<int16>(dist, 60, 150); else dist = CLIP<int16>(dist, 120, 300); @@ -1154,7 +1154,7 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, // scene. After speaking with AM, the compact disk is visible. She always says this line // when entering room 59, after speaking with AM, if the compact disk is not picked up yet // Check Script::sfDropObject for the other part of this hack - if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 3 && + if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 3 && _vm->_scene->currentSceneNumber() == 59 && _activeSpeech.sampleResourceId == 286) { for (i = 0; i < _objsCount; i++) { if (_objs[i]->_id == 16385) { // the compact disk @@ -1178,7 +1178,7 @@ void Actor::nonActorSpeech(const Common::Rect &box, const char **strings, int st _activeSpeech.speechFlags = speechFlags; _activeSpeech.actorsCount = 1; _activeSpeech.actorIds[0] = 0; - if (!(_vm->getFeatures() & GF_CD_FX)) + if (_vm->getFeatures() & GF_ITE_FLOPPY) _activeSpeech.sampleResourceId = -1; else _activeSpeech.sampleResourceId = sampleResourceId; @@ -1212,7 +1212,7 @@ void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, void Actor::abortAllSpeeches() { // WORKAROUND: Don't abort speeches in scene 31 (tree with beehive). This prevents the // making fire animation from breaking - if (_vm->getGameType() == GType_ITE && _vm->_scene->currentSceneNumber() == 31) + if (_vm->getGameId() == GID_ITE && _vm->_scene->currentSceneNumber() == 31) return; abortSpeech(); diff --git a/engines/saga/actor_path.cpp b/engines/saga/actor_path.cpp index 434b019f67..716a0742a2 100644 --- a/engines/saga/actor_path.cpp +++ b/engines/saga/actor_path.cpp @@ -233,7 +233,7 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be const PathDirectionData *samplePathDirection; Point nextPoint; int directionCount; - int16 compressX = (_vm->getGameType() == GType_ITE) ? 2 : 1; + int16 compressX = (_vm->getGameId() == GID_ITE) ? 2 : 1; _pathDirectionListCount = 0; pointCounter = 0; diff --git a/engines/saga/actor_walk.cpp b/engines/saga/actor_walk.cpp index d62c1c61d7..7a0ac33e98 100644 --- a/engines/saga/actor_walk.cpp +++ b/engines/saga/actor_walk.cpp @@ -207,7 +207,7 @@ void Actor::updateActorsScene(int actorsEntrance) { if (actor->_flags & kProtagonist) { actor->_finalTarget = actor->_location; _centerActor = _protagonist = actor; - } else if (_vm->getGameType() == GType_ITE && + } else if (_vm->getGameId() == GID_ITE && _vm->_scene->currentSceneResourceId() == ITE_SCENE_OVERMAP) { continue; } @@ -247,7 +247,7 @@ void Actor::updateActorsScene(int actorsEntrance) { // // After stepping on an action zone, Rif is trying to exit. // Shift Rif's entry position to a non action zone area. - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if ((_vm->_scene->currentSceneNumber() >= 53) && (_vm->_scene->currentSceneNumber() <= 66)) _protagonist->_location.y += 10; } @@ -341,7 +341,7 @@ void Actor::handleActions(int msec, bool setup) { if (!actor->_inScene) continue; - if ((_vm->getGameType() == GType_ITE) && (i == ACTOR_DRAGON_INDEX)) { + if ((_vm->getGameId() == GID_ITE) && (i == ACTOR_DRAGON_INDEX)) { moveDragon(actor); continue; } @@ -455,7 +455,7 @@ void Actor::handleActions(int msec, bool setup) { } actor->_partialTarget.fromScreenPoint(actor->_walkStepsPoints[actor->_walkStepIndex++]); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (actor->_partialTarget.x > 224 * 2 * ACTOR_LMULT) { actor->_partialTarget.x -= 256 * 2 * ACTOR_LMULT; } @@ -474,7 +474,7 @@ void Actor::handleActions(int msec, bool setup) { } } - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) speed = (ACTOR_LMULT * 2 * actor->_screenScale + 63) / 256; else speed = (ACTOR_SPEED * actor->_screenScale + 128) >> 8; @@ -482,7 +482,7 @@ void Actor::handleActions(int msec, bool setup) { if (speed < 1) speed = 1; - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) speed = speed / 2; if ((actor->_actionDirection == kDirUp) || (actor->_actionDirection == kDirDown)) { @@ -539,7 +539,7 @@ void Actor::handleActions(int msec, bool setup) { actor->cycleWrap(frameRange->frameCount); actor->_frameNumber = frameRange->frameIndex + actor->_actionCycle; } else { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { actor->_location.x += directionLUT[actor->_actionDirection][0] * 2; actor->_location.y += directionLUT[actor->_actionDirection][1] * 2; } else { @@ -696,7 +696,7 @@ void Actor::handleActions(int msec, bool setup) { // to the left, which makes him exit the screen when the graffiti is examined. // We effectively change the left side of the hitzone here so that it starts from // pixel 301 onwards. The same workaround is applied in Script::whichObject - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if (_vm->_scene->currentChapterNumber() == 1 && _vm->_scene->currentSceneNumber() == 22) if (hitPoint.x <= 300) hitZone = NULL; @@ -710,7 +710,7 @@ void Actor::handleActions(int msec, bool setup) { // (room 51) for hitzone 24577 (the door with the copy protection) to avoid the glitch. This glitch // happens because the copy protection is supposed to kick in at this point, but it's bypassed // (with permission from Wyrmkeep Entertainment) - if (hitZone && !(_vm->getGameType() == GType_ITE && _vm->_scene->currentSceneNumber() == 51 && hitZone->getHitZoneId() == 24577)) { + if (hitZone && !(_vm->getGameId() == GID_ITE && _vm->_scene->currentSceneNumber() == 51 && hitZone->getHitZoneId() == 24577)) { stepZoneAction(actor, hitZone, false, false); } } @@ -891,7 +891,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { if (_vm->_scene->getFlags() & kSceneFlagISO) { - if ((_vm->getGameType() == GType_ITE) && (actor->_index == ACTOR_DRAGON_INDEX)) { + if ((_vm->getGameId() == GID_ITE) && (actor->_index == ACTOR_DRAGON_INDEX)) { return false; } @@ -938,10 +938,10 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { if ( ((actor->_currentAction >= kActionWalkToPoint && actor->_currentAction <= kActionWalkDir) || - (_vm->getGameType() == GType_ITE && actor == _protagonist)) && + (_vm->getGameId() == GID_ITE && actor == _protagonist)) && !_vm->_scene->canWalk(pointFrom)) { - int max = _vm->getGameType() == GType_ITE ? 8 : 4; + int max = _vm->getGameId() == GID_ITE ? 8 : 4; for (i = 1; i < max; i++) { pointAdd = pointFrom; @@ -956,7 +956,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { pointFrom = pointAdd; break; } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { pointAdd = pointFrom; pointAdd.x += i; if (_vm->_scene->canWalk(pointAdd)) { @@ -1087,7 +1087,7 @@ bool Actor::actorEndWalk(uint16 actorId, bool recurse) { actor = getActor(actorId); actor->_actorFlags &= ~kActorBackwards; - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (actor->_location.distance(actor->_finalTarget) > 8 && (actor->_flags & kProtagonist) && recurse && !(actor->_actorFlags & kActorNoCollide)) { actor->_actorFlags |= kActorNoCollide; @@ -1107,7 +1107,7 @@ bool Actor::actorEndWalk(uint16 actorId, bool recurse) { if (actor == _protagonist) { _vm->_script->wakeUpActorThread(kWaitTypeWalk, actor); if (_vm->_script->_pendingVerb == _vm->_script->getVerbType(kVerbWalkTo)) { - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) actor->_location.toScreenPointUV(testPoint); // it's wrong calculation, but it is used in ITE else actor->_location.toScreenPointXY(testPoint); diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index 90d3837ce1..6518044718 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -320,7 +320,7 @@ void Anim::clearCutaway(void) { _vm->_interface->restoreMode(); _vm->_gfx->showCursor(true); - if (_vm->getGameId() == GID_IHNM_DEMO) { + if (_vm->getFeatures() & GF_IHNM_DEMO) { // Enable the save reminder state after each cutaway for the IHNM demo _vm->_interface->setSaveReminderState(true); } diff --git a/engines/saga/animation.h b/engines/saga/animation.h index 1127028718..5495ab229e 100644 --- a/engines/saga/animation.h +++ b/engines/saga/animation.h @@ -179,7 +179,7 @@ private: } bool isLongData() const { - if ((_vm->getGameType() == GType_ITE) && (_vm->getPlatform() != Common::kPlatformMacintosh)) { + if ((_vm->getGameId() == GID_ITE) && (_vm->getPlatform() != Common::kPlatformMacintosh)) { return false; } return true; diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 21e74ad5de..aac00ce16a 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -45,7 +45,6 @@ namespace Saga { struct SAGAGameDescription { Common::ADGameDescription desc; - int gameType; int gameId; uint32 features; int startSceneNumber; @@ -79,7 +78,6 @@ const GameFontDescription *SagaEngine::getFontDescription(int index) { int SagaEngine::getFontsCount() const { return _gameDescription->fontsCount; } int SagaEngine::getGameId() const { return _gameDescription->gameId; } -int SagaEngine::getGameType() const { return _gameDescription->gameType; } uint32 SagaEngine::getFeatures() const { uint32 result = _gameDescription->features; @@ -317,29 +315,29 @@ bool SagaEngine::initGame() { } const GameDisplayInfo &SagaEngine::getDisplayInfo() { - return _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; + return _gameDescription->gameId == GID_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; } int SagaEngine::getDisplayWidth() const { - const GameDisplayInfo &di = _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; + const GameDisplayInfo &di = _gameDescription->gameId == GID_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; return di.logicalWidth; } int SagaEngine::getDisplayHeight() const { - const GameDisplayInfo &di = _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; + const GameDisplayInfo &di = _gameDescription->gameId == GID_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo; return di.logicalHeight; } Common::Error SagaEngine::loadGameState(int slot) { // Init the current chapter to 8 (character selection) for IHNM - if (getGameType() == GType_IHNM) + if (getGameId() == GID_IHNM) _scene->changeScene(-2, 0, kTransitionFade, 8); // First scene sets up palette _scene->changeScene(getStartSceneNumber(), 0, kTransitionNoFade); _events->handleEvents(0); // Process immediate events - if (getGameType() != GType_IHNM) + if (getGameId() == GID_ITE) _interface->setMode(kPanelMain); else _interface->setMode(kPanelChapterSelection); diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h index befaac8527..6aaee7c6bf 100644 --- a/engines/saga/detection_tables.h +++ b/engines/saga/detection_tables.h @@ -203,9 +203,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_DEMO }, - GType_ITE, - GID_ITE_DEMO_G, // Game id - 0, // features + GID_ITE, // Game id + GF_OLD_ITE_DOS, // features ITE_DEFAULT_SCENE, // Starting scene number &ITEDemo_Resources, ARRAYSIZE(ITEDEMO_GameFonts), @@ -230,9 +229,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformMacintosh, Common::ADGF_DEMO }, - GType_ITE, - GID_ITE_MACDEMO2, - GF_BIG_ENDIAN_DATA | GF_WYRMKEEP | GF_CD_FX | GF_SCENE_SUBSTITUTES, + GID_ITE, + GF_BIG_ENDIAN_DATA | GF_WYRMKEEP | GF_SCENE_SUBSTITUTES | GF_MONO_MUSIC, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITEWINDEMO_GameFonts), @@ -258,9 +256,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformMacintosh, Common::ADGF_DEMO }, - GType_ITE, - GID_ITE_MACDEMO1, - GF_BIG_ENDIAN_DATA | GF_WYRMKEEP | GF_CD_FX | GF_NON_INTERACTIVE, + GID_ITE, + GF_BIG_ENDIAN_DATA | GF_WYRMKEEP | GF_NON_INTERACTIVE, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITEWINDEMO_GameFonts), @@ -286,9 +283,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformWindows, Common::ADGF_DEMO }, - GType_ITE, - GID_ITE_WINDEMO3, - GF_WYRMKEEP | GF_CD_FX | GF_SCENE_SUBSTITUTES, + GID_ITE, + GF_WYRMKEEP | GF_SCENE_SUBSTITUTES, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITEWINDEMO_GameFonts), @@ -314,9 +310,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformWindows, Common::ADGF_DEMO }, - GType_ITE, - GID_ITE_WINDEMO1, - GF_WYRMKEEP | GF_CD_FX | GF_NON_INTERACTIVE, + GID_ITE, + GF_WYRMKEEP | GF_NON_INTERACTIVE, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITEWINDEMO_GameFonts), @@ -349,9 +344,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_MACCD_G, - GF_BIG_ENDIAN_DATA | GF_CD_FX, + GID_ITE, + GF_BIG_ENDIAN_DATA, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITEWINDEMO_GameFonts), @@ -375,9 +369,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_MACCD, - GF_BIG_ENDIAN_DATA | GF_WYRMKEEP | GF_CD_FX, + GID_ITE, + GF_BIG_ENDIAN_DATA | GF_WYRMKEEP, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITEWINDEMO_GameFonts), @@ -409,9 +402,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformUnknown, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_MULTICD, - GF_WYRMKEEP | GF_CD_FX, + GID_ITE, + GF_WYRMKEEP, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -441,9 +433,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformUnknown, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_MULTICD, - GF_WYRMKEEP | GF_CD_FX, + GID_ITE, + GF_WYRMKEEP, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -467,9 +458,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_CD, - GF_CD_FX, + GID_ITE, + GF_EXTRA_ITE_CREDITS, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -493,9 +483,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_CD, - GF_CD_FX, + GID_ITE, + 0, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -519,9 +508,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_CD_G, - GF_CD_FX, + GID_ITE, + 0, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -546,9 +534,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_CD_DE, - GF_CD_FX, + GID_ITE, + 0, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -575,9 +562,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_DISK_DE, - 0, + GID_ITE, + GF_ITE_FLOPPY, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -601,9 +587,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_DISK_G, - 0, + GID_ITE, + GF_ITE_FLOPPY, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -627,9 +612,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_ITE, - GID_ITE_DISK_G, - 0, + GID_ITE, + GF_ITE_FLOPPY, ITE_DEFAULT_SCENE, &ITE_Resources, ARRAYSIZE(ITE_GameFonts), @@ -662,9 +646,8 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_DEMO }, - GType_IHNM, - GID_IHNM_DEMO, - 0, + GID_IHNM, + GF_IHNM_DEMO, IHNMDEMO_DEFAULT_SCENE, &IHNMDEMO_Resources, ARRAYSIZE(IHNMDEMO_GameFonts), @@ -696,8 +679,7 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_IHNM, - GID_IHNM_CD, + GID_IHNM, 0, IHNM_DEFAULT_SCENE, &IHNM_Resources, @@ -728,8 +710,7 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_IHNM, - GID_IHNM_CD_DE, + GID_IHNM, 0, IHNM_DEFAULT_SCENE, &IHNM_Resources, @@ -758,8 +739,7 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_IHNM, - GID_IHNM_CD_ES, + GID_IHNM, 0, IHNM_DEFAULT_SCENE, &IHNM_Resources, @@ -789,8 +769,7 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_IHNM, - GID_IHNM_CD_FR, + GID_IHNM, 0, IHNM_DEFAULT_SCENE, &IHNM_Resources, @@ -819,8 +798,7 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformPC, Common::ADGF_NO_FLAGS }, - GType_IHNM, - GID_IHNM_CD_ITA, + GID_IHNM, 0, IHNM_DEFAULT_SCENE, &IHNM_Resources, @@ -846,8 +824,7 @@ static const SAGAGameDescription gameDescriptions[] = { Common::kPlatformMacintosh, Common::ADGF_NO_FLAGS }, - GType_IHNM, - GID_IHNM_CD_MAC, + GID_IHNM, 0, // GF_BIG_ENDIAN_DATA IHNM_DEFAULT_SCENE, &IHNM_Resources, @@ -857,7 +834,7 @@ static const SAGAGameDescription gameDescriptions[] = { &MAC_GameSound, NULL, }, - { AD_TABLE_END_MARKER, 0, 0, 0, 0, NULL, 0, NULL, NULL, NULL, NULL } + { AD_TABLE_END_MARKER, 0, 0, 0, NULL, 0, NULL, NULL, NULL, NULL } }; } // End of namespace Saga diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index a95a73c293..78da66d993 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -338,7 +338,7 @@ int Events::handleOneShot(Event *event) { if (event->param == kEvPSetPalette) { PalEntry *palPointer; - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if (_vm->_spiritualBarometer > 255) _vm->_gfx->setPaletteColor(kIHNMColorPortrait, 0xff, 0xff, 0xff); else @@ -507,12 +507,14 @@ int Events::handleOneShot(Event *event) { break; case kEventSetNormalCursor: // in ITE and IHNM demo there is just one cursor - if (_vm->getGameType() == GType_IHNM && _vm->getGameId() != GID_IHNM_DEMO) + // ITE never makes this call + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) _vm->_gfx->setCursor(kCursorNormal); break; case kEventSetBusyCursor: // in ITE and IHNM demo there is just one cursor - if (_vm->getGameType() == GType_IHNM && _vm->getGameId() != GID_IHNM_DEMO) + // ITE never makes this call + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) _vm->_gfx->setCursor(kCursorBusy); break; default: diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index c1d01295a7..cb44e9ad08 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -341,7 +341,7 @@ void Font::outFont(const FontStyle &drawFont, const char *text, size_t count, co // versions of IHNM, so it has been changed to apply for ITE only. // It doesn't make any difference for the English version of IHNM. // Fixes bug #1796045: "IHNM: Spanish font wrong". - if (!(flags & kFontDontmap) && _vm->getGameType() == GType_ITE) { + if (!(flags & kFontDontmap) && _vm->getGameId() == GID_ITE) { c_code = translateChar(c_code); } } else if (_fontMapping == 1) { @@ -659,7 +659,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) { FontId fontId = kSmallFont; // The demo version of IHNM has 3 font types (like ITE), not 6 (like the full version of IHNM) - if (_vm->getGameType() == GType_ITE || _vm->getGameId() == GID_IHNM_DEMO) { + if (_vm->getGameId() == GID_ITE || _vm->getFeatures() & GF_IHNM_DEMO) { switch (font) { case (kKnownFontSmall): fontId = kSmallFont; @@ -681,7 +681,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) { fontId = _vm->_font->valid(kBigFont) ? kBigFont : kMediumFont; break; } - } else if (_vm->getGameType() == GType_IHNM && _vm->getGameId() != GID_IHNM_DEMO) { + } else if (_vm->getGameId() == GID_IHNM && !(_vm->getFeatures() & GF_IHNM_DEMO)) { switch (font) { case (kKnownFontSmall): fontId = kSmallFont; diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp index 621351915f..fa586f0dc7 100644 --- a/engines/saga/gfx.cpp +++ b/engines/saga/gfx.cpp @@ -164,7 +164,7 @@ void Surface::transitionDissolve(const byte *sourceBuffer, const Common::Rect &s } void Gfx::initPalette() { - if (_vm->getGameType() != GType_IHNM) + if (_vm->getGameId() == GID_ITE) return; ResourceContext *resourceContext = _vm->_resource->getContext(GAME_RESOURCEFILE); @@ -196,7 +196,7 @@ void Gfx::setPalette(const PalEntry *pal, bool full) { byte *ppal; int from, numcolors; - if (_vm->getGameType() != GType_IHNM || full) { + if (_vm->getGameId() == GID_ITE || full) { from = 0; numcolors = PAL_ENTRIES; } else { @@ -212,7 +212,7 @@ void Gfx::setPalette(const PalEntry *pal, bool full) { } // Color 0 should always be black in IHNM - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) memset(&_currentPal[0 * 4], 0, 4); // Make 256th color black. See bug #1256368 @@ -270,7 +270,7 @@ void Gfx::palToBlack(PalEntry *srcPal, double percent) { double fpercent; - if (_vm->getGameType() != GType_IHNM) { + if (_vm->getGameId() == GID_ITE) { from = 0; numcolors = PAL_ENTRIES; } else { @@ -321,7 +321,7 @@ void Gfx::palToBlack(PalEntry *srcPal, double percent) { } // Color 0 should always be black in IHNM - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) memset(&_currentPal[0 * 4], 0, 4); // Make 256th color black. See bug #1256368 @@ -339,7 +339,7 @@ void Gfx::blackToPal(PalEntry *srcPal, double percent) { PalEntry *palE; int from, numcolors; - if (_vm->getGameType() != GType_IHNM) { + if (_vm->getGameId() == GID_ITE) { from = 0; numcolors = PAL_ENTRIES; } else { @@ -388,7 +388,7 @@ void Gfx::blackToPal(PalEntry *srcPal, double percent) { } // Color 0 should always be black in IHNM - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) memset(&_currentPal[0 * 4], 0, 4); // Make 256th color black. See bug #1256368 @@ -473,7 +473,7 @@ void Gfx::showCursor(bool state) { } void Gfx::setCursor(CursorType cursorType) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { // Set up the mouse cursor const byte A = kITEColorLightGrey; const byte B = kITEColorWhite; @@ -494,7 +494,7 @@ void Gfx::setCursor(CursorType cursorType) { switch (cursorType) { case kCursorBusy: - if (_vm->getGameId() != GID_IHNM_DEMO) + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) resourceId = RID_IHNM_HOURGLASS_CURSOR; else resourceId = (uint32)-1; diff --git a/engines/saga/image.cpp b/engines/saga/image.cpp index 99626737fd..7d8eb83550 100644 --- a/engines/saga/image.cpp +++ b/engines/saga/image.cpp @@ -91,7 +91,7 @@ int SagaEngine::decodeBGImage(const byte *image_data, size_t image_size, unbankBGImage(out_buf, decode_buf, hdr.width, hdr.height); // For some reason bg images in IHNM are upside down - if (getGameType() == GType_IHNM && !flip) { + if (getGameId() == GID_IHNM && !flip) { flipImage(out_buf, hdr.width, hdr.height); } diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 24fd15594d..c4734453a2 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -192,7 +192,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { free(resource); // Quit panel - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { _quitPanel.buttons = _vm->getDisplayInfo().quitPanelButtons; _quitPanel.buttonsCount = _vm->getDisplayInfo().quitPanelButtonsCount; @@ -203,7 +203,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { } // Save panel - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { _savePanel.buttons = _vm->getDisplayInfo().savePanelButtons; _savePanel.buttonsCount = _vm->getDisplayInfo().savePanelButtonsCount; @@ -214,7 +214,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { } // Load panel - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { _loadPanel.buttons = _vm->getDisplayInfo().loadPanelButtons; _loadPanel.buttonsCount = _vm->getDisplayInfo().loadPanelButtonsCount; @@ -235,7 +235,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { // Quit panel sprites _vm->_sprite->loadList(_vm->getResourceDescription()->warningPanelSpritesResourceId, _quitPanel.sprites); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { _vm->_sprite->loadList(_vm->getResourceDescription()->defaultPortraitsResourceId, _defPortraits); } @@ -362,7 +362,7 @@ void Interface::updateSaveReminder() { _saveReminderState = _saveReminderState % _vm->getDisplayInfo().saveReminderNumSprites + 1; drawStatusBar(); _vm->_timer->removeTimerProc(&saveReminderCallback); - _vm->_timer->installTimerProc(&saveReminderCallback, ((_vm->getGameType() == GType_ITE) ? TIMETOBLINK_ITE : TIMETOBLINK_IHNM), this); + _vm->_timer->installTimerProc(&saveReminderCallback, ((_vm->getGameId() == GID_ITE) ? TIMETOBLINK_ITE : TIMETOBLINK_IHNM), this); } } @@ -374,7 +374,7 @@ int Interface::activate() { unlockMode(); if (_panelMode == kPanelMain || _panelMode == kPanelChapterSelection) { _saveReminderState = 1; - } else if (_panelMode == kPanelNull && _vm->getGameId() == GID_IHNM_DEMO) { + } else if (_panelMode == kPanelNull && _vm->getFeatures() & GF_IHNM_DEMO) { _saveReminderState = 1; } _vm->_gfx->showCursor(true); @@ -425,7 +425,7 @@ void Interface::setMode(int mode) { } else if (mode == kPanelChapterSelection) { _saveReminderState = 1; } else if (mode == kPanelNull) { - if (_vm->getGameId() == GID_IHNM_DEMO) { + if (_vm->getFeatures() & GF_IHNM_DEMO) { _inMainMode = true; _saveReminderState = 1; } @@ -487,7 +487,7 @@ void Interface::setMode(int mode) { _vm->_render->setFlag(RF_DEMO_SUBST); break; case kPanelProtect: - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { // This is used as the copy protection panel in ITE _protectPanel.currentButton = NULL; _textInputMaxWidth = _protectEdit->width - 10; @@ -672,7 +672,7 @@ bool Interface::processAscii(Common::KeyState keystate) { case '7': case '8': case '9': - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) converseSetPos(ascii); break; } @@ -695,7 +695,7 @@ bool Interface::processAscii(Common::KeyState keystate) { keyBossExit(); break; case kPanelProtect: - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (_textInput && processTextInput(keystate)) { return true; } @@ -715,9 +715,9 @@ bool Interface::processAscii(Common::KeyState keystate) { } break; case kPanelPlacard: - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { // Any keypress here returns the user back to the game - if (_vm->getGameId() != GID_IHNM_DEMO) { + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { _vm->_scene->clearPsychicProfile(); } else { setMode(kPanelConverse); @@ -733,11 +733,11 @@ bool Interface::processAscii(Common::KeyState keystate) { void Interface::setStatusText(const char *text, int statusColor) { // Disable the status text in IHNM when the chapter is 8 - if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 8) + if (_vm->getGameId() == GID_IHNM && !(_vm->getFeatures() & GF_IHNM_DEMO) && _vm->_scene->currentChapterNumber() == 8) return; // Disable the status text in the introduction of the IHNM demo - if (_vm->getGameId() == GID_IHNM_DEMO && _vm->_scene->currentSceneNumber() == 0) + if (_vm->getFeatures() & GF_IHNM_DEMO && _vm->_scene->currentSceneNumber() == 0) return; assert(text != NULL); @@ -799,7 +799,7 @@ void Interface::draw() { drawStatusBar(); if (_panelMode == kPanelMain || _panelMode == kPanelMap || - (_panelMode == kPanelNull && _vm->getGameId() == GID_IHNM_DEMO)) { + (_panelMode == kPanelNull && _vm->getFeatures() & GF_IHNM_DEMO)) { _mainPanel.getRect(rect); _vm->_gfx->drawRegion(rect, _mainPanel.image); @@ -816,7 +816,7 @@ void Interface::draw() { if (_panelMode == kPanelMain || _panelMode == kPanelConverse || _lockedMode == kPanelMain || _lockedMode == kPanelConverse || - (_panelMode == kPanelNull && _vm->getGameId() == GID_IHNM_DEMO)) { + (_panelMode == kPanelNull && _vm->getFeatures() & GF_IHNM_DEMO)) { leftPortraitPoint.x = _mainPanel.x + _vm->getDisplayInfo().leftPortraitXOffset; leftPortraitPoint.y = _mainPanel.y + _vm->getDisplayInfo().leftPortraitYOffset; _vm->_sprite->draw(_defPortraits, _leftPortrait, leftPortraitPoint, 256); @@ -851,7 +851,7 @@ void Interface::calcOptionSaveSlider() { totalFiles = visibleFiles; } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { // ITE's save file list slider has a dynamically computed height, depending on // the number of save games sliderHeight = visibleFiles * height / totalFiles; @@ -889,12 +889,12 @@ void Interface::drawPanelText(InterfacePanel *panel, PanelButton *panelButton) { KnownFont textFont = kKnownFontMedium; // Button differs for CD version - if (panelButton->id == kTextReadingSpeed && _vm->getFeatures() & GF_CD_FX) + if (panelButton->id == kTextReadingSpeed && _vm->getGameId() == GID_ITE && !(_vm->getFeatures() & GF_ITE_FLOPPY)) return; - if (panelButton->id == kTextShowDialog && !(_vm->getFeatures() & GF_CD_FX)) + if (panelButton->id == kTextShowDialog && _vm->getFeatures() & GF_ITE_FLOPPY) return; - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { text = _vm->getTextString(panelButton->id); textFont = kKnownFontMedium; textShadowKnownColor = kKnownColorVerbTextShadow; @@ -916,7 +916,7 @@ void Interface::drawPanelText(InterfacePanel *panel, PanelButton *panelButton) { panel->calcPanelButtonRect(panelButton, rect); if (panelButton->xOffset < 0) { - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) textWidth = _vm->_font->getStringWidth(kKnownFontMedium, text, 0, kFontNormal); else textWidth = _vm->_font->getStringWidth(kKnownFontVerb, text, 0, kFontNormal); @@ -951,7 +951,7 @@ void Interface::drawOption() { panelButton = &_optionPanel.buttons[i]; if (panelButton->type == kPanelButtonOption) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { drawPanelButtonText(&_optionPanel, panelButton); } else { drawPanelButtonText(&_optionPanel, panelButton, spritenum); @@ -964,11 +964,11 @@ void Interface::drawOption() { } if (_optionSaveRectTop.height() > 0) { - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_gfx->drawRect(_optionSaveRectTop, kITEColorDarkGrey); } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { drawButtonBox(_optionSaveRectSlider, kSlider, _optionSaveFileSlider->state > 0); } else { panelButton = &_optionPanel.buttons[0]; @@ -987,7 +987,7 @@ void Interface::drawOption() { rect2 = rect; fontHeight = _vm->_font->getHeight(kKnownFontSmall); for (uint j = 0; j < _vm->getDisplayInfo().optionSaveFileVisible; j++) { - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) bgColor = kITEColorDarkGrey0C; else bgColor = _vm->KnownColor2ColorId(kKnownColorBlack); @@ -1004,7 +1004,7 @@ void Interface::drawOption() { text = _vm->getSaveFile(idx)->name; textPoint.x = rect.left + 1; textPoint.y = rect2.top; - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_font->textDraw(kKnownFontSmall, text, textPoint, fgColor, 0, kFontNormal); else _vm->_font->textDraw(kKnownFontVerb, text, textPoint, fgColor, 0, kFontNormal); @@ -1019,7 +1019,7 @@ void Interface::drawQuit() { PanelButton *panelButton; _quitPanel.getRect(rect); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) drawButtonBox(rect, kButton, false); else _vm->_gfx->drawRegion(rect, _quitPanel.image); @@ -1069,7 +1069,7 @@ void Interface::setQuit(PanelButton *panelButton) { setMode(kPanelOption); break; case kTextQuit: - if (_vm->getGameId() == GID_IHNM_DEMO) + if (_vm->getFeatures() & GF_IHNM_DEMO) _vm->_scene->creditsScene(); // display sales info for IHNM demo else _vm->quitGame(); @@ -1083,7 +1083,7 @@ void Interface::drawLoad() { PanelButton *panelButton; _loadPanel.getRect(rect); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) drawButtonBox(rect, kButton, false); else _vm->_gfx->drawRegion(rect, _loadPanel.image); @@ -1130,7 +1130,7 @@ void Interface::setLoad(PanelButton *panelButton) { _loadPanel.currentButton = NULL; switch (panelButton->id) { case kTextOK: - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { setMode(kPanelMain); } else { if (_vm->getSaveFilesCount() > 0) { @@ -1189,7 +1189,7 @@ bool Interface::processTextInput(Common::KeyState keystate) { ch[1] = 0; // IHNM has a smaller save title size than ITE. We only limit the save title size during text input // in IHNM, to preserve backwards compatibility with older save games - uint save_title_size = _vm->getGameType() == GType_ITE ? SAVE_TITLE_SIZE : IHNM_SAVE_TITLE_SIZE; + uint save_title_size = _vm->getGameId() == GID_ITE ? SAVE_TITLE_SIZE : IHNM_SAVE_TITLE_SIZE; switch (keystate.keycode) { case Common::KEYCODE_RETURN: @@ -1303,7 +1303,7 @@ void Interface::drawSave() { PanelButton *panelButton; _savePanel.getRect(rect); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) drawButtonBox(rect, kButton, false); else _vm->_gfx->drawRegion(rect, _savePanel.image); @@ -1578,7 +1578,7 @@ void Interface::setOption(PanelButton *panelButton) { switch (panelButton->id) { case kTextContinuePlaying: ConfMan.flushToDisk(); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { setMode(kPanelMain); } else { if (_vm->_scene->currentChapterNumber() == 8) { @@ -1594,7 +1594,7 @@ void Interface::setOption(PanelButton *panelButton) { setMode(kPanelQuit); break; case kTextLoad: - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (_vm->getSaveFilesCount() > 0) { if (_vm->isSaveListFull() || (_optionSaveFileTitleNumber > 0)) { debug(1, "Loading save game %d", _vm->getSaveFile(_optionSaveFileTitleNumber)->slotNumber); @@ -1620,7 +1620,7 @@ void Interface::setOption(PanelButton *panelButton) { setMode(kPanelSave); break; case kTextReadingSpeed: - if (_vm->getFeatures() & GF_CD_FX) { + if (_vm->getGameId() == GID_ITE && !(_vm->getFeatures() & GF_ITE_FLOPPY)) { _vm->_subtitlesEnabled = !_vm->_subtitlesEnabled; ConfMan.setBool("subtitles", _vm->_subtitlesEnabled); } else { @@ -1677,7 +1677,7 @@ void Interface::update(const Point& mousePoint, int updateFlag) { // When opening the psychic profile, or the options screen in the non-interactive part of the IHNM demo, // the interface is locked (_active is false) // Don't return in those cases, so that mouse actions can be processed - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { return; } else { if (_panelMode == kPanelPlacard && (updateFlag & UPDATE_MOUSECLICK)) { @@ -1836,10 +1836,10 @@ void Interface::update(const Point& mousePoint, int updateFlag) { break; case kPanelPlacard: - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { // Any mouse click here returns the user back to the game if (updateFlag & UPDATE_MOUSECLICK) { - if (_vm->getGameId() != GID_IHNM_DEMO) { + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { _vm->_scene->clearPsychicProfile(); } else { setMode(kPanelConverse); @@ -1866,10 +1866,10 @@ void Interface::drawStatusBar() { int color; // The default colors in the Spanish version of IHNM are shifted by one // Fixes bug #1848016 - "IHNM: Wrong Subtitles Color (Spanish)" - int offset = (_vm->getGameId() == GID_IHNM_CD_ES) ? 1 : 0; + int offset = (_vm->getLanguage() == Common::ES_ESP) ? 1 : 0; // Disable the status text in IHNM when the chapter is 8 - if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 8) + if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 8) return; // Don't draw the status bar while fading out @@ -1893,7 +1893,7 @@ void Interface::drawStatusBar() { textPoint.x = _vm->getDisplayInfo().statusXOffset + (_vm->getDisplayInfo().statusWidth - stringWidth) / 2; textPoint.y = _vm->getDisplayInfo().statusYOffset + _vm->getDisplayInfo().statusTextY; - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_font->textDraw(kKnownFontSmall, _statusText, textPoint, color, 0, kFontNormal); else _vm->_font->textDraw(kKnownFontVerb, _statusText, textPoint, color, 0, kFontNormal); @@ -2111,7 +2111,7 @@ void Interface::drawInventory() { } _mainPanel.calcPanelButtonRect(&_mainPanel.buttons[i], rect); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_gfx->drawRect(rect, kITEColorDarkGrey); else _vm->_gfx->drawRect(rect, _vm->KnownColor2ColorId(kKnownColorBlack)); @@ -2154,7 +2154,7 @@ void Interface::drawButtonBox(const Rect& rect, ButtonKind kind, bool down) { solidColor = down ? kITEColorLightBlue94 : kITEColorLightBlue96; break; case kEdit: - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { cornerColor = frameColor = fillColor = kITEColorLightBlue96; our = kITEColorDarkBlue8a; odl = kITEColorLightBlue94; @@ -2247,7 +2247,7 @@ void Interface::drawPanelButtonText(InterfacePanel *panel, PanelButton *panelBut textId = panelButton->id; switch (panelButton->id) { case kTextReadingSpeed: - if (_vm->getFeatures() & GF_CD_FX) { + if (_vm->getGameId() == GID_ITE && !(_vm->getFeatures() & GF_ITE_FLOPPY)) { if (_vm->_subtitlesEnabled) textId = kTextOn; else @@ -2277,7 +2277,7 @@ void Interface::drawPanelButtonText(InterfacePanel *panel, PanelButton *panelBut textId = kTextAudio; break; } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { text = _vm->getTextString(textId); textFont = kKnownFontMedium; textShadowKnownColor = kKnownColorVerbTextShadow; @@ -2309,7 +2309,7 @@ void Interface::drawPanelButtonText(InterfacePanel *panel, PanelButton *panelBut } panel->calcPanelButtonRect(panelButton, rect); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { drawButtonBox(rect, kButton, panelButton->state > 0); } else { litButton = panelButton->state > 0; @@ -2361,7 +2361,7 @@ void Interface::drawPanelButtonArrow(InterfacePanel *panel, PanelButton *panelBu point.x = panel->x + panelButton->xOffset; point.y = panel->y + panelButton->yOffset; - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_sprite->draw(_vm->_sprite->_mainSprites, spriteNumber, point, 256); else _vm->_sprite->draw(_vm->_sprite->_arrowSprites, spriteNumber, point, 256); @@ -2373,7 +2373,7 @@ void Interface::drawVerbPanelText(PanelButton *panelButton, KnownColor textKnown Point point; int textId; - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { textId = verbTypeToTextStringsIdLUT[0][panelButton->id]; text = _vm->getTextString(textId); } else { @@ -2384,7 +2384,7 @@ void Interface::drawVerbPanelText(PanelButton *panelButton, KnownColor textKnown textWidth = _vm->_font->getStringWidth(kKnownFontVerb, text, 0, kFontNormal); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { point.x = _mainPanel.x + panelButton->xOffset + 1 + (panelButton->width - 1 - textWidth) / 2; point.y = _mainPanel.y + panelButton->yOffset + 1; } else { @@ -2440,7 +2440,7 @@ bool Interface::converseAddText(const char *text, int strId, int replyId, byte r for (i = len; i >= 0; i--) { c = _converseWorkString[i]; - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if ((c == ' ' || c == '\0') && (_vm->_font->getStringWidth(kKnownFontSmall, _converseWorkString, i, kFontNormal) <= _vm->getDisplayInfo().converseMaxTextWidth)) break; } else { @@ -2521,7 +2521,7 @@ void Interface::converseDisplayTextLines() { assert(_conversePanel.buttonsCount >= 6); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { bulletForegnd = kITEColorGreen; bulletBackgnd = kITEColorBlack; } else { @@ -2533,7 +2533,7 @@ void Interface::converseDisplayTextLines() { rect.moveTo(_conversePanel.x + _conversePanel.buttons[0].xOffset, _conversePanel.y + _conversePanel.buttons[0].yOffset); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_gfx->drawRect(rect, kITEColorDarkGrey); //fill bullet place else _vm->_gfx->drawRect(rect, _vm->KnownColor2ColorId(kKnownColorBlack)); //fill bullet place @@ -2546,7 +2546,7 @@ void Interface::converseDisplayTextLines() { } if (_conversePos >= 0 && _converseText[_conversePos].stringNum == _converseText[relPos].stringNum) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { foregnd = kITEColorBrightWhite; backgnd = (!_vm->leftMouseButtonPressed()) ? kITEColorDarkGrey : kITEColorGrey; } else { @@ -2554,7 +2554,7 @@ void Interface::converseDisplayTextLines() { backgnd = _vm->KnownColor2ColorId(kKnownColorVerbTextActive); } } else { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { foregnd = kITEColorBlue; backgnd = kITEColorDarkGrey; } else { @@ -2573,14 +2573,14 @@ void Interface::converseDisplayTextLines() { textPoint.x = rect.left - 6; textPoint.y = rect.top; - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_font->textDraw(kKnownFontSmall, bullet, textPoint, bulletForegnd, bulletBackgnd, (FontEffectFlags)(kFontShadow | kFontDontmap)); else _vm->_font->textDraw(kKnownFontVerb, bullet, textPoint, bulletForegnd, bulletBackgnd, (FontEffectFlags)(kFontShadow | kFontDontmap)); } textPoint.x = rect.left + 1; textPoint.y = rect.top; - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_font->textDraw(kKnownFontSmall, str, textPoint, foregnd, kITEColorBlack, kFontShadow); else _vm->_font->textDraw(kKnownFontVerb, str, textPoint, foregnd, _vm->KnownColor2ColorId(kKnownColorBlack), kFontShadow); @@ -2797,7 +2797,7 @@ void Interface::mapPanelDrawCrossHair() { } void Interface::keyBoss() { - if (_vm->getGameType() != GType_IHNM) + if (_vm->getGameId() == GID_ITE) return; if (_bossMode != -1 || _fadeMode != kNoFade) diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp index 3ce77d945f..99e2b4aa31 100644 --- a/engines/saga/introproc_ihnm.cpp +++ b/engines/saga/introproc_ihnm.cpp @@ -51,7 +51,7 @@ int Scene::IHNMStartProc() { IHNMLoadCutaways(); - if (_vm->getGameId() != GID_IHNM_DEMO) { + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { int logoLength = -168; if (_vm->getLanguage() == Common::DE_DEU || _vm->getLanguage() == Common::ES_ESP) @@ -102,7 +102,7 @@ int Scene::IHNMCreditsProc() { _vm->_music->play(0, MUSIC_NORMAL); - if (_vm->getGameId() != GID_IHNM_DEMO) { + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { // Display the credits for 400 frames playTitle(4, -400, true); } else { @@ -127,7 +127,7 @@ void Scene::IHNMLoadCutaways() { error("Scene::IHNMStartProc() resource context not found"); } - if (_vm->getGameId() != GID_IHNM_DEMO) + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) _vm->_resource->loadResource(resourceContext, RID_IHNM_INTRO_CUTAWAYS, resourcePointer, resourceLength); else _vm->_resource->loadResource(resourceContext, RID_IHNMDEMO_INTRO_CUTAWAYS, resourcePointer, resourceLength); diff --git a/engines/saga/introproc_ite.cpp b/engines/saga/introproc_ite.cpp index f3e2e2a344..8b01564d20 100644 --- a/engines/saga/introproc_ite.cpp +++ b/engines/saga/introproc_ite.cpp @@ -193,7 +193,7 @@ Event *Scene::ITEQueueCredits(int delta_time, int duration, int n_credits, const game = kITEWyrmKeep; } else if (_vm->getPlatform() == Common::kPlatformMacintosh) { game = kITEMac; - } else if (_vm->getGameId() == GID_ITE_CD_G) { + } else if (_vm->getFeatures() & GF_EXTRA_ITE_CREDITS) { game = kITEPCCD; } else { game = kITEPC; diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index b4a8f23203..202c870a77 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -76,7 +76,7 @@ public: bool endOfData() const { return eosIntern(); } bool isStereo() const { // The digital music in the ITE Mac demo version is not stereo - return _vm->getGameId() == GID_ITE_MACDEMO2 ? false : true; + return _vm->getFeatures() & GF_MONO_MUSIC ? false : true; } int getRate() const { return 11025; } }; @@ -453,7 +453,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { int realTrackNumber; - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (flags == MUSIC_DEFAULT) { if (resourceId == 13 || resourceId == 19) { flags = MUSIC_NORMAL; @@ -482,13 +482,13 @@ void Music::play(uint32 resourceId, MusicFlags flags) { } } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (resourceId >= 9 && resourceId <= 34) { if (_digitalMusicContext != NULL) { //TODO: check resource size loopStart = 0; // fix ITE sunstatm/sunspot score - if ((_vm->getGameType() == GType_ITE) && (resourceId == MUSIC_SUNSPOT)) { + if ((_vm->getGameId() == GID_ITE) && (resourceId == MUSIC_SUNSPOT)) { loopStart = 4 * 18727; } @@ -511,12 +511,12 @@ void Music::play(uint32 resourceId, MusicFlags flags) { // Load MIDI/XMI resource data - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { context = _vm->_resource->getContext(GAME_MUSICFILE_GM); if (context == NULL) { context = _vm->_resource->getContext(GAME_RESOURCEFILE); } - } else if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + } else if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { // The music of the Mac version of IHNM is loaded from its // associated external file later on } else { @@ -545,7 +545,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { // Note that the IHNM demo has only got one music file // (music.rsc). It is assumed that it contains FM music - if (hasAdlib() || _vm->getGameId() == GID_IHNM_DEMO) { + if (hasAdlib() || _vm->getFeatures() & GF_IHNM_DEMO) { context = _vm->_resource->getContext(GAME_MUSICFILE_FM); } else { context = _vm->_resource->getContext(GAME_MUSICFILE_GM); @@ -554,7 +554,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { _player->setGM(true); - if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { // Load the external music file for Mac IHNM Common::File musicFile; char musicFileName[40]; @@ -577,7 +577,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { } if (xmidiParser->loadMusic(resourceData, resourceSize)) { - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _player->setGM(false); parser = xmidiParser; diff --git a/engines/saga/palanim.cpp b/engines/saga/palanim.cpp index 319946f2d5..d59ae1f281 100644 --- a/engines/saga/palanim.cpp +++ b/engines/saga/palanim.cpp @@ -58,7 +58,7 @@ int PalAnim::loadPalAnim(const byte *resdata, size_t resdata_len) { MemoryReadStreamEndian readS(resdata, resdata_len, _vm->isBigEndian()); - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { return SUCCESS; } diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp index 43dd83957f..5e5c9ee09d 100644 --- a/engines/saga/render.cpp +++ b/engines/saga/render.cpp @@ -101,7 +101,7 @@ void Render::drawScene() { if (!(_flags & (RF_DEMO_SUBST | RF_MAP) || curMode == kPanelPlacard)) { if (_vm->_interface->getFadeMode() != kFadeOut) { // Display scene background - if (!(_flags & RF_DISABLE_ACTORS) || _vm->getGameType() == GType_ITE) + if (!(_flags & RF_DISABLE_ACTORS) || _vm->getGameId() == GID_ITE) _vm->_scene->draw(); if (_vm->_puzzle->isActive()) { @@ -176,7 +176,7 @@ void Render::drawScene() { // Display "paused game" message, if applicable if (_flags & RF_RENDERPAUSE) { - const char *pauseString = (_vm->getGameType() == GType_ITE) ? pauseStringITE : pauseStringIHNM; + const char *pauseString = (_vm->getGameId() == GID_ITE) ? pauseStringITE : pauseStringIHNM; textPoint.x = (_vm->_gfx->getBackBufferWidth() - _vm->_font->getStringWidth(kKnownFontPause, pauseString, 0, kFontOutline)) / 2; textPoint.y = 90; diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp index 2e7eaddf85..ce6c61a960 100644 --- a/engines/saga/rscfile.cpp +++ b/engines/saga/rscfile.cpp @@ -330,7 +330,7 @@ bool Resource::loadContext(ResourceContext *context) { // ITE uses several patch files which are loaded and then not needed // anymore (as they're in memory), so close them here. IHNM uses only // 1 patch file, which is reused, so don't close it - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) resourceData->patchData->_patchFile->close(); } else { delete resourceData->patchData; @@ -401,8 +401,8 @@ bool Resource::createContexts() { if (!soundFileInArray) { // If the sound file is not specified in the detector table, add it here fileFound = false; - curSoundfiles = _vm->getGameType() == GType_ITE ? sfxFilesITE : sfxFilesIHNM; - maxFile = _vm->getGameType() == GType_ITE ? 4 : 2; + curSoundfiles = _vm->getGameId() == GID_ITE ? sfxFilesITE : sfxFilesIHNM; + maxFile = _vm->getGameId() == GID_ITE ? 4 : 2; for (i = 0; i < maxFile; i++) { if (Common::File::exists(curSoundfiles[i].fileName)) { @@ -418,7 +418,7 @@ bool Resource::createContexts() { if (!fileFound) { // No sound file found, don't add any file to the array soundFileInArray = true; - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { // ITE floppy versions have both voices and sounds in voices.rsc voiceFileType = GAME_SOUNDFILE | GAME_VOICEFILE; } @@ -445,8 +445,8 @@ bool Resource::createContexts() { // Detect and add voice files fileFound = false; - curSoundfiles = _vm->getGameType() == GType_ITE ? voiceFilesITE : voiceFilesIHNM; - maxFile = _vm->getGameType() == GType_ITE ? 7 : 4; + curSoundfiles = _vm->getGameId() == GID_ITE ? voiceFilesITE : voiceFilesIHNM; + maxFile = _vm->getGameId() == GID_ITE ? 7 : 4; for (i = 0; i < maxFile; i++) { if (Common::File::exists(curSoundfiles[i].fileName)) { @@ -490,7 +490,7 @@ bool Resource::createContexts() { } if (!fileFound) { - if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { // The Macintosh version of IHNM has no voices.res, and it has all // its voice files in subdirectories, so don't do anything here } else { @@ -511,7 +511,7 @@ bool Resource::createContexts() { }; // Check for digital music in ITE - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { fileFound = false; for (i = 0; i < 4; i++) { @@ -538,7 +538,7 @@ bool Resource::createContexts() { context->serial = 0; // For ITE, add the digital music file and sfx file information here - if (_vm->getGameType() == GType_ITE && digitalMusic && i == _contextsCount - 1) { + if (_vm->getGameId() == GID_ITE && digitalMusic && i == _contextsCount - 1) { context->fileName = musicFileName; context->fileType = GAME_MUSICFILE; } else if (!soundFileInArray && i == soundFileIndex) { @@ -602,7 +602,7 @@ void Resource::clearContexts() { uint32 Resource::convertResourceId(uint32 resourceId) { - if (_vm->getGameType() == GType_ITE && _vm->isMacResources()) { + if (_vm->getGameId() == GID_ITE && _vm->isMacResources()) { if (resourceId > 1537) { return resourceId - 2; } else { @@ -640,7 +640,7 @@ void Resource::loadResource(ResourceContext *context, uint32 resourceId, byte*&r // ITE uses several patch files which are loaded and then not needed // anymore (as they're in memory), so close them here. IHNM uses only // 1 patch file, which is reused, so don't close it - if (resourceData->patchData != NULL && _vm->getGameType() == GType_ITE) + if (resourceData->patchData != NULL && _vm->getGameId() == GID_ITE) file->close(); } @@ -649,7 +649,7 @@ static int metaResourceTableDemo[] = { 0, 0, 0, 0, 0, 0, 0, 285, 0 }; void Resource::loadGlobalResources(int chapter, int actorsEntrance) { if (chapter < 0) - chapter = (_vm->getGameId() != GID_IHNM_DEMO) ? 8 : 7; + chapter = (!(_vm->getFeatures() & GF_IHNM_DEMO)) ? 8 : 7; _vm->_script->_globalVoiceLUT.freeMem(); @@ -672,7 +672,7 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) { byte *resourcePointer; size_t resourceLength; - if (_vm->getGameId() != GID_IHNM_DEMO) { + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { _vm->_resource->loadResource(resourceContext, metaResourceTable[chapter], resourcePointer, resourceLength); } else { diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 428579ef06..316f4b7cc5 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -216,7 +216,7 @@ Common::Error SagaEngine::init() { _gfx->initPalette(); if (_voiceFilesExist) { - if (getGameType() == GType_IHNM) { + if (getGameId() == GID_IHNM) { if (!ConfMan.hasKey("voices")) { _voicesEnabled = true; ConfMan.setBool("voices", true); @@ -234,7 +234,7 @@ Common::Error SagaEngine::init() { // well for 320x200 but it's unclear how well it will work for // 640x480. - if (getGameType() == GType_ITE) + if (getGameId() == GID_ITE) _system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true); return Common::kNoError; @@ -248,19 +248,19 @@ Common::Error SagaEngine::go() { if (ConfMan.hasKey("start_scene")) { _scene->changeScene(ConfMan.getInt("start_scene"), 0, kTransitionNoFade); } else if (ConfMan.hasKey("boot_param")) { - if (getGameType() == GType_ITE) + if (getGameId() == GID_ITE) _interface->addToInventory(_actor->objIndexToId(0)); // Magic hat _scene->changeScene(ConfMan.getInt("boot_param"), 0, kTransitionNoFade); } else if (ConfMan.hasKey("save_slot")) { // Init the current chapter to 8 (character selection) for IHNM - if (getGameType() == GType_IHNM) + if (getGameId() == GID_IHNM) _scene->changeScene(-2, 0, kTransitionFade, 8); // First scene sets up palette _scene->changeScene(getStartSceneNumber(), 0, kTransitionNoFade); _events->handleEvents(0); // Process immediate events - if (getGameType() != GType_IHNM) + if (getGameId() == GID_ITE) _interface->setMode(kPanelMain); else _interface->setMode(kPanelChapterSelection); @@ -374,13 +374,13 @@ const char *SagaEngine::getObjectName(uint16 objectId) { const HitZone *hitZone; // Disable the object names in IHNM when the chapter is 8 - if (getGameType() == GType_IHNM && _scene->currentChapterNumber() == 8) + if (getGameId() == GID_IHNM && _scene->currentChapterNumber() == 8) return ""; switch (objectTypeId(objectId)) { case kGameObjectObject: obj = _actor->getObj(objectId); - if (getGameType() == GType_ITE) + if (getGameId() == GID_ITE) return _script->_mainStrings.getString(obj->_nameIndex); return _actor->_objectsStrings.getString(obj->_nameIndex); case kGameObjectActor: @@ -452,7 +452,7 @@ void SagaEngine::getExcuseInfo(int verb, const char *&textString, int &soundReso ColorId SagaEngine::KnownColor2ColorId(KnownColor knownColor) { ColorId colorId = kITEColorTransBlack; - if (getGameType() == GType_ITE) { + if (getGameId() == GID_ITE) { switch (knownColor) { case(kKnownColorTransparent): colorId = kITEColorTransBlack; @@ -482,10 +482,10 @@ ColorId SagaEngine::KnownColor2ColorId(KnownColor knownColor) { default: error("SagaEngine::KnownColor2ColorId unknown color %i", knownColor); } - } else if (getGameType() == GType_IHNM) { + } else if (getGameId() == GID_IHNM) { // The default colors in the Spanish version of IHNM are shifted by one // Fixes bug #1848016 - "IHNM: Wrong Subtitles Color (Spanish)" - int offset = (getGameId() == GID_IHNM_CD_ES) ? 1 : 0; + int offset = (getLanguage() == Common::ES_ESP) ? 1 : 0; switch (knownColor) { case(kKnownColorTransparent): diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 8e26a46e1f..09f605ba28 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -94,52 +94,9 @@ enum ERRORCODE { SUCCESS = 0 }; -enum SAGAGameType { - GType_ITE = 0, - GType_IHNM = 1 -}; - enum GameIds { - // Dreamers Guild - GID_ITE_DEMO_G = 0, - GID_ITE_DISK_G, - GID_ITE_DISK_G2, - GID_ITE_CD_G, - GID_ITE_CD_G2, - GID_ITE_MACCD_G, - - // Wyrmkeep - GID_ITE_CD, // data for Win rerelease is same as in old DOS - GID_ITE_WINCD, // but it has a bunch of patch files - GID_ITE_MACCD, - GID_ITE_LINCD, - GID_ITE_MULTICD, // Wyrmkeep combined Windows/Mac/Linux version - GID_ITE_WINDEMO1, // older Wyrmkeep windows demo - GID_ITE_MACDEMO1, // older Wyrmkeep mac demo - GID_ITE_LINDEMO, - GID_ITE_WINDEMO2, - GID_ITE_WINDEMO3, - GID_ITE_MACDEMO2, - - // German - GID_ITE_DISK_DE, - GID_ITE_DISK_DE2, - GID_ITE_AMIGACD_DE, // TODO - GID_ITE_OLDMAC_DE, // TODO - GID_ITE_AMIGA_FL_DE,// TODO - GID_ITE_CD_DE, // reported by mld. Bestsellergamers cover disk - GID_ITE_CD_DE2, - GID_ITE_AMIGA_AGA_DEMO, // TODO - GID_ITE_AMIGA_ECS_DEMO, // TODO - - GID_IHNM_DEMO, - GID_IHNM_CD, - GID_IHNM_CD_DE, // reported by mld. German retail - GID_IHNM_CD_ES, - GID_IHNM_CD_RU, - GID_IHNM_CD_FR, - GID_IHNM_CD_ITA, - GID_IHNM_CD_MAC + GID_ITE = 0, + GID_IHNM = 1 }; enum GameFileTypes { @@ -159,10 +116,14 @@ enum GameFileTypes { enum GameFeatures { GF_BIG_ENDIAN_DATA = 1 << 0, GF_WYRMKEEP = 1 << 1, - GF_CD_FX = 1 << 2, + GF_ITE_FLOPPY = 1 << 2, GF_SCENE_SUBSTITUTES = 1 << 3, GF_COMPRESSED_SOUNDS = 1 << 4, - GF_NON_INTERACTIVE = 1 << 5 + GF_NON_INTERACTIVE = 1 << 5, + GF_OLD_ITE_DOS = 1 << 6, + GF_MONO_MUSIC = 1 << 7, + GF_EXTRA_ITE_CREDITS = 1 << 8, + GF_IHNM_DEMO = 1 << 9 }; enum VerbTypeIds { @@ -604,7 +565,7 @@ public: } inline int ticksToMSec(int tick) { - if (getGameType() == GType_ITE) + if (getGameId() == GID_ITE) return tick * 1000 / kScriptTimeTicksPerSecond; else return tick * 1000 / kScriptTimeTicksPerSecondIHNM; @@ -642,7 +603,6 @@ public: int getFontsCount() const; int getGameId() const; - int getGameType() const; uint32 getFeatures() const; Common::Language getLanguage() const; Common::Platform getPlatform() const; diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp index d84435fc5d..2c18a5f02c 100644 --- a/engines/saga/saveload.cpp +++ b/engines/saga/saveload.cpp @@ -199,7 +199,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) { // Surrounding scene out->writeSint32LE(_scene->getOutsetSceneNumber()); - if (getGameType() != GType_ITE) { + if (getGameId() == GID_IHNM) { out->writeSint32LE(_scene->currentChapterNumber()); // Protagonist out->writeSint32LE(_scene->currentProtag()); @@ -210,7 +210,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) { // Inset scene out->writeSint32LE(_scene->currentSceneNumber()); - if (getGameType() != GType_ITE) { + if (getGameId() == GID_IHNM) { out->writeUint32LE(_globalFlags); for (int i = 0; i < ARRAYSIZE(_ethicsPoints); i++) out->writeSint16LE(_ethicsPoints[i]); @@ -288,7 +288,7 @@ void SagaEngine::load(const char *fileName) { // Surrounding scene sceneNumber = in->readSint32LE(); - if (getGameType() != GType_ITE) { + if (getGameId() == GID_IHNM) { int currentChapter = _scene->currentChapterNumber(); _scene->setChapterNumber(in->readSint32LE()); _scene->setProtag(in->readSint32LE()); @@ -299,7 +299,7 @@ void SagaEngine::load(const char *fileName) { _music->stop(); if (_scene->currentChapterNumber() == 8) _interface->setMode(kPanelChapterSelection); - if (getGameId() != GID_IHNM_DEMO) { + if (!(getFeatures() & GF_IHNM_DEMO)) { _music->play(_music->_songTable[_scene->getCurrentMusicTrack()], _scene->getCurrentMusicRepeat() ? MUSIC_LOOP : MUSIC_NORMAL); } else { _music->play(3, MUSIC_LOOP); @@ -309,7 +309,7 @@ void SagaEngine::load(const char *fileName) { // Inset scene insetSceneNumber = in->readSint32LE(); - if (getGameType() != GType_ITE) { + if (getGameId() == GID_IHNM) { _globalFlags = in->readUint32LE(); for (int i = 0; i < ARRAYSIZE(_ethicsPoints); i++) _ethicsPoints[i] = in->readSint16LE(); @@ -334,7 +334,7 @@ void SagaEngine::load(const char *fileName) { _isoMap->setMapPosition(mapx, mapy); // Protagonist swapping - if (getGameType() != GType_ITE) { + if (getGameId() == GID_IHNM) { if (_scene->currentProtag() != 0 && _scene->currentChapterNumber() != 6) { ActorData *actor1 = _actor->getFirstActor(); ActorData *actor2; diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index c4d04c65e2..a746efc7bd 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -226,7 +226,7 @@ Scene::~Scene() { } void Scene::getResourceTypes(SAGAResourceTypes *&types, int &typesCount) { - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { typesCount = ARRAYSIZE(IHNMSceneResourceTypes); types = IHNMSceneResourceTypes; } else { @@ -270,11 +270,11 @@ void Scene::startScene() { event.op = kEventHide; _vm->_events->queue(&event); - switch (_vm->getGameType()) { - case GType_ITE: + switch (_vm->getGameId()) { + case GID_ITE: ITEStartProc(); break; - case GType_IHNM: + case GID_IHNM: IHNMStartProc(); break; default: @@ -305,11 +305,11 @@ void Scene::creditsScene() { // Hide cursor during credits _vm->_gfx->showCursor(false); - switch (_vm->getGameType()) { - case GType_ITE: + switch (_vm->getGameId()) { + case GID_ITE: // Not called by ITE break; - case GType_IHNM: + case GID_IHNM: IHNMCreditsProc(); break; default: @@ -601,7 +601,7 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { _chapterPointsChanged = false; - if ((_vm->getGameType() == GType_IHNM) && (loadSceneParams->chapter != NO_CHAPTER_CHANGE)) { + if ((_vm->getGameId() == GID_IHNM) && (loadSceneParams->chapter != NO_CHAPTER_CHANGE)) { if (loadSceneParams->loadFlag != kLoadBySceneNumber) { error("loadScene wrong usage"); } @@ -622,7 +622,7 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { _vm->_interface->activate(); if (loadSceneParams->chapter == 8 || loadSceneParams->chapter == -1) { - if (_vm->getGameId() != GID_IHNM_DEMO) + if (!(_vm->getFeatures() & GF_IHNM_DEMO)) _vm->_interface->setMode(kPanelChapterSelection); else _vm->_interface->setMode(kPanelNull); @@ -646,7 +646,7 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { _loadDescription = true; - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if (loadSceneParams->loadFlag == kLoadBySceneNumber) // When will we get rid of it? if (loadSceneParams->sceneDescriptor <= 0) loadSceneParams->sceneDescriptor = _vm->_resource->_metaResource.sceneIndex; @@ -813,14 +813,14 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { } if (loadSceneParams->sceneProc == NULL) { - if (!_inGame && _vm->getGameType() == GType_ITE) { + if (!_inGame && _vm->getGameId() == GID_ITE) { _inGame = true; _vm->_interface->setMode(kPanelMain); } _vm->_sound->stopAll(); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (_sceneDescription.musicResourceId >= 0) { event.type = kEvTOneshot; event.code = kMusicEvent; @@ -997,7 +997,7 @@ void Scene::processSceneResources() { case SAGA_ACTOR: //for (a = actorsInScene; a; a = a->nextInScene) // if (a->obj.figID == glist->file_id) - // if (_vm->getGameType() == GType_ITE || + // if (_vm->getGameId() == GID_ITE || // ((a->obj.flags & ACTORF_FINAL_FACE) & 0xff)) // a->sprites = (xSpriteSet *)glist->offset; warning("STUB: unimplemeted handler of SAGA_ACTOR resource"); @@ -1119,7 +1119,7 @@ void Scene::processSceneResources() { _vm->_palanim->loadPalAnim(resourceData, resourceDataLength); break; case SAGA_FACES: - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) _vm->_interface->loadScenePortraits(_resourceList[i].resourceId); break; case SAGA_PALETTE: @@ -1323,7 +1323,7 @@ void Scene::clearPlacard() { event.duration = 0; q_event = _vm->_events->chain(q_event, &event); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { event.type = kEvTOneshot; event.code = kTextEvent; event.op = kEventRemove; @@ -1340,7 +1340,7 @@ void Scene::clearPlacard() { event.duration = 0; q_event = _vm->_events->chain(q_event, &event); - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { // set mode to main event.type = kEvTImmediate; event.code = kInterfaceEvent; @@ -1492,7 +1492,7 @@ void Scene::showPsychicProfile(const char *text) { } void Scene::clearPsychicProfile() { - if (_vm->_interface->getMode() == kPanelPlacard || _vm->getGameId() == GID_IHNM_DEMO) { + if (_vm->_interface->getMode() == kPanelPlacard || _vm->getFeatures() & GF_IHNM_DEMO) { _vm->_render->setFlag(RF_DISABLE_ACTORS); _vm->_scene->clearPlacard(); _vm->_interface->activate(); diff --git a/engines/saga/scene.h b/engines/saga/scene.h index a97b5d203a..43b8779e10 100644 --- a/engines/saga/scene.h +++ b/engines/saga/scene.h @@ -348,7 +348,7 @@ class Scene { void drawTextList(); int getHeight(bool speech = false) const { - if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 8 && !speech) + if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 8 && !speech) return _vm->getDisplayInfo().logicalHeight; else return _vm->getDisplayInfo().sceneHeight; @@ -360,7 +360,7 @@ class Scene { void showIHNMDemoSpecialScreen(); bool isNonInteractiveIHNMDemoPart() { - return _vm->getGameId() == GID_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149); + return _vm->getFeatures() & GF_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149); } private: diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp index 088be34c72..a8391464fe 100644 --- a/engines/saga/script.cpp +++ b/engines/saga/script.cpp @@ -289,7 +289,7 @@ void Script::showVerb(int statusColor) { return; } - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) verbName = _mainStrings.getString(_leftButtonVerb - 1); else verbName = _mainStrings.getString(_leftButtonVerb + 1); @@ -329,7 +329,7 @@ void Script::showVerb(int statusColor) { } int Script::getVerbType(VerbTypes verbType) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { switch (verbType) { case kVerbNone: return kVerbITENone; @@ -456,7 +456,7 @@ void Script::doVerb() { scriptModuleNumber = _vm->_scene->getScriptModuleNumber(); } // IHNM never sets scriptModuleNumber to 0 - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) scriptModuleNumber = _vm->_scene->getScriptModuleNumber(); } else { if (_pendingVerb == getVerbType(kVerbUse)) { @@ -488,7 +488,7 @@ void Script::doVerb() { scriptModuleNumber = 0; } // IHNM never sets scriptModuleNumber to 0 - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) scriptModuleNumber = _vm->_scene->getScriptModuleNumber(); } } @@ -503,7 +503,7 @@ void Script::doVerb() { // choosing "[Cut out Edna's heart]", which works correctly. To disable this action, if the knife is used on Edna, we // change the action here to "use knife with the knife", which yields a better reply ("I'd just dull my knife"). // Fixes bug #1826871 - "IHNM: Edna's got two hearts but loves to be on the hook" - if (_vm->getGameType() == GType_IHNM && _pendingObject[0] == 16385 && _pendingObject[1] == 8197 && _pendingVerb == 4) + if (_vm->getGameId() == GID_IHNM && _pendingObject[0] == 16385 && _pendingObject[1] == 8197 && _pendingVerb == 4) _pendingObject[1] = 16385; // WORKAROUND for a bug in the original game scripts of IHNM. Gorrister's heart is not supposed to have a @@ -511,7 +511,7 @@ void Script::doVerb() { // reply is given to the player ("It's too narrow for me to pass", said when Gorrister tries to pick up the // heart without a rope). Therefore, for object number 16397 (Gorrister's heart), when the active verb is // "Use", set it to "Push", which gives a more appropriate reply ("What good will that do me?") - if (_vm->getGameType() == GType_IHNM && _pendingObject[0] == 16397 && _pendingVerb == 4) + if (_vm->getGameId() == GID_IHNM && _pendingObject[0] == 16397 && _pendingVerb == 4) _pendingVerb = 8; if (scriptEntrypointNumber > 0) { @@ -530,11 +530,11 @@ void Script::doVerb() { } else { // Show excuse text in ITE CD Versions - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { _vm->getExcuseInfo(_pendingVerb, excuseText, excuseSampleResourceId); if (excuseText) { // In Floppy versions we don't have excuse texts - if (!(_vm->getFeatures() & GF_CD_FX)) + if (_vm->getFeatures() & GF_ITE_FLOPPY) excuseSampleResourceId = -1; _vm->_actor->actorSpeech(ID_PROTAG, &excuseText, 1, excuseSampleResourceId, 0); @@ -660,14 +660,14 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { } if (hitZone != NULL) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (hitZone->getFlags() & kHitZoneNoWalk) { _vm->_actor->actorFaceTowardsPoint(ID_PROTAG, pickLocation); doVerb(); return; } } else { - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if ((hitZone->getFlags() & kHitZoneNoWalk) && (_pendingVerb != getVerbType(kVerbWalkTo))) { doVerb(); return; @@ -693,7 +693,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { } } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if ((_pendingVerb == getVerbType(kVerbWalkTo)) || (_pendingVerb == getVerbType(kVerbPickUp)) || (_pendingVerb == getVerbType(kVerbOpen)) || @@ -716,7 +716,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { } } - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if ((_pendingVerb == getVerbType(kVerbWalkTo)) || (_pendingVerb == getVerbType(kVerbPickUp)) || @@ -809,14 +809,14 @@ void Script::whichObject(const Point& mousePoint) { } else { actor = _vm->_actor->getActor(newObjectId); objectId = newObjectId; - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) objectFlags = kObjUseWith; // Note: for IHNM, the default right button action is "Look at" for actors, // but "Talk to" makes much more sense newRightButtonVerb = getVerbType(kVerbTalkTo); // Slight hack because of the above change: the jukebox in Gorrister's chapter // is an actor, so change the right button action to "Look at" - if (_vm->getGameType() == GType_IHNM && objectId == 8199) + if (_vm->getGameId() == GID_IHNM && objectId == 8199) newRightButtonVerb = getVerbType(kVerbLookAt); if ((_currentVerb == getVerbType(kVerbPickUp)) || @@ -824,7 +824,7 @@ void Script::whichObject(const Point& mousePoint) { (_currentVerb == getVerbType(kVerbClose)) || ((_currentVerb == getVerbType(kVerbGive)) && !_firstObjectSet) || ((_currentVerb == getVerbType(kVerbUse)) && !(actor->_flags & kFollower))) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { objectId = ID_NOTHING; newObjectId = ID_NOTHING; } @@ -850,7 +850,7 @@ void Script::whichObject(const Point& mousePoint) { // to the left, which makes him exit the screen when the graffiti is examined. // We effectively change the left side of the hitzone here so that it starts from // pixel 301 onwards. The same workaround is applied in Actor::handleActions - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if (_vm->_scene->currentChapterNumber() == 1 && _vm->_scene->currentSceneNumber() == 22) if (hitZoneIndex == 8 && pickPoint.x <= 300) hitZoneIndex = -1; @@ -868,14 +868,14 @@ void Script::whichObject(const Point& mousePoint) { // hitzone contains (object ID 24578 - "The key") to the ID of the key // object itself (object ID 16402 - "Edna's key"), as the user can keep // hovering the cursor to both items, but can only pick up one - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { if (_vm->_scene->currentChapterNumber() == 1 && _vm->_scene->currentSceneNumber() == 24) { if (objectId == 24578) objectId = 16402; } } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { if (newRightButtonVerb == getVerbType(kVerbWalkOnly)) { if (_firstObjectSet) { diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index 39e3ee022d..7ae40d7cf7 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -243,7 +243,7 @@ static const ScriptFunctionDescription IHNMscriptFunctionsList[IHNM_SCRIPT_FUNCT OPCODE(sfQueueMusic), OPCODE(sfDisableAbortSpeeches) }; - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) _scriptFunctionsList = IHNMscriptFunctionsList; else _scriptFunctionsList = ITEscriptFunctionsList; @@ -282,7 +282,7 @@ void Script::sfTakeObject(SCRIPTFUNC_PARAMS) { // Fixes bugs #2057200 - "IHNM: Invisible inventory objects", // #1861126 - "IHNM: Crash when Gorrister cuts sheet in the mooring ring" // and some incorrect objects in the IHNM demo - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) obj->_spriteListResourceId = obj->_index; _vm->_interface->addToInventory(objectId); @@ -324,7 +324,7 @@ void Script::sfMainMode(SCRIPTFUNC_PARAMS) { // by an incorrect stored mode _vm->_interface->rememberMode(); - if (_vm->getGameType() == GType_ITE) + if (_vm->getGameId() == GID_ITE) setPointerVerb(); // The early Windows and Mac demos of ITE were non-interactive. In those demos, @@ -393,7 +393,7 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) { return; } moduleNumber = 0; - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) moduleNumber = _vm->_scene->getScriptModuleNumber(); break; case kGameObjectActor: @@ -407,7 +407,7 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) { } else { moduleNumber = _vm->_scene->getScriptModuleNumber(); } - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) moduleNumber = _vm->_scene->getScriptModuleNumber(); break; case kGameObjectHitZone: @@ -550,16 +550,16 @@ void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) { int16 sceneNumber = thread->pop(); int16 entrance = thread->pop(); - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { _vm->_gfx->setCursor(kCursorBusy); } - if (_vm->getGameType() == GType_ITE && sceneNumber < 0) { + if (_vm->getGameId() == GID_ITE && sceneNumber < 0) { _vm->quitGame(); return; } - if (_vm->getGameType() == GType_IHNM && sceneNumber == 0) { + if (_vm->getGameId() == GID_IHNM && sceneNumber == 0) { _vm->_scene->creditsScene(); return; } @@ -572,7 +572,7 @@ void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) { } // changeScene calls loadScene which calls setVerb. setVerb resets all pending objects and object flags - if (sceneNumber == -1 && _vm->getGameType() == GType_IHNM) { + if (sceneNumber == -1 && _vm->getGameId() == GID_IHNM) { // Return back to the character selection screen in IHNM _vm->_scene->changeScene(154, entrance, kTransitionFade, 8); } else { @@ -590,7 +590,7 @@ void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) { _currentObject[0] = _currentObject[1] = ID_NOTHING; showVerb(); // calls setStatusText("") - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { // There are some cutaways which are not removed by game scripts, like the cutaway // after the intro of IHNM or the cutaway at the end of Ellen's part in the IHNM demo. // Clear any remaining cutaways here @@ -607,7 +607,7 @@ void Script::sfSetObjImage(SCRIPTFUNC_PARAMS) { uint16 spriteId = thread->pop(); ObjectData *obj = _vm->_actor->getObj(objectId); - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) obj->_spriteListResourceId = spriteId; else obj->_spriteListResourceId = OBJ_SPRITE_BASE + spriteId; @@ -631,7 +631,7 @@ void Script::sfGetObjImage(SCRIPTFUNC_PARAMS) { uint16 objectId = thread->pop(); ObjectData *obj = _vm->_actor->getObj(objectId); - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) thread->_returnValue = obj->_spriteListResourceId; else thread->_returnValue = obj->_spriteListResourceId - OBJ_SPRITE_BASE; @@ -825,11 +825,11 @@ void Script::sfDropObject(SCRIPTFUNC_PARAMS) { // Change the scene number of the compact disk so that it's not shown. It will be shown // once Ellen says that there's something different (i.e. after speaking with AM) // See Actor::actorSpeech for the other part of this hack - if (_vm->getGameType() == GType_IHNM && _vm->_scene->currentChapterNumber() == 3 && + if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 3 && _vm->_scene->currentSceneNumber() == 59 && obj->_id == 16385) obj->_sceneNumber = -1; - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { // Don't update _spriteListResourceId if spriteId is 0 and the object is not the // psychic profile. If spriteId == 0, the object's sprite is incorrectly reset. // This occurs in the IHNM demo and with some incorrect scripts in the retail version @@ -865,13 +865,13 @@ void Script::sfSwapActors(SCRIPTFUNC_PARAMS) { actor1->_flags &= ~kProtagonist; actor2->_flags |= kProtagonist; _vm->_actor->_protagonist = _vm->_actor->_centerActor = actor2; - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) _vm->_scene->setProtag(actorId2); } else if (actor2->_flags & kProtagonist) { actor2->_flags &= ~kProtagonist; actor1->_flags |= kProtagonist; _vm->_actor->_protagonist = _vm->_actor->_centerActor = actor1; - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) _vm->_scene->setProtag(actorId1); } } @@ -897,7 +897,7 @@ void Script::sfSimulSpeech(SCRIPTFUNC_PARAMS) { actorsIds[i] = thread->pop(); if (thread->_voiceLUT->voices) { - if (_vm->getGameType() == GType_IHNM && stringId >= 338) { + if (_vm->getGameId() == GID_IHNM && stringId >= 338) { sampleResourceId = -1; } else { sampleResourceId = thread->_voiceLUT->voices[stringId]; @@ -964,7 +964,7 @@ void Script::sfCycleFrames(SCRIPTFUNC_PARAMS) { actor->_actorFlags |= kActorRandom; } if (flags & kCycleReverse) { - if (_vm->getGameType() == GType_IHNM && + if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 2 && _vm->_scene->currentSceneNumber() == 41) { // WORKAROUND: Prevent Benny from walking backwards after talking to the child via the monitor. This // occurs in the original as well, and is fixed by not setting the kActorBackwards flag at this point @@ -1458,7 +1458,7 @@ void Script::sfEraseDelta(SCRIPTFUNC_PARAMS) { // Script function #63 (0x3F) void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { int16 param = thread->pop() + 9; if (param >= 9 && param <= 34) { @@ -1568,7 +1568,7 @@ void Script::sfPlaySound(SCRIPTFUNC_PARAMS) { if (param >= 0 && param < _vm->_sndRes->_fxTableLen) { res = _vm->_sndRes->_fxTable[param].res; - if (_vm->getFeatures() & GF_CD_FX) + if (_vm->getGameId() == GID_ITE && !(_vm->getFeatures() & GF_ITE_FLOPPY)) res -= 14; _vm->_sndRes->playSound(res, _vm->_sndRes->_fxTable[param].vol, false); } else { @@ -1583,7 +1583,7 @@ void Script::sfPlayLoopedSound(SCRIPTFUNC_PARAMS) { if (param >= 0 && param < _vm->_sndRes->_fxTableLen) { res = _vm->_sndRes->_fxTable[param].res; - if (_vm->getFeatures() & GF_CD_FX) + if (_vm->getGameId() == GID_ITE && !(_vm->getFeatures() & GF_ITE_FLOPPY)) res -= 14; _vm->_sndRes->playSound(res, _vm->_sndRes->_fxTable[param].vol, true); @@ -1647,7 +1647,7 @@ void Script::finishDialog(int strID, int replyID, int flags, int bitOffset) { if (_conversingThread) { _vm->_interface->setMode(kPanelNull); - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { str = _conversingThread->_strings->getString(strID); if (*str != '[') { int sampleResourceId = -1; diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 9742657523..f0812e17ba 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -56,7 +56,7 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) { setVoiceBank(0); - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { _fxTable = ITE_SfxTable; _fxTableLen = ITE_SFXCOUNT; } else { @@ -70,7 +70,7 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) { byte *resourcePointer; size_t resourceLength; - if (_vm->getGameId() == GID_IHNM_DEMO) { + if (_vm->getFeatures() & GF_IHNM_DEMO) { _vm->_resource->loadResource(resourceContext, RID_IHNMDEMO_SFX_LUT, resourcePointer, resourceLength); } else { @@ -97,7 +97,7 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) { } SndRes::~SndRes() { - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { free(_fxTable); free(_fxTableIDs); } @@ -109,7 +109,7 @@ void SndRes::setVoiceBank(int serial) { // If we got the Macintosh version of IHNM, just set the voice bank // so that we know which voices* subfolder to look for later - if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { _voiceSerial = serial; // Set a dummy voice context _voiceContext = new ResourceContext(); @@ -155,7 +155,7 @@ void SndRes::playVoice(uint32 resourceId) { if (!(_vm->_voiceFilesExist)) return; - if (_vm->getGameType() == GType_IHNM && !(_vm->_voicesEnabled)) + if (_vm->getGameId() == GID_IHNM && !(_vm->_voicesEnabled)) return; debug(4, "SndRes::playVoice %i", resourceId); @@ -185,7 +185,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff return false; } - if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { char soundFileName[40]; int dirIndex = resourceId / 64; @@ -221,7 +221,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff soundInfo = _vm->getSfxInfo(); } - if (_vm->getGameType() == GType_IHNM && _vm->isMacResources() && (context->fileType & GAME_VOICEFILE) != 0) { + if (_vm->getGameId() == GID_IHNM && _vm->isMacResources() && (context->fileType & GAME_VOICEFILE) != 0) { // No sound patch data for the voice files in the Mac version of IHNM } else { context->table[resourceId].fillSoundPatch(soundInfo); @@ -247,11 +247,11 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff bool uncompressedSound = false; // If patch data exists for sound resource 4 (used in ITE intro), don't treat this sound as compressed // Patch data for this resource is in file p2_a.iaf or p2_a.voc - if (_vm->getGameType() == GType_ITE && resourceId == 4 && context->table[resourceId].patchData != NULL) + if (_vm->getGameId() == GID_ITE && resourceId == 4 && context->table[resourceId].patchData != NULL) uncompressedSound = true; // FIXME: Currently, the SFX.RES file in IHNM cannot be compressed - if (_vm->getGameType() == GType_IHNM && (context->fileType & GAME_SOUNDFILE)) + if (_vm->getGameId() == GID_IHNM && (context->fileType & GAME_SOUNDFILE)) uncompressedSound = true; if ((_vm->getFeatures() & GF_COMPRESSED_SOUNDS) && !uncompressedSound) { @@ -396,7 +396,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff } - if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) { + if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { delete file; } diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index 3a406ce13b..05a1ba188c 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -58,24 +58,26 @@ Sprite::Sprite(SagaEngine *vm) : _vm(vm) { memoryError("Sprite::Sprite"); } - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameId() == GID_ITE) { loadList(_vm->getResourceDescription()->mainSpritesResourceId, _mainSprites); _arrowSprites = _saveReminderSprites = _inventorySprites = _mainSprites; - } else { - if (_vm->getGameId() == GID_IHNM_DEMO) { + } else if (_vm->getGameId() == GID_IHNM) { + if (_vm->getFeatures() & GF_IHNM_DEMO) { loadList(RID_IHNMDEMO_ARROW_SPRITES, _arrowSprites); loadList(RID_IHNMDEMO_SAVEREMINDER_SPRITES, _saveReminderSprites); } else { loadList(RID_IHNM_ARROW_SPRITES, _arrowSprites); loadList(RID_IHNM_SAVEREMINDER_SPRITES, _saveReminderSprites); } + } else { + error("Sprite: unknown game type"); } } Sprite::~Sprite(void) { debug(8, "Shutting down sprite subsystem..."); _mainSprites.freeMem(); - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { _inventorySprites.freeMem(); _arrowSprites.freeMem(); _saveReminderSprites.freeMem(); @@ -118,7 +120,7 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) { spriteList.spriteCount = newSpriteCount; - bool bigHeader = _vm->getGameType() != GType_ITE || _vm->isMacResources(); + bool bigHeader = _vm->getGameId() == GID_IHNM || _vm->isMacResources(); for (i = oldSpriteCount; i < spriteList.spriteCount; i++) { spriteInfo = &spriteList.infoList[i]; @@ -169,7 +171,7 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) { // assume are perverse. To simplify things, flip them now. Not // at drawing time. - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { byte *src = _decodeBuf + spriteInfo->width * (spriteInfo->height - 1); byte *dst = spriteInfo->decodedBuffer; diff --git a/engines/saga/sthread.cpp b/engines/saga/sthread.cpp index 376e15c372..ab1c771cbc 100644 --- a/engines/saga/sthread.cpp +++ b/engines/saga/sthread.cpp @@ -61,7 +61,7 @@ ScriptThread *Script::createThread(uint16 scriptModuleNumber, uint16 scriptEntry newThread->_strings = &_modules[scriptModuleNumber].strings; - if (_vm->getGameType() == GType_IHNM) + if (_vm->getGameId() == GID_IHNM) newThread->_voiceLUT = &_globalVoiceLUT; else newThread->_voiceLUT = &_modules[scriptModuleNumber].voiceLUT; @@ -123,7 +123,7 @@ void Script::executeThreads(uint msec) { if (thread->_flags & kTFlagFinished) setPointerVerb(); - if (_vm->getGameType() == GType_IHNM) { + if (_vm->getGameId() == GID_IHNM) { thread->_flags &= ~kTFlagFinished; thread->_flags |= kTFlagAborted; ++threadIterator; @@ -190,7 +190,7 @@ void Script::abortAllThreads(void) { } void Script::completeThread(void) { - int limit = (_vm->getGameType() == GType_IHNM) ? 100 : 40; + int limit = (_vm->getGameId() == GID_IHNM) ? 100 : 40; for (int i = 0; i < limit && !_threadList.empty(); i++) executeThreads(0); @@ -343,7 +343,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) { CASEOP(opCcallV) argumentsCount = scriptS.readByte(); functionNumber = scriptS.readUint16LE(); - if (functionNumber >= ((_vm->getGameType() == GType_IHNM) ? + if (functionNumber >= ((_vm->getGameId() == GID_IHNM) ? IHNM_SCRIPT_FUNCTION_MAX : ITE_SCRIPT_FUNCTION_MAX)) { error("Script::runThread() Invalid script function number (%d)", functionNumber); } @@ -653,7 +653,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) { } // now data contains last string index - if (_vm->getGameId() == GID_ITE_DISK_G) { // special ITE dos + if (_vm->getFeatures() & GF_OLD_ITE_DOS) { // special ITE dos if ((_vm->_scene->currentSceneNumber() == ITE_DEFAULT_SCENE) && (iparam1 >= 288) && (iparam1 <= (RID_SCENE1_VOICE_END - RID_SCENE1_VOICE_START + 288))) { sampleResourceId = RID_SCENE1_VOICE_START + iparam1 - 288; @@ -667,7 +667,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) { if (sampleResourceId < 0 || sampleResourceId > 4000) sampleResourceId = -1; - if (_vm->getGameType() == GType_ITE && !sampleResourceId) + if (_vm->getGameId() == GID_ITE && !sampleResourceId) sampleResourceId = -1; _vm->_actor->actorSpeech(actorId, strings, stringsCount, sampleResourceId, speechFlags); |