aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui/esper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/bladerunner/ui/esper.cpp')
-rw-r--r--engines/bladerunner/ui/esper.cpp121
1 files changed, 53 insertions, 68 deletions
diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp
index 641415472d..513b980a62 100644
--- a/engines/bladerunner/ui/esper.cpp
+++ b/engines/bladerunner/ui/esper.cpp
@@ -95,13 +95,13 @@ void ESPER::open(Graphics::Surface *surface) {
return;
}
- _surfacePhoto.create(kPhotoWidth, kPhotoHeight, createRGB555());
+ _surfacePhoto.create(kPhotoWidth, kPhotoHeight, gameDataPixelFormat());
- _surfaceViewport.create(_screen.width(), _screen.height(), createRGB555());
+ _surfaceViewport.create(_screen.width(), _screen.height(), screenPixelForrmat());
_viewportNext = _viewport;
- _vm->_mainFont->setColor(0x001F);
+ _vm->_mainFont->setColor(surface->format.RGBToColor(0, 0, 248));
_shapeButton = new Shape(_vm);
if (!_shapeButton->open("ESPBUTTN.SHP", 0)) {
@@ -562,7 +562,7 @@ void ESPER::draw(Graphics::Surface &surface) {
drawPhotoOpening(surface);
break;
case kEsperMainStateClear:
- surface.fillRect(_screen, 0x0000);
+ surface.fillRect(_screen, surface.format.RGBToColor(0, 0, 0));
break;
case kEsperMainStatePhoto:
if (_isScrolling) {
@@ -585,7 +585,7 @@ void ESPER::draw(Graphics::Surface &surface) {
viewportXToScreenX(_regions[i].rectInner.right),
viewportYToScreenY(_regions[i].rectInner.bottom)
),
- 0x7FE0
+ surface.format.RGBToColor(248, 248, 0)
);
surface.frameRect(
Common::Rect(
@@ -594,7 +594,7 @@ void ESPER::draw(Graphics::Surface &surface) {
viewportXToScreenX(_regions[i].rectOuter.right),
viewportYToScreenY(_regions[i].rectOuter.bottom)
),
- 0x7FE0
+ surface.format.RGBToColor(248, 248, 0)
);
}
}
@@ -660,10 +660,10 @@ void ESPER::drawPhotoOpening(Graphics::Surface &surface) {
}
copyImageScale(&_surfacePhoto, _viewport, &surface, Common::Rect(_screen.left, _screen.top, _photoOpeningWidth, _photoOpeningHeight));
- surface.hLine(_screen.left, _photoOpeningHeight, _screen.right - 1, 0x03E0);
- surface.vLine(_photoOpeningWidth, _screen.top, _screen.bottom - 1, 0x03E0);
- surface.hLine(_screen.left, _photoOpeningHeight - 1, _screen.right - 1, 0x0240);
- surface.vLine(_photoOpeningWidth - 1, _screen.top, _screen.bottom - 1, 0x0240);
+ surface.hLine(_screen.left, _photoOpeningHeight, _screen.right - 1, surface.format.RGBToColor(0, 248, 0));
+ surface.vLine(_photoOpeningWidth, _screen.top, _screen.bottom - 1, surface.format.RGBToColor(0, 248, 0));
+ surface.hLine(_screen.left, _photoOpeningHeight - 1, _screen.right - 1, surface.format.RGBToColor(0, 144, 0));
+ surface.vLine(_photoOpeningWidth - 1, _screen.top, _screen.bottom - 1, surface.format.RGBToColor(0, 144, 0));
drawGrid(surface);
@@ -818,10 +818,10 @@ void ESPER::drawPhotoSharpening(Graphics::Surface &surface) {
}
drawGrid(surface);
- surface.hLine(_screen.left, _photoOpeningHeight, _screen.right - 1, 0x03E0);
- surface.vLine(_photoOpeningWidth, _screen.top, _screen.bottom - 1, 0x03E0);
- surface.hLine(_screen.left, _photoOpeningHeight - 1, _screen.right - 1, 0x0240);
- surface.vLine(_photoOpeningWidth - 1, _screen.top, _screen.bottom - 1, 0x0240);
+ surface.hLine(_screen.left, _photoOpeningHeight, _screen.right - 1, surface.format.RGBToColor(0, 248, 0));
+ surface.vLine(_photoOpeningWidth, _screen.top, _screen.bottom - 1, surface.format.RGBToColor(0, 248, 0));
+ surface.hLine(_screen.left, _photoOpeningHeight - 1, _screen.right - 1, surface.format.RGBToColor(0, 144, 0));
+ surface.vLine(_photoOpeningWidth - 1, _screen.top, _screen.bottom - 1, surface.format.RGBToColor(0, 144, 0));
if (!needMoreSharpening) {
if (_regionSelectedAck && !_regions[_regionSelected].name.empty()){
setStatePhoto(kEsperPhotoStateVideoShow);
@@ -949,11 +949,11 @@ void ESPER::drawPhoto(Graphics::Surface &surface) {
void ESPER::drawGrid(Graphics::Surface &surface) {
for (int i = 0; i < 7; ++i) {
- surface.drawLine(_screen.left + i * 50, _screen.top, _screen.left + i * 50, _screen.bottom - 1, 0x109C);
+ surface.drawLine(_screen.left + i * 50, _screen.top, _screen.left + i * 50, _screen.bottom - 1, surface.format.RGBToColor(32, 32, 224));
}
for (int i = 0; i < 7; ++i) {
- surface.drawLine(_screen.left, _screen.top + i * 44, _screen.right - 1, _screen.top + i * 44, 0x109C);
+ surface.drawLine(_screen.left, _screen.top + i * 44, _screen.right - 1, _screen.top + i * 44, surface.format.RGBToColor(32, 32, 224));
}
}
@@ -968,9 +968,9 @@ void ESPER::drawSelection(Graphics::Surface &surface, bool crosshair, int style)
int right = CLIP(_selection.right, _screen.left, (int16)(_screen.right - 1));
int bottom = CLIP(_selection.bottom, _screen.top, (int16)(_screen.bottom - 1));
- int color = 0x0240;
+ int color = surface.format.RGBToColor(0, 144, 0);
if (style) {
- color = 0x03E0;
+ color = surface.format.RGBToColor(0, 248, 0);
}
// selection rectangle
@@ -998,7 +998,7 @@ void ESPER::drawSelection(Graphics::Surface &surface, bool crosshair, int style)
// ghosting
if (_selectionCrosshairX != right) {
- surface.vLine(_selectionCrosshairX, _screen.top, _screen.bottom - 1, 0x0240);
+ surface.vLine(_selectionCrosshairX, _screen.top, _screen.bottom - 1, surface.format.RGBToColor(0, 144, 0));
if (abs(_selectionCrosshairX - right) <= 1) {
_selectionCrosshairX = right;
} else {
@@ -1006,7 +1006,7 @@ void ESPER::drawSelection(Graphics::Surface &surface, bool crosshair, int style)
}
}
if (_selectionCrosshairY != bottom) {
- surface.hLine(_screen.left, _selectionCrosshairY, _screen.right - 1, 0x0240);
+ surface.hLine(_screen.left, _selectionCrosshairY, _screen.right - 1, surface.format.RGBToColor(0, 144, 0));
if (abs(_selectionCrosshairY - bottom) <= 1) {
_selectionCrosshairY = bottom;
} else {
@@ -1014,8 +1014,8 @@ void ESPER::drawSelection(Graphics::Surface &surface, bool crosshair, int style)
}
}
- surface.vLine(right, _screen.top, _screen.bottom - 1, 0x03E0);
- surface.hLine(_screen.left, bottom, _screen.right - 1, 0x03E0);
+ surface.vLine(right, _screen.top, _screen.bottom - 1, surface.format.RGBToColor(0, 248, 0));
+ surface.hLine(_screen.left, bottom, _screen.right - 1, surface.format.RGBToColor(0, 248, 0));
}
}
@@ -1026,13 +1026,13 @@ void ESPER::drawVideoFrame(Graphics::Surface &surface) {
void ESPER::drawTextCoords(Graphics::Surface &surface) {
if (_vm->_language == Common::RU_RUS) {
- _vm->_mainFont->drawColor(Common::String::format("gh %04.0f", _zoom / _zoomMin * 2.0f ), surface, 155, 364, 0x001F);
- _vm->_mainFont->drawColor(Common::String::format("dh %04d", 12 * _viewport.top + 98), surface, 260, 364, 0x001F);
- _vm->_mainFont->drawColor(Common::String::format("uh %04d", 12 * _viewport.left + 167), surface, 364, 364, 0x001F);
+ _vm->_mainFont->drawColor(Common::String::format("gh %04.0f", _zoom / _zoomMin * 2.0f ), surface, 155, 364, surface.format.RGBToColor(0, 0, 255));
+ _vm->_mainFont->drawColor(Common::String::format("dh %04d", 12 * _viewport.top + 98), surface, 260, 364, surface.format.RGBToColor(0, 0, 255));
+ _vm->_mainFont->drawColor(Common::String::format("uh %04d", 12 * _viewport.left + 167), surface, 364, 364, surface.format.RGBToColor(0, 0, 255));
} else {
- _vm->_mainFont->drawColor(Common::String::format("ZM %04.0f", _zoom / _zoomMin * 2.0f ), surface, 155, 364, 0x001F);
- _vm->_mainFont->drawColor(Common::String::format("NS %04d", 12 * _viewport.top + 98), surface, 260, 364, 0x001F);
- _vm->_mainFont->drawColor(Common::String::format("EW %04d", 12 * _viewport.left + 167), surface, 364, 364, 0x001F);
+ _vm->_mainFont->drawColor(Common::String::format("ZM %04.0f", _zoom / _zoomMin * 2.0f ), surface, 155, 364, surface.format.RGBToColor(0, 0, 255));
+ _vm->_mainFont->drawColor(Common::String::format("NS %04d", 12 * _viewport.top + 98), surface, 260, 364, surface.format.RGBToColor(0, 0, 255));
+ _vm->_mainFont->drawColor(Common::String::format("EW %04d", 12 * _viewport.left + 167), surface, 364, 364, surface.format.RGBToColor(0, 0, 255));
}
}
@@ -1083,10 +1083,10 @@ void ESPER::drawMouse(Graphics::Surface &surface) {
_isDrawingSelection = false;
}
}
- surface.vLine(p.x, p.y - 8, p.y - 1, 0x03E0);
- surface.vLine(p.x, p.y + 8, p.y + 1, 0x03E0);
- surface.hLine(p.x - 8, p.y, p.x - 1, 0x03E0);
- surface.hLine(p.x + 8, p.y, p.x + 1, 0x03E0);
+ surface.vLine(p.x, p.y - 8, p.y - 1, surface.format.RGBToColor(0, 248, 0));
+ surface.vLine(p.x, p.y + 8, p.y + 1, surface.format.RGBToColor(0, 248, 0));
+ surface.hLine(p.x - 8, p.y, p.x - 1, surface.format.RGBToColor(0, 248, 0));
+ surface.hLine(p.x + 8, p.y, p.x + 1, surface.format.RGBToColor(0, 248, 0));
_mouseOverScroll = -1;
} else if (p.x >= 85 && p.y >= 73 && p.x <= 484 && p.y <= 436) {
if (!_isDrawingSelection && _statePhoto != kEsperPhotoStateVideoShow && _zoom != 2.0f) {
@@ -1121,14 +1121,11 @@ void ESPER::drawMouse(Graphics::Surface &surface) {
void ESPER::flashViewport() {
uint16 *ptr = (uint16 *)_surfaceViewport.getPixels();
- for (int i = 0; i < _surfaceViewport.w * _surfaceViewport.h; ++i) {
- int8 r = (*ptr >> 10) & 0x1F;
- int8 g = (*ptr >> 5) & 0x1F;
- int8 b = (*ptr ) & 0x1F;
- b = MIN(b * 2, 0x1F);
- *ptr = r << 10 | g << 5 | b;
-
- ++ptr;
+ for (int i = 0; i < _surfaceViewport.w * _surfaceViewport.h; ++i, ++ptr) {
+ uint8 r, g, b;
+ _surfaceViewport.format.colorToRGB(*ptr, r, g, b);
+ b *= 2;
+ *ptr = _surfaceViewport.format.RGBToColor(r, g, b);
}
}
@@ -1153,16 +1150,13 @@ void ESPER::copyImageScale(Graphics::Surface *src, Common::Rect srcRect, Graphic
uint16 *srcPtr = (uint16 *)src->getBasePtr(srcX, srcY);
uint16 *dstPtr = (uint16 *)dst->getBasePtr(dstX, dstY);
+ uint8 r, g, b;
+ src->format.colorToRGB(*srcPtr, r, g, b);
if (_flash) {
- int8 r = (*srcPtr >> 10) & 0x1F;
- int8 g = (*srcPtr >> 5) & 0x1F;
- int8 b = (*srcPtr ) & 0x1F;
// add blue-ish tint
- b = MIN(b * 2, 0x1F);
- *dstPtr = r << 10 | g << 5 | b;
- } else {
- *dstPtr = *srcPtr;
+ b *= 2;
}
+ *dstPtr = dst->format.RGBToColor(r, g, b);
srcX += srcDstWidthRatio;
srcXCounter += srcDstWidthRest;
@@ -1195,16 +1189,13 @@ void ESPER::copyImageScale(Graphics::Surface *src, Common::Rect srcRect, Graphic
uint16 *srcPtr = (uint16 *)src->getBasePtr(srcX, srcY);
uint16 *dstPtr = (uint16 *)dst->getBasePtr(dstX, dstY);
+ uint8 r, g, b;
+ src->format.colorToRGB(*srcPtr, r, g, b);
if (_flash) {
- int8 r = (*srcPtr >> 10) & 0x1F;
- int8 g = (*srcPtr >> 5) & 0x1F;
- int8 b = (*srcPtr ) & 0x1F;
// add blue-ish tint
- b = MIN(b * 2, 0x1F);
- *dstPtr = r << 10 | g << 5 | b;
- } else {
- *dstPtr = *srcPtr;
+ b *= 2;
}
+ *dstPtr = dst->format.RGBToColor(r, g, b);
}
srcYCounter += srcRect.height();
@@ -1259,16 +1250,13 @@ void ESPER::copyImageBlur(Graphics::Surface *src, Common::Rect srcRect, Graphics
uint16 *srcPtr = (uint16 *)src->getBasePtr(srcX, srcY);
uint16 *dstPtr = (uint16 *)dst->getBasePtr(dstX, dstY);
+ uint8 r, g, b;
+ src->format.colorToRGB(*srcPtr, r, g, b);
if (_flash) {
- int8 r = (*srcPtr >> 10) & 0x1F;
- int8 g = (*srcPtr >> 5) & 0x1F;
- int8 b = (*srcPtr ) & 0x1F;
// add blue-ish tint
- b = MIN(b * 2, 0x1F);
- *dstPtr = r << 10 | g << 5 | b;
- } else {
- *dstPtr = *srcPtr;
+ b *= 2;
}
+ *dstPtr = dst->format.RGBToColor(r, g, b);
++dstX;
++skipX;
@@ -1329,16 +1317,13 @@ void ESPER::copyImageBlur(Graphics::Surface *src, Common::Rect srcRect, Graphics
uint16 *srcPtr = (uint16 *)src->getBasePtr(srcX, srcY);
uint16 *dstPtr = (uint16 *)dst->getBasePtr(dstX, dstY);
+ uint8 r, g, b;
+ src->format.colorToRGB(*srcPtr, r, g, b);
if (_flash) {
- int8 r = (*srcPtr >> 10) & 0x1F;
- int8 g = (*srcPtr >> 5) & 0x1F;
- int8 b = (*srcPtr ) & 0x1F;
// add blue-ish tint
- b = MIN(b * 2, 0x1F);
- *dstPtr = r << 10 | g << 5 | b;
- } else {
- *dstPtr = *srcPtr;
+ b *= 2;
}
+ *dstPtr = dst->format.RGBToColor(r, g, b);
++dstX;
++skipX;