aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/ui/ui_tiled_image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/ui/ui_tiled_image.cpp')
-rw-r--r--engines/wintermute/ui/ui_tiled_image.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp
index 2b337330c7..be9f87cf58 100644
--- a/engines/wintermute/ui/ui_tiled_image.cpp
+++ b/engines/wintermute/ui/ui_tiled_image.cpp
@@ -42,7 +42,7 @@ IMPLEMENT_PERSISTENT(UITiledImage, false)
//////////////////////////////////////////////////////////////////////////
UITiledImage::UITiledImage(BaseGame *inGame) : BaseObject(inGame) {
- _image = NULL;
+ _image = nullptr;
BasePlatform::setRectEmpty(&_upLeft);
BasePlatform::setRectEmpty(&_upMiddle);
@@ -59,7 +59,7 @@ UITiledImage::UITiledImage(BaseGame *inGame) : BaseObject(inGame) {
//////////////////////////////////////////////////////////////////////////
UITiledImage::~UITiledImage() {
delete _image;
- _image = NULL;
+ _image = nullptr;
}
@@ -104,14 +104,11 @@ bool UITiledImage::display(int x, int y, int width, int height) {
}
// tiles
- yyy = y + (_upMiddle.bottom - _upMiddle.top);
- for (row = 0; row < nuRows; row++) {
+ if (nuRows > 0 && nuColumns > 0) {
+ yyy = y + (_upMiddle.bottom - _upMiddle.top);
xxx = x + (_upLeft.right - _upLeft.left);
- for (col = 0; col < nuColumns; col++) {
- _image->_surface->displayTrans(xxx, yyy, _middleMiddle);
- xxx += tileWidth;
- }
- yyy += tileWidth;
+ _image->_surface->displayTrans(xxx, yyy, _middleMiddle);
+ _image->_surface->repeatLastDisplayOp(tileWidth, tileWidth, nuColumns, nuRows);
}
_gameRef->_renderer->endSpriteBatch();
@@ -123,7 +120,7 @@ bool UITiledImage::display(int x, int y, int width, int height) {
//////////////////////////////////////////////////////////////////////////
bool UITiledImage::loadFile(const char *filename) {
byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename);
- if (buffer == NULL) {
+ if (buffer == nullptr) {
_gameRef->LOG(0, "UITiledImage::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@@ -208,7 +205,7 @@ bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
_image = new BaseSubFrame(_gameRef);
if (!_image || DID_FAIL(_image->setSurface((char *)params))) {
delete _image;
- _image = NULL;
+ _image = nullptr;
cmd = PARSERR_GENERIC;
}
break;