ALL: Sync with ScummVM - rev a94849abc4

This commit is contained in:
Pawel Kolodziejski 2020-06-24 02:01:11 +02:00
parent 7ca866cbe0
commit 17df02d25d
6 changed files with 43 additions and 11 deletions

View File

@ -80,6 +80,13 @@ public:
* currently represents a pause request.
*/
void clear();
/**
* Returns true if the PauseToken represents a pause level,
* false if it is empty.
*/
bool isActive() const { return _engine != nullptr; }
private:
PauseToken(Engine *);

View File

@ -34,6 +34,7 @@
#include "engines/wintermute/base/file/base_package.h"
#include "engines/wintermute/base/base_engine.h"
#include "engines/wintermute/wintermute.h"
#include "common/algorithm.h"
#include "common/debug.h"
#include "common/str.h"
#include "common/tokenizer.h"
@ -372,6 +373,10 @@ uint32 BaseFileManager::getPackageVersion(const Common::String &filename) {
//////////////////////////////////////////////////////////////////////////
bool BaseFileManager::hasFile(const Common::String &filename) {
Common::String backwardSlashesPath = filename;
// correct slashes
Common::replace(backwardSlashesPath.begin(), backwardSlashesPath.end(), '/', '\\');
if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) {
BasePersistenceManager pm(BaseEngine::instance().getGameTargetName());
if (filename.size() <= 9) {
@ -386,7 +391,7 @@ bool BaseFileManager::hasFile(const Common::String &filename) {
if (diskFileExists(filename)) {
return true;
}
if (_packages.hasFile(filename)) {
if (_packages.hasFile(backwardSlashesPath)) {
return true; // We don't bother checking if the file can actually be opened, something bigger is wrong if that is the case.
}
if (!_detectionMode && _resources->hasFile(filename)) {

View File

@ -197,7 +197,6 @@ public:
int32 getWidth() const { return _width; }
int32 getHeight() const { return _height; }
protected:
int32 _height;
int32 _width;

View File

@ -30,7 +30,7 @@
#include "engines/wintermute/video/video_theora_player.h"
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/base_file_manager.h"
#include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h"
#include "engines/wintermute/base/gfx/base_surface.h"
#include "engines/wintermute/base/gfx/base_image.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
#include "engines/wintermute/base/sound/base_sound_manager.h"
@ -143,7 +143,7 @@ bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common:
// Additional setup.
_surface.create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight(), _theoraDecoder->getPixelFormat());
_texture = new BaseSurfaceOSystem(_gameRef);
_texture = _gameRef->_renderer->createSurface();
_texture->create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight());
_state = THEORA_STATE_PLAYING;
_playZoom = 100;

View File

@ -63,7 +63,7 @@ public:
ThemeLayout(ThemeLayout *p) :
_parent(p), _x(0), _y(0), _w(-1), _h(-1),
_defaultW(-1), _defaultH(-1),
_textHAlign(Graphics::kTextAlignInvalid) {}
_textHAlign(Graphics::kTextAlignInvalid), _useRTL(true) {}
virtual ~ThemeLayout() {
for (uint i = 0; i < _children.size(); ++i)
@ -115,6 +115,7 @@ protected:
public:
virtual bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
bool getUseRTL() { return _useRTL; }
virtual Graphics::TextAlign getWidgetTextHAlign(const Common::String &name);
@ -220,7 +221,7 @@ protected:
class ThemeLayoutWidget : public ThemeLayout {
public:
ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, bool &useRTL) : ThemeLayout(p), _name(name) {
ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, bool useRTL) : ThemeLayout(p), _name(name) {
_w = _defaultW = w;
_h = _defaultH = h;
_useRTL = useRTL;
@ -255,7 +256,7 @@ class ThemeLayoutTabWidget : public ThemeLayoutWidget {
public:
ThemeLayoutTabWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, int tabHeight):
ThemeLayoutWidget(p, name, w, h, align, _useRTL) {
ThemeLayoutWidget(p, name, w, h, align, p->getUseRTL()) {
_tabHeight = tabHeight;
}
@ -266,7 +267,7 @@ public:
}
bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) override {
if (ThemeLayoutWidget::getWidgetData(name, x, y, w, h, _useRTL)) {
if (ThemeLayoutWidget::getWidgetData(name, x, y, w, h, useRTL)) {
h -= _tabHeight;
return true;
}

View File

@ -69,8 +69,13 @@ void TabWidget::init() {
int x = _w - _butRP - _butW * 2 - 2;
int y = _butTP - _tabHeight;
_navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", nullptr, kCmdLeft);
_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", nullptr, kCmdRight);
String leftArrow = g_gui.useRTL() ? ">" : "<";
String rightArrow = g_gui.useRTL() ? "<" : ">";
_navLeft = new ButtonWidget(this, x, y, _butW, _butH, leftArrow, nullptr, kCmdLeft);
_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, rightArrow, nullptr, kCmdRight);
_navLeft->setEnabled(false);
_navRight->setEnabled(true);
@ -275,12 +280,26 @@ bool TabWidget::handleKeyDown(Common::KeyState state) {
void TabWidget::adjustTabs(int value) {
// Determine which tab is next
int tabID = _activeTab + value;
int lastVis = _lastVisibleTab;
if (tabID >= (int)_tabs.size())
tabID = 0;
else if (tabID < 0)
tabID = ((int)_tabs.size() - 1);
setActiveTab(tabID);
if (_navButtonsVisible) {
if (lastVis != _lastVisibleTab) {
_navLeft->setEnabled(true);
_navRight->setEnabled(true);
}
if (_firstVisibleTab == 0)
_navLeft->setEnabled(false);
else if (_lastVisibleTab == (int)_tabs.size() - 1)
_navRight->setEnabled(false);
}
}
int TabWidget::getFirstVisible() const {
@ -371,12 +390,13 @@ void TabWidget::drawWidget() {
tabs.push_back(_tabs[i].title);
widths.push_back(_tabs[i]._tabWidth);
}
g_gui.theme()->drawDialogBackground(
Common::Rect(_x + _bodyLP, _y + _bodyTP, _x + _w - _bodyRP, _y + _h - _bodyBP + _tabHeight),
_bodyBackgroundType);
g_gui.theme()->drawTab(Common::Rect(_x, _y, _x + _w, _y + _h), _tabHeight, widths, tabs,
_activeTab - _firstVisibleTab);
_activeTab - _firstVisibleTab, (g_gui.useRTL() && _useRTL));
}
void TabWidget::draw() {