mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 15:09:47 +00:00
WINTERMUTE: Use constants from transform_tools for consistency
This commit is contained in:
parent
b6ed5ee816
commit
1b9967400d
@ -32,6 +32,7 @@
|
||||
|
||||
#include "engines/wintermute/coll_templ.h"
|
||||
#include "engines/wintermute/base/base_script_holder.h"
|
||||
#include "engines/wintermute/graphics/transform_tools.h"
|
||||
|
||||
namespace Wintermute {
|
||||
class BaseFrame;
|
||||
@ -44,17 +45,17 @@ public:
|
||||
void setDefaults();
|
||||
DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder)
|
||||
|
||||
bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
|
||||
bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = DEFAULT_ZOOM_X, float scaleY = DEFAULT_ZOOM_Y);
|
||||
int32 _moveY;
|
||||
int32 _moveX;
|
||||
bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
|
||||
bool getCurrentFrame(float zoomX = 100, float zoomY = 100);
|
||||
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);
|
||||
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 = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF);
|
||||
bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = DEFAULT_ZOOM_X, float zoomY = DEFAULT_ZOOM_Y, uint32 alpha = DEFAULT_RGBAMOD);
|
||||
bool _looping;
|
||||
int32 _currentFrame;
|
||||
bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr);
|
||||
|
@ -48,8 +48,9 @@ IMPLEMENT_PERSISTENT(BaseSubFrame, false)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) {
|
||||
_surface = nullptr;
|
||||
_hotspotX = _hotspotY = 0;
|
||||
_alpha = 0xFFFFFFFF;
|
||||
_hotspotX = DEFAULT_HOTSPOT_X;
|
||||
_hotspotY = DEFAULT_HOTSPOT_Y;
|
||||
_alpha = DEFAULT_RGBAMOD;
|
||||
_transparent = 0xFFFF00FF;
|
||||
|
||||
_wantsDefaultRect = false;
|
||||
@ -246,7 +247,7 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl
|
||||
}
|
||||
|
||||
if (registerOwner != nullptr && !_decoration) {
|
||||
if (zoomX == 100 && zoomY == 100) {
|
||||
if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) {
|
||||
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));
|
||||
@ -259,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 != 0xFFFFFFFF) {
|
||||
if (_alpha != DEFAULT_RGBAMOD) {
|
||||
alpha = _alpha;
|
||||
}
|
||||
|
||||
if (rotate != 0.0f) {
|
||||
if (rotate != DEFAULT_ANGLE) {
|
||||
Point32 boxOffset, rotatedHotspot, hotspotOffset, newOrigin;
|
||||
Point32 origin(x, y);
|
||||
Rect32 oldRect = getRect();
|
||||
@ -273,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 == 100 && zoomY == 100) {
|
||||
if (zoomX == DEFAULT_ZOOM_X && zoomY == DEFAULT_ZOOM_Y) {
|
||||
res = _surface->displayTrans(x - _hotspotX, y - _hotspotY, getRect(), alpha, blendMode, _mirrorX, _mirrorY);
|
||||
} else {
|
||||
res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / 100)), (int)(y - _hotspotY * (zoomY / 100)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY);
|
||||
res = _surface->displayTransZoom((int)(x - _hotspotX * (zoomX / DEFAULT_ZOOM_X)), (int)(y - _hotspotY * (zoomY / DEFAULT_ZOOM_Y)), getRect(), zoomX, zoomY, alpha, blendMode, _mirrorX, _mirrorY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,11 +51,11 @@ public:
|
||||
bool endPixelOp() override;
|
||||
|
||||
|
||||
bool displayTransZoom(int x, int y, Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
|
||||
bool displayTrans(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
|
||||
bool displayTransOffset(int x, int y, Rect32 rect, uint32 alpha = 0xFFFFFFFF, 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 = 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 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 = 0xFFFFFFFF, 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 = DEFAULT_RGBAMOD, bool transparent = false, TSpriteBlendMode blendMode = BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
|
||||
bool displayTransform(int x, int y, Rect32 rect, Rect32 newRect, 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;
|
||||
|
Loading…
Reference in New Issue
Block a user