From 51e17d9f86d9063dd98924046c78ad23946b4ae9 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 20 Apr 2013 18:11:47 +0200 Subject: WINTERMUTE: Further reduce the amount of int->int32-confusion. --- engines/wintermute/ad/ad_inventory_box.cpp | 2 +- engines/wintermute/ad/ad_object.cpp | 10 ++-- engines/wintermute/ad/ad_response_box.cpp | 2 +- engines/wintermute/ad/ad_scene.cpp | 58 +++++++++++----------- engines/wintermute/ad/ad_scene.h | 8 +-- engines/wintermute/ad/ad_sentence.cpp | 8 +-- engines/wintermute/base/base_game.cpp | 10 ++-- .../wintermute/base/base_persistence_manager.cpp | 4 +- engines/wintermute/base/base_region.cpp | 2 +- engines/wintermute/base/base_sprite.cpp | 4 +- engines/wintermute/base/base_viewport.cpp | 6 +-- engines/wintermute/base/base_viewport.h | 2 +- .../wintermute/base/font/base_font_truetype.cpp | 2 +- engines/wintermute/ui/ui_edit.cpp | 18 +++---- 14 files changed, 68 insertions(+), 68 deletions(-) diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index 87554245cf..110359917b 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.cpp @@ -84,7 +84,7 @@ bool AdInventoryBox::listen(BaseScriptHolder *param1, uint32 param2) { _visible = false; } else if (scumm_stricmp(obj->getName(), "prev") == 0) { _scrollOffset -= _scrollBy; - _scrollOffset = MAX(_scrollOffset, 0); + _scrollOffset = MAX(_scrollOffset, 0); } else if (scumm_stricmp(obj->getName(), "next") == 0) { _scrollOffset += _scrollBy; } else { diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp index 6f9c85d3b5..b01caf6b2c 100644 --- a/engines/wintermute/ad/ad_object.cpp +++ b/engines/wintermute/ad/ad_object.cpp @@ -864,14 +864,14 @@ int AdObject::getHeight() { return 0; } else { BaseFrame *frame = _currentSprite->_frames[_currentSprite->_currentFrame]; - int ret = 0; + int32 ret = 0; for (uint32 i = 0; i < frame->_subframes.size(); i++) { ret = MAX(ret, frame->_subframes[i]->_hotspotY); } if (_zoomable) { float zoom = ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY); - ret = (int)(ret * zoom / 100); + ret = (int32)(ret * zoom / 100); } return ret; } @@ -945,7 +945,7 @@ void AdObject::talk(const char *text, const char *sound, uint32 duration, const } - int x, y, width, height; + int32 x, y, width, height; x = _posX; y = _posY; @@ -981,8 +981,8 @@ void AdObject::talk(const char *text, const char *sound, uint32 duration, const } - x = MIN(MAX(0, x), _gameRef->_renderer->getWidth() - width); - y = MIN(MAX(0, y), _gameRef->_renderer->getHeight() - height); + x = MIN(MAX(0, x), _gameRef->_renderer->getWidth() - width); + y = MIN(MAX(0, y), _gameRef->_renderer->getHeight() - height); _sentence->_width = width; diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index df86bce29c..a589bf3a30 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.cpp @@ -187,7 +187,7 @@ bool AdResponseBox::createButtons() { // make the responses touchable if (_gameRef->_touchInterface) { - btn->_height = MAX(btn->_height, 50); + btn->_height = MAX(btn->_height, 50); } //btn->SetListener(this, btn, _responses[i]->_iD); diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index e3f198bdd2..4d0068fad1 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -976,14 +976,14 @@ bool AdScene::traverseNodes(bool doUpdate) { ////////////////////////////////////////////////////////////////////////// - int viewportWidth, viewportHeight; + int32 viewportWidth, viewportHeight; getViewportSize(&viewportWidth, &viewportHeight); - int viewportX, viewportY; + int32 viewportX, viewportY; getViewportOffset(&viewportX, &viewportY); - int scrollableX = _width - viewportWidth; - int scrollableY = _height - viewportHeight; + int32 scrollableX = _width - viewportWidth; + int32 scrollableY = _height - viewportHeight; double widthRatio = scrollableX <= 0 ? 0 : ((double)(_offsetLeft) / (double)scrollableX); double heightRatio = scrollableY <= 0 ? 0 : ((double)(_offsetTop) / (double)scrollableY); @@ -1272,16 +1272,16 @@ bool AdScene::update() { ////////////////////////////////////////////////////////////////////////// void AdScene::scrollTo(int offsetX, int offsetY) { - int viewportWidth, viewportHeight; + int32 viewportWidth, viewportHeight; getViewportSize(&viewportWidth, &viewportHeight); - int origOffsetLeft = _targetOffsetLeft; - int origOffsetTop = _targetOffsetTop; + int32 origOffsetLeft = _targetOffsetLeft; + int32 origOffsetTop = _targetOffsetTop; - _targetOffsetLeft = MAX(0, offsetX - viewportWidth / 2); + _targetOffsetLeft = MAX(0, offsetX - viewportWidth / 2); _targetOffsetLeft = MIN(_targetOffsetLeft, _width - viewportWidth); - _targetOffsetTop = MAX(0, offsetY - viewportHeight / 2); + _targetOffsetTop = MAX(0, offsetY - viewportHeight / 2); _targetOffsetTop = MIN(_targetOffsetTop, _height - viewportHeight); @@ -1317,13 +1317,13 @@ void AdScene::skipToObject(BaseObject *object) { ////////////////////////////////////////////////////////////////////////// void AdScene::skipTo(int offsetX, int offsetY) { - int viewportWidth, viewportHeight; + int32 viewportWidth, viewportHeight; getViewportSize(&viewportWidth, &viewportHeight); - _offsetLeft = MAX(0, offsetX - viewportWidth / 2); + _offsetLeft = MAX(0, offsetX - viewportWidth / 2); _offsetLeft = MIN(_offsetLeft, _width - viewportWidth); - _offsetTop = MAX(0, offsetY - viewportHeight / 2); + _offsetTop = MAX(0, offsetY - viewportHeight / 2); _offsetTop = MIN(_offsetTop, _height - viewportHeight); _targetOffsetLeft = _offsetLeft; @@ -1866,7 +1866,7 @@ ScValue *AdScene::scGetProperty(const Common::String &name) { // MouseX (RO) ////////////////////////////////////////////////////////////////////////// else if (name == "MouseX") { - int viewportX; + int32 viewportX; getViewportOffset(&viewportX); _scValue->setInt(_gameRef->_mousePos.x + _offsetLeft - viewportX); @@ -1877,7 +1877,7 @@ ScValue *AdScene::scGetProperty(const Common::String &name) { // MouseY (RO) ////////////////////////////////////////////////////////////////////////// else if (name == "MouseY") { - int viewportY; + int32 viewportY; getViewportOffset(nullptr, &viewportY); _scValue->setInt(_gameRef->_mousePos.y + _offsetTop - viewportY); @@ -2057,10 +2057,10 @@ bool AdScene::scSetProperty(const char *name, ScValue *value) { else if (strcmp(name, "OffsetX") == 0) { _offsetLeft = value->getInt(); - int viewportWidth, viewportHeight; + int32 viewportWidth, viewportHeight; getViewportSize(&viewportWidth, &viewportHeight); - _offsetLeft = MAX(0, _offsetLeft - viewportWidth / 2); + _offsetLeft = MAX(0, _offsetLeft - viewportWidth / 2); _offsetLeft = MIN(_offsetLeft, _width - viewportWidth); _targetOffsetLeft = _offsetLeft; @@ -2073,10 +2073,10 @@ bool AdScene::scSetProperty(const char *name, ScValue *value) { else if (strcmp(name, "OffsetY") == 0) { _offsetTop = value->getInt(); - int viewportWidth, viewportHeight; + int32 viewportWidth, viewportHeight; getViewportSize(&viewportWidth, &viewportHeight); - _offsetTop = MAX(0, _offsetTop - viewportHeight / 2); + _offsetTop = MAX(0, _offsetTop - viewportHeight / 2); _offsetTop = MIN(_offsetTop, _height - viewportHeight); _targetOffsetTop = _offsetTop; @@ -2361,10 +2361,10 @@ bool AdScene::afterLoad() { } ////////////////////////////////////////////////////////////////////////// -bool AdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, BaseObject *requester) { +bool AdScene::correctTargetPoint2(int32 startX, int32 startY, int32 *targetX, int32 *targetY, bool checkFreeObjects, BaseObject *requester) { double xStep, yStep, x, y; - int xLength, yLength, xCount, yCount; - int x1, y1, x2, y2; + int32 xLength, yLength, xCount, yCount; + int32 x1, y1, x2, y2; x1 = *targetX; y1 = *targetY; @@ -2407,9 +2407,9 @@ bool AdScene::correctTargetPoint2(int startX, int startY, int *targetX, int *tar } ////////////////////////////////////////////////////////////////////////// -bool AdScene::correctTargetPoint(int startX, int startY, int *argX, int *argY, bool checkFreeObjects, BaseObject *requester) { - int x = *argX; - int y = *argY; +bool AdScene::correctTargetPoint(int32 startX, int32 startY, int32 *argX, int32 *argY, bool checkFreeObjects, BaseObject *requester) { + int32 x = *argX; + int32 y = *argY; if (isWalkableAt(x, y, checkFreeObjects, requester) || !_mainLayer) { return STATUS_OK; @@ -2522,7 +2522,7 @@ void AdScene::pfPointsAdd(int x, int y, int distance) { ////////////////////////////////////////////////////////////////////////// -bool AdScene::getViewportOffset(int *offsetX, int *offsetY) { +bool AdScene::getViewportOffset(int32 *offsetX, int32 *offsetY) { AdGame *adGame = (AdGame *)_gameRef; if (_viewport && !_gameRef->_editorMode) { if (offsetX) { @@ -2551,7 +2551,7 @@ bool AdScene::getViewportOffset(int *offsetX, int *offsetY) { ////////////////////////////////////////////////////////////////////////// -bool AdScene::getViewportSize(int *width, int *height) { +bool AdScene::getViewportSize(int32 *width, int32 *height) { AdGame *adGame = (AdGame *)_gameRef; if (_viewport && !_gameRef->_editorMode) { if (width) { @@ -2581,7 +2581,7 @@ bool AdScene::getViewportSize(int *width, int *height) { ////////////////////////////////////////////////////////////////////////// int AdScene::getOffsetLeft() { - int viewportX; + int32 viewportX; getViewportOffset(&viewportX); return _offsetLeft - viewportX; @@ -2590,7 +2590,7 @@ int AdScene::getOffsetLeft() { ////////////////////////////////////////////////////////////////////////// int AdScene::getOffsetTop() { - int viewportY; + int32 viewportY; getViewportOffset(nullptr, &viewportY); return _offsetTop - viewportY; @@ -2599,7 +2599,7 @@ int AdScene::getOffsetTop() { ////////////////////////////////////////////////////////////////////////// bool AdScene::pointInViewport(int x, int y) { - int left, top, width, height; + int32 left, top, width, height; getViewportOffset(&left, &top); getViewportSize(&width, &height); diff --git a/engines/wintermute/ad/ad_scene.h b/engines/wintermute/ad/ad_scene.h index d418f4e58f..cd144b77ef 100644 --- a/engines/wintermute/ad/ad_scene.h +++ b/engines/wintermute/ad/ad_scene.h @@ -67,16 +67,16 @@ public: bool pointInViewport(int x, int y); int getOffsetTop(); int getOffsetLeft(); - bool getViewportSize(int *width = nullptr, int *height = nullptr); - bool getViewportOffset(int *offsetX = nullptr, int *offsetY = nullptr); + bool getViewportSize(int32 *width = nullptr, int32 *height = nullptr); + bool getViewportOffset(int32 *offsetX = nullptr, int32 *offsetY = nullptr); BaseViewport *_viewport; BaseFader *_fader; int32 _pfPointsNum; void pfPointsAdd(int x, int y, int distance); void pfPointsStart(); bool _initialized; - bool correctTargetPoint(int startX, int startY, int *x, int *y, bool checkFreeObjects = false, BaseObject *requester = nullptr); - bool correctTargetPoint2(int startX, int startY, int *targetX, int *targetY, bool checkFreeObjects, BaseObject *requester); + bool correctTargetPoint(int32 startX, int32 startY, int32 *x, int32 *y, bool checkFreeObjects = false, BaseObject *requester = nullptr); + bool correctTargetPoint2(int32 startX, int32 startY, int32 *targetX, int32 *targetY, bool checkFreeObjects, BaseObject *requester); DECLARE_PERSISTENT(AdScene, BaseObject) bool displayRegionContent(AdRegion *region = nullptr, bool display3DOnly = false); bool displayRegionContentOld(AdRegion *region = nullptr); diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp index 196a7acd0b..70a57a624d 100644 --- a/engines/wintermute/ad/ad_sentence.cpp +++ b/engines/wintermute/ad/ad_sentence.cpp @@ -204,8 +204,8 @@ bool AdSentence::display() { } if (_gameRef->_subtitles) { - int x = _pos.x; - int y = _pos.y; + int32 x = _pos.x; + int32 y = _pos.y; if (!_fixedPos) { x = x - ((AdGame *)_gameRef)->_scene->getOffsetLeft(); @@ -213,9 +213,9 @@ bool AdSentence::display() { } - x = MAX(x, 0); + x = MAX(x, 0); x = MIN(x, _gameRef->_renderer->getWidth() - _width); - y = MAX(y, 0); + y = MAX(y, 0); _font->drawText((byte *)_text, x, y, _width, _align); } diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index f5b63e46cc..e97e342149 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -1090,11 +1090,11 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SetMousePos") == 0) { stack->correctParams(2); - int x = stack->pop()->getInt(); - int y = stack->pop()->getInt(); - x = MAX(x, 0); + int32 x = stack->pop()->getInt(); + int32 y = stack->pop()->getInt(); + x = MAX(x, 0); x = MIN(x, _renderer->getWidth()); - y = MAX(y, 0); + y = MAX(y, 0); y = MIN(y, _renderer->getHeight()); Point32 p; p.x = x + _renderer->_drawOffsetX; @@ -2486,7 +2486,7 @@ bool BaseGame::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SoundBufferSize") == 0) { _soundBufferSizeSec = value->getInt(); - _soundBufferSizeSec = MAX(3, _soundBufferSizeSec); + _soundBufferSizeSec = MAX(3, _soundBufferSizeSec); return STATUS_OK; } diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 48c1583f3d..5dbacb157b 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -533,7 +533,7 @@ TimeDate BasePersistenceManager::getTimeDate() { } void BasePersistenceManager::putFloat(float val) { - int32 exponent = 0; + int exponent = 0; float significand = frexp(val, &exponent); Common::String str = Common::String::format("FS%f", significand); _saveStream->writeUint32LE(str.size()); @@ -556,7 +556,7 @@ float BasePersistenceManager::getFloat() { } void BasePersistenceManager::putDouble(double val) { - int32 exponent = 0; + int exponent = 0; double significand = frexp(val, &exponent); Common::String str = Common::String::format("DS%f", significand); _saveStream->writeUint32LE(str.size()); diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index 51d222be4c..2dabe6ae44 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -493,7 +493,7 @@ bool BaseRegion::getBoundingRect(Rect32 *rect) { if (_points.size() == 0) { BasePlatform::setRectEmpty(rect); } else { - int minX = INT_MAX, minY = INT_MAX, maxX = INT_MIN, maxY = INT_MIN; + int32 minX = INT_MAX, minY = INT_MAX, maxX = INT_MIN, maxY = INT_MIN; for (uint32 i = 0; i < _points.size(); i++) { minX = MIN(minX, _points[i]->x); diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp index 4e01fa5251..c920da9ee9 100644 --- a/engines/wintermute/base/base_sprite.cpp +++ b/engines/wintermute/base/base_sprite.cpp @@ -298,8 +298,8 @@ bool BaseSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteCa case TOKEN_EDITOR_BG_ALPHA: parser.scanStr((char *)params, "%d", &_editorBgAlpha); - _editorBgAlpha = MIN(_editorBgAlpha, 255); - _editorBgAlpha = MAX(_editorBgAlpha, 0); + _editorBgAlpha = MIN(_editorBgAlpha, 255); + _editorBgAlpha = MAX(_editorBgAlpha, 0); break; case TOKEN_FRAME: { diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index 557ba74037..f79e5c9f13 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -65,10 +65,10 @@ bool BaseViewport::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// -bool BaseViewport::setRect(int left, int top, int right, int bottom, bool noCheck) { +bool BaseViewport::setRect(int32 left, int32 top, int32 right, int32 bottom, bool noCheck) { if (!noCheck) { - left = MAX(left, 0); - top = MAX(top, 0); + left = MAX(left, 0); + top = MAX(top, 0); right = MIN(right, BaseEngine::instance().getRenderer()->getWidth()); bottom = MIN(bottom, BaseEngine::instance().getRenderer()->getHeight()); } diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h index 75b9989080..584e5a78f9 100644 --- a/engines/wintermute/base/base_viewport.h +++ b/engines/wintermute/base/base_viewport.h @@ -41,7 +41,7 @@ public: int getHeight() const; int getWidth() const; Rect32 *getRect(); - bool setRect(int left, int top, int right, int bottom, bool noCheck = false); + bool setRect(int32 left, int32 top, int32 right, int32 bottom, bool noCheck = false); DECLARE_PERSISTENT(BaseViewport, BaseClass) int32 _offsetY; int32 _offsetX; diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 246c6befb7..63ccfd91a1 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -509,7 +509,7 @@ bool BaseFontTT::persist(BasePersistenceManager *persistMgr) { // persist layers - int numLayers; + int32 numLayers; if (persistMgr->getIsSaving()) { numLayers = _layers.size(); persistMgr->transfer(TMEMBER(numLayers)); diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index cc3955066b..91ca7326cb 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -481,7 +481,7 @@ bool UIEdit::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// if (strcmp(name, "SelStart") == 0) { _selStart = value->getInt(); - _selStart = MAX(_selStart, 0); + _selStart = MAX(_selStart, 0); _selStart = (int)MIN((size_t)_selStart, strlen(_text)); return STATUS_OK; } @@ -491,7 +491,7 @@ bool UIEdit::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// else if (strcmp(name, "SelEnd") == 0) { _selEnd = value->getInt(); - _selEnd = MAX(_selEnd, 0); + _selEnd = MAX(_selEnd, 0); _selEnd = (int)MIN((size_t)_selEnd, strlen(_text)); return STATUS_OK; } @@ -600,8 +600,8 @@ bool UIEdit::display(int offsetX, int offsetY) { bool focused = isFocused(); - _selStart = MAX(_selStart, 0); - _selEnd = MAX(_selEnd, 0); + _selStart = MAX(_selStart, 0); + _selEnd = MAX(_selEnd, 0); _selStart = (int)MIN((size_t)_selStart, strlen(_text)); _selEnd = (int)MIN((size_t)_selEnd, strlen(_text)); @@ -609,11 +609,11 @@ bool UIEdit::display(int offsetX, int offsetY) { //int CursorWidth = font->GetCharWidth(_cursorChar[0]); int cursorWidth = font->getTextWidth((byte *)_cursorChar); - int s1, s2; + int32 s1, s2; bool curFirst; // modify scroll offset if (_selStart >= _selEnd) { - while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selEnd - _scrollOffset)) > _width - cursorWidth - 2 * _frameWidth) { + while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selEnd - _scrollOffset)) > _width - cursorWidth - 2 * _frameWidth) { _scrollOffset++; if (_scrollOffset >= (int)strlen(_text)) { break; @@ -626,8 +626,8 @@ bool UIEdit::display(int offsetX, int offsetY) { s2 = _selStart; curFirst = true; } else { - while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selStart - _scrollOffset)) + - sfont->getTextWidth((byte *)(_text + MAX(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart)) + while (font->getTextWidth((byte *)_text + _scrollOffset, MAX(0, _selStart - _scrollOffset)) + + sfont->getTextWidth((byte *)(_text + MAX(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart)) > _width - cursorWidth - 2 * _frameWidth) { _scrollOffset++; @@ -766,7 +766,7 @@ bool UIEdit::handleKeypress(Common::Event *event, bool printable) { deleteChars(_selStart, _selEnd); } if (_selEnd >= _selStart) { - _selEnd -= MAX(1, _selEnd - _selStart); + _selEnd -= MAX(1, _selEnd - _selStart); } _selStart = _selEnd; -- cgit v1.2.3