diff options
author | Tobia Tesan | 2013-07-15 22:39:55 +0200 |
---|---|---|
committer | Tobia Tesan | 2013-08-01 00:21:25 +0200 |
commit | d2d72c0110e4e2c265fcc1413958540f182d4353 (patch) | |
tree | 0fc1f91e35c9b84498581ba3cd593ed2993f6d64 /engines | |
parent | 63b8132ea3ec6fe6bcfcb43d1e0c9baf481eab1e (diff) | |
download | scummvm-rg350-d2d72c0110e4e2c265fcc1413958540f182d4353.tar.gz scummvm-rg350-d2d72c0110e4e2c265fcc1413958540f182d4353.tar.bz2 scummvm-rg350-d2d72c0110e4e2c265fcc1413958540f182d4353.zip |
WINTERMUTE: #define to const for TransformStruct defaults
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wintermute/base/base_sprite.h | 8 | ||||
-rw-r--r-- | engines/wintermute/base/base_sub_frame.cpp | 16 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 12 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_surface_osystem.h | 8 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/render_ticket.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/graphics/transform_struct.cpp | 20 | ||||
-rw-r--r-- | engines/wintermute/graphics/transform_struct.h | 22 | ||||
-rw-r--r-- | engines/wintermute/graphics/transform_tools.cpp | 4 |
8 files changed, 47 insertions, 47 deletions
diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index 6badffa827..d464899b04 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -45,17 +45,17 @@ public: void setDefaults(); DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder) - bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = DEFAULT_ZOOM_X, float scaleY = DEFAULT_ZOOM_Y); + bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = kDefaultZoomX, float scaleY = kDefaultZoomY); int32 _moveY; int32 _moveX; - bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y, uint32 alpha = DEFAULT_RGBAMOD, float rotate = DEFAULT_ANGLE, TSpriteBlendMode blendMode = BLEND_NORMAL); - bool getCurrentFrame(float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y); + bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod, float rotate = kDefaultAngle, TSpriteBlendMode blendMode = BLEND_NORMAL); + bool getCurrentFrame(float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY); void reset(); bool isChanged(); bool isFinished(); bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y, uint32 alpha = DEFAULT_RGBAMOD); + bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = kDefaultZoomX, float zoomY = kDefaultZoomY, uint32 alpha = kDefaultRgbaMod); bool _looping; int32 _currentFrame; bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr); diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index f8c4000324..7012c28feb 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -48,9 +48,9 @@ IMPLEMENT_PERSISTENT(BaseSubFrame, false) ////////////////////////////////////////////////////////////////////////// BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) { _surface = nullptr; - _hotspotX = DEFAULT_HOTSPOT_X; - _hotspotY = DEFAULT_HOTSPOT_Y; - _alpha = DEFAULT_RGBAMOD; + _hotspotX = kDefaultHotspotX; + _hotspotY = kDefaultHotspotY; + _alpha = kDefaultRgbaMod; _transparent = 0xFFFF00FF; _wantsDefaultRect = false; @@ -247,7 +247,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl } if (registerOwner != nullptr && !_decoration) { - if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) { + if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + getRect().left, y - _hotspotY + getRect().top, getRect().right - getRect().left, getRect().bottom - getRect().top, zoomX, zoomY, precise)); } else { BaseEngine::getRenderer()->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + getRect().left) * (zoomX / 100)), (int)(y - (_hotspotY + getRect().top) * (zoomY / 100)), (int)((getRect().right - getRect().left) * (zoomX / 100)), (int)((getRect().bottom - getRect().top) * (zoomY / 100)), zoomX, zoomY, precise)); @@ -260,11 +260,11 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl bool res; //if (Alpha==0xFFFFFFFF) Alpha = _alpha; // TODO: better (combine owner's and self alpha) - if (_alpha != DEFAULT_RGBAMOD) { + if (_alpha != kDefaultRgbaMod) { alpha = _alpha; } - if (rotate != DEFAULT_ANGLE) { + if (rotate != kDefaultAngle) { Point32 boxOffset, rotatedHotspot, hotspotOffset, newOrigin; Point32 origin(x, y); Rect32 oldRect = getRect(); @@ -274,10 +274,10 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl newOrigin = origin - newHotspot; res = _surface->displayTransform(newOrigin.x, newOrigin.y, oldRect, newRect, transform); } else { - if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) { + if (zoomX == kDefaultZoomX && zoomY == kDefaultZoomY) { res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY); } else { - res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / DEFAULT_ZOOM_X)), (int)(y - _hotspotY * (zoomY / DEFAULT_ZOOM_Y)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); + res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / kDefaultZoomX)), (int)(y - _hotspotY * (zoomY / kDefaultZoomY)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY); } } diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 02f7f991e1..e01a669a2c 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -321,20 +321,20 @@ bool BaseSurfaceOSystem::endPixelOp() { ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, mirrorX, mirrorY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTrans(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, blendMode, alpha, mirrorX, mirrorY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, blendMode, alpha, mirrorX, mirrorY)); } ////////////////////////////////////////////////////////////////////////// bool BaseSurfaceOSystem::displayTransOffset(int x, int y, Rect32 rect, uint32 alpha, TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY, int offsetX, int offsetY) { _rotation = 0; - return drawSprite(x, y, &rect, nullptr, TransformStruct(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y, DEFAULT_ANGLE, DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); + return drawSprite(x, y, &rect, nullptr, TransformStruct(kDefaultZoomX, kDefaultZoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY, offsetX, offsetY)); } ////////////////////////////////////////////////////////////////////////// @@ -349,7 +349,7 @@ bool BaseSurfaceOSystem::displayZoom(int x, int y, Rect32 rect, float zoomX, flo _rotation = 0; TransformStruct transform; if (transparent) { - transform = TransformStruct(zoomX, zoomY, DEFAULT_ANGLE, DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y, blendMode, alpha, mirrorX, mirrorY); + transform = TransformStruct(zoomX, zoomY, kDefaultAngle, kDefaultHotspotX, kDefaultHotspotY, blendMode, alpha, mirrorX, mirrorY); } else { transform = TransformStruct(zoomX, zoomY, mirrorX, mirrorY); } @@ -414,8 +414,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, position.setWidth(newRect->width()); position.setHeight(newRect->height()); } else { - position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / DEFAULT_ZOOM_X)); - position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / DEFAULT_ZOOM_Y)); + position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / kDefaultZoomX)); + position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / kDefaultZoomY)); } renderer->modTargetRect(&position); diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h index 2e2da3c289..8f38128039 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h @@ -51,11 +51,11 @@ public: bool endPixelOp() override; - bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = DEFAULT_RGBAMOD, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; + bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = kDefaultRgbaMod, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override; bool display(int x, int y, Rect32 rect, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; - bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = DEFAULT_RGBAMOD, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; + bool displayZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = kDefaultRgbaMod, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override; bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, const TransformStruct &transform) override; bool repeatLastDisplayOp(int offsetX, int offsetY, int numTimesX, int numTimesY) override; virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override; diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 7f141aa460..091bb6e58a 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -51,7 +51,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel); } // Then scale it if necessary - if (_transform._angle != DEFAULT_ANGLE) { + if (_transform._angle != kDefaultAngle) { TransparentSurface src(*_surface, false); Graphics::Surface *temp = src.rotoscale(transform); _surface->free(); @@ -67,7 +67,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s } else { _surface = nullptr; - if (transform._angle != DEFAULT_ANGLE) { // Make sure comparison-tickets get the correct width + if (transform._angle != kDefaultAngle) { // Make sure comparison-tickets get the correct width Rect32 newDstRect; Point32 newHotspot; newDstRect = TransformTools::newRect(_srcRect, transform, &newHotspot); diff --git a/engines/wintermute/graphics/transform_struct.cpp b/engines/wintermute/graphics/transform_struct.cpp index c179d42ab1..8edbf765b5 100644 --- a/engines/wintermute/graphics/transform_struct.cpp +++ b/engines/wintermute/graphics/transform_struct.cpp @@ -51,14 +51,14 @@ TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 h TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, TSpriteBlendMode blendMode, uint32 rgbaMod, bool mirrorX, bool mirrorY) { init(Point32(zoomX, zoomY), - DEFAULT_ANGLE, - Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + kDefaultAngle, + Point32(kDefaultHotspotX, kDefaultHotspotY), false, blendMode, rgbaMod, mirrorX, mirrorY, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); + Point32(kDefaultOffsetX, kDefaultOffsetY)); } TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 hotspotX, int32 hotspotY) { @@ -67,20 +67,20 @@ TransformStruct::TransformStruct(int32 zoomX, int32 zoomY, uint32 angle, int32 h Point32(hotspotX, hotspotY), true, BLEND_NORMAL, - DEFAULT_RGBAMOD, + kDefaultRgbaMod, false, false, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); + Point32(kDefaultOffsetX, kDefaultOffsetY)); } TransformStruct::TransformStruct() { - init(Point32(DEFAULT_ZOOM_X, DEFAULT_ZOOM_Y), - DEFAULT_ANGLE, - Point32(DEFAULT_HOTSPOT_X, DEFAULT_HOTSPOT_Y), + init(Point32(kDefaultZoomX, kDefaultZoomY), + kDefaultAngle, + Point32(kDefaultHotspotX, kDefaultHotspotY), true, BLEND_NORMAL, - DEFAULT_RGBAMOD, + kDefaultRgbaMod, false, false, - Point32(DEFAULT_OFFSET_X, DEFAULT_OFFSET_Y)); + Point32(kDefaultOffsetX, kDefaultOffsetY)); } bool TransformStruct::getMirrorX() const { diff --git a/engines/wintermute/graphics/transform_struct.h b/engines/wintermute/graphics/transform_struct.h index 6b021b5cd5..3fec9c0d0d 100644 --- a/engines/wintermute/graphics/transform_struct.h +++ b/engines/wintermute/graphics/transform_struct.h @@ -20,21 +20,21 @@ * */ -#ifndef GRAPHICS_TRANSFORM_STRUCT_H -#define GRAPHICS_TRANSFORM_STRUCT_H +#ifndef WINTERMUTE_TRANSFORM_STRUCT_H +#define WINTERMUTE_TRANSFORM_STRUCT_H #include "engines/wintermute/math/rect32.h" #include "engines/wintermute/dctypes.h" -#define DEFAULT_ZOOM_X 100.0 -#define DEFAULT_ZOOM_Y 100.0 -#define DEFAULT_RGBAMOD 0xFFFFFFFF -#define DEFAULT_HOTSPOT_X 0 -#define DEFAULT_HOTSPOT_Y 0 -#define DEFAULT_OFFSET_X 0 -#define DEFAULT_OFFSET_Y 0 -#define DEFAULT_ANGLE 0 - +const float kDefaultZoomX = 100.0; +const float kDefaultZoomY = 100.0; +const uint32 kDefaultRgbaMod = 0xFFFFFFFF; +const int32 kDefaultHotspotX = 0; +const int32 kDefaultHotspotY = 0; +const int32 kDefaultOffsetX = 0; +const int32 kDefaultOffsetY = 0; +const int32 kDefaultAngle = 0; + namespace Wintermute { /** * Contains all the required information that define a transform. diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 01e8b486ce..1ba48433ef 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -29,8 +29,8 @@ namespace Wintermute { FloatPoint TransformTools::transformPoint(const FloatPoint &point, const float rotate, const Point32 &zoom, const bool mirrorX, const bool mirrorY) { float rotateRad = rotate * M_PI / 180; FloatPoint newPoint; - newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/DEFAULT_ZOOM_X; - newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/DEFAULT_ZOOM_Y; + newPoint.x = (point.x * cos(rotateRad) - point.y * sin(rotateRad))*zoom.x/kDefaultZoomX; + newPoint.y = (point.x * sin(rotateRad) + point.y * cos(rotateRad))*zoom.y/kDefaultZoomY; if (mirrorX) { newPoint.x *= -1; } |