diff options
author | Matthew Hoops | 2011-05-11 00:30:02 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-11 00:30:28 -0400 |
commit | a1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch) | |
tree | 8c51419daa486f1d4833757db4715dadab6c3497 /engines/lastexpress | |
parent | accb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff) | |
parent | 33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff) | |
download | scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2 scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip |
Merge remote branch 'upstream/master' into t7g-ios
Conflicts:
audio/decoders/qdm2.h
common/util.cpp
engines/groovie/music.cpp
engines/groovie/resource.h
video/qt_decoder.cpp
video/qt_decoder.h
Diffstat (limited to 'engines/lastexpress')
-rw-r--r-- | engines/lastexpress/data/animation.cpp | 5 | ||||
-rw-r--r-- | engines/lastexpress/data/archive.h | 3 | ||||
-rw-r--r-- | engines/lastexpress/data/background.cpp | 1 | ||||
-rw-r--r-- | engines/lastexpress/data/font.cpp | 2 | ||||
-rw-r--r-- | engines/lastexpress/data/font.h | 2 | ||||
-rw-r--r-- | engines/lastexpress/data/scene.cpp | 1 | ||||
-rw-r--r-- | engines/lastexpress/data/scene.h | 6 | ||||
-rw-r--r-- | engines/lastexpress/data/sequence.cpp | 3 | ||||
-rw-r--r-- | engines/lastexpress/data/sequence.h | 2 | ||||
-rw-r--r-- | engines/lastexpress/data/snd.cpp | 40 | ||||
-rw-r--r-- | engines/lastexpress/data/snd.h | 4 | ||||
-rw-r--r-- | engines/lastexpress/data/subtitle.cpp | 2 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity.h | 1 | ||||
-rw-r--r-- | engines/lastexpress/game/inventory.cpp | 193 | ||||
-rw-r--r-- | engines/lastexpress/game/inventory.h | 18 | ||||
-rw-r--r-- | engines/lastexpress/game/logic.cpp | 28 | ||||
-rw-r--r-- | engines/lastexpress/game/state.h | 8 | ||||
-rw-r--r-- | engines/lastexpress/graphics.cpp | 13 | ||||
-rw-r--r-- | engines/lastexpress/lastexpress.cpp | 3 | ||||
-rw-r--r-- | engines/lastexpress/resource.cpp | 1 |
20 files changed, 275 insertions, 61 deletions
diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp index 7288889f09..2bf9bd4999 100644 --- a/engines/lastexpress/data/animation.cpp +++ b/engines/lastexpress/data/animation.cpp @@ -35,7 +35,10 @@ #include "common/events.h" #include "common/rational.h" +#include "common/rect.h" #include "common/stream.h" +#include "common/system.h" +#include "common/textconsole.h" #include "engines/engine.h" @@ -266,7 +269,7 @@ void Animation::play() { if (_changed) { // Create a temporary surface to merge the overlay with the background Graphics::Surface *s = new Graphics::Surface; - s->create(640, 480, 2); + s->create(640, 480, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); draw(s); diff --git a/engines/lastexpress/data/archive.h b/engines/lastexpress/data/archive.h index 3860245bc5..17b1d661fa 100644 --- a/engines/lastexpress/data/archive.h +++ b/engines/lastexpress/data/archive.h @@ -39,6 +39,9 @@ */ #include "common/archive.h" +#include "common/hash-str.h" +#include "common/hashmap.h" +#include "common/str.h" namespace LastExpress { diff --git a/engines/lastexpress/data/background.cpp b/engines/lastexpress/data/background.cpp index 8b0d338f64..e8236bca86 100644 --- a/engines/lastexpress/data/background.cpp +++ b/engines/lastexpress/data/background.cpp @@ -31,6 +31,7 @@ #include "lastexpress/debug.h" +#include "common/rect.h" #include "common/stream.h" namespace LastExpress { diff --git a/engines/lastexpress/data/font.cpp b/engines/lastexpress/data/font.cpp index 99239606ab..d9acbb8382 100644 --- a/engines/lastexpress/data/font.cpp +++ b/engines/lastexpress/data/font.cpp @@ -25,8 +25,10 @@ #include "lastexpress/data/font.h" +#include "common/rect.h" #include "common/stream.h" #include "common/system.h" +#include "common/textconsole.h" namespace LastExpress { diff --git a/engines/lastexpress/data/font.h b/engines/lastexpress/data/font.h index d49db35ba5..7bcf03ed7d 100644 --- a/engines/lastexpress/data/font.h +++ b/engines/lastexpress/data/font.h @@ -39,10 +39,12 @@ byte {x} - Unknown data (probably just garbage) */ +#include "common/str.h" #include "graphics/surface.h" namespace Common { class SeekableReadStream; +struct Rect; } namespace LastExpress { diff --git a/engines/lastexpress/data/scene.cpp b/engines/lastexpress/data/scene.cpp index 5a943982c4..e893d641a5 100644 --- a/engines/lastexpress/data/scene.cpp +++ b/engines/lastexpress/data/scene.cpp @@ -31,6 +31,7 @@ #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" +#include "common/textconsole.h" #include "common/stream.h" namespace LastExpress { diff --git a/engines/lastexpress/data/scene.h b/engines/lastexpress/data/scene.h index 7fc9425f28..9ec1899402 100644 --- a/engines/lastexpress/data/scene.h +++ b/engines/lastexpress/data/scene.h @@ -72,9 +72,15 @@ #include "lastexpress/shared.h" #include "common/array.h" +#include "common/rect.h" namespace Common { class SeekableReadStream; +class String; +} + +namespace Graphics { +struct Surface; } namespace LastExpress { diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp index 2308d70a2b..b986a33d5c 100644 --- a/engines/lastexpress/data/sequence.cpp +++ b/engines/lastexpress/data/sequence.cpp @@ -30,6 +30,7 @@ #include "lastexpress/debug.h" #include "common/stream.h" +#include "common/textconsole.h" namespace LastExpress { @@ -82,7 +83,7 @@ void FrameInfo::read(Common::SeekableReadStream *in, bool isSequence) { AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f) : _palette(NULL) { _palSize = 1; // TODO: use just the needed rectangle - _image.create(640, 480, 1); + _image.create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); //debugC(6, kLastExpressDebugGraphics, " Offsets: data=%d, unknown=%d, palette=%d", f.dataOffset, f.unknown, f.paletteOffset); //debugC(6, kLastExpressDebugGraphics, " Position: (%d, %d) - (%d, %d)", f.xPos1, f.yPos1, f.xPos2, f.yPos2); diff --git a/engines/lastexpress/data/sequence.h b/engines/lastexpress/data/sequence.h index 7ad0a57254..cd16f26ab2 100644 --- a/engines/lastexpress/data/sequence.h +++ b/engines/lastexpress/data/sequence.h @@ -77,6 +77,8 @@ #include "lastexpress/shared.h" #include "common/array.h" +#include "common/rect.h" +#include "common/str.h" namespace Common { class SeekableReadStream; diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp index bd2320726a..a50fa7be08 100644 --- a/engines/lastexpress/data/snd.cpp +++ b/engines/lastexpress/data/snd.cpp @@ -30,12 +30,48 @@ #include "lastexpress/debug.h" -#include "audio/decoders/adpcm.h" +#include "audio/decoders/adpcm_intern.h" #include "audio/audiostream.h" +#include "common/debug.h" #include "common/memstream.h" +#include "common/system.h" +#include "common/textconsole.h" namespace LastExpress { +// Last Express ADPCM is similar to MS IMA mono, but inverts its nibbles +// and does not have the 4 byte per channel requirement + +class LastExpress_ADPCMStream : public Audio::Ima_ADPCMStream { +public: + LastExpress_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, uint32 blockSize) : + Audio::Ima_ADPCMStream(stream, disposeAfterUse, size, 44100, 1, blockSize) {} + + int readBuffer(int16 *buffer, const int numSamples) { + int samples = 0; + + assert(numSamples % 2 == 0); + + while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) { + if (_blockPos[0] == _blockAlign) { + // read block header + _status.ima_ch[0].last = _stream->readSint16LE(); + _status.ima_ch[0].stepIndex = _stream->readSint16LE(); + _blockPos[0] = 4; + } + + for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) { + byte data = _stream->readByte(); + _blockPos[0]++; + buffer[samples] = decodeIMA((data >> 4) & 0x0f); + buffer[samples + 1] = decodeIMA(data & 0x0f); + } + } + + return samples; + } +}; + ////////////////////////////////////////////////////////////////////////// // Sound ////////////////////////////////////////////////////////////////////////// @@ -60,7 +96,7 @@ void SimpleSound::loadHeader(Common::SeekableReadStream *in) { } Audio::AudioStream *SimpleSound::makeDecoder(Common::SeekableReadStream *in, uint32 size) const { - return Audio::makeADPCMStream(in, DisposeAfterUse::YES, size, Audio::kADPCMMSImaLastExpress, 44100, 1, _blockSize); + return new LastExpress_ADPCMStream(in, DisposeAfterUse::YES, size, _blockSize); } void SimpleSound::play(Audio::AudioStream *as) { diff --git a/engines/lastexpress/data/snd.h b/engines/lastexpress/data/snd.h index 2d28404f42..61d1c0951a 100644 --- a/engines/lastexpress/data/snd.h +++ b/engines/lastexpress/data/snd.h @@ -42,8 +42,8 @@ #include "audio/mixer.h" namespace Audio { - class AudioStream; - class QueuingAudioStream; +class AudioStream; +class QueuingAudioStream; } namespace Common { diff --git a/engines/lastexpress/data/subtitle.cpp b/engines/lastexpress/data/subtitle.cpp index 953edd1d1a..2bc5d3c5ad 100644 --- a/engines/lastexpress/data/subtitle.cpp +++ b/engines/lastexpress/data/subtitle.cpp @@ -33,7 +33,9 @@ #include "lastexpress/debug.h" #include "common/debug.h" +#include "common/rect.h" #include "common/stream.h" +#include "common/textconsole.h" namespace LastExpress { diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index ccef312cd6..8c6cc2bafc 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -35,6 +35,7 @@ #include "common/array.h" #include "common/func.h" #include "common/serializer.h" +#include "common/textconsole.h" namespace LastExpress { diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp index 81189ae633..c4d43d53d7 100644 --- a/engines/lastexpress/game/inventory.cpp +++ b/engines/lastexpress/game/inventory.cpp @@ -43,13 +43,13 @@ namespace LastExpress { -Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItem(kItemNone), _itemsShown(0), +Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItemIndex(0), _itemsShown(0), _showingHourGlass(false), _blinkingEgg(false), _blinkingTime(0), _blinkingInterval(_defaultBlinkingInterval), _blinkingBrightness(1), - _useMagnifier(false), _flag1(false), _isOpened(false), _eggHightlighted(false), _itemScene(NULL) { + _useMagnifier(false), _portraitHighlighted(false), _isOpened(false), _eggHightlighted(false), _itemScene(NULL) { - _inventoryRect = Common::Rect(0, 0, 32, 32); - _menuRect = Common::Rect(608, 448, 640, 480); - _selectedRect = Common::Rect(44, 0, 76, 32); + //_inventoryRect = Common::Rect(0, 0, 32, 32); + _menuEggRect = Common::Rect(608, 448, 640, 480); + _selectedItemRect = Common::Rect(44, 0, 76, 32); init(); } @@ -136,13 +136,14 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { _useMagnifier = false; // Egg (menu) - if (!_menuRect.contains(ev.mouse)) { + if (!_menuEggRect.contains(ev.mouse)) { // Remove highlight if needed if (_eggHightlighted) { if (!getGlobalTimer()) { drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, 1); askForRedraw(); } + _eggHightlighted = false; } } else { @@ -159,7 +160,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { // If clicked, show the menu if (ev.type == Common::EVENT_LBUTTONDOWN) { _eggHightlighted = false; - _flag1 = false; + _portraitHighlighted = false; _isOpened = false; getSound()->playSoundWithSubtitles("LIB039.SND", SoundManager::kFlagMenuClock, kEntityPlayer); @@ -178,14 +179,125 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { // Selected item if (ev.mouse.x >= 32) { - // TODO + if (_isOpened) { + // If clicked + if (ev.type == Common::EVENT_LBUTTONDOWN) { + if (_highlightedItemIndex != 0) { + error("[Inventory::handleMouseEvent] Click on highlighted item not implemented"); + } + } else { + warning("[Inventory::handleMouseEvent] Default handling of open menu not implemented"); + } + } else { + if (_portraitHighlighted) { + drawItem((CursorStyle)getProgress().portrait, 0, 0, 1); + askForRedraw(); + _portraitHighlighted = false; + } + + if (_selectedItem != kItemNone + && get(_selectedItem)->scene != kSceneNone + && _selectedItemRect.contains(ev.mouse)) { + error("[Inventory::handleMouseEvent] Default handling of selected item not implemented"); + } + } return; } // Opened inventory if (ev.mouse.y >= 32) { - // TODO + // Draw portrait (darkened) if the inventory is closed (and we are not on top of it) + if (!_isOpened) { + if (_portraitHighlighted) { + drawItem((CursorStyle)getProgress().portrait, 0, 0, 1); + askForRedraw(); + _portraitHighlighted = false; + } + + return; + } + + // Change item highlight on list + if (getFlags()->mouseLeftPressed) { + uint32 index = ev.mouse.y / 40; + + if (_highlightedItemIndex && _highlightedItemIndex != index) + drawHighlight(_highlightedItemIndex, true); + + if (index && index <= _itemsShown && index != _highlightedItemIndex) + drawHighlight(index, false); + + return; + } + + // User released the mouse button, check if we were on a valid item + uint32 index = _highlightedItemIndex ? getItemIndex(_highlightedItemIndex) : 0; + + // Reset items and portrait + drawItem((CursorStyle)getProgress().portrait, 0, 0, 1); + _engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(0, 44, 32, (int16)(40 * _itemsShown + 40))); + _highlightedItemIndex = 0; + _itemsShown = 0; + + // Load the scene if an item has been selected + if (index) { + InventoryEntry entry = _entries[index]; + + // If a scene is affected to the item + if (entry.scene) { + if (getState()->sceneUseBackup) { + if (getFirstExaminableItem() && !getState()->sceneBackup2) + getState()->sceneBackup2 = getState()->scene; + } else { + getState()->sceneUseBackup = true; + getState()->sceneBackup = getState()->scene; + } + + getScenes()->loadScene(entry.scene); + } + + if (entry.field_2) { + selectItem((InventoryItem)index); + } else { + drawSelectedItem(); + } + + // Set inventory as closed (will cause a cleanup on next call) + _isOpened = false; + + return; + } + + // Draw the currently selected item + drawSelectedItem(); + + // Stop processing if we are not looking at an item already + if (!getState()->sceneUseBackup) { + _isOpened = false; + return; + } + + SceneIndex scene = kSceneNone; + if (getState()->sceneBackup2) { + scene = getState()->sceneBackup2; + getState()->sceneBackup2 = kSceneNone; + } else { + if (getEvent(kEventKronosBringFirebird) || getProgress().isEggOpen) { + _isOpened = false; + return; + } + + getState()->sceneUseBackup = false; + scene = getState()->sceneBackup; + + if (getEntities()->getPosition(getScenes()->get(scene)->car, getScenes()->get(scene)->position)) + scene = getScenes()->processIndex(getState()->sceneBackup); + } + + getScenes()->loadScene(scene); + + _isOpened = false; return; } @@ -202,10 +314,10 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { return; } - if (!_flag1 && !_isOpened) { + if (!_portraitHighlighted && !_isOpened) { drawItem((CursorStyle)getProgress().portrait, 0, 0); - _flag1 = true; - } else if (!_isOpened || (ev.type == Common::EVENT_LBUTTONDOWN || ev.type == Common::EVENT_LBUTTONUP)) { + _portraitHighlighted = true; + } else if (!_isOpened || getFlags()->mouseLeftPressed) { // Do nothing } else if (_isOpened) { close(); @@ -239,12 +351,12 @@ void Inventory::handleMouseEvent(const Common::Event &ev) { } } - _flag1 = true; + _portraitHighlighted = true; } // Draw highlighted item - if (_highlightedItem) - drawHighlight(); + if (_highlightedItemIndex) + drawHighlight(_highlightedItemIndex, true); } } @@ -256,7 +368,7 @@ void Inventory::show() { askForRedraw(); // Show portrait (first draw, cannot be highlighted) - drawItem((CursorStyle)getProgress().portrait, 0, 0); + drawItem((CursorStyle)getProgress().portrait, 0, 0, 1); // Show selected item if (_selectedItem != kItemNone) @@ -511,9 +623,27 @@ void Inventory::drawItem(CursorStyle id, uint16 x, uint16 y, int16 brightnessInd _engine->getGraphicsManager()->draw(&icon, GraphicsManager::kBackgroundInventory); } -// Close inventory: clear items and reset icon +void Inventory::drawSelectedItem() { + // Draw the selected item if any + if (!_selectedItem || get(_selectedItem)->manualSelect) { + _selectedItem = getFirstExaminableItem(); + + if (_selectedItem) { + drawItem(get(_selectedItem)->cursor, 44, 0); + } else { + clearSelectedItem(); + } + askForRedraw(); + } +} + +void Inventory::clearSelectedItem() { + _engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(44, 0, 44 + 32, 32)); +} + +// Open inventory: show portrait selected and draw contents void Inventory::open() { - _flag1 = false; + _portraitHighlighted = false; _isOpened = true; // Draw highlighted portrait @@ -552,9 +682,18 @@ void Inventory::close() { askForRedraw(); } -void Inventory::drawHighlight() { - int32 count = 0; - uint32 index = 0; +void Inventory::drawHighlight(uint32 currentIndex, bool reset) { + uint32 index = getItemIndex(currentIndex); + + if (index) { + drawItem(_entries[index].cursor, 0, 40 * currentIndex + 4, reset ? 1 : -1); + _highlightedItemIndex = reset ? 0 : currentIndex; + askForRedraw(); + } +} + +uint32 Inventory::getItemIndex(uint32 currentIndex) { + uint32 count = 0; for (uint32 i = 1; i < ARRAYSIZE(_entries); i++) { if (!_entries[i].isPresent) @@ -565,17 +704,13 @@ void Inventory::drawHighlight() { if (count < 11) { ++count; - if (count == _highlightedItem) { - index = i; - break; - } + + if (count == currentIndex) + return i; } } - if (index) { - drawItem(_entries[index].cursor, 0, 40 * _highlightedItem + 4, 1); - _highlightedItem = kItemNone; - } + return 0; } } // End of namespace LastExpress diff --git a/engines/lastexpress/game/inventory.h b/engines/lastexpress/game/inventory.h index 860f8257fe..9a885438eb 100644 --- a/engines/lastexpress/game/inventory.h +++ b/engines/lastexpress/game/inventory.h @@ -120,7 +120,7 @@ public: // State bool isMagnifierInUse() { return _useMagnifier; } - bool isFlag1() { return _flag1; } + bool isPortraitHighlighted() { return _portraitHighlighted; } bool isOpened() { return _isOpened; } bool isEggHighlighted() { return _eggHightlighted; } @@ -142,7 +142,7 @@ private: InventoryEntry _entries[32]; InventoryItem _selectedItem; - InventoryItem _highlightedItem; + uint32 _highlightedItemIndex; uint32 _itemsShown; @@ -154,27 +154,31 @@ private: // Flags bool _useMagnifier; - bool _flag1; + bool _portraitHighlighted; bool _isOpened; bool _eggHightlighted; Scene *_itemScene; // Important rects - Common::Rect _inventoryRect; - Common::Rect _menuRect; - Common::Rect _selectedRect; + //Common::Rect _inventoryRect; + Common::Rect _menuEggRect; + Common::Rect _selectedItemRect; void init(); void open(); void close(); void examine(InventoryItem item); - void drawHighlight(); + void drawHighlight(uint32 currentIndex, bool reset); + uint32 getItemIndex(uint32 currentIndex); bool isItemSceneParameter(InventoryItem item) const; void drawItem(CursorStyle id, uint16 x, uint16 y, int16 brighnessIndex = -1); + + void drawSelectedItem(); + void clearSelectedItem(); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp index bfed65eb4a..83e067f67c 100644 --- a/engines/lastexpress/game/logic.cpp +++ b/engines/lastexpress/game/logic.cpp @@ -89,7 +89,7 @@ Logic::~Logic() { #define REDRAW_CURSOR() { \ if (getInventory()->isMagnifierInUse()) \ _engine->getCursor()->setStyle(kCursorMagnifier); \ - if (getInventory()->isFlag1() \ + if (getInventory()->isPortraitHighlighted() \ || getInventory()->isOpened() \ || getInventory()->isEggHighlighted()) \ _engine->getCursor()->setStyle(kCursorNormal); \ @@ -104,7 +104,7 @@ void Logic::eventMouse(const Common::Event &ev) { getFlags()->mouseRightClick = false; // Process event flags - if (ev.type == Common::EVENT_LBUTTONUP) { + if (ev.type == Common::EVENT_LBUTTONDOWN) { if (getFlags()->frameInterval) _ignoreFrameInterval = false; @@ -113,7 +113,7 @@ void Logic::eventMouse(const Common::Event &ev) { } if (getFlags()->flag_0) { - if (ev.type == Common::EVENT_LBUTTONUP || ev.type == Common::EVENT_RBUTTONUP) { + if (ev.type == Common::EVENT_LBUTTONDOWN || ev.type == Common::EVENT_RBUTTONDOWN) { getFlags()->flag_0 = false; getFlags()->shouldRedraw = true; updateCursor(true); @@ -143,7 +143,7 @@ void Logic::eventMouse(const Common::Event &ev) { && !getProgress().isEggOpen && !getEntities()->isPlayerPosition(kCarGreenSleeping, 59) && !getEntities()->isPlayerPosition(kCarGreenSleeping, 76) - && !getInventory()->isFlag1() + && !getInventory()->isPortraitHighlighted() && !getInventory()->isOpened() && !getInventory()->isEggHighlighted() && !getInventory()->isMagnifierInUse()) { @@ -173,7 +173,7 @@ void Logic::eventMouse(const Common::Event &ev) { if (getInventory()->getSelectedItem() == kItemMatch && (getEntities()->isPlayerInCar(kCarGreenSleeping) || getEntities()->isPlayerInCar(kCarRedSleeping)) && getProgress().jacket == kJacketGreen - && !getInventory()->isFlag1() + && !getInventory()->isPortraitHighlighted() && !getInventory()->isOpened() && !getInventory()->isEggHighlighted() && !getInventory()->isMagnifierInUse() @@ -198,7 +198,7 @@ void Logic::eventMouse(const Common::Event &ev) { // Handle entity item case EntityIndex entityIndex = getEntities()->canInteractWith(ev.mouse); if (entityIndex - && !getInventory()->isFlag1() + && !getInventory()->isPortraitHighlighted() && !getInventory()->isOpened() && !getInventory()->isEggHighlighted() && !getInventory()->isMagnifierInUse()) { @@ -223,17 +223,17 @@ void Logic::eventMouse(const Common::Event &ev) { ////////////////////////////////////////////////////////////////////////// // Handle standard actions - if (getInventory()->isFlag1() || getInventory()->isOpened() || getInventory()->isEggHighlighted()) + if (getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted()) _engine->getCursor()->setStyle(kCursorNormal); - if (hotspotHandled || getInventory()->isFlag1() || getInventory()->isOpened() || getInventory()->isEggHighlighted()) + if (hotspotHandled || getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted()) return; // Magnifier in use if (getInventory()->isMagnifierInUse()) { _engine->getCursor()->setStyle(kCursorMagnifier); - if (getInventory()->isFlag1() + if (getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted()) _engine->getCursor()->setStyle(kCursorNormal); @@ -518,7 +518,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe || getProgress().isEggOpen || getEntities()->isPlayerPosition(kCarGreenSleeping, 59) || getEntities()->isPlayerPosition(kCarGreenSleeping, 76) - || getInventory()->isFlag1() + || getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted() || getInventory()->isMagnifierInUse()) { @@ -526,7 +526,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe if (getInventory()->getSelectedItem() != kItemMatch || (!getEntities()->isPlayerInCar(kCarGreenSleeping) && !getEntities()->isPlayerInCar(kCarRedSleeping)) || getProgress().jacket != kJacketGreen - || getInventory()->isFlag1() + || getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted() || getInventory()->isMagnifierInUse() @@ -536,7 +536,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe EntityIndex entity = getEntities()->canInteractWith(getCoords()); if (entity - && !getInventory()->isFlag1() + && !getInventory()->isPortraitHighlighted() && !getInventory()->isOpened() && !getInventory()->isEggHighlighted() && !getInventory()->isMagnifierInUse()) { @@ -550,7 +550,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe } if (!interact - && !getInventory()->isFlag1() + && !getInventory()->isPortraitHighlighted() && !getInventory()->isOpened() && !getInventory()->isEggHighlighted() && !getInventory()->isMagnifierInUse()) { @@ -587,7 +587,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe if (getInventory()->isMagnifierInUse()) style = kCursorMagnifier; - if (getInventory()->isFlag1() || getInventory()->isOpened() || getInventory()->isEggHighlighted()) + if (getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted()) style = kCursorNormal; _engine->getCursor()->setStyle(style); diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h index d97ebc1b55..663550acc2 100644 --- a/engines/lastexpress/game/state.h +++ b/engines/lastexpress/game/state.h @@ -28,8 +28,10 @@ #include "lastexpress/shared.h" +#include "common/rect.h" #include "common/serializer.h" #include "common/system.h" +#include "common/textconsole.h" namespace LastExpress { @@ -564,6 +566,9 @@ public: bool mouseLeftClick; bool mouseRightClick; + bool mouseLeftPressed; + bool mouseRightPressed; + bool flag_entities_0; bool flag_entities_1; @@ -585,6 +590,9 @@ public: mouseRightClick = false; mouseLeftClick = false; + mouseLeftPressed = false; + mouseRightPressed = false; + flag_entities_0 = false; flag_entities_1 = false; diff --git a/engines/lastexpress/graphics.cpp b/engines/lastexpress/graphics.cpp index e5a69d16ea..c45baba808 100644 --- a/engines/lastexpress/graphics.cpp +++ b/engines/lastexpress/graphics.cpp @@ -25,20 +25,23 @@ #include "lastexpress/graphics.h" +#include "common/rect.h" #include "common/system.h" +#include "common/textconsole.h" namespace LastExpress { #define COLOR_KEY 0xFFFF GraphicsManager::GraphicsManager() : _changed(false) { - _screen.create(640, 480, 2); + const Graphics::PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 0); + _screen.create(640, 480, format); // Create the game surfaces - _backgroundA.create(640, 480, 2); - _backgroundC.create(640, 480, 2); - _overlay.create(640, 480, 2); - _inventory.create(640, 480, 2); + _backgroundA.create(640, 480, format); + _backgroundC.create(640, 480, format); + _overlay.create(640, 480, format); + _inventory.create(640, 480, format); clear(kBackgroundAll); } diff --git a/engines/lastexpress/lastexpress.cpp b/engines/lastexpress/lastexpress.cpp index 7c08fef627..535f5e86b7 100644 --- a/engines/lastexpress/lastexpress.cpp +++ b/engines/lastexpress/lastexpress.cpp @@ -215,6 +215,7 @@ bool LastExpressEngine::handleEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_LBUTTONDOWN: getGameLogic()->getGameState()->getGameFlags()->mouseLeftClick = true; + getGameLogic()->getGameState()->getGameFlags()->mouseLeftPressed = (ev.type == Common::EVENT_LBUTTONDOWN) ? true : false; // Adjust frameInterval flag if (_frameCounter < _lastFrameCount + 30) @@ -228,6 +229,8 @@ bool LastExpressEngine::handleEvents() { case Common::EVENT_RBUTTONUP: case Common::EVENT_RBUTTONDOWN: getGameLogic()->getGameState()->getGameFlags()->mouseRightClick = true; + getGameLogic()->getGameState()->getGameFlags()->mouseRightPressed = (ev.type == Common::EVENT_RBUTTONDOWN) ? true : false; + if (_eventMouse && _eventMouse->isValid()) (*_eventMouse)(ev); break; diff --git a/engines/lastexpress/resource.cpp b/engines/lastexpress/resource.cpp index 5a77b23602..dff686a503 100644 --- a/engines/lastexpress/resource.cpp +++ b/engines/lastexpress/resource.cpp @@ -34,6 +34,7 @@ #include "common/debug.h" #include "common/file.h" +#include "common/textconsole.h" namespace LastExpress { |