From d6b9d7de8f4bc8be34ef7456a89ee144172ca5b0 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Tue, 29 Oct 2013 02:55:31 +0100 Subject: WINTERMUTE: Remove BasePlatform::setRect (replace with member-call) --- engines/wintermute/base/base_active_rect.cpp | 2 +- engines/wintermute/base/base_game.cpp | 10 +++--- engines/wintermute/base/base_region.cpp | 2 +- engines/wintermute/base/base_sub_frame.cpp | 14 ++++----- engines/wintermute/base/base_viewport.cpp | 3 +- engines/wintermute/base/font/base_font_bitmap.cpp | 3 +- .../wintermute/base/font/base_font_truetype.cpp | 3 +- engines/wintermute/base/gfx/base_renderer.cpp | 2 +- engines/wintermute/base/particles/part_emitter.cpp | 3 +- engines/wintermute/math/rect32.h | 8 +++++ engines/wintermute/platform_osystem.cpp | 10 ------ engines/wintermute/ui/ui_button.cpp | 2 +- engines/wintermute/ui/ui_tiled_image.cpp | 36 +++++++++++----------- engines/wintermute/video/video_theora_player.cpp | 3 +- 14 files changed, 46 insertions(+), 55 deletions(-) (limited to 'engines/wintermute') diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp index 548b85b0c5..69cc7b02b6 100644 --- a/engines/wintermute/base/base_active_rect.cpp +++ b/engines/wintermute/base/base_active_rect.cpp @@ -52,7 +52,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) { BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX, float zoomY, bool precise) : BaseClass(inGame) { _owner = owner; _frame = frame; - BasePlatform::setRect(&_rect, x, y, x + width, y + height); + _rect.setRect(x, y, x + width, y + height); _zoomX = zoomX; _zoomY = zoomY; _precise = precise; diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 47a081eca4..033f019712 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -1123,7 +1123,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack BaseUtils::swap(&top, &bottom); } - BasePlatform::setRect(&_mouseLockRect, left, top, right, bottom); + _mouseLockRect.setRect(left, top, right, bottom); stack->pushNULL(); return STATUS_OK; @@ -3361,10 +3361,10 @@ bool BaseGame::getCurrentViewportRect(Rect32 *rect, bool *custom) const { *custom = true; } } else { - BasePlatform::setRect(rect, _renderer->_drawOffsetX, - _renderer->_drawOffsetY, - _renderer->getWidth() + _renderer->_drawOffsetX, - _renderer->getHeight() + _renderer->_drawOffsetY); + rect->setRect(_renderer->_drawOffsetX, + _renderer->_drawOffsetY, + _renderer->getWidth() + _renderer->_drawOffsetX, + _renderer->getHeight() + _renderer->_drawOffsetY); if (custom) { *custom = false; } diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index 94f1c9a3a3..2953adc8a5 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -502,7 +502,7 @@ bool BaseRegion::getBoundingRect(Rect32 *rect) { maxX = MAX(maxX, _points[i]->x); maxY = MAX(maxY, _points[i]->y); } - BasePlatform::setRect(rect, minX, minY, maxX, maxY); + rect->setRect(minX, minY, maxX, maxY); } return STATUS_OK; } diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index b99ee3a4d8..490a9945db 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -34,7 +34,6 @@ #include "engines/wintermute/base/base_surface_storage.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_engine.h" -#include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script_stack.h" @@ -219,7 +218,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) { Rect32 BaseSubFrame::getRect() { if (_wantsDefaultRect && _surface) { - BasePlatform::setRect(&_rect, 0, 0, _surface->getWidth(), _surface->getHeight()); + _rect.setRect(0, 0, _surface->getWidth(), _surface->getHeight()); _wantsDefaultRect = false; } return _rect; @@ -294,11 +293,10 @@ bool BaseSubFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, flo float ratioX = scaleX / 100.0f; float ratioY = scaleY / 100.0f; - BasePlatform::setRect(rect, - (int)(x - _hotspotX * ratioX), - (int)(y - _hotspotY * ratioY), - (int)(x - _hotspotX * ratioX + (getRect().right - getRect().left) * ratioX), - (int)(y - _hotspotY * ratioY + (getRect().bottom - getRect().top) * ratioY)); + rect->setRect((int)(x - _hotspotX * ratioX), + (int)(y - _hotspotY * ratioY), + (int)(x - _hotspotX * ratioX + (getRect().right - getRect().left) * ratioX), + (int)(y - _hotspotY * ratioY + (getRect().bottom - getRect().top) * ratioY)); return true; } @@ -320,7 +318,7 @@ bool BaseSubFrame::saveAsText(BaseDynamicBuffer *buffer, int indent, bool comple Rect32 rect; rect.setEmpty(); if (_surface) { - BasePlatform::setRect(&rect, 0, 0, _surface->getWidth(), _surface->getHeight()); + rect.setRect(0, 0, _surface->getWidth(), _surface->getHeight()); } if (!(rect == getRect())) { buffer->putTextIndent(indent + 2, "RECT { %d,%d,%d,%d }\n", getRect().left, getRect().top, getRect().right, getRect().bottom); diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index a420585168..acc0ee7561 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -29,7 +29,6 @@ #include "engines/wintermute/base/base_viewport.h" #include "engines/wintermute/base/base_engine.h" #include "engines/wintermute/base/base_persistence_manager.h" -#include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/base/gfx/base_renderer.h" namespace Wintermute { @@ -73,7 +72,7 @@ bool BaseViewport::setRect(int32 left, int32 top, int32 right, int32 bottom, boo bottom = MIN(bottom, BaseEngine::instance().getRenderer()->getHeight()); } - BasePlatform::setRect(&_rect, left, top, right, bottom); + _rect.setRect(left, top, right, bottom); _offsetX = left; _offsetY = top; return STATUS_OK; diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp index 2b5fe0d1ff..dd54e5eb3f 100644 --- a/engines/wintermute/base/font/base_font_bitmap.cpp +++ b/engines/wintermute/base/font/base_font_bitmap.cpp @@ -37,7 +37,6 @@ #include "engines/wintermute/base/base_frame.h" #include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/base/base_file_manager.h" -#include "engines/wintermute/platform_osystem.h" namespace Wintermute { @@ -253,7 +252,7 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) { tileWidth = _widths[c]; } - BasePlatform::setRect(&rect, col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1)*_tileHeight); + rect.setRect(col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1) * _tileHeight); bool handled = false; if (_sprite) { _sprite->getCurrentFrame(); diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 8f0484f99c..13e88f5734 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -34,7 +34,6 @@ #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/utils/utils.h" -#include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/wintermute.h" #include "graphics/fonts/ttf.h" #include "graphics/fontman.h" @@ -227,7 +226,7 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign // and paint it if (surface) { Rect32 rc; - BasePlatform::setRect(&rc, 0, 0, surface->getWidth(), surface->getHeight()); + rc.setRect(0, 0, surface->getWidth(), surface->getHeight()); for (uint32 i = 0; i < _layers.size(); i++) { uint32 color = _layers[i]->_color; uint32 origForceAlpha = renderer->_forceAlphaColor; diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index 93364c4042..818010e00e 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -374,7 +374,7 @@ bool BaseRenderer::displayIndicator() { } if (_saveLoadImage && !_hasDrawnSaveLoadImage) { Rect32 rc; - BasePlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight()); + rc.setRect(0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight()); if (_loadInProgress) { _saveLoadImage->displayTrans(_loadImageX, _loadImageY, rc); } else { diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index 3d83562447..c5c049a37c 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -38,7 +38,6 @@ #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/utils/utils.h" -#include "engines/wintermute/platform_osystem.h" #include "common/str.h" #include "common/math.h" @@ -386,7 +385,7 @@ bool PartEmitter::compareZ(const PartParticle *p1, const PartParticle *p2) { ////////////////////////////////////////////////////////////////////////// bool PartEmitter::setBorder(int x, int y, int width, int height) { - BasePlatform::setRect(&_border, x, y, x + width, y + height); + _border.setRect(x, y, x + width, y + height); return STATUS_OK; } diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h index 4eb00b199a..a4a64690e2 100644 --- a/engines/wintermute/math/rect32.h +++ b/engines/wintermute/math/rect32.h @@ -104,6 +104,14 @@ struct Rect32 { right += dx; bottom += dy; } + + void setRect(int32 newLeft, int32 newTop, int32 newRight, int32 newBottom) { + this->left = newLeft; + this->top = newTop; + this->right = newRight; + this->bottom = newBottom; + } + /** * Check if the given rect is equal to this one. * diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index 303530bbf6..9fa23c6074 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_osystem.cpp @@ -173,16 +173,6 @@ bool BasePlatform::ptInRect(Rect32 *lprc, Point32 p) { return (p.x >= lprc->left) && (p.x < lprc->right) && (p.y >= lprc->top) && (p.y < lprc->bottom); } -////////////////////////////////////////////////////////////////////////// -bool BasePlatform::setRect(Rect32 *lprc, int left, int top, int right, int bottom) { - lprc->left = left; - lprc->top = top; - lprc->right = right; - lprc->bottom = bottom; - - return true; -} - ////////////////////////////////////////////////////////////////////////// bool BasePlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2) { if (lprcSrc1->isRectEmpty() || lprcSrc2->isRectEmpty() || diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index f2933f4d75..3cc33f2362 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -655,7 +655,7 @@ bool UIButton::display(int offsetX, int offsetY) { BaseFont *font = 0; //RECT rect; - //BasePlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height); + //rect.setRect(OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height); //_hover = (!_disable && BasePlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE); _hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN)); diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index 66fd3f50a7..e895477a36 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -267,19 +267,19 @@ bool UITiledImage::loadBuffer(char *buffer, bool complete) { if (vTiles && hTiles) { // up row - BasePlatform::setRect(&_upLeft, 0, 0, h1, v1); - BasePlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1); - BasePlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1); + _upLeft.setRect(0, 0, h1, v1); + _upMiddle.setRect(h1, 0, h1 + h2, v1); + _upRight.setRect(h1 + h2, 0, h1 + h2 + h3, v1); // middle row - BasePlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2); - BasePlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2); - BasePlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2); + _middleLeft.setRect(0, v1, h1, v1 + v2); + _middleMiddle.setRect(h1, v1, h1 + h2, v1 + v2); + _middleRight.setRect(h1 + h2, v1, h1 + h2 + h3, v1 + v2); // down row - BasePlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3); - BasePlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3); - BasePlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3); + _downLeft.setRect(0, v1 + v2, h1, v1 + v2 + v3); + _downMiddle.setRect(h1, v1 + v2, h1 + h2, v1 + v2 + v3); + _downRight.setRect(h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3); } // default @@ -288,33 +288,33 @@ bool UITiledImage::loadBuffer(char *buffer, bool complete) { int height = _image->_surface->getHeight() / 3; if (_upLeft.isRectEmpty()) { - BasePlatform::setRect(&_upLeft, 0, 0, width, height); + _upLeft.setRect(0, 0, width, height); } if (_upMiddle.isRectEmpty()) { - BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height); + _upMiddle.setRect(width, 0, 2 * width, height); } if (_upRight.isRectEmpty()) { - BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height); + _upRight.setRect(2 * width, 0, 3 * width, height); } if (_middleLeft.isRectEmpty()) { - BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height); + _middleLeft.setRect(0, height, width, 2 * height); } if (_middleMiddle.isRectEmpty()) { - BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height); + _middleMiddle.setRect(width, height, 2 * width, 2 * height); } if (_middleRight.isRectEmpty()) { - BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height); + _middleRight.setRect(2 * width, height, 3 * width, 2 * height); } if (_downLeft.isRectEmpty()) { - BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height); + _downLeft.setRect(0, 2 * height, width, 3 * height); } if (_downMiddle.isRectEmpty()) { - BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height); + _downMiddle.setRect(width, 2 * height, 2 * width, 3 * height); } if (_downRight.isRectEmpty()) { - BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height); + _downRight.setRect(2 * width, 2 * height, 3 * width, 3 * height); } } diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index 6b2037aa4f..5dbb301374 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -34,7 +34,6 @@ #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" -#include "engines/wintermute/platform_osystem.h" #include "video/theora_decoder.h" #include "engines/wintermute/wintermute.h" #include "common/system.h" @@ -396,7 +395,7 @@ bool VideoTheoraPlayer::display(uint32 alpha) { bool res; if (_texture && _videoFrameReady) { - BasePlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight()); + rc.setRect(0, 0, _texture->getWidth(), _texture->getHeight()); if (_playZoom == 100.0f) { res = _texture->displayTrans(_posX, _posY, rc, alpha); } else { -- cgit v1.2.3