diff options
Diffstat (limited to 'engines')
146 files changed, 933 insertions, 737 deletions
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp index 8a4e87017a..687a8ef1cf 100644 --- a/engines/agos/input.cpp +++ b/engines/agos/input.cpp @@ -460,7 +460,7 @@ void AGOSEngine_Simon1::handleMouseWheelUp() { _saveLoadEdit = false; listSaveGames(); } - } else { + } else { AGOSEngine::handleMouseWheelUp(); } } @@ -472,11 +472,11 @@ void AGOSEngine_Simon1::handleMouseWheelDown() { _saveLoadRowCurPos += 1; if (_saveLoadRowCurPos >= _numSaveGameRows) _saveLoadRowCurPos = _numSaveGameRows; - + _saveLoadEdit = false; listSaveGames(); } - } else { + } else { AGOSEngine::handleMouseWheelDown(); } } @@ -492,7 +492,7 @@ void AGOSEngine_Elvira2::handleMouseWheelUp() { _saveLoadRowCurPos -= 3; listSaveGames(); - } else { + } else { AGOSEngine::handleMouseWheelUp(); } } @@ -506,7 +506,7 @@ void AGOSEngine_Elvira2::handleMouseWheelDown() { _saveLoadRowCurPos = 1; listSaveGames(); - } else { + } else { AGOSEngine::handleMouseWheelDown(); } } diff --git a/engines/bbvs/bbvs.cpp b/engines/bbvs/bbvs.cpp index d2e13e525c..11e4b6cea7 100644 --- a/engines/bbvs/bbvs.cpp +++ b/engines/bbvs/bbvs.cpp @@ -60,7 +60,7 @@ static const BBPoint kInventorySlotPositions[] = { {135, 93}, {134, 145}, { 96, 224}, {128, 224}, {160, 224}, {192, 224}, {224, 224}, {240, 224}, {256, 224}, { 0, 0} }; - + static const BBRect kVerbRects[6] = { {-32, -2, 19, 27}, {-33, -33, 19, 27}, { 12, -2, 19, 27}, { 13, -33, 19, 27}, {-10, 8, 19, 27}, {-11, -49, 19, 27} @@ -77,7 +77,7 @@ bool WalkArea::contains(const Common::Point &pt) const { BbvsEngine::BbvsEngine(OSystem *syst, const ADGameDescription *gd) : Engine(syst), _gameDescription(gd) { - + _random = new Common::RandomSource("bbvs"); _currActionCommandIndex = -1; _buttheadObject = nullptr; @@ -148,14 +148,14 @@ Common::Error BbvsEngine::run() { _gameModule = new GameModule(); _spriteModule = new SpriteModule(); _sound = new SoundMan(); - + allocSnapshot(); memset(_easterEggInput, 0, sizeof(_easterEggInput)); - + _gameTicks = 0; _playVideoNumber = 0; _bootSaveSlot = -1; - + memset(_inventoryItemStatus, 0, sizeof(_inventoryItemStatus)); memset(_gameVars, 0, sizeof(_gameVars)); memset(_sceneVisited, 0, sizeof(_sceneVisited)); @@ -189,7 +189,7 @@ Common::Error BbvsEngine::run() { _playVideoNumber = 0; } } - + writeContinueSavegame(); freeSnapshot(); @@ -282,20 +282,20 @@ void BbvsEngine::updateGame() { inputTicks = 1; _gameTicks = _system->getMillis(); } - + if (inputTicks > 20) { inputTicks = 20; _gameTicks = _system->getMillis(); } - + if (inputTicks == 0) return; - + if (_mouseX >= 320 || _mouseY >= 240) { _mouseY = -1; _mouseX = -1; } - + bool done; do { @@ -304,14 +304,14 @@ void BbvsEngine::updateGame() { _mouseButtons &= ~kRightButtonClicked; _keyCode = Common::KEYCODE_INVALID; } while (--inputTicks && _playVideoNumber == 0 && _gameTicks > 0 && !done); - + if (!done && _playVideoNumber == 0 && _gameTicks > 0) { DrawList drawList; buildDrawList(drawList); _screen->drawDrawList(drawList, _spriteModule); drawScreen(); } - + _system->delayMillis(10); } @@ -329,7 +329,7 @@ void BbvsEngine::updateBackgroundSounds() { _backgroundSoundsActive[i] = 0; } } -} +} bool BbvsEngine::update(int mouseX, int mouseY, uint mouseButtons, Common::KeyCode keyCode) { @@ -339,7 +339,7 @@ bool BbvsEngine::update(int mouseX, int mouseY, uint mouseButtons, Common::KeyCo _bootSaveSlot = -1; return false; } - + if (_newSceneNum != 0) { _gameTicks = 0; return changeScene(); @@ -413,7 +413,7 @@ bool BbvsEngine::update(int mouseX, int mouseY, uint mouseButtons, Common::KeyCo } updateInventory(mouseButtons & kLeftButtonClicked); break; - + case kGSVerbs: _isSaveAllowed = false; updateVerbs(); @@ -426,7 +426,7 @@ bool BbvsEngine::update(int mouseX, int mouseY, uint mouseButtons, Common::KeyCo } } break; - + case kGSWait: case kGSWaitDialog: _isSaveAllowed = false; @@ -438,14 +438,14 @@ bool BbvsEngine::update(int mouseX, int mouseY, uint mouseButtons, Common::KeyCo else updateCommon(); break; - + case kGSDialog: _isSaveAllowed = true; saveSnapshot(); updateDialog(mouseButtons & kLeftButtonClicked); updateCommon(); break; - + } return true; @@ -503,7 +503,7 @@ void BbvsEngine::buildDrawList(DrawList &drawList) { // Verbs background drawList.add(_gameModule->getGuiSpriteIndex(13), _verbPos.x - _cameraPos.x, _verbPos.y - _cameraPos.y, 500); - // Selected inventory item + // Selected inventory item if (_currInventoryItem >= 0) { drawList.add(_gameModule->getInventoryItemSpriteIndex(2 * _currInventoryItem), _verbPos.x - _cameraPos.x, _verbPos.y - _cameraPos.y + 27, 500); @@ -538,7 +538,7 @@ void BbvsEngine::updateVerbs() { _mouseCursorSpriteIndex = 0; return; } - + for (int i = 0; i < 6; ++i) { const BBRect &verbRect = kVerbRects[i]; const int16 x = _verbPos.x + verbRect.x; @@ -551,7 +551,7 @@ void BbvsEngine::updateVerbs() { break; } } - + switch (_currVerbNum) { case kVerbLook: case kVerbUse: @@ -585,7 +585,7 @@ void BbvsEngine::updateDialog(bool clicked) { _gameState = kGSScene; return; } - + int slotX = (_mousePos.x - _cameraPos.x) / 32; if (slotX >= _dialogSlotCount) { @@ -597,7 +597,7 @@ void BbvsEngine::updateDialog(bool clicked) { _mouseCursorSpriteIndex = _gameModule->getGuiSpriteIndex(5); _activeItemType = kITDialog; - + // Find the selected dialog item index for (int i = 0; i < 50 && slotX >= 0; ++i) { if (_dialogItemStatus[i]) { @@ -605,7 +605,7 @@ void BbvsEngine::updateDialog(bool clicked) { _activeItemIndex = i; } } - + // Select the dialog item action if it was clicked if (clicked) { for (int i = 0; i < _gameModule->getActionsCount(); ++i) { @@ -622,7 +622,7 @@ void BbvsEngine::updateDialog(bool clicked) { } void BbvsEngine::updateInventory(bool clicked) { - + Common::Rect kInvButtonRects[3] = { Common::Rect(97, 13, 97 + 20, 13 + 26), Common::Rect(135, 15, 135 + 46, 15 + 25), @@ -636,10 +636,10 @@ void BbvsEngine::updateInventory(bool clicked) { if (_currVerbNum != kVerbLook && _currVerbNum != kVerbUse && _currVerbNum != kVerbInvItem) _currVerbNum = kVerbUse; - + const int16 mx = _mousePos.x - _cameraPos.x; const int16 my = _mousePos.y - _cameraPos.y; - + // Check inventory exit left/right edge of screen if (mx < 40 || mx > 280) { _mouseCursorSpriteIndex = _gameModule->getGuiSpriteIndex(10); @@ -652,7 +652,7 @@ void BbvsEngine::updateInventory(bool clicked) { return; } - // Check hovered/clicked inventory button + // Check hovered/clicked inventory button _inventoryButtonIndex = -1; if (kInvButtonRects[0].contains(mx, my)) { _inventoryButtonIndex = 0; @@ -677,10 +677,10 @@ void BbvsEngine::updateInventory(bool clicked) { // Find hovered/clicked inventory item int currItem = -1; - + if (_currVerbNum == kVerbInvItem) currItem = _currInventoryItem; - + _activeItemType = kITEmpty; for (int i = 0; i < 50; ++i) { @@ -769,7 +769,7 @@ void BbvsEngine::updateScene(bool clicked) { } } } - + for (int i = 0; i < _gameModule->getBgObjectsCount(); ++i) { BgObject *bgObject = _gameModule->getBgObject(i); if (lastPriority <= bgObject->rect.bottom && bgObject->rect.contains(_mousePos)) { @@ -921,7 +921,7 @@ bool BbvsEngine::performActionCommand(ActionCommand *actionCommand) { return false; case kActionCmdWalkObject: - { + { SceneObject *sceneObject = &_sceneObjects[actionCommand->sceneObjectIndex]; debug(5, "[%s] walks from (%d, %d) to (%d, %d)", sceneObject->sceneObjectDef->name, sceneObject->x >> 16, sceneObject->y >> 16, actionCommand->walkDest.x, actionCommand->walkDest.y); @@ -998,14 +998,14 @@ bool BbvsEngine::performActionCommand(ActionCommand *actionCommand) { bool BbvsEngine::processCurrAction() { bool actionsFinished = false; - + if (_sceneObjectActions.size() == 0) { - + for (uint i = 0; i < _currAction->actionCommands.size(); ++i) { ActionCommand *actionCommand = &_currAction->actionCommands[i]; if (actionCommand->timeStamp != 0) break; - + if (actionCommand->cmd == kActionCmdMoveObject || actionCommand->cmd == kActionCmdAnimObject) { SceneObjectAction *sceneObjectAction = 0; // See if there's already an entry for the SceneObject @@ -1027,14 +1027,14 @@ bool BbvsEngine::processCurrAction() { sceneObjectAction->animationIndex = actionCommand->param; } } - + if (actionCommand->cmd == kActionCmdSetCameraPos) { _currCameraNum = actionCommand->param; _newCameraPos = _gameModule->getCameraInit(actionCommand->param)->cameraPos; } } - + // Delete entries for SceneObjects without anim for (uint i = 0; i < _sceneObjectActions.size();) { if (!_sceneObjects[_sceneObjectActions[i].sceneObjectIndex].anim) @@ -1107,7 +1107,7 @@ void BbvsEngine::updateCommon() { if (doActionCommands) { ActionCommand *actionCommand = &_currAction->actionCommands[_currActionCommandIndex]; - + while (actionCommand->timeStamp == _currActionCommandTimeStamp && _currActionCommandIndex < (int)_currAction->actionCommands.size()) { if (!performActionCommand(actionCommand)) { @@ -1161,7 +1161,7 @@ void BbvsEngine::updateCommon() { } updateWalkObject(sceneObject); } - + if (sceneObject->walkCount > 0 && sceneObject->turnCount == 0) { debug(5, "walk step, xIncr: %d, yIncr: %d", sceneObject->xIncr, sceneObject->yIncr); sceneObject->x += sceneObject->xIncr; @@ -1226,7 +1226,7 @@ void BbvsEngine::updateCommon() { } } } - + if (_cameraPos.x < _newCameraPos.x) ++_cameraPos.x; if (_cameraPos.x > _newCameraPos.x) @@ -1235,7 +1235,7 @@ void BbvsEngine::updateCommon() { ++_cameraPos.y; if (_cameraPos.y > _newCameraPos.y) --_cameraPos.y; - + // Check if Butthead is inside a scene exit if (_newSceneNum == 0 && !_currAction && _buttheadObject) { int16 buttheadX = _buttheadObject->x >> 16; @@ -1314,13 +1314,13 @@ void BbvsEngine::stopSounds() { bool BbvsEngine::runMinigame(int minigameNum) { debug(0, "BbvsEngine::runMinigame() minigameNum: %d", minigameNum); - + bool fromMainGame = _currSceneNum != kMainMenu; - + _sound->unloadSounds(); - + Minigame *minigame = 0; - + switch (minigameNum) { case kMinigameBbLoogie: minigame = new MinigameBbLoogie(this); @@ -1338,9 +1338,9 @@ bool BbvsEngine::runMinigame(int minigameNum) { error("Incorrect minigame number %d", minigameNum); break; } - + bool minigameResult = minigame->run(fromMainGame); - + delete minigame; // Check if the principal was hit with a megaloogie in the loogie minigame @@ -1370,11 +1370,11 @@ void BbvsEngine::checkEasterEgg(char key) { "SKCUS", "NAMTAH" }; - + static const int kEasterEggLengths[] = { 7, 5, 5, 6 }; - + if (_currSceneNum == kCredits) { memcpy(&_easterEggInput[1], &_easterEggInput[0], 6); _easterEggInput[0] = key; diff --git a/engines/bbvs/bbvs.h b/engines/bbvs/bbvs.h index 6a9a13905c..bbd8046a8b 100644 --- a/engines/bbvs/bbvs.h +++ b/engines/bbvs/bbvs.h @@ -149,7 +149,7 @@ struct BBPoint { struct BBRect { int16 x, y, width, height; -}; +}; struct BBPolygon { const BBPoint *points; @@ -229,66 +229,66 @@ public: private: const ADGameDescription *_gameDescription; Graphics::PixelFormat _pixelFormat; -public: +public: Common::RandomSource *_random; - + GameModule *_gameModule; SpriteModule *_spriteModule; SoundMan *_sound; - + Screen *_screen; - + int _bootSaveSlot; - + int _mouseX, _mouseY; uint _mouseButtons; Common::KeyCode _keyCode; - + int _mouseCursorSpriteIndex; int _gameState; int _gameTicks; - + Common::Point _mousePos; Common::Point _verbPos; Common::Point _walkMousePos; - + int _activeItemType; int _activeItemIndex; int _currTalkObjectIndex; - + Common::Point _cameraPos, _newCameraPos; - + int _newSceneNum, _prevSceneNum, _currSceneNum; int _playVideoNumber; - + int _dialogSlotCount; byte _dialogItemStatus[kDialogItemStatusCount]; - + byte _gameVars[kGameVarsCount]; byte _sceneVisited[kSceneVisitedCount]; int _currVerbNum; - + int _currInventoryItem; byte _inventoryItemStatus[kInventoryItemStatusCount]; int _inventoryButtonIndex; - + Action *_currAction; uint32 _currActionCommandTimeStamp; int _currActionCommandIndex; - + Common::Array<Action*> _walkAreaActions; - + SceneObject _sceneObjects[kSceneObjectsCount]; Common::Array<SceneObjectAction> _sceneObjectActions; - + SceneObject *_buttheadObject, *_beavisObject; int _currCameraNum; - + byte _backgroundSoundsActive[kSceneSoundsCount]; Audio::SoundHandle _speechSoundHandle; - + int _walkAreasCount; WalkArea _walkAreas[80]; int _walkInfosCount; @@ -298,40 +298,40 @@ public: Common::Rect _tempWalkableRects1[256]; Common::Rect _tempWalkableRects2[256]; WalkInfo *_walkInfoPtrs[256]; - + WalkArea *_sourceWalkArea, *_destWalkArea; Common::Point _sourceWalkAreaPt, _destWalkAreaPt, _finalWalkPt; int _currWalkDistance; bool _walkReachedDestArea; - + bool _hasSnapshot; byte *_snapshot; Common::SeekableMemoryWriteStream *_snapshotStream; - + char _easterEggInput[7]; - + void updateEvents(); int getRandom(int max); void drawDebugInfo(); void drawScreen(); - + void updateGame(); bool evalCondition(Conditions &conditions); bool evalCameraCondition(Conditions &conditions, int value); int evalDialogCondition(Conditions &conditions); void evalActionResults(ActionResults &results); - + void updateBackgroundSounds(); void loadScene(int sceneNum); void initScene(bool sounds); - bool changeScene(); + bool changeScene(); bool update(int mouseX, int mouseY, uint mouseButtons, Common::KeyCode keyCode); - + void buildDrawList(DrawList &drawList); - + void updateVerbs(); void updateDialog(bool clicked); void updateInventory(bool clicked); @@ -342,7 +342,7 @@ public: void skipCurrAction(); void updateCommon(); - + void updateWalkableRects(); void startWalkObject(SceneObject *sceneObject); void updateWalkObject(SceneObject *sceneObject); @@ -360,20 +360,20 @@ public: void walkFindPath(WalkArea *sourceWalkArea, int infoCount); int calcDistance(const Common::Point &pt1, const Common::Point &pt2); void walkFoundPath(int count); - + void updateSceneObjectsTurnValue(); void updateDialogConditions(); - - void playSpeech(int soundNum); + + void playSpeech(int soundNum); void stopSpeech(); - + void playSound(uint soundNum, bool loop = false); void stopSound(uint soundNum); void stopSounds(); - + bool runMinigame(int minigameNum); void playVideo(int videoNum); - + void runMainMenu(); void checkEasterEgg(char key); @@ -409,13 +409,13 @@ public: bool existsSavegame(int num); static Common::String getSavegameFilename(const Common::String &target, int num); static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header); - + void allocSnapshot(); void freeSnapshot(); void saveSnapshot(); - + void writeContinueSavegame(); - + }; } // End of namespace Bbvs diff --git a/engines/bbvs/detection.cpp b/engines/bbvs/detection.cpp index e7383163f5..3e247aad99 100644 --- a/engines/bbvs/detection.cpp +++ b/engines/bbvs/detection.cpp @@ -133,7 +133,7 @@ SaveStateDescriptor BbvsMetaEngine::querySaveMetaInfos(const char *target, int s Bbvs::BbvsEngine::kReadSaveHeaderError error; error = Bbvs::BbvsEngine::readSaveHeader(in, true, header); delete in; - if (error == Bbvs::BbvsEngine::kRSHENoError) { + if (error == Bbvs::BbvsEngine::kRSHENoError) { SaveStateDescriptor desc(slot, header.description); // Slot 0 is used for the "Continue" save desc.setDeletableFlag(slot != 0); diff --git a/engines/bbvs/dialogs.cpp b/engines/bbvs/dialogs.cpp index 5247a58ec8..af95f06c1e 100644 --- a/engines/bbvs/dialogs.cpp +++ b/engines/bbvs/dialogs.cpp @@ -34,7 +34,7 @@ struct MenuButton { static const MenuButton kMenuButtons[] = { // Main menu - {"New Game", kCmdNewGame}, + {"New Game", kCmdNewGame}, {"Continue", kCmdContinue}, {"Options", kCmdOptions}, {"Mini Games", kCmdMiniGames}, @@ -61,7 +61,7 @@ MainMenu::~MainMenu() { } void MainMenu::init() { - _buttons[0] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); + _buttons[0] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); _buttons[1] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); _buttons[2] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); _buttons[3] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); @@ -76,14 +76,14 @@ void MainMenu::reflowLayout() { const int buttonWidth = screenW * 70 / 320; const int buttonHeight = screenH * 14 / 240; const int buttonPadding = screenW * 3 / 320; - + _w = 2 * buttonWidth + buttonPadding; _h = 3 * buttonHeight + 3 * buttonPadding; _x = (screenW - _w) / 2; _y = screenH - _h; int x = 0, y = 0; - + x = 0; y = 0; _buttons[0]->resize(x, y, buttonWidth, buttonHeight); diff --git a/engines/bbvs/dialogs.h b/engines/bbvs/dialogs.h index 2dce2a110b..7db0b182b7 100644 --- a/engines/bbvs/dialogs.h +++ b/engines/bbvs/dialogs.h @@ -67,13 +67,13 @@ protected: BbvsEngine *_vm; void init(); - + GUI::ButtonWidget *_buttons[5]; - + void gotoMenuScreen(int index); bool canContinue(); void gotoScene(int sceneNum); - + }; } diff --git a/engines/bbvs/gamemodule.cpp b/engines/bbvs/gamemodule.cpp index d6343084ab..80f0e81450 100644 --- a/engines/bbvs/gamemodule.cpp +++ b/engines/bbvs/gamemodule.cpp @@ -39,11 +39,11 @@ GameModule::~GameModule() { void GameModule::load(const char *filename) { debug(0, "GameModule::load()"); - + unload(); Common::File fd; - + if (!fd.open(filename)) error("GameModule::load() Could not open %s", filename); @@ -68,7 +68,7 @@ void GameModule::load(const char *filename) { fd.seek(0x1A8); _buttheadObjectIndex = fd.readUint32LE(); - + fd.close(); debug(0, "GameModule::load() OK"); @@ -177,7 +177,7 @@ int GameModule::getBgSpritePriority(int index) { int GameModule::getSceneSoundsCount() { return _sceneSoundsCount; } - + SceneSound *GameModule::getSceneSound(int index) { assert(index < _sceneSoundsCount); return &_sceneSounds[index]; @@ -257,7 +257,7 @@ void GameModule::unload() { void GameModule::loadBgSprites(Common::SeekableReadStream &s) { debug(0, "GameModule::loadBgSprites()"); - + s.seek(0x14); _bgSpriteCount = s.readUint32LE(); uint32 bgSpriteIndicesOffs = s.readUint32LE(); @@ -275,7 +275,7 @@ void GameModule::loadBgSprites(Common::SeekableReadStream &s) { void GameModule::loadCameraInits(Common::SeekableReadStream &s) { debug(0, "GameModule::loadCameraInits()"); - + s.seek(0x20); for (int i = 0; i < kCameraInitsCount; ++i) { CameraInit &cameraInit = _cameraInits[i]; @@ -283,13 +283,13 @@ void GameModule::loadCameraInits(Common::SeekableReadStream &s) { for (int j = 0; j < 8; ++j) cameraInit.cameraLinks[j] = s.readByte(); for (int j = 0; j < 8; ++j) - cameraInit.rects[j] = readRect(s); + cameraInit.rects[j] = readRect(s); } } void GameModule::loadWalkRects(Common::SeekableReadStream &s) { debug(0, "GameModule::loadWalkRects()"); - + s.seek(0x150); _walkRectsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); @@ -301,7 +301,7 @@ void GameModule::loadWalkRects(Common::SeekableReadStream &s) { void GameModule::loadSceneExits(Common::SeekableReadStream &s) { debug(0, "GameModule::loadSceneExits()"); - + s.seek(0x158); _sceneExitsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); @@ -329,13 +329,13 @@ void GameModule::loadBgObjects(Common::SeekableReadStream &s) { void GameModule::loadAnimations(Common::SeekableReadStream &s) { debug(0, "GameModule::loadAnimations()"); - + s.seek(0x168); _animationsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); _animations = new Animation[_animationsCount]; for (int i = 0; i < _animationsCount; ++i) { - Animation &anim = _animations[i]; + Animation &anim = _animations[i]; s.seek(offs + i * 20); anim.frameCount = s.readUint32LE(); uint32 frameSpriteIndicesOffs = s.readUint32LE(); @@ -363,7 +363,7 @@ void GameModule::loadAnimations(Common::SeekableReadStream &s) { void GameModule::loadSceneObjectDefs(Common::SeekableReadStream &s) { debug(0, "GameModule::loadSceneObjectDefs()"); - + s.seek(0x170); _sceneObjectDefsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); @@ -379,7 +379,7 @@ void GameModule::loadSceneObjectDefs(Common::SeekableReadStream &s) { void GameModule::loadSceneObjectInits(Common::SeekableReadStream &s) { debug(0, "GameModule::loadSceneObjectInits()"); - + s.seek(0x178); _sceneObjectInitsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); @@ -396,7 +396,7 @@ void GameModule::loadSceneObjectInits(Common::SeekableReadStream &s) { void GameModule::loadActions(Common::SeekableReadStream &s) { debug(0, "GameModule::loadActions()"); - + s.seek(0x180); _actionsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); @@ -427,7 +427,7 @@ void GameModule::loadActions(Common::SeekableReadStream &s) { void GameModule::loadGuiSpriteIndices(Common::SeekableReadStream &s) { debug(0, "GameModule::loadGuiSpriteIndices()"); - + s.seek(0x188); uint32 offs = s.readUint32LE(); s.seek(offs); @@ -437,7 +437,7 @@ void GameModule::loadGuiSpriteIndices(Common::SeekableReadStream &s) { void GameModule::loadInventoryItemSpriteIndices(Common::SeekableReadStream &s) { debug(0, "GameModule::loadInventoryItemSpriteIndices()"); - + s.seek(0x18C); uint32 offs = s.readUint32LE(); s.seek(offs); @@ -447,7 +447,7 @@ void GameModule::loadInventoryItemSpriteIndices(Common::SeekableReadStream &s) { void GameModule::loadInventoryItemInfos(Common::SeekableReadStream &s) { debug(0, "GameModule::loadInventoryItemInfos()"); - + s.seek(0x190); uint32 offs = s.readUint32LE(); s.seek(offs); @@ -462,7 +462,7 @@ void GameModule::loadInventoryItemInfos(Common::SeekableReadStream &s) { void GameModule::loadDialogItemSpriteIndices(Common::SeekableReadStream &s) { debug(0, "GameModule::loadDialogItemSpriteIndices()"); - + s.seek(0x194); uint32 offs = s.readUint32LE(); s.seek(offs); @@ -473,7 +473,7 @@ void GameModule::loadDialogItemSpriteIndices(Common::SeekableReadStream &s) { void GameModule::loadSceneSounds(Common::SeekableReadStream &s) { debug(0, "GameModule::loadSceneSounds()"); - + s.seek(0x1A0); _sceneSoundsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); @@ -487,7 +487,7 @@ void GameModule::loadSceneSounds(Common::SeekableReadStream &s) { void GameModule::loadPreloadSounds(Common::SeekableReadStream &s) { debug(0, "GameModule::loadPreloadSounds()"); - + s.seek(0x198); _preloadSoundsCount = s.readUint32LE(); uint32 offs = s.readUint32LE(); diff --git a/engines/bbvs/gamemodule.h b/engines/bbvs/gamemodule.h index 4d4f5b90a1..b31b95dcee 100644 --- a/engines/bbvs/gamemodule.h +++ b/engines/bbvs/gamemodule.h @@ -134,29 +134,29 @@ class GameModule { public: GameModule(); ~GameModule(); - + void load(const char *filename); - + int getFieldC(); int getButtheadObjectIndex(); - + int getGuiSpriteIndex(int index); int getInventoryItemSpriteIndex(int index); int getDialogItemSpriteIndex(int index); - + int getActionsCount(); Action *getAction(int index); - + InventoryItemInfo *getInventoryItemInfo(int index); CameraInit *getCameraInit(int cameraNum); - + int getSceneExitsCount(); SceneExit *getSceneExit(int index); - + int getWalkRectsCount(); Common::Rect *getWalkRects(); - + int getSceneObjectDefsCount(); SceneObjectDef *getSceneObjectDef(int index); @@ -170,44 +170,44 @@ public: int getBgSpriteIndex(int index); int getBgSpritePriority(int index); - int getSceneSoundsCount(); + int getSceneSoundsCount(); SceneSound *getSceneSound(int index); - uint getSceneSoundIndex(uint soundNum); - + uint getSceneSoundIndex(uint soundNum); + uint getPreloadSoundsCount(); uint getPreloadSound(uint index); Animation *getAnimation(int index); - + protected: - + int _bgSpriteCount; int *_bgSpriteIndices; int16 *_bgSpritePriorities; - + CameraInit _cameraInits[kCameraInitsCount]; - + int _walkRectsCount; Common::Rect *_walkRects; - + int _sceneExitsCount; SceneExit *_sceneExits; - + int _bgObjectsCount; BgObject *_bgObjects; - + int _animationsCount; Animation *_animations; - + int _sceneObjectDefsCount; SceneObjectDef *_sceneObjectDefs; - + int _sceneObjectInitsCount; SceneObjectInit *_sceneObjectInits; int _actionsCount; Action *_actions; - + int _sceneSoundsCount; SceneSound *_sceneSounds; @@ -218,16 +218,16 @@ protected: int _inventoryItemSpriteIndices[kInventoryItemSpriteCount]; InventoryItemInfo _inventoryItemInfos[kInventoryItemCount]; int _dialogItemSpriteIndices[kDialogItemSpriteCount]; - + int _fieldC; int _buttheadObjectIndex; Common::Point readPoint(Common::SeekableReadStream &s); Common::Rect readRect(Common::SeekableReadStream &s); Conditions readConditions(Common::SeekableReadStream &s); - + void unload(); - + void loadBgSprites(Common::SeekableReadStream &s); void loadCameraInits(Common::SeekableReadStream &s); void loadWalkRects(Common::SeekableReadStream &s); @@ -243,7 +243,7 @@ protected: void loadDialogItemSpriteIndices(Common::SeekableReadStream &s); void loadSceneSounds(Common::SeekableReadStream &s); void loadPreloadSounds(Common::SeekableReadStream &s); - + }; } // End of namespace Bbvs diff --git a/engines/bbvs/graphics.cpp b/engines/bbvs/graphics.cpp index 810d910abf..43840607c8 100644 --- a/engines/bbvs/graphics.cpp +++ b/engines/bbvs/graphics.cpp @@ -104,9 +104,9 @@ void Screen::drawSprite(Sprite &sprite, int x, int y) { } if (destX + width >= _surface->w) width = _surface->w - destX; - + debug(0, "drawSprite() (%d, %d, %d, %d); skipX: %d; skipY: %d; %d", destX, destY, width, height, skipX, skipY, sprite.type); - + if (sprite.type == 1) { for (int yc = 0; yc < height; ++yc) { byte *source = sprite.getRow(skipY + yc); diff --git a/engines/bbvs/minigames/bbairguitar.cpp b/engines/bbvs/minigames/bbairguitar.cpp index f2e42313e3..1984dbb0fd 100644 --- a/engines/bbvs/minigames/bbairguitar.cpp +++ b/engines/bbvs/minigames/bbairguitar.cpp @@ -198,12 +198,12 @@ void MinigameBbAirGuitar::buildDrawList1(DrawList &drawList) { if (_trackBarX > kTrackBarMaxX) _trackBarX = kTrackBarMaxX; - + _trackBarThumbRect.top = 208; _trackBarThumbRect.bottom = 218; _trackBarThumbRect.left = _trackBarX; _trackBarThumbRect.right = _trackBarX + 6; - + drawList.add(_objects[5].anim->frameIndices[0], _trackBarX, 208, 100); if (_playerMode != 0) { @@ -228,7 +228,7 @@ void MinigameBbAirGuitar::buildDrawList1(DrawList &drawList) { drawList.add(_objects[i].anim->frameIndices[frameIndex], kPointsTbl2[i - 47].x, kPointsTbl2[i - 47].y, 254); } } - + if (_backgroundSpriteIndex > 0) drawList.add(_backgroundSpriteIndex, 0, 0, 0); @@ -394,7 +394,7 @@ void MinigameBbAirGuitar::initObjects1() { _track[0].noteNum = -1; stop(); changePatch(0); - + } bool MinigameBbAirGuitar::updateStatus(int mouseX, int mouseY, uint mouseButtons) { @@ -408,7 +408,7 @@ bool MinigameBbAirGuitar::updateStatus(int mouseX, int mouseY, uint mouseButtons } bool MinigameBbAirGuitar::updateStatus0(int mouseX, int mouseY, uint mouseButtons) { - + if (mouseButtons & kAnyButtonDown) { stopSound(1); _rockTunePlaying = false; @@ -436,14 +436,14 @@ bool MinigameBbAirGuitar::updateStatus0(int mouseX, int mouseY, uint mouseButton } } - + return true; } bool MinigameBbAirGuitar::updateStatus1(int mouseX, int mouseY, uint mouseButtons) { - + int currTicks = _vm->_system->getMillis(); - + if (_playerMode == 1 && _track[_trackIndex].ticks <= currTicks - _noteStartTime) { noteOff(_track[_trackIndex].noteNum); if (_trackIndex < _trackCount && _track[++_trackIndex].noteNum != -1) @@ -481,17 +481,17 @@ bool MinigameBbAirGuitar::updateStatus1(int mouseX, int mouseY, uint mouseButton } else { ++_vuMeterRight2; } - + if (_resetAnims && _vm->_system->getMillis() - _noteStartTime >= 1000) resetObjs(); - + _objects[0].x = mouseX; _objects[0].y = mouseY; - + _trackBarMouseX = CLIP(mouseX, kTrackBarMinX, kTrackBarMaxX); - + bool checkClick = false; - + if (mouseButtons & kAnyButtonClicked) { checkClick = true; } else if (!(mouseButtons & kAnyButtonDown)) { @@ -506,14 +506,14 @@ bool MinigameBbAirGuitar::updateStatus1(int mouseX, int mouseY, uint mouseButton } } else if (!_movingTrackBar) checkClick = true; - + if (checkClick) { afterButtonReleased(); _objects[0].frameIndex = 1; - + if (ptInRect(&kRect2, mouseX, mouseY)) { - + if (_playerMode != 1 && ptInRect(&kPianoRect, mouseX, mouseY)) { for (int i = 0; i <= 12; ++i) { if (ptInPoly(&kPianoKeyAreas[i], mouseX, mouseY)) { @@ -538,7 +538,7 @@ bool MinigameBbAirGuitar::updateStatus1(int mouseX, int mouseY, uint mouseButton break; } } - + if (playerButtonNum >= 0) { _currButtonNum = playerButtonNum; _currPlayerButtonRect = &kPlayerButtonRects[playerButtonNum]; @@ -673,12 +673,12 @@ bool MinigameBbAirGuitar::updateStatus1(int mouseX, int mouseY, uint mouseButton } } } - + if (_buttonClickTicks + 1000 < currTicks) _buttonClickTicks = currTicks; - + int newKind = _buttonClickTicks + 500 < currTicks ? 1 : 0; - + switch (_playerMode) { case 1: @@ -770,20 +770,20 @@ bool MinigameBbAirGuitar::run(bool fromMainGame) { _gameResult = false; _gameDone = false; initObjects(); - + _spriteModule = new SpriteModule(); _spriteModule->load("bbairg/bbairg.000"); Palette palette = _spriteModule->getPalette(); _vm->_screen->setPalette(palette); - + loadSounds(); - + while (!_vm->shouldQuit() &&!_gameDone) { _vm->updateEvents(); update(); } - + _vm->_sound->unloadSounds(); delete _spriteModule; @@ -803,15 +803,15 @@ void MinigameBbAirGuitar::update() { inputTicks = 1; _gameTicks = _vm->_system->getMillis(); } - + if (_vm->_keyCode == Common::KEYCODE_ESCAPE) { _gameDone = true; return; } - + if (inputTicks == 0) return; - + bool done; do { @@ -820,9 +820,9 @@ void MinigameBbAirGuitar::update() { _vm->_mouseButtons &= ~kRightButtonClicked; _vm->_keyCode = Common::KEYCODE_INVALID; } while (--inputTicks && _gameTicks > 0 && !done); - + drawSprites(); - + _vm->_system->delayMillis(10); } @@ -1001,7 +1001,7 @@ void MinigameBbAirGuitar::calcTotalTicks1() { } void MinigameBbAirGuitar::noteOn(int noteNum) { - + if (_currNoteNum != -2) { if (noteNum == _currNoteNum) return; @@ -1087,7 +1087,7 @@ void MinigameBbAirGuitar::noteOn(int noteNum) { } void MinigameBbAirGuitar::noteOff(int noteNum) { - + if (_currNoteNum != noteNum) return; diff --git a/engines/bbvs/minigames/bbairguitar.h b/engines/bbvs/minigames/bbairguitar.h index d4fd6ec30c..40b8a50a03 100644 --- a/engines/bbvs/minigames/bbairguitar.h +++ b/engines/bbvs/minigames/bbairguitar.h @@ -32,7 +32,7 @@ public: MinigameBbAirGuitar(BbvsEngine *vm) : Minigame(vm) {}; bool run(bool fromMainGame); public: - + struct Obj { int kind; int x, y; @@ -44,24 +44,24 @@ public: int16 frameIndexAdd; int16 unk2; }; - + enum { kMaxObjectsCount = 256, kMaxTracks = 2049 }; - + struct PianoKeyInfo { int x, y; int frameIndex; }; - + struct TrackEvt { int8 noteNum; int16 ticks; }; - + Obj _objects[kMaxObjectsCount]; - + int _playerMode; bool _modified; @@ -82,24 +82,24 @@ public: int *_currFrameIndex; int _btn3KindToggle; - + const BBPolygon *_currPianoKeyArea; const Rect *_currPlayerButtonRect; - + bool _movingTrackBar; int _trackBarMouseX; int _trackBarX; Rect _trackBarThumbRect; - + int _currTrackPos, _totalTrackLength; int _ticksDelta; - + int _actionStartTrackPos, _actionTrackPos; int _actionStartTime; int _currNoteNum; int _currPatchNum; - + const ObjAnimation *getAnimation(int animIndex); bool ptInRect(const Rect *r, int x, int y); bool ptInPoly(const BBPolygon *poly, int x, int y); @@ -109,14 +109,14 @@ public: void buildDrawList1(DrawList &drawList); void drawSprites(); - + void initObjs(); Obj *getFreeObject(); - + void initObjects(); void initObjects0(); void initObjects1(); - + bool updateStatus(int mouseX, int mouseY, uint mouseButtons); bool updateStatus0(int mouseX, int mouseY, uint mouseButtons); bool updateStatus1(int mouseX, int mouseY, uint mouseButtons); @@ -124,7 +124,7 @@ public: void updateObjs(); void update(); - + void play(); void record(); void setPlayerMode3(); @@ -136,9 +136,9 @@ public: void noteOn(int noteNum); void noteOff(int noteNum); void resetObjs(); - + void loadSounds(); - void playNote(int noteNum); + void playNote(int noteNum); void stopNote(int noteNum); }; diff --git a/engines/bbvs/minigames/bbant.cpp b/engines/bbvs/minigames/bbant.cpp index 9786682ada..3678934345 100644 --- a/engines/bbvs/minigames/bbant.cpp +++ b/engines/bbvs/minigames/bbant.cpp @@ -94,7 +94,7 @@ void MinigameBbAnt::buildDrawList1(DrawList &drawList) { drawNumber(drawList, _score, 68, 16); drawList.add(getAnimation(166)->frameIndices[0], 230, 2, 2000); drawNumber(drawList, _levelTimeLeft, 280, 16); - + for (int i = 0; i < _stompCount; ++i) drawList.add(getAnimation(130)->frameIndices[0], 20 + i * 30, 230, 2000); @@ -116,7 +116,7 @@ void MinigameBbAnt::buildDrawList3(DrawList &drawList) { drawNumber(drawList, _hiScore, 208, 107); } -void MinigameBbAnt::drawMagnifyingGlass(DrawList &drawList) { +void MinigameBbAnt::drawMagnifyingGlass(DrawList &drawList) { scale2x(_objects[0].x - 28, _objects[0].y - 27); drawList.clear(); drawList.add(_objects[0].anim->frameIndices[0], _objects[0].x, _objects[0].y, _objects[0].priority); @@ -358,7 +358,7 @@ bool MinigameBbAnt::updateStatus0(int mouseX, int mouseY, uint mouseButtons) { _objects[0].x = 0; if (_objects[0].y < 0) _objects[0].y = 0; - + if ((mouseButtons & kLeftButtonDown) || (mouseButtons & kRightButtonDown)) { _gameState = 1; initObjects(); @@ -447,7 +447,7 @@ bool MinigameBbAnt::updateStatus1(int mouseX, int mouseY, uint mouseButtons) { int maxKindCount = 0, objKind = 0; _stompCounter2 = _stompCounter1; - + for (int i = 0; i < 4; ++i) testTbl[i] = _vm->getRandom(_bugsChanceByKind[i] - _bugsCountByKind[i]); @@ -471,7 +471,7 @@ bool MinigameBbAnt::updateStatus1(int mouseX, int mouseY, uint mouseButtons) { if (_stompCounter1 > 20) --_stompCounter1; } - + return true; } @@ -701,7 +701,7 @@ void MinigameBbAnt::updateBugObjAnim(int objIndex) { void MinigameBbAnt::updateObjAnim2(int objIndex) { Obj *obj = &_objects[objIndex]; - + obj->animIndexIncr += _vm->getRandom(3) - 1; if (obj->animIndexIncr < 0) obj->animIndexIncr = 7; @@ -736,7 +736,7 @@ bool MinigameBbAnt::isBugOutOfScreen(int objIndex) { void MinigameBbAnt::updateObjAnim3(int objIndex) { Obj *obj = &_objects[objIndex]; - + obj->animIndexIncr += _vm->getRandom(3) - 1; if (obj->animIndexIncr < 0) obj->animIndexIncr = 7; @@ -752,7 +752,7 @@ void MinigameBbAnt::updateBugObj1(int objIndex) { Obj *obj = &_objects[objIndex]; bool flag1 = false; bool flag2 = false; - + if (--obj->ticks == 0) { ++obj->frameIndex; if (obj->anim->frameCount == obj->frameIndex) { @@ -911,7 +911,7 @@ void MinigameBbAnt::updateStompObj(int objIndex) { void MinigameBbAnt::updateSmokeObj(int objIndex) { Obj *obj = &_objects[objIndex]; - + obj->x += obj->xIncr; obj->y += obj->yIncr; @@ -1047,7 +1047,7 @@ bool MinigameBbAnt::isMagGlassAtBug(int objIndex) { Obj *obj = &_objects[objIndex]; Obj *obj0 = &_objects[0]; bool result = false; - + if (obj->kind >= 1 && obj->kind <= 5) { const BBRect &frameRect1 = obj0->anim->frameRects[0]; const int obj1X1 = obj0->x + frameRect1.x; @@ -1102,7 +1102,7 @@ bool MinigameBbAnt::testObj5(int objIndex) { } void MinigameBbAnt::updateObjs(uint mouseButtons) { - + for (int i = 12; i < kMaxObjectsCount; ++i) { Obj *obj = &_objects[i]; @@ -1162,7 +1162,7 @@ void MinigameBbAnt::updateObjs(uint mouseButtons) { } } - + } } @@ -1170,9 +1170,9 @@ void MinigameBbAnt::updateObjs(uint mouseButtons) { bool MinigameBbAnt::run(bool fromMainGame) { memset(_objects, 0, sizeof(_objects)); - + _numbersAnim = getAnimation(167); - + _backgroundSpriteIndex = 303; _titleScreenSpriteIndex = 304; @@ -1187,23 +1187,23 @@ bool MinigameBbAnt::run(bool fromMainGame) { _gameDone = false; initObjects(); initVars(); - + _spriteModule = new SpriteModule(); _spriteModule->load("bbant/bbant.000"); Palette palette = _spriteModule->getPalette(); _vm->_screen->setPalette(palette); - + loadSounds(); _gameTicks = 0; playSound(12, true); - + while (!_vm->shouldQuit() &&!_gameDone) { _vm->updateEvents(); update(); } - + _vm->_sound->unloadSounds(); if (!_fromMainGame) @@ -1243,19 +1243,19 @@ void MinigameBbAnt::update() { _vm->_mouseButtons &= ~kRightButtonClicked; _vm->_keyCode = Common::KEYCODE_INVALID; } while (--inputTicks && _gameTicks > 0 && !done); - + drawSprites(); - + _vm->_system->delayMillis(10); } void MinigameBbAnt::scale2x(int x, int y) { - Graphics::Surface *surface = _vm->_screen->_surface; - + Graphics::Surface *surface = _vm->_screen->_surface; + int srcX = x + 14, srcY = y + 14; int srcW = kScaleDim, srcH = kScaleDim; - + if (srcX < 0) { srcW += srcX; srcX = 0; @@ -1265,21 +1265,21 @@ void MinigameBbAnt::scale2x(int x, int y) { srcH += srcY; srcY = 0; } - + if (srcX + srcW >= 320) srcW = 320 - srcX - 1; - + if (srcY + srcH >= 240) srcH = 240 - srcY - 1; - + for (int yc = 0; yc < srcH; ++yc) { byte *src = (byte*)surface->getBasePtr(srcX, srcY + yc); memcpy(&_scaleBuf[yc * kScaleDim], src, srcW); } - + int dstX = x, dstY = y; int dstW = 2 * kScaleDim, dstH = 2 * kScaleDim; - + if (dstX < 0) { dstW += dstX; dstX = 0; @@ -1289,15 +1289,15 @@ void MinigameBbAnt::scale2x(int x, int y) { dstH += dstY; dstY = 0; } - + if (dstX + dstW >= 320) dstW = 320 - dstX - 1; - + if (dstY + dstH >= 240) dstH = 240 - dstY - 1; - + int w = MIN(srcW * 2, dstW), h = MIN(srcH * 2, dstH); - + for (int yc = 0; yc < h; ++yc) { byte *src = _scaleBuf + kScaleDim * (yc / 2); byte *dst = (byte*)surface->getBasePtr(dstX, dstY + yc); diff --git a/engines/bbvs/minigames/bbant.h b/engines/bbvs/minigames/bbant.h index be2afe688d..88b4af9c71 100644 --- a/engines/bbvs/minigames/bbant.h +++ b/engines/bbvs/minigames/bbant.h @@ -32,7 +32,7 @@ public: MinigameBbAnt(BbvsEngine *vm) : Minigame(vm) {}; bool run(bool fromMainGame); public: - + struct Obj { int kind; int x, y, priority; @@ -55,21 +55,21 @@ public: int status2; int flag; }; - + enum { kMaxObjectsCount = 256, kScaleDim = 28 }; - + struct ObjInit { const ObjAnimation *anim1; const ObjAnimation *anim2; const ObjAnimation *anim3; int x, y; }; - + Obj _objects[kMaxObjectsCount]; - + int _score, _hiScore; int _totalBugsCount; @@ -96,37 +96,37 @@ public: int _countdown6; int _countdown5; int _countdown7; - + byte _scaleBuf[kScaleDim * kScaleDim]; const ObjAnimation *getAnimation(int animIndex); const ObjInit *getObjInit(int index); const ObjAnimation * const *getObjKindAnimTable(int kind); const ObjAnimation *getObjAnim(int index); - + void buildDrawList0(DrawList &drawList); void buildDrawList1(DrawList &drawList); void buildDrawList2(DrawList &drawList); void buildDrawList3(DrawList &drawList); void drawMagnifyingGlass(DrawList &drawList); - + void drawSprites(); void drawSprites0(); void drawSprites1(); void drawSprites2(); void drawSprites3(); - + Obj *getFreeObject(); - + void initObjects(); void initObjects0(); void initObjects1(); - + void initVars(); void initVars1(); void initVars2(); void initVars3(); - + bool updateStatus(int mouseX, int mouseY, uint mouseButtons); bool updateStatus0(int mouseX, int mouseY, uint mouseButtons); bool updateStatus1(int mouseX, int mouseY, uint mouseButtons); @@ -161,7 +161,7 @@ public: void updateObjs(uint mouseButtons); void update(); - + void scale2x(int x, int y); void loadSounds(); diff --git a/engines/bbvs/minigames/bbloogie.cpp b/engines/bbvs/minigames/bbloogie.cpp index 4601e9ff93..68a3147f9a 100644 --- a/engines/bbvs/minigames/bbloogie.cpp +++ b/engines/bbvs/minigames/bbloogie.cpp @@ -117,7 +117,7 @@ void MinigameBbLoogie::buildDrawList0(DrawList &drawList) { } void MinigameBbLoogie::buildDrawList1(DrawList &drawList) { - + for (int i = 0; i < kMaxObjectsCount; ++i) { Obj *obj = &_objects[i]; switch (obj->kind) { @@ -163,7 +163,7 @@ void MinigameBbLoogie::buildDrawList1(DrawList &drawList) { } void MinigameBbLoogie::buildDrawList2(DrawList &drawList) { - + buildDrawList1(drawList); if (_level > 0 && (_bonusDisplayDelay1 > 0 || _bonusDisplayDelay2 > 0)) { @@ -180,7 +180,7 @@ void MinigameBbLoogie::buildDrawList2(DrawList &drawList) { } void MinigameBbLoogie::buildDrawList3(DrawList &drawList) { - + for (int i = 0; i < kMaxObjectsCount; ++i) { Obj *obj = &_objects[i]; if (obj->kind == 2) @@ -191,7 +191,7 @@ void MinigameBbLoogie::buildDrawList3(DrawList &drawList) { if (_backgroundSpriteIndex) drawList.add(_backgroundSpriteIndex, 0, 0, 0); - + drawList.add(getAnimation(10)->frameIndices[0], 230, 2, 2000); drawNumber(drawList, _levelTimeLeft, 280, 16); @@ -201,7 +201,7 @@ void MinigameBbLoogie::buildDrawList3(DrawList &drawList) { int numberX2 = drawNumber(drawList, _currScore, 68, 16); drawList.add(getAnimation(9)->frameIndices[10], numberX2, 16, 2000); drawNumber(drawList, _dispLevelScore, numberX2 + 10, 16); - + drawList.add(getAnimation(20)->frameIndices[0], 120, 70, 2000); drawList.add(getAnimation(13)->frameIndices[0], 95, 95, 2000); @@ -416,7 +416,7 @@ bool MinigameBbLoogie::updateStatus(int mouseX, int mouseY, uint mouseButtons) { } bool MinigameBbLoogie::updateStatus0(int mouseX, int mouseY, uint mouseButtons) { - + _objects[0].x = mouseX; _objects[0].y = mouseY; @@ -445,7 +445,7 @@ bool MinigameBbLoogie::updateStatus0(int mouseX, int mouseY, uint mouseButtons) _objects[4].kind = 0; _objects[2].kind = 1; } - + for (int i = 0; i < kMaxObjectsCount; ++i) { Obj *obj = &_objects[i]; if (obj->kind == 11) { @@ -487,12 +487,12 @@ bool MinigameBbLoogie::updateStatus0(int mouseX, int mouseY, uint mouseButtons) initVars(); _gameTicks = 0; } - + return true; } bool MinigameBbLoogie::updateStatus1(int mouseX, int mouseY, uint mouseButtons) { - + if (--_levelTimeDelay == 0) { _levelTimeDelay = 58; --_levelTimeLeft; @@ -568,9 +568,9 @@ bool MinigameBbLoogie::updateStatus2(int mouseX, int mouseY, uint mouseButtons) } bool MinigameBbLoogie::updateStatus3(int mouseX, int mouseY, uint mouseButtons) { - + _objects[0].x = mouseX; - + for (int i = 0; i < kMaxObjectsCount; ++i) { Obj *obj = &_objects[i]; if (obj->kind == 2) { @@ -582,7 +582,7 @@ bool MinigameBbLoogie::updateStatus3(int mouseX, int mouseY, uint mouseButtons) } } } - + return true; } @@ -620,7 +620,7 @@ void MinigameBbLoogie::updateObjs(uint mouseButtons) { break; } } - + if (--_carDelay == 0) { // Car Obj *obj = getFreeObject(); @@ -633,7 +633,7 @@ void MinigameBbLoogie::updateObjs(uint mouseButtons) { obj->yIncr = 0; _carDelay = _vm->getRandom(256) + 800; } - + if (--_bikeDelay == 0) { // Bike Obj *obj = getFreeObject(); @@ -646,7 +646,7 @@ void MinigameBbLoogie::updateObjs(uint mouseButtons) { obj->yIncr = 0; _bikeDelay = _vm->getRandom(512) + 500; } - + if (--_squirrelDelay == 0) { // Squirrel Obj *obj = getFreeObject(); @@ -662,7 +662,7 @@ void MinigameBbLoogie::updateObjs(uint mouseButtons) { playSound(9); _squirrelDelay = _vm->getRandom(512) + 300; } - + if (--_paperPlaneDelay == 0) { // Paper plane Obj *obj = getFreeObject(); @@ -685,7 +685,7 @@ void MinigameBbLoogie::updateObjs(uint mouseButtons) { } _paperPlaneDelay = 400; } - + if (_principalDelay >= 0 && --_principalDelay == 0) { // Principal Obj *obj = getFreeObject(); @@ -703,13 +703,13 @@ void MinigameBbLoogie::updateObjs(uint mouseButtons) { _principalFirstFrameIndex = 11; _principalLastFrameIndex = 16; } - + } void MinigameBbLoogie::updatePlayer(int objIndex, uint mouseButtons) { Obj *obj = &_objects[0]; - + switch (obj->status) { case 1: @@ -817,7 +817,7 @@ void MinigameBbLoogie::updateLoogie(int objIndex) { obj->y -= kLoogieOffY[obj->unk2 / 8]; --obj->unk2; } - + if (obj->ticks-- == 0) { obj->ticks = getAnimation(5)->frameTicks[0]; ++obj->frameIndex; @@ -832,9 +832,9 @@ void MinigameBbLoogie::updateLoogie(int objIndex) { void MinigameBbLoogie::updateCar(int objIndex) { Obj *obj = &_objects[objIndex]; - + obj->x += obj->xIncr; - + if (obj->ticks-- == 0) { if (obj->frameIndex++ == 3 || obj->frameIndex == 6) obj->frameIndex = 0; @@ -867,7 +867,7 @@ void MinigameBbLoogie::updateCar(int objIndex) { void MinigameBbLoogie::updateBike(int objIndex) { Obj *obj = &_objects[objIndex]; - + obj->x += obj->xIncr; if (obj->ticks-- == 0) { @@ -965,7 +965,7 @@ void MinigameBbLoogie::updatePaperPlane(int objIndex) { loogieObj = findLoogieObj(loogieObjIndex++); } } - + } void MinigameBbLoogie::updateIndicator(int objIndex) { @@ -995,7 +995,7 @@ void MinigameBbLoogie::updateIndicator(int objIndex) { obj->kind = 0; obj->anim = getAnimation(6); } - + } void MinigameBbLoogie::updatePrincipal(int objIndex) { @@ -1281,22 +1281,22 @@ bool MinigameBbLoogie::run(bool fromMainGame) { _gameDone = false; initObjects(); initVars(); - + _spriteModule = new SpriteModule(); _spriteModule->load("bbloogie/bbloogie.000"); Palette palette = _spriteModule->getPalette(); _vm->_screen->setPalette(palette); - + loadSounds(); playSound(32, true); - + while (!_vm->shouldQuit() &&!_gameDone) { _vm->updateEvents(); update(); } - + _vm->_sound->unloadSounds(); if (!_fromMainGame) @@ -1319,15 +1319,15 @@ void MinigameBbLoogie::update() { inputTicks = 1; _gameTicks = _vm->_system->getMillis(); } - + if (_vm->_keyCode == Common::KEYCODE_ESCAPE) { _gameDone = true; return; } - + if (inputTicks == 0) return; - + bool done; do { @@ -1336,9 +1336,9 @@ void MinigameBbLoogie::update() { _vm->_mouseButtons &= ~kRightButtonClicked; _vm->_keyCode = Common::KEYCODE_INVALID; } while (--inputTicks && _gameTicks > 0 && !done); - + drawSprites(); - + _vm->_system->delayMillis(10); } diff --git a/engines/bbvs/minigames/bbloogie.h b/engines/bbvs/minigames/bbloogie.h index 1dd4049b41..04ead51a1e 100644 --- a/engines/bbvs/minigames/bbloogie.h +++ b/engines/bbvs/minigames/bbloogie.h @@ -32,7 +32,7 @@ public: MinigameBbLoogie(BbvsEngine *vm) : Minigame(vm) {}; bool run(bool fromMainGame); public: - + struct Obj { int kind; int x, y; @@ -44,33 +44,33 @@ public: int16 frameIndexAdd; int16 unk2; }; - + enum { kMaxObjectsCount = 256 }; - + enum { kGSTitleScreen = 0, // Title screen kGSMainGame = 1, // Game when called as part of the main game kGSStandaloneGame = 2, // Game when called as standalone game kGSScoreCountUp = 3 // Score countup and next level text }; - + Obj _objects[kMaxObjectsCount]; - + int _playerKind; const ObjAnimation *_playerAnim; const uint *_playerSounds1, *_playerSounds2; uint _playerSounds1Count, _playerSounds2Count; - + int _level, _levelTimeLeft, _levelTimeDelay; - int _numberOfHits, _currScore, _hiScore; + int _numberOfHits, _currScore, _hiScore; int _doubleScore, _megaLoogieCount; - + int _dispLevelScore, _nextLevelScore; int _timeBonusCtr, _bonusDisplayDelay1, _bonusDisplayDelay2, _bonusDisplayDelay3; - + int _carDelay; int _bikeDelay; int _squirrelDelay; @@ -78,37 +78,37 @@ public: int _paperPlaneDelay; int _principalDelay; - int _prevPrincipalStatus; + int _prevPrincipalStatus; int _principalCtr, _principalFirstFrameIndex, _principalLastFrameIndex; bool _principalAngry; - + const ObjAnimation *getAnimation(int animIndex); - + void buildDrawList(DrawList &drawList); void buildDrawList0(DrawList &drawList); void buildDrawList1(DrawList &drawList); void buildDrawList2(DrawList &drawList); void buildDrawList3(DrawList &drawList); - + void drawSprites(); - + void initObjs(); Obj *getFreeObject(); Obj *findLoogieObj(int startObjIndex); bool isHit(Obj *obj1, Obj *obj2); bool isCursorAtObj(int objIndex); - + void initObjects(); void initObjects0(); void initObjects1(); void initObjects3(); - + void initVars(); void initVars0(); void initVars1(); void initVars2(); void initVars3(); - + bool updateStatus(int mouseX, int mouseY, uint mouseButtons); bool updateStatus0(int mouseX, int mouseY, uint mouseButtons); bool updateStatus1(int mouseX, int mouseY, uint mouseButtons); @@ -129,7 +129,7 @@ public: void incNumberOfHits(); void incScore(int incrAmount); void playRndSound(); - + void update(); void loadSounds(); diff --git a/engines/bbvs/minigames/bbtennis.cpp b/engines/bbvs/minigames/bbtennis.cpp index ddd5cfc804..7763548330 100644 --- a/engines/bbvs/minigames/bbtennis.cpp +++ b/engines/bbvs/minigames/bbtennis.cpp @@ -86,7 +86,7 @@ void MinigameBbTennis::buildDrawList(DrawList &drawList) { } void MinigameBbTennis::buildDrawList0(DrawList &drawList) { - + drawList.add(_objects[0].anim->frameIndices[_objects[0].frameIndex], _objects[0].x, _objects[0].y, 2000); for (int i = 0; i < kMaxObjectsCount; ++i) { @@ -154,7 +154,7 @@ void MinigameBbTennis::buildDrawList1(DrawList &drawList) { break; } - + drawList.add(index, x, y, priority); } @@ -174,16 +174,16 @@ void MinigameBbTennis::buildDrawList1(DrawList &drawList) { drawList.add(getAnimation(9)->frameIndices[0], 256, 52, 500); drawList.add(getAnimation(10)->frameIndices[0], 60, 162, 500); drawList.add(getAnimation(21)->frameIndices[0], 36, 18, 2000); - + drawNumber(drawList, _score, 70, 18); - + for (int i = 0; i < _numHearts; ++i) drawList.add(getAnimation(7)->frameIndices[0], 20 + i * 20, 236, 990); } void MinigameBbTennis::buildDrawList2(DrawList &drawList) { - + for (int i = 0; i < kMaxObjectsCount; ++i) { Obj *obj = &_objects[i]; if (obj->kind) @@ -384,7 +384,7 @@ bool MinigameBbTennis::updateStatus1(int mouseX, int mouseY, uint mouseButtons) _objects[0].x = mouseX; _objects[0].y = mouseY; - + if (_allHeartsGone) { _gameState = 2; initObjects(); @@ -427,13 +427,13 @@ bool MinigameBbTennis::updateStatus1(int mouseX, int mouseY, uint mouseButtons) if (_newBallTimer > 0) --_newBallTimer; - + if (++_delayDecreaseTimer == 30) { _delayDecreaseTimer = 0; if (_playerDecrease < 199) ++_playerDecrease; } - + updateObjs(); if (!_playedThisIsTheCoolest && _score > 3 && _vm->getRandom(10) == 1 && !isAnySoundPlaying(kAllSounds, 11)) { @@ -482,7 +482,7 @@ void MinigameBbTennis::updateObjs() { break; } } - + if (_rapidFireBallsCount == 0) { --_squirrelDelay; if (--_squirrelDelay == 0) { @@ -763,7 +763,7 @@ void MinigameBbTennis::updateTennisPlayer(int objIndex) { } ++_tennisPlayerDelay; break; - + case 2: if (--obj->ticks == 0) { ++obj->frameIndex; @@ -1077,7 +1077,7 @@ void MinigameBbTennis::updateNetPlayer(int objIndex) { void MinigameBbTennis::updateEnemyTennisBall(int objIndex) { Obj *obj = &_objects[objIndex]; - + if (--obj->ticks == 0) { --obj->frameIndex; obj->ticks = getAnimation(6)->frameTicks[obj->frameIndex]; @@ -1103,7 +1103,7 @@ void MinigameBbTennis::updateEnemyTennisBall(int objIndex) { obj->x = (int)obj->fltX; obj->fltY = obj->fltY - obj->fltStepY; obj->y = (int)obj->fltY; - + } void MinigameBbTennis::makeEnemyBall(int x, int y, int frameIndex) { @@ -1184,7 +1184,7 @@ void MinigameBbTennis::hitSomething() { bool MinigameBbTennis::run(bool fromMainGame) { memset(_objects, 0, sizeof(_objects)); - + _numbersAnim = getAnimation(20); _backgroundSpriteIndex = 272; @@ -1201,23 +1201,23 @@ bool MinigameBbTennis::run(bool fromMainGame) { _gameDone = false; initObjects(); initVars(); - + _spriteModule = new SpriteModule(); _spriteModule->load("bbtennis/bbtennis.000"); Palette palette = _spriteModule->getPalette(); _vm->_screen->setPalette(palette); - + loadSounds(); _gameTicks = 0; playSound(29, true); - + while (!_vm->shouldQuit() &&!_gameDone) { _vm->updateEvents(); update(); } - + _vm->_sound->unloadSounds(); if (!_fromMainGame) @@ -1240,15 +1240,15 @@ void MinigameBbTennis::update() { inputTicks = 1; _gameTicks = _vm->_system->getMillis(); } - + if (_vm->_keyCode == Common::KEYCODE_ESCAPE) { _gameDone = true; return; } - + if (inputTicks == 0) return; - + bool done; do { @@ -1257,9 +1257,9 @@ void MinigameBbTennis::update() { _vm->_mouseButtons &= ~kRightButtonClicked; _vm->_keyCode = Common::KEYCODE_INVALID; } while (--inputTicks && _gameTicks > 0 && !done); - + drawSprites(); - + _vm->_system->delayMillis(10); } diff --git a/engines/bbvs/minigames/bbtennis.h b/engines/bbvs/minigames/bbtennis.h index 690bd724a0..7eac904c4d 100644 --- a/engines/bbvs/minigames/bbtennis.h +++ b/engines/bbvs/minigames/bbtennis.h @@ -32,7 +32,7 @@ public: MinigameBbTennis(BbvsEngine *vm) : Minigame(vm) {}; bool run(bool fromMainGame); public: - + struct Obj { int kind; int x, y; @@ -51,20 +51,20 @@ public: int ballStepCtr; int netPlayDirection; }; - + enum { kMaxObjectsCount = 256 }; - + enum { kGSTitleScreen = 0, // Title screen kGSMainGame = 1, // Game when called as part of the main game kGSStandaloneGame = 2, // Game when called as standalone game kGSScoreCountUp = 3 // Score countup and next level text }; - + Obj _objects[kMaxObjectsCount]; - + int _numHearts; int _squirrelDelay; int _tennisPlayerDelay; @@ -85,29 +85,29 @@ public: bool _endSoundPlaying; const ObjAnimation *getAnimation(int animIndex); - + void buildDrawList(DrawList &drawList); void buildDrawList0(DrawList &drawList); void buildDrawList1(DrawList &drawList); void buildDrawList2(DrawList &drawList); - + void drawSprites(); - + void initObjs(); Obj *getFreeObject(); Obj *findTennisBall(int startObjIndex); bool isHit(Obj *obj1, Obj *obj2); - + void initObjects(); void initObjects0(); void initObjects1(); void initObjects2(); - + void initVars(); void initVars0(); void initVars1(); void initVars2(); - + bool updateStatus(int mouseX, int mouseY, uint mouseButtons); bool updateStatus0(int mouseX, int mouseY, uint mouseButtons); bool updateStatus1(int mouseX, int mouseY, uint mouseButtons); diff --git a/engines/bbvs/minigames/minigame.cpp b/engines/bbvs/minigames/minigame.cpp index aae18072d9..58d98a9df8 100644 --- a/engines/bbvs/minigames/minigame.cpp +++ b/engines/bbvs/minigames/minigame.cpp @@ -44,13 +44,13 @@ Minigame::~Minigame() { int Minigame::drawNumber(DrawList &drawList, int number, int x, int y) { int digits = 1, rightX = x; - + for (int mag = 10; number / mag != 0; mag *= 10) ++digits; - + rightX = x + digits * 10; x = rightX; - + while (digits--) { const int n = number % 10; x -= 10; diff --git a/engines/bbvs/minigames/minigame.h b/engines/bbvs/minigames/minigame.h index 675dec360d..1c24110519 100644 --- a/engines/bbvs/minigames/minigame.h +++ b/engines/bbvs/minigames/minigame.h @@ -51,30 +51,30 @@ public: virtual ~Minigame(); virtual bool run(bool fromMainGame) = 0; protected: - BbvsEngine *_vm; + BbvsEngine *_vm; SpriteModule *_spriteModule; - + int _gameState; int _gameTicks; bool _gameResult; bool _gameDone; bool _fromMainGame; int _hiScoreTable[kMinigameCount]; - + int _backgroundSpriteIndex, _titleScreenSpriteIndex; - + const ObjAnimation *_numbersAnim; - + int drawNumber(DrawList &drawList, int number, int x, int y); void playSound(uint index, bool loop = false); void stopSound(uint index); bool isSoundPlaying(uint index); bool isAnySoundPlaying(const uint *indices, uint count); - + void saveHiscore(int minigameNum, int score); int loadHiscore(int minigameNum); - + }; } // End of namespace Bbvs diff --git a/engines/bbvs/saveload.cpp b/engines/bbvs/saveload.cpp index ff53cc457b..e7725713fd 100644 --- a/engines/bbvs/saveload.cpp +++ b/engines/bbvs/saveload.cpp @@ -73,7 +73,7 @@ void BbvsEngine::savegame(const char *filename, const char *description) { byte descriptionLen = strlen(description); out->writeByte(descriptionLen); out->write(description, descriptionLen); - + Graphics::saveThumbnail(*out); // Not used yet, reserved for future usage @@ -86,7 +86,7 @@ void BbvsEngine::savegame(const char *filename, const char *description) { out->writeUint32LE(saveTime); out->writeUint32LE(playTime); // Header end - + out->write(_snapshot, _snapshotStream->pos()); out->finalize(); @@ -103,15 +103,15 @@ void BbvsEngine::loadgame(const char *filename) { SaveHeader header; kReadSaveHeaderError errorCode = readSaveHeader(in, false, header); - + if (errorCode != kRSHENoError) { warning("Error loading savegame '%s'", filename); delete in; return; } - + g_engine->setTotalPlayTime(header.playTime * 1000); - + memset(_sceneObjects, 0, sizeof(_sceneObjects)); for (int i = 0; i < kSceneObjectsCount; ++i) { _sceneObjects[i].walkDestPt.x = -1; @@ -120,7 +120,7 @@ void BbvsEngine::loadgame(const char *filename) { _currSceneNum = 0; _newSceneNum = in->readUint32LE(); - + initScene(false); _prevSceneNum = in->readUint32LE(); @@ -157,16 +157,16 @@ void BbvsEngine::loadgame(const char *filename) { obj->frameIndex = in->readUint32LE(); obj->frameTicks = in->readUint32LE(); obj->walkCount = in->readUint32LE(); - obj->xIncr = in->readUint32LE(); + obj->xIncr = in->readUint32LE(); obj->yIncr = in->readUint32LE(); - obj->turnValue = in->readUint32LE(); - obj->turnCount = in->readUint32LE(); + obj->turnValue = in->readUint32LE(); + obj->turnCount = in->readUint32LE(); obj->turnTicks = in->readUint32LE(); obj->walkDestPt.x = in->readUint16LE(); obj->walkDestPt.y = in->readUint16LE(); obj->anim = obj->animIndex > 0 ? _gameModule->getAnimation(obj->animIndex) : 0; } - + updateWalkableRects(); // Restart scene background sounds @@ -259,10 +259,10 @@ void BbvsEngine::saveSnapshot() { _snapshotStream->writeUint32LE(obj->frameIndex); _snapshotStream->writeUint32LE(obj->frameTicks); _snapshotStream->writeUint32LE(obj->walkCount); - _snapshotStream->writeUint32LE(obj->xIncr); + _snapshotStream->writeUint32LE(obj->xIncr); _snapshotStream->writeUint32LE(obj->yIncr); - _snapshotStream->writeUint32LE(obj->turnValue); - _snapshotStream->writeUint32LE(obj->turnCount); + _snapshotStream->writeUint32LE(obj->turnValue); + _snapshotStream->writeUint32LE(obj->turnCount); _snapshotStream->writeUint32LE(obj->turnTicks); _snapshotStream->writeUint16LE(obj->walkDestPt.x); _snapshotStream->writeUint16LE(obj->walkDestPt.y); diff --git a/engines/bbvs/scene.cpp b/engines/bbvs/scene.cpp index 0d86eb4dbc..a89c88fd82 100644 --- a/engines/bbvs/scene.cpp +++ b/engines/bbvs/scene.cpp @@ -34,7 +34,7 @@ static const int kAfterVideoSceneNum[] = { void BbvsEngine::loadScene(int sceneNum) { debug(0, "BbvsEngine::loadScene() sceneNum: %d", sceneNum); - + Common::String sprFilename = Common::String::format("vnm/vspr%04d.vnm", sceneNum); Common::String gamFilename = Common::String::format("vnm/game%04d.vnm", sceneNum); @@ -42,7 +42,7 @@ void BbvsEngine::loadScene(int sceneNum) { _spriteModule->load(sprFilename.c_str()); _gameModule->load(gamFilename.c_str()); - + Palette palette = _spriteModule->getPalette(); _screen->setPalette(palette); @@ -106,10 +106,10 @@ void BbvsEngine::initScene(bool sounds) { loadScene(_newSceneNum); _currSceneNum = _newSceneNum; _newSceneNum = 0; - + for (int i = 0; i < _gameModule->getSceneObjectDefsCount(); ++i) _sceneObjects[i].sceneObjectDef = _gameModule->getSceneObjectDef(i); - + for (int i = 0; i < _gameModule->getSceneObjectInitsCount(); ++i) { SceneObjectInit *soInit = _gameModule->getSceneObjectInit(i); if (evalCondition(soInit->conditions)) { @@ -149,10 +149,10 @@ void BbvsEngine::initScene(bool sounds) { } } } - + _cameraPos = _gameModule->getCameraInit(_currCameraNum)->cameraPos; _newCameraPos = _cameraPos; - + _walkAreaActions.clear(); for (int i = 0; i < _gameModule->getActionsCount(); ++i) { Action *action = _gameModule->getAction(i); @@ -165,7 +165,7 @@ void BbvsEngine::initScene(bool sounds) { _activeItemIndex = 0; _activeItemType = kITEmpty; - + for (int i = 0; i < _gameModule->getActionsCount(); ++i) { Action *action = _gameModule->getAction(i); if (evalCondition(action->conditions)) { @@ -183,7 +183,7 @@ void BbvsEngine::initScene(bool sounds) { break; } } - + if (sounds) updateBackgroundSounds(); @@ -192,7 +192,7 @@ void BbvsEngine::initScene(bool sounds) { bool BbvsEngine::changeScene() { writeContinueSavegame(); - + if (_newSceneNum >= 27 && _newSceneNum <= 30) { // Run minigames stopSpeech(); @@ -221,7 +221,7 @@ bool BbvsEngine::changeScene() { } return true; - + } } // End of namespace Bbvs diff --git a/engines/bbvs/spritemodule.cpp b/engines/bbvs/spritemodule.cpp index 8eae7f9a6a..f8b0d9afd5 100644 --- a/engines/bbvs/spritemodule.cpp +++ b/engines/bbvs/spritemodule.cpp @@ -41,15 +41,15 @@ SpriteModule::~SpriteModule() { void SpriteModule::load(const char *filename) { unload(); - + Common::File fd; if (!fd.open(filename)) error("SpriteModule::load() Could not open %s", filename); - + fd.readUint32LE(); // Skip magic fd.readUint32LE(); // Skip unused fd.readUint32LE(); // Skip filesize - + _paletteOffs = fd.readUint32LE(); fd.readUint32LE(); // Skip unused flagsTbl1Ofs fd.readUint32LE(); // Skip unused flagsTbl2Ofs @@ -57,18 +57,18 @@ void SpriteModule::load(const char *filename) { _paletteStart = fd.readUint32LE(); _paletteCount = fd.readUint32LE(); _spritesCount = fd.readUint32LE(); - + debug(0, "_paletteOffs: %08X", _paletteOffs); debug(0, "_spriteTblOffs: %08X", _spriteTblOffs); debug(0, "_paletteStart: %d", _paletteStart); debug(0, "_paletteCount: %d", _paletteCount); debug(0, "_spritesCount: %d", _spritesCount); - + _spriteDataSize = fd.size(); _spriteData = new byte[_spriteDataSize]; fd.seek(0); fd.read(_spriteData, _spriteDataSize); - + // Convert palette byte *palette = _spriteData + _paletteOffs; for (int i = 0; i < _paletteCount; ++i) { diff --git a/engines/bbvs/videoplayer.cpp b/engines/bbvs/videoplayer.cpp index fda9372ade..9ea73ad10b 100644 --- a/engines/bbvs/videoplayer.cpp +++ b/engines/bbvs/videoplayer.cpp @@ -42,7 +42,7 @@ void BbvsEngine::playVideo(int videoNum) { warning("Couldn't switch to a RGB color video mode to play a video."); return; } - + Video::VideoDecoder *videoDecoder = new Video::AVIDecoder(); if (!videoDecoder->loadFile(videoFilename)) { delete videoDecoder; @@ -74,7 +74,7 @@ void BbvsEngine::playVideo(int videoNum) { } delete videoDecoder; - + initGraphics(320, 240, false); } diff --git a/engines/bbvs/walk.cpp b/engines/bbvs/walk.cpp index 077110b867..5ef14101a0 100644 --- a/engines/bbvs/walk.cpp +++ b/engines/bbvs/walk.cpp @@ -46,7 +46,7 @@ static const int8 kWalkAnimTbl[32] = { void BbvsEngine::startWalkObject(SceneObject *sceneObject) { if (_buttheadObject != sceneObject && _beavisObject != sceneObject) return; - + initWalkAreas(sceneObject); _sourceWalkAreaPt.x = sceneObject->x >> 16; _sourceWalkAreaPt.y = sceneObject->y >> 16; @@ -60,7 +60,7 @@ void BbvsEngine::startWalkObject(SceneObject *sceneObject) { _destWalkArea = getWalkAreaAtPos(_destWalkAreaPt); if (!_destWalkArea) return; - + if (_sourceWalkArea != _destWalkArea) { _currWalkDistance = kMaxDistance; walkFindPath(_sourceWalkArea, 0); @@ -68,12 +68,12 @@ void BbvsEngine::startWalkObject(SceneObject *sceneObject) { } walkObject(sceneObject, _destWalkAreaPt, sceneObject->sceneObjectDef->walkSpeed); - + } void BbvsEngine::updateWalkObject(SceneObject *sceneObject) { int animIndex; - + if (sceneObject->walkCount > 0 && (sceneObject->xIncr != 0 || sceneObject->yIncr != 0)) { if (ABS(sceneObject->xIncr) <= ABS(sceneObject->yIncr)) sceneObject->turnValue = sceneObject->yIncr >= 0 ? 0 : 4; @@ -89,7 +89,7 @@ void BbvsEngine::updateWalkObject(SceneObject *sceneObject) { Animation *anim = 0; if (animIndex > 0) anim = _gameModule->getAnimation(animIndex); - + if (sceneObject->anim != anim) { if (anim) { sceneObject->anim = anim; @@ -305,12 +305,12 @@ bool BbvsEngine::canButtheadWalkToDest(const Common::Point &destPt) { } void BbvsEngine::canWalkToDest(WalkArea *walkArea, int infoCount) { - + if (_destWalkArea == walkArea) { _walkReachedDestArea = true; return; } - + if (_gameModule->getFieldC() <= 320 || infoCount <= 20) { walkArea->checked = true; for (int linkIndex = 0; linkIndex < walkArea->linksCount; ++linkIndex) { @@ -364,10 +364,10 @@ int BbvsEngine::calcDistance(const Common::Point &pt1, const Common::Point &pt2) void BbvsEngine::walkFoundPath(int count) { debug(5, "BbvsEngine::walkFoundPath(%d)", count); - + Common::Point midPt = _sourceWalkAreaPt; int totalMidPtDistance = 0; - + if (count > 0) { Common::Point lastMidPt; int halfCount = (count + 1) >> 1; @@ -384,13 +384,13 @@ void BbvsEngine::walkFoundPath(int count) { if (distance >= _currWalkDistance) return; - + debug(5, "BbvsEngine::walkFoundPath() distance smaller"); _currWalkDistance = distance; Common::Point destPt = _destWalkAreaPt, newDestPt; - + while (1) { int index = 0; @@ -408,7 +408,7 @@ void BbvsEngine::walkFoundPath(int count) { WalkInfo *walkInfo = _walkInfoPtrs[--count]; destPt.x = walkInfo->x; destPt.y = walkInfo->y; - + if (walkInfo->direction) { newDestPt.x = walkInfo->x; newDestPt.y = walkInfo->y + walkInfo->delta - 1; diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index babcb7e667..4d3a103663 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -640,7 +640,7 @@ Vga::Vga(CGEEngine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _ if (ConfMan.getBool("enable_color_blind")) _mono = 1; - + _oldColors = (Dac *)malloc(sizeof(Dac) * kPalCount); _newColors = (Dac *)malloc(sizeof(Dac) * kPalCount); diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index 37d87ba09c..ee62e20ac6 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -97,7 +97,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _midiNotify = nullptr; _spriteNotify = nullptr; _startGameSlot = 0; - + _sayCap = ConfMan.getBool("subtitles"); _sayVox = !ConfMan.getBool("speech_mute"); _muteAll = ConfMan.getBool("mute"); diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index 50b418f294..fbe4cb3abc 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -269,7 +269,7 @@ public: void snRoom(Sprite *spr, bool on); void snGhost(Bitmap *bmp); void snSay(Sprite *spr, int val); - + void hide1(Sprite *spr); Sprite *expandSprite(Sprite *spr); void qGame(); diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 3e3d615a91..4e3d229618 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -58,7 +58,7 @@ void System::touch(uint16 mask, V2D pos, Common::KeyCode keyCode) { if (_vm->_gamePhase != kPhaseInGame) return; _vm->_infoLine->setText(nullptr); - + if (mask & kMouseLeftUp) { if (pos.y >= 0) { // world if (!_vm->_talk && pos.y < _vm->_mouseTop) @@ -184,7 +184,7 @@ Sprite *CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos) if (line.empty()) continue; Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); - + char *p = token(tmpStr); if (*p == '@') { if (label != kNoByte) @@ -327,7 +327,7 @@ void CGE2Engine::loadScript(const char *fname, bool onlyToolbar) { lcnt++; Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); - + ok = false; // not OK if break V3D P; @@ -419,7 +419,7 @@ void CGE2Engine::sceneUp(int cav) { _map->load(_now); _spare->takeScene(_now); openPocket(); - + for (int i = 0; i < 2; i++) { Hero *h = _heroTab[i]->_ptr; if (h && h->_scene == _now) { @@ -432,7 +432,7 @@ void CGE2Engine::sceneUp(int cav) { h->setContact(); } } - + _sound->stop(); _fx->clear(); @@ -596,7 +596,7 @@ void CGE2Engine::tick() { for (Sprite *spr = _vga->_showQ->first(); spr; spr = spr->_next) { if (spr->_time && (--spr->_time == 0)) spr->tick(); - + if (_waitRef && (_waitRef == spr->_ref) && spr->seqTest(_waitSeq)) _waitRef = 0; } @@ -658,10 +658,10 @@ void CGE2Engine::loadUser() { void CGE2Engine::loadHeroes() { // Original name: loadGame() // load sprites & pocket - + Sprite *s; Hero *h = nullptr; - + // initialize Andzia/Anna s = _spare->take(142); if (s) { @@ -698,7 +698,7 @@ void CGE2Engine::loadPos() { if (_resman->exist("CGE.HXY")) { for (int cav = 0; cav < kSceneMax; cav++) _heroTab[1]->_posTab[cav] = new V2D(this, 180, 10); - + EncryptedStream file(this, "CGE.HXY"); for (int cav = 0; cav < kSceneMax; cav++) { @@ -752,7 +752,7 @@ void CGE2Engine::cge2_main() { runGame(); _gamePhase = kPhaseOver; } - + _vga->sunset(); } else _vga->sunset(); @@ -767,7 +767,7 @@ char *CGE2Engine::mergeExt(char *buf, const char *name, const char *ext) { return buf; } -void CGE2Engine::setEye(const V3D &e) { +void CGE2Engine::setEye(const V3D &e) { *_eye = e; } @@ -931,7 +931,7 @@ void CGE2Engine::offUse() { // This fixes the issue of empty speech bubbles in the original. // Now we only let this cycle pass if it randoms a valid value for getText(). int txt = 0; - do { + do { txt = kOffUseText + _sex * offUseCount + newRandom(offUseCount); } while (_text->getText(txt) == nullptr); diff --git a/engines/cge2/cge2_main.h b/engines/cge2/cge2_main.h index 88cca1cc1e..4d92c33e50 100644 --- a/engines/cge2/cge2_main.h +++ b/engines/cge2/cge2_main.h @@ -40,7 +40,7 @@ public: Sprite *_blinkSprite; System(CGE2Engine *vm); - + virtual void touch(uint16 mask, V2D pos, Common::KeyCode keyCode); void tick(); private: diff --git a/engines/cge2/events.cpp b/engines/cge2/events.cpp index ed1ec66bb1..85743c8011 100644 --- a/engines/cge2/events.cpp +++ b/engines/cge2/events.cpp @@ -132,7 +132,7 @@ Mouse::Mouse(CGE2Engine *vm) : Sprite(vm), _busy(nullptr), _hold(nullptr), _hx(0 _busy = nullptr; _active = false; _flags._kill = false; - + setSeq(_stdSeq8); BitmapPtr MC = new Bitmap[2]; @@ -260,7 +260,7 @@ void EventManager::handleEvents() { if (e._spritePtr) { if (e._mask & kEventKeyb) e._spritePtr->touch(e._mask, _vm->_mouse->_point, e._keyCode); - else + else e._spritePtr->touch(e._mask, _vm->_mouse->_point - e._spritePtr->_pos2D, e._keyCode); } else if (_vm->_sys) _vm->_sys->touch(e._mask, _vm->_mouse->_point, e._keyCode); diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp index 225df54bd1..42ae67cc2b 100644 --- a/engines/cge2/hero.cpp +++ b/engines/cge2/hero.cpp @@ -205,7 +205,7 @@ Sprite *Hero::expand() { int i = stepSize() / 2; _maxDist = (int)sqrt(double(i * i * 2)); setCurrent(); - + return this; } @@ -558,9 +558,9 @@ int CGE2Engine::mapCross(const V2D &a, const V2D &b) { if (p) { if (cross(a, b, *n0, *n)) ++cnt; - + if (*n == *p) - p = nullptr; + p = nullptr; } else { p = n; } @@ -587,7 +587,7 @@ void Hero::operator--() { bool Sprite::works(Sprite *spr) { if (!spr || !spr->_ext) return false; - + bool ok = false; Action a = _vm->_heroTab[_vm->_sex]->_ptr->action(); @@ -615,7 +615,7 @@ bool Sprite::works(Sprite *spr) { } } } - + return ok; } diff --git a/engines/cge2/map.cpp b/engines/cge2/map.cpp index 8c1f00048f..275e15f55a 100644 --- a/engines/cge2/map.cpp +++ b/engines/cge2/map.cpp @@ -48,7 +48,7 @@ void Map::load(int scene) { return; EncryptedStream file(_vm, fileName.c_str()); - + Common::String line; for (line = file.readLine(); !file.eos(); line = file.readLine()) { if (line.empty()) diff --git a/engines/cge2/saveload.cpp b/engines/cge2/saveload.cpp index fd60422dff..7735c077a6 100644 --- a/engines/cge2/saveload.cpp +++ b/engines/cge2/saveload.cpp @@ -104,7 +104,7 @@ bool CGE2Engine::loadGame(int slotNumber) { saveFile->read(dataBuffer, size); readStream = new Common::MemoryReadStream(dataBuffer, size, DisposeAfterUse::YES); delete saveFile; - + // Check to see if it's a ScummVM savegame or not char buffer[kSavegameStrSize + 1]; readStream->read(buffer, kSavegameStrSize + 1); @@ -132,7 +132,7 @@ bool CGE2Engine::loadGame(int slotNumber) { delete readStream; loadHeroes(); - + return true; } diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp index 8e1ddf2d9b..7580ef4425 100644 --- a/engines/cge2/snail.cpp +++ b/engines/cge2/snail.cpp @@ -92,7 +92,7 @@ void CommandHandler::runCommand() { } _textDelay = false; } - + if (_vm->_talk && tailCmd._commandType != kCmdPause) break; } @@ -332,7 +332,7 @@ void CGE2Engine::snRSeq(Sprite *spr, int val) { void CGE2Engine::snSend(Sprite *spr, int val) { if (!spr) return; - + // Sending", spr->_file // from scene", spr->_scene // to scene", val @@ -691,7 +691,7 @@ Sprite *CGE2Engine::expandSprite(Sprite *spr) { void CGE2Engine::qGame() { // Write out the user's progress saveGame(0, Common::String("Automatic Savegame")); - + busy(false); _vga->sunset(); _endGame = true; @@ -853,13 +853,13 @@ void CGE2Engine::feedSnail(Sprite *spr, Action snq, Hero *hero) { if (s == spr) break; } - + _commandHandler->addCommand(c->_commandType, c->_ref, c->_val, spr); ++c; } } - + } } // End of namespace CGE2. diff --git a/engines/cge2/spare.h b/engines/cge2/spare.h index 7dc6ce60f5..24a97712ff 100644 --- a/engines/cge2/spare.h +++ b/engines/cge2/spare.h @@ -38,7 +38,7 @@ class Spare { public: Spare(CGE2Engine *vm) : _vm(vm) {} ~Spare() { clear(); } - void store(Sprite *spr); + void store(Sprite *spr); Sprite *locate(int ref); Sprite *take(int ref); void takeScene(int cav); diff --git a/engines/cge2/talk.cpp b/engines/cge2/talk.cpp index 9109da90f1..8e6be6cac2 100644 --- a/engines/cge2/talk.cpp +++ b/engines/cge2/talk.cpp @@ -121,7 +121,7 @@ Talk::Talk(CGE2Engine *vm, const char *text, TextBoxStyle mode, ColorBank color, Talk::Talk(CGE2Engine *vm, ColorBank color) : Sprite(vm), _mode(kTBPure), _created(false), _wideSpace(false), _vm(vm) { _color = _vm->_font->_colorSet[color]; - + if (color == kCBRel) _vm->setAutoColors(); } diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 227633579e..f4064f3565 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -45,13 +45,13 @@ void V3D::sync(Common::Serializer &s) { _z.sync(s); } -FXP FXP::operator*(const FXP& x) const { - FXP y; +FXP FXP::operator*(const FXP& x) const { + FXP y; int32 t1 = (v >> 8) * x.v; int32 t2 = ((v & 0xFF) * x.v) >> 8; y.v = t1 + t2; - return y; + return y; } FXP FXP::operator/(const FXP& x) const { @@ -613,7 +613,7 @@ void Sprite::gotoxyz(V2D pos) { ++trim; } _pos2D.x = pos.x; - + if (pos.y < -kPanHeight) { pos.y = -kPanHeight; ++trim; diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index bb0838395d..ebaff32550 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -163,7 +163,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) for (int i = 0; i < 11; i++) _currSoundList1[i] = 0; - + for (int i = 0; i < 200; i++) _mapTable[i] = 0; @@ -285,7 +285,7 @@ Common::Error FullpipeEngine::run() { freeGameLoader(); _currentScene = 0; _updateTicks = 0; - + loadGam("fullpipe.gam"); _needRestart = false; } diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 61fbf7192f..42846850ca 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -153,7 +153,7 @@ bool PictureObject::load(MfcArchive &file, bool bigPicture) { if (count > 0) { GameObject *o = new GameObject(); - + o->load(file); _pictureObject2List->push_back(o); } @@ -286,9 +286,9 @@ bool GameObject::load(MfcArchive &file) { _okeyCode = 0; _flags = 0; _field_20 = 0; - + _id = file.readUint16LE(); - + _objectName = file.readPascalString(); _ox = file.readUint32LE(); _oy = file.readUint32LE(); @@ -498,7 +498,7 @@ bool Picture::load(MfcArchive &file) { _x = file.readUint32LE(); _y = file.readUint32LE(); _field_44 = file.readUint16LE(); - + assert(g_fp->_gameProjectVersion >= 2); _width = file.readUint32LE(); diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index 7c97461a24..b681f4fbe7 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -70,7 +70,7 @@ void setInputDisabled(bool state) { void InputController::addCursor(CursorInfo *cursor) { CursorInfo *newc = new CursorInfo(cursor); Common::Point p; - + cursor->picture->getDimensions(&p); newc->width = p.x; diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 49cf88434e..9573e0517b 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1040,11 +1040,11 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int if (!mq || !mq->getExCommandByIndex(0)) return 0; - + ExCommand *ex = mq->getExCommandByIndex(0); - if ((ex->_messageKind != 1 && ex->_messageKind != 20) || - ex->_messageNum != subj->_movement->_id || + if ((ex->_messageKind != 1 && ex->_messageKind != 20) || + ex->_messageNum != subj->_movement->_id || (ex->_field_14 >= 1 && ex->_field_14 <= subj->_movement->_currDynamicPhaseIndex)) subj->playIdle(); } @@ -1416,8 +1416,8 @@ Common::Array<MovArr *> *MovGraph::genMovArr(int x, int y, int *arrSize, int fla movarr = new MovArr; movarr->_link = lnk; - movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - point.y) + - (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(point.x - lnk->_movGraphNode1->_x)) / + movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - point.y) + + (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(point.x - lnk->_movGraphNode1->_x)) / lnk->_distance / lnk->_distance; movarr->_point = point; @@ -1445,8 +1445,8 @@ Common::Array<MovArr *> *MovGraph::genMovArr(int x, int y, int *arrSize, int fla } else { movarr = new MovArr; movarr->_link = lnk; - movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - y) + - (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(x - lnk->_movGraphNode1->_x)) / + movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - y) + + (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(x - lnk->_movGraphNode1->_x)) / lnk->_distance / lnk->_distance; movarr->_point.x = x; movarr->_point.y = y; diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 8463b3ab40..00dd70c1b2 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -162,7 +162,7 @@ bool Scene::load(MfcArchive &file) { Background::load(file); _sceneId = file.readUint16LE(); - + _sceneName = file.readPascalString(); debug(0, "scene: <%s> %d", transCyrillic((byte *)_sceneName), _sceneId); diff --git a/engines/fullpipe/scenes/scene02.cpp b/engines/fullpipe/scenes/scene02.cpp index 109a20a07a..fd542d580d 100644 --- a/engines/fullpipe/scenes/scene02.cpp +++ b/engines/fullpipe/scenes/scene02.cpp @@ -134,5 +134,5 @@ int sceneHandler02(ExCommand *ex) { return res; } - + } // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp index 21dbe8101f..446f477133 100644 --- a/engines/fullpipe/scenes/scene14.cpp +++ b/engines/fullpipe/scenes/scene14.cpp @@ -57,7 +57,7 @@ void scene14_initScene(Scene *sc) { ball->_flags &= 0xFFFB; g_vars->scene14_balls.push_back(ball); - + for (uint i = 0; i < 3; i++) { ball = new StaticANIObject(ball); // create a copy diff --git a/engines/fullpipe/scenes/scene15.cpp b/engines/fullpipe/scenes/scene15.cpp index 452f2edeca..efc69a5fa6 100644 --- a/engines/fullpipe/scenes/scene15.cpp +++ b/engines/fullpipe/scenes/scene15.cpp @@ -71,7 +71,7 @@ void scene15_initScene(Scene *sc) { grandma->hide(); g_fp->setObjectState(sO_LeftPipe_15, g_fp->getObjectEnumState(sO_LeftPipe_15, sO_IsOpened)); } - + g_vars->scene15_plusminus = sc->getStaticANIObject1ById(ANI_PLUSMINUS, -1); if (g_fp->getObjectState(sO_Guard_2) == g_fp->getObjectEnumState(sO_Guard_2, sO_Off)) diff --git a/engines/fullpipe/scenes/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp index ed3c51a6c2..e9d3a37efd 100644 --- a/engines/fullpipe/scenes/scene16.cpp +++ b/engines/fullpipe/scenes/scene16.cpp @@ -57,9 +57,9 @@ void scene16_initScene(Scene *sc) { boy[1] = new StaticANIObject(boy[0]); sc->addStaticANIObject(boy[1], 1); - + int idx = 0; - + for (int i = 0; i < 3; i++) { g_vars->scene16_figures.push_back(boy[idx]); @@ -68,7 +68,7 @@ void scene16_initScene(Scene *sc) { if (idx >= 2) idx = 0; } - + g_vars->scene16_figures.push_back(sc->getStaticANIObject1ById(ANI_GIRL, -1)); for (int i = 0; i < 4; i++) { @@ -259,7 +259,7 @@ void sceneHandler16_drink() { mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYKICK), 0, 1); mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); - + ex = new ExCommand(ANI_MAN, 34, 384, 0, 0, 0, 1, 0, 0, 0); ex->_excFlags |= 3u; ex->_field_14 = 384; diff --git a/engines/fullpipe/scenes/scene23.cpp b/engines/fullpipe/scenes/scene23.cpp index ccfbac9223..f66ea12b4b 100644 --- a/engines/fullpipe/scenes/scene23.cpp +++ b/engines/fullpipe/scenes/scene23.cpp @@ -146,7 +146,7 @@ void scene23_initScene(Scene *sc) { sc->getStaticANIObject1ById(ANI_INV_LEVERHANDLE, -1)->hide(); } - + g_fp->_currentScene = oldsc; } diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp index c21ce05502..de5a96e70d 100644 --- a/engines/fullpipe/scenes/scene28.cpp +++ b/engines/fullpipe/scenes/scene28.cpp @@ -46,7 +46,7 @@ void scene28_initScene(Scene *sc) { g_vars->scene28_lift6inside = false; g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28")); - + g_fp->initArcadeKeys("SC_28"); } diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp index 8f82e99ad1..222a541554 100644 --- a/engines/fullpipe/scenes/scene29.cpp +++ b/engines/fullpipe/scenes/scene29.cpp @@ -840,7 +840,7 @@ void sceneHandler29_shootersEscape() { void sceneHandler29_manRideBack() { g_vars->scene29_manX -= 2; - + g_fp->_aniMan->setOXY(g_vars->scene29_manX, g_vars->scene29_manY); } diff --git a/engines/fullpipe/scenes/scene37.cpp b/engines/fullpipe/scenes/scene37.cpp index 09da01f138..324d3ac92d 100644 --- a/engines/fullpipe/scenes/scene37.cpp +++ b/engines/fullpipe/scenes/scene37.cpp @@ -91,7 +91,7 @@ void scene37_initScene(Scene *sc) { g_vars->scene37_rings.push_back(ring); g_fp->setObjectState(sO_LeftPipe_37, g_fp->getObjectEnumState(sO_LeftPipe_37, sO_IsClosed)); - + Scene *oldsc = g_fp->_currentScene; g_fp->_currentScene = sc; diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index a4ca06f489..230d6c39a9 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -62,7 +62,7 @@ bool SoundList::load(MfcArchive &file, char *fname) { } return true; - + } bool SoundList::loadFile(const char *fname, char *libname) { diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 717de84925..880c2eb0df 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -246,7 +246,7 @@ bool StaticANIObject::load(MfcArchive &file) { void StaticANIObject::setOXY(int x, int y) { _ox = x; _oy = y; - + if (_movement) _movement->setOXY(x, y); } @@ -713,7 +713,7 @@ void StaticANIObject::setSpeed(int speed) { void StaticANIObject::setAlpha(int alpha) { for (uint i = 0; i < _movements.size(); i++) _movements[i]->setAlpha(alpha); - + for (uint i = 0; i < _staticsList.size(); i++) _staticsList[i]->setAlpha(alpha); } @@ -1813,7 +1813,7 @@ void Movement::initStatics(StaticANIObject *ani) { _staticsObj2 = ani->addReverseStatics(_currMovement->_staticsObj2); _staticsObj1 = ani->addReverseStatics(_currMovement->_staticsObj1); - + _mx = _currMovement->_mx; _my = _currMovement->_my; @@ -2279,7 +2279,7 @@ bool StaticPhase::load(MfcArchive &file) { _initialCountdown = file.readUint16LE(); _field_6A = file.readUint16LE(); - + if (g_fp->_gameProjectVersion >= 12) { _exCommand = (ExCommand *)file.readClass(); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 84d5c631c7..18b16cb4c8 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -883,7 +883,7 @@ void ComputerManager::getScoreName() { _vm->_graphicsMan->setColorPercentage(254, 0, 0, 0); byte *ptr = _vm->_fileIO->loadFile("ALPHA.SPR"); _vm->_graphicsMan->fadeInBreakout(); - + // Figure out the line to put the new high score on int scoreLine = 0; while (scoreLine < 5 && _breakoutScore < atol(_score[scoreLine]._score.c_str())) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 6620f2878c..3100ed6cdc 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -74,7 +74,7 @@ int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes * It's now using the config manager and a per-engine GUI option. */ void FileManager::initCensorship() { - _vm->_globals->_censorshipFl = ConfMan.getBool("enable_gore"); + _vm->_globals->_censorshipFl = !ConfMan.getBool("enable_gore"); } /** diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 773c714899..d86fc449ee 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -261,9 +261,9 @@ void SoundManager::loadAnimSound() { } } -void SoundManager::playAnimSound(int soundNumber) { +void SoundManager::playAnimSound(int animFrame) { if (!_vm->_globals->_censorshipFl && _specialSoundNum == 2) { - switch (soundNumber) { + switch (animFrame) { case 20: playSample(5); break; @@ -282,35 +282,35 @@ void SoundManager::playAnimSound(int soundNumber) { playSample(4); break; } - } else if (_specialSoundNum == 1 && soundNumber == 17) + } else if (_specialSoundNum == 1 && animFrame == 17) playSoundFile("SOUND42.WAV"); - else if (_specialSoundNum == 5 && soundNumber == 19) + else if (_specialSoundNum == 5 && animFrame == 19) playWav(1); - else if (_specialSoundNum == 14 && soundNumber == 625) + else if (_specialSoundNum == 14 && animFrame == 625) playWav(1); - else if (_specialSoundNum == 16 && soundNumber == 25) + else if (_specialSoundNum == 16 && animFrame == 25) playWav(1); else if (_specialSoundNum == 17) { - if (soundNumber == 6) + if (animFrame == 6) playSample(1); - else if (soundNumber == 14) + else if (animFrame == 14) playSample(2); - else if (soundNumber == 67) + else if (animFrame == 67) playSample(3); - } else if (_specialSoundNum == 198 && soundNumber == 15) + } else if (_specialSoundNum == 198 && animFrame == 15) playWav(1); - else if (_specialSoundNum == 199 && soundNumber == 72) + else if (_specialSoundNum == 199 && animFrame == 72) playWav(1); - else if (_specialSoundNum == 208 && soundNumber == 40) + else if (_specialSoundNum == 208 && animFrame == 40) playWav(1); - else if (_specialSoundNum == 210 && soundNumber == 2) + else if (_specialSoundNum == 210 && animFrame == 2) playWav(1); - else if (_specialSoundNum == 211 && soundNumber == 22) + else if (_specialSoundNum == 211 && animFrame == 22) playWav(1); else if (_specialSoundNum == 229) { - if (soundNumber == 15) + if (animFrame == 15) playWav(1); - else if (soundNumber == 91) + else if (animFrame == 91) playWav(2); } } diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index 97cdcdc1dd..1fb4f9ae71 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -116,7 +116,7 @@ public: ~SoundManager(); void loadAnimSound(); - void playAnimSound(int soundNumber); + void playAnimSound(int animFrame); void loadSample(int wavIndex, const Common::String &file); void playSample(int wavIndex, int voiceMode = 9); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index df7b26c82c..00c4ab0332 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -68,7 +68,7 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename) getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer); getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer); getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer); - + switch (_vm->_globals->_language) { case LANG_FR: _answersFilename = _questionsFilename = "RUE.TXT"; diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index fb51c05e51..cfd5f6ffc6 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -532,7 +532,7 @@ void VQADecoder::VQAVideoTrack::handleVQFR(Common::SeekableReadStream *stream) { uint32 tag = readTag(stream); uint32 i; size = stream->readUint32BE(); - + switch (tag) { case MKTAG('C','B','F','0'): // Full codebook stream->read(_codeBook, size); diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 63a7e40d1b..94653f9a39 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -556,7 +556,7 @@ void Game::writeSavegameHeader(Common::OutSaveFile *out, MADSSavegameHeader &hea if (!_saveThumb) createThumbnail(); Graphics::saveThumbnail(*out, *_saveThumb); - + _saveThumb->free(); delete _saveThumb; _saveThumb = nullptr; diff --git a/engines/mads/menu_views.cpp b/engines/mads/menu_views.cpp index 03afc70c3e..ee4268a650 100644 --- a/engines/mads/menu_views.cpp +++ b/engines/mads/menu_views.cpp @@ -37,7 +37,7 @@ MenuView::MenuView(MADSEngine *vm) : FullScreenDialog(vm) { } void MenuView::show() { - Scene &scene = _vm->_game->_scene; + Scene &scene = _vm->_game->_scene; EventsManager &events = *_vm->_events; _vm->_screenFade = SCREEN_FADE_FAST; @@ -195,7 +195,7 @@ void TextView::processCommand() { paramP = commandStr + 10; resetPalette(); int screenId = getParameter(¶mP); - + SceneInfo *sceneInfo = SceneInfo::init(_vm); sceneInfo->load(screenId, 0, "", 0, scene._depthSurface, scene._backgroundSurface); scene._spriteSlots.fullRefresh(); @@ -230,7 +230,7 @@ void TextView::processCommand() { int soundId = getParameter(¶mP); _vm->_sound->command(soundId); - } else if (!strncmp(commandStr, "COLOR", 5) && ((commandStr[5] == '0') || + } else if (!strncmp(commandStr, "COLOR", 5) && ((commandStr[5] == '0') || (commandStr[5] == '1'))) { // Set the text colors int index = commandStr[5] - '0'; @@ -254,7 +254,7 @@ void TextView::processCommand() { sceneInfo->_width = MADS_SCREEN_WIDTH; sceneInfo->_height = MADS_SCENE_HEIGHT; _spareScreens[spareIndex].setSize(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); - sceneInfo->loadMadsV1Background(screenId, "", SCENEFLAG_TRANSLATE, + sceneInfo->loadMadsV1Background(screenId, "", SCENEFLAG_TRANSLATE, _spareScreens[spareIndex]); delete sceneInfo; @@ -409,7 +409,7 @@ void TextView::doFrame() { Common::copy(srcP, srcP + MADS_SCREEN_WIDTH, destP); } - Common::copy(linesTemp, linesTemp + _pan.y * MADS_SCREEN_WIDTH, + Common::copy(linesTemp, linesTemp + _pan.y * MADS_SCREEN_WIDTH, (byte *)scene._backgroundSurface.getPixels()); delete[] linesTemp; } @@ -429,7 +429,7 @@ void TextView::doFrame() { if (tl._pos.y < 0) { _textLines.remove_at(i); } else { - tl._textDisplayIndex = scene._textDisplay.add(tl._pos.x, tl._pos.y, + tl._textDisplayIndex = scene._textDisplay.add(tl._pos.x, tl._pos.y, 0x605, -1, tl._line, _font); } } @@ -537,7 +537,7 @@ bool AnimationView::onEvent(Common::Event &event) { void AnimationView::doFrame() { Scene &scene = _vm->_game->_scene; - + if (_resourceIndex == -1 || _currentAnimation->freeFlag()) { if (++_resourceIndex == (int)_resources.size()) { scriptDone(); @@ -565,7 +565,7 @@ void AnimationView::loadNextResource() { if (resEntry._bgFlag) palette.resetGamePalette(1, 8); - palette._mainPalette[253 * 3] = palette._mainPalette[253 * 3 + 1] + palette._mainPalette[253 * 3] = palette._mainPalette[253 * 3 + 1] = palette._mainPalette[253 * 3 + 2] = 0xb4; palette.setPalette(&palette._mainPalette[253 * 3], 253, 1); @@ -587,7 +587,7 @@ void AnimationView::loadNextResource() { delete _currentAnimation; _currentAnimation = Animation::init(_vm, &scene); int flags = ANIMFLAG_ANIMVIEW | (resEntry._bgFlag ? ANIMFLAG_LOAD_BACKGROUND : 0); - _currentAnimation->load(scene._backgroundSurface, scene._depthSurface, + _currentAnimation->load(scene._backgroundSurface, scene._depthSurface, resEntry._resourceName, flags, &paletteCycles, _sceneInfo); // Signal for a screen refresh @@ -656,7 +656,7 @@ void AnimationView::processLines() { if (c != '\r' && c != '\0') _currentLine += c; } - + // Process the line while (!_currentLine.empty()) { if (_currentLine.hasPrefix("-")) { @@ -672,7 +672,7 @@ void AnimationView::processLines() { } // Add resource into list along with any set state information - _resources.push_back(ResourceEntry(resName, _sfx, _soundFlag, + _resources.push_back(ResourceEntry(resName, _sfx, _soundFlag, _bgLoadFlag, _showWhiteBars)); // Fx resets between resource entries @@ -753,7 +753,7 @@ int AnimationView::getParameter() { while (!_currentLine.empty()) { char c = _currentLine[0]; - + if (c >= '0' && c <= '9') { _currentLine.deleteChar(0); result = result * 10 + (c - '0'); diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index f51d046951..f5355517bd 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -908,7 +908,7 @@ void GameDialog::refreshText() { } if (!skipFlag) { - _lines[i]._textDisplayIndex = scene._textDisplay.add(_lines[i]._pos.x, _lines[i]._pos.y, + _lines[i]._textDisplayIndex = scene._textDisplay.add(_lines[i]._pos.x, _lines[i]._pos.y, fontColor, _lines[i]._widthAdjust, _lines[i]._msg, _lines[i]._font); } } diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index d00cd87ead..5dbe4da6f0 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -116,7 +116,7 @@ class GameDialog: public FullScreenDialog { Common::String _msg; Font *_font; int _widthAdjust; - + DialogLine(); DialogLine(const Common::String &s); }; @@ -130,7 +130,7 @@ protected: int _menuSpritesIndex; int _lineIndex; int _textLineCount; - + /** * Display the dialog */ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index eae74d6da0..fd669bc5cf 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -625,7 +625,7 @@ void GameNebular::doObjectAction() { _objects.addToInventory(OBJ_DURAFAIL_CELLS); if (_difficulty == DIFFICULTY_HARD) { dialogs.showItem(OBJ_DURAFAIL_CELLS, 416); - } + } _globals[kHandsetCellStatus] = 0; break; case 3: diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index f2f90e2291..28de4e5650 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -48,7 +48,7 @@ MainMenu::MainMenu(MADSEngine *vm): MenuView(vm) { _highlightedIndex = -1; _selectedIndex = -1; _buttonDown = false; - + for (int i = 0; i < 7; ++i) _menuItems[i] = nullptr; } @@ -85,7 +85,7 @@ void MainMenu::display() { Common::Point pt(frame0->_offset.x - (frame0->w / 2), frame0->_offset.y - frame0->h); screenObjects.add( - Common::Rect(pt.x, pt.y + DIALOG_TOP, pt.x + frame0->w, + Common::Rect(pt.x, pt.y + DIALOG_TOP, pt.x + frame0->w, pt.y + frame0->h + DIALOG_TOP), LAYER_GUI, CAT_COMMAND, i); } @@ -126,7 +126,7 @@ void MainMenu::doFrame() { // If the user has chosen to skip the animation, show the full menu immediately if (_skipFlag && _menuItemIndex >= 0) { - // Quickly loop through all the menu items to display each's final frame + // Quickly loop through all the menu items to display each's final frame for (; _menuItemIndex < 6; ++_menuItemIndex) { if (_menuItemIndex == 4 && !shouldShowQuotes()) continue; @@ -161,7 +161,7 @@ void MainMenu::doFrame() { void MainMenu::addSpriteSlot() { Scene &scene = _vm->_game->_scene; SpriteSlots &spriteSlots = scene._spriteSlots; - + int seqIndex = (_menuItemIndex < 6) ? _menuItemIndex : _frameIndex; spriteSlots.deleteTimer(seqIndex); @@ -255,7 +255,7 @@ bool MainMenu::onEvent(Common::Event &event) { } return true; - case Common::EVENT_MOUSEMOVE: + case Common::EVENT_MOUSEMOVE: if (_buttonDown) { int menuIndex = getHighlightedItem(event.mouse); if (menuIndex != _highlightedIndex) { @@ -287,7 +287,7 @@ bool MainMenu::onEvent(Common::Event &event) { default: break; } - + return false; } @@ -317,7 +317,7 @@ void MainMenu::handleAction(MADSGameAction action) { break; case RESUME_GAME: - // The original resumed the most recently saved game. Instead, + // The original resumed the most recently saved game. Instead, // just show the load game scren _vm->_dialogs->_pendingDialog = DIALOG_RESTORE; return; @@ -354,7 +354,7 @@ void AdvertView::show() { uint32 expiryTime = g_system->getMillis() + 10 * 1000; _vm->_palette->resetGamePalette(4, 8); - + // Load the advert background onto the screen SceneInfo *sceneInfo = SceneInfo::init(_vm); sceneInfo->load(screenId, 0, Common::String(), 0, _vm->_game->_scene._depthSurface, diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 13ee1a3dc1..679039535f 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -3155,7 +3155,7 @@ bool Scene611::check2ChargedBatteries() { } bool Scene611::check4ChargedBatteries() { - if (_game._objects.isInInventory(OBJ_DURAFAIL_CELLS) && _game._objects.isInInventory(OBJ_PHONE_CELLS) + if (_game._objects.isInInventory(OBJ_DURAFAIL_CELLS) && _game._objects.isInInventory(OBJ_PHONE_CELLS) && _globals[kDurafailRecharged]) return true; diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 930bb7c250..0f019c4b19 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -2616,7 +2616,7 @@ void Scene752::actions() { default: break; } - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._savedFields._mainObjectSource == CAT_HOTSPOT) && + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._savedFields._mainObjectSource == CAT_HOTSPOT) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { switch (_game._trigger) { case 0: diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 14f36756de..62a1a262b0 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -1098,7 +1098,7 @@ void Scene804::actions() { _action.isAction(VERB_OPEN, NOUN_SERVICE_PANEL)) { _scene->_nextSceneId = 805; } else if ((_action.isAction(VERB_ACTIVATE, NOUN_REMOTE)) && _globals[kTopButtonPushed]) { - if (!_globals[kInSpace]) { + if (!_globals[kInSpace]) { // Top button pressed on panel in hanger control if (!_globals[kBeamIsUp]) { _globals[kFromCockpit] = true; diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 1787b3c298..836d04f7c0 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -233,7 +233,7 @@ int PaletteUsage::process(Common::Array<RGB6> &palette, uint flags) { // CHECKME: When pressing on F1 in the first screen, newPalIndex is set to 0xFF at this point // which is a valid value for the index. Maybe a better check would be "< 256" ? //assert(newPalIndex != -1); - + int var52 = (noUsageFlag && palette[palIndex]._u2) ? 2 : 0; _vm->_palette->_palFlags[newPalIndex] |= var52 | rgbMask; @@ -342,7 +342,7 @@ int PaletteUsage::checkRGB(const byte *rgb, int palStart, bool flag, int *palInd if ((!(*flagsP & 1) || flag) && !(*flagsP & 2)) { if (!memcmp(palP, rgb, 3)) { *flagsP |= mask; - + if (palIndex) *palIndex = result; match = true; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index b0a5aa35c6..b5e219ed04 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -264,7 +264,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, assert(asset && _depthStyle != 2); MSprite *spr = asset->getFrame(asset->getCount() - 1); - bgSurface.copyFrom(spr, si._position, si._depth, &depthSurface, + bgSurface.copyFrom(spr, si._position, si._depth, &depthSurface, si._scale, spr->getTransparencyIndex()); } diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 07b1451718..05f00afb5a 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -473,7 +473,7 @@ int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTic int depth = _vm->_game->_scene._depthSurface.getDepth(Common::Point( frame->_offset.x + frame->w / 2, frame->_offset.y + frame->h / 2)); - return add(srcSpriteIndex, flipped, sprites->getCount(), triggerCountdown, timeoutTicks, + return add(srcSpriteIndex, flipped, sprites->getCount(), triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, true, 100, depth - 1, -1, ANIMTYPE_REVERSIBLE, 0, 0); } diff --git a/engines/mortevielle/detection_tables.h b/engines/mortevielle/detection_tables.h index 0aa27b89eb..d244d15365 100644 --- a/engines/mortevielle/detection_tables.h +++ b/engines/mortevielle/detection_tables.h @@ -75,7 +75,7 @@ static const MortevielleGameDescription MortevielleGameDescriptions[] = { // DOS English version doesn't exist. Technically, they are French or German versions, // using English strings stored mort.dat - + // English on top of French version { { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c3d1e4ae8b..5f7f175c26 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -421,7 +421,7 @@ public: byte *_curPict; byte *_curAnim; byte *_rightFramePict; - + PaletteManager _paletteManager; GfxSurface _backgroundSurface; Common::RandomSource _randomSource; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index d5dec6a286..40136ad78b 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -3097,7 +3097,7 @@ void MortevielleEngine::putObject() { */ void MortevielleEngine::addObjectToInventory(int objectId) { int i; - + for (i = 1; (i <= 5) && (_coreVar._inventory[i] != 0); i++) ; diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index 91ab3e767a..7ee6b30311 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -55,7 +55,7 @@ bool Console::Cmd_Scene(int argc, const char **argv) { const char *sceneTypes[] = { "normal", "smacker", "navigation" }; - debugPrintf("Current module: %d, previous module: %d, scene %d (%s scene)\n", currentModule, previousModule, scenenNum, sceneTypes[sceneType]); + debugPrintf("Current module: %d, previous module: %d, scene %d (%s scene)\n", currentModule, previousModule, scenenNum, sceneTypes[sceneType]); if (sceneType == kSceneTypeNormal) { Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject; diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index d53243d4ba..b15bea4a64 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -560,7 +560,7 @@ int NeverhoodAudioStream::readBuffer(int16 *buffer, const int numSamples) { } else { while (samplesRead--) { *buffer++ = READ_LE_UINT16(src); - src += 2; + src += 2; } } diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp index e1b7e25cd5..73c319bd8b 100644 --- a/engines/pegasus/input.cpp +++ b/engines/pegasus/input.cpp @@ -57,7 +57,7 @@ InputDeviceManager::InputDeviceManager() { _keyMap[Common::KEYCODE_p] = false; _keyMap[Common::KEYCODE_TILDE] = false; _keyMap[Common::KEYCODE_BACKQUOTE] = false; - _keyMap[Common::KEYCODE_KP7] = false; + _keyMap[Common::KEYCODE_KP7] = false; _keyMap[Common::KEYCODE_BACKSPACE] = false; _keyMap[Common::KEYCODE_KP_MULTIPLY] = false; _keyMap[Common::KEYCODE_KP9] = false; diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index 0c8ea2e4ee..4262ad4c12 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -979,7 +979,7 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) { resetIntroTimer(); break; case kMenuCmdPauseSave: - result = showSaveDialog(); + result = showSaveDialog(); if (result.getCode() != Common::kUserCanceled) { if (result.getCode() != Common::kNoError) diff --git a/engines/prince/animation.cpp b/engines/prince/animation.cpp index b4bde27f69..aabdd7a623 100644 --- a/engines/prince/animation.cpp +++ b/engines/prince/animation.cpp @@ -132,7 +132,7 @@ int16 Animation::getPhaseOffsetX(int phaseIndex) const { if (phaseIndex < _phaseCount) { return _phaseList[phaseIndex]._phaseOffsetX; } else { - error("getPhaseOffsetX() phaseIndex: %d, phaseCount: %d", phaseIndex, _phaseCount); + error("getPhaseOffsetX() phaseIndex: %d, phaseCount: %d", phaseIndex, _phaseCount); } } @@ -140,7 +140,7 @@ int16 Animation::getPhaseOffsetY(int phaseIndex) const { if (phaseIndex < _phaseCount) { return _phaseList[phaseIndex]._phaseOffsetY; } else { - error("getPhaseOffsetY() phaseIndex: %d, phaseCount: %d", phaseIndex, _phaseCount); + error("getPhaseOffsetY() phaseIndex: %d, phaseCount: %d", phaseIndex, _phaseCount); } } @@ -148,7 +148,7 @@ int16 Animation::getPhaseFrameIndex(int phaseIndex) const { if (phaseIndex < _phaseCount) { return _phaseList[phaseIndex]._phaseToFrameIndex; } else { - error("getPhaseFrameIndex() phaseIndex: %d, phaseCount: %d", phaseIndex, _phaseCount); + error("getPhaseFrameIndex() phaseIndex: %d, phaseCount: %d", phaseIndex, _phaseCount); } } diff --git a/engines/prince/animation.h b/engines/prince/animation.h index 733acb399c..3471ffa158 100644 --- a/engines/prince/animation.h +++ b/engines/prince/animation.h @@ -35,7 +35,7 @@ public: Animation(); ~Animation(); bool loadStream(Common::SeekableReadStream &stream); - + int16 getLoopCount() const; int32 getPhaseCount() const; int32 getFrameCount() const; diff --git a/engines/prince/archive.cpp b/engines/prince/archive.cpp index ae6a2b7546..a01f824df8 100644 --- a/engines/prince/archive.cpp +++ b/engines/prince/archive.cpp @@ -64,7 +64,7 @@ bool PtcArchive::open(const Common::String &filename) { byte *fileTableEnd = fileTable + fileTableSize; _stream->read(fileTable, fileTableSize); decrypt(fileTable, fileTableSize); - + for (byte *fileItem = fileTable; fileItem < fileTableEnd; fileItem += 32) { FileEntry item; Common::String name = (const char*)fileItem; @@ -79,6 +79,28 @@ bool PtcArchive::open(const Common::String &filename) { return true; } +bool PtcArchive::openTranslation(const Common::String &filename) { + _stream = SearchMan.createReadStreamForMember(filename); + if (!_stream) + return false; + + Common::Array<Common::String> translationNames; + Common::String translationFileName; + const int kTranslationFiles = 5; + for (int i = 0; i < kTranslationFiles; i++) { + translationFileName = _stream->readLine(); + translationNames.push_back(translationFileName); + } + FileEntry item; + for (int i = 0; i < kTranslationFiles; i++) { + item._offset = _stream->readUint32LE(); + item._size = _stream->readUint32LE(); + _items[translationNames[i]] = item; + } + + return true; +} + void PtcArchive::close() { delete _stream; _stream = nullptr; diff --git a/engines/prince/archive.h b/engines/prince/archive.h index e211036ed6..a640b77911 100644 --- a/engines/prince/archive.h +++ b/engines/prince/archive.h @@ -35,6 +35,7 @@ public: ~PtcArchive(); bool open(const Common::String &filename); + bool openTranslation(const Common::String &filename); void close(); bool isOpen() const { return _stream != 0; } diff --git a/engines/prince/cursor.h b/engines/prince/cursor.h index 9387f344dc..fb07d01729 100644 --- a/engines/prince/cursor.h +++ b/engines/prince/cursor.h @@ -30,7 +30,7 @@ namespace Prince { class Cursor { -public: +public: Cursor(); ~Cursor(); diff --git a/engines/prince/detection.h b/engines/prince/detection.h index 5cc0d32be4..7e5bdd6b7b 100644 --- a/engines/prince/detection.h +++ b/engines/prince/detection.h @@ -28,9 +28,15 @@ namespace Prince { +enum PrinceGameType { + kPrinceDataUNK, + kPrinceDataDE, + kPrinceDataPL +}; + struct PrinceGameDescription { ADGameDescription desc; - int gameType; + PrinceGameType gameType; }; static const PlainGameDescriptor princeGames[] = { @@ -49,7 +55,7 @@ static const PrinceGameDescription gameDescriptions[] = { ADGF_TESTING, GUIO1(GUIO_NONE) }, - 0 + kPrinceDataDE }, { { @@ -61,9 +67,33 @@ static const PrinceGameDescription gameDescriptions[] = { ADGF_TESTING, GUIO1(GUIO_NONE) }, - 1 + kPrinceDataPL + }, + { + { + "prince", + "The Prince and the Coward", + AD_ENTRY1s("databank.ptc", "5fa03833177331214ec1354761b1d2ee", 3565031), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_TESTING, + GUIO1(GUIO_NONE) + }, + kPrinceDataDE + }, + { + { + "prince", + "The Prince and the Coward", + AD_ENTRY1s("databank.ptc", "48ec9806bda9d152acbea8ce31c93c49", 3435298), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_TESTING, + GUIO1(GUIO_NONE) + }, + kPrinceDataPL }, - { AD_TABLE_END_MARKER, 0 } + { AD_TABLE_END_MARKER, kPrinceDataUNK } }; const static char *directoryGlobs[] = { diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp index ad6a2ff85c..f556d81eab 100644 --- a/engines/prince/graphics.cpp +++ b/engines/prince/graphics.cpp @@ -194,7 +194,7 @@ void GraphicsMan::drawTransparentDrawNode(Graphics::Surface *screen, DrawNode *d /** * Similar to drawTransparentDrawNode but with additional anti-aliasing code for sprite drawing. * Edge smoothing is based on 256 x 256 table of colors transition. - * Algorithm is checking if currently drawing pixel is located next to the edge of sprite and if it makes jagged line. + * Algorithm is checking if currently drawing pixel is located next to the edge of sprite and if it makes jagged line. * If it does then this pixel is set with color from transition table calculated of original background pixel color * and sprite's edge pixel color. */ diff --git a/engines/prince/graphics.h b/engines/prince/graphics.h index b6f002b7da..1a1737f976 100644 --- a/engines/prince/graphics.h +++ b/engines/prince/graphics.h @@ -35,7 +35,7 @@ class GraphicsMan { public: GraphicsMan(PrinceEngine *vm); ~GraphicsMan(); - + void update(Graphics::Surface *screen); void change(); diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp index 146470f6b7..b873e83360 100644 --- a/engines/prince/hero.cpp +++ b/engines/prince/hero.cpp @@ -129,7 +129,7 @@ int Hero::getScaledValue(int size) { Graphics::Surface *Hero::zoomSprite(Graphics::Surface *heroFrame) { Graphics::Surface *zoomedFrame = new Graphics::Surface(); zoomedFrame->create(_scaledFrameXSize, _scaledFrameYSize, Graphics::PixelFormat::createFormatCLUT8()); - + int sprZoomX; int sprZoomY = _vm->_scaleValue; uint xSource = 0; diff --git a/engines/prince/hero.h b/engines/prince/hero.h index d5f7d8cc7a..703ef0650d 100644 --- a/engines/prince/hero.h +++ b/engines/prince/hero.h @@ -129,7 +129,7 @@ public: void drawHeroShadow(Graphics::Surface *heroFrame); void freeOldMove(); void freeHeroAnim(); - + uint16 _number; uint16 _visible; int16 _state; @@ -170,7 +170,7 @@ public: int _color; // subtitles color uint32 _animSetNr; // number of animation set Common::Array<Animation *> _moveSet; // MoveAnims MoveSet - + uint32 _moveDelay; uint32 _shadMinus; diff --git a/engines/prince/mhwanh.cpp b/engines/prince/mhwanh.cpp index ef94ef71f9..608ccc23d7 100644 --- a/engines/prince/mhwanh.cpp +++ b/engines/prince/mhwanh.cpp @@ -38,7 +38,7 @@ MhwanhDecoder::~MhwanhDecoder() { void MhwanhDecoder::destroy() { if (_surface != nullptr) { _surface->free(); - delete _surface; + delete _surface; _surface = nullptr; } if (_palette != nullptr) { @@ -57,7 +57,7 @@ bool MhwanhDecoder::loadStream(Common::SeekableReadStream &stream) { _palette[i * 3] = stream.readByte(); _palette[i * 3 + 1] = stream.readByte(); _palette[i * 3 + 2] = stream.readByte(); - } + } _surface = new Graphics::Surface(); _surface->create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/prince/mob.h b/engines/prince/mob.h index cc60e36f9b..0ea610dd8f 100644 --- a/engines/prince/mob.h +++ b/engines/prince/mob.h @@ -50,7 +50,7 @@ public: void setData(AttrId dataId, uint16 value); uint16 getData(AttrId dataId); - bool _visible; + bool _visible; uint16 _type; uint16 _mask; Common::Rect _rect; diff --git a/engines/prince/object.cpp b/engines/prince/object.cpp index a9a96455b1..2dc5da68e7 100644 --- a/engines/prince/object.cpp +++ b/engines/prince/object.cpp @@ -79,7 +79,7 @@ bool Object::loadFromStream(Common::SeekableReadStream &stream) { _flags = stream.readUint16LE(); _z = stream.readUint16LE(); - + stream.seek(pos + 16); return true; diff --git a/engines/prince/object.h b/engines/prince/object.h index 68edd061a0..ff22a05805 100644 --- a/engines/prince/object.h +++ b/engines/prince/object.h @@ -62,7 +62,7 @@ public: private: void loadSurface(Common::SeekableReadStream &stream); - Graphics::Surface *_surface; + Graphics::Surface *_surface; }; } // End of namespace Prince diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index b0f2cd5056..00e1736c46 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -61,6 +61,7 @@ #include "prince/animation.h" #include "prince/option_text.h" #include "prince/curve_values.h" +#include "prince/detection.h" namespace Prince { @@ -95,7 +96,8 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) _tracePointFirstPointFlag(false), _coordsBuf2(nullptr), _coords2(nullptr), _coordsBuf3(nullptr), _coords3(nullptr), _shanLen(0), _directionTable(nullptr), _currentMidi(0), _lightX(0), _lightY(0), _curveData(nullptr), _curvPos(0), _creditsData(nullptr), _creditsDataSize(0), _currentTime(0), _zoomBitmap(nullptr), _shadowBitmap(nullptr), _transTable(nullptr), - _flcFrameSurface(nullptr), _shadScaleValue(0), _shadLineLen(0), _scaleValue(0), _dialogImage(nullptr) { + _flcFrameSurface(nullptr), _shadScaleValue(0), _shadLineLen(0), _scaleValue(0), _dialogImage(nullptr), _mobTranslationData(nullptr), + _mobTranslationSize(0) { // Debug/console setup DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel"); @@ -204,6 +206,8 @@ PrinceEngine::~PrinceEngine() { _dialogImage->free(); delete _dialogImage; } + + free(_mobTranslationData); } GUI::Debugger *PrinceEngine::getDebugger() { @@ -213,11 +217,11 @@ GUI::Debugger *PrinceEngine::getDebugger() { void PrinceEngine::init() { const Common::FSNode gameDataDir(ConfMan.get("path")); - + debugEngine("Adding all path: %s", gameDataDir.getPath().c_str()); PtcArchive *all = new PtcArchive(); - if (!all->open("all/databank.ptc")) + if (!all->open("all/databank.ptc")) error("Can't open all/databank.ptc"); PtcArchive *voices = new PtcArchive(); @@ -228,11 +232,20 @@ void PrinceEngine::init() { if (!sound->open("sound/databank.ptc")) error("Can't open sound/databank.ptc"); + PtcArchive *translation = new PtcArchive(); + if (getLanguage() != Common::PL_POL && getLanguage() != Common::DE_DEU) { + if (!translation->openTranslation("all/prince_translation.dat")) + error("Can't open prince_translation.dat"); + } + SearchMan.addSubDirectoryMatching(gameDataDir, "all"); SearchMan.add("all", all); SearchMan.add("voices", voices); SearchMan.add("sound", sound); + if (getLanguage() != Common::PL_POL && getLanguage() != Common::DE_DEU) { + SearchMan.add("translation", translation); + } _graph = new GraphicsMan(this); @@ -261,14 +274,24 @@ void PrinceEngine::init() { _variaTxt = new VariaTxt(); Resource::loadResource(_variaTxt, "variatxt.dat", true); - + if (getLanguage() == Common::PL_POL || getLanguage() == Common::DE_DEU) { + Resource::loadResource(_variaTxt, "variatxt.dat", true); + } else { + Resource::loadResource(_variaTxt, "variatxt_translate.dat", true); + } + _cursor1 = new Cursor(); Resource::loadResource(_cursor1, "mouse1.cur", true); _cursor3 = new Cursor(); Resource::loadResource(_cursor3, "mouse2.cur", true); - Common::SeekableReadStream *talkTxtStream = SearchMan.createReadStreamForMember("talktxt.dat"); + Common::SeekableReadStream *talkTxtStream; + if (getLanguage() == Common::PL_POL || getLanguage() == Common::DE_DEU) { + talkTxtStream = SearchMan.createReadStreamForMember("talktxt.dat"); + } else { + talkTxtStream = SearchMan.createReadStreamForMember("talktxt_translate.dat"); + } if (!talkTxtStream) { error("Can't load talkTxtStream"); return; @@ -279,7 +302,12 @@ void PrinceEngine::init() { delete talkTxtStream; - Common::SeekableReadStream *invTxtStream = SearchMan.createReadStreamForMember("invtxt.dat"); + Common::SeekableReadStream *invTxtStream; + if (getLanguage() == Common::PL_POL || getLanguage() == Common::DE_DEU) { + invTxtStream = SearchMan.createReadStreamForMember("invtxt.dat"); + } else { + invTxtStream = SearchMan.createReadStreamForMember("invtxt_translate.dat"); + } if (!invTxtStream) { error("Can't load invTxtStream"); return; @@ -354,7 +382,12 @@ void PrinceEngine::init() { _shadowLine = (byte *)malloc(kShadowLineArraySize); - Common::SeekableReadStream *creditsDataStream = SearchMan.createReadStreamForMember("credits.dat"); + Common::SeekableReadStream *creditsDataStream; + if (getLanguage() == Common::PL_POL || getLanguage() == Common::DE_DEU) { + creditsDataStream = SearchMan.createReadStreamForMember("credits.dat"); + } else { + creditsDataStream = SearchMan.createReadStreamForMember("credits_translate.dat"); + } if (!creditsDataStream) { error("Can't load creditsDataStream"); return; @@ -363,6 +396,10 @@ void PrinceEngine::init() { _creditsData = (byte *)malloc(_creditsDataSize); creditsDataStream->read(_creditsData, _creditsDataSize); delete creditsDataStream; + + if (getLanguage() != Common::PL_POL && getLanguage() != Common::DE_DEU) { + loadMobTranslationTexts(); + } } void PrinceEngine::showLogo() { @@ -469,13 +506,17 @@ bool PrinceEngine::loadLocation(uint16 locationNr) { loadMobPriority("mobpri"); _mobList.clear(); - if (getLanguage() == Common::DE_DEU) { + if (getGameType() == kPrinceDataDE) { const Common::String mobLstName = Common::String::format("mob%02d.lst", _locationNr); debug("name: %s", mobLstName.c_str()); Resource::loadResource(_mobList, mobLstName.c_str(), false); - } else { + } else if (getGameType() == kPrinceDataPL) { Resource::loadResource(_mobList, "mob.lst", false); } + if (getLanguage() != Common::PL_POL && getLanguage() != Common::DE_DEU) { + // update Mob texts for translated version + setMobTranslationTexts(); + } _animList.clear(); Resource::loadResource(_animList, "anim.lst", false); @@ -705,7 +746,7 @@ void PrinceEngine::freeAllSamples() { } bool PrinceEngine::loadSample(uint32 sampleSlot, const Common::String &streamName) { - // FIXME: This is just a workaround streamName is a path + // FIXME: This is just a workaround streamName is a path // SOUND\\SCIERKA1.WAV for now only last path component is used Common::String normalizedPath = lastPathComponent(streamName, '\\'); @@ -756,7 +797,7 @@ bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::Strin } id = sampleStream->readUint32LE(); - debugEngine("SetVoice slot %d time %04x", slot, id); + debugEngine("SetVoice slot %d time %04x", slot, id); id <<= 3; id /= 22050; id += 2; @@ -768,7 +809,7 @@ bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::Strin _secondHero->_talkTime = id; } - debugEngine("SetVoice slot %d time %04x", slot, id); + debugEngine("SetVoice slot %d time %04x", slot, id); sampleStream->seek(SEEK_SET); _audioStream[sampleSlot] = Audio::makeWAVStream(sampleStream, DisposeAfterUse::NO); delete sampleStream; @@ -947,6 +988,45 @@ bool PrinceEngine::loadMobPriority(const char *resourceName) { return true; } +void PrinceEngine::loadMobTranslationTexts() { + Common::SeekableReadStream *mobTranslationStream = SearchMan.createReadStreamForMember("mob_translate.dat"); + if (!mobTranslationStream) { + error("Can't load mob_translate.dat"); + } + _mobTranslationSize = mobTranslationStream->size(); + _mobTranslationData = (byte *)malloc(_mobTranslationSize); + mobTranslationStream->read(_mobTranslationData, _mobTranslationSize); + delete mobTranslationStream; +} + +void PrinceEngine::setMobTranslationTexts() { + int locationOffset = READ_UINT16(_mobTranslationData + (_locationNr - 1) * 2); + if (locationOffset) { + byte *locationText = _mobTranslationData + locationOffset; + for (uint i = 0; i < _mobList.size(); i++) { + byte c; + locationText++; + _mobList[i]._name.clear(); + while ((c = *locationText)) { + _mobList[i]._name += c; + locationText++; + } + locationText++; + _mobList[i]._examText.clear(); + c = *locationText; + locationText++; + if (c) { + _mobList[i]._examText += c; + do { + c = *locationText; + _mobList[i]._examText += c; + locationText++; + } while (c != 255); + } + } + } +} + void PrinceEngine::keyHandler(Common::Event event) { uint16 nChar = event.kbd.keycode; switch (nChar) { @@ -4321,7 +4401,7 @@ int PrinceEngine::scanDirectionsFindNext(byte *tempCoordsBuf, int xDiff, int yDi tempCoordsBuf += 4; if (tempCoordsBuf == _coords) { - direction = tempX; + direction = tempX; break; } diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 0e5bf97dde..48491c63bd 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -242,7 +242,7 @@ struct DebugChannel { enum Type { kScript, - kEngine + kEngine }; }; @@ -285,6 +285,9 @@ public: uint32 _talkTxtSize; byte *_talkTxt; + uint32 _mobTranslationSize; + byte *_mobTranslationData; + bool loadLocation(uint16 locationNr); bool loadAnim(uint16 animNr, bool loop); bool loadVoice(uint32 textSlot, uint32 sampleSlot, const Common::String &name); @@ -294,6 +297,9 @@ public: bool loadTrans(byte *transTable, const char *resourceName); bool loadMobPriority(const char *resourceName); + void loadMobTranslationTexts(); + void setMobTranslationTexts(); + bool loadMusic(int musNumber); void stopMusic(); @@ -658,7 +664,7 @@ private: Common::Array<Mob> _invMobList; bool _flicLooped; - + void mainLoop(); }; diff --git a/engines/prince/pscr.h b/engines/prince/pscr.h index d59fa37d81..fdcdb524a9 100644 --- a/engines/prince/pscr.h +++ b/engines/prince/pscr.h @@ -40,7 +40,7 @@ public: Graphics::Surface *getSurface() const { return _surface; } private: void loadSurface(Common::SeekableReadStream &stream); - Graphics::Surface *_surface; + Graphics::Surface *_surface; }; } // End of namespace Prince diff --git a/engines/prince/resource.h b/engines/prince/resource.h index b1fbd9c4f0..f42eb87842 100644 --- a/engines/prince/resource.h +++ b/engines/prince/resource.h @@ -41,13 +41,13 @@ namespace Resource { bool loadResource(T *resource, const char *resourceName, bool required) { Common::ScopedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(resourceName)); if (!stream) { - if (required) + if (required) error("Can't load %s", resourceName); return false; } return loadFromStream(*resource, *stream); - } + } template <typename T> bool loadResource(Common::Array<T> &array, Common::SeekableReadStream &stream, bool required = true) { @@ -82,7 +82,7 @@ namespace Resource { } // FIXME: This is stupid. Maybe loadFromStream should be helper method that returns initiailzed object - while (true) { + while (true) { T* t = new T(); if (!t->loadFromStream(*stream)) { delete t; diff --git a/engines/prince/saveload.cpp b/engines/prince/saveload.cpp index 39a4002b40..706079ffaf 100644 --- a/engines/prince/saveload.cpp +++ b/engines/prince/saveload.cpp @@ -480,7 +480,7 @@ bool PrinceEngine::loadGame(int slotNumber) { saveFile->read(dataBuffer, size); readStream = new Common::MemoryReadStream(dataBuffer, size, DisposeAfterUse::YES); delete saveFile; - + // Check to see if it's a ScummVM savegame or not char buffer[kSavegameStrSize + 1]; readStream->read(buffer, kSavegameStrSize + 1); @@ -507,7 +507,7 @@ bool PrinceEngine::loadGame(int slotNumber) { // TODO //syncSpeechSettings(); - + return true; } diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index d1a0034940..deb52d7622 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -43,7 +43,7 @@ Room::Room() {} bool Room::loadRoom(byte *roomData) { int roomSize = 64; Common::MemoryReadStream roomStream(roomData, roomSize); - + _mobs = roomStream.readSint32LE(); _backAnim = roomStream.readSint32LE(); _obj = roomStream.readSint32LE(); @@ -131,7 +131,7 @@ bool Script::loadStream(Common::SeekableReadStream &stream) { _scriptInfo.invObjGive = scriptDataStream.readSint32LE(); _scriptInfo.stdGiveItem = scriptDataStream.readSint32LE(); _scriptInfo.goTester = scriptDataStream.readSint32LE(); - + return true; } @@ -427,7 +427,7 @@ int32 InterpreterFlags::getFlagValue(Flags::Id flagId) { return _flags[(uint32)flagId - kFlagMask]; } -Interpreter::Interpreter(PrinceEngine *vm, Script *script, InterpreterFlags *flags) : +Interpreter::Interpreter(PrinceEngine *vm, Script *script, InterpreterFlags *flags) : _vm(vm), _script(script), _flags(flags), _stacktop(0), _opcodeNF(false), _opcodeEnd(false), _waitFlag(0), _result(true) { @@ -479,8 +479,8 @@ uint32 Interpreter::step(uint32 opcodePC) { if (_lastOpcode >= kNumOpcodes) error( - "Trying to execute unknown opcode @0x%04X: %02d", - _currentInstruction, + "Trying to execute unknown opcode @0x%04X: %02d", + _currentInstruction, _lastOpcode); // Execute the current opcode @@ -570,7 +570,7 @@ int32 Interpreter::readScriptFlagValue() { return value; } -Flags::Id Interpreter::readScriptFlagId() { +Flags::Id Interpreter::readScriptFlagId() { return (Flags::Id)readScript16(); } @@ -1689,7 +1689,7 @@ void Interpreter::O_POPSTRING() { void Interpreter::O_SETFGCODE() { int32 offset = readScript32(); - _fgOpcodePC = _currentInstruction + offset - 4; + _fgOpcodePC = _currentInstruction + offset - 4; debugInterpreter("O_SETFGCODE next %08x, offset %08x", _fgOpcodePC, offset); } diff --git a/engines/saga/introproc_ite.cpp b/engines/saga/introproc_ite.cpp index 0c1a2ce233..0b129dbcc0 100644 --- a/engines/saga/introproc_ite.cpp +++ b/engines/saga/introproc_ite.cpp @@ -374,7 +374,7 @@ int Scene::ITEIntroCaveCommonProc(int param, int caveScene) { lang = 2; int n_dialogues = 0; - + switch (caveScene) { case 1: n_dialogues = ARRAYSIZE(introDialogueCave1[lang]); diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 565e9752c3..e233c4cba4 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -485,6 +485,7 @@ bool Console::cmdGetVersion(int argc, const char **argv) { #endif debugPrintf("View type: %s\n", viewTypeDesc[g_sci->getResMan()->getViewType()]); debugPrintf("Uses palette merging: %s\n", g_sci->_gfxPalette->isMerging() ? "yes" : "no"); + debugPrintf("Uses 16 bit color matching: %s\n", g_sci->_gfxPalette->isUsing16bitColorMatch() ? "yes" : "no"); debugPrintf("Resource volume version: %s\n", g_sci->getResMan()->getVolVersionDesc()); debugPrintf("Resource map version: %s\n", g_sci->getResMan()->getMapVersionDesc()); debugPrintf("Contains selector vocabulary (vocab.997): %s\n", hasVocab997 ? "yes" : "no"); @@ -663,7 +664,7 @@ bool Console::cmdDiskDump(int argc, const char **argv) { int resNumFrom = 0; int resNumTo = 0; int resNumCur = 0; - + if (argc != 3) { debugPrintf("Dumps the specified resource to disk as a patch file\n"); debugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]); @@ -671,7 +672,7 @@ bool Console::cmdDiskDump(int argc, const char **argv) { cmdResourceTypes(argc, argv); return true; } - + if (strcmp(argv[2], "*") == 0) { resNumFrom = 0; resNumTo = 65535; diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index dddf845222..a65bcb7df5 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -145,7 +145,7 @@ public: */ Kernel(ResourceManager *resMan, SegManager *segMan); ~Kernel(); - + void init(); uint getSelectorNamesSize() const; @@ -161,7 +161,7 @@ public: * @return The appropriate selector ID, or -1 on error */ int findSelector(const char *selectorName) const; - + bool selectorNamesAvailable(); // Script dissection/dumping functions diff --git a/engines/sci/engine/script_patches.h b/engines/sci/engine/script_patches.h index 0b35792949..7023ef327e 100644 --- a/engines/sci/engine/script_patches.h +++ b/engines/sci/engine/script_patches.h @@ -98,7 +98,7 @@ private: void enablePatch(const SciScriptPatcherEntry *patchTable, const char *searchDescription); int32 findSignature(const SciScriptPatcherEntry *patchEntry, SciScriptPatcherRuntimeEntry *runtimeEntry, const byte *scriptData, const uint32 scriptSize, bool isMacSci11); void applyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, bool isMacSci11); - + Selector *_selectorIdTable; SciScriptPatcherRuntimeEntry *_runtimeTable; }; diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp index 7d106b5b02..a210a469f1 100644 --- a/engines/sci/graphics/paint32.cpp +++ b/engines/sci/graphics/paint32.cpp @@ -46,7 +46,7 @@ void GfxPaint32::fillRect(Common::Rect rect, byte color) { Common::Rect clipRect = rect; clipRect.clip(_screen->getWidth(), _screen->getHeight()); - + for (y = clipRect.top; y < clipRect.bottom; y++) { for (x = clipRect.left; x < clipRect.right; x++) { _screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, color, 0, 0); diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index a3624c7959..59abef5550 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -65,14 +65,21 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen) // the real merging done in earlier games. If we use the copying over, we // will get issues because some views have marked all colors as being used // and those will overwrite the current palette in that case - if (getSciVersion() < SCI_VERSION_1_1) + if (getSciVersion() < SCI_VERSION_1_1) { _useMerging = true; - else if (getSciVersion() == SCI_VERSION_1_1) + _use16bitColorMatch = true; + } else if (getSciVersion() == SCI_VERSION_1_1) { // there are some games that use inbetween SCI1.1 interpreter, so we have // to detect if the current game is merging or copying _useMerging = _resMan->detectPaletteMergingSci11(); - else // SCI32 + _use16bitColorMatch = _useMerging; + // Note: Laura Bow 2 floppy uses the new palette format and is detected + // as 8 bit color matching because of that. + } else { + // SCI32 _useMerging = false; + _use16bitColorMatch = false; // not verified that SCI32 uses 8-bit color matching + } palVaryInit(); @@ -120,6 +127,10 @@ bool GfxPalette::isMerging() { return _useMerging; } +bool GfxPalette::isUsing16bitColorMatch() { + return _use16bitColorMatch; +} + // meant to get called only once during init of engine void GfxPalette::setDefault() { if (_resMan->getViewType() == kViewEga) @@ -464,8 +475,8 @@ bool GfxPalette::merge(Palette *newPalette, bool force, bool forceRealMerge) { // check if exact color could be matched res = matchColor(newPalette->colors[i].r, newPalette->colors[i].g, newPalette->colors[i].b); - if (res & 0x8000) { // exact match was found - newPalette->mapping[i] = res & 0xFF; + if (res & SCI_PALETTE_MATCH_PERFECT) { // exact match was found + newPalette->mapping[i] = res & SCI_PALETTE_MATCH_COLORMASK; continue; } @@ -486,8 +497,8 @@ bool GfxPalette::merge(Palette *newPalette, bool force, bool forceRealMerge) { // if still no luck - set an approximate color if (j == 256) { - newPalette->mapping[i] = res & 0xFF; - _sysPalette.colors[res & 0xFF].used |= 0x10; + newPalette->mapping[i] = res & SCI_PALETTE_MATCH_COLORMASK; + _sysPalette.colors[res & SCI_PALETTE_MATCH_COLORMASK].used |= 0x10; } } @@ -509,29 +520,47 @@ void GfxPalette::drewPicture(GuiResourceId pictureId) { } } -uint16 GfxPalette::matchColor(byte r, byte g, byte b) { - byte found = 0xFF; - int diff = 0x2FFFF, cdiff; - int16 dr,dg,db; - - for (int i = 1; i < 255; i++) { - if ((!_sysPalette.colors[i].used)) - continue; - dr = _sysPalette.colors[i].r - r; - dg = _sysPalette.colors[i].g - g; - db = _sysPalette.colors[i].b - b; -// minimum squares match - cdiff = (dr*dr) + (dg*dg) + (db*db); -// minimum sum match (Sierra's) -// cdiff = ABS(dr) + ABS(dg) + ABS(db); - if (cdiff < diff) { - if (cdiff == 0) - return i | 0x8000; // setting this flag to indicate exact match - found = i; - diff = cdiff; +uint16 GfxPalette::matchColor(byte matchRed, byte matchGreen, byte matchBlue) { + int16 colorNr; + int16 differenceRed, differenceGreen, differenceBlue; + int16 differenceTotal = 0; + int16 bestDifference = 0x7FFF; + uint16 bestColorNr = 255; + + if (_use16bitColorMatch) { + // used by SCI0 to SCI1, also by the first few SCI1.1 games + for (colorNr = 0; colorNr < 256; colorNr++) { + if ((!_sysPalette.colors[colorNr].used)) + continue; + differenceRed = ABS(_sysPalette.colors[colorNr].r - matchRed); + differenceGreen = ABS(_sysPalette.colors[colorNr].g - matchGreen); + differenceBlue = ABS(_sysPalette.colors[colorNr].b - matchBlue); + differenceTotal = differenceRed + differenceGreen + differenceBlue; + if (differenceTotal <= bestDifference) { + bestDifference = differenceTotal; + bestColorNr = colorNr; + } + } + } else { + // SCI1.1, starting with QfG3 introduced a bug in the matching code + // we have to implement it as well, otherwise some colors will be "wrong" in comparison to the original interpreter + // See Space Quest 5 bug #6455 + for (colorNr = 0; colorNr < 256; colorNr++) { + if ((!_sysPalette.colors[colorNr].used)) + continue; + differenceRed = (uint8)ABS<int8>(_sysPalette.colors[colorNr].r - matchRed); + differenceGreen = (uint8)ABS<int8>(_sysPalette.colors[colorNr].g - matchGreen); + differenceBlue = (uint8)ABS<int8>(_sysPalette.colors[colorNr].b - matchBlue); + differenceTotal = differenceRed + differenceGreen + differenceBlue; + if (differenceTotal <= bestDifference) { + bestDifference = differenceTotal; + bestColorNr = colorNr; + } } } - return found; + if (differenceTotal == 0) // original interpreter does not do this, instead it does 2 calls for merges in the worst case + return bestColorNr | SCI_PALETTE_MATCH_PERFECT; // we set this flag, so that we can optimize during palette merge + return bestColorNr; } void GfxPalette::getSys(Palette *pal) { @@ -621,7 +650,7 @@ void GfxPalette::kernelSetIntensity(uint16 fromColor, uint16 toColor, uint16 int } int16 GfxPalette::kernelFindColor(uint16 r, uint16 g, uint16 b) { - return matchColor(r, g, b) & 0xFF; + return matchColor(r, g, b) & SCI_PALETTE_MATCH_COLORMASK; } // Returns true, if palette got changed diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 347695deb8..500a45eccf 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -31,6 +31,10 @@ namespace Sci { class ResourceManager; class GfxScreen; +// Special flag implemented by us for optimization in palette merge +#define SCI_PALETTE_MATCH_PERFECT 0x8000 +#define SCI_PALETTE_MATCH_COLORMASK 0xFF + enum ColorRemappingType { kRemappingNone = 0, kRemappingByRange = 1, @@ -46,6 +50,7 @@ public: ~GfxPalette(); bool isMerging(); + bool isUsing16bitColorMatch(); void setDefault(); void createFromData(byte *data, int bytesLeft, Palette *paletteOut); @@ -124,6 +129,7 @@ private: bool _sysPaletteChanged; bool _useMerging; + bool _use16bitColorMatch; Common::Array<PalSchedule> _schedules; diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index 434a490109..d751f9738f 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -246,7 +246,7 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos int16 y, lastY, x, leftX, rightX; int pixelCount; uint16 width, height; - + // if the picture is not an overlay and we are also not in EGA mode, use priority 0 if (!isEGA && !_addToFlag) priority = 0; @@ -362,7 +362,7 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos ptr = celBitmap; ptr += skipCelBitmapPixels; ptr += skipCelBitmapLines * width; - + if ((!isEGA) || (priority < 16)) { // VGA + EGA, EGA only checks priority, when given priority is below 16 if (!_mirroredFlag) { diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp index 488450485d..668de616fb 100644 --- a/engines/sci/graphics/portrait.cpp +++ b/engines/sci/graphics/portrait.cpp @@ -134,34 +134,34 @@ void Portrait::init() { // raw lip-sync ID table follows uint32 lipSyncIDTableSize; - + lipSyncIDTableSize = READ_LE_UINT32(data); data += 4; assert( lipSyncIDTableSize == (_lipSyncIDCount * 4) ); _lipSyncIDTable = data; data += lipSyncIDTableSize; - + // raw lip-sync frame table follows uint32 lipSyncDataTableSize; uint32 lipSyncDataTableLastOffset; byte lipSyncData; uint16 lipSyncDataNr; uint16 lipSyncCurOffset; - + lipSyncDataTableSize = READ_LE_UINT32(data); data += 4; assert( lipSyncDataTableSize == 0x220 ); // always this size, just a safety-check - + _lipSyncData = data; lipSyncDataTableLastOffset = lipSyncDataTableSize - 1; _lipSyncDataOffsetTable = new uint16[ _lipSyncIDCount ]; - + lipSyncDataNr = 0; lipSyncCurOffset = 0; while ( (lipSyncCurOffset < lipSyncDataTableSize) && (lipSyncDataNr < _lipSyncIDCount) ) { // We are currently at the start of ID-frame data _lipSyncDataOffsetTable[lipSyncDataNr] = lipSyncCurOffset; - + // Look for end of ID-frame data lipSyncData = *data++; lipSyncCurOffset++; while ( (lipSyncData != 0xFF) && (lipSyncCurOffset < lipSyncDataTableLastOffset) ) { @@ -195,7 +195,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint Resource *syncResource = _resMan->findResource(syncResourceId, true); uint syncOffset = 0; #endif - + #ifdef DEBUG_PORTRAIT // prints out the current lip sync ASCII data char debugPrint[4000]; @@ -246,7 +246,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint warning("kPortrait: no rave resource %d %X", resourceId, audioNumber); return; } - + // Do animation depending on rave resource till audio is done playing int16 raveTicks; uint16 raveID; @@ -264,7 +264,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint raveTicks = raveGetTicks(raveResource, &raveOffset); if (raveTicks < 0) break; - + // get lipSyncID raveID = raveGetID(raveResource, &raveOffset); if (raveID) { @@ -272,7 +272,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint } else { raveLipSyncData = NULL; } - + timerPosition += raveTicks; // Wait till syncTime passed, then show specific animation bitmap @@ -287,7 +287,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint curPosition = _audio->getAudioPosition(); } while ((curPosition != -1) && (curPosition < timerPosition) && (!userAbort)); } - + if (raveLipSyncData) { // lip sync data is // Tick:Byte, Bitmap-Nr:BYTE @@ -308,7 +308,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint } while ((curPosition != -1) && (curPosition < timerPositionWithin) && (!userAbort)); raveLipSyncBitmapNr = *raveLipSyncData++; - + // bitmap nr within sync data is base 1, we need base 0 raveLipSyncBitmapNr--; @@ -319,7 +319,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint } else { warning("kPortrait: rave lip sync data tried to draw non-existent bitmap %d", raveLipSyncBitmapNr); } - + raveLipSyncTicks = *raveLipSyncData++; } } @@ -372,7 +372,7 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint } } #endif - + // Reset the portrait bitmap to "closed mouth" state (rave.dll seems to do the same) drawBitmap(0); bitsShow(); @@ -393,10 +393,10 @@ int16 Portrait::raveGetTicks(Resource *resource, uint *offset) { byte *curData = resource->data + curOffset; byte curByte; uint16 curValue = 0; - + if (curOffset >= resource->size) return -1; - + while (curOffset < resource->size) { curByte = *curData++; curOffset++; if ( curByte == ' ' ) @@ -418,7 +418,7 @@ uint16 Portrait::raveGetID(Resource *resource, uint *offset) { byte *curData = resource->data + curOffset; byte curByte = 0; uint16 curValue = 0; - + while (curOffset < resource->size) { curByte = *curData++; curOffset++; if ( curByte == ' ' ) @@ -429,7 +429,7 @@ uint16 Portrait::raveGetID(Resource *resource, uint *offset) { curValue |= curByte; } } - + *offset = curOffset; return curValue; } @@ -440,17 +440,17 @@ byte *Portrait::raveGetLipSyncData(uint16 raveID) { byte *lipSyncIDPtr = _lipSyncIDTable; byte lipSyncIDByte1, lipSyncIDByte2; uint16 lipSyncID; - + lipSyncIDPtr++; // skip over first byte while (lipSyncIDNr < _lipSyncIDCount) { lipSyncIDByte1 = *lipSyncIDPtr++; lipSyncIDByte2 = *lipSyncIDPtr++; lipSyncID = ( lipSyncIDByte1 << 8 ) | lipSyncIDByte2; - + if ( lipSyncID == raveID ) { return _lipSyncData + _lipSyncDataOffsetTable[lipSyncIDNr]; } - + lipSyncIDNr++; lipSyncIDPtr += 2; // ID is every 4 bytes } diff --git a/engines/sci/graphics/portrait.h b/engines/sci/graphics/portrait.h index 877b253bcf..e0888daa86 100644 --- a/engines/sci/graphics/portrait.h +++ b/engines/sci/graphics/portrait.h @@ -72,7 +72,7 @@ private: Common::String _resourceName; byte *_fileData; - + uint32 _lipSyncIDCount; byte *_lipSyncIDTable; diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index c5c94d7991..d66352b411 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -50,7 +50,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) { _upscaledHires = GFX_SCREEN_UPSCALED_640x480; #endif } - + if (g_sci->getPlatform() == Common::kPlatformMacintosh) { if (getSciVersion() <= SCI_VERSION_01) _upscaledHires = GFX_SCREEN_UPSCALED_480x300; @@ -232,7 +232,7 @@ void GfxScreen::copyRectToScreen(const Common::Rect &rect, int16 x, int16 y) { } else { int rectHeight = _upscaledHeightMapping[rect.bottom] - _upscaledHeightMapping[rect.top]; int rectWidth = _upscaledWidthMapping[rect.right] - _upscaledWidthMapping[rect.left]; - + g_system->copyRectToScreen(_activeScreen + _upscaledHeightMapping[rect.top] * _displayWidth + _upscaledWidthMapping[rect.left], _displayWidth, _upscaledWidthMapping[x], _upscaledHeightMapping[y], rectWidth, rectHeight); } } @@ -329,7 +329,7 @@ void GfxScreen::drawLine(Common::Point startPoint, Common::Point endPoint, byte int16 top = CLIP<int16>(startPoint.y, 0, maxHeight); int16 right = CLIP<int16>(endPoint.x, 0, maxWidth); int16 bottom = CLIP<int16>(endPoint.y, 0, maxHeight); - + //set_drawing_flag byte drawMask = getDrawingMask(color, priority, control); diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index a88546e68c..da61ecf4c3 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -367,7 +367,7 @@ void GfxView::initData(GuiResourceId resourceId) { default: error("ViewType was not detected, can't continue"); } - + // Inject our own views // Currently only used for Dual mode (speech + text) for games, that do not have a "dual" icon already // Which is Laura Bow 2 + King's Quest 6 diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 6b6058c819..33392e3b42 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -76,8 +76,8 @@ MODULE_OBJS := \ sound/drivers/midi.o \ sound/drivers/pcjr.o \ video/seq_decoder.o - - + + ifdef ENABLE_SCI32 MODULE_OBJS += \ engine/kgraphics32.o \ diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index d155792853..10740a8b7b 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -2350,6 +2350,9 @@ bool ResourceManager::detectPaletteMergingSci11() { // Old palette format used in palette resource? -> it's merging if ((data[0] == 0 && data[1] == 1) || (data[0] == 0 && data[1] == 0 && READ_LE_UINT16(data + 29) == 0)) return true; + // Hardcoded: Laura Bow 2 floppy uses new palette resource, but still palette merging + 16 bit color matching + if ((g_sci->getGameId() == GID_LAURABOW2) && (!g_sci->isCD()) && (!g_sci->isDemo())) + return true; return false; } return false; diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 66778f0914..c775f502c5 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -110,7 +110,7 @@ bool Resource::loadFromAudioVolumeSCI11(Common::SeekableReadStream *file) { unalloc(); return false; } - + _headerSize = file->readByte(); if (type == kResourceTypeAudio) { diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index fc723f18cf..60a1271b89 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -219,7 +219,7 @@ Common::Error SciEngine::run() { // Add the after market GM patches for the specified game, if they exist _resMan->addNewGMPatch(_gameId); _gameObjectAddress = _resMan->findGameObject(); - + _scriptPatcher = new ScriptPatcher(); SegManager *segMan = new SegManager(_resMan, _scriptPatcher); @@ -896,7 +896,7 @@ void SciEngine::syncSoundSettings() { bool SciEngine::speechAndSubtitlesEnabled() { bool subtitlesOn = ConfMan.getBool("subtitles"); bool speechOn = !ConfMan.getBool("speech_mute"); - + if (isCD() && subtitlesOn && speechOn) return true; return false; @@ -936,7 +936,7 @@ void SciEngine::updateScummVMAudioOptions() { // depending on the in-game settings if (isCD() && getSciVersion() == SCI_VERSION_1_1) { uint16 ingameSetting = _gamestate->variables[VAR_GLOBAL][90].getOffset(); - + switch (ingameSetting) { case 1: // subtitles diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 362cca699d..7a6eaf62b4 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -142,7 +142,7 @@ void SciMusic::init() { _driverLastChannel = _pMidiDrv->getLastChannel(); if (getSciVersion() <= SCI_VERSION_0_LATE) _globalReverb = _pMidiDrv->getReverb(); // Init global reverb for SCI0 - + _currentlyPlayingSample = NULL; } diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index 6149bb799e..4e44074630 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -264,7 +264,7 @@ private: int _driverFirstChannel; int _driverLastChannel; - + MusicEntry *_currentlyPlayingSample; }; diff --git a/engines/scumm/cdda.cpp b/engines/scumm/cdda.cpp index adb414ecce..d797712a31 100644 --- a/engines/scumm/cdda.cpp +++ b/engines/scumm/cdda.cpp @@ -46,7 +46,7 @@ private: public: CDDAStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse); virtual ~CDDAStream(); - + int readBuffer(int16 *buffer, const int numSamples); bool isStereo() const { return true; } int getRate() const { return 44100; } diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index a7922b232e..10482ba1fc 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -244,7 +244,7 @@ static Common::String generateFilenameForDetection(const char *pattern, Filename case kGenRoomNum: result = Common::String::format(pattern, 0); break; - + case kGenDiskNumSteam: case kGenRoomNumSteam: { const SteamIndexFile *indexFile = lookUpSteamIndexFile(pattern, platform); diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index 791963e237..3f08f17aff 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -680,12 +680,13 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "freddi", "Freddi Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "freddi", "Freddi Fish", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "freddi", "FreddiD", kGenHEPC, Common::NL_NLD, UNK, 0 }, + { "freddi", "FreddiE", kGenHEPC, UNK_LANG, UNK, 0 }, { "freddi", "Freddi Fisk", kGenHEMac, Common::SE_SWE, Common::kPlatformMacintosh, 0 }, { "freddi", "FRITZI", kGenHEPC, Common::DE_DEU, UNK, 0 }, { "freddi", "Marine Malice", kGenHEMac, Common::FR_FRA, Common::kPlatformMacintosh, 0 }, { "freddi", "MM-DEMO", kGenHEPC, UNK_LANG, UNK, 0 }, - { "freddi2", "freddi2", kGenHEPC, UNK_LANG, UNK, 0 }, + { "freddi2", "freddi2", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 }, { "freddi2", "FF2-demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "freddi2", "ff2-demo", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 }, { "freddi2", "FFHSDemo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, @@ -747,7 +748,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "lost", "lost", kGenHEPC, UNK_LANG, UNK, 0 }, { "lost", "Lost and Found", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "lost", "smaller", kGenHEPC, UNK_LANG, UNK, 0 }, - { "lost", "verloren", kGenHEPC, Common::NL_NLD, UNK, 0 }, + { "lost", "verloren", kGenHEPC, Common::NL_NLD, Common::kPlatformWindows, 0 }, { "lost", "Verloren", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 }, { "maze", "maze", kGenHEPC, UNK_LANG, UNK, 0 }, @@ -792,7 +793,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "pajama2", "PJ2 Demo", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 }, { "pajama2", "PS2DEMO", kGenHEPC, Common::HE_ISR, UNK, 0 }, - { "pajama3", "pajama3", kGenHEPC, UNK_LANG, UNK, 0 }, + { "pajama3", "pajama3", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 }, { "pajama3", "FPJ3Demo", kGenHEPC, Common::FR_FRA, UNK, 0 }, { "pajama3", "GPJ3Demo", kGenHEPC, Common::DE_DEU, UNK, 0 }, { "pajama3", "PajamaHTF", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, @@ -891,7 +892,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "socks", "socks", kGenHEPC, UNK_LANG, UNK, 0 }, { "socks", "SockWorks", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, - { "socks", "SokkenSoep", kGenHEPC, Common::NL_NLD, UNK, 0 }, + { "socks", "SokkenSoep", kGenHEPC, Common::NL_NLD, Common::kPlatformWindows, 0 }, { "socks", "SokkenSoep", kGenHEMac, Common::NL_NLD, Common::kPlatformMacintosh, 0 }, { "spyfox", "spyfox", kGenHEPC, UNK_LANG, Common::kPlatformWindows, 0 }, diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 7eadb042fb..0c0f6be73b 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -109,7 +109,12 @@ Common::Error ScummEngine::saveGameState(int slot, const Common::String &desc) { } bool ScummEngine::canSaveGameStateCurrently() { - // FIXME: For now always allow loading in V0-V3 games + // Disallow saving in v0-v3 games when a 'prequel' to a cutscene is shown. + // This is a blank screen with text, and while this is shown, saving should + // be disabled, as no room is set. + if (_game.version <= 3 && _currentScript == 0xFF && _roomResource == 0 && _currentRoom == 0) + return false; + // TODO: Should we disallow saving in some more places, // e.g. when a SAN movie is playing? Not sure whether the // original EXE allowed this. diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 0eeff57ff7..d7ec9bb686 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Wed Jun 25 10:34:07 2014 + This file was generated by the md5table tool on Mon Oct 20 12:17:31 2014 DO NOT EDIT MANUALLY! */ @@ -28,7 +28,7 @@ static const MD5Table md5table[] = { { "055ffe4f47753e47594ac67823220c54", "puttrace", "HE 99", "", -1, Common::DE_DEU, Common::kPlatformUnknown }, { "057c9b456dedcc4d71b991a3072a20b3", "monkey", "SEGA", "", 9465, Common::JA_JPN, Common::kPlatformSegaCD }, { "06b187468113f9ae5a400b148a847fac", "atlantis", "Floppy", "Floppy", 12075, Common::EN_ANY, Common::kPlatformMacintosh }, - { "06c3cf4f31daad8b1cd93153491db9e6", "pajama3", "", "", -1, Common::NL_NLD, Common::kPlatformMacintosh }, + { "06c3cf4f31daad8b1cd93153491db9e6", "pajama3", "", "", 79382, Common::NL_NLD, Common::kPlatformUnknown }, { "07433205acdca3bc553d0e731588b35f", "airport", "", "", -1, Common::EN_ANY, Common::kPlatformWindows }, { "07a1eefd8ca95d77310311446c0f53d0", "brstorm", "", "", 5433, Common::EN_ANY, Common::kPlatformUnknown }, { "07b810e37be7489263f7bc7627d4765d", "freddi4", "unenc", "Unencrypted", -1, Common::RU_RUS, Common::kPlatformWindows }, @@ -112,7 +112,7 @@ static const MD5Table md5table[] = { { "2108d83dcf09f8adb4bc524669c8cf51", "PuttTime", "HE 99", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown }, { "21a6592322f92550f144f68a8a4e685e", "dig", "", "", -1, Common::FR_FRA, Common::kPlatformMacintosh }, { "21abe302e1b1e2b66d6f5c12e241ebfd", "freddicove", "unenc", "Unencrypted", -1, Common::RU_RUS, Common::kPlatformWindows }, - { "2232b0b9411575b1f9961713ebc9de61", "balloon", "HE 80", "", -1, Common::UNK_LANG, Common::kPlatformWindows }, + { "2232b0b9411575b1f9961713ebc9de61", "balloon", "HE 80", "", -1, Common::NL_NLD, Common::kPlatformWindows }, { "225e18566e810c634bf7de63e7568e3e", "mustard", "", "", -1, Common::EN_USA, Common::kPlatformUnknown }, { "22c9eb04455440131ffc157aeb8d40a8", "fbear", "HE 70", "Demo", -1, Common::EN_ANY, Common::kPlatformWindows }, { "22de86b2f7ec6e5db745ed1123310b44", "spyfox2", "", "Demo", 15832, Common::FR_FRA, Common::kPlatformWindows }, @@ -393,9 +393,10 @@ static const MD5Table md5table[] = { { "8e3241ddd6c8dadf64305e8740d45e13", "balloon", "HE 100", "Updated", -1, Common::EN_ANY, Common::kPlatformUnknown }, { "8e4ee4db46954bfe2912e259a16fad82", "monkey2", "", "", -1, Common::FR_FRA, Common::kPlatformDOS }, { "8e9417564f33790815445b2136efa667", "atlantis", "", "CD", 11915, Common::JA_JPN, Common::kPlatformMacintosh }, - { "8e9830a6f2702be5b22c8fa0a6aaf977", "freddi2", "HE 80", "", -1, Common::NL_NLD, Common::kPlatformMacintosh }, + { "8e9830a6f2702be5b22c8fa0a6aaf977", "freddi2", "HE 80", "", 65305, Common::NL_NLD, Common::kPlatformUnknown }, { "8eb84cee9b429314c7f0bdcf560723eb", "monkey", "FM-TOWNS", "", 9925, Common::EN_ANY, Common::kPlatformFMTowns }, { "8ee63cafb1fe9d62aa0d5a23117e70e7", "freddi2", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown }, + { "8f345db2f3f5a25ed6305001957e6f72", "freddicove", "HE 100", "", 41182, Common::NL_NLD, Common::kPlatformUnknown }, { "8f3758ff98c9c5d78e5d635222cad026", "atlantis", "Floppy", "Floppy", -1, Common::IT_ITA, Common::kPlatformDOS }, { "8fec68383202d38c0d25e9e3b757c5df", "comi", "Demo", "Demo", 18041, Common::UNK_LANG, Common::kPlatformWindows }, { "8ffd618a776a4c0d8922bb28b09f8ce8", "airport", "", "Demo", -1, Common::EN_ANY, Common::kPlatformWindows }, diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index af118a89a1..46512f8ce6 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -1362,7 +1362,7 @@ public: byte VAR_SCRIPT_CYCLE; // Used in runScript()/runObjectScript() byte VAR_NUM_SCRIPT_CYCLES; // Used in runAllScripts() - + byte VAR_QUIT_SCRIPT; // Used in confirmExitDialog() // Exists both in V7 and in V72HE: diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index cb428d1c15..84d2b37f96 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -1066,9 +1066,9 @@ void Sound::playCDTrackInternal(int track, int numLoops, int startFrame, int dur Common::File *cddaFile = new Common::File(); if (cddaFile->open("CDDA.SOU")) { Audio::Timestamp start = Audio::Timestamp(0, startFrame, 75); - Audio::Timestamp end = Audio::Timestamp(0, startFrame + duration, 75); + Audio::Timestamp end = Audio::Timestamp(0, startFrame + duration, 75); Audio::SeekableAudioStream *stream = makeCDDAStream(cddaFile, DisposeAfterUse::YES); - + _mixer->playStream(Audio::Mixer::kMusicSoundType, &_loomSteamCDAudioHandle, Audio::makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops)); } else { diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index a903ac5804..a6be5c3f3a 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -715,7 +715,7 @@ void ScummEngine_v99he::resetScummVars() { VAR(140) = 0; #endif } - + if (_game.id == GID_PUTTZOO && _game.heversion == 100 && _game.platform == Common::kPlatformWindows) { // Specific to Nimbus Games version. VAR(156) = 1; diff --git a/engines/sword1/console.cpp b/engines/sword1/console.cpp index 7fabc62192..3a4b51965b 100644 --- a/engines/sword1/console.cpp +++ b/engines/sword1/console.cpp @@ -36,7 +36,7 @@ SwordConsole::SwordConsole(SwordEngine *vm) : GUI::Debugger(), _vm(vm) { SwordConsole::~SwordConsole() { } - + bool SwordConsole::Cmd_SpeechEndianness(int argc, const char **argv) { if (argc == 1) { debugPrintf("Using %s speech\n", _vm->_sound->_bigEndianSpeech ? "be" : "le"); diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 9140bddb65..4deaf06edc 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -144,7 +144,7 @@ void Sound::checkSpeechFileEndianness() { debug(8, "Speech endianness heuristic: average = %f for BE and %f for LE (%d samples)", be_diff, le_diff, maxSamples); } } - + double Sound::endiannessHeuristicValue(int16* data, uint32 dataSize, uint32 &maxSamples) { if (!data) return 50000.; // the heuristic value for the wrong endianess is about 21000 (1/3rd of the 16 bits range) diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp index 4927b4c58e..8aeecad6b1 100644 --- a/engines/sword25/gfx/renderobjectmanager.cpp +++ b/engines/sword25/gfx/renderobjectmanager.cpp @@ -107,7 +107,7 @@ bool RenderObjectManager::render() { if (!_currQueue->exists(*it)) _uta->addRect((*it)._bbox); } - + // Add rectangles of objects which are different from the previous frame for (RenderObjectQueue::iterator it = _currQueue->begin(); it != _currQueue->end(); ++it) { if (!_prevQueue->exists(*it)) diff --git a/engines/sword25/util/pluto/pluto.cpp b/engines/sword25/util/pluto/pluto.cpp index 78b0a815e8..cbe16b0d5b 100644 --- a/engines/sword25/util/pluto/pluto.cpp +++ b/engines/sword25/util/pluto/pluto.cpp @@ -325,7 +325,7 @@ static void persisttable(PersistInfo *pi) #ifdef TOTEXT printf("persisttable\n"); #endif - + /* perms reftbl ... tbl */ lua_checkstack(pi->L, 3); if(persistspecialobject(pi, 1)) { @@ -1192,7 +1192,7 @@ int persist_l(lua_State *L) wi.buf = NULL; wi.buflen = 0; - + lua_settop(L, 2); /* perms? rootobj? */ luaL_checktype(L, 1, LUA_TTABLE); @@ -1750,7 +1750,7 @@ static void unpersistthread(int ref, UnpersistInfo *upi) #else verify(LIF(Z,read)(&upi->zio, &L2->errfunc, sizeof(ptrdiff_t)) == 0); #endif - + //read_size(&upi->zio, (size_t *)&L2->errfunc); L2->base = L2->stack + stackbase; L2->top = L2->stack + stacktop; @@ -2045,7 +2045,7 @@ int unpersist_l(lua_State *L) int version_l(lua_State *L) { const char *version = VERSION; - + lua_settop(L, 0); /* (empty) */ lua_pushlstring(L, version, strlen(version)); diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp index c102242dfd..0a2c62330b 100644 --- a/engines/tony/game.cpp +++ b/engines/tony/game.cpp @@ -1557,14 +1557,14 @@ void RMPointer::updateCursor() { for (int i = 0; i < 64; i++) { uint16 *lineP = src; for (int j = 0; j < 64; j++) { - lineP[j] = RMGfxTargetBuffer::_precalcTable[lineP[j] & 0x7FFF]; + lineP[j] = RMGfxTargetBuffer::_precalcTable[lineP[j]]; } src += 64; } } // Get the raw pixel data and set the cursor to it - Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); CursorMan.replaceCursor(cursorData, 64, 64, _cursorHotspot._x, _cursorHotspot._y, 0, 1, &pixelFormat); } diff --git a/engines/tony/gfxcore.cpp b/engines/tony/gfxcore.cpp index 9254d59df6..2a32926c53 100644 --- a/engines/tony/gfxcore.cpp +++ b/engines/tony/gfxcore.cpp @@ -422,11 +422,11 @@ uint16 *RMGfxTargetBuffer::_precalcTable = NULL; * called if the user selects the black & white option. */ void RMGfxTargetBuffer::createBWPrecalcTable() { - _precalcTable = new uint16[0x8000]; + _precalcTable = new uint16[0x10000]; - for (int i = 0; i < 0x8000; i++) { - int r = (i >> 10) & 0x1F; - int g = (i >> 5) & 0x1F; + for (int i = 0; i < 0x10000; i++) { + int r = (i >> 11) & 0x1F; + int g = (i >> 6) & 0x1F; int b = i & 0x1F; int min = MIN(r, MIN(g, b)); @@ -434,11 +434,11 @@ void RMGfxTargetBuffer::createBWPrecalcTable() { min = (min + max) / 2; - r = CLIP(min + 8 - 8, 0, 31); - g = CLIP(min + 5 - 8, 0, 31); - b = CLIP(min + 0 - 8, 0, 31); + r = CLIP(min + 8 - 8, 0, 0x1f); + g = CLIP(min + 5 - 8, 0, 0x1f); + b = CLIP(min + 0 - 8, 0, 0x1f); - _precalcTable[i] = (r << 10) | (g << 5) | b; + _precalcTable[i] = (r << 11) | (g << 6) | b; } } @@ -512,8 +512,9 @@ int RMGfxSourceBufferPal::loadPalette(const byte *buf) { void RMGfxSourceBufferPal::preparePalette() { for (int i = 0; i < 256; i++) { - _palFinal[i] = (((int)_pal[i * 3 + 0] >> 3) << 10) | - (((int)_pal[i * 3 + 1] >> 3) << 5) | + // we convert 555 to 565 here. + _palFinal[i] = (((int)_pal[i * 3 + 0] >> 3) << 11) | + (((int)_pal[i * 3 + 1] >> 3) << 6) | (((int)_pal[i * 3 + 2] >> 3) << 0); } } @@ -665,8 +666,8 @@ void RMGfxSourceBuffer8::create(int dimx, int dimy) { RMGfxBuffer::create(dimx, dimy, 8); } -#define GETRED(x) (((x) >> 10) & 0x1F) -#define GETGREEN(x) (((x) >> 5) & 0x1F) +#define GETRED(x) (((x) >> 11) & 0x1F) +#define GETGREEN(x) (((x) >> 5) & 0x3F) #define GETBLUE(x) ((x) & 0x1F) /****************************************************************************\ @@ -684,13 +685,13 @@ int RMGfxSourceBuffer8AB::calcTrasp(int fore, int back) { if (r > 0x1F) r = 0x1F; - if (g > 0x1F) - g = 0x1F; + if (g > 0x3F) + g = 0x3F; if (b > 0x1F) b = 0x1F; - return (r << 10) | (g << 5) | b; + return (r << 11) | (g << 5) | b; } void RMGfxSourceBuffer8AB::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { @@ -802,8 +803,8 @@ void RMGfxSourceBuffer8RLE::preparePalette() { // Handle RGB alpha blending if (_alphaBlendColor != -1) { - _alphaR = (_palFinal[_alphaBlendColor] >> 10) & 0x1F; - _alphaG = (_palFinal[_alphaBlendColor] >> 5) & 0x1F; + _alphaR = (_palFinal[_alphaBlendColor] >> 11) & 0x1F; + _alphaG = (_palFinal[_alphaBlendColor] >> 5) & 0x3F; _alphaB = (_palFinal[_alphaBlendColor]) & 0x1F; } } @@ -1054,15 +1055,15 @@ RLEByteDoAlpha2: if (n > nLength) n = nLength; for (int i = 0; i < n; i++) { - int r = (*dst >> 10) & 0x1F; - int g = (*dst >> 5) & 0x1F; + int r = (*dst >> 11) & 0x1F; + int g = (*dst >> 5) & 0x3F; int b = *dst & 0x1F; r = (r >> 2) + (_alphaR >> 1); g = (g >> 2) + (_alphaG >> 1); b = (b >> 2) + (_alphaB >> 1); - *dst ++ = (r << 10) | (g << 5) | b; + *dst ++ = (r << 11) | (g << 5) | b; } nLength -= n; @@ -1158,15 +1159,15 @@ RLEByteFlippedDoAlpha2: if (n > nLength) n = nLength; for (int i = 0; i < n; i++) { - int r = (*dst >> 10) & 0x1F; - int g = (*dst >> 5) & 0x1F; + int r = (*dst >> 11) & 0x1F; + int g = (*dst >> 5) & 0x3F; int b = *dst & 0x1F; r = (r >> 2) + (_alphaR >> 1); g = (g >> 2) + (_alphaG >> 1); b = (b >> 2) + (_alphaB >> 1); - *dst-- = (r << 10) | (g << 5) | b; + *dst-- = (r << 11) | (g << 5) | b; } nLength -= n; @@ -1302,15 +1303,15 @@ RLEWordDoAlpha2: n = nLength; for (int i = 0; i < n; i++) { - int r = (*dst >> 10) & 0x1F; - int g = (*dst >> 5) & 0x1F; + int r = (*dst >> 11) & 0x1F; + int g = (*dst >> 5) & 0x3F; int b = *dst & 0x1F; r = (r >> 2) + (_alphaR >> 1); g = (g >> 2) + (_alphaG >> 1); b = (b >> 2) + (_alphaB >> 1); - *dst++ = (r << 10) | (g << 5) | b; + *dst++ = (r << 11) | (g << 5) | b; } nLength -= n; @@ -1416,15 +1417,15 @@ RLEWordFlippedDoAlpha2: n = nLength; for (int i = 0; i < n; i++) { - int r = (*dst >> 10) & 0x1F; - int g = (*dst >> 5) & 0x1F; + int r = (*dst >> 11) & 0x1F; + int g = (*dst >> 5) & 0x3F; int b = *dst & 0x1F; r = (r >> 2) + (_alphaR >> 1); g = (g >> 2) + (_alphaG >> 1); b = (b >> 2) + (_alphaB >> 1); - *dst-- = (r << 10) | (g << 5) | b; + *dst-- = (r << 11) | (g << 5) | b; } nLength -= n; @@ -1543,15 +1544,15 @@ RLEWordDoAlpha2: // @@@ SHOULD NOT BE THERE !!!!! for (int i = 0; i < n; i++) { - int r = (*dst >> 10) & 0x1F; - int g = (*dst >> 5) & 0x1F; + int r = (*dst >> 11) & 0x1F; + int g = (*dst >> 5) & 0x3F; int b = *dst & 0x1F; r = (r >> 2) + (_alphaR >> 1); g = (g >> 2) + (_alphaG >> 1); b = (b >> 2) + (_alphaB >> 1); - *dst++ = (r << 10) | (g << 5) | b; + *dst++ = (r << 11) | (g << 5) | b; } nLength -= n; @@ -1570,19 +1571,19 @@ RLEWordDoCopy2: n = nLength; for (int i = 0; i < n; i++) { - int r = (*dst >> 10) & 0x1F; - int g = (*dst >> 5) & 0x1F; + int r = (*dst >> 11) & 0x1F; + int g = (*dst >> 5) & 0x3F; int b = *dst & 0x1F; - int r2 = (_palFinal[*src] >> 10) & 0x1F; - int g2 = (_palFinal[*src] >> 5) & 0x1F; + int r2 = (_palFinal[*src] >> 11) & 0x1F; + int g2 = (_palFinal[*src] >> 5) & 0x3F; int b2 = _palFinal[*src] & 0x1F; r = (r >> 1) + (r2 >> 1); g = (g >> 1) + (g2 >> 1); b = (b >> 1) + (b2 >> 1); - *dst ++ = (r << 10) | (g << 5) | b; + *dst ++ = (r << 11) | (g << 5) | b; src++; } @@ -1732,14 +1733,14 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri g /= 5; b /= 5; - if (r > 31) - r = 31; - if (g > 31) - g = 31; - if (b > 31) - b = 31; + if (r > 0x1f) + r = 0x1f; + if (g > 0x3f) + g = 0x3f; + if (b > 0x1f) + b = 0x1f; - mybuf[0] = (r << 10) | (g << 5) | b; + mybuf[0] = (r << 11) | (g << 5) | b; } } @@ -1773,14 +1774,14 @@ void RMGfxSourceBuffer8AA::drawAA(RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pri g /= 6; b /= 6; - if (r > 31) - r = 31; - if (g > 31) - g = 31; - if (b > 31) - b = 31; + if (r > 0x1f) + r = 0x1f; + if (g > 0x3f) + g = 0x3f; + if (b > 0x1f) + b = 0x1f; - mybuf[0] = (r << 10) | (g << 5) | b; + mybuf[0] = (r << 11) | (g << 5) | b; } } @@ -1948,8 +1949,17 @@ void RMGfxSourceBuffer16::prepareImage() { // Color space conversion if necessary! uint16 *buf = (uint16 *)_buf; - for (int i = 0; i < _dimx * _dimy; i++) - buf[i] = FROM_LE_16(buf[i]) & 0x7FFF; + // convert 555 to 565 + for (int i = 0; i < _dimx * _dimy; i++) { + uint16 pixel = FROM_LE_16(buf[i]); + int r = (pixel >> 10) & 0x1F; + int g = (pixel >> 5) & 0x1F; + int b = pixel & 0x1F; + + pixel = (r << 11) | (g << 6) | b; + + buf[i] = pixel; + } } RMGfxSourceBuffer16::RMGfxSourceBuffer16(int dimx, int dimy) @@ -1983,7 +1993,8 @@ void RMGfxBox::setColor(byte r, byte g, byte b) { r >>= 3; g >>= 3; b >>= 3; - _wFillColor = (r << 10) | (g << 5) | b; + // These are hard-coded colors, so we convert 555 to 565. + _wFillColor = (r << 11) | (g << 6) | b; } void RMGfxBox::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) { diff --git a/engines/tony/mpal/lzo.cpp b/engines/tony/mpal/lzo.cpp index 314d6f3ed5..6cc2333315 100644 --- a/engines/tony/mpal/lzo.cpp +++ b/engines/tony/mpal/lzo.cpp @@ -116,7 +116,7 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len) *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do + do *op++ = *ip++; while (--t > 0); diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index 5c50a50a57..3b3687419b 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -53,9 +53,9 @@ RMWindow::~RMWindow() { * Initializes the graphics window */ void RMWindow::init() { - Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); initGraphics(RM_SX, RM_SY, true, &pixelFormat); - + reset(); } @@ -83,7 +83,7 @@ void RMWindow::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, for (int i = 0; i < h; i++) { uint16 *dst = (uint16 *)screen->getBasePtr(x, y + i); for (int j = 0; j < w; j++) { - dst[j] = RMGfxTargetBuffer::_precalcTable[src[j] & 0x7FFF]; + dst[j] = RMGfxTargetBuffer::_precalcTable[src[j]]; } src += (pitch / 2); } @@ -291,8 +291,8 @@ void RMSnapshot::grabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) { cursrc = &src[RM_SKIPX + x]; *curOut++ = ((*cursrc) & 0x1F) << 3; - *curOut++ = (((*cursrc) >> 5) & 0x1F) << 3; - *curOut++ = (((*cursrc) >> 10) & 0x1F) << 3; + *curOut++ = (((*cursrc) >> 5) & 0x3F) << 3; + *curOut++ = (((*cursrc) >> 11) & 0x1F) << 3; if (lpDestBuf) *lpDestBuf++ = *cursrc; @@ -319,8 +319,8 @@ void RMSnapshot::grabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) { curv = v; sommab += cursrc[curv * RM_BBX + u] & 0x1F; - sommag += (cursrc[curv * RM_BBX + u] >> 5) & 0x1F; - sommar += (cursrc[curv * RM_BBX + u] >> 10) & 0x1F; + sommag += (cursrc[curv * RM_BBX + u] >> 6) & 0x1F; + sommar += (cursrc[curv * RM_BBX + u] >> 11) & 0x1F; } } _rgb[k + 0] = (byte)(sommab * 8 / (dezoom * dezoom)); diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index 51e8dee19f..686fe99beb 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -1059,7 +1059,7 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { _specialAnim->loadAnimation(animName); _animSpecialId = animId; - + if (_animationInstance) { _animationInstance->setAnimation(_specialAnim); _animationInstance->setAnimationRange(0, _specialAnim->_numFrames - 1); diff --git a/engines/toon/state.cpp b/engines/toon/state.cpp index 6ac5808219..000f94d659 100644 --- a/engines/toon/state.cpp +++ b/engines/toon/state.cpp @@ -115,7 +115,7 @@ State::State(void) { #endif memset(_conversationState, 0, sizeof(Conversation) * 60); - + _conversationData = nullptr; _currentConversationId = -1; _exitConversation = true; diff --git a/engines/tsage/ringworld2/ringworld2_outpost.cpp b/engines/tsage/ringworld2/ringworld2_outpost.cpp index 05cfa6259b..cad21b4623 100644 --- a/engines/tsage/ringworld2/ringworld2_outpost.cpp +++ b/engines/tsage/ringworld2/ringworld2_outpost.cpp @@ -4605,7 +4605,7 @@ void Scene1337::subD1940(bool flag) { } void Scene1337::subD1975(int arg1, int arg2) { - // No implementation required in ScummVM: Mouse handling with tons of caching + // No implementation required in ScummVM: Mouse handling with tons of caching } void Scene1337::OptionsDialog::show() { diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 9eaead630b..8610e0c8bc 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -3878,7 +3878,7 @@ void Scene3500::dispatch() { Scene::dispatch(); // WORKAROUND: The _mazeUI wasn't originally added to the scene in postInit. - // This is only needed to fix old savegames + // This is only needed to fix old savegames if (!R2_GLOBALS._sceneObjects->contains(&_mazeUI)) _mazeUI.draw(); diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 93b5c68a30..00326d6747 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -50,7 +50,7 @@ struct Point32 { y -= delta.y; return *this; } - + operator FloatPoint() { return FloatPoint(x,y); } diff --git a/engines/zvision/archives/zfs_archive.cpp b/engines/zvision/archives/zfs_archive.cpp index f5fa6fc9bf..d18cc9966b 100644 --- a/engines/zvision/archives/zfs_archive.cpp +++ b/engines/zvision/archives/zfs_archive.cpp @@ -79,7 +79,7 @@ void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) { // Read in each entry header for (uint32 i = 0; i < _header.filesPerBlock; ++i) { ZfsEntryHeader entryHeader; - + entryHeader.name = readEntryName(stream); entryHeader.offset = stream->readUint32LE(); entryHeader.id = stream->readUint32LE(); diff --git a/engines/zvision/core/save_manager.cpp b/engines/zvision/core/save_manager.cpp index 07fb7637e7..e10201e024 100644 --- a/engines/zvision/core/save_manager.cpp +++ b/engines/zvision/core/save_manager.cpp @@ -106,7 +106,7 @@ void SaveManager::autoSave() { void SaveManager::writeSaveGameData(Common::OutSaveFile *file) { // Create a thumbnail and save it Graphics::saveThumbnail(*file); - + // Write out the save date/time TimeDate td; g_system->getTimeAndDate(td); @@ -171,7 +171,7 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea warning("File is not a ZVision save file. Aborting load"); return false; } - + // Read in the version header.version = in->readByte(); diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 517278e155..219f418b13 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -123,7 +123,7 @@ ActionDisableControl::ActionDisableControl(const Common::String &line) { bool ActionDisableControl::execute(ZVision *engine) { debug("Disabling control %u", _key); - + ScriptManager *scriptManager = engine->getScriptManager(); scriptManager->setStateFlags(_key, scriptManager->getStateFlags(_key) | ScriptManager::DISABLED); @@ -194,7 +194,7 @@ bool ActionMusic::execute(ZVision *engine) { } else { audioStream = makeRawZorkStream(_fileName, engine); } - + if (_loop) { Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES); engine->_mixer->playStream(_soundType, 0, loopingAudioStream, -1, _volume); @@ -327,7 +327,7 @@ ActionSetPartialScreen::ActionSetPartialScreen(const Common::String &line) { bool ActionSetPartialScreen::execute(ZVision *engine) { RenderManager *renderManager = engine->getRenderManager(); - + if (_backgroundColor > 0) { renderManager->clearWorkingWindowTo555Color(_backgroundColor); } diff --git a/engines/zvision/scripting/controls/animation_control.h b/engines/zvision/scripting/controls/animation_control.h index 6c4d6dfcf7..bdb07d39ea 100644 --- a/engines/zvision/scripting/controls/animation_control.h +++ b/engines/zvision/scripting/controls/animation_control.h @@ -56,7 +56,7 @@ private: private: uint32 _animationKey; - + union { RlfAnimation *rlf; Video::VideoDecoder *avi; diff --git a/engines/zvision/scripting/controls/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp index 9724e661b7..c029a2a7a1 100644 --- a/engines/zvision/scripting/controls/lever_control.cpp +++ b/engines/zvision/scripting/controls/lever_control.cpp @@ -84,7 +84,7 @@ LeverControl::~LeverControl() { } else if (_fileType == RLF) { delete _animation.rlf; } - + delete[] _frameInfo; } @@ -194,7 +194,7 @@ void LeverControl::onMouseDown(const Common::Point &screenSpacePos, const Common if (!_enabled) { return; } - + if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { _mouseIsCaptured = true; _lastMousePos = backgroundImageSpacePos; @@ -205,7 +205,7 @@ void LeverControl::onMouseUp(const Common::Point &screenSpacePos, const Common:: if (!_enabled) { return; } - + if (_mouseIsCaptured) { _mouseIsCaptured = false; _engine->getScriptManager()->setStateValue(_key, _currentFrame); @@ -220,7 +220,7 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common if (!_enabled) { return false; } - + bool cursorWasChanged = false; if (_mouseIsCaptured) { @@ -276,7 +276,7 @@ bool LeverControl::process(uint32 deltaTimeInMillis) { renderFrame(_returnRoutesCurrentFrame); } } - + return false; } @@ -387,7 +387,7 @@ void LeverControl::renderFrame(uint frameNumber) { // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can frameData = (const uint16 *)_animation.rlf->getFrameData(frameNumber)->getPixels(); width = _animation.rlf->width(); // Use the animation width instead of _animationCoords.width() - height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() + height = _animation.rlf->height(); // Use the animation height instead of _animationCoords.height() } else if (_fileType == AVI) { _animation.avi->seekToFrame(frameNumber); const Graphics::Surface *surface = _animation.avi->decodeNextFrame(); diff --git a/engines/zvision/scripting/controls/push_toggle_control.cpp b/engines/zvision/scripting/controls/push_toggle_control.cpp index 82736b7576..a96c95b377 100644 --- a/engines/zvision/scripting/controls/push_toggle_control.cpp +++ b/engines/zvision/scripting/controls/push_toggle_control.cpp @@ -76,7 +76,7 @@ void PushToggleControl::onMouseUp(const Common::Point &screenSpacePos, const Com if (!_enabled) { return; } - + if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getScriptManager()->setStateValue(_key, 1); } @@ -86,7 +86,7 @@ bool PushToggleControl::onMouseMove(const Common::Point &screenSpacePos, const C if (!_enabled) { return false; } - + if (_hotspot.contains(backgroundImageSpacePos)) { _engine->getCursorManager()->changeCursor(_hoverCursor); return true; diff --git a/engines/zvision/scripting/controls/timer_node.cpp b/engines/zvision/scripting/controls/timer_node.cpp index c8c8a85d34..6f88b056a1 100644 --- a/engines/zvision/scripting/controls/timer_node.cpp +++ b/engines/zvision/scripting/controls/timer_node.cpp @@ -31,7 +31,7 @@ namespace ZVision { - + TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds) : Control(engine, key) { if (_engine->getGameId() == GID_NEMESIS) { diff --git a/engines/zvision/scripting/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp index 753ce4ac6a..416bac00f3 100644 --- a/engines/zvision/scripting/scr_file_handling.cpp +++ b/engines/zvision/scripting/scr_file_handling.cpp @@ -236,7 +236,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis } else if (line.matchString("*:ttytext*", true)) { // TODO: Implement ActionTTYText } else if (line.matchString("*:universe_music*", true)) { - // TODO: Implement ActionUniverseMusic + // TODO: Implement ActionUniverseMusic } else if (line.matchString("*:copy_file*", true)) { // Not used. Purposely left empty } else { diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp index 41b835e550..da82308051 100644 --- a/engines/zvision/scripting/script_manager.cpp +++ b/engines/zvision/scripting/script_manager.cpp @@ -260,7 +260,7 @@ Control *ScriptManager::getControl(uint32 key) { void ScriptManager::focusControl(uint32 key) { for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) { uint32 controlKey = (*iter)->getKey(); - + if (controlKey == key) { (*iter)->focus(); } else if (controlKey == _currentlyFocusedControl) { diff --git a/engines/zvision/utility/utility.cpp b/engines/zvision/utility/utility.cpp index 905bc4513a..2079d23733 100644 --- a/engines/zvision/utility/utility.cpp +++ b/engines/zvision/utility/utility.cpp @@ -203,7 +203,7 @@ void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Com return; Audio::AudioStream *audioStream = makeRawZorkStream(inputFile, engine); - + Common::DumpFile output; output.open(outputFile); |