diff options
author | Colin Snover | 2017-10-06 22:05:57 -0500 |
---|---|---|
committer | Colin Snover | 2017-10-06 22:56:26 -0500 |
commit | c7c5f28bdb2f393c1290bcac803cf9fc86ac8ed8 (patch) | |
tree | a58ee49fcb2271f8c399220d2946b47b648c7b4a /engines/sci/engine | |
parent | d53e7787391683830f57c77cc8acd87c50444d40 (diff) | |
download | scummvm-rg350-c7c5f28bdb2f393c1290bcac803cf9fc86ac8ed8.tar.gz scummvm-rg350-c7c5f28bdb2f393c1290bcac803cf9fc86ac8ed8.tar.bz2 scummvm-rg350-c7c5f28bdb2f393c1290bcac803cf9fc86ac8ed8.zip |
SCI32: Clean up scriptWidth/scriptHeight/screenWidth/screenHeight
This removes the unnecessary Buffer subclass and stops most places
where the output buffer was being interrogated about dimensions
instead of GfxFrameout.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 31 | ||||
-rw-r--r-- | engines/sci/engine/kvideo.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/segment.h | 6 |
4 files changed, 22 insertions, 21 deletions
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 02b2cea9a9..f9c1edee42 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -77,7 +77,7 @@ reg_t kBaseSetter32(EngineState *s, int argc, reg_t *argv) { Ratio scaleX; if (getSciVersion() < SCI_VERSION_2_1_LATE) { - const int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth; + const int16 scriptWidth = g_sci->_gfxFrameout->getScriptWidth(); scaleX = Ratio(scriptWidth, celObj._xResolution); } @@ -160,11 +160,12 @@ reg_t kShakeScreen32(EngineState *s, int argc, reg_t *argv) { } reg_t kIsHiRes(EngineState *s, int argc, reg_t *argv) { - const Buffer &buffer = g_sci->_gfxFrameout->getCurrentBuffer(); - if (buffer.screenWidth < 640 || buffer.screenHeight < 400) - return make_reg(0, 0); + const GfxFrameout *gfxFrameout = g_sci->_gfxFrameout; + if (gfxFrameout->getScreenWidth() < 640 || gfxFrameout->getScreenHeight() < 400) { + return NULL_REG; + } - return make_reg(0, 1); + return TRUE_REG; } reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv) { @@ -412,25 +413,25 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) { } reg_t kCelHigh32(EngineState *s, int argc, reg_t *argv) { - GuiResourceId resourceId = argv[0].toUint16(); - int16 loopNo = argv[1].toSint16(); - int16 celNo = argv[2].toSint16(); - CelObjView celObj(resourceId, loopNo, celNo); + const GuiResourceId resourceId = argv[0].toUint16(); + const int16 loopNo = argv[1].toSint16(); + const int16 celNo = argv[2].toSint16(); + const CelObjView celObj(resourceId, loopNo, celNo); int16 height = celObj._height; if (getSciVersion() < SCI_VERSION_2_1_LATE) { - height = mulru(height, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, celObj._yResolution)); + height = mulru(height, Ratio(g_sci->_gfxFrameout->getScriptHeight(), celObj._yResolution)); } return make_reg(0, height); } reg_t kCelWide32(EngineState *s, int argc, reg_t *argv) { - GuiResourceId resourceId = argv[0].toUint16(); - int16 loopNo = argv[1].toSint16(); - int16 celNo = argv[2].toSint16(); - CelObjView celObj(resourceId, loopNo, celNo); + const GuiResourceId resourceId = argv[0].toUint16(); + const int16 loopNo = argv[1].toSint16(); + const int16 celNo = argv[2].toSint16(); + const CelObjView celObj(resourceId, loopNo, celNo); int16 width = celObj._width; if (getSciVersion() < SCI_VERSION_2_1_LATE) { - width = mulru(width, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, celObj._xResolution)); + width = mulru(width, Ratio(g_sci->_gfxFrameout->getScriptWidth(), celObj._xResolution)); } return make_reg(0, width); } diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index 98b2ba2b85..1bd886c831 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -460,8 +460,8 @@ reg_t kPlayVMDShowCursor(EngineState *s, int argc, reg_t *argv) { } reg_t kPlayVMDSetBlackoutArea(EngineState *s, int argc, reg_t *argv) { - const int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth; - const int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight; + const int16 scriptWidth = g_sci->_gfxFrameout->getScriptWidth(); + const int16 scriptHeight = g_sci->_gfxFrameout->getScriptHeight(); Common::Rect blackoutArea; blackoutArea.left = MAX<int16>(0, argv[0].toSint16()); diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 06a26ec58e..a7ebe0b4df 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -801,7 +801,7 @@ void SciBitmap::saveLoadWithSerializer(Common::Serializer &s) { s.syncBytes(_data, _dataSize); if (s.isLoading()) { - _buffer = Buffer(getWidth(), getHeight(), getPixels()); + _buffer.init(getWidth(), getHeight(), getWidth(), getPixels(), Graphics::PixelFormat::createFormatCLUT8()); } } #endif diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h index 2a4fd9149b..14744e3e39 100644 --- a/engines/sci/engine/segment.h +++ b/engines/sci/engine/segment.h @@ -977,7 +977,7 @@ public: _data = (byte *)malloc(other._dataSize); memcpy(_data, other._data, other._dataSize); if (_dataSize) { - _buffer = Buffer(getWidth(), getHeight(), getPixels()); + _buffer.init(getWidth(), getHeight(), getWidth(), getPixels(), Graphics::PixelFormat::createFormatCLUT8()); } _gc = other._gc; } @@ -998,7 +998,7 @@ public: _data = (byte *)malloc(other._dataSize); memcpy(_data, other._data, _dataSize); if (_dataSize) { - _buffer = Buffer(getWidth(), getHeight(), getPixels()); + _buffer.init(getWidth(), getHeight(), getWidth(), getPixels(), Graphics::PixelFormat::createFormatCLUT8()); } _gc = other._gc; @@ -1032,7 +1032,7 @@ public: setXResolution(xResolution); setYResolution(yResolution); - _buffer = Buffer(getWidth(), getHeight(), getPixels()); + _buffer.init(getWidth(), getHeight(), getWidth(), getPixels(), Graphics::PixelFormat::createFormatCLUT8()); } inline int getRawSize() const { |