diff options
author | Jaromir Wysoglad | 2019-06-06 08:45:13 +0200 |
---|---|---|
committer | Thierry Crozat | 2019-07-28 15:09:14 +0100 |
commit | 9e9602051c82cd0173cfb35c28f3318745a9629e (patch) | |
tree | 7516f01da52f362d365c94d4fa6e81f8707891c0 /engines | |
parent | b4c59bee451f6715c368d9607786eb5ddb40b6f0 (diff) | |
download | scummvm-rg350-9e9602051c82cd0173cfb35c28f3318745a9629e.tar.gz scummvm-rg350-9e9602051c82cd0173cfb35c28f3318745a9629e.tar.bz2 scummvm-rg350-9e9602051c82cd0173cfb35c28f3318745a9629e.zip |
SUPERNOVA2: Add missing interactions in Cabin room
Diffstat (limited to 'engines')
-rw-r--r-- | engines/supernova2/graphics.cpp | 36 | ||||
-rw-r--r-- | engines/supernova2/ms2_def.h | 2 | ||||
-rw-r--r-- | engines/supernova2/rooms.cpp | 48 | ||||
-rw-r--r-- | engines/supernova2/screen.cpp | 18 | ||||
-rw-r--r-- | engines/supernova2/state.cpp | 8 | ||||
-rw-r--r-- | engines/supernova2/state.h | 2 |
6 files changed, 89 insertions, 25 deletions
diff --git a/engines/supernova2/graphics.cpp b/engines/supernova2/graphics.cpp index 630fa46ddb..592a8e9081 100644 --- a/engines/supernova2/graphics.cpp +++ b/engines/supernova2/graphics.cpp @@ -221,21 +221,39 @@ bool MS2Image::loadStream(Common::SeekableReadStream &stream) { } bool MS2Image::loadSections() { - _pitch = 320; + bool isPoster = _filenumber == 38; + int imageWidth = isPoster ? 640 : 320; + int imageHeight = isPoster ? 480 : 200; + _pitch = imageWidth; for (int section = 0; section < _numSections; ++section) { Graphics::Surface *surface = new Graphics::Surface; _sectionSurfaces.push_back(surface); + if (isPoster) { + surface->create(imageWidth, imageHeight, g_system->getScreenFormat()); + byte *surfacePixels = static_cast<byte *>(surface->getPixels()); + for (int i = 0; i < imageWidth * imageHeight / 8; ++i) { + *surfacePixels++ = (_encodedImage[i] & 0x80) ? kColorWhite63 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x40) ? kColorWhite63 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x20) ? kColorWhite63 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x10) ? kColorWhite63 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x08) ? kColorWhite63 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x04) ? kColorWhite63 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x02) ? kColorWhite63 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x01) ? kColorWhite63 : kColorBlack; + } + } else { - uint32 offset = (_section[section].addressHigh << 16) + _section[section].addressLow; - if (offset == kInvalidAddress || _section[section].x2 == 0) { - return false; + uint32 offset = (_section[section].addressHigh << 16) + _section[section].addressLow; + if (offset == kInvalidAddress || _section[section].x2 == 0) { + return false; + } + int width = _section[section].x2 - _section[section].x1 + 1; + int height = _section[section].y2 - _section[section].y1 + 1; + surface->create(width, height, g_system->getScreenFormat()); + byte *surfacePixels = static_cast<byte *>(surface->getPixels()); + Common::copy(_encodedImage + offset, _encodedImage + offset + width * height, surfacePixels); } - int width = _section[section].x2 - _section[section].x1 + 1; - int height = _section[section].y2 - _section[section].y1 + 1; - surface->create(width, height, g_system->getScreenFormat()); - byte *surfacePixels = static_cast<byte *>(surface->getPixels()); - Common::copy(_encodedImage + offset, _encodedImage + offset + width * height, surfacePixels); } return true; diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h index f3cc21f8a4..b83be46448 100644 --- a/engines/supernova2/ms2_def.h +++ b/engines/supernova2/ms2_def.h @@ -170,7 +170,7 @@ kStringAirportEntrance, kStringAirport, kStringDowntown, kStringCulturePalace, k kStringPrivateApartment, kStringLeaveTaxi, kStringPay, kStringAddress, kStringCheater, kStringNotEnoughMoney, kStringTaxiAccelerating, kString5MinutesLater, kStringAlreadyHavePole, kStringSawPole, kStringOnlyShop, kStringCabinOccupiedSay, kStringTakeMoney, kStringAlreadyPaid, kStringNoMoney, -kStringPay10Xa, kStringWillPassOut, kStringRest, kString223, kStringWillTakeIt, +kStringPay10Xa, kStringWillPassOut, kStringRest, kStringCypher, kStringWillTakeIt, kStringTooExpensive, kStringWouldBuy, kStringMeHorstHummel, kStringHaveMusicChip, kStringGreatMask, kStringThreeYears, kStringStrongDrink, kStringMusicDevice, kStringArtusToothbrush, kStringSellInBulk, kStringRarityBooks, kStringEncyclopedia, kStringLargestDictionary, kStringOver400Words, kStringNotSale, diff --git a/engines/supernova2/rooms.cpp b/engines/supernova2/rooms.cpp index f9b8056843..43599b7ec1 100644 --- a/engines/supernova2/rooms.cpp +++ b/engines/supernova2/rooms.cpp @@ -688,7 +688,6 @@ bool Games::interact(Action verb, Object &obj1, Object &obj2) { Cabin::Cabin(Supernova2Engine *vm, GameManager *gm) { _vm = vm; _gm = gm; - _paid = false; _fileNumber = 7; _id = CABIN; @@ -712,7 +711,7 @@ void Cabin::onEntrance() { } void Cabin::animation() { - if (_paid) { + if (_shown[kMaxSection - 1]) { if (isSectionVisible(1)) setSectionVisible(1, kShownFalse); else @@ -725,30 +724,29 @@ bool Cabin::interact(Action verb, Object &obj1, Object &obj2) { if (verb == ACTION_USE && Object::combine(obj1, obj2, MONEY, SLOT1)) { if (isSectionVisible(2)) _vm->renderMessage(kStringTakeMoney); - else if (_paid) + else if (_shown[kMaxSection - 1]) _vm->renderMessage(kStringAlreadyPaid); else if (_gm->_state._money < 10) _vm->renderMessage(kStringNoMoney); else { _vm->renderMessage(kStringPay10Xa); _gm->takeMoney(-10); - _paid = true; + _shown[kMaxSection - 1] = true; } - } - else if (verb == ACTION_USE && obj1._id == CHAIR) { - if (_paid) { + } else if (verb == ACTION_USE && obj1._id == CHAIR) { + if (_shown[kMaxSection - 1]) { if (_shown[kMaxSection - 2]) { _vm->paletteFadeOut(); _vm->setCurrentImage(31); _vm->renderImage(0); _vm->paletteFadeIn(); - _paid = true; + _shown[kMaxSection - 1] = true; _gm->waitOnInput(100000); _vm->paletteFadeOut(); _vm->setCurrentImage(7); _vm->renderImage(0); setSectionVisible(1, kShownFalse); - _paid = false; + _shown[kMaxSection - 1] = false; _vm->renderRoom(*this); _vm->renderImage(2); _gm->drawMapExits(); @@ -776,8 +774,36 @@ bool Cabin::interact(Action verb, Object &obj1, Object &obj2) { } } else _vm->renderMessage(kStringRest); - } - else + } else if (verb == ACTION_TAKE && obj1._id == PRIZE) { + _vm->renderImage(2 + 128); + obj1._click = 255; + _gm->takeMoney(400); + } else if (verb == ACTION_TAKE && obj1._id == BACK_MONEY) { + _vm->renderImage(2 + 128); + obj1._click = 255; + _gm->takeMoney(10); + } else if (verb == ACTION_LOOK && obj1._id == SCRIBBLE1) { + _vm->renderMessage(kStringCypher); + } else if (verb == ACTION_LOOK && obj1._id == SCRIBBLE2) { + _gm->animationOff(); + _vm->setCurrentImage(28); + _vm->renderImage(0); + _gm->waitOnInput(100000); + _vm->setCurrentImage(7); + _vm->renderRoom(*this); + _gm->drawGUI(); + _gm->_state._addressKnown = true; + _gm->animationOn(); + } else if (verb == ACTION_LOOK && obj1._id == SIGN) { + _gm->animationOff(); + _vm->setCurrentImage(38); + _vm->renderImage(0); + _gm->waitOnInput(100000); + _vm->setCurrentImage(7); + _vm->renderRoom(*this); + _gm->drawGUI(); + _gm->animationOn(); + } else return false; return true; } diff --git a/engines/supernova2/screen.cpp b/engines/supernova2/screen.cpp index 29aa52ecbd..8d5fddfdff 100644 --- a/engines/supernova2/screen.cpp +++ b/engines/supernova2/screen.cpp @@ -340,10 +340,20 @@ void Screen::renderImageSection(const MS2Image *image, int section, bool invert) image->_section[section].y1, image->_section[section].x2 + 1, image->_section[section].y2 + 1); - if (_screenWidth != 320) { - _screenWidth = 320; - _screenHeight = 200; - initGraphics(_screenWidth, _screenHeight); + if (image->_filenumber == 38) { + sectionRect.setWidth(640); + sectionRect.setHeight(480); + if (_screenWidth != 640) { + _screenWidth = 640; + _screenHeight = 480; + initGraphics(_screenWidth, _screenHeight); + } + } else { + if (_screenWidth != 320) { + _screenWidth = 320; + _screenHeight = 200; + initGraphics(_screenWidth, _screenHeight); + } } uint offset = 0; diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp index 2cc05180d2..9c59397de6 100644 --- a/engines/supernova2/state.cpp +++ b/engines/supernova2/state.cpp @@ -797,6 +797,14 @@ void GameManager::drawMapExits() { } } +void GameManager::animationOff() { + _animationEnabled = false; +} + +void GameManager::animationOn() { + _animationEnabled = true; +} + void GameManager::edit(Common::String &input, int x, int y, uint length) { bool isEditing = true; uint cursorIndex = input.size(); diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h index 53deb9f13b..b356dd9c83 100644 --- a/engines/supernova2/state.h +++ b/engines/supernova2/state.h @@ -182,6 +182,8 @@ public: void waitOnInput(int ticks); bool waitOnInput(int ticks, Common::KeyCode &keycode); void showMenu(); + void animationOff(); + void animationOn(); void edit(Common::String &input, int x, int y, uint length); int invertSection(int section); void drawMapExits(); |